[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/vendor/codemirror/addon/hint/ -> sql-hint.min.js (source)

   1  !function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],t):t(CodeMirror)}((function(t){"use strict";var e,r,n,o,i=";",s="AS",a=t.Pos,u=t.cmpPos;function l(t){return"[object Array]"==Object.prototype.toString.call(t)}function f(t){return"string"==typeof t?t:t.text}function c(t,e){return l(e)&&(e={columns:e}),e.text||(e.text=t),e}function p(t){return e[t.toUpperCase()]}function d(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function g(t,e){var r=t.length,n=f(e).substr(0,r);return t.toUpperCase()===n.toUpperCase()}function h(t,e,r,n){if(l(r))for(var o=0;o<r.length;o++)g(e,r[o])&&t.push(n(r[o]));else for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];g(e,s=s&&!0!==s?s.displayText?{text:s.text,displayText:s.displayText}:s.text:i)&&t.push(n(s))}}function v(t){"."==t.charAt(0)&&(t=t.substr(1));for(var e=t.split(o+o),r=0;r<e.length;r++)e[r]=e[r].replace(new RegExp(o,"g"),"");return e.join(o)}function x(t){for(var e=f(t).split("."),r=0;r<e.length;r++)e[r]=o+e[r].replace(new RegExp(o,"g"),o+o)+o;var n=e.join(".");return"string"==typeof t?n:((t=d(t)).text=n,t)}function m(t,e){for(var r=t.split(/\s+/),n=0;n<r.length;n++)r[n]&&e(r[n].replace(/[`,;]/g,""))}function b(t,e){for(var r=e.doc,n=r.getValue(),o=t.toUpperCase(),l="",f="",c=[],d={start:a(0,0),end:a(e.lastLine(),e.getLineHandle(e.lastLine()).length)},g=n.indexOf(i);-1!=g;)c.push(r.posFromIndex(g)),g=n.indexOf(i,g+1);c.unshift(a(0,0)),c.push(a(e.lastLine(),e.getLineHandle(e.lastLine()).text.length));for(var h=null,v=e.getCursor(),x=0;x<c.length;x++){if((null==h||u(v,h)>0)&&u(v,c[x])<=0){d={start:h,end:c[x]};break}h=c[x]}if(d.start){var b=r.getRange(d.start,d.end,!1);for(x=0;x<b.length;x++){if(m(b[x],(function(t){var e=t.toUpperCase();e===o&&p(l)&&(f=l),e!==s&&(l=t)})),f)break}}return f}t.registerHelper("hint","sql",(function(i,s){e=function(t){var e={};if(l(t))for(var r=t.length-1;r>=0;r--){var n=t[r];e[f(n).toUpperCase()]=c(f(n),n)}else if(t)for(var o in t)e[o.toUpperCase()]=c(o,t[o]);return e}(s&&s.tables);var u=s&&s.defaultTable,g=s&&s.disableKeywords;r=u&&p(u),n=function(e){var r=e.doc.modeOption;return"sql"===r&&(r="text/x-sql"),t.resolveMode(r).keywords}(i),o=function(e){var r=e.doc.modeOption;return"sql"===r&&(r="text/x-sql"),t.resolveMode(r).identifierQuote||"`"}(i),u&&!r&&(r=b(u,i)),(r=r||[]).columns&&(r=r.columns);var m,y,C,q=i.getCursor(),A=[],j=i.getTokenAt(q);if(j.end>q.ch&&(j.end=q.ch,j.string=j.string.slice(0,q.ch-j.start)),j.string.match(/^[.`"'\w@][\w$#]*$/g)?(C=j.string,m=j.start,y=j.end):(m=y=q.ch,C=""),"."==C.charAt(0)||C.charAt(0)==o)m=function(t,n,i,s){for(var u=!1,l=[],f=n.start,c=!0;c;)c="."==n.string.charAt(0),u=u||n.string.charAt(0)==o,f=n.start,l.unshift(v(n.string)),"."==(n=s.getTokenAt(a(t.line,n.start))).string&&(c=!0,n=s.getTokenAt(a(t.line,n.start)));var g=l.join(".");h(i,g,e,(function(t){return u?x(t):t})),h(i,g,r,(function(t){return u?x(t):t})),g=l.pop();var m=l.join("."),y=!1,C=m;if(!p(m)){var q=m;(m=b(m,s))!==q&&(y=!0)}var A=p(m);return A&&A.columns&&(A=A.columns),A&&h(i,g,A,(function(t){var e=m;return 1==y&&(e=C),"string"==typeof t?t=e+"."+t:(t=d(t)).text=e+"."+t.text,u?x(t):t})),f}(q,j,A,i);else{var w=function(t,e){return"object"==typeof t?t.className=e:t={text:t,className:e},t};h(A,C,r,(function(t){return w(t,"CodeMirror-hint-table CodeMirror-hint-default-table")})),h(A,C,e,(function(t){return w(t,"CodeMirror-hint-table")})),g||h(A,C,n,(function(t){return w(t.toUpperCase(),"CodeMirror-hint-keyword")}))}return{list:A,from:a(q.line,m),to:a(q.line,y)}}))}));


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer