@syncfusion/ej2-querybuilder
Version:
Essential JS 2 QueryBuilder
10 lines • 172 kB
JavaScript
/*!
* filename: ej2-querybuilder.umd.min.js
* version : 31.2.4
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!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,L,N,c,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,i=arguments.length,r=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(r=(i<3?o(r):3<i?o(t,l,r):o(t,l))||r);return 3<i&&r&&Object.defineProperty(t,l,r),r},i=(t=L.ChildProperty,l(r,t),o([L.Property(null)],r.prototype,"field",void 0),o([L.Property(null)],r.prototype,"label",void 0),o([L.Property(null)],r.prototype,"type",void 0),o([L.Property(null)],r.prototype,"values",void 0),o([L.Property(null)],r.prototype,"operators",void 0),o([L.Property()],r.prototype,"ruleTemplate",void 0),o([L.Property(null)],r.prototype,"template",void 0),o([L.Property({isRequired:!0,min:0,max:Number.MAX_VALUE})],r.prototype,"validation",void 0),o([L.Property(null)],r.prototype,"format",void 0),o([L.Property(null)],r.prototype,"step",void 0),o([L.Property(null)],r.prototype,"value",void 0),o([L.Property(null)],r.prototype,"category",void 0),o([L.Property(null)],r.prototype,"columns",void 0),r);function r(){return null!==t&&t.apply(this,arguments)||this}a=L.ChildProperty,l(d,a),o([L.Property(null)],d.prototype,"condition",void 0),o([L.Collection([],d)],d.prototype,"rules",void 0),o([L.Property(null)],d.prototype,"field",void 0),o([L.Property(null)],d.prototype,"label",void 0),o([L.Property(null)],d.prototype,"type",void 0),o([L.Property(null)],d.prototype,"operator",void 0),o([L.Property(null)],d.prototype,"value",void 0),o([L.Property(!1)],d.prototype,"not",void 0),o([L.Property(null)],d.prototype,"isLocked",void 0);var a,u=d;function d(){return null!==a&&a.apply(this,arguments)||this}m=L.ChildProperty,l(f,m),o([L.Property(null)],f.prototype,"numericTextBoxModel",void 0),o([L.Property(null)],f.prototype,"multiSelectModel",void 0),o([L.Property(null)],f.prototype,"datePickerModel",void 0),o([L.Property(null)],f.prototype,"textBoxModel",void 0),o([L.Property(null)],f.prototype,"radioButtonModel",void 0);var m,g=f;function f(){return null!==m&&m.apply(this,arguments)||this}y=L.ChildProperty,l(S,y),o([L.Property(!1)],S.prototype,"cloneRule",void 0),o([L.Property(!1)],S.prototype,"cloneGroup",void 0),o([L.Property(!1)],S.prototype,"lockRule",void 0),o([L.Property(!1)],S.prototype,"lockGroup",void 0),o([L.Property(!0)],S.prototype,"ruleDelete",void 0),o([L.Property(!0)],S.prototype,"groupInsert",void 0),o([L.Property(!0)],S.prototype,"groupDelete",void 0);var y,C=S;function S(){return null!==y&&y.apply(this,arguments)||this}E=L.Component,l(x,E),x.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},x.prototype.reset=function(){this.isImportRules=!1;var e,t,l,n,o=this.element.querySelector(".e-group-body"),i=this.element.querySelectorAll("input.e-control"),r=20,s=0,a=function(){for(var e=Math.min(s+r,i.length),t=s;t<e;t++){var l,n=i[t];try{-1<n.className.indexOf("e-tooltip")?(l=L.getComponent(n,"tooltip"))&&l.destroy():n.parentElement&&-1<n.parentElement.className.indexOf("e-tooltip")&&(l=L.getComponent(n.parentElement,"tooltip"))&&l.destroy()}catch(e){console.warn("Error destroying tooltip:",e)}}(s=e)<i.length&&requestAnimationFrame(a)};if(0<i.length&&a(),o?o.textContent="":(e=document.createDocumentFragment(),t=this.createElement("div",{attrs:{class:"e-group-container"}}),l=this.createElement("div",{attrs:{class:"e-group-header"}}),n=this.createElement("div",{attrs:{class:"e-group-body"}}),t.appendChild(l),t.appendChild(n),e.appendChild(t),this.element.appendChild(e),o=this.element.querySelector(".e-group-body")),this.headerTemplate&&this.isRoot&&(this.element.textContent="",this.isRoot=!1),this.enableNotCondition)for(var u=this.element.querySelectorAll(".e-qb-toggle"),d=0;d<u.length;d++)L.removeClass([u[d]],"e-active-toggle");o&&o.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),o&&o.parentElement&&this.disableRuleCondition(o.parentElement)},x.prototype.getWrapper=function(){return this.element},x.prototype.getModuleName=function(){return"query-builder"},x.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},x.prototype.GetRootColumnName=function(e){return L.isNullOrUndefined(e)?"":this.separator?e.split(this.separator)[0]:e},x.prototype.initialize=function(){var t=this;if(this.dataColl.length){var l,n,o=Object.keys(this.dataColl[0]),e=[],i=[],r=!1,s=!1,a={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length)this.columnSort(),this.columns.forEach(function(e){t.updateCustomOperator(e,"initial"),e.type||(-1<o.indexOf(e.field)&&(n=t.dataColl[0][e.field],"string"===(l=typeof n)?s=!isNaN(Date.parse(n)):"object"===l&&(s=n instanceof Date&&!isNaN(n.getTime()),l="string"),e.type=l,s=!1),l="string"),e.validation||(e.validation=a),e.category?r=!0:e.category=t.l10n.getConstant("OtherFields"),i.indexOf(e.category)<0&&i.push(e.category),(!e.operators||t.isLocale&&-1===t.isCustomOprCols.indexOf(e.field))&&(e.operators=t.customOperators[e.type+"Operator"])}),r&&(1<i.length||i[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns);else{for(var u=0,d=o.length;u<d;u++)n=this.dataColl[0][o[u]],"string"===(l=typeof n)?s=!isNaN(Date.parse(n)):"object"!==l||Object.keys(n).length||(s=n instanceof Date&&!isNaN(n.getTime()),l="string"),e[u]={field:o[u],label:o[u],type:s?"date":l,validation:a},s=!1,e[u].operators=this.customOperators[e[u].type+"Operator"],"object"===l&&this.updateSubFields(n,e[u]);this.columns=e}}else this.columns&&this.columns.length&&("Default"!==this.sortDirection&&this.columnSort(),this.processColumnsInBatches(),50<this.columns.length?setTimeout(function(){t.updateSubFieldsFromColumns(t.columns)},0):this.updateSubFieldsFromColumns(this.columns));this.trigger("dataBound",{type:"dataBound"})},x.prototype.processColumnsInBatches=function(){function l(){for(var e=Math.min(i+10,o.length),t=i;t<e;t++)o[t].category&&o[t].category!==n.l10n.getConstant("OtherFields")?n.fields={text:"label",value:"field",groupBy:"category"}:o[t].category=n.l10n.getConstant("OtherFields"),n.updateCustomOperator(o[t],"initial"),(!o[t].operators||n.isLocale&&-1===n.isCustomOprCols.indexOf(o[t].field))&&(o[t].operators=n.customOperators[o[t].type+"Operator"]);(i=e)<o.length&&requestAnimationFrame(l)}var n=this,o=this.columns,i=0;l()},x.prototype.updateSubFieldsFromColumns=function(e,t){if(50<e.length)this.updateSubFieldsLarge(e,t);else 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))},x.prototype.updateSubFieldsLarge=function(t,l){function n(){for(var e=Math.min(i+10,r);i<e;i++)""!==o.separator&&t[i].field.indexOf(o.separator)<0&&(t[i].field=l?l+o.separator+t[i].field:t[i].field),t[i].operators?o.updateCustomOperator(t[i]):t[i].type&&"object"!==t[i].type&&(t[i].operators=o.customOperators[t[i].type+"Operator"]);i<r?requestAnimationFrame(n):setTimeout(function(){for(var e=0;e<r;e++)t[e].columns&&(t[e].type="object",o.updateSubFieldsFromColumns(t[e].columns,t[e].field))},0)}var o=this,i=0,r=t.length;n()},x.prototype.updateSubFields=function(e,t,l){t.columns=[];var n=Object.keys(e);l=l||this.dataColl[0];for(var o=0,i=n.length;o<i;o++){var r,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:r="object"!=(r=typeof s)||isNaN(Date.parse(s))?r:"date"};"object"!=r&&(u.operators=this.customOperators[r+"Operator"]),t.columns.push(u),"object"==r&&this.updateSubFields(s,u,a)}},x.prototype.updateCustomOperator=function(o,e){if(o.operators){this.isLocale||"initial"!==e||L.isNullOrUndefined(this.isCustomOprCols)||this.isCustomOprCols.push(o.field);for(var i=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"),i.operators[l[e]]=l[n])}(t)}},x.prototype.focusEventHandler=function(e){this.target=e.target},x.prototype.clickEventHandler=function(e){var t,l,n,o,i=this,r=e.target;if(this.isImportRules=!1,"string"==typeof(r="SPAN"===r.tagName?r.parentElement:r).className&&-1<r.className.indexOf("e-collapse-rule")&&(u=new L.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"===r.tagName&&"string"==typeof r.className&&r.className.indexOf("e-qb-toggle")<0){var s,a,u=new L.Animation({duration:1e3,delay:0});switch(!0){case-1<r.className.indexOf("e-removerule"):this.actionButton=r,this.deleteRule(r);break;case-1<r.className.indexOf("e-clone-rule-btn"):this.actionButton=r,this.cloneRuleBtnClick=!0,this.isRuleClicked=!0,this.ruleClone(r);break;case-1<r.className.indexOf("e-lock-rule-btn"):this.actionButton=r,this.ruleLock(r);break;case-1<r.className.indexOf("e-lock-grp-btn"):this.actionButton=r,this.groupLock(r);break;case-1<r.className.indexOf("e-clone-grp-btn"):this.actionButton=r,this.cloneGrpBtnClick=!0,this.isRuleClicked=!0,this.groupClone(L.closest(r,".e-group-container"));break;case-1<r.className.indexOf("e-deletegroup"):this.actionButton=r,this.deleteGroup(L.closest(r,".e-group-container"));break;case-1<r.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=L.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"===r.tagName&&-1<r.parentElement.className.indexOf("e-btn-group")||"string"==typeof r.className&&-1<r.className.indexOf("e-qb-toggle"))&&(e=L.closest(r,".e-group-container"),this.headerTemplate||(o=void 0,(t=r.getAttribute("for"))?o=document.getElementById(t).getAttribute("value"):this.enableSeparateConnector&&(o=r.classList.contains("e-btngroup-or-lbl")?"or":r.classList.contains("e-btngroup-and-lbl")?"and":r.textContent),t=e.id.replace(this.element.id+"_",""),l=this.getGroup(t),n=void 0,this.enableNotCondition&&(-1<r.className.indexOf("e-qb-toggle")?(n=-1<(e=e.getElementsByClassName("e-qb-toggle")[0]).className.indexOf("e-active-toggle")?(L.removeClass([e],"e-active-toggle"),!1):(L.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,r):this.trigger("beforeChange",l,function(e){i.beforeSuccessCallBack(e,r)}),this.target=r)},x.prototype.beforeSuccessCallBack=function(e,t){var l,n,o,i,r;e&&!e.cancel&&(l=(i=L.closest(t,".e-group-container")).id.replace(this.element.id+"_",""),n=this.getValidRules(this.rule),o=this.getParentGroup(i),this.enableSeparateConnector?(r=(i=L.isNullOrUndefined(L.closest(t,".e-rule-container"))&&i.classList.contains("e-group-container")?null!==t.parentElement.previousElementSibling?t.parentElement.previousElementSibling:i:L.closest(t,".e-rule-container")).id.replace(this.element.id+"_",""),i.classList.contains("e-rule-container")?(o=this.getRule(i)).condition=e.value:i.classList.contains("e-group-container")&&((o=this.getGroup(i)).condition=e.value),this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:l,ruleID:r,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)&&(i=t.parentElement.querySelector(".e-btngroup-and"),r=t.parentElement.querySelector(".e-btngroup-or"),i)&&r&&("and"===e.value?(i.checked=!0,r.checked=!1):"or"===e.value&&(r.checked=!0,i.checked=!1))},x.prototype.selectBtn=function(e,t){"beforeOpen"===t.name?this.showButtons.groupInsert||L.isNullOrUndefined(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?L.addClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):L.removeClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&L.addClass([t.element.querySelector("li").parentElement],"e-rtl")):L.addClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):-1<t.element.children[0].className.indexOf("e-addrule")?(this.isRuleClicked=!0,this.addRuleElement(L.closest(e,".e-group-container"),{})):-1<t.element.children[0].className.indexOf("e-addgroup")&&(this.isRuleClicked=!0,this.addGroupElement(!0,L.closest(e,".e-group-container"),"",!0))},x.prototype.appendRuleElem=function(e,t,l,n,o,i){var r,s,a=e&&e.querySelector(".e-rule-list");if("change"===l)r=L.select("#"+n,e);else{if((r=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(r);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(r,a.children[this.ruleIndex+u+1])}else a.insertBefore(r,a.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else a.appendChild(r);this.ruleIdCounter++}return t&&t.ruleTemplate&&i?(l={requestType:"template-initialize",ruleID:r.id,action:o,fields:this.fields,rule:i},this.trigger("actionBegin",l),this.ruleTemplateFn=this.templateParser(t.ruleTemplate),n=this.element.id+t.field,l.fields=this.fields,l.columns=this.columns,""===i.field&&(i.field=t.field),l.operators=this.getOperators(i.field),l.operatorFields={text:"key",value:"value"},this.isReact?((s=this.ruleTemplateFn(l,this,r.id,n)[0]).className+=" e-rule-field",r.appendChild(s)):this.isAngular?((s=3===(e=this.ruleTemplateFn(l,this,r.id,n))[0].nodeType?e[1]:e[0]).className+=" e-rule-field",r.appendChild(s)):this.isVue3?(s=this.ruleTemplateFn(l,this,"Template",n),L.append(s,r),r.children.length&&(r.children[r.children.length-1].className+=" e-rule-field")):((s=this.ruleTemplateFn(l,this,"Template",n)[0]).className+=" e-rule-field",r.appendChild(s))):(s=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),r.appendChild(s)),this.showButtons.lockGroup&&L.removeClass(r.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&L.removeClass(r.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&L.removeClass(r.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&L.removeClass(r.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&L.removeClass(r.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&L.removeClass(r.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),t&&t.ruleTemplate&&i&&this.renderReactTemplates(),r},x.prototype.addRuleElement=function(t,l,n,o,i,r){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,i,r)):this.trigger("beforeChange",e,function(e){s.addRuleSuccessCallBack(e,t,l,n,o,i,r)}))},x.prototype.addRuleSuccessCallBack=function(e,t,l,n,o,i,r){var s,a,u,d=this,c=-1<this.element.className.indexOf("e-device")||"Vertical"===this.displayMode,p=c?"250px":"200px",n=l&&l.field?this.getColumn(l.field):n||this.columns[0],h={label:"",field:"",type:"",operator:""};e.cancel||(n&&n.ruleTemplate&&l.field?(this.selectedColumn=n,e=this.selectedColumn.operators,h={label:n.label,field:n.field,type:n.type,operator:e[0].value},a=Object.keys(l).length?l:h,e={requestType:"template-initialize",ruleID:(u=this.appendRuleElem(t,n,o,i,"field",a)).id,action:"insert-rule",fields:this.fields,rule:a},this.trigger("actionBegin",e),setTimeout(function(){var e={requestType:"template-create",ruleID:u.id,action:"insert-rule",fields:d.fields,rule:a};d.trigger("actionBegin",e)},0)):((u=this.appendRuleElem(t,n,o,i,"field")).querySelector(".e-filter-input").setAttribute("id",u.id+"_filterkey"),e=u.querySelector(".e-rule-delete"),-1<this.element.className.indexOf("e-device")||"Vertical"===this.displayMode?(e.textContent=this.l10n.getConstant("Remove"),L.addClass([e],"e-flat"),L.addClass([e],"e-primary")):(L.addClass([e],"e-round"),L.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"}}),e.appendChild(o)),this.showButtons.ruleDelete||e.classList.add("e-button-hide")),u.className="e-rule-container "+(c?"e-vertical-mode":"e-horizontal-mode"),o=u.previousElementSibling,this.processAdjacentElements(u,o,l),this.isImportRules||this.updateAddedRule(t,l,h,r,i,!!this.enableSeparateConnector||null),""===this.rule.condition&&(this.isRuleClicked||1<this.rule.rules.length)&&(this.rule.condition="and"),this.isRuleClicked=!1,e=this.rule.rules.length,n&&n.ruleTemplate&&l.field||(20<e?setTimeout(function(){d.applyFieldComponent(u,l,p)},0):this.applyFieldComponent(u,l,p)),s=u.id.replace(this.element.id+"_",""),l&&l.isLocked&&(c=u.querySelector(".e-lock-rule-btn"),this.ruleLock(c)),this.isImportRules)||this.prvtEvtTgrDaD||this.trigger("change",{groupID:t.id.replace(this.element.id+"_",""),ruleID:s,type:"insertRule"}),this.enableSeparateConnector&&L.isNullOrUndefined(l.condition)&&s&&(l=this.getRule(s)),this.enableSeparateConnector&&this.processConnectorElements(u)},x.prototype.processAdjacentElements=function(e,t,l){var n;this.enableSeparateConnector?(t=t&&t.classList.contains("e-group-container")?(n=t.querySelectorAll(".e-rule-container"))[n.length-1]:t)&&t.classList.contains("e-rule-container")?(n=this.getRule(t),this.headerTemplate&&this.headerTemplateFn(t,!1,n.condition,n,t.id)):L.isNullOrUndefined(t)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedRuleElement(e,l):t&&-1<t.className.indexOf("e-rule-container")&&(e.classList.add("e-joined-rule"),t.classList.add("e-prev-joined-rule")),t&&-1<t.className.indexOf("e-group-container")&&e.className.indexOf("e-separate-rule")<0&&(e.className+=" e-separate-rule")},x.prototype.handleOrphanedRuleElement=function(e,t){var l,n=e.closest(".e-group-container");n&&n.previousElementSibling?(l=(n=n.previousElementSibling).querySelectorAll(".e-rule-container"),(n=n.classList.contains("e-group-container")?l[l.length-1]:n).classList.contains("e-rule-container")&&(l=this.getRule(n),this.headerTemplateFn(n,!1,l.condition,l,n.id,!0))):this.headerTemplateFn(e,!1,t.condition,t,e.id,!0)},x.prototype.processConnectorElements=function(e){for(var t,l,n=e.previousElementSibling;n&&!n.classList.contains("e-rule-container");){if(n.classList.contains("e-group-container")){n=(t=n.querySelectorAll(".e-rule-container"))[t.length-1];break}n=n.previousElementSibling}this.headerTemplate&&n?(l=this.getRule(n),l={requestType:"rule-template-create",ruleID:n.id,condition:l.condition,notCondition:!!this.enableNotCondition||void 0},this.trigger("actionBegin",l)):L.isNullOrUndefined(n)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedConnectorElement(e),this.setMultiConnector(e)},x.prototype.handleOrphanedConnectorElement=function(e){var t,e=e.closest(".e-group-container");e&&e.previousElementSibling&&e.previousElementSibling.previousElementSibling&&(e=(e=e.previousElementSibling.previousElementSibling).classList.contains("e-group-container")?(t=e.querySelectorAll(".e-rule-container"))[t.length-1]:e).classList.contains("e-rule-container")&&(t=this.getRule(e),e={requestType:"rule-template-create",ruleID:e.id,condition:t.condition,notCondition:!!this.enableNotCondition||void 0},this.trigger("actionBegin",e))},x.prototype.applyFieldComponent=function(e,t,l){"Default"===this.fieldMode?this.applyDropdownListComponent(e,t,l):this.applyDropdownTreeComponent(e,t,l)},x.prototype.applyDropdownListComponent=function(e,t,l){var n=this.separator&&t.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(t.field):t.field,l={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:5<this.columns.length?l:"auto",close:this.fieldClose.bind(this,e.id+"_filterkey"),change:this.changeField.bind(this),value:t?n:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},n=(this.fieldModel&&(l=b({},l,this.fieldModel)),new c.DropDownList(l));n.appendTo("#"+e.id+"_filterkey"),l=this.separator&&t.field||this.isImportRules?this.GetRootColumnName(t.field):n.value,this.selectedColumn=n.getDataByValue(l),Object.keys(t).length&&this.changeRule(t,{element:n.element,itemData:this.selectedColumn})},x.prototype.applyDropdownTreeComponent=function(e,t,l){this.isImportRules;var n=t.field,n=(this.dummyDropdownTreeDs=L.extend([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),l={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?l:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:L.isNullOrUndefined(n)?null:[n],open:this.popupOpen.bind(this,!1),treeSettings:{expandOn:"Click"},cssClass:"e-qb-ddt",filtering:this.dropdownTreeFiltering.bind(this),close:this.dropdownTreeClose.bind(this)},this.fieldModel&&(l=b({},l,this.fieldModel)),new c.DropDownTree(l)),e=(n.appendTo("#"+e.id+"_filterkey"),L.isNullOrUndefined(n.value)||(l=this.getLabelFromColumn(n.value[0]),n.element.value=l),L.isNullOrUndefined(t.field)?n.value:this.GetRootColumnName(t.field));this.selectedColumn=this.getColumn(e),Object.keys(t).length&&this.changeRule(t,{element:n.element,itemData:this.selectedColumn})},x.prototype.dropdownTreeFiltering=function(t){var l=this,e=this,n=t.event.srcElement,n=(n.classList.contains("e-clear-icon")?n.parentElement.querySelector(".e-textbox"):n).id.split("_filterkey")[0],n=document.getElementById(n),n=(this.ddTree=L.getComponent(n.querySelector("input.e-dropdowntree"),"dropdowntree"),L.extend([],this.columns,[],!0));t.cancel=!0,""===t.text?this.changeDataSource(n):(n=n.map(function(e){return l.nestedChildFilter(t.text,e)}).filter(function(e){return null!==e}),this.changeDataSource(n),setTimeout(function(){L.isNullOrUndefined(e.ddTree)||L.isNullOrUndefined(e.ddTree.treeObj)||e.ddTree.treeObj.expandAll()},100))},x.prototype.changeDataSource=function(e){this.updateDropdowntreeDS(e),this.ddTree.treeObj.fields={dataSource:e,value:"field",text:"label",child:"columns",expanded:"expanded"},this.ddTree.treeObj.refresh()},x.prototype.nestedChildFilter=function(t,e){var l,n=this,o=e[this.ddTree.fields.child];return o?(l=o.map(function(e){return n.nestedChildFilter(t,e)}).filter(function(e){return null!==e})).length?(e[this.ddTree.fields.child]=l,e):(e[this.ddTree.fields.child]=o,this.isMatchedNode(t,e)?e:null):this.isMatchedNode(t,e)?e:null},x.prototype.isMatchedNode=function(e,t){t=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==t.indexOf(e)},x.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource(L.extend([],this.columns,[],!0)),this.ddTree=null},x.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},x.prototype.updateAddedRule=function(e,t,l,n,o,i){var r=0;if(n){for(s=L.select("#"+o,e),u=L.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||r++}d.rules[r]=t}else{var u=L.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,i)},x.prototype.changeRuleTemplate=function(e,t){var l,n,o;e&&e.ruleTemplate||(l=L.closest(t,".e-group-container"),n=L.closest(t,".e-rule-container").id,this.previousColumn&&this.previousColumn.ruleTemplate&&(L.detach(t.closest('[id="'+n+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([n])),e?(t=this.selectedColumn.operators,o={field:e.field,label:e.label,operator:t[0].value,value:""},this.addRuleElement(l,o,e,"change",n,!0)):this.addRuleElement(l,o={field:"",label:"",operator:"",value:""},e,"change",n,!0))},x.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)},x.prototype.validateFields=function(){var e,t=!0;if(this.allowValidation)for(var l=["isnull","isnotnull","isempty","isnotempty"],n=void 0,o=void 0,i=void 0,r=[],s=void 0,a=void 0,u=void 0,d=void 0,c=this.element.querySelectorAll(".e-rule-container"),n=0,p=c.length;n<p;n++){var h=void 0,m=L.closest(c[n],".e-group-container"),d=this.getParentGroup(m),s=0;if(i=u=c[n],"DropdownTree"===this.fieldMode?(e=L.getComponent(c[n].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),h=this.selectedColumn.validation):(a=L.getComponent(c[n].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&a.value&&(this.selectedColumn=a.getDataByValue(a.value),h=!L.isNullOrUndefined(a.value)&&this.selectedColumn.validation),o=u.querySelector(".e-rule-field input.e-control"),h&&h.isRequired){for(;i&&null!==i.previousElementSibling;){var i=i.previousElementSibling,g=this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container")));this.enableSeparateConnector&&!g||s++}if(o=u.querySelector(".e-rule-operator .e-control"),d.rules[s].operator||(o.parentElement.className.indexOf("e-tooltip")<0&&o.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),t=!1),d.rules[s].value instanceof Array&&(r=d.rules[s].value),l.indexOf(d.rules[s].operator)<-1&&L.isNullOrUndefined(d.rules[s].value)&&"date"!==d.rules[s].type||""===d.rules[s].value||null===d.rules[s].value||d.rules[s].value instanceof Array&&r.length<1){var f=u.querySelectorAll(".e-rule-value .e-control");l.indexOf(d.rules[s].operator)<0&&(t=!1);for(var y=0,v=f.length;y<v;y++){var b=f[y],C=void 0;-1<b.parentElement.className.indexOf("e-searcher")?(C=L.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 if("date"===d.rules[s].type&&(null===d.rules[s].value||-1<d.rules[s].value.indexOf(null))){f=u.querySelectorAll(".e-rule-value .e-control");l.indexOf(d.rules[s].operator)<0&&(t=!1);for(y=0,v=f.length;y<v;y++)f[y].parentElement.className.indexOf("e-tooltip")<0&&f[y].className.indexOf("e-tooltip")<0&&(L.isNullOrUndefined(d.rules[s].value)||null==d.rules[s].value[y])&&this.renderToolTip(f[y].parentElement)}}else(a&&a.element&&L.isNullOrUndefined(a.value)||e&&e.element&&(L.isNullOrUndefined(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),t=!1)}return t},x.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]}))},x.prototype.refreshLevel=function(e){for(var t,l=e.groupElement.querySelector(".e-rule-list").children,n=e.groupElement,o=l.length,i=0,r=0;r<o;r++)-1<(t=l[r]).className.indexOf("e-group-container")&&(e.level.push(i),this.levelColl[t.id]=e.level.slice(),i++,e.groupElement=t,e=this.refreshLevel(e));var s=L.closest(n,".e-rule-list");return e.groupElement=s?L.closest(s,".e-group-container"):n,e.level=this.levelColl[e.groupElement.id].slice(),e},x.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"}}),i=this.createElement("div",{attrs:{class:"e-group-body"}}),r=this.createElement("div",{attrs:{class:"e-rule-list"}});return n.appendChild(o),i.appendChild(r),n.appendChild(i),this.headerTemplate||(r=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden",i=this.createElement("span",{attrs:{class:r,"aria-label":"drag handle",title:"drag handle"}}),o.appendChild(i),r=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group",i=this.createElement("div",{attrs:{class:r,role:"group"}}),this.enableSeparateConnector&&i.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"}}),i.appendChild(t)),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),i.appendChild(t),e=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),i.appendChild(e),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),i.appendChild(t),e=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),i.appendChild(e),o.appendChild(i),r=this.createElement("div",{attrs:{class:"e-group-action"}}),l=this.enableSeparateConnector?(l=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),r.appendChild(l),this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}})):this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),r.appendChild(l),o.appendChild(r)),n},x.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-label":"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",i=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"}}),i=(n.appendChild(o),this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:i}})),o=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),o=(i.appendChild(o),this.showButtons.ruleDelete||L.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(i),l.appendChild(o),t.appendChild(l),e.appendChild(t),e},x.prototype.addGroupElement=function(t,l,n,o,i,r,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,i,r,s)):this.trigger("beforeChange",e,function(e){a.addGroupSuccess(e,t,l,n,o,i,r,s)})},x.prototype.addGroupSuccess=function(e,t,l,n,o,i,r,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"),L.addClass([h.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(r?(t=!1,h.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(h,i,n,s,p),this.groupIdCounter=0):this.headerTemplateFn(h,i,n,s,p)),this.groupIdCounter++,this.headerTemplate||(r=h.querySelector(".e-btngroup-and"),s=h.querySelector(".e-btngroup-or"),p=h.querySelector(".e-btngroup-and-lbl"),O=h.querySelector(".e-btngroup-or-lbl"),r.setAttribute("id",this.element.id+"_and"+this.btnGroupId),s.setAttribute("id",this.element.id+"_or"+this.btnGroupId),r.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),O.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++),t){for(var r=void 0,r=this.showButtons.groupDelete||L.isNullOrUndefined(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",l=this.createElement("button",{attrs:{type:"button",class:r}}),s=(new N.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(l),l.setAttribute("title",this.l10n.getConstant("DeleteGroup")),L.rippleEffect(l,{selector:".deletegroup"}),e.querySelector(".e-rule-list")),m=s.children,g=0,f=0,y=m.length;f<y;f++)-1<m[f].className.indexOf("e-group-container")&&(g+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===m.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++)m[C].classList.contains("e-rule-container")&&(b++,v++);0<v&&v--,m[k=this.groupIndex+v+1].parentNode.insertBefore(h,m[k])}else m[k=this.groupIndex+1].parentNode.insertBefore(h,m[k]);this.isMiddleGroup=!0}else s.appendChild(h);var S,E,x,p=this.levelColl[e.id].slice(0);p.push(g),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",O=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:S}}),E=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}}),O.appendChild(E),h.querySelector(".e-group-action").appendChild(O),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",x=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"}}),x.appendChild(t),h.querySelector(".e-group-action").appendChild(x),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",x=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:S}}),E=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),x.appendChild(E),h.querySelector(".e-group-action").appendChild(x)),e.appendChild(h),this.levelColl[h.id]=[0];if(this.enableNotCondition&&!this.headerTemplate&&(q=h.querySelector(".e-qb-toggle"),(this.enableSeparateConnector?new N.CheckBox({label:this.l10n.getConstant("NOT"),cssClass:"e-qb-toggle"}):new N.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"})).appendTo(q),h.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule)&&this.updatedRule.not&&L.addClass([q],"e-active-toggle"),this.enableSeparateConnector&&!this.headerTemplate){for(var q,O,r=h.querySelector(".e-btngroup-and"),k=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&&(L.isNullOrUndefined(this.headerTemplate)&&(h.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),h),(q=h.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle"))&&(q.style.display="none"),this.isImportRules||(p=(s=h.previousElementSibling).querySelector(".e-btngroup-and"),o=s.querySelector(".e-btngroup-or"),r.checked||k.checked?this.enableSeparateConnector&&(r.checked&&(p.checked=!0),k.checked)&&(o.checked=!0):(O=h.nextElementSibling)&&O.classList.contains("e-btn-group")&&(r=O.querySelector(".e-btngroup-and"),k=O.querySelector(".e-btngroup-or"),p.checked=r.checked,o.checked=k.checked)))}this.updatedRule=null,this.headerTemplate?(t={requestType:"header-template-create",ruleID:h.id,condition:n,notCondition:this.enableNotCondition?i:void 0},this.trigger("actionBegin",t)):this.enableSeparateConnector?(u=h.querySelector(".e-add-condition-btn"),(c=new N.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(u),c.element.onclick=function(){a.addRuleElement(L.closest(u,".e-group-container"),{})},d=h.querySelector(".e-add-group-btn"),(c=new N.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(d),c.element.onclick=function(){a.addGroupElement(!0,L.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+"_",""),E=h.id.replace(this.element.id+"_",""),this.trigger("change",{groupID:S,type:"insertGroup",childGroupID:E}))}},x.prototype.setMultiConnector=function(e){var t;this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling&&(t=this.groupTemplate(!0).querySelector(".e-btn-group"))&&(e.parentElement.insertBefore(t,e),(t=e.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(t.style.display="none"),this.addHeaderDiv(e))},x.prototype.addHeaderDiv=function(e){var t,l=e.previousElementSibling.previousElementSibling;l&&(l=-1<l.id.indexOf("rule")?this.getRule(l):this.getGroup(l),!L.isNullOrUndefined(l)&&L.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,L.isNullOrUndefined(l)||"or"!==l.condition?e.checked=!0:t.checked=!0)},x.prototype.headerTemplateFn=function(e,t,l,n,o,i){var r=this.element.id+"_header",s=e.querySelector(".e-group-header");if(this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(s=e),this.headerTemplate){if(t={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?t:void 0,condition:l,rule:this.getRuleCollection(n,!1),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)a=this.headerFn(t,this,e.id,r)[0],this.enableSeparateConnector&&i?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):s.appendChild(a);else if(this.isAngular){var l=this.headerFn(t,this,e.id,r),a=3===l[0].nodeType?l[1]:l[0];this.enableSeparateConnector&&i?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):s.appendChild(a)}else if(this.isVue3){if(a=this.headerFn(t,this,e.id,r),this.enableSeparateConnector&&(i||-1!==e.id.indexOf("rule")))for(var u=0;u<a.length;u++)if("DIV"===a[u].nodeName){a=a[u];break}this.enableSeparateConnector&&i?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):L.append(a,s)}else a=this.headerFn(t,this,"Template",r)[0],this.enableSeparateConnector&&i?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):s.appendChild(a);this.renderReactTemplates()}return e},x.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)},x.prototype.notifyChange=function(e,t,l){var n=L.closest(t,".e-group-container"),n=this.getParentGroup(n),o=L.closest(t,".e-rule-container"),i=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"))))&&i++;var n=n.rules[i],n=this.getColumn(n.field),r=this.getFormat(n.format);if("date"===n.type)if(e instanceof Date)e=this.intl.formatDate(e,r);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],r));n.ruleTemplate?this.templateChange(t,e,l):(this.isNotified=!0,this.updateRules(t,e),this.isNotified=!1)}},x.prototype.templateChange=function(e,t,l){var n=L.closest(e,".e-group-container"),o=n&&this.getParentGroup(n),i=L.closest(e,".e-rule-container"),r=0;for(this.allowValidation&&this.validateValue(o,i);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"))))&&r++;var s,a,u=o&&o.rules[r],o=("field"===l?this.selectedColumn=this.getColumn(t):u&&(this.selectedColumn=this.getColumn(u.field)),this.previousColumn=u&&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":if(L.isNullOrUndefined(t)){if(L.isNullOrUndefined(u))return;u.field="",u.label="",u.type="",u.value="",u.operator=""}else 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=L.closest(e,".e-rule-container"),this.destroyControls(o,!0),L.detach(o.querySelector(".e-rule-field")),e=this.appendRuleElem(L.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)))},x.prototype.changeValue=function(e,t){var l,n,o,i,r,s,a,u=this;this.isNumInput&&"number"==typeof t.value||"input"===t.type&&t.target&&t.target.classList.contains("e-numerictextbox")&&this.selectedColumn.validation&&(this.selectedColumn.validation.max!==Number.MAX_VALUE||0<this.selectedColumn.validation.min)?this.isNumInput=!1:(l=t.element&&t.element.classList.contains("e-multiselect")?t.element:t.event?t.event.target:"input"===t.type&&t.target&&t.target.classList.contains("e-numerictextbox")?t.currentTarget:t.element)&&((-1<l.className.indexOf("e-day")||-1<l.className.indexOf("e-today")||-1<l.className.indexOf("e-cell"))&&(l=t.element),r=L.closest(l,".e-group-container"),a=L.closest(l,".e-rule-container"),n=r&&r.id.replace(this.element.id+"_",""),o=a.id.replace(this.element.id+"_",""),(r=t).element&&-1<r.element.cla