New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@syncfusion/ej2-querybuilder

Package Overview
Dependencies
Maintainers
2
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syncfusion/ej2-querybuilder - npm Package Compare versions

Comparing version 16.4.40-beta to 16.4.42

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

## 16.4.40-beta (2018-12-10)
### QueryBuilder

@@ -7,0 +9,0 @@

4

dist/ej2-querybuilder.umd.min.js
/*!
* filename: ej2-querybuilder.umd.min.js
* version : 16.4.40-beta
* version : 16.4.42
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.

@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-calendars"),require("@syncfusion/ej2-splitbuttons"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-buttons","@syncfusion/ej2-dropdowns","@syncfusion/ej2-data","@syncfusion/ej2-inputs","@syncfusion/ej2-calendars","@syncfusion/ej2-splitbuttons","@syncfusion/ej2-popups"],t):t(e.ej={},e.ej2Base,e.ej2Buttons,e.ej2Dropdowns,e.ej2Data,e.ej2Inputs,e.ej2Calendars,e.ej2Splitbuttons,e.ej2Popups)}(this,function(e,t,r,n,l,o,i,s,a){"use strict";var u=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),p=function(e,t,r,n){var l,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(i=(o<3?l(i):o>3?l(t,r,i):l(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};n.MultiSelect.Inject(n.CheckBoxSelection);var d=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"values",void 0),p([t.Property(null)],r.prototype,"operators",void 0),p([t.Property(null)],r.prototype,"template",void 0),p([t.Property(null)],r.prototype,"validation",void 0),p([t.Property(null)],r.prototype,"format",void 0),p([t.Property(null)],r.prototype,"step",void 0),r}(t.ChildProperty),c=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"operator",void 0),p([t.Property(null)],r.prototype,"value",void 0),r}(t.ChildProperty),h=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("and")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),r}(t.ChildProperty),m=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(!0)],r.prototype,"ruleDelete",void 0),p([t.Property(!0)],r.prototype,"groupInsert",void 0),p([t.Property(!0)],r.prototype,"groupDelete",void 0),r}(t.ChildProperty),y=function(e){function d(r,n){var l=e.call(this,r,n)||this;return l.groupIdCounter=0,l.ruleIdCounter=0,l.btnGroupId=0,l.isImportRules=!1,l.parser=[],l.intl=new t.Internationalization,l.customOperators={},l.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE"},l.operatorValue={equal:"Equal",greaterthan:"GreaterThan",greaterthanorequal:"GreaterThanOrEqual",lessthan:"LessThan",lessthanorequal:"LessThanOrEqual",notequal:"NotEqual",empty:"Empty",notempty:"NotEmpty",between:"Between",in:"in",notin:"NotIn",notbetween:"NotBetween",startswith:"StartsWith",endswith:"EndsWith",contains:"Contains"},l.validationRules={},l}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;var e=this.element.querySelector(".e-group-body");t.detach(e.children[0]),e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_e_group0"]=[0],this.rule={condition:"and",rules:[]}},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.initialize=function(){if(this.dataSource.length){var e=Object.keys(this.dataSource[0]),t=[],r=void 0,n=!1,o=void 0;if(this.columns.length){"descending"===this.sortDirection.toLowerCase()?this.columns=new l.DataManager(this.columns).executeLocal((new l.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new l.DataManager(this.columns).executeLocal((new l.Query).sortBy("field")));for(var i=this.columns,s=0,a=i.length;s<a;s++)i[s].type||(e.indexOf(i[s].field)>-1&&("string"===(r=typeof(o=this.dataSource[0][i[s].field]))?n=!isNaN(Date.parse(o)):"object"===r&&(n=o instanceof Date&&!isNaN(o.getTime()),r="string"),i[s].type=r,n=!1),r="string")}else{for(s=0,a=e.length;s<a;s++)"string"===(r=typeof(o=this.dataSource[0][e[s]]))?n=!isNaN(Date.parse(o)):"object"===r&&(n=o instanceof Date&&!isNaN(o.getTime()),r="string"),t[s]={field:e[s],label:e[s],type:n?"date":r},n=!1;this.columns=t}}},d.prototype.clickEventHandler=function(e){var r=e.target;if(this.isImportRules=!1,"SPAN"===r.tagName&&(r=r.parentElement),"BUTTON"===r.tagName)if(r.className.indexOf("e-removerule")>-1)r.className.indexOf("e-tooltip")>-1&&t.getComponent(r,"tooltip").destroy(),this.deleteRule(r);else if(r.className.indexOf("e-deletegroup")>-1)t.getComponent(r,"tooltip").destroy(),this.deleteGroup(t.closest(r,".e-group-container"));else if(r.className.indexOf("e-edit-rule")>-1)if(document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition);var n=t.extend({},this.rule,{},!0);this.setGroupRules(n),this.renderSummaryCollapse()}else{(l=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),l.style.display="block"}else if(r.className.indexOf("e-collapse-rule")>-1){var l;(l=this.element.querySelector(".e-group-container")).style.display="none",this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),document.getElementById(this.element.id+"_summary_content").style.display="block"}else r.className.indexOf("e-collapse-rule")>-1&&(this.element.querySelector(".e-group-container").style.display="none",this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),document.getElementById(this.element.id+"_summary_content").style.display="block");else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1){var o=t.closest(r,".e-group-container"),i={groupID:o.id,selectedItem:r,cancel:!1};this.trigger("beforeConditionChange",i);this.getGroup(o).condition=r.textContent.toLowerCase(),i={groupID:o.id,selectedItem:r},this.trigger("conditionChanged",i)}},d.prototype.selectBtn=function(e,r){"beforeOpen"===r.name?t.addClass([r.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide1"):r.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):r.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},d.prototype.addRuleElement=function(e,r){var l=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?l.className="e-rule-container e-vertical-mode":l.className="e-rule-container e-horizontal-mode";var o,i,s,u,p,d,c=e.querySelector(".e-rule-list"),h=l.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)h.textContent=this.l10n.getConstant("Remove");else{t.addClass([h],"e-round"),t.addClass([h],"e-icon-btn");new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(h),h=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),l.querySelector("button").appendChild(h)}if(l.setAttribute("id",e.id+"_e_rule"+this.ruleIdCounter),this.ruleIdCounter++,l.querySelector(".e-filter-input").setAttribute("id",l.id+"_filterkey"),c.appendChild(l),d=this.element.className.indexOf("e-device")>-1?"250px":"200px",(p=new n.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?d:"auto",change:this.changeField.bind(this),value:r?r.field:null})).appendTo("#"+l.id+"_filterkey"),this.allowValidation&&(l.querySelector(".e-filter-input").setAttribute("name",l.id+"field"),t.addClass([l.querySelector(".e-filter-input")],"e-error"),this.validationRules[l.id+"field"]={required:!0}),this.filterIndex=p.index,o=this.levelColl[e.id],!this.isImportRules){for(i=this.rule,s=0,u=o.length;s<u;s++)i=this.findGroupByIdx(o[s],i,0===s);Object.keys(r).length?i.rules.push({field:r.field,type:r.type,label:r.label,operator:r.operator,value:r.value}):i.rules.push({field:"",type:"",label:"",operator:"",value:[]})}Object.keys(r).length&&this.changeRule(r,{element:p.element,itemData:this.columns[this.filterIndex]})},d.prototype.validateFields=function(){var e,r,n,l,o,i,s=Object.keys(this.validationRules),a=s.length;for(e=0;e<a;e++)if(r=this.element.querySelector("[name="+s[e]+" ]")){for(n=t.closest(r,".e-group-container"),l=this.getGroup(n),o=t.closest(r,".e-rule-container"),i=0;o&&null!==o.previousElementSibling;)o=o.previousElementSibling,i++;t.closest(r,".e-rule-filter")&&(l.rules[i].field?t.removeClass([r.parentElement],"e-error"):t.addClass([r.parentElement],"e-error")),t.closest(r,".e-rule-operator")&&(l.rules[i].operator?t.removeClass([r.parentElement],"e-error"):t.addClass([r.parentElement],"e-error")),t.closest(r,".e-rule-value")&&(l.rules[i].value?t.removeClass([r.parentElement],"e-error"):t.addClass([r.parentElement],"e-error"))}},d.prototype.groupTemplate=function(){var e,t,r,n,l,o,i,s,a;return e=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),t=this.createElement("div",{attrs:{class:"e-group-body"}}),n=this.createElement("div",{attrs:{class:"e-rule-list"}}),e.appendChild(r),t.appendChild(n),e.appendChild(t),l=this.createElement("div",{attrs:{class:"e-btn-group"}}),(o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),l.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl"},innerHTML:"AND"}),l.appendChild(i),o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),l.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl"},innerHTML:"OR"}),l.appendChild(i),r.appendChild(l),s=this.createElement("div",{attrs:{class:"e-group-action"}}),a=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),s.appendChild(a),r.appendChild(s),e},d.prototype.ruleTemplate=function(){var e,t,r,n,l;return e=this.createElement("div"),l=this.createElement("div",{attrs:{class:"e-rule-field"}}),r=this.createElement("div",{attrs:{class:"e-rule-filter"}}),t=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}}),r.appendChild(t),l.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-operator"}}),l.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-value"}}),l.appendChild(r),e.appendChild(l),n=this.createElement("button",{attrs:{class:"e-removerule e-rule-delete e-control e-btn e-small"}}),l.appendChild(n),e},d.prototype.addGroupElement=function(e,n,l,o){if(!(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var i,u=this.groupElem.cloneNode(!0);u.setAttribute("id",this.element.id+"_e_group"+this.groupIdCounter),this.groupIdCounter++;var p=u.querySelector(".e-btngroup-and"),d=u.querySelector(".e-btngroup-or"),c=u.querySelector(".e-btngroup-and-lbl"),h=u.querySelector(".e-btngroup-or-lbl");if(p.setAttribute("id",this.element.id+"_and"+this.btnGroupId),d.setAttribute("id",this.element.id+"_or"+this.btnGroupId),p.setAttribute("name",this.element.id+"_and"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("for",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){i=this.createElement("button",{attrs:{class:"e-deletegroup"}});new r.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(i);new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(i),t.rippleEffect(i,{selector:".deletegroup"}),u.querySelector(".e-group-action").appendChild(i);var m=n.querySelector(".e-rule-list"),y=n.querySelectorAll(".e-group-container").length;m.appendChild(u);var g=this.levelColl[n.id].slice(0);g.push(y),this.levelColl[u.id]=g,this.isImportRules||(this.addGroups([],n.id),o&&this.addRuleElement(u,{}))}else n.appendChild(u),this.levelColl[u.id]=[0];u.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===l&&u.querySelector(".e-btngroup-or").setAttribute("checked","true");var f=u.querySelector(".e-add-btn");new s.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,f),select:this.selectBtn.bind(this,f)}).appendTo(f),t.rippleEffect(f,{selector:".e-round"})}},d.prototype.notifyChange=function(e,r){for(var n=t.closest(r,".e-rule-value").querySelectorAll(".e-template"),l=[],o=0,i=n.length;o<i;o++)n[o].nextElementSibling&&n[o].nextElementSibling.className.indexOf("e-check")>-1&&l.push(n[o].textContent);this.updateRules(r,n.length>1?l:e)},d.prototype.changeValue=function(e,r){var n,l;if(r.event)l=r.event.target;else{l=r.element}if(l.className.indexOf("e-day")>-1){l=r.element}var o=t.closest(l,".e-group-container"),i=r;i.element&&i.element.className.indexOf("e-datepicker")>-1&&(l=i.element);var s;s=l.className.indexOf("e-radio")>-1?t.getComponent(l,"radio").label:l.className.indexOf("e-multiselect")>-1?t.getComponent(l,"multiselect").value:r.value,n={groupID:o.id,filterID:l.id,value:s,cancel:!1},this.trigger("beforeValueChange",n),this.updateRules(l,s,e),n={groupID:o.id,filterID:l.id,value:s,cancel:!1},this.trigger("valueChanged",n)},d.prototype.changeField=function(e){for(var r=t.closest(e.element,".e-group-container"),n=this.getGroup(r),l=t.closest(e.element,".e-rule-container"),o=0;l&&null!==l.previousElementSibling;)l=l.previousElementSibling,o++;this.changeRule(n.rules[o],e)},d.prototype.changeRule=function(e,r){if(r.itemData){var l,o,i,s,a={};o=t.closest(r.element,".e-rule-filter"),i=t.closest(r.element,".e-rule-operator");var u=t.getComponent(r.element,"dropdownlist"),p=t.closest(r.element,".e-group-container");if(o){var d={groupID:p.id,filterID:r.element.id,selectedItem:r.item,cancel:!1};this.trigger("beforeFieldChange",d),a.type=this.columns[u.index].type}if(i){d={groupID:p.id,filterID:r.element.id,selectedItem:r.item,cancel:!1};this.trigger("beforeFieldChange",d),a.operator=r.itemData.value;var c=document.getElementById(r.element.id.replace("operatorkey","filterkey")),h=t.getComponent(c,"dropdownlist");if(!this.columns[h.index].template&&((a.operator.toLowerCase().indexOf("between")>-1||a.operator.toLowerCase().indexOf("in")>-1&&a.operator.toLowerCase().indexOf("contains")<0)&&(o=i.previousElementSibling,a.type=e.type),r.previousItemData)){var m=r.previousItemData.value.toLowerCase();(m.indexOf("between")>-1||m.indexOf("in")>-1&&m.indexOf("contains")<0)&&(o=i.previousElementSibling,a.type=e.type)}}if(o)if((i=o.nextElementSibling).childElementCount)this.renderValues(i,r.itemData,r.previousItemData,!0,e,a);else{var y=t.closest(i,".e-rule-container").id;s=this.createElement("input",{attrs:{type:"text",id:y+"_operatorkey"}}),i.appendChild(s),this.columns[u.index].operators?l=this.columns[u.index].operators:r.itemData&&(l=this.customOperators[this.columns[u.index].type+"Operator"]);var g=this.element.className.indexOf("e-device")>-1?"250px":"200px",f=new n.DropDownList({dataSource:l,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:l.length>5?g:"auto",change:this.changeField.bind(this),index:0,value:e?this.l10n.getConstant(this.operatorValue[e.operator]):null});f.appendTo("#"+y+"_operatorkey"),this.allowValidation&&(s.setAttribute("name",y+"operator"),t.addClass([s],"e-error"),this.validationRules[y+"operator"]={required:!0}),a.operator=e?e.operator:"",this.isImportRules&&(f.value=e.operator,f.dataBind(),a.type=this.columns[u.index].type,a.operator=e.operator),this.renderValues(i,this.columns[u.index],r.previousItemData,!1,e,a)}this.isImportRules||this.updateRules(r.element,r.item)}},d.prototype.destroyControls=function(e){var r;r=e.nextElementSibling.querySelectorAll("input.e-control");var n;n=e.nextElementSibling.querySelectorAll("div.e-control");for(var l=this.columns,o=0,i=r.length;o<i;o++){if(r[o].classList.contains("e-textbox"))t.getComponent(r[o],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-dropdownlist"))t.getComponent(r[o],"dropdownlist").destroy();else if(r[o].classList.contains("e-radio"))t.getComponent(r[o],"radio").destroy();else if(r[o].classList.contains("e-numerictextbox"))t.getComponent(r[o],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-datepicker"))t.getComponent(r[o],"datepicker").destroy();else if(r[o].classList.contains("e-multiselect"))t.getComponent(r[o],"multiselect").destroy();else if(r[o].className.indexOf("e-template")>-1)for(var s=r[o].className,a=0,u=l.length;a<u;a++)if(l[a].template&&s.indexOf(l[a].field)>-1){this.templateDestroy(l[a],r[o].id);break}t.detach(r[o])}for(o=0,i=n.length;o<i;o++){if(n[o].className.indexOf("e-template")>-1)for(s=n[o].className,a=0,u=l.length;a<u;a++)if(l[a].template&&s.indexOf(l[a].field)>-1){this.templateDestroy(l[a],n[o].id);break}t.detach(n[o])}},d.prototype.templateDestroy=function(e,r){var n=e.template.destroy;e.template&&e.template.destroy&&("string"==typeof n?(n=t.getValue(n,window))({elementId:r}):e.template.destroy({elementId:r}))},d.prototype.getDistinctValues=function(e,t){for(var r={},n=[],l=0,o=e.length;l<o;l++){var i=e[l][t],s={};i in r||(r[i]=1,s[t]=i,n.push(s))}return n},d.prototype.renderMultiSelect=function(e,r,o,i){var s=this.getDistinctValues(this.dataSource,e.field);new n.MultiSelect({dataSource:new l.DataManager(s),query:new l.Query([e.field]),fields:{text:e.field,value:e.field},value:i,mode:"CheckBox",width:"100%,",change:this.changeValue.bind(this,o)}).appendTo("#"+r+"_valuekey"+o),t.addClass([document.getElementById(r).querySelector(".e-rule-value")],"e-rule-multiselect")},d.prototype.processTemplate=function(e,r,n,l){var o=t.closest(e,".e-rule-container").querySelectorAll(".e-template");o.length<2?this.isImportRules?r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o[0],values:n.value}):r.template&&r.template.write&&r.template.write({elements:o[0],values:n.value}):r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o[0]}):r.template&&r.template.write&&r.template.write({elements:o[0]}):this.isImportRules?r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o,values:n.value}):r.template&&r.template.write&&r.template.write({elements:o,values:n.value}):r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o}):r.template&&r.template.write&&r.template.write({elements:o})},d.prototype.renderControls=function(e,n,l,s){if(n.template)this.processTemplate(e,n,l,s);else{var a="boolean"===s.type||s.operator&&s.operator.toLowerCase().indexOf("between")>-1?2:1,u=t.closest(e,".e-rule-container").id,p=void 0;(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1)&&(p=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")<0&&(p.style.width="200px"));for(var d=0;d<a;d++)switch(s.type){case"string":var c=this.isImportRules?l.value:"";if("in"===s.operator||"notin"===s.operator){var h=this.isImportRules?l.value:[];this.renderMultiSelect(l,u,d,h),this.element.className.indexOf("e-device")<0&&(p.style.width="300px")}else{var m=new o.TextBox({placeholder:"Value",input:this.changeValue.bind(this,d)});m.appendTo("#"+u+"_valuekey"+d),m.value=c,m.dataBind(),this.allowValidation&&n.validation&&(m.element.setAttribute("name",u+d),t.addClass([m.element],"e-error"),this.validationRules[u+d]={required:!0})}break;case"number":c=this.isImportRules?l.value:0;if("in"===s.operator||"notin"===s.operator){h=this.isImportRules?l.value:[];this.renderMultiSelect(l,u,d,h),this.element.className.indexOf("e-device")<0&&(p.style.width="300px")}else{var y=new o.NumericTextBox({value:c,format:"#",width:"100%",change:this.changeValue.bind(this,d)});y.appendTo("#"+u+"_valuekey"+d),this.allowValidation&&(y.element.setAttribute("name",u+d),t.addClass([y.element],"e-error"),this.validationRules[u+d]={required:!0})}break;case"boolean":var g=n.values&&n.values.length?n.values:["True","False"],f=!this.isImportRules||Boolean(l.value);new r.RadioButton({label:g[d],name:u+"default",checked:f,change:this.changeValue.bind(this,d)}).appendTo("#"+u+"_valuekey"+d);break;case"date":c=this.isImportRules?new Date(l.value):new Date;var v=new i.DatePicker({value:c,format:"dd-MMM-yy",change:this.changeValue.bind(this,d)});v.appendTo("#"+u+"_valuekey"+d),this.allowValidation&&(v.element.setAttribute("name",u+d),this.validationRules[u+d]={required:!0})}}},d.prototype.renderValues=function(e,r,n,l,o,i){if(l){var s=t.getComponent(e.querySelector("input"),"dropdownlist");r.operators?(s.dataSource=r.operators,s.index=0!==s.index?0:1,s.dataBind()):r.type&&(s.dataSource=this.customOperators[r.type+"Operator"],s.index=0!==s.index?0:1,s.dataBind())}var a=t.closest(e,".e-rule-container").id;if(n&&n.template&&(this.templateDestroy(n,a+"_valuekey0"),t.detach(e.nextElementSibling.querySelector("#"+a+"_valuekey0"))),l&&this.destroyControls(e),r.template){var u=void 0;if(r.template&&"string"==typeof r.template.create?u=t.getValue(r.template.create,window)():r.template&&r.template.create&&(u=r.template.create()),u instanceof Element)u.id=a+"_valuekey0",t.addClass([u],"e-template"),t.addClass([u],"e-"+r.field),e.nextElementSibling.appendChild(u);else{t.addClass(u,"e-template");for(var p=0,d=u.length;p<d;p++)u[p].id=a+"_valuekey"+p,e.nextElementSibling.appendChild(u[p])}if(this.element.className.indexOf("e-device")<0){e.parentElement.querySelector(".e-rule-value").style.width="200px"}}else if("boolean"===i.type||i.operator&&i.operator.toLowerCase().indexOf("between")>-1)for(p=0;p<2;p++){u=void 0;u=this.createElement("input",{attrs:{type:"text",id:a+"_valuekey"+p}}),e.nextElementSibling.appendChild(u)}else{u=this.createElement("input",{attrs:{type:"text",id:a+"_valuekey0"}});e.nextElementSibling.appendChild(u)}this.renderControls(e,r,o,i)},d.prototype.updateValues=function(e,r){var n=e.className.split(" e-")[1],l=parseInt(e.id.slice(-1),2);switch(n){case"textbox":case"dropdownlist":case"radio":r.value=t.getComponent(e,n).value;break;case"numerictextbox":r.operator.indexOf("between")>-1?r.value[l]=t.getComponent(e,n).value:r.value=t.getComponent(e,n).value;break;case"datepicker":r.operator.indexOf("between")>-1?r.value[l]=t.getComponent(e,n).value:r.value=this.intl.formatDate(t.getComponent(e,n).value,{type:"dateTime",format:"dd-MMM-yy"})}},d.prototype.updateRules=function(e,r,l){for(var o,i,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),t.closest(e,".e-rule-filter")){o=t.getComponent(e,"dropdownlist"),a.rules[p].field=this.columns[o.index].field,a.rules[p].type=this.columns[o.index].type,a.rules[p].label=this.columns[o.index].label;var d=t.closest(e,".e-rule-filter"),c=d.nextElementSibling.querySelector("input.e-control"),h=t.getComponent(c,"dropdownlist").value;a.rules[p].operator=h,(c=d.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(c=d.nextElementSibling.nextElementSibling.querySelector("div.e-control")),i={groupID:s.id,filterID:e,selectedItem:r,cancel:!1},this.trigger("fieldChanged",i),this.updateValues(c,a.rules[p]),a.rules[p].field?t.removeClass([e.parentElement],"e-error"):t.addClass([e.parentElement],"e-error")}else if(t.closest(e,".e-rule-operator")){o=t.getComponent(e,"dropdownlist"),a.rules[p].operator=o.value;var m=void 0;m=u.querySelectorAll(".e-rule-value input.e-control"),a.rules[p].value=[],i={groupID:s.id,filterID:e,selectedItem:r,cancel:!1},this.trigger("operatorChanged",i),a.rules[p].operator?t.removeClass([e.parentElement],"e-error"):t.addClass([e.parentElement],"e-error");for(var y=0;y<m.length;y++)this.updateValues(m[y],a.rules[p])}else if(t.closest(e,".e-rule-value")&&null!==r){if(e.className.indexOf("e-template")>-1){var g=a.rules[p].operator.toLowerCase();r instanceof Array?g.indexOf("in")>-1&&g.indexOf("contains")<0||g.indexOf("between")>-1?a.rules[p].value=r:a.rules[p].value=r[0]:a.rules[p].value=r,i={groupID:s.id,filterID:e,selectedItem:r,cancel:!1},this.trigger("valueChanged",i)}else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[l]=r:a.rules[p].value=r;else if(e.className.indexOf("e-radio")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-multiselect")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-textbox")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-datepicker")>-1){var f=t.getInstance(u.querySelector(".e-rule-filter input"),n.DropDownList),v={type:"dateTime",format:this.columns[f.index].format||"dd/MM/yyy"};v.type&&(a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[l]=this.intl.formatDate(r,v):a.rules[p].value=this.intl.formatDate(r,v))}a.rules[p].value?t.removeClass([e.parentElement],"e-error"):t.addClass([e.parentElement],"e-error")}},d.prototype.findGroupByIdx=function(e,t,r){var n=t.rules;if(!r&&n[e]){if((t=n[e]).rules)return t;for(var l=e+1,o=n.length;l<o;l++)if((t=n[l]).rules)return t}return t},d.prototype.destroy=function(){var e,r,n;for(n=(e=this.element.querySelectorAll(".e-addrulegroup")).length,r=0;r<n;r++)t.getComponent(e[r],"dropdown-btn").destroy(),t.detach(e[r]);this.reset(),this.unWireEvents()},d.prototype.addRules=function(e,t){var r={groupID:t,filterID:""};this.trigger("ruleDelete",r);for(var n=0,l=e.length;n<l;n++)this.addRuleElement(document.getElementById(t),e[n])},d.prototype.addGroups=function(e,t){var r=document.getElementById(t),n=this.getGroup(r),l=e.length,o={groupID:t};if(this.trigger("ruleDelete",o),l)for(var i=0,s=e.length;i<s;i++)this.importRules(e[i],r);else n.rules.push({condition:"and",rules:[]})},d.prototype.initWrapper=function(){if(this.cssClass&&t.addClass([this.element],this.cssClass),this.enableRtl&&t.addClass([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),t.Browser.isDevice||"Vertical"===this.displayMode?(t.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),t.removeClass(document.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.addClass(document.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.isImportRules&&this.summaryView)this.renderSummary();else{if(this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition);var e=t.extend({},this.rule,{},!0);this.setGroupRules(e)}else this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});for(var r=document.querySelectorAll("label.e-btn"),n=void 0,l=0;l<r.length;l++)n=r.item(l),t.rippleEffect(n,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"}}),r=this.createElement("button",{attrs:{class:"e-edit-rule e-control e-btn e-small"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),r.textContent=this.l10n.getConstant("Edit"),e.appendChild(r),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("button",{attrs:{class:"e-collapse-rule e-control e-btn e-small"}});e.appendChild(this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-collapse-icon"}})),this.element.querySelector(".e-group-header").appendChild(e)},d.prototype.onPropertyChanged=function(e,r){for(var n=0,o=Object.keys(e);n<o.length;n++){switch(o[n]){case"summaryView":var i=this.element.querySelector(".e-group-container"),s=this.element.querySelector(".e-summary-content");e.summaryView?(i.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),s=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),s.style.display="block"):(i.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),i.style.display="block",s.style.display="none");break;case"displayMode":"Horizontal"===e.displayMode?(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode")):(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"));break;case"showButtons":e.showButtons.ruleDelete?t.removeClass(this.element.querySelectorAll("e-rule-delete"),"e-button-hide"):t.addClass(this.element.querySelectorAll("e-rule-delete"),"e-button-hide"),e.showButtons.groupDelete?t.removeClass(this.element.querySelectorAll("e-deletegroup"),"e-button-hide"):t.addClass(this.element.querySelectorAll("e-deletegroup"),"e-button-hide");break;case"cssClass":r.cssClass&&t.removeClass([this.element],r.cssClass.split(" ")),e.cssClass&&t.addClass([this.element],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl");break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource;break;case"columns":this.columns=e.columns,"ascending"===this.sortDirection.toLowerCase()?this.columns=new l.DataManager(this.columns).executeLocal((new l.Query).sortBy("field")):"descending"===this.sortDirection.toLowerCase()&&(this.columns=new l.DataManager(this.columns).executeLocal((new l.Query).sortByDesc("field")));break;case"sortDirection":this.sortDirection=e.sortDirection;break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rules":this.rule=e.rule;break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale}}},d.prototype.preRender=function(){this.defaultLocale={StartsWith:"Starts With",EndsWith:"Ends With",Contains:"Contains",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",Empty:"Empty",NotEmpty:"Not Empty",In:"In",NotIn:"Not In",NotContains:"Not Contains",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]}},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate(),this.initWrapper(),this.initialize(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this)},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler)},d.prototype.getGroup=function(e,t){for(var r=this.levelColl[e.id],n=t?r.length-1:r.length,l=this.rule,o=0;o<n;o++)l=this.findGroupByIdx(r[o],l,0===o);return l},d.prototype.deleteGroup=function(e){var r,n,l=e,o=l.id,i=this.getGroup(l,!0),s=0,a={groupID:o,filterID:o};this.trigger("groupDelete",a);var u=l.querySelectorAll(".e-group-container");for(r=0,n=u.length;r<n;r++)delete this.levelColl[u[r].id];for(;null!==l.previousElementSibling;)l=l.previousElementSibling,s++;i.rules.splice(s,1),delete this.levelColl[o],t.detach(e)},d.prototype.deleteRule=function(e){for(var r=t.closest(e,".e-group-container"),n=this.getGroup(r),l=t.closest(e,".e-rule-container"),o=l,i={groupID:r.id,filterID:l.id},s=0;null!==l.previousElementSibling;)l=l.previousElementSibling,s++;n.rules.splice(s,1),this.trigger("ruleDelete",i),t.detach(o)},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0)},d.prototype.setRules=function(e){var r=t.extend({},e,{},!0);this.setGroupRules(r)},d.prototype.getRules=function(){return this.rule},d.prototype.deleteGroups=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteGroup(document.getElementById(e[t]))},d.prototype.getFilteredRecords=function(){var e=(new l.Query).where(this.getPredicate(this.rule)),t=[];return new l.DataManager(this.dataSource).executeQuery(e).then(function(e){e.result.forEach(function(e){t.push(e)})}),t},d.prototype.deleteRules=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteRule(document.getElementById(e[t]))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),r=[],n=0,o=Object.keys(this.columns);n<o.length;n++)r.push(this.columns[n].field);return e.rules.length?(new l.Query).select(r).where(t):(new l.Query).select(r)},d.prototype.getPredicate=function(e){for(var t,r,n,o=e.rules,i=!1,s=0,a=o.length;s<a;s++){if(Object.keys(o[s]).indexOf("rules")>-1)(r=this.getPredicate(o[s]))&&(t="and"===e.condition?t.and(r):t.or(r));else if(o[s].operator.length){n="date"===o[s].type?new Date(o[s].value):o[s].value;var u=o[s].operator.toLowerCase();if(i="contains"===u||"startswith"===u||"endswith"===u,0===s)if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s]);else{""!==(p=n)&&(t=new l.Predicate(o[s].field,o[s].operator,n,i))}else if("and"===e.condition)if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{var p=n;t&&""!==p&&(t=t.and(o[s].field,o[s].operator,n,i))}else if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{p=n;t&&""!==p&&(t=t.or(o[s].field,o[s].operator,n,i))}}}return t},d.prototype.arrayPredicate=function(e,t,r){for(var n,o=e.value,i=0,s=o.length;i<s;i++)if(""!==o[i])if(0===i)switch(e.operator){case"between":n=new l.Predicate(e.field,"greaterthan",o[i]);break;case"notbetween":n=new l.Predicate(e.field,"lessthan",o[i]);break;case"in":n=new l.Predicate(e.field,"equal",o[i]);break;case"notin":n=new l.Predicate(e.field,"notequal",o[i])}else switch(e.operator){case"between":n=n.and(e.field,"lessthan",o[i]);break;case"notbetween":n=n.or(e.field,"greaterthan",o[i]);break;case"in":n=n.or(e.field,"equal",o[i]);break;case"notin":n=n.and(e.field,"notequal",o[i])}return n&&(t="and"===r?t.and(n):"or"===r?t.or(n):n),t},d.prototype.importRules=function(e,r,n){n||(r=this.renderGroup(e.condition,r));for(var l=e.rules,o=0,i=l.length;o<i;o++){Object.keys(l[o]).indexOf("rules")>-1?(r=this.renderGroup(l[o].condition,r),r=this.importRules(l[o],r,!0)):this.renderRule(l[o],r)}return(r=t.closest(r,".e-rule-list"))&&(r=t.closest(r,".e-group-container")),r},d.prototype.renderGroup=function(e,t){this.addGroupElement(!0,t,e);var r=t.querySelectorAll(".e-group-container");return r[r.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.getSqlString=function(e,t){var r=!1;t?t+="(":(t="",r=!0);for(var n=e.condition,l=0,o=e.rules.length;l<o;l++){if(e.rules[l].rules)t=this.getSqlString(e.rules[l],t);else{var i=e.rules[l],s="";i.value instanceof Array?s+="("+i.value+")":"startswith"===i.operator?s+='("'+i.value+'%")':"endswith"===i.operator?s+='("%'+i.value+'")':"contains"===i.operator?s+='("%'+i.value+'%")':"number"===i.type?s+=i.value:s+='"'+i.value+'"',t+=i.field+" "+this.operators[i.operator]+" "+s}l!==o-1&&(t+=" "+n+" ")}return r||(t+=")"),t},d.prototype.setRulesFromSql=function(e){var t=this.getRulesFromSql(e);this.setRules({condition:t.condition,rules:t.rules})},d.prototype.getRulesFromSql=function(e){return this.parser=[],this.sqlParser(e),this.rule={condition:"",rules:[]},this.processParser(this.parser,this.rule,[0])},d.prototype.getSqlFromRules=function(e){return this.getSqlString(e).replace(/"/g,"'")},d.prototype.sqlParser=function(e){var t,r=0;do{t=e.slice(r),r+=this.parseSqlStrings(t)}while(""!==t);return this.parser},d.prototype.parseSqlStrings=function(e){for(var t,r,n=["=","!=","<",">","<=",">="],l=["and","or"],o=["IN","NOT IN","LIKE","NOT LIKE"],i=0,s=n.length;i<s;i++)if(t=/^\w+$/.test(n[i])?"\\b":"",new RegExp("^("+n[i]+")"+t,"ig").exec(e))return this.parser.push(["Operators",n[i].toLowerCase()]),n[i].length;for(i=0,s=l.length;i<s;i++)if(t=/^\w+$/.test(l[i])?"\\b":"",new RegExp("^("+l[i]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",l[i].toLowerCase()]),l[i].length;for(i=0,s=o.length;i<s;i++)if(t=/^\w+$/.test(o[i])?"\\b":"",new RegExp("^("+o[i]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",o[i].toLowerCase()]),o[i].length;return/^\(/.exec(e)?(this.parser.push(["Left","("]),1):/^\)/.exec(e)?(this.parser.push(["Right",")"]),1):/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)?(r=/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",r]),r.length):/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)?(r=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],this.parser.push(["String",r]),r.length):/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(r=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",r]),r.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(r=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",r]),r.length):1},d.prototype.getOperator=function(e,t){return 0===e.indexOf("%")&&e.indexOf("%")===e.length-1?"contains":0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"startswith":0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"endswith":{"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal"}[t]},d.prototype.processParser=function(e,t,r){for(var n,l,o,i,s,a,u,p,d,c,h=[],m=[],y=0,g=e.length;y<g;y++)if("Literal"===e[y][0]){if(n={label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){for(n.operator=this.getOperator(e[y+3][1].replace(/'/g,""),e[y+1][1]),c=e[y+1][1],o=++y+1,i=g,o=y+1;o<i;o++){if("Right"===e[o][0]){y=o;break}"like"===c&&"String"===e[o][0]?(n.value=e[o][1].replace(/'/g,"").replace(/%/g,""),n.type="string"):"Number"===e[o][0]?h.push(Number(e[o][1])):"String"===e[o][0]&&m.push(e[o][1].replace(/'/g,""))}"like"!==c&&("Number"===e[o-1][0]?(n.value=h,n.type="integer"):"String"===e[o-1][0]&&(n.value=m,n.type="string"))}else"Operators"===e[y+1][0]&&(n.operator=this.getOperator(e[y+2][1],e[y+1][1]),"Number"===e[y+2][0]?(n.type="integer",n.value=Number(e[y+2][1])):(n.type="string",n.value=e[y+2][1].replace(/'/g,"")));t.rules.push(n)}else{if("Left"===e[y][0]){for(l={condition:"",rules:[]},this.parser=e.splice(y+1,g-(y+1)),d=0,a=t.rules.length,s=0;s<a;s++)t.rules[s].rules&&d++;return r.push(d),t.rules.push(l),l=this.processParser(this.parser,l,r),t}if("Conditions"===e[y][0])t.condition=e[y][1];else if("Right"===e[y][0]){for(this.parser=e.splice(y+1,g-(y+1)),r.pop(),t=this.rule,p=r.length,u=0;u<p;u++)t=this.findGroupByIdx(r[u],t,0===u);return this.processParser(this.parser,t,r)}}return t},p([t.Event()],d.prototype,"created",void 0),p([t.Event()],d.prototype,"beforeConditionChange",void 0),p([t.Event()],d.prototype,"beforeFieldChange",void 0),p([t.Event()],d.prototype,"beforeOperatorChange",void 0),p([t.Event()],d.prototype,"beforeValueChange",void 0),p([t.Event()],d.prototype,"conditionChanged",void 0),p([t.Event()],d.prototype,"fieldChanged",void 0),p([t.Event()],d.prototype,"valueChanged",void 0),p([t.Event()],d.prototype,"operatorChanged",void 0),p([t.Event()],d.prototype,"groupDelete",void 0),p([t.Event()],d.prototype,"ruleDelete",void 0),p([t.Event()],d.prototype,"groupInsert",void 0),p([t.Event()],d.prototype,"ruleInsert",void 0),p([t.Property(m)],d.prototype,"showButtons",void 0),p([t.Property(!1)],d.prototype,"summaryView",void 0),p([t.Property(!1)],d.prototype,"allowValidation",void 0),p([t.Property([])],d.prototype,"columns",void 0),p([t.Property("")],d.prototype,"cssClass",void 0),p([t.Property([])],d.prototype,"dataSource",void 0),p([t.Property("Horizontal")],d.prototype,"displayMode",void 0),p([t.Property(!1)],d.prototype,"enableRtl",void 0),p([t.Property(!1)],d.prototype,"enablePersistence",void 0),p([t.Property("Default")],d.prototype,"sortDirection",void 0),p([t.Property(5)],d.prototype,"maxGroupCount",void 0),p([t.Property("auto")],d.prototype,"height",void 0),p([t.Property("auto")],d.prototype,"width",void 0),p([t.Complex({condition:"and",rules:[]},h)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);e.Columns=d,e.Rules=c,e.Rule=h,e.ShowButtons=m,e.QueryBuilder=y,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-calendars"),require("@syncfusion/ej2-splitbuttons"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-buttons","@syncfusion/ej2-dropdowns","@syncfusion/ej2-data","@syncfusion/ej2-inputs","@syncfusion/ej2-calendars","@syncfusion/ej2-splitbuttons","@syncfusion/ej2-popups"],t):t(e.ej={},e.ej2Base,e.ej2Buttons,e.ej2Dropdowns,e.ej2Data,e.ej2Inputs,e.ej2Calendars,e.ej2Splitbuttons,e.ej2Popups)}(this,function(e,t,r,n,l,o,i,s,a){"use strict";var u=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),p=function(e,t,r,n){var l,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(i=(o<3?l(i):o>3?l(t,r,i):l(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};n.MultiSelect.Inject(n.CheckBoxSelection);var d=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"values",void 0),p([t.Property(null)],r.prototype,"operators",void 0),p([t.Property(null)],r.prototype,"template",void 0),p([t.Property(null)],r.prototype,"validation",void 0),p([t.Property(null)],r.prototype,"format",void 0),p([t.Property(null)],r.prototype,"step",void 0),r}(t.ChildProperty),c=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"operator",void 0),p([t.Property(null)],r.prototype,"value",void 0),r}(t.ChildProperty),h=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("and")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),r}(t.ChildProperty),m=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(!0)],r.prototype,"ruleDelete",void 0),p([t.Property(!0)],r.prototype,"groupInsert",void 0),p([t.Property(!0)],r.prototype,"groupDelete",void 0),r}(t.ChildProperty),y=function(e){function d(r,n){var l=e.call(this,r,n)||this;return l.groupIdCounter=0,l.ruleIdCounter=0,l.btnGroupId=0,l.isImportRules=!1,l.parser=[],l.intl=new t.Internationalization,l}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;var e=this.element.querySelector(".e-group-body");e.innerHTML="",e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_e_group0"]=[0],this.rule={condition:"and",rules:[]}},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.initialize=function(){if(this.dataSource.length){var e=Object.keys(this.dataSource[0]),t=[],r=void 0,n=!1,l=void 0;if(this.columns.length){this.columnSort();for(var o=this.columns,i=0,s=o.length;i<s;i++)o[i].type||(e.indexOf(o[i].field)>-1&&("string"===(r=typeof(l=this.dataSource[0][o[i].field]))?n=!isNaN(Date.parse(l)):"object"===r&&(n=l instanceof Date&&!isNaN(l.getTime()),r="string"),o[i].type=r,n=!1),r="string")}else{for(i=0,s=e.length;i<s;i++)"string"===(r=typeof(l=this.dataSource[0][e[i]]))?n=!isNaN(Date.parse(l)):"object"===r&&(n=l instanceof Date&&!isNaN(l.getTime()),r="string"),t[i]={field:e[i],label:e[i],type:n?"date":r},n=!1;this.columns=t}}},d.prototype.clickEventHandler=function(e){var r=e.target;if(this.isImportRules=!1,"SPAN"===r.tagName&&(r=r.parentElement),"BUTTON"===r.tagName){if(r.className.indexOf("e-removerule")>-1)r.className.indexOf("e-tooltip")>-1&&t.getComponent(r,"tooltip").destroy(),this.deleteRule(r);else if(r.className.indexOf("e-deletegroup")>-1)t.getComponent(r,"tooltip").destroy(),this.deleteGroup(t.closest(r,".e-group-container"));else if(r.className.indexOf("e-edit-rule")>-1)if(document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition);var n=t.extend({},this.rule,{},!0);this.setGroupRules(n),this.renderSummaryCollapse()}else{(l=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),l.style.display="block"}else if(r.className.indexOf("e-collapse-rule")>-1){var l;(l=this.element.querySelector(".e-group-container")).style.display="none",this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),document.getElementById(this.element.id+"_summary_content").style.display="block"}}else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1){var o=t.closest(r,".e-group-container"),i={groupID:o.id,selectedItem:r,cancel:!1};this.trigger("beforeConditionChange",i);this.getGroup(o).condition=r.textContent.toLowerCase(),i={groupID:o.id,selectedItem:r},this.trigger("conditionChanged",i)}},d.prototype.selectBtn=function(e,r){"beforeOpen"===r.name?this.showButtons.groupInsert?t.removeClass([r.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.addClass([r.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):r.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):r.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},d.prototype.addRuleElement=function(e,r){var l=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?l.className="e-rule-container e-vertical-mode":l.className="e-rule-container e-horizontal-mode";var o,i,s,u,p,d,c=e.querySelector(".e-rule-list"),h=l.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)h.textContent=this.l10n.getConstant("Remove");else{t.addClass([h],"e-round"),t.addClass([h],"e-icon-btn");new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(h),h=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),l.querySelector("button").appendChild(h)}if(l.setAttribute("id",e.id+"_e_rule"+this.ruleIdCounter),this.ruleIdCounter++,l.querySelector(".e-filter-input").setAttribute("id",l.id+"_filterkey"),c.appendChild(l),l.previousElementSibling&&l.previousElementSibling.className.indexOf("e-rule-container")>-1&&(l.className.indexOf("e-joined-rule")<0&&(l.className+=" e-joined-rule"),l.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(l.previousElementSibling.className+=" e-prev-joined-rule")),l.previousElementSibling&&l.previousElementSibling.className.indexOf("e-group-container")>-1&&l.className.indexOf("e-separate-rule")<0&&(l.className+=" e-separate-rule"),d=this.element.className.indexOf("e-device")>-1?"250px":"200px",(p=new n.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?d:"auto",change:this.changeField.bind(this),value:r?r.field:null})).appendTo("#"+l.id+"_filterkey"),this.allowValidation&&(l.querySelector(".e-filter-input").setAttribute("name",l.id+"field"),t.addClass([l.querySelector(".e-filter-input")],"e-error")),this.filterIndex=p.index,o=this.levelColl[e.id],!this.isImportRules){for(i=this.rule,s=0,u=o.length;s<u;s++)i=this.findGroupByIdx(o[s],i,0===s);Object.keys(r).length?i.rules.push({field:r.field,type:r.type,label:r.label,operator:r.operator,value:r.value}):i.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(r).length&&this.changeRule(r,{element:p.element,itemData:this.columns[this.filterIndex]})},d.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),position:"BottomCenter",cssClass:"e-querybuilder-error"});t.appendTo(e),t.open(e)},d.prototype.validateFields=function(){if(this.allowValidation){var e=void 0,r=void 0,n=void 0,l=void 0,o=void 0,i=void 0,s=void 0,a=void 0,u=void 0,p=this.element.querySelectorAll(".e-rule-container"),d=void 0;for(e=0,r=p.length;e<r;e++)if(o=t.closest(p[e],".e-group-container"),u=this.getGroup(o),i=0,l=a=p[e],s=t.getComponent(p[e].querySelector(".e-rule-field input.e-control"),"dropdownlist"),d=!t.isNullOrUndefined(s.index)&&this.columns[s.index].validation,n=a.querySelector(".e-rule-field input.e-control"),d&&d.isRequired){for(;l&&null!==l.previousElementSibling;)l=l.previousElementSibling,i++;if(n=a.querySelector(".e-rule-field input.e-control"),!u.rules[i].field&&n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),n=a.querySelector(".e-rule-operator input.e-control"),!u.rules[i].operator&&n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),!u.rules[i].value){var c=a.querySelectorAll(".e-rule-value input.e-control");do{var h=c[0],m=void 0;h.parentElement.className.indexOf("e-searcher")>-1?(m=t.closest(h,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(m):c[0].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(c[0].parentElement),c.length>1&&c[1].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(c[1].parentElement),c=a.querySelectorAll(".e-rule-value div.e-control")}while(c.length>0)}}else s.element&&!s.index&&n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement)}},d.prototype.groupTemplate=function(){var e,t,r,n,l,o,i,s,a;return e=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),t=this.createElement("div",{attrs:{class:"e-group-body"}}),n=this.createElement("div",{attrs:{class:"e-rule-list"}}),e.appendChild(r),t.appendChild(n),e.appendChild(t),l=this.createElement("div",{attrs:{class:"e-btn-group"}}),(o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),l.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl"},innerHTML:"AND"}),l.appendChild(i),o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),l.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl"},innerHTML:"OR"}),l.appendChild(i),r.appendChild(l),s=this.createElement("div",{attrs:{class:"e-group-action"}}),a=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),s.appendChild(a),r.appendChild(s),e},d.prototype.ruleTemplate=function(){var e,t,r,n,l,o;return e=this.createElement("div"),l=this.createElement("div",{attrs:{class:"e-rule-field"}}),r=this.createElement("div",{attrs:{class:"e-rule-filter"}}),t=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}}),r.appendChild(t),l.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-operator"}}),l.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-value"}}),l.appendChild(r),e.appendChild(l),o=this.showButtons.ruleDelete?"e-removerule e-rule-delete e-css e-btn e-small":"e-removerule e-rule-delete e-css e-btn e-small e-button-hide",n=this.createElement("button",{attrs:{class:o}}),l.appendChild(n),e},d.prototype.addGroupElement=function(e,n,l,o){if(!(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var i,u=this.groupElem.cloneNode(!0);u.setAttribute("id",this.element.id+"_e_group"+this.groupIdCounter),this.groupIdCounter++;var p=u.querySelector(".e-btngroup-and"),d=u.querySelector(".e-btngroup-or"),c=u.querySelector(".e-btngroup-and-lbl"),h=u.querySelector(".e-btngroup-or-lbl");if(p.setAttribute("id",this.element.id+"_and"+this.btnGroupId),d.setAttribute("id",this.element.id+"_or"+this.btnGroupId),p.setAttribute("name",this.element.id+"_and"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("for",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){var m=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";i=this.createElement("button",{attrs:{class:m}});new r.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(i);new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(i),t.rippleEffect(i,{selector:".deletegroup"}),u.querySelector(".e-group-action").appendChild(i);var y=n.querySelector(".e-rule-list"),f=n.querySelectorAll(".e-group-container").length;y.appendChild(u);var g=this.levelColl[n.id].slice(0);g.push(f),this.levelColl[u.id]=g,this.isImportRules||(this.addGroups([],n.id),o&&this.addRuleElement(u,{}))}else n.appendChild(u),this.levelColl[u.id]=[0];u.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===l&&u.querySelector(".e-btngroup-or").setAttribute("checked","true");var v=u.querySelector(".e-add-btn");new s.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,v),select:this.selectBtn.bind(this,v)}).appendTo(v),t.rippleEffect(v,{selector:".e-round"})}},d.prototype.notifyChange=function(e,r){for(var n=t.closest(r,".e-rule-value").querySelectorAll(".e-template"),l=[],o=0,i=n.length;o<i;o++)n[o].nextElementSibling&&n[o].nextElementSibling.className.indexOf("e-check")>-1&&l.push(n[o].textContent);this.updateRules(r,n.length>1?l:e)},d.prototype.changeValue=function(e,r){var n,l;if(r.event)l=r.event.target;else{l=r.element}if(l.className.indexOf("e-day")>-1){l=r.element}var o=t.closest(l,".e-group-container"),i=t.closest(l,".e-rule-container"),s=r;s.element&&s.element.className.indexOf("e-datepicker")>-1&&(l=s.element);var a;a=l.className.indexOf("e-radio")>-1?t.getComponent(l,"radio").label:l.className.indexOf("e-multiselect")>-1?t.getComponent(l,"multiselect").value:r.value,n={groupID:o.id,ruleID:i.id,value:a,cancel:!1},this.trigger("beforeValueChange",n),this.updateRules(l,a,e),n={groupID:o.id,ruleID:i.id,value:a,cancel:!1},this.trigger("valueChanged",n)},d.prototype.changeField=function(e){if(e.isInteracted){for(var r=t.closest(e.element,".e-group-container"),n=this.getGroup(r),l=t.closest(e.element,".e-rule-container"),o=0;l&&null!==l.previousElementSibling;)l=l.previousElementSibling,o++;this.changeRule(n.rules[o],e)}},d.prototype.changeRule=function(e,r){if(r.itemData){var l,o,i,s,a,u={},p=e.operator?e.operator.toLowerCase():"";i=t.closest(r.element,".e-rule-filter"),s=t.closest(r.element,".e-rule-operator");var d=t.getComponent(r.element,"dropdownlist"),c=t.closest(r.element,".e-group-container");if(i){var h=t.closest(i,".e-rule-container"),m={groupID:c.id,ruleID:h.id,selectedItem:r.item,cancel:!1};this.trigger("beforeFieldChange",m),u.type=this.columns[d.index].type,h.querySelector(".e-template")&&(e.value="")}if(s){h=t.closest(s,".e-rule-container"),m={groupID:c.id,ruleID:h.id,selectedItem:r.item,cancel:!1};this.trigger("beforeOperatorChange",m),u.operator=r.itemData.value;var y=u.operator.toLowerCase();if(u.operator.toLowerCase().indexOf("between")>-1||u.operator.toLowerCase().indexOf("in")>-1&&u.operator.toLowerCase().indexOf("contains")<0){i=s.previousElementSibling,u.type=e.type;var f=[],g=[];"string"==typeof e.value?(g.push(e.value),e.value=g):"number"==typeof e.value&&(f.push(e.value),e.value=f)}else"object"==typeof e.value&&(e.value=e.value[0]);if(r.previousItemData){var v=r.previousItemData.value.toLowerCase();(v.indexOf("between")>-1||v.indexOf("in")>-1&&v.indexOf("contains")<0)&&(i=s.previousElementSibling,u.type=e.type)}p.indexOf("in")>-1&&p.indexOf("in")<5&&y.indexOf("in")>-1&&y.indexOf("in")<5&&(i=null)}if(i)if(s=i.nextElementSibling,t.addClass([s],"e-operator"),s.childElementCount)l=t.getComponent(s.querySelector(".e-dropdownlist"),"dropdownlist"),u.operator=l.value,this.renderValues(s,r.itemData,r.previousItemData,!0,e,u,r.element);else{var b=t.closest(s,".e-rule-container").id;a=this.createElement("input",{attrs:{type:"text",id:b+"_operatorkey"}}),s.appendChild(a),this.columns[d.index].operators?o=this.columns[d.index].operators:r.itemData&&(o=this.customOperators[this.columns[d.index].type+"Operator"]);var C=this.element.className.indexOf("e-device")>-1?"250px":"200px";new n.DropDownList({dataSource:o,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:o.length>5?C:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+b+"_operatorkey"),u.operator=e&&""!==e.operator?e.operator:o[0].value,this.isImportRules&&(u.type=this.columns[d.index].type,u.operator=e.operator),this.renderValues(s,this.columns[d.index],r.previousItemData,!1,e,u,r.element)}this.isImportRules||this.updateRules(r.element,r.item)}},d.prototype.destroyControls=function(e){var r;r=e.nextElementSibling.querySelectorAll("input.e-control");var n;n=e.nextElementSibling.querySelectorAll("div.e-control:not(.e-handle)");for(var l=this.columns,o=0,i=r.length;o<i;o++){if(r[o].classList.contains("e-textbox"))t.getComponent(r[o],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-dropdownlist"))t.getComponent(r[o],"dropdownlist").destroy();else if(r[o].classList.contains("e-radio"))t.getComponent(r[o],"radio").destroy();else if(r[o].classList.contains("e-numerictextbox"))t.getComponent(r[o],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-datepicker"))t.getComponent(r[o],"datepicker").destroy();else if(r[o].classList.contains("e-multiselect"))t.getComponent(r[o],"multiselect").destroy();else if(r[o].className.indexOf("e-template")>-1)for(var s=r[o].className,a=0,u=l.length;a<u;a++)if(l[a].template&&s.indexOf(l[a].field)>-1){this.templateDestroy(l[a],r[o].id);break}t.detach(r[o])}for(o=0,i=n.length;o<i;o++){if(n[o].className.indexOf("e-template")>-1)for(s=n[o].className,a=0,u=l.length;a<u;a++)if(l[a].template&&s.indexOf(l[a].field)>-1){this.templateDestroy(l[a],n[o].id);break}t.detach(n[o])}},d.prototype.templateDestroy=function(e,r){var n=e.template.destroy;e.template&&e.template.destroy&&("string"==typeof n?(n=t.getValue(n,window))({elementId:r}):e.template.destroy({elementId:r}))},d.prototype.getDistinctValues=function(e,t){for(var r={},n=[],l=0,o=e.length;l<o;l++){var i=e[l][t],s={};i in r||(r[i]=1,s[t]=i,n.push(s))}return n},d.prototype.renderMultiSelect=function(e,t,r,o){var i=this.getDistinctValues(this.dataSource,e.field);new n.MultiSelect({dataSource:new l.DataManager(i),query:new l.Query([e.field]),fields:{text:e.field,value:e.field},value:o,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,r)}).appendTo("#"+t+"_valuekey"+r)},d.prototype.processTemplate=function(e,r,n,l){var o=t.closest(e,".e-rule-container").querySelectorAll(".e-template");o.length<2?r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o[0],values:n.value,operator:l.operator}):r.template&&r.template.write&&r.template.write({elements:o[0],values:n.value,operator:l.operator}):r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o,values:n.value,operator:l.operator}):r.template&&r.template.write&&r.template.write({elements:o,values:n.value,operator:l.operator})},d.prototype.renderStringValue=function(e,t,r,n,l){var i,s=this.isImportRules?t.value:"";if(("in"===r||"notin"===r)&&this.dataSource.length>0)i=this.isImportRules?t.value:[],this.renderMultiSelect(t,e,n,i),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?l.style.width="100%":(l.style.width=null,l.style.minWidth="200px");else{"in"!==r&&"notin"!==r||(s=(i=this.isImportRules?t.value:[]).join(","));var a=new o.TextBox({placeholder:"Value",input:this.changeValue.bind(this,n)});a.appendTo("#"+e+"_valuekey"+n),a.value=s,a.dataBind()}},d.prototype.renderNumberValue=function(e,t,r,n,l,i,s){var a,u=this.isImportRules?t.value:0;if(("in"===r||"notin"===r)&&this.dataSource.length>0)a=this.isImportRules?t.value:[],this.renderMultiSelect(t,e,n,a),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?l.style.width="100%":(l.style.minWidth="200px",l.style.width=null);else if("in"===r||"notin"===r){var p=(a=this.isImportRules?t.value:[]).join(","),d=new o.TextBox({placeholder:"Value",input:this.changeValue.bind(this,n)});d.appendTo("#"+e+"_valuekey"+n),d.value=p,d.dataBind()}else{var c=i.validation&&i.validation.min?i.validation.min:0,h=i.validation&&i.validation.max?i.validation.max:Number.MAX_VALUE,m=i.format?i.format:"#";s>1&&t&&(u=t.value[n]);new o.NumericTextBox({value:u,format:m,min:c,max:h,width:"100%",step:i.step?i.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}},d.prototype.processValueString=function(e,t){var r=[],n=e.split(",");if("string"===t)return n;for(var l=0,o=n.length;l<o;l++)r.push(Number(n[l]));return r},d.prototype.renderControls=function(e,n,l,o){if(t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),n.template)this.processTemplate(e,n,l,o);else{var s="boolean"===o.type||o.operator&&o.operator.toLowerCase().indexOf("between")>-1?2:1,a=t.closest(e,".e-rule-container").id,u=void 0;if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){u=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?u.style.width="100%":"in"!==o.operator&&"notin"!==o.operator&&(u.style.width="200px");for(var p=0;p<s;p++)switch(o.type){case"string":this.renderStringValue(a,l,o.operator,p,u);break;case"number":this.renderNumberValue(a,l,o.operator,p,u,n,s);break;case"boolean":var d=n.values&&n.values.length?n.values:["True","False"],c=!this.isImportRules||Boolean(l.value);new r.RadioButton({label:d[p],name:a+"default",checked:c,change:this.changeValue.bind(this,p)}).appendTo("#"+a+"_valuekey"+p);break;case"date":var h=new Date;this.isImportRules&&l&&l.value&&(h=s>1?new Date(l.value[p]):new Date(l.value));var m=n.format?n.format:"MM/dd/yyyy";new i.DatePicker({value:h,format:m,change:this.changeValue.bind(this,p)}).appendTo("#"+a+"_valuekey"+p)}}}},d.prototype.renderValues=function(e,r,n,l,o,i,s){if(l){var a=t.getComponent(e.querySelector("input"),"dropdownlist");r.operators?(a.dataSource=r.operators,a.index=0!==a.index?0:1,a.dataBind(),i.operator=a.value):r.type&&(a.dataSource=this.customOperators[r.type+"Operator"],a.index=0!==a.index?0:1,a.dataBind(),i.operator=a.value)}var u=t.closest(e,".e-rule-container").id;n&&n.template&&(this.templateDestroy(n,u+"_valuekey0"),t.detach(e.nextElementSibling.querySelector("#"+u+"_valuekey0"))),l&&this.destroyControls(e);var p=document.getElementById(s.id.replace("operatorkey","filterkey")),d=t.getComponent(p,"dropdownlist");if(r.template||this.columns[d.index].template){r.template=this.columns[d.index].template;var c=void 0;if(r.template&&"string"==typeof r.template.create?c=t.getValue(r.template.create,window)():r.template&&r.template.create&&(c=r.template.create()),c instanceof Element)c.id=u+"_valuekey0",t.addClass([c],"e-template"),t.addClass([c],"e-"+r.field),e.nextElementSibling.appendChild(c);else{t.addClass(c,"e-template");for(var h=0,m=c.length;h<m;h++)c[h].id=u+"_valuekey"+h,e.nextElementSibling.appendChild(c[h])}var y=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?y.style.width="100%":y.style.minWidth="200px"}else if("boolean"===i.type||i.operator&&i.operator.toLowerCase().indexOf("between")>-1)for(h=0;h<2;h++){c=void 0;c=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+h}}),e.nextElementSibling.appendChild(c)}else{c=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey0"}});e.nextElementSibling.appendChild(c)}this.renderControls(e,r,o,i)},d.prototype.updateValues=function(e,r){var n=e.className.split(" e-")[1],l=parseInt(e.id.slice(-1),2);switch(n){case"textbox":case"dropdownlist":case"radio":r.value=t.getComponent(e,n).value;break;case"numerictextbox":r.operator.indexOf("between")>-1?r.value[l]=t.getComponent(e,n).value:r.value=t.getComponent(e,n).value;break;case"datepicker":r.operator.indexOf("between")>-1?r.value[l]=t.getComponent(e,n).value:r.value=this.intl.formatDate(t.getComponent(e,n).value,{type:"dateTime",format:"MM/dd/yyyy"})}},d.prototype.updateRules=function(e,r,l){for(var o,i,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),t.closest(e,".e-rule-filter")){o=t.getComponent(e,"dropdownlist"),a.rules[p].field=this.columns[o.index].field,a.rules[p].type=this.columns[o.index].type,a.rules[p].label=this.columns[o.index].label;var d=t.closest(e,".e-rule-filter"),c=d.nextElementSibling.querySelector("input.e-control"),h=t.getComponent(c,"dropdownlist").value;a.rules[p].operator=h,(c=d.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(c=d.nextElementSibling.nextElementSibling.querySelector("div.e-control")),i={groupID:s.id,ruleID:u.id,selectedItem:r,cancel:!1},this.updateValues(c,a.rules[p]),this.trigger("fieldChanged",i),this.allowValidation&&a.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy()}else if(t.closest(e,".e-rule-operator")){o=t.getComponent(e,"dropdownlist"),a.rules[p].operator=o.value;var m=void 0;e.parentElement;m=u.querySelectorAll(".e-rule-value input.e-control"),i={groupID:s.id,ruleID:u.id,selectedItem:r,cancel:!1},this.allowValidation&&a.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),m.length>1&&(a.rules[p].value=[]);for(var y=0;y<m.length;y++)this.updateValues(m[y],a.rules[p]);this.trigger("operatorChanged",i)}else if(t.closest(e,".e-rule-value")&&null!==r){if(e.className.indexOf("e-template")>-1){var f=a.rules[p].operator.toLowerCase();r instanceof Array?f.indexOf("in")>-1&&f.indexOf("contains")<0||f.indexOf("between")>-1?a.rules[p].value=r:a.rules[p].value=r[0]:a.rules[p].value=r,i={groupID:s.id,ruleID:u.id,selectedItem:r,cancel:!1},this.trigger("valueChanged",i)}else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[l]=r:a.rules[p].value=r;else if(e.className.indexOf("e-radio")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-multiselect")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-textbox")>-1)"in"===a.rules[p].operator||"notin"===a.rules[p].operator?(a.rules[p].type,a.rules[p].value=this.processValueString(r,a.rules[p].type)):a.rules[p].value=r;else if(e.className.indexOf("e-datepicker")>-1){var g=t.getInstance(u.querySelector(".e-rule-filter input"),n.DropDownList),v={type:"dateTime",format:this.columns[g.index].format||"MM/dd/yyyy"};v.type&&(a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[l]=this.intl.formatDate(r,v):a.rules[p].value=this.intl.formatDate(r,v))}this.validatValue(a,p,u)}},d.prototype.validatValue=function(e,r,n){if(this.allowValidation&&e.rules[r].value){var l=n.querySelectorAll(".e-rule-value .e-control");if(l[0].parentElement.className.indexOf("e-searcher")>-1){var o=t.closest(l[0],".e-multi-select-wrapper");o.className.indexOf("e-tooltip")>-1&&t.getComponent(o,"tooltip").destroy()}else l[0].parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(l[0].parentElement,"tooltip").destroy();l[1]&&l[1].parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(l[1].parentElement,"tooltip").destroy()}},d.prototype.findGroupByIdx=function(e,t,r){var n=t.rules;if(!r&&n[e]){if((t=n[e]).rules)return t;for(var l=e+1,o=n.length;l<o;l++)if((t=n[l]).rules)return t}return t},d.prototype.destroy=function(){if(this.element){var r,n,l;for(e.prototype.destroy.call(this),l=(r=this.element.querySelectorAll(".e-addrulegroup")).length,n=0;n<l;n++)t.getComponent(r[n],"dropdown-btn").destroy(),t.detach(r[n]);for(l=(r=this.element.querySelectorAll(".e-rule-filter .e-control")).length,n=0;n<l;n++)t.getComponent(r[n],"dropdownlist").destroy(),t.detach(r[n]);for(l=(r=this.element.querySelectorAll(".e-rule-operator .e-control")).length,n=0;n<l;n++)t.getComponent(r[n],"dropdownlist").destroy(),t.detach(r[n]);this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_e_group0"]=[0],this.rule={condition:"and",rules:[]},this.element.innerHTML="",t.classList(this.element,[],["e-rtl","e-responsive","e-device"])}},d.prototype.addRules=function(e,t){for(var r={groupID:t},n=0,l=e.length;n<l;n++)this.addRuleElement(document.getElementById(t),e[n]);this.trigger("ruleInsert",r)},d.prototype.addGroups=function(e,t){var r=document.getElementById(t),n=this.getGroup(r),l={groupID:t};if(e.length)for(var o=0,i=e.length;o<i;o++)this.importRules(e[o],r);else n.rules.push({condition:"and",rules:[]});this.trigger("groupInsert",l)},d.prototype.initWrapper=function(){if(this.cssClass&&t.addClass([this.element],this.cssClass),this.enableRtl&&t.addClass([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),t.Browser.isDevice||"Vertical"===this.displayMode?(t.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),t.removeClass(document.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.addClass(document.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.isImportRules&&this.summaryView)this.renderSummary();else{if(this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition);var e=t.extend({},this.rule,{},!0);this.setGroupRules(e)}else this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});for(var r=document.querySelectorAll("label.e-btn"),n=void 0,l=0;l<r.length;l++)n=r.item(l),t.rippleEffect(n,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"}}),r=this.createElement("button",{attrs:{class:"e-edit-rule e-css e-btn e-small"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),r.textContent=this.l10n.getConstant("Edit"),e.appendChild(r),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("button",{attrs:{class:"e-collapse-rule e-css e-btn e-small"}});e.appendChild(this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-collapse-icon"}})),this.element.querySelector(".e-group-header").appendChild(e)},d.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new l.DataManager(this.columns).executeLocal((new l.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new l.DataManager(this.columns).executeLocal((new l.Query).sortBy("field")))},d.prototype.onPropertyChanged=function(e,r){for(var n=0,l=Object.keys(e);n<l.length;n++){switch(l[n]){case"summaryView":var o=this.element.querySelector(".e-group-container"),i=this.element.querySelector(".e-summary-content");e.summaryView?(o.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),i=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),i.style.display="block"):(o.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),o.style.display="block",i.style.display="none");break;case"displayMode":"Horizontal"===e.displayMode?(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode")):(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"));break;case"showButtons":e.showButtons.ruleDelete?t.removeClass(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"),e.showButtons.groupDelete?t.removeClass(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide");break;case"cssClass":r.cssClass&&t.removeClass([this.element],r.cssClass.split(" ")),e.cssClass&&t.addClass([this.element],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?t.addClass([this.element],"e-rtl"):t.removeClass([this.element],"e-rtl");break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource;break;case"columns":this.columns=e.columns,this.columnSort();break;case"sortDirection":this.sortDirection=e.sortDirection,this.columnSort();break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rule":this.rule=e.rule;break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale}}},d.prototype.preRender=function(){this.defaultLocale={StartsWith:"Starts With",EndsWith:"Ends With",Contains:"Contains",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",Empty:"Empty",NotEmpty:"Not Empty",In:"In",NotIn:"Not In",NotContains:"Not Contains",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE"},this.operatorValue={equal:"Equal",greaterthan:"GreaterThan",greaterthanorequal:"GreaterThanOrEqual",lessthan:"LessThan",lessthanorequal:"LessThanOrEqual",notequal:"NotEqual",empty:"Empty",notempty:"NotEmpty",between:"Between",in:"in",notin:"NotIn",notbetween:"NotBetween",startswith:"StartsWith",endswith:"EndsWith",contains:"Contains"}},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate(),this.initialize(),this.initWrapper(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this)},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler)},d.prototype.getGroup=function(e,t){for(var r=this.levelColl[e.id],n=t?r.length-1:r.length,l=this.rule,o=0;o<n;o++)l=this.findGroupByIdx(r[o],l,0===o);return l},d.prototype.deleteGroup=function(e){var r,n,l=e,o=l.id,i=this.getGroup(l,!0),s=0,a={groupID:o};this.trigger("groupDelete",a);var u=l.nextElementSibling,p=l.previousElementSibling,d=l.querySelectorAll(".e-group-container"),c=e.querySelectorAll(".e-tooltip");for(n=c.length,r=0;r<n;r++)t.getComponent(c[r],"tooltip").destroy();for(r=0,n=d.length;r<n;r++)delete this.levelColl[d[r].id];for(;null!==l.previousElementSibling;)l=l.previousElementSibling,s++;u&&u.className.indexOf("e-separate-rule")>-1&&(t.removeClass([u],"e-separate-rule"),t.addClass([u],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&t.addClass([p],"e-prev-joined-rule")),i.rules.splice(s,1),delete this.levelColl[o],t.detach(e)},d.prototype.deleteRule=function(e){var r,n=t.closest(e,".e-group-container"),l=this.getGroup(n),o=t.closest(e,".e-rule-container"),i=o,s=o.nextElementSibling,a=o.previousElementSibling,u={groupID:n.id,ruleID:o.id},p=0,d=o.querySelectorAll(".e-tooltip"),c=d.length;for(r=0;r<c;r++)t.getComponent(d[r],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,p++;l.rules.splice(p,1),this.trigger("ruleDelete",u),(!a||a.className.indexOf("e-rule-container")<0)&&s&&t.removeClass([s],"e-joined-rule"),(!s||s.className.indexOf("e-rule-container")<0)&&a&&t.removeClass([a],"e-prev-joined-rule"),t.detach(i)},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0)},d.prototype.setRules=function(e){var r=t.extend({},e,{},!0);this.setGroupRules(r)},d.prototype.getRules=function(){return this.rule},d.prototype.deleteGroups=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteGroup(document.getElementById(e[t]))},d.prototype.getFilteredRecords=function(){var e=(new l.Query).where(this.getPredicate(this.rule));return new l.DataManager(this.dataSource).executeLocal(e)},d.prototype.deleteRules=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteRule(document.getElementById(e[t]))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),r=[],n=0,o=Object.keys(this.columns);n<o.length;n++)r.push(this.columns[n].field);return e.rules.length?(new l.Query).select(r).where(t):(new l.Query).select(r)},d.prototype.getPredicate=function(e){for(var t,r,n,o=e.rules,i=!1,s=0,a=o.length;s<a;s++){if(Object.keys(o[s]).indexOf("rules")>-1)(r=this.getPredicate(o[s]))&&(t="and"===e.condition?t.and(r):t.or(r));else if(o[s].operator.length){n="date"===o[s].type?new Date(o[s].value):o[s].value;var u=o[s].operator.toLowerCase();if(i="contains"===u||"startswith"===u||"endswith"===u,0===s)if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s]);else{""!==(p=n)&&(t=new l.Predicate(o[s].field,o[s].operator,n,i))}else if("and"===e.condition)if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{var p=n;t&&""!==p?t=t.and(o[s].field,o[s].operator,n,i):""!==p&&(t=new l.Predicate(o[s].field,o[s].operator,n,i))}else if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{p=n;t&&""!==p?t=t.or(o[s].field,o[s].operator,n,i):""!==p&&(t=new l.Predicate(o[s].field,o[s].operator,n,i))}}}return t},d.prototype.arrayPredicate=function(e,t,r){for(var n,o=e.value,i=0,s=o.length;i<s;i++)if(""!==o[i])if(0===i)switch(e.operator){case"between":n=new l.Predicate(e.field,"greaterthan",o[i]);break;case"notbetween":n=new l.Predicate(e.field,"lessthan",o[i]);break;case"in":n=new l.Predicate(e.field,"equal",o[i]);break;case"notin":n=new l.Predicate(e.field,"notequal",o[i])}else switch(e.operator){case"between":n=n.and(e.field,"lessthan",o[i]);break;case"notbetween":n=n.or(e.field,"greaterthan",o[i]);break;case"in":n=n.or(e.field,"equal",o[i]);break;case"notin":n=n.and(e.field,"notequal",o[i])}return n&&(t?"and"===r?t=t.and(n):"or"===r&&(t=t.or(n)):t=n),t},d.prototype.importRules=function(e,r,n){n||(r=this.renderGroup(e.condition,r));for(var l=e.rules,o=0,i=l.length;o<i;o++){Object.keys(l[o]).indexOf("rules")>-1?(r=this.renderGroup(l[o].condition,r),r=this.importRules(l[o],r,!0)):this.renderRule(l[o],r)}return(r=t.closest(r,".e-rule-list"))&&(r=t.closest(r,".e-group-container")),r},d.prototype.renderGroup=function(e,t){this.addGroupElement(!0,t,e);var r=t.querySelectorAll(".e-group-container");return r[r.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.getSqlString=function(e,t){var r=!1;t?t+="(":(t="",r=!0);for(var n=e.condition,l=0,o=e.rules.length;l<o;l++){if(e.rules[l].rules)t=this.getSqlString(e.rules[l],t);else{var i=e.rules[l],s="";if(i.value instanceof Array)if("string"==typeof i.value[0]){s+='("'+i.value[0]+'"';for(var a=1,u=i.value.length;a<u;a++)s+=',"'+i.value[a]+'"';s+=")"}else s+="("+i.value+")";else"startswith"===i.operator?s+='("'+i.value+'%")':"endswith"===i.operator?s+='("%'+i.value+'")':"contains"===i.operator?s+='("%'+i.value+'%")':"number"===i.type?s+=i.value:s+='"'+i.value+'"';t+=i.field+" "+this.operators[i.operator]+" "+s}l!==o-1&&(t+=" "+n+" ")}return r||(t+=")"),t},d.prototype.setRulesFromSql=function(e){var t=this.getRulesFromSql(e);this.setRules({condition:t.condition,rules:t.rules})},d.prototype.getRulesFromSql=function(e){return this.parser=[],this.sqlParser(e),this.rule={condition:"",rules:[]},this.processParser(this.parser,this.rule,[0])},d.prototype.getSqlFromRules=function(e){return this.getSqlString(e).replace(/"/g,"'")},d.prototype.sqlParser=function(e){var t,r=0;do{t=e.slice(r),r+=this.parseSqlStrings(t)}while(""!==t);return this.parser},d.prototype.parseSqlStrings=function(e){for(var t,r,n=["=","!=","<",">","<=",">="],l=["and","or"],o=["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN"],i=0,s=n.length;i<s;i++)if(t=/^\w+$/.test(n[i])?"\\b":"",new RegExp("^("+n[i]+")"+t,"ig").exec(e))return this.parser.push(["Operators",n[i].toLowerCase()]),n[i].length;for(i=0,s=l.length;i<s;i++)if(t=/^\w+$/.test(l[i])?"\\b":"",new RegExp("^("+l[i]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",l[i].toLowerCase()]),l[i].length;for(i=0,s=o.length;i<s;i++)if(t=/^\w+$/.test(o[i])?"\\b":"",new RegExp("^("+o[i]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",o[i].toLowerCase()]),o[i].length;return/^\(/.exec(e)?(this.parser.push(["Left","("]),1):/^\)/.exec(e)?(this.parser.push(["Right",")"]),1):/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)?(r=/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",r]),r.length):/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)?(r=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],this.parser.push(["String",r]),r.length):/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(r=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",r]),r.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(r=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",r]),r.length):1},d.prototype.getOperator=function(e,t){return 0===e.indexOf("%")&&e.indexOf("%")===e.length-1?"contains":0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"startswith":0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"endswith":{"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween"}[t]},d.prototype.processParser=function(e,t,r){for(var n,l,o,i,s,a,u,p,d,c,h=[],m=[],y=0,f=e.length;y<f;y++)if("Literal"===e[y][0]){if(n={label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){for(n.operator=this.getOperator(e[y+3][1].replace(/'/g,""),e[y+1][1]),c=e[y+1][1],o=++y+1,i=f,o=y+1;o<i;o++){if("Right"===e[o][0]){y=o;break}"like"===c&&"String"===e[o][0]?(n.value=e[o][1].replace(/'/g,"").replace(/%/g,""),n.type="string"):"Number"===e[o][0]?h.push(Number(e[o][1])):"String"===e[o][0]&&m.push(e[o][1].replace(/'/g,""))}"like"!==c&&("Number"===e[o-1][0]?(n.value=h,n.type="number"):"String"===e[o-1][0]&&(n.value=m,n.type="string"))}else"Operators"===e[y+1][0]&&(n.operator=this.getOperator(e[y+2][1],e[y+1][1]),"Number"===e[y+2][0]?(n.type="number",n.value=Number(e[y+2][1])):(n.type="string",n.value=e[y+2][1].replace(/'/g,"")));t.rules.push(n)}else{if("Left"===e[y][0]){for(l={condition:"",rules:[]},this.parser=e.splice(y+1,f-(y+1)),d=0,a=t.rules.length,s=0;s<a;s++)t.rules[s].rules&&d++;return r.push(d),t.rules.push(l),l=this.processParser(this.parser,l,r),t}if("Conditions"===e[y][0])t.condition=e[y][1];else if("Right"===e[y][0]){for(this.parser=e.splice(y+1,f-(y+1)),r.pop(),t=this.rule,p=r.length,u=0;u<p;u++)t=this.findGroupByIdx(r[u],t,0===u);return this.processParser(this.parser,t,r)}}return t},p([t.Event()],d.prototype,"created",void 0),p([t.Event()],d.prototype,"beforeConditionChange",void 0),p([t.Event()],d.prototype,"beforeFieldChange",void 0),p([t.Event()],d.prototype,"beforeOperatorChange",void 0),p([t.Event()],d.prototype,"beforeValueChange",void 0),p([t.Event()],d.prototype,"conditionChanged",void 0),p([t.Event()],d.prototype,"fieldChanged",void 0),p([t.Event()],d.prototype,"valueChanged",void 0),p([t.Event()],d.prototype,"operatorChanged",void 0),p([t.Event()],d.prototype,"groupDelete",void 0),p([t.Event()],d.prototype,"ruleDelete",void 0),p([t.Event()],d.prototype,"groupInsert",void 0),p([t.Event()],d.prototype,"ruleInsert",void 0),p([t.Property({ruleDelete:!0,groupInsert:!0,groupDelete:!0})],d.prototype,"showButtons",void 0),p([t.Property(!1)],d.prototype,"summaryView",void 0),p([t.Property(!1)],d.prototype,"allowValidation",void 0),p([t.Property([])],d.prototype,"columns",void 0),p([t.Property("")],d.prototype,"cssClass",void 0),p([t.Property([])],d.prototype,"dataSource",void 0),p([t.Property("Horizontal")],d.prototype,"displayMode",void 0),p([t.Property(!1)],d.prototype,"enableRtl",void 0),p([t.Property(!1)],d.prototype,"enablePersistence",void 0),p([t.Property("Default")],d.prototype,"sortDirection",void 0),p([t.Property(5)],d.prototype,"maxGroupCount",void 0),p([t.Property("auto")],d.prototype,"height",void 0),p([t.Property("auto")],d.prototype,"width",void 0),p([t.Complex({condition:"and",rules:[]},h)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);e.Columns=d,e.Rules=c,e.Rule=h,e.ShowButtons=m,e.QueryBuilder=y,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-querybuilder.umd.min.js.map
/*!
* filename: ej2-querybuilder.min.js
* version : 16.4.40-beta
* version : 16.4.42
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.

@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license.

*/
this.ej=this.ej||{},this.ej.querybuilder=function(e,t,r,l,n,o,i,s,a){"use strict";var u=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function l(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(l.prototype=r.prototype,new l)}}(),p=function(e,t,r,l){var n,o=arguments.length,i=o<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,r):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,l);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o<3?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};l.MultiSelect.Inject(l.CheckBoxSelection);var d=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"values",void 0),p([t.Property(null)],r.prototype,"operators",void 0),p([t.Property(null)],r.prototype,"template",void 0),p([t.Property(null)],r.prototype,"validation",void 0),p([t.Property(null)],r.prototype,"format",void 0),p([t.Property(null)],r.prototype,"step",void 0),r}(t.ChildProperty),c=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"operator",void 0),p([t.Property(null)],r.prototype,"value",void 0),r}(t.ChildProperty),h=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("and")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),r}(t.ChildProperty),m=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(!0)],r.prototype,"ruleDelete",void 0),p([t.Property(!0)],r.prototype,"groupInsert",void 0),p([t.Property(!0)],r.prototype,"groupDelete",void 0),r}(t.ChildProperty),y=function(e){function d(r,l){var n=e.call(this,r,l)||this;return n.groupIdCounter=0,n.ruleIdCounter=0,n.btnGroupId=0,n.isImportRules=!1,n.parser=[],n.intl=new t.Internationalization,n.customOperators={},n.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE"},n.operatorValue={equal:"Equal",greaterthan:"GreaterThan",greaterthanorequal:"GreaterThanOrEqual",lessthan:"LessThan",lessthanorequal:"LessThanOrEqual",notequal:"NotEqual",empty:"Empty",notempty:"NotEmpty",between:"Between",in:"in",notin:"NotIn",notbetween:"NotBetween",startswith:"StartsWith",endswith:"EndsWith",contains:"Contains"},n.validationRules={},n}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;var e=this.element.querySelector(".e-group-body");t.detach(e.children[0]),e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_e_group0"]=[0],this.rule={condition:"and",rules:[]}},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.initialize=function(){if(this.dataSource.length){var e=Object.keys(this.dataSource[0]),t=[],r=void 0,l=!1,o=void 0;if(this.columns.length){"descending"===this.sortDirection.toLowerCase()?this.columns=new n.DataManager(this.columns).executeLocal((new n.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new n.DataManager(this.columns).executeLocal((new n.Query).sortBy("field")));for(var i=this.columns,s=0,a=i.length;s<a;s++)i[s].type||(e.indexOf(i[s].field)>-1&&("string"===(r=typeof(o=this.dataSource[0][i[s].field]))?l=!isNaN(Date.parse(o)):"object"===r&&(l=o instanceof Date&&!isNaN(o.getTime()),r="string"),i[s].type=r,l=!1),r="string")}else{for(var s=0,a=e.length;s<a;s++)"string"===(r=typeof(o=this.dataSource[0][e[s]]))?l=!isNaN(Date.parse(o)):"object"===r&&(l=o instanceof Date&&!isNaN(o.getTime()),r="string"),t[s]={field:e[s],label:e[s],type:l?"date":r},l=!1;this.columns=t}}},d.prototype.clickEventHandler=function(e){var r=e.target;if(this.isImportRules=!1,"SPAN"===r.tagName&&(r=r.parentElement),"BUTTON"===r.tagName)if(r.className.indexOf("e-removerule")>-1)r.className.indexOf("e-tooltip")>-1&&t.getComponent(r,"tooltip").destroy(),this.deleteRule(r);else if(r.className.indexOf("e-deletegroup")>-1)t.getComponent(r,"tooltip").destroy(),this.deleteGroup(t.closest(r,".e-group-container"));else if(r.className.indexOf("e-edit-rule")>-1)if(document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition);var l=t.extend({},this.rule,{},!0);this.setGroupRules(l),this.renderSummaryCollapse()}else(n=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),n.style.display="block";else if(r.className.indexOf("e-collapse-rule")>-1){var n=this.element.querySelector(".e-group-container");n.style.display="none",this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),document.getElementById(this.element.id+"_summary_content").style.display="block"}else r.className.indexOf("e-collapse-rule")>-1&&(this.element.querySelector(".e-group-container").style.display="none",this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),document.getElementById(this.element.id+"_summary_content").style.display="block");else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1){var o=t.closest(r,".e-group-container"),i={groupID:o.id,selectedItem:r,cancel:!1};this.trigger("beforeConditionChange",i),this.getGroup(o).condition=r.textContent.toLowerCase(),i={groupID:o.id,selectedItem:r},this.trigger("conditionChanged",i)}},d.prototype.selectBtn=function(e,r){"beforeOpen"===r.name?t.addClass([r.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide1"):r.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):r.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},d.prototype.addRuleElement=function(e,r){var n=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.className="e-rule-container e-vertical-mode":n.className="e-rule-container e-horizontal-mode";var o,i,s,u,p,d,c=e.querySelector(".e-rule-list"),h=n.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?h.textContent=this.l10n.getConstant("Remove"):(t.addClass([h],"e-round"),t.addClass([h],"e-icon-btn"),new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(h),h=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),n.querySelector("button").appendChild(h)),n.setAttribute("id",e.id+"_e_rule"+this.ruleIdCounter),this.ruleIdCounter++,n.querySelector(".e-filter-input").setAttribute("id",n.id+"_filterkey"),c.appendChild(n),d=this.element.className.indexOf("e-device")>-1?"250px":"200px",(p=new l.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?d:"auto",change:this.changeField.bind(this),value:r?r.field:null})).appendTo("#"+n.id+"_filterkey"),this.allowValidation&&(n.querySelector(".e-filter-input").setAttribute("name",n.id+"field"),t.addClass([n.querySelector(".e-filter-input")],"e-error"),this.validationRules[n.id+"field"]={required:!0}),this.filterIndex=p.index,o=this.levelColl[e.id],!this.isImportRules){for(i=this.rule,s=0,u=o.length;s<u;s++)i=this.findGroupByIdx(o[s],i,0===s);Object.keys(r).length?i.rules.push({field:r.field,type:r.type,label:r.label,operator:r.operator,value:r.value}):i.rules.push({field:"",type:"",label:"",operator:"",value:[]})}Object.keys(r).length&&this.changeRule(r,{element:p.element,itemData:this.columns[this.filterIndex]})},d.prototype.validateFields=function(){var e,r,l,n,o,i,s=Object.keys(this.validationRules),a=s.length;for(e=0;e<a;e++)if(r=this.element.querySelector("[name="+s[e]+" ]")){for(l=t.closest(r,".e-group-container"),n=this.getGroup(l),o=t.closest(r,".e-rule-container"),i=0;o&&null!==o.previousElementSibling;)o=o.previousElementSibling,i++;t.closest(r,".e-rule-filter")&&(n.rules[i].field?t.removeClass([r.parentElement],"e-error"):t.addClass([r.parentElement],"e-error")),t.closest(r,".e-rule-operator")&&(n.rules[i].operator?t.removeClass([r.parentElement],"e-error"):t.addClass([r.parentElement],"e-error")),t.closest(r,".e-rule-value")&&(n.rules[i].value?t.removeClass([r.parentElement],"e-error"):t.addClass([r.parentElement],"e-error"))}},d.prototype.groupTemplate=function(){var e,t,r,l,n,o,i,s,a;return e=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),t=this.createElement("div",{attrs:{class:"e-group-body"}}),l=this.createElement("div",{attrs:{class:"e-rule-list"}}),e.appendChild(r),t.appendChild(l),e.appendChild(t),n=this.createElement("div",{attrs:{class:"e-btn-group"}}),(o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),n.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl"},innerHTML:"AND"}),n.appendChild(i),o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),n.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl"},innerHTML:"OR"}),n.appendChild(i),r.appendChild(n),s=this.createElement("div",{attrs:{class:"e-group-action"}}),a=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),s.appendChild(a),r.appendChild(s),e},d.prototype.ruleTemplate=function(){var e,t,r,l,n;return e=this.createElement("div"),n=this.createElement("div",{attrs:{class:"e-rule-field"}}),r=this.createElement("div",{attrs:{class:"e-rule-filter"}}),t=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}}),r.appendChild(t),n.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-operator"}}),n.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-value"}}),n.appendChild(r),e.appendChild(n),l=this.createElement("button",{attrs:{class:"e-removerule e-rule-delete e-control e-btn e-small"}}),n.appendChild(l),e},d.prototype.addGroupElement=function(e,l,n,o){if(!(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var i,u=this.groupElem.cloneNode(!0);u.setAttribute("id",this.element.id+"_e_group"+this.groupIdCounter),this.groupIdCounter++;var p=u.querySelector(".e-btngroup-and"),d=u.querySelector(".e-btngroup-or"),c=u.querySelector(".e-btngroup-and-lbl"),h=u.querySelector(".e-btngroup-or-lbl");if(p.setAttribute("id",this.element.id+"_and"+this.btnGroupId),d.setAttribute("id",this.element.id+"_or"+this.btnGroupId),p.setAttribute("name",this.element.id+"_and"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("for",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){i=this.createElement("button",{attrs:{class:"e-deletegroup"}}),new r.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(i),new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(i),t.rippleEffect(i,{selector:".deletegroup"}),u.querySelector(".e-group-action").appendChild(i);var m=l.querySelector(".e-rule-list"),y=l.querySelectorAll(".e-group-container").length;m.appendChild(u);var g=this.levelColl[l.id].slice(0);g.push(y),this.levelColl[u.id]=g,this.isImportRules||(this.addGroups([],l.id),o&&this.addRuleElement(u,{}))}else l.appendChild(u),this.levelColl[u.id]=[0];u.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===n&&u.querySelector(".e-btngroup-or").setAttribute("checked","true");var f=u.querySelector(".e-add-btn");new s.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,f),select:this.selectBtn.bind(this,f)}).appendTo(f),t.rippleEffect(f,{selector:".e-round"})}},d.prototype.notifyChange=function(e,r){for(var l=t.closest(r,".e-rule-value").querySelectorAll(".e-template"),n=[],o=0,i=l.length;o<i;o++)l[o].nextElementSibling&&l[o].nextElementSibling.className.indexOf("e-check")>-1&&n.push(l[o].textContent);this.updateRules(r,l.length>1?n:e)},d.prototype.changeValue=function(e,r){var l,n;(n=r.event?r.event.target:r.element).className.indexOf("e-day")>-1&&(n=r.element);var o=t.closest(n,".e-group-container"),i=r;i.element&&i.element.className.indexOf("e-datepicker")>-1&&(n=i.element);var s;s=n.className.indexOf("e-radio")>-1?t.getComponent(n,"radio").label:n.className.indexOf("e-multiselect")>-1?t.getComponent(n,"multiselect").value:r.value,l={groupID:o.id,filterID:n.id,value:s,cancel:!1},this.trigger("beforeValueChange",l),this.updateRules(n,s,e),l={groupID:o.id,filterID:n.id,value:s,cancel:!1},this.trigger("valueChanged",l)},d.prototype.changeField=function(e){for(var r=t.closest(e.element,".e-group-container"),l=this.getGroup(r),n=t.closest(e.element,".e-rule-container"),o=0;n&&null!==n.previousElementSibling;)n=n.previousElementSibling,o++;this.changeRule(l.rules[o],e)},d.prototype.changeRule=function(e,r){if(r.itemData){var n,o,i,s,a={};o=t.closest(r.element,".e-rule-filter"),i=t.closest(r.element,".e-rule-operator");var u=t.getComponent(r.element,"dropdownlist"),p=t.closest(r.element,".e-group-container");if(o){d={groupID:p.id,filterID:r.element.id,selectedItem:r.item,cancel:!1};this.trigger("beforeFieldChange",d),a.type=this.columns[u.index].type}if(i){var d={groupID:p.id,filterID:r.element.id,selectedItem:r.item,cancel:!1};this.trigger("beforeFieldChange",d),a.operator=r.itemData.value;var c=document.getElementById(r.element.id.replace("operatorkey","filterkey")),h=t.getComponent(c,"dropdownlist");if(!this.columns[h.index].template&&((a.operator.toLowerCase().indexOf("between")>-1||a.operator.toLowerCase().indexOf("in")>-1&&a.operator.toLowerCase().indexOf("contains")<0)&&(o=i.previousElementSibling,a.type=e.type),r.previousItemData)){var m=r.previousItemData.value.toLowerCase();(m.indexOf("between")>-1||m.indexOf("in")>-1&&m.indexOf("contains")<0)&&(o=i.previousElementSibling,a.type=e.type)}}if(o)if((i=o.nextElementSibling).childElementCount)this.renderValues(i,r.itemData,r.previousItemData,!0,e,a);else{var y=t.closest(i,".e-rule-container").id;s=this.createElement("input",{attrs:{type:"text",id:y+"_operatorkey"}}),i.appendChild(s),this.columns[u.index].operators?n=this.columns[u.index].operators:r.itemData&&(n=this.customOperators[this.columns[u.index].type+"Operator"]);var g=this.element.className.indexOf("e-device")>-1?"250px":"200px",f=new l.DropDownList({dataSource:n,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:n.length>5?g:"auto",change:this.changeField.bind(this),index:0,value:e?this.l10n.getConstant(this.operatorValue[e.operator]):null});f.appendTo("#"+y+"_operatorkey"),this.allowValidation&&(s.setAttribute("name",y+"operator"),t.addClass([s],"e-error"),this.validationRules[y+"operator"]={required:!0}),a.operator=e?e.operator:"",this.isImportRules&&(f.value=e.operator,f.dataBind(),a.type=this.columns[u.index].type,a.operator=e.operator),this.renderValues(i,this.columns[u.index],r.previousItemData,!1,e,a)}this.isImportRules||this.updateRules(r.element,r.item)}},d.prototype.destroyControls=function(e){var r;r=e.nextElementSibling.querySelectorAll("input.e-control");var l;l=e.nextElementSibling.querySelectorAll("div.e-control");for(var n=this.columns,o=0,i=r.length;o<i;o++){if(r[o].classList.contains("e-textbox"))t.getComponent(r[o],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-dropdownlist"))t.getComponent(r[o],"dropdownlist").destroy();else if(r[o].classList.contains("e-radio"))t.getComponent(r[o],"radio").destroy();else if(r[o].classList.contains("e-numerictextbox"))t.getComponent(r[o],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-datepicker"))t.getComponent(r[o],"datepicker").destroy();else if(r[o].classList.contains("e-multiselect"))t.getComponent(r[o],"multiselect").destroy();else if(r[o].className.indexOf("e-template")>-1)for(var s=r[o].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],r[o].id);break}t.detach(r[o])}for(var o=0,i=l.length;o<i;o++){if(l[o].className.indexOf("e-template")>-1)for(var s=l[o].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],l[o].id);break}t.detach(l[o])}},d.prototype.templateDestroy=function(e,r){var l=e.template.destroy;e.template&&e.template.destroy&&("string"==typeof l?(l=t.getValue(l,window))({elementId:r}):e.template.destroy({elementId:r}))},d.prototype.getDistinctValues=function(e,t){for(var r={},l=[],n=0,o=e.length;n<o;n++){var i=e[n][t],s={};i in r||(r[i]=1,s[t]=i,l.push(s))}return l},d.prototype.renderMultiSelect=function(e,r,o,i){var s=this.getDistinctValues(this.dataSource,e.field);new l.MultiSelect({dataSource:new n.DataManager(s),query:new n.Query([e.field]),fields:{text:e.field,value:e.field},value:i,mode:"CheckBox",width:"100%,",change:this.changeValue.bind(this,o)}).appendTo("#"+r+"_valuekey"+o),t.addClass([document.getElementById(r).querySelector(".e-rule-value")],"e-rule-multiselect")},d.prototype.processTemplate=function(e,r,l,n){var o=t.closest(e,".e-rule-container").querySelectorAll(".e-template");o.length<2?this.isImportRules?r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o[0],values:l.value}):r.template&&r.template.write&&r.template.write({elements:o[0],values:l.value}):r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o[0]}):r.template&&r.template.write&&r.template.write({elements:o[0]}):this.isImportRules?r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o,values:l.value}):r.template&&r.template.write&&r.template.write({elements:o,values:l.value}):r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o}):r.template&&r.template.write&&r.template.write({elements:o})},d.prototype.renderControls=function(e,l,n,s){if(l.template)this.processTemplate(e,l,n,s);else{var a="boolean"===s.type||s.operator&&s.operator.toLowerCase().indexOf("between")>-1?2:1,u=t.closest(e,".e-rule-container").id,p=void 0;(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1)&&(p=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")<0&&(p.style.width="200px"));for(var d=0;d<a;d++)switch(s.type){case"string":f=this.isImportRules?n.value:"";if("in"===s.operator||"notin"===s.operator){h=this.isImportRules?n.value:[];this.renderMultiSelect(n,u,d,h),this.element.className.indexOf("e-device")<0&&(p.style.width="300px")}else{var c=new o.TextBox({placeholder:"Value",input:this.changeValue.bind(this,d)});c.appendTo("#"+u+"_valuekey"+d),c.value=f,c.dataBind(),this.allowValidation&&l.validation&&(c.element.setAttribute("name",u+d),t.addClass([c.element],"e-error"),this.validationRules[u+d]={required:!0})}break;case"number":f=this.isImportRules?n.value:0;if("in"===s.operator||"notin"===s.operator){var h=this.isImportRules?n.value:[];this.renderMultiSelect(n,u,d,h),this.element.className.indexOf("e-device")<0&&(p.style.width="300px")}else{var m=new o.NumericTextBox({value:f,format:"#",width:"100%",change:this.changeValue.bind(this,d)});m.appendTo("#"+u+"_valuekey"+d),this.allowValidation&&(m.element.setAttribute("name",u+d),t.addClass([m.element],"e-error"),this.validationRules[u+d]={required:!0})}break;case"boolean":var y=l.values&&l.values.length?l.values:["True","False"],g=!this.isImportRules||Boolean(n.value);new r.RadioButton({label:y[d],name:u+"default",checked:g,change:this.changeValue.bind(this,d)}).appendTo("#"+u+"_valuekey"+d);break;case"date":var f=this.isImportRules?new Date(n.value):new Date,v=new i.DatePicker({value:f,format:"dd-MMM-yy",change:this.changeValue.bind(this,d)});v.appendTo("#"+u+"_valuekey"+d),this.allowValidation&&(v.element.setAttribute("name",u+d),this.validationRules[u+d]={required:!0})}}},d.prototype.renderValues=function(e,r,l,n,o,i){if(n){var s=t.getComponent(e.querySelector("input"),"dropdownlist");r.operators?(s.dataSource=r.operators,s.index=0!==s.index?0:1,s.dataBind()):r.type&&(s.dataSource=this.customOperators[r.type+"Operator"],s.index=0!==s.index?0:1,s.dataBind())}var a=t.closest(e,".e-rule-container").id;if(l&&l.template&&(this.templateDestroy(l,a+"_valuekey0"),t.detach(e.nextElementSibling.querySelector("#"+a+"_valuekey0"))),n&&this.destroyControls(e),r.template){d=void 0;if(r.template&&"string"==typeof r.template.create?d=t.getValue(r.template.create,window)():r.template&&r.template.create&&(d=r.template.create()),d instanceof Element)d.id=a+"_valuekey0",t.addClass([d],"e-template"),t.addClass([d],"e-"+r.field),e.nextElementSibling.appendChild(d);else{t.addClass(d,"e-template");for(var u=0,p=d.length;u<p;u++)d[u].id=a+"_valuekey"+u,e.nextElementSibling.appendChild(d[u])}this.element.className.indexOf("e-device")<0&&(e.parentElement.querySelector(".e-rule-value").style.width="200px")}else if("boolean"===i.type||i.operator&&i.operator.toLowerCase().indexOf("between")>-1)for(u=0;u<2;u++){d=void 0;d=this.createElement("input",{attrs:{type:"text",id:a+"_valuekey"+u}}),e.nextElementSibling.appendChild(d)}else{var d=this.createElement("input",{attrs:{type:"text",id:a+"_valuekey0"}});e.nextElementSibling.appendChild(d)}this.renderControls(e,r,o,i)},d.prototype.updateValues=function(e,r){var l=e.className.split(" e-")[1],n=parseInt(e.id.slice(-1),2);switch(l){case"textbox":case"dropdownlist":case"radio":r.value=t.getComponent(e,l).value;break;case"numerictextbox":r.operator.indexOf("between")>-1?r.value[n]=t.getComponent(e,l).value:r.value=t.getComponent(e,l).value;break;case"datepicker":var o={type:"dateTime",format:"dd-MMM-yy"};r.operator.indexOf("between")>-1?r.value[n]=t.getComponent(e,l).value:r.value=this.intl.formatDate(t.getComponent(e,l).value,o)}},d.prototype.updateRules=function(e,r,n){for(var o,i,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),t.closest(e,".e-rule-filter")){o=t.getComponent(e,"dropdownlist"),a.rules[p].field=this.columns[o.index].field,a.rules[p].type=this.columns[o.index].type,a.rules[p].label=this.columns[o.index].label;var d=t.closest(e,".e-rule-filter"),c=d.nextElementSibling.querySelector("input.e-control"),h=t.getComponent(c,"dropdownlist").value;a.rules[p].operator=h,(c=d.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(c=d.nextElementSibling.nextElementSibling.querySelector("div.e-control")),i={groupID:s.id,filterID:e,selectedItem:r,cancel:!1},this.trigger("fieldChanged",i),this.updateValues(c,a.rules[p]),a.rules[p].field?t.removeClass([e.parentElement],"e-error"):t.addClass([e.parentElement],"e-error")}else if(t.closest(e,".e-rule-operator")){o=t.getComponent(e,"dropdownlist"),a.rules[p].operator=o.value;var m=void 0;m=u.querySelectorAll(".e-rule-value input.e-control"),a.rules[p].value=[],i={groupID:s.id,filterID:e,selectedItem:r,cancel:!1},this.trigger("operatorChanged",i),a.rules[p].operator?t.removeClass([e.parentElement],"e-error"):t.addClass([e.parentElement],"e-error");for(var y=0;y<m.length;y++)this.updateValues(m[y],a.rules[p])}else if(t.closest(e,".e-rule-value")&&null!==r){if(e.className.indexOf("e-template")>-1){var g=a.rules[p].operator.toLowerCase();r instanceof Array?g.indexOf("in")>-1&&g.indexOf("contains")<0||g.indexOf("between")>-1?a.rules[p].value=r:a.rules[p].value=r[0]:a.rules[p].value=r,i={groupID:s.id,filterID:e,selectedItem:r,cancel:!1},this.trigger("valueChanged",i)}else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[n]=r:a.rules[p].value=r;else if(e.className.indexOf("e-radio")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-multiselect")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-textbox")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-datepicker")>-1){var f=t.getInstance(u.querySelector(".e-rule-filter input"),l.DropDownList),v={type:"dateTime",format:this.columns[f.index].format||"dd/MM/yyy"};v.type&&(a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[n]=this.intl.formatDate(r,v):a.rules[p].value=this.intl.formatDate(r,v))}a.rules[p].value?t.removeClass([e.parentElement],"e-error"):t.addClass([e.parentElement],"e-error")}},d.prototype.findGroupByIdx=function(e,t,r){var l=t.rules;if(!r&&l[e]){if((t=l[e]).rules)return t;for(var n=e+1,o=l.length;n<o;n++)if((t=l[n]).rules)return t}return t},d.prototype.destroy=function(){var e,r,l;for(l=(e=this.element.querySelectorAll(".e-addrulegroup")).length,r=0;r<l;r++)t.getComponent(e[r],"dropdown-btn").destroy(),t.detach(e[r]);this.reset(),this.unWireEvents()},d.prototype.addRules=function(e,t){var r={groupID:t,filterID:""};this.trigger("ruleDelete",r);for(var l=0,n=e.length;l<n;l++)this.addRuleElement(document.getElementById(t),e[l])},d.prototype.addGroups=function(e,t){var r=document.getElementById(t),l=this.getGroup(r),n=e.length,o={groupID:t};if(this.trigger("ruleDelete",o),n)for(var i=0,s=e.length;i<s;i++)this.importRules(e[i],r);else l.rules.push({condition:"and",rules:[]})},d.prototype.initWrapper=function(){if(this.cssClass&&t.addClass([this.element],this.cssClass),this.enableRtl&&t.addClass([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),t.Browser.isDevice||"Vertical"===this.displayMode?(t.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),t.removeClass(document.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.addClass(document.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.isImportRules&&this.summaryView)this.renderSummary();else{if(this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition);var e=t.extend({},this.rule,{},!0);this.setGroupRules(e)}else this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});for(var r=document.querySelectorAll("label.e-btn"),l=void 0,n=0;n<r.length;n++)l=r.item(n),t.rippleEffect(l,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"}}),r=this.createElement("button",{attrs:{class:"e-edit-rule e-control e-btn e-small"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),r.textContent=this.l10n.getConstant("Edit"),e.appendChild(r),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("button",{attrs:{class:"e-collapse-rule e-control e-btn e-small"}});e.appendChild(this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-collapse-icon"}})),this.element.querySelector(".e-group-header").appendChild(e)},d.prototype.onPropertyChanged=function(e,r){for(var l=0,o=Object.keys(e);l<o.length;l++)switch(o[l]){case"summaryView":var i=this.element.querySelector(".e-group-container"),s=this.element.querySelector(".e-summary-content");e.summaryView?(i.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),s=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),s.style.display="block"):(i.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),i.style.display="block",s.style.display="none");break;case"displayMode":"Horizontal"===e.displayMode?(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode")):(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"));break;case"showButtons":e.showButtons.ruleDelete?t.removeClass(this.element.querySelectorAll("e-rule-delete"),"e-button-hide"):t.addClass(this.element.querySelectorAll("e-rule-delete"),"e-button-hide"),e.showButtons.groupDelete?t.removeClass(this.element.querySelectorAll("e-deletegroup"),"e-button-hide"):t.addClass(this.element.querySelectorAll("e-deletegroup"),"e-button-hide");break;case"cssClass":r.cssClass&&t.removeClass([this.element],r.cssClass.split(" ")),e.cssClass&&t.addClass([this.element],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl");break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource;break;case"columns":this.columns=e.columns,"ascending"===this.sortDirection.toLowerCase()?this.columns=new n.DataManager(this.columns).executeLocal((new n.Query).sortBy("field")):"descending"===this.sortDirection.toLowerCase()&&(this.columns=new n.DataManager(this.columns).executeLocal((new n.Query).sortByDesc("field")));break;case"sortDirection":this.sortDirection=e.sortDirection;break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rules":this.rule=e.rule;break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale}},d.prototype.preRender=function(){this.defaultLocale={StartsWith:"Starts With",EndsWith:"Ends With",Contains:"Contains",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",Empty:"Empty",NotEmpty:"Not Empty",In:"In",NotIn:"Not In",NotContains:"Not Contains",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]}},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate(),this.initWrapper(),this.initialize(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this)},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler)},d.prototype.getGroup=function(e,t){for(var r=this.levelColl[e.id],l=t?r.length-1:r.length,n=this.rule,o=0;o<l;o++)n=this.findGroupByIdx(r[o],n,0===o);return n},d.prototype.deleteGroup=function(e){var r,l,n=e,o=n.id,i=this.getGroup(n,!0),s=0,a={groupID:o,filterID:o};this.trigger("groupDelete",a);var u=n.querySelectorAll(".e-group-container");for(r=0,l=u.length;r<l;r++)delete this.levelColl[u[r].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,s++;i.rules.splice(s,1),delete this.levelColl[o],t.detach(e)},d.prototype.deleteRule=function(e){for(var r=t.closest(e,".e-group-container"),l=this.getGroup(r),n=t.closest(e,".e-rule-container"),o=n,i={groupID:r.id,filterID:n.id},s=0;null!==n.previousElementSibling;)n=n.previousElementSibling,s++;l.rules.splice(s,1),this.trigger("ruleDelete",i),t.detach(o)},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0)},d.prototype.setRules=function(e){var r=t.extend({},e,{},!0);this.setGroupRules(r)},d.prototype.getRules=function(){return this.rule},d.prototype.deleteGroups=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteGroup(document.getElementById(e[t]))},d.prototype.getFilteredRecords=function(){var e=(new n.Query).where(this.getPredicate(this.rule)),t=[];return new n.DataManager(this.dataSource).executeQuery(e).then(function(e){e.result.forEach(function(e){t.push(e)})}),t},d.prototype.deleteRules=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteRule(document.getElementById(e[t]))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),r=[],l=0,o=Object.keys(this.columns);l<o.length;l++)r.push(this.columns[l].field);return e.rules.length?(new n.Query).select(r).where(t):(new n.Query).select(r)},d.prototype.getPredicate=function(e){for(var t,r,l,o=e.rules,i=!1,s=0,a=o.length;s<a;s++)if(Object.keys(o[s]).indexOf("rules")>-1)(r=this.getPredicate(o[s]))&&(t="and"===e.condition?t.and(r):t.or(r));else if(o[s].operator.length){l="date"===o[s].type?new Date(o[s].value):o[s].value;var u=o[s].operator.toLowerCase();if(i="contains"===u||"startswith"===u||"endswith"===u,0===s)(u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u?t=this.arrayPredicate(o[s]):""!==(p=l)&&(t=new n.Predicate(o[s].field,o[s].operator,l,i));else if("and"===e.condition)if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{p=l;t&&""!==p&&(t=t.and(o[s].field,o[s].operator,l,i))}else if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{var p=l;t&&""!==p&&(t=t.or(o[s].field,o[s].operator,l,i))}}return t},d.prototype.arrayPredicate=function(e,t,r){for(var l,o=e.value,i=0,s=o.length;i<s;i++)if(""!==o[i])if(0===i)switch(e.operator){case"between":l=new n.Predicate(e.field,"greaterthan",o[i]);break;case"notbetween":l=new n.Predicate(e.field,"lessthan",o[i]);break;case"in":l=new n.Predicate(e.field,"equal",o[i]);break;case"notin":l=new n.Predicate(e.field,"notequal",o[i])}else switch(e.operator){case"between":l=l.and(e.field,"lessthan",o[i]);break;case"notbetween":l=l.or(e.field,"greaterthan",o[i]);break;case"in":l=l.or(e.field,"equal",o[i]);break;case"notin":l=l.and(e.field,"notequal",o[i])}return l&&(t="and"===r?t.and(l):"or"===r?t.or(l):l),t},d.prototype.importRules=function(e,r,l){l||(r=this.renderGroup(e.condition,r));for(var n=e.rules,o=0,i=n.length;o<i;o++)Object.keys(n[o]).indexOf("rules")>-1?(r=this.renderGroup(n[o].condition,r),r=this.importRules(n[o],r,!0)):this.renderRule(n[o],r);return(r=t.closest(r,".e-rule-list"))&&(r=t.closest(r,".e-group-container")),r},d.prototype.renderGroup=function(e,t){this.addGroupElement(!0,t,e);var r=t.querySelectorAll(".e-group-container");return r[r.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.getSqlString=function(e,t){var r=!1;t?t+="(":(t="",r=!0);for(var l=e.condition,n=0,o=e.rules.length;n<o;n++){if(e.rules[n].rules)t=this.getSqlString(e.rules[n],t);else{var i=e.rules[n],s="";i.value instanceof Array?s+="("+i.value+")":"startswith"===i.operator?s+='("'+i.value+'%")':"endswith"===i.operator?s+='("%'+i.value+'")':"contains"===i.operator?s+='("%'+i.value+'%")':"number"===i.type?s+=i.value:s+='"'+i.value+'"',t+=i.field+" "+this.operators[i.operator]+" "+s}n!==o-1&&(t+=" "+l+" ")}return r||(t+=")"),t},d.prototype.setRulesFromSql=function(e){var t=this.getRulesFromSql(e);this.setRules({condition:t.condition,rules:t.rules})},d.prototype.getRulesFromSql=function(e){return this.parser=[],this.sqlParser(e),this.rule={condition:"",rules:[]},this.processParser(this.parser,this.rule,[0])},d.prototype.getSqlFromRules=function(e){return this.getSqlString(e).replace(/"/g,"'")},d.prototype.sqlParser=function(e){var t,r=0;do{t=e.slice(r),r+=this.parseSqlStrings(t)}while(""!==t);return this.parser},d.prototype.parseSqlStrings=function(e){for(var t,r,l=["=","!=","<",">","<=",">="],n=["and","or"],o=["IN","NOT IN","LIKE","NOT LIKE"],i=0,s=l.length;i<s;i++)if(t=/^\w+$/.test(l[i])?"\\b":"",new RegExp("^("+l[i]+")"+t,"ig").exec(e))return this.parser.push(["Operators",l[i].toLowerCase()]),l[i].length;for(var i=0,s=n.length;i<s;i++)if(t=/^\w+$/.test(n[i])?"\\b":"",new RegExp("^("+n[i]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",n[i].toLowerCase()]),n[i].length;for(var i=0,s=o.length;i<s;i++)if(t=/^\w+$/.test(o[i])?"\\b":"",new RegExp("^("+o[i]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",o[i].toLowerCase()]),o[i].length;return/^\(/.exec(e)?(this.parser.push(["Left","("]),1):/^\)/.exec(e)?(this.parser.push(["Right",")"]),1):/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)?(r=/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",r]),r.length):/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)?(r=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],this.parser.push(["String",r]),r.length):/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(r=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",r]),r.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(r=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",r]),r.length):1},d.prototype.getOperator=function(e,t){var r={"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal"};return 0===e.indexOf("%")&&e.indexOf("%")===e.length-1?"contains":0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"startswith":0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"endswith":r[t]},d.prototype.processParser=function(e,t,r){for(var l,n,o,i,s,a,u,p,d,c,h=[],m=[],y=0,g=e.length;y<g;y++)if("Literal"===e[y][0]){if(l={label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){for(l.operator=this.getOperator(e[y+3][1].replace(/'/g,""),e[y+1][1]),c=e[y+1][1],o=++y+1,i=g,o=y+1;o<i;o++){if("Right"===e[o][0]){y=o;break}"like"===c&&"String"===e[o][0]?(l.value=e[o][1].replace(/'/g,"").replace(/%/g,""),l.type="string"):"Number"===e[o][0]?h.push(Number(e[o][1])):"String"===e[o][0]&&m.push(e[o][1].replace(/'/g,""))}"like"!==c&&("Number"===e[o-1][0]?(l.value=h,l.type="integer"):"String"===e[o-1][0]&&(l.value=m,l.type="string"))}else"Operators"===e[y+1][0]&&(l.operator=this.getOperator(e[y+2][1],e[y+1][1]),"Number"===e[y+2][0]?(l.type="integer",l.value=Number(e[y+2][1])):(l.type="string",l.value=e[y+2][1].replace(/'/g,"")));t.rules.push(l)}else{if("Left"===e[y][0]){for(n={condition:"",rules:[]},this.parser=e.splice(y+1,g-(y+1)),d=0,a=t.rules.length,s=0;s<a;s++)t.rules[s].rules&&d++;return r.push(d),t.rules.push(n),n=this.processParser(this.parser,n,r),t}if("Conditions"===e[y][0])t.condition=e[y][1];else if("Right"===e[y][0]){for(this.parser=e.splice(y+1,g-(y+1)),r.pop(),t=this.rule,p=r.length,u=0;u<p;u++)t=this.findGroupByIdx(r[u],t,0===u);return this.processParser(this.parser,t,r)}}return t},p([t.Event()],d.prototype,"created",void 0),p([t.Event()],d.prototype,"beforeConditionChange",void 0),p([t.Event()],d.prototype,"beforeFieldChange",void 0),p([t.Event()],d.prototype,"beforeOperatorChange",void 0),p([t.Event()],d.prototype,"beforeValueChange",void 0),p([t.Event()],d.prototype,"conditionChanged",void 0),p([t.Event()],d.prototype,"fieldChanged",void 0),p([t.Event()],d.prototype,"valueChanged",void 0),p([t.Event()],d.prototype,"operatorChanged",void 0),p([t.Event()],d.prototype,"groupDelete",void 0),p([t.Event()],d.prototype,"ruleDelete",void 0),p([t.Event()],d.prototype,"groupInsert",void 0),p([t.Event()],d.prototype,"ruleInsert",void 0),p([t.Property(m)],d.prototype,"showButtons",void 0),p([t.Property(!1)],d.prototype,"summaryView",void 0),p([t.Property(!1)],d.prototype,"allowValidation",void 0),p([t.Property([])],d.prototype,"columns",void 0),p([t.Property("")],d.prototype,"cssClass",void 0),p([t.Property([])],d.prototype,"dataSource",void 0),p([t.Property("Horizontal")],d.prototype,"displayMode",void 0),p([t.Property(!1)],d.prototype,"enableRtl",void 0),p([t.Property(!1)],d.prototype,"enablePersistence",void 0),p([t.Property("Default")],d.prototype,"sortDirection",void 0),p([t.Property(5)],d.prototype,"maxGroupCount",void 0),p([t.Property("auto")],d.prototype,"height",void 0),p([t.Property("auto")],d.prototype,"width",void 0),p([t.Complex({condition:"and",rules:[]},h)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);return e.Columns=d,e.Rules=c,e.Rule=h,e.ShowButtons=m,e.QueryBuilder=y,e}({},ej.base,ej.buttons,ej.dropdowns,ej.data,ej.inputs,ej.calendars,ej.splitbuttons,ej.popups),this.ejs=ej;
this.ej=this.ej||{},this.ej.querybuilder=function(e,t,r,l,n,o,i,s,a){"use strict";var u=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function l(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(l.prototype=r.prototype,new l)}}(),p=function(e,t,r,l){var n,o=arguments.length,i=o<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,r):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,l);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o<3?n(i):o>3?n(t,r,i):n(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i};l.MultiSelect.Inject(l.CheckBoxSelection);var d=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"values",void 0),p([t.Property(null)],r.prototype,"operators",void 0),p([t.Property(null)],r.prototype,"template",void 0),p([t.Property(null)],r.prototype,"validation",void 0),p([t.Property(null)],r.prototype,"format",void 0),p([t.Property(null)],r.prototype,"step",void 0),r}(t.ChildProperty),c=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),p([t.Property(null)],r.prototype,"field",void 0),p([t.Property(null)],r.prototype,"label",void 0),p([t.Property(null)],r.prototype,"type",void 0),p([t.Property(null)],r.prototype,"operator",void 0),p([t.Property(null)],r.prototype,"value",void 0),r}(t.ChildProperty),h=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property("and")],r.prototype,"condition",void 0),p([t.Property()],r.prototype,"rules",void 0),r}(t.ChildProperty),m=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return u(r,e),p([t.Property(!0)],r.prototype,"ruleDelete",void 0),p([t.Property(!0)],r.prototype,"groupInsert",void 0),p([t.Property(!0)],r.prototype,"groupDelete",void 0),r}(t.ChildProperty),y=function(e){function d(r,l){var n=e.call(this,r,l)||this;return n.groupIdCounter=0,n.ruleIdCounter=0,n.btnGroupId=0,n.isImportRules=!1,n.parser=[],n.intl=new t.Internationalization,n}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;var e=this.element.querySelector(".e-group-body");e.innerHTML="",e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_e_group0"]=[0],this.rule={condition:"and",rules:[]}},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.initialize=function(){if(this.dataSource.length){var e=Object.keys(this.dataSource[0]),t=[],r=void 0,l=!1,n=void 0;if(this.columns.length){this.columnSort();for(var o=this.columns,i=0,s=o.length;i<s;i++)o[i].type||(e.indexOf(o[i].field)>-1&&("string"===(r=typeof(n=this.dataSource[0][o[i].field]))?l=!isNaN(Date.parse(n)):"object"===r&&(l=n instanceof Date&&!isNaN(n.getTime()),r="string"),o[i].type=r,l=!1),r="string")}else{for(var i=0,s=e.length;i<s;i++)"string"===(r=typeof(n=this.dataSource[0][e[i]]))?l=!isNaN(Date.parse(n)):"object"===r&&(l=n instanceof Date&&!isNaN(n.getTime()),r="string"),t[i]={field:e[i],label:e[i],type:l?"date":r},l=!1;this.columns=t}}},d.prototype.clickEventHandler=function(e){var r=e.target;if(this.isImportRules=!1,"SPAN"===r.tagName&&(r=r.parentElement),"BUTTON"===r.tagName){if(r.className.indexOf("e-removerule")>-1)r.className.indexOf("e-tooltip")>-1&&t.getComponent(r,"tooltip").destroy(),this.deleteRule(r);else if(r.className.indexOf("e-deletegroup")>-1)t.getComponent(r,"tooltip").destroy(),this.deleteGroup(t.closest(r,".e-group-container"));else if(r.className.indexOf("e-edit-rule")>-1)if(document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition);var l=t.extend({},this.rule,{},!0);this.setGroupRules(l),this.renderSummaryCollapse()}else(n=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),n.style.display="block";else if(r.className.indexOf("e-collapse-rule")>-1){var n=this.element.querySelector(".e-group-container");n.style.display="none",this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),document.getElementById(this.element.id+"_summary_content").style.display="block"}}else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1){var o=t.closest(r,".e-group-container"),i={groupID:o.id,selectedItem:r,cancel:!1};this.trigger("beforeConditionChange",i),this.getGroup(o).condition=r.textContent.toLowerCase(),i={groupID:o.id,selectedItem:r},this.trigger("conditionChanged",i)}},d.prototype.selectBtn=function(e,r){"beforeOpen"===r.name?this.showButtons.groupInsert?t.removeClass([r.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.addClass([r.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):r.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):r.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},d.prototype.addRuleElement=function(e,r){var n=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.className="e-rule-container e-vertical-mode":n.className="e-rule-container e-horizontal-mode";var o,i,s,u,p,d,c=e.querySelector(".e-rule-list"),h=n.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?h.textContent=this.l10n.getConstant("Remove"):(t.addClass([h],"e-round"),t.addClass([h],"e-icon-btn"),new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(h),h=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),n.querySelector("button").appendChild(h)),n.setAttribute("id",e.id+"_e_rule"+this.ruleIdCounter),this.ruleIdCounter++,n.querySelector(".e-filter-input").setAttribute("id",n.id+"_filterkey"),c.appendChild(n),n.previousElementSibling&&n.previousElementSibling.className.indexOf("e-rule-container")>-1&&(n.className.indexOf("e-joined-rule")<0&&(n.className+=" e-joined-rule"),n.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(n.previousElementSibling.className+=" e-prev-joined-rule")),n.previousElementSibling&&n.previousElementSibling.className.indexOf("e-group-container")>-1&&n.className.indexOf("e-separate-rule")<0&&(n.className+=" e-separate-rule"),d=this.element.className.indexOf("e-device")>-1?"250px":"200px",(p=new l.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?d:"auto",change:this.changeField.bind(this),value:r?r.field:null})).appendTo("#"+n.id+"_filterkey"),this.allowValidation&&(n.querySelector(".e-filter-input").setAttribute("name",n.id+"field"),t.addClass([n.querySelector(".e-filter-input")],"e-error")),this.filterIndex=p.index,o=this.levelColl[e.id],!this.isImportRules){for(i=this.rule,s=0,u=o.length;s<u;s++)i=this.findGroupByIdx(o[s],i,0===s);Object.keys(r).length?i.rules.push({field:r.field,type:r.type,label:r.label,operator:r.operator,value:r.value}):i.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(r).length&&this.changeRule(r,{element:p.element,itemData:this.columns[this.filterIndex]})},d.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),position:"BottomCenter",cssClass:"e-querybuilder-error"});t.appendTo(e),t.open(e)},d.prototype.validateFields=function(){if(this.allowValidation){var e=void 0,r=void 0,l=void 0,n=void 0,o=void 0,i=void 0,s=void 0,a=void 0,u=void 0,p=this.element.querySelectorAll(".e-rule-container"),d=void 0;for(e=0,r=p.length;e<r;e++)if(o=t.closest(p[e],".e-group-container"),u=this.getGroup(o),i=0,n=a=p[e],s=t.getComponent(p[e].querySelector(".e-rule-field input.e-control"),"dropdownlist"),d=!t.isNullOrUndefined(s.index)&&this.columns[s.index].validation,l=a.querySelector(".e-rule-field input.e-control"),d&&d.isRequired){for(;n&&null!==n.previousElementSibling;)n=n.previousElementSibling,i++;if(l=a.querySelector(".e-rule-field input.e-control"),!u.rules[i].field&&l.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(l.parentElement),l=a.querySelector(".e-rule-operator input.e-control"),!u.rules[i].operator&&l.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(l.parentElement),!u.rules[i].value){var c=a.querySelectorAll(".e-rule-value input.e-control");do{var h=c[0],m=void 0;h.parentElement.className.indexOf("e-searcher")>-1?(m=t.closest(h,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(m):c[0].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(c[0].parentElement),c.length>1&&c[1].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(c[1].parentElement),c=a.querySelectorAll(".e-rule-value div.e-control")}while(c.length>0)}}else s.element&&!s.index&&l.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(l.parentElement)}},d.prototype.groupTemplate=function(){var e,t,r,l,n,o,i,s,a;return e=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),t=this.createElement("div",{attrs:{class:"e-group-body"}}),l=this.createElement("div",{attrs:{class:"e-rule-list"}}),e.appendChild(r),t.appendChild(l),e.appendChild(t),n=this.createElement("div",{attrs:{class:"e-btn-group"}}),(o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),n.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl"},innerHTML:"AND"}),n.appendChild(i),o=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),n.appendChild(o),i=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl"},innerHTML:"OR"}),n.appendChild(i),r.appendChild(n),s=this.createElement("div",{attrs:{class:"e-group-action"}}),a=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),s.appendChild(a),r.appendChild(s),e},d.prototype.ruleTemplate=function(){var e,t,r,l,n,o;return e=this.createElement("div"),n=this.createElement("div",{attrs:{class:"e-rule-field"}}),r=this.createElement("div",{attrs:{class:"e-rule-filter"}}),t=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}}),r.appendChild(t),n.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-operator"}}),n.appendChild(r),r=this.createElement("div",{attrs:{class:"e-rule-value"}}),n.appendChild(r),e.appendChild(n),o=this.showButtons.ruleDelete?"e-removerule e-rule-delete e-css e-btn e-small":"e-removerule e-rule-delete e-css e-btn e-small e-button-hide",l=this.createElement("button",{attrs:{class:o}}),n.appendChild(l),e},d.prototype.addGroupElement=function(e,l,n,o){if(!(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var i,u=this.groupElem.cloneNode(!0);u.setAttribute("id",this.element.id+"_e_group"+this.groupIdCounter),this.groupIdCounter++;var p=u.querySelector(".e-btngroup-and"),d=u.querySelector(".e-btngroup-or"),c=u.querySelector(".e-btngroup-and-lbl"),h=u.querySelector(".e-btngroup-or-lbl");if(p.setAttribute("id",this.element.id+"_and"+this.btnGroupId),d.setAttribute("id",this.element.id+"_or"+this.btnGroupId),p.setAttribute("name",this.element.id+"_and"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("for",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){var m=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";i=this.createElement("button",{attrs:{class:m}}),new r.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(i),new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(i),t.rippleEffect(i,{selector:".deletegroup"}),u.querySelector(".e-group-action").appendChild(i);var y=l.querySelector(".e-rule-list"),g=l.querySelectorAll(".e-group-container").length;y.appendChild(u);var v=this.levelColl[l.id].slice(0);v.push(g),this.levelColl[u.id]=v,this.isImportRules||(this.addGroups([],l.id),o&&this.addRuleElement(u,{}))}else l.appendChild(u),this.levelColl[u.id]=[0];u.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===n&&u.querySelector(".e-btngroup-or").setAttribute("checked","true");var f=u.querySelector(".e-add-btn");new s.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,f),select:this.selectBtn.bind(this,f)}).appendTo(f),t.rippleEffect(f,{selector:".e-round"})}},d.prototype.notifyChange=function(e,r){for(var l=t.closest(r,".e-rule-value").querySelectorAll(".e-template"),n=[],o=0,i=l.length;o<i;o++)l[o].nextElementSibling&&l[o].nextElementSibling.className.indexOf("e-check")>-1&&n.push(l[o].textContent);this.updateRules(r,l.length>1?n:e)},d.prototype.changeValue=function(e,r){var l,n;(n=r.event?r.event.target:r.element).className.indexOf("e-day")>-1&&(n=r.element);var o=t.closest(n,".e-group-container"),i=t.closest(n,".e-rule-container"),s=r;s.element&&s.element.className.indexOf("e-datepicker")>-1&&(n=s.element);var a;a=n.className.indexOf("e-radio")>-1?t.getComponent(n,"radio").label:n.className.indexOf("e-multiselect")>-1?t.getComponent(n,"multiselect").value:r.value,l={groupID:o.id,ruleID:i.id,value:a,cancel:!1},this.trigger("beforeValueChange",l),this.updateRules(n,a,e),l={groupID:o.id,ruleID:i.id,value:a,cancel:!1},this.trigger("valueChanged",l)},d.prototype.changeField=function(e){if(e.isInteracted){for(var r=t.closest(e.element,".e-group-container"),l=this.getGroup(r),n=t.closest(e.element,".e-rule-container"),o=0;n&&null!==n.previousElementSibling;)n=n.previousElementSibling,o++;this.changeRule(l.rules[o],e)}},d.prototype.changeRule=function(e,r){if(r.itemData){var n,o,i,s,a,u={},p=e.operator?e.operator.toLowerCase():"";i=t.closest(r.element,".e-rule-filter"),s=t.closest(r.element,".e-rule-operator");var d=t.getComponent(r.element,"dropdownlist"),c=t.closest(r.element,".e-group-container");if(i){var h=t.closest(i,".e-rule-container"),m={groupID:c.id,ruleID:h.id,selectedItem:r.item,cancel:!1};this.trigger("beforeFieldChange",m),u.type=this.columns[d.index].type,h.querySelector(".e-template")&&(e.value="")}if(s){var h=t.closest(s,".e-rule-container"),m={groupID:c.id,ruleID:h.id,selectedItem:r.item,cancel:!1};this.trigger("beforeOperatorChange",m),u.operator=r.itemData.value;var y=u.operator.toLowerCase();if(u.operator.toLowerCase().indexOf("between")>-1||u.operator.toLowerCase().indexOf("in")>-1&&u.operator.toLowerCase().indexOf("contains")<0){i=s.previousElementSibling,u.type=e.type;var g=[],v=[];"string"==typeof e.value?(v.push(e.value),e.value=v):"number"==typeof e.value&&(g.push(e.value),e.value=g)}else"object"==typeof e.value&&(e.value=e.value[0]);if(r.previousItemData){var f=r.previousItemData.value.toLowerCase();(f.indexOf("between")>-1||f.indexOf("in")>-1&&f.indexOf("contains")<0)&&(i=s.previousElementSibling,u.type=e.type)}p.indexOf("in")>-1&&p.indexOf("in")<5&&y.indexOf("in")>-1&&y.indexOf("in")<5&&(i=null)}if(i)if(s=i.nextElementSibling,t.addClass([s],"e-operator"),s.childElementCount)n=t.getComponent(s.querySelector(".e-dropdownlist"),"dropdownlist"),u.operator=n.value,this.renderValues(s,r.itemData,r.previousItemData,!0,e,u,r.element);else{var b=t.closest(s,".e-rule-container").id;a=this.createElement("input",{attrs:{type:"text",id:b+"_operatorkey"}}),s.appendChild(a),this.columns[d.index].operators?o=this.columns[d.index].operators:r.itemData&&(o=this.customOperators[this.columns[d.index].type+"Operator"]);var C=this.element.className.indexOf("e-device")>-1?"250px":"200px";new l.DropDownList({dataSource:o,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:o.length>5?C:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+b+"_operatorkey"),u.operator=e&&""!==e.operator?e.operator:o[0].value,this.isImportRules&&(u.type=this.columns[d.index].type,u.operator=e.operator),this.renderValues(s,this.columns[d.index],r.previousItemData,!1,e,u,r.element)}this.isImportRules||this.updateRules(r.element,r.item)}},d.prototype.destroyControls=function(e){var r;r=e.nextElementSibling.querySelectorAll("input.e-control");var l;l=e.nextElementSibling.querySelectorAll("div.e-control:not(.e-handle)");for(var n=this.columns,o=0,i=r.length;o<i;o++){if(r[o].classList.contains("e-textbox"))t.getComponent(r[o],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-dropdownlist"))t.getComponent(r[o],"dropdownlist").destroy();else if(r[o].classList.contains("e-radio"))t.getComponent(r[o],"radio").destroy();else if(r[o].classList.contains("e-numerictextbox"))t.getComponent(r[o],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[o].id));else if(r[o].classList.contains("e-datepicker"))t.getComponent(r[o],"datepicker").destroy();else if(r[o].classList.contains("e-multiselect"))t.getComponent(r[o],"multiselect").destroy();else if(r[o].className.indexOf("e-template")>-1)for(var s=r[o].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],r[o].id);break}t.detach(r[o])}for(var o=0,i=l.length;o<i;o++){if(l[o].className.indexOf("e-template")>-1)for(var s=l[o].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],l[o].id);break}t.detach(l[o])}},d.prototype.templateDestroy=function(e,r){var l=e.template.destroy;e.template&&e.template.destroy&&("string"==typeof l?(l=t.getValue(l,window))({elementId:r}):e.template.destroy({elementId:r}))},d.prototype.getDistinctValues=function(e,t){for(var r={},l=[],n=0,o=e.length;n<o;n++){var i=e[n][t],s={};i in r||(r[i]=1,s[t]=i,l.push(s))}return l},d.prototype.renderMultiSelect=function(e,t,r,o){var i=this.getDistinctValues(this.dataSource,e.field);new l.MultiSelect({dataSource:new n.DataManager(i),query:new n.Query([e.field]),fields:{text:e.field,value:e.field},value:o,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,r)}).appendTo("#"+t+"_valuekey"+r)},d.prototype.processTemplate=function(e,r,l,n){var o=t.closest(e,".e-rule-container").querySelectorAll(".e-template");o.length<2?r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o[0],values:l.value,operator:n.operator}):r.template&&r.template.write&&r.template.write({elements:o[0],values:l.value,operator:n.operator}):r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:o,values:l.value,operator:n.operator}):r.template&&r.template.write&&r.template.write({elements:o,values:l.value,operator:n.operator})},d.prototype.renderStringValue=function(e,t,r,l,n){var i,s=this.isImportRules?t.value:"";if(("in"===r||"notin"===r)&&this.dataSource.length>0)i=this.isImportRules?t.value:[],this.renderMultiSelect(t,e,l,i),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.style.width="100%":(n.style.width=null,n.style.minWidth="200px");else{"in"!==r&&"notin"!==r||(s=(i=this.isImportRules?t.value:[]).join(","));var a=new o.TextBox({placeholder:"Value",input:this.changeValue.bind(this,l)});a.appendTo("#"+e+"_valuekey"+l),a.value=s,a.dataBind()}},d.prototype.renderNumberValue=function(e,t,r,l,n,i,s){var a,u=this.isImportRules?t.value:0;if(("in"===r||"notin"===r)&&this.dataSource.length>0)a=this.isImportRules?t.value:[],this.renderMultiSelect(t,e,l,a),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?n.style.width="100%":(n.style.minWidth="200px",n.style.width=null);else if("in"===r||"notin"===r){var p=(a=this.isImportRules?t.value:[]).join(","),d=new o.TextBox({placeholder:"Value",input:this.changeValue.bind(this,l)});d.appendTo("#"+e+"_valuekey"+l),d.value=p,d.dataBind()}else{var c=i.validation&&i.validation.min?i.validation.min:0,h=i.validation&&i.validation.max?i.validation.max:Number.MAX_VALUE,m=i.format?i.format:"#";s>1&&t&&(u=t.value[l]),new o.NumericTextBox({value:u,format:m,min:c,max:h,width:"100%",step:i.step?i.step:1,change:this.changeValue.bind(this,l)}).appendTo("#"+e+"_valuekey"+l)}},d.prototype.processValueString=function(e,t){var r=[],l=e.split(",");if("string"===t)return l;for(var n=0,o=l.length;n<o;n++)r.push(Number(l[n]));return r},d.prototype.renderControls=function(e,l,n,o){if(t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),l.template)this.processTemplate(e,l,n,o);else{var s="boolean"===o.type||o.operator&&o.operator.toLowerCase().indexOf("between")>-1?2:1,a=t.closest(e,".e-rule-container").id,u=void 0;if(e.className.indexOf("e-rule-operator")>-1||e.className.indexOf("e-rule-filter")>-1){u=e.parentElement.querySelector(".e-rule-value"),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?u.style.width="100%":"in"!==o.operator&&"notin"!==o.operator&&(u.style.width="200px");for(var p=0;p<s;p++)switch(o.type){case"string":this.renderStringValue(a,n,o.operator,p,u);break;case"number":this.renderNumberValue(a,n,o.operator,p,u,l,s);break;case"boolean":var d=l.values&&l.values.length?l.values:["True","False"],c=!this.isImportRules||Boolean(n.value);new r.RadioButton({label:d[p],name:a+"default",checked:c,change:this.changeValue.bind(this,p)}).appendTo("#"+a+"_valuekey"+p);break;case"date":var h=new Date;this.isImportRules&&n&&n.value&&(h=s>1?new Date(n.value[p]):new Date(n.value));var m=l.format?l.format:"MM/dd/yyyy";new i.DatePicker({value:h,format:m,change:this.changeValue.bind(this,p)}).appendTo("#"+a+"_valuekey"+p)}}}},d.prototype.renderValues=function(e,r,l,n,o,i,s){if(n){var a=t.getComponent(e.querySelector("input"),"dropdownlist");r.operators?(a.dataSource=r.operators,a.index=0!==a.index?0:1,a.dataBind(),i.operator=a.value):r.type&&(a.dataSource=this.customOperators[r.type+"Operator"],a.index=0!==a.index?0:1,a.dataBind(),i.operator=a.value)}var u=t.closest(e,".e-rule-container").id;l&&l.template&&(this.templateDestroy(l,u+"_valuekey0"),t.detach(e.nextElementSibling.querySelector("#"+u+"_valuekey0"))),n&&this.destroyControls(e);var p=document.getElementById(s.id.replace("operatorkey","filterkey")),d=t.getComponent(p,"dropdownlist");if(r.template||this.columns[d.index].template){r.template=this.columns[d.index].template;y=void 0;if(r.template&&"string"==typeof r.template.create?y=t.getValue(r.template.create,window)():r.template&&r.template.create&&(y=r.template.create()),y instanceof Element)y.id=u+"_valuekey0",t.addClass([y],"e-template"),t.addClass([y],"e-"+r.field),e.nextElementSibling.appendChild(y);else{t.addClass(y,"e-template");for(var c=0,h=y.length;c<h;c++)y[c].id=u+"_valuekey"+c,e.nextElementSibling.appendChild(y[c])}var m=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?m.style.width="100%":m.style.minWidth="200px"}else if("boolean"===i.type||i.operator&&i.operator.toLowerCase().indexOf("between")>-1)for(c=0;c<2;c++){y=void 0;y=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+c}}),e.nextElementSibling.appendChild(y)}else{var y=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey0"}});e.nextElementSibling.appendChild(y)}this.renderControls(e,r,o,i)},d.prototype.updateValues=function(e,r){var l=e.className.split(" e-")[1],n=parseInt(e.id.slice(-1),2);switch(l){case"textbox":case"dropdownlist":case"radio":r.value=t.getComponent(e,l).value;break;case"numerictextbox":r.operator.indexOf("between")>-1?r.value[n]=t.getComponent(e,l).value:r.value=t.getComponent(e,l).value;break;case"datepicker":var o={type:"dateTime",format:"MM/dd/yyyy"};r.operator.indexOf("between")>-1?r.value[n]=t.getComponent(e,l).value:r.value=this.intl.formatDate(t.getComponent(e,l).value,o)}},d.prototype.updateRules=function(e,r,n){for(var o,i,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),t.closest(e,".e-rule-filter")){o=t.getComponent(e,"dropdownlist"),a.rules[p].field=this.columns[o.index].field,a.rules[p].type=this.columns[o.index].type,a.rules[p].label=this.columns[o.index].label;var d=t.closest(e,".e-rule-filter"),c=d.nextElementSibling.querySelector("input.e-control"),h=t.getComponent(c,"dropdownlist").value;a.rules[p].operator=h,(c=d.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(c=d.nextElementSibling.nextElementSibling.querySelector("div.e-control")),i={groupID:s.id,ruleID:u.id,selectedItem:r,cancel:!1},this.updateValues(c,a.rules[p]),this.trigger("fieldChanged",i),this.allowValidation&&a.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy()}else if(t.closest(e,".e-rule-operator")){o=t.getComponent(e,"dropdownlist"),a.rules[p].operator=o.value;var m=void 0;e.parentElement;m=u.querySelectorAll(".e-rule-value input.e-control"),i={groupID:s.id,ruleID:u.id,selectedItem:r,cancel:!1},this.allowValidation&&a.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),m.length>1&&(a.rules[p].value=[]);for(var y=0;y<m.length;y++)this.updateValues(m[y],a.rules[p]);this.trigger("operatorChanged",i)}else if(t.closest(e,".e-rule-value")&&null!==r){if(e.className.indexOf("e-template")>-1){var g=a.rules[p].operator.toLowerCase();r instanceof Array?g.indexOf("in")>-1&&g.indexOf("contains")<0||g.indexOf("between")>-1?a.rules[p].value=r:a.rules[p].value=r[0]:a.rules[p].value=r,i={groupID:s.id,ruleID:u.id,selectedItem:r,cancel:!1},this.trigger("valueChanged",i)}else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[n]=r:a.rules[p].value=r;else if(e.className.indexOf("e-radio")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-multiselect")>-1)a.rules[p].value=r;else if(e.className.indexOf("e-textbox")>-1)"in"===a.rules[p].operator||"notin"===a.rules[p].operator?(a.rules[p].type,a.rules[p].value=this.processValueString(r,a.rules[p].type)):a.rules[p].value=r;else if(e.className.indexOf("e-datepicker")>-1){var v=t.getInstance(u.querySelector(".e-rule-filter input"),l.DropDownList),f={type:"dateTime",format:this.columns[v.index].format||"MM/dd/yyyy"};f.type&&(a.rules[p].operator.indexOf("between")>-1||a.rules[p].operator.indexOf("in")>-1&&a.rules[p].operator.indexOf("contains")<0?a.rules[p].value[n]=this.intl.formatDate(r,f):a.rules[p].value=this.intl.formatDate(r,f))}this.validatValue(a,p,u)}},d.prototype.validatValue=function(e,r,l){if(this.allowValidation&&e.rules[r].value){var n=l.querySelectorAll(".e-rule-value .e-control");if(n[0].parentElement.className.indexOf("e-searcher")>-1){var o=t.closest(n[0],".e-multi-select-wrapper");o.className.indexOf("e-tooltip")>-1&&t.getComponent(o,"tooltip").destroy()}else n[0].parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(n[0].parentElement,"tooltip").destroy();n[1]&&n[1].parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(n[1].parentElement,"tooltip").destroy()}},d.prototype.findGroupByIdx=function(e,t,r){var l=t.rules;if(!r&&l[e]){if((t=l[e]).rules)return t;for(var n=e+1,o=l.length;n<o;n++)if((t=l[n]).rules)return t}return t},d.prototype.destroy=function(){if(this.element){var r,l,n;for(e.prototype.destroy.call(this),n=(r=this.element.querySelectorAll(".e-addrulegroup")).length,l=0;l<n;l++)t.getComponent(r[l],"dropdown-btn").destroy(),t.detach(r[l]);for(n=(r=this.element.querySelectorAll(".e-rule-filter .e-control")).length,l=0;l<n;l++)t.getComponent(r[l],"dropdownlist").destroy(),t.detach(r[l]);for(n=(r=this.element.querySelectorAll(".e-rule-operator .e-control")).length,l=0;l<n;l++)t.getComponent(r[l],"dropdownlist").destroy(),t.detach(r[l]);this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_e_group0"]=[0],this.rule={condition:"and",rules:[]},this.element.innerHTML="",t.classList(this.element,[],["e-rtl","e-responsive","e-device"])}},d.prototype.addRules=function(e,t){for(var r={groupID:t},l=0,n=e.length;l<n;l++)this.addRuleElement(document.getElementById(t),e[l]);this.trigger("ruleInsert",r)},d.prototype.addGroups=function(e,t){var r=document.getElementById(t),l=this.getGroup(r),n={groupID:t};if(e.length)for(var o=0,i=e.length;o<i;o++)this.importRules(e[o],r);else l.rules.push({condition:"and",rules:[]});this.trigger("groupInsert",n)},d.prototype.initWrapper=function(){if(this.cssClass&&t.addClass([this.element],this.cssClass),this.enableRtl&&t.addClass([this.element],"e-rtl"),this.width&&(this.element.style.width=this.width),this.height&&(this.element.style.height=this.height),this.rule.rules.length?this.isImportRules=!0:this.addGroupElement(!1,this.element),t.Browser.isDevice||"Vertical"===this.displayMode?(t.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),t.removeClass(document.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.addClass(document.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.isImportRules&&this.summaryView)this.renderSummary();else{if(this.columns.length&&this.isImportRules){this.addGroupElement(!1,this.element,this.rule.condition);var e=t.extend({},this.rule,{},!0);this.setGroupRules(e)}else this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});for(var r=document.querySelectorAll("label.e-btn"),l=void 0,n=0;n<r.length;n++)l=r.item(n),t.rippleEffect(l,{selector:".e-btn"})}},d.prototype.renderSummary=function(){var e=this.createElement("div",{attrs:{class:"e-summary-content",id:this.element.id+"_summary_content"}}),t=this.createElement("textarea",{attrs:{class:"e-summary-text",readonly:"true"}}),r=this.createElement("button",{attrs:{class:"e-edit-rule e-css e-btn e-small"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),r.textContent=this.l10n.getConstant("Edit"),e.appendChild(r),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("button",{attrs:{class:"e-collapse-rule e-css e-btn e-small"}});e.appendChild(this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-collapse-icon"}})),this.element.querySelector(".e-group-header").appendChild(e)},d.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new n.DataManager(this.columns).executeLocal((new n.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new n.DataManager(this.columns).executeLocal((new n.Query).sortBy("field")))},d.prototype.onPropertyChanged=function(e,r){for(var l=0,n=Object.keys(e);l<n.length;l++)switch(n[l]){case"summaryView":var o=this.element.querySelector(".e-group-container"),i=this.element.querySelector(".e-summary-content");e.summaryView?(o.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),i=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),i.style.display="block"):(o.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),o.style.display="block",i.style.display="none");break;case"displayMode":"Horizontal"===e.displayMode?(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode")):(t.addClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),t.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"));break;case"showButtons":e.showButtons.ruleDelete?t.removeClass(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"),e.showButtons.groupDelete?t.removeClass(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide");break;case"cssClass":r.cssClass&&t.removeClass([this.element],r.cssClass.split(" ")),e.cssClass&&t.addClass([this.element],e.cssClass.split(" "));break;case"enableRtl":e.enableRtl?t.addClass([this.element],"e-rtl"):t.removeClass([this.element],"e-rtl");break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource;break;case"columns":this.columns=e.columns,this.columnSort();break;case"sortDirection":this.sortDirection=e.sortDirection,this.columnSort();break;case"maxGroupCount":this.maxGroupCount=e.maxGroupCount;break;case"height":this.height=e.height,this.element.style.height=this.height;break;case"rule":this.rule=e.rule;break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale}},d.prototype.preRender=function(){this.defaultLocale={StartsWith:"Starts With",EndsWith:"Ends With",Contains:"Contains",Equal:"Equal",NotEqual:"Not Equal",LessThan:"Less Than",LessThanOrEqual:"Less Than Or Equal",GreaterThan:"Greater Than",GreaterThanOrEqual:"Greater Than Or Equal",Between:"Between",NotBetween:"Not Between",Empty:"Empty",NotEmpty:"Not Empty",In:"In",NotIn:"Not In",NotContains:"Not Contains",Remove:"REMOVE",SelectField:"Select a field",SelectOperator:"Select operator",DeleteRule:"Remove this condition",DeleteGroup:"Delete group",AddGroup:"Add Group",AddCondition:"Add Condition",Edit:"EDIT",ValidationMessage:"This field is required"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}],dateOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],booleanOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"notequal",key:this.l10n.getConstant("NotEqual")}],numberOperator:[{value:"equal",key:this.l10n.getConstant("Equal")},{value:"greaterthanorequal",key:this.l10n.getConstant("GreaterThanOrEqual")},{value:"greaterthan",key:this.l10n.getConstant("GreaterThan")},{value:"between",key:this.l10n.getConstant("Between")},{value:"lessthan",key:this.l10n.getConstant("LessThan")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")},{value:"lessthanorequal",key:this.l10n.getConstant("LessThanOrEqual")},{value:"notequal",key:this.l10n.getConstant("NotEqual")},{value:"in",key:this.l10n.getConstant("In")},{value:"notin",key:this.l10n.getConstant("NotIn")}]},this.operators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:"IN",notin:"NOT IN",lessthanorequal:"<=",startswith:"LIKE",endswith:"LIKE",between:"BETWEEN",notbetween:"NOT BETWEEN",contains:"LIKE"},this.operatorValue={equal:"Equal",greaterthan:"GreaterThan",greaterthanorequal:"GreaterThanOrEqual",lessthan:"LessThan",lessthanorequal:"LessThanOrEqual",notequal:"NotEqual",empty:"Empty",notempty:"NotEmpty",between:"Between",in:"in",notin:"NotIn",notbetween:"NotBetween",startswith:"StartsWith",endswith:"EndsWith",contains:"Contains"}},d.prototype.render=function(){this.levelColl={},this.items=[{text:this.l10n.getConstant("AddGroup"),iconCss:"e-icons e-add-icon e-addgroup"},{text:this.l10n.getConstant("AddCondition"),iconCss:"e-icons e-add-icon e-addrule"}],this.ruleElem=this.ruleTemplate(),this.groupElem=this.groupTemplate(),this.initialize(),this.initWrapper(),this.wireEvents()},d.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this)},d.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler)},d.prototype.getGroup=function(e,t){for(var r=this.levelColl[e.id],l=t?r.length-1:r.length,n=this.rule,o=0;o<l;o++)n=this.findGroupByIdx(r[o],n,0===o);return n},d.prototype.deleteGroup=function(e){var r,l,n=e,o=n.id,i=this.getGroup(n,!0),s=0,a={groupID:o};this.trigger("groupDelete",a);var u=n.nextElementSibling,p=n.previousElementSibling,d=n.querySelectorAll(".e-group-container"),c=e.querySelectorAll(".e-tooltip");for(l=c.length,r=0;r<l;r++)t.getComponent(c[r],"tooltip").destroy();for(r=0,l=d.length;r<l;r++)delete this.levelColl[d[r].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,s++;u&&u.className.indexOf("e-separate-rule")>-1&&(t.removeClass([u],"e-separate-rule"),t.addClass([u],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&t.addClass([p],"e-prev-joined-rule")),i.rules.splice(s,1),delete this.levelColl[o],t.detach(e)},d.prototype.deleteRule=function(e){var r,l=t.closest(e,".e-group-container"),n=this.getGroup(l),o=t.closest(e,".e-rule-container"),i=o,s=o.nextElementSibling,a=o.previousElementSibling,u={groupID:l.id,ruleID:o.id},p=0,d=o.querySelectorAll(".e-tooltip"),c=d.length;for(r=0;r<c;r++)t.getComponent(d[r],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,p++;n.rules.splice(p,1),this.trigger("ruleDelete",u),(!a||a.className.indexOf("e-rule-container")<0)&&s&&t.removeClass([s],"e-joined-rule"),(!s||s.className.indexOf("e-rule-container")<0)&&a&&t.removeClass([a],"e-prev-joined-rule"),t.detach(i)},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0)},d.prototype.setRules=function(e){var r=t.extend({},e,{},!0);this.setGroupRules(r)},d.prototype.getRules=function(){return this.rule},d.prototype.deleteGroups=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteGroup(document.getElementById(e[t]))},d.prototype.getFilteredRecords=function(){var e=(new n.Query).where(this.getPredicate(this.rule));return new n.DataManager(this.dataSource).executeLocal(e)},d.prototype.deleteRules=function(e){var t,r=e.length;for(t=0;t<r;t++)this.deleteRule(document.getElementById(e[t]))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),r=[],l=0,o=Object.keys(this.columns);l<o.length;l++)r.push(this.columns[l].field);return e.rules.length?(new n.Query).select(r).where(t):(new n.Query).select(r)},d.prototype.getPredicate=function(e){for(var t,r,l,o=e.rules,i=!1,s=0,a=o.length;s<a;s++)if(Object.keys(o[s]).indexOf("rules")>-1)(r=this.getPredicate(o[s]))&&(t="and"===e.condition?t.and(r):t.or(r));else if(o[s].operator.length){l="date"===o[s].type?new Date(o[s].value):o[s].value;var u=o[s].operator.toLowerCase();if(i="contains"===u||"startswith"===u||"endswith"===u,0===s)(u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u?t=this.arrayPredicate(o[s]):""!==(p=l)&&(t=new n.Predicate(o[s].field,o[s].operator,l,i));else if("and"===e.condition)if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{p=l;t&&""!==p?t=t.and(o[s].field,o[s].operator,l,i):""!==p&&(t=new n.Predicate(o[s].field,o[s].operator,l,i))}else if((u.indexOf("in")>-1||u.indexOf("between")>-1)&&"contains"!==u)t=this.arrayPredicate(o[s],t,e.condition);else{var p=l;t&&""!==p?t=t.or(o[s].field,o[s].operator,l,i):""!==p&&(t=new n.Predicate(o[s].field,o[s].operator,l,i))}}return t},d.prototype.arrayPredicate=function(e,t,r){for(var l,o=e.value,i=0,s=o.length;i<s;i++)if(""!==o[i])if(0===i)switch(e.operator){case"between":l=new n.Predicate(e.field,"greaterthan",o[i]);break;case"notbetween":l=new n.Predicate(e.field,"lessthan",o[i]);break;case"in":l=new n.Predicate(e.field,"equal",o[i]);break;case"notin":l=new n.Predicate(e.field,"notequal",o[i])}else switch(e.operator){case"between":l=l.and(e.field,"lessthan",o[i]);break;case"notbetween":l=l.or(e.field,"greaterthan",o[i]);break;case"in":l=l.or(e.field,"equal",o[i]);break;case"notin":l=l.and(e.field,"notequal",o[i])}return l&&(t?"and"===r?t=t.and(l):"or"===r&&(t=t.or(l)):t=l),t},d.prototype.importRules=function(e,r,l){l||(r=this.renderGroup(e.condition,r));for(var n=e.rules,o=0,i=n.length;o<i;o++)Object.keys(n[o]).indexOf("rules")>-1?(r=this.renderGroup(n[o].condition,r),r=this.importRules(n[o],r,!0)):this.renderRule(n[o],r);return(r=t.closest(r,".e-rule-list"))&&(r=t.closest(r,".e-group-container")),r},d.prototype.renderGroup=function(e,t){this.addGroupElement(!0,t,e);var r=t.querySelectorAll(".e-group-container");return r[r.length-1]},d.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},d.prototype.getSqlString=function(e,t){var r=!1;t?t+="(":(t="",r=!0);for(var l=e.condition,n=0,o=e.rules.length;n<o;n++){if(e.rules[n].rules)t=this.getSqlString(e.rules[n],t);else{var i=e.rules[n],s="";if(i.value instanceof Array)if("string"==typeof i.value[0]){s+='("'+i.value[0]+'"';for(var a=1,u=i.value.length;a<u;a++)s+=',"'+i.value[a]+'"';s+=")"}else s+="("+i.value+")";else"startswith"===i.operator?s+='("'+i.value+'%")':"endswith"===i.operator?s+='("%'+i.value+'")':"contains"===i.operator?s+='("%'+i.value+'%")':"number"===i.type?s+=i.value:s+='"'+i.value+'"';t+=i.field+" "+this.operators[i.operator]+" "+s}n!==o-1&&(t+=" "+l+" ")}return r||(t+=")"),t},d.prototype.setRulesFromSql=function(e){var t=this.getRulesFromSql(e);this.setRules({condition:t.condition,rules:t.rules})},d.prototype.getRulesFromSql=function(e){return this.parser=[],this.sqlParser(e),this.rule={condition:"",rules:[]},this.processParser(this.parser,this.rule,[0])},d.prototype.getSqlFromRules=function(e){return this.getSqlString(e).replace(/"/g,"'")},d.prototype.sqlParser=function(e){var t,r=0;do{t=e.slice(r),r+=this.parseSqlStrings(t)}while(""!==t);return this.parser},d.prototype.parseSqlStrings=function(e){for(var t,r,l=["=","!=","<",">","<=",">="],n=["and","or"],o=["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN"],i=0,s=l.length;i<s;i++)if(t=/^\w+$/.test(l[i])?"\\b":"",new RegExp("^("+l[i]+")"+t,"ig").exec(e))return this.parser.push(["Operators",l[i].toLowerCase()]),l[i].length;for(var i=0,s=n.length;i<s;i++)if(t=/^\w+$/.test(n[i])?"\\b":"",new RegExp("^("+n[i]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",n[i].toLowerCase()]),n[i].length;for(var i=0,s=o.length;i<s;i++)if(t=/^\w+$/.test(o[i])?"\\b":"",new RegExp("^("+o[i]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",o[i].toLowerCase()]),o[i].length;return/^\(/.exec(e)?(this.parser.push(["Left","("]),1):/^\)/.exec(e)?(this.parser.push(["Right",")"]),1):/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)?(r=/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",r]),r.length):/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)?(r=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],this.parser.push(["String",r]),r.length):/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(r=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",r]),r.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(r=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",r]),r.length):1},d.prototype.getOperator=function(e,t){var r={"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween"};return 0===e.indexOf("%")&&e.indexOf("%")===e.length-1?"contains":0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"startswith":0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"endswith":r[t]},d.prototype.processParser=function(e,t,r){for(var l,n,o,i,s,a,u,p,d,c,h=[],m=[],y=0,g=e.length;y<g;y++)if("Literal"===e[y][0]){if(l={label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){for(l.operator=this.getOperator(e[y+3][1].replace(/'/g,""),e[y+1][1]),c=e[y+1][1],o=++y+1,i=g,o=y+1;o<i;o++){if("Right"===e[o][0]){y=o;break}"like"===c&&"String"===e[o][0]?(l.value=e[o][1].replace(/'/g,"").replace(/%/g,""),l.type="string"):"Number"===e[o][0]?h.push(Number(e[o][1])):"String"===e[o][0]&&m.push(e[o][1].replace(/'/g,""))}"like"!==c&&("Number"===e[o-1][0]?(l.value=h,l.type="number"):"String"===e[o-1][0]&&(l.value=m,l.type="string"))}else"Operators"===e[y+1][0]&&(l.operator=this.getOperator(e[y+2][1],e[y+1][1]),"Number"===e[y+2][0]?(l.type="number",l.value=Number(e[y+2][1])):(l.type="string",l.value=e[y+2][1].replace(/'/g,"")));t.rules.push(l)}else{if("Left"===e[y][0]){for(n={condition:"",rules:[]},this.parser=e.splice(y+1,g-(y+1)),d=0,a=t.rules.length,s=0;s<a;s++)t.rules[s].rules&&d++;return r.push(d),t.rules.push(n),n=this.processParser(this.parser,n,r),t}if("Conditions"===e[y][0])t.condition=e[y][1];else if("Right"===e[y][0]){for(this.parser=e.splice(y+1,g-(y+1)),r.pop(),t=this.rule,p=r.length,u=0;u<p;u++)t=this.findGroupByIdx(r[u],t,0===u);return this.processParser(this.parser,t,r)}}return t},p([t.Event()],d.prototype,"created",void 0),p([t.Event()],d.prototype,"beforeConditionChange",void 0),p([t.Event()],d.prototype,"beforeFieldChange",void 0),p([t.Event()],d.prototype,"beforeOperatorChange",void 0),p([t.Event()],d.prototype,"beforeValueChange",void 0),p([t.Event()],d.prototype,"conditionChanged",void 0),p([t.Event()],d.prototype,"fieldChanged",void 0),p([t.Event()],d.prototype,"valueChanged",void 0),p([t.Event()],d.prototype,"operatorChanged",void 0),p([t.Event()],d.prototype,"groupDelete",void 0),p([t.Event()],d.prototype,"ruleDelete",void 0),p([t.Event()],d.prototype,"groupInsert",void 0),p([t.Event()],d.prototype,"ruleInsert",void 0),p([t.Property({ruleDelete:!0,groupInsert:!0,groupDelete:!0})],d.prototype,"showButtons",void 0),p([t.Property(!1)],d.prototype,"summaryView",void 0),p([t.Property(!1)],d.prototype,"allowValidation",void 0),p([t.Property([])],d.prototype,"columns",void 0),p([t.Property("")],d.prototype,"cssClass",void 0),p([t.Property([])],d.prototype,"dataSource",void 0),p([t.Property("Horizontal")],d.prototype,"displayMode",void 0),p([t.Property(!1)],d.prototype,"enableRtl",void 0),p([t.Property(!1)],d.prototype,"enablePersistence",void 0),p([t.Property("Default")],d.prototype,"sortDirection",void 0),p([t.Property(5)],d.prototype,"maxGroupCount",void 0),p([t.Property("auto")],d.prototype,"height",void 0),p([t.Property("auto")],d.prototype,"width",void 0),p([t.Complex({condition:"and",rules:[]},h)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);return e.Columns=d,e.Rules=c,e.Rule=h,e.ShowButtons=m,e.QueryBuilder=y,e}({},ej.base,ej.buttons,ej.dropdowns,ej.data,ej.inputs,ej.calendars,ej.splitbuttons,ej.popups),this.ejs=ej;
//# sourceMappingURL=ej2-querybuilder.min.js.map
/*!
* filename: index.d.ts
* version : 16.4.40-beta
* version : 16.4.42
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.

@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license.

{
"name": "@syncfusion/ej2-querybuilder",
"version": "16.4.40-beta",
"version": "16.4.42",
"description": "Essential JS 2 QueryBuilder",

@@ -11,8 +11,8 @@ "author": "Syncfusion Inc.",

"dependencies": {
"@syncfusion/ej2-base": "~16.4.40-beta",
"@syncfusion/ej2-buttons": "~16.4.40-beta",
"@syncfusion/ej2-calendars": "~16.4.40-beta",
"@syncfusion/ej2-dropdowns": "~16.4.40-beta",
"@syncfusion/ej2-splitbuttons": "~16.4.40-beta",
"@syncfusion/ej2-inputs": "~16.4.40-beta"
"@syncfusion/ej2-base": "~16.4.42",
"@syncfusion/ej2-buttons": "~16.4.42",
"@syncfusion/ej2-calendars": "~16.4.42",
"@syncfusion/ej2-dropdowns": "~16.4.42",
"@syncfusion/ej2-splitbuttons": "~16.4.42",
"@syncfusion/ej2-inputs": "~16.4.42"
},

@@ -19,0 +19,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

import { Component, INotifyPropertyChanged, NotifyPropertyChanges, getComponent, MouseEventArgs, Browser } from '@syncfusion/ej2-base';import { Property, ChildProperty, Complex, L10n, closest, extend } from '@syncfusion/ej2-base';import { getInstance, addClass, removeClass, rippleEffect, detach } from '@syncfusion/ej2-base';import { Internationalization, DateFormatOptions } from '@syncfusion/ej2-base';import { Button, RadioButton, ChangeEventArgs as ButtonChangeEventArgs } from '@syncfusion/ej2-buttons';import { DropDownList, ChangeEventArgs, FieldSettingsModel, CheckBoxSelection } from '@syncfusion/ej2-dropdowns';import { MultiSelect, MultiSelectChangeEventArgs } from '@syncfusion/ej2-dropdowns';import { EmitType, Event, EventHandler , getValue } from '@syncfusion/ej2-base';import { Query, Predicate, DataManager, ReturnOption } from '@syncfusion/ej2-data';import { TextBox, NumericTextBox, InputEventArgs, ChangeEventArgs as InputChangeEventArgs } from '@syncfusion/ej2-inputs';import { DatePicker, ChangeEventArgs as CalendarChangeEventArgs } from '@syncfusion/ej2-calendars';import { DropDownButton, ItemModel, MenuEventArgs } from '@syncfusion/ej2-splitbuttons';import { Tooltip } from '@syncfusion/ej2-popups';
import { Component, INotifyPropertyChanged, NotifyPropertyChanges, getComponent, MouseEventArgs, Browser } from '@syncfusion/ej2-base';import { Property, ChildProperty, Complex, L10n, closest, extend, isNullOrUndefined } from '@syncfusion/ej2-base';import { getInstance, addClass, removeClass, rippleEffect, detach, classList } from '@syncfusion/ej2-base';import { Internationalization, DateFormatOptions } from '@syncfusion/ej2-base';import { Button, RadioButton, ChangeEventArgs as ButtonChangeEventArgs } from '@syncfusion/ej2-buttons';import { DropDownList, ChangeEventArgs, FieldSettingsModel, CheckBoxSelection } from '@syncfusion/ej2-dropdowns';import { MultiSelect, MultiSelectChangeEventArgs } from '@syncfusion/ej2-dropdowns';import { EmitType, Event, EventHandler, getValue } from '@syncfusion/ej2-base';import { Query, Predicate, DataManager } from '@syncfusion/ej2-data';import { TextBox, NumericTextBox, InputEventArgs, ChangeEventArgs as InputChangeEventArgs } from '@syncfusion/ej2-inputs';import { DatePicker, ChangeEventArgs as CalendarChangeEventArgs } from '@syncfusion/ej2-calendars';import { DropDownButton, ItemModel, MenuEventArgs } from '@syncfusion/ej2-splitbuttons';import { Tooltip } from '@syncfusion/ej2-popups';
import {TemplateColumn,Validation,DisplayMode,SortDirection} from "./query-builder";

@@ -141,2 +141,3 @@ import {ComponentModel} from '@syncfusion/ej2-base';

* Specifies the boolean value in ruleDelete that the enable/disable the buttons in rule.
* @default true
*/

@@ -147,2 +148,3 @@ ruleDelete?: boolean;

* Specifies the boolean value in groupInsert that the enable/disable the buttons in group.
* @default true
*/

@@ -153,2 +155,3 @@ groupInsert?: boolean;

* Specifies the boolean value in groupDelete that the enable/disable the buttons in group.
* @default true
*/

@@ -155,0 +158,0 @@ groupDelete?: boolean;

@@ -110,2 +110,3 @@ /**

* Specifies the boolean value in ruleDelete that the enable/disable the buttons in rule.
* @default true
*/

@@ -115,2 +116,3 @@ ruleDelete: boolean;

* Specifies the boolean value in groupInsert that the enable/disable the buttons in group.
* @default true
*/

@@ -120,2 +122,3 @@ groupInsert: boolean;

* Specifies the boolean value in groupDelete that the enable/disable the buttons in group.
* @default true
*/

@@ -160,3 +163,2 @@ groupDelete: boolean;

private operatorValue;
private validationRules;
private ruleElem;

@@ -317,3 +319,4 @@ private groupElem;

private addRuleElement;
private validateFields;
private renderToolTip;
validateFields(): void;
private groupTemplate;

@@ -331,2 +334,5 @@ private ruleTemplate;

private processTemplate;
private renderStringValue;
private renderNumberValue;
private processValueString;
private renderControls;

@@ -336,2 +342,3 @@ private renderValues;

private updateRules;
private validatValue;
private findGroupByIdx;

@@ -358,2 +365,3 @@ /**

private renderSummaryCollapse;
private columnSort;
onPropertyChanged(newProp: QueryBuilderModel, oldProp: QueryBuilderModel): void;

@@ -392,3 +400,3 @@ protected preRender(): void;

*/
deleteRules(filterID: string[]): void;
deleteRules(ruleID: string[]): void;
/**

@@ -441,3 +449,3 @@ * Gets the query for Data Manager.

*/
min: number;
min?: number;
/**

@@ -447,3 +455,3 @@ * Specifies the maximum value in textbox validation.

*/
max: number;
max?: number;
/**

@@ -450,0 +458,0 @@ * Specifies whether the value is required or not

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc