UNPKG

@syncfusion/ej2-querybuilder

Version:
10 lines 174 kB
/*! * filename: ej2-querybuilder.min.js * version : 30.1.40 * Copyright Syncfusion Inc. 2001 - 2024. 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&&"object"==typeof module?module.exports=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):"function"==typeof define&&define.amd?define(["SyncfusionBase","SyncfusionButtons","SyncfusionDropdowns","SyncfusionData","SyncfusionInputs","SyncfusionCalendars","SyncfusionSplitbuttons","SyncfusionPopups"],t):"object"==typeof exports?exports.SyncfusionQuerybuilder=t(require("SyncfusionBase"),require("SyncfusionButtons"),require("SyncfusionDropdowns"),require("SyncfusionData"),require("SyncfusionInputs"),require("SyncfusionCalendars"),require("SyncfusionSplitbuttons"),require("SyncfusionPopups")):e.SyncfusionQuerybuilder=t(e.SyncfusionBase,e.SyncfusionButtons,e.SyncfusionDropdowns,e.SyncfusionData,e.SyncfusionInputs,e.SyncfusionCalendars,e.SyncfusionSplitbuttons,e.SyncfusionPopups)}(self,(e,t,l,n,r,i,o,s)=>(()=>{"use strict";var a={766:t=>{t.exports=e},741:e=>{e.exports=t},570:e=>{e.exports=i},74:e=>{e.exports=n},778:e=>{e.exports=l},323:e=>{e.exports=r},197:e=>{e.exports=s},295:e=>{e.exports=o}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var l=u[e]={exports:{}};return a[e](l,l.exports,d),l.exports}d.d=(e,t)=>{for(var l in t)d.o(t,l)&&!d.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return(()=>{d.r(p),d.d(p,{Columns:()=>g,QueryBuilder:()=>y,QueryLibrary:()=>b,Rule:()=>m,ShowButtons:()=>v,Value:()=>f});var e,t=d(766),l=d(741),n=d(778),r=d(74),i=d(323),o=d(570),s=d(295),a=d(197),u=(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])},e(t,l)},function(t,l){function n(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(n.prototype=l.prototype,new n)}),c=function(){return c=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)},h=function(e,t,l,n){var r,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(i<3?r(o):i>3?r(t,l,o):r(t,l))||o);return i>3&&o&&Object.defineProperty(t,l,o),o},g=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"values",void 0),h([(0,t.Property)(null)],l.prototype,"operators",void 0),h([(0,t.Property)()],l.prototype,"ruleTemplate",void 0),h([(0,t.Property)(null)],l.prototype,"template",void 0),h([(0,t.Property)({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),h([(0,t.Property)(null)],l.prototype,"format",void 0),h([(0,t.Property)(null)],l.prototype,"step",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(null)],l.prototype,"category",void 0),h([(0,t.Property)(null)],l.prototype,"columns",void 0),l}(t.ChildProperty),m=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"condition",void 0),h([(0,t.Collection)([],l)],l.prototype,"rules",void 0),h([(0,t.Property)(null)],l.prototype,"field",void 0),h([(0,t.Property)(null)],l.prototype,"label",void 0),h([(0,t.Property)(null)],l.prototype,"type",void 0),h([(0,t.Property)(null)],l.prototype,"operator",void 0),h([(0,t.Property)(null)],l.prototype,"value",void 0),h([(0,t.Property)(!1)],l.prototype,"not",void 0),h([(0,t.Property)(null)],l.prototype,"isLocked",void 0),l}(t.ChildProperty),f=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(null)],l.prototype,"numericTextBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"multiSelectModel",void 0),h([(0,t.Property)(null)],l.prototype,"datePickerModel",void 0),h([(0,t.Property)(null)],l.prototype,"textBoxModel",void 0),h([(0,t.Property)(null)],l.prototype,"radioButtonModel",void 0),l}(t.ChildProperty),v=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),h([(0,t.Property)(!1)],l.prototype,"cloneRule",void 0),h([(0,t.Property)(!1)],l.prototype,"cloneGroup",void 0),h([(0,t.Property)(!1)],l.prototype,"lockRule",void 0),h([(0,t.Property)(!1)],l.prototype,"lockGroup",void 0),h([(0,t.Property)(!0)],l.prototype,"ruleDelete",void 0),h([(0,t.Property)(!0)],l.prototype,"groupInsert",void 0),h([(0,t.Property)(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),y=function(e){function d(t,l){var r=e.call(this,t,l)||this;return r.isReadonly=!0,r.fields={text:"label",value:"field"},r.updatedRule={not:!1,condition:"and",isLocked:!1},r.isLocale=!1,r.isRefreshed=!1,r.isNotified=!1,r.isAddSuccess=!1,r.isNotValueChange=!1,r.isFieldChange=!1,r.isFieldClose=!1,r.isDestroy=!1,r.isGetNestedData=!1,r.isCustomOprCols=[],r.groupCounter=0,r.lockItems=[],r.groupIndex=-1,r.ruleIndex=-1,r.isLastGroup=!1,r.cloneGrpBtnClick=!1,r.isMiddleGroup=!1,r.cloneRuleBtnClick=!1,r.isValueEmpty=!1,r.isPropChange=!1,n.MultiSelect.Inject(n.CheckBoxSelection),r}return u(d,e),d.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},d.prototype.reset=function(){this.isImportRules=!1;for(var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),n=0,r=l.length;n<r;n++)l[n].className.indexOf("e-tooltip")>-1?(0,t.getComponent)(l[n],"tooltip").destroy():l[n].parentElement.className.indexOf("e-tooltip")>-1&&(0,t.getComponent)(l[n].parentElement,"tooltip").destroy();if(e)e.innerHTML="";else{var i=this.createElement("div",{attrs:{class:"e-group-container"}}),o=this.createElement("div",{attrs:{class:"e-group-header"}}),s=this.createElement("div",{attrs:{class:"e-group-body"}});i.appendChild(o).appendChild(s),this.element.appendChild(i),e=this.element.querySelector(".e-group-body")}this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&(0,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)},d.prototype.getWrapper=function(){return this.element},d.prototype.getModuleName=function(){return"query-builder"},d.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},d.prototype.GetRootColumnName=function(e){return(0,t.isNullOrUndefined)(e)?"":this.separator?e.split(this.separator)[0]:e},d.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],n=void 0,r=!1,i=!1,o=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"===(n=typeof(o=this.dataColl[0][d[a].field]))?i=!isNaN(Date.parse(o)):"object"===n&&(i=o instanceof Date&&!isNaN(o.getTime()),n="string"),d[a].type=n,i=!1),n="string"),d[a].validation||(d[a].validation=s),d[a].category?r=!0:d[a].category=this.l10n.getConstant("OtherFields"),l.indexOf(d[a].category)<0&&l.push(d[a].category),(!d[a].operators||this.isLocale&&-1===this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);r&&(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"===(n=typeof(o=this.dataColl[0][e[a]]))?i=!isNaN(Date.parse(o)):"object"!==n||Object.keys(o).length||(i=o instanceof Date&&!isNaN(o.getTime()),n="string"),t[a]={field:e[a],label:e[a],type:i?"date":n,validation:s},i=!1,t[a].operators=this.customOperators[t[a].type+"Operator"],"object"===n&&this.updateSubFields(o,t[a]);this.columns=t}}else if(this.columns&&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],"initial"),(!d[a].operators||this.isLocale&&-1===this.isCustomOprCols.indexOf(d[a].field))&&(d[a].operators=this.customOperators[d[a].type+"Operator"]);this.updateSubFieldsFromColumns(this.columns)}this.trigger("dataBound",{type:"dataBound"})},d.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))},d.prototype.updateSubFields=function(e,t,l){var n;t.columns=[];var r,i,o=Object.keys(e);l=l||this.dataColl[0];for(var s=0,a=o.length;s<a;s++){var u=t.field.split(".");i=l?l[u[u.length-1]][o[s]]:this.dataColl[0][t.field][o[s]];var d=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]];r=typeof i,n={field:t.field+this.separator+o[s],label:o[s],type:r="object"!==r||isNaN(Date.parse(i))?r:"date"},"object"!==r&&(n.operators=this.customOperators[r+"Operator"]),t.columns.push(n),"object"===r&&this.updateSubFields(i,n,d)}},d.prototype.updateCustomOperator=function(e,l){if(e.operators){this.isLocale||"initial"!==l||(0,t.isNullOrUndefined)(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var n=e.operators[t],i=Object.keys(n),o=i.map(function(e){return n[""+e]}).join(",").split(","),s=i.indexOf("value");r.operators[o[s]]=o[l]}},r=this,i=0;i<e.operators.length;i++)n(i)}},d.prototype.focusEventHandler=function(e){this.target=e.target},d.prototype.clickEventHandler=function(e){var l,n,r=this,i=e.target;if(this.isImportRules=!1,"SPAN"===i.tagName&&(i=i.parentElement),"string"==typeof i.className&&i.className.indexOf("e-collapse-rule")>-1){var o=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");o.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"===i.tagName&&"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")<0){o=new t.Animation({duration:1e3,delay:0});switch(!0){case i.className.indexOf("e-removerule")>-1:this.actionButton=i,this.deleteRule(i);break;case i.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=i,this.cloneRuleBtnClick=!0,this.ruleClone(i);break;case i.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=i,this.ruleLock(i);break;case i.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=i,this.groupLock(i);break;case i.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=i,this.cloneGrpBtnClick=!0,this.groupClone((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-deletegroup")>-1:this.actionButton=i,this.deleteGroup((0,t.closest)(i,".e-group-container"));break;case i.className.indexOf("e-edit-rule")>-1:if(o.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=(0,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"===i.tagName&&i.parentElement.className.indexOf("e-btn-group")>-1||"string"==typeof i.className&&i.className.indexOf("e-qb-toggle")>-1){var p=(0,t.closest)(i,".e-group-container");if(!this.headerTemplate){var c=i.getAttribute("for"),h=void 0;c?h=document.getElementById(c).getAttribute("value"):this.enableSeparateConnector&&(h=i.classList.contains("e-btngroup-or-lbl")?"or":i.classList.contains("e-btngroup-and-lbl")?"and":i.textContent),n=p.id.replace(this.element.id+"_","");var g=this.getGroup(n),m=void 0;if(this.enableNotCondition)if(i.className.indexOf("e-qb-toggle")>-1){var f=p.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?((0,t.removeClass)([f],"e-active-toggle"),m=!1):((0,t.addClass)([f],"e-active-toggle"),m=!0),h=g.condition}else m=g.not;l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase(),not:m})}this.isImportRules?this.beforeSuccessCallBack(l,i):this.trigger("beforeChange",l,function(e){r.beforeSuccessCallBack(e,i)}),this.target=i}},d.prototype.beforeSuccessCallBack=function(e,l){if(e&&!e.cancel){var n=(0,t.closest)(l,".e-group-container"),r=n.id.replace(this.element.id+"_",""),i=this.getValidRules(this.rule),o=this.getParentGroup(n);if(this.enableSeparateConnector){var s=(n=(0,t.isNullOrUndefined)((0,t.closest)(l,".e-rule-container"))&&n.classList.contains("e-group-container")?null!==l.parentElement.previousElementSibling?l.parentElement.previousElementSibling:n:(0,t.closest)(l,".e-rule-container")).id.replace(this.element.id+"_","");n.classList.contains("e-rule-container")?(o=this.getRule(n)).condition=e.value:n.classList.contains("e-group-container")&&((o=this.getGroup(n)).condition=e.value),this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,ruleID:s,type:"condition",value:o.condition})}else o.condition=e.value,this.enableNotCondition&&(o.not=e.not),this.isImportRules||this.trigger("change",{groupID:r,type:"condition",value:o.condition});if(this.filterRules(i,this.getValidRules(this.rule),"condition"),this.enableSeparateConnector){var a=l.parentElement.querySelector(".e-btngroup-and"),u=l.parentElement.querySelector(".e-btngroup-or");a&&u&&("and"===e.value?(a.checked=!0,u.checked=!1):"or"===e.value&&(u.checked=!0,a.checked=!1))}}},d.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert||(0,t.isNullOrUndefined)(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):(0,t.removeClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&(0,t.addClass)([l.element.querySelector("li").parentElement],"e-rtl")):(0,t.addClass)([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement((0,t.closest)(e,".e-group-container"),{}):l.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,(0,t.closest)(e,".e-group-container"),"",!0)},d.prototype.appendRuleElem=function(e,l,n,r,i,o){var s,a,u,d=e.querySelector(".e-rule-list");if("change"===n)s=(0,t.select)("#"+r,e);else{if((s=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick){if(this.ruleIndex<0)d.appendChild(s);else if(this.enableSeparateConnector){for(var p=-1,c=this.ruleIndex+1,h=0;h<c&&h!==d.children.length;h++)d.children[h].classList.contains("e-rule-container")&&(c++,p++);d.insertBefore(s,d.children[this.ruleIndex+p+1])}else d.insertBefore(s,d.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else d.appendChild(s);this.ruleIdCounter++}if(l&&l.ruleTemplate&&o){u={requestType:"template-initialize",ruleID:s.id,action:i,fields:this.fields,rule:o},this.trigger("actionBegin",u),this.ruleTemplateFn=this.templateParser(l.ruleTemplate);var g=this.element.id+l.field;if(u.fields=this.fields,u.columns=this.columns,""===o.field&&(o.field=l.field),u.operators=this.getOperators(o.field),u.operatorFields={text:"key",value:"value"},this.isReact)(a=this.ruleTemplateFn(u,this,s.id,g)[0]).className+=" e-rule-field",s.appendChild(a);else if(this.isAngular){var m=this.ruleTemplateFn(u,this,s.id,g);(a=3===m[0].nodeType?m[1]:m[0]).className+=" e-rule-field",s.appendChild(a)}else this.isVue3?(a=this.ruleTemplateFn(u,this,"Template",g),(0,t.append)(a,s),s.children.length&&(s.children[s.children.length-1].className+=" e-rule-field")):((a=this.ruleTemplateFn(u,this,"Template",g)[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&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&(0,t.removeClass)(s.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&(0,t.removeClass)(s.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&(0,t.removeClass)(s.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&(0,t.removeClass)(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&(0,t.removeClass)(s.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),l&&l.ruleTemplate&&o&&this.renderReactTemplates(),s},d.prototype.addRuleElement=function(e,t,l,n,r,i){var o=this;if(e){var s={groupID:e.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(s,e,t,l,n,r,i)):this.trigger("beforeChange",s,function(s){o.addRuleSuccessCallBack(s,e,t,l,n,r,i)})}},d.prototype.addRuleSuccessCallBack=function(e,l,r,i,o,s,a){var u,d,p,h,g=this.element.className.indexOf("e-device")>-1?"250px":"200px",m=r&&r.field?this.getColumn(r.field):i||this.columns[0],f={label:"",field:"",type:"",operator:""};if(!e.cancel){if(m&&m.ruleTemplate&&r.field){this.selectedColumn=m,d=this.selectedColumn.operators,f={label:m.label,field:m.field,type:m.type,operator:d[0].value};var v=Object.keys(r).length?r:f,y={requestType:"template-create",action:"insert-rule",ruleID:(h=this.appendRuleElem(l,m,o,s,"field",v)).id,fields:this.fields,rule:v};this.trigger("actionBegin",y)}else{(h=this.appendRuleElem(l,m,o,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"),(0,t.addClass)([b],"e-flat"),(0,t.addClass)([b],"e-primary");else{(0,t.addClass)([b],"e-round"),(0,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")}"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";var S=h.previousElementSibling;if(this.enableSeparateConnector){var x=void 0,q=void 0;if(S&&S.classList.contains("e-group-container")&&(q=S.querySelectorAll(".e-rule-container"),S=q[q.length-1]),S&&S.classList.contains("e-rule-container")&&(x=this.getRule(S)),this.headerTemplate&&S&&x)this.headerTemplateFn(S,!1,x.condition,x,S.id);else if((0,t.isNullOrUndefined)(S)&&h.id!==this.element.id+"_group0_rule0"){if((B=h.closest(".e-group-container"))&&B.previousElementSibling){var O=(D=B.previousElementSibling).querySelectorAll(".e-rule-container");if(D.classList.contains("e-group-container")&&(D=O[O.length-1]),D.classList.contains("e-rule-container")){var E=this.getRule(D);this.headerTemplateFn(D,!1,E.condition,E,D.id,!0)}}else this.headerTemplateFn(h,!1,r.condition,r,h.id,!0)}}else S&&S.className.indexOf("e-rule-container")>-1&&(h.className.indexOf("e-joined-rule")<0&&(h.className+=" e-joined-rule"),S.className.indexOf("e-prev-joined-rule")<0&&(S.className+=" e-prev-joined-rule"));if(S&&S.className.indexOf("e-group-container")>-1&&h.className.indexOf("e-separate-rule")<0&&(h.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(l,r,f,a,s,!!this.enableSeparateConnector||null),!m||m&&!m.ruleTemplate||!r.field)if("Default"===this.fieldMode){var k=void 0,w=void 0;w=this.separator&&r.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(r.field):r.field,k={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?g:"auto",close:this.fieldClose.bind(this,h.id+"_filterkey"),change:this.changeField.bind(this),value:r?w:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(k=c({},k,this.fieldModel)),(p=new n.DropDownList(k)).appendTo("#"+h.id+"_filterkey");var N=void 0;N=this.separator&&r.field||this.isImportRules?this.GetRootColumnName(r.field):p.value,this.selectedColumn=p.getDataByValue(N),Object.keys(r).length&&this.changeRule(r,{element:p.element,itemData:this.selectedColumn})}else{k=void 0,w=(this.isImportRules,r.field);this.dummyDropdownTreeDs=(0,t.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),k={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?g:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:(0,t.isNullOrUndefined)(w)?null:[w],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&&(k=c({},k,this.fieldModel));var L=new n.DropDownTree(k);if(L.appendTo("#"+h.id+"_filterkey"),!(0,t.isNullOrUndefined)(L.value)){var R=this.getLabelFromColumn(L.value[0]);L.element.value=R}N=(0,t.isNullOrUndefined)(r.field)?L.value:this.GetRootColumnName(r.field);this.selectedColumn=this.getColumn(N),Object.keys(r).length&&this.changeRule(r,{element:L.element,itemData:this.selectedColumn})}if(u=h.id.replace(this.element.id+"_",""),r&&r.isLocked){var T=h.querySelector(".e-lock-rule-btn");this.ruleLock(T)}this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:u,type:"insertRule"})}if(this.enableSeparateConnector&&(0,t.isNullOrUndefined)(r.condition)&&u&&(r=this.getRule(u)),this.enableSeparateConnector){var D=h.previousElementSibling;for(q=void 0;D&&!D.classList.contains("e-rule-container");){if(D.classList.contains("e-group-container")){q=D.querySelectorAll(".e-rule-container"),D=q[q.length-1];break}D=D.previousElementSibling}if(this.headerTemplate&&D){x=this.getRule(D);var I={requestType:"rule-template-create",ruleID:D.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",I)}else if((0,t.isNullOrUndefined)(D)&&h.id!==this.element.id+"_group0_rule0"){var B;if((B=h.closest(".e-group-container"))&&B.previousElementSibling&&B.previousElementSibling.previousElementSibling){var P=B.previousElementSibling.previousElementSibling;if(P.classList.contains("e-group-container")){var A=P.querySelectorAll(".e-rule-container");P=A[A.length-1]}if(P.classList.contains("e-rule-container")){x=this.getRule(P);var G={requestType:"rule-template-create",ruleID:P.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",G)}}}this.setMultiConnector(h)}},d.prototype.dropdownTreeFiltering=function(e){var l,n=this,r=this,i=e.event.srcElement;l=(i.classList.contains("e-clear-icon")?i.parentElement.querySelector(".e-textbox"):i).id.split("_filterkey")[0];var o=document.getElementById(l);this.ddTree=(0,t.getComponent)(o.querySelector("input.e-dropdowntree"),"dropdowntree");var s=(0,t.extend)([],this.columns,[],!0);if(e.cancel=!0,""===e.text)this.changeDataSource(s);else{var a=s.map(function(t){return n.nestedChildFilter(e.text,t)}).filter(function(e){return null!==e});this.changeDataSource(a),setTimeout(function(){(0,t.isNullOrUndefined)(r.ddTree)||(0,t.isNullOrUndefined)(r.ddTree.treeObj)||r.ddTree.treeObj.expandAll()},100)}},d.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()},d.prototype.nestedChildFilter=function(e,t){var l=this,n=t[this.ddTree.fields.child];if(!n)return this.isMatchedNode(e,t)?t:null;var r=n.map(function(t){return l.nestedChildFilter(e,t)}).filter(function(e){return null!==e});return r.length?(t[this.ddTree.fields.child]=r,t):(t[this.ddTree.fields.child]=n,this.isMatchedNode(e,t)?t:null)},d.prototype.isMatchedNode=function(e,t){var l=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==l.indexOf(e)},d.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource((0,t.extend)([],this.columns,[],!0)),this.ddTree=null},d.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},d.prototype.updateAddedRule=function(e,l,n,r,i,o){var s,a,u,d=0;if(r){for(s=(0,t.select)("#"+i,e),a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var p=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&&!p||d++}u.rules[d]=l}else{a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);var c=l.custom;Object.keys(l).length?this.ruleIndex<0?(u.rules.push({field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),c&&(u.rules[u.rules.length-1].custom=c),this.enableSeparateConnector&&(u.rules[u.rules.length-1].condition=l.condition?l.condition:n.condition)):(u.rules.splice(this.ruleIndex+1,0,{field:l.field,type:l.type,label:l.label,operator:l.operator,value:l.value}),c&&(u.rules[this.ruleIndex+1].custom=c),this.enableSeparateConnector&&(u.rules[this.ruleIndex+1].condition=l.condition?l.condition:n.condition)):(c&&(n.custom=c),this.autoSelectField&&(l.field=n.field=this.rule.rules[0].field),u.rules.push(n))}this.disableRuleCondition(e,u,o)},d.prototype.changeRuleTemplate=function(e,l){if(!e||!e.ruleTemplate){var n=(0,t.closest)(l,".e-group-container"),r=(0,t.closest)(l,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&((0,t.detach)(l.closest('[id="'+r+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([r])),e){var i=this.selectedColumn.operators,o={field:e.field,label:e.label,operator:i[0].value,value:""};this.addRuleElement(n,o,e,"change",r,!0)}else{o={field:"",label:"",operator:"",value:""};this.addRuleElement(n,o,e,"change",r,!0)}}},d.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)},d.prototype.validateFields=function(){var e,l=!0;if(this.allowValidation){var n,r=["isnull","isnotnull","isempty","isnotempty"],i=void 0,o=void 0,s=void 0,a=[],u=void 0,d=void 0,p=void 0,c=void 0,h=void 0,g=this.element.querySelectorAll(".e-rule-container");for(i=0,n=g.length;i<n;i++){var m=void 0;if(u=(0,t.closest)(g[i],".e-group-container"),h=this.getParentGroup(u),d=0,s=c=g[i],"DropdownTree"===this.fieldMode?(e=(0,t.getComponent)(g[i].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),m=this.selectedColumn.validation):(p=(0,t.getComponent)(g[i].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&p.value&&(this.selectedColumn=p.getDataByValue(p.value),m=!(0,t.isNullOrUndefined)(p.value)&&this.selectedColumn.validation),o=c.querySelector(".e-rule-field input.e-control"),m&&m.isRequired){for(;s&&null!==s.previousElementSibling;){s=s.previousElementSibling;var f=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&&!f||d++}if(o=c.querySelector(".e-rule-operator .e-control"),h.rules[d].operator||(o.parentElement.className.indexOf("e-tooltip")<0&&o.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1),h.rules[d].value instanceof Array&&(a=h.rules[d].value),r.indexOf(h.rules[d].operator)<-1&&(0,t.isNullOrUndefined)(h.rules[d].value)&&"date"!==h.rules[d].type||""===h.rules[d].value||null===h.rules[d].value||h.rules[d].value instanceof Array&&a.length<1){var v=c.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(var y=0,b=v.length;y<b;y++){var C=v[y],S=void 0;C.parentElement.className.indexOf("e-searcher")>-1?(S=(0,t.closest)(C,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(S):v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&this.renderToolTip(v[y].parentElement),y++}}else if("date"===h.rules[d].type&&(null===h.rules[d].value||h.rules[d].value.indexOf(null)>-1)){v=c.querySelectorAll(".e-rule-value .e-control");r.indexOf(h.rules[d].operator)<0&&(l=!1);for(y=0,b=v.length;y<b;y++)v[y].parentElement.className.indexOf("e-tooltip")<0&&v[y].className.indexOf("e-tooltip")<0&&((0,t.isNullOrUndefined)(h.rules[d].value)||null==h.rules[d].value[y])&&this.renderToolTip(v[y].parentElement)}}else(p&&p.element&&(0,t.isNullOrUndefined)(p.value)||e&&e.element&&((0,t.isNullOrUndefined)(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1)}}return l},d.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)}},d.prototype.refreshLevel=function(e){var l,n,r=e.groupElement.querySelector(".e-rule-list").children,i=e.groupElement,o=r.length,s=0;for(n=0;n<o;n++)(l=r[n]).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=(0,t.closest)(i,".e-rule-list");return e.groupElement=a?(0,t.closest)(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},d.prototype.groupTemplate=function(e){var t,l,n,r,i,o,s=this.createElement("div",{attrs:{class:"e-group-container"}}),a=this.createElement("div",{attrs:{class:"e-group-header"}}),u=this.createElement("div",{attrs:{class:"e-group-body"}}),d=this.createElement("div",{attrs:{class:"e-rule-list"}});if(s.appendChild(a),u.appendChild(d),s.appendChild(u),!this.headerTemplate){n=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var p=this.createElement("span",{attrs:{class:n,"aria-label":"drag handle",title:"drag handle"}});a.appendChild(p);var c=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group";t=this.createElement("div",{attrs:{class:c,role:"group"}}),this.enableSeparateConnector&&t.classList.add("e-multi-connector"),this.enableNotCondition&&(l=this.enableSeparateConnector?this.createElement("input",{attrs:{type:"checkbox",class:"e-qb-toggle"}}):this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),t.appendChild(l)),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),t.appendChild(r),l=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),t.appendChild(l),r=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),t.appendChild(r),a.appendChild(t),i=this.createElement("div",{attrs:{class:"e-group-action"}}),this.enableSeparateConnector?(o=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),i.appendChild(o),o=this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}}),i.appendChild(o)):(o=this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),i.appendChild(o)),a.appendChild(i)}return s},d.prototype.ruleTemplate=function(){var e,l,n,r,i,o=this.createElement("div"),s=this.createElement("div",{attrs:{class:"e-rule-field"}});e=this.createElement("div",{attrs:{class:"e-rule-filter"}}),i=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden";var a=this.createElement("span",{attrs:{class:i,"aria-label":"drag handle",title:"drag handle"}});s.appendChild(a);var u=this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}});e.appendChild(u),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-operator"}}),s.appendChild(e),e=this.createElement("div",{attrs:{class:"e-rule-value"}}),s.appendChild(e),e=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";var d=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}}),p=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});d.appendChild(p);var c=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:r}});p=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),c.appendChild(p),l=this.showButtons.ruleDelete||(0,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 h=this.createElement("button",{attrs:{type:"button",class:l}});return e.appendChild(d),e.appendChild(c),e.appendChild(h),s.appendChild(e),o.appendChild(s),o},d.prototype.addGroupElement=function(e,t,l,n,r,i,o){var s=this,a={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addGroupSuccess(a,e,t,l,n,r,i,o)):this.trigger("beforeChange",a,function(a){s.addGroupSuccess(a,e,t,l,n,r,i,o)})},d.prototype.addGroupSuccess=function(e,n,r,i,o,a,u,d){var p=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var c=r,h=void 0,g="";g=c.className.indexOf("e-group-container")<0?c.querySelector(".e-group-container")&&c.querySelector(".e-group-container").id:c.id,this.enableSeparateConnector&&(this.groupElem=this.groupTemplate());var m=this.groupElem.cloneNode(!0);if(m.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&m.querySelector(".e-drag-qb-rule")&&(m&&m.children[0]&&m.children[0].classList.add("e-parent-header"),(0,t.addClass)([m.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(u?(n=!1,m.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(m,a,i,d,g),this.groupIdCounter=0):this.headerTemplateFn(m,a,i,d,g)),this.groupIdCounter++,!this.headerTemplate){var f=m.querySelector(".e-btngroup-and"),v=m.querySelector(".e-btngroup-or"),y=m.querySelector(".e-btngroup-and-lbl"),b=m.querySelector(".e-btngroup-or-lbl");f.setAttribute("id",this.element.id+"_and"+this.btnGroupId),v.setAttribute("id",this.element.id+"_or"+this.btnGroupId),f.setAttribute("name",this.element.id+"_and"+this.btnGroupId),v.setAttribute("name",this.element.id+"_and"+this.btnGroupId),y.setAttribute("for",this.element.id+"_and"+this.btnGroupId),b.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++}if(n){var C=void 0;C=this.showButtons.groupDelete||(0,t.isNullOrUndefined)(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",h=this.createElement("button",{attrs:{type:"button",class:C}}),new l.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(h),h.setAttribute("title",this.l10n.getConstant("DeleteGroup")),(0,t.rippleEffect)(h,{selector:".deletegroup"});for(var S=c.querySelector(".e-rule-list"),x=S.children,q=0,O=0,E=x.length;O<E;O++)x[O].className.indexOf("e-group-container")>-1&&(q+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===x.length-1)S.appendChild(m),this.isLastGroup=!0;else{if(this.enableSeparateConnector){for(var k=0,w=this.groupIndex+1,N=0;N<w;N++)x[N].classList.contains("e-rule-container")&&(w++,k++);k>0&&k--,x[L=this.groupIndex+k+1].parentNode.insertBefore(m,x[L])}else{var L;x[L=this.groupIndex+1].parentNode.insertBefore(m,x[L])}this.isMiddleGroup=!0}else S.appendChild(m);var R=this.levelColl[c.id].slice(0);if(R.push(q),this.levelColl[m.id]=R,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],c.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,o&&this.addRuleToNewGroups&&this.addRuleElement(m,{})),!this.headerTemplate){var T="";T=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 D=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:T}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});D.appendChild(I),m.querySelector(".e-group-action").appendChild(D),T=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 B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:T}}),P=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(P),m.querySelector(".e-group-action").appendChild(B),m.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){T="";T=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";B=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:T}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(I),m.querySelector(".e-group-action").appendChild(B)}c.appendChild(m),this.levelColl[m.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var A=m.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(A),m.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&(0,t.addClass)([A],"e-active-toggle")}if(this.enableSeparateConnector&&!this.headerTemplate){var G=m.querySelector(".e-btngroup-and"),M=m.querySelector(".e-btngroup-or"),V=m.querySelector(".e-btn-group");for(N=0;N<V.childNodes.length;N++)"not"===m.querySelector(".e-btn-group").childNodes[N].textContent.toLowerCase()&&this.enableNotCondition?V.childNodes[N].classList.add("e-multiconnector"):V.childNodes[N].style.display="none";if(m.previousElementSibling){if((0,t.isNullOrUndefined)(this.headerTemplate))m.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),m),(A=m.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(A.style.display="none");if(!this.isImportRules){var U=m.previousElementSibling,F=U.querySelector(".e-btngroup-and"),_=U.querySelector(".e-btngroup-or");if(G.checked||M.checked)this.enableSeparateConnector&&(G.checked&&(F.checked=!0),M.checked&&(_.checked=!0));else{var j=m.nextElementSibling;j&&j.classList.contains("e-btn-group")&&(G=j.querySelector(".e-btngroup-and"),M=j.querySelector(".e-btngroup-or"),F.checked=G.checked,_.checked=M.checked)}}}}if(this.updatedRule=null,this.headerTemplate){var $={requestType:"header-template-create",ruleID:m.id,condition:i,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",$)}else if(this.enableSeparateConnector){var Q=m.querySelector(".e-add-condition-btn");(W=new l.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(Q),W.element.onclick=function(){p.addRuleElement((0,t.closest)(Q,".e-group-container"),{})};var H=m.querySelector(".e-add-group-btn");(W=new l.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(H),W.element.onclick=function(){p.addGroupElement(!0,(0,t.closest)(H,".e-group-container"),"",!0)}}else{var W,z=m.querySelector(".e-add-btn");(W=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,z),select:this.selectBtn.bind(this,z)})).appendTo(z),z.setAttribute("title",this.l10n.getConstant("AddButton"))}if(!this.isImportRules&&!this.prvtEvtTgrDaD){var Y=c.id.replace(this.element.id+"_",""),K=m.id.replace(this.element.id+"_","");this.trigger("change",{groupID:Y,type:"insertGroup",childGroupID:K})}}},d.prototype.setMultiConnector=function(e){if(this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling&&this.groupElem.querySelector(".e-btn-group")){e.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),e);var t=e.previousElementSibling.childNodes[0];t.classList.contains("e-qb-toggle")&&(t.style.display="none"),this.addHeaderDiv(e)}},d.prototype.addHeaderDiv=function(e){var l,n=e.previousElementSibling.previousElementSibling;if(n){l=n.id.indexOf("rule")>-1?this.getRule(n):this.getGroup(n),!(0,t.isNullOrUndefined)(l)&&(0,t.isNullOrUndefined)(l.condition)&&(l.condition="and");var r=e.previousElementSibling.querySelector(".e-btngroup-or"),i=e.previousElementSibling.querySelector(".e-btngroup-and");r.disabled=!1,i.disabled=!1,(0,t.isNullOrUndefined)(l)||"or"!==l.condition?i.checked=!0:r.checked=!0}},d.prototype.headerTemplateFn=function(e,l,n,r,i,o){var s,a,u=this.element.id+"_header",d=e.querySelector(".e-group-header");if(this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(d=e),this.headerTemplate){if(a={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?l:void 0,condition:n,rule:this.getRuleCollection(r,!1),groupID:i},this.trigger("actionBegin",a),this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(a.requestType="rule-template-create"),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)s=this.headerFn(a,this,e.id,u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);else if(this.isAngular){var p=this.headerFn(a,this,e.id,u);s=3===p[0].nodeType?p[1]:p[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s)}else if(this.isVue3){if(s=this.headerFn(a,this,e.id,u),this.enableSeparateConnector&&(o||-1!==e.id.indexOf("rule")))for(var c=0;c<s.length;c++)if("DIV"===s[c].nodeName){s=s[c];break}this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):(0,t.append)(s,d)}else s=this.headerFn(a,this,"Template",u)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,s):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?d.parentElement.insertBefore(s,d.nextElementSibling):d.appendChild(s);this.renderReactTemplates()}return e},d.prototype.enableSeparateConnectorInitialRule=function(e,t){var l=(e.nextElementSibling?e.nextElementSibling:e).closest(".e-group-container");!e.nextElementSibling&&l&&(l=l.nextElementSibling?l.nextElementSibling:l),l&&l.parentElement.insertBefore(t,l)},d.prototype.notifyChange=function(e,l,n){var r=(0,t.closest)(l,".e-group-container"),i=this.getParentGroup(r),o=(0,t.closest)(l,".e-rule-container"),s=0;if("not"!==n)if("condition"!==n){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"))))&&s++;var a=i.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,n):(this.isNotified=!0,this.updateRules(l,e),this.isNotified=!1)}else this.enableSeparateConnector?((o=l.parentElement.previousElementSibling)&&o.classList.contains("e-group-container")&&(o=o.querySelectorAll(".e-rule-container")[o.querySelectorAll(".e-rule-container").length-1]),o&&o.classList.contains("e-rule-container")&&(i=this.getRule(o)),i.condition=e):i.condition=e;else i.not=e},d.prototype.templateChange=function(e,l,n){var r,i=(0,t.closest)(e,".e-group-container"),o=this.getParentGroup(i),s=(0,t.closest)(e,".e-rule-container"),a=0;for(this.allowValidation&&this.validateValue(o,s);s&&null!==s.previousElementSibling;)s=s.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container"))))&&a++;var u,d=o.rules[a];"field"===n?this.selectedColumn=this.getColumn(l):d&&(this.selectedColumn=this.getColumn(d.field)),this.previousColumn=this.getColumn(d.field);var p=this.getValidRules(this.rule);this.selectedColumn&&(u=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var c,h=["in","notin","between","notbetween"];switch(n){case"field":(0,t.isNullOrUndefined)(l)?(d.field="",d.label="",d.type="",d.value="",d.operator=""):(d.field=l,d.label=this.selectedColumn.label,d.type=this.selectedColumn.type,d.value="",d.operator=u[0].value);break;case"operator":c=d.operator,d.operator=l,h.indexOf(d.operator)>-1?d.value=[]:h.indexOf(c)>-1&&(d.value="");break;case"value":d.value=l}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(p,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var g=(0,t.closest)(e,".e-rule-container");this.destroyControls(g,!0),(0,t.detach)(g.querySelector(".e-rule-field"));var m=this.appendRuleElem((0,t.closest)(g,".e-group-container"),this.selectedColumn,"change",g.id,n,d);"Vertical"===this.displayMode||this.element.className.indexOf("e-device")>-1?m.className="e-rule-container e-vertical-mode":m.className="e-rule-container e-horizontal-mode",this.enableSeparateConnector||m.previousElementSibling&&m.previousElementSibling.className.indexOf("e-rule-container")>-1&&(m.className.indexOf("e-joined-rule")<0&&(m.className+=" e-joined-rule"),m.previousElementSibling.className.indexOf("e-prev-joined-rule")<0&&(m.previousElementSibling.className+=" e-prev-joined-rule")),m.previousElementSibling&&m.previousElementSibling.className.indexOf("e-group-container")>-1&&m.className.indexOf("e-separate-rule")<0&&(m.className+=" e-separate-rule");var f={requestType:"template-create",action:n,ruleID:g.id,fields:this.fields,rule:d};r={groupID:i.id.replace(this.element.id+"_",""),ruleID:g.id.replace(this.element.id+"_",""),value:d.field,type:"field"},this.trigger("actionBegin",f),this.trigger("change",r)}},d.prototype.changeValue=function(e,l){var n,r=this;if(this.isNumInput&&"number"==