@syncfusion/ej2-querybuilder
Advanced tools
Comparing version 17.1.42 to 17.1.43
@@ -9,2 +9,10 @@ # Changelog | ||
- Multiselect datasource not properly updated for in and notin operators. | ||
## 17.1.42 (2019-04-23) | ||
### QueryBuilder | ||
#### Bug Fixes | ||
- Rule with AND operator is not properly updated in ASP.NET MVC and Core. | ||
@@ -11,0 +19,0 @@ |
/*! | ||
* filename: ej2-querybuilder.umd.min.js | ||
* version : 17.1.42 | ||
* version : 17.1.43 | ||
* Copyright Syncfusion Inc. 2001 - 2019. 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,l,r,n,i,o,s,a){"use strict";var u=function(){var e=function(t,l){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])})(t,l)};return function(t,l){function r(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(r.prototype=l.prototype,new r)}}(),p=function(e,t,l,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,l):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(i<3?n(o):i>3?n(t,l,o):n(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o};r.MultiSelect.Inject(r.CheckBoxSelection);var d=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"values",void 0),p([t.Property(null)],l.prototype,"operators",void 0),p([t.Property(null)],l.prototype,"template",void 0),p([t.Property({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),p([t.Property(null)],l.prototype,"format",void 0),p([t.Property(null)],l.prototype,"step",void 0),l}(t.ChildProperty),c=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"condition",void 0),p([t.Collection([],l)],l.prototype,"rules",void 0),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"operator",void 0),p([t.Property(null)],l.prototype,"value",void 0),l}(t.ChildProperty),h=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(!0)],l.prototype,"ruleDelete",void 0),p([t.Property(!0)],l.prototype,"groupInsert",void 0),p([t.Property(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),m=function(e){function d(t,l){return e.call(this,t,l)||this}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+"_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.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=void 0,r=!1,n=void 0,i={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var o=this.columns,s=0,a=o.length;s<a;s++)o[s].type||(e.indexOf(o[s].field)>-1&&("string"===(l=typeof(n=this.dataColl[0][o[s].field]))?r=!isNaN(Date.parse(n)):"object"===l&&(r=n instanceof Date&&!isNaN(n.getTime()),l="string"),o[s].type=l,r=!1),l="string"),o[s].validation||(o[s].validation=i)}else{for(s=0,a=e.length;s<a;s++)"string"===(l=typeof(n=this.dataColl[0][e[s]]))?r=!isNaN(Date.parse(n)):"object"===l&&(r=n instanceof Date&&!isNaN(n.getTime()),l="string"),t[s]={field:e[s],label:e[s],type:r?"date":l,validation:i},r=!1;this.columns=t}}},d.prototype.triggerEvents=function(e,t){return this.isImportRules?e:("before"===t?this.trigger("beforeChange",e):"ruleChange"===t?this.trigger("ruleChange",e):this.trigger("change",e),e)},d.prototype.clickEventHandler=function(e){var l,r=e.target;this.isImportRules=!1;var n;if("SPAN"===r.tagName&&(r=r.parentElement),r.className.indexOf("e-collapse-rule")>-1){var i=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var o=document.getElementById(this.element.id+"_summary_content"),s=o.querySelector(".e-summary-text");i.animate(".e-query-builder",{name:"SlideLeftIn"});(u=this.element.querySelector(".e-group-container")).style.display="none",s.textContent=this.getSqlFromRules(this.rule),o.style.display="block",s.style.height=s.scrollHeight+"px"}if("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((i=new t.Animation({duration:1e3,delay:0})).animate(".e-query-builder",{name:"SlideLeftIn"}),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 a=t.extend({},this.rule,{},!0);this.setGroupRules(a),this.renderSummaryCollapse()}else{var u;(u=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),u.style.display="block"}}}else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1){var p=t.closest(r,".e-group-container"),d=this.getValidRules(this.rule);if(n=p.id.replace(this.element.id+"_",""),l={groupID:n,cancel:!1,type:"condition",value:r.textContent.toLowerCase()},(l=this.triggerEvents(l,"before")).cancel)return;var c=this.getGroup(p);c.condition=l.value,this.triggerEvents({groupID:n,type:"condition",value:c.condition}),this.filterRules(d,this.getValidRules(this.rule),"condition")}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert?t.removeClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.addClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):l.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},d.prototype.addRuleElement=function(e,l){var n={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};if(!(n=this.triggerEvents(n,"before")).cancel){var i=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?i.className="e-rule-container e-vertical-mode":i.className="e-rule-container e-horizontal-mode";var o,s,u,p,d,c,h=e.querySelector(".e-rule-list"),m=i.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)m.textContent=this.l10n.getConstant("Remove"),t.addClass([m],"e-flat"),t.addClass([m],"e-primary");else{t.addClass([m],"e-round"),t.addClass([m],"e-icon-btn");new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(m),m=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),i.querySelector("button").appendChild(m)}if(i.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.ruleIdCounter++,i.querySelector(".e-filter-input").setAttribute("id",i.id+"_filterkey"),h.appendChild(i),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-rule-container")>-1&&(i.className.indexOf("e-joined-rule")<0&&(i.className+=" e-joined-rule"),i.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(i.previousElementSibling.className+=" e-prev-joined-rule")),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-group-container")>-1&&i.className.indexOf("e-separate-rule")<0&&(i.className+=" e-separate-rule"),c=this.element.className.indexOf("e-device")>-1?"250px":"200px",(d=new r.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?c:"auto",change:this.changeField.bind(this),value:l?l.field:null})).appendTo("#"+i.id+"_filterkey"),this.filterIndex=d.index,o=this.levelColl[e.id],!this.isImportRules){for(s=this.rule,u=0,p=o.length;u<p;u++)s=this.findGroupByIdx(o[u],s,0===u);Object.keys(l).length?s.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}):s.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(l).length&&this.changeRule(l,{element:d.element,itemData:this.columns[this.filterIndex]}),this.triggerEvents({groupID:e.id.replace(this.element.id+"_",""),type:"insertRule"})}},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(){var e=!0;if(this.allowValidation){var l=void 0,r=void 0,n=void 0,i=void 0,o=[],s=void 0,a=void 0,u=void 0,p=void 0,d=void 0,c=this.element.querySelectorAll(".e-rule-container"),h=void 0;for(l=0,r=c.length;l<r;l++)if(s=t.closest(c[l],".e-group-container"),d=this.getGroup(s),a=0,i=p=c[l],u=t.getComponent(c[l].querySelector(".e-rule-field input.e-control"),"dropdownlist"),h=!t.isNullOrUndefined(u.index)&&this.columns[u.index].validation,n=p.querySelector(".e-rule-field input.e-control"),h&&h.isRequired){for(;i&&null!==i.previousElementSibling;)i=i.previousElementSibling,a++;if(n=p.querySelector(".e-rule-field input.e-control"),d.rules[a].field||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),n=p.querySelector(".e-rule-operator input.e-control"),d.rules[a].operator||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),d.rules[a].value instanceof Array&&(o=d.rules[a].value),t.isNullOrUndefined(d.rules[a].value)||""===d.rules[a].value||d.rules[a].value instanceof Array&&o.length<1){var m=p.querySelectorAll(".e-rule-value input.e-control");e=!1;for(var y=0,f=m.length;y<f;y++){var g=m[y],v=void 0;g.parentElement.className.indexOf("e-searcher")>-1?(v=t.closest(g,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(v):m[y].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(m[y].parentElement),y++}}}else u.element&&t.isNullOrUndefined(u.index)&&(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1)}return e},d.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)},d.prototype.refreshLevel=function(e){var l,r,n=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=n.length,s=0;for(r=0;r<o;r++)(l=n[r]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[l.id]=e.level.slice(),s++,e.groupElement=l,e=this.refreshLevel(e));var a=t.closest(i,".e-rule-list");return e.groupElement=a?t.closest(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(){var e,t,l,r,n,i,o,s,a;return e=this.createElement("div",{attrs:{class:"e-group-container"}}),l=this.createElement("div",{attrs:{class:"e-group-header"}}),t=this.createElement("div",{attrs:{class:"e-group-body"}}),r=this.createElement("div",{attrs:{class:"e-rule-list"}}),e.appendChild(l),t.appendChild(r),e.appendChild(t),n=this.createElement("div",{attrs:{class:"e-btn-group"}}),(i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl e-small"},innerHTML:"AND"}),n.appendChild(o),i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl e-small"},innerHTML:"OR"}),n.appendChild(o),l.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),l.appendChild(s),e},d.prototype.ruleTemplate=function(){var e,t,l,r,n,i;return e=this.createElement("div"),n=this.createElement("div",{attrs:{class:"e-rule-field"}}),l=this.createElement("div",{attrs:{class:"e-rule-filter"}}),t=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}}),l.appendChild(t),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-operator"}}),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value"}}),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),i=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",r=this.createElement("button",{attrs:{class:i}}),l.appendChild(r),n.appendChild(l),e.appendChild(n),e},d.prototype.addGroupElement=function(e,r,n,i){var o={groupID:r.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};if(!((o=this.triggerEvents(o,"before")).cancel||this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var u,p=this.groupElem.cloneNode(!0);p.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.groupIdCounter++;var d=p.querySelector(".e-btngroup-and"),c=p.querySelector(".e-btngroup-or"),h=p.querySelector(".e-btngroup-and-lbl"),m=p.querySelector(".e-btngroup-or-lbl");if(d.setAttribute("id",this.element.id+"_and"+this.btnGroupId),c.setAttribute("id",this.element.id+"_or"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("name",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_and"+this.btnGroupId),m.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){var y=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";u=this.createElement("button",{attrs:{class:y}});new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(u);new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(u),t.rippleEffect(u,{selector:".deletegroup"}),p.querySelector(".e-group-action").appendChild(u);for(var f=r.querySelector(".e-rule-list"),g=f.children,v=0,b=0,C=g.length;b<C;b++)g[b].className.indexOf("e-group-container")>-1&&(v+=1);f.appendChild(p);var x=this.levelColl[r.id].slice(0);x.push(v),this.levelColl[p.id]=x,this.isImportRules||(this.addGroups([],r.id.replace(this.element.id+"_","")),i&&this.addRuleElement(p,{}))}else r.appendChild(p),this.levelColl[p.id]=[0];p.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===n&&p.querySelector(".e-btngroup-or").setAttribute("checked","true");var E=p.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,E),select:this.selectBtn.bind(this,E)}).appendTo(E),this.triggerEvents({groupID:r.id.replace(this.element.id+"_",""),type:"insertGroup"})}},d.prototype.notifyChange=function(e,l){for(var r=t.closest(l,".e-rule-value").querySelectorAll(".e-template"),n=[],i=0,o=r.length;i<o;i++)r[i].nextElementSibling&&r[i].nextElementSibling.className.indexOf("e-check")>-1&&n.push(r[i].textContent);this.updateRules(l,r.length>1?n:e)},d.prototype.changeValue=function(e,l){var r,n,i,o;if(l.event)o=l.event.target;else{o=l.element}if(o.className.indexOf("e-day")>-1){o=l.element}var s=t.closest(o,".e-group-container"),a=t.closest(o,".e-rule-container");n=s.id.replace(this.element.id+"_",""),i=a.id.replace(this.element.id+"_","");var u=l;u.element&&u.element.className.indexOf("e-datepicker")>-1&&(o=u.element);var p,d,c;if(o.className.indexOf("e-radio")>-1)if(d=parseInt(o.id.split("valuekey")[1],0),c=t.getComponent(t.closest(o,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.columns[c.index].values)p=this.columns[c.index].values[d];else{p=["True","False"][d]}else p=o.className.indexOf("e-multiselect")>-1?t.getComponent(o,"multiselect").value:l.value;r={groupID:n,ruleID:i,value:p,cancel:!1,type:"value"},(r=this.triggerEvents(r,"before")).cancel||(this.updateRules(o,r.value,e),this.triggerEvents({groupID:n,ruleID:i,value:r.value,cancel:!1,type:"value"}))},d.prototype.changeField=function(e){if(e.isInteracted){for(var l=t.closest(e.element,".e-group-container"),r=this.getGroup(l),n=t.closest(e.element,".e-rule-container"),i=0;n&&null!==n.previousElementSibling;)n=n.previousElementSibling,i++;this.changeRule(r.rules[i],e)}},d.prototype.changeRule=function(e,l){if(l.itemData){var n,i,o,s,a,u,p,d,c={},h=e.operator?e.operator.toLowerCase():"";u=t.closest(l.element,".e-rule-filter"),p=t.closest(l.element,".e-rule-operator");var m=t.getComponent(l.element,"dropdownlist");s=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_","");var y;if(u){if(i=t.closest(u,".e-rule-container"),a=i.id.replace(this.element.id+"_",""),y={groupID:s,ruleID:a,selectedIndex:m.index,cancel:!1,type:"field"},(y=this.triggerEvents(y,"before")).cancel)return;m.index!==y.selectedIndex&&(m.index=y.selectedIndex),c.type=this.columns[m.index].type,i.querySelector(".e-template")&&(e.value="")}if(p){if(i=t.closest(p,".e-rule-container"),a=i.id.replace(this.element.id+"_",""),y={groupID:s,ruleID:a,selectedIndex:m.index,cancel:!1,type:"operator"},(y=this.triggerEvents(y,"before")).cancel)return;m.index!==y.selectedIndex&&(m.index=y.selectedIndex),c.operator=m.value;var f=c.operator.toLowerCase();if(c.operator.toLowerCase().indexOf("between")>-1||c.operator.toLowerCase().indexOf("in")>-1&&c.operator.toLowerCase().indexOf("contains")<0?(u=p.previousElementSibling,c.type=e.type,e.value=[]):"object"==typeof e.value&&(e.value=e.value.length>0?e.value[0]:""),l.previousItemData){var g=l.previousItemData.value.toLowerCase();(g.indexOf("between")>-1||g.indexOf("in")>-1&&g.indexOf("contains")<0)&&(u=p.previousElementSibling,c.type=e.type)}h.indexOf("in")>-1&&h.indexOf("in")<5&&f.indexOf("in")>-1&&f.indexOf("in")<5&&(u=null)}if(u)if(p=u.nextElementSibling,t.addClass([p],"e-operator"),p.childElementCount)n=t.getComponent(p.querySelector(".e-dropdownlist"),"dropdownlist"),c.operator=n.value,this.renderValues(p,l.itemData,l.previousItemData,!0,e,c,l.element);else{var v=t.closest(p,".e-rule-container").id;d=this.createElement("input",{attrs:{type:"text",id:v+"_operatorkey"}}),p.appendChild(d),this.columns[m.index].operators?o=this.columns[m.index].operators:l.itemData&&(o=this.customOperators[this.columns[m.index].type+"Operator"]);var b=this.element.className.indexOf("e-device")>-1?"250px":"200px";new r.DropDownList({dataSource:o,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:o.length>5?b:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+v+"_operatorkey"),c.operator=e&&""!==e.operator?e.operator:o[0].value,this.isImportRules&&(c.type=this.columns[m.index].type,c.operator=e.operator),this.renderValues(p,this.columns[m.index],l.previousItemData,!1,e,c,l.element)}this.isImportRules||this.updateRules(l.element,l.item)}},d.prototype.destroyControls=function(e){var l;l=e.nextElementSibling.querySelectorAll("input.e-control");var r;r=e.nextElementSibling.querySelectorAll("div.e-control:not(.e-handle)");for(var n=this.columns,i=0,o=l.length;i<o;i++){if(l[i].classList.contains("e-textbox"))t.getComponent(l[i],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+l[i].id));else if(l[i].classList.contains("e-dropdownlist"))t.getComponent(l[i],"dropdownlist").destroy();else if(l[i].classList.contains("e-radio"))t.getComponent(l[i],"radio").destroy();else if(l[i].classList.contains("e-numerictextbox"))t.getComponent(l[i],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+l[i].id));else if(l[i].classList.contains("e-datepicker"))t.getComponent(l[i],"datepicker").destroy();else if(l[i].classList.contains("e-multiselect"))t.getComponent(l[i],"multiselect").destroy();else if(l[i].className.indexOf("e-template")>-1)for(var s=l[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],l[i].id);break}document.getElementById(l[i].id)&&t.detach(l[i])}for(i=0,o=r.length;i<o;i++){if(r[i].className.indexOf("e-template")>-1)for(s=r[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],r[i].id);break}t.detach(r[i])}},d.prototype.templateDestroy=function(e,l){var r=e.template.destroy;e.template&&e.template.destroy&&("string"==typeof r?(r=t.getValue(r,window))({elementId:l}):e.template.destroy({elementId:l}))},d.prototype.getDistinctValues=function(e,t){for(var l={},r=[],n=0,i=e.length;n<i;n++){var o=e[n][t];Number(e[n][t])===e[n][t]&&e[n][t]%1!=0&&(o=e[n][t].toString());var s={};o in l||(l[o]=1,s[t]=o,r.push(s))}return r},d.prototype.renderMultiSelect=function(e,t,l,i){var o,s=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(s=!0,o=this.getDistinctValues(this.dataColl,e.field));new r.MultiSelect({dataSource:s?o:this.dataManager,query:new n.Query([e.field]),fields:{text:e.field,value:e.field},value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l)}).appendTo("#"+t+"_valuekey"+l)},d.prototype.multiSelectOpen=function(e,l){var r=this;if(this.dataSource instanceof n.DataManager){var i=document.getElementById(e),o=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),s=this.columns[o.index].field,u=!1;if(this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(s)>-1&&(u=!0),!u){l.cancel=!0;var p=t.getComponent(i,"multiselect");p.hideSpinner();var d=this.dataManager.executeQuery((new n.Query).select(s)),c=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),d.then(function(e){r.dataColl=t.extend(r.dataColl,e.result,[],!0);var l=r.getDistinctValues(r.dataColl,s);p.dataSource=l,a.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){c.reject(e)})}}},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),a.createSpinner({target:l,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,l){var r=document.getElementById(l.popup.element.id.replace("_popup","")),n=t.getComponent(r,"multiselect").value;this.updateRules(r,n,e)},d.prototype.processTemplate=function(e,l,r,n){var i=t.closest(e,".e-rule-container").querySelectorAll(".e-template");i.length<2?l.template&&"string"==typeof l.template.write?t.getValue(l.template.write,window)({elements:i[0],values:r.value,operator:n.operator}):l.template&&l.template.write&&l.template.write({elements:i[0],values:r.value,operator:n.operator}):l.template&&"string"==typeof l.template.write?t.getValue(l.template.write,window)({elements:i,values:r.value,operator:n.operator}):l.template&&l.template.write&&l.template.write({elements:i,values:r.value,operator:n.operator})},d.prototype.renderStringValue=function(e,t,l,r,n){var o,s=this.isImportRules?t.value:"";if("in"!==l&&"notin"!==l||!this.dataColl.length){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules?t.value:[]).join(","));var a=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,r)});a.appendTo("#"+e+"_valuekey"+r),a.value=s,a.dataBind()}else o=this.isImportRules?t.value:[],this.renderMultiSelect(t,e,r,o),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.style.width="100%":(n.style.width=null,n.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,l,r,n,o,s,a){var u,p=this.isImportRules?l.value:0;if("in"!==r&&"notin"!==r||!this.dataColl.length)if("in"===r||"notin"===r){var d=(u=this.isImportRules?l.value:[]).join(","),c=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,n)});c.appendTo("#"+e+"_valuekey"+n),c.value=d,c.dataBind()}else{var h=t.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist"),m=(s=this.columns[h.index]).validation&&s.validation.min?s.validation.min:0,y=s.validation&&s.validation.max?s.validation.max:Number.MAX_VALUE,f=s.format?s.format:"n";a>1&&l&&(p=l.value[n]?l.value[n]:0);new i.NumericTextBox({value:p,format:f,min:m,max:y,width:"100%",step:s.step?s.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}else u=this.isImportRules?l.value:[],this.renderMultiSelect(l,e,n,u),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?o.style.width="100%":(o.style.minWidth="200px",o.style.width=null)},d.prototype.processValueString=function(e,t){var l=[],r=e.split(",");if("string"===t)return r;for(var n=0,i=r.length;n<i;n++)l.push(Number(r[n]));return l},d.prototype.renderControls=function(e,r,n,i){if(t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),r.template)this.processTemplate(e,r,n,i);else{var s="boolean"===i.type||i.operator&&i.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"!==i.operator&&"notin"!==i.operator&&(u.style.width="200px");for(var p=0;p<s;p++)switch(i.type){case"string":this.renderStringValue(a,n,i.operator,p,u);break;case"number":this.renderNumberValue(a,n,i.operator,p,u,r,s);break;case"boolean":var d=r.values&&r.values.length?r.values:["True","False"],c=!this.isImportRules||Boolean(n.value),h=new l.RadioButton({label:d[p].toString(),name:a+"default",checked:c,value:d[p],change:this.changeValue.bind(this,p)});h.appendTo("#"+a+"_valuekey"+p),this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,y=void 0;if(this.isImportRules&&n&&n.value){m=s>1?new Date(n.value[p]):new Date(n.value);var f=void 0,g=this.getColumn(n.field);if(y=s>1?n.value[p]:n.value,g.format){var v=this.intl.getDateParser({skeleton:"full",type:"dateTime"});f={type:"dateTime",format:g.format},"Invalid Date"===m.toLocaleDateString()&&(m=v(y),t.isNullOrUndefined(m)&&(m=this.intl.parseDate(y,f)))}}(r.format?new o.DatePicker({value:m,format:r.format,change:this.changeValue.bind(this,p)}):new o.DatePicker({value:m,change:this.changeValue.bind(this,p)})).appendTo("#"+a+"_valuekey"+p)}}}},d.prototype.renderValues=function(e,l,r,n,i,o,s){if(n){var a=t.getComponent(e.querySelector("input"),"dropdownlist");l.operators?(a.dataSource=l.operators,a.index=0!==a.index?0:1,a.dataBind(),o.operator=a.value):l.type&&(a.dataSource=this.customOperators[l.type+"Operator"],a.index=0!==a.index?0:1,a.dataBind(),o.operator=a.value)}var u=t.closest(e,".e-rule-container").id;r&&r.template&&(this.templateDestroy(r,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(l.template=this.columns[d.index].template,l.template){l.template=this.columns[d.index].template;var c=void 0;if(l.template&&"string"==typeof l.template.create?c=t.getValue(l.template.create,window)():l.template&&l.template.create&&(c=l.template.create()),c instanceof Element)c.id=u+"_valuekey0",t.addClass([c],"e-template"),t.addClass([c],"e-"+l.field),e.nextElementSibling.appendChild(c);else if(c instanceof Array){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"===o.type||o.operator&&o.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,l,i,o)},d.prototype.updateValues=function(e,l){var r=e.className.split(" e-")[1],n=parseInt(e.id.slice(-1),2);switch(r){case"textbox":case"dropdownlist":case"radio":l.value=t.getComponent(e,r).value;break;case"numerictextbox":l.operator.indexOf("between")>-1?l.value[n]=t.getComponent(e,r).value:l.value=t.getComponent(e,r).value;break;case"datepicker":var i={type:"dateTime",format:this.getColumn(l.field).format};l.operator.indexOf("between")>-1?l.value[n]=t.getComponent(e,r).value:t.isNullOrUndefined(i.format)?l.value=this.intl.formatDate(t.getComponent(e,r).value):l.value=this.intl.formatDate(t.getComponent(e,r).value,i)}},d.prototype.updateRules=function(e,l,r){for(var n,i,o,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0,d=s.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),o=u.id.replace(this.element.id+"_",""),t.closest(e,".e-rule-filter")){n=t.getComponent(e,"dropdownlist"),a.rules[p].field=this.columns[n.index].field,a.rules[p].type=this.columns[n.index].type,a.rules[p].label=this.columns[n.index].label;var h=t.closest(e,".e-rule-filter"),m=h.nextElementSibling.querySelector("input.e-control"),y=t.getComponent(m,"dropdownlist").value;a.rules[p].operator=y,(m=h.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(m=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),m||(m=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:a.rules[p].field,type:"field"},this.updateValues(m,a.rules[p]),this.triggerEvents(i),this.allowValidation&&a.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if(t.closest(e,".e-rule-operator")){n=t.getComponent(e,"dropdownlist"),a.rules[p].operator=n.value;var f=void 0;e.parentElement;f=u.querySelectorAll(".e-rule-value input.e-control"),i={groupID:d,ruleID:o,value:n.value,type:"operator"},this.allowValidation&&a.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),f.length>1&&(a.rules[p].value=[]);for(var g=0;g<f.length;g++)this.updateValues(f[g],a.rules[p]);this.triggerEvents(i),this.filterRules(c,this.getValidRules(this.rule),"operator")}else t.closest(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,p,s,u,r),this.filterRules(c,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,rule:e.rules})!==JSON.stringify({condition:t.condition,rule:t.rules})&&this.triggerEvents({previousRule:e,rule:t,type:l},"ruleChange")},d.prototype.ruleValueUpdate=function(e,l,n,i,o,s,a){var u,p=["in","between","notin","notbetween"];if(null!==l){var d=n.rules[i].operator.toLowerCase();if(e.className.indexOf("e-multiselect")>-1&&"number"===n.rules[i].type){for(var c=[],h=l,m=0,y=h.length;m<y;m++)"string"==typeof h[m]&&c.push(parseFloat(h[m]));c.length&&(l=c)}if(e.className.indexOf("e-template")>-1)l instanceof Array?p.indexOf(d)>-1?n.rules[i].value=l:n.rules[i].value=l[0]:n.rules[i].value=l,u={groupID:o.id,ruleID:s.id,value:n.rules[i].value,type:"value"},this.triggerEvents(u);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)p.indexOf(d)>-1?n.rules[i].value[a]=l:n.rules[i].value=l;else if(e.className.indexOf("e-radio")>-1)n.rules[i].value=l;else if(e.className.indexOf("e-multiselect")>-1)n.rules[i].value=l;else if(e.className.indexOf("e-textbox")>-1)"in"===d||"notin"===d?(n.rules[i].type,n.rules[i].value=this.processValueString(l,n.rules[i].type)):n.rules[i].value=l;else if(e.className.indexOf("e-datepicker")>-1){var f=t.getInstance(s.querySelector(".e-rule-filter input"),r.DropDownList),g={type:"dateTime",format:this.columns[f.index].format||"MM/dd/yyyy"};g.type&&(p.indexOf(d)>-1?n.rules[i].value[a]=this.intl.formatDate(l,g):n.rules[i].value=this.intl.formatDate(l,g))}this.validatValue(n,i,s)}},d.prototype.validatValue=function(e,l,r){if(this.allowValidation&&e.rules[l].value){var n=r.querySelectorAll(".e-rule-value .e-control");n[0].className.indexOf("e-tooltip")>-1?t.getComponent(n[0],"tooltip").destroy():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,l){var r=t.rules,n=[];if(!l){for(var i=0,o=r.length;i<o;i++)(t=r[i]).rules&&n.push(t);return n[e]}return t},d.prototype.destroy=function(){if(this.element){var l,r,n;for(e.prototype.destroy.call(this),n=(l=this.element.querySelectorAll(".e-addrulegroup")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdown-btn").destroy(),t.detach(l[r]);for(n=(l=this.element.querySelectorAll(".e-rule-filter .e-control")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdownlist").destroy(),t.detach(l[r]);for(n=(l=this.element.querySelectorAll(".e-rule-operator .e-control")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdownlist").destroy(),t.detach(l[r]);this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_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){t=this.element.id+"_"+t;for(var l=0,r=e.length;l<r;l++)this.addRuleElement(document.getElementById(t),e[l])},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var l=document.getElementById(t),r=this.getGroup(l);if(e.length)for(var n=0,i=e.length;n<i;n++)this.importRules(e[n],l);else r.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.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();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 l=document.querySelectorAll("label.e-btn"),r=void 0,n=0;n<l.length;n++)r=l.item(n),t.rippleEffect(r,{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"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),r=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),r.appendChild(l),e.appendChild(r),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});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,l){for(var r=0,n=Object.keys(e);r<n.length;r++){switch(n[r]){case"summaryView":var i=this.element.querySelector(".e-group-container"),o=this.element.querySelector(".e-summary-content");e.summaryView?(i.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),o=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),o.style.display="block"):(i.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),i.style.display="block",o.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":l.cssClass&&t.removeClass([this.element],l.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,e.rule=this.getRuleCollection(this.rule,!1);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new t.Internationalization(this.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",In:"In",NotIn:"Not In",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",SummaryViewTitle:"Summary View"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],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",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.dataSource instanceof n.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new n.Query).take(1))):(this.dataManager=new n.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new n.Query),this.initControl())},d.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),r=new n.Deferred;l.then(function(e){t.dataColl=e.result,t.initControl()}).catch(function(e){r.reject(e)})},d.prototype.initControl=function(){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 l=this.levelColl[e.id],r=t?l.length-1:l.length,n=this.rule,i=0;i<r;i++)n=this.findGroupByIdx(l[i],n,0===i);return n},d.prototype.deleteGroup=function(e){var l,r,n=e,i=n.id.replace(this.element.id+"_",""),o=this.getGroup(n,!0),s=0,a={groupID:i,cancel:!1,type:"deleteGroup"},u=this.getValidRules(this.rule);if(!(a=this.triggerEvents(a,"before")).cancel){var p=n.nextElementSibling,d=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),h=e.querySelectorAll(".e-tooltip");for(r=h.length,l=0;l<r;l++)t.getComponent(h[l],"tooltip").destroy();for(l=0,r=c.length;l<r;l++)delete this.levelColl[c[l].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,s++;p&&p.className.indexOf("e-separate-rule")>-1&&(t.removeClass([p],"e-separate-rule"),t.addClass([p],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&t.addClass([d],"e-prev-joined-rule")),o.rules.splice(s,1),delete this.levelColl[i],t.detach(e),this.refreshLevelColl(),this.triggerEvents(a),this.filterRules(u,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.deleteRule=function(e){var l,r,n=t.closest(e,".e-group-container"),i=this.getGroup(n),o=t.closest(e,".e-rule-container");r=n.id.replace(this.element.id+"_",""),l=t.closest(e,".e-rule-container").id.replace(this.element.id+"_","");var s=this.getValidRules(this.rule),a={groupID:r,ruleID:l,cancel:!1,type:"deleteRule"};if(!(a=this.triggerEvents(a,"before")).cancel){var u,p=o,d=o.nextElementSibling,c=o.previousElementSibling,h=0,m=o.querySelectorAll(".e-tooltip"),y=m.length;for(u=0;u<y;u++)t.getComponent(m[u],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,h++;i.rules.splice(h,1),(!c||c.className.indexOf("e-rule-container")<0)&&d&&t.removeClass([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&c&&t.removeClass([c],"e-prev-joined-rule"),t.detach(p),this.triggerEvents(a),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0),this.isImportRules=!1},d.prototype.getValidRules=function(e){var l=e.condition,r=t.extend([],e.rules,[],!0);return this.getRuleCollection({condition:l,rules:r},!0)},d.prototype.getRuleCollection=function(e,t){var l;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var r=e.rules.length,n=0;n<r;n++)l=e.rules[n],l=this.getRuleCollection(l,t),e.rules[n]=l,Object.keys(l).length<1&&t&&(e.rules.splice(n,1),n--,r--);return e=e.condition?{condition:e.condition,rules:e.rules}:""!==e.field&&""!==e.operator&&""!==e.value?{label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value}:{}},d.prototype.setRules=function(e){var l=t.extend({},e,{},!0);this.setGroupRules(l)},d.prototype.getRules=function(){return this.rule},d.prototype.deleteGroups=function(e){var t,l,r=e.length;for(t=0;t<r;t++)l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=(new n.Query).where(e);return this.dataManager.executeQuery(t)},d.prototype.deleteRules=function(e){var t,l,r=e.length;for(t=0;t<r;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],r=0,i=Object.keys(this.columns);r<i.length;r++)l.push(this.columns[r].field);return e.rules.length?(new n.Query).select(l).where(t):(new n.Query).select(l)},d.prototype.getPredicate=function(e){for(var t,l,r,i,o=e.rules,s=!1,a=0,u=o.length;a<u;a++){if(Object.keys(o[a]).indexOf("rules")>-1)(l=this.getPredicate(o[a]))&&(t=t?"and"===e.condition?t.and(l):t.or(l):l);else if(o[a].operator.length){var p=o[a].operator.toLowerCase();if(s=["contains","startswith","endswith"].indexOf(p)>-1||"date"===o[a].type&&["equal","notequal"].indexOf(p)>-1,i=this.getColumn(o[a].field),"date"===o[a].type){var d={type:"dateTime",format:i.format||"MM/dd/yyyy"};r=this.intl.parseDate(o[a].value,d)}else r=o[a].value;if(0===a)if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a]);else{""!==(c=r)&&(t=new n.Predicate(o[a].field,o[a].operator,r,s))}else if("and"===e.condition)if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{var c=r;t&&""!==c?t=t.and(o[a].field,o[a].operator,r,s):""!==c&&(t=new n.Predicate(o[a].field,o[a].operator,r,s))}else if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{c=r;t&&""!==c?t=t.or(o[a].field,o[a].operator,r,s):""!==c&&(t=new n.Predicate(o[a].field,o[a].operator,r,s))}}}return t},d.prototype.getColumn=function(e){for(var t,l=this.columns,r=0,n=l.length;r<n;r++)l[r].field===e&&(t=l[r]);return t},d.prototype.arrayPredicate=function(e,t,l){for(var r,i=e.value,o=0,s=i.length;o<s;o++)if(""!==i[o])if(0===o)switch(e.operator){case"between":r=new n.Predicate(e.field,"greaterthan",i[o]);break;case"notbetween":r=new n.Predicate(e.field,"lessthan",i[o]);break;case"in":r=new n.Predicate(e.field,"equal",i[o]);break;case"notin":r=new n.Predicate(e.field,"notequal",i[o])}else switch(e.operator){case"between":r=r.and(e.field,"lessthan",i[o]);break;case"notbetween":r=r.or(e.field,"greaterthan",i[o]);break;case"in":r=r.or(e.field,"equal",i[o]);break;case"notin":r=r.and(e.field,"notequal",i[o])}return r&&(t?"and"===l?t=t.and(r):"or"===l&&(t=t.or(r)):t=r),t},d.prototype.importRules=function(e,l,r){r||(l=this.renderGroup(e.condition,l));var n=e.rules;if(!t.isNullOrUndefined(n))for(var i=0,o=n.length;i<o;i++){var s=Object.keys(n[i]);!t.isNullOrUndefined(n[i].rules)&&s.indexOf("rules")>-1?(l=this.renderGroup(n[i].condition,l),l=this.importRules(n[i],l,!0)):this.renderRule(n[i],l)}return(l=t.closest(l,".e-rule-list"))&&(l=t.closest(l,".e-group-container")),l},d.prototype.renderGroup=function(e,t){this.addGroupElement(!0,t,e);var l=t.querySelectorAll(".e-group-container");return l[l.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 l=!1;t?t+="(":(t="",l=!0);for(var r=e.condition,n=0,i=e.rules.length;n<i;n++){if(e.rules[n].rules)t=this.getSqlString(e.rules[n],t);else{var o=e.rules[n],s="";if(o.value instanceof Array)if(o.operator.indexOf("between")>-1)s+=o.value[0]+" AND "+o.value[1];else if("string"==typeof o.value[0]){s+='("'+o.value[0]+'"';for(var a=1,u=o.value.length;a<u;a++)s+=',"'+o.value[a]+'"';s+=")"}else s+="("+o.value+")";else"startswith"===o.operator?s+='("'+o.value+'%")':"endswith"===o.operator?s+='("%'+o.value+'")':"contains"===o.operator?s+='("%'+o.value+'%")':"number"===o.type?s+=o.value:s+='"'+o.value+'"';t+=o.field+" "+this.operators[o.operator]+" "+s}n!==i-1&&(t+=" "+r+" ")}return l||(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 e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e)).replace(/"/g,"'")},d.prototype.sqlParser=function(e){var t,l=0;do{t=e.slice(l),l+=this.parseSqlStrings(t)}while(""!==t);return this.parser},d.prototype.parseSqlStrings=function(e){for(var t,l,r=["=","!=","<",">","<=",">="],n=["and","or"],i=["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN"],o=0,s=r.length;o<s;o++)if(t=/^\w+$/.test(r[o])?"\\b":"",new RegExp("^("+r[o]+")"+t,"ig").exec(e))return this.parser.push(["Operators",r[o].toLowerCase()]),r[o].length;for(o=0,s=n.length;o<s;o++)if(t=/^\w+$/.test(n[o])?"\\b":"",new RegExp("^("+n[o]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",n[o].toLowerCase()]),n[o].length;for(o=0,s=i.length;o<s;o++)if(t=/^\w+$/.test(i[o])?"\\b":"",new RegExp("^("+i[o]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",i[o].toLowerCase()]),i[o].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)?(l=/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",l]),l.length):/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)?(l=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],this.parser.push(["String",l]),l.length):/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(l=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",l]),l.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(l=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",l]),l.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,l){for(var r,n,i,o,s,a,u,p,d,c,h=[],m=[],y=0,f=e.length;y<f;y++)if("Literal"===e[y][0]){if(r={label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){for(r.operator=this.getOperator(e[y+3][1].replace(/'/g,""),e[y+1][1]),c=e[y+1][1],i=++y+1,o=f,i=y+1;i<o;i++){if("Right"===e[i][0]){y=i;break}if("like"===c&&"String"===e[i][0])r.value=e[i][1].replace(/'/g,"").replace(/%/g,""),r.type="string";else if("between"===c){if("Literal"===e[i][0]||"Left"===e[i][0])break;"Number"===e[i][0]&&h.push(Number(e[i][1]))}else"Number"===e[i][0]?h.push(Number(e[i][1])):"String"===e[i][0]&&m.push(e[i][1].replace(/'/g,""))}"like"!==c&&("Number"===e[i-1][0]?(r.value=h,r.type="number"):"String"===e[i-1][0]?(r.value=m,r.type="string"):"between"===c&&"Conditions"===e[i-1][0]&&(r.value=h,r.type="number"))}else"Operators"===e[y+1][0]&&(r.operator=this.getOperator(e[y+2][1],e[y+1][1]),"Number"===e[y+2][0]?(r.type="number",r.value=Number(e[y+2][1])):(r.type="string",r.value=e[y+2][1].replace(/'/g,"")));t.rules.push(r)}else{if("Left"===e[y][0]){for(n={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 l.push(d),t.rules.push(n),n=this.processParser(this.parser,n,l),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)),l.pop(),t=this.rule,p=l.length,u=0;u<p;u++)t=this.findGroupByIdx(l[u],t,0===u);return this.processParser(this.parser,t,l)}}return t},p([t.Event()],d.prototype,"created",void 0),p([t.Event()],d.prototype,"beforeChange",void 0),p([t.Event()],d.prototype,"change",void 0),p([t.Event()],d.prototype,"ruleChange",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:[]},c)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);e.Columns=d,e.Rule=c,e.ShowButtons=h,e.QueryBuilder=m,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,l,n,i,o,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,i=arguments.length,o=i<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,r):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,l);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(i<3?n(o):i>3?n(t,r,o):n(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o};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({isRequired:!0,min:0,max:Number.MAX_VALUE})],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(null)],r.prototype,"condition",void 0),p([t.Collection([],r)],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(!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),m=function(e){function d(t,r){return e.call(this,t,r)||this}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+"_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.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],r=void 0,l=!1,n=void 0,i={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var o=this.columns,s=0,a=o.length;s<a;s++)o[s].type||(e.indexOf(o[s].field)>-1&&("string"===(r=typeof(n=this.dataColl[0][o[s].field]))?l=!isNaN(Date.parse(n)):"object"===r&&(l=n instanceof Date&&!isNaN(n.getTime()),r="string"),o[s].type=r,l=!1),r="string"),o[s].validation||(o[s].validation=i)}else{for(s=0,a=e.length;s<a;s++)"string"===(r=typeof(n=this.dataColl[0][e[s]]))?l=!isNaN(Date.parse(n)):"object"===r&&(l=n instanceof Date&&!isNaN(n.getTime()),r="string"),t[s]={field:e[s],label:e[s],type:l?"date":r,validation:i},l=!1;this.columns=t}}},d.prototype.triggerEvents=function(e,t){return this.isImportRules?e:("before"===t?this.trigger("beforeChange",e):"ruleChange"===t?this.trigger("ruleChange",e):this.trigger("change",e),e)},d.prototype.clickEventHandler=function(e){var r,l=e.target;this.isImportRules=!1;var n;if("SPAN"===l.tagName&&(l=l.parentElement),l.className.indexOf("e-collapse-rule")>-1){var i=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var o=document.getElementById(this.element.id+"_summary_content"),s=o.querySelector(".e-summary-text");i.animate(".e-query-builder",{name:"SlideLeftIn"});(u=this.element.querySelector(".e-group-container")).style.display="none",s.textContent=this.getSqlFromRules(this.rule),o.style.display="block",s.style.height=s.scrollHeight+"px"}if("BUTTON"===l.tagName){if(l.className.indexOf("e-removerule")>-1)l.className.indexOf("e-tooltip")>-1&&t.getComponent(l,"tooltip").destroy(),this.deleteRule(l);else if(l.className.indexOf("e-deletegroup")>-1)t.getComponent(l,"tooltip").destroy(),this.deleteGroup(t.closest(l,".e-group-container"));else if(l.className.indexOf("e-edit-rule")>-1){if((i=new t.Animation({duration:1e3,delay:0})).animate(".e-query-builder",{name:"SlideLeftIn"}),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 a=t.extend({},this.rule,{},!0);this.setGroupRules(a),this.renderSummaryCollapse()}else{var u;(u=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),u.style.display="block"}}}else if("LABEL"===l.tagName&&l.parentElement.className.indexOf("e-btn-group")>-1){var p=t.closest(l,".e-group-container"),d=this.getValidRules(this.rule);if(n=p.id.replace(this.element.id+"_",""),r={groupID:n,cancel:!1,type:"condition",value:l.textContent.toLowerCase()},(r=this.triggerEvents(r,"before")).cancel)return;var c=this.getGroup(p);c.condition=r.value,this.triggerEvents({groupID:n,type:"condition",value:c.condition}),this.filterRules(d,this.getValidRules(this.rule),"condition")}},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={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};if(!(n=this.triggerEvents(n,"before")).cancel){var i=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?i.className="e-rule-container e-vertical-mode":i.className="e-rule-container e-horizontal-mode";var o,s,u,p,d,c,h,m=e.querySelector(".e-rule-list"),f=i.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)f.textContent=this.l10n.getConstant("Remove"),t.addClass([f],"e-flat"),t.addClass([f],"e-primary");else{t.addClass([f],"e-round"),t.addClass([f],"e-icon-btn");new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(f),f=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),i.querySelector("button").appendChild(f)}if(i.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.ruleIdCounter++,i.querySelector(".e-filter-input").setAttribute("id",i.id+"_filterkey"),m.appendChild(i),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-rule-container")>-1&&(i.className.indexOf("e-joined-rule")<0&&(i.className+=" e-joined-rule"),i.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(i.previousElementSibling.className+=" e-prev-joined-rule")),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-group-container")>-1&&i.className.indexOf("e-separate-rule")<0&&(i.className+=" e-separate-rule"),c=this.element.className.indexOf("e-device")>-1?"250px":"200px",(d=new l.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?c:"auto",change:this.changeField.bind(this),value:r?r.field:null})).appendTo("#"+i.id+"_filterkey"),this.filterIndex=d.index,o=this.levelColl[e.id],!this.isImportRules){for(s=this.rule,u=0,p=o.length;u<p;u++)s=this.findGroupByIdx(o[u],s,0===u);Object.keys(r).length?s.rules.push({field:r.field,type:r.type,label:r.label,operator:r.operator,value:r.value}):s.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(r).length&&this.changeRule(r,{element:d.element,itemData:this.columns[this.filterIndex]}),h=i.id.replace(this.element.id+"_",""),this.triggerEvents({groupID:e.id.replace(this.element.id+"_",""),ruleID:h,type:"insertRule"})}},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(){var e=!0;if(this.allowValidation){var r=void 0,l=void 0,n=void 0,i=void 0,o=[],s=void 0,a=void 0,u=void 0,p=void 0,d=void 0,c=this.element.querySelectorAll(".e-rule-container"),h=void 0;for(r=0,l=c.length;r<l;r++)if(s=t.closest(c[r],".e-group-container"),d=this.getGroup(s),a=0,i=p=c[r],u=t.getComponent(c[r].querySelector(".e-rule-field input.e-control"),"dropdownlist"),h=!t.isNullOrUndefined(u.index)&&this.columns[u.index].validation,n=p.querySelector(".e-rule-field input.e-control"),h&&h.isRequired){for(;i&&null!==i.previousElementSibling;)i=i.previousElementSibling,a++;if(n=p.querySelector(".e-rule-field input.e-control"),d.rules[a].field||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),n=p.querySelector(".e-rule-operator input.e-control"),d.rules[a].operator||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),d.rules[a].value instanceof Array&&(o=d.rules[a].value),t.isNullOrUndefined(d.rules[a].value)||""===d.rules[a].value||d.rules[a].value instanceof Array&&o.length<1){var m=p.querySelectorAll(".e-rule-value input.e-control");e=!1;for(var f=0,y=m.length;f<y;f++){var g=m[f],v=void 0;g.parentElement.className.indexOf("e-searcher")>-1?(v=t.closest(g,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(v):m[f].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(m[f].parentElement),f++}}}else u.element&&t.isNullOrUndefined(u.index)&&(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1)}return e},d.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)},d.prototype.refreshLevel=function(e){var r,l,n=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=n.length,s=0;for(l=0;l<o;l++)(r=n[l]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[r.id]=e.level.slice(),s++,e.groupElement=r,e=this.refreshLevel(e));var a=t.closest(i,".e-rule-list");return e.groupElement=a?t.closest(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(){var e,t,r,l,n,i,o,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"}}),(i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl e-small"},innerHTML:"AND"}),n.appendChild(o),i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl e-small"},innerHTML:"OR"}),n.appendChild(o),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,i;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),r=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),i=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:i}}),r.appendChild(l),n.appendChild(r),e.appendChild(n),e},d.prototype.addGroupElement=function(e,l,n,i){var o={groupID:l.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};if(!((o=this.triggerEvents(o,"before")).cancel||this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var u,p=this.groupElem.cloneNode(!0);p.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.groupIdCounter++;var d=p.querySelector(".e-btngroup-and"),c=p.querySelector(".e-btngroup-or"),h=p.querySelector(".e-btngroup-and-lbl"),m=p.querySelector(".e-btngroup-or-lbl");if(d.setAttribute("id",this.element.id+"_and"+this.btnGroupId),c.setAttribute("id",this.element.id+"_or"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("name",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_and"+this.btnGroupId),m.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){var f=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";u=this.createElement("button",{attrs:{class:f}});new r.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(u);new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(u),t.rippleEffect(u,{selector:".deletegroup"}),p.querySelector(".e-group-action").appendChild(u);for(var y=l.querySelector(".e-rule-list"),g=y.children,v=0,b=0,C=g.length;b<C;b++)g[b].className.indexOf("e-group-container")>-1&&(v+=1);y.appendChild(p);var x=this.levelColl[l.id].slice(0);x.push(v),this.levelColl[p.id]=x,this.isImportRules||(this.addGroups([],l.id.replace(this.element.id+"_","")),i&&this.addRuleElement(p,{}))}else l.appendChild(p),this.levelColl[p.id]=[0];p.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===n&&p.querySelector(".e-btngroup-or").setAttribute("checked","true");var E=p.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,E),select:this.selectBtn.bind(this,E)}).appendTo(E),this.triggerEvents({groupID:l.id.replace(this.element.id+"_",""),type:"insertGroup"})}},d.prototype.notifyChange=function(e,r){for(var l=t.closest(r,".e-rule-value").querySelectorAll(".e-template"),n=[],i=0,o=l.length;i<o;i++)l[i].nextElementSibling&&l[i].nextElementSibling.className.indexOf("e-check")>-1&&n.push(l[i].textContent);this.updateRules(r,l.length>1?n:e)},d.prototype.changeValue=function(e,r){var l,n,i,o;if(r.event)o=r.event.target;else{o=r.element}if(o.className.indexOf("e-day")>-1){o=r.element}var s=t.closest(o,".e-group-container"),a=t.closest(o,".e-rule-container");n=s&&s.id.replace(this.element.id+"_",""),i=a.id.replace(this.element.id+"_","");var u=r;u.element&&u.element.className.indexOf("e-datepicker")>-1&&(o=u.element);var p,d,c;if(o.className.indexOf("e-radio")>-1)if(d=parseInt(o.id.split("valuekey")[1],0),c=t.getComponent(t.closest(o,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.columns[c.index].values)p=this.columns[c.index].values[d];else{p=["True","False"][d]}else p=o.className.indexOf("e-multiselect")>-1?t.getComponent(o,"multiselect").value:r.value;l={groupID:n,ruleID:i,value:p,cancel:!1,type:"value"},(l=this.triggerEvents(l,"before")).cancel||(this.updateRules(o,l.value,e),this.triggerEvents({groupID:n,ruleID:i,value:l.value,cancel:!1,type:"value"}))},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"),i=0;n&&null!==n.previousElementSibling;)n=n.previousElementSibling,i++;this.changeRule(l.rules[i],e)}},d.prototype.changeRule=function(e,r){if(r.itemData){var n,i,o,s,a,u,p,d={},c=e.operator?e.operator.toLowerCase():"";a=t.closest(r.element,".e-rule-filter"),u=t.closest(r.element,".e-rule-operator");var h,m=t.getComponent(r.element,"dropdownlist"),f=t.closest(r.element,".e-group-container").id.replace(this.element.id+"_","");if(a){if(i=t.closest(a,".e-rule-container"),s=i.id.replace(this.element.id+"_",""),h={groupID:f,ruleID:s,selectedIndex:m.index,cancel:!1,type:"field"},(h=this.triggerEvents(h,"before")).cancel)return;m.index!==h.selectedIndex&&(m.index=h.selectedIndex),d.type=this.columns[m.index].type,i.querySelector(".e-template")&&(e.value="")}if(u){if(i=t.closest(u,".e-rule-container"),s=i.id.replace(this.element.id+"_",""),h={groupID:f,ruleID:s,selectedIndex:m.index,cancel:!1,type:"operator"},(h=this.triggerEvents(h,"before")).cancel)return;m.index!==h.selectedIndex&&(m.index=h.selectedIndex),d.operator=m.value;var y=d.operator.toLowerCase();if(d.operator.toLowerCase().indexOf("between")>-1||d.operator.toLowerCase().indexOf("in")>-1&&d.operator.toLowerCase().indexOf("contains")<0?(a=u.previousElementSibling,d.type=e.type,(d.operator.toLowerCase().indexOf("in")<0||e.operator.toLowerCase().indexOf("in")<0)&&(e.value=[])):"object"==typeof e.value&&(e.value=e.value.length>0?e.value[0]:""),r.previousItemData){var g=r.previousItemData.value.toLowerCase();(g.indexOf("between")>-1||g.indexOf("in")>-1&&g.indexOf("contains")<0)&&(a=u.previousElementSibling,d.type=e.type)}c.indexOf("in")>-1&&c.indexOf("in")<5&&y.indexOf("in")>-1&&y.indexOf("in")<5&&(a=null)}if(a)if(u=a.nextElementSibling,t.addClass([u],"e-operator"),u.childElementCount)n=t.getComponent(u.querySelector(".e-dropdownlist"),"dropdownlist"),d.operator=n.value,this.renderValues(u,r.itemData,r.previousItemData,!0,e,d,r.element);else{var v=t.closest(u,".e-rule-container").id;p=this.createElement("input",{attrs:{type:"text",id:v+"_operatorkey"}}),u.appendChild(p),this.columns[m.index].operators?o=this.columns[m.index].operators:r.itemData&&(o=this.customOperators[this.columns[m.index].type+"Operator"]);var b=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?b:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+v+"_operatorkey"),d.operator=e&&""!==e.operator?e.operator:o[0].value,this.isImportRules&&(d.type=this.columns[m.index].type,d.operator=e.operator),this.renderValues(u,this.columns[m.index],r.previousItemData,!1,e,d,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,i=0,o=r.length;i<o;i++){if(r[i].classList.contains("e-textbox"))t.getComponent(r[i],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[i].id));else if(r[i].classList.contains("e-dropdownlist"))t.getComponent(r[i],"dropdownlist").destroy();else if(r[i].classList.contains("e-radio"))t.getComponent(r[i],"radio").destroy();else if(r[i].classList.contains("e-numerictextbox"))t.getComponent(r[i],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+r[i].id));else if(r[i].classList.contains("e-datepicker"))t.getComponent(r[i],"datepicker").destroy();else if(r[i].classList.contains("e-multiselect"))t.getComponent(r[i],"multiselect").destroy();else if(r[i].className.indexOf("e-template")>-1)for(var s=r[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],r[i].id);break}document.getElementById(r[i].id)&&t.detach(r[i])}for(i=0,o=l.length;i<o;i++){if(l[i].className.indexOf("e-template")>-1)for(s=l[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],l[i].id);break}t.detach(l[i])}},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,i=e.length;n<i;n++){var o=e[n][t];Number(e[n][t])===e[n][t]&&e[n][t]%1!=0&&(o=e[n][t].toString());var s={};o in r||(r[o]=1,s[t]=o,l.push(s))}return l},d.prototype.renderMultiSelect=function(e,t,r,i){var o,s=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(s=!0,o=this.getDistinctValues(this.dataColl,e.field));new l.MultiSelect({dataSource:s?o:this.dataManager,query:new n.Query([e.field]),fields:{text:e.field,value:e.field},value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,r),close:this.closePopup.bind(this,r),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+r)}).appendTo("#"+t+"_valuekey"+r)},d.prototype.multiSelectOpen=function(e,r){var l=this;if(this.dataSource instanceof n.DataManager){var i=document.getElementById(e),o=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),s=this.columns[o.index].field,u=!1;if(this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(s)>-1&&(u=!0),!u){r.cancel=!0;var p=t.getComponent(i,"multiselect");p.hideSpinner();var d=this.dataManager.executeQuery((new n.Query).select(s)),c=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),d.then(function(e){l.dataColl=t.extend(l.dataColl,e.result,[],!0);var r=l.getDistinctValues(l.dataColl,s);p.dataSource=r,a.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){c.reject(e)})}}},d.prototype.createSpinner=function(e){var r=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(r),a.createSpinner({target:r,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,r){var l=document.getElementById(r.popup.element.id.replace("_popup","")),n=t.getComponent(l,"multiselect").value;this.updateRules(l,n,e)},d.prototype.processTemplate=function(e,r,l,n){var i=t.closest(e,".e-rule-container").querySelectorAll(".e-template");i.length<2?r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:i[0],values:l.value,operator:n.operator}):r.template&&r.template.write&&r.template.write({elements:i[0],values:l.value,operator:n.operator}):r.template&&"string"==typeof r.template.write?t.getValue(r.template.write,window)({elements:i,values:l.value,operator:n.operator}):r.template&&r.template.write&&r.template.write({elements:i,values:l.value,operator:n.operator})},d.prototype.getItemData=function(e){var r=t.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist");return this.columns[r.index]},d.prototype.renderStringValue=function(e,t,r,l,n){var o,s=this.getItemData(e),a=this.isImportRules?t.value:"";if("in"!==r&&"notin"!==r||!this.dataColl.length){"in"!==r&&"notin"!==r||(a=(o=this.isImportRules?t.value:[]).join(","));var u=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,l)});u.appendTo("#"+e+"_valuekey"+l),u.value=a,u.dataBind()}else o=this.isImportRules?t.value:[],this.renderMultiSelect(s,e,l,o),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.style.width="100%":(n.style.width=null,n.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,r,l,n,o,s,a){var u,p=this.isImportRules?r.value:0,d=this.getItemData(e);if("in"!==l&&"notin"!==l||!this.dataColl.length)if("in"===l||"notin"===l){var c=(u=this.isImportRules?r.value:[]).join(","),h=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,n)});h.appendTo("#"+e+"_valuekey"+n),h.value=c,h.dataBind()}else{var m=t.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist"),f=(s=this.columns[m.index]).validation&&s.validation.min?s.validation.min:0,y=s.validation&&s.validation.max?s.validation.max:Number.MAX_VALUE,g=s.format?s.format:"n";a>1&&r&&(p=r.value[n]?r.value[n]:0);new i.NumericTextBox({value:p,format:g,min:f,max:y,width:"100%",step:s.step?s.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}else u=this.isImportRules?r.value:[],this.renderMultiSelect(d,e,n,u),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?o.style.width="100%":(o.style.minWidth="200px",o.style.width=null)},d.prototype.processValueString=function(e,t){var r=[],l=e.split(",");if("string"===t)return l;for(var n=0,i=l.length;n<i;n++)r.push(Number(l[n]));return r},d.prototype.renderControls=function(e,l,n,i){if(t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),l.template)this.processTemplate(e,l,n,i);else{var s="boolean"===i.type||i.operator&&i.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"!==i.operator&&"notin"!==i.operator&&(u.style.width="200px");for(var p=0;p<s;p++)switch(i.type){case"string":this.renderStringValue(a,n,i.operator,p,u);break;case"number":this.renderNumberValue(a,n,i.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),h=new r.RadioButton({label:d[p].toString(),name:a+"default",checked:c,value:d[p],change:this.changeValue.bind(this,p)});h.appendTo("#"+a+"_valuekey"+p),this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,f=void 0;if(this.isImportRules&&n&&n.value){m=s>1?new Date(n.value[p]):new Date(n.value);var y=void 0,g=this.getColumn(n.field);if(f=s>1?n.value[p]:n.value,g.format){var v=this.intl.getDateParser({skeleton:"full",type:"dateTime"});y={type:"dateTime",format:g.format},"Invalid Date"===m.toLocaleDateString()&&(m=v(f),t.isNullOrUndefined(m)&&(m=this.intl.parseDate(f,y)))}}(l.format?new o.DatePicker({value:m,format:l.format,change:this.changeValue.bind(this,p)}):new o.DatePicker({value:m,change:this.changeValue.bind(this,p)})).appendTo("#"+a+"_valuekey"+p),n.value||this.updateRules(document.getElementById(a+"_valuekey"+p),m)}}}},d.prototype.getOperatorIndex=function(e,t){var r,l=e.dataSource.length;for(r=0;r<l;r++)if(t.operator===e.dataSource[r].value)return r;return 0},d.prototype.renderValues=function(e,r,l,n,i,o,s){if(n){var a=t.getComponent(e.querySelector("input"),"dropdownlist");r.operators?(a.dataSource=r.operators,a.index=this.getOperatorIndex(a,i),a.value=o.operator=a.dataSource[a.index].value,a.dataBind()):r.type&&(a.dataSource=this.customOperators[r.type+"Operator"],a.index=this.getOperatorIndex(a,i),a.value=o.operator=a.dataSource[a.index].value,a.dataBind())}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){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 if(c instanceof Array){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 f=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?f.style.width="100%":f.style.minWidth="200px"}else if("boolean"===o.type||o.operator&&o.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,i,o)},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":r.value=t.getComponent(e,l).value;break;case"radio":var i=t.getComponent(e,l);i.checked=!0,i.refresh(),r.value=i.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:this.getColumn(r.field).format};r.operator.indexOf("between")>-1?r.value[n]=t.getComponent(e,l).value:t.isNullOrUndefined(o.format)?r.value=this.intl.formatDate(t.getComponent(e,l).value):r.value=this.intl.formatDate(t.getComponent(e,l).value,o)}},d.prototype.updateRules=function(e,r,l){for(var n,i,o,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0,d=s.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),o=u.id.replace(this.element.id+"_",""),t.closest(e,".e-rule-filter")){n=t.getComponent(e,"dropdownlist"),this.isImportRules||a.rules[p].field.toLowerCase()===this.columns[n.index].field.toLowerCase()||(a.rules[p].value=""),a.rules[p].field=this.columns[n.index].field,a.rules[p].type=this.columns[n.index].type,a.rules[p].label=this.columns[n.index].label;var h=t.closest(e,".e-rule-filter"),m=h.nextElementSibling.querySelector("input.e-control"),f=t.getComponent(m,"dropdownlist").value;a.rules[p].operator=f,(m=h.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(m=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),m||(m=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:a.rules[p].field,type:"field"},this.updateValues(m,a.rules[p]),this.triggerEvents(i),this.allowValidation&&a.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if(t.closest(e,".e-rule-operator")){n=t.getComponent(e,"dropdownlist"),a.rules[p].operator=n.value;var y=void 0;e.parentElement;y=u.querySelectorAll(".e-rule-value input.e-control"),i={groupID:d,ruleID:o,value:n.value,type:"operator"},this.allowValidation&&a.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),y.length>1&&(a.rules[p].value=[]);for(var g=0;g<y.length;g++)this.updateValues(y[g],a.rules[p]);this.triggerEvents(i),this.filterRules(c,this.getValidRules(this.rule),"operator")}else t.closest(e,".e-rule-value")&&(this.ruleValueUpdate(e,r,a,p,s,u,l),this.filterRules(c,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,r){JSON.stringify({condition:e.condition,rule:e.rules})!==JSON.stringify({condition:t.condition,rule:t.rules})&&this.triggerEvents({previousRule:e,rule:t,type:r},"ruleChange")},d.prototype.ruleValueUpdate=function(e,r,n,i,o,s,a){var u,p,d=["in","between","notin","notbetween"];if(null!==r){if(n.rules[i].operator&&(p=n.rules[i].operator.toLowerCase()),e.className.indexOf("e-multiselect")>-1&&"number"===n.rules[i].type){for(var c=[],h=r,m=0,f=h.length;m<f;m++)"string"==typeof h[m]&&c.push(parseFloat(h[m]));c.length&&(r=c)}if(e.className.indexOf("e-template")>-1)r instanceof Array?d.indexOf(p)>-1?n.rules[i].value=r:n.rules[i].value=r[0]:n.rules[i].value=r,u={groupID:o.id,ruleID:s.id,value:n.rules[i].value,type:"value"},this.triggerEvents(u);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)d.indexOf(p)>-1?n.rules[i].value[a]=r:n.rules[i].value=r;else if(e.className.indexOf("e-radio")>-1)n.rules[i].value=r;else if(e.className.indexOf("e-multiselect")>-1)n.rules[i].value=r;else if(e.className.indexOf("e-textbox")>-1)"in"===p||"notin"===p?(n.rules[i].type,n.rules[i].value=this.processValueString(r,n.rules[i].type)):n.rules[i].value=r;else if(e.className.indexOf("e-datepicker")>-1){var y=t.getInstance(s.querySelector(".e-rule-filter input"),l.DropDownList),g={type:"dateTime",format:this.columns[y.index].format||"MM/dd/yyyy"};g.type&&(d.indexOf(p)>-1?n.rules[i].value[a]=this.intl.formatDate(r,g):n.rules[i].value=this.intl.formatDate(r,g))}this.validatValue(n,i,s)}},d.prototype.validatValue=function(e,r,l){if(this.allowValidation&&e.rules[r].value){var n=l.querySelectorAll(".e-rule-value .e-control");n[0].className.indexOf("e-tooltip")>-1?t.getComponent(n[0],"tooltip").destroy():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,n=[];if(!r){for(var i=0,o=l.length;i<o;i++)(t=l[i]).rules&&n.push(t);return n[e]}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+"_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){t=this.element.id+"_"+t;for(var r=0,l=e.length;r<l;r++)this.addRuleElement(document.getElementById(t),e[r])},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var r=document.getElementById(t),l=this.getGroup(r);if(e.length)for(var n=0,i=e.length;n<i;n++)this.importRules(e[n],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.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();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"},styles:"max-height:500px"}),r=this.createElement("button",{attrs:{class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),l=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),r.textContent=this.l10n.getConstant("Edit"),l.appendChild(r),e.appendChild(l),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});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 i=this.element.querySelector(".e-group-container"),o=this.element.querySelector(".e-summary-content");e.summaryView?(i.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),o=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),o.style.display="block"):(i.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),i.style.display="block",o.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,e.rule=this.getRuleCollection(this.rule,!1);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new t.Internationalization(this.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",In:"In",NotIn:"Not In",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",SummaryViewTitle:"Summary View"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],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",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.dataSource instanceof n.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new n.Query).take(1))):(this.dataManager=new n.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new n.Query),this.initControl())},d.prototype.executeDataManager=function(e){var t=this,r=this.dataManager.executeQuery(e),l=new n.Deferred;r.then(function(e){t.dataColl=e.result,t.initControl()}).catch(function(e){l.reject(e)})},d.prototype.initControl=function(){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,i=0;i<l;i++)n=this.findGroupByIdx(r[i],n,0===i);return n},d.prototype.deleteGroup=function(e){var r,l,n=e,i=n.id.replace(this.element.id+"_",""),o=this.getGroup(n,!0),s=0,a={groupID:i,cancel:!1,type:"deleteGroup"},u=this.getValidRules(this.rule);if(!(a=this.triggerEvents(a,"before")).cancel){var p=n.nextElementSibling,d=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),h=e.querySelectorAll(".e-tooltip");for(l=h.length,r=0;r<l;r++)t.getComponent(h[r],"tooltip").destroy();for(r=0,l=c.length;r<l;r++)delete this.levelColl[c[r].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,s++;p&&p.className.indexOf("e-separate-rule")>-1&&(t.removeClass([p],"e-separate-rule"),t.addClass([p],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&t.addClass([d],"e-prev-joined-rule")),o.rules.splice(s,1),delete this.levelColl[i],t.detach(e),this.refreshLevelColl(),this.triggerEvents(a),this.filterRules(u,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.deleteRule=function(e){var r,l,n=t.closest(e,".e-group-container"),i=this.getGroup(n),o=t.closest(e,".e-rule-container");l=n.id.replace(this.element.id+"_",""),r=t.closest(e,".e-rule-container").id.replace(this.element.id+"_","");var s=this.getValidRules(this.rule),a={groupID:l,ruleID:r,cancel:!1,type:"deleteRule"};if(!(a=this.triggerEvents(a,"before")).cancel){var u,p=o,d=o.nextElementSibling,c=o.previousElementSibling,h=0,m=o.querySelectorAll(".e-tooltip"),f=m.length;for(u=0;u<f;u++)t.getComponent(m[u],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,h++;i.rules.splice(h,1),(!c||c.className.indexOf("e-rule-container")<0)&&d&&t.removeClass([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&c&&t.removeClass([c],"e-prev-joined-rule"),t.detach(p),this.triggerEvents(a),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0),this.isImportRules=!1},d.prototype.getValidRules=function(e){var r=e.condition,l=t.extend([],e.rules,[],!0);return this.getRuleCollection({condition:r,rules:l},!0)},d.prototype.getRuleCollection=function(e,t){var r;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var l=e.rules.length,n=0;n<l;n++)r=e.rules[n],r=this.getRuleCollection(r,t),e.rules[n]=r,Object.keys(r).length<1&&t&&(e.rules.splice(n,1),n--,l--);return e=e.condition?{condition:e.condition,rules:e.rules}:""!==e.field&&""!==e.operator&&""!==e.value?{label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value}:{}},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,l=e.length;for(t=0;t<l;t++)r=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(r))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=(new n.Query).where(e);return this.dataManager.executeQuery(t)},d.prototype.deleteRules=function(e){var t,r,l=e.length;for(t=0;t<l;t++)r=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(r))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),r=[],l=0,i=Object.keys(this.columns);l<i.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,i,o=e.rules,s=!1,a=0,u=o.length;a<u;a++){if(Object.keys(o[a]).indexOf("rules")>-1)(r=this.getPredicate(o[a]))&&(t=t?"and"===e.condition?t.and(r):t.or(r):r);else if(o[a].operator.length){var p=o[a].operator.toLowerCase();if(s=["contains","startswith","endswith"].indexOf(p)>-1||"date"===o[a].type&&["equal","notequal"].indexOf(p)>-1,i=this.getColumn(o[a].field),"date"===o[a].type){var d={type:"dateTime",format:i.format||"MM/dd/yyyy"};l=this.intl.parseDate(o[a].value,d)}else l=o[a].value;if(0===a)if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a]);else{""!==(c=l)&&(t=new n.Predicate(o[a].field,o[a].operator,l,s))}else if("and"===e.condition)if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{var c=l;t&&""!==c?t=t.and(o[a].field,o[a].operator,l,s):""!==c&&(t=new n.Predicate(o[a].field,o[a].operator,l,s))}else if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{c=l;t&&""!==c?t=t.or(o[a].field,o[a].operator,l,s):""!==c&&(t=new n.Predicate(o[a].field,o[a].operator,l,s))}}}return t},d.prototype.getColumn=function(e){for(var t,r=this.columns,l=0,n=r.length;l<n;l++)r[l].field===e&&(t=r[l]);return t},d.prototype.arrayPredicate=function(e,t,r){for(var l,i=e.value,o=0,s=i.length;o<s;o++)if(""!==i[o])if(0===o)switch(e.operator){case"between":l=new n.Predicate(e.field,"greaterthan",i[o]);break;case"notbetween":l=new n.Predicate(e.field,"lessthan",i[o]);break;case"in":l=new n.Predicate(e.field,"equal",i[o]);break;case"notin":l=new n.Predicate(e.field,"notequal",i[o])}else switch(e.operator){case"between":l=l.and(e.field,"lessthan",i[o]);break;case"notbetween":l=l.or(e.field,"greaterthan",i[o]);break;case"in":l=l.or(e.field,"equal",i[o]);break;case"notin":l=l.and(e.field,"notequal",i[o])}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));var n=e.rules;if(!t.isNullOrUndefined(n))for(var i=0,o=n.length;i<o;i++){var s=Object.keys(n[i]);!t.isNullOrUndefined(n[i].rules)&&s.indexOf("rules")>-1?(r=this.renderGroup(n[i].condition,r),r=this.importRules(n[i],r,!0)):this.renderRule(n[i],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,i=e.rules.length;n<i;n++){if(e.rules[n].rules)t=this.getSqlString(e.rules[n],t);else{var o=e.rules[n],s="";if(o.value instanceof Array)if(o.operator.indexOf("between")>-1)s+=o.value[0]+" AND "+o.value[1];else if("string"==typeof o.value[0]){s+='("'+o.value[0]+'"';for(var a=1,u=o.value.length;a<u;a++)s+=',"'+o.value[a]+'"';s+=")"}else s+="("+o.value+")";else"startswith"===o.operator?s+='("'+o.value+'%")':"endswith"===o.operator?s+='("%'+o.value+'")':"contains"===o.operator?s+='("%'+o.value+'%")':"number"===o.type?s+=o.value:s+='"'+o.value+'"';t+=o.field+" "+this.operators[o.operator]+" "+s}n!==i-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 e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(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"],i=["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN"],o=0,s=l.length;o<s;o++)if(t=/^\w+$/.test(l[o])?"\\b":"",new RegExp("^("+l[o]+")"+t,"ig").exec(e))return this.parser.push(["Operators",l[o].toLowerCase()]),l[o].length;for(o=0,s=n.length;o<s;o++)if(t=/^\w+$/.test(n[o])?"\\b":"",new RegExp("^("+n[o]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",n[o].toLowerCase()]),n[o].length;for(o=0,s=i.length;o<s;o++)if(t=/^\w+$/.test(i[o])?"\\b":"",new RegExp("^("+i[o]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",i[o].toLowerCase()]),i[o].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 l,n,i,o,s,a,u,p,d,c,h=[],m=[],f=0,y=e.length;f<y;f++)if("Literal"===e[f][0]){if(l={label:e[f][1],field:e[f][1]},"SubOperators"===e[f+1][0]){for(l.operator=this.getOperator(e[f+3][1].replace(/'/g,""),e[f+1][1]),c=e[f+1][1],i=++f+1,o=y,i=f+1;i<o;i++){if("Right"===e[i][0]){f=i;break}if("like"===c&&"String"===e[i][0])l.value=e[i][1].replace(/'/g,"").replace(/%/g,""),l.type="string";else if("between"===c){if("Literal"===e[i][0]||"Left"===e[i][0])break;"Number"===e[i][0]&&h.push(Number(e[i][1]))}else"Number"===e[i][0]?h.push(Number(e[i][1])):"String"===e[i][0]&&m.push(e[i][1].replace(/'/g,""))}"like"!==c&&("Number"===e[i-1][0]?(l.value=h,l.type="number"):"String"===e[i-1][0]?(l.value=m,l.type="string"):"between"===c&&"Conditions"===e[i-1][0]&&(l.value=h,l.type="number"))}else"Operators"===e[f+1][0]&&(l.operator=this.getOperator(e[f+2][1],e[f+1][1]),"Number"===e[f+2][0]?(l.type="number",l.value=Number(e[f+2][1])):(l.type="string",l.value=e[f+2][1].replace(/'/g,"")));t.rules.push(l)}else{if("Left"===e[f][0]){for(n={condition:"",rules:[]},this.parser=e.splice(f+1,y-(f+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[f][0])t.condition=e[f][1];else if("Right"===e[f][0]){for(this.parser=e.splice(f+1,y-(f+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,"beforeChange",void 0),p([t.Event()],d.prototype,"change",void 0),p([t.Event()],d.prototype,"ruleChange",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:[]},c)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);e.Columns=d,e.Rule=c,e.ShowButtons=h,e.QueryBuilder=m,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ej2-querybuilder.umd.min.js.map |
/*! | ||
* filename: ej2-querybuilder.min.js | ||
* version : 17.1.42 | ||
* version : 17.1.43 | ||
* Copyright Syncfusion Inc. 2001 - 2019. 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,l,r,n,i,o,s,a){"use strict";var u=function(){var e=function(t,l){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])})(t,l)};return function(t,l){function r(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(r.prototype=l.prototype,new r)}}(),p=function(e,t,l,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,l):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(i<3?n(o):i>3?n(t,l,o):n(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o};r.MultiSelect.Inject(r.CheckBoxSelection);var d=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"values",void 0),p([t.Property(null)],l.prototype,"operators",void 0),p([t.Property(null)],l.prototype,"template",void 0),p([t.Property({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),p([t.Property(null)],l.prototype,"format",void 0),p([t.Property(null)],l.prototype,"step",void 0),l}(t.ChildProperty),c=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"condition",void 0),p([t.Collection([],l)],l.prototype,"rules",void 0),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"operator",void 0),p([t.Property(null)],l.prototype,"value",void 0),l}(t.ChildProperty),h=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(!0)],l.prototype,"ruleDelete",void 0),p([t.Property(!0)],l.prototype,"groupInsert",void 0),p([t.Property(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),m=function(e){function d(t,l){return e.call(this,t,l)||this}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+"_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.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=void 0,r=!1,n=void 0,i={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var o=this.columns,s=0,a=o.length;s<a;s++)o[s].type||(e.indexOf(o[s].field)>-1&&("string"===(l=typeof(n=this.dataColl[0][o[s].field]))?r=!isNaN(Date.parse(n)):"object"===l&&(r=n instanceof Date&&!isNaN(n.getTime()),l="string"),o[s].type=l,r=!1),l="string"),o[s].validation||(o[s].validation=i)}else{for(var s=0,a=e.length;s<a;s++)"string"===(l=typeof(n=this.dataColl[0][e[s]]))?r=!isNaN(Date.parse(n)):"object"===l&&(r=n instanceof Date&&!isNaN(n.getTime()),l="string"),t[s]={field:e[s],label:e[s],type:r?"date":l,validation:i},r=!1;this.columns=t}}},d.prototype.triggerEvents=function(e,t){return this.isImportRules?e:("before"===t?this.trigger("beforeChange",e):"ruleChange"===t?this.trigger("ruleChange",e):this.trigger("change",e),e)},d.prototype.clickEventHandler=function(e){var l,r=e.target;this.isImportRules=!1;var n;if("SPAN"===r.tagName&&(r=r.parentElement),r.className.indexOf("e-collapse-rule")>-1){var i=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var o=document.getElementById(this.element.id+"_summary_content"),s=o.querySelector(".e-summary-text");i.animate(".e-query-builder",{name:"SlideLeftIn"}),(u=this.element.querySelector(".e-group-container")).style.display="none",s.textContent=this.getSqlFromRules(this.rule),o.style.display="block",s.style.height=s.scrollHeight+"px"}if("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((i=new t.Animation({duration:1e3,delay:0})).animate(".e-query-builder",{name:"SlideLeftIn"}),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 a=t.extend({},this.rule,{},!0);this.setGroupRules(a),this.renderSummaryCollapse()}else{var u=this.element.querySelector(".e-group-container");u.querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),u.style.display="block"}}else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1){var p=t.closest(r,".e-group-container"),d=this.getValidRules(this.rule);if(n=p.id.replace(this.element.id+"_",""),l={groupID:n,cancel:!1,type:"condition",value:r.textContent.toLowerCase()},(l=this.triggerEvents(l,"before")).cancel)return;var c=this.getGroup(p);c.condition=l.value,this.triggerEvents({groupID:n,type:"condition",value:c.condition}),this.filterRules(d,this.getValidRules(this.rule),"condition")}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert?t.removeClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.addClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):l.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},d.prototype.addRuleElement=function(e,l){var n={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};if(!(n=this.triggerEvents(n,"before")).cancel){var i=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?i.className="e-rule-container e-vertical-mode":i.className="e-rule-container e-horizontal-mode";var o,s,u,p,d,c,h=e.querySelector(".e-rule-list"),m=i.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?(m.textContent=this.l10n.getConstant("Remove"),t.addClass([m],"e-flat"),t.addClass([m],"e-primary")):(t.addClass([m],"e-round"),t.addClass([m],"e-icon-btn"),new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(m),m=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),i.querySelector("button").appendChild(m)),i.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.ruleIdCounter++,i.querySelector(".e-filter-input").setAttribute("id",i.id+"_filterkey"),h.appendChild(i),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-rule-container")>-1&&(i.className.indexOf("e-joined-rule")<0&&(i.className+=" e-joined-rule"),i.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(i.previousElementSibling.className+=" e-prev-joined-rule")),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-group-container")>-1&&i.className.indexOf("e-separate-rule")<0&&(i.className+=" e-separate-rule"),c=this.element.className.indexOf("e-device")>-1?"250px":"200px",(d=new r.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?c:"auto",change:this.changeField.bind(this),value:l?l.field:null})).appendTo("#"+i.id+"_filterkey"),this.filterIndex=d.index,o=this.levelColl[e.id],!this.isImportRules){for(s=this.rule,u=0,p=o.length;u<p;u++)s=this.findGroupByIdx(o[u],s,0===u);Object.keys(l).length?s.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}):s.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(l).length&&this.changeRule(l,{element:d.element,itemData:this.columns[this.filterIndex]}),this.triggerEvents({groupID:e.id.replace(this.element.id+"_",""),type:"insertRule"})}},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(){var e=!0;if(this.allowValidation){var l=void 0,r=void 0,n=void 0,i=void 0,o=[],s=void 0,a=void 0,u=void 0,p=void 0,d=void 0,c=this.element.querySelectorAll(".e-rule-container"),h=void 0;for(l=0,r=c.length;l<r;l++)if(s=t.closest(c[l],".e-group-container"),d=this.getGroup(s),a=0,i=p=c[l],u=t.getComponent(c[l].querySelector(".e-rule-field input.e-control"),"dropdownlist"),h=!t.isNullOrUndefined(u.index)&&this.columns[u.index].validation,n=p.querySelector(".e-rule-field input.e-control"),h&&h.isRequired){for(;i&&null!==i.previousElementSibling;)i=i.previousElementSibling,a++;if(n=p.querySelector(".e-rule-field input.e-control"),d.rules[a].field||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),n=p.querySelector(".e-rule-operator input.e-control"),d.rules[a].operator||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),d.rules[a].value instanceof Array&&(o=d.rules[a].value),t.isNullOrUndefined(d.rules[a].value)||""===d.rules[a].value||d.rules[a].value instanceof Array&&o.length<1){var m=p.querySelectorAll(".e-rule-value input.e-control");e=!1;for(var g=0,v=m.length;g<v;g++){var y=m[g],f=void 0;y.parentElement.className.indexOf("e-searcher")>-1?(f=t.closest(y,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(f):m[g].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(m[g].parentElement),g++}}}else u.element&&t.isNullOrUndefined(u.index)&&(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1)}return e},d.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)},d.prototype.refreshLevel=function(e){var l,r,n=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=n.length,s=0;for(r=0;r<o;r++)(l=n[r]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[l.id]=e.level.slice(),s++,e.groupElement=l,e=this.refreshLevel(e));var a=t.closest(i,".e-rule-list");return e.groupElement=a?t.closest(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(){var e,t,l,r,n,i,o,s,a;return e=this.createElement("div",{attrs:{class:"e-group-container"}}),l=this.createElement("div",{attrs:{class:"e-group-header"}}),t=this.createElement("div",{attrs:{class:"e-group-body"}}),r=this.createElement("div",{attrs:{class:"e-rule-list"}}),e.appendChild(l),t.appendChild(r),e.appendChild(t),n=this.createElement("div",{attrs:{class:"e-btn-group"}}),(i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl e-small"},innerHTML:"AND"}),n.appendChild(o),i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl e-small"},innerHTML:"OR"}),n.appendChild(o),l.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),l.appendChild(s),e},d.prototype.ruleTemplate=function(){var e,t,l,r,n,i;return e=this.createElement("div"),n=this.createElement("div",{attrs:{class:"e-rule-field"}}),l=this.createElement("div",{attrs:{class:"e-rule-filter"}}),t=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}}),l.appendChild(t),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-operator"}}),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value"}}),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),i=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",r=this.createElement("button",{attrs:{class:i}}),l.appendChild(r),n.appendChild(l),e.appendChild(n),e},d.prototype.addGroupElement=function(e,r,n,i){var o={groupID:r.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};if(!((o=this.triggerEvents(o,"before")).cancel||this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var u,p=this.groupElem.cloneNode(!0);p.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.groupIdCounter++;var d=p.querySelector(".e-btngroup-and"),c=p.querySelector(".e-btngroup-or"),h=p.querySelector(".e-btngroup-and-lbl"),m=p.querySelector(".e-btngroup-or-lbl");if(d.setAttribute("id",this.element.id+"_and"+this.btnGroupId),c.setAttribute("id",this.element.id+"_or"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("name",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_and"+this.btnGroupId),m.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){var g=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";u=this.createElement("button",{attrs:{class:g}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(u),new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(u),t.rippleEffect(u,{selector:".deletegroup"}),p.querySelector(".e-group-action").appendChild(u);for(var v=r.querySelector(".e-rule-list"),y=v.children,f=0,b=0,C=y.length;b<C;b++)y[b].className.indexOf("e-group-container")>-1&&(f+=1);v.appendChild(p);var x=this.levelColl[r.id].slice(0);x.push(f),this.levelColl[p.id]=x,this.isImportRules||(this.addGroups([],r.id.replace(this.element.id+"_","")),i&&this.addRuleElement(p,{}))}else r.appendChild(p),this.levelColl[p.id]=[0];p.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===n&&p.querySelector(".e-btngroup-or").setAttribute("checked","true");var E=p.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,E),select:this.selectBtn.bind(this,E)}).appendTo(E),this.triggerEvents({groupID:r.id.replace(this.element.id+"_",""),type:"insertGroup"})}},d.prototype.notifyChange=function(e,l){for(var r=t.closest(l,".e-rule-value").querySelectorAll(".e-template"),n=[],i=0,o=r.length;i<o;i++)r[i].nextElementSibling&&r[i].nextElementSibling.className.indexOf("e-check")>-1&&n.push(r[i].textContent);this.updateRules(l,r.length>1?n:e)},d.prototype.changeValue=function(e,l){var r,n,i,o;(o=l.event?l.event.target:l.element).className.indexOf("e-day")>-1&&(o=l.element);var s=t.closest(o,".e-group-container"),a=t.closest(o,".e-rule-container");n=s.id.replace(this.element.id+"_",""),i=a.id.replace(this.element.id+"_","");var u=l;u.element&&u.element.className.indexOf("e-datepicker")>-1&&(o=u.element);var p,d,c;o.className.indexOf("e-radio")>-1?(d=parseInt(o.id.split("valuekey")[1],0),c=t.getComponent(t.closest(o,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),p=this.columns[c.index].values?this.columns[c.index].values[d]:["True","False"][d]):p=o.className.indexOf("e-multiselect")>-1?t.getComponent(o,"multiselect").value:l.value,r={groupID:n,ruleID:i,value:p,cancel:!1,type:"value"},(r=this.triggerEvents(r,"before")).cancel||(this.updateRules(o,r.value,e),this.triggerEvents({groupID:n,ruleID:i,value:r.value,cancel:!1,type:"value"}))},d.prototype.changeField=function(e){if(e.isInteracted){for(var l=t.closest(e.element,".e-group-container"),r=this.getGroup(l),n=t.closest(e.element,".e-rule-container"),i=0;n&&null!==n.previousElementSibling;)n=n.previousElementSibling,i++;this.changeRule(r.rules[i],e)}},d.prototype.changeRule=function(e,l){if(l.itemData){var n,i,o,s,a,u,p,d,c={},h=e.operator?e.operator.toLowerCase():"";u=t.closest(l.element,".e-rule-filter"),p=t.closest(l.element,".e-rule-operator");var m=t.getComponent(l.element,"dropdownlist");s=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_","");var g;if(u){if(i=t.closest(u,".e-rule-container"),a=i.id.replace(this.element.id+"_",""),g={groupID:s,ruleID:a,selectedIndex:m.index,cancel:!1,type:"field"},(g=this.triggerEvents(g,"before")).cancel)return;m.index!==g.selectedIndex&&(m.index=g.selectedIndex),c.type=this.columns[m.index].type,i.querySelector(".e-template")&&(e.value="")}if(p){if(i=t.closest(p,".e-rule-container"),a=i.id.replace(this.element.id+"_",""),g={groupID:s,ruleID:a,selectedIndex:m.index,cancel:!1,type:"operator"},(g=this.triggerEvents(g,"before")).cancel)return;m.index!==g.selectedIndex&&(m.index=g.selectedIndex),c.operator=m.value;var v=c.operator.toLowerCase();if(c.operator.toLowerCase().indexOf("between")>-1||c.operator.toLowerCase().indexOf("in")>-1&&c.operator.toLowerCase().indexOf("contains")<0?(u=p.previousElementSibling,c.type=e.type,e.value=[]):"object"==typeof e.value&&(e.value=e.value.length>0?e.value[0]:""),l.previousItemData){var y=l.previousItemData.value.toLowerCase();(y.indexOf("between")>-1||y.indexOf("in")>-1&&y.indexOf("contains")<0)&&(u=p.previousElementSibling,c.type=e.type)}h.indexOf("in")>-1&&h.indexOf("in")<5&&v.indexOf("in")>-1&&v.indexOf("in")<5&&(u=null)}if(u)if(p=u.nextElementSibling,t.addClass([p],"e-operator"),p.childElementCount)n=t.getComponent(p.querySelector(".e-dropdownlist"),"dropdownlist"),c.operator=n.value,this.renderValues(p,l.itemData,l.previousItemData,!0,e,c,l.element);else{var f=t.closest(p,".e-rule-container").id;d=this.createElement("input",{attrs:{type:"text",id:f+"_operatorkey"}}),p.appendChild(d),this.columns[m.index].operators?o=this.columns[m.index].operators:l.itemData&&(o=this.customOperators[this.columns[m.index].type+"Operator"]);var b=this.element.className.indexOf("e-device")>-1?"250px":"200px";new r.DropDownList({dataSource:o,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:o.length>5?b:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+f+"_operatorkey"),c.operator=e&&""!==e.operator?e.operator:o[0].value,this.isImportRules&&(c.type=this.columns[m.index].type,c.operator=e.operator),this.renderValues(p,this.columns[m.index],l.previousItemData,!1,e,c,l.element)}this.isImportRules||this.updateRules(l.element,l.item)}},d.prototype.destroyControls=function(e){var l;l=e.nextElementSibling.querySelectorAll("input.e-control");var r;r=e.nextElementSibling.querySelectorAll("div.e-control:not(.e-handle)");for(var n=this.columns,i=0,o=l.length;i<o;i++){if(l[i].classList.contains("e-textbox"))t.getComponent(l[i],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+l[i].id));else if(l[i].classList.contains("e-dropdownlist"))t.getComponent(l[i],"dropdownlist").destroy();else if(l[i].classList.contains("e-radio"))t.getComponent(l[i],"radio").destroy();else if(l[i].classList.contains("e-numerictextbox"))t.getComponent(l[i],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+l[i].id));else if(l[i].classList.contains("e-datepicker"))t.getComponent(l[i],"datepicker").destroy();else if(l[i].classList.contains("e-multiselect"))t.getComponent(l[i],"multiselect").destroy();else if(l[i].className.indexOf("e-template")>-1)for(var s=l[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],l[i].id);break}document.getElementById(l[i].id)&&t.detach(l[i])}for(var i=0,o=r.length;i<o;i++){if(r[i].className.indexOf("e-template")>-1)for(var s=r[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],r[i].id);break}t.detach(r[i])}},d.prototype.templateDestroy=function(e,l){var r=e.template.destroy;e.template&&e.template.destroy&&("string"==typeof r?(r=t.getValue(r,window))({elementId:l}):e.template.destroy({elementId:l}))},d.prototype.getDistinctValues=function(e,t){for(var l={},r=[],n=0,i=e.length;n<i;n++){var o=e[n][t];Number(e[n][t])===e[n][t]&&e[n][t]%1!=0&&(o=e[n][t].toString());var s={};o in l||(l[o]=1,s[t]=o,r.push(s))}return r},d.prototype.renderMultiSelect=function(e,t,l,i){var o,s=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(s=!0,o=this.getDistinctValues(this.dataColl,e.field)),new r.MultiSelect({dataSource:s?o:this.dataManager,query:new n.Query([e.field]),fields:{text:e.field,value:e.field},value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l)}).appendTo("#"+t+"_valuekey"+l)},d.prototype.multiSelectOpen=function(e,l){var r=this;if(this.dataSource instanceof n.DataManager){var i=document.getElementById(e),o=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),s=this.columns[o.index].field,u=!1;if(this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(s)>-1&&(u=!0),!u){l.cancel=!0;var p=t.getComponent(i,"multiselect");p.hideSpinner();var d=this.dataManager.executeQuery((new n.Query).select(s)),c=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),d.then(function(e){r.dataColl=t.extend(r.dataColl,e.result,[],!0);var l=r.getDistinctValues(r.dataColl,s);p.dataSource=l,a.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){c.reject(e)})}}},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),a.createSpinner({target:l,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,l){var r=document.getElementById(l.popup.element.id.replace("_popup","")),n=t.getComponent(r,"multiselect").value;this.updateRules(r,n,e)},d.prototype.processTemplate=function(e,l,r,n){var i=t.closest(e,".e-rule-container").querySelectorAll(".e-template");i.length<2?l.template&&"string"==typeof l.template.write?t.getValue(l.template.write,window)({elements:i[0],values:r.value,operator:n.operator}):l.template&&l.template.write&&l.template.write({elements:i[0],values:r.value,operator:n.operator}):l.template&&"string"==typeof l.template.write?t.getValue(l.template.write,window)({elements:i,values:r.value,operator:n.operator}):l.template&&l.template.write&&l.template.write({elements:i,values:r.value,operator:n.operator})},d.prototype.renderStringValue=function(e,t,l,r,n){var o,s=this.isImportRules?t.value:"";if("in"!==l&&"notin"!==l||!this.dataColl.length){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules?t.value:[]).join(","));var a=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,r)});a.appendTo("#"+e+"_valuekey"+r),a.value=s,a.dataBind()}else o=this.isImportRules?t.value:[],this.renderMultiSelect(t,e,r,o),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.style.width="100%":(n.style.width=null,n.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,l,r,n,o,s,a){var u,p=this.isImportRules?l.value:0;if("in"!==r&&"notin"!==r||!this.dataColl.length)if("in"===r||"notin"===r){var d=(u=this.isImportRules?l.value:[]).join(","),c=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,n)});c.appendTo("#"+e+"_valuekey"+n),c.value=d,c.dataBind()}else{var h=t.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist"),m=(s=this.columns[h.index]).validation&&s.validation.min?s.validation.min:0,g=s.validation&&s.validation.max?s.validation.max:Number.MAX_VALUE,v=s.format?s.format:"n";a>1&&l&&(p=l.value[n]?l.value[n]:0),new i.NumericTextBox({value:p,format:v,min:m,max:g,width:"100%",step:s.step?s.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}else u=this.isImportRules?l.value:[],this.renderMultiSelect(l,e,n,u),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?o.style.width="100%":(o.style.minWidth="200px",o.style.width=null)},d.prototype.processValueString=function(e,t){var l=[],r=e.split(",");if("string"===t)return r;for(var n=0,i=r.length;n<i;n++)l.push(Number(r[n]));return l},d.prototype.renderControls=function(e,r,n,i){if(t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),r.template)this.processTemplate(e,r,n,i);else{var s="boolean"===i.type||i.operator&&i.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"!==i.operator&&"notin"!==i.operator&&(u.style.width="200px");for(var p=0;p<s;p++)switch(i.type){case"string":this.renderStringValue(a,n,i.operator,p,u);break;case"number":this.renderNumberValue(a,n,i.operator,p,u,r,s);break;case"boolean":var d=r.values&&r.values.length?r.values:["True","False"],c=!this.isImportRules||Boolean(n.value),h=new l.RadioButton({label:d[p].toString(),name:a+"default",checked:c,value:d[p],change:this.changeValue.bind(this,p)});h.appendTo("#"+a+"_valuekey"+p),this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,g=void 0;if(this.isImportRules&&n&&n.value){m=s>1?new Date(n.value[p]):new Date(n.value);var v=void 0,y=this.getColumn(n.field);if(g=s>1?n.value[p]:n.value,y.format){var f=this.intl.getDateParser({skeleton:"full",type:"dateTime"});v={type:"dateTime",format:y.format},"Invalid Date"===m.toLocaleDateString()&&(m=f(g),t.isNullOrUndefined(m)&&(m=this.intl.parseDate(g,v)))}}(r.format?new o.DatePicker({value:m,format:r.format,change:this.changeValue.bind(this,p)}):new o.DatePicker({value:m,change:this.changeValue.bind(this,p)})).appendTo("#"+a+"_valuekey"+p)}}}},d.prototype.renderValues=function(e,l,r,n,i,o,s){if(n){var a=t.getComponent(e.querySelector("input"),"dropdownlist");l.operators?(a.dataSource=l.operators,a.index=0!==a.index?0:1,a.dataBind(),o.operator=a.value):l.type&&(a.dataSource=this.customOperators[l.type+"Operator"],a.index=0!==a.index?0:1,a.dataBind(),o.operator=a.value)}var u=t.closest(e,".e-rule-container").id;r&&r.template&&(this.templateDestroy(r,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(l.template=this.columns[d.index].template,l.template){l.template=this.columns[d.index].template;g=void 0;if(l.template&&"string"==typeof l.template.create?g=t.getValue(l.template.create,window)():l.template&&l.template.create&&(g=l.template.create()),g instanceof Element)g.id=u+"_valuekey0",t.addClass([g],"e-template"),t.addClass([g],"e-"+l.field),e.nextElementSibling.appendChild(g);else if(g instanceof Array){t.addClass(g,"e-template");for(var c=0,h=g.length;c<h;c++)g[c].id=u+"_valuekey"+c,e.nextElementSibling.appendChild(g[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"===o.type||o.operator&&o.operator.toLowerCase().indexOf("between")>-1)for(c=0;c<2;c++){g=void 0;g=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+c}}),e.nextElementSibling.appendChild(g)}else{var g=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey0"}});e.nextElementSibling.appendChild(g)}this.renderControls(e,l,i,o)},d.prototype.updateValues=function(e,l){var r=e.className.split(" e-")[1],n=parseInt(e.id.slice(-1),2);switch(r){case"textbox":case"dropdownlist":case"radio":l.value=t.getComponent(e,r).value;break;case"numerictextbox":l.operator.indexOf("between")>-1?l.value[n]=t.getComponent(e,r).value:l.value=t.getComponent(e,r).value;break;case"datepicker":var i={type:"dateTime",format:this.getColumn(l.field).format};l.operator.indexOf("between")>-1?l.value[n]=t.getComponent(e,r).value:t.isNullOrUndefined(i.format)?l.value=this.intl.formatDate(t.getComponent(e,r).value):l.value=this.intl.formatDate(t.getComponent(e,r).value,i)}},d.prototype.updateRules=function(e,l,r){for(var n,i,o,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0,d=s.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),o=u.id.replace(this.element.id+"_",""),t.closest(e,".e-rule-filter")){n=t.getComponent(e,"dropdownlist"),a.rules[p].field=this.columns[n.index].field,a.rules[p].type=this.columns[n.index].type,a.rules[p].label=this.columns[n.index].label;var h=t.closest(e,".e-rule-filter"),m=h.nextElementSibling.querySelector("input.e-control"),g=t.getComponent(m,"dropdownlist").value;a.rules[p].operator=g,(m=h.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(m=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),m||(m=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:a.rules[p].field,type:"field"},this.updateValues(m,a.rules[p]),this.triggerEvents(i),this.allowValidation&&a.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if(t.closest(e,".e-rule-operator")){n=t.getComponent(e,"dropdownlist"),a.rules[p].operator=n.value;var v=void 0;e.parentElement;v=u.querySelectorAll(".e-rule-value input.e-control"),i={groupID:d,ruleID:o,value:n.value,type:"operator"},this.allowValidation&&a.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),v.length>1&&(a.rules[p].value=[]);for(var y=0;y<v.length;y++)this.updateValues(v[y],a.rules[p]);this.triggerEvents(i),this.filterRules(c,this.getValidRules(this.rule),"operator")}else t.closest(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,p,s,u,r),this.filterRules(c,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,rule:e.rules})!==JSON.stringify({condition:t.condition,rule:t.rules})&&this.triggerEvents({previousRule:e,rule:t,type:l},"ruleChange")},d.prototype.ruleValueUpdate=function(e,l,n,i,o,s,a){var u,p=["in","between","notin","notbetween"];if(null!==l){var d=n.rules[i].operator.toLowerCase();if(e.className.indexOf("e-multiselect")>-1&&"number"===n.rules[i].type){for(var c=[],h=l,m=0,g=h.length;m<g;m++)"string"==typeof h[m]&&c.push(parseFloat(h[m]));c.length&&(l=c)}if(e.className.indexOf("e-template")>-1)l instanceof Array?p.indexOf(d)>-1?n.rules[i].value=l:n.rules[i].value=l[0]:n.rules[i].value=l,u={groupID:o.id,ruleID:s.id,value:n.rules[i].value,type:"value"},this.triggerEvents(u);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)p.indexOf(d)>-1?n.rules[i].value[a]=l:n.rules[i].value=l;else if(e.className.indexOf("e-radio")>-1)n.rules[i].value=l;else if(e.className.indexOf("e-multiselect")>-1)n.rules[i].value=l;else if(e.className.indexOf("e-textbox")>-1)"in"===d||"notin"===d?(n.rules[i].type,n.rules[i].value=this.processValueString(l,n.rules[i].type)):n.rules[i].value=l;else if(e.className.indexOf("e-datepicker")>-1){var v=t.getInstance(s.querySelector(".e-rule-filter input"),r.DropDownList),y={type:"dateTime",format:this.columns[v.index].format||"MM/dd/yyyy"};y.type&&(p.indexOf(d)>-1?n.rules[i].value[a]=this.intl.formatDate(l,y):n.rules[i].value=this.intl.formatDate(l,y))}this.validatValue(n,i,s)}},d.prototype.validatValue=function(e,l,r){if(this.allowValidation&&e.rules[l].value){var n=r.querySelectorAll(".e-rule-value .e-control");n[0].className.indexOf("e-tooltip")>-1?t.getComponent(n[0],"tooltip").destroy():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,l){var r=t.rules,n=[];if(!l){for(var i=0,o=r.length;i<o;i++)(t=r[i]).rules&&n.push(t);return n[e]}return t},d.prototype.destroy=function(){if(this.element){var l,r,n;for(e.prototype.destroy.call(this),n=(l=this.element.querySelectorAll(".e-addrulegroup")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdown-btn").destroy(),t.detach(l[r]);for(n=(l=this.element.querySelectorAll(".e-rule-filter .e-control")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdownlist").destroy(),t.detach(l[r]);for(n=(l=this.element.querySelectorAll(".e-rule-operator .e-control")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdownlist").destroy(),t.detach(l[r]);this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_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){t=this.element.id+"_"+t;for(var l=0,r=e.length;l<r;l++)this.addRuleElement(document.getElementById(t),e[l])},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var l=document.getElementById(t),r=this.getGroup(l);if(e.length)for(var n=0,i=e.length;n<i;n++)this.importRules(e[n],l);else r.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.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();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 l=document.querySelectorAll("label.e-btn"),r=void 0,n=0;n<l.length;n++)r=l.item(n),t.rippleEffect(r,{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"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),r=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),r.appendChild(l),e.appendChild(r),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});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,l){for(var r=0,n=Object.keys(e);r<n.length;r++)switch(n[r]){case"summaryView":var i=this.element.querySelector(".e-group-container"),o=this.element.querySelector(".e-summary-content");e.summaryView?(i.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),o=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),o.style.display="block"):(i.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),i.style.display="block",o.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":l.cssClass&&t.removeClass([this.element],l.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,e.rule=this.getRuleCollection(this.rule,!1);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new t.Internationalization(this.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",In:"In",NotIn:"Not In",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",SummaryViewTitle:"Summary View"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],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",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.dataSource instanceof n.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new n.Query).take(1))):(this.dataManager=new n.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new n.Query),this.initControl())},d.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),r=new n.Deferred;l.then(function(e){t.dataColl=e.result,t.initControl()}).catch(function(e){r.reject(e)})},d.prototype.initControl=function(){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 l=this.levelColl[e.id],r=t?l.length-1:l.length,n=this.rule,i=0;i<r;i++)n=this.findGroupByIdx(l[i],n,0===i);return n},d.prototype.deleteGroup=function(e){var l,r,n=e,i=n.id.replace(this.element.id+"_",""),o=this.getGroup(n,!0),s=0,a={groupID:i,cancel:!1,type:"deleteGroup"},u=this.getValidRules(this.rule);if(!(a=this.triggerEvents(a,"before")).cancel){var p=n.nextElementSibling,d=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),h=e.querySelectorAll(".e-tooltip");for(r=h.length,l=0;l<r;l++)t.getComponent(h[l],"tooltip").destroy();for(l=0,r=c.length;l<r;l++)delete this.levelColl[c[l].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,s++;p&&p.className.indexOf("e-separate-rule")>-1&&(t.removeClass([p],"e-separate-rule"),t.addClass([p],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&t.addClass([d],"e-prev-joined-rule")),o.rules.splice(s,1),delete this.levelColl[i],t.detach(e),this.refreshLevelColl(),this.triggerEvents(a),this.filterRules(u,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.deleteRule=function(e){var l,r,n=t.closest(e,".e-group-container"),i=this.getGroup(n),o=t.closest(e,".e-rule-container");r=n.id.replace(this.element.id+"_",""),l=t.closest(e,".e-rule-container").id.replace(this.element.id+"_","");var s=this.getValidRules(this.rule),a={groupID:r,ruleID:l,cancel:!1,type:"deleteRule"};if(!(a=this.triggerEvents(a,"before")).cancel){var u,p=o,d=o.nextElementSibling,c=o.previousElementSibling,h=0,m=o.querySelectorAll(".e-tooltip"),g=m.length;for(u=0;u<g;u++)t.getComponent(m[u],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,h++;i.rules.splice(h,1),(!c||c.className.indexOf("e-rule-container")<0)&&d&&t.removeClass([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&c&&t.removeClass([c],"e-prev-joined-rule"),t.detach(p),this.triggerEvents(a),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0),this.isImportRules=!1},d.prototype.getValidRules=function(e){var l=e.condition,r=t.extend([],e.rules,[],!0);return this.getRuleCollection({condition:l,rules:r},!0)},d.prototype.getRuleCollection=function(e,t){var l;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var r=e.rules.length,n=0;n<r;n++)l=e.rules[n],l=this.getRuleCollection(l,t),e.rules[n]=l,Object.keys(l).length<1&&t&&(e.rules.splice(n,1),n--,r--);return e=e.condition?{condition:e.condition,rules:e.rules}:""!==e.field&&""!==e.operator&&""!==e.value?{label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value}:{}},d.prototype.setRules=function(e){var l=t.extend({},e,{},!0);this.setGroupRules(l)},d.prototype.getRules=function(){return this.rule},d.prototype.deleteGroups=function(e){var t,l,r=e.length;for(t=0;t<r;t++)l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=(new n.Query).where(e);return this.dataManager.executeQuery(t)},d.prototype.deleteRules=function(e){var t,l,r=e.length;for(t=0;t<r;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],r=0,i=Object.keys(this.columns);r<i.length;r++)l.push(this.columns[r].field);return e.rules.length?(new n.Query).select(l).where(t):(new n.Query).select(l)},d.prototype.getPredicate=function(e){for(var t,l,r,i,o=e.rules,s=!1,a=0,u=o.length;a<u;a++)if(Object.keys(o[a]).indexOf("rules")>-1)(l=this.getPredicate(o[a]))&&(t=t?"and"===e.condition?t.and(l):t.or(l):l);else if(o[a].operator.length){var p=o[a].operator.toLowerCase(),d=["equal","notequal"];if(s=["contains","startswith","endswith"].indexOf(p)>-1||"date"===o[a].type&&d.indexOf(p)>-1,i=this.getColumn(o[a].field),"date"===o[a].type){var c={type:"dateTime",format:i.format||"MM/dd/yyyy"};r=this.intl.parseDate(o[a].value,c)}else r=o[a].value;if(0===a)(p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p?t=this.arrayPredicate(o[a]):""!==(h=r)&&(t=new n.Predicate(o[a].field,o[a].operator,r,s));else if("and"===e.condition)if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{h=r;t&&""!==h?t=t.and(o[a].field,o[a].operator,r,s):""!==h&&(t=new n.Predicate(o[a].field,o[a].operator,r,s))}else if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{var h=r;t&&""!==h?t=t.or(o[a].field,o[a].operator,r,s):""!==h&&(t=new n.Predicate(o[a].field,o[a].operator,r,s))}}return t},d.prototype.getColumn=function(e){for(var t,l=this.columns,r=0,n=l.length;r<n;r++)l[r].field===e&&(t=l[r]);return t},d.prototype.arrayPredicate=function(e,t,l){for(var r,i=e.value,o=0,s=i.length;o<s;o++)if(""!==i[o])if(0===o)switch(e.operator){case"between":r=new n.Predicate(e.field,"greaterthan",i[o]);break;case"notbetween":r=new n.Predicate(e.field,"lessthan",i[o]);break;case"in":r=new n.Predicate(e.field,"equal",i[o]);break;case"notin":r=new n.Predicate(e.field,"notequal",i[o])}else switch(e.operator){case"between":r=r.and(e.field,"lessthan",i[o]);break;case"notbetween":r=r.or(e.field,"greaterthan",i[o]);break;case"in":r=r.or(e.field,"equal",i[o]);break;case"notin":r=r.and(e.field,"notequal",i[o])}return r&&(t?"and"===l?t=t.and(r):"or"===l&&(t=t.or(r)):t=r),t},d.prototype.importRules=function(e,l,r){r||(l=this.renderGroup(e.condition,l));var n=e.rules;if(!t.isNullOrUndefined(n))for(var i=0,o=n.length;i<o;i++){var s=Object.keys(n[i]);!t.isNullOrUndefined(n[i].rules)&&s.indexOf("rules")>-1?(l=this.renderGroup(n[i].condition,l),l=this.importRules(n[i],l,!0)):this.renderRule(n[i],l)}return(l=t.closest(l,".e-rule-list"))&&(l=t.closest(l,".e-group-container")),l},d.prototype.renderGroup=function(e,t){this.addGroupElement(!0,t,e);var l=t.querySelectorAll(".e-group-container");return l[l.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 l=!1;t?t+="(":(t="",l=!0);for(var r=e.condition,n=0,i=e.rules.length;n<i;n++){if(e.rules[n].rules)t=this.getSqlString(e.rules[n],t);else{var o=e.rules[n],s="";if(o.value instanceof Array)if(o.operator.indexOf("between")>-1)s+=o.value[0]+" AND "+o.value[1];else if("string"==typeof o.value[0]){s+='("'+o.value[0]+'"';for(var a=1,u=o.value.length;a<u;a++)s+=',"'+o.value[a]+'"';s+=")"}else s+="("+o.value+")";else"startswith"===o.operator?s+='("'+o.value+'%")':"endswith"===o.operator?s+='("%'+o.value+'")':"contains"===o.operator?s+='("%'+o.value+'%")':"number"===o.type?s+=o.value:s+='"'+o.value+'"';t+=o.field+" "+this.operators[o.operator]+" "+s}n!==i-1&&(t+=" "+r+" ")}return l||(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 e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e)).replace(/"/g,"'")},d.prototype.sqlParser=function(e){var t,l=0;do{t=e.slice(l),l+=this.parseSqlStrings(t)}while(""!==t);return this.parser},d.prototype.parseSqlStrings=function(e){for(var t,l,r=["=","!=","<",">","<=",">="],n=["and","or"],i=["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN"],o=0,s=r.length;o<s;o++)if(t=/^\w+$/.test(r[o])?"\\b":"",new RegExp("^("+r[o]+")"+t,"ig").exec(e))return this.parser.push(["Operators",r[o].toLowerCase()]),r[o].length;for(var o=0,s=n.length;o<s;o++)if(t=/^\w+$/.test(n[o])?"\\b":"",new RegExp("^("+n[o]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",n[o].toLowerCase()]),n[o].length;for(var o=0,s=i.length;o<s;o++)if(t=/^\w+$/.test(i[o])?"\\b":"",new RegExp("^("+i[o]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",i[o].toLowerCase()]),i[o].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)?(l=/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",l]),l.length):/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)?(l=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],this.parser.push(["String",l]),l.length):/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(l=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",l]),l.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(l=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",l]),l.length):1},d.prototype.getOperator=function(e,t){var l={"=":"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":l[t]},d.prototype.processParser=function(e,t,l){for(var r,n,i,o,s,a,u,p,d,c,h=[],m=[],g=0,v=e.length;g<v;g++)if("Literal"===e[g][0]){if(r={label:e[g][1],field:e[g][1]},"SubOperators"===e[g+1][0]){for(r.operator=this.getOperator(e[g+3][1].replace(/'/g,""),e[g+1][1]),c=e[g+1][1],i=++g+1,o=v,i=g+1;i<o;i++){if("Right"===e[i][0]){g=i;break}if("like"===c&&"String"===e[i][0])r.value=e[i][1].replace(/'/g,"").replace(/%/g,""),r.type="string";else if("between"===c){if("Literal"===e[i][0]||"Left"===e[i][0])break;"Number"===e[i][0]&&h.push(Number(e[i][1]))}else"Number"===e[i][0]?h.push(Number(e[i][1])):"String"===e[i][0]&&m.push(e[i][1].replace(/'/g,""))}"like"!==c&&("Number"===e[i-1][0]?(r.value=h,r.type="number"):"String"===e[i-1][0]?(r.value=m,r.type="string"):"between"===c&&"Conditions"===e[i-1][0]&&(r.value=h,r.type="number"))}else"Operators"===e[g+1][0]&&(r.operator=this.getOperator(e[g+2][1],e[g+1][1]),"Number"===e[g+2][0]?(r.type="number",r.value=Number(e[g+2][1])):(r.type="string",r.value=e[g+2][1].replace(/'/g,"")));t.rules.push(r)}else{if("Left"===e[g][0]){for(n={condition:"",rules:[]},this.parser=e.splice(g+1,v-(g+1)),d=0,a=t.rules.length,s=0;s<a;s++)t.rules[s].rules&&d++;return l.push(d),t.rules.push(n),n=this.processParser(this.parser,n,l),t}if("Conditions"===e[g][0])t.condition=e[g][1];else if("Right"===e[g][0]){for(this.parser=e.splice(g+1,v-(g+1)),l.pop(),t=this.rule,p=l.length,u=0;u<p;u++)t=this.findGroupByIdx(l[u],t,0===u);return this.processParser(this.parser,t,l)}}return t},p([t.Event()],d.prototype,"created",void 0),p([t.Event()],d.prototype,"beforeChange",void 0),p([t.Event()],d.prototype,"change",void 0),p([t.Event()],d.prototype,"ruleChange",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:[]},c)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);return e.Columns=d,e.Rule=c,e.ShowButtons=h,e.QueryBuilder=m,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,l,r,n,i,o,s,a){"use strict";var u=function(){var e=function(t,l){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])})(t,l)};return function(t,l){function r(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(r.prototype=l.prototype,new r)}}(),p=function(e,t,l,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,l):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(i<3?n(o):i>3?n(t,l,o):n(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o};r.MultiSelect.Inject(r.CheckBoxSelection);var d=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"values",void 0),p([t.Property(null)],l.prototype,"operators",void 0),p([t.Property(null)],l.prototype,"template",void 0),p([t.Property({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),p([t.Property(null)],l.prototype,"format",void 0),p([t.Property(null)],l.prototype,"step",void 0),l}(t.ChildProperty),c=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"condition",void 0),p([t.Collection([],l)],l.prototype,"rules",void 0),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"operator",void 0),p([t.Property(null)],l.prototype,"value",void 0),l}(t.ChildProperty),h=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(!0)],l.prototype,"ruleDelete",void 0),p([t.Property(!0)],l.prototype,"groupInsert",void 0),p([t.Property(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),m=function(e){function d(t,l){return e.call(this,t,l)||this}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+"_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.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=void 0,r=!1,n=void 0,i={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var o=this.columns,s=0,a=o.length;s<a;s++)o[s].type||(e.indexOf(o[s].field)>-1&&("string"===(l=typeof(n=this.dataColl[0][o[s].field]))?r=!isNaN(Date.parse(n)):"object"===l&&(r=n instanceof Date&&!isNaN(n.getTime()),l="string"),o[s].type=l,r=!1),l="string"),o[s].validation||(o[s].validation=i)}else{for(var s=0,a=e.length;s<a;s++)"string"===(l=typeof(n=this.dataColl[0][e[s]]))?r=!isNaN(Date.parse(n)):"object"===l&&(r=n instanceof Date&&!isNaN(n.getTime()),l="string"),t[s]={field:e[s],label:e[s],type:r?"date":l,validation:i},r=!1;this.columns=t}}},d.prototype.triggerEvents=function(e,t){return this.isImportRules?e:("before"===t?this.trigger("beforeChange",e):"ruleChange"===t?this.trigger("ruleChange",e):this.trigger("change",e),e)},d.prototype.clickEventHandler=function(e){var l,r=e.target;this.isImportRules=!1;var n;if("SPAN"===r.tagName&&(r=r.parentElement),r.className.indexOf("e-collapse-rule")>-1){var i=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var o=document.getElementById(this.element.id+"_summary_content"),s=o.querySelector(".e-summary-text");i.animate(".e-query-builder",{name:"SlideLeftIn"}),(u=this.element.querySelector(".e-group-container")).style.display="none",s.textContent=this.getSqlFromRules(this.rule),o.style.display="block",s.style.height=s.scrollHeight+"px"}if("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((i=new t.Animation({duration:1e3,delay:0})).animate(".e-query-builder",{name:"SlideLeftIn"}),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 a=t.extend({},this.rule,{},!0);this.setGroupRules(a),this.renderSummaryCollapse()}else{var u=this.element.querySelector(".e-group-container");u.querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),u.style.display="block"}}else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1){var p=t.closest(r,".e-group-container"),d=this.getValidRules(this.rule);if(n=p.id.replace(this.element.id+"_",""),l={groupID:n,cancel:!1,type:"condition",value:r.textContent.toLowerCase()},(l=this.triggerEvents(l,"before")).cancel)return;var c=this.getGroup(p);c.condition=l.value,this.triggerEvents({groupID:n,type:"condition",value:c.condition}),this.filterRules(d,this.getValidRules(this.rule),"condition")}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert?t.removeClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.addClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):l.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},d.prototype.addRuleElement=function(e,l){var n={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};if(!(n=this.triggerEvents(n,"before")).cancel){var i=this.ruleElem.cloneNode(!0);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?i.className="e-rule-container e-vertical-mode":i.className="e-rule-container e-horizontal-mode";var o,s,u,p,d,c,h,m=e.querySelector(".e-rule-list"),g=i.querySelector("button");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?(g.textContent=this.l10n.getConstant("Remove"),t.addClass([g],"e-flat"),t.addClass([g],"e-primary")):(t.addClass([g],"e-round"),t.addClass([g],"e-icon-btn"),new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(g),g=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),i.querySelector("button").appendChild(g)),i.setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.ruleIdCounter++,i.querySelector(".e-filter-input").setAttribute("id",i.id+"_filterkey"),m.appendChild(i),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-rule-container")>-1&&(i.className.indexOf("e-joined-rule")<0&&(i.className+=" e-joined-rule"),i.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(i.previousElementSibling.className+=" e-prev-joined-rule")),i.previousElementSibling&&i.previousElementSibling.className.indexOf("e-group-container")>-1&&i.className.indexOf("e-separate-rule")<0&&(i.className+=" e-separate-rule"),c=this.element.className.indexOf("e-device")>-1?"250px":"200px",(d=new r.DropDownList({dataSource:this.columns,fields:{text:"label",value:"field"},placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?c:"auto",change:this.changeField.bind(this),value:l?l.field:null})).appendTo("#"+i.id+"_filterkey"),this.filterIndex=d.index,o=this.levelColl[e.id],!this.isImportRules){for(s=this.rule,u=0,p=o.length;u<p;u++)s=this.findGroupByIdx(o[u],s,0===u);Object.keys(l).length?s.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}):s.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(l).length&&this.changeRule(l,{element:d.element,itemData:this.columns[this.filterIndex]}),h=i.id.replace(this.element.id+"_",""),this.triggerEvents({groupID:e.id.replace(this.element.id+"_",""),ruleID:h,type:"insertRule"})}},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(){var e=!0;if(this.allowValidation){var l=void 0,r=void 0,n=void 0,i=void 0,o=[],s=void 0,a=void 0,u=void 0,p=void 0,d=void 0,c=this.element.querySelectorAll(".e-rule-container"),h=void 0;for(l=0,r=c.length;l<r;l++)if(s=t.closest(c[l],".e-group-container"),d=this.getGroup(s),a=0,i=p=c[l],u=t.getComponent(c[l].querySelector(".e-rule-field input.e-control"),"dropdownlist"),h=!t.isNullOrUndefined(u.index)&&this.columns[u.index].validation,n=p.querySelector(".e-rule-field input.e-control"),h&&h.isRequired){for(;i&&null!==i.previousElementSibling;)i=i.previousElementSibling,a++;if(n=p.querySelector(".e-rule-field input.e-control"),d.rules[a].field||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),n=p.querySelector(".e-rule-operator input.e-control"),d.rules[a].operator||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),d.rules[a].value instanceof Array&&(o=d.rules[a].value),t.isNullOrUndefined(d.rules[a].value)||""===d.rules[a].value||d.rules[a].value instanceof Array&&o.length<1){var m=p.querySelectorAll(".e-rule-value input.e-control");e=!1;for(var g=0,v=m.length;g<v;g++){var y=m[g],f=void 0;y.parentElement.className.indexOf("e-searcher")>-1?(f=t.closest(y,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(f):m[g].parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(m[g].parentElement),g++}}}else u.element&&t.isNullOrUndefined(u.index)&&(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1)}return e},d.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)},d.prototype.refreshLevel=function(e){var l,r,n=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=n.length,s=0;for(r=0;r<o;r++)(l=n[r]).className.indexOf("e-group-container")>-1&&(e.level.push(s),this.levelColl[l.id]=e.level.slice(),s++,e.groupElement=l,e=this.refreshLevel(e));var a=t.closest(i,".e-rule-list");return e.groupElement=a?t.closest(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(){var e,t,l,r,n,i,o,s,a;return e=this.createElement("div",{attrs:{class:"e-group-container"}}),l=this.createElement("div",{attrs:{class:"e-group-header"}}),t=this.createElement("div",{attrs:{class:"e-group-body"}}),r=this.createElement("div",{attrs:{class:"e-rule-list"}}),e.appendChild(l),t.appendChild(r),e.appendChild(t),n=this.createElement("div",{attrs:{class:"e-btn-group"}}),(i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}})).setAttribute("checked","true"),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-and-lbl e-small"},innerHTML:"AND"}),n.appendChild(o),i=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),n.appendChild(i),o=this.createElement("label",{attrs:{class:"e-btn e-btngroup-or-lbl e-small"},innerHTML:"OR"}),n.appendChild(o),l.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),l.appendChild(s),e},d.prototype.ruleTemplate=function(){var e,t,l,r,n,i;return e=this.createElement("div"),n=this.createElement("div",{attrs:{class:"e-rule-field"}}),l=this.createElement("div",{attrs:{class:"e-rule-filter"}}),t=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}}),l.appendChild(t),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-operator"}}),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value"}}),n.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),i=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",r=this.createElement("button",{attrs:{class:i}}),l.appendChild(r),n.appendChild(l),e.appendChild(n),e},d.prototype.addGroupElement=function(e,r,n,i){var o={groupID:r.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};if(!((o=this.triggerEvents(o,"before")).cancel||this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount)){var u,p=this.groupElem.cloneNode(!0);p.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.groupIdCounter++;var d=p.querySelector(".e-btngroup-and"),c=p.querySelector(".e-btngroup-or"),h=p.querySelector(".e-btngroup-and-lbl"),m=p.querySelector(".e-btngroup-or-lbl");if(d.setAttribute("id",this.element.id+"_and"+this.btnGroupId),c.setAttribute("id",this.element.id+"_or"+this.btnGroupId),d.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("name",this.element.id+"_and"+this.btnGroupId),h.setAttribute("for",this.element.id+"_and"+this.btnGroupId),m.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,e){var g=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";u=this.createElement("button",{attrs:{class:g}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(u),new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(u),t.rippleEffect(u,{selector:".deletegroup"}),p.querySelector(".e-group-action").appendChild(u);for(var v=r.querySelector(".e-rule-list"),y=v.children,f=0,b=0,C=y.length;b<C;b++)y[b].className.indexOf("e-group-container")>-1&&(f+=1);v.appendChild(p);var x=this.levelColl[r.id].slice(0);x.push(f),this.levelColl[p.id]=x,this.isImportRules||(this.addGroups([],r.id.replace(this.element.id+"_","")),i&&this.addRuleElement(p,{}))}else r.appendChild(p),this.levelColl[p.id]=[0];p.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===n&&p.querySelector(".e-btngroup-or").setAttribute("checked","true");var E=p.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,E),select:this.selectBtn.bind(this,E)}).appendTo(E),this.triggerEvents({groupID:r.id.replace(this.element.id+"_",""),type:"insertGroup"})}},d.prototype.notifyChange=function(e,l){for(var r=t.closest(l,".e-rule-value").querySelectorAll(".e-template"),n=[],i=0,o=r.length;i<o;i++)r[i].nextElementSibling&&r[i].nextElementSibling.className.indexOf("e-check")>-1&&n.push(r[i].textContent);this.updateRules(l,r.length>1?n:e)},d.prototype.changeValue=function(e,l){var r,n,i,o;(o=l.event?l.event.target:l.element).className.indexOf("e-day")>-1&&(o=l.element);var s=t.closest(o,".e-group-container"),a=t.closest(o,".e-rule-container");n=s&&s.id.replace(this.element.id+"_",""),i=a.id.replace(this.element.id+"_","");var u=l;u.element&&u.element.className.indexOf("e-datepicker")>-1&&(o=u.element);var p,d,c;o.className.indexOf("e-radio")>-1?(d=parseInt(o.id.split("valuekey")[1],0),c=t.getComponent(t.closest(o,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),p=this.columns[c.index].values?this.columns[c.index].values[d]:["True","False"][d]):p=o.className.indexOf("e-multiselect")>-1?t.getComponent(o,"multiselect").value:l.value,r={groupID:n,ruleID:i,value:p,cancel:!1,type:"value"},(r=this.triggerEvents(r,"before")).cancel||(this.updateRules(o,r.value,e),this.triggerEvents({groupID:n,ruleID:i,value:r.value,cancel:!1,type:"value"}))},d.prototype.changeField=function(e){if(e.isInteracted){for(var l=t.closest(e.element,".e-group-container"),r=this.getGroup(l),n=t.closest(e.element,".e-rule-container"),i=0;n&&null!==n.previousElementSibling;)n=n.previousElementSibling,i++;this.changeRule(r.rules[i],e)}},d.prototype.changeRule=function(e,l){if(l.itemData){var n,i,o,s,a,u,p,d={},c=e.operator?e.operator.toLowerCase():"";a=t.closest(l.element,".e-rule-filter"),u=t.closest(l.element,".e-rule-operator");var h,m=t.getComponent(l.element,"dropdownlist"),g=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_","");if(a){if(i=t.closest(a,".e-rule-container"),s=i.id.replace(this.element.id+"_",""),h={groupID:g,ruleID:s,selectedIndex:m.index,cancel:!1,type:"field"},(h=this.triggerEvents(h,"before")).cancel)return;m.index!==h.selectedIndex&&(m.index=h.selectedIndex),d.type=this.columns[m.index].type,i.querySelector(".e-template")&&(e.value="")}if(u){if(i=t.closest(u,".e-rule-container"),s=i.id.replace(this.element.id+"_",""),h={groupID:g,ruleID:s,selectedIndex:m.index,cancel:!1,type:"operator"},(h=this.triggerEvents(h,"before")).cancel)return;m.index!==h.selectedIndex&&(m.index=h.selectedIndex),d.operator=m.value;var v=d.operator.toLowerCase();if(d.operator.toLowerCase().indexOf("between")>-1||d.operator.toLowerCase().indexOf("in")>-1&&d.operator.toLowerCase().indexOf("contains")<0?(a=u.previousElementSibling,d.type=e.type,(d.operator.toLowerCase().indexOf("in")<0||e.operator.toLowerCase().indexOf("in")<0)&&(e.value=[])):"object"==typeof e.value&&(e.value=e.value.length>0?e.value[0]:""),l.previousItemData){var y=l.previousItemData.value.toLowerCase();(y.indexOf("between")>-1||y.indexOf("in")>-1&&y.indexOf("contains")<0)&&(a=u.previousElementSibling,d.type=e.type)}c.indexOf("in")>-1&&c.indexOf("in")<5&&v.indexOf("in")>-1&&v.indexOf("in")<5&&(a=null)}if(a)if(u=a.nextElementSibling,t.addClass([u],"e-operator"),u.childElementCount)n=t.getComponent(u.querySelector(".e-dropdownlist"),"dropdownlist"),d.operator=n.value,this.renderValues(u,l.itemData,l.previousItemData,!0,e,d,l.element);else{var f=t.closest(u,".e-rule-container").id;p=this.createElement("input",{attrs:{type:"text",id:f+"_operatorkey"}}),u.appendChild(p),this.columns[m.index].operators?o=this.columns[m.index].operators:l.itemData&&(o=this.customOperators[this.columns[m.index].type+"Operator"]);var b=this.element.className.indexOf("e-device")>-1?"250px":"200px";new r.DropDownList({dataSource:o,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:o.length>5?b:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+f+"_operatorkey"),d.operator=e&&""!==e.operator?e.operator:o[0].value,this.isImportRules&&(d.type=this.columns[m.index].type,d.operator=e.operator),this.renderValues(u,this.columns[m.index],l.previousItemData,!1,e,d,l.element)}this.isImportRules||this.updateRules(l.element,l.item)}},d.prototype.destroyControls=function(e){var l;l=e.nextElementSibling.querySelectorAll("input.e-control");var r;r=e.nextElementSibling.querySelectorAll("div.e-control:not(.e-handle)");for(var n=this.columns,i=0,o=l.length;i<o;i++){if(l[i].classList.contains("e-textbox"))t.getComponent(l[i],"textbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+l[i].id));else if(l[i].classList.contains("e-dropdownlist"))t.getComponent(l[i],"dropdownlist").destroy();else if(l[i].classList.contains("e-radio"))t.getComponent(l[i],"radio").destroy();else if(l[i].classList.contains("e-numerictextbox"))t.getComponent(l[i],"numerictextbox").destroy(),t.detach(e.nextElementSibling.querySelector("input#"+l[i].id));else if(l[i].classList.contains("e-datepicker"))t.getComponent(l[i],"datepicker").destroy();else if(l[i].classList.contains("e-multiselect"))t.getComponent(l[i],"multiselect").destroy();else if(l[i].className.indexOf("e-template")>-1)for(var s=l[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],l[i].id);break}document.getElementById(l[i].id)&&t.detach(l[i])}for(var i=0,o=r.length;i<o;i++){if(r[i].className.indexOf("e-template")>-1)for(var s=r[i].className,a=0,u=n.length;a<u;a++)if(n[a].template&&s.indexOf(n[a].field)>-1){this.templateDestroy(n[a],r[i].id);break}t.detach(r[i])}},d.prototype.templateDestroy=function(e,l){var r=e.template.destroy;e.template&&e.template.destroy&&("string"==typeof r?(r=t.getValue(r,window))({elementId:l}):e.template.destroy({elementId:l}))},d.prototype.getDistinctValues=function(e,t){for(var l={},r=[],n=0,i=e.length;n<i;n++){var o=e[n][t];Number(e[n][t])===e[n][t]&&e[n][t]%1!=0&&(o=e[n][t].toString());var s={};o in l||(l[o]=1,s[t]=o,r.push(s))}return r},d.prototype.renderMultiSelect=function(e,t,l,i){var o,s=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(s=!0,o=this.getDistinctValues(this.dataColl,e.field)),new r.MultiSelect({dataSource:s?o:this.dataManager,query:new n.Query([e.field]),fields:{text:e.field,value:e.field},value:i,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l)}).appendTo("#"+t+"_valuekey"+l)},d.prototype.multiSelectOpen=function(e,l){var r=this;if(this.dataSource instanceof n.DataManager){var i=document.getElementById(e),o=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),s=this.columns[o.index].field,u=!1;if(this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(s)>-1&&(u=!0),!u){l.cancel=!0;var p=t.getComponent(i,"multiselect");p.hideSpinner();var d=this.dataManager.executeQuery((new n.Query).select(s)),c=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),d.then(function(e){r.dataColl=t.extend(r.dataColl,e.result,[],!0);var l=r.getDistinctValues(r.dataColl,s);p.dataSource=l,a.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){c.reject(e)})}}},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),a.createSpinner({target:l,width:t.Browser.isDevice?"16px":"14px"})},d.prototype.closePopup=function(e,l){var r=document.getElementById(l.popup.element.id.replace("_popup","")),n=t.getComponent(r,"multiselect").value;this.updateRules(r,n,e)},d.prototype.processTemplate=function(e,l,r,n){var i=t.closest(e,".e-rule-container").querySelectorAll(".e-template");i.length<2?l.template&&"string"==typeof l.template.write?t.getValue(l.template.write,window)({elements:i[0],values:r.value,operator:n.operator}):l.template&&l.template.write&&l.template.write({elements:i[0],values:r.value,operator:n.operator}):l.template&&"string"==typeof l.template.write?t.getValue(l.template.write,window)({elements:i,values:r.value,operator:n.operator}):l.template&&l.template.write&&l.template.write({elements:i,values:r.value,operator:n.operator})},d.prototype.getItemData=function(e){var l=t.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist");return this.columns[l.index]},d.prototype.renderStringValue=function(e,t,l,r,n){var o,s=this.getItemData(e),a=this.isImportRules?t.value:"";if("in"!==l&&"notin"!==l||!this.dataColl.length){"in"!==l&&"notin"!==l||(a=(o=this.isImportRules?t.value:[]).join(","));var u=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,r)});u.appendTo("#"+e+"_valuekey"+r),u.value=a,u.dataBind()}else o=this.isImportRules?t.value:[],this.renderMultiSelect(s,e,r,o),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?n.style.width="100%":(n.style.width=null,n.style.minWidth="200px")},d.prototype.renderNumberValue=function(e,l,r,n,o,s,a){var u,p=this.isImportRules?l.value:0,d=this.getItemData(e);if("in"!==r&&"notin"!==r||!this.dataColl.length)if("in"===r||"notin"===r){var c=(u=this.isImportRules?l.value:[]).join(","),h=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,n)});h.appendTo("#"+e+"_valuekey"+n),h.value=c,h.dataBind()}else{var m=t.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist"),g=(s=this.columns[m.index]).validation&&s.validation.min?s.validation.min:0,v=s.validation&&s.validation.max?s.validation.max:Number.MAX_VALUE,y=s.format?s.format:"n";a>1&&l&&(p=l.value[n]?l.value[n]:0),new i.NumericTextBox({value:p,format:y,min:g,max:v,width:"100%",step:s.step?s.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}else u=this.isImportRules?l.value:[],this.renderMultiSelect(d,e,n,u),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?o.style.width="100%":(o.style.minWidth="200px",o.style.width=null)},d.prototype.processValueString=function(e,t){var l=[],r=e.split(",");if("string"===t)return r;for(var n=0,i=r.length;n<i;n++)l.push(Number(r[n]));return l},d.prototype.renderControls=function(e,r,n,i){if(t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),r.template)this.processTemplate(e,r,n,i);else{var s="boolean"===i.type||i.operator&&i.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"!==i.operator&&"notin"!==i.operator&&(u.style.width="200px");for(var p=0;p<s;p++)switch(i.type){case"string":this.renderStringValue(a,n,i.operator,p,u);break;case"number":this.renderNumberValue(a,n,i.operator,p,u,r,s);break;case"boolean":var d=r.values&&r.values.length?r.values:["True","False"],c=!this.isImportRules||Boolean(n.value),h=new l.RadioButton({label:d[p].toString(),name:a+"default",checked:c,value:d[p],change:this.changeValue.bind(this,p)});h.appendTo("#"+a+"_valuekey"+p),this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,g=void 0;if(this.isImportRules&&n&&n.value){m=s>1?new Date(n.value[p]):new Date(n.value);var v=void 0,y=this.getColumn(n.field);if(g=s>1?n.value[p]:n.value,y.format){var f=this.intl.getDateParser({skeleton:"full",type:"dateTime"});v={type:"dateTime",format:y.format},"Invalid Date"===m.toLocaleDateString()&&(m=f(g),t.isNullOrUndefined(m)&&(m=this.intl.parseDate(g,v)))}}(r.format?new o.DatePicker({value:m,format:r.format,change:this.changeValue.bind(this,p)}):new o.DatePicker({value:m,change:this.changeValue.bind(this,p)})).appendTo("#"+a+"_valuekey"+p),n.value||this.updateRules(document.getElementById(a+"_valuekey"+p),m)}}}},d.prototype.getOperatorIndex=function(e,t){var l,r=e.dataSource.length;for(l=0;l<r;l++)if(t.operator===e.dataSource[l].value)return l;return 0},d.prototype.renderValues=function(e,l,r,n,i,o,s){if(n){var a=t.getComponent(e.querySelector("input"),"dropdownlist");l.operators?(a.dataSource=l.operators,a.index=this.getOperatorIndex(a,i),a.value=o.operator=a.dataSource[a.index].value,a.dataBind()):l.type&&(a.dataSource=this.customOperators[l.type+"Operator"],a.index=this.getOperatorIndex(a,i),a.value=o.operator=a.dataSource[a.index].value,a.dataBind())}var u=t.closest(e,".e-rule-container").id;r&&r.template&&(this.templateDestroy(r,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(l.template=this.columns[d.index].template,l.template){l.template=this.columns[d.index].template;g=void 0;if(l.template&&"string"==typeof l.template.create?g=t.getValue(l.template.create,window)():l.template&&l.template.create&&(g=l.template.create()),g instanceof Element)g.id=u+"_valuekey0",t.addClass([g],"e-template"),t.addClass([g],"e-"+l.field),e.nextElementSibling.appendChild(g);else if(g instanceof Array){t.addClass(g,"e-template");for(var c=0,h=g.length;c<h;c++)g[c].id=u+"_valuekey"+c,e.nextElementSibling.appendChild(g[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"===o.type||o.operator&&o.operator.toLowerCase().indexOf("between")>-1)for(c=0;c<2;c++){g=void 0;g=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+c}}),e.nextElementSibling.appendChild(g)}else{var g=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey0"}});e.nextElementSibling.appendChild(g)}this.renderControls(e,l,i,o)},d.prototype.updateValues=function(e,l){var r=e.className.split(" e-")[1],n=parseInt(e.id.slice(-1),2);switch(r){case"textbox":case"dropdownlist":l.value=t.getComponent(e,r).value;break;case"radio":var i=t.getComponent(e,r);i.checked=!0,i.refresh(),l.value=i.value;break;case"numerictextbox":l.operator.indexOf("between")>-1?l.value[n]=t.getComponent(e,r).value:l.value=t.getComponent(e,r).value;break;case"datepicker":var o={type:"dateTime",format:this.getColumn(l.field).format};l.operator.indexOf("between")>-1?l.value[n]=t.getComponent(e,r).value:t.isNullOrUndefined(o.format)?l.value=this.intl.formatDate(t.getComponent(e,r).value):l.value=this.intl.formatDate(t.getComponent(e,r).value,o)}},d.prototype.updateRules=function(e,l,r){for(var n,i,o,s=t.closest(e,".e-group-container"),a=this.getGroup(s),u=t.closest(e,".e-rule-container"),p=0,d=s.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,p++;if(u=t.closest(e,".e-rule-container"),o=u.id.replace(this.element.id+"_",""),t.closest(e,".e-rule-filter")){n=t.getComponent(e,"dropdownlist"),this.isImportRules||a.rules[p].field.toLowerCase()===this.columns[n.index].field.toLowerCase()||(a.rules[p].value=""),a.rules[p].field=this.columns[n.index].field,a.rules[p].type=this.columns[n.index].type,a.rules[p].label=this.columns[n.index].label;var h=t.closest(e,".e-rule-filter"),m=h.nextElementSibling.querySelector("input.e-control"),g=t.getComponent(m,"dropdownlist").value;a.rules[p].operator=g,(m=h.nextElementSibling.nextElementSibling.querySelector("input.e-control"))||(m=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),m||(m=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:a.rules[p].field,type:"field"},this.updateValues(m,a.rules[p]),this.triggerEvents(i),this.allowValidation&&a.rules[p].field&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),this.filterRules(c,this.getValidRules(this.rule),"field")}else if(t.closest(e,".e-rule-operator")){n=t.getComponent(e,"dropdownlist"),a.rules[p].operator=n.value;var v=void 0;e.parentElement;v=u.querySelectorAll(".e-rule-value input.e-control"),i={groupID:d,ruleID:o,value:n.value,type:"operator"},this.allowValidation&&a.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),v.length>1&&(a.rules[p].value=[]);for(var y=0;y<v.length;y++)this.updateValues(v[y],a.rules[p]);this.triggerEvents(i),this.filterRules(c,this.getValidRules(this.rule),"operator")}else t.closest(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,p,s,u,r),this.filterRules(c,this.getValidRules(this.rule),"value"))},d.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,rule:e.rules})!==JSON.stringify({condition:t.condition,rule:t.rules})&&this.triggerEvents({previousRule:e,rule:t,type:l},"ruleChange")},d.prototype.ruleValueUpdate=function(e,l,n,i,o,s,a){var u,p,d=["in","between","notin","notbetween"];if(null!==l){if(n.rules[i].operator&&(p=n.rules[i].operator.toLowerCase()),e.className.indexOf("e-multiselect")>-1&&"number"===n.rules[i].type){for(var c=[],h=l,m=0,g=h.length;m<g;m++)"string"==typeof h[m]&&c.push(parseFloat(h[m]));c.length&&(l=c)}if(e.className.indexOf("e-template")>-1)l instanceof Array?d.indexOf(p)>-1?n.rules[i].value=l:n.rules[i].value=l[0]:n.rules[i].value=l,u={groupID:o.id,ruleID:s.id,value:n.rules[i].value,type:"value"},this.triggerEvents(u);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)d.indexOf(p)>-1?n.rules[i].value[a]=l:n.rules[i].value=l;else if(e.className.indexOf("e-radio")>-1)n.rules[i].value=l;else if(e.className.indexOf("e-multiselect")>-1)n.rules[i].value=l;else if(e.className.indexOf("e-textbox")>-1)"in"===p||"notin"===p?(n.rules[i].type,n.rules[i].value=this.processValueString(l,n.rules[i].type)):n.rules[i].value=l;else if(e.className.indexOf("e-datepicker")>-1){var v=t.getInstance(s.querySelector(".e-rule-filter input"),r.DropDownList),y={type:"dateTime",format:this.columns[v.index].format||"MM/dd/yyyy"};y.type&&(d.indexOf(p)>-1?n.rules[i].value[a]=this.intl.formatDate(l,y):n.rules[i].value=this.intl.formatDate(l,y))}this.validatValue(n,i,s)}},d.prototype.validatValue=function(e,l,r){if(this.allowValidation&&e.rules[l].value){var n=r.querySelectorAll(".e-rule-value .e-control");n[0].className.indexOf("e-tooltip")>-1?t.getComponent(n[0],"tooltip").destroy():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,l){var r=t.rules,n=[];if(!l){for(var i=0,o=r.length;i<o;i++)(t=r[i]).rules&&n.push(t);return n[e]}return t},d.prototype.destroy=function(){if(this.element){var l,r,n;for(e.prototype.destroy.call(this),n=(l=this.element.querySelectorAll(".e-addrulegroup")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdown-btn").destroy(),t.detach(l[r]);for(n=(l=this.element.querySelectorAll(".e-rule-filter .e-control")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdownlist").destroy(),t.detach(l[r]);for(n=(l=this.element.querySelectorAll(".e-rule-operator .e-control")).length,r=0;r<n;r++)t.getComponent(l[r],"dropdownlist").destroy(),t.detach(l[r]);this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_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){t=this.element.id+"_"+t;for(var l=0,r=e.length;l<r;l++)this.addRuleElement(document.getElementById(t),e[l])},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var l=document.getElementById(t),r=this.getGroup(l);if(e.length)for(var n=0,i=e.length;n<i;n++)this.importRules(e[n],l);else r.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.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();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 l=document.querySelectorAll("label.e-btn"),r=void 0,n=0;n<l.length;n++)r=l.item(n),t.rippleEffect(r,{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"},styles:"max-height:500px"}),l=this.createElement("button",{attrs:{class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),r=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),r.appendChild(l),e.appendChild(r),this.element.appendChild(e)},d.prototype.renderSummaryCollapse=function(){var e=this.createElement("div",{attrs:{class:"e-collapse-rule e-icons",title:this.l10n.getConstant("SummaryViewTitle")}});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,l){for(var r=0,n=Object.keys(e);r<n.length;r++)switch(n[r]){case"summaryView":var i=this.element.querySelector(".e-group-container"),o=this.element.querySelector(".e-summary-content");e.summaryView?(i.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),o=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),o.style.display="block"):(i.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),i.style.display="block",o.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":l.cssClass&&t.removeClass([this.element],l.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,e.rule=this.getRuleCollection(this.rule,!1);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new t.Internationalization(this.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",In:"In",NotIn:"Not In",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",SummaryViewTitle:"Summary View"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],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",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.dataSource instanceof n.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new n.Query).take(1))):(this.dataManager=new n.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new n.Query),this.initControl())},d.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),r=new n.Deferred;l.then(function(e){t.dataColl=e.result,t.initControl()}).catch(function(e){r.reject(e)})},d.prototype.initControl=function(){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 l=this.levelColl[e.id],r=t?l.length-1:l.length,n=this.rule,i=0;i<r;i++)n=this.findGroupByIdx(l[i],n,0===i);return n},d.prototype.deleteGroup=function(e){var l,r,n=e,i=n.id.replace(this.element.id+"_",""),o=this.getGroup(n,!0),s=0,a={groupID:i,cancel:!1,type:"deleteGroup"},u=this.getValidRules(this.rule);if(!(a=this.triggerEvents(a,"before")).cancel){var p=n.nextElementSibling,d=n.previousElementSibling,c=n.querySelectorAll(".e-group-container"),h=e.querySelectorAll(".e-tooltip");for(r=h.length,l=0;l<r;l++)t.getComponent(h[l],"tooltip").destroy();for(l=0,r=c.length;l<r;l++)delete this.levelColl[c[l].id];for(;null!==n.previousElementSibling;)n=n.previousElementSibling,s++;p&&p.className.indexOf("e-separate-rule")>-1&&(t.removeClass([p],"e-separate-rule"),t.addClass([p],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&t.addClass([d],"e-prev-joined-rule")),o.rules.splice(s,1),delete this.levelColl[i],t.detach(e),this.refreshLevelColl(),this.triggerEvents(a),this.filterRules(u,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.deleteRule=function(e){var l,r,n=t.closest(e,".e-group-container"),i=this.getGroup(n),o=t.closest(e,".e-rule-container");r=n.id.replace(this.element.id+"_",""),l=t.closest(e,".e-rule-container").id.replace(this.element.id+"_","");var s=this.getValidRules(this.rule),a={groupID:r,ruleID:l,cancel:!1,type:"deleteRule"};if(!(a=this.triggerEvents(a,"before")).cancel){var u,p=o,d=o.nextElementSibling,c=o.previousElementSibling,h=0,m=o.querySelectorAll(".e-tooltip"),g=m.length;for(u=0;u<g;u++)t.getComponent(m[u],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,h++;i.rules.splice(h,1),(!c||c.className.indexOf("e-rule-container")<0)&&d&&t.removeClass([d],"e-joined-rule"),(!d||d.className.indexOf("e-rule-container")<0)&&c&&t.removeClass([c],"e-prev-joined-rule"),t.detach(p),this.triggerEvents(a),this.filterRules(s,this.getValidRules(this.rule),"deleteRule")}},d.prototype.setGroupRules=function(e){this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.rule=e,e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0),this.isImportRules=!1},d.prototype.getValidRules=function(e){var l=e.condition,r=t.extend([],e.rules,[],!0);return this.getRuleCollection({condition:l,rules:r},!0)},d.prototype.getRuleCollection=function(e,t){var l;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||t))for(var r=e.rules.length,n=0;n<r;n++)l=e.rules[n],l=this.getRuleCollection(l,t),e.rules[n]=l,Object.keys(l).length<1&&t&&(e.rules.splice(n,1),n--,r--);return e=e.condition?{condition:e.condition,rules:e.rules}:""!==e.field&&""!==e.operator&&""!==e.value?{label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value}:{}},d.prototype.setRules=function(e){var l=t.extend({},e,{},!0);this.setGroupRules(l)},d.prototype.getRules=function(){return this.rule},d.prototype.deleteGroups=function(e){var t,l,r=e.length;for(t=0;t<r;t++)l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l))},d.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),t=(new n.Query).where(e);return this.dataManager.executeQuery(t)},d.prototype.deleteRules=function(e){var t,l,r=e.length;for(t=0;t<r;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},d.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],r=0,i=Object.keys(this.columns);r<i.length;r++)l.push(this.columns[r].field);return e.rules.length?(new n.Query).select(l).where(t):(new n.Query).select(l)},d.prototype.getPredicate=function(e){for(var t,l,r,i,o=e.rules,s=!1,a=0,u=o.length;a<u;a++)if(Object.keys(o[a]).indexOf("rules")>-1)(l=this.getPredicate(o[a]))&&(t=t?"and"===e.condition?t.and(l):t.or(l):l);else if(o[a].operator.length){var p=o[a].operator.toLowerCase(),d=["equal","notequal"];if(s=["contains","startswith","endswith"].indexOf(p)>-1||"date"===o[a].type&&d.indexOf(p)>-1,i=this.getColumn(o[a].field),"date"===o[a].type){var c={type:"dateTime",format:i.format||"MM/dd/yyyy"};r=this.intl.parseDate(o[a].value,c)}else r=o[a].value;if(0===a)(p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p?t=this.arrayPredicate(o[a]):""!==(h=r)&&(t=new n.Predicate(o[a].field,o[a].operator,r,s));else if("and"===e.condition)if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{h=r;t&&""!==h?t=t.and(o[a].field,o[a].operator,r,s):""!==h&&(t=new n.Predicate(o[a].field,o[a].operator,r,s))}else if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[a],t,e.condition);else{var h=r;t&&""!==h?t=t.or(o[a].field,o[a].operator,r,s):""!==h&&(t=new n.Predicate(o[a].field,o[a].operator,r,s))}}return t},d.prototype.getColumn=function(e){for(var t,l=this.columns,r=0,n=l.length;r<n;r++)l[r].field===e&&(t=l[r]);return t},d.prototype.arrayPredicate=function(e,t,l){for(var r,i=e.value,o=0,s=i.length;o<s;o++)if(""!==i[o])if(0===o)switch(e.operator){case"between":r=new n.Predicate(e.field,"greaterthan",i[o]);break;case"notbetween":r=new n.Predicate(e.field,"lessthan",i[o]);break;case"in":r=new n.Predicate(e.field,"equal",i[o]);break;case"notin":r=new n.Predicate(e.field,"notequal",i[o])}else switch(e.operator){case"between":r=r.and(e.field,"lessthan",i[o]);break;case"notbetween":r=r.or(e.field,"greaterthan",i[o]);break;case"in":r=r.or(e.field,"equal",i[o]);break;case"notin":r=r.and(e.field,"notequal",i[o])}return r&&(t?"and"===l?t=t.and(r):"or"===l&&(t=t.or(r)):t=r),t},d.prototype.importRules=function(e,l,r){r||(l=this.renderGroup(e.condition,l));var n=e.rules;if(!t.isNullOrUndefined(n))for(var i=0,o=n.length;i<o;i++){var s=Object.keys(n[i]);!t.isNullOrUndefined(n[i].rules)&&s.indexOf("rules")>-1?(l=this.renderGroup(n[i].condition,l),l=this.importRules(n[i],l,!0)):this.renderRule(n[i],l)}return(l=t.closest(l,".e-rule-list"))&&(l=t.closest(l,".e-group-container")),l},d.prototype.renderGroup=function(e,t){this.addGroupElement(!0,t,e);var l=t.querySelectorAll(".e-group-container");return l[l.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 l=!1;t?t+="(":(t="",l=!0);for(var r=e.condition,n=0,i=e.rules.length;n<i;n++){if(e.rules[n].rules)t=this.getSqlString(e.rules[n],t);else{var o=e.rules[n],s="";if(o.value instanceof Array)if(o.operator.indexOf("between")>-1)s+=o.value[0]+" AND "+o.value[1];else if("string"==typeof o.value[0]){s+='("'+o.value[0]+'"';for(var a=1,u=o.value.length;a<u;a++)s+=',"'+o.value[a]+'"';s+=")"}else s+="("+o.value+")";else"startswith"===o.operator?s+='("'+o.value+'%")':"endswith"===o.operator?s+='("%'+o.value+'")':"contains"===o.operator?s+='("%'+o.value+'%")':"number"===o.type?s+=o.value:s+='"'+o.value+'"';t+=o.field+" "+this.operators[o.operator]+" "+s}n!==i-1&&(t+=" "+r+" ")}return l||(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 e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e)).replace(/"/g,"'")},d.prototype.sqlParser=function(e){var t,l=0;do{t=e.slice(l),l+=this.parseSqlStrings(t)}while(""!==t);return this.parser},d.prototype.parseSqlStrings=function(e){for(var t,l,r=["=","!=","<",">","<=",">="],n=["and","or"],i=["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN"],o=0,s=r.length;o<s;o++)if(t=/^\w+$/.test(r[o])?"\\b":"",new RegExp("^("+r[o]+")"+t,"ig").exec(e))return this.parser.push(["Operators",r[o].toLowerCase()]),r[o].length;for(var o=0,s=n.length;o<s;o++)if(t=/^\w+$/.test(n[o])?"\\b":"",new RegExp("^("+n[o]+")"+t,"ig").exec(e))return this.parser.push(["Conditions",n[o].toLowerCase()]),n[o].length;for(var o=0,s=i.length;o<s;o++)if(t=/^\w+$/.test(i[o])?"\\b":"",new RegExp("^("+i[o]+")"+t,"ig").exec(e))return this.parser.push(["SubOperators",i[o].toLowerCase()]),i[o].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)?(l=/^`?([a-z_][a-z0-9_]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",l]),l.length):/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)?(l=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0],this.parser.push(["String",l]),l.length):/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(l=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",l]),l.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(l=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",l]),l.length):1},d.prototype.getOperator=function(e,t){var l={"=":"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":l[t]},d.prototype.processParser=function(e,t,l){for(var r,n,i,o,s,a,u,p,d,c,h=[],m=[],g=0,v=e.length;g<v;g++)if("Literal"===e[g][0]){if(r={label:e[g][1],field:e[g][1]},"SubOperators"===e[g+1][0]){for(r.operator=this.getOperator(e[g+3][1].replace(/'/g,""),e[g+1][1]),c=e[g+1][1],i=++g+1,o=v,i=g+1;i<o;i++){if("Right"===e[i][0]){g=i;break}if("like"===c&&"String"===e[i][0])r.value=e[i][1].replace(/'/g,"").replace(/%/g,""),r.type="string";else if("between"===c){if("Literal"===e[i][0]||"Left"===e[i][0])break;"Number"===e[i][0]&&h.push(Number(e[i][1]))}else"Number"===e[i][0]?h.push(Number(e[i][1])):"String"===e[i][0]&&m.push(e[i][1].replace(/'/g,""))}"like"!==c&&("Number"===e[i-1][0]?(r.value=h,r.type="number"):"String"===e[i-1][0]?(r.value=m,r.type="string"):"between"===c&&"Conditions"===e[i-1][0]&&(r.value=h,r.type="number"))}else"Operators"===e[g+1][0]&&(r.operator=this.getOperator(e[g+2][1],e[g+1][1]),"Number"===e[g+2][0]?(r.type="number",r.value=Number(e[g+2][1])):(r.type="string",r.value=e[g+2][1].replace(/'/g,"")));t.rules.push(r)}else{if("Left"===e[g][0]){for(n={condition:"",rules:[]},this.parser=e.splice(g+1,v-(g+1)),d=0,a=t.rules.length,s=0;s<a;s++)t.rules[s].rules&&d++;return l.push(d),t.rules.push(n),n=this.processParser(this.parser,n,l),t}if("Conditions"===e[g][0])t.condition=e[g][1];else if("Right"===e[g][0]){for(this.parser=e.splice(g+1,v-(g+1)),l.pop(),t=this.rule,p=l.length,u=0;u<p;u++)t=this.findGroupByIdx(l[u],t,0===u);return this.processParser(this.parser,t,l)}}return t},p([t.Event()],d.prototype,"created",void 0),p([t.Event()],d.prototype,"beforeChange",void 0),p([t.Event()],d.prototype,"change",void 0),p([t.Event()],d.prototype,"ruleChange",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:[]},c)],d.prototype,"rule",void 0),d=p([t.NotifyPropertyChanges],d)}(t.Component);return e.Columns=d,e.Rule=c,e.ShowButtons=h,e.QueryBuilder=m,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 : 17.1.42 | ||
* version : 17.1.43 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"name": "@syncfusion/ej2-querybuilder", | ||
"version": "17.1.42", | ||
"version": "17.1.43", | ||
"description": "Essential JS 2 QueryBuilder", | ||
@@ -11,6 +11,6 @@ "author": "Syncfusion Inc.", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~17.1.42", | ||
"@syncfusion/ej2-base": "~17.1.43", | ||
"@syncfusion/ej2-buttons": "~17.1.42", | ||
"@syncfusion/ej2-calendars": "~17.1.42", | ||
"@syncfusion/ej2-dropdowns": "~17.1.42", | ||
"@syncfusion/ej2-calendars": "~17.1.43", | ||
"@syncfusion/ej2-dropdowns": "~17.1.43", | ||
"@syncfusion/ej2-splitbuttons": "~17.1.42", | ||
@@ -17,0 +17,0 @@ "@syncfusion/ej2-inputs": "~17.1.42" |
@@ -284,2 +284,3 @@ /** | ||
private processTemplate; | ||
private getItemData; | ||
private renderStringValue; | ||
@@ -289,2 +290,3 @@ private renderNumberValue; | ||
private renderControls; | ||
private getOperatorIndex; | ||
private renderValues; | ||
@@ -291,0 +293,0 @@ private updateValues; |
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
1744607
19967