@syncfusion/ej2-querybuilder 25.2.7 → 26.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +3 -2
- package/dist/ej2-querybuilder.min.js +2 -2
- package/dist/ej2-querybuilder.umd.min.js +2 -2
- package/dist/ej2-querybuilder.umd.min.js.map +1 -1
- package/dist/es6/ej2-querybuilder.es2015.js +1334 -290
- package/dist/es6/ej2-querybuilder.es2015.js.map +1 -1
- package/dist/es6/ej2-querybuilder.es5.js +1327 -282
- package/dist/es6/ej2-querybuilder.es5.js.map +1 -1
- package/dist/global/ej2-querybuilder.min.js +2 -2
- package/dist/global/ej2-querybuilder.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/query-builder/query-builder-model.d.ts +45 -6
- package/src/query-builder/query-builder.d.ts +102 -5
- package/src/query-builder/query-builder.js +1319 -262
- package/src/query-builder/query-library.js +2 -2
- package/styles/bootstrap-dark.css +195 -21
- package/styles/bootstrap-dark.scss +15 -1
- package/styles/bootstrap.css +195 -21
- package/styles/bootstrap.scss +15 -1
- package/styles/bootstrap4.css +199 -22
- package/styles/bootstrap4.scss +15 -1
- package/styles/bootstrap5-dark.css +199 -30
- package/styles/bootstrap5-dark.scss +15 -1
- package/styles/bootstrap5.css +199 -30
- package/styles/bootstrap5.scss +15 -1
- package/styles/fabric-dark.css +193 -20
- package/styles/fabric-dark.scss +15 -1
- package/styles/fabric.css +193 -20
- package/styles/fabric.scss +15 -1
- package/styles/fluent-dark.css +197 -28
- package/styles/fluent-dark.scss +15 -1
- package/styles/fluent.css +197 -28
- package/styles/fluent.scss +15 -1
- package/styles/fluent2.css +2052 -0
- package/styles/fluent2.scss +15 -0
- package/styles/highcontrast-light.css +196 -20
- package/styles/highcontrast-light.scss +15 -1
- package/styles/highcontrast.css +196 -20
- package/styles/highcontrast.scss +15 -1
- package/styles/material-dark.css +206 -24
- package/styles/material-dark.scss +15 -1
- package/styles/material.css +208 -24
- package/styles/material.scss +15 -1
- package/styles/material3-dark.css +213 -26
- package/styles/material3-dark.scss +15 -1
- package/styles/material3.css +213 -26
- package/styles/material3.scss +15 -1
- package/styles/query-builder/_bds-definition.scss +8 -1
- package/styles/query-builder/_bootstrap-dark-definition.scss +8 -0
- package/styles/query-builder/_bootstrap-definition.scss +8 -0
- package/styles/query-builder/_bootstrap4-definition.scss +8 -0
- package/styles/query-builder/_bootstrap5-definition.scss +8 -1
- package/styles/query-builder/_bootstrap5.3-definition.scss +115 -0
- package/styles/query-builder/_fabric-dark-definition.scss +8 -0
- package/styles/query-builder/_fabric-definition.scss +8 -0
- package/styles/query-builder/_fluent-definition.scss +8 -1
- package/styles/query-builder/_fluent2-definition.scss +114 -0
- package/styles/query-builder/_fusionnew-definition.scss +8 -1
- package/styles/query-builder/_highcontrast-definition.scss +8 -0
- package/styles/query-builder/_highcontrast-light-definition.scss +8 -0
- package/styles/query-builder/_layout.scss +273 -12
- package/styles/query-builder/_material-dark-definition.scss +8 -0
- package/styles/query-builder/_material-definition.scss +8 -0
- package/styles/query-builder/_material3-definition.scss +8 -1
- package/styles/query-builder/_tailwind-definition.scss +8 -1
- package/styles/query-builder/_theme.scss +34 -22
- package/styles/query-builder/bootstrap-dark.css +195 -21
- package/styles/query-builder/bootstrap.css +195 -21
- package/styles/query-builder/bootstrap4.css +199 -22
- package/styles/query-builder/bootstrap5-dark.css +199 -30
- package/styles/query-builder/bootstrap5.css +199 -30
- package/styles/query-builder/fabric-dark.css +193 -20
- package/styles/query-builder/fabric.css +193 -20
- package/styles/query-builder/fluent-dark.css +197 -28
- package/styles/query-builder/fluent.css +197 -28
- package/styles/query-builder/fluent2.css +2052 -0
- package/styles/query-builder/fluent2.scss +15 -0
- package/styles/query-builder/highcontrast-light.css +196 -20
- package/styles/query-builder/highcontrast.css +196 -20
- package/styles/query-builder/icons/_bds.scss +4 -0
- package/styles/query-builder/icons/_bootstrap-dark.scss +4 -0
- package/styles/query-builder/icons/_bootstrap.scss +4 -0
- package/styles/query-builder/icons/_bootstrap4.scss +4 -0
- package/styles/query-builder/icons/_bootstrap5.3.scss +11 -0
- package/styles/query-builder/icons/_bootstrap5.scss +4 -0
- package/styles/query-builder/icons/_fabric-dark.scss +4 -0
- package/styles/query-builder/icons/_fabric.scss +4 -0
- package/styles/query-builder/icons/_fluent.scss +4 -0
- package/styles/query-builder/icons/_fluent2.scss +11 -0
- package/styles/query-builder/icons/_fusionnew.scss +4 -0
- package/styles/query-builder/icons/_highcontrast-light.scss +4 -0
- package/styles/query-builder/icons/_highcontrast.scss +4 -0
- package/styles/query-builder/icons/_material-dark.scss +4 -0
- package/styles/query-builder/icons/_material.scss +4 -0
- package/styles/query-builder/icons/_material3.scss +4 -0
- package/styles/query-builder/icons/_tailwind-dark.scss +4 -0
- package/styles/query-builder/icons/_tailwind.scss +4 -0
- package/styles/query-builder/material-dark.css +206 -24
- package/styles/query-builder/material.css +208 -24
- package/styles/query-builder/material3-dark.css +213 -26
- package/styles/query-builder/material3.css +213 -26
- package/styles/query-builder/tailwind-dark.css +206 -24
- package/styles/query-builder/tailwind.css +206 -24
- package/styles/tailwind-dark.css +206 -24
- package/styles/tailwind-dark.scss +15 -1
- package/styles/tailwind.css +206 -24
- package/styles/tailwind.scss +15 -1
- package/CHANGELOG.md +0 -828
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-querybuilder.umd.min.js
|
|
3
|
-
* version :
|
|
3
|
+
* version : 26.1.38
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
7
|
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
8
|
* applicable laws.
|
|
9
9
|
*/
|
|
10
|
-
!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,i,o,n,r,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 i(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(i.prototype=l.prototype,new i)}}(),d=function(){return(d=Object.assign||function(e){for(var t,l=1,i=arguments.length;l<i;l++){t=arguments[l];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)},p=function(e,t,l,i){var o,n=arguments.length,r=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,l):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,l,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(r=(n<3?o(r):n>3?o(t,l,r):o(t,l))||r);return n>3&&r&&Object.defineProperty(t,l,r),r},c=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()],l.prototype,"ruleTemplate",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),p([t.Property(null)],l.prototype,"columns",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(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),p([t.Property(!1)],l.prototype,"not",void 0),p([t.Property(null)],l.prototype,"isLocked",void 0),l}(t.ChildProperty),m=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"numericTextBoxModel",void 0),p([t.Property(null)],l.prototype,"multiSelectModel",void 0),p([t.Property(null)],l.prototype,"datePickerModel",void 0),p([t.Property(null)],l.prototype,"textBoxModel",void 0),p([t.Property(null)],l.prototype,"radioButtonModel",void 0),l}(t.ChildProperty),g=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(!1)],l.prototype,"cloneRule",void 0),p([t.Property(!1)],l.prototype,"cloneGroup",void 0),p([t.Property(!1)],l.prototype,"lockRule",void 0),p([t.Property(!1)],l.prototype,"lockGroup",void 0),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),f=function(e){function c(t,l){var o=e.call(this,t,l)||this;return o.isReadonly=!0,o.fields={text:"label",value:"field"},o.updatedRule={not:!1,condition:"and",isLocked:!1},o.isLocale=!1,o.isRefreshed=!1,o.isNotified=!1,o.isAddSuccess=!1,o.isNotValueChange=!1,o.isFieldChange=!1,o.isFieldClose=!1,o.isDestroy=!1,o.isGetNestedData=!1,o.isCustomOprCols=[],o.groupCounter=0,o.lockItems=[],o.groupIndex=-1,o.ruleIndex=-1,o.isLastGroup=!1,o.cloneGrpBtnClick=!1,o.isMiddleGroup=!1,o.cloneRuleBtnClick=!1,i.MultiSelect.Inject(i.CheckBoxSelection),o}return u(c,e),c.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},c.prototype.reset=function(){this.isImportRules=!1;for(var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),i=0,o=l.length;i<o;i++)l[i].className.indexOf("e-tooltip")>-1?t.getComponent(l[i],"tooltip").destroy():l[i].parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(l[i].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var n=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),s=this.createElement("div",{attrs:{class:"e-group-body"}});n.appendChild(r).appendChild(s),this.element.appendChild(n),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&t.removeClass(this.element.querySelectorAll(".e-qb-toggle"),"e-active-toggle"),e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),this.disableRuleCondition(e.parentElement)},c.prototype.getWrapper=function(){return this.element},c.prototype.getModuleName=function(){return"query-builder"},c.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},c.prototype.GetRootColumnName=function(e){return this.separator?e.split(this.separator)[0]:e},c.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],i=void 0,o=!1,n=!1,r=void 0,s={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=0,u=(d=this.columns).length;a<u;a++)this.updateCustomOperator(d[a],"initial"),d[a].type||(e.indexOf(d[a].field)>-1&&("string"===(i=typeof(r=this.dataColl[0][d[a].field]))?n=!isNaN(Date.parse(r)):"object"===i&&(n=r instanceof Date&&!isNaN(r.getTime()),i="string"),d[a].type=i,n=!1),i="string"),d[a].validation||(d[a].validation=s),d[a].category?o=!0:d[a].category=this.l10n.getConstant("OtherFields"),l.indexOf(d[a].category)<0&&l.push(d[a].category),(!d[a].operators||this.isLocale&&0!==this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);o&&(l.length>1||l[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(a=0,u=e.length;a<u;a++)"string"===(i=typeof(r=this.dataColl[0][e[a]]))?n=!isNaN(Date.parse(r)):"object"!==i||Object.keys(r).length||(n=r instanceof Date&&!isNaN(r.getTime()),i="string"),t[a]={field:e[a],label:e[a],type:n?"date":i,validation:s},n=!1,t[a].operators=this.customOperators[t[a].type+"Operator"],"object"===i&&this.updateSubFields(r,t[a]);this.columns=t}}else if(this.columns.length){var d;for(a=0,u=(d=this.columns).length;a<u;a++)d[a].category?this.fields={text:"label",value:"field",groupBy:"category"}:d[a].category=this.l10n.getConstant("OtherFields"),this.updateCustomOperator(d[a]),d[a].operators&&!this.isLocale||(d[a].operators=this.customOperators[d[a].type+"Operator"]);this.updateSubFieldsFromColumns(this.columns)}this.trigger("dataBound",{type:"dataBound"})},c.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},c.prototype.updateSubFields=function(e,t,l){var i;t.columns=[];var o,n,r=Object.keys(e);l=l||this.dataColl[0];for(var s=0,a=r.length;s<a;s++){var u=t.field.split(".");n=l?l[u[u.length-1]][r[s]]:this.dataColl[0][t.field][r[s]];var d=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];o=typeof n,i={field:t.field+this.separator+r[s],label:r[s],type:o="object"!==o||isNaN(Date.parse(n))?o:"date"},"object"!==o&&(i.operators=this.customOperators[o+"Operator"]),t.columns.push(i),"object"===o&&this.updateSubFields(n,i,d)}},c.prototype.updateCustomOperator=function(e,l){if(e.operators){this.isLocale||"initial"!==l||t.isNullOrUndefined(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var i=function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var i=e.operators[t],n=Object.keys(i),r=n.map(function(e){return i[""+e]}).join(",").split(","),s=n.indexOf("value");o.operators[r[s]]=r[l]}},o=this,n=0;n<e.operators.length;n++)i(n)}},c.prototype.focusEventHandler=function(e){this.target=e.target},c.prototype.clickEventHandler=function(e){var l,i=this,o=e.target;this.isImportRules=!1;var n;if("SPAN"===o.tagName&&(o=o.parentElement),o.className.indexOf("e-collapse-rule")>-1){var r=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var s=document.getElementById(this.element.id+"_summary_content"),a=s.querySelector(".e-summary-text");r.animate(".e-query-builder",{name:"SlideLeftIn"});(d=this.element.querySelector(".e-group-container")).style.display="none",a.textContent=this.getSqlFromRules(this.rule),s.style.display="block",a.style.height=a.scrollHeight+"px"}if("BUTTON"===o.tagName&&o.className.indexOf("e-qb-toggle")<0)switch(!0){case o.className.indexOf("e-removerule")>-1:this.actionButton=o,this.deleteRule(o);break;case o.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=o,this.cloneRuleBtnClick=!0,this.ruleClone(o);break;case o.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=o,this.ruleLock(o);break;case o.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=o,this.groupLock(o);break;case o.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=o,this.cloneGrpBtnClick=!0,this.groupClone(t.closest(o,".e-group-container"));break;case o.className.indexOf("e-deletegroup")>-1:this.actionButton=o,this.deleteGroup(t.closest(o,".e-group-container"));break;case o.className.indexOf("e-edit-rule")>-1:if((r=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,!1,this.rule.not);var u=t.extend({},this.rule,{},!0);this.setGroupRules(u),this.renderSummaryCollapse()}else{var d;(d=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}else if("LABEL"===o.tagName&&o.parentElement.className.indexOf("e-btn-group")>-1||o.className.indexOf("e-qb-toggle")>-1){var p=t.closest(o,".e-group-container");if(!this.headerTemplate){var c=o.getAttribute("for"),h=void 0;c&&(h=document.getElementById(c).getAttribute("value")),n=p.id.replace(this.element.id+"_","");var m=this.getGroup(n),g=void 0;if(this.enableNotCondition)if(o.className.indexOf("e-qb-toggle")>-1){var f=p.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?(t.removeClass([f],"e-active-toggle"),g=!1):(t.addClass([f],"e-active-toggle"),g=!0),h=m.condition}else g=m.not;l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(l,o):this.trigger("beforeChange",l,function(e){i.beforeSuccessCallBack(e,o)}),this.target=o}},c.prototype.beforeSuccessCallBack=function(e,l){if(e&&!e.cancel){var i=t.closest(l,".e-group-container"),o=i.id.replace(this.element.id+"_",""),n=this.getValidRules(this.rule),r=this.getParentGroup(i);r.condition=e.value,this.enableNotCondition&&(r.not=e.not),this.isImportRules||this.trigger("change",{groupID:o,type:"condition",value:r.condition}),this.filterRules(n,this.getValidRules(this.rule),"condition")}},c.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert||t.isNullOrUndefined(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?t.addClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.removeClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&t.addClass([l.element.querySelector("li").parentElement],"e-rtl")):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)},c.prototype.appendRuleElem=function(e,l,i,o,n,r){var s,a,u,d=e.querySelector(".e-rule-list");if("change"===i?s=t.select("#"+o,e):((s=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick?(this.ruleIndex<0?d.appendChild(s):d.insertBefore(s,d.children[this.ruleIndex+1]),this.cloneRuleBtnClick=!1):d.appendChild(s),this.ruleIdCounter++),l&&l.ruleTemplate&&r){u={requestType:"template-initialize",ruleID:s.id,action:n,fields:this.fields,rule:r},this.trigger("actionBegin",u),this.ruleTemplateFn=this.templateParser(l.ruleTemplate);var p=this.element.id+l.field;if(u.fields=this.fields,u.columns=this.columns,""===r.field&&(r.field=l.field),u.operators=this.getOperators(r.field),u.operatorFields={text:"key",value:"value"},this.isReact)(a=this.ruleTemplateFn(u,this,s.id,p)[0]).className+=" e-rule-field",s.appendChild(a);else if(this.isAngular){var c=this.ruleTemplateFn(u,this,s.id,p);(a=3===c[0].nodeType?c[1]:c[0]).className+=" e-rule-field",s.appendChild(a)}else this.isVue3?(a=this.ruleTemplateFn(u,this,"Template",p),t.append(a,s),s.children[s.children.length-1].className+=" e-rule-field"):((a=this.ruleTemplateFn(u,this,"Template",p)[0]).className+=" e-rule-field",s.appendChild(a))}else a=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),s.appendChild(a);return this.showButtons.lockGroup&&t.removeClass(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&t.removeClass(s.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&t.removeClass(s.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&t.removeClass(s.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&t.removeClass(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),l&&l.ruleTemplate&&r&&this.renderReactTemplates(),s},c.prototype.addRuleElement=function(e,t,l,i,o,n){var r=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,i,o,n)):this.trigger("beforeChange",s,function(s){r.addRuleSuccessCallBack(s,e,t,l,i,o,n)})}},c.prototype.addRuleSuccessCallBack=function(e,l,o,n,r,s,a){var u,p,c,h,m=this.element.className.indexOf("e-device")>-1?"250px":"200px",g=o&&o.field?this.getColumn(o.field):n||this.columns[0],f={label:"",field:"",type:"",operator:""};if(!e.cancel){if(g&&g.ruleTemplate&&o.field){this.selectedColumn=g,p=this.selectedColumn.operators,f={label:g.label,field:g.field,type:g.type,operator:p[0].value};var y=Object.keys(o).length?o:f,v={requestType:"template-create",action:"insert-rule",ruleID:(h=this.appendRuleElem(l,g,r,s,"field",y)).id,fields:this.fields,rule:y};this.trigger("actionBegin",v)}else{(h=this.appendRuleElem(l,g,r,s,"field")).querySelector(".e-filter-input").setAttribute("id",h.id+"_filterkey");var b=h.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)b.textContent=this.l10n.getConstant("Remove"),t.addClass([b],"e-flat"),t.addClass([b],"e-primary");else{t.addClass([b],"e-round"),t.addClass([b],"e-icon-btn"),b.setAttribute("title",this.l10n.getConstant("DeleteRule"));var C=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});h.querySelector(".e-rule-delete").appendChild(C)}this.showButtons.ruleDelete||b.classList.add("e-button-hide")}if("Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?h.className="e-rule-container e-vertical-mode":h.className="e-rule-container e-horizontal-mode",h.previousElementSibling&&h.previousElementSibling.className.indexOf("e-rule-container")>-1&&(h.className.indexOf("e-joined-rule")<0&&(h.className+=" e-joined-rule"),h.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(h.previousElementSibling.className+=" e-prev-joined-rule")),h.previousElementSibling&&h.previousElementSibling.className.indexOf("e-group-container")>-1&&h.className.indexOf("e-separate-rule")<0&&(h.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(l,o,f,a,s),!g||g&&!g.ruleTemplate||!o.field)if("Default"===this.fieldMode){var S=void 0,x=void 0;x=this.separator&&o.field?this.GetRootColumnName(o.field):this.autoSelectField?this.GetRootColumnName(o.field):this.isImportRules?this.GetRootColumnName(o.field):o.field,S={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?m:"auto",close:this.fieldClose.bind(this,h.id+"_filterkey"),change:this.changeField.bind(this),value:o?x:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(S=d({},S,this.fieldModel)),(c=new i.DropDownList(S)).appendTo("#"+h.id+"_filterkey");var O=void 0;O=this.separator&&o.field?this.GetRootColumnName(o.field):this.isImportRules?this.GetRootColumnName(o.field):c.value,this.selectedColumn=c.getDataByValue(O),Object.keys(o).length&&this.changeRule(o,{element:c.element,itemData:this.selectedColumn})}else{S=void 0,x=(this.isImportRules,o.field);this.dummyDropdownTreeDs=t.extend([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),S={fields:{dataSource:this.dummyDropdownTreeDs,value:"field",text:"label",child:"columns",expanded:"expanded",selectable:"selectable"},placeholder:this.l10n.getConstant("SelectField"),showClearButton:!1,popupHeight:this.columns.length>5?m:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:t.isNullOrUndefined(x)?null:[x],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt"},this.fieldModel&&(S=d({},S,this.fieldModel));var k=new i.DropDownTree(S);if(k.appendTo("#"+h.id+"_filterkey"),!t.isNullOrUndefined(k.value)){var w=this.getLabelFromColumn(k.value[0]);k.element.value=w}O=t.isNullOrUndefined(o.field)?k.value:this.GetRootColumnName(o.field);this.selectedColumn=this.getColumn(O),Object.keys(o).length&&this.changeRule(o,{element:k.element,itemData:this.selectedColumn})}u=h.id.replace(this.element.id+"_",""),this.isImportRules||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:u,type:"insertRule"})}},c.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type&&(e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns))},c.prototype.updateAddedRule=function(e,l,i,o,n){var r,s,a,u=0;if(o){for(r=t.select("#"+n,e),s=t.closest(e,".e-group-container"),a=this.getParentGroup(s);r&&null!==r.previousElementSibling;)r=r.previousElementSibling,u++;a.rules[u]=l}else{s=t.closest(e,".e-group-container"),a=this.getParentGroup(s);var d=l.custom;Object.keys(l).length?this.ruleIndex<0?(a.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),d&&(a.rules[a.rules.length-1].custom=d)):(a.rules.splice(this.ruleIndex+1,0,{field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),d&&(a.rules[this.ruleIndex+1].custom=d)):(d&&(i.custom=d),this.autoSelectField&&(l.field=i.field=this.rule.rules[0].field),a.rules.push(i))}this.disableRuleCondition(e,a)},c.prototype.changeRuleTemplate=function(e,l){var i=this.selectedColumn.operators;if(!e.ruleTemplate){var o=t.closest(l,".e-group-container"),n=t.closest(l,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&(t.detach(l.closest('[id="'+n+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([n])),e){var r={field:e.field,label:e.label,operator:i[0].value,value:""};this.addRuleElement(o,r,e,"change",n,!0)}}},c.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},c.prototype.validateFields=function(){var e,l=!0;if(this.allowValidation){var i=["isnull","isnotnull","isempty","isnotempty"],o=void 0,n=void 0,r=void 0,s=void 0,a=[],u=void 0,d=void 0,p=void 0,c=void 0,h=void 0,m=this.element.querySelectorAll(".e-rule-container");for(o=0,n=m.length;o<n;o++){var g=void 0;if(u=t.closest(m[o],".e-group-container"),h=this.getParentGroup(u),d=0,s=c=m[o],"DropdownTree"===this.fieldMode?(e=t.getComponent(m[o].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(p=t.getComponent(m[o].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&p.value&&(this.selectedColumn=p.getDataByValue(p.value),g=!t.isNullOrUndefined(p.index)&&this.selectedColumn.validation),r=c.querySelector(".e-rule-field input.e-control"),g&&g.isRequired){for(;s&&null!==s.previousElementSibling;)s=s.previousElementSibling,d++;if(r=c.querySelector(".e-rule-operator .e-control"),h.rules[d].operator||(r.parentElement.className.indexOf("e-tooltip")<0&&r.className.indexOf("e-tooltip")<0&&this.renderToolTip(r.parentElement),l=!1),h.rules[d].value instanceof Array&&(a=h.rules[d].value),i.indexOf(h.rules[d].operator)<-1&&t.isNullOrUndefined(h.rules[d].value)&&"date"!==h.rules[d].type||""===h.rules[d].value||h.rules[d].value instanceof Array&&a.length<1){var f=c.querySelectorAll(".e-rule-value .e-control");l=!1;for(var y=0,v=f.length;y<v;y++){var b=f[y],C=void 0;b.parentElement.className.indexOf("e-searcher")>-1?(C=t.closest(b,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(C):f[y].parentElement.className.indexOf("e-tooltip")<0&&f[y].className.indexOf("e-tooltip")<0&&this.renderToolTip(f[y].parentElement),y++}}}else(p&&p.element&&t.isNullOrUndefined(p.index)||e&&e.element&&(t.isNullOrUndefined(e.value)||e.value.length<1))&&(r.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(r.parentElement),l=!1)}}return l},c.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");if(e){this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)}},c.prototype.refreshLevel=function(e){var l,i,o=e.groupElement.querySelector(".e-rule-list").children,n=e.groupElement,r=o.length,s=0;for(i=0;i<r;i++)(l=o[i]).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(n,".e-rule-list");return e.groupElement=a?t.closest(a,".e-group-container"):n,e.level=this.levelColl[e.groupElement.id].slice(),e},c.prototype.groupTemplate=function(){var e,t,l,i,o,n=this.createElement("div",{attrs:{class:"e-group-container"}}),r=this.createElement("div",{attrs:{class:"e-group-header"}}),s=this.createElement("div",{attrs:{class:"e-group-body"}}),a=this.createElement("div",{attrs:{class:"e-rule-list"}});return n.appendChild(r),s.appendChild(a),n.appendChild(s),this.headerTemplate||(e=this.createElement("div",{attrs:{class:"e-lib e-btn-group",role:"group"}}),this.enableNotCondition&&(t=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),e.appendChild(t)),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),e.appendChild(t),l=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),e.appendChild(l),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),e.appendChild(t),l=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),e.appendChild(l),r.appendChild(e),i=this.createElement("div",{attrs:{class:"e-group-action"}}),o=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(o),r.appendChild(i)),n},c.prototype.ruleTemplate=function(){var e,l,i,o,n=this.createElement("div"),r=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}});var s=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(s),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),r.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),i=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",o=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var a=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:i}}),u=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});a.appendChild(u);var d=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:o}});u=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),d.appendChild(u),l=this.showButtons.ruleDelete||t.isNullOrUndefined(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";var p=this.createElement("button",{attrs:{type:"button",class:l}});return e.appendChild(a),e.appendChild(d),e.appendChild(p),r.appendChild(e),n.appendChild(r),n},c.prototype.addGroupElement=function(e,t,l,i,o,n,r){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,i,o,n,r)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,l,i,o,n,r)})},c.prototype.addGroupSuccess=function(e,i,o,n,r,a,u,d){if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var p=o,c=void 0,h="";h=p.className.indexOf("e-group-container")<0?p.querySelector(".e-group-container")&&p.querySelector(".e-group-container").id:p.id;var m=this.groupElem.cloneNode(!0);if(m.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),this.headerTemplate&&(u?(i=!1,m.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(m,a,n,d,h),this.groupIdCounter=0):this.headerTemplateFn(m,a,n,d,h)),this.groupIdCounter++,!this.headerTemplate){var g=m.querySelector(".e-btngroup-and"),f=m.querySelector(".e-btngroup-or"),y=m.querySelector(".e-btngroup-and-lbl"),v=m.querySelector(".e-btngroup-or-lbl");g.setAttribute("id",this.element.id+"_and"+this.btnGroupId),f.setAttribute("id",this.element.id+"_or"+this.btnGroupId),g.setAttribute("name",this.element.id+"_and"+this.btnGroupId),f.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),v.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(i){var b=void 0;b=this.showButtons.groupDelete||t.isNullOrUndefined(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",c=this.createElement("button",{attrs:{type:"button",class:b}});new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(c),c.setAttribute("title",this.l10n.getConstant("DeleteGroup")),t.rippleEffect(c,{selector:".deletegroup"});for(var C=p.querySelector(".e-rule-list"),S=C.children,x=0,O=0,k=S.length;O<k;O++)S[O].className.indexOf("e-group-container")>-1&&(x+=1);this.showButtons.cloneGroup&&this.cloneGrpBtnClick?this.groupIndex===S.length-1?(C.appendChild(m),this.isLastGroup=!0):(S[this.groupIndex+1].parentNode.insertBefore(m,S[this.groupIndex+1]),this.isMiddleGroup=!0):C.appendChild(m);var w=this.levelColl[p.id].slice(0);if(w.push(x),this.levelColl[m.id]=w,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],p.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,r&&this.addRuleToNewGroups&&this.addRuleElement(m,{})),!this.headerTemplate){var q="";q=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var N=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:q}}),E=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});N.appendChild(E),m.querySelector(".e-group-action").appendChild(N),q=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";var R=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:q}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});R.appendChild(I),m.querySelector(".e-group-action").appendChild(R),m.querySelector(".e-group-action").appendChild(c)}}else{if(!this.headerTemplate){q="";q=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide";R=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:q}}),E=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});R.appendChild(E),m.querySelector(".e-group-action").appendChild(R)}p.appendChild(m),this.levelColl[m.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var L=m.querySelector(".e-qb-toggle");new l.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"}).appendTo(L),m.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&t.addClass([L],"e-active-toggle")}if(this.updatedRule=null,this.headerTemplate){var T={requestType:"header-template-create",ruleID:m.id,condition:n,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",T)}else{var D=m.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,D),select:this.selectBtn.bind(this,D)}).appendTo(D),D.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules){var B=p.id.replace(this.element.id+"_",""),P=m.id.replace(this.element.id+"_","");this.trigger("change",{groupID:B,type:"insertGroup",childGroupID:P})}}},c.prototype.headerTemplateFn=function(e,l,i,o,n){var r,s,a=this.element.id+"_header",u=e.querySelector(".e-group-header");if(this.headerTemplate){if(s={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?l:void 0,condition:i,rule:this.getRuleCollection(o,!0),groupID:n},this.trigger("actionBegin",s),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)r=this.headerFn(s,this,e.id,a)[0],u.appendChild(r);else if(this.isAngular){var d=this.headerFn(s,this,e.id,a);r=3===d[0].nodeType?d[1]:d[0],u.appendChild(r)}else this.isVue3?(r=this.headerFn(s,this,e.id,a),t.append(r,u)):(r=this.headerFn(s,this,"Template",a)[0],u.appendChild(r));this.renderReactTemplates()}return e},c.prototype.notifyChange=function(e,l,i){var o=t.closest(l,".e-group-container"),n=this.getParentGroup(o),r=t.closest(l,".e-rule-container"),s=0;if("not"!==i)if("condition"!==i){for(;r&&null!==r.previousElementSibling;)r=r.previousElementSibling,s++;var a=n.rules[s],u=this.getColumn(a.field),d=this.getFormat(u.format);if("date"===u.type)if(e instanceof Date)e=this.intl.formatDate(e,d);else if(e instanceof Array)for(var p=0;p<e.length;p++)e[p]&&e[p]instanceof Date&&(e[p]=this.intl.formatDate(e[p],d));u.ruleTemplate?this.templateChange(l,e,i):(this.isNotified=!0,this.updateRules(l,e),this.isNotified=!1)}else n.condition=e;else n.not=e},c.prototype.templateChange=function(e,l,i){var o,n=t.closest(e,".e-group-container"),r=this.getParentGroup(n),s=t.closest(e,".e-rule-container"),a=0;for(this.allowValidation&&this.validateValue(r,s);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,a++;var u=r.rules[a];"field"===i?this.selectedColumn=this.getColumn(l):u&&(this.selectedColumn=this.getColumn(u.field));var d;this.previousColumn=this.getColumn(u.field);var p=this.getValidRules(this.rule);this.selectedColumn&&(d=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var c,h=["in","notin","between","notbetween"];switch(i){case"field":u.field=l,u.label=this.selectedColumn.label,u.type=this.selectedColumn.type,u.value="",u.operator=d[0].value;break;case"operator":c=u.operator,u.operator=l,h.indexOf(u.operator)>-1?u.value=[]:h.indexOf(c)>-1&&(u.value="");break;case"value":u.value=l}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(p,this.getValidRules(this.rule),i),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===i||"operator"===i)){var m=t.closest(e,".e-rule-container");this.destroyControls(m,!0),t.detach(m.querySelector(".e-rule-field"));var g=this.appendRuleElem(t.closest(m,".e-group-container"),this.selectedColumn,"change",m.id,i,u);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?g.className="e-rule-container e-vertical-mode":g.className="e-rule-container e-horizontal-mode",g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-rule-container")>-1&&(g.className.indexOf("e-joined-rule")<0&&(g.className+=" e-joined-rule"),g.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(g.previousElementSibling.className+=" e-prev-joined-rule")),g.previousElementSibling&&g.previousElementSibling.className.indexOf("e-group-container")>-1&&g.className.indexOf("e-separate-rule")<0&&(g.className+=" e-separate-rule");var f={requestType:"template-create",action:i,ruleID:m.id,fields:this.fields,rule:u};o={groupID:n.id.replace(this.element.id+"_",""),ruleID:m.id.replace(this.element.id+"_",""),value:u.field,type:"field"},this.trigger("actionBegin",f),this.trigger("change",o)}},c.prototype.changeValue=function(e,l){var i,o=this;if(this.isNumInput&&"number"==typeof l.value)this.isNumInput=!1;else{if(l.element&&l.element.classList.contains("e-multiselect")){i=l.element}else i=l.event?l.event.target:"input"===l.type&&l.currentTarget?l.currentTarget:l.element;if(i.className.indexOf("e-day")>-1||i.className.indexOf("e-today")>-1||i.className.indexOf("e-cell")>-1){i=l.element}var r,s=t.closest(i,".e-group-container"),a=t.closest(i,".e-rule-container"),u=s&&s.id.replace(this.element.id+"_",""),d=a.id.replace(this.element.id+"_",""),p=l;p.element&&p.element.className.indexOf("e-datepicker")>-1&&(i=p.element,(r=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=r.getDataByValue(r.value)),(r=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(r.value[0])));var c,h;if(i.className.indexOf("e-radio")>-1)if(h=parseInt(i.id.split("valuekey")[1],0),"Default"===this.fieldMode?(r=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=r.getDataByValue(r.value),this.selectedColumn.columns&&(r=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(r.value))):(r=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(r.value[0])),this.selectedColumn.values)c=this.selectedColumn.values[h];else{c=[!0,!1][h]}else if(i.className.indexOf("e-multiselect")>-1)c=t.getComponent(i,"multiselect").value;else if(c=l.value,"input"===l.type&&l.currentTarget){c=Number(l.currentTarget.value);t.getInstance(l.currentTarget,n.NumericTextBox).value=c,this.isNumInput=!0}"input"===l.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){o.filterValue(u,d,c,e,i)},this.immediateModeDelay)):this.filterValue(u,d,c,e,i)}},c.prototype.filterValue=function(e,t,l,i,o){var n=this,r={groupID:e,ruleID:t,value:l,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(r,o,i,e,t):this.trigger("beforeChange",r,function(l){n.changeValueSuccessCallBack(l,o,i,e,t)})},c.prototype.changeValueSuccessCallBack=function(e,t,l,i,o){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules||this.trigger("change",{groupID:i,ruleID:o,value:e.value,cancel:!1,type:"value"}))},c.prototype.fieldClose=function(e){if(!this.isFieldChange&&!this.isDestroy){this.isFieldClose=!0;var l=t.getComponent(e,"dropdownlist"),i=l.popupObj.element.querySelector(".e-active"),o=l.getItemData();l.value=o.value;var n={element:l.element,value:o.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:i,itemData:o,event:null,e:null};l.previousValue!==l.value&&this.changeField(n),this.isFieldChange=!1}},c.prototype.changeField=function(e){if(e.isInteracted){if(t.isNullOrUndefined(e.value))return;this.isFieldChange=!0,this.prevItemData=e.itemData;var l=t.closest(e.element,".e-rule-filter")||t.closest(e.element,".e-rule-sub-filter"),i="DropdownTree"===this.fieldMode?this.getColumn(e.value[0]):this.getColumn(e.value);if("DropdownTree"===this.fieldMode&&null!==l){var o=l.querySelector(".e-dropdowntree.e-control"),n=t.getComponent(o,"dropdowntree");if(!i)return;if("object"===i.type){if(n.value=e.oldValue,n.dataBind(),t.isNullOrUndefined(e.oldValue))o.value="";else{var r=this.getLabelFromColumn(e.oldValue[0]);o.value=r}return}if(!t.isNullOrUndefined(e.value[0])){n.value=e.value[0],n.dataBind();r=this.getLabelFromColumn(e.value[0]);o.value=r}}if(this.destroySubFields(l),this.subFieldElem=null,this.isNotValueChange=!0,i&&i.ruleTemplate)this.templateChange(e.element,i.field,"field");else if(i&&i.columns&&i.columns[0].ruleTemplate)this.templateChange(e.element,i.columns[0].field,"field");else{for(var s=t.closest(e.element,".e-group-container"),a=this.getParentGroup(s),u=t.closest(e.element,".e-rule-container"),d=0;u&&null!==u.previousElementSibling;)u=u.previousElementSibling,d++;a.rules[d].value="",this.changeRule(a.rules[d],e)}}},c.prototype.changeRule=function(e,l){if(!l.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==t.getComponent(l.element,"dropdowntree").value)return}var i=t.closest(l.element,".e-rule-filter");i=i||t.closest(l.element,".e-rule-sub-filter");var o=t.getComponent(l.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==i&&(o=t.getComponent(l.element,"dropdowntree"));var n=t.closest(l.element,".e-group-container").id.replace(this.element.id+"_","");this.changeFilter(i,o,n,e,{},l)},c.prototype.changeFilter=function(e,l,i,o,n,r){var s=this;if(e){var a=void 0;a="DropdownTree"===this.fieldMode?l.value[0]:this.isImportRules?this.GetRootColumnName(l.value):l.value,this.selectedColumn=this.getColumn(a);var u={groupID:i,ruleID:t.closest(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:"DropdownTree"===this.fieldMode?l.value[0]:l.value,cancel:!1,type:"field"};this.isImportRules?this.fieldChangeSuccess(u,n,e,o,r):this.trigger("beforeChange",u,function(t){s.fieldChangeSuccess(t,n,e,o,r)})}else{var d=t.closest(r.element,".e-rule-operator");this.changeOperator(e,d,l,i,o,n,r)}},c.prototype.changeOperator=function(e,l,i,o,n,r,s){var a,u=this;l?(a={groupID:o,ruleID:t.closest(l,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:i.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(a,e,r,n,s):this.trigger("beforeChange",a,function(t){u.operatorChangeSuccess(t,e,r,n,s)})):this.changeRuleValues(e,n,r,s)},c.prototype.fieldChangeSuccess=function(e,l,i,o,n){for(var r=t.closest(i,".e-rule-container"),s=t.closest(n.element,".e-rule-operator"),a=t.closest(n.element,".e-group-container").id.replace(this.element.id+"_",""),u=t.getComponent(n.element,"dropdownlist"),d=r.querySelectorAll(".e-tooltip.e-input-group"),p=0;p<d.length;p++)t.getComponent(d[p],"tooltip").destroy();if(e.cancel)this.changeOperator(i,s,u,a,o,l,n);else{if(t.isNullOrUndefined(this.selectedColumn))return;if(l.type=this.selectedColumn.type,r.querySelector(".e-template")&&(o.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(l.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(i,o,l,n);else this.destroySubFields(i),this.changeOperator(i,s,u,a,o,l,n)}},c.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},c.prototype.createSubFields=function(e,l,o,n){var r=!1,s=t.closest(e,".e-rule-field"),a=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}});s.insertBefore(a,s.querySelector(".e-rule-operator"));var u=t.closest(a,".e-rule-container").id,p=this.createElement("input",{attrs:{type:"text",id:u+"_subfilterkey"+this.subFilterCounter}});a.appendChild(p);var c,h=this.element.className.indexOf("e-device")>-1?"250px":"200px";c={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.selectedColumn.columns.length>5?h:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},this.fieldModel&&(c=d({},c,this.fieldModel));var m=new i.DropDownList(c);if(m.appendTo("#"+u+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(l.field)===this.GetRootColumnName(this.previousColumn.field))for(var g=this.selectedColumn.columns,f=0;f<g.length;f++)if(l.field===g[f].field||l.field.indexOf(g[f].field+this.separator)>-1){m.value=g[f].field,this.selectedColumn=g[f],r=!0;break}this.subFilterCounter++,this.subFieldElem=p,n.itemData=n.itemData,!r&&this.selectedColumn.columns&&(!r&&this.isImportRules&&(m.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(a,l,o,n)},c.prototype.operatorChangeSuccess=function(e,l,i,o,n){if(!e.cancel){var r=t.closest(n.element,".e-rule-operator"),s=r.nextElementSibling,a=t.getComponent(n.element,"dropdownlist"),u=o.operator?o.operator.toString().toLowerCase():"";i.operator=a.value.toString();var d=i.operator.toLowerCase();if(i.operator.toLowerCase().indexOf("between")>-1||i.operator.toLowerCase().indexOf("in")>-1&&i.operator.toLowerCase().indexOf("contains")<0?(l=r.previousElementSibling,i.type=o.type,(i.operator.toLowerCase().indexOf("in")<0||u.indexOf("in")<0)&&(o.value=[])):"object"==typeof o.value&&null!==o.value&&(o.value=o.value.length>0?o.value[0]:"number"===o.type?0:""),n.previousItemData){var p=n.previousItemData.value.toString().toLowerCase();(p.indexOf("between")>-1||(p.indexOf("in")>-1||p.indexOf("null")>-1||p.indexOf("empty")>-1)&&p.indexOf("contains")<0)&&(l=r.previousElementSibling,i.type=o.type)}if(u.indexOf("in")>-1&&u.indexOf("in")<5&&d.indexOf("in")>-1&&d.indexOf("in")<5&&(l=null),i.operator.indexOf("null")>-1||i.operator.indexOf("empty")>-1){var c=r.parentElement.querySelector(".e-rule-value"),h=c.querySelector(".e-tooltip.e-input-group");h&&t.getComponent(h,"tooltip").destroy(),t.removeClass([c],"e-show"),t.addClass([c],"e-hide")}s&&this.getColumn(o.field).template&&(l=r.previousElementSibling),0==s.children.length&&(l=r.previousElementSibling),this.changeRuleValues(l,o,i,n)}},c.prototype.changeRuleValues=function(e,l,o,n){var r,s,a,u=t.closest(n.element,".e-rule-operator");if(e)if(u=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(o.type=this.selectedColumn.type,u=u.classList.contains("e-rule-sub-filter")?u.nextElementSibling:u),t.addClass([u],"e-operator"),u.childElementCount){r=t.getComponent(u.querySelector(".e-dropdownlist"),"dropdownlist"),o.operator=r.value;var p=void 0;p="DropdownTree"===this.fieldMode?t.getComponent(e.querySelector(".e-dropdowntree"),"dropdowntree"):t.getComponent(e.querySelector(".e-dropdownlist"),"dropdownlist"),o.type="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]).type:this.getColumn(p.value).type;var c=n.itemData;""!==r.value&&this.renderValues(u,c,n.previousItemData,!0,l,o,n.element)}else{var h=t.closest(u,".e-rule-container").id;a=this.createElement("input",{attrs:{type:"text",id:h+"_operatorkey"}}),u.appendChild(a),this.selectedColumn.operators?s=this.selectedColumn.operators:n.itemData&&(s=this.customOperators[this.selectedColumn.type+"Operator"]);var m=this.element.className.indexOf("e-device")>-1?"250px":"200px",g=s[0].value,f=0;this.autoSelectOperator||(g="",f=-1),(this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1)&&(g=l&&l.operator?l.operator:g);var y=void 0;y={dataSource:s,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:s.length>5?m:"auto",change:this.changeField.bind(this),index:f,value:g,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(y=d({},y,this.operatorModel));new i.DropDownList(y).appendTo("#"+h+"_operatorkey"),o.operator=l&&""!==l.operator&&!t.isNullOrUndefined(l.operator)?l.operator:s[0].value,this.isImportRules&&(o.type=this.selectedColumn.type,o.operator=l.operator),t.isNullOrUndefined(g)||""===g?this.autoSelectField&&this.autoSelectOperator&&this.renderValues(u,this.selectedColumn,n.previousItemData,!1,l,o,n.element):this.renderValues(u,this.selectedColumn,n.previousItemData,!1,l,o,n.element)}this.isImportRules||this.updateRules(n.element,n.item)},c.prototype.popupOpen=function(e,l){this.enableRtl&&t.addClass([l.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},c.prototype.destroyControls=function(e,l){for(var i=l?e:e.nextElementSibling,o=i.querySelectorAll("input.e-control"),n=i.querySelectorAll("div.e-control:not(.e-handle)"),r=this.columns,s=0,a=o.length;s<a;s++){if(o[s].classList.contains("e-textbox"))t.getComponent(o[s],"textbox").destroy(),t.detach(t.select("input#"+o[s].id,i));else if(o[s].classList.contains("e-dropdownlist"))this.allowValidation&&o[s].parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(o[s].parentElement,"tooltip").destroy(),t.getComponent(o[s],"dropdownlist").destroy();else if(o[s].classList.contains("e-radio"))t.getComponent(o[s],"radio").destroy();else if(o[s].classList.contains("e-numerictextbox"))t.getComponent(o[s],"numerictextbox").destroy(),t.detach(t.select("input#"+o[s].id,i));else if(o[s].classList.contains("e-datepicker"))t.getComponent(o[s],"datepicker").destroy();else if(o[s].classList.contains("e-multiselect"))t.getComponent(o[s],"multiselect").destroy();else if(o[s].className.indexOf("e-template")>-1)for(var u=o[s].className,d=0,p=r.length;d<p;d++)if(r[d].template&&u.indexOf(r[d].field)>-1){this.templateDestroy(r[d],o[s].id);break}document.getElementById(o[s].id)&&t.detach(o[s])}for(s=0,a=n.length;s<a;s++){if(n[s].className.indexOf("e-template")>-1)for(u=n[s].className,d=0,p=r.length;d<p;d++)if(r[d].template&&u.indexOf(r[d].field)>-1){this.templateDestroy(r[d],n[s].id);break}t.detach(n[s])}var c=i.querySelectorAll(".e-template:not(.e-control)");for(s=0,a=c.length;s<a;s++)t.detach(c[s])},c.prototype.templateDestroy=function(e,l){var i;if("string"!=typeof e.template||void 0===e.template.destroy){var o=(i=e.template).destroy;if(i.destroy){var n=void 0;document.getElementById(l)&&(n=t.closest(document.getElementById(l),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof o?(o=t.getValue(o,window))({field:e.field,elementId:l,elements:n}):i.destroy({field:e.field,elementId:l,elements:n})}}},c.prototype.getValues=function(e){var t,l={},i=[],o=[];this.separator.length>0&&(o=e.split(this.separator));var n=this.dataColl;if(this.dataColl[1])for(var r=0,s=n.length;r<s;r++){var a={};if(o.length>1)for(var u=n[r],d=void 0,p=0,c=o.length;p<c;p++)d=o[p],o.length===p+1?(t=u[""+d],Number(u[""+d])===u[""+d]&&u[""+d]%1!=0&&(t=u[""+d].toString())):u=u[""+d];else t=n[r][""+e],Number(n[r][""+e])===n[r][""+e]&&n[r][""+e]%1!=0&&(t=n[r][""+e].toString());t in l||(l[""+t]=1,o.length>1?this.createNestedObject(a,o,t):a[""+e]=t,i.push(a))}return i},c.prototype.createNestedObject=function(e,t,l){for(var i,o=t.length-1,n=0;n<o;++n)(i=t[n])in e||(e[""+i]={}),e=e[""+i];e[t[o]]=l},c.prototype.getDistinctValues=function(e,t){for(var l={},i=[],o=[],n="",r=t.indexOf(this.separator),s=function(s,u){0===r?n=e[s][""+t]:(o=t.split(a.separator)).forEach(function(t){n=n?n[""+t]:e[s][""+t]}),Number(e[s][""+t])===e[s][""+t]&&e[s][""+t]%1!=0&&(n=e[s][""+t].toString());var d={};n in l||(l[""+n]=1,0===r?d[""+t]=n:d[o[o.length-1]]=n,i.push(d))},a=this,u=0,d=e.length;u<d;u++)s(u);return i},c.prototype.renderMultiSelect=function(e,t,l,n,r){var s,a=!1,u=!1;this.isGetNestedData=!1,this.dataColl[1]&&Object.keys(this.dataColl[1]).indexOf(e.field)>-1&&(a=!0,s=this.getDistinctValues(this.dataColl,e.field)),a=!e.columns&&a,!this.dataColl.length&&r.length&&(u=!0);var p;p={dataSource:u?r:a?s:this.dataManager,query:new o.Query([e.field]),fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:n,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(p=d({},p,this.valueModel.multiSelectModel));var c=new i.MultiSelect(p);c.appendTo("#"+t+"_valuekey"+l),this.updateRules(c.element,n,0)},c.prototype.multiSelectOpen=function(e,l){if(this.dataSource instanceof o.DataManager){var i=document.getElementById(e),n=t.getComponent(t.closest(i,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist");this.selectedColumn=n.getDataByValue(n.value);var r=this.selectedColumn.field,s=!1;if(this.dataColl[1]){Object.keys(this.dataColl[1]).indexOf(r)>-1&&(s=!0);0!==r.indexOf(this.separator)&&this.isGetNestedData&&(s=!0)}s||(l.cancel=!0,this.bindMultiSelectData(i,r))}},c.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},c.prototype.getMultiSelectData=function(e,l){var i,n=this,r=new o.Deferred,s=this.dataManager.executeQuery((new o.Query).select(l)),u=t.getComponent(e,"multiselect");u.hideSpinner(),this.createSpinner(t.closest(e,".e-multi-select-wrapper").parentElement),a.showSpinner(t.closest(e,".e-multi-select-wrapper").parentElement),s.then(function(o){i=o.actual&&o.actual.result?o.actual.result:o.result,n.dataColl=t.extend(n.dataColl,i,[],!0),u.dataSource=n.getDistinctValues(n.dataColl,l),n.isGetNestedData=!0,a.hideSpinner(t.closest(e,".e-multi-select-wrapper").parentElement)}).catch(function(e){r.reject(e)})},c.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"})},c.prototype.closePopup=function(e,l){var i=document.getElementById(l.popup.element.id.replace("_popup",""));if(i){var o=t.getComponent(i,"multiselect").value;this.updateRules(i,o,e)}},c.prototype.processTemplate=function(e,l,i,o){var n=t.closest(e,".e-rule-container"),r=n.querySelectorAll(".e-template"),s=n.querySelector(".e-rule-filter .e-filter-input"),a="DropdownTree"===this.fieldMode?t.getComponent(s,"dropdowntree"):t.getComponent(n.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),u="DropdownTree"===this.fieldMode?this.getColumn(a.value[0]):this.getColumn(a.value);if("string"==typeof l.template||void 0===l.template.write){var d={rule:i,ruleID:n.id,operator:o.operator,field:u.field,requestType:"value-template-create"};this.trigger("actionBegin",d)}else{var p=l.template;"string"==typeof p.write?t.getValue(p.write,window)({elements:r.length>1?r:r[0],values:i.value,operator:o.operator,field:u.field,dataSource:u.values}):"function"!=typeof l.template&&l.template.write({elements:r.length>1?r:r[0],values:i.value,operator:o.operator,field:u.field,dataSource:u.values})}},c.prototype.getItemData=function(e){var l=t.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist");return"DropdownTree"===this.fieldMode&&(l=t.getComponent(document.getElementById(e+"_filterkey"),"dropdowntree")),"DropdownTree"===this.fieldMode?this.getColumn(l.value[0]):this.getColumn(l.value)},c.prototype.setDefaultValue=function(e,l,i){var o=this.getItemData(e);if(t.isNullOrUndefined(o.value))return i?l?[0,0]:0:l?[]:"";if(l){if(!(o.value instanceof Array))return[o.value]}else if(o.value instanceof Array)return o.value[0];return o.value},c.prototype.renderStringValue=function(e,t,l,i,o){var r,s,a=this.getItemData(e),u="string"==typeof a.template;if(s=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||""!=t.value?t.value:this.setDefaultValue(e,!1,!1),"in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values){"in"!==l&&"notin"!==l||(s=(r=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(","));var p=void 0;p={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.textBoxModel&&(p=d({},p,this.valueModel.textBoxModel));var c=new n.TextBox(p);c.appendTo("#"+e+"_valuekey"+i),c.value=s,c.dataBind()}else r=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,i,r,a.values),"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?o.style.width="100%":(o.style.width=null,o.style.minWidth="200px")},c.prototype.renderNumberValue=function(e,t,l,i,o,r,s){var a=this.getItemData(e),u="string"==typeof a.template,p=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1||this.isPublic||u||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);if("in"!==l&&"notin"!==l||!this.dataColl.length&&!a.values)if("in"===l||"notin"===l){var c=(p=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1)).join(","),h=void 0;h={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.textBoxModel&&(h=d({},h,this.valueModel.textBoxModel));var m=new n.TextBox(h);m.appendTo("#"+e+"_valuekey"+i),m.value=c,m.dataBind()}else{var g=(r=a).validation&&r.validation.min?r.validation.min:0,f=r.validation&&r.validation.max?r.validation.max:Number.MAX_VALUE,y=r.format?r.format:"n";s>1&&t&&(p=t.value[i]?t.value[i]:this.setDefaultValue(e,!0,!0));var v=void 0;v={value:p instanceof Array?p[i]:p,format:y,min:g,max:f,width:"100%",step:r.step?r.step:1,change:this.changeValue.bind(this,i)},this.valueModel&&this.valueModel.numericTextBoxModel&&(v=d({},v,this.valueModel.numericTextBoxModel));var b=new n.NumericTextBox(v);b.appendTo("#"+e+"_valuekey"+i),b.element.setAttribute("aria-label",r.label+" Value"),b.element.oninput=this.changeValue.bind(this,i)}else p=this.isImportRules||this.ruleIndex>-1||this.groupIndex>-1?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(a,e,i,p,a.values),this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode?o.style.width="100%":(o.style.minWidth="200px",o.style.width=null)},c.prototype.processValueString=function(e,t){var l=[],i=e.split(",");if("string"===t)return i;for(var o=0,n=i.length;o<n;o++)l.push(Number(i[o]));return l},c.prototype.parseDate=function(e,l){var i,o;if(l){var n=this.intl.getDateParser({skeleton:"full",type:"dateTime"});i=this.getFormat(l),o=n(e),t.isNullOrUndefined(o)&&(o=this.intl.parseDate(e,i))}else o=new Date(e);return o},c.prototype.renderControls=function(e,l,i,o,n){if(t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),t.removeClass([e.parentElement.querySelector(".e-rule-value")],"e-hide"),t.addClass([e.parentElement.querySelector(".e-rule-value")],"e-show"),l.template&&(l.template.create||n))this.processTemplate(e,l,i,o);else{var s;s="boolean"===o.type?this.selectedColumn.values?this.selectedColumn.values.length:2:o.operator&&o.operator.toString().toLowerCase().indexOf("between")>-1?2:1;var a=t.closest(e,".e-rule-container").id,u=void 0,p=o.operator.toString();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"!==p&&"notin"!==p?t.addClass([u],"e-custom-value"):t.removeClass([u],"e-custom-value");for(var c=0;c<s;c++)switch(o.type){case"string":this.renderStringValue(a,i,p,c,u);break;case"number":this.renderNumberValue(a,i,p,c,u,l,s);break;case"boolean":this.processBoolValues(l,i,a,c);break;case"date":var h=new Date,m=void 0,g=void 0,f=l.format,y=void 0,v=void 0,b=this.l10n.getConstant("SelectValue"),C="string"==typeof l.template;if(i.value&&!t.isNullOrUndefined(f)&&(m=s>1?i.value[c]:i.value,h=this.parseDate(m,f)||new Date),l.field||l.key||!l.value||(h=l.value instanceof Date?l.value:this.parseDate(l.value,l.format)),!l.format&&i&&""!==i.field&&(f=(g=this.getColumn(i.field)).format),(this.isImportRules||this.isPublic||C)&&i&&(f=(g=this.getColumn(i.field)).format,i.value?(m=s>1?i.value[c]:i.value,h=this.parseDate(m,g.format)):h=i.value),f){var S=this.getFormat(f);S.skeleton?(v={locale:this.getLocale(),value:h,placeholder:b,format:S,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(v=d({},v,this.valueModel.datePickerModel)),y=new r.DatePicker(v)):(v={value:h,locale:this.getLocale(),placeholder:b,format:S.format,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(v=d({},v,this.valueModel.datePickerModel)),y=new r.DatePicker(v))}else v={locale:this.getLocale(),value:h,placeholder:b,change:this.changeValue.bind(this,c)},this.valueModel&&this.valueModel.datePickerModel&&(v=d({},v,this.valueModel.datePickerModel)),y=new r.DatePicker(v);if(y.appendTo("#"+a+"_valuekey"+c),!i.value){var x=document.getElementById(a+"_valuekey"+c);this.updateRules(x,h,null,this.isNotValueChange),this.isNotValueChange=!1}}}}},c.prototype.processBoolValues=function(e,i,o,n){var r,s,a=!1;t.isNullOrUndefined(i.type)&&e&&(i.type=e.type);var u;if(e.values){var p=e.values;"boolean"!==i.type||t.isNullOrUndefined(i.value)?e.value?a=p[n].toLowerCase()===e.value.toString().toLowerCase():0===n&&(a=!0):a=p[n].toLowerCase()===i.value.toString().toLowerCase(),s=r=u=p[n]}else{p=[!0,!1];"boolean"!==i.type||t.isNullOrUndefined(i.value)?e.value?a=p[n].toString().toLowerCase()===e.value.toString().toLowerCase():0===n&&(a="boolean"!=typeof i.value||!!i.value):a=p[n].toString().toLowerCase()===i.value.toString().toLowerCase(),"boolean"==typeof i.value&&1===n&&(a=!i.value),r=p[n].toString(),s=p[n],u=this.l10n.getConstant(["True","False"][n])}var c;c={label:u,name:o+"default",checked:a,value:r,change:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.radioButtonModel&&(c=d({},c,this.valueModel.radioButtonModel));var h=new l.RadioButton(c);h.appendTo("#"+o+"_valuekey"+n),a&&this.updateRules(h.element,s,0,!0)},c.prototype.getOperatorIndex=function(e,t){var l,i=e.dataSource.length;for(l=0;l<i;l++)if(t.operator===e.dataSource[l].value)return l;return 0},c.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&e&&(e=this.getColumn(e.value)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},c.prototype.renderValues=function(e,l,i,o,n,r,s){var a=e.previousElementSibling.getElementsByTagName("input")[0],u="DropdownTree"===this.fieldMode?t.getComponent(a,"dropdowntree"):t.getComponent(a,"dropdownlist"),d="DropdownTree"===this.fieldMode?this.getColumn(u.value[0]):this.getColumn(u.value);this.selectedRule=d;var p=t.getComponent(e.querySelector("input"),"dropdownlist");o&&(l=s.id.indexOf("operator")>-1?l:this.selectedRule).operators&&(p.value=null,p.dataBind(),p.dataSource=l.operators,p.index=this.getOperatorIndex(p,n),p.value=r.operator=p.dataSource[p.index].value,this.autoSelectOperator?p.dataBind():(p.index=-1,r.operator=p.value=""));var c=r.operator.toString(),h=!1;if(c.indexOf("null")>-1||c.indexOf("isempty")>-1||c.indexOf("isnotempty")>-1){(f=e.parentElement.querySelector(".e-rule-value"))&&(t.removeClass([f],"e-show"),t.addClass([f],"e-hide"))}else{var m=t.closest(e,".e-rule-container").id;if((i=this.getPreviousItemData(i,d))&&void 0===i.template?i.columns&&(i=this.getColumn(n.field)):"DropdownTree"===this.fieldMode&&void 0===i&&(i=this.getColumn(n.field)),i&&i.template){this.templateDestroy(i,m+"_valuekey0");var g=t.select("#"+m+"_valuekey0",e.nextElementSibling);g&&!g.classList.contains("e-control")&&t.detach(t.select("#"+m+"_valuekey0",e.nextElementSibling)),"string"!=typeof i.template&&void 0!==i.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([m]),e.nextElementSibling.innerHTML="")}if(o&&(this.validateValue(n,t.closest(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||p&&""!==p.value){if(d&&(l.template=d.template),l.template&&(t.addClass([e.nextElementSibling],"e-template-value"),l.template=d.template,h=this.setColumnTemplate(l,m,d.field,l.value||c,e,n)),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.width="200px"}else{t.removeClass([e.nextElementSibling],"e-template-value");var y=1;y="boolean"===r.type?this.selectedColumn.values?this.selectedColumn.values.length:2:c&&c.toLowerCase().indexOf("between")>-1?2:1;for(var v=0;v<y;v++){var b=this.createElement("input",{attrs:{type:"text",id:m+"_valuekey"+v}});e.nextElementSibling.appendChild(b)}}this.renderControls(e,l,n,r,h)}}},c.prototype.setColumnTemplate=function(e,l,i,o,n,r){var s,a=this,u=!0;if(e.template){if("string"==typeof e.template||void 0===e.template.create)return s={requestType:"value-template-initialize",ruleID:l,field:i,operator:o,rule:r,renderTemplate:!0},this.trigger("actionBegin",s,function(t){u=a.actionBeginSuccessCallBack(t,e,l,i,n)}),u;var d=void 0,p=e.template;if((d="string"==typeof p.create?t.getValue(p.create,window)({field:i,operator:o}):p.create({field:i,operator:o}))instanceof Element)d.id=l+"_valuekey0",t.addClass([d],"e-template"),n.nextElementSibling.appendChild(d),i.indexOf(" ")<0&&t.addClass([d],"e-"+i);else if(d instanceof Array){t.addClass(d,"e-template");for(var c=0,h=d.length;c<h;c++)d[c].id=l+"_valuekey"+c,n.nextElementSibling.appendChild(d[c])}return t.addClass([n.nextElementSibling],"e-template-value"),!0}return!0},c.prototype.actionBeginSuccessCallBack=function(e,l,i,o,n){if(e.renderTemplate){var r=void 0;this.columnTemplateFn=this.templateParser((l.template,l.template));var s=this.element.id+o;if(this.isReact)r=this.columnTemplateFn(e,this,i,s)[0],n.nextElementSibling.appendChild(r);else if(this.isAngular){var a=this.columnTemplateFn(e,this,i,s);r=3===a[0].nodeType?a[1]:a[0],n.nextElementSibling.appendChild(r)}else this.isVue3?(r=this.columnTemplateFn(e,this,"Template",s),t.append(r,n.nextElementSibling)):(r=this.columnTemplateFn(e,this,"Template",s)[0],n.nextElementSibling.appendChild(r));return t.addClass([n.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0}return!1},c.prototype.updateValues=function(e,l){var i=1;e.className.indexOf("e-template")>-1&&(i=3);var o=e.className.split(" e-")[i],n=parseInt(e.id.slice(-1),2);switch(o){case"checkbox":var r=t.getComponent(e,o).value;l.value=""!==r?r:void 0;break;case"textbox":case"dropdownlist":l.value=t.getComponent(e,o).value;break;case"radio":var s=t.getComponent(e,o);s.checked&&("boolean"==typeof l.value?l.value="true"===s.value:this.getColumn(l.field).values?l.value=s.value:l.value="true"===s.value),s.refresh();break;case"numerictextbox":l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[n]=t.getComponent(e,o).value):l.value=t.getComponent(e,o).value;break;case"datepicker":var a=this.getColumn(l.field),u=this.getFormat(a.format),d=t.getComponent(e,o).value;l.operator.indexOf("between")>-1?("string"==typeof l.value&&(l.value=[]),l.value[n]=this.intl.formatDate(d,u)):t.isNullOrUndefined(u.format)&&d?l.value=this.intl.formatDate(d):l.value=d?this.intl.formatDate(d,u):d;break;case"multiselect":l.value=t.getComponent(e,o).value}},c.prototype.updateRules=function(e,l,i,o){for(var n,r,s=t.closest(e,".e-group-container"),a=this.getParentGroup(s),u=t.closest(e,".e-rule-container"),d=0,p=s.id.replace(this.element.id+"_",""),c=this.getValidRules(this.rule);u&&null!==u.previousElementSibling;)u=u.previousElementSibling,d++;var h=a.rules[d].operator?a.rules[d].operator.toString():"",m=(u=t.closest(e,".e-rule-container")).id.replace(this.element.id+"_","");if(t.closest(e,".e-rule-filter")||t.closest(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem),n="DropdownTree"===this.fieldMode?t.getComponent(e,"dropdowntree"):t.getComponent(e,"dropdownlist");var g="DropdownTree"===this.fieldMode?this.getColumn(n.value[0]):this.getColumn(n.value);!this.isImportRules&&a.rules[d].field&&a.rules[d].field.toLowerCase()!==g.field.toLowerCase()&&(!u.querySelectorAll(".e-template")&&!(h.indexOf("null")>-1)||h.indexOf("empty")>-1)&&(a.rules[d].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),a.rules[d].field=this.selectedColumn.field,a.rules[d].type=this.selectedColumn.type,a.rules[d].label=this.selectedColumn.label;var f=t.closest(e,".e-rule-filter"),y=(f=f||t.closest(e,".e-rule-sub-filter")).nextElementSibling.querySelector("input.e-control");y=y||f.nextElementSibling.nextElementSibling.querySelector("input.e-control"),h=t.getComponent(y,"dropdownlist").value.toString(),a.rules[d].operator=h;var v=f.nextElementSibling.nextElementSibling,b=v.querySelectorAll("input.e-control");b.length<1&&(b=v.querySelectorAll("div.e-control")),b.length<1&&(b=v.querySelectorAll(".e-template")),r={groupID:p,ruleID:m,value:a.rules[d].field,type:"field"};for(var C=0;C<b.length;C++)h.indexOf("null")>-1||h.indexOf("empty")>-1?a.rules[d].value=null:this.updateValues(b[C],a.rules[d]);this.isImportRules||this.trigger("change",r),this.allowValidation&&a.rules[d].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[d].operator=n.value.toString();var S=u.querySelectorAll(".e-rule-value input.e-control");r={groupID:p,ruleID:m,value:n.value,type:"operator"},this.allowValidation&&a.rules[d].operator&&e.parentElement.className.indexOf("e-tooltip")>-1&&t.getComponent(e.parentElement,"tooltip").destroy(),S.length>1&&!(S[0].className.indexOf("e-template")>-1)&&(a.rules[d].value=[]);for(var x=0;x<S.length;x++)a.rules[d].operator.indexOf("null")>-1||a.rules[d].operator.indexOf("empty")>-1?a.rules[d].value=null:S[x].classList.contains("e-template")||this.updateValues(S[x],a.rules[d]);this.isImportRules||this.trigger("change",r),this.filterRules(c,this.getValidRules(this.rule),"operator")}else t.closest(e,".e-rule-value")&&(this.ruleValueUpdate(e,l,a,d,s,u,i),o||this.filterRules(c,this.getValidRules(this.rule),"value"))},c.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})!==JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})&&(this.isImportRules||this.trigger("ruleChange",{previousRule:e,rule:t,type:l}))},c.prototype.ruleValueUpdate=function(e,t,l,i,o,n,r){var s,a,u=["in","between","notin","notbetween"];if(l.rules[i].operator&&(a=l.rules[i].operator.toString().toLowerCase()),null!==t){if(e.className.indexOf("e-multiselect")>-1&&"number"===l.rules[i].type&&!this.isNotified){for(var d=[],p=t,c=0,h=p.length;c<h;c++)"string"==typeof p[c]&&d.push(parseFloat(p[c]));d.length&&(t=d)}if(this.isNotified)l.rules[i].value=t,s={groupID:o.id,ruleID:n.id,value:l.rules[i].value,type:"value"},this.isImportRules||this.trigger("change",s);else if(e.className.indexOf("e-spin")>-1||e.className.indexOf("e-numeric")>-1)u.indexOf(a)>-1?l.rules[i].value[r]=t:l.rules[i].value=t;else if(e.className.indexOf("e-radio")>-1)l.rules[i].value=t;else if(e.className.indexOf("e-multiselect")>-1)l.rules[i].value=t;else if(e.className.indexOf("e-textbox")>-1)"in"===a||"notin"===a?(l.rules[i].type,l.rules[i].value=this.processValueString(t,l.rules[i].type)):l.rules[i].value=t;else if(e.className.indexOf("e-datepicker")>-1){var m=this.getFormat(this.getColumn(this.selectedColumn.field).format);m.type&&(u.indexOf(a)>-1?("string"==typeof l.rules[i].value&&(l.rules[i].value=[]),l.rules[i].value[r]=this.intl.formatDate(t,m)):l.rules[i].value=this.intl.formatDate(t,m))}this.validateValue(l,n,i)}else e.className.indexOf("e-datepicker")>-1&&u.indexOf(a)>-1?("string"==typeof l.rules[i].value&&(l.rules[i].value=[]),l.rules[i].value[r]=t):l.rules[i].value=t},c.prototype.validateValue=function(e,l,i){t.isNullOrUndefined(i)||(e=e.rules[i]);var o="object"==typeof e.value;if(this.allowValidation&&(t.isNullOrUndefined(i)||(o?e.value.length>0:e.value))){var n=l.querySelectorAll(".e-rule-value .e-control");n.length>0&&(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())}},c.prototype.getFormat=function(e){var t;return e?"string"==typeof e?(t={type:"dateTime"},"short"===e||"yMd"===e?(t.type="date",t.skeleton=e):t.format=e):t={type:"dateTime",skeleton:e.skeleton}:t={type:"date",skeleton:"yMd"},t},c.prototype.findGroupByIdx=function(e,t,l){var i=t.rules,o=[];if(!l){for(var n=0,r=i.length;n<r;n++)(t=i[n]).rules&&o.push(t);return o[e]}return t},c.prototype.destroy=function(){this.isDestroy=!0;if(this.element){var l,i,o,n;e.prototype.destroy.call(this);var r;for(o=(l=this.element.querySelectorAll(".e-addrulegroup")).length,i=0;i<o;i++)t.getComponent(l[i],"dropdown-btn").destroy(),t.detach(l[i]);for(n=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),i=0;i<n.length;i++)t.getComponent(n[i],"tooltip").destroy();for(o=(l=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)")).length,i=0;i<o;i++)t.getComponent(l[i],"dropdownlist")?t.getComponent(l[i],"dropdownlist").destroy():t.getComponent(l[i],"dropdowntree").destroy(),t.detach(l[i]);for(n=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),i=0;i<n.length;i++)t.getComponent(n[i],"tooltip").destroy();for(o=(l=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)")).length,i=0;i<o;i++)t.getComponent(l[i],"dropdownlist")&&(t.getComponent(l[i],"dropdownlist").destroy(),t.detach(l[i]));for(n=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),i=0;i<n.length;i++)t.getComponent(n[i],"tooltip").destroy();if(this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate(),r=document.querySelectorAll(".qb-dropdownlist.e-popup"))for(i=0;i<r.length;i++)r[i].remove();t.classList(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1}},c.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,i=e.length;l<i;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},c.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),i=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var o=0,n=e.length;o<n;o++)this.updatedRule={isLocked:e[o].isLocked,condition:e[o].condition,not:e[o].not},this.importRules(e[o],l,!1,e[o].not);this.isPublic=!1}else{var r="and",s=!1,a=!1;this.updatedRule&&(r=this.updatedRule.condition,s=this.updatedRule.not,a=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?i.rules.push({condition:r,not:s,rules:[]}):i.rules.push({condition:r,rules:[]}):this.enableNotCondition?i.rules.splice(this.groupIndex+1,0,{condition:r,not:s,rules:[],isLocked:a}):i.rules.splice(this.groupIndex+1,0,{condition:r,rules:[],isLocked:a})}this.headerTemplate||this.disableRuleCondition(l,i)}},c.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&t.addClass([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),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(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),t.addClass(this.element.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,!1,this.rule.not,!1,this.rule);var e=t.extend({},this.rule,{},!0);this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1}else this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{});this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var l=this.element.querySelectorAll("label.e-btn"),i=void 0,o=0;o<l.length;o++)i=l.item(o),t.rippleEffect(i,{selector:".e-btn"})}},c.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:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),i=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),i.appendChild(l),e.appendChild(i),this.element.appendChild(e)},c.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)},c.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new o.DataManager(this.columns).executeLocal((new o.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new o.DataManager(this.columns).executeLocal((new o.Query).sortBy("field")))},c.prototype.onChangeNotGroup=function(){if(this.element.innerHTML="",this.groupIdCounter=0,!this.headerTemplate)if(this.enableNotCondition){if(this.enableNotCondition){var e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}});this.groupElem.querySelector(".e-btn-group").insertBefore(e,this.groupElem.querySelector(".e-btngroup-and"))}}else this.groupElem.querySelector(".e-qb-toggle").remove();this.setProperties({rule:this.checkNotGroup(this.rule)},!0),this.initWrapper()},c.prototype.notGroupRtl=function(){this.enableRtl?t.addClass(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):t.removeClass(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},c.prototype.checkNotGroup=function(e){var l;if(e.rules)for(var i=0;i<e.rules.length;i++)l=e.rules[i],l=this.checkNotGroup(l),e.rules[i]=l;return t.isNullOrUndefined(e.not)?this.enableNotCondition&&!t.isNullOrUndefined(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},c.prototype.onPropertyChanged=function(e,l){for(var i=0,o=Object.keys(e);i<o.length;i++){switch(o[i]){case"summaryView":var n=this.element.querySelector(".e-group-container"),r=this.element.querySelector(".e-summary-content");e.summaryView?(n.style.display="none",this.element.querySelectorAll(".e-summary-content").length<1?(this.renderSummary(),r=this.element.querySelector(".e-summary-content")):this.element.querySelector(".e-summary-text").textContent=this.getSqlFromRules(this.rule),r.style.display="block"):(n.querySelectorAll(".e-collapse-rule").length>-1&&this.renderSummaryCollapse(),n.style.display="block",r.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":t.isNullOrUndefined(e.showButtons.lockGroup)||(e.showButtons.lockGroup?t.removeClass(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),t.isNullOrUndefined(e.showButtons.lockRule)||(e.showButtons.lockRule?t.removeClass(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),t.isNullOrUndefined(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?t.removeClass(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),t.isNullOrUndefined(e.showButtons.cloneRule)||(e.showButtons.cloneRule?t.removeClass(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):t.addClass(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),t.isNullOrUndefined(e.showButtons.ruleDelete)||(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")),t.isNullOrUndefined(e.showButtons.groupDelete)||(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.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?(t.addClass([this.element],"e-rtl"),this.notGroupRtl()):(t.removeClass([this.element],"e-rtl"),this.notGroupRtl());break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource,this.refresh();break;case"columns":this.columns=e.columns,this.columnSort(),this.updateSubFieldsFromColumns(this.columns);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":0!==this.rule.rules.length||t.isNullOrUndefined(this.rule)||this.reset(),this.setProperties({rule:e.rule},!0),e.rule=this.getRuleCollection(this.rule,!1),this.setRules(this.rule);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),this.isLocale=!0,this.refresh(),this.isLocale=!1;break;case"enableNotCondition":this.onChangeNotGroup();break;case"readonly":this.isReadonly=e.readonly,this.enableReadonly()}}},c.prototype.preRender=function(){this.element.id=this.element.id||t.getUniqueID("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",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",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new t.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new t.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{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")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],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")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],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",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},c.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();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof o.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new o.Query).take(1))):(this.dataManager=new o.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new o.Query),this.initControl()),this.renderComplete()},c.prototype.templateParser=function(e){if(e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?t.compile(document.querySelector(e).innerHTML.trim()):t.compile(e)}catch(l){return t.compile(e)}},c.prototype.executeDataManager=function(e){var t=this,l=this.dataManager.executeQuery(e),i=new o.Deferred;l.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){i.reject(e)})},c.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},c.prototype.wireEvents=function(){var e=this.getWrapper();t.EventHandler.add(e,"click",this.clickEventHandler,this),t.EventHandler.add(e,"focusout",this.focusEventHandler,this),t.EventHandler.add(e,"focusin",this.focusEventHandler,this),t.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this)},c.prototype.unWireEvents=function(){var e=this.getWrapper();t.EventHandler.remove(e,"click",this.clickEventHandler),t.EventHandler.remove(e,"focusout",this.focusEventHandler),t.EventHandler.remove(e,"focusin",this.focusEventHandler),t.EventHandler.remove(this.element,"keydown",this.keyBoardHandler)},c.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],i=t?l.length-1:l.length,o=this.rule,n=0;n<i;n++)o=this.findGroupByIdx(l[n],o,0===n);return o},c.prototype.deleteGroup=function(e){var t,l=this,i=e;"string"==typeof e?(t=this.element.id+"_"+e,e=document.getElementById(t)):t=i.id.replace(this.element.id+"_","");var o={groupID:t,cancel:!1,type:"deleteGroup"};this.isImportRules?this.deleteGroupSuccessCallBack(o,e):this.trigger("beforeChange",o,function(t){l.deleteGroupSuccessCallBack(t,e)})},c.prototype.deleteGroupSuccessCallBack=function(e,l){if(!e.cancel){var i=l,o=this.getParentGroup(i,!0),n=0,r=void 0,s=void 0,a=this.getValidRules(this.rule),u=i.nextElementSibling,d=i.previousElementSibling,p=i.querySelectorAll(".e-group-container"),c=i.querySelectorAll(".e-tooltip");for(s=c.length,r=0;r<s;r++)t.getComponent(c[r],"tooltip").destroy();for(r=0,s=p.length;r<s;r++)delete this.levelColl[p[r].id];for(;null!==i.previousElementSibling;)i=i.previousElementSibling,n++;u&&u.className.indexOf("e-separate-rule")>-1&&(t.removeClass([u],"e-separate-rule"),t.addClass([u],"e-joined-rule"),d&&d.className.indexOf("e-rule-container")>-1&&t.addClass([d],"e-prev-joined-rule"));var h=i.parentElement.parentElement.parentElement,m=[];if(this.isReact||this.isAngular){var g=o.rules[n],f=l.querySelectorAll(".e-rule-container");if(g&&g.rules)for(var y=0;y<g.rules.length;y++){var v=this.getColumn(g.rules[y].field);if(f[y]){var b=f[y].querySelector(".e-template-value");v&&(v.ruleTemplate||this.isPlatformTemplate(v)&&b)&&m.push(f[y].id)}}}t.detach(l),this.headerTemplate&&this.clearQBTemplate([l.id]),m.length&&this.clearQBTemplate(m),o.rules.splice(n,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(h,o),this.isImportRules||this.trigger("change",e),this.filterRules(a,this.getValidRules(this.rule),"deleteGroup")}},c.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},c.prototype.deleteRule=function(e){var l=this,i={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(i,e):this.trigger("beforeChange",i,function(t){l.deleteRuleSuccessCallBack(t,e)})},c.prototype.deleteRuleSuccessCallBack=function(e,l){if(!e.cancel){var i=t.closest(l,".e-group-container"),o=this.getParentGroup(i),n=t.closest(l,".e-rule-container"),r=this.getValidRules(this.rule),s=n,a=n.nextElementSibling,u=n.previousElementSibling,d=0,p=n.querySelectorAll(".e-tooltip"),c=void 0,h=p.length;for(c=0;c<h;c++)t.getComponent(p[c],"tooltip").destroy();for(;null!==n.previousElementSibling;)n=n.previousElementSibling,d++;var m=this.getColumn(o.rules[d].field);m&&m.template&&s.querySelector(".e-template")&&this.templateDestroy(m,s.querySelector(".e-template").id),(!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");var g=s.querySelector(".e-template-value");try{t.detach(s)}catch(e){(e=[]).error="error"}m&&m.ruleTemplate&&this.clearQBTemplate([s.id]),m&&this.isPlatformTemplate(m)&&g&&this.clearQBTemplate([s.id]),o.rules.splice(d,1),o.rules[0]&&o.rules[0].rules||this.disableRuleCondition(i,o);for(var f=this.element.querySelectorAll(".e-tooltip"),y=0;y<f.length;y++)t.getComponent(f[y],"tooltip").refresh(f[y]);this.isImportRules||this.trigger("change",e),this.filterRules(r,this.getValidRules(this.rule),"deleteRule")}},c.prototype.setGroupRules=function(e,t){if(this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked){var l=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn");this.groupLock(l)}this.isImportRules=!1},c.prototype.keyBoardHandler=function(e){!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode||e.preventDefault()},c.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},c.prototype.disableRuleCondition=function(e,t){if(!this.headerTemplate){if(this.readonly)return;var l=e.querySelector(".e-rule-list").childElementCount,i=e.querySelector(".e-btngroup-and"),o=e.querySelector(".e-btngroup-or");l>1?(i.disabled=!1,o.disabled=!1,(o.nextElementSibling.classList.contains("e-btn-disable")||i.nextElementSibling.classList.contains("e-btn-disable"))&&(o.nextElementSibling.classList.remove("e-btn-disable"),i.nextElementSibling.classList.remove("e-btn-disable")),t&&"or"===t.condition?o.checked=!0:i.checked=!0):(i.checked=!1,i.disabled=!0,o.checked=!1,o.disabled=!0,t&&(o.nextElementSibling.classList.add("e-btn-disable"),i.nextElementSibling.classList.add("e-btn-disable")))}},c.prototype.getValidRules=function(e){e||(e=this.getRules());var l=e.condition,i=e.not,o=t.extend([],e.rules,[],!0);return t.isNullOrUndefined(e.isLocked)?this.getRuleCollection({condition:l,rules:o,not:i},!0):this.getRuleCollection({condition:l,rules:o,not:i,isLocked:e.isLocked},!0)},c.prototype.getRuleCollection=function(e,l){if(t.isNullOrUndefined(e))return null;var i;if(e.rules&&e.rules.length&&(Object.keys(e.rules[0]).length>6||l))for(var o=e.rules.length,n=0;n<o;n++)i=e.rules[n],i=this.getRuleCollection(i,l),e.rules[n]=i,Object.keys(i).length<1&&l&&(e.rules.splice(n,1),n--,o--);var r=e.custom;if(e.field&&""!==e.field&&(t.isNullOrUndefined(r)||r&&"question"!==r.type&&"answer"!==r.type))if(e.operator&&(e.operator.toString().indexOf("null")>-1||e.operator.toString().indexOf("empty")>-1)&&(e.value=null),this.isRefreshed&&this.enablePersistence||""!==e.field&&""!==e.operator&&""!==e.value&&void 0!==e.value||r&&r.isQuestion){var s=e.condition,a=e.isLocked;e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value},t.isNullOrUndefined(a)||(e.isLocked=a),s&&(e.condition=s),r&&(e.custom=r),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length||(e={})}else e={};else if(!r||"question"!==r.type&&"answer"!==r.type)if(t.isNullOrUndefined(e.condition)&&t.isNullOrUndefined(e.rules))e={};else{var u=e.isLocked;e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},t.isNullOrUndefined(u)||(e.isLocked=u),r&&(e.custom=r),0===e.rules.length&&(e={})}else{var d=e.not;(e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules}).custom=r,this.enableNotCondition&&(e.not=d)}return e},c.prototype.setRules=function(e){var l=t.extend({},e,{},!0);this.headerTemplate?this.setGroupRules(l,!0):this.setGroupRules(l)},c.prototype.getRules=function(){var e;return e=this.enableNotCondition?{condition:this.rule.condition,rules:this.rule.rules,not:this.rule.not}:{condition:this.rule.condition,rules:this.rule.rules},t.isNullOrUndefined(this.rule.isLocked)||(e.isLocked=this.rule.isLocked),this.rule.custom&&(e.custom=this.rule.custom),e},c.prototype.getRule=function(e){var l,i,o=0;if(e instanceof HTMLElement?l=t.closest(e,".e-rule-container"):(i=this.element.id+"_"+e,l=document.getElementById(i)),t.isNullOrUndefined(l))return null;for(var n=t.closest(l,".e-group-container"),r=this.getParentGroup(n);null!==l.previousElementSibling;)l=l.previousElementSibling,o++;return r.rules[o]},c.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;return this.getParentGroup(l)},c.prototype.deleteGroups=function(e){var t,l,i=e.length;for(t=0;t<i;t++)l=this.element.id+"_"+e[t],this.deleteGroup(document.getElementById(l))},c.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),l=t.isNullOrUndefined(e)?new o.Query:(new o.Query).where(e);return this.dataManager.executeQuery(l)},c.prototype.deleteRules=function(e){var t,l,i=e.length;for(t=0;t<i;t++)l=this.element.id+"_"+e[t],this.deleteRule(document.getElementById(l))},c.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],i=0,n=Object.keys(this.columns);i<n.length;i++)l.push(this.columns[i].field);return e.rules.length?(new o.Query).select(l).where(t):(new o.Query).select(l)},c.prototype.getPredicate=function(e){var l,i,n,r,s=e.rules,a=!1;if(!s)return l;for(var u=0,d=s.length;u<d;u++){var p=s[u].operator;"notstartswith"===p?p="doesnotstartwith":"notendswith"===p?p="doesnotendwith":"notcontains"===p&&(p="doesnotcontain");if(a=!1,Object.keys(s[u]).indexOf("rules")>-1&&s[u].rules)(i=this.getPredicate(s[u]))&&(l=l?"and"===e.condition?l.and(i):l.or(i):i);else if(!t.isNullOrUndefined(p)&&!t.isNullOrUndefined(p.length)){var c=s[u].operator.toLowerCase(),h=!1,m=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"];if("string"===s[u].type&&(a=!this.matchCase),"date"===s[u].type&&m.indexOf(c)>-1&&(a=!0),r=this.getColumn(s[u].field),c.indexOf("null")>-1||c.indexOf("empty")>-1)s[u].value=null;else if("date"!==s[u].type||s[u].value instanceof Array)n=s[u].value;else{var g=this.getFormat(r.format);t.isNullOrUndefined(s[u].value)?n=null:(n=this.getDate(s[u].value,g),m.indexOf(c)>-1&&!this.isTime(s[u].value)&&(h=!0))}if(0===u)if(h||(c.indexOf("in")>-1||c.indexOf("between")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contain")<0)l=h?this.datePredicate(s[u],n):this.arrayPredicate(s[u]);else{""!==(f=n)&&(l=new o.Predicate(s[u].field,p,n,a))}else if(h||(c.indexOf("in")>-1||c.indexOf("between")>-1||c.indexOf("null")>-1||c.indexOf("empty")>-1)&&c.indexOf("contain")<0)l=h?this.datePredicate(s[u],n,l,e.condition):this.arrayPredicate(s[u],l,e.condition);else if("and"===e.condition){var f=n;l&&""!==f?l=l.and(s[u].field,p,n,a):""!==f&&(l=new o.Predicate(s[u].field,p,n,a))}else{f=n;l&&""!==f?l=l.or(s[u].field,p,n,a):""!==f&&(l=new o.Predicate(s[u].field,p,n,a))}}}return this.dataSource instanceof o.DataManager&&(t.isNullOrUndefined(l)||"isnull"!==l.operator&&"isnotnull"!==l.operator||(l.operator="isnull"===l.operator?"equal":"notequal")),l},c.prototype.getLocale=function(){var e=this.locale;return t.getValue("main."+this.locale+".dates.calendars.gregorian.days.format.short",t.cldrData)||(e="en"),e},c.prototype.getColumn=function(e,t){for(var l,i=this.columns,o=0,n=(i=t||i).length;o<n;o++){if(i[o].field===e){l=i[o];break}if(i[o].columns){if(l=this.getColumn(e,i[o].columns))break}else if(e&&e.indexOf(this.separator)>-1&&""!==this.separator&&i[o].field===e.split(this.separator)[0]){l=i[o];break}}return l},c.prototype.getOperators=function(e){return this.getColumn(e).operators},c.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},c.prototype.datePredicate=function(e,t,l,i){var n,r=this.setTime(new Date(t.getTime()),!0),s=this.setTime(t);switch(e.operator){case"equal":n=(n=new o.Predicate(e.field,"greaterthanorequal",r)).and(e.field,"lessthanorequal",s);break;case"notequal":n=(n=new o.Predicate(e.field,"lessthan",r)).or(e.field,"greaterthan",s);break;case"greaterthan":n=new o.Predicate(e.field,"greaterthan",s);break;case"greaterthanorequal":n=new o.Predicate(e.field,"greaterthanorequal",r);break;case"lessthan":n=new o.Predicate(e.field,"lessthan",r);break;case"lessthanorequal":n=new o.Predicate(e.field,"lessthanorequal",s)}return n&&(l?"and"===i?l=l.and(n):"or"===i&&(l=l.or(n)):l=n),l},c.prototype.arrayPredicate=function(e,t,l){var i,n=e.value,r=e.operator.toString(),s=e.value,a=this.getColumn(e.field),u=this.getFormat(a.format);if(r.indexOf("null")>-1||r.indexOf("empty")>-1)switch(r){case"isnull":i=new o.Predicate(e.field,"isnull",s);break;case"isnotnull":i=new o.Predicate(e.field,"isnotnull",s);break;case"isempty":i=new o.Predicate(e.field,"equal","");break;case"isnotempty":i=new o.Predicate(e.field,"notequal","")}if(!(r.indexOf("null")>-1||r.indexOf("empty")>-1))for(var d=0,p=n.length;d<p;d++)if(""!==n[d]||("in"===r||"notin"===r)&&"string"===a.type)if(0===d){var c="greaterthanorequal";switch(r){case"between":i="date"!==a.type?new o.Predicate(e.field,c,n[d]):new o.Predicate(e.field,c,n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null);break;case"notbetween":i="date"===a.type?new o.Predicate(e.field,"lessthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u),!0):null):new o.Predicate(e.field,"lessthan",n[d]);break;case"in":i=new o.Predicate(e.field,"equal",n[d]);break;case"notin":i=new o.Predicate(e.field,"notequal",n[d])}}else{switch(e.operator){case"between":i="date"===a.type?i.and(e.field,"lessthanorequal",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):i.and(e.field,"lessthanorequal",n[d]);break;case"notbetween":i="date"===a.type?i.or(e.field,"greaterthan",n[d]?this.isTime(n[d])?this.getDate(n[d],u):this.setTime(this.getDate(n[d],u)):n[d]):i.or(e.field,"greaterthan",n[d]);break;case"in":i=i.or(e.field,"equal",n[d]);break;case"notin":i=i.and(e.field,"notequal",n[d])}}return i&&(t?"and"===l?t=t.and(i):"or"===l&&(t=t.or(i)):t=i),t},c.prototype.getDate=function(e,t){var l=this.intl.parseDate(e,t);return e.indexOf(":")>-1&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&((l=new Date).setHours(parseInt(e.split(":")[0])),l.setMinutes(parseInt(e.split(":")[1])),e.split(":")[2]&&l.setSeconds(parseInt(e.split(":")[2]))),l},c.prototype.isTime=function(e){return!!(e&&e.indexOf(":")>-1)},c.prototype.importRules=function(e,l,i,o,n){if(i){if(e.rules.length>1&&!this.headerTemplate){var r=l.querySelector(".e-btngroup-or"),s=l.querySelector(".e-btngroup-and");r.disabled=!1,s.disabled=!1,"or"===e.condition?r.checked=!0:s.checked=!0}else this.disableRuleCondition(l);if(this.headerTemplate&&n&&(l=this.renderGroup(e,e.condition,this.element,e.not,n)),this.enableNotCondition&&!this.headerTemplate){var a=l.querySelector(".e-qb-toggle");e.not?t.addClass([a],"e-active-toggle"):t.removeClass([a],"e-active-toggle")}}else l=this.renderGroup(e,e.condition,l,o);0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var u=e.rules;if(!t.isNullOrUndefined(u))for(var d=0,p=u.length;d<p;d++){var c=Object.keys(u[d]);if(!t.isNullOrUndefined(u[d].rules)&&c.indexOf("rules")>-1&&0!==u[d].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;l=this.renderGroup(u[d],u[d].condition,l,u[d].not),l=this.importRules(u[d],l,!0)}else this.renderRule(u[d],l);if(!t.isNullOrUndefined(u[d].rules)&&u[d].isLocked){var h=l.querySelector(".e-rule-list").children[d].querySelector(".e-lock-grp-btn");this.groupLock(h)}if(t.isNullOrUndefined(u[d].rules)&&u[d].isLocked){var m=l.querySelector(".e-rule-list").children[d].querySelector(".e-lock-rule-btn");this.ruleLock(m)}}return l&&(l=t.closest(l,".e-rule-list")),l&&(l=t.closest(l,".e-group-container")),l},c.prototype.renderGroup=function(e,t,l,i,o){this.addGroupElement(!0,l,t,!1,i,o,e);var n=l.querySelectorAll(".e-group-container"),r=l.querySelector(".e-rule-list").children;return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup?(this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1,r[this.groupIndex+1]):this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,r[r.length-1]):n[n.length-1]},c.prototype.renderRule=function(e,t){t.className.indexOf("e-group-container")>-1?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},c.prototype.enableReadonly=function(){for(var e=this.element.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),o=0;o<e.length;o++)if(e[o].classList.contains("e-dropdownlist")){t.getInstance(e[o],i.DropDownList).readonly=this.isReadonly}else if(e[o].classList.contains("e-dropdowntree")){t.getComponent(e[o],"dropdowntree").readonly=this.isReadonly}else if(e[o].classList.contains("e-numerictextbox")){t.getInstance(e[o],n.NumericTextBox).readonly=this.isReadonly}else if(e[o].classList.contains("e-textbox")){t.getInstance(e[o],n.TextBox).readonly=this.isReadonly}else if(e[o].classList.contains("e-datepicker")){t.getInstance(e[o],r.DatePicker).readonly=this.isReadonly}else if(e[o].classList.contains("e-multiselect")){t.getInstance(e[o],i.MultiSelect).readonly=this.isReadonly}else if(e[o].classList.contains("e-radio")){t.getInstance(e[o],l.RadioButton).checked||(this.isReadonly?e[o].parentElement.style.display="none":e[o].parentElement.style.display="inherit")}var s=this.element.querySelectorAll(".e-deletegroup"),a=this.element.querySelectorAll(".e-addrulegroup"),u=this.element.querySelectorAll(".e-removerule");!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly");var d=[s,a,u];for(o=0;o<d.length;o++)d[o].forEach(function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")});this.enableBtnGroup()},c.prototype.enableBtnGroup=function(){var e=this,t=!1;this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle").forEach(function(l){!l.classList.contains("e-qb-toggle")||l.classList.contains("e-active-toggle")||l.classList.contains("e-readonly")?l.classList.contains("e-qb-toggle")&&l.classList.contains("e-not-readonly")?l.classList.remove("e-not-readonly"):l.classList.contains("e-qb-toggle")&&l.classList.contains("e-readonly")?l.classList.remove("e-readonly"):l.classList.contains("e-active-toggle")?(l.classList.add("e-not-readonly"),t=!0):l.previousElementSibling.checked||l.classList.contains("e-readonly")?(l.classList.remove("e-readonly"),t?"AND"===l.textContent?l.classList.add("e-readonly-and"):l.classList.add("e-readonly-or"):("AND"===l.textContent&&e.isReadonly?(l.classList.remove("e-not"),l.classList.add("e-readonly-and")):(e.enableNotCondition&&l.classList.add("e-not"),l.classList.remove("e-readonly-and")),"OR"===l.textContent&&e.isReadonly?l.classList.add("e-readonly-or-not"):l.classList.remove("e-readonly-or-not"))):l.classList.contains("e-btn-disable")||l.classList.add("e-readonly"):(l.classList.add("e-readonly"),t=!1)})},c.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,i=t.length;l<i;l++)if(e.toLowerCase().indexOf(t[l])>-1)return!0;return!1},c.prototype.getSqlString=function(e,t,l,i){var o=!1;l||""===l?l+="(":(l="",o=!0);var n=e.condition;if(e.not){l+=o?i?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (":i?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT ("}if(e.rules)for(var r=0,s=e.rules.length;r<s;r++){if(e.rules[r].rules)l=this.getSqlString(e.rules[r],t,l,i);else{var a=e.rules[r],u="",d=i?this.sqlOperators[a.operator]:this.operators[a.operator];if(a.value instanceof Array)if(a.operator.toString().indexOf("between")>-1){var p=i?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==a.type||this.isDateFunction(a.value[0])?u+=a.value[0]+p+a.value[1]:u+='"'+a.value[0]+'"'+p+'"'+a.value[1]+'"'}else if("string"==typeof a.value[0]&&null!==a.value){u+='("'+a.value[0]+'"';for(var c=1,h=a.value.length;c<h;c++)u+=',"'+a.value[c]+'"';u+=")"}else u+="("+a.value+")";else a.operator.toString().indexOf("startswith")>-1?u+=a.value?'("'+a.value+'%")':"("+a.value+")":a.operator.toString().indexOf("endswith")>-1?u+=a.value?'("%'+a.value+'")':"("+a.value+")":a.operator.toString().indexOf("contains")>-1?u+=a.value?'("%'+a.value+'%")':"("+a.value+")":"number"===a.type||"boolean"==typeof a.value||null===a.value&&a.operator.toString().indexOf("empty")<-1?u+=a.value:a.operator.toString().indexOf("empty")>-1?u+='""':u+='"'+a.value+'"';if(a.operator.toString().indexOf("null")>-1)t?a.field="`"+a.field+"`":a.field.indexOf(" ")>-1&&(a.field='"'+a.field+'"'),l+=a.field+" "+d;else{var m=d;"isempty"===a.operator?m="=":"isnotempty"===a.operator&&(m="!="),t?a.field="`"+a.field+"`":a.field.indexOf(" ")>-1&&(a.field='"'+a.field+'"'),l+=a.field+" "+m+" "+u}a.condition&&""!==a.condition&&(n=a.condition)}if(r!==s-1){a=e.rules[r];(""===n||a&&""!==a.condition&&a.custom&&a.custom.isCustom)&&(n=a.condition),l+=" "+(n=i?this.l10n.getConstant(n.toUpperCase()).toUpperCase():n.toUpperCase())+" "}}return o||(l+=")"),e.not&&(l+=")"),l},c.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");var l=this.getRulesFromSql(e,t);this.setRules({condition:l.condition,not:l.not,rules:l.rules})},c.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);var l=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:l.condition,not:l.not,rules:l.rules}:{condition:l.condition,rules:l.rules}},c.prototype.getSqlFromRules=function(e,t,l){e||(e=this.getValidRules()),e=this.getRuleCollection(e,!1);return this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},c.prototype.getParameterizedSql=function(e){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql},c.prototype.setParameterizedSql=function(e){var t={sql:null};this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var i=this.getRulesFromSql(l);this.setRules({condition:i.condition,not:i.not,rules:i.rules})}},c.prototype.getParameterizedNamedSql=function(e){e||(e=this.getValidRules());var t={sql:null};return this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!1,value:{rule:e,obj:t}}),t.sql},c.prototype.setParameterizedNamedSql=function(e){var t={sql:null};this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!1,value:{sql:e,obj:t}});var l=t.sql;if(l){l=l.replace(/`/g,"");var i=this.getRulesFromSql(l);this.setRules({condition:i.condition,not:i.not,rules:i.rules})}},c.prototype.setMongoQuery=function(e,t){this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})},c.prototype.getMongoQuery=function(e){e||(e=this.getValidRules());var t={mongoQuery:null};return this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!1,value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery},c.prototype.cloneRule=function(e,t,l){var i=this.getRule(e.replace(this.element.id+"_","")),o=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:i.label,field:i.field,type:i.type,operator:i.operator,value:i.value}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=o,o=!1},c.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var i=this.getGroup(t),o=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:i.condition,not:i.not,rules:i.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=o,o=!1},c.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(t)},c.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);var t=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(t)},c.prototype.sqlParser=function(e,t){var l,i=0;do{l=e.slice(i),i+=this.parseSqlStrings(l,t)}while(""!==l);return this.parser},c.prototype.parseSqlStrings=function(e,t){var l,i=["=","!=","<=",">=","<",">"];l=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"];var o;o=t?[this.l10n.getConstant("In").toUpperCase(),this.l10n.getConstant("NotIn").toUpperCase(),this.l10n.getConstant("Like").toUpperCase(),this.l10n.getConstant("NotLike").toUpperCase(),this.l10n.getConstant("Between").toUpperCase(),this.l10n.getConstant("NotBetween").toUpperCase(),this.l10n.getConstant("IsNull").toUpperCase(),this.l10n.getConstant("IsNotNull").toUpperCase(),this.l10n.getConstant("IsEmpty").toUpperCase(),this.l10n.getConstant("IsNotEmpty").toUpperCase()]:["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"];for(var n,r,s=0,a=i.length;s<a;s++)if(n=/^\w+$/.test(i[s])?"\\b":"",new RegExp("^("+i[s]+")"+n,"ig").exec(e))return this.parser.push(["Operators",i[s].toLowerCase()]),i[s].length;var u=this.parser[this.parser.length-1];if(!u||u&&"Literal"!==u[0])for(s=0,a=l.length;s<a;s++)if(n=/^\w+$/.test(l[s])?"\\b":"",new RegExp("^("+l[s]+")"+n,"ig").exec(e))return this.parser.push(["Conditions",l[s].toLowerCase()]),l[s].length;for(s=0,a=o.length;s<a;s++)if(n=/^\w+$/.test(o[s])?"\\b":"",new RegExp("^("+o[s]+")"+n,"ig").exec(e))return this.parser.push(["SubOperators",o[s].toLowerCase()]),o[s].length;if(/^\(/.exec(e))return this.parser.push(["Left","("]),1;if(/^\)/.exec(e))return this.parser.push(["Right",")"]),1;if(/^(true|false)/.exec(e))return r=/^(true|false)/.exec(e)[0],this.parser.push(["String",r]),r.length;if(/^null/.exec(e))return r=/^null/.exec(e)[0],this.parser.push(["String",null]),r.length;if(/^`?([a-z_][a-z0-9_.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e))return r=/^`?([a-zåäö_][a-z0-9åäö_.\[\]\(\)]{0,}(\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",r]),r.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(e))return r=/^'?([a-z_][a-z0-9 _.\[\]\(\)-]{0,}(\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",r]),r.length+2;if(this.checkNumberLiteral(e,t))return r=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Literal",r]),r.length;if(/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)){if("("===(r=/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(e)[0])[r.length-2])for(var d=!1,p=r.length;p<e.length&&(r+=e[p],")"===e[p]&&(d=!0),!d||"'"!==e[p]);p++);else e[r.length]&&")"!==e[r.length]&&!this.checkCondition(e,r)&&(r=this.getSingleQuoteString(e,r));return this.parser.push(["String",r]),r.length}return/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)?(r=/^"([^\\"]*(?:\\.[^\\"]*)*)"/.exec(e)[0],this.parser.push(["DoubleString",r]),r.length):/^[0-9]+(\.[0-9]+)?/.exec(e)?(r=/^[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",r]),r.length):/^-?[0-9]+(\.[0-9]+)?/.exec(e)?(r=/^-?[0-9]+(\.[0-9]+)?/.exec(e)[0],this.parser.push(["Number",r]),r.length):1},c.prototype.checkCondition=function(e,t){return"AND"===e.slice(t.length+1,t.length+4)||"OR"===e.slice(t.length+1,t.length+3)},c.prototype.getSingleQuoteString=function(e,l){if(e[l.length]&&")"!==e[l.length]&&!this.checkCondition(e,l)&&","!==e[l.length]){var i=e.replace(l,"");if(t.isNullOrUndefined(/^'((?:[^\\']+?|\\.|'')*)'(?!')/.exec(i))){l+=/^((?:[^\\']+?|\\.|'')*)'(?!')/.exec(i)[0],l=this.getSingleQuoteString(e,l)}}return l},c.prototype.checkLiteral=function(){var e=this.parser[this.parser.length-1];if(!e)return!0;var t=this.parser[this.parser.length-2],l=this.parser[this.parser.length-3];if("Left"===e[0]&&t&&"Conditions"===t[0])return!0;return!!("Conditions"===e[0]&&l&&l[1].indexOf("between")<0)},c.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(\.[0-9]+)?/.exec(e)){var i=this.parser[this.parser.length-2],o=this.parser[this.parser.length-3];if("Left"===l[0]&&i&&"Conditions"===i[0])return!0;var n=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&o&&o[1].indexOf(n)<0)return!0}return!1},c.prototype.getOperator=function(e,t,l){if(l){for(var i=Object.keys(this.sqlOperators),o=0;o<i.length;o++)if(this.sqlOperators[i[o]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":i[o];return null}if(e){if(0===e.indexOf("%")&&"%"===e[e.length-1])return"not like"===t?"notcontains":"contains";if(0!==e.indexOf("%")&&e.indexOf("%")===e.length-1)return"not like"===t?"notstartswith":"startswith";if(0===e.indexOf("%")&&e.indexOf("%")!==e.length-1)return"not like"===t?"notendswith":"endswith"}else{if("not like"===t)return"notequal";if("like"===t)return"equal"}return{"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween","is empty":"isempty","is null":"isnull","is not null":"isnotnull","is not empty":"isnotempty"}[""+t]},c.prototype.getTypeFromColumn=function(e){var l=this.getColumn(e.field);return t.isNullOrUndefined(l)?null:l.type},c.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""!==this.separator){for(var i=e.split(this.separator),o=0;o<i.length;o++)t+=this.getLabelFromField(i,o+1),++l<i.length&&(t+=this.separator);return t}return this.getColumn(e).label},c.prototype.getLabelFromField=function(e,t){for(var l="",i=0,o=0;o<t;o++)l+=e[o],++i<t&&(l+=this.separator);return this.getColumn(l).label},c.prototype.processParser=function(e,t,l,i){for(var o,n,r,s,a,u,d,p,c,h,m=[],g=[],f=!1,y=0,v=e.length;y<v;y++)if("Literal"===e[y][0]){var b=this.getColumn(e[y][1]);if(r={label:b&&b.label?b.label:e[y][1],field:e[y][1]},"SubOperators"===e[y+1][0]){if(e[y+1][1].indexOf("null")>-1||e[y+1][1].indexOf("empty")>-1)r.operator=this.getOperator(" ",e[y+1][1],i),r.value=null,r.type=this.getTypeFromColumn(r);else{var C=e[y+3][1]?e[y+3][1].replace(/'/g,""):e[y+3][1];r.operator=this.getOperator(C,e[y+1][1],i)}for(h=e[y+1][1],o=++y+1,n=v,i&&"contains"===r.operator||"startswith"===r.operator||"endswith"===r.operator?h="like":i&&"notcontains"===r.operator||"notstartswith"===r.operator||"notendswith"===r.operator?h="not like":i&&(h=r.operator),o=y+1;o<n;o++)if(h.indexOf("between")<0&&"Left"===e[o][0])f=!0;else{if("Right"===e[o][0]&&f){y=o,f=!1;break}if(h.indexOf("null")>-1||h.indexOf("empty")>-1)break;if(h.indexOf("like")>-1&&"String"===e[o][0]){var S=e[o][1];e[o][1]&&"'"===e[o][1][0]&&(S=e[o][1].substring(1,e[o][1].length-1)),S=S?S.replace(/%/g,""):e[o][1],r.value=S,r.type="string"}else if(h.indexOf("between")>-1){if("Literal"===e[o][0]||"Left"===e[o][0])break;if("Number"===e[o][0])m.push(Number(e[o][1]));else if("String"===e[o][0]){S=e[o][1];e[o][1]&&"'"===e[o][1][0]&&(S=e[o][1].substring(1,e[o][1].length-1)),g.push(S)}}else if("Number"===e[o][0])m.push(Number(e[o][1]));else if("String"===e[o][0]){S=e[o][1];e[o][1]&&"'"===e[o][1][0]&&(S=e[o][1].substring(1,e[o][1].length-1)),g.push(S)}r.type=this.getTypeFromColumn(r)}h.indexOf("like")<0&&("Number"===e[o-1][0]?(r.value=m,r.type="number"):"String"===e[o-1][0]?(r.value=g,r.type="string"):h.indexOf("between")>-1&&"Conditions"===e[o-1][0]&&(0!==g.length?(r.value=g,r.type="string"):(r.value=m,r.type="number")),m=[],g=[],r.type=this.getTypeFromColumn(r))}else if("Operators"===e[y+1][0]){if(r.operator=this.getOperator(e[y+2][1],e[y+1][1],i),"equal"==r.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]?r.operator="isempty":"notequal"==r.operator&&"String"===e[y+2][0]&&"''"===e[y+2][1]&&(r.operator="isnotempty"),"Number"===e[y+2][0])r.type="number",r.value=Number(e[y+2][1]);else{r.type="string";(S=e[y+2][1])&&"'"===S[0]&&(S=S.substring(1,S.length-1)),r.value=S}r.type=this.getTypeFromColumn(r)}t.rules.push(r)}else{if("Left"===e[y][0]){if("Left"!==e[0][0]&&("not"===e[y-1][1]||i&&this.l10n.getConstant("NOT").toLowerCase()===e[y-1][1]))continue;for(this.parser=e.splice(y+1,v-(y+1)),s=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},c=0,u=t.rules.length,a=0;a<u;a++)t.rules[a].rules&&c++;return l.push(c),t.rules.push(s),s=this.processParser(this.parser,s,l,i),t}if("Conditions"===e[y][0])"not"===e[y][1]||i&&this.l10n.getConstant("NOT").toLowerCase()===e[y][1]?t.not=!0:t.condition=e[y][1];else if("Right"===e[y][0]){for(this.parser=e.splice(y+1,v-(y+1)),l.pop(),t=this.rule,p=l.length,d=0;d<p;d++)t=this.findGroupByIdx(l[d],t,0===d);return this.processParser(this.parser,t,l,i)}}return t},c.prototype.getValueFromParser=function(e,t){var l,i="";for(l=t;l<e.length&&("String"===e[l][0]&&","!==e[l][1]&&", "!==e[l][1]);l++)""!==i&&(t+=1),null!==e[l][1]?i+=e[l][1]:i=null;return{value:i,idx:t}},c.prototype.groupClone=function(e){var t,l,i=e.closest(".e-rule-list").closest(".e-group-container");"string"==typeof e?(l=this.element.id+"_"+e,e=document.getElementById(l)):(t=e.id.replace(this.element.id+"_",""),l=i.id.replace(this.element.id+"_",""));var o=this.getGroup(t);this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:o.condition,not:o.not,rules:o.rules}],l),this.groupIndex=-1},c.prototype.ruleClone=function(e){for(var l=t.closest(e,".e-rule-container"),i=e.closest(".e-rule-list").closest(".e-group-container"),o=this.getRule(e),n=i.id.replace(this.element.id+"_",""),r=i.querySelectorAll(".e-rule-container"),s=0,a=r.length;s<a;s++)l.id===r[s].id&&(this.ruleIndex=s);this.addRules([{label:o.label,field:o.field,type:o.type,operator:o.operator,value:o.value}],n),this.ruleIndex=-1},c.prototype.ruleLock=function(e){var l=t.closest(e,".e-rule-container"),i=this.getRule(l.id.replace(this.element.id+"_",""));l.classList.contains("e-disable")?(i.isLocked=!1,this.lockItems=this.lockItems.filter(function(e){return e!==l.id}),l.classList.remove("e-disable"),this.disableRuleControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(i.isLocked=!0,this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableRuleControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},c.prototype.groupLock=function(e){var l=t.closest(e,".e-group-container"),i=this.getGroup(l.id.replace(this.element.id+"_","")),o=l.id.indexOf("group0")>-1;if(l.classList.contains("e-disable")){if(o){(n={}).condition=i.condition,n.not=i.not,n.isLocked=!1,this.setProperties({rule:n},!0)}else i.isLocked=!1;this.lockItems=this.lockItems.filter(function(e){return e!==l.id}),l.classList.remove("e-disable"),this.disableHeaderControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()}else{if(o){var n;(n={}).condition=i.condition,n.not=i.not,n.isLocked=!0,this.setProperties({rule:n},!0)}else i.isLocked=!0;this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableHeaderControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup"))}},c.prototype.updateLockItems=function(){for(var e=0;e<this.lockItems.length;e++){if(this.lockItems[e].split("_").length>2){var l=this.element.querySelector("#"+this.lockItems[e]),i=l.querySelector(".e-lock-rule-btn");(l=t.closest(i,".e-rule-container")).classList.contains("e-disable")||this.ruleLock(i)}else{var o=this.element.querySelector("#"+this.lockItems[e]);i=o.querySelector(".e-lock-grp-btn");(o=t.closest(i,".e-group-container")).classList.contains("e-disable")||this.groupLock(i)}}},c.prototype.disableHeaderControls=function(e,t,l){for(var i=t.querySelectorAll(".e-btngroup-and"),o=t.querySelectorAll(".e-btngroup-or"),n=t.querySelectorAll(".e-qb-toggle"),r=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),p=0;p<i.length;p++)l?(d[p]&&d[p].classList.contains("e-disable")&&d[p].classList.add("e-disable"),i[p].disabled=!0,o[p].disabled=!0,r[p].disabled=!0,n[p]&&(n[p].disabled=!0),s[p]&&(s[p].disabled=!0),u[p]&&(u[p].disabled=!0),i[p].parentElement.classList.add("e-disabled"),a[p]!==e&&(a[p].disabled=!0,a[p].children[0].classList.remove("e-unlock"),a[p].children[0].classList.add("e-lock"))):(d[p]&&d[p].classList.remove("e-disable"),i[p].disabled=!1,o[p].disabled=!1,r[p].disabled=!1,a[p].disabled=!1,n[p]&&(n[p].disabled=!1),s[p]&&(s[p].disabled=!1),u[p]&&(u[p].disabled=!1),i[p].parentElement.classList.remove("e-disabled"),a[p].children[0].classList.remove("e-lock"),a[p].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},c.prototype.disableRuleControls=function(e,l,i){for(var o=l.querySelectorAll(".e-control.e-dropdownlist"),n=l.querySelectorAll(".e-control.e-numerictextbox"),r=l.querySelectorAll(".e-control.e-textbox"),s=l.querySelectorAll(".e-control.e-datepicker"),a=l.querySelectorAll(".e-control.e-checkbox"),u=l.querySelectorAll(".e-control.e-radio"),d=l.querySelectorAll(".e-control.e-multiselect"),p=l.querySelectorAll(".e-rule-delete"),c=l.querySelectorAll(".e-lock-rule"),h=l.querySelectorAll(".e-clone-rule"),m=l.querySelectorAll(".e-rule-container"),g=0;g<p.length;g++)i?(m[g]&&m[g].classList.contains("e-disable")&&m[g].classList.add("e-disable"),p[g].disabled=!0,h[g]&&(h[g].disabled=!0),c[g]!==e&&(c[g].disabled=!0,c[g].children[0].classList.remove("e-unlock"),c[g].children[0].classList.add("e-lock"))):(m[g]&&m[g].classList.remove("e-disable"),h[g]&&(h[g].disabled=!1),p[g].disabled=!1,c[g].disabled=!1,c[g].children[0].classList.remove("e-lock"),c[g].children[0].classList.add("e-unlock"));for(g=0;g<o.length;g++)t.getComponent(o[g],"dropdownlist").enabled=!i;for(g=0;g<n.length;g++)t.getComponent(n[g],"numerictextbox").enabled=!i;for(g=0;g<r.length;g++)t.getComponent(r[g],"textbox").enabled=!i;for(g=0;g<s.length;g++)t.getComponent(s[g],"datepicker").enabled=!i;for(g=0;g<a.length;g++)t.getComponent(a[g],"checkbox").disabled=!!i;for(g=0;g<u.length;g++)t.getComponent(u[g],"radio").disabled=!!i;for(g=0;g<d.length;g++)t.getComponent(d[g],"multiselect").enabled=!i},p([t.Event()],c.prototype,"created",void 0),p([t.Event()],c.prototype,"actionBegin",void 0),p([t.Event()],c.prototype,"beforeChange",void 0),p([t.Event()],c.prototype,"change",void 0),p([t.Event()],c.prototype,"dataBound",void 0),p([t.Event()],c.prototype,"ruleChange",void 0),p([t.Complex({},g)],c.prototype,"showButtons",void 0),p([t.Property(!1)],c.prototype,"summaryView",void 0),p([t.Property(!1)],c.prototype,"allowValidation",void 0),p([t.Property("Default")],c.prototype,"fieldMode",void 0),p([t.Property([])],c.prototype,"columns",void 0),p([t.Property(null)],c.prototype,"fieldModel",void 0),p([t.Property(null)],c.prototype,"operatorModel",void 0),p([t.Property(null)],c.prototype,"valueModel",void 0),p([t.Property()],c.prototype,"headerTemplate",void 0),p([t.Property("")],c.prototype,"cssClass",void 0),p([t.Property([])],c.prototype,"dataSource",void 0),p([t.Property("Horizontal")],c.prototype,"displayMode",void 0),p([t.Property(!1)],c.prototype,"enablePersistence",void 0),p([t.Property("Default")],c.prototype,"sortDirection",void 0),p([t.Property(5)],c.prototype,"maxGroupCount",void 0),p([t.Property("auto")],c.prototype,"height",void 0),p([t.Property("auto")],c.prototype,"width",void 0),p([t.Property(!1)],c.prototype,"matchCase",void 0),p([t.Property(0)],c.prototype,"immediateModeDelay",void 0),p([t.Property(!1)],c.prototype,"enableNotCondition",void 0),p([t.Property(!1)],c.prototype,"readonly",void 0),p([t.Property(!0)],c.prototype,"addRuleToNewGroups",void 0),p([t.Property(!1)],c.prototype,"autoSelectField",void 0),p([t.Property(!0)],c.prototype,"autoSelectOperator",void 0),p([t.Property("")],c.prototype,"separator",void 0),p([t.Complex({condition:"and",rules:[]},h)],c.prototype,"rule",void 0),c=p([t.NotifyPropertyChanges],c)}(t.Component),y=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},e.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},e.prototype.getMongoFromRules=function(e,t){return t="{","or"===e.condition?(t+='"$or":[',t=this.convertMongoQuery(e.rules,t)+"]"):(t+='"$and":[',t=this.convertMongoQuery(e.rules,t)+"]"),t+="}"},e.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},e.prototype.convertMongoQuery=function(e,t){var l=this,i=0;return e.forEach(function(o){i++,t+="{",void 0!==o.rules&&("or"===o.condition?(t+=' "$or":[',t=l.convertMongoQuery(o.rules,t)+"]"):(t+=' "$and":[',t=l.convertMongoQuery(o.rules,t)+"]"));var n="string"===o.type&&"in"!==o.operator&&"notin"!==o.operator&&o.value&&""!==o.value.trim()?o.value.replace(/'/g,"\\"):"";"string"!==o.type||"in"!==o.operator&&"notin"!==o.operator||!o.value||1!==o.value.length||(n=o.value[0].replace(/'/g,"\\"));var r=o.field?o.field.substring(0):"";switch(o.operator){case"contains":t+='"'+r+'":{"$regex":"'+n+'"}';break;case"notcontains":t+='"'+r+'":{"$not":{"$regex":"'+o.value+'"}}';break;case"startswith":t+='"'+r+'":{"$regex":"^'+n+'"}';break;case"notstartswith":t+='"'+r+'":{"$not":{"$regex":"^'+o.value+'"}}';break;case"endswith":t+='"'+r+'":{"$regex":"'+n+'$"}';break;case"notendswith":t+='"'+r+'":{"$not":{"$regex":"'+o.value+'$"}}';break;case"isnull":t+='"'+r+'": null';break;case"isnotnull":t+='"'+r+'":{"$ne": null}';break;case"isempty":t+='"'+r+'": ""';break;case"isnotempty":t+='"'+r+'":{"$ne": ""}';break;case"equal":"string"===o.type?t+='"'+r+'":"'+n+'"':"date"===o.type?t+='"'+r+'":"'+o.value+'"':(o.type,t+='"'+r+'":'+o.value);break;case"notequal":"string"===o.type?t+='"'+r+'":{"$ne":"'+n+'"}':"date"===o.type?t+='"'+r+'":{"$ne":"'+o.value+'"}':t+='"'+r+'":{"$ne":'+o.value+"}";break;case"in":if("string"===o.type)if(o.value.length>1){s=(s=o.value.map(function(e,t){return t<o.value.length?'"'+e+'"':""}).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+r+'": { "$in": ['+s+"]}"}else t+='"'+r+'": { "$in": ["'+n+'"]}';else"number"===o.type&&(o.value.length>1?t+='"'+r+'": { "$in": ['+o.value.toString()+"]}":t+='"'+r+'": { "$in": ['+o.value+"]}");break;case"notin":if("string"===o.type)if(o.value.length>1){var s;s=(s=o.value.map(function(e,t){return t<o.value.length?'"'+e+'"':""}).toString()).endsWith(",")?s.substring(0,s.length-1):s,t+='"'+r+'": { "$nin": ['+s+"]}"}else t+='"'+r+'": { "$nin": ["'+n+'"]}';else"number"===o.type&&(o.value.length>1?t+='"'+r+'": { "$nin": ['+o.value.toString()+"]}":t+='"'+r+'": { "$nin": ['+o.value+"]}");break;case"greaterthan":"number"===o.type?t+='"'+r+'": { "$gt": '+o.value+"}":t+='"'+r+'": { "$gt": "'+o.value+'"}';break;case"greaterthanorequal":"number"===o.type?t+='"'+r+'": { "$gte": '+o.value+"}":t+='"'+r+'": { "$gte": "'+o.value+'"}';break;case"between":"number"===o.type?t+='"'+r+'": {"$gte":'+o.value[0]+', "$lte":'+o.value[1]+"}":t+='"'+r+'": {"$gte": "'+o.value[0]+'", "$lte": "'+o.value[1]+'"}';break;case"notbetween":"number"===o.type?t+='"$or":[{"'+r+'": {"$lt":'+o.value[0]+'}}, {"'+r+'": {"$gt":'+o.value[1]+"}}]":t+='"$or":[{"'+r+'": {"$lt": "'+o.value[0]+'"}}, {"'+r+'": {"$gt": "'+o.value[1]+'"}}]';break;case"lessthan":"number"===o.type?t+='"'+r+'": { "$lt": '+o.value+"}":t+='"'+r+'": { "$lt": "'+o.value+'"}';break;case"lessthanorequal":"number"===o.type?t+='"'+r+'": { "$lte": '+o.value+"}":t+='"'+r+'": { "$lte": "'+o.value+'"}'}t+="}",e.length!==i&&(t+=",")}),t},e.prototype.mongoParser=function(e,t,l){var i;Object.keys(e).indexOf("$and")>-1?(i=e.$and,t.condition="and"):Object.keys(e).indexOf("$or")>-1&&(i=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(i,t.rules,l)},e.prototype.mongoRecursion=function(e,l,i){for(var o,n,r,s,a,u,d,p,c,h,m,g=0,f=e.length;g<f;g++){var y=[],v=[];if(u=Object.keys(e[g])[0],d=e[g][u],"$and"===u)p=this.parent.enableNotCondition?{condition:u.replace("$",""),rules:[],not:!1}:{condition:u.replace("$",""),rules:[]},l.push(p),this.mongoRecursion(e[g][u],l[l.length-1].rules,i);else if("$or"===u){var b=void 0,C=[],S=[],x=[],O=[],k=[],w=[],q=[];Array.isArray(d)&&2===d.length&&(w=d[(S=Object.keys(d))[0]],q=d[S[1]],"object"==typeof w&&(C=Object.keys(w)[0],x=Object.keys(w[Object.keys(w)[0]])[0],O=Object.keys(q[Object.keys(q)[0]])[0],"$lt"===x&&"$gt"===O&&(o="notbetween",c={field:C,label:C,value:m=[k=w[C][x],q[C][O]],operator:o,type:n="number"==typeof k?"number":"date"},l.push(c),b=!0))),b||(p=this.parent.enableNotCondition?{condition:u.replace("$",""),rules:[],not:!1}:{condition:u.replace("$",""),rules:[]},l.push(p),this.mongoRecursion(e[g][u],l[l.length-1].rules,i))}else{if(null===(d=e[g][u])&&(o="isnull"),"boolean"==typeof d&&(o="equal",n="boolean",m=d),"number"==typeof d)m=d,n="number",o="equal";else if("object"==typeof d&&null!==d){h=Object.keys(d);for(var N=0;N<h.length;N++)s=h[N],r=d[h[N]],"$ne"===s&&t.isNullOrUndefined(r)&&(o="isnotnull",m=null),"$ne"===s&&"boolean"==typeof r&&(o="notequal",m=r,n="boolean"),h.length>=2&&h[N]?("object"==typeof r?(o="notbetween",u=Object.keys(r)[0],a=[Object.keys(r[u])[0]],y.push(r[u][a]),n="number"):(o="between",y.push(r)),"number"==typeof r&&(n="number")):"object"==typeof r&&null!==r?"$not"===s&&"$regex"===Object.keys(r)[0]?r.$regex.indexOf("^")>-1?(o="notstartswith",m=r.$regex.replace("^","")):r.$regex.indexOf("$")>-1?(o="notendswith",m=r.$regex.replace("$","")):(o="notcontains",m=r.$regex):(o="$in"===s?"in":"notin",v=r,n="number"==typeof r[0]?"number":"string"):"number"==typeof r&&(o=this.getOperatorFromMongoOperator(s),n="number",m=r),"string"==typeof r&&("$regex"===s&&(o="contains",m=r,n="string"),"$ne"===s&&(null!==r&&r.length>0&&isNaN(Date.parse(r))?(o="notequal",m=r):t.isNullOrUndefined(r)?(o="isnotnull",m=r):""===r&&(o="isnotempty",m=r),n="string"),r.indexOf("^")>-1&&(o="startswith",m=r.replace("^",""),n="string"),r.indexOf("$")>-1&&"$not"!==s&&(o="endswith",m=r.replace("$",""),n="string"),isNaN(Date.parse(r))||(o=o||this.getOperatorFromMongoOperator(s),n="date",m=r))}else d&&"string"==typeof d&&!isNaN(Date.parse(d))?(o="equal",m=d,n="date"):"string"==typeof d&&""!==d&&"true"!==d&&"false"!==d?(o="equal",m=d,n="string"):"string"==typeof d&&""===d&&(o="isempty",m=d,n="string");c=y&&y.length>1?{field:u,label:u,value:y,operator:o,type:n}:v&&v.length>1?{field:u,label:u,value:v,operator:o,type:n}:{field:u,label:u,value:m,operator:o,type:n},l.push(c),o=""}}},e.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,i=t.split("?"),o=i[0],n=0;n<l.length;n++)o+="string"==typeof l[n]?"'"+l[n]+"'"+i[n+1]:l[n]+i[n+1];return o.length>=2&&"("===o[0]&&")"===o[o.length-1]&&(o=o.slice(1,-1)),o=o.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,i=t;return Object.keys(l).forEach(function(e){var t=l[e];e=":"+e,i=i.replace(e,"string"==typeof t?"'"+t+"'":String(t))}),i.length>=2&&"("===i[0]&&")"===i[i.length-1]&&(i=i.slice(1,-1)),i=i.replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},e.prototype.getParameterSql=function(e){var l=t.extend({},e,null,!0),i=this.updateRuleValue(l,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(l),i.ruleVal)},e.prototype.getNamedParameterSql=function(e){var l=t.extend({},e,null,!0),i=this.updateRuleValue(l,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(l),i.namedRuleVal)},e.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},e.prototype.updateRuleValue=function(e,t){return this.updateValue(e.rules,t,[],{},[])},e.prototype.updateValue=function(e,l,i,o,n){if(t.isNullOrUndefined(e))return{ruleVal:i,namedRuleVal:o};for(var r=0;r<e.length;r++)if(e[r].rules){i=(u=this.updateValue(e[r].rules,l,i,o,n)).ruleVal,o=u.namedRuleVal}else{var s=void 0;if(e[r].value instanceof Array)for(var a=0;a<e[r].value.length;a++)l&&(s=this.getNamedParameter(e[r].field,n)),t.isNullOrUndefined(e[r].value[a])||("string"===e[r].type||e[r].type,l?o[s]=e[r].value[a]:i.push(e[r].value[a])),e[r].value[a]=l?":"+s:"?";else if(l&&(s=this.getNamedParameter(e[r].field,n)),e[r].operator.indexOf("null")<1&&("string"!==e[r].type||"string"===e[r].type&&(""!==e[r].value||0===e[r].value))){if("string"===e[r].type||"date"===e[r].type)if(e[r].operator.indexOf("empty")<1){var u=e[r].value.toString();switch(e[r].operator){case"startswith":case"notstartswith":u+="%";break;case"endswith":case"notendswith":u="%"+u;break;case"contains":case"notcontains":u="%"+u+"%"}l?o[s]=u:i.push(u)}else l?o[s]="":i.push(""),"isempty"===e[r].operator?e[r].operator="equal":e[r].operator="notequal";else t.isNullOrUndefined(e[r].value)||(l?o[s]=e[r].value:i.push(e[r].value));e[r].value=l?":"+s:"?"}}return{ruleVal:i,namedRuleVal:o}},e.prototype.getNamedParameter=function(e,t){var l=null;if(t.length>0)for(var i=t.length-1;i>=0;i--){var o=t[i];if(o.indexOf(e)>-1){l=e+"_"+(parseInt(o.split("_")[1],10)+1),t.push(l);break}}return l||(l=e+"_1",t.push(l)),l},e.prototype.getModuleName=function(){return"query-library"},e}();e.Columns=c,e.Rule=h,e.Value=m,e.ShowButtons=g,e.QueryBuilder=f,e.QueryLibrary=y,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
10
|
+
!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=e||self).ej={},e.ej2Base,e.ej2Buttons,e.ej2Dropdowns,e.ej2Data,e.ej2Inputs,e.ej2Calendars,e.ej2Splitbuttons,e.ej2Popups)}(this,function(e,N,L,y,h,p,v,R,s){"use strict";n=function(e,t){return(n=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])}))(e,t)};var n,t,l=function(e,t){function l(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(l.prototype=t.prototype,new l)},b=function(){return(b=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var o in t=arguments[l])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=function(e,t,l,n){var o,r=arguments.length,i=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(i=(r<3?o(i):3<r?o(t,l,i):o(t,l))||i);return 3<r&&i&&Object.defineProperty(t,l,i),i},r=(t=N.ChildProperty,l(i,t),o([N.Property(null)],i.prototype,"field",void 0),o([N.Property(null)],i.prototype,"label",void 0),o([N.Property(null)],i.prototype,"type",void 0),o([N.Property(null)],i.prototype,"values",void 0),o([N.Property(null)],i.prototype,"operators",void 0),o([N.Property()],i.prototype,"ruleTemplate",void 0),o([N.Property(null)],i.prototype,"template",void 0),o([N.Property({isRequired:!0,min:0,max:Number.MAX_VALUE})],i.prototype,"validation",void 0),o([N.Property(null)],i.prototype,"format",void 0),o([N.Property(null)],i.prototype,"step",void 0),o([N.Property(null)],i.prototype,"value",void 0),o([N.Property(null)],i.prototype,"category",void 0),o([N.Property(null)],i.prototype,"columns",void 0),i);function i(){return null!==t&&t.apply(this,arguments)||this}a=N.ChildProperty,l(d,a),o([N.Property(null)],d.prototype,"condition",void 0),o([N.Collection([],d)],d.prototype,"rules",void 0),o([N.Property(null)],d.prototype,"field",void 0),o([N.Property(null)],d.prototype,"label",void 0),o([N.Property(null)],d.prototype,"type",void 0),o([N.Property(null)],d.prototype,"operator",void 0),o([N.Property(null)],d.prototype,"value",void 0),o([N.Property(!1)],d.prototype,"not",void 0),o([N.Property(null)],d.prototype,"isLocked",void 0);var a,u=d;function d(){return null!==a&&a.apply(this,arguments)||this}c=N.ChildProperty,l(m,c),o([N.Property(null)],m.prototype,"numericTextBoxModel",void 0),o([N.Property(null)],m.prototype,"multiSelectModel",void 0),o([N.Property(null)],m.prototype,"datePickerModel",void 0),o([N.Property(null)],m.prototype,"textBoxModel",void 0),o([N.Property(null)],m.prototype,"radioButtonModel",void 0);var c,g=m;function m(){return null!==c&&c.apply(this,arguments)||this}f=N.ChildProperty,l(S,f),o([N.Property(!1)],S.prototype,"cloneRule",void 0),o([N.Property(!1)],S.prototype,"cloneGroup",void 0),o([N.Property(!1)],S.prototype,"lockRule",void 0),o([N.Property(!1)],S.prototype,"lockGroup",void 0),o([N.Property(!0)],S.prototype,"ruleDelete",void 0),o([N.Property(!0)],S.prototype,"groupInsert",void 0),o([N.Property(!0)],S.prototype,"groupDelete",void 0);var f,C=S;function S(){return null!==f&&f.apply(this,arguments)||this}x=N.Component,l(q,x),q.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},q.prototype.reset=function(){this.isImportRules=!1;for(var e,t,l,n=this.element.querySelector(".e-group-body"),o=this.element.querySelectorAll("input.e-control"),r=0,i=o.length;r<i;r++)-1<o[r].className.indexOf("e-tooltip")?N.getComponent(o[r],"tooltip").destroy():-1<o[r].parentElement.className.indexOf("e-tooltip")&&N.getComponent(o[r].parentElement,"tooltip").destroy();n?n.innerHTML="":(e=this.createElement("div",{attrs:{class:"e-group-container"}}),t=this.createElement("div",{attrs:{class:"e-group-header"}}),l=this.createElement("div",{attrs:{class:"e-group-body"}}),e.appendChild(t).appendChild(l),this.element.appendChild(e),n=this.element.querySelector(".e-group-body")),this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&N.removeClass(this.element.querySelectorAll(".e-qb-toggle"),"e-active-toggle"),n.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),this.disableRuleCondition(n.parentElement)},q.prototype.getWrapper=function(){return this.element},q.prototype.getModuleName=function(){return"query-builder"},q.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},q.prototype.GetRootColumnName=function(e){return this.separator?e.split(this.separator)[0]:e},q.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],n=void 0,o=!1,r=!1,i=void 0,s={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=0,u=(d=this.columns).length;a<u;a++)this.updateCustomOperator(d[a],"initial"),d[a].type||(-1<e.indexOf(d[a].field)&&("string"===(n=typeof(i=this.dataColl[0][d[a].field]))?r=!isNaN(Date.parse(i)):"object"===n&&(r=i instanceof Date&&!isNaN(i.getTime()),n="string"),d[a].type=n,r=!1),n="string"),d[a].validation||(d[a].validation=s),d[a].category?o=!0:d[a].category=this.l10n.getConstant("OtherFields"),l.indexOf(d[a].category)<0&&l.push(d[a].category),(!d[a].operators||this.isLocale&&0!==this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);o&&(1<l.length||l[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(a=0,u=e.length;a<u;a++)"string"===(n=typeof(i=this.dataColl[0][e[a]]))?r=!isNaN(Date.parse(i)):"object"!==n||Object.keys(i).length||(r=i instanceof Date&&!isNaN(i.getTime()),n="string"),r=!(t[a]={field:e[a],label:e[a],type:r?"date":n,validation:s}),t[a].operators=this.customOperators[t[a].type+"Operator"],"object"===n&&this.updateSubFields(i,t[a]);this.columns=t}}else if(this.columns&&this.columns.length){for(var d,a=0,u=(d=this.columns).length;a<u;a++)d[a].category?this.fields={text:"label",value:"field",groupBy:"category"}:d[a].category=this.l10n.getConstant("OtherFields"),this.updateCustomOperator(d[a]),d[a].operators&&!this.isLocale||(d[a].operators=this.customOperators[d[a].type+"Operator"]);this.updateSubFieldsFromColumns(this.columns)}this.trigger("dataBound",{type:"dataBound"})},q.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},q.prototype.updateSubFields=function(e,t,l){t.columns=[];var n=Object.keys(e);l=l||this.dataColl[0];for(var o=0,r=n.length;o<r;o++){var i,s=t.field.split("."),s=(l?l[s[s.length-1]]:this.dataColl[0][t.field])[n[o]],a=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]],u={field:t.field+this.separator+n[o],label:n[o],type:i="object"!=(i=typeof s)||isNaN(Date.parse(s))?i:"date"};"object"!=i&&(u.operators=this.customOperators[i+"Operator"]),t.columns.push(u),"object"==i&&this.updateSubFields(s,u,a)}},q.prototype.updateCustomOperator=function(o,e){if(o.operators){this.isLocale||"initial"!==e||N.isNullOrUndefined(this.isCustomOprCols)||this.isCustomOprCols.push(o.field);for(var r=this,t=0;t<o.operators.length;t++)!function(e){var t,l,n=Object.keys(o.operators[e]).indexOf("sqlOperator");-1<n&&(t=o.operators[e],l=(e=Object.keys(t)).map(function(e){return t[""+e]}).join(",").split(","),e=e.indexOf("value"),r.operators[l[e]]=l[n])}(t)}},q.prototype.focusEventHandler=function(e){this.target=e.target},q.prototype.clickEventHandler=function(e){var t,l,n,o,r=this,i=e.target;if(this.isImportRules=!1,-1<(i="SPAN"===i.tagName?i.parentElement:i).className.indexOf("e-collapse-rule")&&(u=new N.Animation({duration:1e3,delay:0}),this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary(),o=(e=document.getElementById(this.element.id+"_summary_content")).querySelector(".e-summary-text"),u.animate(".e-query-builder",{name:"SlideLeftIn"}),(a=this.element.querySelector(".e-group-container")).style.display="none",o.textContent=this.getSqlFromRules(this.rule),e.style.display="block",o.style.height=o.scrollHeight+"px"),"BUTTON"===i.tagName&&i.className.indexOf("e-qb-toggle")<0){var s,a,u=new N.Animation({duration:1e3,delay:0});switch(!0){case-1<i.className.indexOf("e-removerule"):this.actionButton=i,this.deleteRule(i);break;case-1<i.className.indexOf("e-clone-rule-btn"):this.actionButton=i,this.cloneRuleBtnClick=!0,this.ruleClone(i);break;case-1<i.className.indexOf("e-lock-rule-btn"):this.actionButton=i,this.ruleLock(i);break;case-1<i.className.indexOf("e-lock-grp-btn"):this.actionButton=i,this.groupLock(i);break;case-1<i.className.indexOf("e-clone-grp-btn"):this.actionButton=i,this.cloneGrpBtnClick=!0,this.groupClone(N.closest(i,".e-group-container"));break;case-1<i.className.indexOf("e-deletegroup"):this.actionButton=i,this.deleteGroup(N.closest(i,".e-group-container"));break;case-1<i.className.indexOf("e-edit-rule"):u.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,!1,this.rule.not),s=N.extend({},this.rule,{},!0),this.setGroupRules(s),this.renderSummaryCollapse()):((a=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),a.style.display="block")}}else("LABEL"===i.tagName&&-1<i.parentElement.className.indexOf("e-btn-group")||-1<i.className.indexOf("e-qb-toggle"))&&(e=N.closest(i,".e-group-container"),this.headerTemplate||(o=void 0,(t=i.getAttribute("for"))?o=document.getElementById(t).getAttribute("value"):this.enableSeparateConnector&&(o=i.textContent),t=e.id.replace(this.element.id+"_",""),l=this.getGroup(t),n=void 0,this.enableNotCondition&&(-1<i.className.indexOf("e-qb-toggle")?(n=-1<(e=e.getElementsByClassName("e-qb-toggle")[0]).className.indexOf("e-active-toggle")?(N.removeClass([e],"e-active-toggle"),!1):(N.addClass([e],"e-active-toggle"),!0),o=l.condition):n=l.not),l={groupID:t,cancel:!1,type:"condition",value:o.toLowerCase()},this.enableNotCondition&&(l={groupID:t,cancel:!1,type:"condition",value:o.toLowerCase(),not:n})),this.isImportRules?this.beforeSuccessCallBack(l,i):this.trigger("beforeChange",l,function(e){r.beforeSuccessCallBack(e,i)}),this.target=i)},q.prototype.beforeSuccessCallBack=function(e,t){var l,n,o,r,i;e&&!e.cancel&&(l=(r=N.closest(t,".e-group-container")).id.replace(this.element.id+"_",""),n=this.getValidRules(this.rule),o=this.getParentGroup(r),this.enableSeparateConnector?(i=(r=N.isNullOrUndefined(N.closest(t,".e-rule-container"))&&r.classList.contains("e-group-container")?null!==t.parentElement.previousElementSibling?t.parentElement.previousElementSibling:r:N.closest(t,".e-rule-container")).id.replace(this.element.id+"_",""),r.classList.contains("e-rule-container")?(o=this.getRule(r)).condition=e.value:r.classList.contains("e-group-container")&&((o=this.getGroup(r)).condition=e.value),this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:l,ruleID:i,type:"condition",value:o.condition})):(o.condition=e.value,this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:l,type:"condition",value:o.condition})),this.filterRules(n,this.getValidRules(this.rule),"condition"),this.enableSeparateConnector)&&(r=t.parentElement.querySelector(".e-btngroup-and"),i=t.parentElement.querySelector(".e-btngroup-or"),r)&&i&&("and"===e.value?(r.checked=!0,i.checked=!1):"or"===e.value&&(i.checked=!0,r.checked=!1))},q.prototype.selectBtn=function(e,t){"beforeOpen"===t.name?this.showButtons.groupInsert||N.isNullOrUndefined(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?N.addClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):N.removeClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&N.addClass([t.element.querySelector("li").parentElement],"e-rtl")):N.addClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):-1<t.element.children[0].className.indexOf("e-addrule")?this.addRuleElement(N.closest(e,".e-group-container"),{}):-1<t.element.children[0].className.indexOf("e-addgroup")&&this.addGroupElement(!0,N.closest(e,".e-group-container"),"",!0)},q.prototype.appendRuleElem=function(e,t,l,n,o,r){var i,s,a=e.querySelector(".e-rule-list");if("change"===l)i=N.select("#"+n,e);else{if((i=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick){if(this.ruleIndex<0)a.appendChild(i);else if(this.enableSeparateConnector){for(var u=-1,d=this.ruleIndex+1,c=0;c<d&&c!==a.children.length;c++)a.children[c].classList.contains("e-rule-container")&&(d++,u++);a.insertBefore(i,a.children[this.ruleIndex+u+1])}else a.insertBefore(i,a.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else a.appendChild(i);this.ruleIdCounter++}return t&&t.ruleTemplate&&r?(l={requestType:"template-initialize",ruleID:i.id,action:o,fields:this.fields,rule:r},this.trigger("actionBegin",l),this.ruleTemplateFn=this.templateParser(t.ruleTemplate),n=this.element.id+t.field,l.fields=this.fields,l.columns=this.columns,""===r.field&&(r.field=t.field),l.operators=this.getOperators(r.field),l.operatorFields={text:"key",value:"value"},this.isReact?((s=this.ruleTemplateFn(l,this,i.id,n)[0]).className+=" e-rule-field",i.appendChild(s)):this.isAngular?((s=3===(e=this.ruleTemplateFn(l,this,i.id,n))[0].nodeType?e[1]:e[0]).className+=" e-rule-field",i.appendChild(s)):this.isVue3?(s=this.ruleTemplateFn(l,this,"Template",n),N.append(s,i),i.children[i.children.length-1].className+=" e-rule-field"):((s=this.ruleTemplateFn(l,this,"Template",n)[0]).className+=" e-rule-field",i.appendChild(s))):(s=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),i.appendChild(s)),this.showButtons.lockGroup&&N.removeClass(i.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&N.removeClass(i.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&N.removeClass(i.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&N.removeClass(i.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&N.removeClass(i.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&N.removeClass(i.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),t&&t.ruleTemplate&&r&&this.renderReactTemplates(),i},q.prototype.addRuleElement=function(t,l,n,o,r,i){var e,s=this;t&&(e={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"},this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(e,t,l,n,o,r,i)):this.trigger("beforeChange",e,function(e){s.addRuleSuccessCallBack(e,t,l,n,o,r,i)}))},q.prototype.addRuleSuccessCallBack=function(e,t,l,n,o,r,i){var s,a,u,d,c=-1<this.element.className.indexOf("e-device")?"250px":"200px",n=l&&l.field?this.getColumn(l.field):n||this.columns[0],p={label:"",field:"",type:"",operator:""};if(e.cancel||(n&&n.ruleTemplate&&l.field?(this.selectedColumn=n,e=this.selectedColumn.operators,p={label:n.label,field:n.field,type:n.type,operator:e[0].value},e=Object.keys(l).length?l:p,e={requestType:"template-create",action:"insert-rule",ruleID:(s=this.appendRuleElem(t,n,o,r,"field",e)).id,fields:this.fields,rule:e},this.trigger("actionBegin",e)):((s=this.appendRuleElem(t,n,o,r,"field")).querySelector(".e-filter-input").setAttribute("id",s.id+"_filterkey"),e=s.querySelector(".e-rule-delete"),-1<this.element.className.indexOf("e-device")||"Vertical"===this.displayMode?(e.textContent=this.l10n.getConstant("Remove"),N.addClass([e],"e-flat"),N.addClass([e],"e-primary")):(N.addClass([e],"e-round"),N.addClass([e],"e-icon-btn"),e.setAttribute("title",this.l10n.getConstant("DeleteRule")),o=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),s.querySelector(".e-rule-delete").appendChild(o)),this.showButtons.ruleDelete||e.classList.add("e-button-hide")),"Vertical"===this.displayMode||-1<this.element.className.indexOf("e-device")?s.className="e-rule-container e-vertical-mode":s.className="e-rule-container e-horizontal-mode",o=s.previousElementSibling,this.enableSeparateConnector?(f=g=void 0,(o=o&&o.classList.contains("e-group-container")?(f=o.querySelectorAll(".e-rule-container"))[f.length-1]:o)&&o.classList.contains("e-rule-container")&&(g=this.getRule(o)),this.headerTemplate&&o&&g?this.headerTemplateFn(o,!1,g.condition,g,o.id):N.isNullOrUndefined(o)&&s.id!==this.element.id+"_group0_rule0"&&((h=s.closest(".e-group-container"))&&h.previousElementSibling?(e=(m=h.previousElementSibling).querySelectorAll(".e-rule-container"),(m=m.classList.contains("e-group-container")?e[e.length-1]:m).classList.contains("e-rule-container")&&(e=this.getRule(m),this.headerTemplateFn(m,!1,e.condition,e,m.id,!0))):this.headerTemplateFn(s,!1,l.condition,l,s.id,!0))):o&&-1<o.className.indexOf("e-rule-container")&&(s.className.indexOf("e-joined-rule")<0&&(s.className+=" e-joined-rule"),o.className.indexOf("e-prev-joined-rule")<0)&&(o.className+=" e-prev-joined-rule"),o&&-1<o.className.indexOf("e-group-container")&&s.className.indexOf("e-separate-rule")<0&&(s.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(t,l,p,i,r,!!this.enableSeparateConnector||null),n&&n.ruleTemplate&&l.field||("Default"===this.fieldMode?(u=a=void 0,u=this.separator&&l.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(l.field):l.field,a={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:5<this.columns.length?c:"auto",close:this.fieldClose.bind(this,s.id+"_filterkey"),change:this.changeField.bind(this),value:l?u:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(a=b({},a,this.fieldModel)),d=void(e=new y.DropDownList(a)).appendTo("#"+s.id+"_filterkey"),d=this.separator&&l.field||this.isImportRules?this.GetRootColumnName(l.field):e.value,this.selectedColumn=e.getDataByValue(d),Object.keys(l).length&&this.changeRule(l,{element:e.element,itemData:this.selectedColumn})):(this.isImportRules,u=l.field,this.dummyDropdownTreeDs=N.extend([],this.columns,[],!(a=void 0)),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),a={fields:{dataSource:this.dummyDropdownTreeDs,value:"field",text:"label",child:"columns",expanded:"expanded",selectable:"selectable"},placeholder:this.l10n.getConstant("SelectField"),showClearButton:!1,popupHeight:5<this.columns.length?c:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:N.isNullOrUndefined(u)?null:[u],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt"},this.fieldModel&&(a=b({},a,this.fieldModel)),(o=new y.DropDownTree(a)).appendTo("#"+s.id+"_filterkey"),N.isNullOrUndefined(o.value)||(p=this.getLabelFromColumn(o.value[0]),o.element.value=p),d=N.isNullOrUndefined(l.field)?o.value:this.GetRootColumnName(l.field),this.selectedColumn=this.getColumn(d),Object.keys(l).length&&this.changeRule(l,{element:o.element,itemData:this.selectedColumn}))),u=s.id.replace(this.element.id+"_",""),l&&l.isLocked&&(i=s.querySelector(".e-lock-rule-btn"),this.ruleLock(i)),this.isImportRules)||this.prvtEvtTgrDaD||this.trigger("change",{groupID:t.id.replace(this.element.id+"_",""),ruleID:u,type:"insertRule"}),this.enableSeparateConnector&&N.isNullOrUndefined(l.condition)&&u&&(l=this.getRule(u)),this.enableSeparateConnector){for(var h,g,m=s.previousElementSibling,f=void 0;m&&!m.classList.contains("e-rule-container");){if(m.classList.contains("e-group-container")){m=(f=m.querySelectorAll(".e-rule-container"))[f.length-1];break}m=m.previousElementSibling}this.headerTemplate&&m?(g=this.getRule(m),r={requestType:"rule-template-create",ruleID:m.id,condition:g.condition,notCondition:!!this.enableNotCondition||void 0},this.trigger("actionBegin",r)):N.isNullOrUndefined(m)&&s.id!==this.element.id+"_group0_rule0"&&(h=s.closest(".e-group-container"))&&h.previousElementSibling&&h.previousElementSibling.previousElementSibling&&(n=(n=h.previousElementSibling.previousElementSibling).classList.contains("e-group-container")?(e=n.querySelectorAll(".e-rule-container"))[e.length-1]:n).classList.contains("e-rule-container")&&(g=this.getRule(n),c={requestType:"rule-template-create",ruleID:n.id,condition:g.condition,notCondition:!!this.enableNotCondition||void 0},this.trigger("actionBegin",c)),this.setMultiConnector(s)}},q.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type?(this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template,e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns)):this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template},q.prototype.updateAddedRule=function(e,t,l,n,o,r){var i=0;if(n){for(s=N.select("#"+o,e),u=N.closest(e,".e-group-container"),d=this.getParentGroup(u);s&&null!==s.previousElementSibling;){var s=s.previousElementSibling,a=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!a||i++}d.rules[i]=t}else{var u=N.closest(e,".e-group-container"),d=this.getParentGroup(u),n=t.custom;Object.keys(t).length?this.ruleIndex<0?(d.rules.push({field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),n&&(d.rules[d.rules.length-1].custom=n),this.enableSeparateConnector&&(d.rules[d.rules.length-1].condition=t.condition||l.condition)):(d.rules.splice(this.ruleIndex+1,0,{field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),n&&(d.rules[this.ruleIndex+1].custom=n),this.enableSeparateConnector&&(d.rules[this.ruleIndex+1].condition=t.condition||l.condition)):(n&&(l.custom=n),this.autoSelectField&&(t.field=l.field=this.rule.rules[0].field),d.rules.push(l))}this.disableRuleCondition(e,d,r)},q.prototype.changeRuleTemplate=function(e,t){var l,n,o=this.selectedColumn.operators;e.ruleTemplate||(l=N.closest(t,".e-group-container"),n=N.closest(t,".e-rule-container").id,this.previousColumn&&this.previousColumn.ruleTemplate&&(N.detach(t.closest('[id="'+n+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([n])),e&&(t={field:e.field,label:e.label,operator:o[0].value,value:""},this.addRuleElement(l,t,e,"change",n,!0)))},q.prototype.renderToolTip=function(e){var t=new s.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){e=e.element.querySelector(".e-tooltip-close");e&&(e.style.display="none")}});t.appendTo(e),t.open(e)},q.prototype.validateFields=function(){var e,t=!0;if(this.allowValidation)for(var l=["isnull","isnotnull","isempty","isnotempty"],n=void 0,o=void 0,r=void 0,i=[],s=void 0,a=void 0,u=void 0,d=this.element.querySelectorAll(".e-rule-container"),n=0,c=d.length;n<c;n++){var p=void 0,h=N.closest(d[n],".e-group-container"),h=this.getParentGroup(h),s=0;if(r=u=d[n],"DropdownTree"===this.fieldMode?(e=N.getComponent(d[n].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),p=this.selectedColumn.validation):(a=N.getComponent(d[n].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&a.value&&(this.selectedColumn=a.getDataByValue(a.value),p=!N.isNullOrUndefined(a.index)&&this.selectedColumn.validation),o=u.querySelector(".e-rule-field input.e-control"),p&&p.isRequired){for(;r&&null!==r.previousElementSibling;){var r=r.previousElementSibling,g=this.enableSeparateConnector&&(!this.headerTemplate&&!r.classList.contains("e-btn-group")||this.headerTemplate&&(r.classList.contains("e-rule-container")||r.classList.contains("e-group-container")));this.enableSeparateConnector&&!g||s++}if(o=u.querySelector(".e-rule-operator .e-control"),h.rules[s].operator||(o.parentElement.className.indexOf("e-tooltip")<0&&o.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),t=!1),h.rules[s].value instanceof Array&&(i=h.rules[s].value),l.indexOf(h.rules[s].operator)<-1&&N.isNullOrUndefined(h.rules[s].value)&&"date"!==h.rules[s].type||""===h.rules[s].value||h.rules[s].value instanceof Array&&i.length<1)for(var m=u.querySelectorAll(".e-rule-value .e-control"),t=!1,f=0,y=m.length;f<y;f++){var v=m[f],b=void 0;-1<v.parentElement.className.indexOf("e-searcher")?(b=N.closest(v,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(b):m[f].parentElement.className.indexOf("e-tooltip")<0&&m[f].className.indexOf("e-tooltip")<0&&this.renderToolTip(m[f].parentElement),f++}}else(a&&a.element&&N.isNullOrUndefined(a.index)||e&&e.element&&(N.isNullOrUndefined(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),t=!1)}return t},q.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");e&&(this.levelColl[e.id]=[0],this.refreshLevel({groupElement:e,level:[0]}))},q.prototype.refreshLevel=function(e){for(var t,l=e.groupElement.querySelector(".e-rule-list").children,n=e.groupElement,o=l.length,r=0,i=0;i<o;i++)-1<(t=l[i]).className.indexOf("e-group-container")&&(e.level.push(r),this.levelColl[t.id]=e.level.slice(),r++,e.groupElement=t,e=this.refreshLevel(e));var s=N.closest(n,".e-rule-list");return e.groupElement=s?N.closest(s,".e-group-container"):n,e.level=this.levelColl[e.groupElement.id].slice(),e},q.prototype.groupTemplate=function(e){var t,l,n=this.createElement("div",{attrs:{class:"e-group-container"}}),o=this.createElement("div",{attrs:{class:"e-group-header"}}),r=this.createElement("div",{attrs:{class:"e-group-body"}}),i=this.createElement("div",{attrs:{class:"e-rule-list"}});return n.appendChild(o),r.appendChild(i),n.appendChild(r),this.headerTemplate||(i=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden",r=this.createElement("span",{attrs:{class:i,"aria-lable":"drag handle",title:"drag handle"}}),o.appendChild(r),i=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group",r=this.createElement("div",{attrs:{class:i,role:"group"}}),this.enableSeparateConnector&&r.classList.add("e-multi-connector"),this.enableNotCondition&&(t=this.enableSeparateConnector?this.createElement("input",{attrs:{type:"checkbox",class:"e-qb-toggle"}}):this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),r.appendChild(t)),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),r.appendChild(t),e=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),r.appendChild(e),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),r.appendChild(t),e=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),r.appendChild(e),o.appendChild(r),i=this.createElement("div",{attrs:{class:"e-group-action"}}),l=this.enableSeparateConnector?(l=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),i.appendChild(l),this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}})):this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(l),o.appendChild(i)),n},q.prototype.ruleTemplate=function(){var e=this.createElement("div"),t=this.createElement("div",{attrs:{class:"e-rule-field"}}),l=this.createElement("div",{attrs:{class:"e-rule-filter"}}),n=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden",n=this.createElement("span",{attrs:{class:n,"aria-lable":"drag handle",title:"drag handle"}}),n=(t.appendChild(n),this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}})),n=(l.appendChild(n),t.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-operator"}}),t.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value"}}),t.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",r=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}})),o=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}}),r=(n.appendChild(o),this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:r}})),o=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),o=(r.appendChild(o),this.showButtons.ruleDelete||N.isNullOrUndefined(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"),o=this.createElement("button",{attrs:{type:"button",class:o}});return l.appendChild(n),l.appendChild(r),l.appendChild(o),t.appendChild(l),e.appendChild(t),e},q.prototype.addGroupElement=function(t,l,n,o,r,i,s){var a=this,e={groupID:l.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addGroupSuccess(e,t,l,n,o,r,i,s)):this.trigger("beforeChange",e,function(e){a.addGroupSuccess(e,t,l,n,o,r,i,s)})},q.prototype.addGroupSuccess=function(e,t,l,n,o,r,i,s){var a=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var u,d,c,e=l,l=void 0,p="",p=e.className.indexOf("e-group-container")<0?e.querySelector(".e-group-container")&&e.querySelector(".e-group-container").id:e.id,h=(this.enableSeparateConnector&&(this.groupElem=this.groupTemplate()),this.groupElem.cloneNode(!0));if(h.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&h.querySelector(".e-drag-qb-rule")&&(h&&h.children[0]&&h.children[0].classList.add("e-parent-header"),N.addClass([h.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(i?(t=!1,h.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(h,r,n,s,p),this.groupIdCounter=0):this.headerTemplateFn(h,r,n,s,p)),this.groupIdCounter++,this.headerTemplate||(i=h.querySelector(".e-btngroup-and"),s=h.querySelector(".e-btngroup-or"),p=h.querySelector(".e-btngroup-and-lbl"),k=h.querySelector(".e-btngroup-or-lbl"),i.setAttribute("id",this.element.id+"_and"+this.btnGroupId),s.setAttribute("id",this.element.id+"_or"+this.btnGroupId),i.setAttribute("name",this.element.id+"_and"+this.btnGroupId),s.setAttribute("name",this.element.id+"_and"+this.btnGroupId),p.setAttribute("for",this.element.id+"_and"+this.btnGroupId),k.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++),t){for(var i=void 0,i=this.showButtons.groupDelete||N.isNullOrUndefined(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",l=this.createElement("button",{attrs:{type:"button",class:i}}),s=(new L.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(l),l.setAttribute("title",this.l10n.getConstant("DeleteGroup")),N.rippleEffect(l,{selector:".deletegroup"}),e.querySelector(".e-rule-list")),g=s.children,m=0,f=0,y=g.length;f<y;f++)-1<g[f].className.indexOf("e-group-container")&&(m+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===g.length-1)s.appendChild(h),this.isLastGroup=!0;else{if(this.enableSeparateConnector){for(var v=0,b=this.groupIndex+1,C=0;C<b;C++)g[C].classList.contains("e-rule-container")&&(b++,v++);0<v&&v--,g[O=this.groupIndex+v+1].parentNode.insertBefore(h,g[O])}else g[O=this.groupIndex+1].parentNode.insertBefore(h,g[O]);this.isMiddleGroup=!0}else s.appendChild(h);var S,x,q,p=this.levelColl[e.id].slice(0);p.push(m),this.levelColl[h.id]=p,-1<this.groupIndex&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],e.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,o&&this.addRuleToNewGroups&&this.addRuleElement(h,{})),this.headerTemplate||(S="",S=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",k=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:S}}),x=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}}),k.appendChild(x),h.querySelector(".e-group-action").appendChild(k),S=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",q=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:S}}),t=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),q.appendChild(t),h.querySelector(".e-group-action").appendChild(q),h.querySelector(".e-group-action").appendChild(l))}else this.headerTemplate||(S="",S=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",q=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:S}}),x=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),q.appendChild(x),h.querySelector(".e-group-action").appendChild(q)),e.appendChild(h),this.levelColl[h.id]=[0];if(this.enableNotCondition&&!this.headerTemplate&&(E=h.querySelector(".e-qb-toggle"),(this.enableSeparateConnector?new L.CheckBox({label:this.l10n.getConstant("NOT"),cssClass:"e-qb-toggle"}):new L.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"})).appendTo(E),h.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule)&&this.updatedRule.not&&N.addClass([E],"e-active-toggle"),this.enableSeparateConnector&&!this.headerTemplate){for(var E,k,i=h.querySelector(".e-btngroup-and"),O=h.querySelector(".e-btngroup-or"),w=h.querySelector(".e-btn-group"),C=0;C<w.childNodes.length;C++)"not"===h.querySelector(".e-btn-group").childNodes[C].textContent.toLowerCase()&&this.enableNotCondition?w.childNodes[C].classList.add("e-multiconnector"):w.childNodes[C].style.display="none";h.previousElementSibling&&(N.isNullOrUndefined(this.headerTemplate)&&(h.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),h),(E=h.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle"))&&(E.style.display="none"),this.isImportRules||(p=(s=h.previousElementSibling).querySelector(".e-btngroup-and"),o=s.querySelector(".e-btngroup-or"),i.checked||O.checked?this.enableSeparateConnector&&(i.checked&&(p.checked=!0),O.checked)&&(o.checked=!0):(k=h.nextElementSibling)&&k.classList.contains("e-btn-group")&&(i=k.querySelector(".e-btngroup-and"),O=k.querySelector(".e-btngroup-or"),p.checked=i.checked,o.checked=O.checked)))}this.updatedRule=null,this.headerTemplate?(t={requestType:"header-template-create",ruleID:h.id,condition:n,notCondition:this.enableNotCondition?r:void 0},this.trigger("actionBegin",t)):this.enableSeparateConnector?(u=h.querySelector(".e-add-condition-btn"),(c=new L.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(u),c.element.onclick=function(){a.addRuleElement(N.closest(u,".e-group-container"),{})},d=h.querySelector(".e-add-group-btn"),(c=new L.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(d),c.element.onclick=function(){a.addGroupElement(!0,N.closest(d,".e-group-container"),"",!0)}):(l=h.querySelector(".e-add-btn"),(c=new R.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,l),select:this.selectBtn.bind(this,l)})).appendTo(l),l.setAttribute("title",this.l10n.getConstant("AddButton"))),this.isImportRules||this.prvtEvtTgrDaD||(S=e.id.replace(this.element.id+"_",""),x=h.id.replace(this.element.id+"_",""),this.trigger("change",{groupID:S,type:"insertGroup",childGroupID:x}))}},q.prototype.setMultiConnector=function(e){var t;this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling&&this.groupElem.querySelector(".e-btn-group")&&(e.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),e),(t=e.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(t.style.display="none"),this.addHeaderDiv(e))},q.prototype.addHeaderDiv=function(e){var t,l=e.previousElementSibling.previousElementSibling;l&&(l=-1<l.id.indexOf("rule")?this.getRule(l):this.getGroup(l),N.isNullOrUndefined(l.condition)&&(l.condition="and"),t=e.previousElementSibling.querySelector(".e-btngroup-or"),e=e.previousElementSibling.querySelector(".e-btngroup-and"),t.disabled=!1,e.disabled=!1,"or"===l.condition?t.checked=!0:e.checked=!0)},q.prototype.headerTemplateFn=function(e,t,l,n,o,r){var i,s=this.element.id+"_header",a=e.querySelector(".e-group-header");return this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(a=e),this.headerTemplate&&(t={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?t:void 0,condition:l,rule:this.getRuleCollection(n,!0),groupID:o},this.trigger("actionBegin",t),this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(t.requestType="rule-template-create"),this.headerFn=this.templateParser(this.headerTemplate),this.isReact?(i=this.headerFn(t,this,e.id,s)[0],this.enableSeparateConnector&&r?this.enableSeparateConnectorInitialRule(e,i):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?a.parentElement.insertBefore(i,a.nextElementSibling):a.appendChild(i)):this.isAngular?(i=3===(l=this.headerFn(t,this,e.id,s))[0].nodeType?l[1]:l[0],this.enableSeparateConnector&&r?this.enableSeparateConnectorInitialRule(e,i):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?a.parentElement.insertBefore(i,a.nextElementSibling):a.appendChild(i)):this.isVue3?(i=this.headerFn(t,this,e.id,s),this.enableSeparateConnector&&r?this.enableSeparateConnectorInitialRule(e,i):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?a.parentElement.insertBefore(i,a.nextElementSibling):N.append(i,a)):(i=this.headerFn(t,this,"Template",s)[0],this.enableSeparateConnector&&r?this.enableSeparateConnectorInitialRule(e,i):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?a.parentElement.insertBefore(i,a.nextElementSibling):a.appendChild(i)),this.renderReactTemplates()),e},q.prototype.enableSeparateConnectorInitialRule=function(e,t){var l=(e.nextElementSibling||e).closest(".e-group-container");(l=e.nextElementSibling?l:l&&(l.nextElementSibling||l))&&l.parentElement.insertBefore(t,l)},q.prototype.notifyChange=function(e,t,l){var n=N.closest(t,".e-group-container"),n=this.getParentGroup(n),o=N.closest(t,".e-rule-container"),r=0;if("not"===l)n.not=e;else if("condition"===l)this.enableSeparateConnector?(n=(o=(o=t.parentElement.previousElementSibling)&&o.classList.contains("e-group-container")?o.querySelectorAll(".e-rule-container")[o.querySelectorAll(".e-rule-container").length-1]:o)&&o.classList.contains("e-rule-container")?this.getRule(o):n).condition=e:n.condition=e;else{for(;o&&null!==o.previousElementSibling;)o=o.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container"))))&&r++;var n=n.rules[r],n=this.getColumn(n.field),i=this.getFormat(n.format);if("date"===n.type)if(e instanceof Date)e=this.intl.formatDate(e,i);else if(e instanceof Array)for(var s=0;s<e.length;s++)e[s]&&e[s]instanceof Date&&(e[s]=this.intl.formatDate(e[s],i));n.ruleTemplate?this.templateChange(t,e,l):(this.isNotified=!0,this.updateRules(t,e),this.isNotified=!1)}},q.prototype.templateChange=function(e,t,l){var n=N.closest(e,".e-group-container"),o=this.getParentGroup(n),r=N.closest(e,".e-rule-container"),i=0;for(this.allowValidation&&this.validateValue(o,r);r&&null!==r.previousElementSibling;)r=r.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!r.classList.contains("e-btn-group")||this.headerTemplate&&(r.classList.contains("e-rule-container")||r.classList.contains("e-group-container"))))&&i++;var s,a,u=o.rules[i],o=("field"===l?this.selectedColumn=this.getColumn(t):u&&(this.selectedColumn=this.getColumn(u.field)),this.previousColumn=this.getColumn(u.field),this.getValidRules(this.rule)),d=(this.selectedColumn&&(s=this.selectedColumn.operators||this.customOperators[this.selectedColumn.type+"Operator"]),["in","notin","between","notbetween"]);switch(l){case"field":u.field=t,u.label=this.selectedColumn.label,u.type=this.selectedColumn.type,u.value="",u.operator=s[0].value;break;case"operator":a=u.operator,u.operator=t,-1<d.indexOf(u.operator)?u.value=[]:-1<d.indexOf(a)&&(u.value="");break;case"value":u.value=t}this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(o,this.getValidRules(this.rule),l),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"!==l&&"operator"!==l||(o=N.closest(e,".e-rule-container"),this.destroyControls(o,!0),N.detach(o.querySelector(".e-rule-field")),e=this.appendRuleElem(N.closest(o,".e-group-container"),this.selectedColumn,"change",o.id,l,u),"Vertical"===this.displayMode||-1<this.element.className.indexOf("e-device")?e.className="e-rule-container e-vertical-mode":e.className="e-rule-container e-horizontal-mode",this.enableSeparateConnector||e.previousElementSibling&&-1<e.previousElementSibling.className.indexOf("e-rule-container")&&(e.className.indexOf("e-joined-rule")<0&&(e.className+=" e-joined-rule"),e.previousElementSibling.className.indexOf("e-prev-joined-rule")<0)&&(e.previousElementSibling.className+=" e-prev-joined-rule"),e.previousElementSibling&&-1<e.previousElementSibling.className.indexOf("e-group-container")&&e.className.indexOf("e-separate-rule")<0&&(e.className+=" e-separate-rule"),e={requestType:"template-create",action:l,ruleID:o.id,fields:this.fields,rule:u},l={groupID:n.id.replace(this.element.id+"_",""),ruleID:o.id.replace(this.element.id+"_",""),value:u.field,type:"field"},this.trigger("actionBegin",e),this.trigger("change",l)))},q.prototype.changeValue=function(e,t){var l,n,o,r,i,s,a,u=this;this.isNumInput&&"number"==typeof t.value?this.isNumInput=!1:((-1<(l=t.element&&t.element.classList.contains("e-multiselect")?t.element:t.event?t.event.target:"input"===t.type&&t.currentTarget?t.currentTarget:t.element).className.indexOf("e-day")||-1<l.className.indexOf("e-today")||-1<l.className.indexOf("e-cell"))&&(l=t.element),a=N.closest(l,".e-group-container"),s=N.closest(l,".e-rule-container"),n=a&&a.id.replace(this.element.id+"_",""),o=s.id.replace(this.element.id+"_",""),(a=t).element&&-1<a.element.className.indexOf("e-datepicker")&&(l=a.element,(r=N.getComponent(N.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=r.getDataByValue(r.value)),r=N.getComponent(N.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(r.value[0])),-1<l.className.indexOf("e-radio")?(s=parseInt(l.id.split("valuekey")[1],10),"Default"===this.fieldMode?(r=N.getComponent(N.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=r.getDataByValue(r.value),this.selectedColumn.columns&&(r=N.getComponent(N.closest(l,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(r.value))):(r=N.getComponent(N.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(r.value[0])),i=(this.selectedColumn.values||[!0,!1])[s]):-1<l.className.indexOf("e-multiselect")?i=N.getComponent(l,"multiselect").value:(i=t.value,"input"===t.type&&t.currentTarget&&(i=Number(t.currentTarget.value),a=t.currentTarget,N.getInstance(a,p.NumericTextBox).value=i,this.isNumInput=!0)),"input"===t.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){u.filterValue(n,o,i,e,l)},this.immediateModeDelay)):this.filterValue(n,o,i,e,l))},q.prototype.filterValue=function(t,l,e,n,o){var r=this,e={groupID:t,ruleID:l,value:e,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(e,o,n,t,l):this.trigger("beforeChange",e,function(e){r.changeValueSuccessCallBack(e,o,n,t,l)})},q.prototype.changeValueSuccessCallBack=function(e,t,l,n,o){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules)||this.trigger("change",{groupID:n,ruleID:o,value:e.value,cancel:!1,type:"value"})},q.prototype.fieldClose=function(e){var t,l;this.isFieldChange||this.isDestroy||(this.isFieldClose=!0,l=(e=N.getComponent(e,"dropdownlist")).popupObj.element.querySelector(".e-active"),t=e.getItemData(),e.value=t.value,l={element:e.element,value:t.value,isInteracted:!0,previousItemData:this.prevItemData,previousItem:null,item:l,itemData:t,event:null,e:null},e.previousValue!==e.value&&this.changeField(l),this.isFieldChange=!1)},q.prototype.changeField=function(e){if(e.isInteracted&&!N.isNullOrUndefined(e.value)){this.isFieldChange=!0,this.prevItemData=e.itemData;var t=N.closest(e.element,".e-rule-filter")||N.closest(e.element,".e-rule-sub-filter"),l="DropdownTree"===this.fieldMode?this.getColumn(e.value[0]):this.getColumn(e.value);if("DropdownTree"===this.fieldMode&&null!==t){var n,o=t.querySelector(".e-dropdowntree.e-control"),r=N.getComponent(o,"dropdowntree");if(!l)return;if("object"===l.type)return r.value=e.oldValue,r.dataBind(),void(N.isNullOrUndefined(e.oldValue)?o.value="":(n=this.getLabelFromColumn(e.oldValue[0]),o.value=n));N.isNullOrUndefined(e.value[0])||(r.value=e.value[0],r.dataBind(),n=this.getLabelFromColumn(e.value[0]),o.value=n)}if(this.destroySubFields(t),this.subFieldElem=null,this.isNotValueChange=!0,l&&l.ruleTemplate)this.templateChange(e.element,l.field,"field");else if(l&&l.columns&&l.columns[0].ruleTemplate)this.templateChange(e.element,l.columns[0].field,"field");else{for(var r=N.closest(e.element,".e-group-container"),o=this.getParentGroup(r),i=N.closest(e.element,".e-rule-container"),s=0;i&&null!==i.previousElementSibling;)i=i.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container"))))&&s++;o.rules[s].value="",this.changeRule(o.rules[s],e)}}},q.prototype.changeRule=function(e,t){if(!t.itemData){if("DropdownTree"!==this.fieldMode)return;if(null==N.getComponent(t.element,"dropdowntree").value)return}var l=N.closest(t.element,".e-rule-filter")||N.closest(t.element,".e-rule-sub-filter"),n=N.getComponent(t.element,"dropdownlist");"DropdownTree"===this.fieldMode&&null!==l&&(n=N.getComponent(t.element,"dropdowntree"));var o=N.closest(t.element,".e-group-container").id.replace(this.element.id+"_","");this.changeFilter(l,n,o,e,{},t)},q.prototype.changeFilter=function(t,e,l,n,o,r){var i,s=this;t?(i=void 0,i="DropdownTree"===this.fieldMode?e.value[0]:this.isImportRules?this.GetRootColumnName(e.value):e.value,this.selectedColumn=this.getColumn(i),i={groupID:l,ruleID:N.closest(t,".e-rule-container").id.replace(this.element.id+"_",""),selectedField:"DropdownTree"===this.fieldMode?e.value[0]:e.value,cancel:!1,type:"field"},this.isImportRules||this.prvtEvtTgrDaD?this.fieldChangeSuccess(i,o,t,n,r):this.trigger("beforeChange",i,function(e){s.fieldChangeSuccess(e,o,t,n,r)})):(i=N.closest(r.element,".e-rule-operator"),this.changeOperator(t,i,e,l,n,o,r))},q.prototype.changeOperator=function(t,e,l,n,o,r,i){var s=this;e?(n={groupID:n,ruleID:N.closest(e,".e-rule-container").id.replace(this.element.id+"_",""),selectedIndex:l.index,cancel:!1,type:"operator"},this.isImportRules?this.operatorChangeSuccess(n,t,r,o,i):this.trigger("beforeChange",n,function(e){s.operatorChangeSuccess(e,t,r,o,i)})):this.changeRuleValues(t,o,r,i)},q.prototype.fieldChangeSuccess=function(e,t,l,n,o){for(var r=N.closest(l,".e-rule-container"),i=N.closest(o.element,".e-rule-operator"),s=N.closest(o.element,".e-group-container").id.replace(this.element.id+"_",""),a=N.getComponent(o.element,"dropdownlist"),u=r.querySelectorAll(".e-tooltip.e-input-group"),d=0;d<u.length;d++)N.getComponent(u[d],"tooltip").destroy();if(e.cancel)this.changeOperator(l,i,a,s,n,t,o);else if(!N.isNullOrUndefined(this.selectedColumn))if(t.type=this.selectedColumn.type,r.querySelector(".e-template")&&(n.value=""),"object"===this.selectedColumn.type&&"Default"===this.fieldMode)for(t.type=this.selectedColumn.columns[0].type;this.selectedColumn.columns;)this.createSubFields(l,n,t,o);else this.destroySubFields(l),this.changeOperator(l,i,a,s,n,t,o)},q.prototype.destroySubFields=function(e){for(;e&&e.nextElementSibling.classList.contains("e-rule-sub-filter");)this.destroyControls(e),e.nextElementSibling.remove()},q.prototype.createSubFields=function(e,t,l,n){var o=!1,e=N.closest(e,".e-rule-field"),r=this.createElement("div",{attrs:{class:"e-rule-sub-filter",id:"subfilter"+this.subFilterCounter}}),e=(e.insertBefore(r,e.querySelector(".e-rule-operator")),N.closest(r,".e-rule-container").id),i=this.createElement("input",{attrs:{type:"text",id:e+"_subfilterkey"+this.subFilterCounter}}),s=(r.appendChild(i),-1<this.element.className.indexOf("e-device")?"250px":"200px"),s={dataSource:this.selectedColumn.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:5<this.selectedColumn.columns.length?s:"auto",change:this.changeField.bind(this),index:0,open:this.popupOpen.bind(this,!1)},a=(this.fieldModel&&(s=b({},s,this.fieldModel)),new y.DropDownList(s));if(a.appendTo("#"+e+"_subfilterkey"+this.subFilterCounter),this.isImportRules||this.previousColumn&&this.previousColumn.ruleTemplate&&this.GetRootColumnName(t.field)===this.GetRootColumnName(this.previousColumn.field))for(var u=this.selectedColumn.columns,d=0;d<u.length;d++)if(t.field===u[d].field||-1<t.field.indexOf(u[d].field+this.separator)){a.value=u[d].field,this.selectedColumn=u[d],o=!0;break}this.subFilterCounter++,this.subFieldElem=i,n.itemData=n.itemData,!o&&this.selectedColumn.columns&&(!o&&this.isImportRules&&(a.value=null),this.selectedColumn=this.selectedColumn.columns[0]),this.previousColumn=this.selectedColumn,this.selectedColumn.columns||this.changeRuleValues(r,t,l,n)},q.prototype.operatorChangeSuccess=function(e,t,l,n,o){var r,i,s,a;e.cancel||(r=(e=N.closest(o.element,".e-rule-operator")).nextElementSibling,i=N.getComponent(o.element,"dropdownlist"),a=n.operator?n.operator.toString().toLowerCase():"",l.operator=i.value.toString(),i=l.operator.toLowerCase(),-1<l.operator.toLowerCase().indexOf("between")||-1<l.operator.toLowerCase().indexOf("in")&&l.operator.toLowerCase().indexOf("contains")<0?(t=e.previousElementSibling,l.type=n.type,(l.operator.toLowerCase().indexOf("in")<0||a.indexOf("in")<0)&&(n.value=[])):"object"==typeof n.value&&null!==n.value&&(n.value=0<n.value.length?n.value[0]:"number"===n.type?0:""),o.previousItemData&&(-1<(s=o.previousItemData.value.toString().toLowerCase()).indexOf("between")||(-1<s.indexOf("in")||-1<s.indexOf("null")||-1<s.indexOf("empty"))&&s.indexOf("contains")<0)&&(t=e.previousElementSibling,l.type=n.type),-1<a.indexOf("in")&&a.indexOf("in")<5&&-1<i.indexOf("in")&&i.indexOf("in")<5&&(t=null),(-1<l.operator.indexOf("null")||-1<l.operator.indexOf("empty"))&&((a=(s=e.parentElement.querySelector(".e-rule-value")).querySelector(".e-tooltip.e-input-group"))&&N.getComponent(a,"tooltip").destroy(),N.removeClass([s],"e-show"),N.addClass([s],"e-hide")),r&&this.getColumn(n.field).template&&(t=e.previousElementSibling),0===r.children.length&&(t=e.previousElementSibling),this.changeRuleValues(t,n,l,o))},q.prototype.changeRuleValues=function(e,t,l,n){var o,r,i,s,a,u=N.closest(n.element,".e-rule-operator");e&&(u=e.nextElementSibling,e.classList.contains("e-rule-sub-filter")&&(l.type=this.selectedColumn.type,u=u.classList.contains("e-rule-sub-filter")?u.nextElementSibling:u),N.addClass([u],"e-operator"),u.childElementCount?(i=N.getComponent(u.querySelector(".e-dropdownlist"),"dropdownlist"),l.operator=i.value,r=void 0,r="DropdownTree"===this.fieldMode?N.getComponent(e.querySelector(".e-dropdowntree"),"dropdowntree"):N.getComponent(e.querySelector(".e-dropdownlist"),"dropdownlist"),l.type=("DropdownTree"===this.fieldMode?this.getColumn(r.value[0]):this.getColumn(r.value)).type,e=n.itemData,""!==i.value&&this.renderValues(u,e,n.previousItemData,!0,t,l,n.element)):(r=N.closest(u,".e-rule-container").id,i=this.createElement("input",{attrs:{type:"text",id:r+"_operatorkey"}}),u.appendChild(i),this.selectedColumn.operators?o=this.selectedColumn.operators:n.itemData&&(o=this.customOperators[this.selectedColumn.type+"Operator"]),e=-1<this.element.className.indexOf("e-device")?"250px":"200px",i=o[0].value,s=0,this.autoSelectOperator||(i="",s=-1),a=void((this.isImportRules||-1<this.ruleIndex||-1<this.groupIndex||this.prvtEvtTgrDaD)&&(i=t&&t.operator||i)),a={dataSource:o,fields:{text:"key",value:"value"},placeholder:this.l10n.getConstant("SelectOperator"),popupHeight:5<o.length?e:"auto",change:this.changeField.bind(this),index:s,value:i,open:this.popupOpen.bind(this,!1)},this.operatorModel&&(a=b({},a,this.operatorModel)),new y.DropDownList(a).appendTo("#"+r+"_operatorkey"),l.operator=t&&""!==t.operator&&!N.isNullOrUndefined(t.operator)?t.operator:o[0].value,this.isImportRules&&(l.type=this.selectedColumn.type,l.operator=t.operator),(!N.isNullOrUndefined(i)&&""!==i||this.autoSelectField&&this.autoSelectOperator)&&this.renderValues(u,this.selectedColumn,n.previousItemData,!1,t,l,n.element))),this.isImportRules||this.updateRules(n.element,n.item)},q.prototype.popupOpen=function(e,t){this.enableRtl&&N.addClass([t.popup.element],"e-rtl"),e&&(this.isFieldClose=!1)},q.prototype.destroyControls=function(e,t){for(var l=t?e:e.nextElementSibling,n=l.querySelectorAll("input.e-control"),o=l.querySelectorAll("div.e-control:not(.e-handle)"),r=this.columns,i=0,s=n.length;i<s;i++){if(n[i].classList.contains("e-textbox"))N.getComponent(n[i],"textbox").destroy(),N.detach(N.select("input#"+n[i].id,l));else if(n[i].classList.contains("e-dropdownlist"))this.allowValidation&&-1<n[i].parentElement.className.indexOf("e-tooltip")&&N.getComponent(n[i].parentElement,"tooltip").destroy(),N.getComponent(n[i],"dropdownlist").destroy();else if(n[i].classList.contains("e-radio"))N.getComponent(n[i],"radio").destroy();else if(n[i].classList.contains("e-numerictextbox"))N.getComponent(n[i],"numerictextbox").destroy(),N.detach(N.select("input#"+n[i].id,l));else if(n[i].classList.contains("e-datepicker"))N.getComponent(n[i],"datepicker").destroy();else if(n[i].classList.contains("e-multiselect"))N.getComponent(n[i],"multiselect").destroy();else if(-1<n[i].className.indexOf("e-template"))for(var a=n[i].className,u=0,d=r.length;u<d;u++)if(r[u].template&&-1<a.indexOf(r[u].field)){this.templateDestroy(r[u],n[i].id);break}document.getElementById(n[i].id)&&N.detach(n[i])}for(i=0,s=o.length;i<s;i++){if(-1<o[i].className.indexOf("e-template"))for(a=o[i].className,u=0,d=r.length;u<d;u++)if(r[u].template&&-1<a.indexOf(r[u].field)){this.templateDestroy(r[u],o[i].id);break}N.detach(o[i])}for(var c=l.querySelectorAll(".e-template:not(.e-control)"),i=0,s=c.length;i<s;i++)N.detach(c[i])},q.prototype.templateDestroy=function(e,t){var l,n,o;"string"==typeof e.template&&void 0!==e.template.destroy||(n=(l=e.template).destroy,l.destroy&&(o=void 0,document.getElementById(t)&&(o=N.closest(document.getElementById(t),".e-rule-field").querySelectorAll(".e-template")),"string"==typeof n?(n=N.getValue(n,window))({field:e.field,elementId:t,elements:o}):l.destroy({field:e.field,elementId:t,elements:o})))},q.prototype.getValues=function(e){var t,l={},n=[],o=[],r=(0<this.separator.length&&(o=e.split(this.separator)),this.dataColl);if(this.dataColl[1])for(var i=0,s=r.length;i<s;i++){var a={};if(1<o.length)for(var u,d=r[i],c=0,p=o.length;c<p;c++)u=o[c],o.length===c+1?(t=d[""+u],Number(d[""+u])===d[""+u]&&d[""+u]%1!=0&&(t=d[""+u].toString())):d=d[""+u];else t=r[i][""+e],Number(r[i][""+e])===r[i][""+e]&&r[i][""+e]%1!=0&&(t=r[i][""+e].toString());t in l||((l[""+t]=1)<o.length?this.createNestedObject(a,o,t):a[""+e]=t,n.push(a))}return n},q.prototype.createNestedObject=function(e,t,l){for(var n,o=t.length-1,r=0;r<o;++r)(n=t[r])in e||(e[""+n]={}),e=e[""+n];e[t[o]]=l},q.prototype.getDistinctValues=function(l,n){for(var o={},r=[],i=[],s="",a=n.indexOf(this.separator),u=this,e=0,t=l.length;e<t;e++)!function(t){0===a?s=l[t][""+n]:(i=n.split(u.separator)).forEach(function(e){s=(s||l[t])[""+e]});var e={};(s=Number(l[t][""+n])===l[t][""+n]&&l[t][""+n]%1!=0?l[t][""+n].toString():s)in o||(o[""+s]=1,0===a?e[""+n]=s:e[i[i.length-1]]=s,r.push(e))}(e);return r},q.prototype.renderMultiSelect=function(e,t,l,n,o){var r,i=!1,s=!1,o=(this.isGetNestedData=!1,this.dataColl[1]&&-1<Object.keys(this.dataColl[1]).indexOf(e.field)&&(i=!0,r=this.getDistinctValues(this.dataColl,e.field)),i=!e.columns&&i,s={dataSource:(s=!this.dataColl.length&&o.length?!0:s)?o:i?r:this.dataManager,query:new h.Query([e.field]),fields:{text:this.selectedRule.field,value:this.selectedRule.field},placeholder:this.l10n.getConstant("SelectValue"),value:n,mode:"CheckBox",width:"100%",change:this.changeValue.bind(this,l),close:this.closePopup.bind(this,l),actionBegin:this.multiSelectOpen.bind(this,t+"_valuekey"+l),open:this.popupOpen.bind(this,!1)},this.valueModel&&this.valueModel.multiSelectModel&&(s=b({},s,this.valueModel.multiSelectModel)),new y.MultiSelect(s));o.appendTo("#"+t+"_valuekey"+l),this.updateRules(o.element,n,0)},q.prototype.multiSelectOpen=function(e,t){var l,n;this.dataSource instanceof h.DataManager&&(e=document.getElementById(e),l=N.getComponent(N.closest(e,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=l.getDataByValue(l.value),l=this.selectedColumn.field,n=!1,(n=this.dataColl[1]&&(-1<Object.keys(this.dataColl[1]).indexOf(l)&&(n=!0),0!==l.indexOf(this.separator))&&this.isGetNestedData?!0:n)||(t.cancel=!0,this.bindMultiSelectData(e,l)))},q.prototype.bindMultiSelectData=function(e,t){this.getMultiSelectData(e,t)},q.prototype.getMultiSelectData=function(t,l){var n,o=this,r=new h.Deferred,e=this.dataManager.executeQuery((new h.Query).select(l)),i=N.getComponent(t,"multiselect");i.hideSpinner(),this.createSpinner(N.closest(t,".e-multi-select-wrapper").parentElement),s.showSpinner(N.closest(t,".e-multi-select-wrapper").parentElement),e.then(function(e){n=(e.actual&&e.actual.result?e.actual:e).result,o.dataColl=N.extend(o.dataColl,n,[],!0),i.dataSource=o.getDistinctValues(o.dataColl,l),o.isGetNestedData=!0,s.hideSpinner(N.closest(t,".e-multi-select-wrapper").parentElement)}).catch(function(e){r.reject(e)})},q.prototype.createSpinner=function(e){var t=this.createElement("span",{attrs:{class:"e-qb-spinner"}});e.appendChild(t),s.createSpinner({target:t,width:N.Browser.isDevice?"16px":"14px"})},q.prototype.closePopup=function(e,t){var l,t=document.getElementById(t.popup.element.id.replace("_popup",""));t&&(l=N.getComponent(t,"multiselect").value,this.updateRules(t,l,e))},q.prototype.processTemplate=function(e,t,l,n){var e=N.closest(e,".e-rule-container"),o=e.querySelectorAll(".e-template"),r=e.querySelector(".e-rule-filter .e-filter-input"),r="DropdownTree"===this.fieldMode?N.getComponent(r,"dropdowntree"):N.getComponent(e.querySelector(".e-rule-filter .e-filter-input"),"dropdownlist"),r="DropdownTree"===this.fieldMode?this.getColumn(r.value[0]):this.getColumn(r.value);"string"==typeof t.template||void 0===t.template.write?(e={rule:l,ruleID:e.id,operator:n.operator,field:r.field,requestType:"value-template-create"},this.trigger("actionBegin",e)):"string"==typeof(e=t.template).write?N.getValue(e.write,window)({elements:1<o.length?o:o[0],values:l.value,operator:n.operator,field:r.field,dataSource:r.values}):"function"!=typeof t.template&&t.template.write({elements:1<o.length?o:o[0],values:l.value,operator:n.operator,field:r.field,dataSource:r.values})},q.prototype.getItemData=function(e){var t=N.getComponent(document.getElementById(e+"_filterkey"),"dropdownlist");return"DropdownTree"===this.fieldMode&&(t=N.getComponent(document.getElementById(e+"_filterkey"),"dropdowntree")),"DropdownTree"===this.fieldMode?this.getColumn(t.value[0]):this.getColumn(t.value)},q.prototype.setDefaultValue=function(e,t,l){e=this.getItemData(e);if(N.isNullOrUndefined(e.value))return l?t?[0,0]:0:t?[]:"";if(t){if(!(e.value instanceof Array))return[e.value]}else if(e.value instanceof Array)return e.value[0];return e.value},q.prototype.renderStringValue=function(e,t,l,n,o){var r,i=this.getItemData(e),s="string"==typeof i.template,s=this.isImportRules||-1<this.ruleIndex||-1<this.groupIndex||this.isPublic||s||""!==t.value?t.value:this.setDefaultValue(e,!1,!1);"in"!==l&&"notin"!==l||!this.dataColl.length&&!i.values?("in"!==l&&"notin"!==l||(s=(r=this.isImportRules||-1<this.ruleIndex||-1<this.groupIndex?t.value:this.setDefaultValue(e,!0,!1)).join(",")),l=void 0,l={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(l=b({},l,this.valueModel.textBoxModel)),(l=new p.TextBox(l)).appendTo("#"+e+"_valuekey"+n),l.value=s,l.dataBind()):(r=this.isImportRules||-1<this.ruleIndex||-1<this.groupIndex||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(i,e,n,r,i.values),"Vertical"===this.displayMode||-1<this.element.className.indexOf("e-device")?o.style.width="100%":(o.style.width=null,o.style.minWidth="200px"))},q.prototype.renderNumberValue=function(e,t,l,n,o,r,i){var s,a,u,d=this.getItemData(e),c="string"==typeof d.template,c=this.isImportRules||-1<this.ruleIndex||-1<this.groupIndex||this.isPublic||c||"number"==typeof t.value?t.value:this.setDefaultValue(e,!1,!0);"in"!==l&&"notin"!==l||!this.dataColl.length&&!d.values?"in"===l||"notin"===l?(l=(c=this.isImportRules||-1<this.ruleIndex||-1<this.groupIndex?t.value:this.setDefaultValue(e,!0,!1)).join(","),s=void 0,s={placeholder:this.l10n.getConstant("SelectValue"),input:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.textBoxModel&&(s=b({},s,this.valueModel.textBoxModel)),(s=new p.TextBox(s)).appendTo("#"+e+"_valuekey"+n),s.value=l,s.dataBind()):(l=(r=d).validation&&r.validation.min?r.validation.min:0,s=r.validation&&r.validation.max?r.validation.max:Number.MAX_VALUE,a=r.format||"n",u=void 0,u={value:(c=1<i&&t?t.value[n]||this.setDefaultValue(e,!0,!0):c)instanceof Array?c[n]:c,format:a,min:l,max:s,width:"100%",step:r.step||1,change:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.numericTextBoxModel&&(u=b({},u,this.valueModel.numericTextBoxModel)),(i=new p.NumericTextBox(u)).appendTo("#"+e+"_valuekey"+n),i.element.setAttribute("aria-label",r.label+" Value"),i.element.oninput=this.changeValue.bind(this,n)):(c=this.isImportRules||-1<this.ruleIndex||-1<this.groupIndex||this.isPublic?t.value:this.setDefaultValue(e,!0,!1),this.renderMultiSelect(d,e,n,c,d.values),-1<this.element.className.indexOf("e-device")||"Vertical"===this.displayMode?o.style.width="100%":(o.style.minWidth="200px",o.style.width=null))},q.prototype.processValueString=function(e,t){var l=[],n=e.split(",");if("string"===t)return n;for(var o=0,r=n.length;o<r;o++)l.push(Number(n[o]));return l},q.prototype.parseDate=function(e,t){var l;return t?(l=this.intl.getDateParser({skeleton:"full",type:"dateTime"}),t=this.getFormat(t),l=l(e),N.isNullOrUndefined(l)&&(l=this.intl.parseDate(e,t))):l=new Date(e),l},q.prototype.renderControls=function(e,t,l,n,o){if(N.addClass([e.parentElement.querySelector(".e-rule-value")],"e-value"),N.removeClass([e.parentElement.querySelector(".e-rule-value")],"e-hide"),N.addClass([e.parentElement.querySelector(".e-rule-value")],"e-show"),t.template&&(t.template.create||o))this.processTemplate(e,t,l,n);else{var r="boolean"===n.type?this.selectedColumn.values?this.selectedColumn.values.length:2:n.operator&&-1<n.operator.toString().toLowerCase().indexOf("between")?2:1,i=N.closest(e,".e-rule-container").id,s=void 0,a=n.operator.toString();if(-1<e.className.indexOf("e-rule-operator")||-1<e.className.indexOf("e-rule-filter")){s=e.parentElement.querySelector(".e-rule-value"),-1<this.element.className.indexOf("e-device")||"Vertical"===this.displayMode?s.style.width="100%":"in"!==a&&"notin"!==a?N.addClass([s],"e-custom-value"):N.removeClass([s],"e-custom-value");for(var u=0;u<r;u++)switch(n.type){case"string":this.renderStringValue(i,l,a,u,s);break;case"number":this.renderNumberValue(i,l,a,u,s,t,r);break;case"boolean":this.processBoolValues(t,l,i,u);break;case"date":var d=new Date,c=void 0,p=void 0,h=t.format,g=void 0,m=this.l10n.getConstant("SelectValue"),f="string"==typeof t.template;l.value&&!N.isNullOrUndefined(h)&&(c=1<r?l.value[u]:l.value,d=this.parseDate(c,h)||new Date),t.field||t.key||!t.value||(d=t.value instanceof Date?t.value:this.parseDate(t.value,t.format)),!t.format&&l&&""!==l.field&&(h=(p=this.getColumn(l.field)).format),(this.isImportRules||this.isPublic||f)&&l&&(h=(p=this.getColumn(l.field)).format,d=l.value&&(c=1<r?l.value[u]:l.value,this.parseDate(c,p.format))),g=h?(f=this.getFormat(h)).skeleton?{locale:this.getLocale(),value:d,placeholder:m,format:f,change:this.changeValue.bind(this,u)}:{value:d,locale:this.getLocale(),placeholder:m,format:f.format,change:this.changeValue.bind(this,u)}:{locale:this.getLocale(),value:d,placeholder:m,change:this.changeValue.bind(this,u)},this.valueModel&&this.valueModel.datePickerModel&&(g=b({},g,this.valueModel.datePickerModel)),new v.DatePicker(g).appendTo("#"+i+"_valuekey"+u),l.value||(c=document.getElementById(i+"_valuekey"+u),this.updateRules(c,d,null,this.isNotValueChange),this.isNotValueChange=!1)}}}},q.prototype.processBoolValues=function(e,t,l,n){var o,r,i,s,a=!1,t=(N.isNullOrUndefined(t.type)&&e&&(t.type=e.type),e.values?(s=e.values,"boolean"!==t.type||N.isNullOrUndefined(t.value)?e.value?a=s[n].toLowerCase()===e.value.toString().toLowerCase():0===n&&(a=!0):a=s[n].toLowerCase()===t.value.toString().toLowerCase(),r=o=i=s[n]):(s=[!0,!1],"boolean"!==t.type||N.isNullOrUndefined(t.value)?e.value?a=s[n].toString().toLowerCase()===e.value.toString().toLowerCase():0===n&&(a="boolean"!=typeof t.value||!!t.value):a=s[n].toString().toLowerCase()===t.value.toString().toLowerCase(),"boolean"==typeof t.value&&1===n&&(a=!t.value),o=s[n].toString(),r=s[n],i=this.l10n.getConstant(["True","False"][n])),e={label:i,name:l+"default",checked:a,value:o,change:this.changeValue.bind(this,n)},this.valueModel&&this.valueModel.radioButtonModel&&(e=b({},e,this.valueModel.radioButtonModel)),new L.RadioButton(e));t.appendTo("#"+l+"_valuekey"+n),a&&this.updateRules(t.element,r,0,!0)},q.prototype.getOperatorIndex=function(e,t){for(var l=e.dataSource.length,n=0;n<l;n++)if(t.operator===e.dataSource[n].value)return n;return 0},q.prototype.getPreviousItemData=function(e,t){return this.isFieldClose&&(e=e&&this.getColumn(e.value)),t&&t.template&&e&&Object.keys(e).length<4&&(e.template=t.template),e},q.prototype.renderValues=function(e,t,l,n,o,r,i){var s=e.previousElementSibling.getElementsByTagName("input")[0],s="DropdownTree"===this.fieldMode?N.getComponent(s,"dropdowntree"):N.getComponent(s,"dropdownlist"),s="DropdownTree"===this.fieldMode?this.getColumn(s.value[0]):this.getColumn(s.value),a=(this.selectedRule=s,N.getComponent(e.querySelector("input"),"dropdownlist")),i=(n&&(t=-1<i.id.indexOf("operator")?t:this.selectedRule).operators&&(a.value=null,a.dataBind(),a.dataSource=t.operators,a.index=this.getOperatorIndex(a,o),a.value=r.operator=a.dataSource[a.index].value,this.autoSelectOperator?a.dataBind():(a.index=-1,r.operator=a.value="")),r.operator.toString()),u=!1;if(-1<i.indexOf("null")||-1<i.indexOf("isempty")||-1<i.indexOf("isnotempty"))(p=e.parentElement.querySelector(".e-rule-value"))&&(N.removeClass([p],"e-show"),N.addClass([p],"e-hide"));else{var d,c=N.closest(e,".e-rule-container").id;if((l=this.getPreviousItemData(l,s))&&void 0===l.template?l.columns&&(l=this.getColumn(o.field)):"DropdownTree"===this.fieldMode&&void 0===l&&(l=this.getColumn(o.field)),l&&l.template&&(this.templateDestroy(l,c+"_valuekey0"),(d=N.select("#"+c+"_valuekey0",e.nextElementSibling))&&!d.classList.contains("e-control")&&N.detach(N.select("#"+c+"_valuekey0",e.nextElementSibling)),"string"!=typeof l.template&&void 0!==l.template.create||(e.nextElementSibling.classList.contains("e-template-value")&&this.clearQBTemplate([c]),e.nextElementSibling.innerHTML="")),n&&(this.validateValue(o,N.closest(e,".e-rule-container")),this.destroyControls(e)),this.isImportRules||a&&""!==a.value){if(s&&(t.template=s.template),t.template&&(N.addClass([e.nextElementSibling],"e-template-value"),t.template=s.template,u=this.setColumnTemplate(t,c,s.field,t.value||i,e,o)),u){var p=e.parentElement.querySelector(".e-rule-value");-1<this.element.className.indexOf("e-device")||"Vertical"===this.displayMode?p.style.width="100%":p.style.width="200px"}else{N.removeClass([e.nextElementSibling],"e-template-value");for(var h=1,h="boolean"===r.type?this.selectedColumn.values?this.selectedColumn.values.length:2:i&&-1<i.toLowerCase().indexOf("between")?2:1,g=0;g<h;g++){var m=this.createElement("input",{attrs:{type:"text",id:c+"_valuekey"+g}});e.nextElementSibling.appendChild(m)}}this.renderControls(e,t,o,r,u)}}},q.prototype.setColumnTemplate=function(t,l,n,e,o,r){var i=this,s=!0;if(t.template){if("string"==typeof t.template||void 0===t.template.create)return this.trigger("actionBegin",{requestType:"value-template-initialize",ruleID:l,field:n,operator:e,rule:r,renderTemplate:!0},function(e){s=i.actionBeginSuccessCallBack(e,t,l,n,o)}),s;var a=void 0,r=t.template;if((a="string"==typeof r.create?N.getValue(r.create,window)({field:n,operator:e}):r.create({field:n,operator:e}))instanceof Element)a.id=l+"_valuekey0",N.addClass([a],"e-template"),o.nextElementSibling.appendChild(a),n.indexOf(" ")<0&&N.addClass([a],"e-"+n);else if(a instanceof Array){N.addClass(a,"e-template");for(var u=0,d=a.length;u<d;u++)a[u].id=l+"_valuekey"+u,o.nextElementSibling.appendChild(a[u])}N.addClass([o.nextElementSibling],"e-template-value")}return!0},q.prototype.actionBeginSuccessCallBack=function(e,t,l,n,o){var r;return!!e.renderTemplate&&(r=void 0,this.columnTemplateFn=this.templateParser((t.template,t.template)),t=this.element.id+n,this.isReact?(r=this.columnTemplateFn(e,this,l,t)[0],o.nextElementSibling.appendChild(r)):this.isAngular?(r=3===(n=this.columnTemplateFn(e,this,l,t))[0].nodeType?n[1]:n[0],o.nextElementSibling.appendChild(r)):this.isVue3?(r=this.columnTemplateFn(e,this,"Template",t),N.append(r,o.nextElementSibling)):(r=this.columnTemplateFn(e,this,"Template",t)[0],o.nextElementSibling.appendChild(r)),N.addClass([o.nextElementSibling],"e-template-value"),this.renderReactTemplates(),!0)},q.prototype.updateValues=function(e,t){var l,n,o=1,r=(-1<e.className.indexOf("e-template")&&(o=3),e.className.split(" e-")[o]),i=parseInt(e.id.slice(-1),2);switch(r){case"checkbox":n=N.getComponent(e,r).value,t.value=""!==n?n:void 0;break;case"textbox":case"dropdownlist":t.value=N.getComponent(e,r).value;break;case"radio":(n=N.getComponent(e,r)).checked&&("boolean"!=typeof t.value&&this.getColumn(t.field).values?t.value=n.value:t.value="true"===n.value),n.refresh();break;case"numerictextbox":-1<t.operator.indexOf("between")?("string"==typeof t.value&&(t.value=[]),t.value[i]=N.getComponent(e,r).value):t.value=N.getComponent(e,r).value;break;case"datepicker":n=this.getColumn(t.field),n=this.getFormat(n.format),l=N.getComponent(e,r).value,-1<t.operator.indexOf("between")?("string"==typeof t.value&&(t.value=[]),t.value[i]=this.intl.formatDate(l,n)):N.isNullOrUndefined(n.format)&&l?t.value=this.intl.formatDate(l):t.value=l&&this.intl.formatDate(l,n);break;case"multiselect":t.value=N.getComponent(e,r).value}},q.prototype.updateRules=function(e,t,l,n){for(var o=N.closest(e,".e-group-container"),r=this.getParentGroup(o),i=N.closest(e,".e-rule-container"),s=0,a=o.id.replace(this.element.id+"_",""),u=this.getValidRules(this.rule);i&&null!==i.previousElementSibling;)i=i.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container"))))&&s++;var d=r.rules[s].operator?r.rules[s].operator.toString():"",c=(i=N.closest(e,".e-rule-container")).id.replace(this.element.id+"_","");if(N.closest(e,".e-rule-filter")||N.closest(e,".e-rule-sub-filter")){this.subFieldElem&&(e=this.subFieldElem);var p="DropdownTree"===this.fieldMode?N.getComponent(e,"dropdowntree"):N.getComponent(e,"dropdownlist"),h="DropdownTree"===this.fieldMode?this.getColumn(p.value[0]):this.getColumn(p.value),h=(this.isImportRules||!r.rules[s].field||r.rules[s].field.toLowerCase()===h.field.toLowerCase()||(!(i.querySelectorAll(".e-template")||-1<d.indexOf("null"))||-1<d.indexOf("empty"))&&(r.rules[s].value=""),this.selectedColumn=this.getColumn(this.selectedColumn.field),r.rules[s].field=this.selectedColumn.field,r.rules[s].type=this.selectedColumn.type,r.rules[s].label=this.selectedColumn.label,N.closest(e,".e-rule-filter")),g=(h=h||N.closest(e,".e-rule-sub-filter")).nextElementSibling.querySelector("input.e-control")||h.nextElementSibling.nextElementSibling.querySelector("input.e-control"),d=N.getComponent(g,"dropdownlist").value.toString(),g=(r.rules[s].operator=d,h.nextElementSibling.nextElementSibling),m=g.querySelectorAll("input.e-control");(m=m.length<1?g.querySelectorAll("div.e-control"):m).length<1&&(m=g.querySelectorAll(".e-template"));for(var h={groupID:a,ruleID:c,value:r.rules[s].field,type:"field"},f=0;f<m.length;f++)-1<d.indexOf("null")||-1<d.indexOf("empty")?r.rules[s].value=null:this.updateValues(m[f],r.rules[s]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",h),this.allowValidation&&r.rules[s].field&&-1<e.parentElement.className.indexOf("e-tooltip")&&N.getComponent(e.parentElement,"tooltip").destroy(),this.filterRules(u,this.getValidRules(this.rule),"field")}else if(N.closest(e,".e-rule-operator")){p=N.getComponent(e,"dropdownlist"),r.rules[s].operator=p.value.toString();var y=i.querySelectorAll(".e-rule-value input.e-control");h={groupID:a,ruleID:c,value:p.value,type:"operator"},this.allowValidation&&r.rules[s].operator&&-1<e.parentElement.className.indexOf("e-tooltip")&&N.getComponent(e.parentElement,"tooltip").destroy(),1<y.length&&!(-1<y[0].className.indexOf("e-template"))&&(r.rules[s].value=[]);for(var v=0;v<y.length;v++)-1<r.rules[s].operator.indexOf("null")||-1<r.rules[s].operator.indexOf("empty")?r.rules[s].value=null:y[v].classList.contains("e-template")||this.updateValues(y[v],r.rules[s]);this.isImportRules||this.trigger("change",h),this.filterRules(u,this.getValidRules(this.rule),"operator")}else N.closest(e,".e-rule-value")&&(this.ruleValueUpdate(e,t,r,s,o,i,l),n||this.filterRules(u,this.getValidRules(this.rule),"value"))},q.prototype.filterRules=function(e,t,l){JSON.stringify({condition:e.condition,not:e.not,rule:e.rules})===JSON.stringify({condition:t.condition,not:t.not,rule:t.rules})||this.isImportRules||this.prvtEvtTgrDaD||this.trigger("ruleChange",{previousRule:e,rule:t,type:l})},q.prototype.ruleValueUpdate=function(e,t,l,n,o,r,i){var s,a=["in","between","notin","notbetween"];if(l.rules[n].operator&&(s=l.rules[n].operator.toString().toLowerCase()),null!==t){if(-1<e.className.indexOf("e-multiselect")&&"number"===l.rules[n].type&&!this.isNotified){for(var u=[],d=t,c=0,p=d.length;c<p;c++)"string"==typeof d[c]&&u.push(parseFloat(d[c]));u.length&&(t=u)}this.isNotified?(l.rules[n].value=t,o={groupID:o.id,ruleID:r.id,value:l.rules[n].value,type:"value"},this.isImportRules||this.trigger("change",o)):-1<e.className.indexOf("e-spin")||-1<e.className.indexOf("e-numeric")?-1<a.indexOf(s)?l.rules[n].value[i]=t:l.rules[n].value=t:-1<e.className.indexOf("e-radio")||-1<e.className.indexOf("e-multiselect")?l.rules[n].value=t:-1<e.className.indexOf("e-textbox")?"in"===s||"notin"===s?(l.rules[n].type,l.rules[n].value=this.processValueString(t,l.rules[n].type)):l.rules[n].value=t:-1<e.className.indexOf("e-datepicker")&&(o=this.getFormat(this.getColumn(this.selectedColumn.field).format)).type&&(-1<a.indexOf(s)?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[i]=this.intl.formatDate(t,o)):l.rules[n].value=this.intl.formatDate(t,o)),this.validateValue(l,r,n)}else-1<e.className.indexOf("e-datepicker")&&-1<a.indexOf(s)?("string"==typeof l.rules[n].value&&(l.rules[n].value=[]),l.rules[n].value[i]=t):l.rules[n].value=t},q.prototype.validateValue=function(e,t,l){var n="object"==typeof(e=N.isNullOrUndefined(l)?e:e.rules[l]).value;this.allowValidation&&(N.isNullOrUndefined(l)||(n?0<e.value.length:e.value))&&0<(l=t.querySelectorAll(".e-rule-value .e-control")).length&&(-1<l[0].className.indexOf("e-tooltip")?N.getComponent(l[0],"tooltip").destroy():-1<l[0].parentElement.className.indexOf("e-tooltip")&&N.getComponent(l[0].parentElement,"tooltip").destroy(),l[1])&&-1<l[1].parentElement.className.indexOf("e-tooltip")&&N.getComponent(l[1].parentElement,"tooltip").destroy()},q.prototype.getFormat=function(e){var t;return e?"string"==typeof e?(t={type:"dateTime"},"short"===e||"yMd"===e?(t.type="date",t.skeleton=e):t.format=e):t={type:"dateTime",skeleton:e.skeleton}:t={type:"date",skeleton:"yMd"},t},q.prototype.findGroupByIdx=function(e,t,l){var n=t.rules,o=[];if(l)return t;for(var r=0,i=n.length;r<i;r++)(t=n[r]).rules&&o.push(t);return o[e]},q.prototype.destroy=function(){var e,t,l,n;if(this.isDestroy=!0,this.element){for(x.prototype.destroy.call(this),l=(e=this.element.querySelectorAll(".e-addrulegroup")).length,t=0;t<l;t++)N.getComponent(e[t],"dropdown-btn").destroy(),N.detach(e[t]);for(n=this.element.querySelectorAll(".e-rule-filter .e-control.e-tooltip"),t=0;t<n.length;t++)N.getComponent(n[t],"tooltip").destroy();for(l=(e=this.element.querySelectorAll(".e-rule-filter .e-control:not(.e-tooltip)")).length,t=0;t<l;t++)(N.getComponent(e[t],"dropdownlist")?N.getComponent(e[t],"dropdownlist"):N.getComponent(e[t],"dropdowntree")).destroy(),N.detach(e[t]);for(n=this.element.querySelectorAll(".e-rule-operator .e-control.e-tooltip"),t=0;t<n.length;t++)N.getComponent(n[t],"tooltip").destroy();for(l=(e=this.element.querySelectorAll(".e-rule-operator .e-control:not(.e-tooltip)")).length,t=0;t<l;t++)N.getComponent(e[t],"dropdownlist")&&(N.getComponent(e[t],"dropdownlist").destroy(),N.detach(e[t]));for(n=this.element.querySelectorAll(".e-rule-value .e-control.e-tooltip"),t=0;t<n.length;t++)N.getComponent(n[t],"tooltip").destroy();this.isImportRules=!1,this.unWireEvents(),this.levelColl[this.element.id+"_group0"]=[0],this.element.innerHTML="",this.portals&&this.portals.length&&this.clearQBTemplate();var o=document.querySelectorAll(".qb-dropdownlist.e-popup");if(o)for(t=0;t<o.length;t++)o[t].remove();N.classList(this.element,[],["e-rtl","e-responsive","e-device"]),this.isDestroy=!1}},q.prototype.addRules=function(e,t){t=this.element.id+"_"+t,this.isPublic=!0;for(var l=0,n=e.length;l<n;l++)this.addRuleElement(document.getElementById(t),e[l]);this.isPublic=!1},q.prototype.addGroups=function(e,t){if(this.isAddSuccess||this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){t=this.element.id+"_"+t;var l=document.getElementById(t),t=this.getParentGroup(l);if(e.length){this.isPublic=!0;for(var n=0,o=e.length;n<o;n++)this.updatedRule={isLocked:e[n].isLocked,condition:e[n].condition,not:e[n].not},this.importRules(e[n],l,!1,e[n].not);this.isPublic=!1}else{var r="and",i=!1,s=!1;this.updatedRule&&(r=this.updatedRule.condition,i=this.updatedRule.not,s=this.updatedRule.isLocked),this.groupIndex<0?this.enableNotCondition?t.rules.push({condition:r,not:i,rules:[]}):t.rules.push({condition:r,rules:[]}):this.enableNotCondition?t.rules.splice(this.groupIndex+1,0,{condition:r,not:i,rules:[],isLocked:s}):t.rules.splice(this.groupIndex+1,0,{condition:r,rules:[],isLocked:s})}this.headerTemplate||this.disableRuleCondition(l,t,null,!!this.enableSeparateConnector||null)}},q.prototype.initWrapper=function(){if(this.isInitialLoad=!0,this.cssClass&&N.addClass([this.element],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableSeparateConnector&&N.addClass([this.element],"e-multi-connector"),this.enableRtl&&N.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),N.Browser.isDevice||"Vertical"===this.displayMode?(N.Browser.isDevice&&(this.element.style.width="100%",this.element.classList.add("e-device")),N.removeClass(this.element.querySelectorAll(".e-rule-container"),"e-horizontal-mode"),N.addClass(this.element.querySelectorAll(".e-rule-container"),"e-vertical-mode"),this.displayMode="Vertical"):this.displayMode="Horizontal",this.summaryView)this.isImportRules?this.renderSummary():this.renderSummaryCollapse();else{this.columns&&this.columns.length&&this.isImportRules?(this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not,!1,this.rule),e=N.extend({},this.rule,{},!0),this.isRefreshed=!0,this.setGroupRules(e),this.isRefreshed=!1):this.columns&&this.columns.length&&this.addRuleElement(this.element.querySelector(".e-group-container"),{}),this.notGroupRtl(),this.readonly&&this.enableReadonly();for(var e,t,l=this.element.querySelectorAll("label.e-btn"),n=0;n<l.length;n++)t=l.item(n),N.rippleEffect(t,{selector:".e-btn"})}},q.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:{type:"button",class:"e-edit-rule e-css e-btn e-small e-flat e-primary"}}),n=this.createElement("div",{attrs:{class:"e-summary-btndiv"}});e.appendChild(t),t.textContent=this.getSqlFromRules(this.rule),l.textContent=this.l10n.getConstant("Edit"),n.appendChild(l),e.appendChild(n),this.element.appendChild(e)},q.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)},q.prototype.columnSort=function(){"descending"===this.sortDirection.toLowerCase()?this.columns=new h.DataManager(this.columns).executeLocal((new h.Query).sortByDesc("field")):"ascending"===this.sortDirection.toLowerCase()&&(this.columns=new h.DataManager(this.columns).executeLocal((new h.Query).sortBy("field")))},q.prototype.onChangeNotGroup=function(){var e;this.element.innerHTML="",this.groupIdCounter=0,this.headerTemplate||(this.enableNotCondition?(e=this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),this.groupElem.querySelector(".e-btn-group")&&this.groupElem.querySelector(".e-btn-group").insertBefore(e,this.groupElem.querySelector(".e-btngroup-and"))):this.groupElem.querySelector(".e-qb-toggle").remove()),this.setProperties({rule:this.checkNotGroup(this.rule)},!0),this.initWrapper()},q.prototype.notGroupRtl=function(){this.enableRtl?N.addClass(this.element.querySelectorAll(".e-btn-group"),"e-rtl"):N.removeClass(this.element.querySelectorAll(".e-btn-group"),"e-rtl")},q.prototype.checkNotGroup=function(e){var t;if(e.rules)for(var l=0;l<e.rules.length;l++)t=e.rules[l],t=this.checkNotGroup(t),e.rules[l]=t;return N.isNullOrUndefined(e.not)?this.enableNotCondition&&!N.isNullOrUndefined(e.condition)&&(e.not=!1):(this.enableNotCondition&&(e.not=!1),delete e.not),e},q.prototype.onPropertyChanged=function(e,t){for(var l=Object.keys(e),n=this.element.querySelector(".e-group-container"),o=this.element.querySelector(".e-summary-content"),r=0,i=l;r<i.length;r++)switch(i[r]){case"summaryView":e.summaryView?(n.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"):(-1<n.querySelectorAll(".e-collapse-rule").length&&this.renderSummaryCollapse(),n.style.display="block",o.style.display="none");break;case"displayMode":this.refresh();break;case"showButtons":N.isNullOrUndefined(e.showButtons.lockGroup)||(e.showButtons.lockGroup?N.removeClass(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"):N.addClass(this.element.querySelectorAll(".e-lock-grp-btn"),"e-button-hide")),N.isNullOrUndefined(e.showButtons.lockRule)||(e.showButtons.lockRule?N.removeClass(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"):N.addClass(this.element.querySelectorAll(".e-lock-rule-btn"),"e-button-hide")),N.isNullOrUndefined(e.showButtons.cloneGroup)||(e.showButtons.cloneGroup?N.removeClass(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"):N.addClass(this.element.querySelectorAll(".e-clone-grp-btn"),"e-button-hide")),N.isNullOrUndefined(e.showButtons.cloneRule)||(e.showButtons.cloneRule?N.removeClass(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"):N.addClass(this.element.querySelectorAll(".e-clone-rule-btn"),"e-button-hide")),N.isNullOrUndefined(e.showButtons.ruleDelete)||(e.showButtons.ruleDelete?N.removeClass(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide"):N.addClass(this.element.querySelectorAll(".e-rule-delete"),"e-button-hide")),N.isNullOrUndefined(e.showButtons.groupDelete)||(e.showButtons.groupDelete?N.removeClass(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"):N.addClass(this.element.querySelectorAll(".e-deletegroup"),"e-button-hide"));break;case"cssClass":t.cssClass&&N.removeClass([this.element],t.cssClass.split(" ")),e.cssClass&&N.addClass([this.element],e.cssClass.replace(/\s+/g," ").trim().split(" "));break;case"enableRtl":e.enableRtl?N.addClass([this.element],"e-rtl"):N.removeClass([this.element],"e-rtl"),this.notGroupRtl();break;case"enablePersistence":this.enablePersistence=e.enablePersistence;break;case"dataSource":this.dataSource=e.dataSource,this.refresh();break;case"columns":this.columns=e.columns,this.columnSort(),this.updateSubFieldsFromColumns(this.columns);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":0!==this.rule.rules.length||N.isNullOrUndefined(this.rule)||this.reset(),this.setProperties({rule:e.rule},!0),e.rule=this.getRuleCollection(this.rule,!1),this.setRules(this.rule);break;case"width":this.width=e.width,this.element.style.width=this.width;break;case"locale":this.locale=e.locale,this.intl=new N.Internationalization(this.locale),this.isLocale=!0,this.refresh(),this.isLocale=!1;break;case"enableNotCondition":this.onChangeNotGroup();break;case"readonly":this.isReadonly=e.readonly,this.enableReadonly();break;case"allowDragAndDrop":this.allowDragAndDrop=e.allowDragAndDrop,this.refresh();break;case"enableSeparateConnector":this.enableSeparateConnector=e.enableSeparateConnector,this.refresh()}},q.prototype.preRender=function(){this.element.id=this.element.id||N.getUniqueID("ej2-querybuilder"),this.defaultLocale={StartsWith:"Starts With",DoesNotStartWith:"Does Not Start With",EndsWith:"Ends With",DoesNotEndWith:"Does Not End With",Contains:"Contains",DoesNotContain:"Does Not Contain",NotLike:"Not Like",Like:"Like",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",NOT:"NOT",SelectValue:"Enter Value",IsEmpty:"Is Empty",IsNotEmpty:"Is Not Empty",IsNull:"Is Null",IsNotNull:"Is Not Null",True:"true",False:"false",AddButton:"Add Group/Condition",CloneGroup:"Clone Group",LockGroup:"Lock Group",CloneRule:"Clone Rule",LockRule:"Lock Rule",UnlockRule:"Unlock Rule",UnlockGroup:"Unlock Group"},this.l10n=new N.L10n("querybuilder",this.defaultLocale,this.locale),this.intl=new N.Internationalization(this.locale),this.groupIdCounter=0,this.subFilterCounter=0,this.ruleIdCounter=0,this.btnGroupId=0,this.isImportRules=!1,this.parser=[],this.customOperators={stringOperator:[{value:"startswith",key:this.l10n.getConstant("StartsWith")},{value:"notstartswith",key:this.l10n.getConstant("DoesNotStartWith")},{value:"endswith",key:this.l10n.getConstant("EndsWith")},{value:"notendswith",key:this.l10n.getConstant("DoesNotEndWith")},{value:"contains",key:this.l10n.getConstant("Contains")},{value:"notcontains",key:this.l10n.getConstant("DoesNotContain")},{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")},{value:"isempty",key:this.l10n.getConstant("IsEmpty")},{value:"isnotempty",key:this.l10n.getConstant("IsNotEmpty")}],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")},{value:"between",key:this.l10n.getConstant("Between")},{value:"notbetween",key:this.l10n.getConstant("NotBetween")}],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",isnull:"IS NULL",isnotnull:"IS NOT NULL",isempty:"IS EMPTY",isnotempty:"IS NOT EMPTY",notstartswith:"NOT LIKE",notendswith:"NOT LIKE",notcontains:"NOT LIKE"},this.sqlOperators={equal:"=",notequal:"!=",greaterthan:">",greaterthanorequal:">=",lessthan:"<",in:this.l10n.getConstant("In").toUpperCase(),notin:this.l10n.getConstant("NotIn").toUpperCase(),lessthanorequal:"<=",startswith:this.l10n.getConstant("Like").toUpperCase(),endswith:this.l10n.getConstant("Like").toUpperCase(),between:this.l10n.getConstant("Between").toUpperCase(),notbetween:this.l10n.getConstant("NotBetween").toUpperCase(),contains:this.l10n.getConstant("Like").toUpperCase(),isnull:this.l10n.getConstant("IsNull").toUpperCase(),isnotnull:this.l10n.getConstant("IsNotNull").toUpperCase(),isempty:this.l10n.getConstant("IsEmpty").toUpperCase(),isnotempty:this.l10n.getConstant("IsNotEmpty").toUpperCase(),notstartswith:this.l10n.getConstant("NotLike").toUpperCase(),notendswith:this.l10n.getConstant("NotLike").toUpperCase(),notcontains:this.l10n.getConstant("NotLike").toUpperCase()},this.fields||(this.fields={text:"label",value:"field"})},q.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();var e=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}],t=[{value:"isnull",key:this.l10n.getConstant("IsNull")},{value:"isnotnull",key:this.l10n.getConstant("IsNotNull")}];this.customOperators.stringOperator=this.customOperators.stringOperator.concat(e),this.customOperators.numberOperator=this.customOperators.numberOperator.concat(t),this.dataSource instanceof h.DataManager?(this.dataManager=this.dataSource,this.executeDataManager((new h.Query).take(1))):(this.dataManager=new h.DataManager(this.dataSource),this.dataColl=this.dataManager.executeLocal(new h.Query),this.initControl()),this.renderComplete(),this.allowDragAndDrop&&this.initializeDrag()},q.prototype.initializeDrag=function(){this.draggable=new N.Draggable(this.element,{dragTarget:".e-drag-qb-rule",distance:5,helper:this.helper.bind(this),dragStart:this.dragStartHandler.bind(this),drag:this.dragHandler.bind(this),dragStop:this.dragStopHandler.bind(this),isReplaceDragEle:!0,isPreventSelect:!1,abort:".e-parent-header",isDragScroll:!0})},q.prototype.helper=function(e){var t,l,n,o=this.draggable.currentStateTarget;return!(!o.classList.contains("e-drag-qb-rule")||o.classList.contains("e-drag-qb-rule")&&N.closest(o,".e-disable"))&&(t=this.createElement("div",{className:"e-cloneproperties e-draganddrop e-dragclone",styles:'height:"auto", z-index:2, width:'+this.element.offsetWidth}),(this.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(l=N.closest(o,".e-group-container").cloneNode(!0),N.closest(o,".e-group-container")):(t.classList.add("e-group-body"),l=this.createElement("div",{className:"e-rule-container"}),n=N.closest(o,".e-rule-field").cloneNode(!0),l.appendChild(n),N.closest(o,".e-rule-field"))).classList.add("e-qb-dragging-rule"),t.appendChild(l),t.querySelectorAll("*").forEach(function(e){e.removeAttribute("id")}),this.element.appendChild(t),t)},q.prototype.dragStartHandler=function(e){this.draggedRule=e.target,this.isDragEventPrevent=!1,document.body.classList.add("e-prevent-select"),this.dragElement=e.dragElement;var t=N.closest(e.target,".e-rule-container"),e=N.closest(e.target,".e-group-container"),t={dragRuleID:(null!==t?t:e).id,dragGroupID:e.id,cancel:!1};this.trigger("dragStart",t),this.isDragEventPrevent=t.cancel},q.prototype.dragHandler=function(e){var t,l,n,o,r,i,s;this.isDragEventPrevent||(this.element.querySelectorAll(".e-drag-rule-bottom-line").forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),this.element.querySelectorAll(".e-drag-rule-top-line").forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),N.isNullOrUndefined(e.target))||("HTML"===e.target.nodeName||N.closest(e.target,".e-qb-dragging-rule")||N.closest(e.target,".e-group-header")||!N.closest(e.target,"#"+this.element.id)||N.closest(e.target,".e-disable")||e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&this.enableSeparateConnector?this.dragElement.classList.add("e-notallowedcur"):(this.dragElement.classList.remove("e-notallowedcur"),t=N.closest(e.target,".e-rule-container"),i=N.closest(e.target,".e-group-container"),t?(l=t.getBoundingClientRect(),s=(n=e.event.clientY||e.event.changedTouches[0].clientY)-l.top,o=l.bottom-n,s<(r=20)?t.classList.add("e-drag-rule-top-line"):o<r&&t.classList.add("e-drag-rule-bottom-line")):e.target.classList.contains("e-rule-list")&&0===e.target.children.length?e.target.classList.add("e-drag-rule-bottom-line"):e.target.classList.contains("e-rule-list")&&e.target.children[0].classList.contains("e-group-container")?(l=e.target.children[0].getBoundingClientRect(),(s=(n=e.event.clientY||e.event.changedTouches[0].clientY)-l.top)<(r=20)&&e.target.classList.add("e-drag-rule-top-line")):(N.closest(e.target,".e-group-container")||e.target.classList.contains("e-group-container"))&&-1<(i=i||e.target).id.indexOf("group0")&&(l=e.target.getBoundingClientRect(),n=e.event.clientY||e.event.changedTouches[0].clientY,(o=l.bottom-n)<(r=20))&&e.target.classList.add("e-drag-rule-bottom-line"),s={dragRuleID:null!==t?t.id:null!==i?i.id:null,dragGroupID:null!==i?i.id:null,cancel:!1},this.trigger("drag",s),this.isDragEventPrevent=s.cancel))},q.prototype.templateParser=function(t){if(t)try{return"function"!=typeof t&&document.querySelectorAll(t).length?N.compile(document.querySelector(t).innerHTML.trim()):N.compile(t)}catch(e){return N.compile(t)}},q.prototype.executeDataManager=function(e){var t=this,e=this.dataManager.executeQuery(e),l=new h.Deferred;e.then(function(e){e.actual&&e.actual.result?t.dataColl=e.actual.result:t.dataColl=e.result,t.initControl()}).catch(function(e){l.reject(e)})},q.prototype.initControl=function(){this.initialize(),this.initWrapper(),this.wireEvents()},q.prototype.wireEvents=function(){var e=this.getWrapper();N.EventHandler.add(e,"click",this.clickEventHandler,this),N.EventHandler.add(e,"focusout",this.focusEventHandler,this),N.EventHandler.add(e,"focusin",this.focusEventHandler,this),N.EventHandler.add(this.element,"keydown",this.keyBoardHandler,this),N.EventHandler.add(document,"keydown",this.keyBoardHandler,this)},q.prototype.unWireEvents=function(){var e=this.getWrapper();N.EventHandler.remove(e,"click",this.clickEventHandler),N.EventHandler.remove(e,"focusout",this.focusEventHandler),N.EventHandler.remove(e,"focusin",this.focusEventHandler),N.EventHandler.remove(this.element,"keydown",this.keyBoardHandler),N.EventHandler.remove(document,"keydown",this.keyBoardHandler)},q.prototype.getParentGroup=function(e,t){for(var l=e instanceof Element?this.levelColl[e.id]:this.levelColl[""+e],n=t?l.length-1:l.length,o=this.rule,r=0;r<n;r++)o=this.findGroupByIdx(l[r],o,0===r);return o},q.prototype.deleteGroup=function(t){var e,l=this,n=t,n=("string"==typeof t?(e=this.element.id+"_"+t,t=document.getElementById(e)):e=n.id.replace(this.element.id+"_",""),{groupID:e,cancel:!1,type:"deleteGroup"});this.isImportRules||this.prvtEvtTgrDaD?this.deleteGroupSuccessCallBack(n,t):this.trigger("beforeChange",n,function(e){l.deleteGroupSuccessCallBack(e,t)})},q.prototype.deleteGroupSuccessCallBack=function(e,t){if(!e.cancel){for(var l=t,n=this.getParentGroup(l,!0),o=0,r=void 0,i=void 0,s=this.getValidRules(this.rule),a=l.nextElementSibling,u=l.previousElementSibling,d=l.querySelectorAll(".e-group-container"),c=l.querySelectorAll(".e-tooltip"),i=c.length,r=0;r<i;r++)N.getComponent(c[r],"tooltip").destroy();for(r=0,i=d.length;r<i;r++)delete this.levelColl[d[r].id];for(;null!==l.previousElementSibling;)l=l.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!l.classList.contains("e-btn-group")||this.headerTemplate&&(l.classList.contains("e-rule-container")||l.classList.contains("e-group-container"))))&&o++;this.enableSeparateConnector||a&&-1<a.className.indexOf("e-separate-rule")&&(N.removeClass([a],"e-separate-rule"),N.addClass([a],"e-joined-rule"),u)&&-1<u.className.indexOf("e-rule-container")&&N.addClass([u],"e-prev-joined-rule");var a=l.parentElement.parentElement.parentElement,p=[];if(this.isReact||this.isAngular){var h=n.rules[o],g=t.querySelectorAll(".e-rule-container");if(h&&h.rules)for(var m=0;m<h.rules.length;m++){var f,y=this.getColumn(h.rules[m].field);g[m]&&(f=g[m].querySelector(".e-template-value"),y)&&(y.ruleTemplate||this.isPlatformTemplate(y)&&f)&&p.push(g[m].id)}}N.detach(t),this.headerTemplate&&this.clearQBTemplate([t.id]),p.length&&this.clearQBTemplate(p),n.rules.splice(o,1),delete this.levelColl[e.groupID],this.refreshLevelColl(),this.disableRuleCondition(a,n),this.enableSeparateConnector&&u&&(!this.headerTemplate&&u.classList.contains("e-btn-group")||this.headerTemplate&&u.classList.contains("e-custom-group-btn"))&&N.detach(u),this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(s,this.getValidRules(this.rule),"deleteGroup")}},q.prototype.isPlatformTemplate=function(e){return e.template&&("string"==typeof e.template||void 0===e.template.create)},q.prototype.deleteRule=function(t){var l=this,e={groupID:N.closest(t,".e-group-container").id.replace(this.element.id+"_",""),ruleID:N.closest(t,".e-rule-container").id.replace(this.element.id+"_",""),cancel:!1,type:"deleteRule"};this.isImportRules||this.prvtEvtTgrDaD?this.deleteRuleSuccessCallBack(e,t):this.trigger("beforeChange",e,function(e){l.deleteRuleSuccessCallBack(e,t)})},q.prototype.deleteRuleSuccessCallBack=function(e,t){if(!e.cancel){for(var l=N.closest(t,".e-group-container"),n=this.getParentGroup(l),o=N.closest(t,".e-rule-container"),t=this.getValidRules(this.rule),r=o.previousElementSibling,i=0,s=o,a=o.nextElementSibling,u=o.querySelectorAll(".e-tooltip"),d=void 0,c=u.length,d=0;d<c;d++)N.getComponent(u[d],"tooltip").destroy();for(;null!==o.previousElementSibling;)o=o.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container"))))&&i++;var p,h,g=this.getColumn(n.rules[i].field),a=(g&&g.template&&s.querySelector(".e-template")&&this.templateDestroy(g,s.querySelector(".e-template").id),(!r||r.className.indexOf("e-rule-container")<0)&&a&&N.removeClass([a],"e-joined-rule"),(!a||a.className.indexOf("e-rule-container")<0)&&r&&N.removeClass([r],"e-prev-joined-rule"),s.querySelector(".e-template-value"));try{this.enableSeparateConnector&&(s.previousElementSibling||s.nextElementSibling)&&(p=s.previousElementSibling,h=s.nextElementSibling,N.isNullOrUndefined(h)&&(!this.headerTemplate&&p.classList.contains("e-btn-group")||this.headerTemplate&&p.classList.contains("e-custom-group-btn"))?(p&&p.previousElementSibling&&p.previousElementSibling.classList.contains("e-rule-container")&&(this.getRule(p.previousElementSibling).condition=null),N.detach(p)):(!this.headerTemplate&&h.classList.contains("e-btn-group")||this.headerTemplate&&h.classList.contains("e-custom-group-btn"))&&N.detach(h)),N.detach(s)}catch(e){return}g&&g.ruleTemplate&&this.clearQBTemplate([s.id]),g&&this.isPlatformTemplate(g)&&a&&this.clearQBTemplate([s.id]),n.rules.splice(i,1),n.rules[0]&&n.rules[0].rules||this.disableRuleCondition(l,n,!!this.enableSeparateConnector);for(var m=this.element.querySelectorAll(".e-tooltip"),f=0;f<m.length;f++)N.getComponent(m[f],"tooltip").refresh(m[f]);this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",e),this.filterRules(t,this.getValidRules(this.rule),"deleteRule")}},q.prototype.setGroupRules=function(e,t){this.headerTemplate&&t&&(this.isRoot=!0),this.reset(),this.groupIdCounter=1,this.ruleIdCounter=0,this.isImportRules=!0,this.setProperties({rule:e},!0),e=this.getRuleCollection(this.rule,!1),this.importRules(this.rule,this.element.querySelector(".e-group-container"),!0,this.rule.not,t),e.isLocked&&(t=this.element.querySelector(".e-group-container").querySelector(".e-lock-grp-btn"),this.groupLock(t)),this.isImportRules=!1},q.prototype.keyBoardHandler=function(e){var t;e.currentTarget!==this.element||!this.readonly||38!==e.keyCode&&40!==e.keyCode&&13!==e.keyCode?"Escape"===e.code&&this.allowDragAndDrop&&(this.isDragEventPrevent=!0,document.body.classList.remove("e-prevent-select"),this.element.querySelectorAll(".e-drag-rule-bottom-line").forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),this.element.querySelectorAll(".e-drag-rule-top-line").forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),this.element.querySelectorAll(".e-qb-dragging-rule").forEach(function(e){e.classList.remove("e-qb-dragging-rule")}),(t=this.element.querySelector(".e-cloneproperties"))&&N.remove(t),this.enableSeparateConnector)&&this.refresh():e.preventDefault()},q.prototype.clearQBTemplate=function(e){(this.isReact||this.isAngular)&&this.clearTemplate(e)},q.prototype.disableRuleCondition=function(e,t,l,n){if(!this.headerTemplate&&!this.readonly){var o=e.querySelector(".e-rule-list").childElementCount,r=e.querySelector(".e-btngroup-and"),i=e.querySelector(".e-btngroup-or");if(1<o)if(r.disabled=!1,i.disabled=!1,(i.nextElementSibling.classList.contains("e-btn-disable")||r.nextElementSibling.classList.contains("e-btn-disable"))&&(i.nextElementSibling.classList.remove("e-btn-disable"),r.nextElementSibling.classList.remove("e-btn-disable")),this.enableSeparateConnector&&!l){for(var s=0,a=void 0;;){var u=e.parentElement.querySelectorAll(".e-btngroup-and"),d=e.parentElement.querySelectorAll(".e-btngroup-or"),r=u[u.length-(1+s)],i=d[d.length-(1+s)];if(!(a=u[u.length-(1+s)])||!a.parentElement||"none"!==a.parentElement.style.display)break;s++}for(var c=e.previousElementSibling;c&&!c.classList.contains("e-rule-container");){if(c.classList.contains("e-group-container")){c=c.querySelectorAll(".e-rule-container")[c.querySelectorAll(".e-rule-container").length-1];break}c=c.previousElementSibling}n&&e.classList.contains("e-group-container")?"or"===this.getGroup(c=e).condition?i.checked=!0:r.checked=!0:c&&c.classList.contains("e-rule-container")&&(p=c.id.replace(this.element.id+"_",""),"or"===this.getRule(p).condition?i.checked=!0:r.checked=!0)}else l||(t&&"or"===t.condition?i.checked=!0:r.checked=!0);else if(this.enableSeparateConnector&&!l){for(s=0,a=void 0;;){u=e.parentElement.querySelectorAll(".e-btngroup-and"),d=e.parentElement.querySelectorAll(".e-btngroup-or");if(r=u[u.length-(1+s)],i=d[d.length-(1+s)],!(a=u[u.length-(1+s)])||!a.parentElement||"none"!==a.parentElement.style.display)break;s++}for(var p,c=void 0,h=e.previousElementSibling;h;){if((h=h.classList.contains("e-group-container")?h.querySelectorAll(".e-rule-container")[h.querySelectorAll(".e-rule-container").length-1]:h).classList.contains("e-rule-container")){c=h;break}h=h.previousElementSibling}N.isNullOrUndefined(c)&&e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]&&(c=e.querySelectorAll(".e-rule-container")[e.querySelectorAll(".e-rule-container").length-1]),n&&e.classList.contains("e-group-container")?"or"===this.getGroup(c=e).condition?i.checked=!0:r.checked=!0:c&&(p=c.id.replace(this.element.id+"_",""),"or"===this.getRule(p).condition&&i?i.checked=!0:r&&(r.checked=!0))}else l||(r.checked=!1,r.disabled=!0,i.checked=!1,i.disabled=!0,t&&(i.nextElementSibling.classList.add("e-btn-disable"),r.nextElementSibling.classList.add("e-btn-disable")))}},q.prototype.getValidRules=function(e){var t=(e=e||this.getRules()).condition,l=e.not,n=N.extend([],e.rules,[],!0);return N.isNullOrUndefined(e.isLocked)?this.getRuleCollection({condition:t,rules:n,not:l},!0):this.getRuleCollection({condition:t,rules:n,not:l,isLocked:e.isLocked},!0)},q.prototype.getRuleCollection=function(e,t){if(N.isNullOrUndefined(e))return null;var l;if(e.rules&&e.rules.length&&(6<Object.keys(e.rules[0]).length||t))for(var n=e.rules.length,o=0;o<n;o++)l=e.rules[o],l=this.getRuleCollection(l,t),e.rules[o]=l,Object.keys(l).length<1&&t&&(e.rules.splice(o,1),o--,n--);var r,i,s=e.custom;return e.field&&""!==e.field&&(N.isNullOrUndefined(s)||s&&"question"!==s.type&&"answer"!==s.type)?(e.operator&&(-1<e.operator.toString().indexOf("null")||-1<e.operator.toString().indexOf("empty"))&&(e.value=null),(this.isRefreshed&&this.enablePersistence||""!==e.field&&""!==e.operator&&""!==e.value&&void 0!==e.value||s&&s.isQuestion)&&(i=e.condition,r=e.isLocked,e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value},N.isNullOrUndefined(r)||(e.isLocked=r),i&&(e.condition=i),s&&(e.custom=s),"in"!==e.operator&&"notin"!==e.operator||!e.value||0!==e.value.length)||(e={})):!s||"question"!==s.type&&"answer"!==s.type?(N.isNullOrUndefined(e.condition)&&N.isNullOrUndefined(e.rules)||(r=e.isLocked,e=this.enableNotCondition?{condition:e.condition,rules:e.rules,not:e.not}:{condition:e.condition,rules:e.rules},N.isNullOrUndefined(r)||(e.isLocked=r),s&&(e.custom=s),e.rules&&0===e.rules.length))&&(e={}):(i=e.not,(e={label:e.label,field:e.field,operator:e.operator,type:e.type,value:e.value,condition:e.condition,rules:e.rules}).custom=s,this.enableNotCondition&&(e.not=i)),e},q.prototype.setRules=function(e){e=N.extend({},e,{},!0);this.headerTemplate?this.setGroupRules(e,!0):this.setGroupRules(e)},q.prototype.getRules=function(){var e=this.enableNotCondition?{condition:this.rule.condition,rules:this.rule.rules,not:this.rule.not}:{condition:this.rule.condition,rules:this.rule.rules};return N.isNullOrUndefined(this.rule.isLocked)||(e.isLocked=this.rule.isLocked),this.rule.custom&&(e.custom=this.rule.custom),e},q.prototype.getRule=function(e){var t=0,l=e instanceof HTMLElement?N.closest(e,".e-rule-container"):(e=this.element.id+"_"+e,document.getElementById(e));if(N.isNullOrUndefined(l))return null;for(e=N.closest(l,".e-group-container"),e=this.getParentGroup(e);null!==l.previousElementSibling;)l=l.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!l.classList.contains("e-btn-group")||this.headerTemplate&&(l.classList.contains("e-rule-container")||l.classList.contains("e-group-container"))))&&t++;return e.rules[t]},q.prototype.getGroup=function(e){e=(e=e instanceof Element&&e.className.indexOf("e-group-container")<1?N.closest(e,".e-group-container"):e)instanceof Element?e.id:this.element.id+"_"+e;return this.getParentGroup(e)},q.prototype.deleteGroups=function(e){for(var t,l=e.length,n=0;n<l;n++)t=this.element.id+"_"+e[n],this.deleteGroup(document.getElementById(t))},q.prototype.getFilteredRecords=function(){var e=this.getPredicate(this.getValidRules(this.rule)),e=N.isNullOrUndefined(e)?new h.Query:(new h.Query).where(e);return this.dataManager.executeQuery(e)},q.prototype.deleteRules=function(e){for(var t,l=e.length,n=0;n<l;n++)t=this.element.id+"_"+e[n],this.deleteRule(document.getElementById(t))},q.prototype.getDataManagerQuery=function(e){for(var t=this.getPredicate(e),l=[],n=0,o=Object.keys(this.columns);n<o.length;n++)l.push(this.columns[n].field);return e.rules.length?(new h.Query).select(l).where(t):(new h.Query).select(l)},q.prototype.getPredicate=function(e){var t,l,n=e.rules,o=!1;if(n){for(var r=0,i=n.length;r<i;r++){var s=n[r].operator;"notstartswith"===s?s="doesnotstartwith":"notendswith"===s?s="doesnotendwith":"notcontains"===s&&(s="doesnotcontain");var a,u,d,c,p,o=!1;-1<Object.keys(n[r]).indexOf("rules")&&n[r].rules?(a=this.getPredicate(n[r]))&&(t=t?"and"===e.condition?t.and(a):t.or(a):a):N.isNullOrUndefined(s)||N.isNullOrUndefined(s.length)||(a=n[r].operator.toLowerCase(),u=!1,d=["equal","notequal","greaterthan","greaterthanorequal","lessthan","lessthanorequal"],"string"===n[r].type&&(o=!this.matchCase),"date"===n[r].type&&-1<d.indexOf(a)&&(o=!0),c=this.getColumn(n[r].field),-1<a.indexOf("null")||-1<a.indexOf("empty")?n[r].value=null:"date"!==n[r].type||n[r].value instanceof Array?l=n[r].value:(c=this.getFormat(c.format),N.isNullOrUndefined(n[r].value)?l=null:(l=this.getDate(n[r].value,c),-1<d.indexOf(a)&&!this.isTime(n[r].value)&&(u=!0))),0===r?u||(-1<a.indexOf("in")||-1<a.indexOf("between")||-1<a.indexOf("null")||-1<a.indexOf("empty"))&&a.indexOf("contain")<0?t=u?this.datePredicate(n[r],l):this.arrayPredicate(n[r]):""!==(p=l)&&(t=new h.Predicate(n[r].field,s,l,o)):u||(-1<a.indexOf("in")||-1<a.indexOf("between")||-1<a.indexOf("null")||-1<a.indexOf("empty"))&&a.indexOf("contain")<0?t=u?this.datePredicate(n[r],l,t,e.condition):this.arrayPredicate(n[r],t,e.condition):"and"===e.condition?(p=l,t&&""!==p?t=t.and(n[r].field,s,l,o):""!==p&&(t=new h.Predicate(n[r].field,s,l,o))):(p=l,t&&""!==p?t=t.or(n[r].field,s,l,o):""!==p&&(t=new h.Predicate(n[r].field,s,l,o))))}this.dataSource instanceof h.DataManager&&(N.isNullOrUndefined(t)||"isnull"!==t.operator&&"isnotnull"!==t.operator||(t.operator="isnull"===t.operator?"equal":"notequal"))}return t},q.prototype.getLocale=function(){var e=this.locale;return e=N.getValue("main."+this.locale+".dates.calendars.gregorian.days.format.short",N.cldrData)?e:"en"},q.prototype.getColumn=function(e,t){for(var l,n=this.columns,o=0,r=(n=t||n).length;o<r;o++){if(n[o].field===e){l=n[o];break}if(n[o].columns){if(l=this.getColumn(e,n[o].columns))break}else if(e&&-1<e.indexOf(this.separator)&&""!==this.separator&&n[o].field===e.split(this.separator)[0]){l=n[o];break}}return l},q.prototype.getOperators=function(e){return this.getColumn(e).operators},q.prototype.setTime=function(e,t){return t?e.setHours(0,0,0):e.setHours(23,59,59),e},q.prototype.datePredicate=function(e,t,l,n){var o,r=this.setTime(new Date(t.getTime()),!0),i=this.setTime(t);switch(e.operator){case"equal":o=(o=new h.Predicate(e.field,"greaterthanorequal",r)).and(e.field,"lessthanorequal",i);break;case"notequal":o=(o=new h.Predicate(e.field,"lessthan",r)).or(e.field,"greaterthan",i);break;case"greaterthan":o=new h.Predicate(e.field,"greaterthan",i);break;case"greaterthanorequal":o=new h.Predicate(e.field,"greaterthanorequal",r);break;case"lessthan":o=new h.Predicate(e.field,"lessthan",r);break;case"lessthanorequal":o=new h.Predicate(e.field,"lessthanorequal",i)}return o&&(l?"and"===n?l=l.and(o):"or"===n&&(l=l.or(o)):l=o),l},q.prototype.arrayPredicate=function(e,t,l){var n,o=e.value,r=e.operator.toString(),i=e.value,s=this.getColumn(e.field),a=this.getFormat(s.format);if(-1<r.indexOf("null")||-1<r.indexOf("empty"))switch(r){case"isnull":n=new h.Predicate(e.field,"isnull",i);break;case"isnotnull":n=new h.Predicate(e.field,"isnotnull",i);break;case"isempty":n=new h.Predicate(e.field,"equal","");break;case"isnotempty":n=new h.Predicate(e.field,"notequal","")}if(!(-1<r.indexOf("null")||-1<r.indexOf("empty")))for(var u=0,d=o.length;u<d;u++)if(""!==o[u]||("in"===r||"notin"===r)&&"string"===s.type)if(0===u){var c="greaterthanorequal";switch(r){case"between":n="date"!==s.type?new h.Predicate(e.field,c,o[u]):new h.Predicate(e.field,c,o[u]?this.isTime(o[u])?this.getDate(o[u],a):this.setTime(this.getDate(o[u],a),!0):null);break;case"notbetween":n="date"===s.type?new h.Predicate(e.field,"lessthan",o[u]?this.isTime(o[u])?this.getDate(o[u],a):this.setTime(this.getDate(o[u],a),!0):null):new h.Predicate(e.field,"lessthan",o[u]);break;case"in":n=new h.Predicate(e.field,"equal",o[u]);break;case"notin":n=new h.Predicate(e.field,"notequal",o[u])}}else switch(e.operator){case"between":n="date"===s.type?n.and(e.field,"lessthanorequal",o[u]&&(this.isTime(o[u])?this.getDate(o[u],a):this.setTime(this.getDate(o[u],a)))):n.and(e.field,"lessthanorequal",o[u]);break;case"notbetween":n="date"===s.type?n.or(e.field,"greaterthan",o[u]&&(this.isTime(o[u])?this.getDate(o[u],a):this.setTime(this.getDate(o[u],a)))):n.or(e.field,"greaterthan",o[u]);break;case"in":n=n.or(e.field,"equal",o[u]);break;case"notin":n=n.and(e.field,"notequal",o[u])}return n&&(t?"and"===l?t=t.and(n):"or"===l&&(t=t.or(n)):t=n),t},q.prototype.getDate=function(e,t){t=this.intl.parseDate(e,t);return-1<e.indexOf(":")&&e.indexOf("/")<0&&e.indexOf(",")<0&&e.indexOf("-")<0&&((t=new Date).setHours(parseInt(e.split(":")[0],10)),t.setMinutes(parseInt(e.split(":")[1],10)),e.split(":")[2])&&t.setSeconds(parseInt(e.split(":")[2],10)),t},q.prototype.isTime=function(e){return!!(e&&-1<e.indexOf(":"))},q.prototype.importRules=function(e,t,l,n,o){if(l){if(e.rules&&1<e.rules.length&&!this.headerTemplate){var l=t.querySelector(".e-btngroup-or"),r=t.querySelector(".e-btngroup-and");if(this.enableSeparateConnector&&t.previousElementSibling&&(l=t.previousElementSibling.querySelector(".e-btngroup-or"),r=t.previousElementSibling.querySelector(".e-btngroup-and")),l.disabled=!1,r.disabled=!1,this.enableSeparateConnector){for(var i=t.previousElementSibling;i&&!i.classList.contains("e-rule-container");){if(i.classList.contains("e-group-container")){i=i.querySelectorAll(".e-rule-container")[i.querySelectorAll(".e-rule-container").length-1];break}i=i.previousElementSibling}i&&i.classList.contains("e-rule-container")&&(s=i.id.replace(this.element.id+"_",""),"or"===this.getRule(s).condition?l.checked=!0:r.checked=!0)}else"or"===e.condition?l.checked=!0:r.checked=!0}else this.disableRuleCondition(t);var s;this.headerTemplate&&o&&(t=this.renderGroup(e,e.condition,this.element,e.not,o)),this.enableNotCondition&&!this.headerTemplate&&(s=t.querySelector(".e-qb-toggle"),e.not?N.addClass([s],"e-active-toggle"):N.removeClass([s],"e-active-toggle"))}else t=this.renderGroup(e,e.condition,t,n);e.rules&&0===e.rules.length&&this.headerTemplate&&(e.rules[0]={label:"",field:"",operator:"",type:"",value:""});var a=e.rules;if(!N.isNullOrUndefined(a))for(var u=0,d=a.length;u<d;u++){var c=Object.keys(a[u]);if(!N.isNullOrUndefined(a[u].rules)&&-1<c.indexOf("rules")&&0!==a[u].rules.length){if(this.element.querySelectorAll(".e-group-container").length>this.maxGroupCount)return null;t=this.renderGroup(a[u],a[u].condition,t,a[u].not),t=this.importRules(a[u],t,!0)}else this.renderRule(a[u],t);!N.isNullOrUndefined(a[u].rules)&&a[u].isLocked&&(c=t.querySelector(".e-rule-list").children[u].querySelector(".e-lock-grp-btn"),this.groupLock(c))}return t=(t=t&&N.closest(t,".e-rule-list"))&&N.closest(t,".e-group-container")},q.prototype.renderGroup=function(e,t,l,n,o){this.addGroupElement(!0,l,t,!1,n,o,e);var t=l.querySelectorAll(".e-group-container"),r=l.querySelector(".e-rule-list").children;if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isMiddleGroup){this.isMiddleGroup=!1,this.cloneGrpBtnClick=!1;var i=0,s=this.groupIndex+1;if(this.enableSeparateConnector)for(var a=0;a<s;a++)r[a].classList.contains("e-rule-container")&&(s++,i++);return r[this.groupIndex+i+1]}return this.showButtons.cloneGroup&&this.cloneGrpBtnClick&&this.isLastGroup?(this.isLastGroup=!1,this.cloneGrpBtnClick=!1,r[r.length-1]):t[t.length-1]},q.prototype.renderRule=function(e,t){-1<t.className.indexOf("e-group-container")?this.addRuleElement(t,e):this.addRuleElement(t.querySelector(".e-group-container"),e)},q.prototype.enableReadonly=function(){for(var e=this.element.querySelectorAll(".e-dropdownlist, .e-dropdowntree, .e-numerictextbox, .e-textbox, .e-datepicker, .e-multiselect .e-lib, .e-radio"),t=0;t<e.length;t++)e[t].classList.contains("e-dropdownlist")?N.getInstance(e[t],y.DropDownList).readonly=this.isReadonly:e[t].classList.contains("e-dropdowntree")?N.getComponent(e[t],"dropdowntree").readonly=this.isReadonly:e[t].classList.contains("e-numerictextbox")?N.getInstance(e[t],p.NumericTextBox).readonly=this.isReadonly:e[t].classList.contains("e-textbox")?N.getInstance(e[t],p.TextBox).readonly=this.isReadonly:e[t].classList.contains("e-datepicker")?N.getInstance(e[t],v.DatePicker).readonly=this.isReadonly:e[t].classList.contains("e-multiselect")?N.getInstance(e[t],y.MultiSelect).readonly=this.isReadonly:e[t].classList.contains("e-radio")&&!N.getInstance(e[t],L.RadioButton).checked&&(this.isReadonly?e[t].parentElement.style.display="none":e[t].parentElement.style.display="inherit");for(var l=this.element.querySelectorAll(".e-deletegroup"),n=this.element.querySelectorAll(".e-addrulegroup"),o=this.element.querySelectorAll(".e-removerule"),r=(!this.isReadonly&&this.ruleElem.classList.contains("e-readonly")&&this.ruleElem.classList.remove("e-readonly"),[l,n,o]),t=0;t<r.length;t++)r[t].forEach(function(e){e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.add("e-readonly")});this.enableBtnGroup()},q.prototype.enableBtnGroup=function(){var t=this,e=this.element.querySelectorAll(".e-btngroup-and-lbl, .e-btngroup-or-lbl, .e-qb-toggle"),l=!1;e.forEach(function(e){!e.classList.contains("e-qb-toggle")||e.classList.contains("e-active-toggle")||e.classList.contains("e-readonly")?e.classList.contains("e-qb-toggle")&&e.classList.contains("e-not-readonly")?e.classList.remove("e-not-readonly"):e.classList.contains("e-qb-toggle")&&e.classList.contains("e-readonly")?e.classList.remove("e-readonly"):e.classList.contains("e-active-toggle")?(e.classList.add("e-not-readonly"),l=!0):e.previousElementSibling.checked||e.classList.contains("e-readonly")?(e.classList.remove("e-readonly"),l?"AND"===e.textContent?e.classList.add("e-readonly-and"):e.classList.add("e-readonly-or"):("AND"===e.textContent&&t.isReadonly?(e.classList.remove("e-not"),e.classList.add("e-readonly-and")):(t.enableNotCondition&&e.classList.add("e-not"),e.classList.remove("e-readonly-and")),"OR"===e.textContent&&t.isReadonly?e.classList.add("e-readonly-or-not"):e.classList.remove("e-readonly-or-not"))):e.classList.contains("e-btn-disable")||e.classList.add("e-readonly"):(e.classList.add("e-readonly"),l=!1)})},q.prototype.isDateFunction=function(e){for(var t=["date","time","day","week","month","year","hour","minute","second","now","quarter","period","extract"],l=0,n=t.length;l<n;l++)if(-1<e.toLowerCase().indexOf(t[l]))return!0;return!1},q.prototype.getSqlString=function(e,t,l,n){var o=!1,r=(l||""===l?l+="(":o=!(l=""),e.condition);if(e.not&&(l+=o?n?this.l10n.getConstant("NOT").toUpperCase()+" (":"NOT (":n?" "+this.l10n.getConstant("NOT").toUpperCase()+" (":" NOT ("),e.rules)for(var i=0,s=e.rules.length;i<s;i++){if(e.rules[i].rules)l=this.getSqlString(e.rules[i],t,l,n),this.enableSeparateConnector&&(r=e.rules[i].condition);else{var a=e.rules[i],u="",d=(n?this.sqlOperators:this.operators)[a.operator];if(a.value instanceof Array)if(-1<a.operator.toString().indexOf("between")){var c=n?" "+this.l10n.getConstant("AND").toUpperCase()+" ":" AND ";"date"!==a.type||this.isDateFunction(a.value[0])?u+=a.value[0]+c+a.value[1]:u+='"'+a.value[0]+'"'+c+'"'+a.value[1]+'"'}else if("string"==typeof a.value[0]&&null!==a.value){u+='("'+a.value[0]+'"';for(var p=1,h=a.value.length;p<h;p++)u+=',"'+a.value[p]+'"';u+=")"}else u+="("+a.value+")";else-1<a.operator.toString().indexOf("startswith")?u+=a.value?'("'+a.value+'%")':"("+a.value+")":-1<a.operator.toString().indexOf("endswith")?u+=a.value?'("%'+a.value+'")':"("+a.value+")":-1<a.operator.toString().indexOf("contains")?u+=a.value?'("%'+a.value+'%")':"("+a.value+")":"number"===a.type||"boolean"==typeof a.value||null===a.value&&a.operator.toString().indexOf("empty")<-1?u+=a.value:-1<a.operator.toString().indexOf("empty")?u+='""':u+='"'+a.value+'"';-1<a.operator.toString().indexOf("null")?(t?a.field="`"+a.field+"`":-1<a.field.indexOf(" ")&&(a.field='"'+a.field+'"'),l+=a.field+" "+d):(c=d,"isempty"===a.operator?c="=":"isnotempty"===a.operator&&(c="!="),t?a.field="`"+a.field+"`":-1<a.field.indexOf(" ")&&(a.field='"'+a.field+'"'),l+=a.field+" "+c+" "+u),a.condition&&""!==a.condition&&(r=a.condition)}i!==s-1&&(a=e.rules[i],r=""===r||a&&""!==a.condition&&a.custom&&a.custom.isCustom?a.condition:r)&&(l+=" "+(r=(n?this.l10n.getConstant(r.toUpperCase()):r).toUpperCase())+" ")}return o||(l+=")"),e.not&&(l+=")"),l},q.prototype.setRulesFromSql=function(e,t){e=e.replace(/`/g,"");e=this.getRulesFromSql(e,t);this.setRules({condition:e.condition,not:e.not,rules:e.rules})},q.prototype.getRulesFromSql=function(e,t){this.parser=[],this.sqlParser(e,t),this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0);e=this.processParser(this.parser,this.rule,[0],t);return this.enableNotCondition?{condition:e.condition,not:e.not,rules:e.rules}:{condition:e.condition,rules:e.rules}},q.prototype.getSqlFromRules=function(e,t,l){return e=e||this.getValidRules(),e=this.getRuleCollection(e,!1),this.getSqlString(this.getValidRules(e),t,null,l).replace(/"/g,"'")},q.prototype.getParameterizedSql=function(e){var t;return this.moduleLoader.loadedModules.length?(e=e||this.getValidRules(),this.notify("query-library",{prop:"getParameterSql",onPropertyChange:!(t={sql:null}),value:{rule:e,obj:t}}),t.sql):(console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null)},q.prototype.setParameterizedSql=function(e){var t;this.moduleLoader.loadedModules.length?(this.notify("query-library",{prop:"convertParamSqlToSql",onPropertyChange:!(t={sql:null}),value:{sql:e,obj:t}}),(e=t.sql)&&(e=e.replace(/`/g,""),t=this.getRulesFromSql(e),this.setRules({condition:t.condition,not:t.not,rules:t.rules}))):console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},q.prototype.getParameterizedNamedSql=function(e){var t;return this.moduleLoader.loadedModules.length?(e=e||this.getValidRules(),this.notify("query-library",{prop:"getNamedParameterSql",onPropertyChange:!(t={sql:null}),value:{rule:e,obj:t}}),t.sql):(console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),null)},q.prototype.setParameterizedNamedSql=function(e){var t;this.moduleLoader.loadedModules.length?(this.notify("query-library",{prop:"convertNamedParamSqlToSql",onPropertyChange:!(t={sql:null}),value:{sql:e,obj:t}}),(e=t.sql)&&(e=e.replace(/`/g,""),t=this.getRulesFromSql(e),this.setRules({condition:t.condition,not:t.not,rules:t.rules}))):console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},q.prototype.setMongoQuery=function(e,t){this.moduleLoader.loadedModules.length?(this.rule={condition:"and",not:!1,rules:[]},this.notify("query-library",{prop:"mongoParser",onPropertyChange:!1,value:{mongoQuery:JSON.parse(e),rule:this.rule,mongoLocale:t}})):console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.')},q.prototype.getMongoQuery=function(e){var t;return this.moduleLoader.loadedModules.length?(e=e||this.getValidRules(),this.notify("query-library",{prop:"getMongoFromRules",onPropertyChange:!(t={mongoQuery:null}),value:{rule:e,mongoQuery:"",obj:t}}),t.mongoQuery):(console.warn('[WARNING] :: Module "query-library" is not available in QueryBuilder component! You either misspelled the module name or forgot to load it.'),"")},q.prototype.cloneRule=function(e,t,l){var e=this.getRule(e.replace(this.element.id+"_","")),n=this.showButtons.cloneRule;t=t.replace(this.element.id+"_",""),this.ruleIndex=l,this.cloneRuleBtnClick=!0,this.showButtons.cloneRule=!0,this.addRules([{label:e.label,field:e.field,type:e.type,operator:e.operator,value:e.value,condition:e.condition}],t),this.ruleIndex=-1,this.cloneRuleBtnClick=!1,this.showButtons.cloneRule=n},q.prototype.cloneGroup=function(e,t,l){t=t.replace(this.element.id+"_","");var t=this.getGroup(t),n=this.showButtons.cloneGroup;e=e.replace(this.element.id+"_",""),this.groupIndex=l,this.cloneGrpBtnClick=!0,this.showButtons.cloneGroup=!0,this.addGroups([{condition:t.condition,not:t.not,rules:t.rules}],e),this.groupIndex=-1,this.cloneGrpBtnClick=!1,this.showButtons.cloneGroup=n},q.prototype.lockRule=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);e=document.getElementById(e).querySelectorAll(".e-lock-rule-btn")[0];this.ruleLock(e)},q.prototype.lockGroup=function(e){e.indexOf(this.element.id)<0&&(e=this.element.id+"_"+e);e=document.getElementById(e).querySelectorAll(".e-lock-grp-btn")[0];this.groupLock(e)},q.prototype.sqlParser=function(e,t){for(var l,n=0;l=e.slice(n),n+=this.parseSqlStrings(l,t),""!==l;);return this.parser},q.prototype.parseSqlStrings=function(e,t){for(var l,n=["=","!=","<=",">=","<",">"],o=t?[this.l10n.getConstant("AND").toUpperCase(),this.l10n.getConstant("OR").toUpperCase(),this.l10n.getConstant("NOT").toUpperCase()]:["AND","OR","NOT"],r=t?[this.l10n.getConstant("In").toUpperCase(),this.l10n.getConstant("NotIn").toUpperCase(),this.l10n.getConstant("Like").toUpperCase(),this.l10n.getConstant("NotLike").toUpperCase(),this.l10n.getConstant("Between").toUpperCase(),this.l10n.getConstant("NotBetween").toUpperCase(),this.l10n.getConstant("IsNull").toUpperCase(),this.l10n.getConstant("IsNotNull").toUpperCase(),this.l10n.getConstant("IsEmpty").toUpperCase(),this.l10n.getConstant("IsNotEmpty").toUpperCase()]:["IN","NOT IN","LIKE","NOT LIKE","BETWEEN","NOT BETWEEN","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"],i=0,s=n.length;i<s;i++){var a=/^\w+$/.test(n[i])?"\\b":"";if(new RegExp("^("+n[i]+")"+a,"ig").exec(e))return this.parser.push(["Operators",n[i].toLowerCase()]),n[i].length}var u=this.parser[this.parser.length-1];if(!u||"Literal"!==u[0])for(i=0,s=o.length;i<s;i++)if(a=/^\w+$/.test(o[i])?"\\b":"",new RegExp("^("+o[i]+")"+a,"ig").exec(e))return this.parser.push(["Conditions",o[i].toLowerCase()]),o[i].length;for(i=0,s=r.length;i<s;i++)if(a=/^\w+$/.test(r[i])?"\\b":"",new RegExp("^("+r[i]+")"+a,"ig").exec(e))return this.parser.push(["SubOperators",r[i].toLowerCase()]),r[i].length;if(/^\(/.exec(e))return this.parser.push(["Left","("]),1;if(/^\)/.exec(e))return this.parser.push(["Right",")"]),1;if(/^(true|false)/.exec(e))return l=/^(true|false)/.exec(e)[0],this.parser.push(["String",l]),l.length;if(/^null/.exec(e))return l=/^null/.exec(e)[0],this.parser.push(["String",null]),l.length;if(/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e))return l=/^`?([a-z_][a-z0-9_.\\[\]\\(\\)]{0,}(\\:(number|float|string|date|boolean))?)`?/i.exec(e)[1],this.parser.push(["Literal",l]),l.length;if(this.checkLiteral()&&/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e))return l=/^'?([a-z_][a-z0-9 _.\\[\]\\(\\)-]{0,}(\\:(number|float|string|date|boolean))?)'?/i.exec(e)[1],this.parser.push(["Literal",l]),l.length+2;if(this.checkNumberLiteral(e,t))return l=/^[0-9]+(\.[0-9]+)$/.exec(e)[0],this.parser.push(["Literal",l]),l.length;u=this.getSingleQuoteString(e);if(""!==u){if("("===(l=u)[l.length-2])for(var d=!1,c=l.length;c<e.length&&(l+=e[c],!(d=")"===e[c]||d)||"'"!==e[c]);c++);else e[l.length]&&")"!==e[l.length]&&!this.checkCondition(e,l)&&(l=this.combineSingleQuoteString(e,l));return this.parser.push(["String",l]),l.length}t=this.getDoubleQuoteString(e);return""!==t?(this.parser.push(["DoubleString",l=t]),l.length):/^\d*\.?\d+/.exec(e)?(l=/^\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",l]),l.length):/^-?\d*\.?\d+/.exec(e)?(l=/^-?\d*\.?\d+/.exec(e)[0],this.parser.push(["Number",l]),l.length):1},q.prototype.getDoubleQuoteString=function(e){var t=e.indexOf('"');if(0===t){var l=e.indexOf('"',t+1);if(-1!==l)return e.substring(t,l+1)}return""},q.prototype.checkCondition=function(e,t){return"AND"===e.slice(t.length+1,t.length+4)||"OR"===e.slice(t.length+1,t.length+3)},q.prototype.getSingleQuoteString=function(e,t){var l=e.indexOf("'");if(-1!==l&&t||0===l&&!t){t=e.indexOf("'",l+1);if(-1!==t)return e.substring(l,t+1)}return""},q.prototype.combineSingleQuoteString=function(e,t){var l;return e[t.length]&&")"!==e[t.length]&&!this.checkCondition(e,t)&&","!==e[t.length]&&(l=t.substring(0,t.length-1),l=e.replace(l,""),""!==(l=this.getSingleQuoteString(l,!0)))&&(l=l.substring(1,l.length),t=this.combineSingleQuoteString(e,t+=l)),t},q.prototype.checkLiteral=function(){var e,t,l=this.parser[this.parser.length-1];return!(l&&(e=this.parser[this.parser.length-2],t=this.parser[this.parser.length-3],"Left"!==l[0]||!e||"Conditions"!==e[0]))||!!("Conditions"===l[0]&&t&&t[1].indexOf("between")<0)},q.prototype.checkNumberLiteral=function(e,t){var l=this.parser[this.parser.length-1];if(!l)return!0;if(/^[0-9]+(?:\.[0-9]+)$/.exec(e)){var e=this.parser[this.parser.length-2],n=this.parser[this.parser.length-3];if("Left"===l[0]&&e&&"Conditions"===e[0])return!0;e=t?this.l10n.getConstant("Between").toLowerCase():"between";if("Conditions"===l[0]&&n&&n[1].indexOf(e)<0)return!0}return!1},q.prototype.getOperator=function(e,t,l){if(l){for(var n=Object.keys(this.sqlOperators),o=0;o<n.length;o++)if(this.sqlOperators[n[o]]===t.toUpperCase())return e&&0===e.indexOf("%")&&"%"===e[e.length-1]?"NOT LIKE"===t.toUpperCase()?"notcontains":"contains":e&&0!==e.indexOf("%")&&e.indexOf("%")===e.length-1?"NOT LIKE"===t.toUpperCase()?"notstartswith":"startswith":e&&0===e.indexOf("%")&&e.indexOf("%")!==e.length-1?"NOT LIKE"===t.toUpperCase()?"notendswith":"endswith":n[o];return null}if(e){if(0===e.indexOf("%")&&"%"===e[e.length-1])return"not like"===t?"notcontains":"contains";if(0!==e.indexOf("%")&&e.indexOf("%")===e.length-1)return"not like"===t?"notstartswith":"startswith";if(0===e.indexOf("%")&&e.indexOf("%")!==e.length-1)return"not like"===t?"notendswith":"endswith"}else{if("not like"===t)return"notequal";if("like"===t)return"equal"}return{"=":"equal","!=":"notequal","<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal",in:"in","not in":"notin",between:"between","not between":"notbetween","is empty":"isempty","is null":"isnull","is not null":"isnotnull","is not empty":"isnotempty"}[""+t]},q.prototype.getTypeFromColumn=function(e){e=this.getColumn(e.field);return N.isNullOrUndefined(e)?null:e.type},q.prototype.getLabelFromColumn=function(e){var t="",l=0;if(""===this.separator)return this.getColumn(e).label;for(var n=e.split(this.separator),o=0;o<n.length;o++)t+=this.getLabelFromField(n,o+1),++l<n.length&&(t+=this.separator);return t},q.prototype.getLabelFromField=function(e,t){for(var l="",n=0,o=0;o<t;o++)l+=e[o],++n<t&&(l+=this.separator);return this.getColumn(l).label},q.prototype.processParser=function(e,t,l,n){for(var o,r,i,s,a,u,d,c,p=[],h=[],g=!1,m=0,f=e.length;m<f;m++)if("Literal"===e[m][0]){var y=this.getColumn(e[m][1]),v={label:y&&y.label?y.label:e[m][1],field:e[m][1]};if("SubOperators"===e[m+1][0]){for(-1<e[m+1][1].indexOf("null")||-1<e[m+1][1].indexOf("empty")?(v.operator=this.getOperator(" ",e[m+1][1],n),v.value=null,v.type=this.getTypeFromColumn(v)):(y=e[m+3][1]&&e[m+3][1].replace(/'/g,""),v.operator=this.getOperator(y,e[m+1][1],n)),c=e[m+1][1],r=f,n&&"contains"===v.operator||"startswith"===v.operator||"endswith"===v.operator?c="like":n&&"notcontains"===v.operator||"notstartswith"===v.operator||"notendswith"===v.operator?c="not like":n&&(c=v.operator),o=o=++m+1;o<r;o++)if(c.indexOf("between")<0&&"Left"===e[o][0])g=!0;else{if("Right"===e[o][0]&&g){m=o,g=!1;break}if(-1<c.indexOf("null")||-1<c.indexOf("empty"))break;if(-1<c.indexOf("like")&&"String"===e[o][0]){var b=e[o][1];b=(b=e[o][1]&&"'"===e[o][1][0]?e[o][1].substring(1,e[o][1].length-1):b)?b.replace(/%/g,""):e[o][1],v.value=b,v.type="string"}else{if(-1<c.indexOf("between")&&("Literal"===e[o][0]||"Left"===e[o][0]))break;"Number"===e[o][0]?p.push(Number(e[o][1])):"String"===e[o][0]&&(b=e[o][1],e[o][1]&&"'"===e[o][1][0]&&(b=e[o][1].substring(1,e[o][1].length-1)),h.push(b))}v.type=this.getTypeFromColumn(v)}c.indexOf("like")<0&&("Number"===e[o-1][0]?(v.value=p,v.type="number"):"String"===e[o-1][0]?(v.value=h,v.type="string"):-1<c.indexOf("between")&&"Conditions"===e[o-1][0]&&(0!==h.length?(v.value=h,v.type="string"):(v.value=p,v.type="number")),p=[],h=[],v.type=this.getTypeFromColumn(v)),this.enableSeparateConnector&&"Conditions"===e[m+1][0]&&(v.condition=e[m+1][1])}else"Operators"===e[m+1][0]&&(v.operator=this.getOperator(e[m+2][1],e[m+1][1],n),"equal"===v.operator&&"String"===e[m+2][0]&&"''"===e[m+2][1]?v.operator="isempty":"notequal"===v.operator&&"String"===e[m+2][0]&&"''"===e[m+2][1]&&(v.operator="isnotempty"),"Number"===e[m+2][0]?(v.type="number",v.value=Number(e[m+2][1])):(v.type="string",(b=e[m+2][1])&&"'"===b[0]&&(b=b.substring(1,b.length-1)),v.value=b),this.enableSeparateConnector&&"Conditions"===e[m+3][0]&&(v.condition=e[m+3][1]),v.type=this.getTypeFromColumn(v));t.rules.push(v)}else if("Left"===e[m][0]){if("Left"===e[0][0]||!("not"===e[m-1][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[m-1][1])){for(this.parser=e.splice(m+1,f-(m+1)),y=this.enableNotCondition?{condition:"and",rules:[],not:!1}:{condition:"and",rules:[]},s=t.rules.length,i=d=0;i<s;i++)t.rules[i].rules&&d++;return l.push(d),t.rules.push(y),y=this.processParser(this.parser,y,l,n),t}}else if("Conditions"!==e[m][0]||this.enableSeparateConnector){if("Right"===e[m][0]){for(this.parser=e.splice(m+1,f-(m+1)),l.pop(),t=this.rule,u=l.length,a=0;a<u;a++)t=this.findGroupByIdx(l[a],t,0===a);return this.processParser(this.parser,t,l,n)}}else"not"===e[m][1]||n&&this.l10n.getConstant("NOT").toLowerCase()===e[m][1]?t.not=!0:t.condition=e[m][1];return t},q.prototype.groupClone=function(e){var t,l,n=e.closest(".e-rule-list").closest(".e-group-container"),n=("string"==typeof e?(l=this.element.id+"_"+e,e=document.getElementById(l)):(t=e.id.replace(this.element.id+"_",""),l=n.id.replace(this.element.id+"_","")),this.getGroup(t));this.groupIndex=Array.prototype.indexOf.call(e.closest(".e-rule-list").children,e.closest(".e-group-container")),this.addGroups([{condition:n.condition,not:n.not,rules:n.rules}],l),this.groupIndex=-1},q.prototype.ruleClone=function(e){for(var t=N.closest(e,".e-rule-container"),l=e.closest(".e-rule-list").closest(".e-group-container"),e=this.getRule(e),n=l.id.replace(this.element.id+"_",""),o=l.querySelectorAll(".e-rule-container"),r=0,i=o.length;r<i;r++)t.id===o[r].id&&(this.ruleIndex=r);this.enableSeparateConnector?this.addRules([{label:e.label,field:e.field,type:e.type,operator:e.operator,value:e.value,condition:e.condition}],n):this.addRules([{label:e.label,field:e.field,type:e.type,operator:e.operator,value:e.value}],n),this.ruleIndex=-1},q.prototype.ruleLock=function(e){var t=N.closest(e,".e-rule-container"),l=this.getRule(t.id.replace(this.element.id+"_",""));t.classList.contains("e-disable")?(l.isLocked=!1,this.lockItems=this.lockItems.filter(function(e){return e!==t.id}),t.classList.remove("e-disable"),this.disableRuleControls(e,t,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockRule"))):(l.isLocked=!0,this.lockItems.indexOf(t.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,t.id),t.classList.add("e-disable"),this.disableRuleControls(e,t,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockRule")))},q.prototype.groupLock=function(e){var t,l=N.closest(e,".e-group-container"),n=this.getGroup(l.id.replace(this.element.id+"_","")),o=-1<l.id.indexOf("group0");l.classList.contains("e-disable")?(o?((t={}).condition=n.condition,t.not=n.not,t.isLocked=!1,this.setProperties({rule:t},!0)):n.isLocked=!1,this.lockItems=this.lockItems.filter(function(e){return e!==l.id}),l.classList.remove("e-disable"),this.disableHeaderControls(e,l,!1),e.children[0].classList.add("e-unlock"),e.children[0].classList.remove("e-lock"),e.setAttribute("title",this.l10n.getConstant("LockGroup")),this.updateLockItems()):(o?((t={}).condition=n.condition,t.not=n.not,t.isLocked=!0,this.setProperties({rule:t},!0)):n.isLocked=!0,this.lockItems.indexOf(l.id)<0&&this.lockItems.splice(this.lockItems.length-1,0,l.id),l.classList.add("e-disable"),this.disableHeaderControls(e,l,!0),e.children[0].classList.add("e-lock"),e.children[0].classList.remove("e-unlock"),e.setAttribute("title",this.l10n.getConstant("UnlockGroup")))},q.prototype.updateLockItems=function(){for(var e,t=0;t<this.lockItems.length;t++)2<this.lockItems[t].split("_").length?(e=this.element.querySelector("#"+this.lockItems[t]).querySelector(".e-lock-rule-btn"),N.closest(e,".e-rule-container").classList.contains("e-disable")||this.ruleLock(e)):(e=this.element.querySelector("#"+this.lockItems[t]).querySelector(".e-lock-grp-btn"),N.closest(e,".e-group-container").classList.contains("e-disable")||this.groupLock(e))},q.prototype.disableHeaderControls=function(e,t,l){for(var n=t.querySelectorAll(".e-btngroup-and"),o=t.querySelectorAll(".e-btngroup-or"),r=t.querySelectorAll(".e-qb-toggle"),i=t.querySelectorAll(".e-add-btn"),s=t.querySelectorAll(".e-deletegroup"),a=t.querySelectorAll(".e-lock-grp-btn"),u=t.querySelectorAll(".e-clone-grp-btn"),d=t.querySelectorAll(".e-group-container"),c=t.querySelectorAll(".e-add-condition-btn"),p=t.querySelectorAll(".e-add-group-btn"),h=0;h<n.length;h++)l?(d[h]&&d[h].classList.contains("e-disable")&&d[h].classList.add("e-disable"),n[h].disabled=!0,o[h].disabled=!0,i[h]&&(i[h].disabled=!0),c[h]&&(c[h].disabled=!0),p[h]&&(p[h].disabled=!0),r[h]&&(r[h].disabled=!0),s[h]&&(s[h].disabled=!0),u[h]&&(u[h].disabled=!0),n[h].parentElement.classList.add("e-disabled"),a[h]&&a[h]!==e&&(a[h].disabled=!0,a[h].children[0].classList.remove("e-unlock"),a[h].children[0].classList.add("e-lock"))):(d[h]&&d[h].classList.remove("e-disable"),n[h].disabled=!1,o[h].disabled=!1,i[h]&&(i[h].disabled=!1),c[h]&&(c[h].disabled=!1),p[h]&&(p[h].disabled=!1),a[h]&&(a[h].disabled=!1),r[h]&&(r[h].disabled=!1),s[h]&&(s[h].disabled=!1),u[h]&&(u[h].disabled=!1),n[h].parentElement.classList.remove("e-disabled"),a[h]&&a[h].children[0].classList.remove("e-lock"),a[h]&&a[h].children[0].classList.add("e-unlock"));this.disableRuleControls(e,t,l)},q.prototype.disableRuleControls=function(e,t,l){for(var n=t.querySelectorAll(".e-control.e-dropdownlist"),o=t.querySelectorAll(".e-control.e-numerictextbox"),r=t.querySelectorAll(".e-control.e-textbox"),i=t.querySelectorAll(".e-control.e-datepicker"),s=t.querySelectorAll(".e-control.e-checkbox"),a=t.querySelectorAll(".e-control.e-radio"),u=t.querySelectorAll(".e-control.e-multiselect"),d=t.querySelectorAll(".e-rule-delete"),c=t.querySelectorAll(".e-lock-rule"),p=t.querySelectorAll(".e-clone-rule"),h=t.querySelectorAll(".e-rule-container"),g=0;g<d.length;g++)l?(h[g]&&h[g].classList.contains("e-disable")&&h[g].classList.add("e-disable"),d[g].disabled=!0,p[g]&&(p[g].disabled=!0),c[g]!==e&&(c[g].disabled=!0,c[g].children[0].classList.remove("e-unlock"),c[g].children[0].classList.add("e-lock"))):(h[g]&&h[g].classList.remove("e-disable"),p[g]&&(p[g].disabled=!1),d[g].disabled=!1,c[g].disabled=!1,c[g].children[0].classList.remove("e-lock"),c[g].children[0].classList.add("e-unlock"));for(g=0;g<n.length;g++)N.getComponent(n[g],"dropdownlist").enabled=!l;for(g=0;g<o.length;g++)N.getComponent(o[g],"numerictextbox").enabled=!l;for(g=0;g<r.length;g++)N.getComponent(r[g],"textbox").enabled=!l;for(g=0;g<i.length;g++)N.getComponent(i[g],"datepicker").enabled=!l;for(g=0;g<s.length;g++)N.getComponent(s[g],"checkbox").disabled=!!l;for(g=0;g<a.length;g++)N.getComponent(a[g],"radio").disabled=!!l;for(g=0;g<u.length;g++)N.getComponent(u[g],"multiselect").enabled=!l},o([N.Event()],q.prototype,"created",void 0),o([N.Event()],q.prototype,"actionBegin",void 0),o([N.Event()],q.prototype,"beforeChange",void 0),o([N.Event()],q.prototype,"change",void 0),o([N.Event()],q.prototype,"dataBound",void 0),o([N.Event()],q.prototype,"ruleChange",void 0),o([N.Event()],q.prototype,"dragStart",void 0),o([N.Event()],q.prototype,"drag",void 0),o([N.Event()],q.prototype,"drop",void 0),o([N.Complex({},C)],q.prototype,"showButtons",void 0),o([N.Property(!1)],q.prototype,"summaryView",void 0),o([N.Property(!1)],q.prototype,"allowValidation",void 0),o([N.Property("Default")],q.prototype,"fieldMode",void 0),o([N.Property([])],q.prototype,"columns",void 0),o([N.Property(null)],q.prototype,"fieldModel",void 0),o([N.Property(null)],q.prototype,"operatorModel",void 0),o([N.Property(null)],q.prototype,"valueModel",void 0),o([N.Property()],q.prototype,"headerTemplate",void 0),o([N.Property("")],q.prototype,"cssClass",void 0),o([N.Property([])],q.prototype,"dataSource",void 0),o([N.Property("Horizontal")],q.prototype,"displayMode",void 0),o([N.Property(!1)],q.prototype,"enablePersistence",void 0),o([N.Property("Default")],q.prototype,"sortDirection",void 0),o([N.Property(5)],q.prototype,"maxGroupCount",void 0),o([N.Property("auto")],q.prototype,"height",void 0),o([N.Property("auto")],q.prototype,"width",void 0),o([N.Property(!1)],q.prototype,"matchCase",void 0),o([N.Property(0)],q.prototype,"immediateModeDelay",void 0),o([N.Property(!1)],q.prototype,"enableNotCondition",void 0),o([N.Property(!1)],q.prototype,"readonly",void 0),o([N.Property(!0)],q.prototype,"addRuleToNewGroups",void 0),o([N.Property(!1)],q.prototype,"autoSelectField",void 0),o([N.Property(!0)],q.prototype,"autoSelectOperator",void 0),o([N.Property("")],q.prototype,"separator",void 0),o([N.Property(!1)],q.prototype,"enableSeparateConnector",void 0),o([N.Complex({condition:"and",rules:[]},u)],q.prototype,"rule",void 0),o([N.Property(!1)],q.prototype,"allowDragAndDrop",void 0);var x,l=o([N.NotifyPropertyChanges],q);function q(e,t){var m=x.call(this,e,t)||this;return m.isReadonly=!0,m.fields={text:"label",value:"field"},m.updatedRule={not:!1,condition:"and",isLocked:!1},m.isLocale=!1,m.isRefreshed=!1,m.isNotified=!1,m.isAddSuccess=!1,m.isNotValueChange=!1,m.isFieldChange=!1,m.isFieldClose=!1,m.isDestroy=!1,m.isGetNestedData=!1,m.isCustomOprCols=[],m.groupCounter=0,m.lockItems=[],m.groupIndex=-1,m.ruleIndex=-1,m.isLastGroup=!1,m.cloneGrpBtnClick=!1,m.isMiddleGroup=!1,m.cloneRuleBtnClick=!1,m.dragStopHandler=function(e){if(!m.isDragEventPrevent){var t,l,n,o=N.closest(e.target,".e-rule-container"),r=(N.isNullOrUndefined(o)&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")&&m.enableSeparateConnector&&(o=N.closest(e.target.parentElement.previousElementSibling,".e-rule-container")),N.closest(e.helper,".e-notallowedcur")),i=(r||(t=N.closest(e.target,".e-group-container"),t={cancel:!1,dropRuleID:null!==o?o.id:null!==t?t.id:null,dropGroupID:null!==t?t.id:null},m.trigger("drop",t),t.cancel&&(r=!0),t=m.getValidRules()),m.prvtEvtTgrDaD=!0,m.enableSeparateConnector&&e.target.parentElement&&e.target.parentElement.classList.contains("e-btn-group")?e.target.parentElement.previousElementSibling:e.target);if(o&&!r){var s=o.id.split(m.element.id+"_")[1].split("_")[0];if(m.draggable.currentStateTarget.parentElement.classList.contains("e-rule-field")||m.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")){var a,u=void 0;m.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(u=m.getGroup(m.draggedRule),m.deleteGroup(N.closest(m.draggedRule,".e-group-container"))):(u=m.getRule(m.draggedRule),m.deleteRule(m.draggedRule)),(a=N.extend([],m.getGroup(o),[],!0)).properties&&(a=a.properties);(d=N.closest(o,".e-group-container")).querySelectorAll(".e-group-container").forEach(function(e){m.element.querySelector("#"+e.id)&&m.deleteGroup(e)});for(var d,c=d.querySelectorAll(".e-rule-container"),p=[],h=void 0,g=0;g<c.length;g++)(c[g].classList.contains("e-drag-rule-top-line")||c[g].classList.contains("e-drag-rule-bottom-line"))&&(h=g),p.push(c[g].id.split(m.element.id+"_")[1]);m.deleteRules(p),o.classList.contains("e-drag-rule-top-line")?a.rules.splice(h,0,u):a.rules.splice(h+1,0,u),a.rules.forEach(function(e){m.enableSeparateConnector?e.rules?m.addGroups([e],s):m.addRules([e],s):e.condition?m.addGroups([e],s):m.addRules([e],s)})}}else i.classList.contains("e-rule-list")&&0===i.children.length&&!r?(n=(d=N.closest(i,".e-group-container")).id.split(m.element.id+"_")[1].split("_")[0],u=void 0,m.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(u=m.getGroup(m.draggedRule),m.deleteGroup(N.closest(m.draggedRule,".e-group-container"))):(u=m.getRule(m.draggedRule),m.deleteRule(m.draggedRule)),m.enableSeparateConnector?u.rules?m.addGroups([u],n):m.addRules([u],n):u.condition?m.addGroups([u],n):m.addRules([u],n)):i.classList.contains("e-rule-list")&&i.children[0].classList.contains("e-group-container")&&!r?(l=(d=N.closest(i,".e-group-container")).id.split(m.element.id+"_")[1].split("_")[0],u=void 0,m.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(u=m.getGroup(m.draggedRule),m.deleteGroup(N.closest(m.draggedRule,".e-group-container"))):(u=m.getRule(m.draggedRule),m.deleteRule(m.draggedRule)),(a=N.extend([],m.getGroup(i),[],!0)).properties&&(a=a.properties),i.querySelectorAll(".e-group-container").forEach(function(e){m.element.querySelector("#"+e.id)&&m.deleteGroup(e)}),(c=d.querySelectorAll(".e-rule-container")).forEach(function(e){m.element.querySelector("#"+e.id)&&m.deleteRule(e)}),m.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?m.addGroups([u],l):m.addRules([u],l),a.rules.forEach(function(e){m.enableSeparateConnector?e.rules?m.addGroups([e],l):m.addRules([e],l):e.condition?m.addGroups([e],l):m.addRules([e],l)})):!N.closest(e.target,".e-group-container")&&!e.target.classList.contains("e-group-container")||r||(u=void 0,"group0"===(n=(o=!(o=N.closest(e.target,".e-group-container"))&&e.target.classList.contains("e-group-container")?e.target:o).id.split(m.element.id+"_")[1].split("_")[0])&&(m.draggable.currentStateTarget.parentElement.classList.contains("e-group-header")?(u=m.getGroup(m.draggedRule),m.deleteGroup(N.closest(m.draggedRule,".e-group-container"))):(u=m.getRule(m.draggedRule),m.deleteRule(m.draggedRule)),m.enableSeparateConnector?u.rules?m.addGroups([u],n):m.addRules([u],n):u.condition?m.addGroups([u],n):m.addRules([u],n)));r||m.trigger("ruleChange",{previousRule:t,rule:m.getValidRules(),type:"drag-and-drop"}),m.prvtEvtTgrDaD=!1,document.body.classList.remove("e-prevent-select");i=m.element.querySelectorAll(".e-drag-rule-bottom-line");i.forEach(function(e){e.classList.remove("e-drag-rule-bottom-line")}),(i=m.element.querySelectorAll(".e-drag-rule-top-line")).forEach(function(e){e.classList.remove("e-drag-rule-top-line")}),(i=m.element.querySelectorAll(".e-qb-dragging-rule")).forEach(function(e){e.classList.remove("e-qb-dragging-rule")}),e.helper.classList.contains("e-cloneproperties")&&document.querySelector("."+e.helper.classList[0])&&N.remove(e.helper),m.enableSeparateConnector&&m.refresh()}},y.MultiSelect.Inject(y.CheckBoxSelection),m}E.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},E.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("query-library",this.queryLibrary,this),this.parent.on("destroyed",this.destroy,this))},E.prototype.removeEventListener=function(){this.parent.off("query-library",this.queryLibrary),this.parent.off("destroyed",this.destroy)},E.prototype.queryLibrary=function(e){switch(e.prop){case"getMongoFromRules":e.value.obj.mongoQuery=this.getMongoFromRules(e.value.rule,e.value.mongoQuery);break;case"mongoParser":this.mongoParser(e.value.mongoQuery,e.value.rule,e.value.mongoLocale);break;case"getParameterSql":e.value.obj.sql=this.getParameterSql(e.value.rule);break;case"getNamedParameterSql":e.value.obj.sql=this.getNamedParameterSql(e.value.rule);break;case"convertParamSqlToSql":e.value.obj.sql=this.convertParamSqlToSql(e.value.sql);break;case"convertNamedParamSqlToSql":e.value.obj.sql=this.convertNamedParamSqlToSql(e.value.sql)}},E.prototype.getMongoFromRules=function(e,t){return t="{",t="or"===e.condition?this.convertMongoQuery(e.rules,t+='"$or":[')+"]":this.convertMongoQuery(e.rules,t+='"$and":[')+"]",t+="}"},E.prototype.getOperatorFromMongoOperator=function(e){var t;switch(e){case"$ne":t="notequal";break;case"$gt":t="greaterthan";break;case"$gte":t="greaterthanorequal";break;case"$lt":t="lessthan";break;case"$lte":t="lessthanorequal";break;case"$nin":t="notin"}return t},E.prototype.convertMongoQuery=function(o,r){var i=this,s=0;return o.forEach(function(l){s++,r+="{",void 0!==l.rules&&(r=("or"===l.condition?r+=' "$or":[':r+=' "$and":[',i.convertMongoQuery(l.rules,r)+"]"));var e,t="string"===l.type&&"in"!==l.operator&&"notin"!==l.operator&&l.value&&""!==l.value.trim()?l.value.replace(/'/g,"\\"):"",n=("string"!==l.type||"in"!==l.operator&&"notin"!==l.operator||!l.value||1!==l.value.length||(t=l.value[0].replace(/'/g,"\\")),l.field?l.field.substring(0):"");switch(l.operator){case"contains":r+='"'+n+'":{"$regex":"'+t+'"}';break;case"notcontains":r+='"'+n+'":{"$not":{"$regex":"'+l.value+'"}}';break;case"startswith":r+='"'+n+'":{"$regex":"^'+t+'"}';break;case"notstartswith":r+='"'+n+'":{"$not":{"$regex":"^'+l.value+'"}}';break;case"endswith":r+='"'+n+'":{"$regex":"'+t+'$"}';break;case"notendswith":r+='"'+n+'":{"$not":{"$regex":"'+l.value+'$"}}';break;case"isnull":r+='"'+n+'": null';break;case"isnotnull":r+='"'+n+'":{"$ne": null}';break;case"isempty":r+='"'+n+'": ""';break;case"isnotempty":r+='"'+n+'":{"$ne": ""}';break;case"equal":"string"===l.type?r+='"'+n+'":"'+t+'"':"date"===l.type?r+='"'+n+'":"'+l.value+'"':(l.type,r+='"'+n+'":'+l.value);break;case"notequal":"string"===l.type?r+='"'+n+'":{"$ne":"'+t+'"}':"date"===l.type?r+='"'+n+'":{"$ne":"'+l.value+'"}':r+='"'+n+'":{"$ne":'+l.value+"}";break;case"in":"string"===l.type?1<l.value.length?(e=(e=l.value.map(function(e,t){return t<l.value.length?'"'+e+'"':""}).toString()).endsWith(",")?e.substring(0,e.length-1):e,r+='"'+n+'": { "$in": ['+e+"]}"):r+='"'+n+'": { "$in": ["'+t+'"]}':"number"===l.type&&(1<l.value.length?r+='"'+n+'": { "$in": ['+l.value.toString()+"]}":r+='"'+n+'": { "$in": ['+l.value+"]}");break;case"notin":"string"===l.type?1<l.value.length?(e=(e=l.value.map(function(e,t){return t<l.value.length?'"'+e+'"':""}).toString()).endsWith(",")?e.substring(0,e.length-1):e,r+='"'+n+'": { "$nin": ['+e+"]}"):r+='"'+n+'": { "$nin": ["'+t+'"]}':"number"===l.type&&(1<l.value.length?r+='"'+n+'": { "$nin": ['+l.value.toString()+"]}":r+='"'+n+'": { "$nin": ['+l.value+"]}");break;case"greaterthan":"number"===l.type?r+='"'+n+'": { "$gt": '+l.value+"}":r+='"'+n+'": { "$gt": "'+l.value+'"}';break;case"greaterthanorequal":"number"===l.type?r+='"'+n+'": { "$gte": '+l.value+"}":r+='"'+n+'": { "$gte": "'+l.value+'"}';break;case"between":"number"===l.type?r+='"'+n+'": {"$gte":'+l.value[0]+', "$lte":'+l.value[1]+"}":r+='"'+n+'": {"$gte": "'+l.value[0]+'", "$lte": "'+l.value[1]+'"}';break;case"notbetween":"number"===l.type?r+='"$or":[{"'+n+'": {"$lt":'+l.value[0]+'}}, {"'+n+'": {"$gt":'+l.value[1]+"}}]":r+='"$or":[{"'+n+'": {"$lt": "'+l.value[0]+'"}}, {"'+n+'": {"$gt": "'+l.value[1]+'"}}]';break;case"lessthan":"number"===l.type?r+='"'+n+'": { "$lt": '+l.value+"}":r+='"'+n+'": { "$lt": "'+l.value+'"}';break;case"lessthanorequal":"number"===l.type?r+='"'+n+'": { "$lte": '+l.value+"}":r+='"'+n+'": { "$lte": "'+l.value+'"}'}r+="}",o.length!==s&&(r+=",")}),r},E.prototype.mongoParser=function(e,t,l){var n;-1<Object.keys(e).indexOf("$and")?(n=e.$and,t.condition="and"):-1<Object.keys(e).indexOf("$or")&&(n=e.$or,t.condition="or"),t.rules=[],this.mongoRecursion(n,t.rules,l)},E.prototype.mongoRecursion=function(e,t,l){for(var n,o,r,i,s,a,u,d,c=0,p=e.length;c<p;c++){var h=[],g=[],m=Object.keys(e[c])[0],f=e[c][m];if("$and"===m)a=this.parent.enableNotCondition?{condition:m.replace("$",""),rules:[],not:!1}:{condition:m.replace("$",""),rules:[]},t.push(a),this.mongoRecursion(e[c][m],t[t.length-1].rules,l);else if("$or"===m){var y,v,b,C,S,x=void 0;Array.isArray(f)&&2===f.length&&(C=f[(S=Object.keys(f))[0]],S=f[S[1]],"object"==typeof C)&&(y=Object.keys(C)[0],b=Object.keys(C[Object.keys(C)[0]])[0],v=Object.keys(S[Object.keys(S)[0]])[0],"$lt"===b)&&"$gt"===v&&(C=C[y][b],b=S[y][v],t.push(u={field:y,label:y,value:d=[C,b],operator:n="notbetween",type:o="number"==typeof C?"number":"date"}),x=!0),x||(a=this.parent.enableNotCondition?{condition:m.replace("$",""),rules:[],not:!1}:{condition:m.replace("$",""),rules:[]},t.push(a),this.mongoRecursion(e[c][m],t[t.length-1].rules,l))}else{if(null===(f=e[c][m])&&(n="isnull"),"boolean"==typeof f&&(n="equal",o="boolean",d=f),"number"==typeof f)d=f,o="number",n="equal";else if("object"==typeof f&&null!==f)for(var q=Object.keys(f),E=0;E<q.length;E++)i=q[E],r=f[q[E]],"$ne"===i&&N.isNullOrUndefined(r)&&(n="isnotnull",d=null),"$ne"===i&&"boolean"==typeof r&&(n="notequal",d=r,o="boolean"),2<=q.length&&q[E]?("object"==typeof r?(n="notbetween",m=Object.keys(r)[0],s=[Object.keys(r[m])[0]],h.push(r[m][s]),o="number"):(n="between",h.push(r)),"number"==typeof r&&(o="number")):"object"==typeof r&&null!==r?"$not"===i&&"$regex"===Object.keys(r)[0]?d=-1<r.$regex.indexOf("^")?(n="notstartswith",r.$regex.replace("^","")):-1<r.$regex.indexOf("$")?(n="notendswith",r.$regex.replace("$","")):(n="notcontains",r.$regex):(n="$in"===i?"in":"notin",o="number"==typeof(g=r)[0]?"number":"string"):"number"==typeof r&&(n=this.getOperatorFromMongoOperator(i),o="number",d=r),"string"==typeof r&&("$regex"===i&&(n="contains",d=r,o="string"),"$ne"===i&&(null!==r&&0<r.length&&isNaN(Date.parse(r))?(n="notequal",d=r):N.isNullOrUndefined(r)?(n="isnotnull",d=r):""===r&&(n="isnotempty",d=r),o="string"),-1<r.indexOf("^")&&(n="startswith",d=r.replace("^",""),o="string"),-1<r.indexOf("$")&&"$not"!==i&&(n="endswith",d=r.replace("$",""),o="string"),isNaN(Date.parse(r))||(n=n||this.getOperatorFromMongoOperator(i),o="date",d=r));else f&&"string"==typeof f&&!isNaN(Date.parse(f))?(n="equal",d=f,o="date"):"string"==typeof f&&""!==f&&"true"!==f&&"false"!==f?(n="equal",d=f,o="string"):"string"==typeof f&&""===f&&(n="isempty",d=f,o="string");u=h&&1<h.length?{field:m,label:m,value:h,operator:n,type:o}:g&&1<g.length?{field:m,label:m,value:g,operator:n,type:o}:{field:m,label:m,value:d,operator:n,type:o},t.push(u),n=""}}},E.prototype.convertParamSqlToSql=function(e){for(var t=e.sql,l=e.params,n=t.split("?"),o=n[0],r=0;r<l.length;r++)o+="string"==typeof l[r]?"'"+l[r]+"'"+n[r+1]:l[r]+n[r+1];return o=(o=2<=o.length&&"("===o[0]&&")"===o[o.length-1]?o.slice(1,-1):o).replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},E.prototype.convertNamedParamSqlToSql=function(e){var t=e.sql,l=e.params,n=t;return Object.keys(l).forEach(function(e){var t=l[e];n=n.replace(e=":"+e,"string"==typeof t?"'"+t+"'":String(t))}),n=(n=2<=n.length&&"("===n[0]&&")"===n[n.length-1]?n.slice(1,-1):n).replace(/!= ''(?! =)/g,"IS NOT EMPTY").replace(/= ''/g,"IS EMPTY")},E.prototype.getParameterSql=function(e){var e=N.extend({},e,null,!0),t=this.updateRuleValue(e,!1);return this.getParameterSQLVal(this.parent.getSqlFromRules(e),t.ruleVal)},E.prototype.getNamedParameterSql=function(e){var e=N.extend({},e,null,!0),t=this.updateRuleValue(e,!0);return this.getNamedParameterSQLVal(this.parent.getSqlFromRules(e),t.namedRuleVal)},E.prototype.getParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},E.prototype.getNamedParameterSQLVal=function(e,t){return{sql:"("+e.replace(/[%']/g,"")+")",params:t}},E.prototype.updateRuleValue=function(e,t){return this.updateValue(e.rules,t,[],{},[])},E.prototype.updateValue=function(e,t,l,n,o){if(!N.isNullOrUndefined(e))for(var r=0;r<e.length;r++)if(e[r].rules)l=(a=this.updateValue(e[r].rules,t,l,n,o)).ruleVal,n=a.namedRuleVal;else{var i=void 0;if(e[r].value instanceof Array)for(var s=0;s<e[r].value.length;s++)t&&(i=this.getNamedParameter(e[r].field,o)),N.isNullOrUndefined(e[r].value[s])||("string"!==e[r].type&&e[r].type,t?n[i]=e[r].value[s]:l.push(e[r].value[s])),e[r].value[s]=t?":"+i:"?";else if(t&&(i=this.getNamedParameter(e[r].field,o)),e[r].operator.indexOf("null")<1&&("string"!==e[r].type||"string"===e[r].type&&(""!==e[r].value||0===e[r].value))){if("string"===e[r].type||"date"===e[r].type)if(e[r].operator.indexOf("empty")<1){var a=e[r].value.toString();switch(e[r].operator){case"startswith":case"notstartswith":a+="%";break;case"endswith":case"notendswith":a="%"+a;break;case"contains":case"notcontains":a="%"+a+"%"}t?n[i]=a:l.push(a)}else t?n[i]="":l.push(""),"isempty"===e[r].operator?e[r].operator="equal":e[r].operator="notequal";else N.isNullOrUndefined(e[r].value)||(t?n[i]=e[r].value:l.push(e[r].value));e[r].value=t?":"+i:"?"}}return{ruleVal:l,namedRuleVal:n}},E.prototype.getNamedParameter=function(e,t){var l=null;if(0<t.length)for(var n=t.length-1;0<=n;n--){var o=t[n];if(-1<o.indexOf(e)){l=e+"_"+(parseInt(o.split("_")[1],10)+1);t.push(l);break}}return l||t.push(l=e+"_1"),l},E.prototype.getModuleName=function(){return"query-library"};o=E;function E(e){this.parent=e,this.addEventListener()}e.Columns=r,e.QueryBuilder=l,e.QueryLibrary=o,e.Rule=u,e.ShowButtons=C,e.Value=g,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
11
11
|
//# sourceMappingURL=ej2-querybuilder.umd.min.js.map
|