CoreFiles by mySites.guru
sql-hint.min.js1 lines, 3,724 bytes, from Joomla_4.0.0-beta5-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta4
md5
e43e1b2bfa70998bb5731256e427b77d
sha1
da24e1f6c3934fe44c578f0734df072c88886c4e
sha256
75d3be39c444a8d1a0b4cb2774f36e2fcaa5841e92f8c04a415badf272f7ee52
!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={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},s=t.Pos,a=t.cmpPos;function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function l(t){return"string"==typeof t?t:t.text}function f(t,e){return u(e)&&(e={columns:e}),e.text||(e.text=t),e}function c(t){return e[t.toUpperCase()]}function p(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function d(t,e){var r=t.length,n=l(e).substr(0,r);return t.toUpperCase()===n.toUpperCase()}function g(t,e,r,n){if(u(r))for(var o=0;o<r.length;o++)d(e,r[o])&&t.push(n(r[o]));else for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];d(e,s=s&&!0!==s?s.displayText?{text:s.text,displayText:s.displayText}:s.text:i)&&t.push(n(s))}}function h(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 v(t){for(var e=l(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=p(t)).text=n,t)}function x(t,e){for(var r=t.split(/\s+/),n=0;n<r.length;n++)r[n]&&e(r[n].replace(/[,;]/g,""))}function m(t,e){for(var r=e.doc,n=r.getValue(),o=t.toUpperCase(),u="",l="",f=[],p={start:s(0,0),end:s(e.lastLine(),e.getLineHandle(e.lastLine()).length)},d=n.indexOf(i.QUERY_DIV);-1!=d;)f.push(r.posFromIndex(d)),d=n.indexOf(i.QUERY_DIV,d+1);f.unshift(s(0,0)),f.push(s(e.lastLine(),e.getLineHandle(e.lastLine()).text.length));for(var g=null,h=e.getCursor(),v=0;v<f.length;v++){if((null==g||a(h,g)>0)&&a(h,f[v])<=0){p={start:g,end:f[v]};break}g=f[v]}if(p.start){var m=r.getRange(p.start,p.end,!1);for(v=0;v<m.length;v++){if(x(m[v],function(t){var e=t.toUpperCase();e===o&&c(u)&&(l=u),e!==i.ALIAS_KEYWORD&&(u=t)}),l)break}}return l}t.registerHelper("hint","sql",function(i,a){e=function(t){var e={};if(u(t))for(var r=t.length-1;r>=0;r--){var n=t[r];e[l(n).toUpperCase()]=f(l(n),n)}else if(t)for(var o in t)e[o.toUpperCase()]=f(o,t[o]);return e}(a&&a.tables);var d=a&&a.defaultTable,x=a&&a.disableKeywords;r=d&&c(d),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),d&&!r&&(r=m(d,i)),(r=r||[]).columns&&(r=r.columns);var b,y,C,A=i.getCursor(),q=[],U=i.getTokenAt(A);if(U.end>A.ch&&(U.end=A.ch,U.string=U.string.slice(0,A.ch-U.start)),U.string.match(/^[.`"'\w@][\w$#]*$/g)?(C=U.string,b=U.start,y=U.end):(b=y=A.ch,C=""),"."==C.charAt(0)||C.charAt(0)==o)b=function(t,n,i,a){for(var u=!1,l=[],f=n.start,d=!0;d;)d="."==n.string.charAt(0),u=u||n.string.charAt(0)==o,f=n.start,l.unshift(h(n.string)),"."==(n=a.getTokenAt(s(t.line,n.start))).string&&(d=!0,n=a.getTokenAt(s(t.line,n.start)));var x=l.join(".");g(i,x,e,function(t){return u?v(t):t}),g(i,x,r,function(t){return u?v(t):t}),x=l.pop();var b=l.join("."),y=!1,C=b;if(!c(b)){var A=b;(b=m(b,a))!==A&&(y=!0)}var q=c(b);return q&&q.columns&&(q=q.columns),q&&g(i,x,q,function(t){var e=b;return 1==y&&(e=C),"string"==typeof t?t=e+"."+t:(t=p(t)).text=e+"."+t.text,u?v(t):t}),f}(A,U,q,i);else{var j=function(t,e){return"object"==typeof t?t.className=e:t={text:t,className:e},t};g(q,C,r,function(t){return j(t,"CodeMirror-hint-table CodeMirror-hint-default-table")}),g(q,C,e,function(t){return j(t,"CodeMirror-hint-table")}),x||g(q,C,n,function(t){return j(t.toUpperCase(),"CodeMirror-hint-keyword")})}return{list:q,from:s(A.line,b),to:s(A.line,y)}})});

The same content is in 2 releases, Joomla 4.0.0-beta4 to 4.0.0-beta5. See them all, or every version of this file.