@syncfusion/ej2-querybuilder
Advanced tools
Comparing version 17.1.51 to 17.2.28-beta
@@ -7,5 +7,5 @@ # Changelog | ||
#### Bug Fixes | ||
#### New Features | ||
- DataManager related issue resolved. | ||
- Provided localization support for 'AND/OR' conditions. | ||
@@ -12,0 +12,0 @@ ## 17.1.50 (2019-06-04) |
/*! | ||
* filename: ej2-querybuilder.umd.min.js | ||
* version : 17.1.51 | ||
* version : 17.2.28-beta | ||
* 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),p([t.Property(null)],l.prototype,"value",void 0),p([t.Property(null)],l.prototype,"category",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=!1,i=void 0,o={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var s=0,a=(u=this.columns).length;s<a;s++)u[s].type||(e.indexOf(u[s].field)>-1&&("string"===(l=typeof(i=this.dataColl[0][u[s].field]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),u[s].type=l,n=!1),l="string"),u[s].validation||(u[s].validation=o),u[s].category?r=!0:u[s].category=this.l10n.getConstant("OtherFields");r&&(this.fields={text:"label",value:"field",groupBy:"category"})}else{for(s=0,a=e.length;s<a;s++)"string"===(l=typeof(i=this.dataColl[0][e[s]]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),t[s]={field:e[s],label:e[s],type:n?"date":l,validation:o},n=!1;this.columns=t}}else if(this.columns.length){var u;for(s=0,a=(u=this.columns).length;s<a;s++)u[s].category?this.fields={text:"label",value:"field",groupBy:"category"}:u[s].category=this.l10n.getConstant("OtherFields")}},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.getParentGroup(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"),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 r.DropDownList({dataSource:this.columns,fields:this.fields,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"),o=this.levelColl[e.id],this.selectedColumn=d.getDataByValue(d.value),!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.selectedColumn}),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.getParentGroup(s),a=0,i=p=c[l],u=t.getComponent(c[l].querySelector(".e-rule-field input.e-control"),"dropdownlist"),this.selectedColumn=u.getDataByValue(u.value),h=!t.isNullOrUndefined(u.index)&&this.selectedColumn.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,g=m.length;f<g;f++){var y=m[f],v=void 0;y.parentElement.className.indexOf("e-searcher")>-1?(v=t.closest(y,".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 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 f=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";u=this.createElement("button",{attrs:{class:f}});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 g=r.querySelector(".e-rule-list"),y=g.children,v=0,C=0,b=y.length;C<b;C++)y[C].className.indexOf("e-group-container")>-1&&(v+=1);g.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&&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.selectedColumn=c.getDataByValue(c.value),this.selectedColumn.values)p=this.selectedColumn.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.getParentGroup(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=e.operator?e.operator.toLowerCase():"",d=t.closest(l.element,".e-rule-filter");s=t.closest(l.element,".e-rule-operator");var c,h,m=t.getComponent(l.element,"dropdownlist"),f=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_","");if(d){if(this.selectedColumn=m.getDataByValue(m.value),i=t.closest(d,".e-rule-container"),o=i.id.replace(this.element.id+"_",""),h={groupID:f,ruleID:o,selectedField:m.value,cancel:!1,type:"field"},(h=this.triggerEvents(h,"before")).cancel)return;u.type=this.selectedColumn.type,i.querySelector(".e-template")&&(e.value="")}if(s){if(i=t.closest(s,".e-rule-container"),o=i.id.replace(this.element.id+"_",""),h={groupID:f,ruleID:o,selectedIndex:m.index,cancel:!1,type:"operator"},(h=this.triggerEvents(h,"before")).cancel)return;u.operator=m.value;var g=u.operator.toLowerCase();if(u.operator.toLowerCase().indexOf("between")>-1||u.operator.toLowerCase().indexOf("in")>-1&&u.operator.toLowerCase().indexOf("contains")<0?(d=s.previousElementSibling,u.type=e.type,(u.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)&&(d=s.previousElementSibling,u.type=e.type)}p.indexOf("in")>-1&&p.indexOf("in")<5&&g.indexOf("in")>-1&&g.indexOf("in")<5&&(d=null)}if(d)if(s=d.nextElementSibling,t.addClass([s],"e-operator"),s.childElementCount)n=t.getComponent(s.querySelector(".e-dropdownlist"),"dropdownlist"),u.operator=n.value,this.renderValues(s,l.itemData,l.previousItemData,!0,e,u,l.element);else{var v=t.closest(s,".e-rule-container").id;c=this.createElement("input",{attrs:{type:"text",id:v+"_operatorkey"}}),s.appendChild(c),this.selectedColumn.operators?a=this.selectedColumn.operators:l.itemData&&(a=this.customOperators[this.selectedColumn.type+"Operator"]);var C=this.element.className.indexOf("e-device")>-1?"250px":"200px";new r.DropDownList({dataSource:a,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:a.length>5?C:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+v+"_operatorkey"),u.operator=e&&""!==e.operator?e.operator:a[0].value,this.isImportRules&&(u.type=this.selectedColumn.type,u.operator=e.operator),this.renderValues(s,this.selectedColumn,l.previousItemData,!1,e,u,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,o){var s,a=!1,u=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(a=!0,s=this.getDistinctValues(this.dataColl,e.field)),!this.dataColl.length&&o.length&&(u=!0);var p=new r.MultiSelect({dataSource:u?o:a?s: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)});p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},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");this.selectedColumn=o.getDataByValue(o.value);var s=this.selectedColumn.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,c=this.dataManager.executeQuery((new n.Query).select(s)),h=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),c.then(function(e){d=e.actual&&e.actual.result?e.actual.result:e.result,r.dataColl=t.extend(r.dataColl,d,[],!0);var l=r.getDistinctValues(r.dataColl,s);p.dataSource=l,a.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){h.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.setDefaultValue=function(e,l,r){var n=this.getItemData(e);if(t.isNullOrUndefined(n.value))return r?l?[0,0]:0:l?[]:"";if(l){if(!(n.value instanceof Array))return[n.value]}else if(n.value instanceof Array)return n.value[0];return n.value},d.prototype.renderStringValue=function(e,t,l,r,n){var o,s,a=this.getItemData(e);if(s=this.isImportRules||this.isPublic?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1)).join(","));var u=new i.TextBox({placeholder:"Value",input:this.changeValue.bind(this,r)});u.appendTo("#"+e+"_valuekey"+r),u.value=s,u.dataBind()}else o=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,r,o,a.values),"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=this.getItemData(e),p=this.isImportRules||this.isPublic?l.value:this.setDefaultValue(e,!1,!0);if("in"!==r&&"notin"!==r||!this.dataColl.length&&!u.values)if("in"===r||"notin"===r){var d=(p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1)).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,f=s.validation&&s.validation.max?s.validation.max:Number.MAX_VALUE,g=s.format?s.format:"n";a>1&&l&&(p=l.value[n]?l.value[n]:this.setDefaultValue(e,!0,!0));new i.NumericTextBox({value:p instanceof Array?p[n]:p,format:g,min:m,max:f,width:"100%",step:s.step?s.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}else p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(u,e,n,p,u.values),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.parseDate=function(e,l){var r,n;if(l){r={type:"dateTime",format:l},n=this.intl.getDateParser({skeleton:"full",type:"dateTime"})(e),t.isNullOrUndefined(n)&&(n=this.intl.parseDate(e,r))}else n=new Date(e);return n},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;s="boolean"===i.type?this.selectedColumn.values?this.selectedColumn.values.length:2:i.operator&&i.operator.toLowerCase().indexOf("between")>-1?2:1;var 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=!1;"boolean"===n.type&&n.value?c=d[p].toLowerCase()===n.value.toString().toLowerCase():r.value?c=d[p].toLowerCase()===r.value.toString().toLowerCase():0===p&&(c=!0);var 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),c&&this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,f=void 0,g=void 0,y=r.format;r.value&&(m=r.value instanceof Date?r.value:r.value instanceof Number?new Date(r.value):this.parseDate(r.value,r.format)),(this.isImportRules||this.isPublic)&&n&&n.value&&(g=this.getColumn(n.field),f=s>1?n.value[p]:n.value,m=this.parseDate(f,g.format),y=g.format),(y?new o.DatePicker({value:m,format:y,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;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 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{var g=1;g="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:o.operator&&o.operator.toLowerCase().indexOf("between")>-1?2:1;for(h=0;h<g;h++){c=void 0;c=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+h}}),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":l.value=t.getComponent(e,r).value;break;case"radio":var i=t.getComponent(e,r);i.checked&&(l.value=i.value),i.refresh();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);break;case"multiselect":l.value=t.getComponent(e,r).value}},d.prototype.updateRules=function(e,l,r){for(var n,i,o,s=t.closest(e,".e-group-container"),a=this.getParentGroup(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=""),this.selectedColumn=n.getDataByValue(n.value),a.rules[p].field=this.selectedColumn.field,a.rules[p].type=this.selectedColumn.type,a.rules[p].label=this.selectedColumn.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;var g=h.nextElementSibling.nextElementSibling,y=g.querySelectorAll("input.e-control");y.length<1&&(y=g.querySelectorAll(".e-template"));for(var v=0;v<y.length;v++)y[v]||(y[v]=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),y[v]||(y[v]=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:a.rules[p].field,type:"field"},this.updateValues(y[v],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 C=void 0;e.parentElement;C=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(),C.length>1&&(a.rules[p].value=[]);for(var b=0;b<C.length;b++)this.updateValues(C[b],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,f=h.length;m<f;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 g=t.getInstance(s.querySelector(".e-rule-filter input"),r.DropDownList),y={type:"dateTime",format:this.columns[g.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,this.isPublic=!0;for(var l=0,r=e.length;l<r;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var l=document.getElementById(t),r=this.getParentGroup(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",OtherFields:"Other Fields"},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"},this.fields={text:"label",value:"field"}},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){e.actual&&e.actual.result?t.dataColl=e.actual.result: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.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[e],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.getParentGroup(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.getParentGroup(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"),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 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.getRule=function(e){var l,r,n=0;e instanceof HTMLElement?l=t.closest(e,".e-rule-container"):(r=this.element.id+"_"+e,l=document.getElementById(r));for(var i=t.closest(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,n++;return o.rules[n]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=t.closest(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e,r=this.getParentGroup(l);return{rules:r.rules,condition:r.condition}},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=!this.matchCase,"date"===o[a].type&&["equal","notequal"].indexOf(p)>-1&&(s=!0),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=[],f=0,g=e.length;f<g;f++)if("Literal"===e[f][0]){if(r={label:e[f][1],field:e[f][1]},"SubOperators"===e[f+1][0]){for(r.operator=this.getOperator(e[f+3][1].replace(/'/g,""),e[f+1][1]),c=e[f+1][1],i=++f+1,o=g,i=f+1;i<o;i++){if("Right"===e[i][0]){f=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[f+1][0]&&(r.operator=this.getOperator(e[f+2][1],e[f+1][1]),"Number"===e[f+2][0]?(r.type="number",r.value=Number(e[f+2][1])):(r.type="string",r.value=e[f+2][1].replace(/'/g,"")));t.rules.push(r)}else{if("Left"===e[f][0]){for(n={condition:"",rules:[]},this.parser=e.splice(f+1,g-(f+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[f][0])t.condition=e[f][1];else if("Right"===e[f][0]){for(this.parser=e.splice(f+1,g-(f+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,"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.Property(!1)],d.prototype,"matchCase",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,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),p([t.Property(null)],l.prototype,"value",void 0),p([t.Property(null)],l.prototype,"category",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=!1,i=void 0,o={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var s=0,a=(u=this.columns).length;s<a;s++)u[s].type||(e.indexOf(u[s].field)>-1&&("string"===(l=typeof(i=this.dataColl[0][u[s].field]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),u[s].type=l,n=!1),l="string"),u[s].validation||(u[s].validation=o),u[s].category?r=!0:u[s].category=this.l10n.getConstant("OtherFields");r&&(this.fields={text:"label",value:"field",groupBy:"category"})}else{for(s=0,a=e.length;s<a;s++)"string"===(l=typeof(i=this.dataColl[0][e[s]]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),t[s]={field:e[s],label:e[s],type:n?"date":l,validation:o},n=!1;this.columns=t}}else if(this.columns.length){var u;for(s=0,a=(u=this.columns).length;s<a;s++)u[s].category?this.fields={text:"label",value:"field",groupBy:"category"}:u[s].category=this.l10n.getConstant("OtherFields")}},d.prototype.clickEventHandler=function(e){var l,r=this,n=e.target;this.isImportRules=!1;if("SPAN"===n.tagName&&(n=n.parentElement),n.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"===n.tagName){if(n.className.indexOf("e-removerule")>-1)this.actionButton=n,this.deleteRule(n);else if(n.className.indexOf("e-deletegroup")>-1)this.actionButton=n,this.deleteGroup(t.closest(n,".e-group-container"));else if(n.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"===n.tagName&&n.parentElement.className.indexOf("e-btn-group")>-1){var p=t.closest(n,".e-group-container"),d=n.getAttribute("for"),c=document.getElementById(d).getAttribute("value");l={groupID:p.id.replace(this.element.id+"_",""),cancel:!1,type:"condition",value:c.toLowerCase()},this.isImportRules?this.beforeSuccessCallBack(l,n):this.trigger("beforeChange",l,function(e){r.beforeSuccessCallBack(e,n)})}},d.prototype.beforeSuccessCallBack=function(e,l){if(!e.cancel){var r=t.closest(l,".e-group-container"),n=r.id.replace(this.element.id+"_",""),i=this.getValidRules(this.rule),o=this.getParentGroup(r);o.condition=e.value,this.isImportRules||this.trigger("change",{groupID:n,type:"condition",value:o.condition}),this.filterRules(i,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,t){var l=this;if(e){var r={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules?this.addRuleSuccessCallBack(r,e,t):this.trigger("beforeChange",r,function(r){l.addRuleSuccessCallBack(r,e,t)})}},d.prototype.addRuleSuccessCallBack=function(e,l,n){if(!e.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=void 0,s=void 0,u=void 0,p=void 0,d=void 0,c=l.querySelector(".e-rule-list"),h=i.querySelector("button"),m=void 0,g=void 0;if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)h.textContent=this.l10n.getConstant("Remove"),t.addClass([h],"e-flat"),t.addClass([h],"e-primary");else{t.addClass([h],"e-round"),t.addClass([h],"e-icon-btn");new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(h),h=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),i.querySelector("button").appendChild(h)}if(i.setAttribute("id",l.id+"_rule"+this.ruleIdCounter),this.ruleIdCounter++,i.querySelector(".e-filter-input").setAttribute("id",i.id+"_filterkey"),c.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"),m=this.element.className.indexOf("e-device")>-1?"250px":"200px",(d=new r.DropDownList({dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?m:"auto",change:this.changeField.bind(this),value:n?n.field:null})).appendTo("#"+i.id+"_filterkey"),o=this.levelColl[l.id],this.selectedColumn=d.getDataByValue(d.value),!this.isImportRules){for(s=this.rule,u=0,p=o.length;u<p;u++)s=this.findGroupByIdx(o[u],s,0===u);Object.keys(n).length?s.rules.push({field:n.field,type:n.type,label:n.label,operator:n.operator,value:n.value}):s.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(n).length&&this.changeRule(n,{element:d.element,itemData:this.selectedColumn}),g=i.id.replace(this.element.id+"_",""),this.isImportRules||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:g,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.getParentGroup(s),a=0,i=p=c[l],u=t.getComponent(c[l].querySelector(".e-rule-field input.e-control"),"dropdownlist"),this.selectedColumn=u.getDataByValue(u.value),h=!t.isNullOrUndefined(u.index)&&this.selectedColumn.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,f=m.length;g<f;g++){var y=m[g],v=void 0;y.parentElement.className.indexOf("e-searcher")>-1?(v=t.closest(y,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(v):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:this.l10n.getConstant("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:this.l10n.getConstant("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,t,l,r){var n=this,i={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules?this.addGroupSuccess(i,e,t,l,r):this.trigger("beforeChange",i,function(i){n.addGroupSuccess(i,e,t,l,r)})},d.prototype.addGroupSuccess=function(e,r,n,i,o){if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var u=n,p=void 0,d=this.groupElem.cloneNode(!0);d.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.groupIdCounter++;var c=d.querySelector(".e-btngroup-and"),h=d.querySelector(".e-btngroup-or"),m=d.querySelector(".e-btngroup-and-lbl"),g=d.querySelector(".e-btngroup-or-lbl");if(c.setAttribute("id",this.element.id+"_and"+this.btnGroupId),h.setAttribute("id",this.element.id+"_or"+this.btnGroupId),c.setAttribute("name",this.element.id+"_and"+this.btnGroupId),h.setAttribute("name",this.element.id+"_and"+this.btnGroupId),m.setAttribute("for",this.element.id+"_and"+this.btnGroupId),g.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,r){var f=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";p=this.createElement("button",{attrs:{class:f}});new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(p);new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(p),t.rippleEffect(p,{selector:".deletegroup"}),d.querySelector(".e-group-action").appendChild(p);for(var y=u.querySelector(".e-rule-list"),v=y.children,C=0,b=0,S=v.length;b<S;b++)v[b].className.indexOf("e-group-container")>-1&&(C+=1);y.appendChild(d);var x=this.levelColl[u.id].slice(0);x.push(C),this.levelColl[d.id]=x,this.isImportRules||(this.addGroups([],u.id.replace(this.element.id+"_","")),o&&this.addRuleElement(d,{}))}else u.appendChild(d),this.levelColl[d.id]=[0];d.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===i&&d.querySelector(".e-btngroup-or").setAttribute("checked","true");var w=d.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,w),select:this.selectBtn.bind(this,w)}).appendTo(w),this.isImportRules||this.trigger("change",{groupID:u.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,s=this;if(l.event)o=l.event.target;else{o=l.element}if(o.className.indexOf("e-day")>-1){o=l.element}var a=t.closest(o,".e-group-container"),u=t.closest(o,".e-rule-container");n=a&&a.id.replace(this.element.id+"_",""),i=u.id.replace(this.element.id+"_","");var p=l;p.element&&p.element.className.indexOf("e-datepicker")>-1&&(o=p.element);var d,c,h;if(o.className.indexOf("e-radio")>-1)if(c=parseInt(o.id.split("valuekey")[1],0),h=t.getComponent(t.closest(o,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=h.getDataByValue(h.value),this.selectedColumn.values)d=this.selectedColumn.values[c];else{d=["True","False"][c]}else d=o.className.indexOf("e-multiselect")>-1?t.getComponent(o,"multiselect").value:l.value;r={groupID:n,ruleID:i,value:d,cancel:!1,type:"value"},this.isImportRules?this.changeValueSuccessCallBack(r,o,e,n,i):this.trigger("beforeChange",r,function(t){s.changeValueSuccessCallBack(t,o,e,n,i)})},d.prototype.changeValueSuccessCallBack=function(e,t,l,r,n){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules||this.trigger("change",{groupID:r,ruleID:n,value:e.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.getParentGroup(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 r={},n=t.closest(l.element,".e-rule-filter"),i=t.getComponent(l.element,"dropdownlist"),o=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_",""),s=t.closest(l.element,".e-rule-operator");this.changeFilter(n,i,o,e,r,l),this.isOperatorRendered||this.changeOperator(n,s,i,o,e,r,l),this.isValueRendered||this.changeRuleValues(n,e,r,l),this.isValueRendered=!1,this.isOperatorRendered=!1}},d.prototype.changeFilter=function(e,l,r,n,i,o){var s=this;if(e){this.selectedColumn=l.getDataByValue(l.value);var a=void 0;a={groupID:r,ruleID:t.closest(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:l.value,cancel:!1,type:"field"},this.isImportRules?this.fieldChangeSuccess(a,i,e,n,o):this.trigger("beforeChange",a,function(t){s.fieldChangeSuccess(t,i,e,n,o)})}},d.prototype.changeOperator=function(e,l,r,n,i,o,s){var a,u=this;l&&(a={groupID:n,ruleID:t.closest(l,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:r.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(a,e,o,i,s):this.trigger("beforeChange",a,function(t){u.operatorChangeSuccess(t,e,o,i,s)}))},d.prototype.fieldChangeSuccess=function(e,l,r,n,i){var o=t.closest(r,".e-rule-container");if(e.cancel)this.isOperatorRendered=!0;else{l.type=this.selectedColumn.type,o.querySelector(".e-template")&&(n.value="");var s=t.closest(i.element,".e-group-container"),a=t.closest(i.element,".e-rule-operator"),u=s.id.replace(this.element.id+"_",""),p=t.getComponent(i.element,"dropdownlist");this.changeOperator(r,a,p,u,n,l,i)}this.isOperatorRendered=!0},d.prototype.operatorChangeSuccess=function(e,l,r,n,i){if(!e.cancel){var o=t.closest(i.element,".e-rule-operator"),s=t.getComponent(i.element,"dropdownlist"),a=n.operator?n.operator.toLowerCase():"";r.operator=s.value;var u=r.operator.toLowerCase();if(r.operator.toLowerCase().indexOf("between")>-1||r.operator.toLowerCase().indexOf("in")>-1&&r.operator.toLowerCase().indexOf("contains")<0?(l=o.previousElementSibling,r.type=n.type,(r.operator.toLowerCase().indexOf("in")<0||n.operator.toLowerCase().indexOf("in")<0)&&(n.value=[])):"object"==typeof n.value&&(n.value=n.value.length>0?n.value[0]:""),i.previousItemData){var p=i.previousItemData.value.toLowerCase();(p.indexOf("between")>-1||p.indexOf("in")>-1&&p.indexOf("contains")<0)&&(l=o.previousElementSibling,r.type=n.type)}a.indexOf("in")>-1&&a.indexOf("in")<5&&u.indexOf("in")>-1&&u.indexOf("in")<5&&(l=null),this.changeRuleValues(l,n,r,i)}this.isValueRendered=!0},d.prototype.changeRuleValues=function(e,l,n,i){var o,s,a,u=t.closest(i.element,".e-rule-operator");if(e)if(u=e.nextElementSibling,t.addClass([u],"e-operator"),u.childElementCount){o=t.getComponent(u.querySelector(".e-dropdownlist"),"dropdownlist"),n.operator=o.value;var p=i.itemData;this.renderValues(u,p,i.previousItemData,!0,l,n,i.element)}else{var d=t.closest(u,".e-rule-container").id;a=this.createElement("input",{attrs:{type:"text",id:d+"_operatorkey"}}),u.appendChild(a),this.selectedColumn.operators?s=this.selectedColumn.operators:i.itemData&&(s=this.customOperators[this.selectedColumn.type+"Operator"]);var c=this.element.className.indexOf("e-device")>-1?"250px":"200px";new r.DropDownList({dataSource:s,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:s.length>5?c:"auto",change:this.changeField.bind(this),index:0,value:l?l.operator:null}).appendTo("#"+d+"_operatorkey"),n.operator=l&&""!==l.operator?l.operator:s[0].value,this.isImportRules&&(n.type=this.selectedColumn.type,n.operator=l.operator),this.renderValues(u,this.selectedColumn,i.previousItemData,!1,l,n,i.element)}this.isImportRules||this.updateRules(i.element,i.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,o){var s,a=!1,u=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(a=!0,s=this.getDistinctValues(this.dataColl,e.field)),!this.dataColl.length&&o.length&&(u=!0);var p=new r.MultiSelect({dataSource:u?o:a?s:this.dataManager,query:new n.Query([e.field]),fields:{text:e.field,value:e.field},placeholder:this.l10n.getConstant("SelectValue"),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)});p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},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");this.selectedColumn=o.getDataByValue(o.value);var s=this.selectedColumn.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,c=this.dataManager.executeQuery((new n.Query).select(s)),h=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),c.then(function(e){d=e.actual&&e.actual.result?e.actual.result:e.result,r.dataColl=t.extend(r.dataColl,d,[],!0);var l=r.getDistinctValues(r.dataColl,s);p.dataSource=l,a.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){h.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.setDefaultValue=function(e,l,r){var n=this.getItemData(e);if(t.isNullOrUndefined(n.value))return r?l?[0,0]:0:l?[]:"";if(l){if(!(n.value instanceof Array))return[n.value]}else if(n.value instanceof Array)return n.value[0];return n.value},d.prototype.renderStringValue=function(e,t,l,r,n){var o,s,a=this.getItemData(e);if(s=this.isImportRules||this.isPublic?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1)).join(","));var u=new i.TextBox({placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,r)});u.appendTo("#"+e+"_valuekey"+r),u.value=s,u.dataBind()}else o=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,r,o,a.values),"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=this.getItemData(e),p=this.isImportRules||this.isPublic?l.value:this.setDefaultValue(e,!1,!0);if("in"!==r&&"notin"!==r||!this.dataColl.length&&!u.values)if("in"===r||"notin"===r){var d=(p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1)).join(","),c=new i.TextBox({placeholder:this.l10n.getConstant("SelectValue"),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,f=s.format?s.format:"n";a>1&&l&&(p=l.value[n]?l.value[n]:this.setDefaultValue(e,!0,!0));new i.NumericTextBox({value:p instanceof Array?p[n]:p,format:f,min:m,max:g,width:"100%",step:s.step?s.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}else p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(u,e,n,p,u.values),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.parseDate=function(e,l){var r,n;if(l){r={type:"dateTime",format:l},n=this.intl.getDateParser({skeleton:"full",type:"dateTime"})(e),t.isNullOrUndefined(n)&&(n=this.intl.parseDate(e,r))}else n=new Date(e);return n},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;s="boolean"===i.type?this.selectedColumn.values?this.selectedColumn.values.length:2:i.operator&&i.operator.toLowerCase().indexOf("between")>-1?2:1;var 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=!1;"boolean"===n.type&&n.value?c=d[p].toLowerCase()===n.value.toString().toLowerCase():r.value?c=d[p].toLowerCase()===r.value.toString().toLowerCase():0===p&&(c=!0);var 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),c&&this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,g=void 0,f=void 0,y=r.format,v=this.l10n.getConstant("SelectValue");r.value&&(m=r.value instanceof Date?r.value:r.value instanceof Number?new Date(r.value):this.parseDate(r.value,r.format)),(this.isImportRules||this.isPublic)&&n&&n.value&&(f=this.getColumn(n.field),g=s>1?n.value[p]:n.value,m=this.parseDate(g,f.format),y=f.format),(y?new o.DatePicker({value:m,placeholder:v,format:y,change:this.changeValue.bind(this,p)}):new o.DatePicker({value:m,placeholder:v,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;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 g=e.parentElement.querySelector(".e-rule-value");this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?g.style.width="100%":g.style.minWidth="200px"}else{var f=1;f="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:o.operator&&o.operator.toLowerCase().indexOf("between")>-1?2:1;for(h=0;h<f;h++){c=void 0;c=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+h}}),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":l.value=t.getComponent(e,r).value;break;case"radio":var i=t.getComponent(e,r);i.checked&&(l.value=i.value),i.refresh();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);break;case"multiselect":l.value=t.getComponent(e,r).value}},d.prototype.updateRules=function(e,l,r){for(var n,i,o,s=t.closest(e,".e-group-container"),a=this.getParentGroup(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=""),this.selectedColumn=n.getDataByValue(n.value),a.rules[p].field=this.selectedColumn.field,a.rules[p].type=this.selectedColumn.type,a.rules[p].label=this.selectedColumn.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;var f=h.nextElementSibling.nextElementSibling,y=f.querySelectorAll("input.e-control");y.length<1&&(y=f.querySelectorAll(".e-template"));for(var v=0;v<y.length;v++)y[v]||(y[v]=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),y[v]||(y[v]=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:a.rules[p].field,type:"field"},this.updateValues(y[v],a.rules[p]);this.isImportRules||this.trigger("change",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 C=void 0;e.parentElement;C=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(),C.length>1&&(a.rules[p].value=[]);for(var b=0;b<C.length;b++)this.updateValues(C[b],a.rules[p]);this.isImportRules||this.trigger("change",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.isImportRules||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},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.isImportRules||this.trigger("change",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 f=t.getInstance(s.querySelector(".e-rule-filter input"),r.DropDownList),y={type:"dateTime",format:this.columns[f.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,this.isPublic=!0;for(var l=0,r=e.length;l<r;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var l=document.getElementById(t),r=this.getParentGroup(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",OtherFields:"Other Fields",AND:"AND",OR:"OR",SelectValue:"Enter Value"},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.fields={text:"label",value:"field"}},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){e.actual&&e.actual.result?t.dataColl=e.actual.result: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.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[e],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 t=this,l={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"deleteGroup"};this.isImportRules?this.deleteGroupSuccessCallBack(l,e):this.trigger("beforeChange",l,function(l){t.deleteGroupSuccessCallBack(l,e)})},d.prototype.deleteGroupSuccessCallBack=function(e,l){if(!e.cancel){this.actionButton&&t.getComponent(this.actionButton,"tooltip").destroy();var r=l,n=this.getParentGroup(r,!0),i=0,o=void 0,s=void 0,a=this.getValidRules(this.rule),u=r.nextElementSibling,p=r.previousElementSibling,d=r.querySelectorAll(".e-group-container"),c=r.querySelectorAll(".e-tooltip");for(s=c.length,o=0;o<s;o++)t.getComponent(c[o],"tooltip").destroy();for(o=0,s=d.length;o<s;o++)delete this.levelColl[d[o].id];for(;null!==r.previousElementSibling;)r=r.previousElementSibling,i++;u&&u.className.indexOf("e-separate-rule")>-1&&(t.removeClass([u],"e-separate-rule"),t.addClass([u],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&t.addClass([p],"e-prev-joined-rule")),n.rules.splice(i,1),delete this.levelColl[e.groupID],t.detach(l),this.refreshLevelColl(),this.isImportRules||this.trigger("change",e),this.filterRules(a,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.deleteRule=function(e){var l=this,r={groupID:t.closest(e,".e-group-container").id.replace(this.element.id+"_",""),ruleID:t.closest(e,".e-rule-container").id.replace(this.element.id+"_",""),cancel:!1,type:"deleteRule"};this.isImportRules?this.deleteRuleSuccessCallBack(r,e):this.trigger("beforeChange",r,function(t){l.deleteRuleSuccessCallBack(t,e)})},d.prototype.deleteRuleSuccessCallBack=function(e,l){if(!e.cancel){this.actionButton&&this.actionButton.className.indexOf("e-tooltip")>-1&&t.getComponent(this.actionButton,"tooltip").destroy();var r=t.closest(l,".e-group-container"),n=this.getParentGroup(r),i=t.closest(l,".e-rule-container"),o=this.getValidRules(this.rule),s=i,a=i.nextElementSibling,u=i.previousElementSibling,p=0,d=i.querySelectorAll(".e-tooltip"),c=void 0,h=d.length;for(c=0;c<h;c++)t.getComponent(d[c],"tooltip").destroy();for(;null!==i.previousElementSibling;)i=i.previousElementSibling,p++;n.rules.splice(p,1),(!u||u.className.indexOf("e-rule-container")<0)&&a&&t.removeClass([a],"e-joined-rule"),(!a||a.className.indexOf("e-rule-container")<0)&&u&&t.removeClass([u],"e-prev-joined-rule"),t.detach(s),this.isImportRules||this.trigger("change",e),this.filterRules(o,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{condition:this.rule.condition,rules:this.rule.rules}},d.prototype.getRule=function(e){var l,r,n=0;e instanceof HTMLElement?l=t.closest(e,".e-rule-container"):(r=this.element.id+"_"+e,l=document.getElementById(r));for(var i=t.closest(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,n++;return o.rules[n]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=t.closest(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e,r=this.getParentGroup(l);return{rules:r.rules,condition:r.condition}},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){var t,l,r,i,o=e.rules,s=!1;if(!o)return t;for(var a=0,u=o.length;a<u;a++){if(Object.keys(o[a]).indexOf("rules")>-1&&o[a].rules)(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=!this.matchCase,"date"===o[a].type&&["equal","notequal"].indexOf(p)>-1&&(s=!0),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){this.parser=[],this.sqlParser(e),this.rule={condition:"",rules:[]};var t=this.processParser(this.parser,this.rule,[0]);return{condition:t.condition,rules:t.rules}},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=[],g=0,f=e.length;g<f;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=f,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,f-(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,f-(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,"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.Property(!1)],d.prototype,"matchCase",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.51 | ||
* version : 17.2.28-beta | ||
* 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,a,s){"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 a=e.length-1;a>=0;a--)(n=e[a])&&(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),p([t.Property(null)],l.prototype,"value",void 0),p([t.Property(null)],l.prototype,"category",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=!1,i=void 0,o={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=0,s=(u=this.columns).length;a<s;a++)u[a].type||(e.indexOf(u[a].field)>-1&&("string"===(l=typeof(i=this.dataColl[0][u[a].field]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),u[a].type=l,n=!1),l="string"),u[a].validation||(u[a].validation=o),u[a].category?r=!0:u[a].category=this.l10n.getConstant("OtherFields");r&&(this.fields={text:"label",value:"field",groupBy:"category"})}else{for(var a=0,s=e.length;a<s;a++)"string"===(l=typeof(i=this.dataColl[0][e[a]]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),t[a]={field:e[a],label:e[a],type:n?"date":l,validation:o},n=!1;this.columns=t}}else if(this.columns.length)for(var u=this.columns,a=0,s=u.length;a<s;a++)u[a].category?this.fields={text:"label",value:"field",groupBy:"category"}:u[a].category=this.l10n.getConstant("OtherFields")},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"),a=o.querySelector(".e-summary-text");i.animate(".e-query-builder",{name:"SlideLeftIn"}),(u=this.element.querySelector(".e-group-container")).style.display="none",a.textContent=this.getSqlFromRules(this.rule),o.style.display="block",a.style.height=a.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 s=t.extend({},this.rule,{},!0);this.setGroupRules(s),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.getParentGroup(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,a,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 s.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:this.fields,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"),o=this.levelColl[e.id],this.selectedColumn=d.getDataByValue(d.value),!this.isImportRules){for(a=this.rule,u=0,p=o.length;u<p;u++)a=this.findGroupByIdx(o[u],a,0===u);Object.keys(l).length?a.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}):a.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(l).length&&this.changeRule(l,{element:d.element,itemData:this.selectedColumn}),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 s.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=[],a=void 0,s=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(a=t.closest(c[l],".e-group-container"),d=this.getParentGroup(a),s=0,i=p=c[l],u=t.getComponent(c[l].querySelector(".e-rule-field input.e-control"),"dropdownlist"),this.selectedColumn=u.getDataByValue(u.value),h=!t.isNullOrUndefined(u.index)&&this.selectedColumn.validation,n=p.querySelector(".e-rule-field input.e-control"),h&&h.isRequired){for(;i&&null!==i.previousElementSibling;)i=i.previousElementSibling,s++;if(n=p.querySelector(".e-rule-field input.e-control"),d.rules[s].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[s].operator||(n.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(n.parentElement),e=!1),d.rules[s].value instanceof Array&&(o=d.rules[s].value),t.isNullOrUndefined(d.rules[s].value)||""===d.rules[s].value||d.rules[s].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,a=0;for(r=0;r<o;r++)(l=n[r]).className.indexOf("e-group-container")>-1&&(e.level.push(a),this.levelColl[l.id]=e.level.slice(),a++,e.groupElement=l,e=this.refreshLevel(e));var s=t.closest(i,".e-rule-list");return e.groupElement=s?t.closest(s,".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,a,s;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),a=this.createElement("div",{attrs:{class:"e-group-action"}}),s=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),a.appendChild(s),l.appendChild(a),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 s.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,C=0,b=y.length;C<b;C++)y[C].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 a.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 a=t.closest(o,".e-group-container"),s=t.closest(o,".e-rule-container");n=a&&a.id.replace(this.element.id+"_",""),i=s.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"),this.selectedColumn=c.getDataByValue(c.value),p=this.selectedColumn.values?this.selectedColumn.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.getParentGroup(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,a,s,u={},p=e.operator?e.operator.toLowerCase():"",d=t.closest(l.element,".e-rule-filter");a=t.closest(l.element,".e-rule-operator");var c,h,m=t.getComponent(l.element,"dropdownlist"),g=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_","");if(d){if(this.selectedColumn=m.getDataByValue(m.value),i=t.closest(d,".e-rule-container"),o=i.id.replace(this.element.id+"_",""),h={groupID:g,ruleID:o,selectedField:m.value,cancel:!1,type:"field"},(h=this.triggerEvents(h,"before")).cancel)return;u.type=this.selectedColumn.type,i.querySelector(".e-template")&&(e.value="")}if(a){if(i=t.closest(a,".e-rule-container"),o=i.id.replace(this.element.id+"_",""),h={groupID:g,ruleID:o,selectedIndex:m.index,cancel:!1,type:"operator"},(h=this.triggerEvents(h,"before")).cancel)return;u.operator=m.value;var v=u.operator.toLowerCase();if(u.operator.toLowerCase().indexOf("between")>-1||u.operator.toLowerCase().indexOf("in")>-1&&u.operator.toLowerCase().indexOf("contains")<0?(d=a.previousElementSibling,u.type=e.type,(u.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)&&(d=a.previousElementSibling,u.type=e.type)}p.indexOf("in")>-1&&p.indexOf("in")<5&&v.indexOf("in")>-1&&v.indexOf("in")<5&&(d=null)}if(d)if(a=d.nextElementSibling,t.addClass([a],"e-operator"),a.childElementCount)n=t.getComponent(a.querySelector(".e-dropdownlist"),"dropdownlist"),u.operator=n.value,this.renderValues(a,l.itemData,l.previousItemData,!0,e,u,l.element);else{var f=t.closest(a,".e-rule-container").id;c=this.createElement("input",{attrs:{type:"text",id:f+"_operatorkey"}}),a.appendChild(c),this.selectedColumn.operators?s=this.selectedColumn.operators:l.itemData&&(s=this.customOperators[this.selectedColumn.type+"Operator"]);var C=this.element.className.indexOf("e-device")>-1?"250px":"200px";new r.DropDownList({dataSource:s,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:s.length>5?C:"auto",change:this.changeField.bind(this),index:0,value:e?e.operator:null}).appendTo("#"+f+"_operatorkey"),u.operator=e&&""!==e.operator?e.operator:s[0].value,this.isImportRules&&(u.type=this.selectedColumn.type,u.operator=e.operator),this.renderValues(a,this.selectedColumn,l.previousItemData,!1,e,u,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 a=l[i].className,s=0,u=n.length;s<u;s++)if(n[s].template&&a.indexOf(n[s].field)>-1){this.templateDestroy(n[s],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 a=r[i].className,s=0,u=n.length;s<u;s++)if(n[s].template&&a.indexOf(n[s].field)>-1){this.templateDestroy(n[s],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 a={};o in l||(l[o]=1,a[t]=o,r.push(a))}return r},d.prototype.renderMultiSelect=function(e,t,l,i,o){var a,s=!1,u=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(s=!0,a=this.getDistinctValues(this.dataColl,e.field)),!this.dataColl.length&&o.length&&(u=!0);var p=new r.MultiSelect({dataSource:u?o:s?a: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)});p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},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");this.selectedColumn=o.getDataByValue(o.value);var a=this.selectedColumn.field,u=!1;if(this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(a)>-1&&(u=!0),!u){l.cancel=!0;var p=t.getComponent(i,"multiselect");p.hideSpinner();var d,c=this.dataManager.executeQuery((new n.Query).select(a)),h=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),s.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),c.then(function(e){d=e.actual&&e.actual.result?e.actual.result:e.result,r.dataColl=t.extend(r.dataColl,d,[],!0);var l=r.getDistinctValues(r.dataColl,a);p.dataSource=l,s.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){h.reject(e)})}}},d.prototype.createSpinner=function(e){var l=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(l),s.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.setDefaultValue=function(e,l,r){var n=this.getItemData(e);if(t.isNullOrUndefined(n.value))return r?l?[0,0]:0:l?[]:"";if(l){if(!(n.value instanceof Array))return[n.value]}else if(n.value instanceof Array)return n.value[0];return n.value},d.prototype.renderStringValue=function(e,t,l,r,n){var o,a,s=this.getItemData(e);if(a=this.isImportRules||this.isPublic?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!s.values){"in"!==l&&"notin"!==l||(a=(o=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1)).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.setDefaultValue(e,!0,!1),this.renderMultiSelect(s,e,r,o,s.values),"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,a,s){var u=this.getItemData(e),p=this.isImportRules||this.isPublic?l.value:this.setDefaultValue(e,!1,!0);if("in"!==r&&"notin"!==r||!this.dataColl.length&&!u.values)if("in"===r||"notin"===r){var d=(p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1)).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=(a=this.columns[h.index]).validation&&a.validation.min?a.validation.min:0,g=a.validation&&a.validation.max?a.validation.max:Number.MAX_VALUE,v=a.format?a.format:"n";s>1&&l&&(p=l.value[n]?l.value[n]:this.setDefaultValue(e,!0,!0)),new i.NumericTextBox({value:p instanceof Array?p[n]:p,format:v,min:m,max:g,width:"100%",step:a.step?a.step:1,change:this.changeValue.bind(this,n)}).appendTo("#"+e+"_valuekey"+n)}else p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(u,e,n,p,u.values),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.parseDate=function(e,l){var r,n;return l?(r={type:"dateTime",format:l},n=this.intl.getDateParser({skeleton:"full",type:"dateTime"})(e),t.isNullOrUndefined(n)&&(n=this.intl.parseDate(e,r))):n=new Date(e),n},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 a;a="boolean"===i.type?this.selectedColumn.values?this.selectedColumn.values.length:2:i.operator&&i.operator.toLowerCase().indexOf("between")>-1?2:1;var s=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<a;p++)switch(i.type){case"string":this.renderStringValue(s,n,i.operator,p,u);break;case"number":this.renderNumberValue(s,n,i.operator,p,u,r,a);break;case"boolean":var d=r.values&&r.values.length?r.values:["True","False"],c=!1;"boolean"===n.type&&n.value?c=d[p].toLowerCase()===n.value.toString().toLowerCase():r.value?c=d[p].toLowerCase()===r.value.toString().toLowerCase():0===p&&(c=!0);var h=new l.RadioButton({label:d[p].toString(),name:s+"default",checked:c,value:d[p],change:this.changeValue.bind(this,p)});h.appendTo("#"+s+"_valuekey"+p),c&&this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,g=void 0,v=void 0,y=r.format;r.value&&(m=r.value instanceof Date?r.value:r.value instanceof Number?new Date(r.value):this.parseDate(r.value,r.format)),(this.isImportRules||this.isPublic)&&n&&n.value&&(v=this.getColumn(n.field),g=a>1?n.value[p]:n.value,m=this.parseDate(g,v.format),y=v.format),(y?new o.DatePicker({value:m,format:y,change:this.changeValue.bind(this,p)}):new o.DatePicker({value:m,change:this.changeValue.bind(this,p)})).appendTo("#"+s+"_valuekey"+p),n.value||this.updateRules(document.getElementById(s+"_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,a){if(n){var s=t.getComponent(e.querySelector("input"),"dropdownlist");l.operators?(s.dataSource=l.operators,s.index=this.getOperatorIndex(s,i),s.value=o.operator=s.dataSource[s.index].value,s.dataBind()):l.type&&(s.dataSource=this.customOperators[l.type+"Operator"],s.index=this.getOperatorIndex(s,i),s.value=o.operator=s.dataSource[s.index].value,s.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(a.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;v=void 0;if(l.template&&"string"==typeof l.template.create?v=t.getValue(l.template.create,window)():l.template&&l.template.create&&(v=l.template.create()),v instanceof Element)v.id=u+"_valuekey0",t.addClass([v],"e-template"),t.addClass([v],"e-"+l.field),e.nextElementSibling.appendChild(v);else if(v instanceof Array){t.addClass(v,"e-template");for(var c=0,h=v.length;c<h;c++)v[c].id=u+"_valuekey"+c,e.nextElementSibling.appendChild(v[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{var g=1;g="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:o.operator&&o.operator.toLowerCase().indexOf("between")>-1?2:1;for(c=0;c<g;c++){var v=void 0;v=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+c}}),e.nextElementSibling.appendChild(v)}}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&&(l.value=i.value),i.refresh();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);break;case"multiselect":l.value=t.getComponent(e,r).value}},d.prototype.updateRules=function(e,l,r){for(var n,i,o,a=t.closest(e,".e-group-container"),s=this.getParentGroup(a),u=t.closest(e,".e-rule-container"),p=0,d=a.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||s.rules[p].field.toLowerCase()===this.columns[n.index].field.toLowerCase()||(s.rules[p].value=""),this.selectedColumn=n.getDataByValue(n.value),s.rules[p].field=this.selectedColumn.field,s.rules[p].type=this.selectedColumn.type,s.rules[p].label=this.selectedColumn.label;var h=t.closest(e,".e-rule-filter"),m=h.nextElementSibling.querySelector("input.e-control"),g=t.getComponent(m,"dropdownlist").value;s.rules[p].operator=g;var v=h.nextElementSibling.nextElementSibling,y=v.querySelectorAll("input.e-control");y.length<1&&(y=v.querySelectorAll(".e-template"));for(var f=0;f<y.length;f++)y[f]||(y[f]=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),y[f]||(y[f]=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:s.rules[p].field,type:"field"},this.updateValues(y[f],s.rules[p]);this.triggerEvents(i),this.allowValidation&&s.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"),s.rules[p].operator=n.value;var C=void 0;e.parentElement;C=u.querySelectorAll(".e-rule-value input.e-control"),i={groupID:d,ruleID:o,value:n.value,type:"operator"},this.allowValidation&&s.rules[p].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),C.length>1&&(s.rules[p].value=[]);for(var b=0;b<C.length;b++)this.updateValues(C[b],s.rules[p]);this.triggerEvents(i),this.filterRules(c,this.getValidRules(this.rule),"operator")}else t.closest(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,s,p,a,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,a,s){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:a.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[s]=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(a.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[s]=this.intl.formatDate(l,y):n.rules[i].value=this.intl.formatDate(l,y))}this.validatValue(n,i,a)}},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,this.isPublic=!0;for(var l=0,r=e.length;l<r;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var l=document.getElementById(t),r=this.getParentGroup(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",OtherFields:"Other Fields"},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"},this.fields={text:"label",value:"field"}},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){e.actual&&e.actual.result?t.dataColl=e.actual.result: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.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[e],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.getParentGroup(n,!0),a=0,s={groupID:i,cancel:!1,type:"deleteGroup"},u=this.getValidRules(this.rule);if(!(s=this.triggerEvents(s,"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,a++;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(a,1),delete this.levelColl[i],t.detach(e),this.refreshLevelColl(),this.triggerEvents(s),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.getParentGroup(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 a=this.getValidRules(this.rule),s={groupID:r,ruleID:l,cancel:!1,type:"deleteRule"};if(!(s=this.triggerEvents(s,"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(s),this.filterRules(a,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.getRule=function(e){var l,r,n=0;e instanceof HTMLElement?l=t.closest(e,".e-rule-container"):(r=this.element.id+"_"+e,l=document.getElementById(r));for(var i=t.closest(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,n++;return o.rules[n]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=t.closest(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e,r=this.getParentGroup(l);return{rules:r.rules,condition:r.condition}},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,a=!1,s=0,u=o.length;s<u;s++)if(Object.keys(o[s]).indexOf("rules")>-1)(l=this.getPredicate(o[s]))&&(t=t?"and"===e.condition?t.and(l):t.or(l):l);else if(o[s].operator.length){var p=o[s].operator.toLowerCase(),d=["equal","notequal"];if(a=!this.matchCase,"date"===o[s].type&&d.indexOf(p)>-1&&(a=!0),i=this.getColumn(o[s].field),"date"===o[s].type){var c={type:"dateTime",format:i.format||"MM/dd/yyyy"};r=this.intl.parseDate(o[s].value,c)}else r=o[s].value;if(0===s)(p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p?t=this.arrayPredicate(o[s]):""!==(h=r)&&(t=new n.Predicate(o[s].field,o[s].operator,r,a));else if("and"===e.condition)if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[s],t,e.condition);else{h=r;t&&""!==h?t=t.and(o[s].field,o[s].operator,r,a):""!==h&&(t=new n.Predicate(o[s].field,o[s].operator,r,a))}else if((p.indexOf("in")>-1||p.indexOf("between")>-1)&&"contains"!==p)t=this.arrayPredicate(o[s],t,e.condition);else{var h=r;t&&""!==h?t=t.or(o[s].field,o[s].operator,r,a):""!==h&&(t=new n.Predicate(o[s].field,o[s].operator,r,a))}}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,a=i.length;o<a;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 a=Object.keys(n[i]);!t.isNullOrUndefined(n[i].rules)&&a.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],a="";if(o.value instanceof Array)if(o.operator.indexOf("between")>-1)a+=o.value[0]+" AND "+o.value[1];else if("string"==typeof o.value[0]){a+='("'+o.value[0]+'"';for(var s=1,u=o.value.length;s<u;s++)a+=',"'+o.value[s]+'"';a+=")"}else a+="("+o.value+")";else"startswith"===o.operator?a+='("'+o.value+'%")':"endswith"===o.operator?a+='("%'+o.value+'")':"contains"===o.operator?a+='("%'+o.value+'%")':"number"===o.type?a+=o.value:a+='"'+o.value+'"';t+=o.field+" "+this.operators[o.operator]+" "+a}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,a=r.length;o<a;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,a=n.length;o<a;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,a=i.length;o<a;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,a,s,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,s=t.rules.length,a=0;a<s;a++)t.rules[a].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,"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.Property(!1)],d.prototype,"matchCase",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),p([t.Property(null)],l.prototype,"value",void 0),p([t.Property(null)],l.prototype,"category",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=!1,i=void 0,o={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var s=0,a=(u=this.columns).length;s<a;s++)u[s].type||(e.indexOf(u[s].field)>-1&&("string"===(l=typeof(i=this.dataColl[0][u[s].field]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),u[s].type=l,n=!1),l="string"),u[s].validation||(u[s].validation=o),u[s].category?r=!0:u[s].category=this.l10n.getConstant("OtherFields");r&&(this.fields={text:"label",value:"field",groupBy:"category"})}else{for(var s=0,a=e.length;s<a;s++)"string"===(l=typeof(i=this.dataColl[0][e[s]]))?n=!isNaN(Date.parse(i)):"object"===l&&(n=i instanceof Date&&!isNaN(i.getTime()),l="string"),t[s]={field:e[s],label:e[s],type:n?"date":l,validation:o},n=!1;this.columns=t}}else if(this.columns.length)for(var u=this.columns,s=0,a=u.length;s<a;s++)u[s].category?this.fields={text:"label",value:"field",groupBy:"category"}:u[s].category=this.l10n.getConstant("OtherFields")},d.prototype.clickEventHandler=function(e){var l,r=this,n=e.target;this.isImportRules=!1;if("SPAN"===n.tagName&&(n=n.parentElement),n.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"===n.tagName){if(n.className.indexOf("e-removerule")>-1)this.actionButton=n,this.deleteRule(n);else if(n.className.indexOf("e-deletegroup")>-1)this.actionButton=n,this.deleteGroup(t.closest(n,".e-group-container"));else if(n.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"===n.tagName&&n.parentElement.className.indexOf("e-btn-group")>-1){var p=t.closest(n,".e-group-container"),d=n.getAttribute("for"),c=document.getElementById(d).getAttribute("value");l={groupID:p.id.replace(this.element.id+"_",""),cancel:!1,type:"condition",value:c.toLowerCase()},this.isImportRules?this.beforeSuccessCallBack(l,n):this.trigger("beforeChange",l,function(e){r.beforeSuccessCallBack(e,n)})}},d.prototype.beforeSuccessCallBack=function(e,l){if(!e.cancel){var r=t.closest(l,".e-group-container"),n=r.id.replace(this.element.id+"_",""),i=this.getValidRules(this.rule),o=this.getParentGroup(r);o.condition=e.value,this.isImportRules||this.trigger("change",{groupID:n,type:"condition",value:o.condition}),this.filterRules(i,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,t){var l=this;if(e){var r={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules?this.addRuleSuccessCallBack(r,e,t):this.trigger("beforeChange",r,function(r){l.addRuleSuccessCallBack(r,e,t)})}},d.prototype.addRuleSuccessCallBack=function(e,l,n){if(!e.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=void 0,s=void 0,u=void 0,p=void 0,d=void 0,c=l.querySelector(".e-rule-list"),h=i.querySelector("button"),m=void 0,g=void 0;if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?(h.textContent=this.l10n.getConstant("Remove"),t.addClass([h],"e-flat"),t.addClass([h],"e-primary")):(t.addClass([h],"e-round"),t.addClass([h],"e-icon-btn"),new a.Tooltip({content:this.l10n.getConstant("DeleteRule")}).appendTo(h),h=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),i.querySelector("button").appendChild(h)),i.setAttribute("id",l.id+"_rule"+this.ruleIdCounter),this.ruleIdCounter++,i.querySelector(".e-filter-input").setAttribute("id",i.id+"_filterkey"),c.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"),m=this.element.className.indexOf("e-device")>-1?"250px":"200px",(d=new r.DropDownList({dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?m:"auto",change:this.changeField.bind(this),value:n?n.field:null})).appendTo("#"+i.id+"_filterkey"),o=this.levelColl[l.id],this.selectedColumn=d.getDataByValue(d.value),!this.isImportRules){for(s=this.rule,u=0,p=o.length;u<p;u++)s=this.findGroupByIdx(o[u],s,0===u);Object.keys(n).length?s.rules.push({field:n.field,type:n.type,label:n.label,operator:n.operator,value:n.value}):s.rules.push({field:"",type:"",label:"",operator:"",value:""})}Object.keys(n).length&&this.changeRule(n,{element:d.element,itemData:this.selectedColumn}),g=i.id.replace(this.element.id+"_",""),this.isImportRules||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:g,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.getParentGroup(s),a=0,i=p=c[l],u=t.getComponent(c[l].querySelector(".e-rule-field input.e-control"),"dropdownlist"),this.selectedColumn=u.getDataByValue(u.value),h=!t.isNullOrUndefined(u.index)&&this.selectedColumn.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 f=m[g],y=void 0;f.parentElement.className.indexOf("e-searcher")>-1?(y=t.closest(f,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(y):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:this.l10n.getConstant("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:this.l10n.getConstant("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,t,l,r){var n=this,i={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules?this.addGroupSuccess(i,e,t,l,r):this.trigger("beforeChange",i,function(i){n.addGroupSuccess(i,e,t,l,r)})},d.prototype.addGroupSuccess=function(e,r,n,i,o){if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var u=n,p=void 0,d=this.groupElem.cloneNode(!0);d.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.groupIdCounter++;var c=d.querySelector(".e-btngroup-and"),h=d.querySelector(".e-btngroup-or"),m=d.querySelector(".e-btngroup-and-lbl"),g=d.querySelector(".e-btngroup-or-lbl");if(c.setAttribute("id",this.element.id+"_and"+this.btnGroupId),h.setAttribute("id",this.element.id+"_or"+this.btnGroupId),c.setAttribute("name",this.element.id+"_and"+this.btnGroupId),h.setAttribute("name",this.element.id+"_and"+this.btnGroupId),m.setAttribute("for",this.element.id+"_and"+this.btnGroupId),g.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++,r){var v=this.showButtons.groupDelete?"e-deletegroup":"e-deletegroup e-button-hide";p=this.createElement("button",{attrs:{class:v}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(p),new a.Tooltip({content:this.l10n.getConstant("DeleteGroup")}).appendTo(p),t.rippleEffect(p,{selector:".deletegroup"}),d.querySelector(".e-group-action").appendChild(p);for(var f=u.querySelector(".e-rule-list"),y=f.children,C=0,b=0,S=y.length;b<S;b++)y[b].className.indexOf("e-group-container")>-1&&(C+=1);f.appendChild(d);var x=this.levelColl[u.id].slice(0);x.push(C),this.levelColl[d.id]=x,this.isImportRules||(this.addGroups([],u.id.replace(this.element.id+"_","")),o&&this.addRuleElement(d,{}))}else u.appendChild(d),this.levelColl[d.id]=[0];d.querySelector(".e-btngroup-and").setAttribute("checked","true"),"or"===i&&d.querySelector(".e-btngroup-or").setAttribute("checked","true");var w=d.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,w),select:this.selectBtn.bind(this,w)}).appendTo(w),this.isImportRules||this.trigger("change",{groupID:u.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,s=this;(o=l.event?l.event.target:l.element).className.indexOf("e-day")>-1&&(o=l.element);var a=t.closest(o,".e-group-container"),u=t.closest(o,".e-rule-container");n=a&&a.id.replace(this.element.id+"_",""),i=u.id.replace(this.element.id+"_","");var p=l;p.element&&p.element.className.indexOf("e-datepicker")>-1&&(o=p.element);var d,c,h;o.className.indexOf("e-radio")>-1?(c=parseInt(o.id.split("valuekey")[1],0),h=t.getComponent(t.closest(o,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=h.getDataByValue(h.value),d=this.selectedColumn.values?this.selectedColumn.values[c]:["True","False"][c]):d=o.className.indexOf("e-multiselect")>-1?t.getComponent(o,"multiselect").value:l.value,r={groupID:n,ruleID:i,value:d,cancel:!1,type:"value"},this.isImportRules?this.changeValueSuccessCallBack(r,o,e,n,i):this.trigger("beforeChange",r,function(t){s.changeValueSuccessCallBack(t,o,e,n,i)})},d.prototype.changeValueSuccessCallBack=function(e,t,l,r,n){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules||this.trigger("change",{groupID:r,ruleID:n,value:e.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.getParentGroup(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 r={},n=t.closest(l.element,".e-rule-filter"),i=t.getComponent(l.element,"dropdownlist"),o=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_",""),s=t.closest(l.element,".e-rule-operator");this.changeFilter(n,i,o,e,r,l),this.isOperatorRendered||this.changeOperator(n,s,i,o,e,r,l),this.isValueRendered||this.changeRuleValues(n,e,r,l),this.isValueRendered=!1,this.isOperatorRendered=!1}},d.prototype.changeFilter=function(e,l,r,n,i,o){var s=this;if(e){this.selectedColumn=l.getDataByValue(l.value);var a=void 0;a={groupID:r,ruleID:t.closest(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:l.value,cancel:!1,type:"field"},this.isImportRules?this.fieldChangeSuccess(a,i,e,n,o):this.trigger("beforeChange",a,function(t){s.fieldChangeSuccess(t,i,e,n,o)})}},d.prototype.changeOperator=function(e,l,r,n,i,o,s){var a,u=this;l&&(a={groupID:n,ruleID:t.closest(l,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:r.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(a,e,o,i,s):this.trigger("beforeChange",a,function(t){u.operatorChangeSuccess(t,e,o,i,s)}))},d.prototype.fieldChangeSuccess=function(e,l,r,n,i){var o=t.closest(r,".e-rule-container");if(e.cancel)this.isOperatorRendered=!0;else{l.type=this.selectedColumn.type,o.querySelector(".e-template")&&(n.value="");var s=t.closest(i.element,".e-group-container"),a=t.closest(i.element,".e-rule-operator"),u=s.id.replace(this.element.id+"_",""),p=t.getComponent(i.element,"dropdownlist");this.changeOperator(r,a,p,u,n,l,i)}this.isOperatorRendered=!0},d.prototype.operatorChangeSuccess=function(e,l,r,n,i){if(!e.cancel){var o=t.closest(i.element,".e-rule-operator"),s=t.getComponent(i.element,"dropdownlist"),a=n.operator?n.operator.toLowerCase():"";r.operator=s.value;var u=r.operator.toLowerCase();if(r.operator.toLowerCase().indexOf("between")>-1||r.operator.toLowerCase().indexOf("in")>-1&&r.operator.toLowerCase().indexOf("contains")<0?(l=o.previousElementSibling,r.type=n.type,(r.operator.toLowerCase().indexOf("in")<0||n.operator.toLowerCase().indexOf("in")<0)&&(n.value=[])):"object"==typeof n.value&&(n.value=n.value.length>0?n.value[0]:""),i.previousItemData){var p=i.previousItemData.value.toLowerCase();(p.indexOf("between")>-1||p.indexOf("in")>-1&&p.indexOf("contains")<0)&&(l=o.previousElementSibling,r.type=n.type)}a.indexOf("in")>-1&&a.indexOf("in")<5&&u.indexOf("in")>-1&&u.indexOf("in")<5&&(l=null),this.changeRuleValues(l,n,r,i)}this.isValueRendered=!0},d.prototype.changeRuleValues=function(e,l,n,i){var o,s,a,u=t.closest(i.element,".e-rule-operator");if(e)if(u=e.nextElementSibling,t.addClass([u],"e-operator"),u.childElementCount){o=t.getComponent(u.querySelector(".e-dropdownlist"),"dropdownlist"),n.operator=o.value;var p=i.itemData;this.renderValues(u,p,i.previousItemData,!0,l,n,i.element)}else{var d=t.closest(u,".e-rule-container").id;a=this.createElement("input",{attrs:{type:"text",id:d+"_operatorkey"}}),u.appendChild(a),this.selectedColumn.operators?s=this.selectedColumn.operators:i.itemData&&(s=this.customOperators[this.selectedColumn.type+"Operator"]);var c=this.element.className.indexOf("e-device")>-1?"250px":"200px";new r.DropDownList({dataSource:s,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:s.length>5?c:"auto",change:this.changeField.bind(this),index:0,value:l?l.operator:null}).appendTo("#"+d+"_operatorkey"),n.operator=l&&""!==l.operator?l.operator:s[0].value,this.isImportRules&&(n.type=this.selectedColumn.type,n.operator=l.operator),this.renderValues(u,this.selectedColumn,i.previousItemData,!1,l,n,i.element)}this.isImportRules||this.updateRules(i.element,i.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,o){var s,a=!1,u=!1;this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(a=!0,s=this.getDistinctValues(this.dataColl,e.field)),!this.dataColl.length&&o.length&&(u=!0);var p=new r.MultiSelect({dataSource:u?o:a?s:this.dataManager,query:new n.Query([e.field]),fields:{text:e.field,value:e.field},placeholder:this.l10n.getConstant("SelectValue"),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)});p.appendTo("#"+t+"_valuekey"+l),this.updateRules(p.element,i,0)},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");this.selectedColumn=o.getDataByValue(o.value);var s=this.selectedColumn.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,c=this.dataManager.executeQuery((new n.Query).select(s)),h=new n.Deferred;this.createSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(i,".e-multi-select-wrapper").parentElement),c.then(function(e){d=e.actual&&e.actual.result?e.actual.result:e.result,r.dataColl=t.extend(r.dataColl,d,[],!0);var l=r.getDistinctValues(r.dataColl,s);p.dataSource=l,a.hideSpinner(t.closest(i,".e-multi-select-wrapper").parentElement)}).catch(function(e){h.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.setDefaultValue=function(e,l,r){var n=this.getItemData(e);if(t.isNullOrUndefined(n.value))return r?l?[0,0]:0:l?[]:"";if(l){if(!(n.value instanceof Array))return[n.value]}else if(n.value instanceof Array)return n.value[0];return n.value},d.prototype.renderStringValue=function(e,t,l,r,n){var o,s,a=this.getItemData(e);if(s=this.isImportRules||this.isPublic?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(o=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1)).join(","));var u=new i.TextBox({placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,r)});u.appendTo("#"+e+"_valuekey"+r),u.value=s,u.dataBind()}else o=this.isImportRules?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,r,o,a.values),"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=this.getItemData(e),p=this.isImportRules||this.isPublic?l.value:this.setDefaultValue(e,!1,!0);if("in"!==r&&"notin"!==r||!this.dataColl.length&&!u.values)if("in"===r||"notin"===r){var d=(p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1)).join(","),c=new i.TextBox({placeholder:this.l10n.getConstant("SelectValue"),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]:this.setDefaultValue(e,!0,!0)),new i.NumericTextBox({value:p instanceof Array?p[n]: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 p=this.isImportRules?l.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(u,e,n,p,u.values),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.parseDate=function(e,l){var r,n;return l?(r={type:"dateTime",format:l},n=this.intl.getDateParser({skeleton:"full",type:"dateTime"})(e),t.isNullOrUndefined(n)&&(n=this.intl.parseDate(e,r))):n=new Date(e),n},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;s="boolean"===i.type?this.selectedColumn.values?this.selectedColumn.values.length:2:i.operator&&i.operator.toLowerCase().indexOf("between")>-1?2:1;var 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=!1;"boolean"===n.type&&n.value?c=d[p].toLowerCase()===n.value.toString().toLowerCase():r.value?c=d[p].toLowerCase()===r.value.toString().toLowerCase():0===p&&(c=!0);var 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),c&&this.updateRules(h.element,d[p],0);break;case"date":var m=new Date,g=void 0,v=void 0,f=r.format,y=this.l10n.getConstant("SelectValue");r.value&&(m=r.value instanceof Date?r.value:r.value instanceof Number?new Date(r.value):this.parseDate(r.value,r.format)),(this.isImportRules||this.isPublic)&&n&&n.value&&(v=this.getColumn(n.field),g=s>1?n.value[p]:n.value,m=this.parseDate(g,v.format),f=v.format),(f?new o.DatePicker({value:m,placeholder:y,format:f,change:this.changeValue.bind(this,p)}):new o.DatePicker({value:m,placeholder:y,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;v=void 0;if(l.template&&"string"==typeof l.template.create?v=t.getValue(l.template.create,window)():l.template&&l.template.create&&(v=l.template.create()),v instanceof Element)v.id=u+"_valuekey0",t.addClass([v],"e-template"),t.addClass([v],"e-"+l.field),e.nextElementSibling.appendChild(v);else if(v instanceof Array){t.addClass(v,"e-template");for(var c=0,h=v.length;c<h;c++)v[c].id=u+"_valuekey"+c,e.nextElementSibling.appendChild(v[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{var g=1;g="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:o.operator&&o.operator.toLowerCase().indexOf("between")>-1?2:1;for(c=0;c<g;c++){var v=void 0;v=this.createElement("input",{attrs:{type:"text",id:u+"_valuekey"+c}}),e.nextElementSibling.appendChild(v)}}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&&(l.value=i.value),i.refresh();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);break;case"multiselect":l.value=t.getComponent(e,r).value}},d.prototype.updateRules=function(e,l,r){for(var n,i,o,s=t.closest(e,".e-group-container"),a=this.getParentGroup(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=""),this.selectedColumn=n.getDataByValue(n.value),a.rules[p].field=this.selectedColumn.field,a.rules[p].type=this.selectedColumn.type,a.rules[p].label=this.selectedColumn.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;var v=h.nextElementSibling.nextElementSibling,f=v.querySelectorAll("input.e-control");f.length<1&&(f=v.querySelectorAll(".e-template"));for(var y=0;y<f.length;y++)f[y]||(f[y]=h.nextElementSibling.nextElementSibling.querySelector("div.e-control")),f[y]||(f[y]=h.nextElementSibling.nextElementSibling.querySelector(".e-template")),i={groupID:d,ruleID:o,value:a.rules[p].field,type:"field"},this.updateValues(f[y],a.rules[p]);this.isImportRules||this.trigger("change",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 C=void 0;e.parentElement;C=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(),C.length>1&&(a.rules[p].value=[]);for(var b=0;b<C.length;b++)this.updateValues(C[b],a.rules[p]);this.isImportRules||this.trigger("change",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.isImportRules||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},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.isImportRules||this.trigger("change",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),f={type:"dateTime",format:this.columns[v.index].format||"MM/dd/yyyy"};f.type&&(d.indexOf(p)>-1?n.rules[i].value[a]=this.intl.formatDate(l,f):n.rules[i].value=this.intl.formatDate(l,f))}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,this.isPublic=!0;for(var l=0,r=e.length;l<r;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},d.prototype.addGroups=function(e,t){t=this.element.id+"_"+t;var l=document.getElementById(t),r=this.getParentGroup(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",OtherFields:"Other Fields",AND:"AND",OR:"OR",SelectValue:"Enter Value"},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.fields={text:"label",value:"field"}},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){e.actual&&e.actual.result?t.dataColl=e.actual.result: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.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[e],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 t=this,l={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"deleteGroup"};this.isImportRules?this.deleteGroupSuccessCallBack(l,e):this.trigger("beforeChange",l,function(l){t.deleteGroupSuccessCallBack(l,e)})},d.prototype.deleteGroupSuccessCallBack=function(e,l){if(!e.cancel){this.actionButton&&t.getComponent(this.actionButton,"tooltip").destroy();var r=l,n=this.getParentGroup(r,!0),i=0,o=void 0,s=void 0,a=this.getValidRules(this.rule),u=r.nextElementSibling,p=r.previousElementSibling,d=r.querySelectorAll(".e-group-container"),c=r.querySelectorAll(".e-tooltip");for(s=c.length,o=0;o<s;o++)t.getComponent(c[o],"tooltip").destroy();for(o=0,s=d.length;o<s;o++)delete this.levelColl[d[o].id];for(;null!==r.previousElementSibling;)r=r.previousElementSibling,i++;u&&u.className.indexOf("e-separate-rule")>-1&&(t.removeClass([u],"e-separate-rule"),t.addClass([u],"e-joined-rule"),p&&p.className.indexOf("e-rule-container")>-1&&t.addClass([p],"e-prev-joined-rule")),n.rules.splice(i,1),delete this.levelColl[e.groupID],t.detach(l),this.refreshLevelColl(),this.isImportRules||this.trigger("change",e),this.filterRules(a,this.getValidRules(this.rule),"deleteGroup")}},d.prototype.deleteRule=function(e){var l,r,n=this,i={groupID:r=t.closest(e,".e-group-container").id.replace(this.element.id+"_",""),ruleID:l=t.closest(e,".e-rule-container").id.replace(this.element.id+"_",""),cancel:!1,type:"deleteRule"};this.isImportRules?this.deleteRuleSuccessCallBack(i,e):this.trigger("beforeChange",i,function(t){n.deleteRuleSuccessCallBack(t,e)})},d.prototype.deleteRuleSuccessCallBack=function(e,l){if(!e.cancel){this.actionButton&&this.actionButton.className.indexOf("e-tooltip")>-1&&t.getComponent(this.actionButton,"tooltip").destroy();var r=t.closest(l,".e-group-container"),n=this.getParentGroup(r),i=t.closest(l,".e-rule-container"),o=this.getValidRules(this.rule),s=i,a=i.nextElementSibling,u=i.previousElementSibling,p=0,d=i.querySelectorAll(".e-tooltip"),c=void 0,h=d.length;for(c=0;c<h;c++)t.getComponent(d[c],"tooltip").destroy();for(;null!==i.previousElementSibling;)i=i.previousElementSibling,p++;n.rules.splice(p,1),(!u||u.className.indexOf("e-rule-container")<0)&&a&&t.removeClass([a],"e-joined-rule"),(!a||a.className.indexOf("e-rule-container")<0)&&u&&t.removeClass([u],"e-prev-joined-rule"),t.detach(s),this.isImportRules||this.trigger("change",e),this.filterRules(o,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{condition:this.rule.condition,rules:this.rule.rules}},d.prototype.getRule=function(e){var l,r,n=0;e instanceof HTMLElement?l=t.closest(e,".e-rule-container"):(r=this.element.id+"_"+e,l=document.getElementById(r));for(var i=t.closest(l,".e-group-container"),o=this.getParentGroup(i);null!==l.previousElementSibling;)l=l.previousElementSibling,n++;return o.rules[n]},d.prototype.getGroup=function(e){e instanceof Element&&e.className.indexOf("e-group-container")<1&&(e=t.closest(e,".e-group-container"));var l=e instanceof Element?e.id:this.element.id+"_"+e,r=this.getParentGroup(l);return{rules:r.rules,condition:r.condition}},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){var t,l,r,i,o=e.rules,s=!1;if(!o)return t;for(var a=0,u=o.length;a<u;a++)if(Object.keys(o[a]).indexOf("rules")>-1&&o[a].rules)(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=!this.matchCase,"date"===o[a].type&&d.indexOf(p)>-1&&(s=!0),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){this.parser=[],this.sqlParser(e),this.rule={condition:"",rules:[]};var t=this.processParser(this.parser,this.rule,[0]);return{condition:t.condition,rules:t.rules}},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,"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.Property(!1)],d.prototype,"matchCase",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.51 | ||
* version : 17.2.28-beta | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
@@ -5,3 +5,3 @@ { | ||
"_inBundle": false, | ||
"_integrity": "sha512-fy98qmxK7uQR8Cv7oM18E2dY2Kx2q6xEkh4Ec4JTC1Nn+ETpQQddsENjQGRnjxFSVABKZ9MENoqKTbX6imdv7w==", | ||
"_integrity": "sha512-i9Yh4ehRR2l2/+ZlBH65G5qGw4PfbuOfMtUtNiOlVk3aXOG5RDeL1owb/VBMPZZey1tbImjHzboHuMKXc4gpJw==", | ||
"_location": "/@syncfusion/ej2-querybuilder", | ||
@@ -28,3 +28,3 @@ "_phantomChildren": {}, | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-querybuilder/-/ej2-querybuilder-17.1.50.tgz", | ||
"_shasum": "03ca189930a83b2f451f42993d858afb737eb5db", | ||
"_shasum": "c6ddc69246897b52b8afde4315f8e4451b7a5002", | ||
"_spec": "@syncfusion/ej2-querybuilder@*", | ||
@@ -37,8 +37,8 @@ "_where": "/jenkins/workspace/ation_hotfix_16.4.0.42_Vol4-CJVRBFC7Z7RSISPRJNEMNQSRMCB6XTG67IJD6R2DVNXFIKQEITTQ/packages/included", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~17.1.49", | ||
"@syncfusion/ej2-buttons": "~17.1.50", | ||
"@syncfusion/ej2-calendars": "~17.1.51", | ||
"@syncfusion/ej2-dropdowns": "~17.1.49", | ||
"@syncfusion/ej2-inputs": "~17.1.50", | ||
"@syncfusion/ej2-splitbuttons": "~17.1.51" | ||
"@syncfusion/ej2-base": "~17.2.28-beta", | ||
"@syncfusion/ej2-buttons": "~17.2.28-beta", | ||
"@syncfusion/ej2-calendars": "~17.2.28-beta", | ||
"@syncfusion/ej2-dropdowns": "~17.2.28-beta", | ||
"@syncfusion/ej2-inputs": "~17.2.28-beta", | ||
"@syncfusion/ej2-splitbuttons": "~17.2.28-beta" | ||
}, | ||
@@ -74,4 +74,4 @@ "deprecated": false, | ||
}, | ||
"version": "17.1.51", | ||
"version": "17.2.28-beta", | ||
"sideEffects": false | ||
} |
@@ -159,3 +159,4 @@ import { Component, INotifyPropertyChanged, NotifyPropertyChanges, getComponent, MouseEventArgs, Browser } from '@syncfusion/ej2-base';import { Property, ChildProperty, Complex, L10n, closest, extend, isNullOrUndefined, Collection } from '@syncfusion/ej2-base';import { getInstance, addClass, removeClass, rippleEffect, detach, classList } from '@syncfusion/ej2-base';import { Internationalization, DateFormatOptions } from '@syncfusion/ej2-base';import { Button, RadioButton, ChangeEventArgs as ButtonChangeEventArgs } from '@syncfusion/ej2-buttons';import { DropDownList, ChangeEventArgs as DropDownChangeEventArgs, FieldSettingsModel, CheckBoxSelection } from '@syncfusion/ej2-dropdowns';import { MultiSelect, MultiSelectChangeEventArgs, PopupEventArgs } from '@syncfusion/ej2-dropdowns';import { EmitType, Event, EventHandler, getValue, Animation, BaseEventArgs } from '@syncfusion/ej2-base';import { Query, Predicate, DataManager, Deferred } from '@syncfusion/ej2-data';import { TextBox, NumericTextBox, InputEventArgs, ChangeEventArgs as InputChangeEventArgs } from '@syncfusion/ej2-inputs';import { DatePicker, ChangeEventArgs as CalendarChangeEventArgs } from '@syncfusion/ej2-calendars';import { DropDownButton, ItemModel, MenuEventArgs } from '@syncfusion/ej2-splitbuttons';import { Tooltip, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups'; | ||
* Triggers when the component is created. | ||
* @event | ||
* @event | ||
* @blazorProperty 'Created' | ||
*/ | ||
@@ -167,2 +168,3 @@ created?: EmitType<Event>; | ||
* @event | ||
* @blazorProperty 'OnChange' | ||
*/ | ||
@@ -174,2 +176,3 @@ beforeChange?: EmitType<ChangeEventArgs>; | ||
* @event | ||
* @blazorProperty 'Changed' | ||
*/ | ||
@@ -181,2 +184,3 @@ change?: EmitType<ChangeEventArgs>; | ||
* @event | ||
* @blazorProperty 'RuleChanged' | ||
*/ | ||
@@ -183,0 +187,0 @@ ruleChange?: EmitType<RuleChangeEventArgs>; |
@@ -157,3 +157,2 @@ /** | ||
private operators; | ||
private operatorValue; | ||
private ruleElem; | ||
@@ -165,5 +164,9 @@ private groupElem; | ||
private selectedColumn; | ||
private isOperatorRendered; | ||
private isValueRendered; | ||
private actionButton; | ||
/** | ||
* Triggers when the component is created. | ||
* @event | ||
* @blazorProperty 'Created' | ||
*/ | ||
@@ -174,2 +177,3 @@ created: EmitType<Event>; | ||
* @event | ||
* @blazorProperty 'OnChange' | ||
*/ | ||
@@ -180,2 +184,3 @@ beforeChange: EmitType<ChangeEventArgs>; | ||
* @event | ||
* @blazorProperty 'Changed' | ||
*/ | ||
@@ -186,2 +191,3 @@ change: EmitType<ChangeEventArgs>; | ||
* @event | ||
* @blazorProperty 'RuleChanged' | ||
*/ | ||
@@ -275,6 +281,7 @@ ruleChange: EmitType<RuleChangeEventArgs>; | ||
private initialize; | ||
private triggerEvents; | ||
private clickEventHandler; | ||
private beforeSuccessCallBack; | ||
private selectBtn; | ||
private addRuleElement; | ||
private addRuleSuccessCallBack; | ||
private renderToolTip; | ||
@@ -291,6 +298,13 @@ /** | ||
private addGroupElement; | ||
private addGroupSuccess; | ||
notifyChange(value: string | number | boolean | Date | string[] | number[] | Date[], element: Element): void; | ||
private changeValue; | ||
private changeValueSuccessCallBack; | ||
private changeField; | ||
private changeRule; | ||
private changeFilter; | ||
private changeOperator; | ||
private fieldChangeSuccess; | ||
private operatorChangeSuccess; | ||
private changeRuleValues; | ||
private destroyControls; | ||
@@ -349,3 +363,5 @@ private templateDestroy; | ||
private deleteGroup; | ||
private deleteGroupSuccessCallBack; | ||
private deleteRule; | ||
private deleteRuleSuccessCallBack; | ||
private setGroupRules; | ||
@@ -352,0 +368,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1895489
21314
3
+ Added@syncfusion/ej2-base@17.2.49(transitive)
+ Added@syncfusion/ej2-buttons@17.2.47(transitive)
+ Added@syncfusion/ej2-calendars@17.2.49(transitive)
+ Added@syncfusion/ej2-data@17.2.47(transitive)
+ Added@syncfusion/ej2-dropdowns@17.2.49(transitive)
+ Added@syncfusion/ej2-icons@17.2.47(transitive)
+ Added@syncfusion/ej2-inputs@17.2.52(transitive)
+ Added@syncfusion/ej2-lists@17.2.47(transitive)
+ Added@syncfusion/ej2-popups@17.2.47(transitive)
+ Added@syncfusion/ej2-splitbuttons@17.2.47(transitive)
- Removed@syncfusion/ej2-base@17.1.49(transitive)
- Removed@syncfusion/ej2-buttons@17.1.50(transitive)
- Removed@syncfusion/ej2-calendars@17.1.51(transitive)
- Removed@syncfusion/ej2-data@17.1.51(transitive)
- Removed@syncfusion/ej2-dropdowns@17.1.49(transitive)
- Removed@syncfusion/ej2-icons@17.1.47(transitive)
- Removed@syncfusion/ej2-inputs@17.1.50(transitive)
- Removed@syncfusion/ej2-lists@17.1.47(transitive)
- Removed@syncfusion/ej2-popups@17.1.50(transitive)
- Removed@syncfusion/ej2-splitbuttons@17.1.51(transitive)