UNPKG

@syncfusion/ej2-querybuilder

Version:
10 lines 168 kB
/*! * filename: ej2-querybuilder.umd.min.js * version : 30.1.40 * Copyright Syncfusion Inc. 2001 - 2024. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-calendars"),require("@syncfusion/ej2-splitbuttons"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-buttons","@syncfusion/ej2-dropdowns","@syncfusion/ej2-data","@syncfusion/ej2-inputs","@syncfusion/ej2-calendars","@syncfusion/ej2-splitbuttons","@syncfusion/ej2-popups"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Buttons,e.ej2Dropdowns,e.ej2Data,e.ej2Inputs,e.ej2Calendars,e.ej2Splitbuttons,e.ej2Popups)}(this,function(e,L,N,y,h,c,v,R,s){"use strict";n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var l in t)t.hasOwnProperty(l)&&(e[l]=t[l])}))(e,t)};var n,t,l=function(e,t){function l(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(l.prototype=t.prototype,new l)},b=function(){return(b=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var i in t=arguments[l])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=function(e,t,l,n){var i,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,l):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,l,n);else for(var s=e.length-1;0<=s;s--)(i=e[s])&&(r=(o<3?i(r):3<o?i(t,l,r):i(t,l))||r);return 3<o&&r&&Object.defineProperty(t,l,r),r},o=(t=L.ChildProperty,l(r,t),i([L.Property(null)],r.prototype,"field",void 0),i([L.Property(null)],r.prototype,"label",void 0),i([L.Property(null)],r.prototype,"type",void 0),i([L.Property(null)],r.prototype,"values",void 0),i([L.Property(null)],r.prototype,"operators",void 0),i([L.Property()],r.prototype,"ruleTemplate",void 0),i([L.Property(null)],r.prototype,"template",void 0),i([L.Property({isRequired:!0,min:0,max:Number.MAX_VALUE})],r.prototype,"validation",void 0),i([L.Property(null)],r.prototype,"format",void 0),i([L.Property(null)],r.prototype,"step",void 0),i([L.Property(null)],r.prototype,"value",void 0),i([L.Property(null)],r.prototype,"category",void 0),i([L.Property(null)],r.prototype,"columns",void 0),r);function r(){return null!==t&&t.apply(this,arguments)||this}a=L.ChildProperty,l(d,a),i([L.Property(null)],d.prototype,"condition",void 0),i([L.Collection([],d)],d.prototype,"rules",void 0),i([L.Property(null)],d.prototype,"field",void 0),i([L.Property(null)],d.prototype,"label",void 0),i([L.Property(null)],d.prototype,"type",void 0),i([L.Property(null)],d.prototype,"operator",void 0),i([L.Property(null)],d.prototype,"value",void 0),i([L.Property(!1)],d.prototype,"not",void 0),i([L.Property(null)],d.prototype,"isLocked",void 0);var a,u=d;function d(){return null!==a&&a.apply(this,arguments)||this}p=L.ChildProperty,l(m,p),i([L.Property(null)],m.prototype,"numericTextBoxModel",void 0),i([L.Property(null)],m.prototype,"multiSelectModel",void 0),i([L.Property(null)],m.prototype,"datePickerModel",void 0),i([L.Property(null)],m.prototype,"textBoxModel",void 0),i([L.Property(null)],m.prototype,"radioButtonModel",void 0);var p,g=m;function m(){return null!==p&&p.apply(this,arguments)||this}f=L.ChildProperty,l(S,f),i([L.Property(!1)],S.prototype,"cloneRule",void 0),i([L.Property(!1)],S.prototype,"cloneGroup",void 0),i([L.Property(!1)],S.prototype,"lockRule",void 0),i([L.Property(!1)],S.prototype,"lockGroup",void 0),i([L.Property(!0)],S.prototype,"ruleDelete",void 0),i([L.Property(!0)],S.prototype,"groupInsert",void 0),i([L.Property(!0)],S.prototype,"groupDelete",void 0);var f,C=S;function S(){return null!==f&&f.apply(this,arguments)||this}x=L.Component,l(q,x),q.prototype.getPersistData=function(){return this.addOnPersist(["rule"])},q.prototype.reset=function(){this.isImportRules=!1;for(var e,t,l,n=this.element.querySelector(".e-group-body"),i=this.element.querySelectorAll("input.e-control"),o=0,r=i.length;o<r;o++)-1<i[o].className.indexOf("e-tooltip")?L.getComponent(i[o],"tooltip").destroy():-1<i[o].parentElement.className.indexOf("e-tooltip")&&L.getComponent(i[o].parentElement,"tooltip").destroy();n?n.innerHTML="":(e=this.createElement("div",{attrs:{class:"e-group-container"}}),t=this.createElement("div",{attrs:{class:"e-group-header"}}),l=this.createElement("div",{attrs:{class:"e-group-body"}}),e.appendChild(t).appendChild(l),this.element.appendChild(e),n=this.element.querySelector(".e-group-body")),this.headerTemplate&&this.isRoot&&(this.element.innerHTML="",this.isRoot=!1),this.enableNotCondition&&L.removeClass(this.element.querySelectorAll(".e-qb-toggle"),"e-active-toggle"),n.appendChild(this.createElement("div",{attrs:{class:"e-rule-list"}})),this.levelColl[this.element.id+"_group0"]=[0],this.setProperties({rule:{condition:"and",not:!1,rules:[]}},!0),this.disableRuleCondition(n.parentElement)},q.prototype.getWrapper=function(){return this.element},q.prototype.getModuleName=function(){return"query-builder"},q.prototype.requiredModules=function(){var e=[];return e.push({member:"query-library",args:[this]}),e},q.prototype.GetRootColumnName=function(e){return L.isNullOrUndefined(e)?"":this.separator?e.split(this.separator)[0]:e},q.prototype.initialize=function(){if(this.dataColl.length){var e=Object.keys(this.dataColl[0]),t=[],l=[],n=void 0,i=!1,o=!1,r=void 0,s={isRequired:!0,min:0,max:Number.MAX_VALUE};if(this.columns.length){this.columnSort();for(var a=0,u=(d=this.columns).length;a<u;a++)this.updateCustomOperator(d[a],"initial"),d[a].type||(-1<e.indexOf(d[a].field)&&("string"===(n=typeof(r=this.dataColl[0][d[a].field]))?o=!isNaN(Date.parse(r)):"object"===n&&(o=r instanceof Date&&!isNaN(r.getTime()),n="string"),d[a].type=n,o=!1),n="string"),d[a].validation||(d[a].validation=s),d[a].category?i=!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"]);i&&(1<l.length||l[0]!==this.l10n.getConstant("OtherFields"))&&(this.fields={text:"label",value:"field",groupBy:"category"}),this.updateSubFieldsFromColumns(this.columns)}else{for(a=0,u=e.length;a<u;a++)"string"===(n=typeof(r=this.dataColl[0][e[a]]))?o=!isNaN(Date.parse(r)):"object"!==n||Object.keys(r).length||(o=r instanceof Date&&!isNaN(r.getTime()),n="string"),o=!(t[a]={field:e[a],label:e[a],type:o?"date":n,validation:s}),t[a].operators=this.customOperators[t[a].type+"Operator"],"object"===n&&this.updateSubFields(r,t[a]);this.columns=t}}else if(this.columns&&this.columns.length){for(var d,a=0,u=(d=this.columns).length;a<u;a++)d[a].category?this.fields={text:"label",value:"field",groupBy:"category"}:d[a].category=this.l10n.getConstant("OtherFields"),this.updateCustomOperator(d[a],"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"})},q.prototype.updateSubFieldsFromColumns=function(e,t){for(var l=0;l<e.length;l++)""!==this.separator&&e[l].field.indexOf(this.separator)<0&&(e[l].field=t?t+this.separator+e[l].field:e[l].field),e[l].operators?this.updateCustomOperator(e[l]):e[l].type&&"object"!==e[l].type&&(e[l].operators=this.customOperators[e[l].type+"Operator"]),e[l].columns&&(e[l].type="object",this.updateSubFieldsFromColumns(e[l].columns,e[l].field))},q.prototype.updateSubFields=function(e,t,l){t.columns=[];var n=Object.keys(e);l=l||this.dataColl[0];for(var i=0,o=n.length;i<o;i++){var r,s=t.field.split("."),s=(l?l[s[s.length-1]]:this.dataColl[0][t.field])[n[i]],a=l[t.field.split(this.separator)[t.field.split(this.separator).length-1]],u={field:t.field+this.separator+n[i],label:n[i],type:r="object"!=(r=typeof s)||isNaN(Date.parse(s))?r:"date"};"object"!=r&&(u.operators=this.customOperators[r+"Operator"]),t.columns.push(u),"object"==r&&this.updateSubFields(s,u,a)}},q.prototype.updateCustomOperator=function(i,e){if(i.operators){this.isLocale||"initial"!==e||L.isNullOrUndefined(this.isCustomOprCols)||this.isCustomOprCols.push(i.field);for(var o=this,t=0;t<i.operators.length;t++)!function(e){var t,l,n=Object.keys(i.operators[e]).indexOf("sqlOperator");-1<n&&(t=i.operators[e],l=(e=Object.keys(t)).map(function(e){return t[""+e]}).join(",").split(","),e=e.indexOf("value"),o.operators[l[e]]=l[n])}(t)}},q.prototype.focusEventHandler=function(e){this.target=e.target},q.prototype.clickEventHandler=function(e){var t,l,n,i,o=this,r=e.target;if(this.isImportRules=!1,"string"==typeof(r="SPAN"===r.tagName?r.parentElement:r).className&&-1<r.className.indexOf("e-collapse-rule")&&(u=new L.Animation({duration:1e3,delay:0}),this.element.querySelectorAll(".e-summary-content").length<1&&this.renderSummary(),i=(e=document.getElementById(this.element.id+"_summary_content")).querySelector(".e-summary-text"),u.animate(".e-query-builder",{name:"SlideLeftIn"}),(a=this.element.querySelector(".e-group-container")).style.display="none",i.textContent=this.getSqlFromRules(this.rule),e.style.display="block",i.style.height=i.scrollHeight+"px"),"BUTTON"===r.tagName&&"string"==typeof r.className&&r.className.indexOf("e-qb-toggle")<0){var s,a,u=new L.Animation({duration:1e3,delay:0});switch(!0){case-1<r.className.indexOf("e-removerule"):this.actionButton=r,this.deleteRule(r);break;case-1<r.className.indexOf("e-clone-rule-btn"):this.actionButton=r,this.cloneRuleBtnClick=!0,this.ruleClone(r);break;case-1<r.className.indexOf("e-lock-rule-btn"):this.actionButton=r,this.ruleLock(r);break;case-1<r.className.indexOf("e-lock-grp-btn"):this.actionButton=r,this.groupLock(r);break;case-1<r.className.indexOf("e-clone-grp-btn"):this.actionButton=r,this.cloneGrpBtnClick=!0,this.groupClone(L.closest(r,".e-group-container"));break;case-1<r.className.indexOf("e-deletegroup"):this.actionButton=r,this.deleteGroup(L.closest(r,".e-group-container"));break;case-1<r.className.indexOf("e-edit-rule"):u.animate(".e-query-builder",{name:"SlideLeftIn"}),document.getElementById(this.element.id+"_summary_content").style.display="none",this.element.querySelectorAll(".e-group-container").length<1?(this.addGroupElement(!1,this.element,this.rule.condition,!1,this.rule.not),s=L.extend({},this.rule,{},!0),this.setGroupRules(s),this.renderSummaryCollapse()):((a=this.element.querySelector(".e-group-container")).querySelectorAll(".e-collapse-rule").length<1&&this.renderSummaryCollapse(),a.style.display="block")}}else("LABEL"===r.tagName&&-1<r.parentElement.className.indexOf("e-btn-group")||"string"==typeof r.className&&-1<r.className.indexOf("e-qb-toggle"))&&(e=L.closest(r,".e-group-container"),this.headerTemplate||(i=void 0,(t=r.getAttribute("for"))?i=document.getElementById(t).getAttribute("value"):this.enableSeparateConnector&&(i=r.classList.contains("e-btngroup-or-lbl")?"or":r.classList.contains("e-btngroup-and-lbl")?"and":r.textContent),t=e.id.replace(this.element.id+"_",""),l=this.getGroup(t),n=void 0,this.enableNotCondition&&(-1<r.className.indexOf("e-qb-toggle")?(n=-1<(e=e.getElementsByClassName("e-qb-toggle")[0]).className.indexOf("e-active-toggle")?(L.removeClass([e],"e-active-toggle"),!1):(L.addClass([e],"e-active-toggle"),!0),i=l.condition):n=l.not),l={groupID:t,cancel:!1,type:"condition",value:i.toLowerCase()},this.enableNotCondition&&(l={groupID:t,cancel:!1,type:"condition",value:i.toLowerCase(),not:n})),this.isImportRules?this.beforeSuccessCallBack(l,r):this.trigger("beforeChange",l,function(e){o.beforeSuccessCallBack(e,r)}),this.target=r)},q.prototype.beforeSuccessCallBack=function(e,t){var l,n,i,o,r;e&&!e.cancel&&(l=(o=L.closest(t,".e-group-container")).id.replace(this.element.id+"_",""),n=this.getValidRules(this.rule),i=this.getParentGroup(o),this.enableSeparateConnector?(r=(o=L.isNullOrUndefined(L.closest(t,".e-rule-container"))&&o.classList.contains("e-group-container")?null!==t.parentElement.previousElementSibling?t.parentElement.previousElementSibling:o:L.closest(t,".e-rule-container")).id.replace(this.element.id+"_",""),o.classList.contains("e-rule-container")?(i=this.getRule(o)).condition=e.value:o.classList.contains("e-group-container")&&((i=this.getGroup(o)).condition=e.value),this.enableNotCondition&&(i.not=e.not),this.isImportRules||this.trigger("change",{groupID:l,ruleID:r,type:"condition",value:i.condition})):(i.condition=e.value,this.enableNotCondition&&(i.not=e.not),this.isImportRules||this.trigger("change",{groupID:l,type:"condition",value:i.condition})),this.filterRules(n,this.getValidRules(this.rule),"condition"),this.enableSeparateConnector)&&(o=t.parentElement.querySelector(".e-btngroup-and"),r=t.parentElement.querySelector(".e-btngroup-or"),o)&&r&&("and"===e.value?(o.checked=!0,r.checked=!1):"or"===e.value&&(r.checked=!0,o.checked=!1))},q.prototype.selectBtn=function(e,t){"beforeOpen"===t.name?this.showButtons.groupInsert||L.isNullOrUndefined(this.showButtons.groupInsert)?(this.element.querySelectorAll(".e-group-container").length>=this.maxGroupCount+1?L.addClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):L.removeClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"),this.enableRtl&&L.addClass([t.element.querySelector("li").parentElement],"e-rtl")):L.addClass([t.element.querySelector("li span.e-addgroup").parentElement],"e-button-hide"):-1<t.element.children[0].className.indexOf("e-addrule")?this.addRuleElement(L.closest(e,".e-group-container"),{}):-1<t.element.children[0].className.indexOf("e-addgroup")&&this.addGroupElement(!0,L.closest(e,".e-group-container"),"",!0)},q.prototype.appendRuleElem=function(e,t,l,n,i,o){var r,s,a=e.querySelector(".e-rule-list");if("change"===l)r=L.select("#"+n,e);else{if((r=this.createElement("div",{attrs:{class:"e-rule-container"}})).setAttribute("id",e.id+"_rule"+this.ruleIdCounter),this.showButtons.cloneRule&&this.cloneRuleBtnClick){if(this.ruleIndex<0)a.appendChild(r);else if(this.enableSeparateConnector){for(var u=-1,d=this.ruleIndex+1,p=0;p<d&&p!==a.children.length;p++)a.children[p].classList.contains("e-rule-container")&&(d++,u++);a.insertBefore(r,a.children[this.ruleIndex+u+1])}else a.insertBefore(r,a.children[this.ruleIndex+1]);this.cloneRuleBtnClick=!1}else a.appendChild(r);this.ruleIdCounter++}return t&&t.ruleTemplate&&o?(l={requestType:"template-initialize",ruleID:r.id,action:i,fields:this.fields,rule:o},this.trigger("actionBegin",l),this.ruleTemplateFn=this.templateParser(t.ruleTemplate),n=this.element.id+t.field,l.fields=this.fields,l.columns=this.columns,""===o.field&&(o.field=t.field),l.operators=this.getOperators(o.field),l.operatorFields={text:"key",value:"value"},this.isReact?((s=this.ruleTemplateFn(l,this,r.id,n)[0]).className+=" e-rule-field",r.appendChild(s)):this.isAngular?((s=3===(e=this.ruleTemplateFn(l,this,r.id,n))[0].nodeType?e[1]:e[0]).className+=" e-rule-field",r.appendChild(s)):this.isVue3?(s=this.ruleTemplateFn(l,this,"Template",n),L.append(s,r),r.children.length&&(r.children[r.children.length-1].className+=" e-rule-field")):((s=this.ruleTemplateFn(l,this,"Template",n)[0]).className+=" e-rule-field",r.appendChild(s))):(s=this.ruleElem.querySelector(".e-rule-field").cloneNode(!0),r.appendChild(s)),this.showButtons.lockGroup&&L.removeClass(r.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.showButtons.lockRule&&L.removeClass(r.querySelectorAll(".e-lock-rule-btn"),"e-button-hide"),this.showButtons.cloneGroup&&L.removeClass(r.querySelectorAll(".e-clone-grp-btn"),"e-button-hide"),this.showButtons.cloneRule&&L.removeClass(r.querySelectorAll(".e-clone-rule-btn"),"e-button-hide"),this.showButtons.ruleDelete&&L.removeClass(r.querySelectorAll(".e-lock-grp-btn"),"e-button-hide"),this.allowDragAndDrop&&L.removeClass(r.querySelectorAll(".e-drag-qb-rule"),"e-hidden"),t&&t.ruleTemplate&&o&&this.renderReactTemplates(),r},q.prototype.addRuleElement=function(t,l,n,i,o,r){var e,s=this;t&&(e={groupID:t.id.replace(this.element.id+"_",""),cancel:!1,type:"insertRule"},this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addRuleSuccessCallBack(e,t,l,n,i,o,r)):this.trigger("beforeChange",e,function(e){s.addRuleSuccessCallBack(e,t,l,n,i,o,r)}))},q.prototype.addRuleSuccessCallBack=function(e,t,l,n,i,o,r){var s,a,u,d,p=-1<this.element.className.indexOf("e-device")?"250px":"200px",n=l&&l.field?this.getColumn(l.field):n||this.columns[0],c={label:"",field:"",type:"",operator:""};if(e.cancel||(n&&n.ruleTemplate&&l.field?(this.selectedColumn=n,e=this.selectedColumn.operators,c={label:n.label,field:n.field,type:n.type,operator:e[0].value},e=Object.keys(l).length?l:c,e={requestType:"template-create",action:"insert-rule",ruleID:(s=this.appendRuleElem(t,n,i,o,"field",e)).id,fields:this.fields,rule:e},this.trigger("actionBegin",e)):((s=this.appendRuleElem(t,n,i,o,"field")).querySelector(".e-filter-input").setAttribute("id",s.id+"_filterkey"),e=s.querySelector(".e-rule-delete"),-1<this.element.className.indexOf("e-device")||"Vertical"===this.displayMode?(e.textContent=this.l10n.getConstant("Remove"),L.addClass([e],"e-flat"),L.addClass([e],"e-primary")):(L.addClass([e],"e-round"),L.addClass([e],"e-icon-btn"),e.setAttribute("title",this.l10n.getConstant("DeleteRule")),i=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-delete-icon"}}),s.querySelector(".e-rule-delete").appendChild(i)),this.showButtons.ruleDelete||e.classList.add("e-button-hide")),"Vertical"===this.displayMode||-1<this.element.className.indexOf("e-device")?s.className="e-rule-container e-vertical-mode":s.className="e-rule-container e-horizontal-mode",i=s.previousElementSibling,this.enableSeparateConnector?(f=g=void 0,(i=i&&i.classList.contains("e-group-container")?(f=i.querySelectorAll(".e-rule-container"))[f.length-1]:i)&&i.classList.contains("e-rule-container")&&(g=this.getRule(i)),this.headerTemplate&&i&&g?this.headerTemplateFn(i,!1,g.condition,g,i.id):L.isNullOrUndefined(i)&&s.id!==this.element.id+"_group0_rule0"&&((h=s.closest(".e-group-container"))&&h.previousElementSibling?(e=(m=h.previousElementSibling).querySelectorAll(".e-rule-container"),(m=m.classList.contains("e-group-container")?e[e.length-1]:m).classList.contains("e-rule-container")&&(e=this.getRule(m),this.headerTemplateFn(m,!1,e.condition,e,m.id,!0))):this.headerTemplateFn(s,!1,l.condition,l,s.id,!0))):i&&-1<i.className.indexOf("e-rule-container")&&(s.className.indexOf("e-joined-rule")<0&&(s.className+=" e-joined-rule"),i.className.indexOf("e-prev-joined-rule")<0)&&(i.className+=" e-prev-joined-rule"),i&&-1<i.className.indexOf("e-group-container")&&s.className.indexOf("e-separate-rule")<0&&(s.className+=" e-separate-rule"),this.isImportRules||this.updateAddedRule(t,l,c,r,o,!!this.enableSeparateConnector||null),n&&n.ruleTemplate&&l.field||("Default"===this.fieldMode?(u=a=void 0,u=this.separator&&l.field||this.autoSelectField||this.isImportRules?this.GetRootColumnName(l.field):l.field,a={dataSource:this.columns,fields:this.fields,placeholder:this.l10n.getConstant("SelectField"),popupHeight:5<this.columns.length?p:"auto",close:this.fieldClose.bind(this,s.id+"_filterkey"),change:this.changeField.bind(this),value:l?u:null,open:this.popupOpen.bind(this,!0),cssClass:"qb-dropdownlist"},this.fieldModel&&(a=b({},a,this.fieldModel)),d=void(e=new y.DropDownList(a)).appendTo("#"+s.id+"_filterkey"),d=this.separator&&l.field||this.isImportRules?this.GetRootColumnName(l.field):e.value,this.selectedColumn=e.getDataByValue(d),Object.keys(l).length&&this.changeRule(l,{element:e.element,itemData:this.selectedColumn})):(this.isImportRules,u=l.field,this.dummyDropdownTreeDs=L.extend([],this.columns,[],!(a=void 0)),this.updateDropdowntreeDS(this.dummyDropdownTreeDs),a={fields:{dataSource:this.dummyDropdownTreeDs,value:"field",text:"label",child:"columns",expanded:"expanded",selectable:"selectable"},placeholder:this.l10n.getConstant("SelectField"),showClearButton:!1,popupHeight:5<this.columns.length?p:"auto",changeOnBlur:!1,change:this.changeField.bind(this),value:L.isNullOrUndefined(u)?null:[u],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&&(a=b({},a,this.fieldModel)),(i=new y.DropDownTree(a)).appendTo("#"+s.id+"_filterkey"),L.isNullOrUndefined(i.value)||(c=this.getLabelFromColumn(i.value[0]),i.element.value=c),d=L.isNullOrUndefined(l.field)?i.value:this.GetRootColumnName(l.field),this.selectedColumn=this.getColumn(d),Object.keys(l).length&&this.changeRule(l,{element:i.element,itemData:this.selectedColumn}))),u=s.id.replace(this.element.id+"_",""),l&&l.isLocked&&(r=s.querySelector(".e-lock-rule-btn"),this.ruleLock(r)),this.isImportRules)||this.prvtEvtTgrDaD||this.trigger("change",{groupID:t.id.replace(this.element.id+"_",""),ruleID:u,type:"insertRule"}),this.enableSeparateConnector&&L.isNullOrUndefined(l.condition)&&u&&(l=this.getRule(u)),this.enableSeparateConnector){for(var h,g,m=s.previousElementSibling,f=void 0;m&&!m.classList.contains("e-rule-container");){if(m.classList.contains("e-group-container")){m=(f=m.querySelectorAll(".e-rule-container"))[f.length-1];break}m=m.previousElementSibling}this.headerTemplate&&m?(g=this.getRule(m),o={requestType:"rule-template-create",ruleID:m.id,condition:g.condition,notCondition:!!this.enableNotCondition||void 0},this.trigger("actionBegin",o)):L.isNullOrUndefined(m)&&s.id!==this.element.id+"_group0_rule0"&&(h=s.closest(".e-group-container"))&&h.previousElementSibling&&h.previousElementSibling.previousElementSibling&&(n=(n=h.previousElementSibling.previousElementSibling).classList.contains("e-group-container")?(e=n.querySelectorAll(".e-rule-container"))[e.length-1]:n).classList.contains("e-rule-container")&&(g=this.getRule(n),p={requestType:"rule-template-create",ruleID:n.id,condition:g.condition,notCondition:!!this.enableNotCondition||void 0},this.trigger("actionBegin",p)),this.setMultiConnector(s)}},q.prototype.dropdownTreeFiltering=function(t){var l=this,e=this,n=t.event.srcElement,n=(n.classList.contains("e-clear-icon")?n.parentElement.querySelector(".e-textbox"):n).id.split("_filterkey")[0],n=document.getElementById(n),n=(this.ddTree=L.getComponent(n.querySelector("input.e-dropdowntree"),"dropdowntree"),L.extend([],this.columns,[],!0));t.cancel=!0,""===t.text?this.changeDataSource(n):(n=n.map(function(e){return l.nestedChildFilter(t.text,e)}).filter(function(e){return null!==e}),this.changeDataSource(n),setTimeout(function(){L.isNullOrUndefined(e.ddTree)||L.isNullOrUndefined(e.ddTree.treeObj)||e.ddTree.treeObj.expandAll()},100))},q.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()},q.prototype.nestedChildFilter=function(t,e){var l,n=this,i=e[this.ddTree.fields.child];return i?(l=i.map(function(e){return n.nestedChildFilter(t,e)}).filter(function(e){return null!==e})).length?(e[this.ddTree.fields.child]=l,e):(e[this.ddTree.fields.child]=i,this.isMatchedNode(t,e)?e:null):this.isMatchedNode(t,e)?e:null},q.prototype.isMatchedNode=function(e,t){t=t[this.ddTree.fields.text].toLowerCase();return e=e?e.toLowerCase():"",-1!==t.indexOf(e)},q.prototype.dropdownTreeClose=function(){this.ddTree&&this.changeDataSource(L.extend([],this.columns,[],!0)),this.ddTree=null},q.prototype.updateDropdowntreeDS=function(e){for(var t=0;t<e.length;t++)"object"===e[parseInt(t.toString(),10)].type?(this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template,e[parseInt(t.toString(),10)].selectable=!1,this.updateDropdowntreeDS(e[parseInt(t.toString(),10)].columns)):this.isAngular&&e[parseInt(t.toString(),10)].template&&delete e[parseInt(t.toString(),10)].template},q.prototype.updateAddedRule=function(e,t,l,n,i,o){var r=0;if(n){for(s=L.select("#"+i,e),u=L.closest(e,".e-group-container"),d=this.getParentGroup(u);s&&null!==s.previousElementSibling;){var s=s.previousElementSibling,a=this.enableSeparateConnector&&(!this.headerTemplate&&!s.classList.contains("e-btn-group")||this.headerTemplate&&(s.classList.contains("e-rule-container")||s.classList.contains("e-group-container")));this.enableSeparateConnector&&!a||r++}d.rules[r]=t}else{var u=L.closest(e,".e-group-container"),d=this.getParentGroup(u),n=t.custom;Object.keys(t).length?this.ruleIndex<0?(d.rules.push({field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),n&&(d.rules[d.rules.length-1].custom=n),this.enableSeparateConnector&&(d.rules[d.rules.length-1].condition=t.condition||l.condition)):(d.rules.splice(this.ruleIndex+1,0,{field:t.field,type:t.type,label:t.label,operator:t.operator,value:t.value}),n&&(d.rules[this.ruleIndex+1].custom=n),this.enableSeparateConnector&&(d.rules[this.ruleIndex+1].condition=t.condition||l.condition)):(n&&(l.custom=n),this.autoSelectField&&(t.field=l.field=this.rule.rules[0].field),d.rules.push(l))}this.disableRuleCondition(e,d,o)},q.prototype.changeRuleTemplate=function(e,t){var l,n,i;e&&e.ruleTemplate||(l=L.closest(t,".e-group-container"),n=L.closest(t,".e-rule-container").id,this.previousColumn&&this.previousColumn.ruleTemplate&&(L.detach(t.closest('[id="'+n+'"]').querySelector(".e-rule-field")),this.clearQBTemplate([n])),e?(t=this.selectedColumn.operators,i={field:e.field,label:e.label,operator:t[0].value,value:""},this.addRuleElement(l,i,e,"change",n,!0)):this.addRuleElement(l,i={field:"",label:"",operator:"",value:""},e,"change",n,!0))},q.prototype.renderToolTip=function(e){var t=new s.Tooltip({content:this.l10n.getConstant("ValidationMessage"),isSticky:!0,position:"BottomCenter",cssClass:"e-querybuilder-error",afterClose:function(){t.destroy()},beforeOpen:function(e){e=e.element.querySelector(".e-tooltip-close");e&&(e.style.display="none")}});t.appendTo(e),t.open(e)},q.prototype.validateFields=function(){var e,t=!0;if(this.allowValidation)for(var l=["isnull","isnotnull","isempty","isnotempty"],n=void 0,i=void 0,o=void 0,r=[],s=void 0,a=void 0,u=void 0,d=void 0,p=this.element.querySelectorAll(".e-rule-container"),n=0,c=p.length;n<c;n++){var h=void 0,g=L.closest(p[n],".e-group-container"),d=this.getParentGroup(g),s=0;if(o=u=p[n],"DropdownTree"===this.fieldMode?(e=L.getComponent(p[n].querySelector(".e-rule-filter input.e-dropdowntree"),"dropdowntree"))&&e.value&&e.value.length&&(this.selectedColumn=this.getColumn(e.value[0]),h=this.selectedColumn.validation):(a=L.getComponent(p[n].querySelector(".e-rule-filter input.e-dropdownlist"),"dropdownlist"))&&a.value&&(this.selectedColumn=a.getDataByValue(a.value),h=!L.isNullOrUndefined(a.value)&&this.selectedColumn.validation),i=u.querySelector(".e-rule-field input.e-control"),h&&h.isRequired){for(;o&&null!==o.previousElementSibling;){var o=o.previousElementSibling,m=this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container")));this.enableSeparateConnector&&!m||s++}if(i=u.querySelector(".e-rule-operator .e-control"),d.rules[s].operator||(i.parentElement.className.indexOf("e-tooltip")<0&&i.className.indexOf("e-tooltip")<0&&this.renderToolTip(i.parentElement),t=!1),d.rules[s].value instanceof Array&&(r=d.rules[s].value),l.indexOf(d.rules[s].operator)<-1&&L.isNullOrUndefined(d.rules[s].value)&&"date"!==d.rules[s].type||""===d.rules[s].value||null===d.rules[s].value||d.rules[s].value instanceof Array&&r.length<1){var f=u.querySelectorAll(".e-rule-value .e-control");l.indexOf(d.rules[s].operator)<0&&(t=!1);for(var y=0,v=f.length;y<v;y++){var b=f[y],C=void 0;-1<b.parentElement.className.indexOf("e-searcher")?(C=L.closest(b,".e-multi-select-wrapper")).className.indexOf("e-tooltip")<0&&this.renderToolTip(C):f[y].parentElement.className.indexOf("e-tooltip")<0&&f[y].className.indexOf("e-tooltip")<0&&this.renderToolTip(f[y].parentElement),y++}}else if("date"===d.rules[s].type&&(null===d.rules[s].value||-1<d.rules[s].value.indexOf(null))){f=u.querySelectorAll(".e-rule-value .e-control");l.indexOf(d.rules[s].operator)<0&&(t=!1);for(y=0,v=f.length;y<v;y++)f[y].parentElement.className.indexOf("e-tooltip")<0&&f[y].className.indexOf("e-tooltip")<0&&(L.isNullOrUndefined(d.rules[s].value)||null==d.rules[s].value[y])&&this.renderToolTip(f[y].parentElement)}}else(a&&a.element&&L.isNullOrUndefined(a.value)||e&&e.element&&(L.isNullOrUndefined(e.value)||e.value.length<1))&&(i.parentElement.className.indexOf("e-tooltip")<0&&this.renderToolTip(i.parentElement),t=!1)}return t},q.prototype.refreshLevelColl=function(){this.levelColl={};var e=this.element.querySelector(".e-group-container");e&&(this.levelColl[e.id]=[0],this.refreshLevel({groupElement:e,level:[0]}))},q.prototype.refreshLevel=function(e){for(var t,l=e.groupElement.querySelector(".e-rule-list").children,n=e.groupElement,i=l.length,o=0,r=0;r<i;r++)-1<(t=l[r]).className.indexOf("e-group-container")&&(e.level.push(o),this.levelColl[t.id]=e.level.slice(),o++,e.groupElement=t,e=this.refreshLevel(e));var s=L.closest(n,".e-rule-list");return e.groupElement=s?L.closest(s,".e-group-container"):n,e.level=this.levelColl[e.groupElement.id].slice(),e},q.prototype.groupTemplate=function(e){var t,l,n=this.createElement("div",{attrs:{class:"e-group-container"}}),i=this.createElement("div",{attrs:{class:"e-group-header"}}),o=this.createElement("div",{attrs:{class:"e-group-body"}}),r=this.createElement("div",{attrs:{class:"e-rule-list"}});return n.appendChild(i),o.appendChild(r),n.appendChild(o),this.headerTemplate||(r=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden",o=this.createElement("span",{attrs:{class:r,"aria-label":"drag handle",title:"drag handle"}}),i.appendChild(o),r=this.enableSeparateConnector&&!e?"e-lib e-btn-group e-qb-toggle-btn":"e-lib e-btn-group",o=this.createElement("div",{attrs:{class:r,role:"group"}}),this.enableSeparateConnector&&o.classList.add("e-multi-connector"),this.enableNotCondition&&(t=this.enableSeparateConnector?this.createElement("input",{attrs:{type:"checkbox",class:"e-qb-toggle"}}):this.createElement("button",{attrs:{type:"button",class:"e-qb-toggle"}}),o.appendChild(t)),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-and",value:"AND"}}),o.appendChild(t),e=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-and-lbl e-small"},innerHTML:this.l10n.getConstant("AND")}),o.appendChild(e),t=this.createElement("input",{attrs:{type:"radio",class:"e-btngroup-or",value:"OR"}}),o.appendChild(t),e=this.createElement("label",{attrs:{class:"e-lib e-btn e-btngroup-or-lbl e-small"},innerHTML:this.l10n.getConstant("OR")}),o.appendChild(e),i.appendChild(o),r=this.createElement("div",{attrs:{class:"e-group-action"}}),l=this.enableSeparateConnector?(l=this.createElement("button",{attrs:{type:"button",class:"e-add-condition-btn"}}),r.appendChild(l),this.createElement("button",{attrs:{type:"button",class:"e-add-group-btn"}})):this.createElement("button",{attrs:{type:"button",class:"e-add-btn"}}),r.appendChild(l),i.appendChild(r)),n},q.prototype.ruleTemplate=function(){var e=this.createElement("div"),t=this.createElement("div",{attrs:{class:"e-rule-field"}}),l=this.createElement("div",{attrs:{class:"e-rule-filter"}}),n=this.allowDragAndDrop?"e-icons e-drag-qb-rule":"e-icons e-drag-qb-rule e-hidden",n=this.createElement("span",{attrs:{class:n,"aria-label":"drag handle",title:"drag handle"}}),n=(t.appendChild(n),this.createElement("input",{attrs:{type:"text",class:"e-filter-input"}})),n=(l.appendChild(n),t.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-operator"}}),t.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value"}}),t.appendChild(l),l=this.createElement("div",{attrs:{class:"e-rule-value-delete"}}),n=this.showButtons.cloneRule?"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn":"e-clone-rule-btn e-clone-rule e-css e-btn e-small e-round e-icon-btn e-button-hide",o=this.showButtons.lockRule?"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-rule-btn e-lock-rule e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneRule"),type:"button",class:n}})),i=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}}),o=(n.appendChild(i),this.createElement("button",{attrs:{title:this.l10n.getConstant("LockRule"),type:"button",class:o}})),i=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),i=(o.appendChild(i),this.showButtons.ruleDelete||L.isNullOrUndefined(this.showButtons.ruleDelete)?"e-removerule e-rule-delete e-css e-btn e-small":"e-removerule e-rule-delete e-css e-btn e-small e-button-hide"),i=this.createElement("button",{attrs:{type:"button",class:i}});return l.appendChild(n),l.appendChild(o),l.appendChild(i),t.appendChild(l),e.appendChild(t),e},q.prototype.addGroupElement=function(t,l,n,i,o,r,s){var a=this,e={groupID:l.id.replace(this.element.id+"_",""),cancel:!1,type:"insertGroup"};this.isImportRules||this.isInitialLoad||this.prvtEvtTgrDaD?(this.isInitialLoad=!1,this.addGroupSuccess(e,t,l,n,i,o,r,s)):this.trigger("beforeChange",e,function(e){a.addGroupSuccess(e,t,l,n,i,o,r,s)})},q.prototype.addGroupSuccess=function(e,t,l,n,i,o,r,s){var a=this;if(!e.cancel&&this.element.querySelectorAll(".e-group-container").length<=this.maxGroupCount){var u,d,p,e=l,l=void 0,c="",c=e.className.indexOf("e-group-container")<0?e.querySelector(".e-group-container")&&e.querySelector(".e-group-container").id:e.id,h=(this.enableSeparateConnector&&(this.groupElem=this.groupTemplate()),this.groupElem.cloneNode(!0));if(h.setAttribute("id",this.element.id+"_group"+this.groupIdCounter),0===this.groupIdCounter&&this.allowDragAndDrop&&h.querySelector(".e-drag-qb-rule")&&(h&&h.children[0]&&h.children[0].classList.add("e-parent-header"),L.addClass([h.querySelector(".e-drag-qb-rule")],"e-hidden")),this.headerTemplate&&(r?(t=!1,h.setAttribute("id",this.element.id+"_group0"),this.headerTemplateFn(h,o,n,s,c),this.groupIdCounter=0):this.headerTemplateFn(h,o,n,s,c)),this.groupIdCounter++,this.headerTemplate||(r=h.querySelector(".e-btngroup-and"),s=h.querySelector(".e-btngroup-or"),c=h.querySelector(".e-btngroup-and-lbl"),E=h.querySelector(".e-btngroup-or-lbl"),r.setAttribute("id",this.element.id+"_and"+this.btnGroupId),s.setAttribute("id",this.element.id+"_or"+this.btnGroupId),r.setAttribute("name",this.element.id+"_and"+this.btnGroupId),s.setAttribute("name",this.element.id+"_and"+this.btnGroupId),c.setAttribute("for",this.element.id+"_and"+this.btnGroupId),E.setAttribute("for",this.element.id+"_or"+this.btnGroupId),this.btnGroupId++),t){for(var r=void 0,r=this.showButtons.groupDelete||L.isNullOrUndefined(this.showButtons.groupDelete)?"e-deletegroup":"e-deletegroup e-button-hide",l=this.createElement("button",{attrs:{type:"button",class:r}}),s=(new N.Button({iconCss:"e-icons e-delete-icon",cssClass:"e-small e-round"}).appendTo(l),l.setAttribute("title",this.l10n.getConstant("DeleteGroup")),L.rippleEffect(l,{selector:".deletegroup"}),e.querySelector(".e-rule-list")),g=s.children,m=0,f=0,y=g.length;f<y;f++)-1<g[f].className.indexOf("e-group-container")&&(m+=1);if(this.showButtons.cloneGroup&&this.cloneGrpBtnClick)if(this.groupIndex===g.length-1)s.appendChild(h),this.isLastGroup=!0;else{if(this.enableSeparateConnector){for(var v=0,b=this.groupIndex+1,C=0;C<b;C++)g[C].classList.contains("e-rule-container")&&(b++,v++);0<v&&v--,g[k=this.groupIndex+v+1].parentNode.insertBefore(h,g[k])}else g[k=this.groupIndex+1].parentNode.insertBefore(h,g[k]);this.isMiddleGroup=!0}else s.appendChild(h);var S,x,q,c=this.levelColl[e.id].slice(0);c.push(m),this.levelColl[h.id]=c,-1<this.groupIndex&&this.refreshLevelColl(),this.isImportRules||(this.isAddSuccess=!0,this.addGroups([],e.id.replace(this.element.id+"_","")),this.isAddSuccess=!1,i&&this.addRuleToNewGroups&&this.addRuleElement(h,{})),this.headerTemplate||(S="",S=this.showButtons.cloneGroup?"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-clone-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",E=this.createElement("button",{attrs:{title:this.l10n.getConstant("CloneGroup"),type:"button",class:S}}),x=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-copy"}}),E.appendChild(x),h.querySelector(".e-group-action").appendChild(E),S=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",q=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:S}}),t=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),q.appendChild(t),h.querySelector(".e-group-action").appendChild(q),h.querySelector(".e-group-action").appendChild(l))}else this.headerTemplate||(S="",S=this.showButtons.lockGroup?"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn":"e-lock-grp-btn e-css e-btn e-small e-round e-icons e-icon-btn e-button-hide",q=this.createElement("button",{attrs:{title:this.l10n.getConstant("LockGroup"),type:"button",class:S}}),x=this.createElement("span",{attrs:{class:"e-btn-icon e-icons e-unlock"}}),q.appendChild(x),h.querySelector(".e-group-action").appendChild(q)),e.appendChild(h),this.levelColl[h.id]=[0];if(this.enableNotCondition&&!this.headerTemplate&&(O=h.querySelector(".e-qb-toggle"),(this.enableSeparateConnector?new N.CheckBox({label:this.l10n.getConstant("NOT"),cssClass:"e-qb-toggle"}):new N.Button({content:this.l10n.getConstant("NOT"),cssClass:"e-btn e-small"})).appendTo(O),h.querySelector(".e-btngroup-and-lbl").classList.add("e-not"),this.updatedRule)&&this.updatedRule.not&&L.addClass([O],"e-active-toggle"),this.enableSeparateConnector&&!this.headerTemplate){for(var O,E,r=h.querySelector(".e-btngroup-and"),k=h.querySelector(".e-btngroup-or"),w=h.querySelector(".e-btn-group"),C=0;C<w.childNodes.length;C++)"not"===h.querySelector(".e-btn-group").childNodes[C].textContent.toLowerCase()&&this.enableNotCondition?w.childNodes[C].classList.add("e-multiconnector"):w.childNodes[C].style.display="none";h.previousElementSibling&&(L.isNullOrUndefined(this.headerTemplate)&&(h.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),h),(O=h.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle"))&&(O.style.display="none"),this.isImportRules||(c=(s=h.previousElementSibling).querySelector(".e-btngroup-and"),i=s.querySelector(".e-btngroup-or"),r.checked||k.checked?this.enableSeparateConnector&&(r.checked&&(c.checked=!0),k.checked)&&(i.checked=!0):(E=h.nextElementSibling)&&E.classList.contains("e-btn-group")&&(r=E.querySelector(".e-btngroup-and"),k=E.querySelector(".e-btngroup-or"),c.checked=r.checked,i.checked=k.checked)))}this.updatedRule=null,this.headerTemplate?(t={requestType:"header-template-create",ruleID:h.id,condition:n,notCondition:this.enableNotCondition?o:void 0},this.trigger("actionBegin",t)):this.enableSeparateConnector?(u=h.querySelector(".e-add-condition-btn"),(p=new N.Button({cssClass:this.element.id+"_addConditionbtn",content:this.l10n.getConstant("AddCondition")})).appendTo(u),p.element.onclick=function(){a.addRuleElement(L.closest(u,".e-group-container"),{})},d=h.querySelector(".e-add-group-btn"),(p=new N.Button({cssClass:this.element.id+"_addGroupbtn",content:this.l10n.getConstant("AddGroup")})).appendTo(d),p.element.onclick=function(){a.addGroupElement(!0,L.closest(d,".e-group-container"),"",!0)}):(l=h.querySelector(".e-add-btn"),(p=new R.DropDownButton({items:this.items,cssClass:"e-round e-small e-caret-hide e-addrulegroup",iconCss:"e-icons e-add-icon",beforeOpen:this.selectBtn.bind(this,l),select:this.selectBtn.bind(this,l)})).appendTo(l),l.setAttribute("title",this.l10n.getConstant("AddButton"))),this.isImportRules||this.prvtEvtTgrDaD||(S=e.id.replace(this.element.id+"_",""),x=h.id.replace(this.element.id+"_",""),this.trigger("change",{groupID:S,type:"insertGroup",childGroupID:x}))}},q.prototype.setMultiConnector=function(e){var t;this.enableSeparateConnector&&!this.headerTemplate&&e.previousElementSibling&&this.groupElem.querySelector(".e-btn-group")&&(e.parentElement.insertBefore(this.groupTemplate(!0).querySelector(".e-btn-group"),e),(t=e.previousElementSibling.childNodes[0]).classList.contains("e-qb-toggle")&&(t.style.display="none"),this.addHeaderDiv(e))},q.prototype.addHeaderDiv=function(e){var t,l=e.previousElementSibling.previousElementSibling;l&&(l=-1<l.id.indexOf("rule")?this.getRule(l):this.getGroup(l),!L.isNullOrUndefined(l)&&L.isNullOrUndefined(l.condition)&&(l.condition="and"),t=e.previousElementSibling.querySelector(".e-btngroup-or"),e=e.previousElementSibling.querySelector(".e-btngroup-and"),t.disabled=!1,e.disabled=!1,L.isNullOrUndefined(l)||"or"!==l.condition?e.checked=!0:t.checked=!0)},q.prototype.headerTemplateFn=function(e,t,l,n,i,o){var r=this.element.id+"_header",s=e.querySelector(".e-group-header");if(this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(s=e),this.headerTemplate){if(t={requestType:"header-template-initialize",ruleID:e.id,notCondition:this.enableNotCondition?t:void 0,condition:l,rule:this.getRuleCollection(n,!1),groupID:i},this.trigger("actionBegin",t),this.enableSeparateConnector&&-1!==e.id.indexOf("rule")&&(t.requestType="rule-template-create"),this.headerFn=this.templateParser(this.headerTemplate),this.isReact)a=this.headerFn(t,this,e.id,r)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):s.appendChild(a);else if(this.isAngular){var l=this.headerFn(t,this,e.id,r),a=3===l[0].nodeType?l[1]:l[0];this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):s.appendChild(a)}else if(this.isVue3){if(a=this.headerFn(t,this,e.id,r),this.enableSeparateConnector&&(o||-1!==e.id.indexOf("rule")))for(var u=0;u<a.length;u++)if("DIV"===a[u].nodeName){a=a[u];break}this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):L.append(a,s)}else a=this.headerFn(t,this,"Template",r)[0],this.enableSeparateConnector&&o?this.enableSeparateConnectorInitialRule(e,a):this.enableSeparateConnector&&-1!==e.id.indexOf("rule")?s.parentElement.insertBefore(a,s.nextElementSibling):s.appendChild(a);this.renderReactTemplates()}return e},q.prototype.enableSeparateConnectorInitialRule=function(e,t){var l=(e.nextElementSibling||e).closest(".e-group-container");(l=e.nextElementSibling?l:l&&(l.nextElementSibling||l))&&l.parentElement.insertBefore(t,l)},q.prototype.notifyChange=function(e,t,l){var n=L.closest(t,".e-group-container"),n=this.getParentGroup(n),i=L.closest(t,".e-rule-container"),o=0;if("not"===l)n.not=e;else if("condition"===l)this.enableSeparateConnector?(n=(i=(i=t.parentElement.previousElementSibling)&&i.classList.contains("e-group-container")?i.querySelectorAll(".e-rule-container")[i.querySelectorAll(".e-rule-container").length-1]:i)&&i.classList.contains("e-rule-container")?this.getRule(i):n).condition=e:n.condition=e;else{for(;i&&null!==i.previousElementSibling;)i=i.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!i.classList.contains("e-btn-group")||this.headerTemplate&&(i.classList.contains("e-rule-container")||i.classList.contains("e-group-container"))))&&o++;var n=n.rules[o],n=this.getColumn(n.field),r=this.getFormat(n.format);if("date"===n.type)if(e instanceof Date)e=this.intl.formatDate(e,r);else if(e instanceof Array)for(var s=0;s<e.length;s++)e[s]&&e[s]instanceof Date&&(e[s]=this.intl.formatDate(e[s],r));n.ruleTemplate?this.templateChange(t,e,l):(this.isNotified=!0,this.updateRules(t,e),this.isNotified=!1)}},q.prototype.templateChange=function(e,t,l){var n=L.closest(e,".e-group-container"),i=this.getParentGroup(n),o=L.closest(e,".e-rule-container"),r=0;for(this.allowValidation&&this.validateValue(i,o);o&&null!==o.previousElementSibling;)o=o.previousElementSibling,(!this.enableSeparateConnector||this.enableSeparateConnector&&(!this.headerTemplate&&!o.classList.contains("e-btn-group")||this.headerTemplate&&(o.classList.contains("e-rule-container")||o.classList.contains("e-group-container"))))&&r++;var s,a,u=i.rules[r],i=("field"===l?this.selectedColumn=this.getColumn(t):u&&(this.selectedColumn=this.getColumn(u.field)),this.previousColumn=this.getColumn(u.field),this.getValidRules(this.rule)),d=(this.selectedColumn&&(s=this.selectedColumn.operators||this.customOperators[this.selectedColumn.type+"Operator"]),["in","notin","between","notbetween"]);switch(l){case"field":L.isNullOrUndefined(t)?(u.field="",u.label="",u.type="",u.value="",u.operator=""):(u.field=t,u.label=this.selectedColumn.label,u.type=this.selectedColumn.type,u.value="",u.operator=s[0].value);break;case"operator":a=u.operator,u.operator=t,-1<d.indexOf(u.operator)?u.value=[]:-1<d.indexOf(a)&&(u.value="");break;case"value":u.value=t}this.changeRuleTemplate(this.selectedColumn,e),this.filterRules(i,this.getValidRules(this.rule),l),this.selectedColumn&&this.selectedColumn.ruleTemplate&&("field"!==l&&"operator"!==l||(i=L.closest(e,".e-rule-container"),this.destroyControls(i,!0),L.detach(i.querySelector(".e-rule-field")),e=this.appendRuleElem(L.closest(i,".e-group-container"),this.selectedColumn,"change",i.id,l,u),"Vertical"===this.displayMode||-1<this.element.className.indexOf("e-device")?e.className="e-rule-container e-vertical-mode":e.className="e-rule-container e-horizontal-mode",this.enableSeparateConnector||e.previousElementSibling&&-1<e.previousElementSibling.className.indexOf("e-rule-container")&&(e.className.indexOf("e-joined-rule")<0&&(e.className+=" e-joined-rule"),e.previousElementSibling.className.indexOf("e-prev-joined-rule")<0)&&(e.previousElementSibling.className+=" e-prev-joined-rule"),e.previousElementSibling&&-1<e.previousElementSibling.className.indexOf("e-group-container")&&e.className.indexOf("e-separate-rule")<0&&(e.className+=" e-separate-rule"),e={requestType:"template-create",action:l,ruleID:i.id,fields:this.fields,rule:u},l={groupID:n.id.replace(this.element.id+"_",""),ruleID:i.id.replace(this.element.id+"_",""),value:u.field,type:"field"},this.trigger("actionBegin",e),this.trigger("change",l)))},q.prototype.changeValue=function(e,t){var l,n,i,o,r,s,a,u=this;this.isNumInput&&"number"==typeof t.value||"input"===t.type&&t.target&&t.target.classList.contains("e-numerictextbox")&&this.selectedColumn.validation&&(this.selectedColumn.validation.max!==Number.MAX_VALUE||0<this.selectedColumn.validation.min)?this.isNumInput=!1:(l=t.element&&t.element.classList.contains("e-multiselect")?t.element:t.event?t.event.target:"input"===t.type&&t.target&&t.target.classList.contains("e-numerictextbox")?t.currentTarget:t.element)&&((-1<l.className.indexOf("e-day")||-1<l.className.indexOf("e-today")||-1<l.className.indexOf("e-cell"))&&(l=t.element),r=L.closest(l,".e-group-container"),a=L.closest(l,".e-rule-container"),n=r&&r.id.replace(this.element.id+"_",""),i=a.id.replace(this.element.id+"_",""),(r=t).element&&-1<r.element.className.indexOf("e-datepicker")&&(l=r.element,(s=L.getComponent(L.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"))&&(this.selectedColumn=s.getDataByValue(s.value)),s=L.getComponent(L.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"))&&(this.selectedColumn=this.getColumn(s.value[0])),-1<l.className.indexOf("e-radio")?(a=parseInt(l.id.split("valuekey")[1],10),"Default"===this.fieldMode?(s=L.getComponent(L.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdownlist"),this.selectedColumn=s.getDataByValue(s.value),this.selectedColumn.columns&&(s=L.getComponent(L.closest(l,".e-rule-container").querySelector(".e-rule-sub-filter .e-dropdownlist"),"dropdownlist"),this.selectedColumn=this.getColumn(s.value))):(s=L.getComponent(L.closest(l,".e-rule-container").querySelector(".e-filter-input"),"dropdowntree"),this.selectedColumn=this.getColumn(s.value[0])),o=(this.selectedColumn.values||[!0,!1])[a]):-1<l.className.indexOf("e-multiselect")?o=L.getComponent(l,"multiselect").value:(o=t.value,"input"===t.type&&t.target&&t.target.classList.contains("e-numerictextbox")&&(o=Number(t.currentTarget.value),r=t.currentTarget,s=L.getInstance(r,c.NumericTextBox),a=L.getValue("decimal",L.getNumericObject(this.locale)),isNaN(o)&&-1!==r.value.indexOf(a)&&(o=this.intl.getNumberParser({format:"n"})(r.value)),isNaN(o)||(s.value=o),this.isNumInput=!0)),"input"===t.name&&this.immediateModeDelay?(window.clearInterval(this.timer),this.timer=window.setInterval(function(){u.filterValue(n,i,o,e,l)},this.immediateModeDelay)):this.filterValue(n,i,o,e,l))},q.prototype.filterValue=function(t,l,e,n,i){var o=this,e={groupID:t,ruleID:l,value:e,cancel:!1,type:"value"};window.clearInterval(this.timer),this.isImportRules?this.changeValueSuccessCallBack(e,i,n,t,l):this.trigger("beforeChange",e,function(e){o.changeValueSuccessCallBack(e,i,n,t,l)})},q.prototype.changeValueSuccessCallBack=function(e,t,l,n,i){e.cancel||(this.updateRules(t,e.value,l),this.isImportRules)||this.t