joy-query-box
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(e,t,r){e.exports=r(4)()},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("pegjs")},function(e,t){e.exports='// Simple API Query Grammar\n// ==========================\n\n{\n\tfunction parseAnd(res, term){\n \treturn Object.assign(res, term);\n }\n \n function parseOr(res, term){\n \treturn res.$or.push(term)\n }\n \n function parselogicExpr (res, op ,term) {\n \treturn op === \'$and\' ? parseAnd(res, term) : parseOr(res, term);\n }\n \n\tfunction ParseConjExpr(head, tail){\n \tif(!tail.length) return head;\n var result = tail.reduce(function(res, element, ix){\n \tvar op = element[1];\n var term = element[3];\n \n \tif(ix === 0) parselogicExpr(res, op, head);\n parselogicExpr(res, op, term);\n return res;\n },{$or:[]});\n \n if(!result.$or.length) delete result.$or;\n \n return result;\n }\n}\n\nSimpleQuery\t\t= head:IrlExpr tail:(_ LogicOperators _ IrlExpr)* {return ParseConjExpr(head, tail)}\nIrlExpr\t\t\t= ConjExpr / GroupExpr\nGroupExpr\t\t= LP _ exprs:ConjExpr _ RP {return exprs}\nConjExpr\t\t= head:CompExpr tail:(_ LogicOperators _ CompExpr)* {return ParseConjExpr(head, tail)}\nCompExpr \t\t= left:Identifier _ op:CompOperators _ right:Expr { return {[left]: {[op]: right}} }\n\nLogicOperators \t= logicOp:(AndOp / OrOp) {return logicOp}\nAndOp \t\t\t= "&" {return "$and"}\nOrOp\t\t\t= "|" {return "$or" }\nLP\t\t\t\t= "("\nRP\t\t\t\t= ")"\n \nCompOperators \t= Equal / GreaterThanOrEqual / GreaterThan / LessThanOrEqual / LessThan / StartWith / Contains / Like / KeyContains / KeyLike / KeyStartWith\nEqual\t\t\t\t= "="\t {return "$eq"}\nDiff\t\t\t\t= "#"\t {return "$dif"}\nGreaterThan \t\t= ">"\t {return "$gt"} \nGreaterThanOrEqual \t= ">="\t {return "$gte"} \nLessThan \t\t\t= "<"\t {return "$lt"} \nLessThanOrEqual \t= "<="\t {return "$lte"} \nStartWith \t\t\t= "$="\t {return "$startWith"} \nKeyStartWith \t\t= "startwith"\t{return "$startWith"} \nContains \t\t\t= "@="\t {return "$contains"} \nKeyContains = "contains"\t{return "$contains"} \nLike \t\t\t = "%="\t {return "$like"} \nKeyLike \t\t\t= "like" {return "$like"} \n\nExpr = Float / Integer / Identifier / String\n\nIdentifier \t= [a-zA-Z0-9_]+ {return text()}\n\nNumber \t= Float / Integer\nInteger = n:[0-9]+ {return parseInt(n.join(""));}\nFloat\t= left:Integer "." right:Integer { return parseFloat([left.toString(), right.toString()].join("."))}\n\nString \t= "\'" str:ValidStringChar* "\'" {return str.join("")}\nValidStringChar\t= !"\'" c:. { return c;}\n\n_ "whitespace"\n = (" "\n / "\\t"\n / "\\v"\n / "\\f")*'},function(e,t,r){"use strict";var o=r(5);function n(){}function a(){}a.resetWarningCache=n,e.exports=function(){function e(e,t,r,n,a,c){if(c!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:n};return r.PropTypes=r,r}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){e.exports=require("brace")},function(e,t){ace.define("ace/theme/tomorrow",["require","exports","module","ace/lib/dom"],function(e,t,r){t.isDark=!1,t.cssClass="ace-tomorrow",t.cssText=".ace-tomorrow .ace_gutter {background: #f6f6f6;color: #4D4D4C}.ace-tomorrow .ace_print-margin {width: 1px;background: #f6f6f6}.ace-tomorrow {background-color: #FFFFFF;color: #4D4D4C}.ace-tomorrow .ace_cursor {color: #AEAFAD}.ace-tomorrow .ace_marker-layer .ace_selection {background: #D6D6D6}.ace-tomorrow.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;}.ace-tomorrow .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-tomorrow .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #D1D1D1}.ace-tomorrow .ace_marker-layer .ace_active-line {background: #EFEFEF}.ace-tomorrow .ace_gutter-active-line {background-color : #dcdcdc}.ace-tomorrow .ace_marker-layer .ace_selected-word {border: 1px solid #D6D6D6}.ace-tomorrow .ace_invisible {color: #D1D1D1}.ace-tomorrow .ace_keyword,.ace-tomorrow .ace_meta,.ace-tomorrow .ace_storage,.ace-tomorrow .ace_storage.ace_type,.ace-tomorrow .ace_support.ace_type {color: #8959A8}.ace-tomorrow .ace_keyword.ace_operator {color: #3E999F}.ace-tomorrow .ace_constant.ace_character,.ace-tomorrow .ace_constant.ace_language,.ace-tomorrow .ace_constant.ace_numeric,.ace-tomorrow .ace_keyword.ace_other.ace_unit,.ace-tomorrow .ace_support.ace_constant,.ace-tomorrow .ace_variable.ace_parameter {color: #F5871F}.ace-tomorrow .ace_constant.ace_other {color: #666969}.ace-tomorrow .ace_invalid {color: #FFFFFF;background-color: #C82829}.ace-tomorrow .ace_invalid.ace_deprecated {color: #FFFFFF;background-color: #8959A8}.ace-tomorrow .ace_fold {background-color: #4271AE;border-color: #4D4D4C}.ace-tomorrow .ace_entity.ace_name.ace_function,.ace-tomorrow .ace_support.ace_function,.ace-tomorrow .ace_variable {color: #4271AE}.ace-tomorrow .ace_support.ace_class,.ace-tomorrow .ace_support.ace_type {color: #C99E00}.ace-tomorrow .ace_heading,.ace-tomorrow .ace_markup.ace_heading,.ace-tomorrow .ace_string {color: #718C00}.ace-tomorrow .ace_entity.ace_name.ace_tag,.ace-tomorrow .ace_entity.ace_other.ace_attribute-name,.ace-tomorrow .ace_meta.ace_tag,.ace-tomorrow .ace_string.ace_regexp,.ace-tomorrow .ace_variable {color: #C82829}.ace-tomorrow .ace_comment {color: #8E908C}.ace-tomorrow .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bdu3f/BwAlfgctduB85QAAAABJRU5ErkJggg==) right repeat-y}",e("../lib/dom").importCssString(t.cssText,t.cssClass)})},function(e,t,r){"use strict";r.r(t);var o=r(1),n=r.n(o),a=r(0),c=r(2),i=r(3),u=r.n(i);r(6),r(7);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=function(e){function t(){var e;l(this,t);var r=(e=p(this,f(t).call(this))).createKeywordMapper({keyword:"like|contains|startwith|equal|not|between|and|or","constant.language":"true|false","storage.type":"int|numeric|decimal|date|bit|money"},"identifier",!0);return e.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",start:"/\\*",end:"\\*/"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"string",regex:"`.*?`"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\&|\\|>|>=|<|<=|=|%=|@=|\\$="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]},e.normalizeRules(),e}return m(t,window.ace.acequire("ace/mode/text_highlight_rules").TextHighlightRules),t}(),_=function(e){function t(){var e;return l(this,t),(e=p(this,f(t).call(this))).HighlightRules=g,e}return m(t,window.ace.acequire("ace/mode/text").Mode),t}();function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=c.generate(u.a),k=function(e){function t(e){var r,o,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=this,a=b(t).call(this,e),r=!a||"object"!==y(a)&&"function"!=typeof a?w(o):a,E(w(r),"editor",function(){return r.__editor}),E(w(r),"hanleQueryChange",function(e){var t=null,o=null,n="";try{o=(n=e.trim())?O.parse(n):{}}catch(e){t=e}finally{r.props.onSearch(t,o,n)}}),r.aceEditor=n.a.createRef(),r}var r,o,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,n.a.PureComponent),r=t,(o=[{key:"render",value:function(){var e=this.props.className||"flex-fill bg-white border py-2";return n.a.createElement("div",{className:e},n.a.createElement("div",{ref:this.aceEditor,id:"query-text-box"}))}},{key:"componentDidMount",value:function(){var e=this.hanleQueryChange;this.__editor=ace.edit(this.aceEditor.current),this.editor().setOptions({maxLines:1,autoScrollEditorIntoView:!0,highlightActiveLine:!1,printMargin:!1,showGutter:!1,theme:"ace/theme/tomorrow",fontSize:13}),this.editor().commands.addCommand({name:"submit-query",bindKey:{mac:"Enter",win:"Enter"},exec:function(t){return e(t.getSession().getValue())}}),this.editor().getSession().setMode(new _),this.props.queryText&&this.editor().getSession().setValue(this.props.queryText)}}])&&h(r.prototype,o),a&&h(r,a),t}();E(k,"propTypes",{className:a.string,placeholder:a.string,onSearch:a.func.isRequired,queryText:a.string,autoFocus:a.bool});t.default=k}]); | ||
module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([function(e,t,n){e.exports=n(4)()},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("pegjs")},function(e,t){e.exports='// Simple API Query Grammar\n// ==========================\n\n{\n\tfunction parseAnd(res, term){\n \treturn Object.assign(res, term);\n }\n \n function parseOr(res, term){\n \treturn res.$or.push(term)\n }\n \n function parselogicExpr (res, op ,term) {\n \treturn op === \'$and\' ? parseAnd(res, term) : parseOr(res, term);\n }\n \n\tfunction ParseConjExpr(head, tail){\n \tif(!tail.length) return head;\n var result = tail.reduce(function(res, element, ix){\n \tvar op = element[1];\n var term = element[3];\n \n \tif(ix === 0) parselogicExpr(res, op, head);\n parselogicExpr(res, op, term);\n return res;\n },{$or:[]});\n \n if(!result.$or.length) delete result.$or;\n \n return result;\n }\n}\n\nSimpleQuery\t\t= head:IrlExpr tail:(_ LogicOperators _ IrlExpr)* {return ParseConjExpr(head, tail)}\nIrlExpr\t\t\t= ConjExpr / GroupExpr\nGroupExpr\t\t= LP _ exprs:ConjExpr _ RP {return exprs}\nConjExpr\t\t= head:CompExpr tail:(_ LogicOperators _ CompExpr)* {return ParseConjExpr(head, tail)}\nCompExpr \t\t= left:Identifier _ op:CompOperators _ right:Expr { return {[left]: {[op]: right}} }\n\nLogicOperators \t= logicOp:(AndOp / OrOp) {return logicOp}\nAndOp \t\t\t= "&" {return "$and"}\nOrOp\t\t\t= "|" {return "$or" }\nLP\t\t\t\t= "("\nRP\t\t\t\t= ")"\n \nCompOperators \t= Equal / GreaterThanOrEqual / GreaterThan / LessThanOrEqual / LessThan / Contains / Like / StartWith\nEqual\t\t\t\t= "="\t {return "$eq"}\nDiff\t\t\t\t= "#"\t {return "$dif"}\nGreaterThan \t\t= ">"\t {return "$gt"} \nGreaterThanOrEqual \t= ">="\t {return "$gte"} \nLessThan \t\t\t= "<"\t {return "$lt"} \nLessThanOrEqual \t= "<="\t {return "$lte"} \nStartWith \t\t= "startwith"\t{return "$startWith"} \nContains = "contains"\t{return "$contains"} \nLike \t\t\t= "like" {return "$like"} \n\nExpr = Float / Integer / Identifier / String\n\nIdentifier \t= [a-zA-Z0-9_]+ {return text()}\n\nNumber \t= Float / Integer\nInteger = n:[0-9]+ {return parseInt(n.join(""));}\nFloat\t= left:Integer "." right:Integer { return parseFloat([left.toString(), right.toString()].join("."))}\n\nString \t= "\'" str:ValidStringChar* "\'" {return str.join("")}\nValidStringChar\t= !"\'" c:. { return c;}\n\n_ "whitespace"\n = (" "\n / "\\t"\n / "\\v"\n / "\\f")*'},function(e,t,n){"use strict";var o=n(5);function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,i,a){if(a!==o){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){e.exports=require("brace")},function(e,t){ace.define("ace/theme/tomorrow",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-tomorrow",t.cssText=".ace-tomorrow .ace_gutter {background: #f6f6f6;color: #4D4D4C}.ace-tomorrow .ace_print-margin {width: 1px;background: #f6f6f6}.ace-tomorrow {background-color: #FFFFFF;color: #4D4D4C}.ace-tomorrow .ace_cursor {color: #AEAFAD}.ace-tomorrow .ace_marker-layer .ace_selection {background: #D6D6D6}.ace-tomorrow.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;}.ace-tomorrow .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-tomorrow .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #D1D1D1}.ace-tomorrow .ace_marker-layer .ace_active-line {background: #EFEFEF}.ace-tomorrow .ace_gutter-active-line {background-color : #dcdcdc}.ace-tomorrow .ace_marker-layer .ace_selected-word {border: 1px solid #D6D6D6}.ace-tomorrow .ace_invisible {color: #D1D1D1}.ace-tomorrow .ace_keyword,.ace-tomorrow .ace_meta,.ace-tomorrow .ace_storage,.ace-tomorrow .ace_storage.ace_type,.ace-tomorrow .ace_support.ace_type {color: #8959A8}.ace-tomorrow .ace_keyword.ace_operator {color: #3E999F}.ace-tomorrow .ace_constant.ace_character,.ace-tomorrow .ace_constant.ace_language,.ace-tomorrow .ace_constant.ace_numeric,.ace-tomorrow .ace_keyword.ace_other.ace_unit,.ace-tomorrow .ace_support.ace_constant,.ace-tomorrow .ace_variable.ace_parameter {color: #F5871F}.ace-tomorrow .ace_constant.ace_other {color: #666969}.ace-tomorrow .ace_invalid {color: #FFFFFF;background-color: #C82829}.ace-tomorrow .ace_invalid.ace_deprecated {color: #FFFFFF;background-color: #8959A8}.ace-tomorrow .ace_fold {background-color: #4271AE;border-color: #4D4D4C}.ace-tomorrow .ace_entity.ace_name.ace_function,.ace-tomorrow .ace_support.ace_function,.ace-tomorrow .ace_variable {color: #4271AE}.ace-tomorrow .ace_support.ace_class,.ace-tomorrow .ace_support.ace_type {color: #C99E00}.ace-tomorrow .ace_heading,.ace-tomorrow .ace_markup.ace_heading,.ace-tomorrow .ace_string {color: #718C00}.ace-tomorrow .ace_entity.ace_name.ace_tag,.ace-tomorrow .ace_entity.ace_other.ace_attribute-name,.ace-tomorrow .ace_meta.ace_tag,.ace-tomorrow .ace_string.ace_regexp,.ace-tomorrow .ace_variable {color: #C82829}.ace-tomorrow .ace_comment {color: #8E908C}.ace-tomorrow .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bdu3f/BwAlfgctduB85QAAAABJRU5ErkJggg==) right repeat-y}",e("../lib/dom").importCssString(t.cssText,t.cssClass)})},function(e,t){ace.define("ace/snippets/text",["require","exports","module"],function(e,t,n){"use strict";t.snippetText=void 0,t.scope="text"})},function(e,t){ace.define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/anchor","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom","ace/editor"],function(e,t,n){"use strict";var o=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,i=e("./lib/lang"),a=e("./range").Range,s=e("./anchor").Anchor,c=e("./keyboard/hash_handler").HashHandler,l=e("./tokenizer").Tokenizer,p=a.comparePoints,u=function(){this.snippetMap={},this.snippetNameMap={}};(function(){o.implement(this,r),this.getTokenizer=function(){function e(e,t,n){return e=e.substr(1),/^\d+$/.test(e)&&!n.inFormatString?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function t(e){return"(?:[^\\\\"+e+"]|\\\\.)"}return u.$tokenizer=new l({start:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectIf?(n[0].expectIf=!1,n[0].elseBranch=n[0],[n[0]]):":"}},{regex:/\\./,onMatch:function(e,t,n){var o=e[1];return"}"==o&&n.length?e=o:-1!="`$\\".indexOf(o)?e=o:n.inFormatString&&("n"==o?e="\n":"t"==o?e="\n":-1!="ulULE".indexOf(o)&&(e={changeCase:o,local:o>"a"})),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:e},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(t,n,o){var r=e(t.substr(1),0,o);return o.unshift(r[0]),r},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+t("\\|")+"*\\|",onMatch:function(e,t,n){n[0].choices=e.slice(1,-1).split(",")},next:"start"},{regex:"/("+t("/")+"+)/(?:("+t("/")+"*)/)(\\w*):?",onMatch:function(e,t,n){var o=n[0];return o.fmtString=e,e=this.splitRegex.exec(e),o.guard=e[1],o.fmt=e[2],o.flag=e[3],""},next:"start"},{regex:"`"+t("`")+"*`",onMatch:function(e,t,n){return n[0].code=e.splice(1,-1),""},next:"start"},{regex:"\\?",onMatch:function(e,t,n){n[0]&&(n[0].expectIf=!0)},next:"start"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:"/("+t("/")+"+)/",token:"regex"},{regex:"",onMatch:function(e,t,n){n.inFormatString=!0},next:"start"}]}),u.prototype.getTokenizer=function(){return u.$tokenizer},u.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(e,t){if(/^[A-Z]\d+$/.test(t)){var n=t.substr(1);return(this.variables[t[0]+"__"]||{})[n]}if(/^\d+$/.test(t))return(this.variables.__||{})[t];if(t=t.replace(/^TM_/,""),e){var o=e.session;switch(t){case"CURRENT_WORD":var r=o.getWordRange();case"SELECTION":case"SELECTED_TEXT":return o.getTextRange(r);case"CURRENT_LINE":return o.getLine(e.getCursorPosition().row);case"PREV_LINE":return o.getLine(e.getCursorPosition().row-1);case"LINE_INDEX":return e.getCursorPosition().column;case"LINE_NUMBER":return e.getCursorPosition().row+1;case"SOFT_TABS":return o.getUseSoftTabs()?"YES":"NO";case"TAB_SIZE":return o.getTabSize();case"FILENAME":case"FILEPATH":return"";case"FULLNAME":return"Ace"}}},this.variables={},this.getVariableValue=function(e,t){return this.variables.hasOwnProperty(t)?this.variables[t](e,t)||"":this.$getDefaultValue(e,t)||""},this.tmStrFormat=function(e,t,n){var o=t.flag||"",r=t.guard;r=new RegExp(r,o.replace(/[^gi]/,""));var i=this.tokenizeTmSnippet(t.fmt,"formatString"),a=this,s=e.replace(r,function(){a.variables.__=arguments;for(var e=a.resolveVariables(i,n),t="E",o=0;o<e.length;o++){var r=e[o];if("object"==typeof r)if(e[o]="",r.changeCase&&r.local){var s=e[o+1];s&&"string"==typeof s&&("u"==r.changeCase?e[o]=s[0].toUpperCase():e[o]=s[0].toLowerCase(),e[o+1]=s.substr(1))}else r.changeCase&&(t=r.changeCase);else"U"==t?e[o]=r.toUpperCase():"L"==t&&(e[o]=r.toLowerCase())}return e.join("")});return this.variables.__=null,s},this.resolveVariables=function(e,t){for(var n=[],o=0;o<e.length;o++){var r=e[o];if("string"==typeof r)n.push(r);else{if("object"!=typeof r)continue;if(r.skip)a(r);else{if(r.processed<o)continue;if(r.text){var i=this.getVariableValue(t,r.text);i&&r.fmtString&&(i=this.tmStrFormat(i,r)),r.processed=o,null==r.expectIf?i&&(n.push(i),a(r)):i?r.skip=r.elseBranch:a(r)}else null!=r.tabstopId?n.push(r):null!=r.changeCase&&n.push(r)}}}function a(t){var n=e.indexOf(t,o+1);-1!=n&&(o=n)}return n},this.insertSnippetForSelection=function(e,t){var n=e.getCursorPosition(),o=e.session.getLine(n.row),r=e.session.getTabString(),i=o.match(/^\s*/)[0];n.column<i.length&&(i=i.slice(0,n.column)),t=t.replace(/\r/g,"");var a=this.tokenizeTmSnippet(t);a=(a=this.resolveVariables(a,e)).map(function(e){return"\n"==e?e+i:"string"==typeof e?e.replace(/\t/g,r):e});var s=[];a.forEach(function(e,t){if("object"==typeof e){var n=e.tabstopId,o=s[n];if(o||((o=s[n]=[]).index=n,o.value=""),-1===o.indexOf(e)){o.push(e);var r=a.indexOf(e,t+1);if(-1!==r){var i=a.slice(t+1,r);i.some(function(e){return"object"==typeof e})&&!o.value?o.value=i:!i.length||o.value&&"string"==typeof o.value||(o.value=i.join(""))}}}}),s.forEach(function(e){e.length=0});var c={};function l(e){for(var t=[],n=0;n<e.length;n++){var o=e[n];if("object"==typeof o){if(c[o.tabstopId])continue;o=t[e.lastIndexOf(o,n-1)]||{tabstopId:o.tabstopId}}t[n]=o}return t}for(var p=0;p<a.length;p++){var u=a[p];if("object"==typeof u){var d=u.tabstopId,f=a.indexOf(u,p+1);if(c[d])c[d]===u&&(c[d]=null);else{var g=s[d],m="string"==typeof g.value?[g.value]:l(g.value);m.unshift(p+1,Math.max(0,f-p)),m.push(u),c[d]=u,a.splice.apply(a,m),-1===g.indexOf(u)&&g.push(u)}}}var b=0,v=0,x="";a.forEach(function(e){if("string"==typeof e){var t=e.split("\n");t.length>1?(v=t[t.length-1].length,b+=t.length-1):v+=e.length,x+=e}else e.start?e.end={row:b,column:v}:e.start={row:b,column:v}});var w=e.getSelectionRange(),y=e.session.replace(w,x),_=new h(e),T=e.inVirtualSelectionMode&&e.selection.index;_.addTabstops(s,w.start,y,T)},this.insertSnippet=function(e,t){var n=this;if(e.inVirtualSelectionMode)return n.insertSnippetForSelection(e,t);e.forEachSelection(function(){n.insertSnippetForSelection(e,t)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},this.$getScope=function(e){var t=e.session.$mode.$id||"";if("html"===(t=t.split("/").pop())||"php"===t){"php"!==t||e.session.$mode.inlinePhp||(t="html");var n=e.getCursorPosition(),o=e.session.getState(n.row);"object"==typeof o&&(o=o[0]),o.substring&&("js-"==o.substring(0,3)?t="javascript":"css-"==o.substring(0,4)?t="css":"php-"==o.substring(0,4)&&(t="php"))}return t},this.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],o=this.snippetMap;return o[t]&&o[t].includeScopes&&n.push.apply(n,o[t].includeScopes),n.push("_"),n},this.expandWithTab=function(e,t){var n=this,o=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return o&&e.tabstopManager&&e.tabstopManager.tabNext(),o},this.expandSnippetForSelection=function(e,t){var n,o=e.getCursorPosition(),r=e.session.getLine(o.row),i=r.substring(0,o.column),a=r.substr(o.column),s=this.snippetMap;return this.getActiveScopes(e).some(function(e){var t=s[e];return t&&(n=this.findMatchingSnippet(t,i,a)),!!n},this),!!n&&(!(!t||!t.dryRun)||(e.session.doc.removeInLine(o.row,o.column-n.replaceBefore.length,o.column+n.replaceAfter.length),this.variables.M__=n.matchBefore,this.variables.T__=n.matchAfter,this.insertSnippetForSelection(e,n.content),this.variables.M__=this.variables.T__=null,!0))},this.findMatchingSnippet=function(e,t,n){for(var o=e.length;o--;){var r=e[o];if((!r.startRe||r.startRe.test(t))&&((!r.endRe||r.endRe.test(n))&&(r.startRe||r.endRe)))return r.matchBefore=r.startRe?r.startRe.exec(t):[""],r.matchAfter=r.endRe?r.endRe.exec(n):[""],r.replaceBefore=r.triggerRe?r.triggerRe.exec(t)[0]:"",r.replaceAfter=r.endTriggerRe?r.endTriggerRe.exec(n)[0]:"",r}},this.snippetMap={},this.snippetNameMap={},this.register=function(e,t){var n=this.snippetMap,o=this.snippetNameMap,r=this;function a(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function s(e,t,n){return e=a(e),t=a(t),n?(e=t+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=t)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function c(e){e.scope||(e.scope=t||"_"),t=e.scope,n[t]||(n[t]=[],o[t]={});var a=o[t];if(e.name){var c=a[e.name];c&&r.unregister(c),a[e.name]=e}n[t].push(e),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\w/.test(e.tabTrigger)&&(e.guard="\\b"),e.trigger=i.escapeRegExp(e.tabTrigger)),(e.trigger||e.guard||e.endTrigger||e.endGuard)&&(e.startRe=s(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger,"",!0),e.endRe=s(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger,"",!0))}e||(e=[]),e&&e.content?c(e):Array.isArray(e)&&e.forEach(c),this._signal("registerSnippets",{scope:t})},this.unregister=function(e,t){var n=this.snippetMap,o=this.snippetNameMap;function r(e){var r=o[e.scope||t];if(r&&r[e.name]){delete r[e.name];var i=n[e.scope||t],a=i&&i.indexOf(e);a>=0&&i.splice(a,1)}}e.content?r(e):Array.isArray(e)&&e.forEach(r)},this.parseSnippetFile=function(e){e=e.replace(/\r/g,"");for(var t,n=[],o={},r=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;t=r.exec(e);){if(t[1])try{o=JSON.parse(t[1]),n.push(o)}catch(e){}if(t[4])o.content=t[4].replace(/^\t/gm,""),n.push(o),o={};else{var i=t[2],a=t[3];if("regex"==i){var s=/\/((?:[^\/\\]|\\.)*)|$/g;o.guard=s.exec(a)[1],o.trigger=s.exec(a)[1],o.endTrigger=s.exec(a)[1],o.endGuard=s.exec(a)[1]}else"snippet"==i?(o.tabTrigger=a.match(/^\S*/)[0],o.name||(o.name=a)):o[i]=a}}return n},this.getSnippetByName=function(e,t){var n,o=this.snippetNameMap;return this.getActiveScopes(t).some(function(t){var r=o[t];return r&&(n=r[e]),!!n},this),n}}).call(u.prototype);var h=function(e){if(e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=i.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};(function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener("change",this.$onChange),this.editor.removeListener("changeSelection",this.$onChangeSelection),this.editor.removeListener("changeSession",this.$onChangeSession),this.editor.commands.removeListener("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){var t="r"==e.action[0],n=e.start,o=e.end,r=n.row,i=o.row-r,a=o.column-n.column;if(t&&(i=-i,a=-a),!this.$inChange&&t){var s=this.selectedTabstop;if(s&&!s.some(function(e){return p(e.start,n)<=0&&p(e.end,o)>=0}))return this.detach()}for(var c=this.ranges,l=0;l<c.length;l++){var u=c[l];u.end.row<n.row||(t&&p(n,u.start)<0&&p(o,u.end)>0?(this.removeRange(u),l--):(u.start.row==r&&u.start.column>n.column&&(u.start.column+=a),u.end.row==r&&u.end.column>=n.column&&(u.end.column+=a),u.start.row>=r&&(u.start.row+=i),u.end.row>=r&&(u.end.row+=i),p(u.start,u.end)>0&&this.removeRange(u)))}c.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges){this.$inChange=!0;for(var n=this.editor.session,o=n.getTextRange(e.firstNonLinked),r=e.length;r--;){var i=e[r];if(i.linked){var a=t.snippetManager.tmStrFormat(o,i.original);n.replace(i,a)}}this.$inChange=!1}},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(this.editor){for(var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty(),o=this.ranges.length;o--;)if(!this.ranges[o].linked){var r=this.ranges[o].contains(e.row,e.column),i=n||this.ranges[o].contains(t.row,t.column);if(r&&i)return}this.detach()}},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);(n=Math.min(Math.max(n,1),t))==t&&(n=0),this.selectTabstop(n),0===n&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];if(t&&this.addTabstopMarkers(t),this.index=e,(t=this.tabstops[this.index])&&t.length){if(this.selectedTabstop=t,this.editor.inVirtualSelectionMode)this.editor.selection.setRange(t.firstNonLinked);else{var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var o=t.length;o--;)t.hasLinkedRanges&&t[o].linked||n.addRange(t[o].clone(),!0);n.ranges[0]&&n.addRange(n.ranges[0].clone())}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)}},this.addTabstops=function(e,t,n){if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var o=a.fromPoints(n,n);g(o.start,t),g(o.end,t),e[0]=[o],e[0].index=0}var r=[this.index+1,0],i=this.ranges;e.forEach(function(e,n){for(var o=this.$openTabstops[n]||e,s=e.length;s--;){var c=e[s],l=a.fromPoints(c.start,c.end||c.start);f(l.start,t),f(l.end,t),l.original=c,l.tabstop=o,i.push(l),o!=e?o.unshift(l):o[s]=l,c.fmtString?(l.linked=!0,o.hasLinkedRanges=!0):o.firstNonLinked||(o.firstNonLinked=l)}o.firstNonLinked||(o.hasLinkedRanges=!1),o===e&&(r.push(o),this.$openTabstops[n]=o),this.addTabstopMarkers(o)},this),r.length>2&&(this.tabstops.length&&r.push(r.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,r))},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,"ace_snippet-marker","text"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);e.tabstop.splice(t,1),t=this.ranges.indexOf(e),this.ranges.splice(t,1),this.editor.session.removeMarker(e.markerId),e.tabstop.length||(-1!=(t=this.tabstops.indexOf(e.tabstop))&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new c,this.keyboardHandler.bindKeys({Tab:function(e){t.snippetManager&&t.snippetManager.expandWithTab(e)||e.tabstopManager.tabNext(1)},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1)},Esc:function(e){e.tabstopManager.detach()},Return:function(e){return!1}})}).call(h.prototype);var d={};d.onChange=s.prototype.onChange,d.setPosition=function(e,t){this.pos.row=e,this.pos.column=t},d.update=function(e,t,n){this.$insertRight=n,this.pos=e,this.onChange(t)};var f=function(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row},g=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};e("./lib/dom").importCssString(".ace_snippet-marker { -moz-box-sizing: border-box; box-sizing: border-box; background: rgba(194, 193, 208, 0.09); border: 1px dotted rgba(211, 208, 235, 0.62); position: absolute;}"),t.snippetManager=new u;var m=e("./editor").Editor;(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(m.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"],function(e,t,n){"use strict";var o=e("../virtual_renderer").VirtualRenderer,r=e("../editor").Editor,i=e("../range").Range,a=e("../lib/event"),s=e("../lib/lang"),c=e("../lib/dom"),l=function(e){var t=new o(e);t.$maxLines=4;var n=new r(t);return n.setHighlightActiveLine(!1),n.setShowPrintMargin(!1),n.renderer.setShowGutter(!1),n.renderer.setHighlightGutterLine(!1),n.$mouseHandler.$focusWaitTimout=0,n.$highlightTagPending=!0,n};c.importCssString(".ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line { background-color: #CAD6FA; z-index: 1;}.ace_editor.ace_autocomplete .ace_line-hover { border: 1px solid #abbffe; margin-top: -1px; background: rgba(233,233,253,0.4);}.ace_editor.ace_autocomplete .ace_line-hover { position: absolute; z-index: 2;}.ace_editor.ace_autocomplete .ace_scroller { background: none; border: none; box-shadow: none;}.ace_rightAlignedText { color: gray; display: inline-block; position: absolute; right: 4px; text-align: right; z-index: -1;}.ace_editor.ace_autocomplete .ace_completion-highlight{ color: #000; text-shadow: 0 0 0.01em;}.ace_editor.ace_autocomplete { width: 280px; z-index: 200000; background: #fbfbfb; color: #444; border: 1px lightgray solid; position: fixed; box-shadow: 2px 3px 5px rgba(0,0,0,.2); line-height: 1.4;}"),t.AcePopup=function(e){var t=c.createElement("div"),n=new l(t);e&&e.appendChild(t),t.style.display="none",n.renderer.content.style.cursor="default",n.renderer.setStyle("ace_autocomplete"),n.setOption("displayIndentGuides",!1),n.setOption("dragDelay",150);var o,r=function(){};n.focus=r,n.$isFocused=!0,n.renderer.$cursorLayer.restartTimer=r,n.renderer.$cursorLayer.element.style.opacity=0,n.renderer.$maxLines=8,n.renderer.$keepTextAreaAtCursor=!1,n.setHighlightActiveLine(!1),n.session.highlight(""),n.session.$searchHighlight.clazz="ace_highlight-marker",n.on("mousedown",function(e){var t=e.getDocumentPosition();n.selection.moveToPosition(t),u.start.row=u.end.row=t.row,e.stop()});var p=new i(-1,0,-1,1/0),u=new i(-1,0,-1,1/0);u.id=n.session.addMarker(u,"ace_active-line","fullLine"),n.setSelectOnHover=function(e){e?p.id&&(n.session.removeMarker(p.id),p.id=null):p.id=n.session.addMarker(p,"ace_line-hover","fullLine")},n.setSelectOnHover(!1),n.on("mousemove",function(e){if(o){if(o.x!=e.x||o.y!=e.y){(o=e).scrollTop=n.renderer.scrollTop;var t=o.getDocumentPosition().row;p.start.row!=t&&(p.id||n.setRow(t),d(t))}}else o=e}),n.renderer.on("beforeRender",function(){if(o&&-1!=p.start.row){o.$pos=null;var e=o.getDocumentPosition().row;p.id||n.setRow(e),d(e,!0)}}),n.renderer.on("afterRender",function(){var e=n.getRow(),t=n.renderer.$textLayer,o=t.element.childNodes[e-t.config.firstRow];o!=t.selectedNode&&(t.selectedNode&&c.removeCssClass(t.selectedNode,"ace_selected"),t.selectedNode=o,o&&c.addCssClass(o,"ace_selected"))});var h=function(){d(-1)},d=function(e,t){e!==p.start.row&&(p.start.row=p.end.row=e,t||n.session._emit("changeBackMarker"),n._emit("changeHoverMarker"))};n.getHoveredRow=function(){return p.start.row},a.addListener(n.container,"mouseout",h),n.on("hide",h),n.on("changeSelection",h),n.session.doc.getLength=function(){return n.data.length},n.session.doc.getLine=function(e){var t=n.data[e];return"string"==typeof t?t:t&&t.value||""};var f=n.session.bgTokenizer;return f.$tokenizeRow=function(e){var t=n.data[e],o=[];if(!t)return o;"string"==typeof t&&(t={value:t}),t.caption||(t.caption=t.value||t.name);for(var r,i,a=-1,s=0;s<t.caption.length;s++)i=t.caption[s],a!==(r=t.matchMask&1<<s?1:0)?(o.push({type:t.className||(r?"completion-highlight":""),value:i}),a=r):o[o.length-1].value+=i;if(t.meta){var c=n.renderer.$size.scrollerWidth/n.renderer.layerConfig.characterWidth,l=t.meta;l.length+t.caption.length>c-2&&(l=l.substr(0,c-t.caption.length-3)+"…"),o.push({type:"rightAlignedText",value:l})}return o},f.$updateOnChange=r,f.start=r,n.session.$computeWidth=function(){return this.screenWidth=0},n.$blockScrolling=1/0,n.isOpen=!1,n.isTopdown=!1,n.autoSelect=!0,n.data=[],n.setData=function(e){n.setValue(s.stringRepeat("\n",e.length),-1),n.data=e||[],n.setRow(0)},n.getData=function(e){return n.data[e]},n.getRow=function(){return u.start.row},n.setRow=function(e){e=Math.max(this.autoSelect?0:-1,Math.min(this.data.length,e)),u.start.row!=e&&(n.selection.clearSelection(),u.start.row=u.end.row=e||0,n.session._emit("changeBackMarker"),n.moveCursorTo(e||0,0),n.isOpen&&n._signal("select"))},n.on("changeSelection",function(){n.isOpen&&n.setRow(n.selection.lead.row),n.renderer.scrollCursorIntoView()}),n.hide=function(){this.container.style.display="none",this._signal("hide"),n.isOpen=!1},n.show=function(e,t,r){var i=this.container,a=window.innerHeight,s=window.innerWidth,c=this.renderer,l=c.$maxLines*t*1.4,p=e.top+this.$borderSize;p>a/2&&!r&&p+t+l>a?(c.$maxPixelHeight=p-2*this.$borderSize,i.style.top="",i.style.bottom=a-p+"px",n.isTopdown=!1):(p+=t,c.$maxPixelHeight=a-p-.2*t,i.style.top=p+"px",i.style.bottom="",n.isTopdown=!0),i.style.display="",this.renderer.$textLayer.checkForSizeChanges();var u=e.left;u+i.offsetWidth>s&&(u=s-i.offsetWidth),i.style.left=u+"px",this._signal("show"),o=null,n.isOpen=!0},n.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},n.$imageSize=0,n.$borderSize=1,n}}),ace.define("ace/autocomplete/util",["require","exports","module"],function(e,t,n){"use strict";t.parForEach=function(e,t,n){var o=0,r=e.length;0===r&&n();for(var i=0;i<r;i++)t(e[i],function(e,t){++o===r&&n(e,t)})};var o=/[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;t.retrievePrecedingIdentifier=function(e,t,n){n=n||o;for(var r=[],i=t-1;i>=0&&n.test(e[i]);i--)r.push(e[i]);return r.reverse().join("")},t.retrieveFollowingIdentifier=function(e,t,n){n=n||o;for(var r=[],i=t;i<e.length&&n.test(e[i]);i++)r.push(e[i]);return r},t.getCompletionPrefix=function(e){var t,n=e.getCursorPosition(),o=e.session.getLine(n.row);return e.completers.forEach(function(e){e.identifierRegexps&&e.identifierRegexps.forEach(function(e){!t&&e&&(t=this.retrievePrecedingIdentifier(o,n.column,e))}.bind(this))}.bind(this)),t||this.retrievePrecedingIdentifier(o,n.column)}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/snippets"],function(e,t,n){"use strict";var o=e("./keyboard/hash_handler").HashHandler,r=e("./autocomplete/popup").AcePopup,i=e("./autocomplete/util"),a=(e("./lib/event"),e("./lib/lang")),s=e("./lib/dom"),c=e("./snippets").snippetManager,l=function(){this.autoInsert=!1,this.autoSelect=!0,this.exactMatch=!1,this.gatherCompletionsId=0,this.keyboardHandler=new o,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=a.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=a.delayedCall(this.updateDocTooltip.bind(this),50)};(function(){this.$init=function(){return this.popup=new r(document.body||document.documentElement),this.popup.on("click",function(e){this.insertMatch(),e.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.tooltipTimer.bind(null,null)),this.popup.on("select",this.tooltipTimer.bind(null,null)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup},this.getPopup=function(){return this.popup||this.$init()},this.openPopup=function(e,t,n){this.popup||this.$init(),this.popup.autoSelect=this.autoSelect,this.popup.setData(this.completions.filtered),e.keyBinding.addKeyboardHandler(this.keyboardHandler);var o=e.renderer;if(this.popup.setRow(this.autoSelect?0:-1),n)n&&!t&&this.detach();else{this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize());var r=o.layerConfig.lineHeight,i=o.$cursorLayer.getPixelPosition(this.base,!0);i.left-=this.popup.getTextLeftOffset();var a=e.container.getBoundingClientRect();i.top+=a.top-o.layerConfig.offset,i.left+=a.left-e.renderer.scrollLeft,i.left+=o.gutterWidth,this.popup.show(i,r)}},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener),this.changeTimer.cancel(),this.hideDocTooltip(),this.gatherCompletionsId+=1,this.popup&&this.popup.isOpen&&this.popup.hide(),this.base&&this.base.detach(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(e){var t=this.editor.selection.lead;(t.row!=this.base.row||t.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(e){var t=document.activeElement,n=this.editor.textInput.getElement(),o=e.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(e.relatedTarget),r=this.popup&&this.popup.container;t==n||t.parentNode==r||o||t==this.tooltipNode||e.relatedTarget==n||this.detach()},this.mousedownListener=function(e){this.detach()},this.mousewheelListener=function(e){this.detach()},this.goTo=function(e){var t=this.popup.getRow(),n=this.popup.session.getLength()-1;switch(e){case"up":t=t<=0?n:t-1;break;case"down":t=t>=n?-1:t+1;break;case"start":t=0;break;case"end":t=n}this.popup.setRow(t)},this.insertMatch=function(e,t){if(e||(e=this.popup.getData(this.popup.getRow())),!e)return!1;if(e.completer&&e.completer.insertMatch)e.completer.insertMatch(this.editor,e);else{if(this.completions.filterText)for(var n,o=this.editor.selection.getAllRanges(),r=0;n=o[r];r++)n.start.column-=this.completions.filterText.length,this.editor.session.remove(n);e.snippet?c.insertSnippet(this.editor,e.snippet):this.editor.execCommand("insertstring",e.value||e)}this.detach()},this.commands={Up:function(e){e.completer.goTo("up")},Down:function(e){e.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(e){e.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(e){e.completer.goTo("end")},Esc:function(e){e.completer.detach()},Return:function(e){return e.completer.insertMatch()},"Shift-Return":function(e){e.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(e){var t=e.completer.insertMatch();if(t||e.tabstopManager)return t;e.completer.goTo("down")},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},this.gatherCompletions=function(e,t){var n=e.getSession(),o=e.getCursorPosition(),r=i.getCompletionPrefix(e);this.base=n.doc.createAnchor(o.row,o.column-r.length),this.base.$insertRight=!0;var a=[],s=e.completers.length;return e.completers.forEach(function(c,l){c.getCompletions(e,n,o,r,function(n,o){!n&&o&&(a=a.concat(o)),t(null,{prefix:i.getCompletionPrefix(e),matches:a,finished:0==--s})})}),!0},this.showPopup=function(e){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.on("changeSelection",this.changeListener),e.on("blur",this.blurListener),e.on("mousedown",this.mousedownListener),e.on("mousewheel",this.mousewheelListener),this.updateCompletions()},this.updateCompletions=function(e){if(e&&this.base&&this.completions){var t=this.editor.getCursorPosition(),n=this.editor.session.getTextRange({start:this.base,end:t});if(n==this.completions.filterText)return;return this.completions.setFilter(n),this.completions.filtered.length?1!=this.completions.filtered.length||this.completions.filtered[0].value!=n||this.completions.filtered[0].snippet?void this.openPopup(this.editor,n,e):this.detach():this.detach()}var o=this.gatherCompletionsId;this.gatherCompletions(this.editor,function(t,n){var r=function(){if(n.finished)return this.detach()}.bind(this),i=n.prefix,a=n&&n.matches;if(!a||!a.length)return r();if(0===i.indexOf(n.prefix)&&o==this.gatherCompletionsId){this.completions=new p(a),this.exactMatch&&(this.completions.exactMatch=!0),this.completions.setFilter(i);var s=this.completions.filtered;return s.length&&(1!=s.length||s[0].value!=i||s[0].snippet)?this.autoInsert&&1==s.length&&n.finished?this.insertMatch(s[0]):void this.openPopup(this.editor,i,e):r()}}.bind(this))},this.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},this.updateDocTooltip=function(){var e=this.popup,t=e.data,n=t&&(t[e.getHoveredRow()]||t[e.getRow()]),o=null;return n&&this.editor&&this.popup.isOpen?(this.editor.completers.some(function(e){return e.getDocTooltip&&(o=e.getDocTooltip(n)),o}),o||(o=n),"string"==typeof o&&(o={docText:o}),o&&(o.docHTML||o.docText)?void this.showDocTooltip(o):this.hideDocTooltip()):this.hideDocTooltip()},this.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=s.createElement("div"),this.tooltipNode.className="ace_tooltip ace_doc-tooltip",this.tooltipNode.style.margin=0,this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this));var t=this.tooltipNode;e.docHTML?t.innerHTML=e.docHTML:e.docText&&(t.textContent=e.docText),t.parentNode||document.body.appendChild(t);var n=this.popup,o=n.container.getBoundingClientRect();t.style.top=n.container.style.top,t.style.bottom=n.container.style.bottom,window.innerWidth-o.right<320?(t.style.right=window.innerWidth-o.left+"px",t.style.left=""):(t.style.left=o.right+1+"px",t.style.right=""),t.style.display="block"},this.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),this.tooltipNode){var e=this.tooltipNode;this.editor.isFocused()||document.activeElement!=e||this.editor.focus(),this.tooltipNode=null,e.parentNode&&e.parentNode.removeChild(e)}},this.onTooltipClick=function(e){for(var t=e.target;t&&t!=this.tooltipNode;){if("A"==t.nodeName&&t.href){t.rel="noreferrer",t.target="_blank";break}t=t.parentNode}}}).call(l.prototype),l.startCommand={name:"startAutocomplete",exec:function(e){e.completer||(e.completer=new l),e.completer.autoInsert=!1,e.completer.autoSelect=!0,e.completer.showPopup(e),e.completer.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var p=function(e,t){this.all=e,this.filtered=e,this.filterText=t||"",this.exactMatch=!1};(function(){this.setFilter=function(e){if(e.length>this.filterText&&0===e.lastIndexOf(this.filterText,0))var t=this.filtered;else t=this.all;this.filterText=e,t=(t=this.filterCompletions(t,this.filterText)).sort(function(e,t){return t.exactMatch-e.exactMatch||t.score-e.score});var n=null;t=t.filter(function(e){var t=e.snippet||e.caption||e.value;return t!==n&&(n=t,!0)}),this.filtered=t},this.filterCompletions=function(e,t){var n=[],o=t.toUpperCase(),r=t.toLowerCase();e:for(var i,a=0;i=e[a];a++){var s=i.value||i.caption||i.snippet;if(s){var c,l,p=-1,u=0,h=0;if(this.exactMatch){if(t!==s.substr(0,t.length))continue e}else for(var d=0;d<t.length;d++){var f=s.indexOf(r[d],p+1),g=s.indexOf(o[d],p+1);if((c=f>=0&&(g<0||f<g)?f:g)<0)continue e;(l=c-p-1)>0&&(-1===p&&(h+=10),h+=l),u|=1<<c,p=c}i.matchMask=u,i.exactMatch=h?0:1,i.score=(i.score||0)-h,n.push(i)}}return n}}).call(p.prototype),t.Autocomplete=l,t.FilteredList=p}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(e,t,n){var o=e("../range").Range,r=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function i(e,t){var n=function(e,t){return e.getTextRange(o.fromPoints({row:0,column:0},t)).split(r).length-1}(e,t),i=e.getValue().split(r),a=Object.create(null),s=i[n];return i.forEach(function(e,t){if(e&&e!==s){var o=Math.abs(n-t),r=i.length-o;a[e]?a[e]=Math.max(r,a[e]):a[e]=r}}),a}t.getCompletions=function(e,t,n,o,r){var a=i(t,n);r(null,Object.keys(a).map(function(e){return{caption:e,value:e,score:a[e],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(e,t,n){"use strict";var o=e("../snippets").snippetManager,r=e("../autocomplete").Autocomplete,i=e("../config"),a=e("../lib/lang"),s=e("../autocomplete/util"),c=e("../autocomplete/text_completer"),l={getCompletions:function(e,t,n,o,r){if(t.$mode.completer)return t.$mode.completer.getCompletions(e,t,n,o,r);var i=e.session.getState(n.row);r(null,t.$mode.getCompletions(i,t,n,o))}},p={getCompletions:function(e,t,n,r,i){var a=o.snippetMap,s=[];o.getActiveScopes(e).forEach(function(e){for(var t=a[e]||[],n=t.length;n--;){var o=t[n],r=o.name||o.tabTrigger;r&&s.push({caption:r,snippet:o.content,meta:o.tabTrigger&&!o.name?o.tabTrigger+"⇥ ":"snippet",type:"snippet"})}},this),i(null,s)},getDocTooltip:function(e){"snippet"!=e.type||e.docHTML||(e.docHTML=["<b>",a.escapeHTML(e.caption),"</b>","<hr></hr>",a.escapeHTML(e.snippet)].join(""))}},u=[p,c,l];t.setCompleters=function(e){u.length=0,e&&u.push.apply(u,e)},t.addCompleter=function(e){u.push(e)},t.textCompleter=c,t.keyWordCompleter=l,t.snippetCompleter=p;var h={name:"expandSnippet",exec:function(e){return o.expandWithTab(e)},bindKey:"Tab"},d=function(e,t){f(t.session.$mode)},f=function(e){var t=e.$id;o.files||(o.files={}),g(t),e.modes&&e.modes.forEach(f)},g=function(e){if(e&&!o.files[e]){var t=e.replace("mode","snippets");o.files[e]={},i.loadModule(t,function(t){t&&(o.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=o.parseSnippetFile(t.snippetText)),o.register(t.snippets||[],t.scope),t.includeScopes&&(o.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(e){g("ace/mode/"+e)})))})}},m=function(e){var t=e.editor,n=t.completer&&t.completer.activated;if("backspace"===e.command.name)n&&!s.getCompletionPrefix(t)&&t.completer.detach();else if("insertstring"===e.command.name){s.getCompletionPrefix(t)&&!n&&(t.completer||(t.completer=new r),t.completer.autoInsert=!1,t.completer.showPopup(t))}},b=e("../editor").Editor;e("../config").defineOptions(b.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:u),this.commands.addCommand(r.startCommand)):this.commands.removeCommand(r.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:u),this.commands.on("afterExec",m)):this.commands.removeListener("afterExec",m)},value:!1},enableSnippets:{set:function(e){e?(this.commands.addCommand(h),this.on("changeMode",d),d(0,this)):(this.commands.removeCommand(h),this.off("changeMode",d))},value:!1}})}),ace.acequire(["ace/ext/language_tools"],function(){})},function(e,t,n){"use strict";n.r(t);var o=n(1),r=n.n(o),i=n(0),a=n(2),s=n(3),c=n.n(s);n(6),n(7),n(8),n(9);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=function(e){function t(){var e;p(this,t);var n=(e=u(this,h(t).call(this))).createKeywordMapper({keyword:"like|contains|startwith|equal|not|between|and|or","constant.language":"true|false","storage.type":"int|numeric|decimal|date|bit|money"},"identifier",!0);return e.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",start:"/\\*",end:"\\*/"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"string",regex:"`.*?`"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:n,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\&|>|>=|<|<=|="},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]},e.normalizeRules(),e}return d(t,window.ace.acequire("ace/mode/text_highlight_rules").TextHighlightRules),t}(),m=function(e){function t(){var e;return p(this,t),(e=u(this,h(t).call(this))).HighlightRules=g,e}return d(t,window.ace.acequire("ace/mode/text").Mode),t}();function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var T=[],S=a.generate(c.a),C=function(e){function t(e){var n,o,i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=this,i=x(t).call(this,e),n=!i||"object"!==b(i)&&"function"!=typeof i?w(o):i,_(w(n),"customCompleter",{getCompletions:function(e,t,o,r,i){i(null,n.suggesions)}}),_(w(n),"editor",function(){return n.__editor}),_(w(n),"hanleQueryChange",function(e){var t=null,o=null,r="";try{o=(r=e.trim())?S.parse(r):{}}catch(e){t=e}finally{n.props.onSearch(t,o,r)}}),n.aceEditor=r.a.createRef(),n}var n,o,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}(t,r.a.PureComponent),n=t,(o=[{key:"render",value:function(){var e=this.props.className||"flex-fill bg-white border py-2";return r.a.createElement("div",{className:e},r.a.createElement("div",{ref:this.aceEditor,id:"query-text-box"}))}},{key:"componentDidMount",value:function(){var e=this;this.__editor=window.ace.edit(this.aceEditor.current),this.__editor.$blockScrolling=!0,window.ace.acequire("ace/ext/language_tools").addCompleter(this.customCompleter),this.suggesions=T.concat((this.props.words||[]).map(function(e){var t=e.word;return{caption:t,value:t,meta:e.desc}})),this.editor().setOptions({maxLines:1,autoScrollEditorIntoView:!0,enableBasicAutocompletion:this.customCompleter,enableLiveAutocompletion:!0,enableSnippets:!0,highlightActiveLine:!1,printMargin:!1,showGutter:!1,theme:"ace/theme/tomorrow",fontSize:13}),this.editor().commands.addCommand({name:"submit-query",bindKey:{mac:"Enter",win:"Enter"},exec:function(t){return e.hanleQueryChange(t.getSession().getValue())}}),this.editor().getSession().setMode(new m),this.props.queryText&&this.editor().getSession().setValue(this.props.queryText)}}])&&v(n.prototype,o),i&&v(n,i),t}();_(C,"propTypes",{className:i.string,placeholder:i.string,onSearch:i.func.isRequired,queryText:i.string,autoFocus:i.bool,words:Object(i.arrayOf)(Object(i.shape)({word:i.string.isRequired,desc:i.string.isRequired}))});t.default=C}]); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "joy-query-box", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,6 +6,7 @@ var webpack = require('webpack'); | ||
new WebpackDevServer(webpack(config), { | ||
public: require('os').hostname().toLowerCase() + ':3000', | ||
publicPath: config.output.publicPath, | ||
hot: true, | ||
historyApiFallback: true | ||
}).listen(3000, 'localhost', function (err, result) { | ||
}).listen(3000, '0.0.0.0', function (err, result) { | ||
if (err) { | ||
@@ -15,3 +16,3 @@ return console.log(err); | ||
console.log('Listening at http://localhost:3000/'); | ||
console.log('Listening at http://0.0.0.0:3000/'); | ||
}); |
@@ -6,2 +6,17 @@ import React from 'react'; | ||
const words = [ | ||
{ | ||
word: 'company', | ||
desc: 'Company Name' | ||
}, | ||
{ | ||
word: 'email', | ||
desc: 'Customer Email' | ||
}, | ||
{ | ||
word: 'fortnoxId', | ||
desc: 'Customer Fortnox Account Id' | ||
} | ||
]; | ||
class App extends React.Component { | ||
@@ -13,3 +28,3 @@ state = { | ||
} | ||
render() { | ||
@@ -34,30 +49,39 @@ return ( | ||
</div> | ||
<div className="col-sm"> | ||
<code>>=</code> Greater than or equal | ||
<code> < </code> Less than | ||
</div> | ||
<div className="col-sm"> | ||
<code> < </code> Less than | ||
<code> & </code> And | ||
</div> | ||
</div> | ||
<div className="row"> | ||
<div className="col-sm"> | ||
</div> | ||
<div className="col-sm"> | ||
<code>>=</code> Greater than or equal | ||
</div> | ||
<div className="col-sm"> | ||
<code> <= </code> Less than or equal | ||
</div> | ||
<div className="col-sm"> | ||
<code> | </code> Or | ||
</div> | ||
</div> | ||
<div className="row"> | ||
<div className="col-sm"> | ||
<code> %= </code> Like | ||
<code>like</code> Like | ||
</div> | ||
<div className="col-sm"> | ||
<code> @= </code> Contains | ||
<code>startwith</code> Start With | ||
</div> | ||
<div className="col-sm"> | ||
<code> $= </code> StartWith | ||
<code>contains</code> Contains | ||
</div> | ||
<div className="col-sm"> | ||
<code> & </code> And | ||
</div> | ||
<div className="col-sm"> | ||
<code> | </code> Or | ||
</div> | ||
</div> | ||
</div> | ||
@@ -68,6 +92,7 @@ <div className="panel flex-fill my-2"> | ||
<div className="input-group-prepend"> | ||
<div className="input-group-text">Simple query</div> | ||
<div className="input-group-text">Simple query</div> | ||
</div> | ||
<QueryBox | ||
autoFocus | ||
words={words} | ||
placeholder="type condition here" | ||
@@ -78,3 +103,3 @@ onSearch={this.handleOnSeach} | ||
</div> | ||
</div> | ||
@@ -81,0 +106,0 @@ <div className="card"> |
import React from 'react'; | ||
import { func , string, bool} from 'prop-types'; | ||
import { func, string, bool, arrayOf, shape } from 'prop-types'; | ||
import * as PEG from 'pegjs'; | ||
@@ -7,6 +7,9 @@ import grammar from './gramma.pegjs'; | ||
import 'brace/theme/tomorrow'; | ||
//import ace from 'ace-builds'; | ||
import "brace/snippets/text"; | ||
import 'brace/ext/language_tools'; | ||
import SimpleQueryMode from './simpleQuery.mode'; | ||
const baseSuggestion = [ | ||
]; | ||
const pegparser = PEG.generate(grammar); | ||
@@ -19,3 +22,7 @@ class QueryBox extends React.PureComponent { | ||
queryText: string, | ||
autoFocus: bool | ||
autoFocus: bool, | ||
words: arrayOf(shape({ | ||
word: string.isRequired, | ||
desc: string.isRequired | ||
})) | ||
} | ||
@@ -26,5 +33,11 @@ | ||
this.aceEditor = React.createRef(); | ||
} | ||
} | ||
render(){ | ||
customCompleter = { | ||
getCompletions: (editor, session, pos, prefix, callback) =>{ | ||
callback(null, this.suggesions); | ||
} | ||
} | ||
render() { | ||
const inputClassName = this.props.className || 'flex-fill bg-white border py-2'; | ||
@@ -39,7 +52,19 @@ return ( | ||
componentDidMount() { | ||
const hanleQueryChange = this.hanleQueryChange; | ||
this.__editor = ace.edit(this.aceEditor.current); | ||
this.__editor = window.ace.edit(this.aceEditor.current); | ||
this.__editor.$blockScrolling = true; | ||
let langTools = window.ace.acequire('ace/ext/language_tools'); | ||
langTools.addCompleter(this.customCompleter); | ||
this.suggesions = baseSuggestion.concat((this.props.words || []).map(({ word, desc }) => ({ | ||
caption: word, | ||
value: word, | ||
meta: desc | ||
}))); | ||
this.editor().setOptions({ | ||
maxLines: 1, | ||
autoScrollEditorIntoView: true, | ||
enableBasicAutocompletion: this.customCompleter, | ||
enableLiveAutocompletion: true, | ||
enableSnippets: true, | ||
highlightActiveLine: false, | ||
@@ -49,3 +74,3 @@ printMargin: false, | ||
theme: "ace/theme/tomorrow", | ||
fontSize: 13, | ||
fontSize: 13 | ||
}); | ||
@@ -55,10 +80,10 @@ this.editor().commands.addCommand({ | ||
bindKey: { | ||
mac: "Enter", | ||
win: "Enter" | ||
mac: "Enter", | ||
win: "Enter" | ||
}, | ||
exec: editor => hanleQueryChange(editor.getSession().getValue()) | ||
exec: editor => this.hanleQueryChange(editor.getSession().getValue()) | ||
}); | ||
this.editor().getSession().setMode(new SimpleQueryMode()); | ||
this.props.queryText && this.editor().getSession().setValue(this.props.queryText); | ||
} | ||
@@ -74,8 +99,8 @@ | ||
freetext = val.trim(); | ||
parsed = freetext ? pegparser.parse(freetext): {}; | ||
parsed = freetext ? pegparser.parse(freetext) : {}; | ||
} | ||
catch(e) { | ||
catch (e) { | ||
err = e; | ||
} finally{ | ||
this.props.onSearch(err, parsed, freetext); | ||
} finally { | ||
this.props.onSearch(err, parsed, freetext); | ||
} | ||
@@ -82,0 +107,0 @@ } |
@@ -42,3 +42,3 @@ | ||
token : "keyword.operator", | ||
regex : "\\&|\\|>|>=|<|<=|=|%=|@=|\\$=" | ||
regex : "\\&|>|>=|<|<=|=" | ||
}, { | ||
@@ -45,0 +45,0 @@ token : "paren.lparen", |
@@ -6,3 +6,3 @@ const webpack = require('webpack'); | ||
'./src/example/index.jsx', | ||
'webpack-dev-server/client?http://localhost:3000', | ||
`webpack-dev-server/client?http://${require('os').hostname().toLowerCase()}:3000'`, | ||
'webpack/hot/only-dev-server' | ||
@@ -43,2 +43,3 @@ ], | ||
devServer: { | ||
host: '0.0.0.0', | ||
contentBase: './dist', | ||
@@ -45,0 +46,0 @@ hot:true |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
347207
567