@syncfusion/ej2-querybuilder
Version:
Essential JS 2 QueryBuilder
10 lines • 171 kB
JavaScript
/*!
* filename: ej2-querybuilder.min.js
* version : 30.1.39
* 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.
*/
this.ej=this.ej||{},this.ej.querybuilder=function(e,t,l,n,r,i,o,s,a){"use strict";var u=function(){var e=function(t,l){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])})(t,l)};return function(t,l){function n(){this.constructor=t}e(t,l),t.prototype=null===l?Object.create(l):(n.prototype=l.prototype,new n)}}(),d=function(){return(d=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++){t=arguments[l];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)},p=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},c=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"values",void 0),p([t.Property(null)],l.prototype,"operators",void 0),p([t.Property()],l.prototype,"ruleTemplate",void 0),p([t.Property(null)],l.prototype,"template",void 0),p([t.Property({isRequired:!0,min:0,max:Number.MAX_VALUE})],l.prototype,"validation",void 0),p([t.Property(null)],l.prototype,"format",void 0),p([t.Property(null)],l.prototype,"step",void 0),p([t.Property(null)],l.prototype,"value",void 0),p([t.Property(null)],l.prototype,"category",void 0),p([t.Property(null)],l.prototype,"columns",void 0),l}(t.ChildProperty),h=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"condition",void 0),p([t.Collection([],l)],l.prototype,"rules",void 0),p([t.Property(null)],l.prototype,"field",void 0),p([t.Property(null)],l.prototype,"label",void 0),p([t.Property(null)],l.prototype,"type",void 0),p([t.Property(null)],l.prototype,"operator",void 0),p([t.Property(null)],l.prototype,"value",void 0),p([t.Property(!1)],l.prototype,"not",void 0),p([t.Property(null)],l.prototype,"isLocked",void 0),l}(t.ChildProperty),g=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(null)],l.prototype,"numericTextBoxModel",void 0),p([t.Property(null)],l.prototype,"multiSelectModel",void 0),p([t.Property(null)],l.prototype,"datePickerModel",void 0),p([t.Property(null)],l.prototype,"textBoxModel",void 0),p([t.Property(null)],l.prototype,"radioButtonModel",void 0),l}(t.ChildProperty),m=function(e){function l(){return null!==e&&e.apply(this,arguments)||this}return u(l,e),p([t.Property(!1)],l.prototype,"cloneRule",void 0),p([t.Property(!1)],l.prototype,"cloneGroup",void 0),p([t.Property(!1)],l.prototype,"lockRule",void 0),p([t.Property(!1)],l.prototype,"lockGroup",void 0),p([t.Property(!0)],l.prototype,"ruleDelete",void 0),p([t.Property(!0)],l.prototype,"groupInsert",void 0),p([t.Property(!0)],l.prototype,"groupDelete",void 0),l}(t.ChildProperty),f=function(e){function c(t,l){var 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(c,e),c.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},c.prototype.reset=function(){this.isImportRules=!1;for(var e=this.element.querySelector(".e-group-body"),l=this.element.querySelectorAll("input.e-control"),n=0,r=l.length;n<r;n++)l[n].className.indexOf("e-tooltip")>-1?t.getComponent(l[n],"tooltip").destroy():l[n].parentElement.className.indexOf("e-tooltip")>-1&&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&&t.removeClass(this.element.querySelectorAll(".e-qb-toggle"),"e-active-toggle"),e.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),this.disableRuleCondition(e.parentElement)},c.prototype.getWrapper=function(){return this.element},c.prototype.getModuleName=function(){return"query-builder"},c.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},c.prototype.GetRootColumnName=function(e){return t.isNullOrUndefined(e)?"":this.separator?e.split(this.separator)[0]:e},c.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],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(var 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){for(var d=this.columns,a=0,u=d.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"})},c.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},c.prototype.updateSubFields=function(e,t,l){var 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)}},c.prototype.updateCustomOperator=function(e,l){if(e.operators){this.isLocale||"initial"!==l||t.isNullOrUndefined(this.isCustomOprCols)||this.isCustomOprCols.push(e.field);for(var n=this,r=0;r<e.operators.length;r++)!function(t){var l=Object.keys(e.operators[t]).indexOf("sqlOperator");if(l>-1){var r=e.operators[t],i=Object.keys(r),o=i.map(function(e){return r[""+e]}).join(",").split(","),s=i.indexOf("value");n.operators[o[s]]=o[l]}}(r)}},c.prototype.focusEventHandler=function(e){this.target=e.target},c.prototype.clickEventHandler=function(e){var l,n=this,r=e.target;this.isImportRules=!1;var i;if("SPAN"===r.tagName&&(r=r.parentElement),"string"==typeof r.className&&r.className.indexOf("e-collapse-rule")>-1){a=new t.Animation({duration:1e3,delay:0});this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary();var o=document.getElementById(this.element.id+"_summary_content"),s=o.querySelector(".e-summary-text");a.animate(".e-query-builder",{name:"SlideLeftIn"}),(d=this.element.querySelector(".e-group-container")).style.display="none",s.textContent=this.getSqlFromRules(this.rule),o.style.display="block",s.style.height=s.scrollHeight+"px"}if("BUTTON"===r.tagName&&"string"==typeof r.className&&r.className.indexOf("e-qb-toggle")<0){var a=new t.Animation({duration:1e3,delay:0});switch(!0){case r.className.indexOf("e-removerule")>-1:this.actionButton=r,this.deleteRule(r);break;case r.className.indexOf("e-clone-rule-btn")>-1:this.actionButton=r,this.cloneRuleBtnClick=!0,this.ruleClone(r);break;case r.className.indexOf("e-lock-rule-btn")>-1:this.actionButton=r,this.ruleLock(r);break;case r.className.indexOf("e-lock-grp-btn")>-1:this.actionButton=r,this.groupLock(r);break;case r.className.indexOf("e-clone-grp-btn")>-1:this.actionButton=r,this.cloneGrpBtnClick=!0,this.groupClone(t.closest(r,".e-group-container"));break;case r.className.indexOf("e-deletegroup")>-1:this.actionButton=r,this.deleteGroup(t.closest(r,".e-group-container"));break;case r.className.indexOf("e-edit-rule")>-1:if(a.animate(".e-query-builder",{name:"SlideLeftIn"}),document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1){this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not);var u=t.extend({},this.rule,{},!0);this.setGroupRules(u),this.renderSummaryCollapse()}else{var d=this.element.querySelector(".e-group-container");d.querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),d.style.display="block"}}}else if("LABEL"===r.tagName&&r.parentElement.className.indexOf("e-btn-group")>-1||"string"==typeof r.className&&r.className.indexOf("e-qb-toggle")>-1){var p=t.closest(r,".e-group-container");if(!this.headerTemplate){var c=r.getAttribute("for"),h=void 0;c?h=document.getElementById(c).getAttribute("value"):this.enableSeparateConnector&&(h=r.classList.contains("e-btngroup-or-lbl")?"or":r.classList.contains("e-btngroup-and-lbl")?"and":r.textContent),i=p.id.replace(this.element.id+"_","");var g=this.getGroup(i),m=void 0;if(this.enableNotCondition)if(r.className.indexOf("e-qb-toggle")>-1){var f=p.getElementsByClassName("e-qb-toggle")[0];f.className.indexOf("e-active-toggle")>-1?(t.removeClass([f],"e-active-toggle"),m=!1):(t.addClass([f],"e-active-toggle"),m=!0),h=g.condition}else m=g.not;l={groupID:i,cancel:!1,type:"condition",value:h.toLowerCase()},this.enableNotCondition&&(l={groupID:i,cancel:!1,type:"condition",value:h.toLowerCase(),not:m})}this.isImportRules?this.beforeSuccessCallBack(l,r):this.trigger("beforeChange",l,function(e){n.beforeSuccessCallBack(e,r)}),this.target=r}},c.prototype.beforeSuccessCallBack=function(e,l){if(e&&!e.cancel){var n=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=t.isNullOrUndefined(t.closest(l,".e-rule-container"))&&n.classList.contains("e-group-container")?null!==l.parentElement.previousElementSibling?l.parentElement.previousElementSibling:n: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))}}},c.prototype.selectBtn=function(e,l){"beforeOpen"===l.name?this.showButtons.groupInsert||t.isNullOrUndefined(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?t.addClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):t.removeClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&t.addClass([l.element.querySelector("li").parentElement],"e-rtl")):t.addClass([l.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):l.element.children[0].className.indexOf("e-addrule")>-1?this.addRuleElement(t.closest(e,".e-group-container"),{}):l.element.children[0].className.indexOf("e-addgroup")>-1&&this.addGroupElement(!0,t.closest(e,".e-group-container"),"",!0)},c.prototype.appendRuleElem=function(e,l,n,r,i,o){var s,a,u,d=e.querySelector(".e-rule-list");if("change"===n)s=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),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&&t.removeClass(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&t.removeClass(s.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&t.removeClass(s.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&t.removeClass(s.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&t.removeClass(s.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&t.removeClass(s.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),l&&l.ruleTemplate&&o&&this.renderReactTemplates(),s},c.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)})}},c.prototype.addRuleSuccessCallBack=function(e,l,r,i,o,s,a){var u,p,c,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,p=this.selectedColumn.operators,f={label:m.label,field:m.field,type:m.type,operator:p[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"),t.addClass([b],"e-flat"),t.addClass([b],"e-primary");else{t.addClass([b],"e-round"),t.addClass([b],"e-icon-btn"),b.setAttribute("title",this.l10n.getConstant("DeleteRule"));var C=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}});h.querySelector(".e-rule-delete").appendChild(C)}this.showButtons.ruleDelete||b.classList.add("e-button-hide")}"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")&&(S=(q=S.querySelectorAll(".e-rule-container"))[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(t.isNullOrUndefined(S)&&h.id!==this.element.id+"_group0_rule0")if((B=h.closest(".e-group-container"))&&B.previousElementSibling){var E=(D=B.previousElementSibling).querySelectorAll(".e-rule-container");if(D.classList.contains("e-group-container")&&(D=E[E.length-1]),D.classList.contains("e-rule-container")){var O=this.getRule(D);this.headerTemplateFn(D,!1,O.condition,O,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.GetRootColumnName(r.field):this.autoSelectField?this.GetRootColumnName(r.field):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=d({},k,this.fieldModel)),(c=new n.DropDownList(k)).appendTo("#"+h.id+"_filterkey");R=void 0;R=this.separator&&r.field?this.GetRootColumnName(r.field):this.isImportRules?this.GetRootColumnName(r.field):c.value,this.selectedColumn=c.getDataByValue(R),Object.keys(r).length&&this.changeRule(r,{element:c.element,itemData:this.selectedColumn})}else{var k=void 0,w=(this.isImportRules,r.field);this.dummyDropdownTreeDs=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: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=d({},k,this.fieldModel));var N=new n.DropDownTree(k);if(N.appendTo("#"+h.id+"_filterkey"),!t.isNullOrUndefined(N.value)){var L=this.getLabelFromColumn(N.value[0]);N.element.value=L}var R=t.isNullOrUndefined(r.field)?N.value:this.GetRootColumnName(r.field);this.selectedColumn=this.getColumn(R),Object.keys(r).length&&this.changeRule(r,{element:N.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&&t.isNullOrUndefined(r.condition)&&u&&(r=this.getRule(u)),this.enableSeparateConnector){for(var D=h.previousElementSibling,q=void 0;D&&!D.classList.contains("e-rule-container");){if(D.classList.contains("e-group-container")){D=(q=D.querySelectorAll(".e-rule-container"))[q.length-1];break}D=D.previousElementSibling}if(this.headerTemplate&&D){var x=this.getRule(D),I={requestType:"rule-template-create",ruleID:D.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",I)}else if(t.isNullOrUndefined(D)&&h.id!==this.element.id+"_group0_rule0"){var B=h.closest(".e-group-container");if(B&&B.previousElementSibling&&B.previousElementSibling.previousElementSibling){var A=B.previousElementSibling.previousElementSibling;if(A.classList.contains("e-group-container")){var P=A.querySelectorAll(".e-rule-container");A=P[P.length-1]}if(A.classList.contains("e-rule-container")){var x=this.getRule(A),G={requestType:"rule-template-create",ruleID:A.id,condition:x.condition,notCondition:!!this.enableNotCondition||void 0};this.trigger("actionBegin",G)}}}this.setMultiConnector(h)}},c.prototype.dropdownTreeFiltering=function(e){var l=this,n=this,r="",i=e.event.srcElement;r=(i.classList.contains("e-clear-icon")?i.parentElement.querySelector(".e-textbox"):i).id.split("_filterkey")[0];var o=document.getElementById(r);this.ddTree=t.getComponent(o.querySelector("input.e-dropdowntree"),"dropdowntree");var s=t.extend([],this.columns,[],!0);if(e.cancel=!0,""===e.text)this.changeDataSource(s);else{var a=s.map(function(t){return l.nestedChildFilter(e.text,t)}).filter(function(e){return null!==e});this.changeDataSource(a),setTimeout(function(){t.isNullOrUndefined(n.ddTree)||t.isNullOrUndefined(n.ddTree.treeObj)||n.ddTree.treeObj.expandAll()},100)}},c.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()},c.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)},c.prototype.isMatchedNode=function(e,t){var l=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==l.indexOf(e)},c.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource(t.extend([],this.columns,[],!0)),this.ddTree=null},c.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},c.prototype.updateAddedRule=function(e,l,n,r,i,o){var s,a,u,d=0;if(r){for(s=t.select("#"+i,e),a=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=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)},c.prototype.changeRuleTemplate=function(e,l){if(!e||!e.ruleTemplate){var n=t.closest(l,".e-group-container"),r=t.closest(l,".e-rule-container").id;if(this.previousColumn&&this.previousColumn.ruleTemplate&&(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)}}},c.prototype.renderToolTip=function(e){var t=new a.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){var t=e.element.querySelector(".e-tooltip-close");t&&(t.style.display="none")}});t.appendTo(e),t.open(e)},c.prototype.validateFields=function(){var e,l=!0;if(this.allowValidation){var n=["isnull","isnotnull","isempty","isnotempty"],r=void 0,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(r=0,i=g.length;r<i;r++){var m=void 0;if(u=t.closest(g[r],".e-group-container"),h=this.getParentGroup(u),d=0,s=c=g[r],"DropdownTree"===this.fieldMode?(e=t.getComponent(g[r].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=t.getComponent(g[r].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&p.value&&(this.selectedColumn=p.getDataByValue(p.value),m=!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),n.indexOf(h.rules[d].operator)<-1&&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){S=c.querySelectorAll(".e-rule-value .e-control");n.indexOf(h.rules[d].operator)<0&&(l=!1);for(var v=0,y=S.length;v<y;v++){var b=S[v],C=void 0;b.parentElement.className.indexOf("e-searcher")>-1?(C=t.closest(b,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(C):S[v].parentElement.className.indexOf("e-tooltip")<0&&S[v].className.indexOf("e-tooltip")<0&&this.renderToolTip(S[v].parentElement),v++}}else if("date"===h.rules[d].type&&(null===h.rules[d].value||h.rules[d].value.indexOf(null)>-1)){var S=c.querySelectorAll(".e-rule-value .e-control");n.indexOf(h.rules[d].operator)<0&&(l=!1);for(var v=0,y=S.length;v<y;v++)S[v].parentElement.className.indexOf("e-tooltip")<0&&S[v].className.indexOf("e-tooltip")<0&&(t.isNullOrUndefined(h.rules[d].value)||null==h.rules[d].value[v])&&this.renderToolTip(S[v].parentElement)}}else(p&&p.element&&t.isNullOrUndefined(p.value)||e&&e.element&&(t.isNullOrUndefined(e.value)||e.value.length<1))&&(o.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(o.parentElement),l=!1)}}return l},c.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");if(e){this.levelColl[e.id]=[0];var t={groupElement:e,level:[0]};this.refreshLevel(t)}},c.prototype.refreshLevel=function(e){var l,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=t.closest(i,".e-rule-list");return e.groupElement=a?t.closest(a,".e-group-container"):i,e.level=this.levelColl[e.groupElement.id].slice(),e},c.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},c.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||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},c.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)})},c.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"),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||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")),t.rippleEffect(h,{selector:".deletegroup"});for(var S=c.querySelector(".e-rule-list"),x=S.children,q=0,E=0,O=x.length;E<O;E++)x[E].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=this.groupIndex+1;x[L].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){A="";A=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:A}}),D=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}});T.appendChild(D),m.querySelector(".e-group-action").appendChild(T),A=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 I=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:A}}),B=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});I.appendChild(B),m.querySelector(".e-group-action").appendChild(I),m.querySelector(".e-group-action").appendChild(h)}}else{if(!this.headerTemplate){var A="";A=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 I=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:A}}),D=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}});I.appendChild(D),m.querySelector(".e-group-action").appendChild(I)}c.appendChild(m),this.levelColl[m.id]=[0]}if(this.enableNotCondition&&!this.headerTemplate){var P=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(P),m.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule&&this.updatedRule.not&&t.addClass([P],"e-active-toggle")}if(this.enableSeparateConnector&&!this.headerTemplate){for(var G=m.querySelector(".e-btngroup-and"),M=m.querySelector(".e-btngroup-or"),V=m.querySelector(".e-btn-group"),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&&(t.isNullOrUndefined(this.headerTemplate)&&(m.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),m),(P=m.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(P.style.display="none")),!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 H=m.querySelector(".e-add-condition-btn");(z=new l.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(H),z.element.onclick=function(){p.addRuleElement(t.closest(H,".e-group-container"),{})};var Q=m.querySelector(".e-add-group-btn");(z=new l.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(Q),z.element.onclick=function(){p.addGroupElement(!0,t.closest(Q,".e-group-container"),"",!0)}}else{var W=m.querySelector(".e-add-btn"),z=new s.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,W),select:this.selectBtn.bind(this,W)});z.appendTo(W),W.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})}}},c.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)}},c.prototype.addHeaderDiv=function(e){var l,n=e.previousElementSibling.previousElementSibling;if(n){l=n.id.indexOf("rule")>-1?this.getRule(n):this.getGroup(n),!t.isNullOrUndefined(l)&&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,t.isNullOrUndefined(l)||"or"!==l.condition?i.checked=!0:r.checked=!0}},c.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):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},c.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)},c.prototype.notifyChange=function(e,l,n){var r=t.closest(l,".e-group-container"),i=this.getParentGroup(r),o=t.closest(l,".e-rule-container"),s=0;if("not"===n)return void(i.not=e);if("condition"===n)return void(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);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)},c.prototype.templateChange=function(e,l,n){var r,i=t.closest(e,".e-group-container"),o=this.getParentGroup(i),s=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=o.rules[a];"field"===n?this.selectedColumn=this.getColumn(l):u&&(this.selectedColumn=this.getColumn(u.field));var d;this.previousColumn=this.getColumn(u.field);var p=this.getValidRules(this.rule);this.selectedColumn&&(d=this.selectedColumn.operators?this.selectedColumn.operators:this.customOperators[this.selectedColumn.type+"Operator"]);var c,h=["in","notin","between","notbetween"];switch(n){case"field":t.isNullOrUndefined(l)?(u.field="",u.label="",u.type="",u.value="",u.operator=""):(u.field=l,u.label=this.selectedColumn.label,u.type=this.selectedColumn.type,u.value="",u.operator=d[0].value);break;case"operator":c=u.operator,u.operator=l,h.indexOf(u.operator)>-1?u.value=[]:h.indexOf(c)>-1&&(u.value="");break;case"value":u.value=l}if(this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(p,this.getValidRules(this.rule),n),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"===n||"operator"===n)){var g=t.closest(e,".e-rule-container");this.destroyControls(g,!0),t.detach(g.querySelector(".e-rule-field"));var m=this.appendRuleElem(t.closest(g,".e-group-container"),this.selectedColumn,"change",g.id,n,u);"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:u};r={groupID:i.id.replace(this.element.id+"_",""),ruleID:g.id.replace(this.element.id+"_",""),value:u.field,type:"field"},this.trigger("actionBegin",f),this.trigger("change",r)}},c.prototype.changeValue=function(e,l){var n,r=this;if(this.isNumInput&&"number"==typeof l.value||"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")&&this.selectedColumn.validation&&(this.selectedColumn.validation.max!==Number.MAX_VALUE||this.selectedColumn.validation.min>0))return void(this.isNumInput=!1);if(n=l.element&&l.element.classList.contains("e-multiselect")?l.element:l.event?l.event.target:"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")?l.currentTarget:l.element){(n.className.indexOf("e-day")>-1||n.className.indexOf("e-today")>-1||n.className.indexOf("e-cell")>-1)&&(n=l.element);var o,s=t.closest(n,".e-group-container"),a=t.closest(n,".e-rule-container"),u=s&&s.id.replace(this.element.id+"_",""),d=a.id.replace(this.element.id+"_",""),p=l;p.element&&p.element.className.indexOf("e-datepicker")>-1&&(n=p.element,(o=t.getComponent(t.closest(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=o.getDataByValue(o.value)),(o=t.getComponent(t.closest(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(o.value[0])));var c,h;if(n.className.indexOf("e-radio")>-1)h=parseInt(n.id.split("valuekey")[1],10),"Default"===this.fieldMode?(o=t.getComponent(t.closest(n,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=o.getDataByValue(o.value),this.selectedColumn.columns&&(o=t.getComponent(t.closest(n,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(o.value))):(o=t.getComponent(t.closest(n,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(o.value[0])),c=this.selectedColumn.values?this.selectedColumn.values[h]:[!0,!1][h];else if(n.className.indexOf("e-multiselect")>-1)c=t.getComponent(n,"multiselect").value;else if(c=l.value,"input"===l.type&&l.target&&l.target.classList.contains("e-numerictextbox")){c=Number(l.currentTarget.value);var g=l.currentTarget,m=t.getInstance(g,i.NumericTextBox),f=t.getValue("decimal",t.getNumericObject(this.locale));isNa