@syncfusion/ej2-querybuilder
Version:
Essential JS 2 QueryBuilder
1 lines • 179 kB
JavaScript
!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 c={};return(()=>{d.r(c),d.d(c,{Columns:()=>m,QueryBuilder:()=>y,QueryLibrary:()=>b,Rule:()=>g,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)}),p=function(){return p=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},p.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},m=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),g=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,r.isRuleClicked=!1,r.groupCloned=!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;var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),n=0,r=function(){for(var e=Math.min(n+20,l.length),i=n;i<e;i++){var o=l[i];try{if(o.className.indexOf("e-tooltip")>-1)(s=(0,t.getComponent)(o,"tooltip"))&&s.destroy();else if(o.parentElement&&o.parentElement.className.indexOf("e-tooltip")>-1){var s;(s=(0,t.getComponent)(o.parentElement,"tooltip"))&&s.destroy()}}catch(e){console.warn("Error destroying tooltip:",e)}}(n=e)<l.length&&requestAnimationFrame(r)};if(l.length>0&&r(),e)e.textContent="";else{var i=document.createDocumentFragment(),o=this.createElement("div",{attrs:{class:"e-group-container"}}),s=this.createElement("div",{attrs:{class:"e-group-header"}}),a=this.createElement("div",{attrs:{class:"e-group-body"}});o.appendChild(s),o.appendChild(a),i.appendChild(o),this.element.appendChild(i),e=this.element.querySelector(".e-group-body")}if(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++)(0,t.removeClass)([u[d]],"e-active-toggle");e&&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),e&&e.parentElement&&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(){var e=this;if(this.dataColl.length){var t,l,n=Object.keys(this.dataColl[0]),r=[],i=[],o=!1,s=!1,a={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort(),this.columns.forEach(function(r){e.updateCustomOperator(r,"initial"),r.type||(n.indexOf(r.field)>-1&&(l=e.dataColl[0][r.field],"string"===(t=typeof l)?s=!isNaN(Date.parse(l)):"object"===t&&(s=l instanceof Date&&!isNaN(l.getTime()),t="string"),r.type=t,s=!1),t="string"),r.validation||(r.validation=a),r.category?o=!0:r.category=e.l10n.getConstant("OtherFields"),i.indexOf(r.category)<0&&i.push(r.category),(!r.operators||e.isLocale&&-1===e.isCustomOprCols.indexOf(r.field))&&(r.operators=e.customOperators[r.type+"Operator"])}),o&&(i.length>1||i[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(var u=0,d=n.length;u<d;u++)l=this.dataColl[0][n[u]],"string"===(t=typeof l)?s=!isNaN(Date.parse(l)):"object"!==t||Object.keys(l).length||(s=l instanceof Date&&!isNaN(l.getTime()),t="string"),r[u]={field:n[u],label:n[u],type:s?"date":t,validation:a},s=!1,r[u].operators=this.customOperators[r[u].type+"Operator"],"object"===t&&this.updateSubFields(l,r[u]);this.columns=r}}else this.columns&&this.columns.length&&("Default"!==this.sortDirection&&this.columnSort(),this.processColumnsInBatches(),this.columns.length>50?setTimeout(function(){e.updateSubFieldsFromColumns(e.columns)},0):this.updateSubFieldsFromColumns(this.columns));this.trigger("dataBound",{type:"dataBound"})},d.prototype.processColumnsInBatches=function(){var e=this,t=this.columns,l=0,n=function(){for(var r=Math.min(l+10,t.length),i=l;i<r;i++)t[i].category&&t[i].category!==e.l10n.getConstant("OtherFields")?e.fields={text:"label",value:"field",groupBy:"category"}:t[i].category=e.l10n.getConstant("OtherFields"),e.updateCustomOperator(t[i],"initial"),(!t[i].operators||e.isLocale&&-1===e.isCustomOprCols.indexOf(t[i].field))&&(t[i].operators=e.customOperators[t[i].type+"Operator"]);(l=r)<t.length&&requestAnimationFrame(n)};n()},d.prototype.updateSubFieldsFromColumns=function(e,t){if(e.length>50)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))},d.prototype.updateSubFieldsLarge=function(e,t){var l=this,n=0,r=e.length,i=function(){for(var o=Math.min(n+10,r);n<o;n++)""!==l.separator&&e[n].field.indexOf(l.separator)<0&&(e[n].field=t?t+l.separator+e[n].field:e[n].field),e[n].operators?l.updateCustomOperator(e[n]):e[n].type&&"object"!==e[n].type&&(e[n].operators=l.customOperators[e[n].type+"Operator"]);n<r?requestAnimationFrame(i):setTimeout(function(){for(var t=0;t<r;t++)e[t].columns&&(e[t].type="object",l.updateSubFieldsFromColumns(e[t].columns,e[t].field))},0)};i()},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.isRuleClicked=!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=this.groupCloned=!0,this.isRuleClicked=!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 c=(0,t.closest)(i,".e-group-container");if(!this.headerTemplate){var p=i.getAttribute("for"),h=void 0;p?h=document.getElementById(p).getAttribute("value"):this.enableSeparateConnector&&(h=i.classList.contains("e-btngroup-or-lbl")?"or":i.classList.contains("e-btngroup-and-lbl")?"and":i.textContent),n=c.id.replace(this.element.id+"_","");var m=this.getGroup(n),g=void 0;if(this.enableNotCondition)if(i.className.indexOf("e-qb-toggle")>-1){var f=c.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?((0,t.removeClass)([f],"e-active-toggle"),g=!1):((0,t.addClass)([f],"e-active-toggle"),g=!0),h=m.condition}else g=m.not;l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:n,cancel:!1,type:"condition",value:h.toLowerCase(),not:g})}this.isImportRules?this.beforeSuccessCallBack(l,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.isRuleClicked=!0,this.addRuleElement((0,t.closest)(e,".e-group-container"),{})):l.element.children[0].className.indexOf("e-addgroup")>-1&&(this.isRuleClicked=!0,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&&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 c=-1,p=this.ruleIndex+1,h=0;h<p&&h!==d.children.length;h++)d.children[h].classList.contains("e-rule-container")&&(p++,c++);d.insertBefore(s,d.children[this.ruleIndex+c+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 m=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,m)[0]).className+=" e-rule-field",s.appendChild(a);else if(this.isAngular){var g=this.ruleTemplateFn(u,this,s.id,m);(a=3===g[0].nodeType?g[1]:g[0]).className+=" e-rule-field",s.appendChild(a)}else this.isVue3?(a=this.ruleTemplateFn(u,this,"Template",m),(0,t.append)(a,s),s.children.length&&(s.children[s.children.length-1].className+=" e-rule-field")):((a=this.ruleTemplateFn(u,this,"Template",m)[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,n,r,i,o,s){var a,u,d,c=this,p=this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode,h=p?"250px":"200px",m=n&&n.field?this.getColumn(n.field):r||this.columns[0],g={label:"",field:"",type:"",operator:""};if(!e.cancel){if(m&&m.ruleTemplate&&n.field){this.selectedColumn=m,u=this.selectedColumn.operators,g={label:m.label,field:m.field,type:m.type,operator:u[0].value};var f=Object.keys(n).length?n:g,v={requestType:"template-initialize",ruleID:(d=this.appendRuleElem(l,m,i,o,"field",f)).id,action:"insert-rule",fields:this.fields,rule:f};this.trigger("actionBegin",v),setTimeout(function(){var e={requestType:"template-create",ruleID:d.id,action:"insert-rule",fields:c.fields,rule:f};c.trigger("actionBegin",e)},0)}else{(d=this.appendRuleElem(l,m,i,o,"field")).querySelector(".e-filter-input").setAttribute("id",d.id+"_filterkey");var y=d.querySelector(".e-rule-delete");if(this.element.className.indexOf("e-device")>-1||"Vertical"===this.displayMode)y.textContent=this.l10n.getConstant("Remove"),(0,t.addClass)([y],"e-flat"),(0,t.addClass)([y],"e-primary");else{(0,t.addClass)([y],"e-round"),(0,t.addClass)([y],"e-icon-btn"),y.setAttribute("title",this.l10n.getConstant("DeleteRule"));var b=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});y.appendChild(b)}this.showButtons.ruleDelete||y.classList.add("e-button-hide")}d.className="e-rule-container "+(p?"e-vertical-mode":"e-horizontal-mode");var C=d.previousElementSibling;this.processAdjacentElements(d,C,n),this.isImportRules||this.updateAddedRule(l,n,g,s,o,!!this.enableSeparateConnector||null),""===this.rule.condition&&(this.isRuleClicked||this.rule.rules.length>1)&&(this.rule.condition="and"),this.isRuleClicked=!1;var S=this.rule.rules.length;if(m&&(!m||m.ruleTemplate)&&n.field||(S>20?setTimeout(function(){c.applyFieldComponent(d,n,h)},0):this.applyFieldComponent(d,n,h)),a=d.id.replace(this.element.id+"_",""),n&&n.isLocked){var x=d.querySelector(".e-lock-rule-btn");this.ruleLock(x)}this.isImportRules||this.prvtEvtTgrDaD||this.trigger("change",{groupID:l.id.replace(this.element.id+"_",""),ruleID:a,type:"insertRule"})}this.enableSeparateConnector&&(0,t.isNullOrUndefined)(n.condition)&&a&&(n=this.getRule(a)),this.enableSeparateConnector&&this.processConnectorElements(d)},d.prototype.processAdjacentElements=function(e,l,n){if(this.enableSeparateConnector){if(l&&l.classList.contains("e-group-container")){var r=l.querySelectorAll(".e-rule-container");l=r[r.length-1]}if(l&&l.classList.contains("e-rule-container")){var i=this.getRule(l);this.headerTemplate&&this.headerTemplateFn(l,!1,i.condition,i,l.id)}else(0,t.isNullOrUndefined)(l)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedRuleElement(e,n)}else l&&l.className.indexOf("e-rule-container")>-1&&(e.classList.add("e-joined-rule"),l.classList.add("e-prev-joined-rule"));l&&l.className.indexOf("e-group-container")>-1&&e.className.indexOf("e-separate-rule")<0&&(e.className+=" e-separate-rule")},d.prototype.handleOrphanedRuleElement=function(e,t){var l=e.closest(".e-group-container");if(l&&l.previousElementSibling){var n=l.previousElementSibling,r=n.querySelectorAll(".e-rule-container");if(n.classList.contains("e-group-container")&&(n=r[r.length-1]),n.classList.contains("e-rule-container")){var i=this.getRule(n);this.headerTemplateFn(n,!1,i.condition,i,n.id,!0)}}else this.headerTemplateFn(e,!1,t.condition,t,e.id,!0)},d.prototype.processConnectorElements=function(e){for(var l,n=e.previousElementSibling;n&&!n.classList.contains("e-rule-container");){if(n.classList.contains("e-group-container")){l=n.querySelectorAll(".e-rule-container"),n=l[l.length-1];break}n=n.previousElementSibling}if(this.headerTemplate&&n){var r=this.getRule(n),i={requestType:"rule-template-create",ruleID:n.id,condition:r.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",i)}else(0,t.isNullOrUndefined)(n)&&e.id!==this.element.id+"_group0_rule0"&&this.handleOrphanedConnectorElement(e);this.setMultiConnector(e)},d.prototype.handleOrphanedConnectorElement=function(e){var t=e.closest(".e-group-container");if(t&&t.previousElementSibling&&t.previousElementSibling.previousElementSibling){var l=t.previousElementSibling.previousElementSibling;if(l.classList.contains("e-group-container")){var n=l.querySelectorAll(".e-rule-container");l=n[n.length-1]}if(l.classList.contains("e-rule-container")){var r=this.getRule(l),i={requestType:"rule-template-create",ruleID:l.id,condition:r.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",i)}}},d.prototype.applyFieldComponent=function(e,t,l){"Default"===this.fieldMode?this.applyDropdownListComponent(e,t,l):this.applyDropdownTreeComponent(e,t,l)},d.prototype.applyDropdownListComponent=function(e,t,l){var r,i;i=this.separator&&t.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(t.field):t.field,r={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:this.columns.length>5?l:"auto",close:this.fieldClose.bind(this,e.id+"_filterkey"),change:this.changeField.bind(this),value:t?i:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(r=p({},r,this.fieldModel));var o,s=new n.DropDownList(r);s.appendTo("#"+e.id+"_filterkey"),o=this.separator&&t.field||this.isImportRules?this.GetRootColumnName(t.field):s.value,this.selectedColumn=s.getDataByValue(o),Object.keys(t).length&&this.changeRule(t,{element:s.element,itemData:this.selectedColumn})},d.prototype.applyDropdownTreeComponent=function(e,l,r){var i,o=(this.isImportRules,l.field);this.dummyDropdownTreeDs=(0,t.extend)([],this.columns,[],!0),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),i={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?r:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:(0,t.isNullOrUndefined)(o)?null:[o],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&&(i=p({},i,this.fieldModel));var s=new n.DropDownTree(i);if(s.appendTo("#"+e.id+"_filterkey"),!(0,t.isNullOrUndefined)(s.value)){var a=this.getLabelFromColumn(s.value[0]);s.element.value=a}var u=(0,t.isNullOrUndefined)(l.field)?s.value:this.GetRootColumnName(l.field);this.selectedColumn=this.getColumn(u),Object.keys(l).length&&this.changeRule(l,{element:s.element,itemData:this.selectedColumn})},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 c=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&&!c||d++}u.rules[d]=l}else{a=(0,t.closest)(e,".e-group-container"),u=this.getParentGroup(a);var p=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}),p&&(u.rules[u.rules.length-1].custom=p),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}),p&&(u.rules[this.ruleIndex+1].custom=p),this.enableSeparateConnector&&(u.rules[this.ruleIndex+1].condition=l.condition?l.condition:n.condition)):(p&&(n.custom=p),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,c=void 0,p=void 0,h=void 0,m=this.element.querySelectorAll(".e-rule-container");for(i=0,n=m.length;i<n;i++){var g=void 0;if(u=(0,t.closest)(m[i],".e-group-container"),h=this.getParentGroup(u),d=0,s=p=m[i],"DropdownTree"===this.fieldMode?(e=(0,t.getComponent)(m[i].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),g=this.selectedColumn.validation):(c=(0,t.getComponent)(m[i].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&c.value&&(this.selectedColumn=c.getDataByValue(c.value),g=!(0,t.isNullOrUndefined)(c.value)&&this.selectedColumn.validation),o=p.querySelector(".e-rule-field input.e-control"),g&&g.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=p.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=p.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=p.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(c&&c.element&&(0,t.isNullOrUndefined)(c.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 c=this.createElement("span",{attrs:{class:n,"aria-label":"drag handle",title:"drag handle"}});a.appendChild(c);var p=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group";t=this.createElement("div",{attrs:{class:p,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}}),c=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});d.appendChild(c);var p=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:r}});c=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),p.appendChild(c),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(p),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 c=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var p=r,h=void 0,m="";m=p.className.indexOf("e-group-container")<0?p.querySelector(".e-group-container")&&p.querySelector(".e-group-container").id:p.id,this.enableSeparateConnector&&(this.groupElem=this.groupTemplate());var g=this.groupElem.cloneNode(!0);if(g.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&g.querySelector(".e-drag-qb-rule")&&(g&&g.children[0]&&g.children[0].classList.add("e-parent-header"),(0,t.addClass)([g.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(u?(n=!1,g.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(g,a,i,d,m),this.groupIdCounter=0):this.headerTemplateFn(g,a,i,d,m)),this.groupIdCounter++,!this.headerTemplate){var f=g.querySelector(".e-btngroup-and"),v=g.querySelector(".e-btngroup-or"),y=g.querySelector(".e-btngroup-and-lbl"),b=g.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=p.querySelector(".e-rule-list"),x=S.children,E=0,q=0,O=x.length;q<O;q++)x[q].className.indexOf("e-group-container")>-1&&(E+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===x.length-1)S.appendChild(g),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(g,x[L])}else{var L;x[L=this.groupIndex+1].parentNode.insertBefore(g,x[L])}this.isMiddleGroup=!0}else S.appendChild(g);var R=this.levelColl[p.id].slice(0);if(R.push(E),this.levelColl[g.id]=R,this.groupIndex>-1&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],p.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,o&&this.addRuleToNewGroups&&this.addRuleElement(g,{})),!this.headerTemplate){var D="";D=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 T=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:D}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});T.appendChild(I),g.querySelector(".e-group-action").appendChild(T),D=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:D}}),A=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(A),g.querySelector(".e-group-action").appendChild(B),g.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){D="";D=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:D}}),I=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});B.appendChild(I),g.querySelector(".e-group-action").appendChild(B)}p.appendChild(g),this.levelColl[g.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var P=g.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(P),g.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&(0,t.addClass)([P],"e-active-toggle")}if(this.enableSeparateConnector&&!this.headerTemplate){var M=g.querySelector(".e-btngroup-and"),G=g.querySelector(".e-btngroup-or"),V=g.querySelector(".e-btn-group");for(N=0;N<V.childNodes.length;N++)"not"===g.querySelector(".e-btn-group").childNodes[N].textContent.toLowerCase()&&this.enableNotCondition?V.childNodes[N].classList.add("e-multiconnector"):V.childNodes[N].style.display="none";if(g.previousElementSibling){if((0,t.isNullOrUndefined)(this.headerTemplate))g.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),g),(P=g.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(P.style.display="none");if(!this.isImportRules){var F=g.previousElementSibling,U=F.querySelector(".e-btngroup-and"),_=F.querySelector(".e-btngroup-or");if(M.checked||G.checked)this.enableSeparateConnector&&(M.checked&&(U.checked=!0),G.checked&&(_.checked=!0));else{var j=g.nextElementSibling;j&&j.classList.contains("e-btn-group")&&(M=j.querySelector(".e-btngroup-and"),G=j.querySelector(".e-btngroup-or"),U.checked=M.checked,_.checked=G.checked)}}}}if(this.updatedRule=null,this.headerTemplate){var $={requestType:"header-template-create",ruleID:g.id,condition:i,notCondition:this.enableNotCondition?a:void 0};this.trigger("actionBegin",$)}else if(this.enableSeparateConnector){var Q=g.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(){c.addRuleElement((0,t.closest)(Q,".e-group-container"),{})};var H=g.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(){c.addGroupElement(!0,(0,t.closest)(H,".e-group-container"),"",!0)}}else{var W,z=g.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=p.id.replace(this.element.id+"_",""),K=g.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){var t=this.groupTemplate(!0).querySelector(".e-btn-group");if(t){e.parentElement.insertBefore(t,e);var l=e.previousElementSibling.childNodes[0];l.classList.contains("e-qb-toggle")&&(l.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 c=this.headerFn(a,this,e.id,u);s=3===c[0].nodeType?c[1]:c[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 p=0;p<s.length;p++)if("DIV"===s[p].nodeName){s=s[p];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 c=0;c<e.length;c++)e[c]&&e[c]instanceof Date&&(e[c]=this.intl.formatDate(e[c],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=i&&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&&o.rules[a];"field"===n?this.selectedColumn=this.getColumn(l):d&&(this.selectedColumn=this.getColumn(d.field)),this.previousColumn=d&&this.getColumn(d.field);var c=this.getValidRules(this.rule);this.selectedColumn&&(u=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var p,h=["in","notin","between","notbetween"];switch(n){case"field":if((0,t.isNullOrUndefined)(l)){if((0,t.isNullOrUndefined)(d))return;