@syncfusion/ej2-treegrid 20.3.60 → 20.3.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * filename: ej2-treegrid.umd.min.js
3
- * version : 20.3.60
3
+ * version : 20.3.61
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
7
7
  * licensing@syncfusion.com. Any infringement will be prosecuted under
8
8
  * applicable laws.
9
9
  */
10
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-grids","@syncfusion/ej2-buttons","@syncfusion/ej2-data","@syncfusion/ej2-popups"],t):t(e.ej={},e.ej2Base,e.ej2Grids,e.ej2Buttons,e.ej2Data,e.ej2Popups)}(this,function(e,t,i,r,n,o){"use strict";function a(e){if(e.dataSource instanceof n.DataManager){var t=e.dataSource.adaptor;return t instanceof n.ODataAdaptor||t instanceof n.WebApiAdaptor||t instanceof n.WebMethodAdaptor||t instanceof n.CacheAdaptor||t instanceof n.UrlAdaptor}return!1}function s(e){return!!(e.dataSource&&"result"in e.dataSource)}function d(e){for(var t=0;t<e.columns.length;t++)if(e.columns[t].showCheckbox)return!0;return!1}function l(e){return!((t.isNullOrUndefined(e.grid.searchSettings.key)||""===e.grid.searchSettings.key||"Child"!==e.searchSettings.hierarchyMode&&"None"!==e.searchSettings.hierarchyMode)&&(!e.allowFiltering||!e.grid.filterSettings.columns.length||"Child"!==e.filterSettings.hierarchyMode&&"None"!==e.filterSettings.hierarchyMode))}function p(e){for(var t=[],r=0,n=Object.keys(e).length;r<n;r++){i.getObject("hasChildRecords",e[r])&&t.push(e[r])}return t}function h(e,i,r){var n,o=t.isNullOrUndefined(i.parentItem)?null:y(e,i.parentItem.uniqueID);return null==o||(!e.initialRender||t.isNullOrUndefined(o[e.expandStateMapping])||o[e.expandStateMapping]?!1!==o.expanded&&(!o.parentItem||((n=y(e,o.parentItem.uniqueID))&&e.initialRender&&!t.isNullOrUndefined(n[e.expandStateMapping])&&!n[e.expandStateMapping]?(n.expanded=!1,!1):(!n||!1!==n.expanded)&&(!n||h(e,n,r)))):(o.expanded=!1,!1))}function c(e){var i=[];if(t.isNullOrUndefined(e)||!e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)&&!e.childRecords.length)return[];if(!t.isNullOrUndefined(e.childRecords))for(var r=e.childRecords.filter(function(e){return!e.isSummaryRow}),n=0,o=Object.keys(r).length;n<o;n++)i.push(r[n]),(r[n].hasChildRecords||!t.isNullOrUndefined(r[n].childRecords)&&r[n].childRecords.length)&&(i=i.concat(c(r[n])));return i}function u(e){if(a(e)){var i=e.dataSource;return!t.isNullOrUndefined(i.ready)}return!0}function g(e){for(var t,i,r=[],n=0;e&&n<e.length;n++){i=Object.keys(e[n]),t={};for(var o=0;o<i.length;o++)t[i[o]]=e[n][i[o]];r.push(t)}return r}function f(e){return delete e.hasChildRecords,delete e.childRecords,delete e.index,delete e.parentItem,delete e.level,delete e.taskData,delete e.uniqueID,e}function y(e,t,i){if(i){return e.uniqueIDFilterCollection[t]}return e.uniqueIDCollection[t]}function m(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}function v(e,i,r,o,a,s,d){var l,p,h,c=e.value,u=e.action,m=i.grid.getPrimaryKeyFieldNames()[0],v=i.dataSource instanceof n.DataManager?i.dataSource.dataSource.json:i.dataSource,C=[],x=c,b=!1;if("Batch"===i.editSettings.mode&&(h=i.grid.editModule.getBatchChanges()),"add"===u||"batchsave"===u&&"Batch"===i.editSettings.mode&&h.addedRecords.length){var S=function(e,i,r,n,o,a,s){var d,l=!1,p=r.grid.getCurrentViewRecords();switch(d=t.extend({},e.value),d=f(d),r.editSettings.newRowPosition){case"Top":i.unshift(d),l=!0;break;case"Bottom":i.push(d),l=!0;break;case"Above":d=t.isNullOrUndefined(s)?f(d=t.extend({},p[o+1])):f(d=t.extend({},s));break;case"Below":case"Child":if(t.isNullOrUndefined(s)){var h=r.grid.getPrimaryKeyFieldNames()[0],c=p[o];d=f(d=!t.isNullOrUndefined(c)&&c[h]===e.value[h]||-1!==a?t.extend({},c):t.extend({},e.value));r.editModule.internalProperties.taskData=d}else d=f(d=t.extend({},s));-1===a&&(i.unshift(d),l=!0)}return{value:d,isSkip:l}}(e,v,i,0,o,a,d);c=S.value,b=S.isSkip}if(c instanceof Array?C=g(c):C.push(t.extend({},c)),!b&&("add"!==u||"Top"!==i.editSettings.newRowPosition&&"Bottom"!==i.editSettings.newRowPosition))for(var I=0;I<C.length;I++){"object"==typeof C[I][m]&&(C[I]=C[I][m]);var D=C[I].taskData?Object.keys(C[I].taskData):Object.keys(C[I]);l=v.length;for(var M=function(){if(v[l][m]===C[I][m]){if("delete"!==u){if("edit"===u){for(p=0;p<D.length;p++)if(Object.prototype.hasOwnProperty.call(v[l],D[p])&&("Cell"!==i.editSettings.mode||!t.isNullOrUndefined(h)&&0===h.changedRecords.length||D[p]===s)){var e=y(i,C[I].uniqueID);v[l][D[p]]=C[I][D[p]],e&&e.taskData&&(e.taskData[D[p]]=e[D[p]]=v[l][D[p]])}}else if("add"===u||"batchsave"===u){var n=void 0;"Child"===i.editSettings.newRowPosition?r?(x.taskData[i.parentIdMapping]=v[l][i.idMapping],v.splice(l+1,0,x.taskData)):(Object.prototype.hasOwnProperty.call(v[l],i.childMapping)||(v[l][i.childMapping]=[]),v[l][i.childMapping].push(x.taskData),R(m,v[l],u,i,r,x)):"Below"===i.editSettings.newRowPosition?(v.splice(l+1,0,x.taskData),t.isNullOrUndefined(x.parentItem)||R(m,v[l+1],u,i,r,x)):o?"Above"===i.editSettings.newRowPosition&&(v.splice(l,0,x.taskData),t.isNullOrUndefined(x.parentItem)||R(m,v[l],u,i,r,x)):(n=0,v.splice(n,0,x.taskData))}return"break"}var a=v[l];if(v.splice(l,1),r){if(!t.isNullOrUndefined(a[i.parentIdMapping]))for(var d=i.flatData.filter(function(e){return e[i.idMapping]===a[i.parentIdMapping]})[0],c=d?d[i.childMapping]:[],g=c.length-1;g>=0;g--)if(c[g][i.idMapping]===a[i.idMapping]){i.enableImmutableMode||d.childRecords.length!==d.Children.length||d.childRecords.splice(g,1),c.splice(g,1),c.length||(d.hasChildRecords=!1,R(m,d,u,i,r));break}return"break"}}else t.isNullOrUndefined(v[l][i.childMapping])||w(v[l][i.childMapping],C[I],u,m,i,r,x,s)&&R(m,v[l],u,i,r)};l--&&l>=0;){if("break"===M())break}}}function w(e,i,r,n,o,a,s,d){for(var l=!1,p=e.length;p--&&p>=0;)if(e[p][n]===i[n]||a&&e[p][o.parentIdMapping]===i[o.idMapping]){if("edit"===r){for(var h=Object.keys(i),c=y(o,i.uniqueID),u=0;u<h.length;u++)if(Object.prototype.hasOwnProperty.call(e[p],h[u])&&("Cell"!==o.editSettings.mode||h[u]===d)&&(c[h[u]]=c.taskData[h[u]]=e[p][h[u]]=i[h[u]],"Normal"===o.grid.editSettings.mode&&"Cell"===o.editSettings.mode)){o.grid.editModule.editModule.editRowIndex=i.index,o.grid.editModule.editModule.updateCurrentViewData(i)}break}"add"===r||"batchsave"===r?"Child"===o.editSettings.newRowPosition?a?(s[o.parentIdMapping]=e[p][o.idMapping],e.splice(p+1,0,s),R(n,e[p],r,o,a,s)):(Object.prototype.hasOwnProperty.call(e[p],o.childMapping)||(e[p][o.childMapping]=[]),e[p][o.childMapping].push(s.taskData),R(n,e[p],r,o,a,s)):"Above"===o.editSettings.newRowPosition?(e.splice(p,0,s.taskData),t.isNullOrUndefined(s.parentItem)||R(n,e[p],r,o,a,s)):"Below"===o.editSettings.newRowPosition&&(e.splice(p+1,0,s.taskData),t.isNullOrUndefined(s.parentItem)||R(n,e[p],r,o,a,s)):(e.splice(p,1),e.length||(l=!0))}else t.isNullOrUndefined(e[p][o.childMapping])||w(e[p][o.childMapping],i,r,n,o,a,s,d)&&R(n,e[p],r,o,a);return l}function R(e,i,r,o,a,s){if("Above"!==o.editSettings.newRowPosition&&"Below"!==o.editSettings.newRowPosition||"add"!==r&&"batchsave"!==r||t.isNullOrUndefined(s.parentItem)){var d,l=o.grid.getCurrentViewRecords();if(l.map(function(t,r){t[e]!==i[e]||(d=r)}),o.enableVirtualization&&t.isNullOrUndefined(d)){var p=t.getValue("uniqueIDCollection."+s.parentUniqueID,o);i=p}if(t.isNullOrUndefined(d)||(i=l[d]),o.enableVirtualization&&t.isNullOrUndefined(i)&&!t.isNullOrUndefined(s)&&(i=t.getValue("uniqueIDCollection."+s.parentUniqueID,o)),a||t.isNullOrUndefined(i.childRecords)||!i.childRecords.length?i.hasChildRecords=!1:i.hasChildRecords=!0,"add"===r||"batchsave"===r){i.expanded=!0,i.hasChildRecords=!0,o.sortSettings.columns.length&&t.isNullOrUndefined(s)&&(s=l.filter(function(e){return e.parentUniqueID===i.uniqueID?e:null}));var h=s?s instanceof Array?s[0]:s:l[d+1];"Below"!==o.editSettings.newRowPosition&&(Object.prototype.hasOwnProperty.call(i,"childRecords")?t.isNullOrUndefined(s)||i[e]===s[e]||i.childRecords.push(s):i.childRecords=[],-1===i.childRecords.indexOf(h)&&i[e]!==s[e]&&i.childRecords.unshift(h),a&&(Object.prototype.hasOwnProperty.call(i,o.childMapping)||(i[o.childMapping]=[]),-1===i[o.childMapping].indexOf(h)&&i[e]!==s[e]&&i[o.childMapping].unshift(h)))}for(var c=o.grid.getPrimaryKeyFieldNames()[0],u=o.grid.dataSource instanceof n.DataManager?o.grid.dataSource.dataSource.json:o.grid.dataSource,g=0;g<u.length;g++)if(u[g][c]===i[c]){u[g]=i;break}o.grid.setRowData(e,i);var f=o.getRowByIndex(d);"Batch"===o.editSettings.mode&&(f="add"===r?o.getRows()[o.grid.getCurrentViewRecords().indexOf(i)]:o.getRows()[o.grid.getRowIndexByPrimaryKey(i[e])]);var m=void 0;if((o.frozenRows||o.getFrozenColumns())&&(m=o.getMovableRowByIndex(d)),!o.enableVirtualization&&!t.isNullOrUndefined(f)||!t.isNullOrUndefined(m)){var v=o.treeColumnIndex;o.allowRowDragAndDrop&&o.enableImmutableMode&&(v+=1),o.renderModule.cellRender({data:i,cell:f.cells[v]?f.cells[v]:m.cells[v-o.getFrozenColumns()],column:o.grid.getColumns()[o.treeColumnIndex],requestType:r}),(o.enableImmutableMode&&"indenting"===o.action||"outdenting"===o.action)&&o.renderModule.RowModifier({data:i,row:f})}}else{y(o,s.parentItem.uniqueID).childRecords.push(s)}}var C=function(){function e(e){this.allowEditing=!0,this.edit={},this.disableHtmlEncode=!0,this.allowReordering=!0,this.showColumnMenu=!0,this.allowFiltering=!0,this.allowSorting=!0,this.allowResizing=!0,this.filter={},t.merge(this,e)}return e.prototype.setProperties=function(e){for(var t=Object.keys(e),i=0;i<t.length;i++)if(this[t[i]]=e[t[i]],this.parent&&this.parent.isReact&&"template"===t[i]){this.parent.clipboardModule.treeGridParent.renderModule.refreshReactColumnTemplateByUid(this.uid)}},e}(),x=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),b=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},S=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return x(i,e),b([t.Property()],i.prototype,"field",void 0),b([t.Property()],i.prototype,"operator",void 0),b([t.Property()],i.prototype,"value",void 0),b([t.Property()],i.prototype,"matchCase",void 0),b([t.Property()],i.prototype,"ignoreAccent",void 0),b([t.Property()],i.prototype,"predicate",void 0),b([t.Property({})],i.prototype,"actualFilterValue",void 0),b([t.Property({})],i.prototype,"actualOperator",void 0),b([t.Property()],i.prototype,"type",void 0),b([t.Property()],i.prototype,"ejpredicate",void 0),b([t.Property()],i.prototype,"uid",void 0),b([t.Property()],i.prototype,"isForeignKey",void 0),i}(t.ChildProperty),I=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return x(i,e),b([t.Collection([],S)],i.prototype,"columns",void 0),b([t.Property("FilterBar")],i.prototype,"type",void 0),b([t.Property()],i.prototype,"mode",void 0),b([t.Property(!0)],i.prototype,"showFilterBarStatus",void 0),b([t.Property(1500)],i.prototype,"immediateModeDelay",void 0),b([t.Property()],i.prototype,"operators",void 0),b([t.Property(!1)],i.prototype,"ignoreAccent",void 0),b([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),D=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),M=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},O=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return D(i,e),M([t.Property("Both")],i.prototype,"wrapMode",void 0),i}(t.ChildProperty),P=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),E="https://ej2.syncfusion.com/documentation/treegrid",A="https://ej2.syncfusion.com/documentation",N=!1,k=function(e){function r(t){return i.Grid.Inject(i.Logger),e.call(this,t)||this}return P(r,e),r.prototype.getModuleName=function(){return"logger"},r.prototype.log=function(e,r){e instanceof Array||(e=[e]);for(var n=e,o=0;o<n.length;o++){var a=i.detailLists[n[o]],s=a.check(r,this.parent);if(s.success){var d=a.generateMessage(r,this.parent,s.options);d=d.replace("EJ2Grid","EJ2TreeGrid").replace("* Hierarchy Grid","").replace("* Grouping",""),N&&"primary_column_missing"===n[o]&&(d=d.replace("Editing","Row DragAndDrop"),N=!1);var l=d.indexOf("https"),p=d.substring(l);"module_missing"===n[o]?d=d.replace(p,E+"/modules"):"primary_column_missing"===n[o]||"selection_key_missing"===n[o]?d=d.replace(p,A+"/api/treegrid/column/#isprimarykey"):"grid_remote_edit"===n[o]?d=d.replace(p,E+"/edit"):"virtual_height"===n[o]?d=d.replace(p,E+"/virtual"):"check_datasource_columns"===n[o]?d=d.replace(p,E+"/columns"):"locale_missing"===n[o]&&(d=d.replace(p,E+"/global-local/#localization")),"datasource_syntax_mismatch"===n[o]?t.isNullOrUndefined(this.treeGridObj)||t.isNullOrUndefined(this.treeGridObj.dataStateChange)||console[a.logType](d):console[a.logType](d)}}},r.prototype.treeLog=function(e,t,i){this.treeGridObj=i,e instanceof Array||(e=[e]);var r=e;i.allowRowDragAndDrop&&!i.columns.filter(function(e){return e.isPrimaryKey}).length&&(N=!0,this.log("primary_column_missing",t));for(var n=0;n<r.length;n++){var o=U[r[n]],a=o.check(t,i);if(a.success){var s=o.generateMessage(t,i,a.options);console[o.logType](s)}}},r}(i.Logger),U={mapping_fields_missing:{type:"mapping_fields_missing",logType:"error",check:function(e,i){var r={success:!1};return(t.isNullOrUndefined(i.idMapping)&&t.isNullOrUndefined(i.childMapping)&&t.isNullOrUndefined(i.parentIdMapping)||!t.isNullOrUndefined(i.idMapping)&&t.isNullOrUndefined(i.parentIdMapping)||t.isNullOrUndefined(i.idMapping)&&!t.isNullOrUndefined(i.parentIdMapping))&&(r={success:!0}),r},generateMessage:function(){return"[EJ2TreeGrid.Error]: MAPPING FIELDS MISSING \nOne of the following fields is missing. It is required for the hierarchical relationship of records in TreeGrid:\n* childMapping\n* idMapping\n* parentIdMapping\nRefer to the following documentation links for more details.\n"+A+"/api/treegrid#childmapping\n"+A+"/api/treegrid#idmapping\n"+A+"/api/treegrid#$parentidmapping"}}},q="rowDataBound",V="queryCellInfo",B="beforeDataBound",T="actionBegin",L="dataStateChange",F="actionComplete",z="rowSelected",j="checkboxChange",_="rowDeselected",H="toolbarClick",G="beforeExcelExport",Q="beforePdfExport",K="expanded",W="collapsed",Y="remoteExpand",J="localPagedExpandCollapse",X="pagingActions",$="printGrid-Init",Z="contextMenuOpen",ee="contextMenuClick",te="crudAction",ie="beginEdit",re="beginAdd",ne="recordDoubleClick",oe="cellSave",ae="cellSaved",se="cellEdit",de="batchDelete",le="batchCancel",pe="batchAdd",he="beforeBatchDelete",ce="beforeBatchAdd",ue="beforeBatchSave",ge="batchSave",fe="key-pressed",ye="double-tap",me="virtual-action-args",ve="data-listener",we="index-modifier",Re="edit-form",Ce="before-batch-cancel",xe="detailDataBound",be="rowDragStartHelper",Se="rows-add",Ie="rows-remove",De="row-draging",Me="row-dropped",Oe="rowDeselecting",Pe="e-movablecontent",Ee="e-frozencontent",Ae="e-content",Ne="data-rowindex",ke=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ue=function(e){function i(t,i){var r=e.call(this,t.grid,i)||this;return r.treeCopyContent="",r.copiedUniqueIdCollection=[],r.treeGridParent=t,r.serviceLocator=i,r}return ke(i,e),i.prototype.setCopyData=function(i){var r="copyContent",n=this.treeGridParent.getCurrentViewRecords();if(""===window.getSelection().toString()){this.clipBoardTextArea.value=this[r]="";var o=this.treeGridParent.grid.getRows();if("Cell"!==this.treeGridParent.selectionSettings.mode){for(var a=this.treeGridParent.getSelectedRowIndexes().sort(function(e,t){return e-t}),s=0;s<a.length;s++)if(s>0&&(this.treeCopyContent+="\n"),!o[a[s]].classList.contains("e-summaryrow")){var d=[].slice.call(o[a[s]].querySelectorAll(".e-rowcell")),l=this.treeGridParent.getSelectedRecords()[s].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&("Parent"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.parentContentData(n,a[s],o,i,s),this.getCopyData(d,!1,"\t",i),this.treeCopyContent+=this[r],this.copiedUniqueIdCollection.push(l),this[r]="","Child"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.childContentData(n,a[s],o,i))}if(i){var p=[];for(s=0;s<this.treeGridParent.getVisibleColumns().length;s++)p[s]=this.treeGridParent.getVisibleColumns()[s].headerText;this.getCopyData(p,!1,"\t",i),this.treeCopyContent=this[r]+"\n"+this.treeCopyContent}var h={data:this.treeCopyContent,cancel:!1};if(this.treeGridParent.trigger("beforeCopy",h),h.cancel)return;this.clipBoardTextArea.value=this[r]=h.data,t.Browser.userAgent.match(/ipad|ipod|iphone/i)?this.clipBoardTextArea.setSelectionRange(0,this.clipBoardTextArea.value.length):this.clipBoardTextArea.select(),this.isSelect=!0,this.copiedUniqueIdCollection=[],this.treeCopyContent=""}else e.prototype.setCopyData.call(this,i)}},i.prototype.parentContentData=function(e,i,r,n,o){var a="copyContent",s="parentItem",d="uniqueID";if(!t.isNullOrUndefined(e[i][s]))for(var l=e[i][s].level,p=0;p<l+1;p++)for(var h=0;h<e.length;h++)if(!t.isNullOrUndefined(e[i][s])&&e[h][d]===e[i][s][d]){i=h;var c=[].slice.call(r[i].querySelectorAll(".e-rowcell")),u=e[h][d];if(-1===this.copiedUniqueIdCollection.indexOf(u)){this.getCopyData(c,!1,"\t",n),this.treeCopyContent=o>0?this.treeCopyContent+this[a]+"\n":this[a]+"\n"+this.treeCopyContent,this.copiedUniqueIdCollection.push(u),this[a]="";break}}},i.prototype.copy=function(t){e.prototype.copy.call(this,t)},i.prototype.paste=function(t,i,r){e.prototype.paste.call(this,t,i,r)},i.prototype.getModuleName=function(){return"clipboard"},i.prototype.destroy=function(){e.prototype.destroy.call(this)},i.prototype.childContentData=function(e,i,r,n){var o="uniqueID";if(e[i].hasChildRecords)for(var a=e[i].childRecords,s=0;s<a.length;s++)for(var d=0;d<e.length;d++)if(!t.isNullOrUndefined(a[s][o])&&e[d][o]===a[s][o]){if(!t.isNullOrUndefined(r[d])&&!r[d].classList.contains("e-summaryrow")){var l=[].slice.call(r[d].querySelectorAll(".e-rowcell")),p=e[d][o];-1===this.copiedUniqueIdCollection.indexOf(p)&&(this.getCopyData(l,!1,"\t",n),this.treeCopyContent+="\n"+this.copyContent,this.copyContent="",this.copiedUniqueIdCollection.push(p),this.childContentData(e,d,r,n))}break}},i}(i.Clipboard),qe=function(){function e(e){this.parent=e,this.selectedItems=[],this.selectedIndexes=[],this.filteredList=[],this.searchingRecords=[],this.addEventListener()}return e.prototype.getModuleName=function(){return"selection"},e.prototype.addEventListener=function(){this.parent.on("dataBoundArg",this.headerCheckbox,this),this.parent.on("columnCheckbox",this.columnCheckbox,this),this.parent.on("updateGridActions",this.updateGridActions,this),this.parent.grid.on("colgroup-refresh",this.headerCheckbox,this),this.parent.on("checkboxSelection",this.checkboxSelection,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("dataBoundArg",this.headerCheckbox),this.parent.off("columnCheckbox",this.columnCheckbox),this.parent.grid.off("colgroup-refresh",this.headerCheckbox),this.parent.off("checkboxSelection",this.checkboxSelection),this.parent.off("updateGridActions",this.updateGridActions))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.checkboxSelection=function(e){var t,r=i.getObject("target",e),n=i.parentsUntil(r,"e-checkbox-wrapper");if(n&&n.querySelectorAll(".e-treecheckselect").length>0){t=n.querySelector('input[type="checkbox"]');var o=[];o.push(r.closest("tr").rowIndex),this.selectCheckboxes(o),this.triggerChkChangeEvent(t,t.nextElementSibling.classList.contains("e-check"),r.closest("tr"))}else if(n&&n.querySelectorAll(".e-treeselectall").length>0&&this.parent.autoCheckHierarchy){var a=!n.querySelector(".e-frame").classList.contains("e-check")&&!n.querySelector(".e-frame").classList.contains("e-stop");this.headerSelection(a),t=n.querySelector('input[type="checkbox"]'),this.triggerChkChangeEvent(t,a,r.closest("tr"))}},e.prototype.triggerChkChangeEvent=function(e,t,i){var r=this.parent.getCurrentViewRecords()[i.rowIndex],n={checked:t,target:e,rowElement:i,rowData:e.classList.contains("e-treeselectall")?this.parent.getCheckedRecords():r};this.parent.trigger(j,n)},e.prototype.getCheckboxcolumnIndex=function(){for(var e,t,i=this.parent.stackedHeader?this.parent.columnModel:this.parent.columns,r=0;r<i.length;r++)i[r].showCheckbox&&(e=i[r].uid);for(var n=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv").length,o=0;o<n;o++){this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv")[o].getAttribute("e-mappinguid")===e&&(t=o)}return t},e.prototype.headerCheckbox=function(){if(this.columnIndex=this.getCheckboxcolumnIndex(),this.columnIndex>-1&&0===this.parent.getHeaderContent().querySelectorAll(".e-treeselectall").length){var e=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv")[this.columnIndex],i=this.parent.createElement("input",{className:"e-treeselectall",attrs:{type:"checkbox"}});(n=r.createCheckBox(this.parent.createElement,!1,{checked:!1,label:" "})).classList.add("e-hierarchycheckbox"),n.insertBefore(i.cloneNode(),n.firstChild),t.isNullOrUndefined(e)||e.insertBefore(n,e.firstChild),this.parent.autoCheckHierarchy&&this.headerSelection()}else if(this.columnIndex>-1&&this.parent.getHeaderContent().querySelectorAll(".e-treeselectall").length>0){var n,o=(n=this.parent.getHeaderContent().querySelectorAll(".e-checkbox-wrapper")[0]).querySelector(".e-frame").classList.contains("e-check");this.parent.autoCheckHierarchy&&o&&this.headerSelection(o)}},e.prototype.renderColumnCheckbox=function(e){var i=this.parent.createElement("input",{className:"e-treecheckselect",attrs:{type:"checkbox","aria-label":"checkbox"}}),n=e.data;e.cell.classList.add("e-treegridcheckbox"),e.cell.setAttribute("aria-label","checkbox");var o=!t.isNullOrUndefined(n.checkboxState)&&"uncheck"!==n.checkboxState,a=r.createCheckBox(this.parent.createElement,!1,{checked:o,label:" "});if(a.classList.add("e-hierarchycheckbox"),this.parent.allowTextWrap&&(a.querySelector(".e-frame").style.width="18px"),"indeterminate"===n.checkboxState){var s=a.querySelectorAll(".e-frame")[0];t.removeClass([s],["e-check","e-stop","e-uncheck"]),a.querySelector(".e-frame").classList.add("e-stop")}return a.insertBefore(i.cloneNode(),a.firstChild),a},e.prototype.columnCheckbox=function(e){var i=this.renderColumnCheckbox(e),r=e.cell.querySelector(".e-treecolumn-container");if(t.isNullOrUndefined(r)){var n=this.parent.createElement("span",{className:"e-treecheckbox"}),o=e.cell.innerHTML;e.cell.innerHTML="",n.innerHTML=o;var a=this.parent.createElement("div",{className:"e-treecheckbox-container"});a.appendChild(i),a.appendChild(n),e.cell.appendChild(a)}else e.cell.querySelector(".e-hierarchycheckbox")||r.insertBefore(i,r.querySelectorAll(".e-treecell")[0])},e.prototype.selectCheckboxes=function(e){for(var t=0;t<e.length;t++){var i=this.parent.getCurrentViewRecords()[e[t]],r=y(this.parent,i.uniqueID),n="uncheck"===(i=r).checkboxState?"check":"uncheck";i.checkboxState=n;for(var o=Object.keys(i),a=0;a<o.length;a++)Object.prototype.hasOwnProperty.call(r,o[a])&&(r[o[a]]=i[o[a]]);this.traverSelection(i,n,!1),this.parent.autoCheckHierarchy&&this.headerSelection()}},e.prototype.traverSelection=function(e,i,r){var n=0;if(this.updateSelectedItems(e,i),!r&&e.parentItem&&this.parent.autoCheckHierarchy&&this.updateParentSelection(e.parentItem),e.childRecords&&this.parent.autoCheckHierarchy){var o=e.childRecords;!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(o=this.getFilteredChildRecords(o)),n=o.length;for(var a=0;a<n;a++)o[a].isSummaryRow||(o[a].hasChildRecords?this.traverSelection(o[a],i,!0):this.updateSelectedItems(o[a],i))}},e.prototype.getFilteredChildRecords=function(e){var t=this;return e.filter(function(e){return t.parent.filterModule.filteredResult.indexOf(e)>-1})},e.prototype.updateParentSelection=function(e){var i=0,r=[],n=y(this.parent,e.uniqueID);n&&n.childRecords&&(r=n.childRecords),!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(r=this.getFilteredChildRecords(r)),i=r&&r.length;var o=0,a=0;if(!t.isNullOrUndefined(n)){for(var s=0;s<r.length;s++){var d=y(this.parent,r[s].uniqueID);t.isNullOrUndefined(d)||("indeterminate"===d.checkboxState?o++:"check"===d.checkboxState&&a++)}o>0||a>0&&a!==i?n.checkboxState="indeterminate":(0!==a||n.hasFilteredChildRecords&&!t.isNullOrUndefined(n.hasFilteredChildRecords)||t.isNullOrUndefined(this.parent.dataResults.actionArgs)||"searching"!==this.parent.dataResults.actionArgs.requestType&&"filtering"!==this.parent.dataResults.actionArgs.requestType||"check"!==n.checkboxState)&&(0===a&&0===o||0===a&&n.hasFilteredChildRecords&&!t.isNullOrUndefined(this.parent.dataResults.actionArgs)&&("searching"===this.parent.dataResults.actionArgs.requestType||"filtering"===this.parent.dataResults.actionArgs.requestType)&&"check"===n.checkboxState)?n.checkboxState="uncheck":n.checkboxState="check",this.updateSelectedItems(n,n.checkboxState),n.parentItem&&this.updateParentSelection(n.parentItem)}},e.prototype.headerSelection=function(e){var i=this,r=0,n=!1;if(!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0){var o=this.parent.filterModule.filteredResult;0===this.filteredList.length&&(this.filteredList=o),this.parent.grid.searchSettings.key.length?this.searchingRecords=o:this.filteredList!==o?(this.filteredList=o,n=!0):n=!1}this.filteredList.length>0&&(this.parent.filterSettings.columns.length||!this.filteredList.length||this.parent.grid.searchSettings.key.length||(this.filteredList=[]),this.searchingRecords.length&&!t.isNullOrUndefined(e)&&(this.filteredList=this.searchingRecords));var s;if(s=0===this.parent.filterModule.filteredResult.length&&0===this.parent.getCurrentViewRecords().length&&this.parent.filterSettings.columns.length>0?this.filteredList:!t.isNullOrUndefined(this.parent.filterModule)&&this.filteredList.length>0?this.filteredList:this.parent.flatData,s=a(this.parent)?this.parent.getCurrentViewRecords():s,!t.isNullOrUndefined(e))for(var d=0;d<s.length;d++)if(e){if("check"===s[d].checkboxState)continue;if(n)continue;s[d].checkboxState="check",this.updateSelectedItems(s[d],s[d].checkboxState)}else this.selectedItems.indexOf(s[d])>-1&&(s[d].checkboxState="uncheck",this.updateSelectedItems(s[d],s[d].checkboxState),this.parent.autoCheckHierarchy&&this.updateParentSelection(s[d]));!1===e&&this.parent.enableVirtualization&&(this.selectedItems=[],this.selectedIndexes=[],s.filter(function(e){e.checkboxState="uncheck",i.updateSelectedItems(e,e.checkboxState)})),r=this.selectedItems.length;var l=this.parent.getHeaderContent().querySelectorAll(".e-frame")[0];r>0&&s.length>0?r===s.length||e?(t.removeClass([l],["e-stop"]),l.classList.add("e-check")):(t.removeClass([l],["e-check"]),l.classList.add("e-stop")):t.removeClass([l],["e-check","e-stop"])},e.prototype.updateSelectedItems=function(e,i){var r,n,o=this.parent.getCurrentViewRecords().filter(function(t){return t.uniqueID===e.uniqueID}),a=this.parent.getCurrentViewRecords().indexOf(o[0]),s=y(this.parent,e.uniqueID),d=this.parent.getRows()[a];if(a>-1){var l=void 0;(this.parent.frozenRows||this.parent.getFrozenColumns())&&(l=this.parent.getMovableDataRows()[a]),n=d.querySelectorAll(".e-frame")[0]?d.querySelectorAll(".e-frame")[0]:l.querySelectorAll(".e-frame")[0],t.isNullOrUndefined(n)||t.removeClass([n],["e-check","e-stop","e-uncheck"])}if(r=s,t.isNullOrUndefined(r)&&(r=e),r.checkboxState=i,"check"===i&&t.isNullOrUndefined(e.isSummaryRow))-1!==a&&-1===this.selectedIndexes.indexOf(a)&&this.selectedIndexes.push(a),-1===this.selectedItems.indexOf(r)&&-1!==a&&!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.selectedItems.push(r),-1===this.selectedItems.indexOf(r)&&this.parent.enableVirtualization&&!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.selectedItems.push(r),-1!==this.selectedItems.indexOf(r)||t.isNullOrUndefined(this.parent.filterModule)||0!==this.parent.filterModule.filteredResult.length||this.selectedItems.push(r),-1===this.selectedItems.indexOf(r)&&t.isNullOrUndefined(this.parent.filterModule)&&this.selectedItems.push(r);else if(("uncheck"===i||"indeterminate"===i)&&t.isNullOrUndefined(e.isSummaryRow)){var p=this.selectedItems.indexOf(r);if(-1!==p&&this.selectedItems.splice(p,1),-1!==this.selectedIndexes.indexOf(a)){var h=this.selectedIndexes.indexOf(a);this.selectedIndexes.splice(h,1)}}var c="indeterminate"===i?"e-stop":"e-"+i;if(a>-1&&!t.isNullOrUndefined(n)){n.classList.add(c);var u="check"===i?"checked":"uncheck"===i?"unchecked":"mixed";d.querySelector(".e-treecheckselect").setAttribute("aria-checked","check"===i?"true":"uncheck"===i?"false":"mixed"),d.querySelector(".e-frame").setAttribute("title","checkbox"+u)}},e.prototype.updateGridActions=function(e){var i,r,n=this,o=e.requestType;if(d(this.parent)&&this.parent.autoCheckHierarchy)if("sorting"===o||"paging"===o){var s=this.parent.grid.getRows();r=(i=this.parent.getCurrentViewRecords()).length,this.selectedIndexes=[];for(var l=0;l<r;l++)s[l].classList.contains("e-summaryrow")||this.updateSelectedItems(i[l],i[l].checkboxState)}else if("delete"===o||"add"===e.action){var p=[];"delete"===o?p=e.data:p.push(e.data);for(l=0;l<p.length;l++){if("delete"===o){var h=this.parent.flatData.indexOf(p[l]),u=this.selectedIndexes.indexOf(h);this.selectedIndexes.splice(u,1),this.updateSelectedItems(p[l],"uncheck")}t.isNullOrUndefined(p[l].parentItem)||this.updateParentSelection(p[l].parentItem)}}else"add"===e.requestType&&this.parent.autoCheckHierarchy?e.data.checkboxState="uncheck":("filtering"===o||"searching"===o||"refresh"===o&&!a(this.parent))&&(this.selectedItems=[],this.selectedIndexes=[],(i=!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0?this.parent.getCurrentViewRecords():this.parent.flatData).forEach(function(e){if(n.parent.enableVirtualization){e.hasChildRecords&&e.childRecords.length>0?n.updateParentSelection(e):n.updateSelectedItems(e,e.checkboxState);var i=c(e);i=n.getFilteredChildRecords(i);for(var r=0;r<i.length;r++)i[r].hasChildRecords?n.updateParentSelection(i[r]):i[r].hasChildRecords||t.isNullOrUndefined(i[r])||n.updateSelectedItems(i[r],i[r].checkboxState)}else e.hasChildRecords?n.updateParentSelection(e):n.updateSelectedItems(e,e.checkboxState)}),this.headerSelection())},e.prototype.getCheckedrecords=function(){return this.selectedItems},e.prototype.getCheckedRowIndexes=function(){return this.selectedIndexes},e}(),Ve=function(){function e(e){this.parent=e,i.Grid.Inject(i.Print),this.addEventListener()}return e.prototype.getModuleName=function(){return"print"},e.prototype.addEventListener=function(){this.parent.grid.on($,this.printTreeGrid,this)},e.prototype.removeEventListener=function(){this.parent.grid.off($,this.printTreeGrid)},e.prototype.printTreeGrid=function(e){var r=i.getObject("printgrid",e),n=i.getObject("element",e);r.addEventListener(V,this.parent.grid.queryCellInfo),r.addEventListener(q,this.parent.grid.rowDataBound),r.addEventListener(B,this.parent.grid.beforeDataBound),t.addClass([n],"e-treegrid")},e.prototype.print=function(){this.parent.grid.print()},e.prototype.destroy=function(){this.removeEventListener()},e}(),Be=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Te=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Le=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Be(i,e),Te([t.Property()],i.prototype,"fields",void 0),Te([t.Property(!1)],i.prototype,"ignoreCase",void 0),Te([t.Property("contains")],i.prototype,"operator",void 0),Te([t.Property()],i.prototype,"key",void 0),Te([t.Property()],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),Fe=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ze=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},je=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Fe(i,e),ze([t.Property("Row")],i.prototype,"mode",void 0),ze([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),ze([t.Property("Single")],i.prototype,"type",void 0),ze([t.Property(!1)],i.prototype,"persistSelection",void 0),ze([t.Property("Default")],i.prototype,"checkboxMode",void 0),ze([t.Property(!1)],i.prototype,"checkboxOnly",void 0),ze([t.Property(!0)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),_e=function(){function e(e){this.parent=e,this.templateResult=null,this.parent.grid.on("template-result",this.columnTemplateResult,this),this.parent.grid.on("reactTemplateRender",this.reactTemplateRender,this)}return e.prototype.RowModifier=function(e){if(e.data){var r=e.data,n=r.parentItem;if(!t.isNullOrUndefined(r.parentItem)&&!l(this.parent)&&(!this.parent.allowPaging||"Root"===this.parent.pageSettings.pageSizeMode||a(this.parent)&&!u(this.parent))){(this.parent.initialRender&&(!(t.isNullOrUndefined(n[this.parent.expandStateMapping])||n[this.parent.expandStateMapping])||this.parent.enableCollapseAll)||!h(this.parent,e.data,this.parent.grid.getCurrentViewRecords()))&&(e.row.style.display="none")}if(a(this.parent)&&!u(this.parent)){var o=this.parent,s=this.parent.getCurrentViewRecords().filter(function(e){return t.getValue(o.idMapping,e)===t.getValue(o.parentIdMapping,r)});if(s.length>0&&!s[0].isSummaryRow){var d=s[0].expanded?"table-row":"none";e.row.setAttribute("style","display: "+d+";")}}i.getObject("isSummaryRow",e.data)&&t.addClass([e.row],"e-summaryrow"),e.row.querySelector(".e-treegridexpand")?e.row.setAttribute("aria-expanded","true"):e.row.querySelector(".e-treegridcollapse")&&e.row.setAttribute("aria-expanded","false"),this.parent.enableCollapseAll&&this.parent.initialRender&&(t.isNullOrUndefined(r.parentItem)||(e.row.style.display="none")),this.parent.trigger(q,e)}},e.prototype.cellRender=function(e){if(e.data){var r,n,o=this.parent.grid,a=e.data,s=t.isNullOrUndefined(a.filterLevel)?a.level:a.filterLevel,d=0,l=this.parent.getColumnByUid(e.column.uid),p=a.isSummaryRow,c=this.parent.getFrozenColumns();r=t.isNullOrUndefined(a.parentItem)?a.index:a.parentItem.index;if((this.parent.enableColumnVirtualization&&!this.parent.initialRender?this.parent.getVirtualColIndexByUid(e.column.uid):o.getColumnIndexByUid(e.column.uid))!==this.parent.treeColumnIndex||"add"!==e.requestType&&"rowDragAndDrop"!==e.requestType&&"delete"!==e.requestType&&!t.isNullOrUndefined(e.cell.querySelector(".e-treecell")))this.templateResult&&(this.templateResult=null);else{for(var u=t.createElement("div",{className:"e-treecolumn-container"}),g=t.createElement("span",{className:"e-icons e-none",styles:"width: 10px; display: inline-block"}),f=0;f<s;f++)d+=10,u.appendChild(g.cloneNode());var y=t.isNullOrUndefined(a.hasFilteredChildRecords)?a.hasChildRecords:a.hasFilteredChildRecords;if(y&&!t.isNullOrUndefined(a.childRecords)&&(y=!(0===a.childRecords.length)),y){t.addClass([e.cell],"e-treerowcell"),e.cell.setAttribute("aria-expanded",a.expanded?"true":"false");var m=t.createElement("span",{className:"e-icons"}),v=void 0;v=this.parent.initialRender?a.expanded&&(t.isNullOrUndefined(a[this.parent.expandStateMapping])||a[this.parent.expandStateMapping])&&!this.parent.enableCollapseAll:!(!a.expanded||!h(this.parent,a,this.parent.grid.getCurrentViewRecords())),t.addClass([m],v?"e-treegridexpand":"e-treegridcollapse"),d+=18,u.appendChild(m),g.style.width="7px",d+=7,u.appendChild(g.cloneNode())}else(s||!s&&!a.level)&&(d+=20,u.appendChild(g.cloneNode()),u.appendChild(g.cloneNode()));n=t.createElement("span",{className:"e-treecell"}),this.parent.allowTextWrap&&(n.style.width="Calc(100% - "+d+"px)"),t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level),this.updateTreeCell(e,n),u.appendChild(n),e.cell.appendChild(u)}if(o.getFrozenLeftColumnsCount()>0||o.getFrozenRightColumnsCount()>0){var w=o.getFrozenRightColumns(),R=o.getFrozenLeftColumns(),C=o.getMovableColumns();w.length>0&&w[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):R.length>0&&R[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):C.length>0&&C[0].field===e.column.field&&t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level)}else c>this.parent.treeColumnIndex&&c>0&&o.getColumnIndexByUid(e.column.uid)===c?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):c<this.parent.treeColumnIndex&&c>0&&(o.getColumnIndexByUid(e.column.uid)===c||o.getColumnIndexByUid(e.column.uid)===c-1)?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):c===this.parent.treeColumnIndex&&c>0&&o.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex-1&&t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level);if(!t.isNullOrUndefined(l)&&l.showCheckbox&&(this.parent.notify("columnCheckbox",e),this.parent.allowTextWrap)){var x=e.cell.querySelectorAll(".e-frame")[0];d+=parseInt(x.style.width,16),d+=10,(n=o.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex?e.cell.querySelector(".e-treecell"):e.cell.querySelector(".e-treecheckbox")).style.width="Calc(100% - "+d+"px)"}if(p){t.addClass([e.cell],"e-summarycell");var b=i.getObject(e.column.field,e.data);null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML=b:e.column.template?e.cell.innerHTML=null:e.cell.innerHTML=b}t.isNullOrUndefined(this.parent.rowTemplate)&&this.parent.trigger(V,e)}},e.prototype.updateTreeCell=function(e,r){var n=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex],o="templateFn",a=e.column.index;t.isNullOrUndefined(n.field)&&e.cell.setAttribute("data-colindex",a+""),n.field!==e.column.field||t.isNullOrUndefined(n.template)||(e.column.template=n.template,e.column[o]=i.templateCompiler(e.column.template),e.cell.classList.add("e-templatecell"));var s=null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML:e.cell.innerHTML;if("object"==typeof e.column.template&&this.templateResult)i.appendChildren(r,this.templateResult),this.templateResult=null,e.cell.innerHTML="";else if(e.cell.classList.contains("e-templatecell")){var d=e.cell.children.length,l=this.parent.element.id+e.column.uid;if(n.field!==e.column.field||t.isNullOrUndefined(n.template))for(;0<d;d=e.cell.children.length)r.appendChild(e.cell.children[0]);else{var p="portals";if(this.parent.isReact&&"string"!=typeof e.column.template)e.column[o](e.data,this.parent,"template",l,null,null,r),t.isNullOrUndefined(this.parent.grid[p])&&(this.parent.grid[p]=this.parent[p]),this.parent.notify("renderReactTemplate",this.parent[p]),this.parent.renderReactTemplates();else{var h=e.column[o](i.extend({index:""},e.data),this.parent,"template",l,this.parent.isStringTemplate);i.appendChildren(r,h)}delete e.column.template,delete e.column[o],e.cell.innerHTML=""}}else r.innerHTML=s,e.cell.innerHTML=""},e.prototype.refreshReactColumnTemplateByUid=function(e){var r=this;this.parent.isReact&&this.parent.clearTemplate(["columnTemplate"],void 0,function(){for(var n=r.parent.grid.getRowsObject(),o=r.parent.grid.getIndentCount(),a=r.parent.grid.getNormalizedColumnIndex(e),s=0;s<n.length;s++)if(n[s].isDataRow&&!t.isNullOrUndefined(n[s].index)){var d=n[s].cells[a],l=new i.CellRenderer(r.parent.grid,r.parent.grid.serviceLocator),p=r.parent.getCellFromIndex(n[s].index,a-o);l.refreshTD(p,d,n[s].data,{index:n[s].index});var h=r.parent.getRows()[s].cells[a];r.cellRender({data:n[s].data,cell:h,column:d.column})}})},e.prototype.columnTemplateResult=function(e){this.templateResult=e.template},e.prototype.reactTemplateRender=function(e){this.parent.portals=e,this.parent.notify("renderReactTemplate",this.parent.portals),this.parent.renderReactTemplates()},e.prototype.destroy=function(){this.parent.grid.off("template-result",this.columnTemplateResult),this.parent.grid.off("reactTemplateRender",this.reactTemplateRender)},e}(),He=function(){function e(e){this.addedRecords="addedRecords",this.parent=e,this.parentItems=[],this.taskIds=[],this.hierarchyData=[],this.storedIndex=-1,this.sortedData=[],this.isSortAction=!1,this.addEventListener(),this.dataResults={},this.isSelfReference=!t.isNullOrUndefined(this.parent.parentIdMapping)}return e.prototype.addEventListener=function(){this.parent.on("updateRemoteLevel",this.updateParentRemoteData,this),this.parent.grid.on("sorting-begin",this.beginSorting,this),this.parent.on("updateAction",this.updateData,this),this.parent.on(Y,this.collectExpandingRecs,this),this.parent.on("dataProcessor",this.dataProcessor,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Y,this.collectExpandingRecs),this.parent.off("updateRemoteLevel",this.updateParentRemoteData),this.parent.off("updateAction",this.updateData),this.parent.off("dataProcessor",this.dataProcessor),this.parent.grid.off("sorting-begin",this.beginSorting))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.isRemote=function(){return this.parent.dataSource instanceof n.DataManager},e.prototype.convertToFlatData=function(e){var r=this;if(this.parent.flatData=0!==Object.keys(e).length||this.parent.dataSource instanceof n.DataManager?[]:this.parent.dataSource,this.parent.parentData=[],a(this.parent)&&!u(this.parent)&&e instanceof n.DataManager&&!(e instanceof Array)){var o=this.parent.dataSource;if(this.parent.parentIdMapping){if(this.parent.query=t.isNullOrUndefined(this.parent.query)?new n.Query:this.parent.query,this.parent.parentIdMapping){var s=this.parent.query.params.filter(function(e){return"IdMapping"===e.key});this.parent.initialRender&&!s.length&&(this.parent.query.where(this.parent.parentIdMapping,"equal",null),this.parent.query.addParams("IdMapping",this.parent.idMapping))}if(!this.parent.hasChildMapping){var d=this.parent.query.clone();d.queries=[],(d=d.select([this.parent.parentIdMapping])).isCountRequired=!0,o.executeQuery(d).then(function(e){r.parentItems=n.DataUtil.distinct(e.result,r.parent.parentIdMapping,!1);0===i.getObject("dataSource.requests",r.parent).filter(function(e){return"OK"!==e.httpRequest.statusText}).length&&(t.setValue("grid.contentModule.isLoaded",!0,r.parent),t.isNullOrUndefined(r.zerothLevelData)||(t.setValue("cancel",!1,r.zerothLevelData),t.getValue("grid.renderModule",r.parent).dataManagerSuccess(r.zerothLevelData),r.zerothLevelData=null),r.parent.grid.hideSpinner())})}}}else e instanceof Array&&this.convertJSONData(e)},e.prototype.convertJSONData=function(e){if(this.hierarchyData=[],this.taskIds=[],this.parent.idMapping)for(var i=Object.keys(e),r=0;r<i.length;r++){var o=e[r];this.hierarchyData.push(t.extend({},o)),t.isNullOrUndefined(o[this.parent.idMapping])||this.taskIds.push(o[this.parent.idMapping])}else this.hierarchyData=e;if(this.isSelfReference){var a=[],s=new n.DataManager(this.hierarchyData).executeLocal((new n.Query).group(this.parent.parentIdMapping));for(r=0;r<s.length;r++){var d=s[r],l=this.taskIds.indexOf(d.key);if(!t.isNullOrUndefined(d.key)&&l>-1){var p=d.items;this.hierarchyData[l][this.parent.childMapping]=p}else a.push.apply(a,d.items)}this.hierarchyData=this.selfReferenceUpdate(a)}if(Object.keys(this.hierarchyData).length)this.createRecords(this.hierarchyData);else{var h=!(this.parent.dataSource instanceof n.DataManager)&&this.parent.isGantt;this.parent.flatData=h?this.parent.dataSource:[]}this.storedIndex=-1},e.prototype.selfReferenceUpdate=function(e){for(var t=[];this.hierarchyData.length>0&&e.length>0;){var i=e.indexOf(this.hierarchyData[0]);-1===i?this.hierarchyData.shift():(t.push(this.hierarchyData.shift()),e.splice(i,1))}return t},e.prototype.updateParentRemoteData=function(e){var r=e.result;if(this.parent.hasChildMapping||this.parentItems.length||this.parent.loadChildOnDemand)if(this.parent.loadChildOnDemand)t.isNullOrUndefined(r)||this.parent.loadChildOnDemand&&s(this.parent)&&!t.isNullOrUndefined(this.parent.dataResults.expandRecord)||this.convertToFlatData(r);else for(var n=0;n<r.length;n++)s(this.parent)&&r[n].hasChildRecords&&this.parent.initialRender&&(r[n].expanded=!1),t.isNullOrUndefined(r[n].index)&&(r[n].taskData=t.extend({},r[n]),r[n].uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r[n].uniqueID,r[n],this.parent),r[n].level=0,r[n].index=Math.ceil(1e3*Math.random()),(r[n][this.parent.hasChildMapping]||-1!==this.parentItems.indexOf(r[n][this.parent.idMapping]))&&(r[n].hasChildRecords=!0),r[n].checkboxState="uncheck");else this.zerothLevelData=e,t.setValue("cancel",!0,e);e.result=this.parent.loadChildOnDemand?this.parent.flatData:r,this.parent.notify("updateResults",e)},e.prototype.collectExpandingRecs=function(e,i){var r=this.parent.getRows();if(this.parent.rowTemplate){var n=this.parent.getContentTable().rows;r=[].slice.call(n)}var o;if(e.rows.length>0){i||(e.record.expanded=!0);for(var a=0;a<e.rows.length;a++){if(e.rows[a].style.display="table-row",this.parent.loadChildOnDemand){var s=e.rows[a].getElementsByClassName("e-treegridcollapse")[0];o=this.parent.rowTemplate?this.parent.grid.getCurrentViewRecords()[e.rows[a].rowIndex]:this.parent.grid.getRowObjectFromUID(e.rows[a].getAttribute("data-Uid")).data,!t.isNullOrUndefined(s)&&o.expanded&&(t.addClass([s],"e-treegridexpand"),t.removeClass([s],"e-treegridcollapse"));var d=[];(d=r.filter(function(e){return e.querySelector(".e-gridrowindex"+o.index+"level"+(o.level+1))})).length&&o.expanded&&this.collectExpandingRecs({record:o,rows:d,parentRow:e.parentRow},!0)}var l=e.rows[a].querySelector(".e-detailrowcollapse");t.isNullOrUndefined(l)||this.parent.grid.detailRowModule.expand(l)}}else this.fetchRemoteChildData({record:e.record,rows:e.rows,parentRow:e.parentRow})},e.prototype.fetchRemoteChildData=function(e){var r=this,a={row:e.parentRow,data:e.record},s=this.parent.dataSource,d=this.parent.grid.getDataModule().generateQuery(),l=d.queries.filter(function(e){return"onPage"!==e.fn&&"onWhere"!==e.fn});d.queries=l,d.isCountRequired=!0,d.where(this.parent.parentIdMapping,"equal",e.record[this.parent.idMapping]),o.showSpinner(this.parent.element),s.executeQuery(d).then(function(s){var d=r.parent.grid.currentViewData.slice(),l=d.indexOf(e.record);-1===l&&r.parent.grid.getRowsObject().forEach(function(t){t.data.uniqueID===e.record.uniqueID&&(l=t.index)});var p=i.getObject("actual.nextLevel",s),h=s.result;e.record.childRecords=h;for(var c=0;c<h.length;c++){h[c].taskData=t.extend({},h[c]),h[c].level=e.record.level+1,h[c].index=Math.ceil(1e3*Math.random());var u=t.extend({},e.record);delete u.childRecords,h[c].parentItem=u,h[c].parentUniqueID=e.record.uniqueID,h[c].uniqueID=i.getUid(r.parent.element.id+"_data_"),h[c].checkboxState="uncheck",t.setValue("uniqueIDCollection."+h[c].uniqueID,h[c],r.parent),!h[c][r.parent.hasChildMapping]&&-1===r.parentItems.indexOf(h[c][r.parent.idMapping])||p&&!p[c]||(h[c].hasChildRecords=!0,h[c].expanded=!1),d.splice(l+c+1,0,h[c])}if(t.setValue("result",d,s),t.setValue("action","beforecontentrender",s),r.parent.trigger(F,s),o.hideSpinner(r.parent.element),r.parent.grid.aggregates.length>0&&!r.parent.enableVirtualization){var g=i.getObject("query",s);if(t.isNullOrUndefined(g)&&(g=t.getValue("grid.renderModule.data",r.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(g)){var f=g.queries.filter(function(e){return"onAggregates"===e.fn});s.result=r.parent.summaryModule.calculateSummaryValue(f,s.result,!0)}}s.count=r.parent.grid.pageSettings.totalRecordsCount;var y={};r.parent.enableVirtualization&&r.remoteVirtualAction(y);var m={index:l,childData:h};r.parent.enableInfiniteScrolling?r.parent.notify("infinite-remote-expand",m):t.getValue("grid.renderModule",r.parent).dataManagerSuccess(s,y),r.parent.trigger(K,a)})},e.prototype.remoteVirtualAction=function(e){e.requestType="refresh",t.setValue("isExpandCollapse",!0,e);var i=t.getValue("grid.contentModule",this.parent),r=t.getValue("currentInfo",i),n=t.getValue("prevInfo",i);r.loadNext&&this.parent.grid.pageSettings.currentPage===r.nextInfo.page&&(this.parent.grid.pageSettings.currentPage=n.page)},e.prototype.beginSorting=function(){this.isSortAction=!0},e.prototype.createRecords=function(e,r){for(var n=[],o=0,a=Object.keys(e).length;o<a;o++){var d=t.extend({},e[o]);d.taskData=e[o];var l=0;if(this.storedIndex++,Object.prototype.hasOwnProperty.call(d,"index")||(d.index=this.storedIndex),(!t.isNullOrUndefined(d[this.parent.childMapping])&&!s(this.parent)||d[this.parent.hasChildMapping]&&s(this.parent))&&(d.hasChildRecords=!0,this.parent.enableCollapseAll||!t.isNullOrUndefined(this.parent.dataStateChange)&&t.isNullOrUndefined(d[this.parent.childMapping])?d.expanded=!1:d.expanded=!!t.isNullOrUndefined(d[this.parent.expandStateMapping])||d[this.parent.expandStateMapping]),Object.prototype.hasOwnProperty.call(d,"index")||(d.index=(d.hasChildRecords,this.storedIndex)),this.isSelfReference&&t.isNullOrUndefined(d[this.parent.parentIdMapping])&&this.parent.parentData.push(d),d.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+d.uniqueID,d,this.parent),!t.isNullOrUndefined(r)){var p=t.extend({},r);delete p.childRecords,delete p[this.parent.childMapping],this.isSelfReference&&delete p.taskData[this.parent.childMapping],d.parentItem=p,d.parentUniqueID=p.uniqueID,l=r.level+1}if(Object.prototype.hasOwnProperty.call(d,"level")||(d.level=l),d.checkboxState="uncheck",(t.isNullOrUndefined(d[this.parent.parentIdMapping])||d.parentItem)&&(this.parent.flatData.push(d),this.parent.infiniteScrollData.push(d)),this.isSelfReference||0!==d.level||this.parent.parentData.push(d),!t.isNullOrUndefined(d[this.parent.childMapping]&&d[this.parent.childMapping].length)){var h=this.createRecords(d[this.parent.childMapping],d);d.childRecords=h}n.push(d)}return n},e.prototype.dataProcessor=function(e){var r,o=i.getObject("isExport",e),a=i.getObject("expresults",e),d=i.getObject("exportType",e),l=i.getObject("isPrinting",e),p=i.getObject("actionArgs",e),h=i.getObject("requestType",e),c=i.getObject("data",e),g=i.getObject("action",e),f=p,y=this.parent.getPrimaryKeyFieldNames()[0],m=i.getObject("data",f);t.isNullOrUndefined(f)||t.isNullOrUndefined(f.action)||"add"!==f.action||t.isNullOrUndefined(f.data)||!t.isNullOrUndefined(f.data[y])||(f.data[y]=e.result[f.index][y],m.taskData[y]=e.result[f.index][y]),(!t.isNullOrUndefined(p)&&Object.keys(p).length||"save"===h)&&(h=h||p.requestType,c=c||i.getObject("data",p),g=g||i.getObject("action",p),"Batch"===this.parent.editSettings.mode&&(this.batchChanges=this.parent.grid.editModule.getBatchChanges()),this.parent.isLocalData&&this.updateAction(c,g,h));var v,w,R=(r=o&&!t.isNullOrUndefined(a)?a:s(this.parent)?t.getValue("result",this.parent.grid.dataSource):this.parent.grid.dataSource)instanceof n.DataManager?r.dataSource.json:r,C=s(this.parent)?t.getValue("count",this.parent.dataSource):R.length,x=new n.Query,b=i.getObject("query",e);if(t.isNullOrUndefined(b)||(v=b.queries.filter(function(e){return"onWhere"===e.fn}),w=b.queries.filter(function(e){return"onSearch"===e.fn})),this.parent.grid.allowFiltering&&this.parent.grid.filterSettings.columns.length||this.parent.grid.searchSettings.key.length>0||!t.isNullOrUndefined(b)&&(v.length||w.length)&&this.parent.isLocalData){t.isNullOrUndefined(b)&&(b=new n.Query,b=t.getValue("grid.renderModule.data",this.parent).filterQuery(b),b=t.getValue("grid.renderModule.data",this.parent).searchQuery(b));var S=b.queries.filter(function(e){return"onWhere"===e.fn}),I=b.queries.filter(function(e){return"onSearch"===e.fn});x.queries=S.concat(I);var D=new n.DataManager(R).executeLocal(x);if(this.parent.notify("updateFilterRecs",{data:D}),R=this.dataResults.result,this.dataResults.result=null,this.parent.grid.aggregates.length>0){var M=i.getObject("query",e);if(t.isNullOrUndefined(b)&&(b=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(M)){var O=M.queries.filter(function(e){return"onAggregates"===e.fn});R=this.parent.summaryModule.calculateSummaryValue(O,R,!0)}}}if(this.parent.grid.aggregates.length&&0===this.parent.grid.sortSettings.columns.length&&0===this.parent.grid.filterSettings.columns.length&&!this.parent.grid.searchSettings.key.length){var P=i.getObject("query",e);t.isNullOrUndefined(P)&&(P=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query));O=P.queries.filter(function(e){return"onAggregates"===e.fn});R=this.parent.summaryModule.calculateSummaryValue(O,this.parent.flatData,!0)}if(this.parent.grid.sortSettings.columns.length>0||this.isSortAction){this.isSortAction=!1;for(var E=this.parent.parentData,A=(M=i.getObject("query",e),new n.Query),N=this.parent.grid.sortSettings.columns.length-1;N>=0;N--){var k=this.parent.grid.renderModule.data.getColumnByField(this.parent.grid.sortSettings.columns[N].field),U=k.sortComparer&&u(this.parent)?k.sortComparer.bind(k):this.parent.grid.sortSettings.columns[N].direction;A.sortBy(this.parent.grid.sortSettings.columns[N].field,U)}var q=new n.DataManager(E).executeLocal(A);if(this.parent.allowRowDragAndDrop&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var V=q.indexOf(this.parent.rowDragAndDropModule.draggedRecord);q.splice(V,1);var B=q.indexOf(this.parent.rowDragAndDropModule.droppedRecord);this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"topSegment"===this.parent.rowDragAndDropModule.dropPosition?q.splice(B,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&q.splice(B+1,0,this.parent.rowDragAndDropModule.draggedRecord)}var T={modifiedData:q,filteredData:R,srtQry:A};if(this.parent.notify("createSort",T),R=T.modifiedData,this.dataResults.result=null,this.sortedData=R,this.parent.notify("updateModel",{}),this.parent.grid.aggregates.length>0&&!t.isNullOrUndefined(M)){O=i.getObject("query",e).queries.filter(function(e){return"onAggregates"===e.fn});R=this.parent.summaryModule.calculateSummaryValue(O,this.sortedData,!1)}}C=s(this.parent)?t.getValue("count",this.parent.dataSource):R.length;var L=this.paging(R,C,o,l,d,e);R=L.result,C=L.count,e.result=R,e.count=C,this.parent.notify("updateResults",e)},e.prototype.paging=function(e,i,r,n,o,a){if(!this.parent.allowPaging||r&&"CurrentPage"!==o||n&&"CurrentPage"!==this.parent.printMode){if((this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)&&(!r||"CurrentPage"===o)&&"save"!==t.getValue("requestType",a)){var d=this.parent.enableInfiniteScrolling?a:t.getValue("actionArgs",a);this.parent.notify(X,{result:e,count:i,actionArgs:d}),e=this.dataResults.result,i=this.dataResults.count}}else this.parent.notify(X,{result:e,count:i}),e=this.dataResults.result,i=s(this.parent)?t.getValue("count",this.parent.dataSource):this.dataResults.count;var l="isCollapsedStatePersist";if((!0===n||a.isPdfExport&&(t.isNullOrUndefined(a[l])||a[l]))&&"AllPages"===this.parent.printMode){for(var p=[],c=0;c<e.length;c++){h(this.parent,e[c],this.parent.parentData)&&p.push(e[c])}i=(e=p).length}return{result:e,count:i}},e.prototype.updateData=function(e){this.dataResults=e},e.prototype.updateAction=function(e,t,i){"delete"!==i&&"save"!==i||this.parent.notify(te,{value:e,action:t||i}),"batchsave"===i&&"Batch"===this.parent.editSettings.mode&&this.parent.notify(ge,{})},e}();!function(e){e[e.Add=0]="Add",e[e.Edit=1]="Edit",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e[e.Cancel=4]="Cancel",e[e.Search=5]="Search",e[e.ExpandAll=6]="ExpandAll",e[e.CollapseAll=7]="CollapseAll",e[e.ExcelExport=8]="ExcelExport",e[e.PdfExport=9]="PdfExport",e[e.CsvExport=10]="CsvExport",e[e.Print=11]="Print",e[e.RowIndent=12]="RowIndent",e[e.RowOutdent=13]="RowOutdent"}(e.ToolbarItem||(e.ToolbarItem={})),function(e){e[e.AutoFit=0]="AutoFit",e[e.AutoFitAll=1]="AutoFitAll",e[e.SortAscending=2]="SortAscending",e[e.SortDescending=3]="SortDescending",e[e.Edit=4]="Edit",e[e.Delete=5]="Delete",e[e.Save=6]="Save",e[e.Cancel=7]="Cancel",e[e.PdfExport=8]="PdfExport",e[e.ExcelExport=9]="ExcelExport",e[e.CsvExport=10]="CsvExport",e[e.FirstPage=11]="FirstPage",e[e.PrevPage=12]="PrevPage",e[e.LastPage=13]="LastPage",e[e.NextPage=14]="NextPage",e[e.AddRow=15]="AddRow",e[e.RowIndent=16]="RowIndent",e[e.RowOutdent=17]="RowOutdent"}(e.ContextMenuItems||(e.ContextMenuItems={}));var Ge=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qe=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ge(i,e),Qe([t.Property(12)],i.prototype,"pageSize",void 0),Qe([t.Property(8)],i.prototype,"pageCount",void 0),Qe([t.Property(1)],i.prototype,"currentPage",void 0),Qe([t.Property()],i.prototype,"totalRecordsCount",void 0),Qe([t.Property(!1)],i.prototype,"enableQueryString",void 0),Qe([t.Property(!1)],i.prototype,"pageSizes",void 0),Qe([t.Property(null)],i.prototype,"template",void 0),Qe([t.Property("All")],i.prototype,"pageSizeMode",void 0),i}(t.ChildProperty),We=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ye=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Je=function(e){function r(){var i=null!==e&&e.apply(this,arguments)||this;return i.intl=new t.Internationalization,i.templateFn={},i}return We(r,e),r.prototype.setFormatter=function(e){this.format&&(this.format.skeleton||this.format.format)&&(this.formatFn=this.getFormatFunction(this.format))},r.prototype.getFormatFunction=function(e){return e.type?this.intl.getDateFormat(e):this.intl.getNumberFormat(e)},r.prototype.getFormatter=function(){return this.formatFn},r.prototype.setTemplate=function(e){void 0===e&&(e={}),void 0!==this.footerTemplate&&(this.templateFn[t.getEnumValue(i.CellType,i.CellType.Summary)]={fn:t.compile(this.footerTemplate,e),property:"footerTemplate"})},r.prototype.getTemplate=function(e){return this.templateFn[t.getEnumValue(i.CellType,e)]},r.prototype.setPropertiesSilent=function(e){this.setProperties(e,!0)},Ye([t.Property()],r.prototype,"type",void 0),Ye([t.Property()],r.prototype,"footerTemplate",void 0),Ye([t.Property()],r.prototype,"field",void 0),Ye([t.Property()],r.prototype,"format",void 0),Ye([t.Property()],r.prototype,"columnName",void 0),Ye([t.Property()],r.prototype,"customAggregate",void 0),r}(t.ChildProperty),Xe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return We(i,e),Ye([t.Collection([],Je)],i.prototype,"columns",void 0),Ye([t.Property(!0)],i.prototype,"showChildSummary",void 0),i}(t.ChildProperty),$e=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ze=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},et=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return $e(i,e),Ze([t.Property(!1)],i.prototype,"allowAdding",void 0),Ze([t.Property(!1)],i.prototype,"allowEditing",void 0),Ze([t.Property(!1)],i.prototype,"allowDeleting",void 0),Ze([t.Property("Cell")],i.prototype,"mode",void 0),Ze([t.Property("Top")],i.prototype,"newRowPosition",void 0),Ze([t.Property(!0)],i.prototype,"allowEditOnDblClick",void 0),Ze([t.Property(!0)],i.prototype,"showConfirmDialog",void 0),Ze([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),Ze([t.Property("")],i.prototype,"template",void 0),Ze([t.Property({})],i.prototype,"dialog",void 0),Ze([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),tt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),it=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},rt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return tt(i,e),it([t.Property()],i.prototype,"field",void 0),it([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),nt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return tt(i,e),it([t.Collection([],rt)],i.prototype,"columns",void 0),it([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),ot=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),at=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},st=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ot(i,e),at([t.Property(!1)],i.prototype,"enableCache",void 0),at([t.Property(3)],i.prototype,"maxBlocks",void 0),at([t.Property(3)],i.prototype,"initialBlocks",void 0),i}(t.ChildProperty),dt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),lt=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},pt=function(r){function d(e,n){var o=r.call(this,e,n)||this;o.dataResults={},o.uniqueIDCollection={},o.uniqueIDFilterCollection={},o.changedRecords="changedRecords",o.deletedRecords="deletedRecords",o.addedRecords="addedRecords",o.indentOutdentAction="indentOutdentAction",o.modifiedRecords=[],o.stackedHeader=!1,o.objectEqualityChecker=function(e,t){if(e){for(var i=Object.keys(e),r=!0,n=["Children","childRecords","taskData","uniqueID","parentItem","parentUniqueID","index"],o=0;o<i.length;o++)if(e[i[o]]!==t[i[o]]&&-1===n.indexOf(i[o])){if(!(e[i[o]]instanceof Date&&t[i[o]]instanceof Date)||e[i[o]].getTime()!==t[i[o]].getTime()){r=!1;break}}return r}return!1},l.Inject(qe),t.setValue("mergePersistData",o.mergePersistTreeGridData,o);return t.isNullOrUndefined(o.injectedModules.Logger)||i.Grid.Inject(i.Logger),o.grid=new i.Grid,o}dt(d,r),l=d,d.prototype.excelExport=function(e,t,i,r){return this.excelExportModule.Map(e,t,i,r,!1)},d.prototype.csvExport=function(e,t,i,r){return this.excelExportModule.Map(e,t,i,r,!0)},d.prototype.pdfExport=function(e,t,i,r){return this.pdfExportModule.Map(e,t,i,r)},d.prototype.getModuleName=function(){return"treegrid"},d.prototype.preRender=function(){this.TreeGridLocale(),this.initProperties(),this.defaultLocale={Above:"Above",Below:"Below",Child:"Child",AddRow:"Add Row",ExpandAll:"Expand All",CollapseAll:"Collapse All",RowIndent:"Indent",RowOutdent:"Outdent"},this.l10n=new t.L10n("treegrid",this.defaultLocale,this.locale),this.isSelfReference&&t.isNullOrUndefined(this.childMapping)&&(this.childMapping="Children")},d.prototype.sortByColumn=function(e,t,i){this.sortModule&&this.sortModule.sortColumn(e,t,i)},d.prototype.clearSorting=function(){this.sortModule&&this.sortModule.clearSorting()},d.prototype.removeSortColumn=function(e){this.sortModule&&this.sortModule.removeSortColumn(e)},d.prototype.search=function(e){this.grid.search(e)},d.prototype.autoFitColumns=function(e){this.resizeModule.autoFitColumns(e),this.updateColumnModel()},d.prototype.reorderColumns=function(e,t){this.grid.reorderColumns(e,t)},d.prototype.TreeGridLocale=function(){var e=t.L10n.locale,r={};t.setValue(this.locale,{},r);var n;n={},n=i.getObject(this.locale,e);var o;o={},o=i.getObject(this.getModuleName(),n),t.setValue("grid",o,i.getObject(this.locale,r)),t.L10n.load(r)},d.prototype.print=function(){this.printModule.print()},d.prototype.treeGridkeyActionHandler=function(e){if(this.allowKeyboard){var i=void 0,r=void 0,n=void 0;switch(e.action){case"ctrlDownArrow":this.expandAll();break;case"ctrlUpArrow":this.collapseAll();break;case"ctrlShiftUpArrow":null!==(r=e.target.closest(".e-rowcell").closest("tr"))&&void 0!==r&&this.expandCollapseRequest(r.querySelector(".e-treegridexpand"));break;case"ctrlShiftDownArrow":null!==(r=e.target.closest(".e-rowcell").closest("tr"))&&void 0!==r&&this.expandCollapseRequest(r.querySelector(".e-treegridcollapse"));break;case"downArrow":if(!this.enableVirtualization)if(i=e.target.parentElement,null!==(n=this.findnextRowElement(i))){var o=n.rowIndex;this.selectRow(o);var a=e.target.cellIndex,s=n.children[a];t.addClass([s],"e-focused"),t.addClass([s],"e-focus")}else this.clearSelection();break;case"upArrow":if(!this.enableVirtualization)if(i=e.target.parentElement,null!==(n=this.findPreviousRowElement(i))){var d=n.rowIndex;this.selectRow(d);var l=e.target.cellIndex,p=n.children[l];t.addClass([p],"e-focused"),t.addClass([p],"e-focus")}else this.clearSelection()}}},d.prototype.findnextRowElement=function(e){var t=e.nextElementSibling;return null===t||-1===t.className.indexOf("e-summaryrow")&&"none"!==t.style.display||(t=this.findnextRowElement(t)),t},d.prototype.findPreviousRowElement=function(e){var t=e.previousElementSibling;return null===t||-1===t.className.indexOf("e-summaryrow")&&"none"!==t.style.display||(t=this.findPreviousRowElement(t)),t},d.prototype.initProperties=function(){this.defaultLocale={},this.flatData=[],this.infiniteScrollData=[],this.parentData=[],this.columnModel=[],this.isExpandAll=!1,this.isCollapseAll=!1,this.keyConfigs={ctrlDownArrow:"ctrl+downarrow",ctrlUpArrow:"ctrl+uparrow",ctrlShiftUpArrow:"ctrl+shift+uparrow",ctrlShiftDownArrow:"ctrl+shift+downarrow",downArrow:"downArrow",upArrow:"upArrow"},this.isLocalData=!(this.dataSource instanceof n.DataManager)||this.dataSource.dataSource.offline||!t.isNullOrUndefined(this.dataSource.ready)||this.dataSource.adaptor instanceof n.RemoteSaveAdaptor,this.isSelfReference=!t.isNullOrUndefined(this.parentIdMapping)},d.prototype.wireEvents=function(){t.EventHandler.add(this.grid.element,"click",this.mouseClickHandler,this),t.EventHandler.add(this.element,"touchend",this.mouseClickHandler,this),this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.treeGridkeyActionHandler.bind(this),keyConfigs:this.keyConfigs,eventName:"keydown"}),this.allowKeyboard&&(this.element.tabIndex=-1===this.element.tabIndex?0:this.element.tabIndex)},d.prototype.requiredModules=function(){var e=[];if(this.grid.splitFrozenCount(this.getGridColumns(this.columns)),this.isDestroyed)return e;e.push({member:"filter",args:[this,this.filterSettings]}),t.isNullOrUndefined(this.toolbar)||e.push({member:"toolbar",args:[this]}),this.contextMenuItems&&e.push({member:"contextMenu",args:[this]}),this.allowPaging&&e.push({member:"pager",args:[this,this.pageSettings]}),this.allowReordering&&e.push({member:"reorder",args:[this]}),this.allowSorting&&e.push({member:"sort",args:[this]}),this.aggregates.length>0&&e.push({member:"summary",args:[this]}),e.push({member:"resize",args:[this]}),this.allowExcelExport&&e.push({member:"ExcelExport",args:[this]});var i=this.injectedModules.filter(function(e){return"freeze"===e.prototype.getModuleName()});return(this.frozenColumns||this.frozenRows||this.getFrozenColumns()||this.grid.getFrozenLeftColumnsCount()||this.grid.getFrozenRightColumnsCount()||i.length)&&e.push({member:"freeze",args:[this]}),this.detailTemplate&&e.push({member:"detailRow",args:[this]}),this.allowPdfExport&&e.push({member:"PdfExport",args:[this]}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this]}),this.showColumnChooser&&e.push({member:"ColumnChooser",args:[this]}),this.extendRequiredModules(e),e},d.prototype.extendRequiredModules=function(e){var i=this.injectedModules.filter(function(e){return"rowDragAndDrop"===e.prototype.getModuleName()});(this.allowRowDragAndDrop||i.length)&&(t.isNullOrUndefined(this.toolbar)||!this.toolbar.includes("Indent")&&!this.toolbar.includes("Outdent")||(this.isIndentEnabled=!0),e.push({member:"rowDragAndDrop",args:[this]})),(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&e.push({member:"edit",args:[this]}),this.isCommandColumn(this.columns)&&e.push({member:"commandColumn",args:[this]}),this.allowSelection&&e.push({member:"selection",args:[this]}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this]}),this.enableInfiniteScrolling&&e.push({member:"infiniteScroll",args:[this]}),e.push({member:"logger",args:[this.grid]})},d.prototype.isCommandColumn=function(e){var t=this;return e.some(function(e){return e.columns?t.isCommandColumn(e.columns):!(!e.commands&&!e.commandsTemplate)})},d.prototype.unwireEvents=function(){this.grid&&this.grid.element&&t.EventHandler.remove(this.grid.element,"click",this.mouseClickHandler)},d.prototype.log=function(e,t){this.loggerModule&&this.loggerModule.treeLog(e,t,this)},d.prototype.render=function(){var e=this;this.isReact&&(this.grid.isReact=!0,this.grid.portals=[]),this.isVue&&(this.grid.isVue=!0),o.createSpinner({target:this.element},this.createElement),this.log(["mapping_fields_missing"]),this.renderModule=new _e(this),this.dataModule=new He(this),this.printModule=new Ve(this),this.trigger("load"),this.autoGenerateColumns(),this.initialRender=!0,t.isNullOrUndefined(this.dataSource)||this.convertTreeData(this.dataSource),this.loadGrid(),this.element.classList.contains("e-treegrid")&&this.rowDropSettings.targetID&&(this.grid.rowDropSettings.targetID+="_gridcontrol"),this.addListener();var i=t.createElement("div",{id:this.element.id+"_gridcontrol"});t.addClass([this.element],"e-treegrid"),t.isNullOrUndefined(this.height)||"string"!=typeof this.height||-1===this.height.indexOf("%")||(this.element.style.height=this.height),t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(this.element.style.width=this.width),this.element.appendChild(i);var r=this.grid.requiredModules;this.grid.requiredModules=function(){var e=[];e=r.apply(this);for(var t=0;t<e.length;t++)"virtualscroll"===e[t].member&&(e[t].member="treeVirtualScroll");return e};this.grid.root=this.root?this.root:this,this.grid.appendTo(i),this.isIndentEnabled&&this.refreshToolbarItems(),this.wireEvents(),this.renderComplete();var n=this.grid.destroyTemplate;this.grid.destroyTemplate=function(i,r){n.apply(e.grid);e.isReact&&t.isNullOrUndefined(e.portals)||e.clearTemplate(i,r)}},d.prototype.refreshToolbarItems=function(){var e=this.toolbarModule.getToolbar(),t=this.element.id+"_gridcontrol_indent",i=this.element.id+"_gridcontrol_outdent",r=e.querySelector("#"+t).parentElement,n=e.querySelector("#"+i).parentElement;r.classList.add("e-hidden"),n.classList.add("e-hidden")},d.prototype.afterGridRender=function(){t.isNullOrUndefined(this.grid.clipboardModule)||this.grid.clipboardModule.destroy(),this.clipboardModule=this.grid.clipboardModule=new Ue(this,this.grid.serviceLocator)},d.prototype.convertTreeData=function(e){var i=this;if(s(this)&&(e=t.getValue("result",e)),e instanceof Array&&e.length>0&&Object.prototype.hasOwnProperty.call(e[0],"level"))this.flatData=e,this.flatData.filter(function(e){t.setValue("uniqueIDCollection."+e.uniqueID,e,i),0===e.level&&i.parentData.push(e)});else if(s(this)){var r=t.getValue("result",this.dataSource);this.dataModule.convertToFlatData(r)}else this.dataModule.convertToFlatData(e)},d.prototype.bindGridProperties=function(){this.bindedDataSource(),this.grid.enableRtl=this.enableRtl,this.grid.allowKeyboard=this.allowKeyboard,this.grid.columns=this.getGridColumns(this.columns),this.grid.allowExcelExport=this.allowExcelExport,this.grid.allowPdfExport=this.allowPdfExport,this.grid.query=this.query,this.grid.columnQueryMode=this.columnQueryMode,this.grid.allowPaging=this.allowPaging,this.grid.pageSettings=i.getActualProperties(this.pageSettings),this.grid.pagerTemplate=this.pagerTemplate,this.grid.showColumnMenu=this.showColumnMenu,this.grid.allowSorting=this.allowSorting,this.grid.allowFiltering=this.allowFiltering,this.grid.enableVirtualization=this.enableVirtualization,this.grid.enableColumnVirtualization=this.enableColumnVirtualization,this.grid.enableInfiniteScrolling=this.enableInfiniteScrolling,this.grid.infiniteScrollSettings=this.infiniteScrollSettings,this.grid.width=this.width,this.grid.height=this.height,this.grid.enableAltRow=this.enableAltRow,this.grid.allowReordering=this.allowReordering,this.grid.allowTextWrap=this.allowTextWrap,this.grid.allowResizing=this.allowResizing,this.grid.enableHover=this.enableHover,this.grid.enableAutoFill=this.enableAutoFill,this.grid.enableAdaptiveUI=this.enableAdaptiveUI,this.grid.enableImmutableMode=this.enableImmutableMode,this.grid.allowRowDragAndDrop=this.allowRowDragAndDrop,this.grid.rowDropSettings=i.getActualProperties(this.rowDropSettings),this.grid.rowHeight=this.rowHeight,this.grid.gridLines=this.gridLines,this.grid.allowSelection=this.allowSelection,this.grid.toolbar=i.getActualProperties(this.getGridToolbar()),this.grid.toolbarTemplate=this.toolbarTemplate,this.grid.showColumnChooser=this.showColumnChooser,this.grid.filterSettings=i.getActualProperties(this.filterSettings),this.grid.selectionSettings=i.getActualProperties(this.selectionSettings),this.grid.sortSettings=i.getActualProperties(this.sortSettings),this.grid.searchSettings=i.getActualProperties(this.searchSettings),this.grid.aggregates=i.getActualProperties(this.aggregates),this.grid.textWrapSettings=i.getActualProperties(this.textWrapSettings),this.grid.printMode=i.getActualProperties(this.printMode),this.grid.locale=i.getActualProperties(this.locale),this.grid.selectedRowIndex=this.selectedRowIndex,this.grid.contextMenuItems=i.getActualProperties(this.getContextMenu()),this.grid.columnMenuItems=i.getActualProperties(this.columnMenuItems),this.grid.editSettings=this.getGridEditSettings(),this.grid.rowTemplate=i.getActualProperties(this.rowTemplate),this.grid.detailTemplate=i.getActualProperties(this.detailTemplate),this.grid.frozenRows=this.frozenRows,this.grid.frozenColumns=this.frozenColumns,this.grid.clipMode=i.getActualProperties(this.clipMode);var e="templateDotnetInstance";this.grid[e]=this[e];this.grid.isJsComponent=!0,this.grid.enableVirtualMaskRow=!1},d.prototype.triggerEvents=function(e){this.trigger(i.getObject("name",e),e)},d.prototype.IsExpandCollapseClicked=function(e){t.isNullOrUndefined(e.target)||!(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse")||e.target.classList.contains("e-summarycell"))||t.isNullOrUndefined(e.data)||!e.data.hasChildRecords||(e.cancel=!0)},d.prototype.bindGridEvents=function(){var e=this;this.grid.rowSelecting=function(t){e.IsExpandCollapseClicked(t),e.trigger("rowSelecting",t)},this.grid.rowDeselecting=function(t){e.IsExpandCollapseClicked(t),e.trigger(Oe,t)},this.grid.rowSelected=function(t){if(e.enableVirtualization&&t.isHeaderCheckboxClicked&&e.grid.currentViewData.length!==e.grid.selectionModule.selectedRowIndexes.length)for(var i=0;i<e.getRows().length;i++)e.getRows()[i].getElementsByClassName("e-frame e-icons e-uncheck").length&&e.grid.selectionModule.updateRowSelection(e.getRows()[i],e.getCurrentViewRecords()[i].index);e.selectedRowIndex=e.grid.selectedRowIndex,e.notify(z,t),e.trigger(z,t)},this.grid.rowDeselected=function(i){e.selectedRowIndex=e.grid.selectedRowIndex,t.isNullOrUndefined(i.data)||e.notify(_,i),e.trigger(_,i)},this.grid.resizeStop=function(t){e.updateColumnModel(),e.trigger("resizeStop",t)},this.grid.excelQueryCellInfo=function(t){e.notify("excelCellInfo",t),t=e.dataResults},this.grid.pdfQueryCellInfo=function(t){e.notify("pdfCellInfo",t),t=e.dataResults},this.grid.checkBoxChange=function(t){e.trigger(j,t)},this.grid.pdfExportComplete=this.triggerEvents.bind(this),this.grid.excelExportComplete=this.triggerEvents.bind(this),this.grid.excelHeaderQueryCellInfo=this.triggerEvents.bind(this),this.grid.pdfHeaderQueryCellInfo=this.triggerEvents.bind(this),this.grid.dataSourceChanged=this.triggerEvents.bind(this),this.grid.recordDoubleClick=this.triggerEvents.bind(this),this.grid.cellDeselected=this.triggerEvents.bind(this),this.grid.cellDeselecting=this.triggerEvents.bind(this),this.grid.columnMenuOpen=this.triggerEvents.bind(this),this.grid.columnMenuClick=this.triggerEvents.bind(this),this.grid.cellSelected=this.triggerEvents.bind(this),this.grid.headerCellInfo=this.triggerEvents.bind(this),this.grid.resizeStart=this.triggerEvents.bind(this),this.grid.resizing=this.triggerEvents.bind(this),this.grid.columnDrag=this.triggerEvents.bind(this),this.grid.columnDragStart=this.triggerEvents.bind(this),this.grid.columnDrop=this.triggerEvents.bind(this),this.grid.beforePrint=this.triggerEvents.bind(this),this.grid.beforeCopy=this.triggerEvents.bind(this),this.grid.beforePaste=function(t){for(var i=e.getRows();i[t.rowIndex].classList.contains("e-summaryrow");)t.rowIndex++;e.trigger("beforePaste",t)},this.grid.load=function(){if(e.grid.on("initial-end",e.afterGridRender,e),!t.isNullOrUndefined(e.loggerModule)){e.loggerModule=e.grid.loggerModule=new k(e.grid)}},this.grid.printComplete=this.triggerEvents.bind(this),this.grid.actionFailure=this.triggerEvents.bind(this),this.extendedGridDataBoundEvent(),this.extendedGridEvents(),this.extendedGridActionEvents(),this.extendedGridEditEvents(),this.bindGridDragEvents(),this.bindCallBackEvents()},d.prototype.lastRowBorder=function(e,i){for(var r=0;r<e.cells.length;r++)i?t.addClass([e.cells[r]],"e-lastrowcell"):t.removeClass([e.cells[r]],"e-lastrowcell")},d.prototype.isPixelHeight=function(){return"auto"!==this.height&&-1===this.height.toString().indexOf("%")},d.prototype.extendedGridDataBoundEvent=function(){var e=this;this.grid.dataBound=function(r){if(e.updateRowTemplate(),e.updateColumnModel(),e.updateAltRow(e.getRows()),e.notify("dataBoundArg",r),a(e)&&!u(e)&&!e.hasChildMapping){var n=i.getObject("dataSource.requests",e).filter(function(e){return"OK"!==e.httpRequest.statusText}).length;t.setValue("grid.contentModule.isLoaded",!(n>0),e)}if(e.isPixelHeight()&&e.initialRender)for(var o=e.getContentTable().rows,s=[].slice.call(o),d=s.length-1;d>0;d--)if(!m(s[d])){s[d].nextElementSibling&&e.lastRowBorder(s[d],!0);break}if(e.enableVirtualization&&e.selectionSettings.persistSelection&&("expand"===e.dataResults.action||"collapse"===e.dataResults.action)){if(e.grid.selectionModule.refreshPersistSelection(),"Single"===e.grid.selectionSettings.type){var l=e.getCurrentViewRecords().indexOf(e.grid.selectionModule.data);e.grid.selectionModule.updateRowSelection(e.getRows()[l],l)}}e.trigger("dataBound",r),e.initialRender=!1};var r=this;this.grid.beforeDataBound=function(e){var o=i.getObject("action",e);if((a(r)&&!u(r)||s(this))&&"edit"!==o)r.notify("updateRemoteLevel",e),e=r.dataResults;else if(0===r.flatData.length&&u(r)&&r.dataSource instanceof n.DataManager){var d=r.dataSource;r.dataModule.convertToFlatData(d.dataSource.json),e.result=r.grid.dataSource.dataSource.json=r.flatData}if(a(r)||s(this)||t.isNullOrUndefined(r.dataSource)||(this.isPrinting&&t.setValue("isPrinting",!0,e),r.notify("dataProcessor",e)),t.extend(e,r.dataResults),r.enableImmutableMode&&(e.result=e.result.slice()),r.initialRender&&(this.contentModule.objectEqualityChecker=r.objectEqualityChecker),!this.isPrinting){var l=new n.Deferred;return r.trigger(B,e,function(e){l.resolve(e)}),l}},this.grid.log=function(t,i){e.loggerModule&&e.loggerModule.log(t,i)}},d.prototype.bindCallBackEvents=function(){var e=this;this.grid.toolbarClick=function(t){if(!(t.item.id===e.grid.element.id+"_excelexport"&&!1===e.allowExcelExport||t.item.id===e.grid.element.id+"_pdfexport"&&!1===e.allowPdfExport||t.item.id===e.grid.element.id+"_csvexport"&&!1===e.allowExcelExport)){var i=new n.Deferred;return e.trigger(H,t,function(r){r.cancel||e.notify(H,t),i.resolve(r)}),i}},this.grid.cellSelecting=function(t){var r=new n.Deferred;return e.trigger(i.getObject("name",t),t,function(e){r.resolve(e)}),r},this.grid.beginEdit=function(i){if(t.isNullOrUndefined(i.row)||!i.row.classList.contains("e-summaryrow")){var r=new n.Deferred;return e.trigger(ie,i,function(e){r.resolve(e)}),r}i.cancel=!0}},d.prototype.extendedGridEditEvents=function(){var e=this;this.grid.dataStateChange=function(i){e.isExpandRefresh?(e.isExpandRefresh=!1,e.grid.dataSource={result:e.flatData,count:t.getValue("count",e.grid.dataSource)}):("infiniteScroll"!==i.action.requestType&&(e.infiniteScrollData=[]),e.trigger(L,i))},this.grid.cellSave=function(i){if(e.grid.isContextMenuOpen()){var r=e.grid.contextMenuModule.contextMenu.element.getElementsByClassName("e-selected")[0];(t.isNullOrUndefined(r)||r.id!==e.element.id+"_gridcontrol_cmenu_Save")&&(i.cancel=!0)}var o=new n.Deferred;return e.trigger(oe,i,function(t){t.cancel||e.notify(oe,t),o.resolve(t)}),o},this.grid.cellSaved=function(t){e.trigger(ae,t),e.notify(ae,t)},this.grid.cellEdit=function(t){var i=new n.Deferred;return t.promise=i,e.notify(se,t),i},this.grid.batchAdd=function(t){e.trigger(pe,t),e.notify(pe,t)},this.grid.beforeBatchSave=function(t){e.trigger(ue,t),e.notify(ue,t)},this.grid.beforeBatchAdd=function(t){e.trigger(ce,t),e.notify(ce,t)},this.grid.batchDelete=function(t){e.trigger(de,t),e.notify(de,t)},this.grid.beforeBatchDelete=function(t){e.trigger(he,t),e.notify(he,t)},this.grid.batchCancel=function(t){"Cell"!==e.editSettings.mode&&e.trigger(le,t),e.notify(le,t)}},d.prototype.updateRowTemplate=function(){this.treeColumnRowTemplate()},d.prototype.bindedDataSource=function(){var e="dataSource";if(this.dataSource&&s(this)){var i=this.flatData,r=t.getValue("count",this.dataSource);this.grid.dataSource={result:i,count:r}}else this.grid.dataSource=this.dataSource instanceof n.DataManager?new n.DataManager(this.dataSource.dataSource,this.dataSource.defaultQuery,this.dataSource.adaptor):this.flatData;if(this.dataSource instanceof n.DataManager&&(this.dataSource.dataSource.offline||this.dataSource.ready)){this.grid.dataSource[e].json=g(this.dataSource[e].json),this.grid.dataSource.ready=this.dataSource.ready;var o=this;t.isNullOrUndefined(this.grid.dataSource.ready)||this.grid.dataSource.ready.then(function(t){var i=o.grid.dataSource;i[e].offline=!0,i.isDataAvailable=!0,i[e].json=t.result,i.adaptor=new n.JsonAdaptor})}},d.prototype.extendedGridActionEvents=function(){var e=this;this.grid.actionBegin=function(r){"sorting"===r.requestType&&r.target&&r.target.parentElement&&r.target.parentElement.classList.contains("e-hierarchycheckbox")&&(r.cancel=!0);if("reorder"===i.getObject("requestType",r)&&e.notify("getColumnIndex",{}),e.notify("actionBegin",{editAction:r}),a(e)||t.isNullOrUndefined(e.filterModule)||s(e)||0!==e.grid.filterSettings.columns.length||0!==e.grid.searchSettings.key.length||(e.notify("clearFilters",{flatData:e.grid.dataSource}),e.grid.setProperties({dataSource:e.dataResults.result},!0),t.isNullOrUndefined(e.grid.changedProperties.dataSource)&&(e.grid.renderModule.data.dataManager=e.grid.dataSource instanceof n.DataManager?e.grid.dataSource:t.isNullOrUndefined(e.grid.dataSource)?new n.DataManager:new n.DataManager(e.grid.dataSource),e.grid.renderModule.data.isQueryInvokedFromData=!0,e.grid.query=e.grid.query instanceof n.Query?e.grid.query:new n.Query)),"indenting"!==e.action&&"outdenting"!==e.action){var o=new n.Deferred;return e.trigger(T,r,function(t){t.cancel||e.notify(ie,t),o.resolve(t)}),o}},this.grid.actionComplete=function(t){if(e.notify("actioncomplete",t),e.updateColumnModel(),e.updateTreeGridModel(),"reorder"===t.requestType&&e.notify("setColumnIndex",{}),e.notify("actionComplete",{editAction:t}),"add"===t.requestType&&"Top"!==e.editSettings.newRowPosition&&"Bottom"!==e.editSettings.newRowPosition&&e.notify(re,t),"batchsave"===t.requestType&&e.notify(ge,t),e.notify("updateGridActions",t),"save"===t.requestType&&e.aggregates.map(function(e){return!0===e.showChildSummary}).length&&e.grid.refresh(),"filter"===t.action&&""!==e.filterModule.currentFilterObject&&e.enableVirtualization&&!e.initialRender&&e.expandAll(),"searching"===t.requestType&&""!==e.searchSettings.key&&e.enableVirtualization&&!e.initialRender&&e.expandAll(),"clearFilter"===t.action&&e.enableCollapseAll&&e.collapseAll(),"indenting"===e.action||"outdenting"===e.action){e.action="indenting"===e.action?"indented":"outdented";var i=[e.selectedRecords],r={data:i,dropIndex:e.dropIndex,dropPosition:e.dropPosition,modifiedRecords:e.modifiedRecords,requestType:e.action,row:e.selectedRows};e.trigger(F,r);e.getCurrentViewRecords().filter(function(e){return e.uniqueID===i[0].uniqueID}).length||e.refreshToolbarItems(),e.action="",e.selectedRecords=e.selectedRows=e.modifiedRecords=[]}else{if(e.grid.isFrozenGrid()&&e.enableVirtualization&&"movable"===t.tableName){var n=e.grid.element.querySelector("."+Pe),o=e.grid.element.querySelector("."+Ee);n.style.height=o.style.height="auto"}e.trigger(F,t)}}},d.prototype.extendedGridEvents=function(){var e=this,i=this;this.grid.recordDoubleClick=function(t){e.trigger(ne,t),e.notify(ne,t)},this.grid.detailDataBound=function(t){e.notify("detaildataBound",t),e.trigger(xe,t)},this.grid.rowDataBound=function(e){t.isNullOrUndefined(this.isPrinting)?t.setValue("isPrinting",!1,e):t.setValue("isPrinting",this.isPrinting,e),i.renderModule.RowModifier(e)},this.grid.queryCellInfo=function(e){t.isNullOrUndefined(this.isPrinting)?t.setValue("isPrinting",!1,e):t.setValue("isPrinting",this.isPrinting,e),i.renderModule.cellRender(e)},this.grid.contextMenuClick=function(t){e.notify(ee,t),e.trigger(ee,t)},this.grid.contextMenuOpen=function(t){e.notify(Z,t),e.trigger(Z,t)},this.grid.queryCellInfo=function(t){e.renderModule.cellRender(t)}},d.prototype.bindGridDragEvents=function(){var e=this;this.grid.rowDragStartHelper=function(t){e.trigger(be,t)},this.grid.rowDragStart=function(t){e.trigger("rowDragStart",t)},this.grid.rowDrag=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(De,t),e.trigger("rowDrag",t))},this.grid.rowDrop=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(Me,t),t.cancel=!0)}},d.prototype.loadGrid=function(){this.bindGridProperties(),this.bindGridEvents(),t.setValue("registeredTemplate",this.registeredTemplate,this.grid);t.setValue("viewContainerRef",this.viewContainerRef,this.grid)},d.prototype.autoGenerateColumns=function(){if(!this.columns.length&&!this.dataModule.isRemote()&&Object.keys(this.dataSource).length){this.columns=[];for(var e=this.dataSource[0],t=Object.keys(e),i=0;i<t.length;i++)-1===[this.childMapping,this.parentIdMapping].indexOf(t[i])&&this.columns.push(t[i])}},d.prototype.getGridEditSettings=function(){var e={};switch(e.allowAdding=this.editSettings.allowAdding,e.allowEditing=this.editSettings.allowEditing,e.allowDeleting=this.editSettings.allowDeleting,e.newRowPosition="Bottom"===this.editSettings.newRowPosition?"Bottom":"Top",e.allowEditOnDblClick=this.editSettings.allowEditOnDblClick,e.showConfirmDialog=this.editSettings.showConfirmDialog,e.template=this.editSettings.template,e.showDeleteConfirmDialog=this.editSettings.showDeleteConfirmDialog,e.allowNextRowEdit=this.editSettings.allowNextRowEdit,e.guid=this.editSettings.guid,e.dialog=this.editSettings.dialog,this.editSettings.mode){case"Dialog":case"Batch":e.mode=this.editSettings.mode;break;case"Row":e.mode="Normal";break;case"Cell":e.mode="Normal",e.showConfirmDialog=!1}return e},d.prototype.getContextMenu=function(){if(this.contextMenuItems){for(var t=[],i=0;i<this.contextMenuItems.length;i++)switch(this.contextMenuItems[i]){case"AddRow":case e.ContextMenuItems.AddRow:t.push({text:this.l10n.getConstant("AddRow"),target:".e-content",id:this.element.id+"_gridcontrol_cmenu_AddRow",items:[{text:this.l10n.getConstant("Above"),id:"Above"},{text:this.l10n.getConstant("Below"),id:"Below"},{text:this.l10n.getConstant("Child"),id:"Child"}]});break;case"Indent":case e.ContextMenuItems.RowIndent:t.push({text:this.l10n.getConstant("RowIndent"),target:".e-content",iconCss:"e-indent e-icons",id:this.element.id+"_gridcontrol_cmenu_Indent"});break;case"Outdent":case e.ContextMenuItems.RowOutdent:t.push({text:this.l10n.getConstant("RowOutdent"),target:".e-content",iconCss:"e-outdent e-icons",id:this.element.id+"_gridcontrol_cmenu_Outdent"});break;default:t.push(this.contextMenuItems[i])}return t}return null},d.prototype.getGridToolbar=function(){if(this.toolbar){this.l10n=new t.L10n("treegrid",this.defaultLocale,this.locale);for(var i=[],r=void 0,n=0;n<this.toolbar.length;n++)switch(this.toolbar[n]){case"Search":case e.ToolbarItem.Search:i.push("Search");break;case"Print":case e.ToolbarItem.Print:i.push("Print");break;case"ExpandAll":case e.ToolbarItem.ExpandAll:r=this.l10n.getConstant("ExpandAll"),i.push({text:r,tooltipText:r,prefixIcon:"e-expand",id:this.element.id+"_gridcontrol_expandall"});break;case"CollapseAll":case e.ToolbarItem.CollapseAll:r=this.l10n.getConstant("CollapseAll"),i.push({text:r,tooltipText:r,prefixIcon:"e-collapse",id:this.element.id+"_gridcontrol_collapseall"});break;case"Indent":case e.ToolbarItem.RowIndent:r=this.l10n.getConstant("RowIndent"),i.push({text:r,tooltipText:r,prefixIcon:"e-indent",id:this.element.id+"_gridcontrol_indent"});break;case"Outdent":case e.ToolbarItem.RowOutdent:r=this.l10n.getConstant("RowOutdent"),i.push({text:r,tooltipText:r,prefixIcon:"e-outdent",id:this.element.id+"_gridcontrol_outdent"});break;default:i.push(this.toolbar[n])}return i}return null},d.prototype.getGridColumns=function(e,i,r){void 0===i&&(i=!0),void 0===r&&(r=0);var n=e;i&&(this.columnModel=[]);var o,a;0==this.columnModel.length&&(r=0===r?-1:r);for(var s=[],d=0;d<n.length;d++){r+=1;var l=this.grid.getColumnByUid(n[d].uid);if(a=l||{},o={},"string"==typeof this.columns[d])a.field=o.field=this.columns[d];else for(var p=0,h=Object.keys(n[d]);p<h.length;p++){var c=h[p];r===this.treeColumnIndex&&"template"===c?o[c]=n[d][c]:"columns"!==c||t.isNullOrUndefined(n[d][c])?this.initialRender&&!t.isNullOrUndefined(l)&&this.enablePersistence&&"edit"===c?a[c]=o[c]=l[c]:l&&"sortComparer"===c||(a[c]=o[c]=n[d][c]):(a[c]=this.getGridColumns(n[d][c],!1,this.columnModel.length-1),o[c]=n[d][c])}o.columns||this.columnModel.push(new C(o)),s.push(a),!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex])&&this.enableRtl&&a.field===this.columnModel[this.treeColumnIndex].field&&(t.isNullOrUndefined(this.treeColumnTextAlign)&&(this.treeColumnTextAlign=this.columnModel[this.treeColumnIndex].textAlign,this.treeColumnField=this.columnModel[this.treeColumnIndex].field),a.textAlign="Right")}return s},d.prototype.onPropertyChanged=function(e){for(var r=!1,o=0,a=Object.keys(e);o<a.length;o++){var d=a[o];switch(d){case"columns":this.grid.columns=this.getGridColumns(this.columns);break;case"treeColumnIndex":this.grid.refreshColumns();break;case"allowPaging":this.grid.allowPaging=this.allowPaging;break;case"pageSettings":this.grid.pageSettings=i.getActualProperties(this.pageSettings),r=!0;break;case"enableVirtualization":this.grid.enableVirtualization=this.enableVirtualization;break;case"enableColumnVirtualization":this.grid.enableColumnVirtualization=this.enableColumnVirtualization;break;case"toolbar":this.grid.toolbar=this.getGridToolbar();break;case"allowSelection":this.grid.allowSelection=this.allowSelection;break;case"selectionSettings":this.grid.selectionSettings=i.getActualProperties(this.selectionSettings);break;case"allowSorting":this.grid.allowSorting=this.allowSorting;break;case"allowMultiSorting":this.grid.allowMultiSorting=this.allowMultiSorting;break;case"sortSettings":this.grid.sortSettings=i.getActualProperties(this.sortSettings);break;case"searchSettings":this.grid.searchSettings=i.getActualProperties(this.searchSettings);break;case"allowFiltering":this.grid.allowFiltering=this.allowFiltering;break;case"filterSettings":this.initialRender||(this.grid.filterSettings=i.getActualProperties(this.filterSettings));break;case"showColumnMenu":this.grid.showColumnMenu=this.showColumnMenu;break;case"allowRowDragAndDrop":this.grid.allowRowDragAndDrop=this.allowRowDragAndDrop;break;case"aggregates":this.grid.aggregates=i.getActualProperties(this.aggregates);break;case"enableInfiniteScrolling":this.grid.enableInfiniteScrolling=this.enableInfiniteScrolling;break;case"dataSource":if(this.isLocalData=!(this.dataSource instanceof n.DataManager)||!t.isNullOrUndefined(this.dataSource.ready)||this.dataSource.adaptor instanceof n.RemoteSaveAdaptor,this.convertTreeData(this.dataSource),this.isLocalData){if(s(this)){var l=t.getValue("count",this.dataSource);this.grid.dataSource={result:this.flatData,count:l}}else{var p=this.dataSource;this.grid.dataSource=p instanceof n.DataManager?new n.DataManager(p.dataSource,p.defaultQuery,p.adaptor):this.flatData}this.enableVirtualization&&(this.grid.contentModule.isDataSourceChanged=!0)}else this.bindedDataSource(),this.enableVirtualization&&(this.grid.contentModule.removeEventListener(),this.grid.contentModule.eventListener("on"),this.grid.contentModule.renderTable());break;case"query":this.grid.query=this.query;break;case"enableCollapseAll":e[d]?this.collapseAll():this.expandAll();break;case"expandStateMapping":this.grid.refresh();break;case"gridLines":this.grid.gridLines=this.gridLines;break;case"rowTemplate":this.grid.rowTemplate=i.getActualProperties(this.rowTemplate);break;case"frozenRows":this.grid.frozenRows=this.frozenRows;break;case"frozenColumns":this.grid.frozenColumns=this.frozenColumns;break;case"rowHeight":this.grid.rowHeight=this.rowHeight;break;case"height":t.isNullOrUndefined(this.height)||"string"!=typeof this.height||-1===this.height.indexOf("%")||(this.element.style.height=this.height),this.grid.height=this.height;break;case"width":t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(this.element.style.width=this.width),this.grid.width=this.width;break;case"locale":this.grid.locale=this.locale,this.TreeGridLocale(),this.grid.toolbar=this.getGridToolbar(),this.grid.contextMenuItems=this.getContextMenu();break;case"selectedRowIndex":this.grid.selectedRowIndex=this.selectedRowIndex;break;case"enableAltRow":this.grid.enableAltRow=this.enableAltRow;break;case"enableHover":this.grid.enableHover=this.enableHover;break;case"enableAutoFill":this.grid.enableAutoFill=this.enableAutoFill;break;case"enableAdaptiveUI":this.grid.enableAdaptiveUI=this.enableAdaptiveUI;break;case"enableImmutableMode":this.grid.enableImmutableMode=this.enableImmutableMode;break;case"allowExcelExport":this.grid.allowExcelExport=this.allowExcelExport;break;case"allowPdfExport":this.grid.allowPdfExport=this.allowPdfExport;break;case"enableRtl":t.isNullOrUndefined(this.treeColumnField)||this.updateTreeColumnTextAlign(),this.grid.enableRtl=this.enableRtl;break;case"allowReordering":this.grid.allowReordering=this.allowReordering;break;case"allowResizing":this.grid.allowResizing=this.allowResizing;break;case"textWrapSettings":this.grid.textWrapSettings=i.getActualProperties(this.textWrapSettings);break;case"allowTextWrap":this.grid.allowTextWrap=i.getActualProperties(this.allowTextWrap),this.grid.refresh();break;case"contextMenuItems":this.grid.contextMenuItems=this.getContextMenu();break;case"showColumnChooser":this.grid.showColumnChooser=this.showColumnChooser;break;case"detailTemplate":this.grid.detailTemplate=i.getActualProperties(this.detailTemplate);break;case"columnMenuItems":this.grid.columnMenuItems=i.getActualProperties(this.columnMenuItems);break;case"editSettings":this.grid.isEdit&&"Normal"===this.grid.editSettings.mode&&e[d].mode&&("Cell"===e[d].mode||"Row"===e[d].mode)&&this.grid.closeEdit(),this.grid.editSettings=this.getGridEditSettings()}r&&this.grid.refresh()}},d.prototype.updateTreeColumnTextAlign=function(){this.grid.getColumnByField(this.treeColumnField).textAlign=this.enableRtl?"Right":this.treeColumnTextAlign,this.grid.refreshColumns()},d.prototype.destroy=function(){var e=this.element;if(e){var t=!(!e.querySelector(".e-gridheader")||!e.querySelector(".e-gridcontent"));t&&this.unwireEvents(),this.removeListener(),t&&r.prototype.destroy.call(this),this.grid&&this.grid.destroy(),this.dataModule&&this.dataModule.destroy();for(var i=["dataModule","sortModule","renderModule","filterModule","printModule","clipboardModule","excelExportModule","pdfExportModule","toolbarModule","summaryModule","reorderModule","resizeModule","pagerModule","keyboardModule","columnMenuModule","contextMenuModule","editModule","virtualScrollModule","selectionModule","detailRow","rowDragAndDropModule","freezeModule"],n=0;n<i.length;n++)this[i[n]]&&(this[i[n]]=null);this.element.innerHTML="",this.grid=null}},d.prototype.dataBind=function(){t.isNullOrUndefined(this.grid)||(!t.isNullOrUndefined(this.rowDropSettings.targetID)&&t.isNullOrUndefined(document.getElementById(this.grid.rowDropSettings.targetID))&&(document.getElementById(this.rowDropSettings.targetID).id=this.grid.rowDropSettings.targetID,this.rowDropSettings.targetID=this.grid.rowDropSettings.targetID),r.prototype.dataBind.call(this),this.grid.dataBind())},d.prototype.getPersistData=function(){for(var e=["pageSettings","sortSettings","filterSettings","columns","searchSettings","selectedRowIndex","treeColumnIndex"],i={pageSettings:["template","pageSizes","pageSizeMode","enableQueryString","totalRecordsCount","pageCount"],filterSettings:["type","mode","showFilterBarStatus","immediateModeDelay","ignoreAccent","hierarchyMode"],searchSettings:["fields","operator","ignoreCase"],sortSettings:[],columns:[],selectedRowIndex:[]},r=0;r<e.length;r++)for(var n=this[e[r]],o=0,a=i[e[r]];!t.isNullOrUndefined(a)&&o<a.length;o++){delete n[a[o]]}return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(e)},d.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)t[i].columns?(this.ignoreInColumn(e,t[i]),this.ignoreInArrays(e,t[i].columns)):this.ignoreInColumn(e,t[i])},d.prototype.ignoreInColumn=function(e,t){for(var i=0;i<e.length;i++)delete t[e[i]],t.filter={}},d.prototype.mouseClickHandler=function(e){if(t.isNullOrUndefined(e.touches)){var i=e.target;!i.classList.contains("e-treegridexpand")&&!i.classList.contains("e-treegridcollapse")||this.isEditCollapse||this.grid.isEdit||this.expandCollapseRequest(i),this.isEditCollapse=!1,this.notify("checkboxSelection",{target:i})}},d.prototype.getRows=function(){return this.grid.getRows()},d.prototype.getPager=function(){return this.grid.getPager()},d.prototype.addRecord=function(e,t,i){if(this.editModule){this.editModule.isAddedRowByMethod=!0,this.editModule.addRecord(e,t,i)}},d.prototype.closeEdit=function(){this.grid.editModule&&this.grid.editModule.closeEdit()},d.prototype.saveCell=function(){this.grid.editModule&&this.grid.editModule.saveCell()},d.prototype.updateCell=function(e,t,i){this.grid.editModule&&this.grid.editModule.updateCell(e,t,i)},d.prototype.updateRow=function(e,i){if(this.grid.editModule)if(t.isNullOrUndefined(e))this.grid.editModule.updateRow(e,i);else{var r=this.grid.getCurrentViewRecords()[e];t.extend(r,i),this.grid.editModule.updateRow(e,r)}},d.prototype.deleteRecord=function(e,t){this.grid.editModule&&this.grid.editModule.deleteRecord(e,t)},d.prototype.startEdit=function(e){this.grid.editModule&&this.grid.editModule.startEdit(e)},d.prototype.editCell=function(e,t){this.editModule&&this.editModule.editCell(e,t)},d.prototype.enableToolbarItems=function(e,t){this.grid.toolbarModule&&this.grid.toolbarModule.enableItems(e,t)},d.prototype.endEdit=function(){this.grid.editModule&&this.grid.editModule.endEdit()},d.prototype.openColumnChooser=function(e,t){this.columnChooserModule&&this.columnChooserModule.openColumnChooser(e,t)},d.prototype.deleteRow=function(e){this.grid.editModule&&this.grid.editModule.deleteRow(e)},d.prototype.getPrimaryKeyFieldNames=function(){return this.grid.getPrimaryKeyFieldNames()},d.prototype.setCellValue=function(e,i,r){this.grid.setCellValue(e,i,r);var n=this.grid.getRowIndexByPrimaryKey(e),o=this.getCurrentViewRecords()[n];t.isNullOrUndefined(o)||v({value:o,action:"edit"},this,this.isSelfReference,o.index,this.grid.selectedRowIndex,i)},d.prototype.setRowData=function(e,t){var i=this.getCurrentViewRecords(),r=this.grid.getPrimaryKeyFieldNames()[0],n=0,o={};i.some(function(t){return t[r]===e&&(o=t,!0)}),n=o.level,t.level=n,t.index=o.index,t.childRecords=o.childRecords,t.taskData=o.taskData,t.uniqueID=o.uniqueID,t.parentItem=o.parentItem,t.checkboxState=o.checkboxState,t.hasChildRecords=o.hasChildRecords,t.parentUniqueID=o.parentUniqueID,t.expanded=o.expanded,this.grid.setRowData(e,t);var a=this.getVisibleRecords();if(a.length>0&&e===a[a.length-1][r]){var s=this.getContentTable().scrollHeight,d=this.getContent().clientHeight;this.lastRowBorder(this.getRows()[i.indexOf(o)],s<=d)}},d.prototype.goToPage=function(e){this.grid.pagerModule&&this.grid.pagerModule.goToPage(e)},d.prototype.updateExternalMessage=function(e){this.pagerModule&&this.grid.pagerModule.updateExternalMessage(e)},d.prototype.getCellFromIndex=function(e,t){return this.grid.getCellFromIndex(e,t)},d.prototype.getColumnByField=function(e){return i.iterateArrayOrObject(this.columnModel,function(t){if(t.field===e)return t})[0]},d.prototype.getColumnByUid=function(e){var t=this.initialRender?this.grid.columns:this.columns;return this.grid.columns.length!==this.columnModel.length&&(t=this.grid.columnModel),i.iterateArrayOrObject(t,function(t){if(t.uid===e)return t})[0]},d.prototype.getColumnFieldNames=function(){return this.grid.getColumnFieldNames()},d.prototype.getFooterContent=function(){return this.grid.getFooterContent()},d.prototype.getFooterContentTable=function(){return this.grid.getFooterContentTable()},d.prototype.showColumns=function(e,t){this.grid.showColumns(e,t),this.updateColumnModel()},d.prototype.hideColumns=function(e,t){this.grid.hideColumns(e,t),this.updateColumnModel()},d.prototype.getColumnHeaderByField=function(e){return this.grid.getColumnHeaderByField(e)},d.prototype.getColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getColumnHeaderByUid=function(e){return this.grid.getColumnHeaderByUid(e)},d.prototype.getColumnIndexByField=function(e){return this.grid.getColumnIndexByField(e)},d.prototype.getVirtualColIndexByUid=function(e){var r=i.iterateArrayOrObject(this.grid.columnModel,function(t,i){if(t.uid===e)return i})[0];return t.isNullOrUndefined(r)?-1:r},d.prototype.getColumnIndexByUid=function(e){return this.grid.getColumnIndexByUid(e)},d.prototype.getColumns=function(e){return this.updateColumnModel(this.grid.getColumns(e)),this.columnModel},d.prototype.updateColumnModel=function(e){var i,r,n=t.isNullOrUndefined(e)?this.grid.getColumns():e;-1!==this.treeColumnIndex&&this.columnModel[this.treeColumnIndex]&&!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex].template)&&(i=this.columnModel[this.treeColumnIndex].template,r=this.columnModel[this.treeColumnIndex].field);var o;if(!this.enableColumnVirtualization||this.enableColumnVirtualization&&this.columnModel.length===n.length){this.columnModel=[];for(var a=0;a<n.length;a++){o={};for(var s=0,d=Object.keys(n[a]);s<d.length;s++){var l=d[s];o[l]=n[a][l]}this.columnModel.push(new C(o)),r!==this.columnModel[a].field||"checkbox"===this.columnModel[a].type||t.isNullOrUndefined(i)||""===i||(this.columnModel[a].template=i)}}return this.deepMerge=["columns"],this.grid.columns.length!==this.columnModel.length&&(this.stackedHeader=!0),this.stackedHeader||t.merge(this.columns,this.columnModel),this.deepMerge=void 0,this.columnModel},d.prototype.getContent=function(){return this.grid.getContent()},d.prototype.mergePersistTreeGridData=function(){this.grid.mergePersistGridData.apply(this)},d.prototype.mergeColumns=function(e,t){this.grid.mergeColumns.apply(this,[e,t])},d.prototype.updateTreeGridModel=function(){this.setProperties({filterSettings:i.getObject("properties",this.grid.filterSettings)},!0),this.setProperties({pageSettings:i.getObject("properties",this.grid.pageSettings)},!0),this.setProperties({searchSettings:i.getObject("properties",this.grid.searchSettings)},!0),this.setProperties({sortSettings:i.getObject("properties",this.grid.sortSettings)},!0)},d.prototype.getContentTable=function(){return this.grid.getContentTable()},d.prototype.getDataRows=function(){for(var e=[],t=this.grid.getDataRows(),i=0,r=t.length;i<r;i++)t[i].classList.contains("e-summaryrow")||e.push(t[i]);return e},d.prototype.getCurrentViewRecords=function(){return this.grid.currentViewData},d.prototype.getBatchChanges=function(){return this.grid.editModule.getBatchChanges()},d.prototype.getHeaderContent=function(){return this.grid.getHeaderContent()},d.prototype.getHeaderTable=function(){return this.grid.getHeaderTable()},d.prototype.getRowByIndex=function(e){return this.grid.getRowByIndex(e)},d.prototype.getRowInfo=function(e){return this.grid.getRowInfo(e)},d.prototype.getUidByColumnField=function(e){return this.grid.getUidByColumnField(e)},d.prototype.getVisibleColumns=function(){for(var e=[],t=0,i=this.columnModel;t<i.length;t++){var r=i[t];r.visible&&e.push(r)}return e},d.prototype.showSpinner=function(){o.showSpinner(this.element)},d.prototype.hideSpinner=function(){o.hideSpinner(this.element)},d.prototype.refresh=function(){this.uniqueIDCollection={},this.convertTreeData(this.dataSource),s(this)||(this.dataSource instanceof n.DataManager?this.grid.setProperties({dataSource:new n.DataManager(this.dataSource.dataSource,this.dataSource.defaultQuery,this.dataSource.adaptor)},!0):this.grid.dataSource=this.flatData),this.grid.refresh()},d.prototype.getCheckedRecords=function(){return this.selectionModule.getCheckedrecords()},d.prototype.getVisibleRecords=function(){var e=[],t=this.getCurrentViewRecords();if(this.allowPaging)e=t;else for(var i=0;i<t.length;i++)e.push(t[i]),t[i].expanded||(i+=c(t[i]).length);return e},d.prototype.getCheckedRowIndexes=function(){return this.selectionModule.getCheckedRowIndexes()},d.prototype.selectCheckboxes=function(e){this.selectionModule.selectCheckboxes(e)},d.prototype.refreshColumns=function(e){t.isNullOrUndefined(e)||e?(this.grid.columns=this.getGridColumns(this.columns),this.grid.refreshColumns()):this.grid.setProperties({columns:this.getGridColumns(this.columns)},!0)},d.prototype.refreshHeader=function(){this.grid.refreshHeader()},d.prototype.expandCollapseRequest=function(e){if("Batch"===this.editSettings.mode){if((this.getBatchChanges()[this.changedRecords].length||this.getBatchChanges()[this.deletedRecords].length||this.getBatchChanges()[this.addedRecords].length)&&this.editSettings.showConfirmDialog){var t=this.grid.editModule.dialogObj;return this.grid.editModule.showDialog("CancelEdit",t),void(this.targetElement=e)}}if(this.rowTemplate){var i=e.closest(".e-treerowcell").parentElement,r=this.getCurrentViewRecords()[i.rowIndex];e.classList.contains("e-treegridexpand")?this.collapseRow(i,r):this.expandRow(i,r)}else{var n=this.grid.getRowInfo(e);r=n.rowData;if(this.grid.isFrozenGrid()&&this.enableVirtualization&&!Object.keys(r).length){r=this.grid.contentModule.freezeRows.filter(function(e){return e.uid===n.row.getAttribute("data-uid")})[0].data}this.enableImmutableMode&&(r=this.getCurrentViewRecords()[n.rowIndex]),e.classList.contains("e-treegridexpand")?this.collapseRow(n.row,r):this.expandRow(n.row,r)}},d.prototype.expandRow=function(e,i,r,n){var o=this;i=this.getCollapseExpandRecords(e,i),!t.isNullOrUndefined(e)&&e.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(e,!1);var d={data:i,row:e,cancel:!1};this.trigger("expanding",d,function(d){if(!d.cancel){o.expandCollapse("expand",e,i),d.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n);if((!a(o)||u(o))&&(!s(o)||!t.isNullOrUndefined(i.Children))){var l={data:i,row:e};o.setHeightForFrozenContent(),t.isNullOrUndefined(o.expandStateMapping)||o.updateExpandStateMapping(l.data,!0),o.trigger(K,l)}}})},d.prototype.expandCollapseAllChildren=function(e,i,r,n){if((t.isNullOrUndefined(r)||e[this.getPrimaryKeyFieldNames()[0]]===r)&&(t.isNullOrUndefined(n)||n===e.level)){var o=c(e).filter(function(e){return e.hasChildRecords});o.unshift(e);for(var a=0;a<o.length;a++)this.expandCollapse(i,null,o[a])}},d.prototype.setHeightForFrozenContent=function(){var e=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.grid.getFrozenColumns()>0||e)&&this.grid.contentModule.refreshScrollOffset()},d.prototype.getCollapseExpandRecords=function(e,i){return this.allowPaging&&"All"===this.pageSettings.pageSizeMode&&this.isExpandAll&&t.isNullOrUndefined(i)&&!a(this)?i=this.flatData.filter(function(e){return e.hasChildRecords}):t.isNullOrUndefined(i)&&(i=this.detailTemplate?this.grid.getCurrentViewRecords()[e.getAttribute("data-rowindex")]:this.grid.getCurrentViewRecords()[e.rowIndex]),i},d.prototype.collapseRow=function(e,i,r){var n=this,o={data:i=this.getCollapseExpandRecords(e,i),row:e,cancel:!1};this.trigger("collapsing",o,function(o){if(!o.cancel){o.collapseAll&&n.expandCollapseAllChildren(i,"collapse",r),n.expandCollapse("collapse",e,i);var s={data:i,row:e};if(!a(n)&&(n.setHeightForFrozenContent(),t.isNullOrUndefined(n.expandStateMapping)||n.updateExpandStateMapping(s.data,!1),n.trigger(W,s),n.enableInfiniteScrolling)){n.grid.getContent().firstElementChild.scrollHeight-n.grid.getContent().firstElementChild.scrollTop<n.grid.getRowHeight()+ +n.height&&n.grid.getContent().firstElementChild.scrollBy(0,n.grid.getRowHeight())}}})},d.prototype.updateExpandStateMapping=function(e,t){var i=e;if(i.length)for(var r=0;r<i.length;r++)i[r][this.expandStateMapping]=t,v({value:i[r],action:"edit"},this,this.isSelfReference,i[r].index,this.grid.selectedRowIndex,this.expandStateMapping);else e[this.expandStateMapping]=t,v({value:e,action:"edit"},this,this.isSelfReference,e.index,this.grid.selectedRowIndex,this.expandStateMapping)},d.prototype.expandAtLevel=function(e){if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!0),t.hasChildRecords&&t.level===e});this.expandAction(t,null,e,!0)}else{t=this.getRecordDetails(e);var r=i.getObject("records",t);this.expandAction(r,null,e)}},d.prototype.expandByKey=function(e){this.expandCollapseActionByKey(e,"Expand")},d.prototype.expandAction=function(e,i,r,n){void 0===n&&(n=!1);for(var o=function(o){if(!t.isNullOrUndefined(e[o].parentItem)){var d=e[o].parentItem.uniqueID,l=s.flatData.filter(function(e){return e.uniqueID===d});a(s)&&(l=s.getCurrentViewRecords().filter(function(e){return e.uniqueID===d})),!1===l[0].expanded?(e.push(l[0]),l[0].expanded=!0):h(s,l[0],s.parentData)||l[0].expanded&&void 0!==l[0].parentItem&&e.push(l[0])}n||s.expandRow(null,e[o],i,r)},s=this,d=0;d<e.length;d++)o(d);n&&this.expandRow(null,e,i,r)},d.prototype.getRecordDetails=function(e){var t=this.getRows().filter(function(t){return-1!==t.className.indexOf("level"+e)&&(t.querySelector(".e-treegridcollapse")||t.querySelector(".e-treegridexpand"))});return{records:this.getCurrentViewRecords().filter(function(t){return t.level===e&&t.hasChildRecords}),rows:t}},d.prototype.collapseAtLevel=function(e){if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!1),t.hasChildRecords&&t.level===e});this.collapseAction(t,null,!0)}else{var r=this.getRecordDetails(e),n=i.getObject("records",r);this.collapseAction(n)}},d.prototype.collapseByKey=function(e){this.expandCollapseActionByKey(e,"Collapse")},d.prototype.expandCollapseActionByKey=function(e,i){var r=this.getPrimaryKeyFieldNames()[0],n=a(this)?this.getCurrentViewRecords():this.grid.dataSource;if(!t.isNullOrUndefined(r)){var o=n.filter(function(t){return t[r].toString()===e.toString()});"Expand"===i?this.expandAction(o,e,null):this.collapseAction(o,e)}},d.prototype.collapseAction=function(e,t,i){if(void 0===i&&(i=!1),i)this.collapseRow(null,e);else for(var r=0;r<e.length;r++)this.collapseRow(null,e[r],t);if(!this.grid.contentModule.isDataSourceChanged&&this.enableVirtualization&&this.getRows()&&this.parentData.length===this.getRows().length){this.grid.contentModule.startIndex=-1,this.grid.contentModule.endIndex=-1}},d.prototype.expandAll=function(){this.expandCollapseAll("expand")},d.prototype.collapseAll=function(){this.expandCollapseAll("collapse")},d.prototype.expandCollapseAll=function(e){var t=this.getRows().filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))});if(!t.length&&this.getRows().length&&t.push(this.getRows()[0]),this.isExpandAll=!0,this.isCollapseAll=!0,(this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization||this.enableInfiniteScrolling)&&!a(this)){if(this.flatData.filter(function(t){t.hasChildRecords&&(t.expanded="collapse"!==e)}),t.length)for(var i=0;i<t.length;i++)"collapse"===e?this.collapseRow(t[i]):this.expandRow(t[i]);else if(this.allowPaging){var r=this.enableCollapseAll;this.setProperties({enableCollapseAll:!0},!0),this.grid.pagerModule.goToPage(1),this.setProperties({enableCollapseAll:r},!0)}}else for(i=0;i<t.length;i++)"collapse"===e?this.collapseRow(t[i]):this.expandRow(t[i]);this.isExpandAll=!1,this.isCollapseAll=!1},d.prototype.expandCollapse=function(e,i,r,n){var o,d={row:i,data:r,childData:[],requestType:e},l=this.getCurrentViewRecords().filter(function(e){return e.parentUniqueID===r.uniqueID});(!a(this)&&"expand"===e&&this.isSelfReference&&s(this)&&!l.length||"collapse"===e||this.isExpandAll&&this.loadChildOnDemand&&!a(this)&&this.isSelfReference&&s(this))&&this.updateChildOnDemand(d);var p=this.getRows();if(this.rowTemplate){var h=this.getContentTable().rows;p=[].slice.call(h)}if(t.isNullOrUndefined(i)?i=p[this.getCurrentViewRecords().indexOf(r)]:+i.getAttribute("data-rowindex"),t.isNullOrUndefined(i)||i.setAttribute("aria-expanded","expand"===e?"true":"false"),!(this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization||this.enableInfiniteScrolling)||a(this)||s(this)){var c=void 0;if("expand"===e){if(c="table-row",n||(r.expanded=!0,this.uniqueIDCollection[r.uniqueID].expanded=r.expanded),t.isNullOrUndefined(i)||(o=i.getElementsByClassName("e-treegridcollapse")[0]),n&&!t.isNullOrUndefined(r[this.expandStateMapping])&&r[this.expandStateMapping]&&t.isNullOrUndefined(o)&&(o=i.getElementsByClassName("e-treegridexpand")[0]),t.isNullOrUndefined(o))return;o.classList.contains("e-treegridexpand")||t.addClass([o],"e-treegridexpand"),t.removeClass([o],"e-treegridcollapse")}else{if(c="none",n&&!s(this)||(r.expanded=!1,this.uniqueIDCollection[r.uniqueID].expanded=r.expanded),t.isNullOrUndefined(i)||(o=i.getElementsByClassName("e-treegridexpand")[0]),n&&!t.isNullOrUndefined(r[this.expandStateMapping])&&!r[this.expandStateMapping]&&t.isNullOrUndefined(o)&&(o=i.getElementsByClassName("e-treegridcollapse")[0]),t.isNullOrUndefined(o))return;o.classList.contains("e-treegridcollapse")||t.addClass([o],"e-treegridcollapse"),t.removeClass([o],"e-treegridexpand")}i.querySelectorAll(".e-treerowcell")[0].setAttribute("aria-expanded","expand"===e?"true":"false");var g=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))});if(a(this)&&!u(this)?this.remoteExpand(e,i,r):s(this)&&!l.length&&"collapse"!==e||this.localExpand(e,i,r),!t.isNullOrUndefined(o)&&o.closest(".e-treerowcell").classList.contains("e-cellselectionbackground")&&(o.closest(".e-treerowcell").classList.remove("e-cellselectionbackground"),o.closest(".e-treerowcell").removeAttribute("aria-selected")),this.isPixelHeight()&&!i.cells[0].classList.contains("e-lastrowcell"))for(var f=this.getRows(),y=(h=this.getContentTable().rows,(f=[].slice.call(h)).length-1);y>=0;y--)if(!m(f[y])){var v=this.getContentTable().scrollHeight,w=this.getContent().clientHeight;this.lastRowBorder(f[y],v<=w);break}this.notify("rowExpandCollapse",{detailrows:g,action:c,record:r,row:i}),this.updateAltRow(p)}else this.notify(J,{action:e,row:i,record:r})},d.prototype.updateChildOnDemand=function(e){var r=this;if("collapse"===e.requestType&&s(this)){for(var o=this.flatData.slice(),a=0;a<o.length;a++)o[a].parentUniqueID===e.data.uniqueID&&(o.splice(a,1),a-=1);this.dataResults.result=o}else{var d=new n.Deferred;e.childDataBind=d.resolve;var l=e.data;this.trigger(L,e),d.promise.then(function(){if(e.childData.length){s(r)&&(r.flatData=r.dataResults.result),r.enableInfiniteScrolling&&s(r)&&(r.flatData=r.infiniteScrollData);for(var n=r.flatData,o=0,a=0;a<n.length;a++)if(n[a].taskData===l.taskData){o=a;break}var d=t.getValue("result",r.dataSource),p=g(e.childData),h=l[r.childMapping]&&l[r.childMapping].length>p.length?l[r.childMapping].length:p.length;for(a=0;a<h;a++)l[r.childMapping]&&d.filter(function(e,t){e[r.parentIdMapping]===l[r.idMapping]&&d.splice(t,1)}),p[a]?(p[a].level=l.level+1,p[a].index=Math.ceil(1e3*Math.random()),p[a].parentItem=t.extend({},l),p[a].taskData=t.extend({},p[a]),delete p[a].parentItem.childRecords,delete p[a].taskData.parentItem,p[a].parentUniqueID=l.uniqueID,p[a].uniqueID=i.getUid(r.element.id+"_data_"),t.setValue("uniqueIDCollection."+p[a].uniqueID,p[a],r),(!t.isNullOrUndefined(p[a][r.childMapping])||p[a][r.hasChildMapping]&&s(r))&&(p[a].hasChildRecords=!0),s(r)&&l[r.childMapping]&&l[r.childMapping][a]?n.splice(o+1+a,0,p[a]):n.splice(o+1+a,l[r.childMapping]&&l[r.childMapping][a]?1:0,p[a])):n.splice(o+1+a,1);n[o][r.childMapping]=p,n[o].childRecords=p,n[o].expanded=!0,t.setValue("uniqueIDCollection."+n[o].uniqueID,n[o],r);for(var c=0;c<e.childData.length;c++)d.push(e.childData[c])}s(r)&&r.loadChildOnDemand&&"expand"===e.requestType&&(r.dataResults.expandRecord={},r.dataResults.expandRecord=e.data),r.isExpandRefresh=!0;var u=r.getContentTable().parentElement.scrollTop;r.grid.refresh(),r.setHeightForFrozenContent(),r.enableInfiniteScrolling&&(r.getContentTable().parentElement.scrollTop=u),r.trigger(K,e)})}},d.prototype.remoteExpand=function(e,t,i){var r=this.getRows();if(this.rowTemplate){var n=this.getContentTable().rows;r=[].slice.call(n)}var o={data:i,row:t},a=[];if(a=r.filter(function(e){return e.querySelector(".e-gridrowindex"+i.index+"level"+(i.level+1))||e.querySelector(".e-gridrowindex"+i.index+"level0.e-summarycell")}),"expand"===e){this.notify(Y,{record:i,rows:a,parentRow:t});var s={row:t,data:i};a.length>0&&(this.setHeightForFrozenContent(),this.trigger(K,s))}else this.collapseRemoteChild({record:i,rows:a}),this.setHeightForFrozenContent(),this.trigger(W,o)},d.prototype.localExpand=function(e,i,r){var n,o=this.getCurrentViewRecords().filter(function(e){return e.parentUniqueID===r.uniqueID});this.isPixelHeight()&&i.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(i,!1);var d,l,p=this.getRows();if(this.rowTemplate){var h=this.getContentTable().rows;p=[].slice.call(h)}var c="expand"===e?"table-row":"none",u=this.getPrimaryKeyFieldNames()[0];if(this.enableImmutableMode&&!this.allowPaging){n=[];for(var g=0;g<o.length;g++){var f=this.grid.getRowIndexByPrimaryKey(o[g][u]);n.push(this.getRows()[f])}}else n=p.filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))});var y=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.frozenRows||this.frozenColumns||this.getFrozenColumns()||y)&&(d=this.getMovableRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))})),y&&(l=this.getFrozenRightRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))}));var m=this.grid.getRowsObject();!1!==m[r.index].visible&&(m[r.index].visible=!0);var v=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))});for(g=0;g<n.length;g++)t.isNullOrUndefined(n[g])||(n[g].style.display=c),t.isNullOrUndefined(n[g])||this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||(m[n[g].rowIndex].visible="none"!=c,"parentItem"in r&&p[r.parentItem.index].getElementsByClassName("e-treegridcollapse").length&&(m[r.index].visible=!1)),t.isNullOrUndefined(d)||(d[g].style.display=c),t.isNullOrUndefined(l)||(l[g].style.display=c),this.notify("childRowExpand",{row:n[g]}),!t.isNullOrUndefined(o[g].childRecords)&&o[g].childRecords.length>0&&("expand"!==e||t.isNullOrUndefined(o[g].expanded)||o[g].expanded)&&(this.expandCollapse(e,n[g],o[g],!0),this.frozenColumns<=this.treeColumnIndex&&!t.isNullOrUndefined(d)&&this.expandCollapse(e,d[g],o[g],!0));for(g=0;g<v.length;g++)t.isNullOrUndefined(v[g])||this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||(m[v[g].rowIndex].visible="none"!=c,v[g].style.display=c);this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||this.grid.notify("refresh-Expand-and-Collapse",{rows:this.grid.getRowsObject()})},d.prototype.updateAltRow=function(e){if(this.enableAltRow&&!this.rowTemplate)for(var i=0,r=0;e&&r<e.length;r++){var n=e[r];"none"!==n.style.display&&(n.classList.contains("e-altrow")&&t.removeClass([n],"e-altrow"),i%2==0||n.classList.contains("e-summaryrow")||n.classList.contains("e-detailrow")||t.addClass([n],"e-altrow"),n.classList.contains("e-summaryrow")||n.classList.contains("e-detailrow")||i++)}},d.prototype.treeColumnRowTemplate=function(){if(this.rowTemplate){var e=this.getContentTable().rows;e=[].slice.call(e);for(var t=0;t<e.length;t++){var i=this.grid.getContentTable().rows[t].cells[this.treeColumnIndex],r=e[t],n={data:this.grid.getRowsObject()[t].data,row:r,cell:i,column:this.getColumns()[this.treeColumnIndex]};this.renderModule.cellRender(n)}}},d.prototype.collapseRemoteChild=function(e,i){i||(e.record.expanded=!1);var r,n,o=e.rows,a=[],s=[],d=this.getFrozenLeftColumnsCount()>0||this.getFrozenRightColumnsCount()>0;d&&(a=this.getMovableRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))}),s=this.getFrozenRightRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))}));for(var l=0;l<o.length;l++){o[l].style.display="none",r=o[l];var p=o[l].querySelector(".e-detailrowexpand");if(t.isNullOrUndefined(p)||this.grid.detailRowModule.collapse(p),d&&(a[l].style.display="none",s[l].style.display="none",o[l].querySelector(".e-treecolumn-container .e-treegridexpand")||(a[l].querySelector(".e-treecolumn-container .e-treegridexpand")?r=a[l]:s[l].querySelector(".e-treecolumn-container .e-treegridexpand")&&(r=s[l]))),r.querySelector(".e-treecolumn-container .e-treegridexpand")){var h=r.querySelector(".e-treecolumn-container .e-treegridexpand");n=this.rowTemplate?this.grid.getCurrentViewRecords()[o[l].rowIndex]:this.grid.getRowObjectFromUID(o[l].getAttribute("data-Uid")).data,!t.isNullOrUndefined(h)&&n.expanded&&(t.removeClass([h],"e-treegridexpand"),t.addClass([h],"e-treegridcollapse"));for(var c=[],u=this.getRows(),g=0;g<u.length;g++)u[g].querySelector(".e-gridrowindex"+n.index+"level"+(n.level+1))&&c.push(u[g]);c.length&&n.expanded&&this.collapseRemoteChild({record:n,rows:c},!0)}}},d.prototype.updateRowAndCellElements=function(e,t,i){for(var r=0;r<e.length;r++)this.renderModule.cellRender({data:e[r],cell:t[r].cells[i],column:this.grid.getColumns()[this.treeColumnIndex],requestType:"rowDragAndDrop"}),"indenting"!==this.action&&"outdenting"!==this.action||this.renderModule.RowModifier({data:e[r],row:t[r]})},d.prototype.addListener=function(){this.on("updateResults",this.updateResultModel,this),this.grid.on("initial-end",this.afterGridRender,this)},d.prototype.updateResultModel=function(e){this.dataResults=e},d.prototype.removeListener=function(){this.isDestroyed||(this.off("updateResults",this.updateResultModel),this.grid.off("initial-end",this.afterGridRender))},d.prototype.filterByColumn=function(e,t,i,r,n,o,a,s){this.grid.filterByColumn(e,t,i,r,n,o,a,s)},d.prototype.clearFiltering=function(){this.grid.clearFiltering()},d.prototype.removeFilteredColsByField=function(e,t){this.grid.removeFilteredColsByField(e,t)},d.prototype.selectRow=function(e,t){this.grid.selectRow(e,t)},d.prototype.selectRows=function(e){this.grid.selectRows(e)},d.prototype.clearSelection=function(){this.grid.clearSelection()},d.prototype.copy=function(e){this.clipboardModule.copy(e)},d.prototype.paste=function(e,t,i){this.clipboardModule.paste(e,t,i)},d.prototype.selectCell=function(e,t){this.grid.selectCell(e,t)},d.prototype.getSelectedRows=function(){return this.grid.getSelectedRows()},d.prototype.getMovableCellFromIndex=function(e,t){return this.grid.getMovableCellFromIndex(e,t)},d.prototype.getMovableDataRows=function(){return this.grid.getMovableDataRows()},d.prototype.getMovableRowByIndex=function(e){return this.grid.getMovableRowByIndex(e)},d.prototype.getMovableRows=function(){return this.grid.getMovableRows()},d.prototype.getFrozenRightRowByIndex=function(e){return this.grid.getFrozenRightRowByIndex(e)},d.prototype.getFrozenRightRows=function(){return this.grid.getFrozenRightRows()},d.prototype.getFrozenRightDataRows=function(){return this.grid.getFrozenRightDataRows()},d.prototype.getFrozenRightCellFromIndex=function(e,t){return this.grid.getFrozenRightCellFromIndex(e,t)},d.prototype.getFrozenLeftColumnHeaderByIndex=function(e){return this.grid.getFrozenLeftColumnHeaderByIndex(e)},d.prototype.getFrozenRightColumnHeaderByIndex=function(e){return this.grid.getFrozenRightColumnHeaderByIndex(e)},d.prototype.getMovableColumnHeaderByIndex=function(e){return this.grid.getMovableColumnHeaderByIndex(e)},d.prototype.getMovableColumnsCount=function(){return this.grid.getMovableColumnsCount()},d.prototype.getFrozenLeftColumnsCount=function(){return this.grid.getFrozenLeftColumnsCount()},d.prototype.getFrozenRightColumnsCount=function(){return this.grid.getFrozenRightColumnsCount()},d.prototype.getFrozenLeftColumns=function(){return this.updateColumnModel(this.grid.getFrozenLeftColumns()),this.columnModel},d.prototype.getFrozenRightColumns=function(){return this.updateColumnModel(this.grid.getFrozenRightColumns()),this.columnModel},d.prototype.getVisibleMovableCount=function(){return this.grid.getVisibleMovableCount()},d.prototype.getVisibleFrozenRightCount=function(){return this.grid.getVisibleFrozenRightCount()},d.prototype.getVisibleFrozenLeftCount=function(){return this.grid.getVisibleFrozenLeftCount()},d.prototype.getMovableColumns=function(){return this.updateColumnModel(this.grid.getMovableColumns()),this.columnModel},d.prototype.getFrozenColumns=function(){return this.getFrozenCount(this.columns,0)+this.frozenColumns},d.prototype.getFrozenCount=function(e,t){for(var i=0,r=e.length;i<r;i++)e[i].columns?t=this.getFrozenCount(e[i].columns,t):e[i].isFrozen&&t++;return t},d.prototype.getSelectedRowIndexes=function(){return this.grid.getSelectedRowIndexes()},d.prototype.getSelectedRowCellIndexes=function(){return this.grid.getSelectedRowCellIndexes()},d.prototype.getSelectedRecords=function(){return this.grid.getSelectedRecords()},d.prototype.getDataModule=function(){return{baseModule:this.grid.getDataModule(),treeModule:this.dataModule}},d.prototype.reorderRows=function(e,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},d.prototype.indent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"indent"))},d.prototype.outdent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"outdent"))};var l;return lt([t.Property(0)],d.prototype,"frozenRows",void 0),lt([t.Property(0)],d.prototype,"frozenColumns",void 0),lt([t.Property("Ellipsis")],d.prototype,"clipMode",void 0),lt([t.Property([])],d.prototype,"columns",void 0),lt([t.Property(null)],d.prototype,"childMapping",void 0),lt([t.Property(null)],d.prototype,"hasChildMapping",void 0),lt([t.Property(0)],d.prototype,"treeColumnIndex",void 0),lt([t.Property(null)],d.prototype,"idMapping",void 0),lt([t.Property(null)],d.prototype,"parentIdMapping",void 0),lt([t.Property(!1)],d.prototype,"enableCollapseAll",void 0),lt([t.Property(null)],d.prototype,"expandStateMapping",void 0),lt([t.Property(!1)],d.prototype,"allowRowDragAndDrop",void 0),lt([t.Property([])],d.prototype,"dataSource",void 0),lt([t.Property()],d.prototype,"query",void 0),lt([t.Property()],d.prototype,"cloneQuery",void 0),lt([t.Property("AllPages")],d.prototype,"printMode",void 0),lt([t.Property(!1)],d.prototype,"allowPaging",void 0),lt([t.Property(!1)],d.prototype,"loadChildOnDemand",void 0),lt([t.Property(!1)],d.prototype,"allowTextWrap",void 0),lt([t.Complex({},O)],d.prototype,"textWrapSettings",void 0),lt([t.Property(!1)],d.prototype,"allowReordering",void 0),lt([t.Property(!1)],d.prototype,"allowResizing",void 0),lt([t.Property(!1)],d.prototype,"autoCheckHierarchy",void 0),lt([t.Complex({},Ke)],d.prototype,"pageSettings",void 0),lt([t.Complex({},i.RowDropSettings)],d.prototype,"rowDropSettings",void 0),lt([t.Property()],d.prototype,"pagerTemplate",void 0),lt([t.Property(!1)],d.prototype,"showColumnMenu",void 0),lt([t.Property(!1)],d.prototype,"showColumnChooser",void 0),lt([t.Property(!1)],d.prototype,"allowSorting",void 0),lt([t.Property(!0)],d.prototype,"allowMultiSorting",void 0),lt([t.Complex({},nt)],d.prototype,"sortSettings",void 0),lt([t.Collection([],Xe)],d.prototype,"aggregates",void 0),lt([t.Complex({},et)],d.prototype,"editSettings",void 0),lt([t.Property(!1)],d.prototype,"allowFiltering",void 0),lt([t.Property()],d.prototype,"detailTemplate",void 0),lt([t.Complex({},I)],d.prototype,"filterSettings",void 0),lt([t.Complex({},Le)],d.prototype,"searchSettings",void 0),lt([t.Property()],d.prototype,"toolbar",void 0),lt([t.Property()],d.prototype,"toolbarTemplate",void 0),lt([t.Property("Default")],d.prototype,"gridLines",void 0),lt([t.Property()],d.prototype,"contextMenuItems",void 0),lt([t.Property()],d.prototype,"columnMenuItems",void 0),lt([t.Property()],d.prototype,"rowTemplate",void 0),lt([t.Property("Parent")],d.prototype,"copyHierarchyMode",void 0),lt([t.Property(null)],d.prototype,"rowHeight",void 0),lt([t.Property(!0)],d.prototype,"enableAltRow",void 0),lt([t.Property(!0)],d.prototype,"allowKeyboard",void 0),lt([t.Property(!1)],d.prototype,"enableHover",void 0),lt([t.Property(!1)],d.prototype,"enableAutoFill",void 0),lt([t.Property(!1)],d.prototype,"enableAdaptiveUI",void 0),lt([t.Property(!1)],d.prototype,"enableImmutableMode",void 0),lt([t.Property("auto")],d.prototype,"height",void 0),lt([t.Property("auto")],d.prototype,"width",void 0),lt([t.Property(!1)],d.prototype,"enableVirtualization",void 0),lt([t.Property(!1)],d.prototype,"enableColumnVirtualization",void 0),lt([t.Property(!1)],d.prototype,"enableInfiniteScrolling",void 0),lt([t.Complex({},st)],d.prototype,"infiniteScrollSettings",void 0),lt([t.Property("All")],d.prototype,"columnQueryMode",void 0),lt([t.Event()],d.prototype,"created",void 0),lt([t.Event()],d.prototype,"load",void 0),lt([t.Event()],d.prototype,"expanding",void 0),lt([t.Event()],d.prototype,"expanded",void 0),lt([t.Event()],d.prototype,"collapsing",void 0),lt([t.Event()],d.prototype,"collapsed",void 0),lt([t.Event()],d.prototype,"cellSave",void 0),lt([t.Event()],d.prototype,"cellSaved",void 0),lt([t.Event()],d.prototype,"actionBegin",void 0),lt([t.Event()],d.prototype,"actionComplete",void 0),lt([t.Event()],d.prototype,"beginEdit",void 0),lt([t.Event()],d.prototype,"batchAdd",void 0),lt([t.Event()],d.prototype,"batchDelete",void 0),lt([t.Event()],d.prototype,"batchCancel",void 0),lt([t.Event()],d.prototype,"beforeBatchAdd",void 0),lt([t.Event()],d.prototype,"beforeBatchDelete",void 0),lt([t.Event()],d.prototype,"beforeBatchSave",void 0),lt([t.Event()],d.prototype,"cellEdit",void 0),lt([t.Event()],d.prototype,"actionFailure",void 0),lt([t.Event()],d.prototype,"dataBound",void 0),lt([t.Event()],d.prototype,"dataSourceChanged",void 0),lt([t.Event()],d.prototype,"dataStateChange",void 0),lt([t.Event()],d.prototype,"recordDoubleClick",void 0),lt([t.Event()],d.prototype,"rowDataBound",void 0),lt([t.Event()],d.prototype,"detailDataBound",void 0),lt([t.Event()],d.prototype,"queryCellInfo",void 0),lt([t.Property(!0)],d.prototype,"allowSelection",void 0),lt([t.Event()],d.prototype,"rowSelecting",void 0),lt([t.Event()],d.prototype,"rowSelected",void 0),lt([t.Event()],d.prototype,"rowDeselecting",void 0),lt([t.Event()],d.prototype,"rowDeselected",void 0),lt([t.Event()],d.prototype,"headerCellInfo",void 0),lt([t.Event()],d.prototype,"cellSelecting",void 0),lt([t.Event()],d.prototype,"columnMenuOpen",void 0),lt([t.Event()],d.prototype,"columnMenuClick",void 0),lt([t.Event()],d.prototype,"cellSelected",void 0),lt([t.Event()],d.prototype,"cellDeselecting",void 0),lt([t.Event()],d.prototype,"cellDeselected",void 0),lt([t.Event()],d.prototype,"resizeStart",void 0),lt([t.Event()],d.prototype,"resizing",void 0),lt([t.Event()],d.prototype,"resizeStop",void 0),lt([t.Event()],d.prototype,"columnDragStart",void 0),lt([t.Event()],d.prototype,"columnDrag",void 0),lt([t.Event()],d.prototype,"columnDrop",void 0),lt([t.Event()],d.prototype,"checkboxChange",void 0),lt([t.Event()],d.prototype,"printComplete",void 0),lt([t.Event()],d.prototype,"beforePrint",void 0),lt([t.Event()],d.prototype,"toolbarClick",void 0),lt([t.Event()],d.prototype,"beforeDataBound",void 0),lt([t.Event()],d.prototype,"contextMenuOpen",void 0),lt([t.Event()],d.prototype,"contextMenuClick",void 0),lt([t.Event()],d.prototype,"beforeCopy",void 0),lt([t.Event()],d.prototype,"beforePaste",void 0),lt([t.Event()],d.prototype,"rowDrag",void 0),lt([t.Event()],d.prototype,"rowDragStart",void 0),lt([t.Event()],d.prototype,"rowDragStartHelper",void 0),lt([t.Event()],d.prototype,"rowDrop",void 0),lt([t.Property(-1)],d.prototype,"selectedRowIndex",void 0),lt([t.Complex({},je)],d.prototype,"selectionSettings",void 0),lt([t.Property(!1)],d.prototype,"allowExcelExport",void 0),lt([t.Property(!1)],d.prototype,"allowPdfExport",void 0),lt([t.Event()],d.prototype,"pdfQueryCellInfo",void 0),lt([t.Event()],d.prototype,"pdfHeaderQueryCellInfo",void 0),lt([t.Event()],d.prototype,"excelQueryCellInfo",void 0),lt([t.Event()],d.prototype,"excelHeaderQueryCellInfo",void 0),lt([t.Event()],d.prototype,"beforeExcelExport",void 0),lt([t.Event()],d.prototype,"excelExportComplete",void 0),lt([t.Event()],d.prototype,"beforePdfExport",void 0),lt([t.Event()],d.prototype,"pdfExportComplete",void 0),d=l=lt([t.NotifyPropertyChanges],d)}(t.Component),ht=function(){function e(e){i.Grid.Inject(i.Reorder),this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"reorder"},e.prototype.addEventListener=function(){this.parent.on("getColumnIndex",this.getTreeColumn,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("getColumnIndex",this.getTreeColumn)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getTreeColumn=function(){for(var e,t=this.parent.columnModel[this.parent.treeColumnIndex],r=this.parent.getColumns(),n=0;n<r.length;n++){if(i.getObject("field",t)===i.getObject("field",r[n])){e=n;break}}this.parent.setProperties({treeColumnIndex:e},!0)},e}(),ct=function(){function e(e){i.Grid.Inject(i.Resize),this.parent=e}return e.prototype.autoFitColumns=function(e){this.parent.grid.autoFitColumns(e)},e.prototype.getModuleName=function(){return"resize"},e.prototype.destroy=function(){this.parent.isDestroyed||this.parent.grid.resizeModule.destroy()},e}(),ut=function(){function e(e){this.canDrop=!0,this.isDraggedWithChild=!1,this.modifiedRecords="modifiedRecords",this.selectedRecords="selectedRecords",this.selectedRows="selectedRows",this.hasDropItem=!0,this.isaddtoBottom=!1,i.Grid.Inject(i.RowDD),this.parent=e,this.addEventListener()}return e.prototype.getChildrecordsByParentID=function(e){return(this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource).filter(function(t){return t.uniqueID===e})},e.prototype.addEventListener=function(){this.parent.on(De,this.Rowdraging,this),this.parent.on(Me,this.rowDropped,this),this.parent.on(Se,this.rowsAdded,this),this.parent.on(Ie,this.rowsRemoved,this)},e.prototype.reorderRows=function(e,i,r){var n=this.parent,o="updateRowAndCellElements";if(e[0]!==i&&-1!==["above","below","child"].indexOf(r)){"above"===r&&(this.dropPosition="topSegment"),"below"===r&&(this.dropPosition="bottomSegment"),"child"===r&&(this.dropPosition="middleSegment"),this.parent.dropPosition=this.dropPosition;for(var a=[],d=0;d<e.length;d++){var l=this.parent.getRowByIndex(e[d]).rowIndex;a[d]=this.parent.getCurrentViewRecords()[l]}var p={data:a,dropIndex:i};if(s(this.parent)||this.dropRows(p,!0),n.isLocalData&&(n.flatData=this.orderToIndex(n.flatData)),"outdenting"===this.parent.action&&(t.isNullOrUndefined(a[0].parentItem)||(a[0].level=a[0].parentItem.level+1)),this.parent.grid.refresh(),this.parent.enableImmutableMode&&"middleSegment"===this.dropPosition){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"indenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var h=this.parent.getRows()[e[0]],c=p.data[0],u=[];(m=[]).push(c),u.push(h);var g=y(this.parent,p.data[0].parentUniqueID),f=this.parent.getRows()[i];m.push(g),u.push(f),this.parent[o](m,u,l)}if(this.parent.enableImmutableMode&&"outdenting"===this.parent.action){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"outdenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var m,v=p.data[0];h=this.parent.getRows()[e[0]],u=[];(m=[]).push(v),u.push(h),this.parent[o](m,u,l)}}},e.prototype.indentOutdentAction=function(e,i){var r=this.parent,n=-1;if(!t.isNullOrUndefined(e)||-1!==this.parent.selectedRowIndex){this.parent.enableVirtualization&&-1!==this.parent.selectedRowIndex?n=this.parent.getSelectedRows()[0].rowIndex:-1!==this.parent.selectedRowIndex&&(n=this.parent.selectedRowIndex),this.selectedItem=t.isNullOrUndefined(e)?r.getCurrentViewRecords()[n]:e;var o=this.parent.getPrimaryKeyFieldNames()[0],a=this.parent.grid.getRowIndexByPrimaryKey(this.selectedItem[o]);if(this.selectedRow=this.parent[this.selectedRows]=-1!==n?this.parent.getSelectedRows()[0]:this.parent.grid.getRowByIndex(a),this.selectedRecord=this.parent[this.selectedRecords]=-1!==n?r.getCurrentViewRecords()[n]:this.selectedItem,"indent"===i){var s=r.getCurrentViewRecords()[this.selectedRow.rowIndex-1],d=void 0;if(0===this.selectedRow.rowIndex||-1===this.selectedRow.rowIndex||r.getCurrentViewRecords()[this.selectedRow.rowIndex].level-s.level==1)return;if(s.level>this.selectedRecord.level)for(var l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[l].taskData===s.parentItem.taskData&&(d=l,r.enableVirtualization&&(d=parseInt(r.getRows()[l].getAttribute("data-rowindex"),10)));else d=this.selectedRow.rowIndex-1;!this.parent.enableVirtualization||!this.selectedRecord||s.level>this.selectedRecord.level||(d=parseInt(this.selectedRow.getAttribute("data-rowindex"),10)-1),r.action="indenting",r.dropIndex=d,this.eventTrigger("indenting",d)}else if("outdent"===i){if(-1===this.selectedRow.rowIndex||0===this.selectedRow.rowIndex||0===r.getCurrentViewRecords()[this.selectedRow.rowIndex].level)return;d=void 0;var p=this.selectedRecord.parentItem;for(l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[l].uniqueID===p.uniqueID&&(d=l);this.parent.enableVirtualization&&this.selectedRecord&&(d=parseInt(this.parent.getRows()[d].getAttribute("data-rowindex"),10)),r.action="outdenting",r.dropIndex=d,this.eventTrigger("outdenting",d)}}},e.prototype.eventTrigger=function(e,t){var i=this,r={action:e,cancel:!1,data:[this.parent[this.selectedRecords]],row:this.parent[this.selectedRows]};this.parent.trigger(T,r,function(e){e.cancel||("indenting"===e.action?i.parent.enableVirtualization?i.reorderRows([parseInt(i.selectedRow.getAttribute("data-rowindex"),10)],t,"child"):i.reorderRows([i.selectedRow.rowIndex],t,"child"):"outdenting"===e.action&&(i.parent.enableVirtualization?i.reorderRows([parseInt(i.selectedRow.getAttribute("data-rowindex"),10)],t,"below"):i.reorderRows([i.selectedRow.rowIndex],t,"below")))})},e.prototype.orderToIndex=function(e){for(var i=0;i<e.length;i++)if(e[i].index=i,!t.isNullOrUndefined(e[i].parentItem)){var r=t.getValue("uniqueIDCollection."+e[i].parentUniqueID,this.parent);e[i].parentItem.index=r.index}return e},e.prototype.rowsAdded=function(e){for(var i,r=e.records,o=e.records.length-1;o>-1;o--)if((i=r[o]).parentUniqueID){var a=r.filter(function(e){return e.uniqueID===i.parentUniqueID});if(a.length){var s=a[0].childRecords.indexOf(i),d=a[0];-1!==s&&(t.isNullOrUndefined(this.parent.idMapping)&&(d.childRecords.splice(s,1),d.childRecords.length||(d.hasChildRecords=!1,d.hasFilteredChildRecords=!1)),this.isDraggedWithChild=!0)}}if(t.isNullOrUndefined(this.parent.dataSource)||!this.parent.dataSource.length){var l,p=this.parent,h=e.records;for(o=e.records.length-1;o>-1;o--){l=h[o],!o&&l.hasChildRecords&&(l.taskData[this.parent.parentIdMapping]=null);if(t.isNullOrUndefined(p.parentIdMapping)||(p.childMapping=null),t.isNullOrUndefined(l.taskData)||t.isNullOrUndefined(p.childMapping)||Object.prototype.hasOwnProperty.call(l.taskData,p.childMapping)||(l.taskData[p.childMapping]=[]),Object.prototype.hasOwnProperty.call(l,p.childMapping)&&l[p.childMapping].length&&!this.isDraggedWithChild&&!t.isNullOrUndefined(p.parentIdMapping))for(var c=l[p.childMapping],u=0;u<c.length;u++)-1===h.indexOf(c[u])&&(h.splice(u,0,c[u]),c[u].taskData=t.extend({},c[u]),o+=1);Object.prototype.hasOwnProperty.call(l,p.parentIdMapping)&&null!==l[p.parentIdMapping]&&!this.isDraggedWithChild&&(l.taskData[p.parentIdMapping]=null,delete l.parentItem,delete l.parentUniqueID),t.isNullOrUndefined(p.dataSource)&&(p.dataSource=[]),p.dataSource.splice(0,0,l.taskData)}p.setProperties({dataSource:p.dataSource},!1)}else{for(o=0;o<r.length;o++)t.setValue("uniqueIDCollection."+r[o].uniqueID,r[o],this.parent);var g={data:e.records,dropIndex:e.toIndex};this.parent.dataSource instanceof n.DataManager?(this.treeGridData=this.parent.dataSource.dataSource.json,this.treeData=this.parent.dataSource.dataSource.json):(this.treeGridData=this.parent.grid.dataSource,this.treeData=this.parent.dataSource),t.isNullOrUndefined(this.dropPosition)&&(this.dropPosition="bottomSegment",g.dropIndex=this.parent.getCurrentViewRecords().length>1?this.parent.getCurrentViewRecords().length-1:g.dropIndex,g.data=g.data.map(function(e){return e.hasChildRecords&&t.isNullOrUndefined(e.parentItem)?(e.level=0,e):(delete e.parentItem,delete e.parentUniqueID,e.level=0,e)})),this.dropRows(g)}},e.prototype.rowsRemoved=function(e){for(var t=0;t<e.records.length;t++)this.draggedRecord=e.records[t],(this.draggedRecord.hasChildRecords||this.draggedRecord.parentItem&&-1!==this.parent.grid.dataSource.indexOf(this.getChildrecordsByParentID(this.draggedRecord.parentUniqueID)[0])||0===this.draggedRecord.level)&&this.deleteDragRow()},e.prototype.refreshGridDataSource=function(){var e,i,r=this.draggedRecord,o=this.droppedRecord,a=this.parent;if(!(e=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?a.dataSource.dataSource.json:a.dataSource)||t.isNullOrUndefined(o)||o.parentItem||t.isNullOrUndefined(o.taskData)){if(!this.parent.parentIdMapping&&!t.isNullOrUndefined(o)&&o.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var s=this.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords;for(l=0;l<s.length;l++)o.parentItem.taskData[this.parent.childMapping][l]=s[l].taskData}}else{for(var d=Object.keys(e),l=0;l<d.length;l++)e[l][this.parent.childMapping]===o.taskData[this.parent.childMapping]&&(i=l);"topSegment"===this.dropPosition?this.parent.idMapping||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.idMapping||e.splice(i+1,0,r.taskData))}this.parent.parentIdMapping&&(r.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(r[this.parent.parentIdMapping]=o[this.parent.parentIdMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.parentIdMapping]):(r[this.parent.parentIdMapping]=o[this.parent.idMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.idMapping]):(r.taskData[this.parent.parentIdMapping]=null,r[this.parent.parentIdMapping]=null))},e.prototype.removeFirstrowBorder=function(e){var t="bottomSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-firstrow-border").length>0&&e&&(0!==e.rowIndex||t)&&this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove()},e.prototype.removeLastrowBorder=function(e){var t,i=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow")),r=(t=this.parent.enableVirtualization?e&&!i&&this.parent.getRows()[this.parent.getCurrentViewRecords().length-1].getAttribute("data-uid")!==e.getAttribute("data-uid"):e&&!i&&this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length-1).getAttribute("data-uid")!==e.getAttribute("data-uid"))||"topSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-lastrow-border").length>0&&e&&(t||r)&&this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove()},e.prototype.updateIcon=function(e,r,n){var o=n.target?t.closest(n.target,"tr"):null;this.dropPosition=void 0;var a=0;this.removeFirstrowBorder(o),this.removeLastrowBorder(o);for(var s=0;s<n.rows.length;s++)(t.isNullOrUndefined(o)||o.getAttribute("data-uid")!==n.rows[s].getAttribute("data-uid"))&&i.parentsUntil(n.target,"e-gridcontent")||(this.dropPosition="Invalid",this.addErrorElem());var d=this.parent,l=0,p=d.toolbar&&d.toolbar.length?document.getElementById(d.element.id+"_gridcontrol_toolbarItems").offsetHeight:0,h=this.getOffset(d.element),c=d.getHeaderContent().offsetHeight+h.top+p,u=d.getContent().firstElementChild.scrollTop;t.isNullOrUndefined(o)||(a=o.offsetTop-u);var g=((l=this.parent.enableVirtualization?o.getBoundingClientRect().top:a+c+0)+e[0].offsetHeight-l)/3,f=l+g,y=f+g,m=y+g,v=i.getObject("originalEvent.event",n),w=i.getObject("originalEvent.event",n),R="mousemove"===v.type?v.pageY:t.isNullOrUndefined(w)||t.isNullOrUndefined(w.changedTouches)?null:w.changedTouches[0].pageY,C=R<=f,x=R>f&&R<=y,b=R>y&&R<=m;if(C||x||b){if(C&&"Invalid"!==this.dropPosition&&(this.removeChildBorder(),this.dropPosition="topSegment",this.removetopOrBottomBorder(),this.addFirstrowBorder(o),this.removeErrorElem(),this.removeLastrowBorder(o),this.topOrBottomBorder(n.target)),x&&"Invalid"!==this.dropPosition){this.removetopOrBottomBorder();var S=[],I=t.closest(n.target,"tr");(S=[].slice.call(I.querySelectorAll(".e-rowcell,.e-rowdragdrop,.e-detailrowcollapse"))).length>0&&this.addRemoveClasses(S,!0,"e-childborder"),this.addLastRowborder(o),this.addFirstrowBorder(o),this.dropPosition="middleSegment"}b&&"Invalid"!==this.dropPosition&&(this.removeErrorElem(),this.removetopOrBottomBorder(),this.removeChildBorder(),this.dropPosition="bottomSegment",this.addLastRowborder(o),this.removeFirstrowBorder(o),this.topOrBottomBorder(n.target))}return this.dropPosition},e.prototype.removeChildBorder=function(){var e=[];(e=[].slice.call(this.parent.element.querySelectorAll(".e-childborder"))).length>0&&this.addRemoveClasses(e,!1,"e-childborder")},e.prototype.addFirstrowBorder=function(e){var i=this.parent.element,r=this.parent;if(e&&0===e.rowIndex&&!e.classList.contains("e-emptyrow")){var n=this.parent.createElement("div",{className:"e-firstrow-border"}),o=this.parent.getHeaderContent(),a=0;r.toolbar&&(a=r.toolbarModule.getToolbar().offsetHeight);var s=!t.isNullOrUndefined(this.parent.rowDropSettings.targetID);s&&(n.style.top=this.parent.grid.element.getElementsByClassName("e-gridheader")[0].offsetHeight+a+"px"),n.style.width=s?i.offsetWidth+"px":i.offsetWidth-this.getScrollWidth()+"px",o.querySelectorAll(".e-firstrow-border").length||o.appendChild(n)}},e.prototype.addLastRowborder=function(e){var t=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow"));if(e&&!t&&this.parent.getRows()[this.parent.getCurrentViewRecords().length-1].getAttribute("data-uid")===e.getAttribute("data-uid")){var i=this.parent.createElement("div",{className:"e-lastrow-border"}),r=this.parent.getContent();i.style.width=this.parent.element.offsetWidth-this.getScrollWidth()+"px",r.querySelectorAll(".e-lastrow-border").length||(r.classList.add("e-treegrid-relative"),r.appendChild(i),i.style.bottom=this.getScrollWidth()+"px")}},e.prototype.getScrollWidth=function(){var e=this.parent.getContent().firstElementChild;return e.scrollWidth>e.offsetWidth?i.Scroll.getScrollBarWidth():0},e.prototype.addErrorElem=function(){var e=document.getElementsByClassName("e-cloneproperties")[0];if(!e.querySelectorAll(".e-errorelem").length&&!this.parent.rowDropSettings.targetID){var i=document.createElement("div");t.classList(i,["e-errorcontainer"],[]),t.classList(i,["e-icons","e-errorelem"],[]);var r=e.querySelector(".errorValue"),n=e.querySelector(".e-rowcell").innerHTML;r&&(n=r.innerHTML,r.parentNode.removeChild(r)),e.querySelector(".e-rowcell").innerHTML="";var o=document.createElement("span");o.className="errorValue",o.style.paddingLeft="16px",o.innerHTML=n,e.querySelector(".e-rowcell").appendChild(i),e.querySelector(".e-rowcell").appendChild(o);var a=document.querySelector(".e-dropitemscount");if(this.hasDropItem&&a){var s=parseInt(a.style.left,10)+i.offsetWidth+16,d=this.parent.enableRtl?0:s;a.style.left=d+"px",this.hasDropItem=!1}}},e.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem"),i=document.querySelector(".errorValue"),r=document.querySelector(".e-dropitemscount");if(e){if(r){var n=parseInt(r.style.left,10)-e.offsetWidth-16;t.setStyleAttribute(i,{paddingLeft:"0px"}),this.parent.enableRtl||t.setStyleAttribute(r,{left:n+"px"})}e.remove()}this.hasDropItem=!0},e.prototype.topOrBottomBorder=function(e){var i=[],r=t.closest(e,"tr");(i=r?[].slice.call(r.querySelectorAll(".e-rowcell,.e-rowdragdrop,.e-detailrowcollapse")):[]).length&&("topSegment"===this.dropPosition&&(this.addRemoveClasses(i,!0,"e-droptop"),this.parent.element.getElementsByClassName("e-lastrow-dragborder").length>0&&this.parent.element.getElementsByClassName("e-lastrow-dragborder")[0].remove()),"bottomSegment"===this.dropPosition&&this.addRemoveClasses(i,!0,"e-dropbottom"))},e.prototype.removetopOrBottomBorder=function(){var e=[];(e=[].slice.call(this.parent.element.querySelectorAll(".e-dropbottom, .e-droptop"))).length&&(this.addRemoveClasses(e,!1,"e-dropbottom"),this.addRemoveClasses(e,!1,"e-droptop"))},e.prototype.addRemoveClasses=function(e,t,i){for(var r=0,n=e.length;r<n;r++)t?e[r].classList.add(i):e[r].classList.remove(i)},e.prototype.getOffset=function(e){var t=e.getBoundingClientRect(),i=document.body,r=document.documentElement,n=window.pageYOffset||r.scrollTop||i.scrollTop,o=window.pageXOffset||r.scrollLeft||i.scrollLeft,a=r.clientTop||i.clientTop||0,s=r.clientLeft||i.clientLeft||0,d=t.top+n-a,l=t.left+o-s;return{top:Math.round(d),left:Math.round(l)}},e.prototype.Rowdraging=function(e){var r=this.parent,n=this.parent.element.querySelector(".e-cloneproperties");n.style.cursor="";var o=e.target?t.closest(e.target,"tr"):null,a=o?o.rowIndex:-1,s=[],d=r.getCurrentViewRecords()[a];if(this.removeErrorElem(),this.canDrop=!0,e.data[0]?s=e.data:s.push(e.data),-1!==a?this.ensuredropPosition(s,d):(this.canDrop=!1,this.addErrorElem()),!r.rowDropSettings.targetID&&this.canDrop&&r.rowDragAndDropModule.updateIcon(e.rows,a,e),r.rowDropSettings.targetID){if((l=i.parentsUntil(e.target,"e-treegrid"))&&l.id===this.parent.rowDropSettings.targetID){l.ej2_instances[0].rowDragAndDropModule.updateIcon(e.rows,a,e)}}if(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)){var l;(l=i.parentsUntil(e.target,"e-treegrid"))||(n.style.cursor="default")}},e.prototype.rowDropped=function(e){var r=this.parent;if(r.rowDropSettings.targetID?(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)||i.parentsUntil(e.target,"e-treegrid")&&i.parentsUntil(e.target,"e-treegrid").id===r.rowDropSettings.targetID||e.target&&document.getElementById(r.rowDropSettings.targetID))&&(t.setValue("dropPosition",this.dropPosition,e),r.trigger("rowDrop",e),!e.cancel&&r.rowDropSettings.targetID&&(this.dragDropGrid(e),r.isLocalData&&(r.flatData=this.orderToIndex(r.flatData)))):i.parentsUntil(e.target,"e-content")&&(this.parent.element.querySelector(".e-errorelem")&&(this.dropPosition="Invalid"),t.setValue("dropPosition",this.dropPosition,e),e.dropIndex=e.dropIndex===e.fromIndex?this.getTargetIdx(e.target.parentElement):e.dropIndex,r.trigger("rowDrop",e),e.cancel||(s(this.parent)||this.dropRows(e),r.isLocalData&&(r.flatData=this.orderToIndex(r.flatData)),r.grid.refresh(),t.isNullOrUndefined(r.getHeaderContent().querySelector(".e-firstrow-border"))||r.getHeaderContent().querySelector(".e-firstrow-border").remove())),this.removetopOrBottomBorder(),this.removeChildBorder(),t.isNullOrUndefined(this.parent.element.getElementsByClassName("e-firstrow-border")[0])?t.isNullOrUndefined(this.parent.element.getElementsByClassName("e-lastrow-border")[0])||this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove():this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove(),this.parent.enableImmutableMode&&!this.parent.allowPaging&&!t.isNullOrUndefined(e.data[0].parentItem)){var n=this.parent.treeColumnIndex;n+=1;var o=this.parent.getPrimaryKeyFieldNames()[0],a=this.parent.grid.getRowIndexByPrimaryKey(e.data[0][o]),d=this.parent.getRows()[a],l=e.data[0];if("middleSegment"===this.dropPosition){var p=[],h=[];p.push(l),h.push(d);l=y(this.parent,e.data[0].parentUniqueID),a=this.parent.grid.getRowIndexByPrimaryKey(l[o]);var c=this.parent.getRows()[a];p.push(l),h.push(c);for(var u=0;u<p.length;u++)this.parent.renderModule.cellRender({data:p[u],cell:h[u].cells[n],column:this.parent.grid.getColumns()[this.parent.treeColumnIndex],requestType:"rowDragAndDrop"});var g=c.getElementsByClassName("e-treegridcollapse")[0];t.isNullOrUndefined(g)||(t.removeClass([g],"e-treegridcollapse"),t.addClass([g],"e-treegridexpand"))}else this.parent.renderModule.cellRender({data:l,cell:d.cells[n],column:this.parent.grid.getColumns()[this.parent.treeColumnIndex],requestType:"rowDragAndDrop"})}},e.prototype.dragDropGrid=function(e){var r,n=this.parent,o=t.closest(e.target,"tr"),d=isNaN(this.getTargetIdx(o))?0:this.getTargetIdx(o),l=i.parentsUntil(e.target,"e-treegrid");if(l&&l.id===this.parent.rowDropSettings.targetID&&!a(this.parent)&&!s(this.parent)){r=l.ej2_instances[0];for(var p=n.getSelectedRecords(),h=[],u=0;u<p.length;u++)h[u]=p[u].index;var g=r.dataSource;if(null!==this.parent.idMapping&&(t.isNullOrUndefined(this.dropPosition)||"bottomSegment"===this.dropPosition||"Invalid"===this.dropPosition)&&!g.length){var f=[];for(u=0;u<p.length;u++)if(p[u].hasChildRecords){f.push(p[u]);for(var y=c(p[u]),m=0;m<y.length;m++)f.push(y[m])}f.length&&(p=f)}n.notify(Ie,{indexes:h,records:p}),r.notify(Se,{toIndex:d,records:p});var v=r.rowDragAndDropModule.treeGridData;if(!t.isNullOrUndefined(v))for(u=0;u<v.length;u++)if(v[u].index=u,!t.isNullOrUndefined(v[u].parentItem)){var w=t.getValue("uniqueIDCollection."+v[u].parentUniqueID+".index",r);v[u].parentItem.index=w}n.grid.refresh(),r.grid.refresh(),r.grid.dataSource.length>1&&(r.grid.refresh(),t.isNullOrUndefined(r.getHeaderContent().querySelector(".e-firstrow-border"))||r.getHeaderContent().querySelector(".e-firstrow-border").remove(),t.isNullOrUndefined(r.getContent().querySelector(".e-lastrow-border"))||r.getContent().querySelector(".e-lastrow-border").remove())}s(this.parent)&&(r=l.ej2_instances[0],n.grid.refresh(),r.grid.refresh())},e.prototype.getTargetIdx=function(e){return e?parseInt(e.getAttribute("data-rowindex"),10):0},e.prototype.getParentData=function(e,t){var i=e.parentItem,r=-1;if(this.parent.enableVirtualization&&-1!==this.parent.selectedRowIndex?r=this.parent.getSelectedRows()[0].rowIndex:-1!==this.parent.selectedRowIndex&&(r=this.parent.selectedRowIndex),"bottomSegment"===this.dropPosition){var n=this.parent.getPrimaryKeyFieldNames()[0],o=-1===r?this.parent.grid.getRowIndexByPrimaryKey(t[0][n]):this.parent.getSelectedRowIndexes()[0],a=this.parent.getCurrentViewRecords()[o];this.droppedRecord=y(this.parent,a.parentItem.uniqueID)}if("middleSegment"===this.dropPosition){this.parent.getCurrentViewRecords()[r].level===i.level?this.droppedRecord=y(this.parent,i.uniqueID):this.getParentData(i)}},e.prototype.dropRows=function(e,i){if("Invalid"!==this.dropPosition&&!a(this.parent)){var r,n=this.parent,o=void 0;if(t.isNullOrUndefined(e.dropIndex)){var s=this.parent.getPrimaryKeyFieldNames()[0],d=-1===n.selectedRowIndex?this.parent.grid.getRowIndexByPrimaryKey(e.data[0][s])-1:n.getSelectedRowIndexes()[0]-1,l=n.getCurrentViewRecords()[d];this.getParentData(l,e.data)}else if(e.dropIndex=e.dropIndex===e.fromIndex?this.getTargetIdx(e.target.parentElement):e.dropIndex,this.parent.enableVirtualization){var p=this.parent.getRowByIndex(e.dropIndex).rowIndex;this.droppedRecord=n.getCurrentViewRecords()[p]}else this.droppedRecord=n.getCurrentViewRecords()[e.dropIndex];var h=[];o=this.droppedRecord,e.data[0]?h=e.data:h.push(e.data),this.parent[this.modifiedRecords].push(e.data[0],o);var c=0,u=this.parent.rowDropSettings.targetID;this.isMultipleGrid=u,u?this.isaddtoBottom=u&&this.isDraggedWithChild:this.ensuredropPosition(h,o);var g=h.length;t.isNullOrUndefined(this.parent.idMapping)||h.reverse();for(var f=function(a){if(r=h[a],y.draggedRecord=r,"Invalid"!==y.dropPosition){if(n.rowDropSettings.targetID&&!i||y.deleteDragRow(),y.draggedRecord===y.droppedRecord){var s=y.getTargetIdx(e.target.offsetParent.parentElement);isNaN(s)&&(s=y.getTargetIdx(e.target.parentElement)),e.dropIndex=s,o=y.droppedRecord=y.parent.getCurrentViewRecords()[e.dropIndex]}if(o.parentItem||"middleSegment"===y.dropPosition){-1!==(g=(u=n.parentData).indexOf(y.draggedRecord))&&u.splice(g,1)}var d=y.treeGridData.indexOf(o);if(y.dropAtTop(d),"bottomSegment"===y.dropPosition){if(o.hasChildRecords?(c=y.getChildCount(o,0),y.parent.parentIdMapping&&y.treeData.splice(d+c+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+c+1,0,y.draggedRecord)):(y.parent.parentIdMapping&&y.treeData.splice(d+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+1,0,y.draggedRecord)),t.isNullOrUndefined(o.parentItem)&&(delete r.parentItem,delete r.parentUniqueID,r.level=0,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=null)),o.parentItem){var l=y.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords,p=l.indexOf(o)+1;l.splice(p,0,r),r.parentItem=o.parentItem,r.parentUniqueID=o.parentUniqueID,r.level=o.level,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=o[y.parent.parentIdMapping],r.parentItem=o.parentItem,r.level=o.level)}if(r.hasChildRecords){y.updateChildRecordLevel(r,1),y.updateChildRecord(r,d+c+1)}}y.dropMiddle(d)}if(t.isNullOrUndefined(r.parentItem)){var u,g=(u=n.parentData).indexOf(y.droppedRecord),f=0;u.filter(function(e){r.uniqueID===e.uniqueID&&f++}),"bottomSegment"===y.dropPosition&&0===f?u.splice(g+1,0,r):"topSegment"===y.dropPosition&&0===f&&u.splice(g,0,r)}n.rowDragAndDropModule.refreshGridDataSource()},y=this,m=0;m<g;m++)f(m)}},e.prototype.dropMiddle=function(e){var i=this.parent,r=c(this.droppedRecord),n=t.isNullOrUndefined(r)||0===r.length?e+1:r.length+e+1;"middleSegment"===this.dropPosition&&(i.parentIdMapping?(this.treeData.splice(n,0,this.draggedRecord.taskData),this.treeGridData.splice(n,0,this.draggedRecord)):this.treeGridData.splice(n,0,this.draggedRecord),this.recordLevel(),this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,n))},e.prototype.dropAtTop=function(e){var t=this.parent;if("topSegment"===this.dropPosition){if(t.parentIdMapping&&this.treeData.splice(e,0,this.draggedRecord.taskData),this.draggedRecord.parentItem=this.treeGridData[e].parentItem,this.draggedRecord.parentUniqueID=this.treeGridData[e].parentUniqueID,this.draggedRecord.level=this.treeGridData[e].level,this.treeGridData.splice(e,0,this.draggedRecord),this.draggedRecord.hasChildRecords){this.updateChildRecord(this.draggedRecord,e),this.updateChildRecordLevel(this.draggedRecord,1)}if(this.droppedRecord.parentItem){var i=this.getChildrecordsByParentID(this.droppedRecord.parentUniqueID)[0].childRecords,r=i.indexOf(this.droppedRecord);i.splice(r,0,this.draggedRecord)}}},e.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,r=this.droppedRecord,n=e.childMapping;if(r.hasChildRecords||(r.hasChildRecords=!0,r.hasFilteredChildRecords=!0,(t.isNullOrUndefined(r.childRecords)||0===r.childRecords.length)&&(r.childRecords=[],!e.parentIdMapping&&t.isNullOrUndefined(r.taskData[n])&&(r.taskData[n]=[]))),"middleSegment"===this.dropPosition){var o=t.extend({},r);delete o.childRecords,i.parentItem=o,i.parentUniqueID=r.uniqueID,r.childRecords.splice(r.childRecords.length,0,i);if(e.isSelfReference&&(r[e.childMapping]=[],r[e.childMapping].splice(r[e.childMapping].length,0,i)),t.isNullOrUndefined(i)||e.parentIdMapping||t.isNullOrUndefined(r.taskData[n])||r.taskData[e.childMapping].splice(r.childRecords.length,0,i.taskData),i.hasChildRecords){i.level=r.level+1,this.updateChildRecordLevel(i,1)}else i.level=r.level+1;r.expanded=!0}},e.prototype.deleteDragRow=function(){this.parent.dataSource instanceof n.DataManager&&u(this.parent)?(this.treeGridData=this.parent.grid.dataSource.dataSource.json,this.treeData=this.parent.dataSource.dataSource.json):(this.treeGridData=this.parent.grid.dataSource,this.treeData=this.parent.dataSource);var e=y(this.parent,this.draggedRecord.uniqueID);!t.isNullOrUndefined(e.childRecords)&&e.childRecords.length&&(e.hasChildRecords=!0),this.removeRecords(e)},e.prototype.updateChildRecord=function(e,i){var r,n=this.parent,o=0;if(!e.hasChildRecords)return 0;o=e.childRecords.length;for(var a=0;a<o;a++)r=this.isMultipleGrid?e.childRecords[a]:t.getValue("uniqueIDCollection."+e.childRecords[a].uniqueID,n),i++,n.flatData.splice(i,0,r),t.setValue("uniqueIDCollection."+r.uniqueID,r,this.parent),n.parentIdMapping&&this.treeData.splice(i,0,r.taskData),r.hasChildRecords&&(i=this.updateChildRecord(r,i));return i},e.prototype.updateChildRecordLevel=function(e,i){var r,n=0;if(i++,!e.hasChildRecords)return 0;n=e.childRecords.length;for(var o=0;o<n;o++){r=this.isMultipleGrid?e.childRecords[o]:t.getValue("uniqueIDCollection."+e.childRecords[o].uniqueID,this.parent);var a=void 0;e.parentItem&&(a=y(this.parent,e.parentItem.uniqueID)),t.isNullOrUndefined(a)&&!t.isNullOrUndefined(e.parentItem)&&(a=e.parentItem),r.level=e.parentItem?a.level+i:e.level+1,r.hasChildRecords&&(i--,i=this.updateChildRecordLevel(r,i))}return i},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;var o=e,a=!t.isNullOrUndefined(r.parentIdMapping),s=this.getChildrecordsByParentID(o.parentUniqueID)[0];if(o){if(o.parentItem){var d=s?s.childRecords:[],l=0;d&&d.length>0&&(l=d.indexOf(o),s.childRecords.splice(l,1),this.parent.parentIdMapping&&!r.enableImmutableMode||v({value:o,action:"delete"},this.parent,a,o.index,o.index))}if(r.parentIdMapping){o.hasChildRecords&&o.childRecords.length>0&&this.removeChildItem(o);for(var p=void 0,h=void 0,c=i,g=0;g<c.length;g++)c[g][this.parent.idMapping]===o.taskData[this.parent.idMapping]&&(p=g);for(g=0;g<this.treeGridData.length;g++)this.treeGridData[g][this.parent.idMapping]===o.taskData[this.parent.idMapping]&&(h=g);-1===p||t.isNullOrUndefined(p)||i.splice(p,1),-1===h||t.isNullOrUndefined(h)||this.treeGridData.splice(h,1)}var f=this.treeGridData.indexOf(o);if(!r.parentIdMapping){var y=this.parent.parentData.indexOf(o);-1!==y&&(r.parentData.splice(y,1),i.splice(y,1))}if(-1===f&&!r.parentIdMapping)for(var m=r.getPrimaryKeyFieldNames()[0],w=0;w<this.treeGridData.length;w++)this.treeGridData[w][m]===o[m]&&(f=w);if(!r.parentIdMapping){var R=this.getChildCount(o,0);this.treeGridData.splice(f,R+1)}o.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(s.expanded=!1,s.hasChildRecords=!1,s.hasFilteredChildRecords=!1),-1!==this.parent[this.modifiedRecords].indexOf(s)||t.isNullOrUndefined(s)||this.parent[this.modifiedRecords].push(s),t.isNullOrUndefined(s)||this.updateModifiedRecords(s)}},e.prototype.updateModifiedRecords=function(e){var i=y(this.parent,e.parentUniqueID);t.isNullOrUndefined(i)||(this.parent[this.modifiedRecords].push(i),this.updateModifiedRecords(i))},e.prototype.removeChildItem=function(e){var i,r,o,a;a=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;for(var s=0;s<e.childRecords.length;s++){i=e.childRecords[s],!t.isNullOrUndefined(i.childRecords)&&i.childRecords.length&&(i.hasChildRecords=!0);var d=void 0;d=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;for(var l=0;l<d.length;l++)d[l][this.parent.idMapping]===i.taskData[this.parent.idMapping]&&(r=l);for(var p=0;p<this.treeGridData.length;p++)if(this.treeGridData[p][this.parent.idMapping]===i.taskData[this.parent.idMapping]){o=p;break}-1===r||t.isNullOrUndefined(r)||a.splice(r,1),-1===o||t.isNullOrUndefined(o)||this.treeGridData.splice(o,1),i.hasChildRecords&&this.removeChildItem(i)}},e.prototype.getChildCount=function(e,t){var i;if(!e.hasChildRecords)return 0;for(var r=0;r<e.childRecords.length;r++)t++,(i=e.childRecords[r]).hasChildRecords&&(t=this.getChildCount(i,t));return t},e.prototype.ensuredropPosition=function(e,i){var r=this;e.filter(function(e){if(e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)){if(-1!==e.childRecords.indexOf(i))return r.dropPosition="Invalid",r.addErrorElem(),void(r.canDrop=!1);r.ensuredropPosition(e.childRecords,i)}})},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(De,this.Rowdraging),this.parent.off(Me,this.rowDropped),this.parent.off(Se,this.rowsAdded),this.parent.off(Ie,this.rowsRemoved))},e.prototype.getModuleName=function(){return"rowDragAndDrop"},e}(),gt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ft=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},yt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return gt(i,e),ft([t.Property()],i.prototype,"targetID",void 0),i}(t.ChildProperty),mt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),vt=function(e){function i(t){var i=e.call(this,t)||this;return i.addEventListener(),i}return mt(i,e),i.prototype.addEventListener=function(){this.parent.on(ve,this.getDatas,this)},i.prototype.getDatas=function(e){this.visualData=e.data},i.prototype.getDataInfo=function(){return e.prototype.getData.call(this)},i.prototype.generateRows=function(i,r){!t.isNullOrUndefined(r.virtualInfo)&&r.virtualInfo.loadNext&&r.virtualInfo.nextInfo.page!==this.parent.pageSettings.currentPage?this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.nextInfo.page}},!0):t.isNullOrUndefined(r.virtualInfo)||r.virtualInfo.loadNext||r.virtualInfo.page===this.parent.pageSettings.currentPage||this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.page}},!0);var o=this.getDataInfo();if(t.isNullOrUndefined(r.virtualInfo)||("right"!==r.virtualInfo.direction&&"left"!==r.virtualInfo.direction?(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))&&1!==r.virtualInfo.blockIndexes.length||(r.virtualInfo.blockIndexes=o.blockIndexes):r.virtualInfo.blockIndexes=this.getBlockIndexes(r.virtualInfo.page)),this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))return e.prototype.generateRows.call(this,i,r);t.isNullOrUndefined(r.requestType)||"collapseAll"!==r.requestType.toString()||(r.requestType="refresh");for(var a=e.prototype.generateRows.call(this,i,r),d=0;d<a.length;d++)a[d].index=this.visualData.indexOf(a[d].data);return a},i.prototype.checkAndResetCache=function(e){var t=["paging","refresh","sorting","filtering","searching","reorder","save","delete"].some(function(t){return e===t});if(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)){var i=this.model.currentPage;t?(this.cache={},this.movableCache={},this.frozenRightCache={},this.data={},this.groups={}):"virtualscroll"===e&&this.cache[i]&&this.cache[i].length>this.parent.contentModule.getBlockSize()&&delete this.cache[i]}else(t||"virtualscroll"===e)&&(this.cache={},this.data={},this.groups={},this.movableCache={},this.frozenRightCache={});return t},i}(i.VirtualRowModelGenerator),wt=function(){function e(e){i.Grid.Inject(i.Filter),this.parent=e,this.isHierarchyFilter=!1,this.filteredResult=[],this.flatFilteredData=[],this.filteredParentRecs=[],this.addEventListener()}return e.prototype.getModuleName=function(){return"filter"},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.on("updateFilterRecs",this.updatedFilteredRecord,this),this.parent.on("clearFilters",this.clearFilterLevel,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateFilterRecs",this.updatedFilteredRecord),this.parent.off("clearFilters",this.clearFilterLevel))},e.prototype.updatedFilteredRecord=function(e){t.setValue("uniqueIDFilterCollection",{},this.parent),this.flatFilteredData=e.data,this.filteredParentRecs=[],this.filteredResult=[],this.isHierarchyFilter=!1;for(var r=0;r<this.flatFilteredData.length;r++){var n=this.flatFilteredData[r];this.addParentRecord(n);var o=""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode;"Child"!==o&&"None"!==o||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key||(this.isHierarchyFilter=!0);var a=i.getObject("childRecords",n);!t.isNullOrUndefined(a)&&a.length&&t.setValue("hasFilteredChildRecords",this.checkChildExsist(n),n);var s=i.getObject("parentItem",n);if(!t.isNullOrUndefined(s)){var d=y(this.parent,n.parentItem.uniqueID,!0);t.setValue("hasFilteredChildRecords",!0,d),d&&d.parentItem&&this.updateParentFilteredRecord(d)}}this.flatFilteredData.length>0&&this.isHierarchyFilter&&this.updateFilterLevel(),this.parent.notify("updateAction",{result:this.filteredResult})},e.prototype.updateParentFilteredRecord=function(e){var i=y(this.parent,e.parentItem.uniqueID,!0),r=t.getValue("uniqueIDFilterCollection",this.parent);i&&Object.prototype.hasOwnProperty.call(r,i.uniqueID)&&t.setValue("hasFilteredChildRecords",!0,i),i&&i.parentItem&&this.updateParentFilteredRecord(i)},e.prototype.addParentRecord=function(e){var i=y(this.parent,e.parentUniqueID);if("None"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key){if(!t.isNullOrUndefined(i)){"Child"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key?this.addParentRecord(i):-1!==this.flatFilteredData.indexOf(i)&&this.addParentRecord(i)}-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))}else if(t.isNullOrUndefined(i)){if(-1!==this.flatFilteredData.indexOf(e))return void(-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent),e.hasFilteredChildRecords=!0))}else this.addParentRecord(i),-1!==this.flatFilteredData.indexOf(i)||-1!==this.filteredResult.indexOf(i)?-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent)):-1===this.filteredResult.indexOf(e)&&-1!==this.flatFilteredData.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))},e.prototype.checkChildExsist=function(e){for(var r=i.getObject("childRecords",e),n=!1,o=0;o<r.length;o++){var a=r[o].childRecords,s=""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode;if(!("Child"!==s&&"Both"!==s||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key)){var d=t.getValue("uniqueIDFilterCollection",this.parent);Object.prototype.hasOwnProperty.call(d,r[o].uniqueID)||(this.filteredResult.push(r[o]),t.setValue("uniqueIDFilterCollection."+r[o].uniqueID,r[o],this.parent),n=!0)}if("None"===s&&(0!==this.parent.grid.filterSettings.columns.length||""!==this.parent.grid.searchSettings.key)&&-1!==this.flatFilteredData.indexOf(r[o])){n=!0;break}!t.isNullOrUndefined(a)&&a.length&&(n=this.checkChildExsist(r[o])),"Child"!==s&&"Both"!==s||!r.length||(n=!0)}return n},e.prototype.updateFilterLevel=function(){for(var e=this.filteredResult,t=this.filteredResult.length,i=0;i<t;i++){var r=y(this.parent,e[i].parentUniqueID);if(-1!==e.indexOf(r)){var n=y(this.parent,e[i].parentUniqueID,!0);e[i].filterLevel=n.filterLevel+1}else e[i].filterLevel=0,this.filteredParentRecs.push(e[i])}},e.prototype.clearFilterLevel=function(e){for(var i,r=0,n=e.flatData,o=n.length;r<o;r++){var a=(i=n[r]).filterLevel;!a&&0!==a&&t.isNullOrUndefined(i.hasFilteredChildRecords)||(i.hasFilteredChildRecords=null,i.filterLevel=null)}this.filteredResult=[],this.parent.notify("updateResults",{result:n,count:n.length})},e}(),Rt=function(){function e(e){this.isCollapsedStatePersist=!1,i.Grid.Inject(i.ExcelExport),this.parent=e,this.dataResults={},this.addEventListener()}return e.prototype.getModuleName=function(){return"ExcelExport"},e.prototype.addEventListener=function(){this.parent.on("updateResults",this.updateExcelResultModel,this),this.parent.on("excelCellInfo",this.excelQueryCellInfo,this),this.parent.grid.on("export-RowDataBound",this.exportRowDataBound,this),this.parent.grid.on("finalPageSetup",this.finalPageSetup,this)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateResults",this.updateExcelResultModel),this.parent.off("excelCellInfo",this.excelQueryCellInfo),this.parent.grid.off("export-RowDataBound",this.exportRowDataBound),this.parent.grid.off("finalPageSetup",this.finalPageSetup))},e.prototype.updateExcelResultModel=function(e){this.dataResults=e},e.prototype.Map=function(e,r,o,a,s){var d=this,l=this.parent.dataSource,p=Object();return t.setValue("isCsv",s,p),t.setValue("cancel",!1,p),t.isNullOrUndefined(e)||(this.isCollapsedStatePersist=e.isCollapsedStatePersist),new Promise(function(h){var c=!d.isLocal()||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),u=new n.Query;if(d.isLocal()||(u=d.generateQuery(u),t.setValue("query",u,p)),d.parent.trigger(G,t.extend(p,e)),i.getObject("cancel",p))return null;c.executeQuery(u).then(function(i){var n=null;return t.isNullOrUndefined(e)||t.isNullOrUndefined(e.dataSource)||(n=e.dataSource),e=d.manipulateExportProperties(e,l,i),d.parent.grid.excelExportModule.Map(d.parent.grid,e,r,o,s,a).then(function(t){null!=n?e.dataSource=n:delete e.dataSource,h(t)})})})},e.prototype.generateQuery=function(e,r){return!t.isNullOrUndefined(r)&&"CurrentPage"===r.exportType&&this.parent.allowPaging&&(r.exportType="AllPages",e.addParams("ExportType","CurrentPage"),e.where(this.parent.parentIdMapping,"equal",null),e=i.getObject("grid.renderModule.data.pageQuery",this.parent)(e)),e},e.prototype.manipulateExportProperties=function(e,r,o){var a=Object();if(t.setValue("query",this.parent.grid.getDataModule().generateQuery(!0),a),t.setValue("isExport",!0,a),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.exportType)||t.setValue("exportType",e.exportType,a),this.isLocal()||(this.parent.parentData=[],this.parent.dataModule.convertToFlatData(i.getObject("result",o)),t.setValue("expresults",this.parent.flatData,a)),this.parent.notify("dataProcessor",a),a=this.dataResults,r=t.isNullOrUndefined(a.result)?this.parent.flatData.slice(0):a.result,this.isLocal()||(this.parent.flatData=[]),e&&e.dataSource&&this.isLocal()){var s=this.parent.flatData,d=e.dataSource instanceof n.DataManager?e.dataSource.dataSource.json:e.dataSource;this.parent.dataModule.convertToFlatData(d),r=this.parent.flatData,this.parent.flatData=s}return e=t.isNullOrUndefined(e)?Object():e,e.dataSource=new n.DataManager({json:r}),e},e.prototype.excelQueryCellInfo=function(e){if(this.parent.grid.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex){var i={},r=e.data,n=t.isNullOrUndefined(r.filterLevel)?r.level:r.filterLevel;i.indent=n,e.style=i}this.parent.notify("updateResults",e),this.parent.trigger("excelQueryCellInfo",e)},e.prototype.exportRowDataBound=function(e){if("excel"===e.type){var i=e.rowObj.data,r=this.parent.grid.filterSettings.columns.length,n=e.excelRows.length,o=i.level;if(i.parentItem&&y(this.parent,i.parentItem.uniqueID,Boolean(r))){var a=!1,s=!1,d=h(this.parent,i,this.parent.parentData);!this.isCollapsedStatePersist||d&&this.parent.isLocalData||(a=!0,s=!i.expanded),e.excelRows[n-1].grouping={outlineLevel:o,isCollapsed:s,isHidden:a}}else i.hasChildRecords&&t.isNullOrUndefined(i.parentItem)&&(e.excelRows[n-1].grouping={outlineLevel:o})}},e.prototype.finalPageSetup=function(e){for(var t=0;t<e.worksheets.length;t++)e.worksheets[t].rows&&(e.worksheets[t].pageSetup={isSummaryRowBelow:!1})},e.prototype.isLocal=function(){return!a(this.parent)&&u(this.parent)},e}(),Ct=function(){function e(e){i.Grid.Inject(i.PdfExport),this.parent=e,this.dataResults={},this.addEventListener()}return e.prototype.getModuleName=function(){return"PdfExport"},e.prototype.addEventListener=function(){this.parent.on("pdfCellInfo",this.pdfQueryCellInfo,this),this.parent.on("updateResults",this.updatePdfResultModel,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("pdfCellInfo",this.pdfQueryCellInfo),this.parent.off("updateResults",this.updatePdfResultModel))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.updatePdfResultModel=function(e){this.dataResults=e},e.prototype.Map=function(e,r,o,s){var d=this,l=this.parent.dataSource,p=Object(),h=!a(this.parent)&&u(this.parent);return t.setValue("cancel",!1,p),new Promise(function(a){var c=!h||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),u=new n.Query;if(h||(u=d.generateQuery(u),t.setValue("query",u,p)),d.parent.trigger(Q,t.extend(p,e)),i.getObject("cancel",p))return null;c.executeQuery(u).then(function(i){var n=null;return t.isNullOrUndefined(e)||t.isNullOrUndefined(e.dataSource)||(n=e.dataSource),e=d.manipulatePdfProperties(e,l,i),d.parent.grid.pdfExportModule.Map(d.parent.grid,e,r,o,s).then(function(t){null!=n?e.dataSource=n:delete e.dataSource,a(t)})})})},e.prototype.generateQuery=function(e,r){return!t.isNullOrUndefined(r)&&"CurrentPage"===r.exportType&&this.parent.allowPaging&&(r.exportType="AllPages",e.addParams("ExportType","CurrentPage"),e.where(this.parent.parentIdMapping,"equal",null),e=i.getObject("grid.renderModule.data.pageQuery",this.parent)(e)),e},e.prototype.manipulatePdfProperties=function(e,i,r){var o={},s=!a(this.parent)&&u(this.parent);if(t.setValue("query",this.parent.grid.getDataModule().generateQuery(!0),o),t.setValue("isExport",!0,o),t.setValue("isPdfExport",!0,o),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.isCollapsedStatePersist)||t.setValue("isCollapsedStatePersist",e.isCollapsedStatePersist,o),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.exportType)||t.setValue("exportType",e.exportType,o),s||(this.parent.parentData=[],this.parent.dataModule.convertToFlatData(t.getValue("result",r)),t.setValue("expresults",this.parent.flatData,o)),this.parent.notify("dataProcessor",o),o=this.dataResults,i=t.isNullOrUndefined(o.result)?this.parent.flatData.slice(0):o.result,s||(this.parent.flatData=[]),e&&e.dataSource&&s){var d=this.parent.flatData,l=e.dataSource instanceof n.DataManager?e.dataSource.dataSource.json:e.dataSource;this.parent.dataModule.convertToFlatData(l),i=this.parent.flatData,this.parent.flatData=d}return e=t.isNullOrUndefined(e)?{}:e,e.dataSource=new n.DataManager({json:i}),e},e.prototype.pdfQueryCellInfo=function(e){if(this.parent.grid.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex){var r={},n=i.getObject("data",e),o=t.isNullOrUndefined(n.filterLevel)?n.level:n.filterLevel;r.paragraphIndent=3*o,e.style=r}this.parent.notify("updateResults",e),this.parent.trigger("pdfQueryCellInfo",e)},e}(),xt=function(){function e(e){i.Grid.Inject(i.Page),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(J,this.collapseExpandPagedchilds,this),this.parent.on(X,this.pageAction,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(J,this.collapseExpandPagedchilds),this.parent.off(X,this.pageAction))},e.prototype.getModuleName=function(){return"pager"},e.prototype.refresh=function(){this.parent.grid.pagerModule.refresh()},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.goToPage=function(e){this.parent.grid.pagerModule.goToPage(e)},e.prototype.updateExternalMessage=function(e){this.parent.grid.pagerModule.updateExternalMessage(e)},e.prototype.collapseExpandPagedchilds=function(e){if(e.record.expanded="collapse"!==e.action,this.parent.flatData.map(function(t){return t.expanded=t.uniqueID===e.record.uniqueID&&t.expanded!==e.record.expanded?e.record.expanded:t.expanded}),this.parent.enableImmutableMode){var i=this.parent.getPrimaryKeyFieldNames()[0],r=this.parent.flatData.filter(function(t){return t[i]===e.record[i]});r.length&&(r[0].expanded=e.record.expanded)}var n={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length};if(t.getValue("grid.renderModule",this.parent).dataManagerSuccess(n),this.parent.enableImmutableMode){var o=void 0;"collapse"===n.action?(o=n.row.getElementsByClassName("e-treegridexpand")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridexpand"),t.addClass([o],"e-treegridcollapse"))):"expand"===n.action&&(o=n.row.getElementsByClassName("e-treegridcollapse")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridcollapse"),t.addClass([o],"e-treegridexpand")))}},e.prototype.pageRoot=function(e,i,r){for(var n=t.isNullOrUndefined(r)?[]:r,o=function(t){n.push(i[t]);var r=[];i[t].hasChildRecords&&(r=e.filter(function(e){return i[t].uniqueID===e.parentUniqueID}),n=a.pageRoot(e,r,n))},a=this,s=0;s<i.length;s++)o(s);return n},e.prototype.updatePageSize=function(e){var t=e.result.length,i=this.parent.grid.pagerModule;!0===this.parent.pageSettings.pageSizes&&i.pagerObj.pagerdropdownModule.dropDownListObject.value===i.pagerObj.getLocalizedLabel("All")&&(i.pagerObj.totalRecordsCount=t,this.parent.grid.pageSettings.pageSize=t)},e.prototype.pageAction=function(e){var t=this,i=new n.DataManager(e.result);if("Root"===this.parent.pageSettings.pageSizeMode){var r=[],o=this.parent.grid.filterSettings.columns.length>0&&("Child"===this.parent.filterSettings.hierarchyMode||"None"===this.parent.filterSettings.hierarchyMode)?"filterLevel":"level",a=(new n.Query).where(o,"equal",0);r=i.executeLocal(a),e.count=r.length;var s=(f=this.parent.grid.pageSettings.pageSize)*((y=this.parent.grid.pageSettings.currentPage)-1);a=a.skip(s).take(f),r=i.executeLocal(a);var d=this.pageRoot(e.result,r);e.result=d}else{var p=new n.DataManager(e.result),c=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),u=p.executeLocal((new n.Query).where(c)),g=void 0;g=!l(this.parent)||this.parent.searchSettings.key===this.parent.grid.searchSettings.key&&this.parent.filterSettings.columns.length===this.parent.grid.filterSettings.columns.length?u.filter(function(e){return h(t.parent,e,u)}):u,e.count=g.length;a=new n.Query;var f=this.parent.grid.pageSettings.pageSize;this.updatePageSize(e);var y=this.parent.grid.pageSettings.currentPage;g.length<y*f&&(y=(y=Math.floor(g.length/f)+(g.length%f?1:0))||1,this.parent.grid.setProperties({pageSettings:{currentPage:y}},!0));s=f*(y-1);a=a.skip(s).take(f),p.dataSource.json=g,e.result=p.executeLocal(a)}this.parent.notify("updateAction",e)},e}(),bt=function(){function e(e){i.Grid.Inject(i.Toolbar),this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"toolbar"},e.prototype.addEventListener=function(){this.parent.on(z,this.refreshToolbar,this),this.parent.on(_,this.refreshToolbar,this),this.parent.on(H,this.toolbarClickHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(z,this.refreshToolbar),this.parent.off(_,this.refreshToolbar),this.parent.off(H,this.toolbarClickHandler))},e.prototype.refreshToolbar=function(e){var i=this.parent.grid.toolbarModule.getToolbar();if(!t.isNullOrUndefined(i)){var r=this.parent,n=void 0,o=void 0,a=r.element.id+"_gridcontrol_indent",s=r.element.id+"_gridcontrol_outdent",d=i.querySelector("#"+a),l=i.querySelector("#"+s),p=e.row,h=r.getSelectedRows()[0];if(t.isNullOrUndefined(p[0])||(p=p[0]),p=t.isNullOrUndefined(h)||h.rowIndex===p.rowIndex?p:h,null!==d&&null!==l){if(n=i.querySelector("#"+a).parentElement,o=i.querySelector("#"+s).parentElement,0===p.rowIndex||r.getSelectedRowIndexes().length>1)n.classList.add("e-hidden"),o.classList.add("e-hidden");else if("rowDeselected"!==e.name||!t.isNullOrUndefined(h)&&r.grid.isCheckBoxSelection){var c=r.getCurrentViewRecords()[p.rowIndex];t.isNullOrUndefined(c)||(c.level>r.getCurrentViewRecords()[p.rowIndex-1].level?n.classList.add("e-hidden"):n.classList.remove("e-hidden"),c.level===r.getCurrentViewRecords()[p.rowIndex-1].level&&n.classList.remove("e-hidden"),0===c.level&&o.classList.add("e-hidden"),0!==c.level&&o.classList.remove("e-hidden"))}"rowDeselected"===e.name&&t.isNullOrUndefined(h)&&!r.grid.isCheckBoxSelection&&(this.parent.toolbar.includes("Indent")&&n.classList.add("e-hidden"),this.parent.toolbar.includes("Outdent")&&o.classList.add("e-hidden"))}}},e.prototype.toolbarClickHandler=function(e){var i=this.parent,r="indentOutdentAction";"Cell"===this.parent.editSettings.mode&&"Batch"===this.parent.grid.editSettings.mode&&e.item.id===this.parent.grid.element.id+"_update"&&(e.cancel=!0,this.parent.grid.editModule.saveCell()),e.item.id===this.parent.grid.element.id+"_expandall"&&this.parent.expandAll(),e.item.id===this.parent.grid.element.id+"_collapseall"&&this.parent.collapseAll(),e.item.id===i.grid.element.id+"_indent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[r](null,"indent"),e.item.id===i.grid.element.id+"_outdent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[r](null,"outdent")},e.prototype.getToolbar=function(){return this.parent.grid.toolbarModule.getToolbar()},e.prototype.enableItems=function(e,t){this.parent.grid.toolbarModule.enableItems(e,t)},e.prototype.destroy=function(){this.removeEventListener()},e}(),St=function(){function e(e){i.Grid.Inject(i.Aggregate),this.parent=e,this.flatChildRecords=[],this.summaryQuery=[]}return e.prototype.getModuleName=function(){return"summary"},e.prototype.removeEventListener=function(){this.parent.isDestroyed},e.prototype.calculateSummaryValue=function(e,r,n){this.summaryQuery=e;for(var o,a=[],s=0,d=Object.keys(r).length;s<d;s++){i.getObject("isSummaryRow",r[s])||a.push(r[s])}var l,h=p(a),c=a.slice(),u=Object.keys(this.parent.aggregates).length,g=Object.keys(h).length,f=this.parent.getColumns();if(this.parent.aggregates.filter(function(e){return e.showChildSummary}).length){var y=0;for(d=g;y<d;y++)if(o=h[y],l=this.getChildRecordsLength(o,c)){for(var m=function(e,r){var a=void 0;a={};for(var s=0;s<f.length;s++){a[t.isNullOrUndefined(i.getObject("field",f[s]))?f[s]:i.getObject("field",f[s])]=null}if(a=v.createSummaryItem(a,v.parent.aggregates[e-1]),!v.parent.aggregates[e-1].showChildSummary)return"continue";var d;c.map(function(e,t){e.uniqueID!==o.uniqueID||(d=t)});var p=d+l+e,h=t.extend({},o);delete h.childRecords,delete h[v.parent.childMapping],t.setValue("parentItem",h,a);var u=i.getObject("level",h);if(t.setValue("level",u+1,a),t.setValue("isSummaryRow",!0,a),t.setValue("parentUniqueID",h.uniqueID,a),n){var g=i.getObject("childRecords",o);g.length&&g.push(a)}c.splice(p,0,a)},v=this,w=1,R=u;w<=R;w++)m(w);this.flatChildRecords=[]}}else{for(var C={},x=0,b=f.length;x<b;x++){C[t.isNullOrUndefined(i.getObject("field",f[x]))?f[x]:i.getObject("field",f[x])]=null}w=1;for(var S=u;w<=S;w++)this.createSummaryItem(C,this.parent.aggregates[w-1])}return c},e.prototype.getChildRecordsLength=function(e,r){for(var n,o=0,a=Object.keys(r).length;o<a;o++){n=r[o];if(e===(t.isNullOrUndefined(n.parentItem)?null:r.filter(function(e){return e.uniqueID===n.parentItem.uniqueID})[0])){this.flatChildRecords.push(n);if(!i.getObject("hasChildRecords",n))continue;this.getChildRecordsLength(n,r)}}return this.flatChildRecords.length},e.prototype.createSummaryItem=function(e,i){for(var r=0,o=Object.keys(i.columns).length;r<o;r++)for(var a=t.isNullOrUndefined(i.columns[r].columnName)?i.columns[r].field:i.columns[r].columnName,s=0,d=Object.keys(e);s<d.length;s++){var l=d[s];if(l===a)if(this.flatChildRecords.length)e[l]=this.getSummaryValues(i.columns[r],this.flatChildRecords);else if(this.parent.isLocalData){var p=this.parent.dataSource instanceof n.DataManager?this.parent.dataSource.dataSource.json:this.parent.flatData;e[l]=this.getSummaryValues(i.columns[r],p)}}return e},e.prototype.getSummaryValues=function(e,r){var o=new n.Query,a={},s={},d=t.isNullOrUndefined(e.field)?void 0:this.parent.getColumnByField(e.field).type;e.setPropertiesSilent({format:this.getFormatFromType(e.format,d)}),e.setFormatter(this.parent.grid.locale);var l=e.getFormatter()||function(e){return e};e.setTemplate(s);var p=e.getTemplate(2);o.queries=this.summaryQuery,o.requiresCount();var h,c=new n.DataManager(r).executeLocal(o),u=e.type;u=[e.type];for(var g=0;g<u.length;g++){h=u[g];var f=e.field+" - "+u[g].toLowerCase(),y="Custom"!==u[g]?i.getObject("aggregates",c):i.calculateAggregate(u[g],c,e,this.parent),m=e.columnName,v="Custom"!==u[g]?y[f]:y;a[m]=a[m]||{},a[m][f]=v,a[m][u[g]]=t.isNullOrUndefined(y)?" ":l(v)}s.format=e.getFormatter();var w=t.createElement("td",{className:"e-summary"});if(this.parent.isReact){p.fn(a[e.columnName],this.parent,p.property,"",null,null,w),this.parent.renderReactTemplates()}else i.appendChildren(w,p.fn(a[e.columnName],this.parent,p.property));var R=a[e.columnName][h];return-1===w.innerHTML.indexOf(R)?w.innerHTML+R:w.innerHTML},e.prototype.getFormatFromType=function(e,i){if(t.isNullOrUndefined(i)||"string"!=typeof e)return e;var r;switch(i){case"number":r={format:e};break;case"datetime":r={type:"dateTime",skeleton:e};break;case"date":r={type:i,skeleton:e}}return r},e.prototype.destroy=function(){this.removeEventListener()},e}(),It=function(){function e(e){i.Grid.Inject(i.Sort),this.parent=e,this.taskIds=[],this.flatSortedData=[],this.storedIndex=-1,this.isSelfReference=!t.isNullOrUndefined(this.parent.parentIdMapping),this.addEventListener()}return e.prototype.getModuleName=function(){return"sort"},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this),this.parent.on("createSort",this.createdSortedRecords,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateModel",this.updateModel),this.parent.off("createSort",this.createdSortedRecords))},e.prototype.createdSortedRecords=function(e){var t=e.modifiedData,i=e.srtQry;this.iterateSort(t,i),this.storedIndex=-1,e.modifiedData=this.flatSortedData,this.flatSortedData=[]},e.prototype.iterateSort=function(e,i){for(var r=0;r<e.length;r++)if(this.parent.grid.filterSettings.columns.length>0||""!==this.parent.grid.searchSettings.key?t.isNullOrUndefined(y(this.parent,e[r].uniqueID,!0))||(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[r]):(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[r]),e[r].hasChildRecords){var o=new n.DataManager(e[r].childRecords).executeLocal(i);if(this.parent.allowRowDragAndDrop&&-1!==e[r].childRecords.indexOf(this.parent.rowDragAndDropModule.draggedRecord)&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var a=o.indexOf(this.parent.rowDragAndDropModule.draggedRecord);o.splice(a,1);var s=o.indexOf(this.parent.rowDragAndDropModule.droppedRecord);"topSegment"===this.parent.rowDragAndDropModule.dropPosition?o.splice(s,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&o.splice(s+1,0,this.parent.rowDragAndDropModule.draggedRecord)}this.iterateSort(o,i)}},e.prototype.sortColumn=function(e,t,i){this.parent.grid.sortColumn(e,t,i)},e.prototype.removeSortColumn=function(e){this.parent.grid.removeSortColumn(e)},e.prototype.updateModel=function(){this.parent.setProperties({sortSettings:i.getActualProperties(this.parent.grid.sortSettings)},!0)},e.prototype.clearSorting=function(){this.parent.grid.clearSorting(),this.updateModel()},e.prototype.destroy=function(){this.removeEventListener()},e}(),Dt=function(){function e(e){i.Grid.Inject(i.ColumnMenu),this.parent=e}return e.prototype.getColumnMenu=function(){return this.parent.grid.columnMenuModule.getColumnMenu()},e.prototype.destroy=function(){},e.prototype.getModuleName=function(){return"columnMenu"},e}(),Mt=function(){function e(e){i.Grid.Inject(i.ContextMenu),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("contextMenuOpen",this.contextMenuOpen,this),this.parent.on("contextMenuClick",this.contextMenuClick,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("contextMenuOpen",this.contextMenuOpen),this.parent.off("contextMenuClick",this.contextMenuClick))},e.prototype.contextMenuOpen=function(e){var i=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_AddRow",e.element),r=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_Edit",e.element),n=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_Indent",e.element),o=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_Outdent",e.element);i&&(!1===this.parent.grid.editSettings.allowAdding||this.parent.grid.isEdit?i.style.display="none":i.style.display="block"),"Cell"!==this.parent.editSettings.mode&&"Batch"!==this.parent.editSettings.mode||t.isNullOrUndefined(r)||r.classList.contains("e-menu-hide")||(r.style.display="none");var a=this.parent,s=a.getSelectedRows()[0];if(!n&&!o||t.isNullOrUndefined(s))a.grid.isEdit&&t.isNullOrUndefined(s)&&(n.style.display="none",o.style.display="none");else{var d=e.event.target.closest("td");if(t.isNullOrUndefined(d)||!t.isNullOrUndefined(d)&&!d.classList.contains("e-rowcell"))n.style.display=o.style.display="none";else if(0===s.rowIndex||a.getSelectedRowIndexes().length>1)n.style.display=o.style.display="none";else if("rowDeselected"!==e.name||!t.isNullOrUndefined(s)&&a.grid.isCheckBoxSelection){var l=a.getCurrentViewRecords()[s.rowIndex];t.isNullOrUndefined(l)||(l.level>a.getCurrentViewRecords()[s.rowIndex-1].level||"Batch"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode?n.style.display="none":n.style.display="block",l.level===a.getCurrentViewRecords()[s.rowIndex-1].level&&"Batch"!==this.parent.editSettings.mode&&"Cell"!==this.parent.editSettings.mode&&(n.style.display="block"),0===l.level||"Batch"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode?o.style.display="none":o.style.display="block")}}},e.prototype.contextMenuClick=function(e){if("Above"!==e.item.id&&"Below"!==e.item.id&&"Child"!==e.item.id||(this.parent.notify("savePreviousRowPosition",e),this.parent.setProperties({editSettings:{newRowPosition:e.item.id}},!0),this.parent.editModule.isAddedRowByContextMenu=!0,this.parent.addRecord()),(e.item.id===this.parent.element.id+"_gridcontrol_cmenu_Indent"||e.item.id===this.parent.element.id+"_gridcontrol_cmenu_Outdent")&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule)){var i=e.item.id===this.parent.element.id+"_gridcontrol_cmenu_Indent"?"indent":"outdent";this.parent.rowDragAndDropModule.indentOutdentAction(null,i)}},e.prototype.getModuleName=function(){return"contextMenu"},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getContextMenu=function(){return this.parent.grid.contextMenuModule.getContextMenu()},e}(),Ot=function(){function e(e){this.batchChildCount=0,this.addedRecords="addedRecords",this.deletedRecords="deletedRecords",this.batchAddedRecords=[],this.batchDeletedRecords=[],this.batchAddRowRecord=[],this.parent=e,this.isSelfReference=!t.isNullOrUndefined(e.parentIdMapping),this.batchRecords=[],this.currentViewRecords=[],this.isAdd=!1,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(ae,this.cellSaved,this),this.parent.on(pe,this.batchAdd,this),this.parent.on(ce,this.beforeBatchAdd,this),this.parent.on(ge,this.batchSave,this),this.parent.on(he,this.beforeBatchDelete,this),this.parent.on(ue,this.beforeBatchSave,this),this.parent.on("batchPageAction",this.batchPageAction,this),this.parent.on("batchCancelAction",this.batchCancelAction,this),this.parent.grid.on("immutable-batch-cancel",this.immutableBatchAction,this),this.parent.grid.on("next-cell-index",this.nextCellIndex,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ae,this.cellSaved),this.parent.off(pe,this.batchAdd),this.parent.off(ge,this.batchSave),this.parent.off(ce,this.beforeBatchAdd),this.parent.off(he,this.beforeBatchDelete),this.parent.off(ue,this.beforeBatchSave),this.parent.off("batchPageAction",this.batchPageAction),this.parent.off("batchCancelAction",this.batchCancelAction),this.parent.grid.off("immutable-batch-cancel",this.immutableBatchAction),this.parent.grid.off("next-cell-index",this.nextCellIndex))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getBatchRecords=function(){return this.batchRecords},e.prototype.getAddRowIndex=function(){return this.addRowIndex},e.prototype.getSelectedIndex=function(){return this.selectedIndex},e.prototype.getBatchChildCount=function(){return this.batchChildCount},e.prototype.batchPageAction=function(){var e,i=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,r=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords)&&this.batchAddedRecords.length)for(var o=0;o<this.batchAddedRecords.length;o++)e=i.map(function(e){return e[r]}).indexOf(this.batchAddedRecords[o][r]),i.splice(e,1);this.batchAddedRecords=this.batchRecords=this.batchAddRowRecord=this.batchDeletedRecords=this.currentViewRecords=[]},e.prototype.cellSaved=function(e){var r=e.cell.cellIndex,o=this.parent.frozenColumns||this.parent.getFrozenColumns();o&&e.columnObject.index>o&&(r+=o);if(this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0){this.parent.getFrozenLeftColumnsCount()+r===this.parent.treeColumnIndex&&this.parent.renderModule.cellRender({data:e.rowData,cell:e.cell,column:this.parent.grid.getColumnByIndex(e.cell.cellIndex)})}else r===this.parent.treeColumnIndex&&this.parent.renderModule.cellRender({data:e.rowData,cell:e.cell,column:this.parent.grid.getColumnByIndex(e.cell.cellIndex)});if(this.isAdd&&"Batch"===this.parent.editSettings.mode&&"Bottom"!==this.parent.editSettings.newRowPosition){var a=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,s=void 0,d=this.parent.grid.getPrimaryKeyFieldNames()[0],l=void 0,p=void 0,h="parentItem",u=this.selectedIndex>-1?this.batchRecords[this.addRowIndex][h]:null,f=void 0,y=void 0,m=void 0,v="Top"===this.parent.editSettings.newRowPosition||-1===this.selectedIndex?0:"Above"===this.parent.editSettings.newRowPosition?this.addRowIndex:this.addRowIndex+1;if(v=this.getActualRowObjectIndex(v),this.newBatchRowAdded){if(this.batchRecords.length&&(f=this.batchRecords[this.addRowIndex][this.parent.idMapping],m=this.batchRecords[this.addRowIndex][this.parent.parentIdMapping],this.batchRecords[this.addRowIndex][h]&&(y=this.batchRecords[this.addRowIndex][h].uniqueID)),this.batchAddedRecords=g(this.batchAddedRecords),this.batchAddRowRecord=g(this.batchAddRowRecord),this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]),s=this.parent.grid.getRowsObject()[v].changes,s.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+s.uniqueID,s,this.parent),!Object.prototype.hasOwnProperty.call(s,"level")){if(this.batchIndex=-1===this.selectedIndex?0:this.batchIndex,"Child"===this.parent.editSettings.newRowPosition){if(s.primaryParent=u,this.selectedIndex>-1){s.parentItem=t.extend({},this.batchRecords[this.addRowIndex]),s.parentUniqueID=s.parentItem.uniqueID,delete s.parentItem.childRecords,delete s.parentItem[this.parent.childMapping],s.level=s.parentItem.level+1,s.index=this.batchIndex;var w=c(this.batchRecords[this.addRowIndex]).length,C=c(this.batchRecords[this.addRowIndex])[w-1];C=t.isNullOrUndefined(C)?this.batchRecords[this.addRowIndex]:C,l=a.map(function(e){return e[d]}).indexOf(C[d]),this.isSelfReference&&(s[this.parent.parentIdMapping]=f),R(d,s.parentItem,"add",this.parent,this.isSelfReference,s)}}else if(("Above"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)&&!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])){if(s.level=this.batchRecords[this.addRowIndex].level,s.level&&this.selectedIndex>-1&&(s.parentItem=u,s.parentUniqueID=y,delete s.parentItem.childRecords,delete s.parentItem[this.parent.childMapping]),s.index="Below"===this.parent.editSettings.newRowPosition?this.batchIndex:this.batchIndex-1,"Below"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){w=c(this.batchRecords[this.addRowIndex]).length,C=c(this.batchRecords[this.addRowIndex])[w-1];C=t.isNullOrUndefined(C)?this.batchRecords[this.addRowIndex]:C,l=a.map(function(e){return e[d]}).indexOf(C[d])}if("Above"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){C=this.batchRecords[this.addRowIndex];l=a.map(function(e){return e[d]}).indexOf(C[d])}this.isSelfReference&&(s[this.parent.parentIdMapping]=m)}s.index=-1===s.index?0:s.index,s.hasChildRecords=!1,s.childRecords=[],this.batchRecords.splice(s.index,0,s),this.currentViewRecords.splice(s.index,0,s),p=l||s.index,"Above"!==this.parent.editSettings.newRowPosition&&(p=0===s.index?p:p+1),a.splice(p,0,s),this.batchAddedRecords.push(s)}this.parent.grid.getRowsObject()[v].data=s,this.newBatchRowAdded=!1}(this.parent.frozenColumns||this.parent.getFrozenColumns()&&"add"===this.parent.grid.getRowsObject()[v].edit)&&t.merge(this.currentViewRecords[v],this.parent.grid.getRowsObject()[v].changes)}},e.prototype.beforeBatchAdd=function(e){if("Cell"===this.parent.editSettings.mode&&this.parent.editModule.isTabLastRow)return e.cancel=!0,void(this.parent.editModule.isTabLastRow=!1);!this.parent.editModule.isAddedRowByMethod||t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.parent.editModule.isAddedRowByContextMenu||-1!==this.parent.grid.selectedRowIndex&&!this.parent.editModule.batchEditModule.isAdd?(this.selectedIndex=this.parent.grid.selectedRowIndex,this.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0,this.parent.editModule.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0,this.addRowRecord=this.parent.getSelectedRecords()[0]):(this.selectedIndex=this.parent.editModule.selectedIndex,this.addRowIndex=this.parent.editModule.addRowIndex,this.addRowRecord=this.batchRecords.length?this.batchRecords[this.selectedIndex]:this.parent.getCurrentViewRecords()[this.selectedIndex])},e.prototype.batchAdd=function(e){if("Bottom"!==this.parent.editSettings.newRowPosition){this.isAdd=!0,this.newBatchRowAdded=!0;var i=0;if(this.batchRecords.length||(this.batchAddedRecords=[],this.batchRecords=g(this.parent.grid.getCurrentViewRecords()),this.currentViewRecords=g(this.parent.grid.getCurrentViewRecords())),this.parent.editModule.isAddedRowByMethod&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&t.classList(this.parent.grid.getDataRows()[0],["e-batchrow"],[]),"Top"!==this.parent.editSettings.newRowPosition){var r=this.parent.grid.getCurrentViewRecords();"Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)&&(r=this.batchRecords),this.updateChildCount(r),this.parent.notify(re,{}),this.batchChildCount=0}this.updateRowIndex();var n=t.getValue("focusModule",this.parent.grid),o=this.parent.getContentTable();if(this.parent.getBatchChanges()[this.deletedRecords].length&&"Above"===this.parent.editSettings.newRowPosition?(i=e.row.rowIndex,n.getContent().matrix.matrix=this.matrix):i=o.getElementsByClassName("e-batchrow")[0].rowIndex,n.getContent().matrix.current=[i,n.getContent().matrix.current[1]],this.parent.editModule.isAddedRowByMethod&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){var a=this.parent.getBatchChanges().addedRecords,s=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[a.length-1].getAttribute("data-rowindex"),10);this.batchRecords.splice(s,0,a[a.length-1])}}},e.prototype.beforeBatchDelete=function(e){this.batchRecords.length||(this.batchRecords=g(this.parent.grid.getCurrentViewRecords()),this.currentViewRecords=g(this.parent.grid.getCurrentViewRecords()));var i=t.getValue("focusModule",this.parent.grid);this.matrix=i.getContent().matrix.matrix;var r,n,o,a=[],s=[],d=this.parent.grid.getPrimaryKeyFieldNames()[0];t.isNullOrUndefined(e.row)||-1!==this.parent.getSelectedRows().indexOf(e.row)?(n=c(r=this.parent.grid.getSelectedRecords()[this.parent.grid.getSelectedRecords().length-1]),o=this.parent.getSelectedRows()[0].getAttribute("data-uid")):(n=c(r=e.rowData),o=e.row.getAttribute("data-uid"));var l=parseInt(this.parent.grid.getRowElementByUID(o).getAttribute("data-rowindex"),10);if(n.length)for(var p=l+n.length,h=l+1;h<=p;h++)a.push(this.parent.grid.getDataRows()[h]),(this.parent.frozenRows||this.parent.frozenColumns||this.parent.getFrozenColumns())&&a.push(this.parent.grid.getMovableRows()[h]);if(!t.isNullOrUndefined(r.parentItem)){var u=y(this.parent,r.parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var f=u.childRecords.indexOf(r);u.childRecords.splice(f,1)}this.batchDeletedRecords=g(this.batchDeletedRecords),this.batchDeletedRecords.push(r)}n.push(r),s=n;for(h=0;h<s.length;h++){var m=this.batchRecords.map(function(e){return e[d]}).indexOf(s[h][d]);-1!==m&&this.batchRecords.splice(m,1)}for(h=0;h<a.length;h++)t.isNullOrUndefined(a[h])||this.parent.grid.selectionModule.selectedRecords.push(a[h])},e.prototype.updateRowIndex=function(){for(var e=this.parent.grid.getDataRows(),t=0;t<e.length;t++)e[t].setAttribute("data-rowindex",t.toString());var i=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;if(this.parent.frozenRows||this.parent.getFrozenColumns()||this.parent.frozenColumns||i){var r=this.parent.grid.getMovableDataRows(),n=this.parent.grid.getFrozenRightDataRows();for(t=0;t<r.length;t++)r[t].setAttribute("data-rowindex",t.toString()),i&&n[t].setAttribute("data-rowindex",t.toString())}},e.prototype.updateChildCount=function(e){for(var i=this.parent.grid.getPrimaryKeyFieldNames()[0],r="addedRecords",n="Child"===this.parent.editSettings.newRowPosition?"primaryParent":"parentItem",o=0;o<this.parent.getBatchChanges()[r].length;o++)t.isNullOrUndefined(this.parent.getBatchChanges()[r][o][n])||this.parent.getBatchChanges()[r][o][n][i]===e[this.addRowIndex][i]&&(this.batchChildCount=this.batchChildCount+1)},e.prototype.beforeBatchSave=function(e){var t="deletedRecords",i=e.batchChanges.changedRecords;if(e.batchChanges.changedRecords.length)for(var r=0;r<i.length;r++)v({value:i[r],action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,void 0);if(e.batchChanges[t].length){var n=e.batchChanges[t];for(r=0;r<n.length;r++){this.deleteUniqueID(n[r].uniqueID);for(var o=c(n[r]),a=0;a<o.length;a++)this.deleteUniqueID(o[a].uniqueID);e.batchChanges[t]=e.batchChanges[t].concat(o)}}this.isAdd=!1},e.prototype.deleteUniqueID=function(e){delete this.parent.uniqueIDFilterCollection[e];delete this.parent.uniqueIDCollection[e]},e.prototype.batchCancelAction=function(){var e,i="targetElement",r="parentItem",o=this.parent.grid.getCurrentViewRecords(),a="childRecords",s=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,d=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords))for(var l=0;l<this.batchAddedRecords.length;l++)if(-1!==(e=s.map(function(e){return e[d]}).indexOf(this.batchAddedRecords[l][d]))&&s.splice(e,1),"Child"===this.parent.editSettings.newRowPosition&&(e=o.map(function(e){return e[d]}).indexOf(this.batchAddedRecords[l][r]?this.batchAddedRecords[l][r][d]:this.batchAddedRecords[l][d]),!t.isNullOrUndefined(o[e])))for(var p=o[e][a],h=0;p&&h<p.length;h++)p[h][d]===this.batchAddedRecords[l][d]&&o[e][a].splice(h,1);if(!t.isNullOrUndefined(this.parent[i])){var c=this.parent[i].closest("tr");this.parent.collapseRow(c),this.parent[i]=null}if(!t.isNullOrUndefined(this.batchDeletedRecords))for(l=0;l<this.batchDeletedRecords.length;l++)if(!t.isNullOrUndefined(this.batchDeletedRecords[l][r])){e=o.map(function(e){return e[d]}).indexOf(this.batchDeletedRecords[l][r][d]);var u=0===this.batchDeletedRecords[l].index?this.batchDeletedRecords[l].index:this.batchDeletedRecords[l].index-1;t.isNullOrUndefined(o[e])||o[e][a].splice(u,0,this.batchDeletedRecords[l])}this.batchAddedRecords=this.batchRecords=this.batchAddRowRecord=this.currentViewRecords=[],this.batchRecords=g(this.parent.grid.getCurrentViewRecords()),this.batchIndex=0,this.currentViewRecords=g(this.parent.grid.getCurrentViewRecords()),this.batchDeletedRecords=[],this.parent.grid.renderModule.refresh()},e.prototype.batchSave=function(e){if("Batch"===this.parent.editSettings.mode){var i=void 0,r=Object.hasOwnProperty.call(e,"updatedRecords")?e.updatedRecords:this.parent.getBatchChanges(),o="deletedRecords",a=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,s=this.parent.grid.getCurrentViewRecords(),d=this.parent.grid.getPrimaryKeyFieldNames()[0],l=r.addedRecords,p=void 0,h=void 0,c=void 0;if(l.length>1&&"Bottom"!==this.parent.editSettings.newRowPosition&&l.reverse(),"Bottom"!==this.parent.editSettings.newRowPosition&&!Object.hasOwnProperty.call(e,"updatedRecords")){if(a.splice(a.length-l.length,l.length),this.parent.editModule.isAddedRowByMethod&&l.length&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){l.reverse();for(var u=0;u<l.length;u++){var f=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[u].getAttribute("data-rowindex"),10);a.splice(f,0,l[u])}}if(this.parent.allowPaging||a.length===s.length){var y=g(a);if(y.length){var m=y.map(function(e){return e[d]}).indexOf(s[0][d]),w=m+this.parent.grid.pageSettings.pageSize;s=y.splice(m,w)}}else s.length>l.length&&s.splice(s.length-l.length,l.length)}for(0===this.batchAddRowRecord.length&&this.batchAddRowRecord.push(this.parent.flatData[e.index]),this.parent.editModule.isAddedRowByContextMenu&&l.reverse(),i=0;i<l.length;i++){var C=t.extend({},l[i]);if(delete C.parentItem,delete C.uniqueID,delete C.index,delete C.level,delete C.hasChildRecords,delete C.childRecords,delete C.parentUniqueID,t.isNullOrUndefined(C.primaryParent)||delete C.primaryParent,l.length>1&&this.parent.editModule.isAddedRowByContextMenu){var x=this.parent.editSettings.newRowPosition;this.parent.editSettings.newRowPosition=this.parent.editModule.previousNewRowPosition,this.parent.editModule.previousNewRowPosition=x}if(l[i].taskData=C,c=this.batchAddRowRecord[i],t.isNullOrUndefined(c)&&(c=this.batchAddRowRecord[i-1]),this.isSelfReference&&(t.isNullOrUndefined(l[i].parentItem)||R(d,l[i].parentItem,"add",this.parent,this.isSelfReference,l[i])),t.isNullOrUndefined(c)||(h=c.index),"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(l[i].parentItem)&&-1===this.selectedIndex&&(p=-1,c=null),v({value:l[i],action:"add"},this.parent,this.isSelfReference,h,p,void 0,c),p=null,"Child"===this.parent.editSettings.newRowPosition&&!t.isNullOrUndefined(l[i].parentItem)&&(t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.isSelfReference))for(var b=s.map(function(e){return e[d]}).indexOf(l[i].parentItem[d]),S=s[b].childRecords,I=0;I<S.length;I++)S[I][d]===l[i][d]&&s[b].childRecords.splice(I,1)}if(r[o].length)for(i=0;i<r[o].length;i++)v({value:r[o][i],action:"delete"},this.parent,this.isSelfReference,h,p,void 0,c);this.parent.parentData=[];for(var D=0;D<a.length;D++)a[D].index=D,t.setValue("uniqueIDCollection."+a[D].uniqueID+".index",D,this.parent),a[D].level||this.parent.parentData.push(a[D])}this.batchAddRowRecord=this.batchAddedRecords=this.batchRecords=this.batchDeletedRecords=this.currentViewRecords=[],this.parent.editModule.isAddedRowByContextMenu&&(this.parent.editModule.isAddedRowByContextMenu=!1)},e.prototype.getActualRowObjectIndex=function(e){var i=this.parent.grid.getDataRows();if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&this.selectedIndex>-1){if(!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])&&this.batchRecords[this.addRowIndex].expanded)if(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length){if(e+=c(this.batchRecords[this.addRowIndex]).length,"Child"!==this.parent.editSettings.newRowPosition){e+=this.getBatchChildCount()}}else e+=c(this.batchRecords[this.addRowIndex]).length;e>=i.length&&(e=i.length-1),this.updateChildCount(this.parent.grid.getCurrentViewRecords()),this.batchChildCount&&(e+=this.batchChildCount),this.batchChildCount=0}return e},e.prototype.immutableBatchAction=function(e){e.args.cancel=!0;var t=this.parent.grid.getBatchChanges(),i=[];Object.keys(t).length&&(i=t.addedRecords);for(var r=0;r<i.length;r++)e.rows.splice(i[r].index,1)},e.prototype.nextCellIndex=function(e){this.parent.getSelectedRows().length?e.index=this.parent.getSelectedRows()[0].rowIndex:e.index=this.batchIndex},e}(),Pt=function(){function e(e){this.addedRecords="addedRecords",this.deletedRecords="deletedRecords",this.prevAriaRowIndex="-1",this.isAddedRowByMethod=!1,this.isAddedRowByContextMenu=!1,i.Grid.Inject(i.Edit),this.parent=e,this.isSelfReference=!t.isNullOrUndefined(e.parentIdMapping),this.previousNewRowPosition=null,this.internalProperties={},this.batchEditModule=new Ot(this.parent),this.addEventListener()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.addEventListener=function(){this.parent.on(te,this.crudAction,this),this.parent.on(ie,this.beginEdit,this),this.parent.on(re,this.beginAdd,this),this.parent.on(ne,this.recordDoubleClick,this),this.parent.on(oe,this.cellSave,this),this.parent.on(le,this.batchCancel,this),this.parent.grid.on(fe,this.keyPressed,this),this.parent.grid.on("batchedit-form",this.lastCellTab,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on(se,this.cellEdit,this),this.parent.on("actionBegin",this.editActionEvents,this),this.parent.on("actionComplete",this.editActionEvents,this),this.parent.grid.on(ye,this.recordDoubleClick,this),this.parent.grid.on("dblclick",this.gridDblClick,this),this.parent.grid.on("recordAdded",this.customCellSave,this),this.parent.on("savePreviousRowPosition",this.savePreviousRowPosition,this),this.parent.grid.on(Re,this.beforeStartEdit,this),this.parent.grid.on(Ce,this.beforeBatchCancel,this),this.parent.grid.on("reset-edit-props",this.resetIsOnBatch,this),this.parent.grid.on("get-row-position",this.getRowPosition,this)},e.prototype.gridDblClick=function(e){this.doubleClickTarget=e.target},e.prototype.getRowPosition=function(e){e.newRowPosition=this.parent.editSettings.newRowPosition,e.addRowIndex=this.addRowIndex,e.dataRowIndex=+this.prevAriaRowIndex},e.prototype.beforeStartEdit=function(e){this.parent.trigger(T,e)},e.prototype.beforeBatchCancel=function(e){"Cell"===this.parent.editSettings.mode&&this.parent.trigger(F,e)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(te,this.crudAction),this.parent.off(ie,this.beginEdit),this.parent.off(re,this.beginAdd),this.parent.off(ne,this.recordDoubleClick),this.parent.off(le,this.batchCancel),this.parent.grid.off(fe,this.keyPressed),this.parent.grid.off("batchedit-form",this.lastCellTab),this.parent.grid.off("content-ready",this.contentready),this.parent.off(se,this.cellEdit),this.parent.off("actionBegin",this.editActionEvents),this.parent.off("actionComplete",this.editActionEvents),this.parent.grid.off("recordAdded",this.customCellSave),this.parent.grid.off(ye,this.recordDoubleClick),this.parent.off("savePreviousRowPosition",this.savePreviousRowPosition),this.parent.grid.off(Re,this.beforeStartEdit),this.parent.grid.off(Ce,this.beforeBatchCancel),this.parent.grid.off("dblclick",this.gridDblClick),this.parent.grid.off("reset-edit-props",this.resetIsOnBatch),this.parent.grid.off("get-row-position",this.getRowPosition))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.applyFormValidation=function(e){this.parent.grid.editModule.applyFormValidation(e)},e.prototype.editActionEvents=function(e){var r=i.getObject("editAction",e),o=i.getObject("name",r),s=this.parent,d=s.dataSource.adaptor;if((a(s)||d instanceof n.RemoteSaveAdaptor)&&"save"===r.requestType&&"add"===r.action&&("Child"===s.editSettings.newRowPosition||"Below"===s.editSettings.newRowPosition||"Above"===s.editSettings.newRowPosition))if("actionBegin"===o){var l=t.isNullOrUndefined(r.row)||!Object.keys(r.row).length?this.selectedIndex:r.row.rowIndex-1,p=t.isNullOrUndefined(l)||-1===l?-1:s.getCurrentViewRecords()[l][s.getPrimaryKeyFieldNames()[0]];s.grid.query.addParams("relationalKey",p)}else if("actionComplete"===o)for(var h=s.grid.query.params.length,c=0;c<h;c++)"relationalKey"===s.grid.query.params[c].key&&s.grid.query.params.splice(c);this.parent.enableInfiniteScrolling&&"actionComplete"===o&&this.infiniteAddAction(r),"Batch"===this.parent.editSettings.mode&&"paging"===r.requestType&&this.parent.notify("batchPageAction",{})},e.prototype.infiniteAddAction=function(e){if("save"===e.requestType&&"add"===e.action||"delete"===e.requestType){if("Top"!==this.parent.editSettings.newRowPosition&&-1!==this.selectedIndex&&"save"===e.requestType&&"add"===e.action){var t=this.parent.grid.getRowsObject(),r=t.splice(0,1)[0],n=this.addRowIndex,o=this.parent.getCurrentViewRecords();"Below"!==this.parent.editSettings.newRowPosition&&"Child"!==this.parent.editSettings.newRowPosition||(n+=c(o[n+1]).length),n="Below"===this.parent.editSettings.newRowPosition?n+1:n,t.splice(n,0,r);var a=o.splice(0,1)[0];o.splice(n,0,a),this.updateInfiniteCurrentViewData(a,this.addRowIndex)}var s=this.parent.grid.getMovableRows(),d=this.parent.grid.getMovableRowsObject(),l=this.parent.infiniteScrollSettings.enableCache;l||(i.resetRowIndex(this.parent.grid,this.parent.grid.getRowsObject(),this.parent.grid.getRows(),0),this.updateIndex(this.parent.grid.dataSource,this.parent.getRows(),this.parent.getCurrentViewRecords())),!l&&this.parent.getFrozenColumns()>0&&(i.resetRowIndex(this.parent.grid,d,s,0),this.updateIndex(this.parent.grid.dataSource,s,this.parent.getCurrentViewRecords()))}},e.prototype.updateInfiniteCurrentViewData=function(e,i){var r=this,n=Math.ceil(i/this.parent.grid.pageSettings.pageSize),o=n>0?n:1,a=i-(o-1)*this.parent.pageSettings.pageSize,s=this.parent.grid.infiniteScrollModule.infiniteCurrentViewData;s[1].splice(0,1);var d=s[o];t.isNullOrUndefined(this.addRowRecord)||(d.filter(function(e,t){e.uniqueID===r.addRowRecord.uniqueID&&(a=t)}),(this.addRowRecord.hasChildRecords&&this.addRowRecord.childRecords.length&&"Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(a+=c(this.addRowRecord).length)),a>=this.parent.pageSettings.pageSize&&(d=s[o+=1],a=a-this.parent.pageSettings.pageSize>=0?a-this.parent.pageSettings.pageSize:0),a="Below"===this.parent.editSettings.newRowPosition?a+1:a,d.splice(a,0,e),this.parent.grid.infiniteScrollModule.updateCurrentViewData()},e.prototype.recordDoubleClick=function(e){var r=e.target;if(!t.isNullOrUndefined(r.closest("td.e-rowcell"))&&this.parent.grid.editSettings.allowEditing&&!this.parent.grid.isEdit){var n=this.parent.grid.getColumnByIndex(+r.closest("td.e-rowcell").getAttribute("data-colindex"));if("Cell"===this.parent.editSettings.mode&&!this.isOnBatch&&n&&!n.isPrimaryKey&&this.parent.editSettings.allowEditing&&n.allowEditing&&!r.classList.contains("e-treegridexpand")&&!r.classList.contains("e-treegridcollapse")&&this.parent.editSettings.allowEditOnDblClick){if(this.isOnBatch=!0,this.parent.grid.setProperties({selectedRowIndex:e.rowIndex},!0),this.parent.enableVirtualization){var o=i.parentsUntil(e.target,"e-row");this.prevAriaRowIndex=o.getAttribute("data-rowindex"),o.setAttribute("data-rowindex",o.rowIndex+"")}this.updateGridEditMode("Batch")}else"Cell"!==this.parent.editSettings.mode||n.allowEditing&&!n.isPrimaryKey||(this.isOnBatch=!0,this.updateGridEditMode("Batch"))}},e.prototype.updateGridEditMode=function(e){this.parent.grid.setProperties({editSettings:{mode:e}},!0);i.getObject("updateEditObj",this.parent.grid.editModule).apply(this.parent.grid.editModule),this.parent.grid.isEdit=!1},e.prototype.resetIsOnBatch=function(){this.parent.enableVirtualization&&"Cell"===this.parent.editSettings.mode&&(this.isOnBatch=!1,this.updateGridEditMode("Normal"))},e.prototype.keyPressed=function(e){this.isOnBatch&&(this.keyPress=e.action),"f2"===e.action&&this.recordDoubleClick(e),"escape"===e.action&&this.parent.closeEdit()},e.prototype.deleteUniqueID=function(e){delete this.parent.uniqueIDFilterCollection[e];delete this.parent.uniqueIDCollection[e]},e.prototype.cellEdit=function(e){var i=this,r=e.promise;if(delete e.promise,this.parent.enableVirtualization&&!t.isNullOrUndefined(this.prevAriaRowIndex)&&"-1"!==this.prevAriaRowIndex&&(e.row.setAttribute("data-rowindex",this.prevAriaRowIndex),this.prevAriaRowIndex=void 0),"enter"!==this.keyPress&&this.parent.trigger(se,e,function(e){e.cancel||"Cell"!==i.parent.editSettings.mode?e.cancel&&"Cell"===i.parent.editSettings.mode&&(i.isOnBatch=!1,i.updateGridEditMode("Normal")):i.enableToolbarItems("edit"),t.isNullOrUndefined(r)||r.resolve(e)}),this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-summarycell")))return e.cancel=!0,void(this.doubleClickTarget=null);"Cell"===this.parent.editSettings.mode&&("tab"===this.keyPress||"shiftTab"===this.keyPress?this.keyPress=null:"enter"===this.keyPress&&(e.cancel=!0,this.keyPress=null,t.setValue("isEditCollapse",!1,this.parent)),e.columnObject.allowEditing||(e.cancel=!0)),this.parent.enableVirtualization&&(this.parent.grid.contentModule.editedRowIndex=this.parent.grid.editModule.editModule.index)},e.prototype.enableToolbarItems=function(e){if(!t.isNullOrUndefined(this.parent.grid.toolbarModule)){var i=this.parent.element.id+"_gridcontrol_";this.parent.grid.toolbarModule.enableItems([i+"add",i+"edit",i+"delete"],"save"===e),this.parent.grid.toolbarModule.enableItems([i+"update",i+"cancel"],"edit"===e)}},e.prototype.batchCancel=function(){if("Cell"===this.parent.editSettings.mode){var e=t.getValue("editModule.cellDetails",this.parent.grid.editModule),i=this.parent.getCellFromIndex(e.rowIndex,this.parent.treeColumnIndex);this.parent.renderModule.cellRender({data:e.rowData,cell:i,column:this.parent.grid.getColumns()[this.parent.treeColumnIndex]}),this.updateGridEditMode("Normal"),this.isOnBatch=!1}"Batch"===this.parent.editSettings.mode&&this.parent.notify("batchCancelAction",{})},e.prototype.customCellSave=function(e){s(this.parent)&&"Cell"===this.parent.editSettings.mode&&"edit"===e.action&&(this.updateCell(e,e.rowIndex),this.afterCellSave(e,e.row,e.rowIndex))},e.prototype.cellSave=function(e){var i=this;if("Cell"===this.parent.editSettings.mode&&this.parent.element.querySelector("form")){e.cancel=!0;t.setValue("isEdit",!1,this.parent.grid),t.setValue("isEditCollapse",!0,this.parent),e.rowData[e.columnName]=e.value;var r;r=t.isNullOrUndefined(e.cell)?this.parent.grid.editModule.editModule.form.parentElement.parentNode:e.cell.parentNode;var o,d=this.parent.getPrimaryKeyFieldNames();if(t.isNullOrUndefined(r))this.parent.grid.getCurrentViewRecords().filter(function(t,i){t[d[0]]!==e.rowData[d[0]]||(o=i)});else{var l=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o=l?-1!==this.parent.getRows().indexOf(r)?this.parent.getRows().indexOf(r):-1!==this.parent.getFrozenRightRows().indexOf(r)?this.parent.getFrozenRightRows().indexOf(r):this.parent.getMovableRows().indexOf(r):-1===this.parent.getRows().indexOf(r)&&this.parent.getFrozenColumns()>0?this.parent.grid.getMovableRows().indexOf(r):this.parent.getRows().indexOf(r)}var p={};if(t.extend(p,e),p.cancel=!1,p.type="save",r=this.parent.grid.getRows()[r.rowIndex],this.parent.trigger(T,p),p.cancel)this.parent.grid.isEdit=!0;else if(r.rowIndex===this.parent.getCurrentViewRecords().length-1&&"tab"===this.keyPress&&(this.isTabLastRow=!0),a(this.parent)||this.parent.dataSource instanceof n.DataManager&&this.parent.dataSource.adaptor instanceof n.RemoteSaveAdaptor){if(a(this.parent)||this.parent.dataSource instanceof n.DataManager&&this.parent.dataSource.adaptor instanceof n.RemoteSaveAdaptor){var h=this.parent.grid.query;this.parent.grid.dataSource.update(d[0],e.rowData,h.fromTable,h,e.previousValue).then(function(n){t.isNullOrUndefined(n)||(e.rowData[e.columnName]=n[e.columnName]),i.updateCell(e,o),i.afterCellSave(e,r,o)})}}else if(s(this.parent)){var c={requestType:"save",data:e.rowData,action:"edit",row:r,rowIndex:o,rowData:e.rowData,columnName:e.columnName,filterChoiceCount:null,excelSearchOperator:null};this.parent.grid.getDataModule().eventPromise(c,this.parent.grid.query)}else this.updateCell(e,o),this.afterCellSave(e,r,o)}this.parent.enableVirtualization&&(this.parent.grid.contentModule.virtualData={})},e.prototype.afterCellSave=function(e,i,r){var n;this.parent.grid.aggregateModule&&this.parent.grid.aggregateModule.refresh(e.rowData),this.parent.grid.editModule.destroyWidgets([this.parent.grid.getColumnByField(e.columnName)]),this.parent.grid.editModule.formObj.destroy(),"tab"!==this.keyPress&&"shiftTab"!==this.keyPress&&(this.updateGridEditMode("Normal"),this.isOnBatch=!1),this.enableToolbarItems("save");this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0?(n=e.cell.closest(".e-frozen-left-header")||e.cell.closest(".e-frozen-left-content")?this.parent.grid.getRows()[r]:e.cell.closest(".e-movableheader")||e.cell.closest(".e-movablecontent")?this.parent.grid.getMovableRows()[r]:this.parent.grid.getFrozenRightRows()[r],t.removeClass([n],["e-editedrow","e-batchrow"]),t.removeClass(n.querySelectorAll(".e-rowcell"),["e-editedbatchcell","e-updatedtd"])):this.parent.getFrozenColumns()>0&&(n=e.cell.closest(".e-frozenheader")||e.cell.closest(".e-frozencontent")?this.parent.grid.getRows()[r]:this.parent.grid.getMovableRows()[r],t.removeClass([n],["e-editedrow","e-batchrow"]),t.removeClass(n.querySelectorAll(".e-rowcell"),["e-editedbatchcell","e-updatedtd"])),t.removeClass([i],["e-editedrow","e-batchrow"]),t.removeClass(i.querySelectorAll(".e-rowcell"),["e-editedbatchcell","e-updatedtd"]),!1!==this.parent.isCellSaveFocus&&this.parent.grid.focusModule.restoreFocus(),v({value:e.rowData,action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,e.columnName),i.rowIndex===this.parent.getCurrentViewRecords().length-1&&"enter"===this.keyPress&&(this.keyPress=null);var o={type:"save",column:this.parent.getColumnByField(e.columnName),data:e.rowData,previousData:e.previousValue,row:i,target:e.cell};this.parent.aggregates.map(function(e){return!0===e.showChildSummary}).length&&this.parent.grid.refresh(),this.parent.trigger(F,o)},e.prototype.lastCellTab=function(){!this.parent.grid.isEdit&&this.isOnBatch&&"tab"===this.keyPress&&"Cell"===this.parent.editSettings.mode&&(this.parent.editSettings.allowNextRowEdit?this.enableToolbarItems("edit"):(this.updateGridEditMode("Normal"),this.isOnBatch=!1,this.keyPress=null))},e.prototype.updateCell=function(e,t){this.parent.grid.editModule.updateCell(t,e.columnName,e.rowData[e.columnName]),this.parent.grid.getRowsObject()[t].data=e.rowData},e.prototype.crudAction=function(e,i){v(e,this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,i,this.addRowRecord),this.parent.parentData=[];for(var r=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,o=0;o<r.length;o++){r[o].index=o;var s=this.parent.grid.getPrimaryKeyFieldNames()[0];e.value[s]===r[o][s]&&"add"===e.action&&(r[o].level=this.internalProperties.level,r[o].taskData=this.internalProperties.taskData,r[o].uniqueID=this.internalProperties.uniqueID,t.isNullOrUndefined(this.internalProperties.parentItem)||(r[o].parentItem=this.internalProperties.parentItem,r[o].parentUniqueID=this.internalProperties.parentUniqueID),r[o].childRecords=this.internalProperties.childRecords),t.setValue("uniqueIDCollection."+r[o].uniqueID+".index",o,this.parent);var d=this.parent.dataSource.adaptor;(a(this.parent)||d instanceof n.RemoteSaveAdaptor)&&t.setValue("uniqueIDCollection."+r[o].uniqueID,r[o],this.parent),r[o].level||this.parent.parentData.push(r[o])}this.parent.enableInfiniteScrolling||"add"===e.action&&null!=this.previousNewRowPosition&&(this.parent.setProperties({editSettings:{newRowPosition:this.previousNewRowPosition}},!0),this.previousNewRowPosition=null)},e.prototype.updateIndex=function(e,i,r){for(var n=0;n<this.parent.getDataRows().length;n++){var o=r[n];if(!t.isNullOrUndefined(o)){var a=t.getValue("uniqueIDCollection."+o.uniqueID+".index",this.parent);if(o.index=a,!t.isNullOrUndefined(o.parentItem)){var s=t.getValue("uniqueIDCollection."+o.parentItem.uniqueID+".index",this.parent);o.parentItem.index=s}}}var d=-1,l=this.parent.treeColumnIndex;if(this.parent.getFrozenColumns()>0)for(var p=i[0].querySelectorAll(".e-rowcell"),h=0;h<p.length;h++)if(p[h].classList.contains("e-gridrowindex0level0")){l=h;break}for(var c=0;c<this.parent.getRows().length;c++){i[c].classList.contains("e-detailrow")||d++;var u=r[d];if(!t.isNullOrUndefined(u)){a=u.index;var g=u.level,f=i[c];t.isNullOrUndefined(u.parentItem)||(a=t.getValue("uniqueIDCollection."+u.parentItem.uniqueID+".index",this.parent));var y=f.cells[l];if(!t.isNullOrUndefined(y)){for(h=0;h<y.classList.length;h++){var m=y.classList[h],v=m.match(/e-gridrowindex/i),w=m.match(/e-griddetailrowindex/i);null!=v&&t.removeClass([y],m),null!=w&&t.removeClass([y],m)}i[c].classList.contains("e-detailrow")?t.addClass([y],"e-griddetailrowindex"+a+"level"+g):t.addClass([y],"e-gridrowindex"+a+"level"+g)}}}},e.prototype.beginAdd=function(){var e,i=this.addRowIndex,r=this.parent.grid.getCurrentViewRecords();"Batch"===this.parent.editSettings.mode&&(i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex(),(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)&&(r=this.batchEditModule.getBatchRecords()));var n=this.parent.grid.getDataRows(),o=n.length?+n[0].getAttribute("data-rowindex"):0,a=n.length?+n[n.length-1].getAttribute("data-rowindex"):0,s=this.selectedIndex>=o&&this.selectedIndex<=a,d=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex;if("Dialog"!==this.parent.editSettings.mode){if("Above"===this.parent.editSettings.newRowPosition)e="before";else if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(this.selectedIndex>-1||d)&&s&&(e="after",!t.isNullOrUndefined(r[i])&&r[i].expanded))if("Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)){if(i+=c(r[i]).length,"Child"!==this.parent.editSettings.newRowPosition){i+=this.batchEditModule.getBatchChildCount()}}else i+=c(r[i]).length;if((this.selectedIndex>-1||d)&&s&&(i||"Child"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)){i>=n.length-1&&(i=n.length-2);var l=this.parent.grid.contentModule.rows[0],p=document.activeElement;n[i+1][e](n[0]),t.setValue("batchIndex",i+1,this.batchEditModule);var h="Above"===this.parent.editSettings.newRowPosition?i:i+1;"Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule.rows.splice(0,1),this.parent.grid.contentModule.rows.splice(h,0,l));var u=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;if(this.parent.frozenRows||this.parent.getFrozenColumns()||this.parent.frozenColumns||u){var g=this.parent.getMovableDataRows(),f=this.parent.grid.getRowsObject()[0];if(g[i+1][e](g[0]),u){var y=this.parent.getFrozenRightDataRows();y[i+1][e](y[0])}"Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule.freezeRows.splice(0,1),this.parent.grid.contentModule.freezeRows.splice(h,0,f)),t.setValue("batchIndex",i+1,this.batchEditModule)}if("Row"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode){for(var m=this.parent.grid.getContentTable().querySelectorAll(".e-griderror"),v=0;v<m.length;v++)m[v].remove();t.setValue("errorRules",[],this.parent.grid.editModule.formObj)}d&&(this.prevAriaRowIndex="-1"),(!this.parent.enableVirtualization||this.parent.enableVirtualization&&!Object.keys(this.parent.grid.contentModule.emptyRowData).length)&&p.focus(),this.parent.enableVirtualization&&!Object.keys(this.parent.grid.contentModule.emptyRowData).length&&this.parent.grid.contentModule.createEmptyRowdata()}}if("Batch"===this.parent.editSettings.mode&&!t.isNullOrUndefined(this.addRowIndex)&&-1!==this.addRowIndex&&this.isAddedRowByMethod&&!this.isAddedRowByContextMenu){i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex();var w=this.parent.getBatchChanges().addedRecords,R=void 0;if(w.length)for(v=0;v<w.length;v++)t.isNullOrUndefined(w[v].uniqueID)&&(R=w[v]);var C={action:"add",data:R,index:i,seletedRow:0};this.beginAddEdit(C),this.batchEditModule.batchAddRowRecord.push(this.batchEditModule.addRowRecord),this.batchEditModule.batchAddedRecords.push(C.data)}},e.prototype.beginEdit=function(e){if("refresh"===e.requestType&&this.isOnBatch)e.cancel=!0;else if("Cell"!==this.parent.editSettings.mode||"beginEdit"!==e.requestType){if(this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-frame")))return e.cancel=!0,void(this.doubleClickTarget=null);if("delete"===e.requestType){var i=e.data;if(t.isNullOrUndefined(e.data[0].uniqueID))for(var r=this.parent.getPrimaryKeyFieldNames(),n=function(t){o.parent.flatData.filter(function(n){n[r[0]]===e.data[t][r[0]]&&(i[t]=n)})},o=this,a=0;a<i.length;a++)n(a);for(a=0;a<i.length;a++){this.deleteUniqueID(i[a].uniqueID);for(var s=c(i[a]),d=0;d<s.length;d++)this.deleteUniqueID(s[d].uniqueID);e.data=e.data.concat(s)}}if("add"===e.requestType||this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)){if((-1===this.parent.grid.selectedRowIndex&&this.isAddedRowByMethod||e.index!==this.parent.grid.selectedRowIndex)&&0!==e.index||(this.selectedIndex=this.parent.grid.selectedRowIndex),this.parent.enableVirtualization){var l='.e-row[data-rowindex="'+this.selectedIndex+'"]',p=void 0;this.selectedIndex>-1&&"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition?(this.prevAriaRowIndex=this.selectedIndex.toString(),p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.prevAriaRowIndex&&"-1"!==this.prevAriaRowIndex?(l='.e-row[data-rowindex="'+this.prevAriaRowIndex+'"]',p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.addRowIndex=0}else this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)?0!==e.index?this.addRowIndex=e.index:this.addRowIndex=this.parent.grid.selectedRowIndex:this.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0;this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)?(this.addRowRecord=this.parent.flatData[this.parent.grid.selectedRowIndex],this.parent.enableVirtualization&&this.isAddedRowByContextMenu&&(this.addRowRecord=this.parent.getCurrentViewRecords()[this.addRowIndex])):this.addRowRecord=this.parent.getSelectedRecords()[0]}this.isAddedRowByMethod&&0!==e.index&&(this.addRowRecord=this.parent.flatData[e.index],this.addRowIndex=e.index),"Child"===this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(this.addRowRecord)&&!t.isNullOrUndefined(this.parent.getSelectedRecords()[0])&&(this.addRowRecord=this.parent.getSelectedRecords()[0]),this.isAddedRowByMethod=!1,e=this.beginAddEdit(e)}else e.cancel=!0},e.prototype.savePreviousRowPosition=function(){null===this.previousNewRowPosition&&(this.previousNewRowPosition=this.parent.editSettings.newRowPosition)},e.prototype.beginAddEdit=function(e){var r=e.data;if("add"===e.action){var o=this.parent.grid.getPrimaryKeyFieldNames()[0],a=null;r.taskData=t.isNullOrUndefined(r.taskData)?t.extend({},e.data):r.taskData;var s=void 0;s=this.parent.enableVirtualization&&0!==e.index?this.parent.flatData:"Batch"===this.parent.editSettings.mode&&this.isAddedRowByMethod&&!t.isNullOrUndefined(this.addRowIndex)?this.batchEditModule.batchRecords:this.parent.grid.getCurrentViewRecords(),this.parent.enableVirtualization&&0!==e.index&&(this.addRowIndex=this.parent.flatData.indexOf(this.addRowRecord),this.selectedIndex=this.addRowIndex);var d=this.addRowIndex;r.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r.uniqueID,r,this.parent);var l=0,p=void 0,h=void 0,u=void 0,g=void 0,f=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex,m=this.parent.getRows(),v=m.length?s.indexOf(s[0]):0,w=m.length?+m[m.length-1].getAttribute("data-rowindex"):0,C=!(!this.parent.enableVirtualization||0===e.index)||this.selectedIndex>=v&&this.selectedIndex<=w;if(s.length&&(p=s[this.addRowIndex][this.parent.idMapping],g=s[this.addRowIndex][this.parent.parentIdMapping],s[this.addRowIndex].parentItem&&(h=s[this.addRowIndex].parentItem.uniqueID),u=s[this.addRowIndex].parentItem),"Top"!==this.parent.editSettings.newRowPosition&&s.length){if(l=s[this.addRowIndex].level,"Above"===this.parent.editSettings.newRowPosition)a="before",d=s[this.addRowIndex].index;else if("Below"===this.parent.editSettings.newRowPosition){a="after";var x=c(s[this.addRowIndex]).length,b=s[this.addRowIndex].index;d=x>0?b+x:b}else if("Child"===this.parent.editSettings.newRowPosition){a="after",(this.selectedIndex>-1||f)&&C&&(r.parentItem=t.extend({},s[this.addRowIndex]),r.parentUniqueID=r.parentItem.uniqueID,delete r.parentItem.childRecords,delete r.parentItem[this.parent.childMapping]);var S=c(s[this.addRowIndex]).length,I=s[this.addRowIndex].index;this.selectedIndex>=0&&(r.level=l+1),d=S>0?I+S:I,this.isSelfReference&&(this.parent.isLocalData||-1!==this.parent.editModule.selectedIndex?r.taskData[this.parent.parentIdMapping]=r[this.parent.parentIdMapping]=p:r.taskData[this.parent.parentIdMapping]=r[this.parent.parentIdMapping]=null,t.isNullOrUndefined(r.parentItem)||R(o,r.parentItem,"add",this.parent,this.isSelfReference,r))}if("Above"!==this.parent.editSettings.newRowPosition&&"Below"!==this.parent.editSettings.newRowPosition||((this.selectedIndex>-1||f)&&l&&C&&(r.parentUniqueID=h,r.parentItem=t.extend({},u),delete r.parentItem.childRecords,delete r.parentItem[this.parent.childMapping]),r.level=l,this.isSelfReference&&(r.taskData[this.parent.parentIdMapping]=r[this.parent.parentIdMapping]=g,t.isNullOrUndefined(r.parentItem)||R(o,r.parentItem,"add",this.parent,this.isSelfReference,r))),null!=a&&(this.selectedIndex>-1||f)&&C&&(e.index="before"===a?d:d+1),"Bottom"===this.parent.editSettings.newRowPosition){var D=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource;e.index=D.length}}t.isNullOrUndefined(r.level)&&(r.level=l),r.hasChildRecords=!1,r.childRecords=[],r.index=0}if("add"===e.action&&(this.internalProperties={level:r.level,parentItem:r.parentItem,uniqueID:r.uniqueID,taskData:r.taskData,parentUniqueID:t.isNullOrUndefined(r.parentItem)?void 0:r.parentItem.uniqueID,childRecords:r.childRecords}),"delete"===e.requestType)for(var M=e.data,O=0;O<M.length;O++)if(M[O].parentItem){u=y(this.parent,M[O].parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var P=u.childRecords.indexOf(M[O]);u.childRecords.splice(P,1)}}return e},e.prototype.addRecord=function(e,i,r){if(this.parent.editSettings.newRowPosition!==this.previousNewRowPosition&&null!==this.previousNewRowPosition||(this.previousNewRowPosition=this.parent.editSettings.newRowPosition),this.isSelfReference||t.isNullOrUndefined(e)||!Object.hasOwnProperty.call(e,this.parent.childMapping))e?(i>-1?(this.selectedIndex=i,this.addRowIndex=i):(this.selectedIndex=this.parent.selectedRowIndex,this.addRowIndex=this.parent.selectedRowIndex),r&&this.parent.setProperties({editSettings:{newRowPosition:r}},!0),this.parent.grid.editModule.addRecord(e,i)):this.parent.grid.editModule.addRecord(e,i);else{var n=[],o=this.parent.editSettings.mode,a=this.parent.grid.editSettings.mode;n.push(e),this.parent.setProperties({editSettings:{mode:"Batch"}},!0),this.parent.grid.setProperties({editSettings:{mode:"Batch"}},!0),t.isNullOrUndefined(r)||this.parent.setProperties({editSettings:{newRowPosition:r}},!0);var s={addedRecords:n,changedRecords:[],deletedRecords:[]};this.parent.notify(ge,{updatedRecords:s,index:i}),this.parent.setProperties({editSettings:{mode:o}},!0),this.parent.grid.setProperties({editSettings:{mode:a}},!0),this.parent.refresh()}},e.prototype.editFormValidate=function(){return this.parent.grid.editModule.editFormValidate()},e.prototype.destroyForm=function(){this.parent.grid.editModule.destroyForm()},e.prototype.contentready=function(e){t.isNullOrUndefined(e.args.requestType)||"delete"!==e.args.requestType.toString()&&"save"!==e.args.requestType.toString()&&("Batch"!==this.parent.editSettings.mode||"batchsave"!==e.args.requestType.toString())||(this.updateIndex(this.parent.grid.dataSource,this.parent.getRows(),this.parent.getCurrentViewRecords()),(this.parent.frozenRows||this.parent.getFrozenColumns()||this.parent.frozenColumns)&&this.parent.grid.dataSource.length===this.parent.getMovableDataRows().length&&this.updateIndex(this.parent.grid.dataSource,this.parent.getMovableDataRows(),this.parent.getCurrentViewRecords()))},e.prototype.editCell=function(e,t){"Cell"!==this.parent.editSettings.mode&&"Batch"!==this.parent.editSettings.mode||("Batch"!==this.parent.editSettings.mode&&(this.isOnBatch=!0,this.updateGridEditMode("Batch")),this.parent.grid.editModule.editCell(e,t))},e}(),Et=function(){function e(e){i.Grid.Inject(i.CommandColumn),this.parent=e}return e.prototype.getModuleName=function(){return"commandColumn"},e.prototype.destroy=function(){},e}(),At=function(){function e(e){i.Grid.Inject(i.DetailRow),this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"detailRow"},e.prototype.addEventListener=function(){this.parent.on("dataBoundArg",this.dataBoundArg,this),this.parent.on("detaildataBound",this.detaildataBound,this),this.parent.grid.on("detail-indentcell-info",this.setIndentVisibility,this),this.parent.on("childRowExpand",this.childRowExpand,this),this.parent.on("rowExpandCollapse",this.rowExpandCollapse,this),this.parent.on("actioncomplete",this.actioncomplete,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("dataBoundArg",this.dataBoundArg),this.parent.off("detaildataBound",this.detaildataBound),this.parent.off("childRowExpand",this.childRowExpand),this.parent.off("rowExpandCollapse",this.rowExpandCollapse),this.parent.off("actioncomplete",this.actioncomplete),this.parent.grid.off("detail-indentcell-info",this.setIndentVisibility))},e.prototype.setIndentVisibility=function(e){e.visible=!1},e.prototype.dataBoundArg=function(){for(var e=this.parent.getRows().filter(function(e){return!e.classList.contains("e-detailrow")}),r=0;r<e.length;r++){var n=e[r].getElementsByClassName("e-detailrowcollapse"),o=this.parent.grid.getRowObjectFromUID(e[r].getAttribute("data-Uid")),a=i.getObject("parentItem",this.parent.grid.getCurrentViewRecords()[r]);(t.isNullOrUndefined(a)||!t.isNullOrUndefined(a)&&h(this.parent,o.data,this.parent.grid.getCurrentViewRecords()))&&this.parent.grid.detailRowModule.expand(n[0])}},e.prototype.childRowExpand=function(e){var i=e.row.getElementsByClassName("e-detailrowcollapse");t.isNullOrUndefined(i[0])||this.parent.grid.detailRowModule.expand(i[0])},e.prototype.rowExpandCollapse=function(e){if(!a(this.parent))for(var t=0;t<e.detailrows.length;t++)e.detailrows[t].style.display=e.action},e.prototype.detaildataBound=function(e){var i=e.data,r=e.detailElement.parentElement.previousSibling,n="e-gridrowindex"+(t.isNullOrUndefined(i.parentItem)?i.index:i.parentItem.index)+"level"+i.level,o=r.querySelector("."+n).classList,a=[].slice.call(o).filter(function(e){return e===n}),s=a[0].length,d="e-griddetail"+a.toString().slice(6,s);t.addClass([e.detailElement.parentElement],d)},e.prototype.actioncomplete=function(e){if("beginEdit"===e.requestType||"add"===e.requestType){var t=e.row.querySelectorAll(".e-editcell")[0].getAttribute("colSpan"),r=(parseInt(t,10)-1).toString();e.row.querySelectorAll(".e-editcell")[0].setAttribute("colSpan",r)}for(var n=this.parent.grid.contentModule.getRows(),o=0;o<n.length;o++)n[o].cells[0].visible=!1;i.getObject("focusModule",this.parent.grid).refreshMatrix(!0)({rows:this.parent.grid.contentModule.getRows()})},e.prototype.destroy=function(){this.removeEventListener()},e}(),Nt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),kt=function(e){function r(t,i){var r=e.call(this,t,i)||this;return r.isExpandCollapse=!1,r.translateY=0,r.maxiPage=0,r.recordAdded=!1,r.startIndex=-1,r.endIndex=-1,r.preTranslate=0,r.isRemoteExpand=!1,r.isDataSourceChanged=!1,r.addEventListener(),r}return Nt(r,e),r.prototype.getModelGenerator=function(){return new vt(this.parent)},r.prototype.getRowByIndex=function(e){return this.parent.getDataRows().filter(function(t){return parseInt(t.getAttribute("data-rowindex"),10)===e})[0]},r.prototype.getMovableVirtualRowByIndex=function(e){return this.getRowCollection(e,!0)},r.prototype.getFrozenRightVirtualRowByIndex=function(e){return this.getRowCollection(e,!1,!1,!0)},r.prototype.getRowCollection=function(e,t,i,r){var n=parseInt(this.parent.getRows()[0].getAttribute(Ne),10),o=t?this.parent.getMovableDataRows():this.parent.getDataRows();o=r?this.parent.getFrozenRightDataRows():o;var a=(i?this.parent.getCurrentViewRecords():o)[e-n];return this.parent.frozenRows&&this.parent.pageSettings.currentPage>1&&(a=i?e<=this.parent.frozenRows?this.parent.getRowsObject()[e].data:a:e<=this.parent.frozenRows?o[e]:o[e-n+this.parent.frozenRows]),a},r.prototype.addEventListener=function(){this.parent.on(me,this.virtualOtherAction,this),this.parent.on(we,this.indexModifier,this)},r.prototype.virtualOtherAction=function(e){e.setTop?(this.translateY=0,this.startIndex=0,this.endIndex=this.parent.pageSettings.pageSize-1):e.isExpandCollapse&&(this.isExpandCollapse=!0)},r.prototype.indexModifier=function(e){var t=this.parent.getContent().querySelector(".e-content");if(this.recordAdded&&this.startIndex>-1&&this.endIndex>-1){if(this.endIndex>e.count-this.parent.pageSettings.pageSize){var i=~~(t.scrollTop/this.parent.getRowHeight()),r=i+this.parent.getRows().length;r>e.count&&(r=i+(e.count-i)),this.startIndex=r-this.parent.getRows().length,this.endIndex=r}else("Top"!==this.parent.root.editSettings.newRowPosition&&-1!==this.parent.root.editModule.selectedIndex||-1!==this.parent.root.editModule.selectedIndex)&&(this.startIndex+=1,this.endIndex+=1);this.recordAdded=!1}this.isDataSourceChanged&&(this.startIndex=0,this.endIndex=this.parent.pageSettings.pageSize-1),e.startIndex=this.startIndex,e.endIndex=this.endIndex},r.prototype.eventListener=function(t){var i=this;this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url&&s(this.parent)?e.prototype.eventListener.call(this,"on"):(this.parent[t]("data-ready",this.onDataReady,this),this.parent[t]("refresh-virtual-block",this.refreshContentRows,this),this.fn=function(){i.observers.observes(function(e){return i.scrollListeners(e)},i.onEnteredAction(),i.parent),i.parent.off("content-ready",i.fn)},this.parent.addEventListener("dataBound",this.dataBoundEvent.bind(this)),this.parent.addEventListener("rowSelected",this.rowSelectedEvent.bind(this)),this.parent[t]("select-virtual-Row",this.toSelectVirtualRow,this),this.parent.on("content-ready",this.fn,this),this.parent.addEventListener(F,this.onActionComplete.bind(this)),this.parent[t]("virtual-scroll-edit-action-begin",this.beginEdit,this),this.parent[t]("virtual-scroll-add-action-begin",this.beginAdd,this),this.parent[t]("virtual-scroll-edit-success",this.virtualEditSuccess,this),this.parent[t]("edit-reset",this.resetIseditValue,this),this.parent[t]("get-virtual-data",this.getData,this),this.parent[t]("virtual-scroll-edit-cancel",this.cancelEdit,this),this.parent[t]("select-row-on-context-open",this.toSelectRowOnContextOpen,this),this.parent[t]("refresh-virtual-editform-cells",this.refreshCell,this),this.parent[t]("virtaul-cell-focus",this.cellFocus,this))},r.prototype.cellFocus=function(t){e.prototype.virtualCellFocus.call(this,t)},r.prototype.onDataReady=function(i){if(e.prototype.onDataReady.call(this,i),!(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url&&s(this.parent))){if(!t.isNullOrUndefined(i.count)){if(this.totalRecords=i.count,this.parent.isFrozenGrid()&&i.count<Object.keys(this.parent.dataSource).length){var r=this.parent.enableColumnVirtualization?this.getColumnOffset(this.parent.columns.length-1)+"px":"100%",o=this.parent.getRowHeight()*i.count-this.parent.getRowHeight()*this.parent.pageSettings.pageSize;t.getValue("virtualEle",this).setVirtualHeight(o,r)}this.parent.enableColumnVirtualization||this.parent.isFrozenGrid()||t.getValue("virtualEle",this).setVirtualHeight(this.parent.getRowHeight()*i.count,"100%")}(!t.isNullOrUndefined(i.requestType)&&"collapseAll"===i.requestType.toString()||this.isDataSourceChanged&&(-1===this.startIndex||0===this.startIndex&&0===this.preStartIndex))&&(this.contents.scrollTop=0,this.isDataSourceChanged=!1)}},r.prototype.renderTable=function(){e.prototype.renderTable.call(this),this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url&&s(this.parent)||(t.getValue("observer",this).options.debounceEvent=!1,this.observers=new Ut(t.getValue("observer",this).element,t.getValue("observer",this).options),this.contents=this.getPanel().firstChild)},r.prototype.getTranslateY=function(t,i,r,o){return this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)?this.isRemoteExpand?(this.isRemoteExpand=!1,this.preTranslate):(this.preTranslate=e.prototype.getTranslateY.call(this,t,i,r,o),e.prototype.getTranslateY.call(this,t,i,r,o)):e.prototype.getTranslateY.call(this,t,i,r,o)},r.prototype.dataBoundEvent=function(){var i="initialRowTop";if(this.parent.getRows().length&&!this[i]&&!t.isNullOrUndefined(this.parent.getRowByIndex(0))){var r=this.parent.getRowByIndex(0).getBoundingClientRect().top,n=this.parent.element.getBoundingClientRect().top;this[i]=r>0?this.parent.getRowByIndex(0).getBoundingClientRect().top-n:this.content.getBoundingClientRect().top-this.parent.getRowByIndex(0).getBoundingClientRect().height}e.prototype.dataBound.call(this)},r.prototype.rowSelectedEvent=function(t){e.prototype.rowSelected.call(this,t)},r.prototype.toSelectVirtualRow=function(i){if(!this.parent.isEdit){var r="containerRect";t.isNullOrUndefined(this.observer[r])&&(this.observer[r]=this.observers[r]),(t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule)||0!==i.selectedIndex||t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule.addRowIndex))&&e.prototype.selectVirtualRow.call(this,i)}},r.prototype.refreshCell=function(e){e.cells=this.generateCells()},r.prototype.generateCells=function(){for(var e=[],t=0;t<this.parent.columns.length;t++)e.push(this.generateCell(this.parent.columns[t]));return e},r.prototype.generateCell=function(e,r,n,o,a,s){var d={visible:e.visible,isDataCell:!t.isNullOrUndefined(e.field||e.template),isTemplate:!t.isNullOrUndefined(e.template),rowID:r,column:e,cellType:t.isNullOrUndefined(n)?i.CellType.Data:n,colSpan:o,commands:e.commands,isForeignKey:e.isForeignColumn&&e.isForeignColumn(),foreignKeyData:e.isForeignColumn&&e.isForeignColumn()&&t.getValue(e.field,s)};return(d.isDataCell||"checkbox"===d.column.type||d.commands)&&(d.index=a),new i.Cell(d)},r.prototype.beginEdit=function(e){this.editedRowIndex=e.index;var t='.e-row[data-rowindex="'+e.index+'"]',i=this.parent.getContent().querySelector(t).rowIndex,r=this.parent.getCurrentViewRecords()[i];e.data=r},r.prototype.beginAdd=function(t){var i={newRowPosition:this.rowPosition,addRowIndex:this.addRowIndex,dataRowIndex:this.dataRowIndex};this.parent.notify("get-row-position",i),this.rowPosition=i.newRowPosition,this.addRowIndex=i.addRowIndex,this.dataRowIndex=i.dataRowIndex;var r=this.parent.getRows(),n=r.length?+r[0].getAttribute("data-rowindex"):0,o=r.length?+r[r.length-1].getAttribute("data-rowindex"):0,a=this.parent.selectedRowIndex>=n&&this.parent.selectedRowIndex<=o;"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition&&(this.isAdd=!0),"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition&&(this.addRowIndex&&-1!==this.addRowIndex||-1!==this.parent.selectedRowIndex&&a)||e.prototype.addActionBegin.call(this,t)},r.prototype.restoreEditState=function(){e.prototype.restoreEdit.call(this)},r.prototype.resetIseditValue=function(){this.parent.notify("reset-edit-props",{}),"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition||!this.isAdd||e.prototype.resetIsedit.call(this)},r.prototype.virtualEditSuccess=function(){var e=this.parent.getContent().querySelector(".e-content");this.isAdd&&e.querySelector(".e-addedrow")&&(this.recordAdded=!0)},r.prototype.cancelEdit=function(t){e.prototype.editCancel.call(this,t)},r.prototype.toSelectRowOnContextOpen=function(t){e.prototype.selectRowOnContextOpen.call(this,t)},r.prototype.restoreNewRow=function(){var e=this.parent.getContent().querySelector(".e-content");this.isAdd&&!e.querySelector(".e-addedrow")&&(this.parent.isEdit=!1,this.parent.editModule.addRecord(null,this.parent.root.editModule.selectedIndex))},r.prototype.getData=function(t){e.prototype.getVirtualData.call(this,t)},r.prototype.onActionComplete=function(t){if("add"===t.requestType){var i={newRowPosition:this.rowPosition,addRowIndex:this.addRowIndex,dataRowIndex:this.dataRowIndex};this.parent.notify("get-row-position",i),this.rowPosition=i.newRowPosition,this.addRowIndex=i.addRowIndex,this.dataRowIndex=this.parent.root.editModule.selectedIndex}e.prototype.actionComplete.call(this,t)},r.prototype.onEnteredAction=function(){var e=this;return function(i,r,n,o,a,s){if(!e.parent.directVirtualRender){t.Browser.isIE&&!a&&s&&!e.preventEvent&&e.parent.showSpinner();var d="X"===r.axis,l=e.getColumnOffset(d?e.vgenerator.getColumnIndexes()[0]-1:e.prevInfo.columnIndexes[0]-1);if(d){var p=Object.keys(e.vgenerator.cOffsets).length-e.prevInfo.columnIndexes.length,h=e.vgenerator.cOffsets[p-1];l=l>h?h:l}e.parent.isFrozenGrid()||(e.virtualEle.adjustTable(l,e.translateY),e.parent.enableColumnVirtualization&&e.header.virtualEle.adjustTable(l,0))}}},r.prototype.scrollListeners=function(e){this.scrollAfterEdit();var i=e.sentinel,r=this.parent.pageSettings.pageSize-Math.ceil(this.parent.pageSettings.pageSize/2),o=this.parent.getContent().querySelector(".e-content"),a=r*this.parent.getRowHeight(),d=e.offset.top-this.translateY<0,l=Math.ceil(e.offset.top-this.translateY)>=a,p="selectedRowIndex",h=this.parent.currentViewData;if(d&&"right"!==e.direction&&"left"!==e.direction){var c=+(this.parent.height.toString().indexOf("%")<0?this.parent.height:this.parent.element.getBoundingClientRect().height),u=~~(o.scrollTop/this.parent.getRowHeight())+Math.ceil(c/this.parent.getRowHeight())-this.parent.pageSettings.pageSize;if(u=u>0?u:0,t.isNullOrUndefined(this[p])||-1===this[p]||u===this[p]||(u=this[p]),this.startIndex=u,this.endIndex=u+this.parent.pageSettings.pageSize,this.endIndex>this.totalRecords){var g=this.totalRecords-1,f=this.endIndex%g;this.endIndex=g,this.startIndex=this.startIndex-f<0?0:this.startIndex-f}h.length&&h[0].index>=this.parent.pageSettings.pageSize/2&&h[0].index-this.startIndex<this.parent.pageSettings.pageSize/2&&(this.startIndex=h[0].index-this.parent.pageSettings.pageSize/2,this.endIndex=this.startIndex+this.parent.pageSettings.pageSize);var y=Math.ceil(e.offset.top/this.parent.getRowHeight());y%=this.parent.pageSettings.pageSize;var m=0;if(!t.isNullOrUndefined(this.parent.getRows()[y])&&!t.isNullOrUndefined(this.parent.getContent().querySelectorAll(".e-content tr")[y])){m=+this.parent.getContent().querySelectorAll(".e-content tr")[y].querySelector("td").getAttribute("index")}if(0===m)this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*this.parent.getRowHeight():this.translateY=e.offset.top;else{var v=this.parent.getRowHeight();this.translateY=e.offset.top-r*v>0?e.offset.top-r*v+10:0}}else if(l&&"right"!==e.direction&&"left"!==e.direction){var w=~~(o.scrollTop/this.parent.getRowHeight()),R=!(this[p]+this.parent.pageSettings.pageSize<this.totalRecords);t.isNullOrUndefined(this[p])||-1===this[p]||w===this[p]||R||(w=this[p]);var C=w+this.parent.pageSettings.pageSize;C>this.totalRecords&&(C=w+(this.totalRecords-w)),this.startIndex=R?w:C-this.parent.pageSettings.pageSize,this.endIndex=C,h.length&&this.startIndex>h[0].index&&this.startIndex-h[0].index<this.parent.pageSettings.pageSize/2&&(this.startIndex=h[0].index+this.parent.pageSettings.pageSize/2),e.offset.top>this.parent.getRowHeight()*this.totalRecords?this.translateY=this.getTranslateY(e.offset.top,o.getBoundingClientRect().height):this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*this.parent.getRowHeight():this.translateY=e.offset.top}if(l&&e.offset.top<this.parent.getRowHeight()*this.totalRecords||d||"right"===e.direction||"left"===e.direction||this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)){var x=this.currentInfo=t.getValue("getInfoFromView",this).apply(this,[e.direction,i,e.offset]);this.previousInfo=x,this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization?x.columnIndexes:[]);var b=x.loadNext&&!x.loadSelf?x.nextInfo.page:x.page;this.parent.setProperties({pageSettings:{currentPage:b}},!0),this.requestType="virtualscroll","right"!==e.direction&&"left"!==e.direction&&(x.event="refresh-virtual-block"===x.event?"model-changed":x.event),this.parent.notify(x.event,{requestType:"virtualscroll",virtualInfo:x,focusElement:e.focusElement})}},r.prototype.appendContent=function(i,r,o){var a=this.parent.isFrozenGrid();if(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)||this.parent.isFrozenGrid())t.getValue("isExpandCollapse",o)&&(this.isRemoteExpand=!0),a&&t.isNullOrUndefined(this.requestType)&&-1===t.getValue("requestTypes",this).indexOf("isFrozen")&&(t.getValue("requestTypes",this).push("isFrozen"),this.requestType="isFrozen"),e.prototype.appendContent.call(this,i,r,o),-1!==t.getValue("requestTypes",this).indexOf("isFrozen")&&(t.getValue("requestTypes",this).splice(t.getValue("requestTypes",this).indexOf("isFrozen"),1),this.requestType="isFrozen"===this.requestType?void 0:this.requestType),!a||this.isExpandCollapse&&0!==this.translateY?this.isExpandCollapse=!1:(this.translateY=this.translateY<0?0:this.translateY,t.getValue("virtualEle",this).adjustTable(0,this.translateY));else{var d=o.virtualInfo.sentinelInfo&&"Y"===o.virtualInfo.sentinelInfo.axis&&t.getValue("currentInfo",this).page&&t.getValue("currentInfo",this).page!==o.virtualInfo.page?t.getValue("currentInfo",this):o.virtualInfo,l=d.columnIndexes[0]-1,p=this.getColumnOffset(l),h=void 0;if(this.parent.enableColumnVirtualization){this.header.virtualEle.adjustTable(p,0);var c=d.columnIndexes;h=this.getColumnOffset(c[c.length-1])-this.getColumnOffset(c[0]-1)+"",this.header.virtualEle.setWrapperWidth(h)}this.virtualEle.setWrapperWidth(h,t.Browser.isIE||"edge"===t.Browser.info.name),(i=this.parent.createElement("tbody")).appendChild(r);this.getTable().querySelector("tbody").replaceWith(i),this.isExpandCollapse&&0!==this.translateY?this.isExpandCollapse=!1:(this.translateY=this.translateY<0?0:this.translateY,t.getValue("virtualEle",this).adjustTable(p,this.translateY)),t.setValue("prevInfo",this.previousInfo?this.previousInfo:d,this),"virtualscroll"===o.requestType&&"X"===o.virtualInfo.sentinelInfo.axis&&this.parent.notify("auto-col",{});e.prototype.focusCell.call(this,o);this.isAdd&&!this.parent.getContent().querySelector(".e-content").querySelector(".e-addedrow")&&"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition&&(this.dataRowIndex>=this.startIndex?this.restoreNewRow():this.addRowIndex&&this.addRowIndex>-1&&(this.isAdd=!1,this.parent.isEdit=!1)),this.restoreEditState(),e.prototype.restoreAdd.call(this),e.prototype.ensureSelectedRowPosition.call(this)}},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("data-ready",this.onDataReady),this.parent.off("content-ready",this.fn),this.parent.off("select-virtual-Row",this.toSelectVirtualRow),this.parent.off("dataBound",this.dataBoundEvent),this.parent.off("rowSelected",this.rowSelectedEvent),this.parent.off(me,this.virtualOtherAction),this.parent.off(we,this.indexModifier),this.parent.off("virtual-scroll-edit-action-begin",this.beginEdit),this.parent.off("virtual-scroll-add-action-begin",this.beginAdd),this.parent.off("virtual-scroll-edit-success",this.virtualEditSuccess),this.parent.off("edit-reset",this.resetIseditValue),this.parent.off("get-virtual-data",this.getData),this.parent.off("virtual-scroll-edit-cancel",this.cancelEdit),this.parent.off("select-row-on-context-open",this.toSelectRowOnContextOpen),this.parent.off("refresh-virtual-editform-cells",this.refreshCell),this.parent.off("virtaul-cell-focus",this.cellFocus))},r}(i.VirtualContentRenderer),Ut=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.isWheeling=!1,t.newPos=0,t.lastPos=0,t.timer=0,t}return Nt(i,e),i.prototype.observes=function(i,r,n){if(e.prototype.containerRect=t.getValue("options",this).container.getBoundingClientRect(),t.EventHandler.add(t.getValue("options",this).container,"scroll",this.virtualScrollHandlers(i,r,n),this),t.getValue("options",this).movableContainer){e.prototype.movableContainerRect=t.getValue("options",this).movableContainer.getBoundingClientRect(),t.EventHandler.add(t.getValue("options",this).movableContainer,"scroll",this.virtualScrollHandlers(i,r,n),this)}},i.prototype.clear=function(){this.lastPos=null},i.prototype.virtualScrollHandlers=function(e,i,r){var o=this,a="options",d=t.debounce(e,50);return this[a].prevTop=this[a].prevLeft=0,function(t){var l=o[a].movableContainer?o[a].container.scrollTop:t.target.scrollTop,p=o[a].movableContainer?o[a].scrollbar.scrollLeft:t.target.scrollLeft,h=o[a].prevTop<l?"down":"up";h=o[a].prevLeft===p?h:o[a].prevLeft<p?"right":"left",o[a].prevTop=l,o[a].prevLeft=p;var c=o.sentinelInfo[h],u=0;if(o.newPos=l,null!=o.lastPos&&(u=o.newPos-o.lastPos),o.lastPos=o.newPos,o.timer&&clearTimeout(o.timer),o.timer=setTimeout(o.clear,0),(u>100||u<-100)&&t&&t.preventDefault&&(t.returnValue=!1,t.preventDefault()),-1!==o[a].axes.indexOf(c.axis)){var g=o.check(h);if(c.entered&&"X"===c.axis&&(!o.movableEle||"right"!==h&&"left"!==h?i(o.element,c,h,{top:l,left:p},o.fromWheel,g):i(o.movableEle,c,h,{top:l,left:p},o.fromWheel,g)),g){var f=d;"X"===c.axis?f({direction:h,sentinel:c,offset:{top:l,left:p},focusElement:document.activeElement}):r.dataSource instanceof n.DataManager&&void 0!==r.dataSource.dataSource.url&&!r.dataSource.dataSource.offline&&""!==r.dataSource.dataSource.url||s(r)?f({direction:h,sentinel:c,offset:{top:l,left:p},focusElement:document.activeElement}):e({direction:h,sentinel:c,offset:{top:l,left:p},focusElement:document.activeElement})}o.fromWheel=!1}}},i}(i.InterSectionObserver),qt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Vt=function(){function e(e){this.prevstartIndex=-1,this.prevendIndex=-1,this.parent=e,i.Grid.Inject(Bt),this.addEventListener()}return e.prototype.returnVisualData=function(e){e.data=this.visualData},e.prototype.getModuleName=function(){return"virtualScroll"},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on(J,this.collapseExpandVirtualchilds,this),this.parent.on(X,this.virtualPageAction,this),this.parent.on("destroy",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(J,this.collapseExpandVirtualchilds),this.parent.off(X,this.virtualPageAction),this.parent.off("destroy",this.destroy))},e.prototype.collapseExpandVirtualchilds=function(e){this.parent.grid.notify(me,{isExpandCollapse:!0}),this.expandCollapseRec=e.record,e.record.expanded="collapse"!==e.action;var i={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length};(this.parent.enableVirtualization&&"Cell"===this.parent.selectionSettings.mode||"Row"===this.parent.selectionSettings.mode&&!this.parent.selectionSettings.persistSelection)&&this.parent.grid.clearSelection();var r=t.getValue("isCollapseAll",this.parent)?"collapseAll":"refresh";t.getValue("grid.renderModule",this.parent).dataManagerSuccess(i,{requestType:r})},e.prototype.virtualPageAction=function(e){var i=this,r=new n.DataManager(e.result),o=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),a=r.executeLocal((new n.Query).where(o)),s=a.filter(function(e){return h(i.parent,e,a)});this.visualData=s,this.parent.grid.notify(ve,{data:s});var d={startIndex:-1,endIndex:-1,count:e.count};this.parent.grid.notify(we,d);var l=d.startIndex,p=d.endIndex;if(e.count=s.length,-1===l&&-1===p){var c=new n.Query,u=this.parent.grid.pageSettings.pageSize,g=u*(this.parent.grid.pageSettings.currentPage-1);c=c.skip(g).take(u),r.dataSource.json=s,e.result=r.executeLocal(c)}else{var f=e.actionArgs.requestType;if(("filtering"===f||"collapseAll"===f||"searching"===f||"refresh"===f&&this.parent.enableCollapseAll&&p>s.length)&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.getContent().firstElementChild.scrollTop=0,this.parent.grid.notify(me,{setTop:!0})),!t.isNullOrUndefined(this.expandCollapseRec)&&("virtualscroll"===e.actionArgs.requestType||"refresh"===e.actionArgs.requestType&&l!==this.prevstartIndex)&&l<this.parent.getRows().length&&p<=l+this.parent.getRows().length&&(l=0),!t.isNullOrUndefined(this.expandCollapseRec)){var y=this.parent.getRows(),m=s.indexOf(this.expandCollapseRec);s.slice(m,m+y.length).length<y.length&&m>=0&&0!==l?(l=m=(m=s.length-y.length)>0?m:0,p=s.length):t.getValue("isCollapseAll",this.parent)&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify(me,{setTop:!0}))}!this.parent.enableCollapseAll&&!this.parent.expandStateMapping||t.isNullOrUndefined(this.expandCollapseRec)||(e.count<this.parent.getRows()[0].getBoundingClientRect().height?l=0:this.parent.isExpandAll||(l=-1===this.prevstartIndex?0:this.prevstartIndex)),this.expandCollapseRec=null,l=l<0?0:l,e.result=s.slice(l,p),this.prevstartIndex=l,this.prevendIndex=p}this.parent.notify("updateAction",e)},e.prototype.destroy=function(){this.removeEventListener()},e}(),Bt=function(e){function r(i,r){var n=e.call(this,i,r)||this;return t.getValue("parent",n).off("initial-load",t.getValue("instantiateRenderer",n),n),t.getValue("parent",n).on("initial-load",n.instantiateRenderers,n),n}return qt(r,e),r.prototype.getModuleName=function(){return"treeVirtualScroll"},r.prototype.instantiateRenderers=function(){var e=t.getValue("parent",this);t.getValue("parent",this).log(["limitation","virtual_height"],"virtualization");var r=t.getValue("locator",this).getService("rendererFactory");e.isFrozenGrid()||(e.enableColumnVirtualization&&t.getValue("addRenderer",r).apply(r,[i.RenderType.Header,new i.VirtualHeaderRenderer(t.getValue("parent",this),t.getValue("locator",this))]),t.getValue("addRenderer",r).apply(r,[i.RenderType.Content,new kt(t.getValue("parent",this),t.getValue("locator",this))])),this.ensurePageSize()},r.prototype.ensurePageSize=function(){var e=t.getValue("parent",this),i=e.getRowHeight();t.isNullOrUndefined(e.height)||"string"!=typeof e.height||-1===e.height.indexOf("%")||(e.element.style.height=e.height);var r=2*~~((e.height.toString().indexOf("%")<0?e.height:e.element.getBoundingClientRect().height)/i),n=e.pageSettings.pageSize;e.setProperties({pageSettings:{pageSize:n<r?r:n}},!0)},r}(i.VirtualScroll),Tt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Lt=function(e){function r(t,i){var r=e.call(this,t,i)||this;return r.addEventListener(),r}return Tt(r,e),r.prototype.renderTable=function(){this.freezeRowGenerator=new i.FreezeRowModelGenerator(this.parent),this.virtualRenderer=new kt(this.parent,this.serviceLoc),this.virtualRenderer.header=this.serviceLoc.getService("rendererFactory").getRenderer(i.RenderType.Header).virtualHdrRenderer,i.FreezeContentRender.prototype.renderTable.call(this),this.virtualRenderer.setPanel(this.parent.getContent()),this.scrollbar=this.parent.getContent().querySelector(".e-movablescrollbar");var e=this.getMovableContent(),t=this.parent.height;if(this.virtualRenderer.virtualEle.content=this.virtualRenderer.content=this.getPanel().querySelector("."+Ae),this.virtualRenderer.virtualEle.content.style.overflowX="hidden",this.virtualRenderer.virtualEle.renderFrozenWrapper(t),this.virtualRenderer.virtualEle.renderFrozenPlaceHolder(),this.parent.enableColumnVirtualization){this.virtualRenderer.virtualEle.movableContent=this.virtualRenderer.movableContent=this.getPanel().querySelector("."+Pe),this.virtualRenderer.virtualEle.renderMovableWrapper(t),this.virtualRenderer.virtualEle.renderMovablePlaceHolder();var r=e.querySelector("table");this.virtualRenderer.virtualEle.movableTable=r,this.virtualRenderer.virtualEle.movableWrapper.appendChild(r),e.appendChild(this.virtualRenderer.virtualEle.movableWrapper),e.appendChild(this.virtualRenderer.virtualEle.movablePlaceholder)}this.virtualRenderer.virtualEle.wrapper.appendChild(this.getFrozenContent()),this.virtualRenderer.virtualEle.wrapper.appendChild(e),this.virtualRenderer.virtualEle.table=this.getTable(),i.setDebounce(this.parent,this.virtualRenderer,this.scrollbar,this.getMovableContent())},r.prototype.appendContent=function(i,r,n){t.getValue("observer",this.virtualRenderer).options.debounceEvent=!1,this.virtualRenderer.observers=new Ut(t.getValue("observer",this.virtualRenderer).element,t.getValue("observer",this.virtualRenderer).options,t.getValue("observer",this.virtualRenderer).movableEle),this.virtualRenderer.contents=this.getPanel().firstChild,e.prototype.appendContent.call(this,i,r,n)},r.prototype.generateRows=function(t,i){return e.prototype.generateRows.call(this,t,i)},r}(i.VirtualFreezeRenderer),Ft=function(e){function r(t,i){var r=e.call(this,t,i)||this;return r.serviceLoc=i,r.eventListener("on"),r}return Tt(r,e),r.prototype.renderTable=function(){this.virtualRenderer=new kt(this.parent,this.serviceLoc),this.virtualRenderer.header=this.serviceLoc.getService("rendererFactory").getRenderer(i.RenderType.Header).virtualHdrRenderer,this.freezeRowGenerator=new i.FreezeRowModelGenerator(this.parent),i.ColumnFreezeContentRenderer.prototype.renderTable.call(this),this.virtualRenderer.setPanel(this.parent.getContent()),this.scrollbar=this.parent.getContent().querySelector(".e-movablescrollbar");var t=this.getFrozenRightContent(),r=this.getFrozenContent(),n=this.getMovableContent();"Right"===this.parent.getFrozenMode()&&(r=t),this.virtualRenderer.virtualEle.content=this.virtualRenderer.content=this.getPanel().querySelector("."+Ae),this.virtualRenderer.virtualEle.content.style.overflowX="hidden";var o=this.parent.height;this.virtualRenderer.virtualEle.renderFrozenWrapper(o),this.virtualRenderer.virtualEle.renderFrozenPlaceHolder(),e.prototype.renderVirtualFrozenLeft.call(this,r,n),e.prototype.renderVirtualFrozenRight.call(this,r,n),e.prototype.renderVirtualFrozenLeftRight.call(this,r,n,t),this.virtualRenderer.virtualEle.table=this.getTable(),i.setDebounce(this.parent,this.virtualRenderer,this.scrollbar,this.getMovableContent())},r.prototype.appendContent=function(i,r,n){t.getValue("observer",this.virtualRenderer).options.debounceEvent=!1,this.virtualRenderer.observers=new Ut(t.getValue("observer",this.virtualRenderer).element,t.getValue("observer",this.virtualRenderer).options,t.getValue("observer",this.virtualRenderer).movableEle),this.virtualRenderer.contents=this.getPanel().firstChild,e.prototype.appendContent.call(this,i,r,n)},r}(i.ColumnVirtualFreezeRenderer),zt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Tt(t,e),t.prototype.renderTable=function(){e.prototype.renderTable.call(this)},t.prototype.rfshMovable=function(){e.prototype.rfshMovable.call(this)},t}(i.VirtualFreezeHdrRenderer),jt=function(){function e(e){i.Grid.Inject(i.Freeze),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("rowExpandCollapse",this.rowExpandCollapse,this),this.parent.on("dataBoundArg",this.dataBoundArg,this),this.parent.grid.on("dblclick",this.dblClickHandler,this),this.parent.grid.on("initial-load",this.instantiateRenderer,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("rowExpandCollapse",this.rowExpandCollapse),this.parent.off("dataBoundArg",this.dataBoundArg),this.parent.grid.off("dblclick",this.dblClickHandler),this.parent.grid.off("initial-load",this.instantiateRenderer))},e.prototype.instantiateRenderer=function(){var e=t.getValue("serviceLocator",this.parent.grid).getService("rendererFactory");this.parent.getFrozenColumns()&&(this.parent.enableColumnVirtualization?t.getValue("addRenderer",e).apply(e,[i.RenderType.Header,new zt(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]):t.getValue("addRenderer",e).apply(e,[i.RenderType.Header,new i.FreezeRender(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]),this.parent.enableVirtualization?t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new Lt(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]):t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new i.FreezeContentRender(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))])),(this.parent.getFrozenLeftColumnsCount()||this.parent.getFrozenRightColumnsCount())&&(t.getValue("addRenderer",e).apply(e,[i.RenderType.Header,new i.ColumnFreezeHeaderRenderer(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]),this.parent.enableVirtualization?t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new Ft(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]):t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new i.ColumnFreezeContentRenderer(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]))},e.prototype.rowExpandCollapse=function(e){var t,i,r=this.parent.getMovableDataRows(),n=this.parent.getRows(),o=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o&&(i=this.parent.getFrozenRightRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))})),t=e.detailrows.length?e.detailrows:r.filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))});for(var a=0;a<t.length;a++){var s=this.parent.grid.getRowObjectFromUID(t[a].getAttribute("data-Uid")).data;t[a].style.display=e.action,o&&(i[a].style.display=e.action);var d="none"===e.action?".e-treecolumn-container .e-treegridcollapse":".e-treecolumn-container .e-treegridexpand";if(n[t[a].rowIndex].querySelector(d)){for(var l=[],p=0;p<r.length;p++)r[p].querySelector(".e-gridrowindex"+s.index+"level"+(s.level+1))&&l.push(r[p]);l.length&&this.rowExpandCollapse({detailrows:l,action:e.action})}}},e.prototype.dblClickHandler=function(e){i.parentsUntil(e.target,"e-rowcell")&&this.parent.grid.editSettings.allowEditOnDblClick&&"Cell"!==this.parent.editSettings.mode&&!e.target.classList.contains("e-treegridcollapse")&&!e.target.classList.contains("e-treegridexpand")&&this.parent.grid.editModule.startEdit(i.parentsUntil(e.target,"e-row"))},e.prototype.dataBoundArg=function(){this.parent.getColumns().filter(function(e){return e.showCheckbox}).length&&this.parent.freezeModule&&this.parent.initialRender&&t.addClass([this.parent.element.getElementsByClassName("e-grid")[0]],"e-checkselection")},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getModuleName=function(){return"freeze"},e}(),_t=function(){function e(e){i.Grid.Inject(i.ColumnChooser),this.parent=e}return e.prototype.openColumnChooser=function(e,t){return this.parent.grid.columnChooserModule.openColumnChooser(e,t)},e.prototype.destroy=function(){},e.prototype.getModuleName=function(){return"ColumnChooser"},e}(),Ht=function(){function e(e){this.parent=e,i.Grid.Inject(i.InfiniteScroll),this.addEventListener()}return e.prototype.getModuleName=function(){return"infiniteScroll"},e.prototype.addEventListener=function(){this.parent.on(X,this.infinitePageAction,this),this.parent.on("infinite-remote-expand",this.infiniteRemoteExpand,this),this.parent.grid.on("delete-complete",this.infiniteDeleteHandler,this),this.parent.grid.on("infinite-edit-handler",this.infiniteEditHandler,this),this.parent.grid.on("infinite-crud-cancel",this.createRows,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on(J,this.collapseExpandInfinitechilds,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("infinite-remote-expand",this.infiniteRemoteExpand),this.parent.grid.off("delete-complete",this.infiniteDeleteHandler),this.parent.grid.off("infinite-edit-handler",this.infiniteEditHandler),this.parent.off(X,this.infinitePageAction),this.parent.grid.off("infinite-crud-cancel",this.createRows),this.parent.grid.off("content-ready",this.contentready),this.parent.off(J,this.collapseExpandInfinitechilds))},e.prototype.infiniteRemoteExpand=function(e){for(var t=this.parent.grid.getRowsObject(),r=this.parent.grid.infiniteScrollModule.serviceLocator,n=new i.RowRenderer(r,null,this.parent.grid),o=this.parent.getRows(),a=e.index===o.length-1?"after":"before",s=this.parent.grid.getColumns(),d=this.parent.grid.infiniteScrollModule.generateRows(e.childData,e),l=[],p=0;p<d.length;p++)l.push(n.render(d[p],s));t.splice.apply(t,[e.index+1,0].concat(d));for(p=0;p<l.length;p++)"after"===a?o[e.index+p][a](l[p]):o[e.index+p+1][a](l[p]),o.splice(e.index+1+p,0,l[p]);i.resetRowIndex(this.parent.grid,this.parent.grid.getRowsObject(),this.parent.grid.getRows(),0)},e.prototype.contentready=function(){if(this.parent.infiniteScrollSettings.enableCache&&!t.isNullOrUndefined(this.parent.editModule)){this.parent.editModule.updateIndex(this.parent.grid.dataSource,this.parent.getRows(),this.parent.getCurrentViewRecords()),this.parent.getFrozenColumns()&&this.parent.editModule.updateIndex(this.parent.grid.dataSource,this.parent.getMovableDataRows(),this.parent.getCurrentViewRecords())}},e.prototype.collapseExpandInfinitechilds=function(e){e.record.expanded="collapse"!==e.action;var i={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length},r=t.getValue("isCollapseAll",this.parent)?"collapseAll":"refresh";t.getValue("grid.renderModule",this.parent).dataManagerSuccess(i,{requestType:r})},e.prototype.infinitePageAction=function(e){var i=this,r=new n.DataManager(e.result),o=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),a=r.executeLocal((new n.Query).where(o)),s=a.filter(function(e){return h(i.parent,e,a)}),d=t.getValue("actionArgs",e.actionArgs),l=t.getValue("actions",this.parent.grid.infiniteScrollModule);this.parent.grid.infiniteScrollModule.isInitialRender&&!this.parent.initialRender&&(this.parent.grid.pageSettings.currentPage=1);var p=!!l.some(function(e){return e===d.requestType})||!!this.parent.initialRender;if(this.visualData=s,e.count=s.length,t.getValue("isPrinting",e.actionArgs))e.result=s;else{var c=new n.Query,u=this.parent.infiniteScrollSettings.enableCache;u&&this.parent.infiniteScrollSettings.initialBlocks>this.parent.infiniteScrollSettings.maxBlocks&&(this.parent.infiniteScrollSettings.initialBlocks=this.parent.infiniteScrollSettings.maxBlocks);var g=p?this.parent.grid.pageSettings.pageSize*this.parent.infiniteScrollSettings.initialBlocks:this.parent.grid.pageSettings.pageSize,f=this.parent.grid.pageSettings.currentPage;if(t.isNullOrUndefined(d))c=c.page(f,g);else{var y=t.getValue("lastIndex",this.parent.grid.infiniteScrollModule),m=t.getValue("firstIndex",this.parent.grid.infiniteScrollModule);if(u||"delete"!==d.requestType)u&&"delete"===d.requestType||"save"===d.requestType&&"add"===d.action?c=(c=c.skip(m)).take(this.parent.infiniteScrollSettings.initialBlocks*this.parent.pageSettings.pageSize):("expand"!==e.actionArgs.action&&"collapse"!==e.actionArgs.action||1===this.parent.grid.pageSettings.currentPage||(f=1,g=this.parent.grid.pageSettings.pageSize*this.parent.grid.pageSettings.currentPage),c=c.page(f,g));else{var v=y-d.data.length+1,w=d.data.length;c=c.skip(v).take(w)}}r.dataSource.json=s,u||t.isNullOrUndefined(d)||"save"!==d.requestType||"add"!==d.action?e.result=r.executeLocal(c):e.result=[d.data]}this.parent.notify("updateAction",e)},e.prototype.infiniteEditHandler=function(e){var t=this.parent.grid.infiniteScrollModule.infiniteCurrentViewData,i=Object.keys(t);if("delete"===e.e.requestType&&e.result.length>1)for(var r=1;r<e.result.length;r++)t[i[i.length-1]].push(e.result[r])},e.prototype.infiniteDeleteHandler=function(e){if("delete"===e.requestType){var t=this.parent.grid.getRowsObject(),i=this.parent.getRows(),r=e.data instanceof Array?e.data:[e.data],n=this.parent.grid.getPrimaryKeyFieldNames()[0];if(this.removeRows(i,t,r,n,!0),this.parent.getFrozenColumns()>0){var o=this.parent.grid.getMovableRowsObject(),a=this.parent.grid.getMovableRows();this.removeRows(a,o,r,n)}}},e.prototype.removeRows=function(e,i,r,n,o){for(var a=this,s=function(s){i.filter(function(d,l){if(d.data[n]===r[s][n]){if(o){var p=Math.ceil((l+1)/a.parent.grid.pageSettings.pageSize);a.parent.grid.infiniteScrollModule.resetInfiniteCurrentViewData(p,l)}i.splice(l,1),t.remove(e[l]),e.splice(l,1)}})},d=0;d<r.length;d++)s(d)},e.prototype.createRows=function(e){var r,n=e.args.e,o=e.row,a=this.parent.grid.infiniteScrollModule.serviceLocator,s=new i.RowRenderer(a,null,this.parent.grid),d=this.parent.getCurrentViewRecords(),l=e.isMovable?this.parent.grid.getMovableRows():this.parent.grid.getDataRows();r=e.isFrozenRight?this.parent.element.querySelector(".e-frozen-right-content").querySelector("tbody"):this.parent.grid.isFrozenGrid()?e.isMovable?this.parent.grid.getMovableVirtualContent().querySelector("tbody"):this.parent.grid.getFrozenVirtualContent().querySelector("tbody"):this.parent.getContent().querySelector("tbody"),this.parent.frozenRows&&(r=e.isFrozenRows&&"add"!==this.parent.grid.infiniteScrollModule.requestType||!e.isFrozenRows&&"add"===this.parent.grid.infiniteScrollModule.requestType?this.parent.grid.isFrozenGrid()?e.isMovable?this.parent.grid.getMovableVirtualHeader().querySelector("tbody"):e.isFrozenRight?this.parent.element.querySelector(".e-frozen-right-header").querySelector("tbody"):this.parent.grid.getFrozenVirtualHeader().querySelector("tbody"):this.parent.getHeaderContent().querySelector("tbody"):r);for(var p,h=this.parent.editModule.addRowIndex,u=0;u<o.length;u++){var g=s.render(o[u],this.parent.grid.getColumns());"save"===n.requestType&&"add"===n.action?-1!==t.getValue("selectedIndex",this.parent.editModule)&&"Top"!==this.parent.editSettings.newRowPosition?"Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition?(p="after",h+=c(d[h]).length,"Child"===this.parent.editSettings.newRowPosition&&(h-=1),l[h][p](g)):"Above"===this.parent.editSettings.newRowPosition&&(p="before",l[this.parent.editModule.addRowIndex][p](g)):"Bottom"===this.parent.editSettings.newRowPosition?r.appendChild(g):r.insertBefore(g,r.firstElementChild):"delete"===n.requestType&&r.appendChild(g)}e.cancel=!0},e.prototype.destroy=function(){this.removeEventListener()},e}();e.TreeGrid=pt,e.load="load",e.rowDataBound=q,e.dataBound="dataBound",e.queryCellInfo=V,e.beforeDataBound=B,e.actionBegin=T,e.dataStateChange=L,e.actionComplete=F,e.rowSelecting="rowSelecting",e.rowSelected=z,e.checkboxChange=j,e.rowDeselected=_,e.toolbarClick=H,e.beforeExcelExport=G,e.beforePdfExport=Q,e.resizeStop="resizeStop",e.expanded=K,e.expanding="expanding",e.collapsed=W,e.collapsing="collapsing",e.remoteExpand=Y,e.localPagedExpandCollapse=J,e.pagingActions=X,e.printGridInit=$,e.contextMenuOpen=Z,e.contextMenuClick=ee,e.beforeCopy="beforeCopy",e.beforePaste="beforePaste",e.savePreviousRowPosition="savePreviousRowPosition",e.crudAction=te,e.beginEdit=ie,e.beginAdd=re,e.recordDoubleClick=ne,e.cellSave=oe,e.cellSaved=ae,e.cellEdit=se,e.batchDelete=de,e.batchCancel=le,e.batchAdd=pe,e.beforeBatchDelete=he,e.beforeBatchAdd=ce,e.beforeBatchSave=ue,e.batchSave=ge,e.keyPressed=fe,e.updateData="update-data",e.doubleTap=ye,e.virtualColumnIndex="virtualColumnIndex",e.virtualActionArgs=me,e.destroy="destroy",e.dataListener=ve,e.indexModifier=we,e.beforeStartEdit=Re,e.beforeBatchCancel=Ce,e.batchEditFormRendered="batcheditform-rendered",e.detailDataBound=xe,e.rowDrag="rowDrag",e.rowDragStartHelper=be,e.rowDrop="rowDrop",e.rowDragStart="rowDragStart",e.rowsAdd=Se,e.rowsRemove=Ie,e.rowdraging=De,e.rowDropped=Me,e.autoCol="auto-col",e.rowDeselecting=Oe,e.headerContent="e-headercontent",e.movableContent=Pe,e.movableHeader="e-movableheader",e.frozenContent=Ee,e.frozenHeader="e-frozenheader",e.content=Ae,e.table="e-table",e.leftRight="Left-Right",e.frozenRight="frozen-right",e.frozenLeft="frozen-left",e.dataColIndex="data-colindex",e.ariaColIndex="aria-colindex",e.dataRowIndex=Ne,e.ariaRowIndex="aria-rowindex",e.DataManipulation=He,e.Reorder=ht,e.Resize=ct,e.RowDD=ut,e.Column=C,e.EditSettings=et,e.Predicate=S,e.FilterSettings=I,e.PageSettings=Ke,e.SearchSettings=Le,e.SelectionSettings=je,e.AggregateColumn=Je,e.AggregateRow=Xe,e.SortDescriptor=rt,e.SortSettings=nt,e.RowDropSettings=yt,e.InfiniteScrollSettings=st,e.Render=_e,e.TreeVirtualRowModelGenerator=vt,e.isRemoteData=a,e.isCountRequired=s,e.isCheckboxcolumn=d,e.isFilterChildHierarchy=l,e.findParentRecords=p,e.getExpandStatus=h,e.findChildrenRecords=c,e.isOffline=u,e.extendArray=g,e.getPlainData=f,e.getParentData=y,e.isHidden=m,e.Filter=wt,e.ExcelExport=Rt,e.PdfExport=Ct,e.Page=xt,e.Toolbar=bt,e.Aggregate=St,e.Sort=It,e.TreeClipboard=Ue,e.ColumnMenu=Dt,e.ContextMenu=Mt,e.Edit=Pt,e.CommandColumn=Et,e.Selection=qe,e.DetailRow=At,e.VirtualScroll=Vt,e.TreeVirtual=Bt,e.Freeze=jt,e.ColumnChooser=_t,e.Logger=k,e.treeGridDetails=U,e.InfiniteScroll=Ht,Object.defineProperty(e,"__esModule",{value:!0})});
10
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-grids","@syncfusion/ej2-buttons","@syncfusion/ej2-data","@syncfusion/ej2-popups"],t):t(e.ej={},e.ej2Base,e.ej2Grids,e.ej2Buttons,e.ej2Data,e.ej2Popups)}(this,function(e,t,i,r,n,o){"use strict";function a(e){if(e.dataSource instanceof n.DataManager){var t=e.dataSource.adaptor;return t instanceof n.ODataAdaptor||t instanceof n.WebApiAdaptor||t instanceof n.WebMethodAdaptor||t instanceof n.CacheAdaptor||t instanceof n.UrlAdaptor}return!1}function s(e){return!!(e.dataSource&&"result"in e.dataSource)}function d(e){for(var t=0;t<e.columns.length;t++)if(e.columns[t].showCheckbox)return!0;return!1}function l(e){return!((t.isNullOrUndefined(e.grid.searchSettings.key)||""===e.grid.searchSettings.key||"Child"!==e.searchSettings.hierarchyMode&&"None"!==e.searchSettings.hierarchyMode)&&(!e.allowFiltering||!e.grid.filterSettings.columns.length||"Child"!==e.filterSettings.hierarchyMode&&"None"!==e.filterSettings.hierarchyMode))}function p(e){for(var t=[],r=0,n=Object.keys(e).length;r<n;r++){i.getObject("hasChildRecords",e[r])&&t.push(e[r])}return t}function h(e,i,r){var n,o=t.isNullOrUndefined(i.parentItem)?null:y(e,i.parentItem.uniqueID);return null==o||(!e.initialRender||t.isNullOrUndefined(o[e.expandStateMapping])||o[e.expandStateMapping]?!1!==o.expanded&&(!o.parentItem||((n=y(e,o.parentItem.uniqueID))&&e.initialRender&&!t.isNullOrUndefined(n[e.expandStateMapping])&&!n[e.expandStateMapping]?(n.expanded=!1,!1):(!n||!1!==n.expanded)&&(!n||h(e,n,r)))):(o.expanded=!1,!1))}function c(e){var i=[];if(t.isNullOrUndefined(e)||!e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)&&!e.childRecords.length)return[];if(!t.isNullOrUndefined(e.childRecords))for(var r=e.childRecords.filter(function(e){return!e.isSummaryRow}),n=0,o=Object.keys(r).length;n<o;n++)i.push(r[n]),(r[n].hasChildRecords||!t.isNullOrUndefined(r[n].childRecords)&&r[n].childRecords.length)&&(i=i.concat(c(r[n])));return i}function u(e){if(a(e)){var i=e.dataSource;return!t.isNullOrUndefined(i.ready)}return!0}function g(e){for(var t,i,r=[],n=0;e&&n<e.length;n++){i=Object.keys(e[n]),t={};for(var o=0;o<i.length;o++)t[i[o]]=e[n][i[o]];r.push(t)}return r}function f(e){return delete e.hasChildRecords,delete e.childRecords,delete e.index,delete e.parentItem,delete e.level,delete e.taskData,delete e.uniqueID,e}function y(e,t,i){if(i){return e.uniqueIDFilterCollection[t]}return e.uniqueIDCollection[t]}function m(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}function v(e,i,r,o,a,s,d){var l,p,h,c=e.value,u=e.action,m=i.grid.getPrimaryKeyFieldNames()[0],v=i.dataSource instanceof n.DataManager?i.dataSource.dataSource.json:i.dataSource,C=[],x=c,b=!1;if("Batch"===i.editSettings.mode&&(h=i.grid.editModule.getBatchChanges()),"add"===u||"batchsave"===u&&"Batch"===i.editSettings.mode&&h.addedRecords.length){var S=function(e,i,r,n,o,a,s){var d,l=!1,p=r.grid.getCurrentViewRecords();switch(d=t.extend({},e.value),d=f(d),r.editSettings.newRowPosition){case"Top":i.unshift(d),l=!0;break;case"Bottom":i.push(d),l=!0;break;case"Above":d=t.isNullOrUndefined(s)?f(d=t.extend({},p[o+1])):f(d=t.extend({},s));break;case"Below":case"Child":if(t.isNullOrUndefined(s)){var h=r.grid.getPrimaryKeyFieldNames()[0],c=p[o];d=f(d=!t.isNullOrUndefined(c)&&c[h]===e.value[h]||-1!==a?t.extend({},c):t.extend({},e.value));r.editModule.internalProperties.taskData=d}else d=f(d=t.extend({},s));-1===a&&(i.unshift(d),l=!0)}return{value:d,isSkip:l}}(e,v,i,0,o,a,d);c=S.value,b=S.isSkip}if(c instanceof Array?C=g(c):C.push(t.extend({},c)),!b&&("add"!==u||"Top"!==i.editSettings.newRowPosition&&"Bottom"!==i.editSettings.newRowPosition))for(var I=0;I<C.length;I++){"object"==typeof C[I][m]&&(C[I]=C[I][m]);var D=C[I].taskData?Object.keys(C[I].taskData):Object.keys(C[I]);l=v.length;for(var M=function(){if(v[l][m]===C[I][m]){if("delete"!==u){if("edit"===u){for(p=0;p<D.length;p++)if(Object.prototype.hasOwnProperty.call(v[l],D[p])&&("Cell"!==i.editSettings.mode||!t.isNullOrUndefined(h)&&0===h.changedRecords.length||D[p]===s)){var e=y(i,C[I].uniqueID);v[l][D[p]]=C[I][D[p]],e&&e.taskData&&(e.taskData[D[p]]=e[D[p]]=v[l][D[p]])}}else if("add"===u||"batchsave"===u){var n=void 0;"Child"===i.editSettings.newRowPosition?r?(x.taskData[i.parentIdMapping]=v[l][i.idMapping],v.splice(l+1,0,x.taskData)):(Object.prototype.hasOwnProperty.call(v[l],i.childMapping)||(v[l][i.childMapping]=[]),v[l][i.childMapping].push(x.taskData),R(m,v[l],u,i,r,x)):"Below"===i.editSettings.newRowPosition?(v.splice(l+1,0,x.taskData),t.isNullOrUndefined(x.parentItem)||R(m,v[l+1],u,i,r,x)):o?"Above"===i.editSettings.newRowPosition&&(v.splice(l,0,x.taskData),t.isNullOrUndefined(x.parentItem)||R(m,v[l],u,i,r,x)):(n=0,v.splice(n,0,x.taskData))}return"break"}var a=v[l];if(v.splice(l,1),r){if(!t.isNullOrUndefined(a[i.parentIdMapping]))for(var d=i.flatData.filter(function(e){return e[i.idMapping]===a[i.parentIdMapping]})[0],c=d?d[i.childMapping]:[],g=c.length-1;g>=0;g--)if(c[g][i.idMapping]===a[i.idMapping]){i.enableImmutableMode||d.childRecords.length!==d.Children.length||d.childRecords.splice(g,1),c.splice(g,1),c.length||(d.hasChildRecords=!1,R(m,d,u,i,r));break}return"break"}}else t.isNullOrUndefined(v[l][i.childMapping])||w(v[l][i.childMapping],C[I],u,m,i,r,x,s)&&R(m,v[l],u,i,r)};l--&&l>=0;){if("break"===M())break}}}function w(e,i,r,n,o,a,s,d){for(var l=!1,p=e.length;p--&&p>=0;)if(e[p][n]===i[n]||a&&e[p][o.parentIdMapping]===i[o.idMapping]){if("edit"===r){for(var h=Object.keys(i),c=y(o,i.uniqueID),u=0;u<h.length;u++)if(Object.prototype.hasOwnProperty.call(e[p],h[u])&&("Cell"!==o.editSettings.mode||h[u]===d)&&(c[h[u]]=c.taskData[h[u]]=e[p][h[u]]=i[h[u]],"Normal"===o.grid.editSettings.mode&&"Cell"===o.editSettings.mode)){o.grid.editModule.editModule.editRowIndex=i.index,o.grid.editModule.editModule.updateCurrentViewData(i)}break}"add"===r||"batchsave"===r?"Child"===o.editSettings.newRowPosition?a?(s[o.parentIdMapping]=e[p][o.idMapping],e.splice(p+1,0,s),R(n,e[p],r,o,a,s)):(Object.prototype.hasOwnProperty.call(e[p],o.childMapping)||(e[p][o.childMapping]=[]),e[p][o.childMapping].push(s.taskData),R(n,e[p],r,o,a,s)):"Above"===o.editSettings.newRowPosition?(e.splice(p,0,s.taskData),t.isNullOrUndefined(s.parentItem)||R(n,e[p],r,o,a,s)):"Below"===o.editSettings.newRowPosition&&(e.splice(p+1,0,s.taskData),t.isNullOrUndefined(s.parentItem)||R(n,e[p],r,o,a,s)):(e.splice(p,1),e.length||(l=!0))}else t.isNullOrUndefined(e[p][o.childMapping])||w(e[p][o.childMapping],i,r,n,o,a,s,d)&&R(n,e[p],r,o,a);return l}function R(e,i,r,o,a,s){if("Above"!==o.editSettings.newRowPosition&&"Below"!==o.editSettings.newRowPosition||"add"!==r&&"batchsave"!==r||t.isNullOrUndefined(s.parentItem)){var d,l=o.grid.getCurrentViewRecords();if(l.map(function(t,r){t[e]!==i[e]||(d=r)}),o.enableVirtualization&&t.isNullOrUndefined(d)){var p=t.getValue("uniqueIDCollection."+s.parentUniqueID,o);i=p}if(t.isNullOrUndefined(d)||(i=l[d]),o.enableVirtualization&&t.isNullOrUndefined(i)&&!t.isNullOrUndefined(s)&&(i=t.getValue("uniqueIDCollection."+s.parentUniqueID,o)),a||t.isNullOrUndefined(i.childRecords)||!i.childRecords.length?i.hasChildRecords=!1:i.hasChildRecords=!0,"add"===r||"batchsave"===r){i.expanded=!0,i.hasChildRecords=!0,o.sortSettings.columns.length&&t.isNullOrUndefined(s)&&(s=l.filter(function(e){return e.parentUniqueID===i.uniqueID?e:null}));var h=s?s instanceof Array?s[0]:s:l[d+1];"Below"!==o.editSettings.newRowPosition&&(Object.prototype.hasOwnProperty.call(i,"childRecords")?t.isNullOrUndefined(s)||i[e]===s[e]||i.childRecords.push(s):i.childRecords=[],-1===i.childRecords.indexOf(h)&&i[e]!==s[e]&&i.childRecords.unshift(h),a&&(Object.prototype.hasOwnProperty.call(i,o.childMapping)||(i[o.childMapping]=[]),-1===i[o.childMapping].indexOf(h)&&i[e]!==s[e]&&i[o.childMapping].unshift(h)))}for(var c=o.grid.getPrimaryKeyFieldNames()[0],u=o.grid.dataSource instanceof n.DataManager?o.grid.dataSource.dataSource.json:o.grid.dataSource,g=0;g<u.length;g++)if(u[g][c]===i[c]){u[g]=i;break}o.grid.setRowData(e,i);var f=o.getRowByIndex(d);"Batch"===o.editSettings.mode&&(f="add"===r?o.getRows()[o.grid.getCurrentViewRecords().indexOf(i)]:o.getRows()[o.grid.getRowIndexByPrimaryKey(i[e])]);var m=void 0;if((o.frozenRows||o.getFrozenColumns())&&(m=o.getMovableRowByIndex(d)),!o.enableVirtualization&&!t.isNullOrUndefined(f)||!t.isNullOrUndefined(m)){var v=o.treeColumnIndex;o.allowRowDragAndDrop&&o.enableImmutableMode&&(v+=1),o.renderModule.cellRender({data:i,cell:f.cells[v]?f.cells[v]:m.cells[v-o.getFrozenColumns()],column:o.grid.getColumns()[o.treeColumnIndex],requestType:r}),(o.enableImmutableMode&&"indenting"===o.action||"outdenting"===o.action)&&o.renderModule.RowModifier({data:i,row:f})}}else{y(o,s.parentItem.uniqueID).childRecords.push(s)}}var C=function(){function e(e){this.allowEditing=!0,this.edit={},this.disableHtmlEncode=!0,this.allowReordering=!0,this.showColumnMenu=!0,this.allowFiltering=!0,this.allowSorting=!0,this.allowResizing=!0,this.filter={},t.merge(this,e)}return e.prototype.setProperties=function(e){for(var t=Object.keys(e),i=0;i<t.length;i++)if(this[t[i]]=e[t[i]],this.parent&&this.parent.isReact&&"template"===t[i]){this.parent.clipboardModule.treeGridParent.renderModule.refreshReactColumnTemplateByUid(this.uid)}},e}(),x=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),b=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},S=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return x(i,e),b([t.Property()],i.prototype,"field",void 0),b([t.Property()],i.prototype,"operator",void 0),b([t.Property()],i.prototype,"value",void 0),b([t.Property()],i.prototype,"matchCase",void 0),b([t.Property()],i.prototype,"ignoreAccent",void 0),b([t.Property()],i.prototype,"predicate",void 0),b([t.Property({})],i.prototype,"actualFilterValue",void 0),b([t.Property({})],i.prototype,"actualOperator",void 0),b([t.Property()],i.prototype,"type",void 0),b([t.Property()],i.prototype,"ejpredicate",void 0),b([t.Property()],i.prototype,"uid",void 0),b([t.Property()],i.prototype,"isForeignKey",void 0),i}(t.ChildProperty),I=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return x(i,e),b([t.Collection([],S)],i.prototype,"columns",void 0),b([t.Property("FilterBar")],i.prototype,"type",void 0),b([t.Property()],i.prototype,"mode",void 0),b([t.Property(!0)],i.prototype,"showFilterBarStatus",void 0),b([t.Property(1500)],i.prototype,"immediateModeDelay",void 0),b([t.Property()],i.prototype,"operators",void 0),b([t.Property(!1)],i.prototype,"ignoreAccent",void 0),b([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),D=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),M=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},O=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return D(i,e),M([t.Property("Both")],i.prototype,"wrapMode",void 0),i}(t.ChildProperty),P=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),E="https://ej2.syncfusion.com/documentation/treegrid",A="https://ej2.syncfusion.com/documentation",N=!1,k=function(e){function r(t){return i.Grid.Inject(i.Logger),e.call(this,t)||this}return P(r,e),r.prototype.getModuleName=function(){return"logger"},r.prototype.log=function(e,r){e instanceof Array||(e=[e]);for(var n=e,o=0;o<n.length;o++){var a=i.detailLists[n[o]],s=a.check(r,this.parent);if(s.success){var d=a.generateMessage(r,this.parent,s.options);d=d.replace("EJ2Grid","EJ2TreeGrid").replace("* Hierarchy Grid","").replace("* Grouping",""),N&&"primary_column_missing"===n[o]&&(d=d.replace("Editing","Row DragAndDrop"),N=!1);var l=d.indexOf("https"),p=d.substring(l);"module_missing"===n[o]?d=d.replace(p,E+"/modules"):"primary_column_missing"===n[o]||"selection_key_missing"===n[o]?d=d.replace(p,A+"/api/treegrid/column/#isprimarykey"):"grid_remote_edit"===n[o]?d=d.replace(p,E+"/edit"):"virtual_height"===n[o]?d=d.replace(p,E+"/virtual"):"check_datasource_columns"===n[o]?d=d.replace(p,E+"/columns"):"locale_missing"===n[o]&&(d=d.replace(p,E+"/global-local/#localization")),"datasource_syntax_mismatch"===n[o]?t.isNullOrUndefined(this.treeGridObj)||t.isNullOrUndefined(this.treeGridObj.dataStateChange)||console[a.logType](d):console[a.logType](d)}}},r.prototype.treeLog=function(e,t,i){this.treeGridObj=i,e instanceof Array||(e=[e]);var r=e;i.allowRowDragAndDrop&&!i.columns.filter(function(e){return e.isPrimaryKey}).length&&(N=!0,this.log("primary_column_missing",t));for(var n=0;n<r.length;n++){var o=U[r[n]],a=o.check(t,i);if(a.success){var s=o.generateMessage(t,i,a.options);console[o.logType](s)}}},r}(i.Logger),U={mapping_fields_missing:{type:"mapping_fields_missing",logType:"error",check:function(e,i){var r={success:!1};return(t.isNullOrUndefined(i.idMapping)&&t.isNullOrUndefined(i.childMapping)&&t.isNullOrUndefined(i.parentIdMapping)||!t.isNullOrUndefined(i.idMapping)&&t.isNullOrUndefined(i.parentIdMapping)||t.isNullOrUndefined(i.idMapping)&&!t.isNullOrUndefined(i.parentIdMapping))&&(r={success:!0}),r},generateMessage:function(){return"[EJ2TreeGrid.Error]: MAPPING FIELDS MISSING \nOne of the following fields is missing. It is required for the hierarchical relationship of records in TreeGrid:\n* childMapping\n* idMapping\n* parentIdMapping\nRefer to the following documentation links for more details.\n"+A+"/api/treegrid#childmapping\n"+A+"/api/treegrid#idmapping\n"+A+"/api/treegrid#$parentidmapping"}}},q="rowDataBound",V="queryCellInfo",B="beforeDataBound",T="actionBegin",L="dataStateChange",F="actionComplete",z="rowSelected",j="checkboxChange",_="rowDeselected",H="toolbarClick",G="beforeExcelExport",Q="beforePdfExport",K="expanded",W="collapsed",Y="remoteExpand",J="localPagedExpandCollapse",X="pagingActions",$="printGrid-Init",Z="contextMenuOpen",ee="contextMenuClick",te="crudAction",ie="beginEdit",re="beginAdd",ne="recordDoubleClick",oe="cellSave",ae="cellSaved",se="cellEdit",de="batchDelete",le="batchCancel",pe="batchAdd",he="beforeBatchDelete",ce="beforeBatchAdd",ue="beforeBatchSave",ge="batchSave",fe="key-pressed",ye="double-tap",me="virtual-action-args",ve="data-listener",we="index-modifier",Re="edit-form",Ce="before-batch-cancel",xe="detailDataBound",be="rowDragStartHelper",Se="rows-add",Ie="rows-remove",De="row-draging",Me="row-dropped",Oe="rowDeselecting",Pe="e-movablecontent",Ee="e-frozencontent",Ae="e-content",Ne="data-rowindex",ke=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ue=function(e){function i(t,i){var r=e.call(this,t.grid,i)||this;return r.treeCopyContent="",r.copiedUniqueIdCollection=[],r.treeGridParent=t,r.serviceLocator=i,r}return ke(i,e),i.prototype.setCopyData=function(i){var r="copyContent",n=this.treeGridParent.getCurrentViewRecords();if(""===window.getSelection().toString()){this.clipBoardTextArea.value=this[r]="";var o=this.treeGridParent.grid.getRows();if("Cell"!==this.treeGridParent.selectionSettings.mode){for(var a=this.treeGridParent.getSelectedRowIndexes().sort(function(e,t){return e-t}),s=0;s<a.length;s++)if(s>0&&(this.treeCopyContent+="\n"),!o[a[s]].classList.contains("e-summaryrow")){var d=[].slice.call(o[a[s]].querySelectorAll(".e-rowcell")),l=this.treeGridParent.getSelectedRecords()[s].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&("Parent"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.parentContentData(n,a[s],o,i,s),this.getCopyData(d,!1,"\t",i),this.treeCopyContent+=this[r],this.copiedUniqueIdCollection.push(l),this[r]="","Child"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.childContentData(n,a[s],o,i))}if(i){var p=[];for(s=0;s<this.treeGridParent.getVisibleColumns().length;s++)p[s]=this.treeGridParent.getVisibleColumns()[s].headerText;this.getCopyData(p,!1,"\t",i),this.treeCopyContent=this[r]+"\n"+this.treeCopyContent}var h={data:this.treeCopyContent,cancel:!1};if(this.treeGridParent.trigger("beforeCopy",h),h.cancel)return;this.clipBoardTextArea.value=this[r]=h.data,t.Browser.userAgent.match(/ipad|ipod|iphone/i)?this.clipBoardTextArea.setSelectionRange(0,this.clipBoardTextArea.value.length):this.clipBoardTextArea.select(),this.isSelect=!0,this.copiedUniqueIdCollection=[],this.treeCopyContent=""}else e.prototype.setCopyData.call(this,i)}},i.prototype.parentContentData=function(e,i,r,n,o){var a="copyContent",s="parentItem",d="uniqueID";if(!t.isNullOrUndefined(e[i][s]))for(var l=e[i][s].level,p=0;p<l+1;p++)for(var h=0;h<e.length;h++)if(!t.isNullOrUndefined(e[i][s])&&e[h][d]===e[i][s][d]){i=h;var c=[].slice.call(r[i].querySelectorAll(".e-rowcell")),u=e[h][d];if(-1===this.copiedUniqueIdCollection.indexOf(u)){this.getCopyData(c,!1,"\t",n),this.treeCopyContent=o>0?this.treeCopyContent+this[a]+"\n":this[a]+"\n"+this.treeCopyContent,this.copiedUniqueIdCollection.push(u),this[a]="";break}}},i.prototype.copy=function(t){e.prototype.copy.call(this,t)},i.prototype.paste=function(t,i,r){e.prototype.paste.call(this,t,i,r)},i.prototype.getModuleName=function(){return"clipboard"},i.prototype.destroy=function(){e.prototype.destroy.call(this)},i.prototype.childContentData=function(e,i,r,n){var o="uniqueID";if(e[i].hasChildRecords)for(var a=e[i].childRecords,s=0;s<a.length;s++)for(var d=0;d<e.length;d++)if(!t.isNullOrUndefined(a[s][o])&&e[d][o]===a[s][o]){if(!t.isNullOrUndefined(r[d])&&!r[d].classList.contains("e-summaryrow")){var l=[].slice.call(r[d].querySelectorAll(".e-rowcell")),p=e[d][o];-1===this.copiedUniqueIdCollection.indexOf(p)&&(this.getCopyData(l,!1,"\t",n),this.treeCopyContent+="\n"+this.copyContent,this.copyContent="",this.copiedUniqueIdCollection.push(p),this.childContentData(e,d,r,n))}break}},i}(i.Clipboard),qe=function(){function e(e){this.parent=e,this.selectedItems=[],this.selectedIndexes=[],this.filteredList=[],this.searchingRecords=[],this.addEventListener()}return e.prototype.getModuleName=function(){return"selection"},e.prototype.addEventListener=function(){this.parent.on("dataBoundArg",this.headerCheckbox,this),this.parent.on("columnCheckbox",this.columnCheckbox,this),this.parent.on("updateGridActions",this.updateGridActions,this),this.parent.grid.on("colgroup-refresh",this.headerCheckbox,this),this.parent.on("checkboxSelection",this.checkboxSelection,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("dataBoundArg",this.headerCheckbox),this.parent.off("columnCheckbox",this.columnCheckbox),this.parent.grid.off("colgroup-refresh",this.headerCheckbox),this.parent.off("checkboxSelection",this.checkboxSelection),this.parent.off("updateGridActions",this.updateGridActions))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.checkboxSelection=function(e){var t,r=i.getObject("target",e),n=i.parentsUntil(r,"e-checkbox-wrapper");if(n&&n.querySelectorAll(".e-treecheckselect").length>0){t=n.querySelector('input[type="checkbox"]');var o=[];o.push(r.closest("tr").rowIndex),this.selectCheckboxes(o),this.triggerChkChangeEvent(t,t.nextElementSibling.classList.contains("e-check"),r.closest("tr"))}else if(n&&n.querySelectorAll(".e-treeselectall").length>0&&this.parent.autoCheckHierarchy){var a=!n.querySelector(".e-frame").classList.contains("e-check")&&!n.querySelector(".e-frame").classList.contains("e-stop");this.headerSelection(a),t=n.querySelector('input[type="checkbox"]'),this.triggerChkChangeEvent(t,a,r.closest("tr"))}},e.prototype.triggerChkChangeEvent=function(e,t,i){var r=this.parent.getCurrentViewRecords()[i.rowIndex],n={checked:t,target:e,rowElement:i,rowData:e.classList.contains("e-treeselectall")?this.parent.getCheckedRecords():r};this.parent.trigger(j,n)},e.prototype.getCheckboxcolumnIndex=function(){for(var e,t,i=this.parent.stackedHeader?this.parent.columnModel:this.parent.columns,r=0;r<i.length;r++)i[r].showCheckbox&&(e=i[r].uid);for(var n=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv").length,o=0;o<n;o++){this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv")[o].getAttribute("e-mappinguid")===e&&(t=o)}return t},e.prototype.headerCheckbox=function(){if(this.columnIndex=this.getCheckboxcolumnIndex(),this.columnIndex>-1&&0===this.parent.getHeaderContent().querySelectorAll(".e-treeselectall").length){var e=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv")[this.columnIndex],i=this.parent.createElement("input",{className:"e-treeselectall",attrs:{type:"checkbox"}});(n=r.createCheckBox(this.parent.createElement,!1,{checked:!1,label:" "})).classList.add("e-hierarchycheckbox"),n.insertBefore(i.cloneNode(),n.firstChild),t.isNullOrUndefined(e)||e.insertBefore(n,e.firstChild),this.parent.autoCheckHierarchy&&this.headerSelection()}else if(this.columnIndex>-1&&this.parent.getHeaderContent().querySelectorAll(".e-treeselectall").length>0){var n,o=(n=this.parent.getHeaderContent().querySelectorAll(".e-checkbox-wrapper")[0]).querySelector(".e-frame").classList.contains("e-check");this.parent.autoCheckHierarchy&&o&&this.headerSelection(o)}},e.prototype.renderColumnCheckbox=function(e){var i=this.parent.createElement("input",{className:"e-treecheckselect",attrs:{type:"checkbox","aria-label":"checkbox"}}),n=e.data;e.cell.classList.add("e-treegridcheckbox"),e.cell.setAttribute("aria-label","checkbox");var o=!t.isNullOrUndefined(n.checkboxState)&&"uncheck"!==n.checkboxState,a=r.createCheckBox(this.parent.createElement,!1,{checked:o,label:" "});if(a.classList.add("e-hierarchycheckbox"),this.parent.allowTextWrap&&(a.querySelector(".e-frame").style.width="18px"),"indeterminate"===n.checkboxState){var s=a.querySelectorAll(".e-frame")[0];t.removeClass([s],["e-check","e-stop","e-uncheck"]),a.querySelector(".e-frame").classList.add("e-stop")}return a.insertBefore(i.cloneNode(),a.firstChild),a},e.prototype.columnCheckbox=function(e){var i=this.renderColumnCheckbox(e),r=e.cell.querySelector(".e-treecolumn-container");if(t.isNullOrUndefined(r)){var n=this.parent.createElement("span",{className:"e-treecheckbox"}),o=e.cell.innerHTML;e.cell.innerHTML="",n.innerHTML=o;var a=this.parent.createElement("div",{className:"e-treecheckbox-container"});a.appendChild(i),a.appendChild(n),e.cell.appendChild(a)}else e.cell.querySelector(".e-hierarchycheckbox")||r.insertBefore(i,r.querySelectorAll(".e-treecell")[0])},e.prototype.selectCheckboxes=function(e){for(var t=0;t<e.length;t++){var i=this.parent.getCurrentViewRecords()[e[t]],r=y(this.parent,i.uniqueID),n="uncheck"===(i=r).checkboxState?"check":"uncheck";i.checkboxState=n;for(var o=Object.keys(i),a=0;a<o.length;a++)Object.prototype.hasOwnProperty.call(r,o[a])&&(r[o[a]]=i[o[a]]);this.traverSelection(i,n,!1),this.parent.autoCheckHierarchy&&this.headerSelection()}},e.prototype.traverSelection=function(e,i,r){var n=0;if(this.updateSelectedItems(e,i),!r&&e.parentItem&&this.parent.autoCheckHierarchy&&this.updateParentSelection(e.parentItem),e.childRecords&&this.parent.autoCheckHierarchy){var o=e.childRecords;!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(o=this.getFilteredChildRecords(o)),n=o.length;for(var a=0;a<n;a++)o[a].isSummaryRow||(o[a].hasChildRecords?this.traverSelection(o[a],i,!0):this.updateSelectedItems(o[a],i))}},e.prototype.getFilteredChildRecords=function(e){var t=this;return e.filter(function(e){return t.parent.filterModule.filteredResult.indexOf(e)>-1})},e.prototype.updateParentSelection=function(e){var i=0,r=[],n=y(this.parent,e.uniqueID);n&&n.childRecords&&(r=n.childRecords),!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(r=this.getFilteredChildRecords(r)),i=r&&r.length;var o=0,a=0;if(!t.isNullOrUndefined(n)){for(var s=0;s<r.length;s++){var d=y(this.parent,r[s].uniqueID);t.isNullOrUndefined(d)||("indeterminate"===d.checkboxState?o++:"check"===d.checkboxState&&a++)}o>0||a>0&&a!==i?n.checkboxState="indeterminate":(0!==a||n.hasFilteredChildRecords&&!t.isNullOrUndefined(n.hasFilteredChildRecords)||t.isNullOrUndefined(this.parent.dataResults.actionArgs)||"searching"!==this.parent.dataResults.actionArgs.requestType&&"filtering"!==this.parent.dataResults.actionArgs.requestType||"check"!==n.checkboxState)&&(0===a&&0===o||0===a&&n.hasFilteredChildRecords&&!t.isNullOrUndefined(this.parent.dataResults.actionArgs)&&("searching"===this.parent.dataResults.actionArgs.requestType||"filtering"===this.parent.dataResults.actionArgs.requestType)&&"check"===n.checkboxState)?n.checkboxState="uncheck":n.checkboxState="check",this.updateSelectedItems(n,n.checkboxState),n.parentItem&&this.updateParentSelection(n.parentItem)}},e.prototype.headerSelection=function(e){var i=this,r=0,n=!1;if(!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0){var o=this.parent.filterModule.filteredResult;0===this.filteredList.length&&(this.filteredList=o),this.parent.grid.searchSettings.key.length?this.searchingRecords=o:this.filteredList!==o?(this.filteredList=o,n=!0):n=!1}this.filteredList.length>0&&(this.parent.filterSettings.columns.length||!this.filteredList.length||this.parent.grid.searchSettings.key.length||(this.filteredList=[]),this.searchingRecords.length&&!t.isNullOrUndefined(e)&&(this.filteredList=this.searchingRecords));var s;if(s=0===this.parent.filterModule.filteredResult.length&&0===this.parent.getCurrentViewRecords().length&&this.parent.filterSettings.columns.length>0?this.filteredList:!t.isNullOrUndefined(this.parent.filterModule)&&this.filteredList.length>0?this.filteredList:this.parent.flatData,s=a(this.parent)?this.parent.getCurrentViewRecords():s,!t.isNullOrUndefined(e))for(var d=0;d<s.length;d++)if(e){if("check"===s[d].checkboxState)continue;if(n)continue;s[d].checkboxState="check",this.updateSelectedItems(s[d],s[d].checkboxState)}else this.selectedItems.indexOf(s[d])>-1&&(s[d].checkboxState="uncheck",this.updateSelectedItems(s[d],s[d].checkboxState),this.parent.autoCheckHierarchy&&this.updateParentSelection(s[d]));!1===e&&this.parent.enableVirtualization&&(this.selectedItems=[],this.selectedIndexes=[],s.filter(function(e){e.checkboxState="uncheck",i.updateSelectedItems(e,e.checkboxState)})),r=this.selectedItems.length;var l=this.parent.getHeaderContent().querySelectorAll(".e-frame")[0];r>0&&s.length>0?r===s.length||e?(t.removeClass([l],["e-stop"]),l.classList.add("e-check")):(t.removeClass([l],["e-check"]),l.classList.add("e-stop")):t.removeClass([l],["e-check","e-stop"])},e.prototype.updateSelectedItems=function(e,i){var r,n,o=this.parent.getCurrentViewRecords().filter(function(t){return t.uniqueID===e.uniqueID}),a=this.parent.getCurrentViewRecords().indexOf(o[0]),s=y(this.parent,e.uniqueID),d=this.parent.getRows()[a];if(a>-1){var l=void 0;(this.parent.frozenRows||this.parent.getFrozenColumns())&&(l=this.parent.getMovableDataRows()[a]),n=d.querySelectorAll(".e-frame")[0]?d.querySelectorAll(".e-frame")[0]:l.querySelectorAll(".e-frame")[0],t.isNullOrUndefined(n)||t.removeClass([n],["e-check","e-stop","e-uncheck"])}if(r=s,t.isNullOrUndefined(r)&&(r=e),r.checkboxState=i,"check"===i&&t.isNullOrUndefined(e.isSummaryRow))-1!==a&&-1===this.selectedIndexes.indexOf(a)&&this.selectedIndexes.push(a),-1===this.selectedItems.indexOf(r)&&-1!==a&&!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.selectedItems.push(r),-1===this.selectedItems.indexOf(r)&&this.parent.enableVirtualization&&!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.selectedItems.push(r),-1!==this.selectedItems.indexOf(r)||t.isNullOrUndefined(this.parent.filterModule)||0!==this.parent.filterModule.filteredResult.length||this.selectedItems.push(r),-1===this.selectedItems.indexOf(r)&&t.isNullOrUndefined(this.parent.filterModule)&&this.selectedItems.push(r);else if(("uncheck"===i||"indeterminate"===i)&&t.isNullOrUndefined(e.isSummaryRow)){var p=this.selectedItems.indexOf(r);if(-1!==p&&this.selectedItems.splice(p,1),-1!==this.selectedIndexes.indexOf(a)){var h=this.selectedIndexes.indexOf(a);this.selectedIndexes.splice(h,1)}}var c="indeterminate"===i?"e-stop":"e-"+i;if(a>-1&&!t.isNullOrUndefined(n)){n.classList.add(c);var u="check"===i?"checked":"uncheck"===i?"unchecked":"mixed";d.querySelector(".e-treecheckselect").setAttribute("aria-checked","check"===i?"true":"uncheck"===i?"false":"mixed"),d.querySelector(".e-frame").setAttribute("title","checkbox"+u)}},e.prototype.updateGridActions=function(e){var i,r,n=this,o=e.requestType;if(d(this.parent)&&this.parent.autoCheckHierarchy)if("sorting"===o||"paging"===o){var s=this.parent.grid.getRows();r=(i=this.parent.getCurrentViewRecords()).length,this.selectedIndexes=[];for(var l=0;l<r;l++)s[l].classList.contains("e-summaryrow")||this.updateSelectedItems(i[l],i[l].checkboxState)}else if("delete"===o||"add"===e.action){var p=[];"delete"===o?p=e.data:p.push(e.data);for(l=0;l<p.length;l++){if("delete"===o){var h=this.parent.flatData.indexOf(p[l]),u=this.selectedIndexes.indexOf(h);this.selectedIndexes.splice(u,1),this.updateSelectedItems(p[l],"uncheck")}t.isNullOrUndefined(p[l].parentItem)||this.updateParentSelection(p[l].parentItem)}}else"add"===e.requestType&&this.parent.autoCheckHierarchy?e.data.checkboxState="uncheck":("filtering"===o||"searching"===o||"refresh"===o&&!a(this.parent))&&(this.selectedItems=[],this.selectedIndexes=[],(i=!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0?this.parent.getCurrentViewRecords():this.parent.flatData).forEach(function(e){if(n.parent.enableVirtualization){e.hasChildRecords&&e.childRecords.length>0?n.updateParentSelection(e):n.updateSelectedItems(e,e.checkboxState);var i=c(e);i=n.getFilteredChildRecords(i);for(var r=0;r<i.length;r++)i[r].hasChildRecords?n.updateParentSelection(i[r]):i[r].hasChildRecords||t.isNullOrUndefined(i[r])||n.updateSelectedItems(i[r],i[r].checkboxState)}else e.hasChildRecords?n.updateParentSelection(e):n.updateSelectedItems(e,e.checkboxState)}),this.headerSelection())},e.prototype.getCheckedrecords=function(){return this.selectedItems},e.prototype.getCheckedRowIndexes=function(){return this.selectedIndexes},e}(),Ve=function(){function e(e){this.parent=e,i.Grid.Inject(i.Print),this.addEventListener()}return e.prototype.getModuleName=function(){return"print"},e.prototype.addEventListener=function(){this.parent.grid.on($,this.printTreeGrid,this)},e.prototype.removeEventListener=function(){this.parent.grid.off($,this.printTreeGrid)},e.prototype.printTreeGrid=function(e){var r=i.getObject("printgrid",e),n=i.getObject("element",e);r.addEventListener(V,this.parent.grid.queryCellInfo),r.addEventListener(q,this.parent.grid.rowDataBound),r.addEventListener(B,this.parent.grid.beforeDataBound),t.addClass([n],"e-treegrid")},e.prototype.print=function(){this.parent.grid.print()},e.prototype.destroy=function(){this.removeEventListener()},e}(),Be=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Te=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Le=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Be(i,e),Te([t.Property()],i.prototype,"fields",void 0),Te([t.Property(!1)],i.prototype,"ignoreCase",void 0),Te([t.Property("contains")],i.prototype,"operator",void 0),Te([t.Property()],i.prototype,"key",void 0),Te([t.Property()],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),Fe=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ze=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},je=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Fe(i,e),ze([t.Property("Row")],i.prototype,"mode",void 0),ze([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),ze([t.Property("Single")],i.prototype,"type",void 0),ze([t.Property(!1)],i.prototype,"persistSelection",void 0),ze([t.Property("Default")],i.prototype,"checkboxMode",void 0),ze([t.Property(!1)],i.prototype,"checkboxOnly",void 0),ze([t.Property(!0)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),_e=function(){function e(e){this.parent=e,this.templateResult=null,this.parent.grid.on("template-result",this.columnTemplateResult,this),this.parent.grid.on("reactTemplateRender",this.reactTemplateRender,this)}return e.prototype.RowModifier=function(e){if(e.data){var r=e.data,n=r.parentItem;if(!t.isNullOrUndefined(r.parentItem)&&!l(this.parent)&&(!this.parent.allowPaging||"Root"===this.parent.pageSettings.pageSizeMode||a(this.parent)&&!u(this.parent))){(this.parent.initialRender&&(!(t.isNullOrUndefined(n[this.parent.expandStateMapping])||n[this.parent.expandStateMapping])||this.parent.enableCollapseAll)||!h(this.parent,e.data,this.parent.grid.getCurrentViewRecords()))&&(e.row.style.display="none")}if(a(this.parent)&&!u(this.parent)){var o=this.parent,s=this.parent.getCurrentViewRecords().filter(function(e){return t.getValue(o.idMapping,e)===t.getValue(o.parentIdMapping,r)});if(s.length>0&&!s[0].isSummaryRow){var d=s[0].expanded?"table-row":"none";e.row.setAttribute("style","display: "+d+";")}}i.getObject("isSummaryRow",e.data)&&t.addClass([e.row],"e-summaryrow"),e.row.querySelector(".e-treegridexpand")?e.row.setAttribute("aria-expanded","true"):e.row.querySelector(".e-treegridcollapse")&&e.row.setAttribute("aria-expanded","false"),this.parent.enableCollapseAll&&this.parent.initialRender&&(t.isNullOrUndefined(r.parentItem)||(e.row.style.display="none")),this.parent.trigger(q,e)}},e.prototype.cellRender=function(e){if(e.data){var r,n,o=this.parent.grid,a=e.data,s=t.isNullOrUndefined(a.filterLevel)?a.level:a.filterLevel,d=0,l=this.parent.getColumnByUid(e.column.uid),p=a.isSummaryRow,c=this.parent.getFrozenColumns();r=t.isNullOrUndefined(a.parentItem)?a.index:a.parentItem.index;if((this.parent.enableColumnVirtualization&&!this.parent.initialRender?this.parent.getVirtualColIndexByUid(e.column.uid):o.getColumnIndexByUid(e.column.uid))!==this.parent.treeColumnIndex||"add"!==e.requestType&&"rowDragAndDrop"!==e.requestType&&"delete"!==e.requestType&&!t.isNullOrUndefined(e.cell.querySelector(".e-treecell")))this.templateResult&&(this.templateResult=null);else{for(var u=t.createElement("div",{className:"e-treecolumn-container"}),g=t.createElement("span",{className:"e-icons e-none",styles:"width: 10px; display: inline-block"}),f=0;f<s;f++)d+=10,u.appendChild(g.cloneNode());var y=t.isNullOrUndefined(a.hasFilteredChildRecords)?a.hasChildRecords:a.hasFilteredChildRecords;if(y&&!t.isNullOrUndefined(a.childRecords)&&(y=!(0===a.childRecords.length)),y){t.addClass([e.cell],"e-treerowcell"),e.cell.setAttribute("aria-expanded",a.expanded?"true":"false");var m=t.createElement("span",{className:"e-icons"}),v=void 0;v=this.parent.initialRender?a.expanded&&(t.isNullOrUndefined(a[this.parent.expandStateMapping])||a[this.parent.expandStateMapping])&&!this.parent.enableCollapseAll:!(!a.expanded||!h(this.parent,a,this.parent.grid.getCurrentViewRecords())),t.addClass([m],v?"e-treegridexpand":"e-treegridcollapse"),d+=18,u.appendChild(m),g.style.width="7px",d+=7,u.appendChild(g.cloneNode())}else(s||!s&&!a.level)&&(d+=20,u.appendChild(g.cloneNode()),u.appendChild(g.cloneNode()));n=t.createElement("span",{className:"e-treecell"}),this.parent.allowTextWrap&&(n.style.width="Calc(100% - "+d+"px)"),t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level),this.updateTreeCell(e,n),u.appendChild(n),e.cell.appendChild(u)}if(o.getFrozenLeftColumnsCount()>0||o.getFrozenRightColumnsCount()>0){var w=o.getFrozenRightColumns(),R=o.getFrozenLeftColumns(),C=o.getMovableColumns();w.length>0&&w[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):R.length>0&&R[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):C.length>0&&C[0].field===e.column.field&&t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level)}else c>this.parent.treeColumnIndex&&c>0&&o.getColumnIndexByUid(e.column.uid)===c?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):c<this.parent.treeColumnIndex&&c>0&&(o.getColumnIndexByUid(e.column.uid)===c||o.getColumnIndexByUid(e.column.uid)===c-1)?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):c===this.parent.treeColumnIndex&&c>0&&o.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex-1&&t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level);if(!t.isNullOrUndefined(l)&&l.showCheckbox&&(this.parent.notify("columnCheckbox",e),this.parent.allowTextWrap)){var x=e.cell.querySelectorAll(".e-frame")[0];d+=parseInt(x.style.width,16),d+=10,(n=o.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex?e.cell.querySelector(".e-treecell"):e.cell.querySelector(".e-treecheckbox")).style.width="Calc(100% - "+d+"px)"}if(p){t.addClass([e.cell],"e-summarycell");var b=i.getObject(e.column.field,e.data);null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML=b:e.column.template?e.cell.innerHTML=null:e.cell.innerHTML=b}t.isNullOrUndefined(this.parent.rowTemplate)&&this.parent.trigger(V,e)}},e.prototype.updateTreeCell=function(e,r){var n=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex],o="templateFn",a=e.column.index;t.isNullOrUndefined(n.field)&&e.cell.setAttribute("data-colindex",a+""),n.field!==e.column.field||t.isNullOrUndefined(n.template)||(e.column.template=n.template,e.column[o]=i.templateCompiler(e.column.template),e.cell.classList.add("e-templatecell"));var s=null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML:e.cell.innerHTML;if("object"==typeof e.column.template&&this.templateResult)i.appendChildren(r,this.templateResult),this.templateResult=null,e.cell.innerHTML="";else if(e.cell.classList.contains("e-templatecell")){var d=e.cell.children.length,l=this.parent.element.id+e.column.uid;if(n.field!==e.column.field||t.isNullOrUndefined(n.template))for(;0<d;d=e.cell.children.length)r.appendChild(e.cell.children[0]);else{var p="portals";if(this.parent.isReact&&"string"!=typeof e.column.template)e.column[o](e.data,this.parent,"template",l,null,null,r),t.isNullOrUndefined(this.parent.grid[p])&&(this.parent.grid[p]=this.parent[p]),this.parent.notify("renderReactTemplate",this.parent[p]),this.parent.renderReactTemplates();else{var h=e.column[o](i.extend({index:""},e.data),this.parent,"template",l,this.parent.isStringTemplate);i.appendChildren(r,h)}delete e.column.template,delete e.column[o],e.cell.innerHTML=""}}else r.innerHTML=s,e.cell.innerHTML=""},e.prototype.refreshReactColumnTemplateByUid=function(e){var r=this;this.parent.isReact&&this.parent.clearTemplate(["columnTemplate"],void 0,function(){for(var n=r.parent.grid.getRowsObject(),o=r.parent.grid.getIndentCount(),a=r.parent.grid.getNormalizedColumnIndex(e),s=0;s<n.length;s++)if(n[s].isDataRow&&!t.isNullOrUndefined(n[s].index)){var d=n[s].cells[a],l=new i.CellRenderer(r.parent.grid,r.parent.grid.serviceLocator),p=r.parent.getCellFromIndex(n[s].index,a-o);l.refreshTD(p,d,n[s].data,{index:n[s].index});var h=r.parent.getRows()[s].cells[a];r.cellRender({data:n[s].data,cell:h,column:d.column})}})},e.prototype.columnTemplateResult=function(e){this.templateResult=e.template},e.prototype.reactTemplateRender=function(e){this.parent.portals=e,this.parent.notify("renderReactTemplate",this.parent.portals),this.parent.renderReactTemplates()},e.prototype.destroy=function(){this.parent.grid.off("template-result",this.columnTemplateResult),this.parent.grid.off("reactTemplateRender",this.reactTemplateRender)},e}(),He=function(){function e(e){this.addedRecords="addedRecords",this.parent=e,this.parentItems=[],this.taskIds=[],this.hierarchyData=[],this.storedIndex=-1,this.sortedData=[],this.isSortAction=!1,this.addEventListener(),this.dataResults={},this.isSelfReference=!t.isNullOrUndefined(this.parent.parentIdMapping)}return e.prototype.addEventListener=function(){this.parent.on("updateRemoteLevel",this.updateParentRemoteData,this),this.parent.grid.on("sorting-begin",this.beginSorting,this),this.parent.on("updateAction",this.updateData,this),this.parent.on(Y,this.collectExpandingRecs,this),this.parent.on("dataProcessor",this.dataProcessor,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Y,this.collectExpandingRecs),this.parent.off("updateRemoteLevel",this.updateParentRemoteData),this.parent.off("updateAction",this.updateData),this.parent.off("dataProcessor",this.dataProcessor),this.parent.grid.off("sorting-begin",this.beginSorting))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.isRemote=function(){return this.parent.dataSource instanceof n.DataManager},e.prototype.convertToFlatData=function(e){var r=this;if(this.parent.flatData=0!==Object.keys(e).length||this.parent.dataSource instanceof n.DataManager?[]:this.parent.dataSource,this.parent.parentData=[],a(this.parent)&&!u(this.parent)&&e instanceof n.DataManager&&!(e instanceof Array)){var o=this.parent.dataSource;if(this.parent.parentIdMapping){if(this.parent.query=t.isNullOrUndefined(this.parent.query)?new n.Query:this.parent.query,this.parent.parentIdMapping){var s=this.parent.query.params.filter(function(e){return"IdMapping"===e.key});this.parent.initialRender&&!s.length&&(this.parent.query.where(this.parent.parentIdMapping,"equal",null),this.parent.query.addParams("IdMapping",this.parent.idMapping))}if(!this.parent.hasChildMapping){var d=this.parent.query.clone();d.queries=[],(d=d.select([this.parent.parentIdMapping])).isCountRequired=!0,o.executeQuery(d).then(function(e){r.parentItems=n.DataUtil.distinct(e.result,r.parent.parentIdMapping,!1);0===i.getObject("dataSource.requests",r.parent).filter(function(e){return"OK"!==e.httpRequest.statusText}).length&&(t.setValue("grid.contentModule.isLoaded",!0,r.parent),t.isNullOrUndefined(r.zerothLevelData)||(t.setValue("cancel",!1,r.zerothLevelData),t.getValue("grid.renderModule",r.parent).dataManagerSuccess(r.zerothLevelData),r.zerothLevelData=null),r.parent.grid.hideSpinner())})}}}else e instanceof Array&&this.convertJSONData(e)},e.prototype.convertJSONData=function(e){if(this.hierarchyData=[],this.taskIds=[],this.parent.idMapping)for(var i=Object.keys(e),r=0;r<i.length;r++){var o=e[r];this.hierarchyData.push(t.extend({},o)),t.isNullOrUndefined(o[this.parent.idMapping])||this.taskIds.push(o[this.parent.idMapping])}else this.hierarchyData=e;if(this.isSelfReference){var a=[],s=new n.DataManager(this.hierarchyData).executeLocal((new n.Query).group(this.parent.parentIdMapping));for(r=0;r<s.length;r++){var d=s[r],l=this.taskIds.indexOf(d.key);if(!t.isNullOrUndefined(d.key)&&l>-1){var p=d.items;this.hierarchyData[l][this.parent.childMapping]=p}else a.push.apply(a,d.items)}this.hierarchyData=this.selfReferenceUpdate(a)}if(Object.keys(this.hierarchyData).length)this.createRecords(this.hierarchyData);else{var h=!(this.parent.dataSource instanceof n.DataManager)&&this.parent.isGantt;this.parent.flatData=h?this.parent.dataSource:[]}this.storedIndex=-1},e.prototype.selfReferenceUpdate=function(e){for(var t=[];this.hierarchyData.length>0&&e.length>0;){var i=e.indexOf(this.hierarchyData[0]);-1===i?this.hierarchyData.shift():(t.push(this.hierarchyData.shift()),e.splice(i,1))}return t},e.prototype.updateParentRemoteData=function(e){var r=e.result;if(this.parent.hasChildMapping||this.parentItems.length||this.parent.loadChildOnDemand)if(this.parent.loadChildOnDemand)t.isNullOrUndefined(r)||this.parent.loadChildOnDemand&&s(this.parent)&&!t.isNullOrUndefined(this.parent.dataResults.expandRecord)||this.convertToFlatData(r);else for(var n=0;n<r.length;n++)s(this.parent)&&r[n].hasChildRecords&&this.parent.initialRender&&(r[n].expanded=!1),t.isNullOrUndefined(r[n].index)&&(r[n].taskData=t.extend({},r[n]),r[n].uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r[n].uniqueID,r[n],this.parent),r[n].level=0,r[n].index=Math.ceil(1e3*Math.random()),(r[n][this.parent.hasChildMapping]||-1!==this.parentItems.indexOf(r[n][this.parent.idMapping]))&&(r[n].hasChildRecords=!0),r[n].checkboxState="uncheck");else this.zerothLevelData=e,t.setValue("cancel",!0,e);e.result=this.parent.loadChildOnDemand?this.parent.flatData:r,this.parent.notify("updateResults",e)},e.prototype.collectExpandingRecs=function(e,i){var r=this.parent.getRows();if(this.parent.rowTemplate){var n=this.parent.getContentTable().rows;r=[].slice.call(n)}var o;if(e.rows.length>0){i||(e.record.expanded=!0);for(var a=0;a<e.rows.length;a++){if(e.rows[a].style.display="table-row",this.parent.loadChildOnDemand){var s=e.rows[a].getElementsByClassName("e-treegridcollapse")[0];o=this.parent.rowTemplate?this.parent.grid.getCurrentViewRecords()[e.rows[a].rowIndex]:this.parent.grid.getRowObjectFromUID(e.rows[a].getAttribute("data-Uid")).data,!t.isNullOrUndefined(s)&&o.expanded&&(t.addClass([s],"e-treegridexpand"),t.removeClass([s],"e-treegridcollapse"));var d=[];(d=r.filter(function(e){return e.querySelector(".e-gridrowindex"+o.index+"level"+(o.level+1))})).length&&o.expanded&&this.collectExpandingRecs({record:o,rows:d,parentRow:e.parentRow},!0)}var l=e.rows[a].querySelector(".e-detailrowcollapse");t.isNullOrUndefined(l)||this.parent.grid.detailRowModule.expand(l)}}else this.fetchRemoteChildData({record:e.record,rows:e.rows,parentRow:e.parentRow})},e.prototype.fetchRemoteChildData=function(e){var r=this,a={row:e.parentRow,data:e.record},s=this.parent.dataSource,d=this.parent.grid.getDataModule().generateQuery(),l=d.queries.filter(function(e){return"onPage"!==e.fn&&"onWhere"!==e.fn});d.queries=l,d.isCountRequired=!0,d.where(this.parent.parentIdMapping,"equal",e.record[this.parent.idMapping]),o.showSpinner(this.parent.element),s.executeQuery(d).then(function(s){var d=r.parent.grid.currentViewData.slice(),l=d.indexOf(e.record);-1===l&&r.parent.grid.getRowsObject().forEach(function(t){t.data.uniqueID===e.record.uniqueID&&(l=t.index)});var p=i.getObject("actual.nextLevel",s),h=s.result;e.record.childRecords=h;for(var c=0;c<h.length;c++){h[c].taskData=t.extend({},h[c]),h[c].level=e.record.level+1,h[c].index=Math.ceil(1e3*Math.random());var u=t.extend({},e.record);delete u.childRecords,h[c].parentItem=u,h[c].parentUniqueID=e.record.uniqueID,h[c].uniqueID=i.getUid(r.parent.element.id+"_data_"),h[c].checkboxState="uncheck",t.setValue("uniqueIDCollection."+h[c].uniqueID,h[c],r.parent),!h[c][r.parent.hasChildMapping]&&-1===r.parentItems.indexOf(h[c][r.parent.idMapping])||p&&!p[c]||(h[c].hasChildRecords=!0,h[c].expanded=!1),d.splice(l+c+1,0,h[c])}if(t.setValue("result",d,s),t.setValue("action","beforecontentrender",s),r.parent.trigger(F,s),o.hideSpinner(r.parent.element),r.parent.grid.aggregates.length>0&&!r.parent.enableVirtualization){var g=i.getObject("query",s);if(t.isNullOrUndefined(g)&&(g=t.getValue("grid.renderModule.data",r.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(g)){var f=g.queries.filter(function(e){return"onAggregates"===e.fn});s.result=r.parent.summaryModule.calculateSummaryValue(f,s.result,!0)}}s.count=r.parent.grid.pageSettings.totalRecordsCount;var y={};r.parent.enableVirtualization&&r.remoteVirtualAction(y);var m={index:l,childData:h};r.parent.enableInfiniteScrolling?r.parent.notify("infinite-remote-expand",m):t.getValue("grid.renderModule",r.parent).dataManagerSuccess(s,y),r.parent.trigger(K,a)})},e.prototype.remoteVirtualAction=function(e){e.requestType="refresh",t.setValue("isExpandCollapse",!0,e);var i=t.getValue("grid.contentModule",this.parent),r=t.getValue("currentInfo",i),n=t.getValue("prevInfo",i);r.loadNext&&this.parent.grid.pageSettings.currentPage===r.nextInfo.page&&(this.parent.grid.pageSettings.currentPage=n.page)},e.prototype.beginSorting=function(){this.isSortAction=!0},e.prototype.createRecords=function(e,r){for(var n=[],o=0,a=Object.keys(e).length;o<a;o++){var d=t.extend({},e[o]);d.taskData=e[o];var l=0;if(this.storedIndex++,Object.prototype.hasOwnProperty.call(d,"index")||(d.index=this.storedIndex),(!t.isNullOrUndefined(d[this.parent.childMapping])&&!s(this.parent)||d[this.parent.hasChildMapping]&&s(this.parent))&&(d.hasChildRecords=!0,this.parent.enableCollapseAll||!t.isNullOrUndefined(this.parent.dataStateChange)&&t.isNullOrUndefined(d[this.parent.childMapping])?d.expanded=!1:d.expanded=!!t.isNullOrUndefined(d[this.parent.expandStateMapping])||d[this.parent.expandStateMapping]),Object.prototype.hasOwnProperty.call(d,"index")||(d.index=(d.hasChildRecords,this.storedIndex)),this.isSelfReference&&t.isNullOrUndefined(d[this.parent.parentIdMapping])&&this.parent.parentData.push(d),d.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+d.uniqueID,d,this.parent),!t.isNullOrUndefined(r)){var p=t.extend({},r);delete p.childRecords,delete p[this.parent.childMapping],this.isSelfReference&&delete p.taskData[this.parent.childMapping],d.parentItem=p,d.parentUniqueID=p.uniqueID,l=r.level+1}if(Object.prototype.hasOwnProperty.call(d,"level")||(d.level=l),d.checkboxState="uncheck",(t.isNullOrUndefined(d[this.parent.parentIdMapping])||d.parentItem)&&(this.parent.flatData.push(d),this.parent.infiniteScrollData.push(d)),this.isSelfReference||0!==d.level||this.parent.parentData.push(d),!t.isNullOrUndefined(d[this.parent.childMapping]&&d[this.parent.childMapping].length)){var h=this.createRecords(d[this.parent.childMapping],d);d.childRecords=h}n.push(d)}return n},e.prototype.dataProcessor=function(e){var r,o=i.getObject("isExport",e),a=i.getObject("expresults",e),d=i.getObject("exportType",e),l=i.getObject("isPrinting",e),p=i.getObject("actionArgs",e),h=i.getObject("requestType",e),c=i.getObject("data",e),g=i.getObject("action",e),f=p,y=this.parent.getPrimaryKeyFieldNames()[0],m=i.getObject("data",f);t.isNullOrUndefined(f)||t.isNullOrUndefined(f.action)||"add"!==f.action||t.isNullOrUndefined(f.data)||!t.isNullOrUndefined(f.data[y])||(f.data[y]=e.result[f.index][y],m.taskData[y]=e.result[f.index][y]),(!t.isNullOrUndefined(p)&&Object.keys(p).length||"save"===h)&&(h=h||p.requestType,c=c||i.getObject("data",p),g=g||i.getObject("action",p),"Batch"===this.parent.editSettings.mode&&(this.batchChanges=this.parent.grid.editModule.getBatchChanges()),this.parent.isLocalData&&this.updateAction(c,g,h));var v,w,R=(r=o&&!t.isNullOrUndefined(a)?a:s(this.parent)?t.getValue("result",this.parent.grid.dataSource):this.parent.grid.dataSource)instanceof n.DataManager?r.dataSource.json:r,C=s(this.parent)?t.getValue("count",this.parent.dataSource):R.length,x=new n.Query,b=i.getObject("query",e);if(t.isNullOrUndefined(b)||(v=b.queries.filter(function(e){return"onWhere"===e.fn}),w=b.queries.filter(function(e){return"onSearch"===e.fn})),this.parent.grid.allowFiltering&&this.parent.grid.filterSettings.columns.length||this.parent.grid.searchSettings.key.length>0||!t.isNullOrUndefined(b)&&(v.length||w.length)&&this.parent.isLocalData){t.isNullOrUndefined(b)&&(b=new n.Query,b=t.getValue("grid.renderModule.data",this.parent).filterQuery(b),b=t.getValue("grid.renderModule.data",this.parent).searchQuery(b));var S=b.queries.filter(function(e){return"onWhere"===e.fn}),I=b.queries.filter(function(e){return"onSearch"===e.fn});x.queries=S.concat(I);var D=new n.DataManager(R).executeLocal(x);if(this.parent.notify("updateFilterRecs",{data:D}),R=this.dataResults.result,this.dataResults.result=null,this.parent.grid.aggregates.length>0){var M=i.getObject("query",e);if(t.isNullOrUndefined(b)&&(b=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(M)){var O=M.queries.filter(function(e){return"onAggregates"===e.fn});R=this.parent.summaryModule.calculateSummaryValue(O,R,!0)}}}if(this.parent.grid.aggregates.length&&0===this.parent.grid.sortSettings.columns.length&&0===this.parent.grid.filterSettings.columns.length&&!this.parent.grid.searchSettings.key.length){var P=i.getObject("query",e);t.isNullOrUndefined(P)&&(P=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query));O=P.queries.filter(function(e){return"onAggregates"===e.fn});R=this.parent.summaryModule.calculateSummaryValue(O,this.parent.flatData,!0)}if(this.parent.grid.sortSettings.columns.length>0||this.isSortAction){this.isSortAction=!1;for(var E=this.parent.parentData,A=(M=i.getObject("query",e),new n.Query),N=this.parent.grid.sortSettings.columns.length-1;N>=0;N--){var k=this.parent.grid.renderModule.data.getColumnByField(this.parent.grid.sortSettings.columns[N].field),U=k.sortComparer&&u(this.parent)?k.sortComparer.bind(k):this.parent.grid.sortSettings.columns[N].direction;A.sortBy(this.parent.grid.sortSettings.columns[N].field,U)}var q=new n.DataManager(E).executeLocal(A);if(this.parent.allowRowDragAndDrop&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var V=q.indexOf(this.parent.rowDragAndDropModule.draggedRecord);q.splice(V,1);var B=q.indexOf(this.parent.rowDragAndDropModule.droppedRecord);this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"topSegment"===this.parent.rowDragAndDropModule.dropPosition?q.splice(B,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&q.splice(B+1,0,this.parent.rowDragAndDropModule.draggedRecord)}var T={modifiedData:q,filteredData:R,srtQry:A};if(this.parent.notify("createSort",T),R=T.modifiedData,this.dataResults.result=null,this.sortedData=R,this.parent.notify("updateModel",{}),this.parent.grid.aggregates.length>0&&!t.isNullOrUndefined(M)){O=i.getObject("query",e).queries.filter(function(e){return"onAggregates"===e.fn});R=this.parent.summaryModule.calculateSummaryValue(O,this.sortedData,!1)}}C=s(this.parent)?t.getValue("count",this.parent.dataSource):R.length;var L=this.paging(R,C,o,l,d,e);R=L.result,C=L.count,e.result=R,e.count=C,this.parent.notify("updateResults",e)},e.prototype.paging=function(e,i,r,n,o,a){if(!this.parent.allowPaging||r&&"CurrentPage"!==o||n&&"CurrentPage"!==this.parent.printMode){if((this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)&&(!r||"CurrentPage"===o)&&"save"!==t.getValue("requestType",a)){var d=this.parent.enableInfiniteScrolling?a:t.getValue("actionArgs",a);this.parent.notify(X,{result:e,count:i,actionArgs:d}),e=this.dataResults.result,i=this.dataResults.count}}else this.parent.notify(X,{result:e,count:i}),e=this.dataResults.result,i=s(this.parent)?t.getValue("count",this.parent.dataSource):this.dataResults.count;var l="isCollapsedStatePersist";if((!0===n||a.isPdfExport&&(t.isNullOrUndefined(a[l])||a[l]))&&"AllPages"===this.parent.printMode){for(var p=[],c=0;c<e.length;c++){h(this.parent,e[c],this.parent.parentData)&&p.push(e[c])}i=(e=p).length}return{result:e,count:i}},e.prototype.updateData=function(e){this.dataResults=e},e.prototype.updateAction=function(e,t,i){"delete"!==i&&"save"!==i||this.parent.notify(te,{value:e,action:t||i}),"batchsave"===i&&"Batch"===this.parent.editSettings.mode&&this.parent.notify(ge,{})},e}();!function(e){e[e.Add=0]="Add",e[e.Edit=1]="Edit",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e[e.Cancel=4]="Cancel",e[e.Search=5]="Search",e[e.ExpandAll=6]="ExpandAll",e[e.CollapseAll=7]="CollapseAll",e[e.ExcelExport=8]="ExcelExport",e[e.PdfExport=9]="PdfExport",e[e.CsvExport=10]="CsvExport",e[e.Print=11]="Print",e[e.RowIndent=12]="RowIndent",e[e.RowOutdent=13]="RowOutdent"}(e.ToolbarItem||(e.ToolbarItem={})),function(e){e[e.AutoFit=0]="AutoFit",e[e.AutoFitAll=1]="AutoFitAll",e[e.SortAscending=2]="SortAscending",e[e.SortDescending=3]="SortDescending",e[e.Edit=4]="Edit",e[e.Delete=5]="Delete",e[e.Save=6]="Save",e[e.Cancel=7]="Cancel",e[e.PdfExport=8]="PdfExport",e[e.ExcelExport=9]="ExcelExport",e[e.CsvExport=10]="CsvExport",e[e.FirstPage=11]="FirstPage",e[e.PrevPage=12]="PrevPage",e[e.LastPage=13]="LastPage",e[e.NextPage=14]="NextPage",e[e.AddRow=15]="AddRow",e[e.RowIndent=16]="RowIndent",e[e.RowOutdent=17]="RowOutdent"}(e.ContextMenuItems||(e.ContextMenuItems={}));var Ge=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qe=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ge(i,e),Qe([t.Property(12)],i.prototype,"pageSize",void 0),Qe([t.Property(8)],i.prototype,"pageCount",void 0),Qe([t.Property(1)],i.prototype,"currentPage",void 0),Qe([t.Property()],i.prototype,"totalRecordsCount",void 0),Qe([t.Property(!1)],i.prototype,"enableQueryString",void 0),Qe([t.Property(!1)],i.prototype,"pageSizes",void 0),Qe([t.Property(null)],i.prototype,"template",void 0),Qe([t.Property("All")],i.prototype,"pageSizeMode",void 0),i}(t.ChildProperty),We=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ye=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Je=function(e){function r(){var i=null!==e&&e.apply(this,arguments)||this;return i.intl=new t.Internationalization,i.templateFn={},i}return We(r,e),r.prototype.setFormatter=function(e){this.format&&(this.format.skeleton||this.format.format)&&(this.formatFn=this.getFormatFunction(this.format))},r.prototype.getFormatFunction=function(e){return e.type?this.intl.getDateFormat(e):this.intl.getNumberFormat(e)},r.prototype.getFormatter=function(){return this.formatFn},r.prototype.setTemplate=function(e){void 0===e&&(e={}),void 0!==this.footerTemplate&&(this.templateFn[t.getEnumValue(i.CellType,i.CellType.Summary)]={fn:t.compile(this.footerTemplate,e),property:"footerTemplate"})},r.prototype.getTemplate=function(e){return this.templateFn[t.getEnumValue(i.CellType,e)]},r.prototype.setPropertiesSilent=function(e){this.setProperties(e,!0)},Ye([t.Property()],r.prototype,"type",void 0),Ye([t.Property()],r.prototype,"footerTemplate",void 0),Ye([t.Property()],r.prototype,"field",void 0),Ye([t.Property()],r.prototype,"format",void 0),Ye([t.Property()],r.prototype,"columnName",void 0),Ye([t.Property()],r.prototype,"customAggregate",void 0),r}(t.ChildProperty),Xe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return We(i,e),Ye([t.Collection([],Je)],i.prototype,"columns",void 0),Ye([t.Property(!0)],i.prototype,"showChildSummary",void 0),i}(t.ChildProperty),$e=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ze=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},et=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return $e(i,e),Ze([t.Property(!1)],i.prototype,"allowAdding",void 0),Ze([t.Property(!1)],i.prototype,"allowEditing",void 0),Ze([t.Property(!1)],i.prototype,"allowDeleting",void 0),Ze([t.Property("Cell")],i.prototype,"mode",void 0),Ze([t.Property("Top")],i.prototype,"newRowPosition",void 0),Ze([t.Property(!0)],i.prototype,"allowEditOnDblClick",void 0),Ze([t.Property(!0)],i.prototype,"showConfirmDialog",void 0),Ze([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),Ze([t.Property("")],i.prototype,"template",void 0),Ze([t.Property({})],i.prototype,"dialog",void 0),Ze([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),tt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),it=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},rt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return tt(i,e),it([t.Property()],i.prototype,"field",void 0),it([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),nt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return tt(i,e),it([t.Collection([],rt)],i.prototype,"columns",void 0),it([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),ot=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),at=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},st=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ot(i,e),at([t.Property(!1)],i.prototype,"enableCache",void 0),at([t.Property(3)],i.prototype,"maxBlocks",void 0),at([t.Property(3)],i.prototype,"initialBlocks",void 0),i}(t.ChildProperty),dt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),lt=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},pt=function(r){function d(e,n){var o=r.call(this,e,n)||this;o.dataResults={},o.uniqueIDCollection={},o.uniqueIDFilterCollection={},o.changedRecords="changedRecords",o.deletedRecords="deletedRecords",o.addedRecords="addedRecords",o.indentOutdentAction="indentOutdentAction",o.modifiedRecords=[],o.stackedHeader=!1,o.objectEqualityChecker=function(e,t){if(e){for(var i=Object.keys(e),r=!0,n=["Children","childRecords","taskData","uniqueID","parentItem","parentUniqueID","index"],o=0;o<i.length;o++)if(e[i[o]]!==t[i[o]]&&-1===n.indexOf(i[o])){if(!(e[i[o]]instanceof Date&&t[i[o]]instanceof Date)||e[i[o]].getTime()!==t[i[o]].getTime()){r=!1;break}}return r}return!1},l.Inject(qe),t.setValue("mergePersistData",o.mergePersistTreeGridData,o);return t.isNullOrUndefined(o.injectedModules.Logger)||i.Grid.Inject(i.Logger),o.grid=new i.Grid,o}dt(d,r),l=d,d.prototype.excelExport=function(e,t,i,r){return this.excelExportModule.Map(e,t,i,r,!1)},d.prototype.csvExport=function(e,t,i,r){return this.excelExportModule.Map(e,t,i,r,!0)},d.prototype.pdfExport=function(e,t,i,r){return this.pdfExportModule.Map(e,t,i,r)},d.prototype.getModuleName=function(){return"treegrid"},d.prototype.preRender=function(){this.TreeGridLocale(),this.initProperties(),this.defaultLocale={Above:"Above",Below:"Below",Child:"Child",AddRow:"Add Row",ExpandAll:"Expand All",CollapseAll:"Collapse All",RowIndent:"Indent",RowOutdent:"Outdent"},this.l10n=new t.L10n("treegrid",this.defaultLocale,this.locale),this.isSelfReference&&t.isNullOrUndefined(this.childMapping)&&(this.childMapping="Children")},d.prototype.sortByColumn=function(e,t,i){this.sortModule&&this.sortModule.sortColumn(e,t,i)},d.prototype.clearSorting=function(){this.sortModule&&this.sortModule.clearSorting()},d.prototype.removeSortColumn=function(e){this.sortModule&&this.sortModule.removeSortColumn(e)},d.prototype.search=function(e){this.grid.search(e)},d.prototype.autoFitColumns=function(e){this.resizeModule.autoFitColumns(e),this.updateColumnModel()},d.prototype.reorderColumns=function(e,t){this.grid.reorderColumns(e,t)},d.prototype.TreeGridLocale=function(){var e=t.L10n.locale,r={};t.setValue(this.locale,{},r);var n;n={},n=i.getObject(this.locale,e);var o;o={},o=i.getObject(this.getModuleName(),n),t.setValue("grid",o,i.getObject(this.locale,r)),t.L10n.load(r)},d.prototype.print=function(){this.printModule.print()},d.prototype.treeGridkeyActionHandler=function(e){if(this.allowKeyboard){var i=void 0,r=void 0,n=void 0;switch(e.action){case"ctrlDownArrow":this.expandAll();break;case"ctrlUpArrow":this.collapseAll();break;case"ctrlShiftUpArrow":null!==(r=e.target.closest(".e-rowcell").closest("tr"))&&void 0!==r&&this.expandCollapseRequest(r.querySelector(".e-treegridexpand"));break;case"ctrlShiftDownArrow":null!==(r=e.target.closest(".e-rowcell").closest("tr"))&&void 0!==r&&this.expandCollapseRequest(r.querySelector(".e-treegridcollapse"));break;case"downArrow":if(!this.enableVirtualization)if(i=e.target.parentElement,null!==(n=this.findnextRowElement(i))){var o=n.rowIndex;this.selectRow(o);var a=e.target.cellIndex,s=n.children[a];t.addClass([s],"e-focused"),t.addClass([s],"e-focus")}else this.clearSelection();break;case"upArrow":if(!this.enableVirtualization)if(i=e.target.parentElement,null!==(n=this.findPreviousRowElement(i))){var d=n.rowIndex;this.selectRow(d);var l=e.target.cellIndex,p=n.children[l];t.addClass([p],"e-focused"),t.addClass([p],"e-focus")}else this.clearSelection()}}},d.prototype.findnextRowElement=function(e){var t=e.nextElementSibling;return null===t||-1===t.className.indexOf("e-summaryrow")&&"none"!==t.style.display||(t=this.findnextRowElement(t)),t},d.prototype.findPreviousRowElement=function(e){var t=e.previousElementSibling;return null===t||-1===t.className.indexOf("e-summaryrow")&&"none"!==t.style.display||(t=this.findPreviousRowElement(t)),t},d.prototype.initProperties=function(){this.defaultLocale={},this.flatData=[],this.infiniteScrollData=[],this.parentData=[],this.columnModel=[],this.isExpandAll=!1,this.isCollapseAll=!1,this.keyConfigs={ctrlDownArrow:"ctrl+downarrow",ctrlUpArrow:"ctrl+uparrow",ctrlShiftUpArrow:"ctrl+shift+uparrow",ctrlShiftDownArrow:"ctrl+shift+downarrow",downArrow:"downArrow",upArrow:"upArrow"},this.isLocalData=!(this.dataSource instanceof n.DataManager)||this.dataSource.dataSource.offline||!t.isNullOrUndefined(this.dataSource.ready)||this.dataSource.adaptor instanceof n.RemoteSaveAdaptor,this.isSelfReference=!t.isNullOrUndefined(this.parentIdMapping)},d.prototype.wireEvents=function(){t.EventHandler.add(this.grid.element,"click",this.mouseClickHandler,this),t.EventHandler.add(this.element,"touchend",this.mouseClickHandler,this),this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.treeGridkeyActionHandler.bind(this),keyConfigs:this.keyConfigs,eventName:"keydown"}),this.allowKeyboard&&(this.element.tabIndex=-1===this.element.tabIndex?0:this.element.tabIndex)},d.prototype.requiredModules=function(){var e=[];if(this.grid.splitFrozenCount(this.getGridColumns(this.columns)),this.isDestroyed)return e;e.push({member:"filter",args:[this,this.filterSettings]}),t.isNullOrUndefined(this.toolbar)||e.push({member:"toolbar",args:[this]}),this.contextMenuItems&&e.push({member:"contextMenu",args:[this]}),this.allowPaging&&e.push({member:"pager",args:[this,this.pageSettings]}),this.allowReordering&&e.push({member:"reorder",args:[this]}),this.allowSorting&&e.push({member:"sort",args:[this]}),this.aggregates.length>0&&e.push({member:"summary",args:[this]}),e.push({member:"resize",args:[this]}),this.allowExcelExport&&e.push({member:"ExcelExport",args:[this]});var i=this.injectedModules.filter(function(e){return"freeze"===e.prototype.getModuleName()});return(this.frozenColumns||this.frozenRows||this.getFrozenColumns()||this.grid.getFrozenLeftColumnsCount()||this.grid.getFrozenRightColumnsCount()||i.length)&&e.push({member:"freeze",args:[this]}),this.detailTemplate&&e.push({member:"detailRow",args:[this]}),this.allowPdfExport&&e.push({member:"PdfExport",args:[this]}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this]}),this.showColumnChooser&&e.push({member:"ColumnChooser",args:[this]}),this.extendRequiredModules(e),e},d.prototype.extendRequiredModules=function(e){var i=this.injectedModules.filter(function(e){return"rowDragAndDrop"===e.prototype.getModuleName()});(this.allowRowDragAndDrop||i.length)&&(t.isNullOrUndefined(this.toolbar)||!this.toolbar.includes("Indent")&&!this.toolbar.includes("Outdent")||(this.isIndentEnabled=!0),e.push({member:"rowDragAndDrop",args:[this]})),(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&e.push({member:"edit",args:[this]}),this.isCommandColumn(this.columns)&&e.push({member:"commandColumn",args:[this]}),this.allowSelection&&e.push({member:"selection",args:[this]}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this]}),this.enableInfiniteScrolling&&e.push({member:"infiniteScroll",args:[this]}),e.push({member:"logger",args:[this.grid]})},d.prototype.isCommandColumn=function(e){var t=this;return e.some(function(e){return e.columns?t.isCommandColumn(e.columns):!(!e.commands&&!e.commandsTemplate)})},d.prototype.unwireEvents=function(){this.grid&&this.grid.element&&t.EventHandler.remove(this.grid.element,"click",this.mouseClickHandler)},d.prototype.log=function(e,t){this.loggerModule&&this.loggerModule.treeLog(e,t,this)},d.prototype.render=function(){var e=this;this.isReact&&(this.grid.isReact=!0,this.grid.portals=[]),this.isVue&&(this.grid.isVue=!0),o.createSpinner({target:this.element},this.createElement),this.log(["mapping_fields_missing"]),this.renderModule=new _e(this),this.dataModule=new He(this),this.printModule=new Ve(this),this.trigger("load"),this.autoGenerateColumns(),this.initialRender=!0,t.isNullOrUndefined(this.dataSource)||this.convertTreeData(this.dataSource),this.loadGrid(),this.element.classList.contains("e-treegrid")&&this.rowDropSettings.targetID&&(this.grid.rowDropSettings.targetID+="_gridcontrol"),this.addListener();var i=t.createElement("div",{id:this.element.id+"_gridcontrol"});t.addClass([this.element],"e-treegrid"),t.isNullOrUndefined(this.height)||"string"!=typeof this.height||-1===this.height.indexOf("%")||(this.element.style.height=this.height),t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(this.element.style.width=this.width),this.element.appendChild(i);var r=this.grid.requiredModules;this.grid.requiredModules=function(){var e=[];e=r.apply(this);for(var t=0;t<e.length;t++)"virtualscroll"===e[t].member&&(e[t].member="treeVirtualScroll");return e};this.grid.root=this.root?this.root:this,this.grid.appendTo(i),this.isIndentEnabled&&this.refreshToolbarItems(),this.wireEvents(),this.renderComplete();var n=this.grid.destroyTemplate;this.grid.destroyTemplate=function(i,r){n.apply(e.grid);e.isReact&&t.isNullOrUndefined(e.portals)||e.clearTemplate(i,r)}},d.prototype.refreshToolbarItems=function(){var e=this.toolbarModule.getToolbar(),t=this.element.id+"_gridcontrol_indent",i=this.element.id+"_gridcontrol_outdent",r=e.querySelector("#"+t).parentElement,n=e.querySelector("#"+i).parentElement;r.classList.add("e-hidden"),n.classList.add("e-hidden")},d.prototype.afterGridRender=function(){t.isNullOrUndefined(this.grid.clipboardModule)||this.grid.clipboardModule.destroy(),this.clipboardModule=this.grid.clipboardModule=new Ue(this,this.grid.serviceLocator)},d.prototype.convertTreeData=function(e){var i=this;if(s(this)&&(e=t.getValue("result",e)),e instanceof Array&&e.length>0&&Object.prototype.hasOwnProperty.call(e[0],"level"))this.flatData=e,this.flatData.filter(function(e){t.setValue("uniqueIDCollection."+e.uniqueID,e,i),0===e.level&&i.parentData.push(e)});else if(s(this)){var r=t.getValue("result",this.dataSource);this.dataModule.convertToFlatData(r)}else this.dataModule.convertToFlatData(e)},d.prototype.bindGridProperties=function(){this.bindedDataSource(),this.grid.enableRtl=this.enableRtl,this.grid.allowKeyboard=this.allowKeyboard,this.grid.columns=this.getGridColumns(this.columns),this.grid.allowExcelExport=this.allowExcelExport,this.grid.allowPdfExport=this.allowPdfExport,this.grid.query=this.query,this.grid.columnQueryMode=this.columnQueryMode,this.grid.allowPaging=this.allowPaging,this.grid.pageSettings=i.getActualProperties(this.pageSettings),this.grid.pagerTemplate=this.pagerTemplate,this.grid.showColumnMenu=this.showColumnMenu,this.grid.allowSorting=this.allowSorting,this.grid.allowFiltering=this.allowFiltering,this.grid.enableVirtualization=this.enableVirtualization,this.grid.enableColumnVirtualization=this.enableColumnVirtualization,this.grid.enableInfiniteScrolling=this.enableInfiniteScrolling,this.grid.infiniteScrollSettings=this.infiniteScrollSettings,this.grid.width=this.width,this.grid.height=this.height,this.grid.enableAltRow=this.enableAltRow,this.grid.allowReordering=this.allowReordering,this.grid.allowTextWrap=this.allowTextWrap,this.grid.allowResizing=this.allowResizing,this.grid.enableHover=this.enableHover,this.grid.enableAutoFill=this.enableAutoFill,this.grid.enableAdaptiveUI=this.enableAdaptiveUI,this.grid.enableImmutableMode=this.enableImmutableMode,this.grid.allowRowDragAndDrop=this.allowRowDragAndDrop,this.grid.rowDropSettings=i.getActualProperties(this.rowDropSettings),this.grid.rowHeight=this.rowHeight,this.grid.gridLines=this.gridLines,this.grid.allowSelection=this.allowSelection,this.grid.toolbar=i.getActualProperties(this.getGridToolbar()),this.grid.toolbarTemplate=this.toolbarTemplate,this.grid.showColumnChooser=this.showColumnChooser,this.grid.filterSettings=i.getActualProperties(this.filterSettings),this.grid.selectionSettings=i.getActualProperties(this.selectionSettings),this.grid.sortSettings=i.getActualProperties(this.sortSettings),this.grid.searchSettings=i.getActualProperties(this.searchSettings),this.grid.aggregates=i.getActualProperties(this.aggregates),this.grid.textWrapSettings=i.getActualProperties(this.textWrapSettings),this.grid.printMode=i.getActualProperties(this.printMode),this.grid.locale=i.getActualProperties(this.locale),this.grid.selectedRowIndex=this.selectedRowIndex,this.grid.contextMenuItems=i.getActualProperties(this.getContextMenu()),this.grid.columnMenuItems=i.getActualProperties(this.columnMenuItems),this.grid.editSettings=this.getGridEditSettings(),this.grid.rowTemplate=i.getActualProperties(this.rowTemplate),this.grid.detailTemplate=i.getActualProperties(this.detailTemplate),this.grid.frozenRows=this.frozenRows,this.grid.frozenColumns=this.frozenColumns,this.grid.clipMode=i.getActualProperties(this.clipMode);var e="templateDotnetInstance";this.grid[e]=this[e];this.grid.isJsComponent=!0,this.grid.enableVirtualMaskRow=!1},d.prototype.triggerEvents=function(e){this.trigger(i.getObject("name",e),e)},d.prototype.IsExpandCollapseClicked=function(e){t.isNullOrUndefined(e.target)||!(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse")||e.target.classList.contains("e-summarycell"))||t.isNullOrUndefined(e.data)||!e.data.hasChildRecords||(e.cancel=!0)},d.prototype.bindGridEvents=function(){var e=this;this.grid.rowSelecting=function(t){e.IsExpandCollapseClicked(t),e.trigger("rowSelecting",t)},this.grid.rowDeselecting=function(t){e.IsExpandCollapseClicked(t),e.trigger(Oe,t)},this.grid.rowSelected=function(t){if(e.enableVirtualization&&t.isHeaderCheckboxClicked&&e.grid.currentViewData.length!==e.grid.selectionModule.selectedRowIndexes.length)for(var i=0;i<e.getRows().length;i++)e.getRows()[i].getElementsByClassName("e-frame e-icons e-uncheck").length&&e.grid.selectionModule.updateRowSelection(e.getRows()[i],e.getCurrentViewRecords()[i].index);e.selectedRowIndex=e.grid.selectedRowIndex,e.notify(z,t),e.trigger(z,t)},this.grid.rowDeselected=function(i){e.selectedRowIndex=e.grid.selectedRowIndex,t.isNullOrUndefined(i.data)||e.notify(_,i),e.trigger(_,i)},this.grid.resizeStop=function(t){e.updateColumnModel(),e.trigger("resizeStop",t)},this.grid.excelQueryCellInfo=function(t){e.notify("excelCellInfo",t),t=e.dataResults},this.grid.pdfQueryCellInfo=function(t){e.notify("pdfCellInfo",t),t=e.dataResults},this.grid.checkBoxChange=function(t){e.trigger(j,t)},this.grid.pdfExportComplete=this.triggerEvents.bind(this),this.grid.excelExportComplete=this.triggerEvents.bind(this),this.grid.excelHeaderQueryCellInfo=this.triggerEvents.bind(this),this.grid.pdfHeaderQueryCellInfo=this.triggerEvents.bind(this),this.grid.dataSourceChanged=this.triggerEvents.bind(this),this.grid.recordDoubleClick=this.triggerEvents.bind(this),this.grid.cellDeselected=this.triggerEvents.bind(this),this.grid.cellDeselecting=this.triggerEvents.bind(this),this.grid.columnMenuOpen=this.triggerEvents.bind(this),this.grid.columnMenuClick=this.triggerEvents.bind(this),this.grid.cellSelected=this.triggerEvents.bind(this),this.grid.headerCellInfo=this.triggerEvents.bind(this),this.grid.resizeStart=this.triggerEvents.bind(this),this.grid.resizing=this.triggerEvents.bind(this),this.grid.columnDrag=this.triggerEvents.bind(this),this.grid.columnDragStart=this.triggerEvents.bind(this),this.grid.columnDrop=this.triggerEvents.bind(this),this.grid.beforePrint=this.triggerEvents.bind(this),this.grid.beforeCopy=this.triggerEvents.bind(this),this.grid.beforePaste=function(t){for(var i=e.getRows();i[t.rowIndex].classList.contains("e-summaryrow");)t.rowIndex++;e.trigger("beforePaste",t)},this.grid.load=function(){if(e.grid.on("initial-end",e.afterGridRender,e),!t.isNullOrUndefined(e.loggerModule)){e.loggerModule=e.grid.loggerModule=new k(e.grid)}},this.grid.printComplete=this.triggerEvents.bind(this),this.grid.actionFailure=this.triggerEvents.bind(this),this.extendedGridDataBoundEvent(),this.extendedGridEvents(),this.extendedGridActionEvents(),this.extendedGridEditEvents(),this.bindGridDragEvents(),this.bindCallBackEvents()},d.prototype.lastRowBorder=function(e,i){for(var r=0;r<e.cells.length;r++)i?t.addClass([e.cells[r]],"e-lastrowcell"):t.removeClass([e.cells[r]],"e-lastrowcell")},d.prototype.isPixelHeight=function(){return"auto"!==this.height&&-1===this.height.toString().indexOf("%")},d.prototype.extendedGridDataBoundEvent=function(){var e=this;this.grid.dataBound=function(r){if(e.updateRowTemplate(),e.updateColumnModel(),e.updateAltRow(e.getRows()),e.notify("dataBoundArg",r),a(e)&&!u(e)&&!e.hasChildMapping){var n=i.getObject("dataSource.requests",e).filter(function(e){return"OK"!==e.httpRequest.statusText}).length;t.setValue("grid.contentModule.isLoaded",!(n>0),e)}if(e.isPixelHeight()&&e.initialRender)for(var o=e.getContentTable().rows,s=[].slice.call(o),d=s.length-1;d>0;d--)if(!m(s[d])){s[d].nextElementSibling&&e.lastRowBorder(s[d],!0);break}if(e.enableVirtualization&&e.selectionSettings.persistSelection&&("expand"===e.dataResults.action||"collapse"===e.dataResults.action)){if(e.grid.selectionModule.refreshPersistSelection(),"Single"===e.grid.selectionSettings.type){var l=e.getCurrentViewRecords().indexOf(e.grid.selectionModule.data);e.grid.selectionModule.updateRowSelection(e.getRows()[l],l)}}e.trigger("dataBound",r),e.initialRender=!1};var r=this;this.grid.beforeDataBound=function(e){var o=i.getObject("action",e);if((a(r)&&!u(r)||s(this))&&"edit"!==o)r.notify("updateRemoteLevel",e),e=r.dataResults;else if(0===r.flatData.length&&u(r)&&r.dataSource instanceof n.DataManager){var d=r.dataSource;r.dataModule.convertToFlatData(d.dataSource.json),e.result=r.grid.dataSource.dataSource.json=r.flatData}if(a(r)||s(this)||t.isNullOrUndefined(r.dataSource)||(this.isPrinting&&t.setValue("isPrinting",!0,e),r.notify("dataProcessor",e)),t.extend(e,r.dataResults),r.enableImmutableMode&&(e.result=e.result.slice()),r.initialRender&&(this.contentModule.objectEqualityChecker=r.objectEqualityChecker),!this.isPrinting){var l=new n.Deferred;return r.trigger(B,e,function(e){l.resolve(e)}),l}},this.grid.log=function(t,i){e.loggerModule&&e.loggerModule.log(t,i)}},d.prototype.bindCallBackEvents=function(){var e=this;this.grid.toolbarClick=function(t){if(!(t.item.id===e.grid.element.id+"_excelexport"&&!1===e.allowExcelExport||t.item.id===e.grid.element.id+"_pdfexport"&&!1===e.allowPdfExport||t.item.id===e.grid.element.id+"_csvexport"&&!1===e.allowExcelExport)){var i=new n.Deferred;return e.trigger(H,t,function(r){r.cancel||e.notify(H,t),i.resolve(r)}),i}},this.grid.cellSelecting=function(t){var r=new n.Deferred;return e.trigger(i.getObject("name",t),t,function(e){r.resolve(e)}),r},this.grid.beginEdit=function(i){if(t.isNullOrUndefined(i.row)||!i.row.classList.contains("e-summaryrow")){var r=new n.Deferred;return e.trigger(ie,i,function(e){r.resolve(e)}),r}i.cancel=!0}},d.prototype.extendedGridEditEvents=function(){var e=this;this.grid.dataStateChange=function(i){e.isExpandRefresh?(e.isExpandRefresh=!1,e.grid.dataSource={result:e.flatData,count:t.getValue("count",e.grid.dataSource)}):("infiniteScroll"!==i.action.requestType&&(e.infiniteScrollData=[]),e.trigger(L,i))},this.grid.cellSave=function(i){if(e.grid.isContextMenuOpen()){var r=e.grid.contextMenuModule.contextMenu.element.getElementsByClassName("e-selected")[0];(t.isNullOrUndefined(r)||r.id!==e.element.id+"_gridcontrol_cmenu_Save")&&(i.cancel=!0)}var o=new n.Deferred;return e.trigger(oe,i,function(t){t.cancel||e.notify(oe,t),o.resolve(t)}),o},this.grid.cellSaved=function(t){e.trigger(ae,t),e.notify(ae,t)},this.grid.cellEdit=function(t){var i=new n.Deferred;return t.promise=i,e.notify(se,t),i},this.grid.batchAdd=function(t){e.trigger(pe,t),e.notify(pe,t)},this.grid.beforeBatchSave=function(t){e.trigger(ue,t),e.notify(ue,t)},this.grid.beforeBatchAdd=function(t){e.trigger(ce,t),e.notify(ce,t)},this.grid.batchDelete=function(t){e.trigger(de,t),e.notify(de,t)},this.grid.beforeBatchDelete=function(t){e.trigger(he,t),e.notify(he,t)},this.grid.batchCancel=function(t){"Cell"!==e.editSettings.mode&&e.trigger(le,t),e.notify(le,t)}},d.prototype.updateRowTemplate=function(){this.treeColumnRowTemplate()},d.prototype.bindedDataSource=function(){var e="dataSource";if(this.dataSource&&s(this)){var i=this.flatData,r=t.getValue("count",this.dataSource);this.grid.dataSource={result:i,count:r}}else this.grid.dataSource=this.dataSource instanceof n.DataManager?new n.DataManager(this.dataSource.dataSource,this.dataSource.defaultQuery,this.dataSource.adaptor):this.flatData;if(this.dataSource instanceof n.DataManager&&(this.dataSource.dataSource.offline||this.dataSource.ready)){this.grid.dataSource[e].json=g(this.dataSource[e].json),this.grid.dataSource.ready=this.dataSource.ready;var o=this;t.isNullOrUndefined(this.grid.dataSource.ready)||this.grid.dataSource.ready.then(function(t){var i=o.grid.dataSource;i[e].offline=!0,i.isDataAvailable=!0,i[e].json=t.result,i.adaptor=new n.JsonAdaptor})}},d.prototype.extendedGridActionEvents=function(){var e=this;this.grid.actionBegin=function(r){"sorting"===r.requestType&&r.target&&r.target.parentElement&&r.target.parentElement.classList.contains("e-hierarchycheckbox")&&(r.cancel=!0);if("reorder"===i.getObject("requestType",r)&&e.notify("getColumnIndex",{}),e.notify("actionBegin",{editAction:r}),a(e)||t.isNullOrUndefined(e.filterModule)||s(e)||0!==e.grid.filterSettings.columns.length||0!==e.grid.searchSettings.key.length||(e.notify("clearFilters",{flatData:e.grid.dataSource}),e.grid.setProperties({dataSource:e.dataResults.result},!0),t.isNullOrUndefined(e.grid.changedProperties.dataSource)&&(e.grid.renderModule.data.dataManager=e.grid.dataSource instanceof n.DataManager?e.grid.dataSource:t.isNullOrUndefined(e.grid.dataSource)?new n.DataManager:new n.DataManager(e.grid.dataSource),e.grid.renderModule.data.isQueryInvokedFromData=!0,e.grid.query=e.grid.query instanceof n.Query?e.grid.query:new n.Query)),"indenting"!==e.action&&"outdenting"!==e.action){var o=new n.Deferred;return e.trigger(T,r,function(t){t.cancel||e.notify(ie,t),o.resolve(t)}),o}},this.grid.actionComplete=function(t){if(e.notify("actioncomplete",t),e.updateColumnModel(),e.updateTreeGridModel(),"reorder"===t.requestType&&e.notify("setColumnIndex",{}),e.notify("actionComplete",{editAction:t}),"add"===t.requestType&&"Top"!==e.editSettings.newRowPosition&&"Bottom"!==e.editSettings.newRowPosition&&e.notify(re,t),"batchsave"===t.requestType&&e.notify(ge,t),e.notify("updateGridActions",t),"save"===t.requestType&&e.aggregates.map(function(e){return!0===e.showChildSummary}).length&&e.grid.refresh(),"filter"===t.action&&""!==e.filterModule.currentFilterObject&&e.enableVirtualization&&!e.initialRender&&e.expandAll(),"searching"===t.requestType&&""!==e.searchSettings.key&&e.enableVirtualization&&!e.initialRender&&e.expandAll(),"clearFilter"===t.action&&e.enableCollapseAll&&e.collapseAll(),"indenting"===e.action||"outdenting"===e.action){e.action="indenting"===e.action?"indented":"outdented";var i=[e.selectedRecords],r={data:i,dropIndex:e.dropIndex,dropPosition:e.dropPosition,modifiedRecords:e.modifiedRecords,requestType:e.action,row:e.selectedRows};e.trigger(F,r);e.getCurrentViewRecords().filter(function(e){return e.uniqueID===i[0].uniqueID}).length||e.refreshToolbarItems(),e.action="",e.selectedRecords=e.selectedRows=e.modifiedRecords=[]}else{if(e.grid.isFrozenGrid()&&e.enableVirtualization&&"movable"===t.tableName){var n=e.grid.element.querySelector("."+Pe),o=e.grid.element.querySelector("."+Ee);n.style.height=o.style.height="auto"}e.trigger(F,t)}}},d.prototype.extendedGridEvents=function(){var e=this,i=this;this.grid.recordDoubleClick=function(t){e.trigger(ne,t),e.notify(ne,t)},this.grid.detailDataBound=function(t){e.notify("detaildataBound",t),e.trigger(xe,t)},this.grid.rowDataBound=function(e){t.isNullOrUndefined(this.isPrinting)?t.setValue("isPrinting",!1,e):t.setValue("isPrinting",this.isPrinting,e),i.renderModule.RowModifier(e)},this.grid.queryCellInfo=function(e){t.isNullOrUndefined(this.isPrinting)?t.setValue("isPrinting",!1,e):t.setValue("isPrinting",this.isPrinting,e),i.renderModule.cellRender(e)},this.grid.contextMenuClick=function(t){e.notify(ee,t),e.trigger(ee,t)},this.grid.contextMenuOpen=function(t){e.notify(Z,t),e.trigger(Z,t)},this.grid.queryCellInfo=function(t){e.renderModule.cellRender(t)}},d.prototype.bindGridDragEvents=function(){var e=this;this.grid.rowDragStartHelper=function(t){e.trigger(be,t)},this.grid.rowDragStart=function(t){e.trigger("rowDragStart",t)},this.grid.rowDrag=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(De,t),e.trigger("rowDrag",t))},this.grid.rowDrop=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(Me,t),t.cancel=!0)}},d.prototype.loadGrid=function(){this.bindGridProperties(),this.bindGridEvents(),t.setValue("registeredTemplate",this.registeredTemplate,this.grid);t.setValue("viewContainerRef",this.viewContainerRef,this.grid)},d.prototype.autoGenerateColumns=function(){if(!this.columns.length&&!this.dataModule.isRemote()&&Object.keys(this.dataSource).length){this.columns=[];for(var e=this.dataSource[0],t=Object.keys(e),i=0;i<t.length;i++)-1===[this.childMapping,this.parentIdMapping].indexOf(t[i])&&this.columns.push(t[i])}},d.prototype.getGridEditSettings=function(){var e={};switch(e.allowAdding=this.editSettings.allowAdding,e.allowEditing=this.editSettings.allowEditing,e.allowDeleting=this.editSettings.allowDeleting,e.newRowPosition="Bottom"===this.editSettings.newRowPosition?"Bottom":"Top",e.allowEditOnDblClick=this.editSettings.allowEditOnDblClick,e.showConfirmDialog=this.editSettings.showConfirmDialog,e.template=this.editSettings.template,e.showDeleteConfirmDialog=this.editSettings.showDeleteConfirmDialog,e.allowNextRowEdit=this.editSettings.allowNextRowEdit,e.guid=this.editSettings.guid,e.dialog=this.editSettings.dialog,this.editSettings.mode){case"Dialog":case"Batch":e.mode=this.editSettings.mode;break;case"Row":e.mode="Normal";break;case"Cell":e.mode="Normal",e.showConfirmDialog=!1}return e},d.prototype.getContextMenu=function(){if(this.contextMenuItems){for(var t=[],i=0;i<this.contextMenuItems.length;i++)switch(this.contextMenuItems[i]){case"AddRow":case e.ContextMenuItems.AddRow:t.push({text:this.l10n.getConstant("AddRow"),target:".e-content",id:this.element.id+"_gridcontrol_cmenu_AddRow",items:[{text:this.l10n.getConstant("Above"),id:"Above"},{text:this.l10n.getConstant("Below"),id:"Below"},{text:this.l10n.getConstant("Child"),id:"Child"}]});break;case"Indent":case e.ContextMenuItems.RowIndent:t.push({text:this.l10n.getConstant("RowIndent"),target:".e-content",iconCss:"e-indent e-icons",id:this.element.id+"_gridcontrol_cmenu_Indent"});break;case"Outdent":case e.ContextMenuItems.RowOutdent:t.push({text:this.l10n.getConstant("RowOutdent"),target:".e-content",iconCss:"e-outdent e-icons",id:this.element.id+"_gridcontrol_cmenu_Outdent"});break;default:t.push(this.contextMenuItems[i])}return t}return null},d.prototype.getGridToolbar=function(){if(this.toolbar){this.l10n=new t.L10n("treegrid",this.defaultLocale,this.locale);for(var i=[],r=void 0,n=0;n<this.toolbar.length;n++)switch(this.toolbar[n]){case"Search":case e.ToolbarItem.Search:i.push("Search");break;case"Print":case e.ToolbarItem.Print:i.push("Print");break;case"ExpandAll":case e.ToolbarItem.ExpandAll:r=this.l10n.getConstant("ExpandAll"),i.push({text:r,tooltipText:r,prefixIcon:"e-expand",id:this.element.id+"_gridcontrol_expandall"});break;case"CollapseAll":case e.ToolbarItem.CollapseAll:r=this.l10n.getConstant("CollapseAll"),i.push({text:r,tooltipText:r,prefixIcon:"e-collapse",id:this.element.id+"_gridcontrol_collapseall"});break;case"Indent":case e.ToolbarItem.RowIndent:r=this.l10n.getConstant("RowIndent"),i.push({text:r,tooltipText:r,prefixIcon:"e-indent",id:this.element.id+"_gridcontrol_indent"});break;case"Outdent":case e.ToolbarItem.RowOutdent:r=this.l10n.getConstant("RowOutdent"),i.push({text:r,tooltipText:r,prefixIcon:"e-outdent",id:this.element.id+"_gridcontrol_outdent"});break;default:i.push(this.toolbar[n])}return i}return null},d.prototype.getGridColumns=function(e,i,r){void 0===i&&(i=!0),void 0===r&&(r=0);var n=e;i&&(this.columnModel=[]);var o,a;0==this.columnModel.length&&(r=0===r?-1:r);for(var s=[],d=0;d<n.length;d++){r+=1;var l=this.grid.getColumnByUid(n[d].uid);if(a=l||{},o={},"string"==typeof this.columns[d])a.field=o.field=this.columns[d];else for(var p=0,h=Object.keys(n[d]);p<h.length;p++){var c=h[p];r===this.treeColumnIndex&&"template"===c?o[c]=n[d][c]:"columns"!==c||t.isNullOrUndefined(n[d][c])?this.initialRender&&!t.isNullOrUndefined(l)&&this.enablePersistence&&"edit"===c?a[c]=o[c]=l[c]:l&&"sortComparer"===c||(a[c]=o[c]=n[d][c]):(a[c]=this.getGridColumns(n[d][c],!1,this.columnModel.length-1),o[c]=n[d][c])}o.columns||this.columnModel.push(new C(o)),s.push(a),!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex])&&this.enableRtl&&a.field===this.columnModel[this.treeColumnIndex].field&&(t.isNullOrUndefined(this.treeColumnTextAlign)&&(this.treeColumnTextAlign=this.columnModel[this.treeColumnIndex].textAlign,this.treeColumnField=this.columnModel[this.treeColumnIndex].field),a.textAlign="Right")}return s},d.prototype.onPropertyChanged=function(e){for(var r=!1,o=0,a=Object.keys(e);o<a.length;o++){var d=a[o];switch(d){case"columns":this.grid.columns=this.getGridColumns(this.columns);break;case"treeColumnIndex":this.grid.refreshColumns();break;case"allowPaging":this.grid.allowPaging=this.allowPaging;break;case"pageSettings":this.grid.pageSettings=i.getActualProperties(this.pageSettings),r=!0;break;case"enableVirtualization":this.grid.enableVirtualization=this.enableVirtualization;break;case"enableColumnVirtualization":this.grid.enableColumnVirtualization=this.enableColumnVirtualization;break;case"toolbar":this.grid.toolbar=this.getGridToolbar();break;case"allowSelection":this.grid.allowSelection=this.allowSelection;break;case"selectionSettings":this.grid.selectionSettings=i.getActualProperties(this.selectionSettings);break;case"allowSorting":this.grid.allowSorting=this.allowSorting;break;case"allowMultiSorting":this.grid.allowMultiSorting=this.allowMultiSorting;break;case"sortSettings":this.grid.sortSettings=i.getActualProperties(this.sortSettings);break;case"searchSettings":this.grid.searchSettings=i.getActualProperties(this.searchSettings);break;case"allowFiltering":this.grid.allowFiltering=this.allowFiltering;break;case"filterSettings":this.initialRender||(this.grid.filterSettings=i.getActualProperties(this.filterSettings));break;case"showColumnMenu":this.grid.showColumnMenu=this.showColumnMenu;break;case"allowRowDragAndDrop":this.grid.allowRowDragAndDrop=this.allowRowDragAndDrop;break;case"aggregates":this.grid.aggregates=i.getActualProperties(this.aggregates);break;case"enableInfiniteScrolling":this.grid.enableInfiniteScrolling=this.enableInfiniteScrolling;break;case"dataSource":if(this.isLocalData=!(this.dataSource instanceof n.DataManager)||!t.isNullOrUndefined(this.dataSource.ready)||this.dataSource.adaptor instanceof n.RemoteSaveAdaptor,this.convertTreeData(this.dataSource),this.isLocalData){if(s(this)){var l=t.getValue("count",this.dataSource);this.grid.dataSource={result:this.flatData,count:l}}else{var p=this.dataSource;this.grid.dataSource=p instanceof n.DataManager?new n.DataManager(p.dataSource,p.defaultQuery,p.adaptor):this.flatData}this.enableVirtualization&&(this.grid.contentModule.isDataSourceChanged=!0)}else this.bindedDataSource(),this.enableVirtualization&&(this.grid.contentModule.removeEventListener(),this.grid.contentModule.eventListener("on"),this.grid.contentModule.renderTable());break;case"query":this.grid.query=this.query;break;case"enableCollapseAll":e[d]?this.collapseAll():this.expandAll();break;case"expandStateMapping":this.grid.refresh();break;case"gridLines":this.grid.gridLines=this.gridLines;break;case"rowTemplate":this.grid.rowTemplate=i.getActualProperties(this.rowTemplate);break;case"frozenRows":this.grid.frozenRows=this.frozenRows;break;case"frozenColumns":this.grid.frozenColumns=this.frozenColumns;break;case"rowHeight":this.grid.rowHeight=this.rowHeight;break;case"height":t.isNullOrUndefined(this.height)||"string"!=typeof this.height||-1===this.height.indexOf("%")||(this.element.style.height=this.height),this.grid.height=this.height;break;case"width":t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(this.element.style.width=this.width),this.grid.width=this.width;break;case"locale":this.grid.locale=this.locale,this.TreeGridLocale(),this.grid.toolbar=this.getGridToolbar(),this.grid.contextMenuItems=this.getContextMenu();break;case"selectedRowIndex":this.grid.selectedRowIndex=this.selectedRowIndex;break;case"enableAltRow":this.grid.enableAltRow=this.enableAltRow;break;case"enableHover":this.grid.enableHover=this.enableHover;break;case"enableAutoFill":this.grid.enableAutoFill=this.enableAutoFill;break;case"enableAdaptiveUI":this.grid.enableAdaptiveUI=this.enableAdaptiveUI;break;case"enableImmutableMode":this.grid.enableImmutableMode=this.enableImmutableMode;break;case"allowExcelExport":this.grid.allowExcelExport=this.allowExcelExport;break;case"allowPdfExport":this.grid.allowPdfExport=this.allowPdfExport;break;case"enableRtl":t.isNullOrUndefined(this.treeColumnField)||this.updateTreeColumnTextAlign(),this.grid.enableRtl=this.enableRtl;break;case"allowReordering":this.grid.allowReordering=this.allowReordering;break;case"allowResizing":this.grid.allowResizing=this.allowResizing;break;case"textWrapSettings":this.grid.textWrapSettings=i.getActualProperties(this.textWrapSettings);break;case"allowTextWrap":this.grid.allowTextWrap=i.getActualProperties(this.allowTextWrap),this.grid.refresh();break;case"contextMenuItems":this.grid.contextMenuItems=this.getContextMenu();break;case"showColumnChooser":this.grid.showColumnChooser=this.showColumnChooser;break;case"detailTemplate":this.grid.detailTemplate=i.getActualProperties(this.detailTemplate);break;case"columnMenuItems":this.grid.columnMenuItems=i.getActualProperties(this.columnMenuItems);break;case"editSettings":this.grid.isEdit&&"Normal"===this.grid.editSettings.mode&&e[d].mode&&("Cell"===e[d].mode||"Row"===e[d].mode)&&this.grid.closeEdit(),this.grid.editSettings=this.getGridEditSettings()}r&&this.grid.refresh()}},d.prototype.updateTreeColumnTextAlign=function(){this.grid.getColumnByField(this.treeColumnField).textAlign=this.enableRtl?"Right":this.treeColumnTextAlign,this.grid.refreshColumns()},d.prototype.destroy=function(){var e=this.element;if(e){var t=!(!e.querySelector(".e-gridheader")||!e.querySelector(".e-gridcontent"));t&&this.unwireEvents(),this.removeListener(),t&&r.prototype.destroy.call(this),this.grid&&this.grid.destroy(),this.dataModule&&this.dataModule.destroy();for(var i=["dataModule","sortModule","renderModule","filterModule","printModule","clipboardModule","excelExportModule","pdfExportModule","toolbarModule","summaryModule","reorderModule","resizeModule","pagerModule","keyboardModule","columnMenuModule","contextMenuModule","editModule","virtualScrollModule","selectionModule","detailRow","rowDragAndDropModule","freezeModule"],n=0;n<i.length;n++)this[i[n]]&&(this[i[n]]=null);this.element.innerHTML="",this.grid=null}},d.prototype.dataBind=function(){t.isNullOrUndefined(this.grid)||(!t.isNullOrUndefined(this.rowDropSettings.targetID)&&t.isNullOrUndefined(document.getElementById(this.grid.rowDropSettings.targetID))&&(document.getElementById(this.rowDropSettings.targetID).id=this.grid.rowDropSettings.targetID,this.rowDropSettings.targetID=this.grid.rowDropSettings.targetID),r.prototype.dataBind.call(this),this.grid.dataBind())},d.prototype.getPersistData=function(){for(var e=["pageSettings","sortSettings","filterSettings","columns","searchSettings","selectedRowIndex","treeColumnIndex"],i={pageSettings:["template","pageSizes","pageSizeMode","enableQueryString","totalRecordsCount","pageCount"],filterSettings:["type","mode","showFilterBarStatus","immediateModeDelay","ignoreAccent","hierarchyMode"],searchSettings:["fields","operator","ignoreCase"],sortSettings:[],columns:[],selectedRowIndex:[]},r=0;r<e.length;r++)for(var n=this[e[r]],o=0,a=i[e[r]];!t.isNullOrUndefined(a)&&o<a.length;o++){delete n[a[o]]}return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(e)},d.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)t[i].columns?(this.ignoreInColumn(e,t[i]),this.ignoreInArrays(e,t[i].columns)):this.ignoreInColumn(e,t[i])},d.prototype.ignoreInColumn=function(e,t){for(var i=0;i<e.length;i++)delete t[e[i]],t.filter={}},d.prototype.mouseClickHandler=function(e){if(t.isNullOrUndefined(e.touches)){var i=e.target;!i.classList.contains("e-treegridexpand")&&!i.classList.contains("e-treegridcollapse")||this.isEditCollapse||this.grid.isEdit||this.expandCollapseRequest(i),this.isEditCollapse=!1,this.notify("checkboxSelection",{target:i})}},d.prototype.getRows=function(){return this.grid.getRows()},d.prototype.getPager=function(){return this.grid.getPager()},d.prototype.addRecord=function(e,t,i){if(this.editModule){this.editModule.isAddedRowByMethod=!0,this.editModule.addRecord(e,t,i)}},d.prototype.closeEdit=function(){this.grid.editModule&&this.grid.editModule.closeEdit()},d.prototype.saveCell=function(){this.grid.editModule&&this.grid.editModule.saveCell()},d.prototype.updateCell=function(e,t,i){this.grid.editModule&&this.grid.editModule.updateCell(e,t,i)},d.prototype.updateRow=function(e,i){if(this.grid.editModule)if(t.isNullOrUndefined(e))this.grid.editModule.updateRow(e,i);else{var r=this.grid.getCurrentViewRecords()[e];t.extend(r,i),this.grid.editModule.updateRow(e,r)}},d.prototype.deleteRecord=function(e,t){this.grid.editModule&&this.grid.editModule.deleteRecord(e,t)},d.prototype.startEdit=function(e){this.grid.editModule&&this.grid.editModule.startEdit(e)},d.prototype.editCell=function(e,t){this.editModule&&this.editModule.editCell(e,t)},d.prototype.enableToolbarItems=function(e,t){this.grid.toolbarModule&&this.grid.toolbarModule.enableItems(e,t)},d.prototype.endEdit=function(){this.grid.editModule&&this.grid.editModule.endEdit()},d.prototype.openColumnChooser=function(e,t){this.columnChooserModule&&this.columnChooserModule.openColumnChooser(e,t)},d.prototype.deleteRow=function(e){this.grid.editModule&&this.grid.editModule.deleteRow(e)},d.prototype.getPrimaryKeyFieldNames=function(){return this.grid.getPrimaryKeyFieldNames()},d.prototype.setCellValue=function(e,i,r){this.grid.setCellValue(e,i,r);var n=this.grid.getRowIndexByPrimaryKey(e),o=this.getCurrentViewRecords()[n];t.isNullOrUndefined(o)||v({value:o,action:"edit"},this,this.isSelfReference,o.index,this.grid.selectedRowIndex,i)},d.prototype.setRowData=function(e,t){var i=this.getCurrentViewRecords(),r=this.grid.getPrimaryKeyFieldNames()[0],n=0,o={};i.some(function(t){return t[r]===e&&(o=t,!0)}),n=o.level,t.level=n,t.index=o.index,t.childRecords=o.childRecords,t.taskData=o.taskData,t.uniqueID=o.uniqueID,t.parentItem=o.parentItem,t.checkboxState=o.checkboxState,t.hasChildRecords=o.hasChildRecords,t.parentUniqueID=o.parentUniqueID,t.expanded=o.expanded,this.grid.setRowData(e,t);var a=this.getVisibleRecords();if(a.length>0&&e===a[a.length-1][r]){var s=this.getContentTable().scrollHeight,d=this.getContent().clientHeight;this.lastRowBorder(this.getRows()[i.indexOf(o)],s<=d)}},d.prototype.goToPage=function(e){this.grid.pagerModule&&this.grid.pagerModule.goToPage(e)},d.prototype.updateExternalMessage=function(e){this.pagerModule&&this.grid.pagerModule.updateExternalMessage(e)},d.prototype.getCellFromIndex=function(e,t){return this.grid.getCellFromIndex(e,t)},d.prototype.getColumnByField=function(e){return i.iterateArrayOrObject(this.columnModel,function(t){if(t.field===e)return t})[0]},d.prototype.getColumnByUid=function(e){var t=this.initialRender?this.grid.columns:this.columns;return this.grid.columns.length!==this.columnModel.length&&(t=this.grid.columnModel),i.iterateArrayOrObject(t,function(t){if(t.uid===e)return t})[0]},d.prototype.getColumnFieldNames=function(){return this.grid.getColumnFieldNames()},d.prototype.getFooterContent=function(){return this.grid.getFooterContent()},d.prototype.getFooterContentTable=function(){return this.grid.getFooterContentTable()},d.prototype.showColumns=function(e,t){this.grid.showColumns(e,t),this.updateColumnModel()},d.prototype.hideColumns=function(e,t){this.grid.hideColumns(e,t),this.updateColumnModel()},d.prototype.getColumnHeaderByField=function(e){return this.grid.getColumnHeaderByField(e)},d.prototype.getColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getColumnHeaderByUid=function(e){return this.grid.getColumnHeaderByUid(e)},d.prototype.getColumnIndexByField=function(e){return this.grid.getColumnIndexByField(e)},d.prototype.getVirtualColIndexByUid=function(e){var r=i.iterateArrayOrObject(this.grid.columnModel,function(t,i){if(t.uid===e)return i})[0];return t.isNullOrUndefined(r)?-1:r},d.prototype.getColumnIndexByUid=function(e){return this.grid.getColumnIndexByUid(e)},d.prototype.getColumns=function(e){return this.updateColumnModel(this.grid.getColumns(e)),this.columnModel},d.prototype.updateColumnModel=function(e){var i,r,n=t.isNullOrUndefined(e)?this.grid.getColumns():e;-1!==this.treeColumnIndex&&this.columnModel[this.treeColumnIndex]&&!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex].template)&&(i=this.columnModel[this.treeColumnIndex].template,r=this.columnModel[this.treeColumnIndex].field);var o;if(!this.enableColumnVirtualization||this.enableColumnVirtualization&&this.columnModel.length===n.length){this.columnModel=[];for(var a=0;a<n.length;a++){o={};for(var s=0,d=Object.keys(n[a]);s<d.length;s++){var l=d[s];o[l]=n[a][l]}this.columnModel.push(new C(o)),r!==this.columnModel[a].field||"checkbox"===this.columnModel[a].type||t.isNullOrUndefined(i)||""===i||(this.columnModel[a].template=i)}}return this.deepMerge=["columns"],this.grid.columns.length!==this.columnModel.length&&(this.stackedHeader=!0),this.stackedHeader||t.merge(this.columns,this.columnModel),this.deepMerge=void 0,this.columnModel},d.prototype.getContent=function(){return this.grid.getContent()},d.prototype.mergePersistTreeGridData=function(){this.grid.mergePersistGridData.apply(this)},d.prototype.mergeColumns=function(e,t){this.grid.mergeColumns.apply(this,[e,t])},d.prototype.updateTreeGridModel=function(){this.setProperties({filterSettings:i.getObject("properties",this.grid.filterSettings)},!0),this.setProperties({pageSettings:i.getObject("properties",this.grid.pageSettings)},!0),this.setProperties({searchSettings:i.getObject("properties",this.grid.searchSettings)},!0),this.setProperties({sortSettings:i.getObject("properties",this.grid.sortSettings)},!0)},d.prototype.getContentTable=function(){return this.grid.getContentTable()},d.prototype.getDataRows=function(){for(var e=[],t=this.grid.getDataRows(),i=0,r=t.length;i<r;i++)t[i].classList.contains("e-summaryrow")||e.push(t[i]);return e},d.prototype.getCurrentViewRecords=function(){return this.grid.currentViewData},d.prototype.getBatchChanges=function(){return this.grid.editModule.getBatchChanges()},d.prototype.getHeaderContent=function(){return this.grid.getHeaderContent()},d.prototype.getHeaderTable=function(){return this.grid.getHeaderTable()},d.prototype.getRowByIndex=function(e){return this.grid.getRowByIndex(e)},d.prototype.getRowInfo=function(e){return this.grid.getRowInfo(e)},d.prototype.getUidByColumnField=function(e){return this.grid.getUidByColumnField(e)},d.prototype.getVisibleColumns=function(){for(var e=[],t=0,i=this.columnModel;t<i.length;t++){var r=i[t];r.visible&&e.push(r)}return e},d.prototype.showSpinner=function(){o.showSpinner(this.element)},d.prototype.hideSpinner=function(){o.hideSpinner(this.element)},d.prototype.refresh=function(){this.uniqueIDCollection={},this.convertTreeData(this.dataSource),s(this)||(this.dataSource instanceof n.DataManager?this.grid.setProperties({dataSource:new n.DataManager(this.dataSource.dataSource,this.dataSource.defaultQuery,this.dataSource.adaptor)},!0):this.grid.dataSource=this.flatData),this.grid.refresh()},d.prototype.getCheckedRecords=function(){return this.selectionModule.getCheckedrecords()},d.prototype.getVisibleRecords=function(){var e=[],t=this.getCurrentViewRecords();if(this.allowPaging)e=t;else for(var i=0;i<t.length;i++)e.push(t[i]),t[i].expanded||(i+=c(t[i]).length);return e},d.prototype.getCheckedRowIndexes=function(){return this.selectionModule.getCheckedRowIndexes()},d.prototype.selectCheckboxes=function(e){this.selectionModule.selectCheckboxes(e)},d.prototype.refreshColumns=function(e){t.isNullOrUndefined(e)||e?(this.grid.columns=this.getGridColumns(this.columns),this.grid.refreshColumns()):this.grid.setProperties({columns:this.getGridColumns(this.columns)},!0)},d.prototype.refreshHeader=function(){this.grid.refreshHeader()},d.prototype.expandCollapseRequest=function(e){if("Batch"===this.editSettings.mode){if((this.getBatchChanges()[this.changedRecords].length||this.getBatchChanges()[this.deletedRecords].length||this.getBatchChanges()[this.addedRecords].length)&&this.editSettings.showConfirmDialog){var t=this.grid.editModule.dialogObj;return this.grid.editModule.showDialog("CancelEdit",t),void(this.targetElement=e)}}if(this.rowTemplate){var i=e.closest(".e-treerowcell").parentElement,r=this.getCurrentViewRecords()[i.rowIndex];e.classList.contains("e-treegridexpand")?this.collapseRow(i,r):this.expandRow(i,r)}else{var n=this.grid.getRowInfo(e);r=n.rowData;if(this.grid.isFrozenGrid()&&this.enableVirtualization&&!Object.keys(r).length){r=this.grid.contentModule.freezeRows.filter(function(e){return e.uid===n.row.getAttribute("data-uid")})[0].data}this.enableImmutableMode&&(r=this.getCurrentViewRecords()[n.rowIndex]),e.classList.contains("e-treegridexpand")?this.collapseRow(n.row,r):this.expandRow(n.row,r)}},d.prototype.expandRow=function(e,i,r,n){var o=this;i=this.getCollapseExpandRecords(e,i),!t.isNullOrUndefined(e)&&e.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(e,!1);var d={data:i,row:e,cancel:!1};this.trigger("expanding",d,function(d){if(!d.cancel){o.expandCollapse("expand",e,i),d.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n);if((!a(o)||u(o))&&(!s(o)||!t.isNullOrUndefined(i.Children))){var l={data:i,row:e};o.setHeightForFrozenContent(),t.isNullOrUndefined(o.expandStateMapping)||o.updateExpandStateMapping(l.data,!0),o.trigger(K,l)}}})},d.prototype.expandCollapseAllChildren=function(e,i,r,n){if((t.isNullOrUndefined(r)||e[this.getPrimaryKeyFieldNames()[0]]===r)&&(t.isNullOrUndefined(n)||n===e.level)){var o=c(e).filter(function(e){return e.hasChildRecords});o.unshift(e);for(var a=0;a<o.length;a++)this.expandCollapse(i,null,o[a])}},d.prototype.setHeightForFrozenContent=function(){var e=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.grid.getFrozenColumns()>0||e)&&this.grid.contentModule.refreshScrollOffset()},d.prototype.getCollapseExpandRecords=function(e,i){return this.allowPaging&&"All"===this.pageSettings.pageSizeMode&&this.isExpandAll&&t.isNullOrUndefined(i)&&!a(this)?i=this.flatData.filter(function(e){return e.hasChildRecords}):t.isNullOrUndefined(i)&&(i=this.detailTemplate?this.grid.getCurrentViewRecords()[e.getAttribute("data-rowindex")]:this.grid.getCurrentViewRecords()[parseInt(e.getAttribute("data-rowindex"),10)]),i},d.prototype.collapseRow=function(e,i,r){var n=this,o={data:i=this.getCollapseExpandRecords(e,i),row:e,cancel:!1};this.trigger("collapsing",o,function(o){if(!o.cancel){o.collapseAll&&n.expandCollapseAllChildren(i,"collapse",r),n.expandCollapse("collapse",e,i);var s={data:i,row:e};if(!a(n)&&(n.setHeightForFrozenContent(),t.isNullOrUndefined(n.expandStateMapping)||n.updateExpandStateMapping(s.data,!1),n.trigger(W,s),n.enableInfiniteScrolling)){n.grid.getContent().firstElementChild.scrollHeight-n.grid.getContent().firstElementChild.scrollTop<n.grid.getRowHeight()+ +n.height&&n.grid.getContent().firstElementChild.scrollBy(0,n.grid.getRowHeight())}}})},d.prototype.updateExpandStateMapping=function(e,t){var i=e;if(i.length)for(var r=0;r<i.length;r++)i[r][this.expandStateMapping]=t,v({value:i[r],action:"edit"},this,this.isSelfReference,i[r].index,this.grid.selectedRowIndex,this.expandStateMapping);else e[this.expandStateMapping]=t,v({value:e,action:"edit"},this,this.isSelfReference,e.index,this.grid.selectedRowIndex,this.expandStateMapping)},d.prototype.expandAtLevel=function(e){if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!0),t.hasChildRecords&&t.level===e});this.expandAction(t,null,e,!0)}else{t=this.getRecordDetails(e);var r=i.getObject("records",t);this.expandAction(r,null,e)}},d.prototype.expandByKey=function(e){this.expandCollapseActionByKey(e,"Expand")},d.prototype.expandAction=function(e,i,r,n){void 0===n&&(n=!1);for(var o=function(o){if(!t.isNullOrUndefined(e[o].parentItem)){var d=e[o].parentItem.uniqueID,l=s.flatData.filter(function(e){return e.uniqueID===d});a(s)&&(l=s.getCurrentViewRecords().filter(function(e){return e.uniqueID===d})),!1===l[0].expanded?(e.push(l[0]),l[0].expanded=!0):h(s,l[0],s.parentData)||l[0].expanded&&void 0!==l[0].parentItem&&e.push(l[0])}n||s.expandRow(null,e[o],i,r)},s=this,d=0;d<e.length;d++)o(d);n&&this.expandRow(null,e,i,r)},d.prototype.getRecordDetails=function(e){var t=this.getRows().filter(function(t){return-1!==t.className.indexOf("level"+e)&&(t.querySelector(".e-treegridcollapse")||t.querySelector(".e-treegridexpand"))});return{records:this.getCurrentViewRecords().filter(function(t){return t.level===e&&t.hasChildRecords}),rows:t}},d.prototype.collapseAtLevel=function(e){if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!1),t.hasChildRecords&&t.level===e});this.collapseAction(t,null,!0)}else{var r=this.getRecordDetails(e),n=i.getObject("records",r);this.collapseAction(n)}},d.prototype.collapseByKey=function(e){this.expandCollapseActionByKey(e,"Collapse")},d.prototype.expandCollapseActionByKey=function(e,i){var r=this.getPrimaryKeyFieldNames()[0],n=a(this)?this.getCurrentViewRecords():this.grid.dataSource;if(!t.isNullOrUndefined(r)){var o=n.filter(function(t){return t[r].toString()===e.toString()});"Expand"===i?this.expandAction(o,e,null):this.collapseAction(o,e)}},d.prototype.collapseAction=function(e,t,i){if(void 0===i&&(i=!1),i)this.collapseRow(null,e);else for(var r=0;r<e.length;r++)this.collapseRow(null,e[r],t);if(!this.grid.contentModule.isDataSourceChanged&&this.enableVirtualization&&this.getRows()&&this.parentData.length===this.getRows().length){this.grid.contentModule.startIndex=-1,this.grid.contentModule.endIndex=-1}},d.prototype.expandAll=function(){this.expandCollapseAll("expand")},d.prototype.collapseAll=function(){this.expandCollapseAll("collapse")},d.prototype.expandCollapseAll=function(e){var t=this.getRows().filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))});if(!t.length&&this.getRows().length&&t.push(this.getRows()[0]),this.isExpandAll=!0,this.isCollapseAll=!0,(this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization||this.enableInfiniteScrolling)&&!a(this)){if(this.flatData.filter(function(t){t.hasChildRecords&&(t.expanded="collapse"!==e)}),t.length)for(var i=0;i<t.length;i++)"collapse"===e?this.collapseRow(t[i]):this.expandRow(t[i]);else if(this.allowPaging){var r=this.enableCollapseAll;this.setProperties({enableCollapseAll:!0},!0),this.grid.pagerModule.goToPage(1),this.setProperties({enableCollapseAll:r},!0)}}else for(i=0;i<t.length;i++)"collapse"===e?this.collapseRow(t[i]):this.expandRow(t[i]);this.isExpandAll=!1,this.isCollapseAll=!1},d.prototype.expandCollapse=function(e,i,r,n){var o,d={row:i,data:r,childData:[],requestType:e},l=this.getCurrentViewRecords().filter(function(e){return e.parentUniqueID===r.uniqueID});(!a(this)&&"expand"===e&&this.isSelfReference&&s(this)&&!l.length||"collapse"===e||this.isExpandAll&&this.loadChildOnDemand&&!a(this)&&this.isSelfReference&&s(this))&&this.updateChildOnDemand(d);var p=this.getRows();if(this.rowTemplate){var h=this.getContentTable().rows;p=[].slice.call(h)}if(t.isNullOrUndefined(i)?i=p[this.getCurrentViewRecords().indexOf(r)]:+i.getAttribute("data-rowindex"),t.isNullOrUndefined(i)||i.setAttribute("aria-expanded","expand"===e?"true":"false"),!(this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization||this.enableInfiniteScrolling)||a(this)||s(this)){var c=void 0;if("expand"===e){if(c="table-row",n||(r.expanded=!0,this.uniqueIDCollection[r.uniqueID].expanded=r.expanded),t.isNullOrUndefined(i)||(o=i.getElementsByClassName("e-treegridcollapse")[0]),n&&!t.isNullOrUndefined(r[this.expandStateMapping])&&r[this.expandStateMapping]&&t.isNullOrUndefined(o)&&(o=i.getElementsByClassName("e-treegridexpand")[0]),t.isNullOrUndefined(o))return;o.classList.contains("e-treegridexpand")||t.addClass([o],"e-treegridexpand"),t.removeClass([o],"e-treegridcollapse")}else{if(c="none",n&&!s(this)||(r.expanded=!1,this.uniqueIDCollection[r.uniqueID].expanded=r.expanded),t.isNullOrUndefined(i)||(o=i.getElementsByClassName("e-treegridexpand")[0]),n&&!t.isNullOrUndefined(r[this.expandStateMapping])&&!r[this.expandStateMapping]&&t.isNullOrUndefined(o)&&(o=i.getElementsByClassName("e-treegridcollapse")[0]),t.isNullOrUndefined(o))return;o.classList.contains("e-treegridcollapse")||t.addClass([o],"e-treegridcollapse"),t.removeClass([o],"e-treegridexpand")}i.querySelectorAll(".e-treerowcell")[0].setAttribute("aria-expanded","expand"===e?"true":"false");var g=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))});if(a(this)&&!u(this)?this.remoteExpand(e,i,r):s(this)&&!l.length&&"collapse"!==e||this.localExpand(e,i,r),!t.isNullOrUndefined(o)&&o.closest(".e-treerowcell").classList.contains("e-cellselectionbackground")&&(o.closest(".e-treerowcell").classList.remove("e-cellselectionbackground"),o.closest(".e-treerowcell").removeAttribute("aria-selected")),this.isPixelHeight()&&!i.cells[0].classList.contains("e-lastrowcell"))for(var f=this.getRows(),y=(h=this.getContentTable().rows,(f=[].slice.call(h)).length-1);y>=0;y--)if(!m(f[y])){var v=this.getContentTable().scrollHeight,w=this.getContent().clientHeight;this.lastRowBorder(f[y],v<=w);break}this.notify("rowExpandCollapse",{detailrows:g,action:c,record:r,row:i}),this.updateAltRow(p)}else this.notify(J,{action:e,row:i,record:r})},d.prototype.updateChildOnDemand=function(e){var r=this;if("collapse"===e.requestType&&s(this)){for(var o=this.flatData.slice(),a=0;a<o.length;a++)o[a].parentUniqueID===e.data.uniqueID&&(o.splice(a,1),a-=1);this.dataResults.result=o}else{var d=new n.Deferred;e.childDataBind=d.resolve;var l=e.data;this.trigger(L,e),d.promise.then(function(){if(e.childData.length){s(r)&&(r.flatData=r.dataResults.result),r.enableInfiniteScrolling&&s(r)&&(r.flatData=r.infiniteScrollData);for(var n=r.flatData,o=0,a=0;a<n.length;a++)if(n[a].taskData===l.taskData){o=a;break}var d=t.getValue("result",r.dataSource),p=g(e.childData),h=l[r.childMapping]&&l[r.childMapping].length>p.length?l[r.childMapping].length:p.length;for(a=0;a<h;a++)l[r.childMapping]&&d.filter(function(e,t){e[r.parentIdMapping]===l[r.idMapping]&&d.splice(t,1)}),p[a]?(p[a].level=l.level+1,p[a].index=Math.ceil(1e3*Math.random()),p[a].parentItem=t.extend({},l),p[a].taskData=t.extend({},p[a]),delete p[a].parentItem.childRecords,delete p[a].taskData.parentItem,p[a].parentUniqueID=l.uniqueID,p[a].uniqueID=i.getUid(r.element.id+"_data_"),t.setValue("uniqueIDCollection."+p[a].uniqueID,p[a],r),(!t.isNullOrUndefined(p[a][r.childMapping])||p[a][r.hasChildMapping]&&s(r))&&(p[a].hasChildRecords=!0),s(r)&&l[r.childMapping]&&l[r.childMapping][a]?n.splice(o+1+a,0,p[a]):n.splice(o+1+a,l[r.childMapping]&&l[r.childMapping][a]?1:0,p[a])):n.splice(o+1+a,1);n[o][r.childMapping]=p,n[o].childRecords=p,n[o].expanded=!0,t.setValue("uniqueIDCollection."+n[o].uniqueID,n[o],r);for(var c=0;c<e.childData.length;c++)d.push(e.childData[c])}s(r)&&r.loadChildOnDemand&&"expand"===e.requestType&&(r.dataResults.expandRecord={},r.dataResults.expandRecord=e.data),r.isExpandRefresh=!0;var u=r.getContentTable().parentElement.scrollTop;r.grid.refresh(),r.setHeightForFrozenContent(),r.enableInfiniteScrolling&&(r.getContentTable().parentElement.scrollTop=u),r.trigger(K,e)})}},d.prototype.remoteExpand=function(e,t,i){var r=this.getRows();if(this.rowTemplate){var n=this.getContentTable().rows;r=[].slice.call(n)}var o={data:i,row:t},a=[];if(a=r.filter(function(e){return e.querySelector(".e-gridrowindex"+i.index+"level"+(i.level+1))||e.querySelector(".e-gridrowindex"+i.index+"level0.e-summarycell")}),"expand"===e){this.notify(Y,{record:i,rows:a,parentRow:t});var s={row:t,data:i};a.length>0&&(this.setHeightForFrozenContent(),this.trigger(K,s))}else this.collapseRemoteChild({record:i,rows:a}),this.setHeightForFrozenContent(),this.trigger(W,o)},d.prototype.localExpand=function(e,i,r){var n,o=this.getCurrentViewRecords().filter(function(e){return e.parentUniqueID===r.uniqueID});this.isPixelHeight()&&i.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(i,!1);var d,l,p=this.getRows();if(this.rowTemplate){var h=this.getContentTable().rows;p=[].slice.call(h)}var c="expand"===e?"table-row":"none",u=this.getPrimaryKeyFieldNames()[0];if(this.enableImmutableMode&&!this.allowPaging){n=[];for(var g=0;g<o.length;g++){var f=this.grid.getRowIndexByPrimaryKey(o[g][u]);n.push(this.getRows()[f])}}else n=p.filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))});var y=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.frozenRows||this.frozenColumns||this.getFrozenColumns()||y)&&(d=this.getMovableRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))})),y&&(l=this.getFrozenRightRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))}));var m=this.grid.getRowsObject();t.isNullOrUndefined(m[this.getCurrentViewRecords().indexOf(r)].visible)||!1===m[this.getCurrentViewRecords().indexOf(r)].visible||(m[this.getCurrentViewRecords().indexOf(r)].visible=!0);var v=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))});for(g=0;g<n.length;g++){if(t.isNullOrUndefined(n[g])||(n[g].style.display=c),!t.isNullOrUndefined(n[g])&&!this.allowPaging&&!(this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this))){m[n[g].rowIndex].visible="none"!=c;var w=t.getValue("uniqueIDCollection."+r.parentUniqueID,this);!t.isNullOrUndefined(w)&&p[this.getCurrentViewRecords().indexOf(w)].getElementsByClassName("e-treegridcollapse").length&&(m[this.getCurrentViewRecords().indexOf(r)].visible=!1)}t.isNullOrUndefined(d)||(d[g].style.display=c),t.isNullOrUndefined(l)||(l[g].style.display=c),this.notify("childRowExpand",{row:n[g]}),!t.isNullOrUndefined(o[g].childRecords)&&o[g].childRecords.length>0&&("expand"!==e||t.isNullOrUndefined(o[g].expanded)||o[g].expanded)&&(this.expandCollapse(e,n[g],o[g],!0),this.frozenColumns<=this.treeColumnIndex&&!t.isNullOrUndefined(d)&&this.expandCollapse(e,d[g],o[g],!0))}for(g=0;g<v.length;g++)t.isNullOrUndefined(v[g])||this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||(m[v[g].rowIndex].visible="none"!=c,v[g].style.display=c);this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||this.grid.notify("refresh-Expand-and-Collapse",{rows:this.grid.getRowsObject()})},d.prototype.updateAltRow=function(e){if(this.enableAltRow&&!this.rowTemplate)for(var i=0,r=0;e&&r<e.length;r++){var n=e[r];"none"!==n.style.display&&(n.classList.contains("e-altrow")&&t.removeClass([n],"e-altrow"),i%2==0||n.classList.contains("e-summaryrow")||n.classList.contains("e-detailrow")||t.addClass([n],"e-altrow"),n.classList.contains("e-summaryrow")||n.classList.contains("e-detailrow")||i++)}},d.prototype.treeColumnRowTemplate=function(){if(this.rowTemplate){var e=this.getContentTable().rows;e=[].slice.call(e);for(var t=0;t<e.length;t++){var i=this.grid.getContentTable().rows[t].cells[this.treeColumnIndex],r=e[t],n={data:this.grid.getRowsObject()[t].data,row:r,cell:i,column:this.getColumns()[this.treeColumnIndex]};this.renderModule.cellRender(n)}}},d.prototype.collapseRemoteChild=function(e,i){i||(e.record.expanded=!1);var r,n,o=e.rows,a=[],s=[],d=this.getFrozenLeftColumnsCount()>0||this.getFrozenRightColumnsCount()>0;d&&(a=this.getMovableRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))}),s=this.getFrozenRightRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))}));for(var l=0;l<o.length;l++){o[l].style.display="none",r=o[l];var p=o[l].querySelector(".e-detailrowexpand");if(t.isNullOrUndefined(p)||this.grid.detailRowModule.collapse(p),d&&(a[l].style.display="none",s[l].style.display="none",o[l].querySelector(".e-treecolumn-container .e-treegridexpand")||(a[l].querySelector(".e-treecolumn-container .e-treegridexpand")?r=a[l]:s[l].querySelector(".e-treecolumn-container .e-treegridexpand")&&(r=s[l]))),r.querySelector(".e-treecolumn-container .e-treegridexpand")){var h=r.querySelector(".e-treecolumn-container .e-treegridexpand");n=this.rowTemplate?this.grid.getCurrentViewRecords()[o[l].rowIndex]:this.grid.getRowObjectFromUID(o[l].getAttribute("data-Uid")).data,!t.isNullOrUndefined(h)&&n.expanded&&(t.removeClass([h],"e-treegridexpand"),t.addClass([h],"e-treegridcollapse"));for(var c=[],u=this.getRows(),g=0;g<u.length;g++)u[g].querySelector(".e-gridrowindex"+n.index+"level"+(n.level+1))&&c.push(u[g]);c.length&&n.expanded&&this.collapseRemoteChild({record:n,rows:c},!0)}}},d.prototype.updateRowAndCellElements=function(e,t,i){for(var r=0;r<e.length;r++)this.renderModule.cellRender({data:e[r],cell:t[r].cells[i],column:this.grid.getColumns()[this.treeColumnIndex],requestType:"rowDragAndDrop"}),"indenting"!==this.action&&"outdenting"!==this.action||this.renderModule.RowModifier({data:e[r],row:t[r]})},d.prototype.addListener=function(){this.on("updateResults",this.updateResultModel,this),this.grid.on("initial-end",this.afterGridRender,this)},d.prototype.updateResultModel=function(e){this.dataResults=e},d.prototype.removeListener=function(){this.isDestroyed||(this.off("updateResults",this.updateResultModel),this.grid.off("initial-end",this.afterGridRender))},d.prototype.filterByColumn=function(e,t,i,r,n,o,a,s){this.grid.filterByColumn(e,t,i,r,n,o,a,s)},d.prototype.clearFiltering=function(){this.grid.clearFiltering()},d.prototype.removeFilteredColsByField=function(e,t){this.grid.removeFilteredColsByField(e,t)},d.prototype.selectRow=function(e,t){this.grid.selectRow(e,t)},d.prototype.selectRows=function(e){this.grid.selectRows(e)},d.prototype.clearSelection=function(){this.grid.clearSelection()},d.prototype.copy=function(e){this.clipboardModule.copy(e)},d.prototype.paste=function(e,t,i){this.clipboardModule.paste(e,t,i)},d.prototype.selectCell=function(e,t){this.grid.selectCell(e,t)},d.prototype.getSelectedRows=function(){return this.grid.getSelectedRows()},d.prototype.getMovableCellFromIndex=function(e,t){return this.grid.getMovableCellFromIndex(e,t)},d.prototype.getMovableDataRows=function(){return this.grid.getMovableDataRows()},d.prototype.getMovableRowByIndex=function(e){return this.grid.getMovableRowByIndex(e)},d.prototype.getMovableRows=function(){return this.grid.getMovableRows()},d.prototype.getFrozenRightRowByIndex=function(e){return this.grid.getFrozenRightRowByIndex(e)},d.prototype.getFrozenRightRows=function(){return this.grid.getFrozenRightRows()},d.prototype.getFrozenRightDataRows=function(){return this.grid.getFrozenRightDataRows()},d.prototype.getFrozenRightCellFromIndex=function(e,t){return this.grid.getFrozenRightCellFromIndex(e,t)},d.prototype.getFrozenLeftColumnHeaderByIndex=function(e){return this.grid.getFrozenLeftColumnHeaderByIndex(e)},d.prototype.getFrozenRightColumnHeaderByIndex=function(e){return this.grid.getFrozenRightColumnHeaderByIndex(e)},d.prototype.getMovableColumnHeaderByIndex=function(e){return this.grid.getMovableColumnHeaderByIndex(e)},d.prototype.getMovableColumnsCount=function(){return this.grid.getMovableColumnsCount()},d.prototype.getFrozenLeftColumnsCount=function(){return this.grid.getFrozenLeftColumnsCount()},d.prototype.getFrozenRightColumnsCount=function(){return this.grid.getFrozenRightColumnsCount()},d.prototype.getFrozenLeftColumns=function(){return this.updateColumnModel(this.grid.getFrozenLeftColumns()),this.columnModel},d.prototype.getFrozenRightColumns=function(){return this.updateColumnModel(this.grid.getFrozenRightColumns()),this.columnModel},d.prototype.getVisibleMovableCount=function(){return this.grid.getVisibleMovableCount()},d.prototype.getVisibleFrozenRightCount=function(){return this.grid.getVisibleFrozenRightCount()},d.prototype.getVisibleFrozenLeftCount=function(){return this.grid.getVisibleFrozenLeftCount()},d.prototype.getMovableColumns=function(){return this.updateColumnModel(this.grid.getMovableColumns()),this.columnModel},d.prototype.getFrozenColumns=function(){return this.getFrozenCount(this.columns,0)+this.frozenColumns},d.prototype.getFrozenCount=function(e,t){for(var i=0,r=e.length;i<r;i++)e[i].columns?t=this.getFrozenCount(e[i].columns,t):e[i].isFrozen&&t++;return t},d.prototype.getSelectedRowIndexes=function(){return this.grid.getSelectedRowIndexes()},d.prototype.getSelectedRowCellIndexes=function(){return this.grid.getSelectedRowCellIndexes()},d.prototype.getSelectedRecords=function(){return this.grid.getSelectedRecords()},d.prototype.getDataModule=function(){return{baseModule:this.grid.getDataModule(),treeModule:this.dataModule}},d.prototype.reorderRows=function(e,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},d.prototype.indent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"indent"))},d.prototype.outdent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"outdent"))};var l;return lt([t.Property(0)],d.prototype,"frozenRows",void 0),lt([t.Property(0)],d.prototype,"frozenColumns",void 0),lt([t.Property("Ellipsis")],d.prototype,"clipMode",void 0),lt([t.Property([])],d.prototype,"columns",void 0),lt([t.Property(null)],d.prototype,"childMapping",void 0),lt([t.Property(null)],d.prototype,"hasChildMapping",void 0),lt([t.Property(0)],d.prototype,"treeColumnIndex",void 0),lt([t.Property(null)],d.prototype,"idMapping",void 0),lt([t.Property(null)],d.prototype,"parentIdMapping",void 0),lt([t.Property(!1)],d.prototype,"enableCollapseAll",void 0),lt([t.Property(null)],d.prototype,"expandStateMapping",void 0),lt([t.Property(!1)],d.prototype,"allowRowDragAndDrop",void 0),lt([t.Property([])],d.prototype,"dataSource",void 0),lt([t.Property()],d.prototype,"query",void 0),lt([t.Property()],d.prototype,"cloneQuery",void 0),lt([t.Property("AllPages")],d.prototype,"printMode",void 0),lt([t.Property(!1)],d.prototype,"allowPaging",void 0),lt([t.Property(!1)],d.prototype,"loadChildOnDemand",void 0),lt([t.Property(!1)],d.prototype,"allowTextWrap",void 0),lt([t.Complex({},O)],d.prototype,"textWrapSettings",void 0),lt([t.Property(!1)],d.prototype,"allowReordering",void 0),lt([t.Property(!1)],d.prototype,"allowResizing",void 0),lt([t.Property(!1)],d.prototype,"autoCheckHierarchy",void 0),lt([t.Complex({},Ke)],d.prototype,"pageSettings",void 0),lt([t.Complex({},i.RowDropSettings)],d.prototype,"rowDropSettings",void 0),lt([t.Property()],d.prototype,"pagerTemplate",void 0),lt([t.Property(!1)],d.prototype,"showColumnMenu",void 0),lt([t.Property(!1)],d.prototype,"showColumnChooser",void 0),lt([t.Property(!1)],d.prototype,"allowSorting",void 0),lt([t.Property(!0)],d.prototype,"allowMultiSorting",void 0),lt([t.Complex({},nt)],d.prototype,"sortSettings",void 0),lt([t.Collection([],Xe)],d.prototype,"aggregates",void 0),lt([t.Complex({},et)],d.prototype,"editSettings",void 0),lt([t.Property(!1)],d.prototype,"allowFiltering",void 0),lt([t.Property()],d.prototype,"detailTemplate",void 0),lt([t.Complex({},I)],d.prototype,"filterSettings",void 0),lt([t.Complex({},Le)],d.prototype,"searchSettings",void 0),lt([t.Property()],d.prototype,"toolbar",void 0),lt([t.Property()],d.prototype,"toolbarTemplate",void 0),lt([t.Property("Default")],d.prototype,"gridLines",void 0),lt([t.Property()],d.prototype,"contextMenuItems",void 0),lt([t.Property()],d.prototype,"columnMenuItems",void 0),lt([t.Property()],d.prototype,"rowTemplate",void 0),lt([t.Property("Parent")],d.prototype,"copyHierarchyMode",void 0),lt([t.Property(null)],d.prototype,"rowHeight",void 0),lt([t.Property(!0)],d.prototype,"enableAltRow",void 0),lt([t.Property(!0)],d.prototype,"allowKeyboard",void 0),lt([t.Property(!1)],d.prototype,"enableHover",void 0),lt([t.Property(!1)],d.prototype,"enableAutoFill",void 0),lt([t.Property(!1)],d.prototype,"enableAdaptiveUI",void 0),lt([t.Property(!1)],d.prototype,"enableImmutableMode",void 0),lt([t.Property("auto")],d.prototype,"height",void 0),lt([t.Property("auto")],d.prototype,"width",void 0),lt([t.Property(!1)],d.prototype,"enableVirtualization",void 0),lt([t.Property(!1)],d.prototype,"enableColumnVirtualization",void 0),lt([t.Property(!1)],d.prototype,"enableInfiniteScrolling",void 0),lt([t.Complex({},st)],d.prototype,"infiniteScrollSettings",void 0),lt([t.Property("All")],d.prototype,"columnQueryMode",void 0),lt([t.Event()],d.prototype,"created",void 0),lt([t.Event()],d.prototype,"load",void 0),lt([t.Event()],d.prototype,"expanding",void 0),lt([t.Event()],d.prototype,"expanded",void 0),lt([t.Event()],d.prototype,"collapsing",void 0),lt([t.Event()],d.prototype,"collapsed",void 0),lt([t.Event()],d.prototype,"cellSave",void 0),lt([t.Event()],d.prototype,"cellSaved",void 0),lt([t.Event()],d.prototype,"actionBegin",void 0),lt([t.Event()],d.prototype,"actionComplete",void 0),lt([t.Event()],d.prototype,"beginEdit",void 0),lt([t.Event()],d.prototype,"batchAdd",void 0),lt([t.Event()],d.prototype,"batchDelete",void 0),lt([t.Event()],d.prototype,"batchCancel",void 0),lt([t.Event()],d.prototype,"beforeBatchAdd",void 0),lt([t.Event()],d.prototype,"beforeBatchDelete",void 0),lt([t.Event()],d.prototype,"beforeBatchSave",void 0),lt([t.Event()],d.prototype,"cellEdit",void 0),lt([t.Event()],d.prototype,"actionFailure",void 0),lt([t.Event()],d.prototype,"dataBound",void 0),lt([t.Event()],d.prototype,"dataSourceChanged",void 0),lt([t.Event()],d.prototype,"dataStateChange",void 0),lt([t.Event()],d.prototype,"recordDoubleClick",void 0),lt([t.Event()],d.prototype,"rowDataBound",void 0),lt([t.Event()],d.prototype,"detailDataBound",void 0),lt([t.Event()],d.prototype,"queryCellInfo",void 0),lt([t.Property(!0)],d.prototype,"allowSelection",void 0),lt([t.Event()],d.prototype,"rowSelecting",void 0),lt([t.Event()],d.prototype,"rowSelected",void 0),lt([t.Event()],d.prototype,"rowDeselecting",void 0),lt([t.Event()],d.prototype,"rowDeselected",void 0),lt([t.Event()],d.prototype,"headerCellInfo",void 0),lt([t.Event()],d.prototype,"cellSelecting",void 0),lt([t.Event()],d.prototype,"columnMenuOpen",void 0),lt([t.Event()],d.prototype,"columnMenuClick",void 0),lt([t.Event()],d.prototype,"cellSelected",void 0),lt([t.Event()],d.prototype,"cellDeselecting",void 0),lt([t.Event()],d.prototype,"cellDeselected",void 0),lt([t.Event()],d.prototype,"resizeStart",void 0),lt([t.Event()],d.prototype,"resizing",void 0),lt([t.Event()],d.prototype,"resizeStop",void 0),lt([t.Event()],d.prototype,"columnDragStart",void 0),lt([t.Event()],d.prototype,"columnDrag",void 0),lt([t.Event()],d.prototype,"columnDrop",void 0),lt([t.Event()],d.prototype,"checkboxChange",void 0),lt([t.Event()],d.prototype,"printComplete",void 0),lt([t.Event()],d.prototype,"beforePrint",void 0),lt([t.Event()],d.prototype,"toolbarClick",void 0),lt([t.Event()],d.prototype,"beforeDataBound",void 0),lt([t.Event()],d.prototype,"contextMenuOpen",void 0),lt([t.Event()],d.prototype,"contextMenuClick",void 0),lt([t.Event()],d.prototype,"beforeCopy",void 0),lt([t.Event()],d.prototype,"beforePaste",void 0),lt([t.Event()],d.prototype,"rowDrag",void 0),lt([t.Event()],d.prototype,"rowDragStart",void 0),lt([t.Event()],d.prototype,"rowDragStartHelper",void 0),lt([t.Event()],d.prototype,"rowDrop",void 0),lt([t.Property(-1)],d.prototype,"selectedRowIndex",void 0),lt([t.Complex({},je)],d.prototype,"selectionSettings",void 0),lt([t.Property(!1)],d.prototype,"allowExcelExport",void 0),lt([t.Property(!1)],d.prototype,"allowPdfExport",void 0),lt([t.Event()],d.prototype,"pdfQueryCellInfo",void 0),lt([t.Event()],d.prototype,"pdfHeaderQueryCellInfo",void 0),lt([t.Event()],d.prototype,"excelQueryCellInfo",void 0),lt([t.Event()],d.prototype,"excelHeaderQueryCellInfo",void 0),lt([t.Event()],d.prototype,"beforeExcelExport",void 0),lt([t.Event()],d.prototype,"excelExportComplete",void 0),lt([t.Event()],d.prototype,"beforePdfExport",void 0),lt([t.Event()],d.prototype,"pdfExportComplete",void 0),d=l=lt([t.NotifyPropertyChanges],d)}(t.Component),ht=function(){function e(e){i.Grid.Inject(i.Reorder),this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"reorder"},e.prototype.addEventListener=function(){this.parent.on("getColumnIndex",this.getTreeColumn,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("getColumnIndex",this.getTreeColumn)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getTreeColumn=function(){for(var e,t=this.parent.columnModel[this.parent.treeColumnIndex],r=this.parent.getColumns(),n=0;n<r.length;n++){if(i.getObject("field",t)===i.getObject("field",r[n])){e=n;break}}this.parent.setProperties({treeColumnIndex:e},!0)},e}(),ct=function(){function e(e){i.Grid.Inject(i.Resize),this.parent=e}return e.prototype.autoFitColumns=function(e){this.parent.grid.autoFitColumns(e)},e.prototype.getModuleName=function(){return"resize"},e.prototype.destroy=function(){this.parent.isDestroyed||this.parent.grid.resizeModule.destroy()},e}(),ut=function(){function e(e){this.canDrop=!0,this.isDraggedWithChild=!1,this.modifiedRecords="modifiedRecords",this.selectedRecords="selectedRecords",this.selectedRows="selectedRows",this.hasDropItem=!0,this.isaddtoBottom=!1,i.Grid.Inject(i.RowDD),this.parent=e,this.addEventListener()}return e.prototype.getChildrecordsByParentID=function(e){return(this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource).filter(function(t){return t.uniqueID===e})},e.prototype.addEventListener=function(){this.parent.on(De,this.Rowdraging,this),this.parent.on(Me,this.rowDropped,this),this.parent.on(Se,this.rowsAdded,this),this.parent.on(Ie,this.rowsRemoved,this)},e.prototype.reorderRows=function(e,i,r){var n=this.parent,o="updateRowAndCellElements";if(e[0]!==i&&-1!==["above","below","child"].indexOf(r)){"above"===r&&(this.dropPosition="topSegment"),"below"===r&&(this.dropPosition="bottomSegment"),"child"===r&&(this.dropPosition="middleSegment"),this.parent.dropPosition=this.dropPosition;for(var a=[],d=0;d<e.length;d++){var l=this.parent.getRowByIndex(e[d]).rowIndex;a[d]=this.parent.getCurrentViewRecords()[l]}var p={data:a,dropIndex:i};if(s(this.parent)||this.dropRows(p,!0),n.isLocalData&&(n.flatData=this.orderToIndex(n.flatData)),"outdenting"===this.parent.action&&(t.isNullOrUndefined(a[0].parentItem)||(a[0].level=a[0].parentItem.level+1)),this.parent.grid.refresh(),this.parent.enableImmutableMode&&"middleSegment"===this.dropPosition){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"indenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var h=this.parent.getRows()[e[0]],c=p.data[0],u=[];(m=[]).push(c),u.push(h);var g=y(this.parent,p.data[0].parentUniqueID),f=this.parent.getRows()[i];m.push(g),u.push(f),this.parent[o](m,u,l)}if(this.parent.enableImmutableMode&&"outdenting"===this.parent.action){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"outdenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var m,v=p.data[0];h=this.parent.getRows()[e[0]],u=[];(m=[]).push(v),u.push(h),this.parent[o](m,u,l)}}},e.prototype.indentOutdentAction=function(e,i){var r=this.parent,n=-1;if(!t.isNullOrUndefined(e)||-1!==this.parent.selectedRowIndex){this.parent.enableVirtualization&&-1!==this.parent.selectedRowIndex?n=this.parent.getSelectedRows()[0].rowIndex:-1!==this.parent.selectedRowIndex&&(n=this.parent.selectedRowIndex),this.selectedItem=t.isNullOrUndefined(e)?r.getCurrentViewRecords()[n]:e;var o=this.parent.getPrimaryKeyFieldNames()[0],a=this.parent.grid.getRowIndexByPrimaryKey(this.selectedItem[o]);if(this.selectedRow=this.parent[this.selectedRows]=-1!==n?this.parent.getSelectedRows()[0]:this.parent.grid.getRowByIndex(a),this.selectedRecord=this.parent[this.selectedRecords]=-1!==n?r.getCurrentViewRecords()[n]:this.selectedItem,"indent"===i){var s=r.getCurrentViewRecords()[this.selectedRow.rowIndex-1],d=void 0;if(0===this.selectedRow.rowIndex||-1===this.selectedRow.rowIndex||r.getCurrentViewRecords()[this.selectedRow.rowIndex].level-s.level==1)return;if(s.level>this.selectedRecord.level)for(var l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[l].taskData===s.parentItem.taskData&&(d=l,r.enableVirtualization&&(d=parseInt(r.getRows()[l].getAttribute("data-rowindex"),10)));else d=this.selectedRow.rowIndex-1;!this.parent.enableVirtualization||!this.selectedRecord||s.level>this.selectedRecord.level||(d=parseInt(this.selectedRow.getAttribute("data-rowindex"),10)-1),r.action="indenting",r.dropIndex=d,this.eventTrigger("indenting",d)}else if("outdent"===i){if(-1===this.selectedRow.rowIndex||0===this.selectedRow.rowIndex||0===r.getCurrentViewRecords()[this.selectedRow.rowIndex].level)return;d=void 0;var p=this.selectedRecord.parentItem;for(l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[l].uniqueID===p.uniqueID&&(d=l);this.parent.enableVirtualization&&this.selectedRecord&&(d=parseInt(this.parent.getRows()[d].getAttribute("data-rowindex"),10)),r.action="outdenting",r.dropIndex=d,this.eventTrigger("outdenting",d)}}},e.prototype.eventTrigger=function(e,t){var i=this,r={action:e,cancel:!1,data:[this.parent[this.selectedRecords]],row:this.parent[this.selectedRows]};this.parent.trigger(T,r,function(e){e.cancel||("indenting"===e.action?i.parent.enableVirtualization?i.reorderRows([parseInt(i.selectedRow.getAttribute("data-rowindex"),10)],t,"child"):i.reorderRows([i.selectedRow.rowIndex],t,"child"):"outdenting"===e.action&&(i.parent.enableVirtualization?i.reorderRows([parseInt(i.selectedRow.getAttribute("data-rowindex"),10)],t,"below"):i.reorderRows([i.selectedRow.rowIndex],t,"below")))})},e.prototype.orderToIndex=function(e){for(var i=0;i<e.length;i++)if(e[i].index=i,!t.isNullOrUndefined(e[i].parentItem)){var r=t.getValue("uniqueIDCollection."+e[i].parentUniqueID,this.parent);e[i].parentItem.index=r.index}return e},e.prototype.rowsAdded=function(e){for(var i,r=e.records,o=e.records.length-1;o>-1;o--)if((i=r[o]).parentUniqueID){var a=r.filter(function(e){return e.uniqueID===i.parentUniqueID});if(a.length){var s=a[0].childRecords.indexOf(i),d=a[0];-1!==s&&(t.isNullOrUndefined(this.parent.idMapping)&&(d.childRecords.splice(s,1),d.childRecords.length||(d.hasChildRecords=!1,d.hasFilteredChildRecords=!1)),this.isDraggedWithChild=!0)}}if(t.isNullOrUndefined(this.parent.dataSource)||!this.parent.dataSource.length){var l,p=this.parent,h=e.records;for(o=e.records.length-1;o>-1;o--){l=h[o],!o&&l.hasChildRecords&&(l.taskData[this.parent.parentIdMapping]=null);if(t.isNullOrUndefined(p.parentIdMapping)||(p.childMapping=null),t.isNullOrUndefined(l.taskData)||t.isNullOrUndefined(p.childMapping)||Object.prototype.hasOwnProperty.call(l.taskData,p.childMapping)||(l.taskData[p.childMapping]=[]),Object.prototype.hasOwnProperty.call(l,p.childMapping)&&l[p.childMapping].length&&!this.isDraggedWithChild&&!t.isNullOrUndefined(p.parentIdMapping))for(var c=l[p.childMapping],u=0;u<c.length;u++)-1===h.indexOf(c[u])&&(h.splice(u,0,c[u]),c[u].taskData=t.extend({},c[u]),o+=1);Object.prototype.hasOwnProperty.call(l,p.parentIdMapping)&&null!==l[p.parentIdMapping]&&!this.isDraggedWithChild&&(l.taskData[p.parentIdMapping]=null,delete l.parentItem,delete l.parentUniqueID),t.isNullOrUndefined(p.dataSource)&&(p.dataSource=[]),p.dataSource.splice(0,0,l.taskData)}p.setProperties({dataSource:p.dataSource},!1)}else{for(o=0;o<r.length;o++)t.setValue("uniqueIDCollection."+r[o].uniqueID,r[o],this.parent);var g={data:e.records,dropIndex:e.toIndex};this.parent.dataSource instanceof n.DataManager?(this.treeGridData=this.parent.dataSource.dataSource.json,this.treeData=this.parent.dataSource.dataSource.json):(this.treeGridData=this.parent.grid.dataSource,this.treeData=this.parent.dataSource),t.isNullOrUndefined(this.dropPosition)&&(this.dropPosition="bottomSegment",g.dropIndex=this.parent.getCurrentViewRecords().length>1?this.parent.getCurrentViewRecords().length-1:g.dropIndex,g.data=g.data.map(function(e){return e.hasChildRecords&&t.isNullOrUndefined(e.parentItem)?(e.level=0,e):(delete e.parentItem,delete e.parentUniqueID,e.level=0,e)})),this.dropRows(g)}},e.prototype.rowsRemoved=function(e){for(var t=0;t<e.records.length;t++)this.draggedRecord=e.records[t],(this.draggedRecord.hasChildRecords||this.draggedRecord.parentItem&&-1!==this.parent.grid.dataSource.indexOf(this.getChildrecordsByParentID(this.draggedRecord.parentUniqueID)[0])||0===this.draggedRecord.level)&&this.deleteDragRow()},e.prototype.refreshGridDataSource=function(){var e,i,r=this.draggedRecord,o=this.droppedRecord,a=this.parent;if(!(e=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?a.dataSource.dataSource.json:a.dataSource)||t.isNullOrUndefined(o)||o.parentItem||t.isNullOrUndefined(o.taskData)){if(!this.parent.parentIdMapping&&!t.isNullOrUndefined(o)&&o.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var s=this.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords;for(l=0;l<s.length;l++)o.parentItem.taskData[this.parent.childMapping][l]=s[l].taskData}}else{for(var d=Object.keys(e),l=0;l<d.length;l++)e[l][this.parent.childMapping]===o.taskData[this.parent.childMapping]&&(i=l);"topSegment"===this.dropPosition?this.parent.idMapping||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.idMapping||e.splice(i+1,0,r.taskData))}this.parent.parentIdMapping&&(r.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(r[this.parent.parentIdMapping]=o[this.parent.parentIdMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.parentIdMapping]):(r[this.parent.parentIdMapping]=o[this.parent.idMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.idMapping]):(r.taskData[this.parent.parentIdMapping]=null,r[this.parent.parentIdMapping]=null))},e.prototype.removeFirstrowBorder=function(e){var t="bottomSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-firstrow-border").length>0&&e&&(0!==e.rowIndex||t)&&this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove()},e.prototype.removeLastrowBorder=function(e){var t,i=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow")),r=(t=this.parent.enableVirtualization?e&&!i&&this.parent.getRows()[this.parent.getCurrentViewRecords().length-1].getAttribute("data-uid")!==e.getAttribute("data-uid"):e&&!i&&this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length-1).getAttribute("data-uid")!==e.getAttribute("data-uid"))||"topSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-lastrow-border").length>0&&e&&(t||r)&&this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove()},e.prototype.updateIcon=function(e,r,n){var o=n.target?t.closest(n.target,"tr"):null;this.dropPosition=void 0;var a=0;this.removeFirstrowBorder(o),this.removeLastrowBorder(o);for(var s=0;s<n.rows.length;s++)(t.isNullOrUndefined(o)||o.getAttribute("data-uid")!==n.rows[s].getAttribute("data-uid"))&&i.parentsUntil(n.target,"e-gridcontent")||(this.dropPosition="Invalid",this.addErrorElem());var d=this.parent,l=0,p=d.toolbar&&d.toolbar.length?document.getElementById(d.element.id+"_gridcontrol_toolbarItems").offsetHeight:0,h=this.getOffset(d.element),c=d.getHeaderContent().offsetHeight+h.top+p,u=d.getContent().firstElementChild.scrollTop;t.isNullOrUndefined(o)||(a=o.offsetTop-u);var g=((l=this.parent.enableVirtualization?o.getBoundingClientRect().top:a+c+0)+e[0].offsetHeight-l)/3,f=l+g,y=f+g,m=y+g,v=i.getObject("originalEvent.event",n),w=i.getObject("originalEvent.event",n),R="mousemove"===v.type?v.pageY:t.isNullOrUndefined(w)||t.isNullOrUndefined(w.changedTouches)?null:w.changedTouches[0].pageY,C=R<=f,x=R>f&&R<=y,b=R>y&&R<=m;if(C||x||b){if(C&&"Invalid"!==this.dropPosition&&(this.removeChildBorder(),this.dropPosition="topSegment",this.removetopOrBottomBorder(),this.addFirstrowBorder(o),this.removeErrorElem(),this.removeLastrowBorder(o),this.topOrBottomBorder(n.target)),x&&"Invalid"!==this.dropPosition){this.removetopOrBottomBorder();var S=[],I=t.closest(n.target,"tr");(S=[].slice.call(I.querySelectorAll(".e-rowcell,.e-rowdragdrop,.e-detailrowcollapse"))).length>0&&this.addRemoveClasses(S,!0,"e-childborder"),this.addLastRowborder(o),this.addFirstrowBorder(o),this.dropPosition="middleSegment"}b&&"Invalid"!==this.dropPosition&&(this.removeErrorElem(),this.removetopOrBottomBorder(),this.removeChildBorder(),this.dropPosition="bottomSegment",this.addLastRowborder(o),this.removeFirstrowBorder(o),this.topOrBottomBorder(n.target))}return this.dropPosition},e.prototype.removeChildBorder=function(){var e=[];(e=[].slice.call(this.parent.element.querySelectorAll(".e-childborder"))).length>0&&this.addRemoveClasses(e,!1,"e-childborder")},e.prototype.addFirstrowBorder=function(e){var i=this.parent.element,r=this.parent;if(e&&0===e.rowIndex&&!e.classList.contains("e-emptyrow")){var n=this.parent.createElement("div",{className:"e-firstrow-border"}),o=this.parent.getHeaderContent(),a=0;r.toolbar&&(a=r.toolbarModule.getToolbar().offsetHeight);var s=!t.isNullOrUndefined(this.parent.rowDropSettings.targetID);s&&(n.style.top=this.parent.grid.element.getElementsByClassName("e-gridheader")[0].offsetHeight+a+"px"),n.style.width=s?i.offsetWidth+"px":i.offsetWidth-this.getScrollWidth()+"px",o.querySelectorAll(".e-firstrow-border").length||o.appendChild(n)}},e.prototype.addLastRowborder=function(e){var t=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow"));if(e&&!t&&this.parent.getRows()[this.parent.getCurrentViewRecords().length-1].getAttribute("data-uid")===e.getAttribute("data-uid")){var i=this.parent.createElement("div",{className:"e-lastrow-border"}),r=this.parent.getContent();i.style.width=this.parent.element.offsetWidth-this.getScrollWidth()+"px",r.querySelectorAll(".e-lastrow-border").length||(r.classList.add("e-treegrid-relative"),r.appendChild(i),i.style.bottom=this.getScrollWidth()+"px")}},e.prototype.getScrollWidth=function(){var e=this.parent.getContent().firstElementChild;return e.scrollWidth>e.offsetWidth?i.Scroll.getScrollBarWidth():0},e.prototype.addErrorElem=function(){var e=document.getElementsByClassName("e-cloneproperties")[0];if(!e.querySelectorAll(".e-errorelem").length&&!this.parent.rowDropSettings.targetID){var i=document.createElement("div");t.classList(i,["e-errorcontainer"],[]),t.classList(i,["e-icons","e-errorelem"],[]);var r=e.querySelector(".errorValue"),n=e.querySelector(".e-rowcell").innerHTML;r&&(n=r.innerHTML,r.parentNode.removeChild(r)),e.querySelector(".e-rowcell").innerHTML="";var o=document.createElement("span");o.className="errorValue",o.style.paddingLeft="16px",o.innerHTML=n,e.querySelector(".e-rowcell").appendChild(i),e.querySelector(".e-rowcell").appendChild(o);var a=document.querySelector(".e-dropitemscount");if(this.hasDropItem&&a){var s=parseInt(a.style.left,10)+i.offsetWidth+16,d=this.parent.enableRtl?0:s;a.style.left=d+"px",this.hasDropItem=!1}}},e.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem"),i=document.querySelector(".errorValue"),r=document.querySelector(".e-dropitemscount");if(e){if(r){var n=parseInt(r.style.left,10)-e.offsetWidth-16;t.setStyleAttribute(i,{paddingLeft:"0px"}),this.parent.enableRtl||t.setStyleAttribute(r,{left:n+"px"})}e.remove()}this.hasDropItem=!0},e.prototype.topOrBottomBorder=function(e){var i=[],r=t.closest(e,"tr");(i=r?[].slice.call(r.querySelectorAll(".e-rowcell,.e-rowdragdrop,.e-detailrowcollapse")):[]).length&&("topSegment"===this.dropPosition&&(this.addRemoveClasses(i,!0,"e-droptop"),this.parent.element.getElementsByClassName("e-lastrow-dragborder").length>0&&this.parent.element.getElementsByClassName("e-lastrow-dragborder")[0].remove()),"bottomSegment"===this.dropPosition&&this.addRemoveClasses(i,!0,"e-dropbottom"))},e.prototype.removetopOrBottomBorder=function(){var e=[];(e=[].slice.call(this.parent.element.querySelectorAll(".e-dropbottom, .e-droptop"))).length&&(this.addRemoveClasses(e,!1,"e-dropbottom"),this.addRemoveClasses(e,!1,"e-droptop"))},e.prototype.addRemoveClasses=function(e,t,i){for(var r=0,n=e.length;r<n;r++)t?e[r].classList.add(i):e[r].classList.remove(i)},e.prototype.getOffset=function(e){var t=e.getBoundingClientRect(),i=document.body,r=document.documentElement,n=window.pageYOffset||r.scrollTop||i.scrollTop,o=window.pageXOffset||r.scrollLeft||i.scrollLeft,a=r.clientTop||i.clientTop||0,s=r.clientLeft||i.clientLeft||0,d=t.top+n-a,l=t.left+o-s;return{top:Math.round(d),left:Math.round(l)}},e.prototype.Rowdraging=function(e){var r=this.parent,n=this.parent.element.querySelector(".e-cloneproperties");n.style.cursor="";var o=e.target?t.closest(e.target,"tr"):null,a=o?o.rowIndex:-1,s=[],d=r.getCurrentViewRecords()[a];if(this.removeErrorElem(),this.canDrop=!0,e.data[0]?s=e.data:s.push(e.data),-1!==a?this.ensuredropPosition(s,d):(this.canDrop=!1,this.addErrorElem()),!r.rowDropSettings.targetID&&this.canDrop&&r.rowDragAndDropModule.updateIcon(e.rows,a,e),r.rowDropSettings.targetID){if((l=i.parentsUntil(e.target,"e-treegrid"))&&l.id===this.parent.rowDropSettings.targetID){l.ej2_instances[0].rowDragAndDropModule.updateIcon(e.rows,a,e)}}if(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)){var l;(l=i.parentsUntil(e.target,"e-treegrid"))||(n.style.cursor="default")}},e.prototype.rowDropped=function(e){var r=this.parent;if(r.rowDropSettings.targetID?(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)||i.parentsUntil(e.target,"e-treegrid")&&i.parentsUntil(e.target,"e-treegrid").id===r.rowDropSettings.targetID||e.target&&document.getElementById(r.rowDropSettings.targetID))&&(t.setValue("dropPosition",this.dropPosition,e),r.trigger("rowDrop",e),!e.cancel&&r.rowDropSettings.targetID&&(this.dragDropGrid(e),r.isLocalData&&(r.flatData=this.orderToIndex(r.flatData)))):i.parentsUntil(e.target,"e-content")&&(this.parent.element.querySelector(".e-errorelem")&&(this.dropPosition="Invalid"),t.setValue("dropPosition",this.dropPosition,e),e.dropIndex=e.dropIndex===e.fromIndex?this.getTargetIdx(e.target.parentElement):e.dropIndex,r.trigger("rowDrop",e),e.cancel||(s(this.parent)||this.dropRows(e),r.isLocalData&&(r.flatData=this.orderToIndex(r.flatData)),r.grid.refresh(),t.isNullOrUndefined(r.getHeaderContent().querySelector(".e-firstrow-border"))||r.getHeaderContent().querySelector(".e-firstrow-border").remove())),this.removetopOrBottomBorder(),this.removeChildBorder(),t.isNullOrUndefined(this.parent.element.getElementsByClassName("e-firstrow-border")[0])?t.isNullOrUndefined(this.parent.element.getElementsByClassName("e-lastrow-border")[0])||this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove():this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove(),this.parent.enableImmutableMode&&!this.parent.allowPaging&&!t.isNullOrUndefined(e.data[0].parentItem)){var n=this.parent.treeColumnIndex;n+=1;var o=this.parent.getPrimaryKeyFieldNames()[0],a=this.parent.grid.getRowIndexByPrimaryKey(e.data[0][o]),d=this.parent.getRows()[a],l=e.data[0];if("middleSegment"===this.dropPosition){var p=[],h=[];p.push(l),h.push(d);l=y(this.parent,e.data[0].parentUniqueID),a=this.parent.grid.getRowIndexByPrimaryKey(l[o]);var c=this.parent.getRows()[a];p.push(l),h.push(c);for(var u=0;u<p.length;u++)this.parent.renderModule.cellRender({data:p[u],cell:h[u].cells[n],column:this.parent.grid.getColumns()[this.parent.treeColumnIndex],requestType:"rowDragAndDrop"});var g=c.getElementsByClassName("e-treegridcollapse")[0];t.isNullOrUndefined(g)||(t.removeClass([g],"e-treegridcollapse"),t.addClass([g],"e-treegridexpand"))}else this.parent.renderModule.cellRender({data:l,cell:d.cells[n],column:this.parent.grid.getColumns()[this.parent.treeColumnIndex],requestType:"rowDragAndDrop"})}},e.prototype.dragDropGrid=function(e){var r,n=this.parent,o=t.closest(e.target,"tr"),d=isNaN(this.getTargetIdx(o))?0:this.getTargetIdx(o),l=i.parentsUntil(e.target,"e-treegrid");if(l&&l.id===this.parent.rowDropSettings.targetID&&!a(this.parent)&&!s(this.parent)){r=l.ej2_instances[0];for(var p=n.getSelectedRecords(),h=[],u=0;u<p.length;u++)h[u]=p[u].index;var g=r.dataSource;if(null!==this.parent.idMapping&&(t.isNullOrUndefined(this.dropPosition)||"bottomSegment"===this.dropPosition||"Invalid"===this.dropPosition)&&!g.length){var f=[];for(u=0;u<p.length;u++)if(p[u].hasChildRecords){f.push(p[u]);for(var y=c(p[u]),m=0;m<y.length;m++)f.push(y[m])}f.length&&(p=f)}n.notify(Ie,{indexes:h,records:p}),r.notify(Se,{toIndex:d,records:p});var v=r.rowDragAndDropModule.treeGridData;if(!t.isNullOrUndefined(v))for(u=0;u<v.length;u++)if(v[u].index=u,!t.isNullOrUndefined(v[u].parentItem)){var w=t.getValue("uniqueIDCollection."+v[u].parentUniqueID+".index",r);v[u].parentItem.index=w}n.grid.refresh(),r.grid.refresh(),r.grid.dataSource.length>1&&(r.grid.refresh(),t.isNullOrUndefined(r.getHeaderContent().querySelector(".e-firstrow-border"))||r.getHeaderContent().querySelector(".e-firstrow-border").remove(),t.isNullOrUndefined(r.getContent().querySelector(".e-lastrow-border"))||r.getContent().querySelector(".e-lastrow-border").remove())}s(this.parent)&&(r=l.ej2_instances[0],n.grid.refresh(),r.grid.refresh())},e.prototype.getTargetIdx=function(e){return e?parseInt(e.getAttribute("data-rowindex"),10):0},e.prototype.getParentData=function(e,t){var i=e.parentItem,r=-1;if(this.parent.enableVirtualization&&-1!==this.parent.selectedRowIndex?r=this.parent.getSelectedRows()[0].rowIndex:-1!==this.parent.selectedRowIndex&&(r=this.parent.selectedRowIndex),"bottomSegment"===this.dropPosition){var n=this.parent.getPrimaryKeyFieldNames()[0],o=-1===r?this.parent.grid.getRowIndexByPrimaryKey(t[0][n]):this.parent.getSelectedRowIndexes()[0],a=this.parent.getCurrentViewRecords()[o];this.droppedRecord=y(this.parent,a.parentItem.uniqueID)}if("middleSegment"===this.dropPosition){this.parent.getCurrentViewRecords()[r].level===i.level?this.droppedRecord=y(this.parent,i.uniqueID):this.getParentData(i)}},e.prototype.dropRows=function(e,i){if("Invalid"!==this.dropPosition&&!a(this.parent)){var r,n=this.parent,o=void 0;if(t.isNullOrUndefined(e.dropIndex)){var s=this.parent.getPrimaryKeyFieldNames()[0],d=-1===n.selectedRowIndex?this.parent.grid.getRowIndexByPrimaryKey(e.data[0][s])-1:n.getSelectedRowIndexes()[0]-1,l=n.getCurrentViewRecords()[d];this.getParentData(l,e.data)}else if(e.dropIndex=e.dropIndex===e.fromIndex?this.getTargetIdx(e.target.parentElement):e.dropIndex,this.parent.enableVirtualization){var p=this.parent.getRowByIndex(e.dropIndex).rowIndex;this.droppedRecord=n.getCurrentViewRecords()[p]}else this.droppedRecord=n.getCurrentViewRecords()[e.dropIndex];var h=[];o=this.droppedRecord,e.data[0]?h=e.data:h.push(e.data),this.parent[this.modifiedRecords].push(e.data[0],o);var c=0,u=this.parent.rowDropSettings.targetID;this.isMultipleGrid=u,u?this.isaddtoBottom=u&&this.isDraggedWithChild:this.ensuredropPosition(h,o);var g=h.length;t.isNullOrUndefined(this.parent.idMapping)||h.reverse();for(var f=function(a){if(r=h[a],y.draggedRecord=r,"Invalid"!==y.dropPosition){if(n.rowDropSettings.targetID&&!i||y.deleteDragRow(),y.draggedRecord===y.droppedRecord){var s=y.getTargetIdx(e.target.offsetParent.parentElement);isNaN(s)&&(s=y.getTargetIdx(e.target.parentElement)),e.dropIndex=s,o=y.droppedRecord=y.parent.getCurrentViewRecords()[e.dropIndex]}if(o.parentItem||"middleSegment"===y.dropPosition){-1!==(g=(u=n.parentData).indexOf(y.draggedRecord))&&u.splice(g,1)}var d=y.treeGridData.indexOf(o);if(y.dropAtTop(d),"bottomSegment"===y.dropPosition){if(o.hasChildRecords?(c=y.getChildCount(o,0),y.parent.parentIdMapping&&y.treeData.splice(d+c+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+c+1,0,y.draggedRecord)):(y.parent.parentIdMapping&&y.treeData.splice(d+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+1,0,y.draggedRecord)),t.isNullOrUndefined(o.parentItem)&&(delete r.parentItem,delete r.parentUniqueID,r.level=0,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=null)),o.parentItem){var l=y.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords,p=l.indexOf(o)+1;l.splice(p,0,r),r.parentItem=o.parentItem,r.parentUniqueID=o.parentUniqueID,r.level=o.level,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=o[y.parent.parentIdMapping],r.parentItem=o.parentItem,r.level=o.level)}if(r.hasChildRecords){y.updateChildRecordLevel(r,1),y.updateChildRecord(r,d+c+1)}}y.dropMiddle(d)}if(t.isNullOrUndefined(r.parentItem)){var u,g=(u=n.parentData).indexOf(y.droppedRecord),f=0;u.filter(function(e){r.uniqueID===e.uniqueID&&f++}),"bottomSegment"===y.dropPosition&&0===f?u.splice(g+1,0,r):"topSegment"===y.dropPosition&&0===f&&u.splice(g,0,r)}n.rowDragAndDropModule.refreshGridDataSource()},y=this,m=0;m<g;m++)f(m)}},e.prototype.dropMiddle=function(e){var i=this.parent,r=c(this.droppedRecord),n=t.isNullOrUndefined(r)||0===r.length?e+1:r.length+e+1;"middleSegment"===this.dropPosition&&(i.parentIdMapping?(this.treeData.splice(n,0,this.draggedRecord.taskData),this.treeGridData.splice(n,0,this.draggedRecord)):this.treeGridData.splice(n,0,this.draggedRecord),this.recordLevel(),this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,n))},e.prototype.dropAtTop=function(e){var t=this.parent;if("topSegment"===this.dropPosition){if(t.parentIdMapping&&this.treeData.splice(e,0,this.draggedRecord.taskData),this.draggedRecord.parentItem=this.treeGridData[e].parentItem,this.draggedRecord.parentUniqueID=this.treeGridData[e].parentUniqueID,this.draggedRecord.level=this.treeGridData[e].level,this.treeGridData.splice(e,0,this.draggedRecord),this.draggedRecord.hasChildRecords){this.updateChildRecord(this.draggedRecord,e),this.updateChildRecordLevel(this.draggedRecord,1)}if(this.droppedRecord.parentItem){var i=this.getChildrecordsByParentID(this.droppedRecord.parentUniqueID)[0].childRecords,r=i.indexOf(this.droppedRecord);i.splice(r,0,this.draggedRecord)}}},e.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,r=this.droppedRecord,n=e.childMapping;if(r.hasChildRecords||(r.hasChildRecords=!0,r.hasFilteredChildRecords=!0,(t.isNullOrUndefined(r.childRecords)||0===r.childRecords.length)&&(r.childRecords=[],!e.parentIdMapping&&t.isNullOrUndefined(r.taskData[n])&&(r.taskData[n]=[]))),"middleSegment"===this.dropPosition){var o=t.extend({},r);delete o.childRecords,i.parentItem=o,i.parentUniqueID=r.uniqueID,r.childRecords.splice(r.childRecords.length,0,i);if(e.isSelfReference&&(r[e.childMapping]=[],r[e.childMapping].splice(r[e.childMapping].length,0,i)),t.isNullOrUndefined(i)||e.parentIdMapping||t.isNullOrUndefined(r.taskData[n])||r.taskData[e.childMapping].splice(r.childRecords.length,0,i.taskData),i.hasChildRecords){i.level=r.level+1,this.updateChildRecordLevel(i,1)}else i.level=r.level+1;r.expanded=!0}},e.prototype.deleteDragRow=function(){this.parent.dataSource instanceof n.DataManager&&u(this.parent)?(this.treeGridData=this.parent.grid.dataSource.dataSource.json,this.treeData=this.parent.dataSource.dataSource.json):(this.treeGridData=this.parent.grid.dataSource,this.treeData=this.parent.dataSource);var e=y(this.parent,this.draggedRecord.uniqueID);!t.isNullOrUndefined(e.childRecords)&&e.childRecords.length&&(e.hasChildRecords=!0),this.removeRecords(e)},e.prototype.updateChildRecord=function(e,i){var r,n=this.parent,o=0;if(!e.hasChildRecords)return 0;o=e.childRecords.length;for(var a=0;a<o;a++)r=this.isMultipleGrid?e.childRecords[a]:t.getValue("uniqueIDCollection."+e.childRecords[a].uniqueID,n),i++,n.flatData.splice(i,0,r),t.setValue("uniqueIDCollection."+r.uniqueID,r,this.parent),n.parentIdMapping&&this.treeData.splice(i,0,r.taskData),r.hasChildRecords&&(i=this.updateChildRecord(r,i));return i},e.prototype.updateChildRecordLevel=function(e,i){var r,n=0;if(i++,!e.hasChildRecords)return 0;n=e.childRecords.length;for(var o=0;o<n;o++){r=this.isMultipleGrid?e.childRecords[o]:t.getValue("uniqueIDCollection."+e.childRecords[o].uniqueID,this.parent);var a=void 0;e.parentItem&&(a=y(this.parent,e.parentItem.uniqueID)),t.isNullOrUndefined(a)&&!t.isNullOrUndefined(e.parentItem)&&(a=e.parentItem),r.level=e.parentItem?a.level+i:e.level+1,r.hasChildRecords&&(i--,i=this.updateChildRecordLevel(r,i))}return i},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;var o=e,a=!t.isNullOrUndefined(r.parentIdMapping),s=this.getChildrecordsByParentID(o.parentUniqueID)[0];if(o){if(o.parentItem){var d=s?s.childRecords:[],l=0;d&&d.length>0&&(l=d.indexOf(o),s.childRecords.splice(l,1),this.parent.parentIdMapping&&!r.enableImmutableMode||v({value:o,action:"delete"},this.parent,a,o.index,o.index))}if(r.parentIdMapping){o.hasChildRecords&&o.childRecords.length>0&&this.removeChildItem(o);for(var p=void 0,h=void 0,c=i,g=0;g<c.length;g++)c[g][this.parent.idMapping]===o.taskData[this.parent.idMapping]&&(p=g);for(g=0;g<this.treeGridData.length;g++)this.treeGridData[g][this.parent.idMapping]===o.taskData[this.parent.idMapping]&&(h=g);-1===p||t.isNullOrUndefined(p)||i.splice(p,1),-1===h||t.isNullOrUndefined(h)||this.treeGridData.splice(h,1)}var f=this.treeGridData.indexOf(o);if(!r.parentIdMapping){var y=this.parent.parentData.indexOf(o);-1!==y&&(r.parentData.splice(y,1),i.splice(y,1))}if(-1===f&&!r.parentIdMapping)for(var m=r.getPrimaryKeyFieldNames()[0],w=0;w<this.treeGridData.length;w++)this.treeGridData[w][m]===o[m]&&(f=w);if(!r.parentIdMapping){var R=this.getChildCount(o,0);this.treeGridData.splice(f,R+1)}o.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(s.expanded=!1,s.hasChildRecords=!1,s.hasFilteredChildRecords=!1),-1!==this.parent[this.modifiedRecords].indexOf(s)||t.isNullOrUndefined(s)||this.parent[this.modifiedRecords].push(s),t.isNullOrUndefined(s)||this.updateModifiedRecords(s)}},e.prototype.updateModifiedRecords=function(e){var i=y(this.parent,e.parentUniqueID);t.isNullOrUndefined(i)||(this.parent[this.modifiedRecords].push(i),this.updateModifiedRecords(i))},e.prototype.removeChildItem=function(e){var i,r,o,a;a=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;for(var s=0;s<e.childRecords.length;s++){i=e.childRecords[s],!t.isNullOrUndefined(i.childRecords)&&i.childRecords.length&&(i.hasChildRecords=!0);var d=void 0;d=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;for(var l=0;l<d.length;l++)d[l][this.parent.idMapping]===i.taskData[this.parent.idMapping]&&(r=l);for(var p=0;p<this.treeGridData.length;p++)if(this.treeGridData[p][this.parent.idMapping]===i.taskData[this.parent.idMapping]){o=p;break}-1===r||t.isNullOrUndefined(r)||a.splice(r,1),-1===o||t.isNullOrUndefined(o)||this.treeGridData.splice(o,1),i.hasChildRecords&&this.removeChildItem(i)}},e.prototype.getChildCount=function(e,t){var i;if(!e.hasChildRecords)return 0;for(var r=0;r<e.childRecords.length;r++)t++,(i=e.childRecords[r]).hasChildRecords&&(t=this.getChildCount(i,t));return t},e.prototype.ensuredropPosition=function(e,i){var r=this;e.filter(function(e){if(e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)){if(-1!==e.childRecords.indexOf(i))return r.dropPosition="Invalid",r.addErrorElem(),void(r.canDrop=!1);r.ensuredropPosition(e.childRecords,i)}})},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(De,this.Rowdraging),this.parent.off(Me,this.rowDropped),this.parent.off(Se,this.rowsAdded),this.parent.off(Ie,this.rowsRemoved))},e.prototype.getModuleName=function(){return"rowDragAndDrop"},e}(),gt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ft=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},yt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return gt(i,e),ft([t.Property()],i.prototype,"targetID",void 0),i}(t.ChildProperty),mt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),vt=function(e){function i(t){var i=e.call(this,t)||this;return i.addEventListener(),i}return mt(i,e),i.prototype.addEventListener=function(){this.parent.on(ve,this.getDatas,this)},i.prototype.getDatas=function(e){this.visualData=e.data},i.prototype.getDataInfo=function(){return e.prototype.getData.call(this)},i.prototype.generateRows=function(i,r){!t.isNullOrUndefined(r.virtualInfo)&&r.virtualInfo.loadNext&&r.virtualInfo.nextInfo.page!==this.parent.pageSettings.currentPage?this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.nextInfo.page}},!0):t.isNullOrUndefined(r.virtualInfo)||r.virtualInfo.loadNext||r.virtualInfo.page===this.parent.pageSettings.currentPage||this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.page}},!0);var o=this.getDataInfo();if(t.isNullOrUndefined(r.virtualInfo)||("right"!==r.virtualInfo.direction&&"left"!==r.virtualInfo.direction?(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))&&1!==r.virtualInfo.blockIndexes.length||(r.virtualInfo.blockIndexes=o.blockIndexes):r.virtualInfo.blockIndexes=this.getBlockIndexes(r.virtualInfo.page)),this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))return e.prototype.generateRows.call(this,i,r);t.isNullOrUndefined(r.requestType)||"collapseAll"!==r.requestType.toString()||(r.requestType="refresh");for(var a=e.prototype.generateRows.call(this,i,r),d=0;d<a.length;d++)a[d].index=this.visualData.indexOf(a[d].data);return a},i.prototype.checkAndResetCache=function(e){var t=["paging","refresh","sorting","filtering","searching","reorder","save","delete"].some(function(t){return e===t});if(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)){var i=this.model.currentPage;t?(this.cache={},this.movableCache={},this.frozenRightCache={},this.data={},this.groups={}):"virtualscroll"===e&&this.cache[i]&&this.cache[i].length>this.parent.contentModule.getBlockSize()&&delete this.cache[i]}else(t||"virtualscroll"===e)&&(this.cache={},this.data={},this.groups={},this.movableCache={},this.frozenRightCache={});return t},i}(i.VirtualRowModelGenerator),wt=function(){function e(e){i.Grid.Inject(i.Filter),this.parent=e,this.isHierarchyFilter=!1,this.filteredResult=[],this.flatFilteredData=[],this.filteredParentRecs=[],this.addEventListener()}return e.prototype.getModuleName=function(){return"filter"},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.on("updateFilterRecs",this.updatedFilteredRecord,this),this.parent.on("clearFilters",this.clearFilterLevel,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateFilterRecs",this.updatedFilteredRecord),this.parent.off("clearFilters",this.clearFilterLevel))},e.prototype.updatedFilteredRecord=function(e){t.setValue("uniqueIDFilterCollection",{},this.parent),this.flatFilteredData=e.data,this.filteredParentRecs=[],this.filteredResult=[],this.isHierarchyFilter=!1;for(var r=0;r<this.flatFilteredData.length;r++){var n=this.flatFilteredData[r];this.addParentRecord(n);var o=""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode;"Child"!==o&&"None"!==o||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key||(this.isHierarchyFilter=!0);var a=i.getObject("childRecords",n);!t.isNullOrUndefined(a)&&a.length&&t.setValue("hasFilteredChildRecords",this.checkChildExsist(n),n);var s=i.getObject("parentItem",n);if(!t.isNullOrUndefined(s)){var d=y(this.parent,n.parentItem.uniqueID,!0);t.setValue("hasFilteredChildRecords",!0,d),d&&d.parentItem&&this.updateParentFilteredRecord(d)}}this.flatFilteredData.length>0&&this.isHierarchyFilter&&this.updateFilterLevel(),this.parent.notify("updateAction",{result:this.filteredResult})},e.prototype.updateParentFilteredRecord=function(e){var i=y(this.parent,e.parentItem.uniqueID,!0),r=t.getValue("uniqueIDFilterCollection",this.parent);i&&Object.prototype.hasOwnProperty.call(r,i.uniqueID)&&t.setValue("hasFilteredChildRecords",!0,i),i&&i.parentItem&&this.updateParentFilteredRecord(i)},e.prototype.addParentRecord=function(e){var i=y(this.parent,e.parentUniqueID);if("None"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key){if(!t.isNullOrUndefined(i)){"Child"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key?this.addParentRecord(i):-1!==this.flatFilteredData.indexOf(i)&&this.addParentRecord(i)}-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))}else if(t.isNullOrUndefined(i)){if(-1!==this.flatFilteredData.indexOf(e))return void(-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent),e.hasFilteredChildRecords=!0))}else this.addParentRecord(i),-1!==this.flatFilteredData.indexOf(i)||-1!==this.filteredResult.indexOf(i)?-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent)):-1===this.filteredResult.indexOf(e)&&-1!==this.flatFilteredData.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))},e.prototype.checkChildExsist=function(e){for(var r=i.getObject("childRecords",e),n=!1,o=0;o<r.length;o++){var a=r[o].childRecords,s=""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode;if(!("Child"!==s&&"Both"!==s||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key)){var d=t.getValue("uniqueIDFilterCollection",this.parent);Object.prototype.hasOwnProperty.call(d,r[o].uniqueID)||(this.filteredResult.push(r[o]),t.setValue("uniqueIDFilterCollection."+r[o].uniqueID,r[o],this.parent),n=!0)}if("None"===s&&(0!==this.parent.grid.filterSettings.columns.length||""!==this.parent.grid.searchSettings.key)&&-1!==this.flatFilteredData.indexOf(r[o])){n=!0;break}!t.isNullOrUndefined(a)&&a.length&&(n=this.checkChildExsist(r[o])),"Child"!==s&&"Both"!==s||!r.length||(n=!0)}return n},e.prototype.updateFilterLevel=function(){for(var e=this.filteredResult,t=this.filteredResult.length,i=0;i<t;i++){var r=y(this.parent,e[i].parentUniqueID);if(-1!==e.indexOf(r)){var n=y(this.parent,e[i].parentUniqueID,!0);e[i].filterLevel=n.filterLevel+1}else e[i].filterLevel=0,this.filteredParentRecs.push(e[i])}},e.prototype.clearFilterLevel=function(e){for(var i,r=0,n=e.flatData,o=n.length;r<o;r++){var a=(i=n[r]).filterLevel;!a&&0!==a&&t.isNullOrUndefined(i.hasFilteredChildRecords)||(i.hasFilteredChildRecords=null,i.filterLevel=null)}this.filteredResult=[],this.parent.notify("updateResults",{result:n,count:n.length})},e}(),Rt=function(){function e(e){this.isCollapsedStatePersist=!1,i.Grid.Inject(i.ExcelExport),this.parent=e,this.dataResults={},this.addEventListener()}return e.prototype.getModuleName=function(){return"ExcelExport"},e.prototype.addEventListener=function(){this.parent.on("updateResults",this.updateExcelResultModel,this),this.parent.on("excelCellInfo",this.excelQueryCellInfo,this),this.parent.grid.on("export-RowDataBound",this.exportRowDataBound,this),this.parent.grid.on("finalPageSetup",this.finalPageSetup,this)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateResults",this.updateExcelResultModel),this.parent.off("excelCellInfo",this.excelQueryCellInfo),this.parent.grid.off("export-RowDataBound",this.exportRowDataBound),this.parent.grid.off("finalPageSetup",this.finalPageSetup))},e.prototype.updateExcelResultModel=function(e){this.dataResults=e},e.prototype.Map=function(e,r,o,a,s){var d=this,l=this.parent.dataSource,p=Object();return t.setValue("isCsv",s,p),t.setValue("cancel",!1,p),t.isNullOrUndefined(e)||(this.isCollapsedStatePersist=e.isCollapsedStatePersist),new Promise(function(h){var c=!d.isLocal()||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),u=new n.Query;if(d.isLocal()||(u=d.generateQuery(u),t.setValue("query",u,p)),d.parent.trigger(G,t.extend(p,e)),i.getObject("cancel",p))return null;c.executeQuery(u).then(function(i){var n=null;return t.isNullOrUndefined(e)||t.isNullOrUndefined(e.dataSource)||(n=e.dataSource),e=d.manipulateExportProperties(e,l,i),d.parent.grid.excelExportModule.Map(d.parent.grid,e,r,o,s,a).then(function(t){null!=n?e.dataSource=n:delete e.dataSource,h(t)})})})},e.prototype.generateQuery=function(e,r){return!t.isNullOrUndefined(r)&&"CurrentPage"===r.exportType&&this.parent.allowPaging&&(r.exportType="AllPages",e.addParams("ExportType","CurrentPage"),e.where(this.parent.parentIdMapping,"equal",null),e=i.getObject("grid.renderModule.data.pageQuery",this.parent)(e)),e},e.prototype.manipulateExportProperties=function(e,r,o){var a=Object();if(t.setValue("query",this.parent.grid.getDataModule().generateQuery(!0),a),t.setValue("isExport",!0,a),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.exportType)||t.setValue("exportType",e.exportType,a),this.isLocal()||(this.parent.parentData=[],this.parent.dataModule.convertToFlatData(i.getObject("result",o)),t.setValue("expresults",this.parent.flatData,a)),this.parent.notify("dataProcessor",a),a=this.dataResults,r=t.isNullOrUndefined(a.result)?this.parent.flatData.slice(0):a.result,this.isLocal()||(this.parent.flatData=[]),e&&e.dataSource&&this.isLocal()){var s=this.parent.flatData,d=e.dataSource instanceof n.DataManager?e.dataSource.dataSource.json:e.dataSource;this.parent.dataModule.convertToFlatData(d),r=this.parent.flatData,this.parent.flatData=s}return e=t.isNullOrUndefined(e)?Object():e,e.dataSource=new n.DataManager({json:r}),e},e.prototype.excelQueryCellInfo=function(e){if(this.parent.grid.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex){var i={},r=e.data,n=t.isNullOrUndefined(r.filterLevel)?r.level:r.filterLevel;i.indent=n,e.style=i}this.parent.notify("updateResults",e),this.parent.trigger("excelQueryCellInfo",e)},e.prototype.exportRowDataBound=function(e){if("excel"===e.type){var i=e.rowObj.data,r=this.parent.grid.filterSettings.columns.length,n=e.excelRows.length,o=i.level;if(i.parentItem&&y(this.parent,i.parentItem.uniqueID,Boolean(r))){var a=!1,s=!1,d=h(this.parent,i,this.parent.parentData);!this.isCollapsedStatePersist||d&&this.parent.isLocalData||(a=!0,s=!i.expanded),e.excelRows[n-1].grouping={outlineLevel:o,isCollapsed:s,isHidden:a}}else i.hasChildRecords&&t.isNullOrUndefined(i.parentItem)&&(e.excelRows[n-1].grouping={outlineLevel:o})}},e.prototype.finalPageSetup=function(e){for(var t=0;t<e.worksheets.length;t++)e.worksheets[t].rows&&(e.worksheets[t].pageSetup={isSummaryRowBelow:!1})},e.prototype.isLocal=function(){return!a(this.parent)&&u(this.parent)},e}(),Ct=function(){function e(e){i.Grid.Inject(i.PdfExport),this.parent=e,this.dataResults={},this.addEventListener()}return e.prototype.getModuleName=function(){return"PdfExport"},e.prototype.addEventListener=function(){this.parent.on("pdfCellInfo",this.pdfQueryCellInfo,this),this.parent.on("updateResults",this.updatePdfResultModel,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("pdfCellInfo",this.pdfQueryCellInfo),this.parent.off("updateResults",this.updatePdfResultModel))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.updatePdfResultModel=function(e){this.dataResults=e},e.prototype.Map=function(e,r,o,s){var d=this,l=this.parent.dataSource,p=Object(),h=!a(this.parent)&&u(this.parent);return t.setValue("cancel",!1,p),new Promise(function(a){var c=!h||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),u=new n.Query;if(h||(u=d.generateQuery(u),t.setValue("query",u,p)),d.parent.trigger(Q,t.extend(p,e)),i.getObject("cancel",p))return null;c.executeQuery(u).then(function(i){var n=null;return t.isNullOrUndefined(e)||t.isNullOrUndefined(e.dataSource)||(n=e.dataSource),e=d.manipulatePdfProperties(e,l,i),d.parent.grid.pdfExportModule.Map(d.parent.grid,e,r,o,s).then(function(t){null!=n?e.dataSource=n:delete e.dataSource,a(t)})})})},e.prototype.generateQuery=function(e,r){return!t.isNullOrUndefined(r)&&"CurrentPage"===r.exportType&&this.parent.allowPaging&&(r.exportType="AllPages",e.addParams("ExportType","CurrentPage"),e.where(this.parent.parentIdMapping,"equal",null),e=i.getObject("grid.renderModule.data.pageQuery",this.parent)(e)),e},e.prototype.manipulatePdfProperties=function(e,i,r){var o={},s=!a(this.parent)&&u(this.parent);if(t.setValue("query",this.parent.grid.getDataModule().generateQuery(!0),o),t.setValue("isExport",!0,o),t.setValue("isPdfExport",!0,o),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.isCollapsedStatePersist)||t.setValue("isCollapsedStatePersist",e.isCollapsedStatePersist,o),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.exportType)||t.setValue("exportType",e.exportType,o),s||(this.parent.parentData=[],this.parent.dataModule.convertToFlatData(t.getValue("result",r)),t.setValue("expresults",this.parent.flatData,o)),this.parent.notify("dataProcessor",o),o=this.dataResults,i=t.isNullOrUndefined(o.result)?this.parent.flatData.slice(0):o.result,s||(this.parent.flatData=[]),e&&e.dataSource&&s){var d=this.parent.flatData,l=e.dataSource instanceof n.DataManager?e.dataSource.dataSource.json:e.dataSource;this.parent.dataModule.convertToFlatData(l),i=this.parent.flatData,this.parent.flatData=d}return e=t.isNullOrUndefined(e)?{}:e,e.dataSource=new n.DataManager({json:i}),e},e.prototype.pdfQueryCellInfo=function(e){if(this.parent.grid.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex){var r={},n=i.getObject("data",e),o=t.isNullOrUndefined(n.filterLevel)?n.level:n.filterLevel;r.paragraphIndent=3*o,e.style=r}this.parent.notify("updateResults",e),this.parent.trigger("pdfQueryCellInfo",e)},e}(),xt=function(){function e(e){i.Grid.Inject(i.Page),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(J,this.collapseExpandPagedchilds,this),this.parent.on(X,this.pageAction,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(J,this.collapseExpandPagedchilds),this.parent.off(X,this.pageAction))},e.prototype.getModuleName=function(){return"pager"},e.prototype.refresh=function(){this.parent.grid.pagerModule.refresh()},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.goToPage=function(e){this.parent.grid.pagerModule.goToPage(e)},e.prototype.updateExternalMessage=function(e){this.parent.grid.pagerModule.updateExternalMessage(e)},e.prototype.collapseExpandPagedchilds=function(e){if(e.record.expanded="collapse"!==e.action,this.parent.flatData.map(function(t){return t.expanded=t.uniqueID===e.record.uniqueID&&t.expanded!==e.record.expanded?e.record.expanded:t.expanded}),this.parent.enableImmutableMode){var i=this.parent.getPrimaryKeyFieldNames()[0],r=this.parent.flatData.filter(function(t){return t[i]===e.record[i]});r.length&&(r[0].expanded=e.record.expanded)}var n={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length};if(t.getValue("grid.renderModule",this.parent).dataManagerSuccess(n),this.parent.enableImmutableMode){var o=void 0;"collapse"===n.action?(o=n.row.getElementsByClassName("e-treegridexpand")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridexpand"),t.addClass([o],"e-treegridcollapse"))):"expand"===n.action&&(o=n.row.getElementsByClassName("e-treegridcollapse")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridcollapse"),t.addClass([o],"e-treegridexpand")))}},e.prototype.pageRoot=function(e,i,r){for(var n=t.isNullOrUndefined(r)?[]:r,o=function(t){n.push(i[t]);var r=[];i[t].hasChildRecords&&(r=e.filter(function(e){return i[t].uniqueID===e.parentUniqueID}),n=a.pageRoot(e,r,n))},a=this,s=0;s<i.length;s++)o(s);return n},e.prototype.updatePageSize=function(e){var t=e.result.length,i=this.parent.grid.pagerModule;!0===this.parent.pageSettings.pageSizes&&i.pagerObj.pagerdropdownModule.dropDownListObject.value===i.pagerObj.getLocalizedLabel("All")&&(i.pagerObj.totalRecordsCount=t,this.parent.grid.pageSettings.pageSize=t)},e.prototype.pageAction=function(e){var t=this,i=new n.DataManager(e.result);if("Root"===this.parent.pageSettings.pageSizeMode){var r=[],o=this.parent.grid.filterSettings.columns.length>0&&("Child"===this.parent.filterSettings.hierarchyMode||"None"===this.parent.filterSettings.hierarchyMode)?"filterLevel":"level",a=(new n.Query).where(o,"equal",0);r=i.executeLocal(a),e.count=r.length;var s=(f=this.parent.grid.pageSettings.pageSize)*((y=this.parent.grid.pageSettings.currentPage)-1);a=a.skip(s).take(f),r=i.executeLocal(a);var d=this.pageRoot(e.result,r);e.result=d}else{var p=new n.DataManager(e.result),c=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),u=p.executeLocal((new n.Query).where(c)),g=void 0;g=!l(this.parent)||this.parent.searchSettings.key===this.parent.grid.searchSettings.key&&this.parent.filterSettings.columns.length===this.parent.grid.filterSettings.columns.length?u.filter(function(e){return h(t.parent,e,u)}):u,e.count=g.length;a=new n.Query;var f=this.parent.grid.pageSettings.pageSize;this.updatePageSize(e);var y=this.parent.grid.pageSettings.currentPage;g.length<y*f&&(y=(y=Math.floor(g.length/f)+(g.length%f?1:0))||1,this.parent.grid.setProperties({pageSettings:{currentPage:y}},!0));s=f*(y-1);a=a.skip(s).take(f),p.dataSource.json=g,e.result=p.executeLocal(a)}this.parent.notify("updateAction",e)},e}(),bt=function(){function e(e){i.Grid.Inject(i.Toolbar),this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"toolbar"},e.prototype.addEventListener=function(){this.parent.on(z,this.refreshToolbar,this),this.parent.on(_,this.refreshToolbar,this),this.parent.on(H,this.toolbarClickHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(z,this.refreshToolbar),this.parent.off(_,this.refreshToolbar),this.parent.off(H,this.toolbarClickHandler))},e.prototype.refreshToolbar=function(e){var i=this.parent.grid.toolbarModule.getToolbar();if(!t.isNullOrUndefined(i)){var r=this.parent,n=void 0,o=void 0,a=r.element.id+"_gridcontrol_indent",s=r.element.id+"_gridcontrol_outdent",d=i.querySelector("#"+a),l=i.querySelector("#"+s),p=e.row,h=r.getSelectedRows()[0];if(t.isNullOrUndefined(p[0])||(p=p[0]),p=t.isNullOrUndefined(h)||h.rowIndex===p.rowIndex?p:h,null!==d&&null!==l){if(n=i.querySelector("#"+a).parentElement,o=i.querySelector("#"+s).parentElement,0===p.rowIndex||r.getSelectedRowIndexes().length>1)n.classList.add("e-hidden"),o.classList.add("e-hidden");else if("rowDeselected"!==e.name||!t.isNullOrUndefined(h)&&r.grid.isCheckBoxSelection){var c=r.getCurrentViewRecords()[p.rowIndex];t.isNullOrUndefined(c)||(c.level>r.getCurrentViewRecords()[p.rowIndex-1].level?n.classList.add("e-hidden"):n.classList.remove("e-hidden"),c.level===r.getCurrentViewRecords()[p.rowIndex-1].level&&n.classList.remove("e-hidden"),0===c.level&&o.classList.add("e-hidden"),0!==c.level&&o.classList.remove("e-hidden"))}"rowDeselected"===e.name&&t.isNullOrUndefined(h)&&!r.grid.isCheckBoxSelection&&(this.parent.toolbar.includes("Indent")&&n.classList.add("e-hidden"),this.parent.toolbar.includes("Outdent")&&o.classList.add("e-hidden"))}}},e.prototype.toolbarClickHandler=function(e){var i=this.parent,r="indentOutdentAction";"Cell"===this.parent.editSettings.mode&&"Batch"===this.parent.grid.editSettings.mode&&e.item.id===this.parent.grid.element.id+"_update"&&(e.cancel=!0,this.parent.grid.editModule.saveCell()),e.item.id===this.parent.grid.element.id+"_expandall"&&this.parent.expandAll(),e.item.id===this.parent.grid.element.id+"_collapseall"&&this.parent.collapseAll(),e.item.id===i.grid.element.id+"_indent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[r](null,"indent"),e.item.id===i.grid.element.id+"_outdent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[r](null,"outdent")},e.prototype.getToolbar=function(){return this.parent.grid.toolbarModule.getToolbar()},e.prototype.enableItems=function(e,t){this.parent.grid.toolbarModule.enableItems(e,t)},e.prototype.destroy=function(){this.removeEventListener()},e}(),St=function(){function e(e){i.Grid.Inject(i.Aggregate),this.parent=e,this.flatChildRecords=[],this.summaryQuery=[]}return e.prototype.getModuleName=function(){return"summary"},e.prototype.removeEventListener=function(){this.parent.isDestroyed},e.prototype.calculateSummaryValue=function(e,r,n){this.summaryQuery=e;for(var o,a=[],s=0,d=Object.keys(r).length;s<d;s++){i.getObject("isSummaryRow",r[s])||a.push(r[s])}var l,h=p(a),c=a.slice(),u=Object.keys(this.parent.aggregates).length,g=Object.keys(h).length,f=this.parent.getColumns();if(this.parent.aggregates.filter(function(e){return e.showChildSummary}).length){var y=0;for(d=g;y<d;y++)if(o=h[y],l=this.getChildRecordsLength(o,c)){for(var m=function(e,r){var a=void 0;a={};for(var s=0;s<f.length;s++){a[t.isNullOrUndefined(i.getObject("field",f[s]))?f[s]:i.getObject("field",f[s])]=null}if(a=v.createSummaryItem(a,v.parent.aggregates[e-1]),!v.parent.aggregates[e-1].showChildSummary)return"continue";var d;c.map(function(e,t){e.uniqueID!==o.uniqueID||(d=t)});var p=d+l+e,h=t.extend({},o);delete h.childRecords,delete h[v.parent.childMapping],t.setValue("parentItem",h,a);var u=i.getObject("level",h);if(t.setValue("level",u+1,a),t.setValue("isSummaryRow",!0,a),t.setValue("parentUniqueID",h.uniqueID,a),n){var g=i.getObject("childRecords",o);g.length&&g.push(a)}c.splice(p,0,a)},v=this,w=1,R=u;w<=R;w++)m(w);this.flatChildRecords=[]}}else{for(var C={},x=0,b=f.length;x<b;x++){C[t.isNullOrUndefined(i.getObject("field",f[x]))?f[x]:i.getObject("field",f[x])]=null}w=1;for(var S=u;w<=S;w++)this.createSummaryItem(C,this.parent.aggregates[w-1])}return c},e.prototype.getChildRecordsLength=function(e,r){for(var n,o=0,a=Object.keys(r).length;o<a;o++){n=r[o];if(e===(t.isNullOrUndefined(n.parentItem)?null:r.filter(function(e){return e.uniqueID===n.parentItem.uniqueID})[0])){this.flatChildRecords.push(n);if(!i.getObject("hasChildRecords",n))continue;this.getChildRecordsLength(n,r)}}return this.flatChildRecords.length},e.prototype.createSummaryItem=function(e,i){for(var r=0,o=Object.keys(i.columns).length;r<o;r++)for(var a=t.isNullOrUndefined(i.columns[r].columnName)?i.columns[r].field:i.columns[r].columnName,s=0,d=Object.keys(e);s<d.length;s++){var l=d[s];if(l===a)if(this.flatChildRecords.length)e[l]=this.getSummaryValues(i.columns[r],this.flatChildRecords);else if(this.parent.isLocalData){var p=this.parent.dataSource instanceof n.DataManager?this.parent.dataSource.dataSource.json:this.parent.flatData;e[l]=this.getSummaryValues(i.columns[r],p)}}return e},e.prototype.getSummaryValues=function(e,r){var o=new n.Query,a={},s={},d=t.isNullOrUndefined(e.field)?void 0:this.parent.getColumnByField(e.field).type;e.setPropertiesSilent({format:this.getFormatFromType(e.format,d)}),e.setFormatter(this.parent.grid.locale);var l=e.getFormatter()||function(e){return e};e.setTemplate(s);var p=e.getTemplate(2);o.queries=this.summaryQuery,o.requiresCount();var h,c=new n.DataManager(r).executeLocal(o),u=e.type;u=[e.type];for(var g=0;g<u.length;g++){h=u[g];var f=e.field+" - "+u[g].toLowerCase(),y="Custom"!==u[g]?i.getObject("aggregates",c):i.calculateAggregate(u[g],c,e,this.parent),m=e.columnName,v="Custom"!==u[g]?y[f]:y;a[m]=a[m]||{},a[m][f]=v,a[m][u[g]]=t.isNullOrUndefined(y)?" ":l(v)}s.format=e.getFormatter();var w=t.createElement("td",{className:"e-summary"});if(this.parent.isReact){p.fn(a[e.columnName],this.parent,p.property,"",null,null,w),this.parent.renderReactTemplates()}else i.appendChildren(w,p.fn(a[e.columnName],this.parent,p.property));var R=a[e.columnName][h];return-1===w.innerHTML.indexOf(R)?w.innerHTML+R:w.innerHTML},e.prototype.getFormatFromType=function(e,i){if(t.isNullOrUndefined(i)||"string"!=typeof e)return e;var r;switch(i){case"number":r={format:e};break;case"datetime":r={type:"dateTime",skeleton:e};break;case"date":r={type:i,skeleton:e}}return r},e.prototype.destroy=function(){this.removeEventListener()},e}(),It=function(){function e(e){i.Grid.Inject(i.Sort),this.parent=e,this.taskIds=[],this.flatSortedData=[],this.storedIndex=-1,this.isSelfReference=!t.isNullOrUndefined(this.parent.parentIdMapping),this.addEventListener()}return e.prototype.getModuleName=function(){return"sort"},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this),this.parent.on("createSort",this.createdSortedRecords,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateModel",this.updateModel),this.parent.off("createSort",this.createdSortedRecords))},e.prototype.createdSortedRecords=function(e){var t=e.modifiedData,i=e.srtQry;this.iterateSort(t,i),this.storedIndex=-1,e.modifiedData=this.flatSortedData,this.flatSortedData=[]},e.prototype.iterateSort=function(e,i){for(var r=0;r<e.length;r++)if(this.parent.grid.filterSettings.columns.length>0||""!==this.parent.grid.searchSettings.key?t.isNullOrUndefined(y(this.parent,e[r].uniqueID,!0))||(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[r]):(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[r]),e[r].hasChildRecords){var o=new n.DataManager(e[r].childRecords).executeLocal(i);if(this.parent.allowRowDragAndDrop&&-1!==e[r].childRecords.indexOf(this.parent.rowDragAndDropModule.draggedRecord)&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var a=o.indexOf(this.parent.rowDragAndDropModule.draggedRecord);o.splice(a,1);var s=o.indexOf(this.parent.rowDragAndDropModule.droppedRecord);"topSegment"===this.parent.rowDragAndDropModule.dropPosition?o.splice(s,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&o.splice(s+1,0,this.parent.rowDragAndDropModule.draggedRecord)}this.iterateSort(o,i)}},e.prototype.sortColumn=function(e,t,i){this.parent.grid.sortColumn(e,t,i)},e.prototype.removeSortColumn=function(e){this.parent.grid.removeSortColumn(e)},e.prototype.updateModel=function(){this.parent.setProperties({sortSettings:i.getActualProperties(this.parent.grid.sortSettings)},!0)},e.prototype.clearSorting=function(){this.parent.grid.clearSorting(),this.updateModel()},e.prototype.destroy=function(){this.removeEventListener()},e}(),Dt=function(){function e(e){i.Grid.Inject(i.ColumnMenu),this.parent=e}return e.prototype.getColumnMenu=function(){return this.parent.grid.columnMenuModule.getColumnMenu()},e.prototype.destroy=function(){},e.prototype.getModuleName=function(){return"columnMenu"},e}(),Mt=function(){function e(e){i.Grid.Inject(i.ContextMenu),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("contextMenuOpen",this.contextMenuOpen,this),this.parent.on("contextMenuClick",this.contextMenuClick,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("contextMenuOpen",this.contextMenuOpen),this.parent.off("contextMenuClick",this.contextMenuClick))},e.prototype.contextMenuOpen=function(e){var i=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_AddRow",e.element),r=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_Edit",e.element),n=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_Indent",e.element),o=t.select("#"+this.parent.element.id+"_gridcontrol_cmenu_Outdent",e.element);i&&(!1===this.parent.grid.editSettings.allowAdding||this.parent.grid.isEdit?i.style.display="none":i.style.display="block"),"Cell"!==this.parent.editSettings.mode&&"Batch"!==this.parent.editSettings.mode||t.isNullOrUndefined(r)||r.classList.contains("e-menu-hide")||(r.style.display="none");var a=this.parent,s=a.getSelectedRows()[0];if(!n&&!o||t.isNullOrUndefined(s))a.grid.isEdit&&t.isNullOrUndefined(s)&&(n.style.display="none",o.style.display="none");else{var d=e.event.target.closest("td");if(t.isNullOrUndefined(d)||!t.isNullOrUndefined(d)&&!d.classList.contains("e-rowcell"))n.style.display=o.style.display="none";else if(0===s.rowIndex||a.getSelectedRowIndexes().length>1)n.style.display=o.style.display="none";else if("rowDeselected"!==e.name||!t.isNullOrUndefined(s)&&a.grid.isCheckBoxSelection){var l=a.getCurrentViewRecords()[s.rowIndex];t.isNullOrUndefined(l)||(l.level>a.getCurrentViewRecords()[s.rowIndex-1].level||"Batch"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode?n.style.display="none":n.style.display="block",l.level===a.getCurrentViewRecords()[s.rowIndex-1].level&&"Batch"!==this.parent.editSettings.mode&&"Cell"!==this.parent.editSettings.mode&&(n.style.display="block"),0===l.level||"Batch"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode?o.style.display="none":o.style.display="block")}}},e.prototype.contextMenuClick=function(e){if("Above"!==e.item.id&&"Below"!==e.item.id&&"Child"!==e.item.id||(this.parent.notify("savePreviousRowPosition",e),this.parent.setProperties({editSettings:{newRowPosition:e.item.id}},!0),this.parent.editModule.isAddedRowByContextMenu=!0,this.parent.addRecord()),(e.item.id===this.parent.element.id+"_gridcontrol_cmenu_Indent"||e.item.id===this.parent.element.id+"_gridcontrol_cmenu_Outdent")&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule)){var i=e.item.id===this.parent.element.id+"_gridcontrol_cmenu_Indent"?"indent":"outdent";this.parent.rowDragAndDropModule.indentOutdentAction(null,i)}},e.prototype.getModuleName=function(){return"contextMenu"},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getContextMenu=function(){return this.parent.grid.contextMenuModule.getContextMenu()},e}(),Ot=function(){function e(e){this.batchChildCount=0,this.addedRecords="addedRecords",this.deletedRecords="deletedRecords",this.batchAddedRecords=[],this.batchDeletedRecords=[],this.batchAddRowRecord=[],this.parent=e,this.isSelfReference=!t.isNullOrUndefined(e.parentIdMapping),this.batchRecords=[],this.currentViewRecords=[],this.isAdd=!1,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(ae,this.cellSaved,this),this.parent.on(pe,this.batchAdd,this),this.parent.on(ce,this.beforeBatchAdd,this),this.parent.on(ge,this.batchSave,this),this.parent.on(he,this.beforeBatchDelete,this),this.parent.on(ue,this.beforeBatchSave,this),this.parent.on("batchPageAction",this.batchPageAction,this),this.parent.on("batchCancelAction",this.batchCancelAction,this),this.parent.grid.on("immutable-batch-cancel",this.immutableBatchAction,this),this.parent.grid.on("next-cell-index",this.nextCellIndex,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ae,this.cellSaved),this.parent.off(pe,this.batchAdd),this.parent.off(ge,this.batchSave),this.parent.off(ce,this.beforeBatchAdd),this.parent.off(he,this.beforeBatchDelete),this.parent.off(ue,this.beforeBatchSave),this.parent.off("batchPageAction",this.batchPageAction),this.parent.off("batchCancelAction",this.batchCancelAction),this.parent.grid.off("immutable-batch-cancel",this.immutableBatchAction),this.parent.grid.off("next-cell-index",this.nextCellIndex))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getBatchRecords=function(){return this.batchRecords},e.prototype.getAddRowIndex=function(){return this.addRowIndex},e.prototype.getSelectedIndex=function(){return this.selectedIndex},e.prototype.getBatchChildCount=function(){return this.batchChildCount},e.prototype.batchPageAction=function(){var e,i=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,r=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords)&&this.batchAddedRecords.length)for(var o=0;o<this.batchAddedRecords.length;o++)e=i.map(function(e){return e[r]}).indexOf(this.batchAddedRecords[o][r]),i.splice(e,1);this.batchAddedRecords=this.batchRecords=this.batchAddRowRecord=this.batchDeletedRecords=this.currentViewRecords=[]},e.prototype.cellSaved=function(e){var r=e.cell.cellIndex,o=this.parent.frozenColumns||this.parent.getFrozenColumns();o&&e.columnObject.index>o&&(r+=o);if(this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0){this.parent.getFrozenLeftColumnsCount()+r===this.parent.treeColumnIndex&&this.parent.renderModule.cellRender({data:e.rowData,cell:e.cell,column:this.parent.grid.getColumnByIndex(e.cell.cellIndex)})}else r===this.parent.treeColumnIndex&&this.parent.renderModule.cellRender({data:e.rowData,cell:e.cell,column:this.parent.grid.getColumnByIndex(e.cell.cellIndex)});if(this.isAdd&&"Batch"===this.parent.editSettings.mode&&"Bottom"!==this.parent.editSettings.newRowPosition){var a=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,s=void 0,d=this.parent.grid.getPrimaryKeyFieldNames()[0],l=void 0,p=void 0,h="parentItem",u=this.selectedIndex>-1?this.batchRecords[this.addRowIndex][h]:null,f=void 0,y=void 0,m=void 0,v="Top"===this.parent.editSettings.newRowPosition||-1===this.selectedIndex?0:"Above"===this.parent.editSettings.newRowPosition?this.addRowIndex:this.addRowIndex+1;if(v=this.getActualRowObjectIndex(v),this.newBatchRowAdded){if(this.batchRecords.length&&(f=this.batchRecords[this.addRowIndex][this.parent.idMapping],m=this.batchRecords[this.addRowIndex][this.parent.parentIdMapping],this.batchRecords[this.addRowIndex][h]&&(y=this.batchRecords[this.addRowIndex][h].uniqueID)),this.batchAddedRecords=g(this.batchAddedRecords),this.batchAddRowRecord=g(this.batchAddRowRecord),this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]),s=this.parent.grid.getRowsObject()[v].changes,s.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+s.uniqueID,s,this.parent),!Object.prototype.hasOwnProperty.call(s,"level")){if(this.batchIndex=-1===this.selectedIndex?0:this.batchIndex,"Child"===this.parent.editSettings.newRowPosition){if(s.primaryParent=u,this.selectedIndex>-1){s.parentItem=t.extend({},this.batchRecords[this.addRowIndex]),s.parentUniqueID=s.parentItem.uniqueID,delete s.parentItem.childRecords,delete s.parentItem[this.parent.childMapping],s.level=s.parentItem.level+1,s.index=this.batchIndex;var w=c(this.batchRecords[this.addRowIndex]).length,C=c(this.batchRecords[this.addRowIndex])[w-1];C=t.isNullOrUndefined(C)?this.batchRecords[this.addRowIndex]:C,l=a.map(function(e){return e[d]}).indexOf(C[d]),this.isSelfReference&&(s[this.parent.parentIdMapping]=f),R(d,s.parentItem,"add",this.parent,this.isSelfReference,s)}}else if(("Above"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)&&!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])){if(s.level=this.batchRecords[this.addRowIndex].level,s.level&&this.selectedIndex>-1&&(s.parentItem=u,s.parentUniqueID=y,delete s.parentItem.childRecords,delete s.parentItem[this.parent.childMapping]),s.index="Below"===this.parent.editSettings.newRowPosition?this.batchIndex:this.batchIndex-1,"Below"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){w=c(this.batchRecords[this.addRowIndex]).length,C=c(this.batchRecords[this.addRowIndex])[w-1];C=t.isNullOrUndefined(C)?this.batchRecords[this.addRowIndex]:C,l=a.map(function(e){return e[d]}).indexOf(C[d])}if("Above"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){C=this.batchRecords[this.addRowIndex];l=a.map(function(e){return e[d]}).indexOf(C[d])}this.isSelfReference&&(s[this.parent.parentIdMapping]=m)}s.index=-1===s.index?0:s.index,s.hasChildRecords=!1,s.childRecords=[],this.batchRecords.splice(s.index,0,s),this.currentViewRecords.splice(s.index,0,s),p=l||s.index,"Above"!==this.parent.editSettings.newRowPosition&&(p=0===s.index?p:p+1),a.splice(p,0,s),this.batchAddedRecords.push(s)}this.parent.grid.getRowsObject()[v].data=s,this.newBatchRowAdded=!1}(this.parent.frozenColumns||this.parent.getFrozenColumns()&&"add"===this.parent.grid.getRowsObject()[v].edit)&&t.merge(this.currentViewRecords[v],this.parent.grid.getRowsObject()[v].changes)}},e.prototype.beforeBatchAdd=function(e){if("Cell"===this.parent.editSettings.mode&&this.parent.editModule.isTabLastRow)return e.cancel=!0,void(this.parent.editModule.isTabLastRow=!1);!this.parent.editModule.isAddedRowByMethod||t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.parent.editModule.isAddedRowByContextMenu||-1!==this.parent.grid.selectedRowIndex&&!this.parent.editModule.batchEditModule.isAdd?(this.selectedIndex=this.parent.grid.selectedRowIndex,this.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0,this.parent.editModule.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0,this.addRowRecord=this.parent.getSelectedRecords()[0]):(this.selectedIndex=this.parent.editModule.selectedIndex,this.addRowIndex=this.parent.editModule.addRowIndex,this.addRowRecord=this.batchRecords.length?this.batchRecords[this.selectedIndex]:this.parent.getCurrentViewRecords()[this.selectedIndex])},e.prototype.batchAdd=function(e){if("Bottom"!==this.parent.editSettings.newRowPosition){this.isAdd=!0,this.newBatchRowAdded=!0;var i=0;if(this.batchRecords.length||(this.batchAddedRecords=[],this.batchRecords=g(this.parent.grid.getCurrentViewRecords()),this.currentViewRecords=g(this.parent.grid.getCurrentViewRecords())),this.parent.editModule.isAddedRowByMethod&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&t.classList(this.parent.grid.getDataRows()[0],["e-batchrow"],[]),"Top"!==this.parent.editSettings.newRowPosition){var r=this.parent.grid.getCurrentViewRecords();"Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)&&(r=this.batchRecords),this.updateChildCount(r),this.parent.notify(re,{}),this.batchChildCount=0}this.updateRowIndex();var n=t.getValue("focusModule",this.parent.grid),o=this.parent.getContentTable();if(this.parent.getBatchChanges()[this.deletedRecords].length&&"Above"===this.parent.editSettings.newRowPosition?(i=e.row.rowIndex,n.getContent().matrix.matrix=this.matrix):i=o.getElementsByClassName("e-batchrow")[0].rowIndex,n.getContent().matrix.current=[i,n.getContent().matrix.current[1]],this.parent.editModule.isAddedRowByMethod&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){var a=this.parent.getBatchChanges().addedRecords,s=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[a.length-1].getAttribute("data-rowindex"),10);this.batchRecords.splice(s,0,a[a.length-1])}}},e.prototype.beforeBatchDelete=function(e){this.batchRecords.length||(this.batchRecords=g(this.parent.grid.getCurrentViewRecords()),this.currentViewRecords=g(this.parent.grid.getCurrentViewRecords()));var i=t.getValue("focusModule",this.parent.grid);this.matrix=i.getContent().matrix.matrix;var r,n,o,a=[],s=[],d=this.parent.grid.getPrimaryKeyFieldNames()[0];t.isNullOrUndefined(e.row)||-1!==this.parent.getSelectedRows().indexOf(e.row)?(n=c(r=this.parent.grid.getSelectedRecords()[this.parent.grid.getSelectedRecords().length-1]),o=this.parent.getSelectedRows()[0].getAttribute("data-uid")):(n=c(r=e.rowData),o=e.row.getAttribute("data-uid"));var l=parseInt(this.parent.grid.getRowElementByUID(o).getAttribute("data-rowindex"),10);if(n.length)for(var p=l+n.length,h=l+1;h<=p;h++)a.push(this.parent.grid.getDataRows()[h]),(this.parent.frozenRows||this.parent.frozenColumns||this.parent.getFrozenColumns())&&a.push(this.parent.grid.getMovableRows()[h]);if(!t.isNullOrUndefined(r.parentItem)){var u=y(this.parent,r.parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var f=u.childRecords.indexOf(r);u.childRecords.splice(f,1)}this.batchDeletedRecords=g(this.batchDeletedRecords),this.batchDeletedRecords.push(r)}n.push(r),s=n;for(h=0;h<s.length;h++){var m=this.batchRecords.map(function(e){return e[d]}).indexOf(s[h][d]);-1!==m&&this.batchRecords.splice(m,1)}for(h=0;h<a.length;h++)t.isNullOrUndefined(a[h])||this.parent.grid.selectionModule.selectedRecords.push(a[h])},e.prototype.updateRowIndex=function(){for(var e=this.parent.grid.getDataRows(),t=0;t<e.length;t++)e[t].setAttribute("data-rowindex",t.toString());var i=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;if(this.parent.frozenRows||this.parent.getFrozenColumns()||this.parent.frozenColumns||i){var r=this.parent.grid.getMovableDataRows(),n=this.parent.grid.getFrozenRightDataRows();for(t=0;t<r.length;t++)r[t].setAttribute("data-rowindex",t.toString()),i&&n[t].setAttribute("data-rowindex",t.toString())}},e.prototype.updateChildCount=function(e){for(var i=this.parent.grid.getPrimaryKeyFieldNames()[0],r="addedRecords",n="Child"===this.parent.editSettings.newRowPosition?"primaryParent":"parentItem",o=0;o<this.parent.getBatchChanges()[r].length;o++)t.isNullOrUndefined(this.parent.getBatchChanges()[r][o][n])||this.parent.getBatchChanges()[r][o][n][i]===e[this.addRowIndex][i]&&(this.batchChildCount=this.batchChildCount+1)},e.prototype.beforeBatchSave=function(e){var t="deletedRecords",i=e.batchChanges.changedRecords;if(e.batchChanges.changedRecords.length)for(var r=0;r<i.length;r++)v({value:i[r],action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,void 0);if(e.batchChanges[t].length){var n=e.batchChanges[t];for(r=0;r<n.length;r++){this.deleteUniqueID(n[r].uniqueID);for(var o=c(n[r]),a=0;a<o.length;a++)this.deleteUniqueID(o[a].uniqueID);e.batchChanges[t]=e.batchChanges[t].concat(o)}}this.isAdd=!1},e.prototype.deleteUniqueID=function(e){delete this.parent.uniqueIDFilterCollection[e];delete this.parent.uniqueIDCollection[e]},e.prototype.batchCancelAction=function(){var e,i="targetElement",r="parentItem",o=this.parent.grid.getCurrentViewRecords(),a="childRecords",s=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,d=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords))for(var l=0;l<this.batchAddedRecords.length;l++)if(-1!==(e=s.map(function(e){return e[d]}).indexOf(this.batchAddedRecords[l][d]))&&s.splice(e,1),"Child"===this.parent.editSettings.newRowPosition&&(e=o.map(function(e){return e[d]}).indexOf(this.batchAddedRecords[l][r]?this.batchAddedRecords[l][r][d]:this.batchAddedRecords[l][d]),!t.isNullOrUndefined(o[e])))for(var p=o[e][a],h=0;p&&h<p.length;h++)p[h][d]===this.batchAddedRecords[l][d]&&o[e][a].splice(h,1);if(!t.isNullOrUndefined(this.parent[i])){var c=this.parent[i].closest("tr");this.parent.collapseRow(c),this.parent[i]=null}if(!t.isNullOrUndefined(this.batchDeletedRecords))for(l=0;l<this.batchDeletedRecords.length;l++)if(!t.isNullOrUndefined(this.batchDeletedRecords[l][r])){e=o.map(function(e){return e[d]}).indexOf(this.batchDeletedRecords[l][r][d]);var u=0===this.batchDeletedRecords[l].index?this.batchDeletedRecords[l].index:this.batchDeletedRecords[l].index-1;t.isNullOrUndefined(o[e])||o[e][a].splice(u,0,this.batchDeletedRecords[l])}this.batchAddedRecords=this.batchRecords=this.batchAddRowRecord=this.currentViewRecords=[],this.batchRecords=g(this.parent.grid.getCurrentViewRecords()),this.batchIndex=0,this.currentViewRecords=g(this.parent.grid.getCurrentViewRecords()),this.batchDeletedRecords=[],this.parent.grid.renderModule.refresh()},e.prototype.batchSave=function(e){if("Batch"===this.parent.editSettings.mode){var i=void 0,r=Object.hasOwnProperty.call(e,"updatedRecords")?e.updatedRecords:this.parent.getBatchChanges(),o="deletedRecords",a=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,s=this.parent.grid.getCurrentViewRecords(),d=this.parent.grid.getPrimaryKeyFieldNames()[0],l=r.addedRecords,p=void 0,h=void 0,c=void 0;if(l.length>1&&"Bottom"!==this.parent.editSettings.newRowPosition&&l.reverse(),"Bottom"!==this.parent.editSettings.newRowPosition&&!Object.hasOwnProperty.call(e,"updatedRecords")){if(a.splice(a.length-l.length,l.length),this.parent.editModule.isAddedRowByMethod&&l.length&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){l.reverse();for(var u=0;u<l.length;u++){var f=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[u].getAttribute("data-rowindex"),10);a.splice(f,0,l[u])}}if(this.parent.allowPaging||a.length===s.length){var y=g(a);if(y.length){var m=y.map(function(e){return e[d]}).indexOf(s[0][d]),w=m+this.parent.grid.pageSettings.pageSize;s=y.splice(m,w)}}else s.length>l.length&&s.splice(s.length-l.length,l.length)}for(0===this.batchAddRowRecord.length&&this.batchAddRowRecord.push(this.parent.flatData[e.index]),this.parent.editModule.isAddedRowByContextMenu&&l.reverse(),i=0;i<l.length;i++){var C=t.extend({},l[i]);if(delete C.parentItem,delete C.uniqueID,delete C.index,delete C.level,delete C.hasChildRecords,delete C.childRecords,delete C.parentUniqueID,t.isNullOrUndefined(C.primaryParent)||delete C.primaryParent,l.length>1&&this.parent.editModule.isAddedRowByContextMenu){var x=this.parent.editSettings.newRowPosition;this.parent.editSettings.newRowPosition=this.parent.editModule.previousNewRowPosition,this.parent.editModule.previousNewRowPosition=x}if(l[i].taskData=C,c=this.batchAddRowRecord[i],t.isNullOrUndefined(c)&&(c=this.batchAddRowRecord[i-1]),this.isSelfReference&&(t.isNullOrUndefined(l[i].parentItem)||R(d,l[i].parentItem,"add",this.parent,this.isSelfReference,l[i])),t.isNullOrUndefined(c)||(h=c.index),"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(l[i].parentItem)&&-1===this.selectedIndex&&(p=-1,c=null),v({value:l[i],action:"add"},this.parent,this.isSelfReference,h,p,void 0,c),p=null,"Child"===this.parent.editSettings.newRowPosition&&!t.isNullOrUndefined(l[i].parentItem)&&(t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.isSelfReference))for(var b=s.map(function(e){return e[d]}).indexOf(l[i].parentItem[d]),S=s[b].childRecords,I=0;I<S.length;I++)S[I][d]===l[i][d]&&s[b].childRecords.splice(I,1)}if(r[o].length)for(i=0;i<r[o].length;i++)v({value:r[o][i],action:"delete"},this.parent,this.isSelfReference,h,p,void 0,c);this.parent.parentData=[];for(var D=0;D<a.length;D++)a[D].index=D,t.setValue("uniqueIDCollection."+a[D].uniqueID+".index",D,this.parent),a[D].level||this.parent.parentData.push(a[D])}this.batchAddRowRecord=this.batchAddedRecords=this.batchRecords=this.batchDeletedRecords=this.currentViewRecords=[],this.parent.editModule.isAddedRowByContextMenu&&(this.parent.editModule.isAddedRowByContextMenu=!1)},e.prototype.getActualRowObjectIndex=function(e){var i=this.parent.grid.getDataRows();if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&this.selectedIndex>-1){if(!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])&&this.batchRecords[this.addRowIndex].expanded)if(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length){if(e+=c(this.batchRecords[this.addRowIndex]).length,"Child"!==this.parent.editSettings.newRowPosition){e+=this.getBatchChildCount()}}else e+=c(this.batchRecords[this.addRowIndex]).length;e>=i.length&&(e=i.length-1),this.updateChildCount(this.parent.grid.getCurrentViewRecords()),this.batchChildCount&&(e+=this.batchChildCount),this.batchChildCount=0}return e},e.prototype.immutableBatchAction=function(e){e.args.cancel=!0;var t=this.parent.grid.getBatchChanges(),i=[];Object.keys(t).length&&(i=t.addedRecords);for(var r=0;r<i.length;r++)e.rows.splice(i[r].index,1)},e.prototype.nextCellIndex=function(e){this.parent.getSelectedRows().length?e.index=this.parent.getSelectedRows()[0].rowIndex:e.index=this.batchIndex},e}(),Pt=function(){function e(e){this.addedRecords="addedRecords",this.deletedRecords="deletedRecords",this.prevAriaRowIndex="-1",this.isAddedRowByMethod=!1,this.isAddedRowByContextMenu=!1,i.Grid.Inject(i.Edit),this.parent=e,this.isSelfReference=!t.isNullOrUndefined(e.parentIdMapping),this.previousNewRowPosition=null,this.internalProperties={},this.batchEditModule=new Ot(this.parent),this.addEventListener()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.addEventListener=function(){this.parent.on(te,this.crudAction,this),this.parent.on(ie,this.beginEdit,this),this.parent.on(re,this.beginAdd,this),this.parent.on(ne,this.recordDoubleClick,this),this.parent.on(oe,this.cellSave,this),this.parent.on(le,this.batchCancel,this),this.parent.grid.on(fe,this.keyPressed,this),this.parent.grid.on("batchedit-form",this.lastCellTab,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on(se,this.cellEdit,this),this.parent.on("actionBegin",this.editActionEvents,this),this.parent.on("actionComplete",this.editActionEvents,this),this.parent.grid.on(ye,this.recordDoubleClick,this),this.parent.grid.on("dblclick",this.gridDblClick,this),this.parent.grid.on("recordAdded",this.customCellSave,this),this.parent.on("savePreviousRowPosition",this.savePreviousRowPosition,this),this.parent.grid.on(Re,this.beforeStartEdit,this),this.parent.grid.on(Ce,this.beforeBatchCancel,this),this.parent.grid.on("reset-edit-props",this.resetIsOnBatch,this),this.parent.grid.on("get-row-position",this.getRowPosition,this)},e.prototype.gridDblClick=function(e){this.doubleClickTarget=e.target},e.prototype.getRowPosition=function(e){e.newRowPosition=this.parent.editSettings.newRowPosition,e.addRowIndex=this.addRowIndex,e.dataRowIndex=+this.prevAriaRowIndex},e.prototype.beforeStartEdit=function(e){this.parent.trigger(T,e)},e.prototype.beforeBatchCancel=function(e){"Cell"===this.parent.editSettings.mode&&this.parent.trigger(F,e)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(te,this.crudAction),this.parent.off(ie,this.beginEdit),this.parent.off(re,this.beginAdd),this.parent.off(ne,this.recordDoubleClick),this.parent.off(le,this.batchCancel),this.parent.grid.off(fe,this.keyPressed),this.parent.grid.off("batchedit-form",this.lastCellTab),this.parent.grid.off("content-ready",this.contentready),this.parent.off(se,this.cellEdit),this.parent.off("actionBegin",this.editActionEvents),this.parent.off("actionComplete",this.editActionEvents),this.parent.grid.off("recordAdded",this.customCellSave),this.parent.grid.off(ye,this.recordDoubleClick),this.parent.off("savePreviousRowPosition",this.savePreviousRowPosition),this.parent.grid.off(Re,this.beforeStartEdit),this.parent.grid.off(Ce,this.beforeBatchCancel),this.parent.grid.off("dblclick",this.gridDblClick),this.parent.grid.off("reset-edit-props",this.resetIsOnBatch),this.parent.grid.off("get-row-position",this.getRowPosition))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.applyFormValidation=function(e){this.parent.grid.editModule.applyFormValidation(e)},e.prototype.editActionEvents=function(e){var r=i.getObject("editAction",e),o=i.getObject("name",r),s=this.parent,d=s.dataSource.adaptor;if((a(s)||d instanceof n.RemoteSaveAdaptor)&&"save"===r.requestType&&"add"===r.action&&("Child"===s.editSettings.newRowPosition||"Below"===s.editSettings.newRowPosition||"Above"===s.editSettings.newRowPosition))if("actionBegin"===o){var l=t.isNullOrUndefined(r.row)||!Object.keys(r.row).length?this.selectedIndex:r.row.rowIndex-1,p=t.isNullOrUndefined(l)||-1===l?-1:s.getCurrentViewRecords()[l][s.getPrimaryKeyFieldNames()[0]];s.grid.query.addParams("relationalKey",p)}else if("actionComplete"===o)for(var h=s.grid.query.params.length,c=0;c<h;c++)"relationalKey"===s.grid.query.params[c].key&&s.grid.query.params.splice(c);this.parent.enableInfiniteScrolling&&"actionComplete"===o&&this.infiniteAddAction(r),"Batch"===this.parent.editSettings.mode&&"paging"===r.requestType&&this.parent.notify("batchPageAction",{})},e.prototype.infiniteAddAction=function(e){if("save"===e.requestType&&"add"===e.action||"delete"===e.requestType){if("Top"!==this.parent.editSettings.newRowPosition&&-1!==this.selectedIndex&&"save"===e.requestType&&"add"===e.action){var t=this.parent.grid.getRowsObject(),r=t.splice(0,1)[0],n=this.addRowIndex,o=this.parent.getCurrentViewRecords();"Below"!==this.parent.editSettings.newRowPosition&&"Child"!==this.parent.editSettings.newRowPosition||(n+=c(o[n+1]).length),n="Below"===this.parent.editSettings.newRowPosition?n+1:n,t.splice(n,0,r);var a=o.splice(0,1)[0];o.splice(n,0,a),this.updateInfiniteCurrentViewData(a,this.addRowIndex)}var s=this.parent.grid.getMovableRows(),d=this.parent.grid.getMovableRowsObject(),l=this.parent.infiniteScrollSettings.enableCache;l||(i.resetRowIndex(this.parent.grid,this.parent.grid.getRowsObject(),this.parent.grid.getRows(),0),this.updateIndex(this.parent.grid.dataSource,this.parent.getRows(),this.parent.getCurrentViewRecords())),!l&&this.parent.getFrozenColumns()>0&&(i.resetRowIndex(this.parent.grid,d,s,0),this.updateIndex(this.parent.grid.dataSource,s,this.parent.getCurrentViewRecords()))}},e.prototype.updateInfiniteCurrentViewData=function(e,i){var r=this,n=Math.ceil(i/this.parent.grid.pageSettings.pageSize),o=n>0?n:1,a=i-(o-1)*this.parent.pageSettings.pageSize,s=this.parent.grid.infiniteScrollModule.infiniteCurrentViewData;s[1].splice(0,1);var d=s[o];t.isNullOrUndefined(this.addRowRecord)||(d.filter(function(e,t){e.uniqueID===r.addRowRecord.uniqueID&&(a=t)}),(this.addRowRecord.hasChildRecords&&this.addRowRecord.childRecords.length&&"Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(a+=c(this.addRowRecord).length)),a>=this.parent.pageSettings.pageSize&&(d=s[o+=1],a=a-this.parent.pageSettings.pageSize>=0?a-this.parent.pageSettings.pageSize:0),a="Below"===this.parent.editSettings.newRowPosition?a+1:a,d.splice(a,0,e),this.parent.grid.infiniteScrollModule.updateCurrentViewData()},e.prototype.recordDoubleClick=function(e){var r=e.target;if(!t.isNullOrUndefined(r.closest("td.e-rowcell"))&&this.parent.grid.editSettings.allowEditing&&!this.parent.grid.isEdit){var n=this.parent.grid.getColumnByIndex(+r.closest("td.e-rowcell").getAttribute("data-colindex"));if("Cell"===this.parent.editSettings.mode&&!this.isOnBatch&&n&&!n.isPrimaryKey&&this.parent.editSettings.allowEditing&&n.allowEditing&&!r.classList.contains("e-treegridexpand")&&!r.classList.contains("e-treegridcollapse")&&this.parent.editSettings.allowEditOnDblClick){if(this.isOnBatch=!0,this.parent.grid.setProperties({selectedRowIndex:e.rowIndex},!0),this.parent.enableVirtualization){var o=i.parentsUntil(e.target,"e-row");this.prevAriaRowIndex=o.getAttribute("data-rowindex"),o.setAttribute("data-rowindex",o.rowIndex+"")}this.updateGridEditMode("Batch")}else"Cell"!==this.parent.editSettings.mode||n.allowEditing&&!n.isPrimaryKey||(this.isOnBatch=!0,this.updateGridEditMode("Batch"))}},e.prototype.updateGridEditMode=function(e){this.parent.grid.setProperties({editSettings:{mode:e}},!0);i.getObject("updateEditObj",this.parent.grid.editModule).apply(this.parent.grid.editModule),this.parent.grid.isEdit=!1},e.prototype.resetIsOnBatch=function(){this.parent.enableVirtualization&&"Cell"===this.parent.editSettings.mode&&(this.isOnBatch=!1,this.updateGridEditMode("Normal"))},e.prototype.keyPressed=function(e){this.isOnBatch&&(this.keyPress=e.action),"f2"===e.action&&this.recordDoubleClick(e),"escape"===e.action&&this.parent.closeEdit()},e.prototype.deleteUniqueID=function(e){delete this.parent.uniqueIDFilterCollection[e];delete this.parent.uniqueIDCollection[e]},e.prototype.cellEdit=function(e){var i=this,r=e.promise;if(delete e.promise,this.parent.enableVirtualization&&!t.isNullOrUndefined(this.prevAriaRowIndex)&&"-1"!==this.prevAriaRowIndex&&(e.row.setAttribute("data-rowindex",this.prevAriaRowIndex),this.prevAriaRowIndex=void 0),"enter"!==this.keyPress&&this.parent.trigger(se,e,function(e){e.cancel||"Cell"!==i.parent.editSettings.mode?e.cancel&&"Cell"===i.parent.editSettings.mode&&(i.isOnBatch=!1,i.updateGridEditMode("Normal")):i.enableToolbarItems("edit"),t.isNullOrUndefined(r)||r.resolve(e)}),this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-summarycell")))return e.cancel=!0,void(this.doubleClickTarget=null);"Cell"===this.parent.editSettings.mode&&("tab"===this.keyPress||"shiftTab"===this.keyPress?this.keyPress=null:"enter"===this.keyPress&&(e.cancel=!0,this.keyPress=null,t.setValue("isEditCollapse",!1,this.parent)),e.columnObject.allowEditing||(e.cancel=!0)),this.parent.enableVirtualization&&(this.parent.grid.contentModule.editedRowIndex=this.parent.grid.editModule.editModule.index)},e.prototype.enableToolbarItems=function(e){if(!t.isNullOrUndefined(this.parent.grid.toolbarModule)){var i=this.parent.element.id+"_gridcontrol_";this.parent.grid.toolbarModule.enableItems([i+"add",i+"edit",i+"delete"],"save"===e),this.parent.grid.toolbarModule.enableItems([i+"update",i+"cancel"],"edit"===e)}},e.prototype.batchCancel=function(){if("Cell"===this.parent.editSettings.mode){var e=t.getValue("editModule.cellDetails",this.parent.grid.editModule),i=this.parent.getCellFromIndex(e.rowIndex,this.parent.treeColumnIndex);this.parent.renderModule.cellRender({data:e.rowData,cell:i,column:this.parent.grid.getColumns()[this.parent.treeColumnIndex]}),this.updateGridEditMode("Normal"),this.isOnBatch=!1}"Batch"===this.parent.editSettings.mode&&this.parent.notify("batchCancelAction",{})},e.prototype.customCellSave=function(e){s(this.parent)&&"Cell"===this.parent.editSettings.mode&&"edit"===e.action&&(this.updateCell(e,e.rowIndex),this.afterCellSave(e,e.row,e.rowIndex))},e.prototype.cellSave=function(e){var i=this;if("Cell"===this.parent.editSettings.mode&&this.parent.element.querySelector("form")){e.cancel=!0;t.setValue("isEdit",!1,this.parent.grid),t.setValue("isEditCollapse",!0,this.parent),e.rowData[e.columnName]=e.value;var r;r=t.isNullOrUndefined(e.cell)?this.parent.grid.editModule.editModule.form.parentElement.parentNode:e.cell.parentNode;var o,d=this.parent.getPrimaryKeyFieldNames();if(t.isNullOrUndefined(r))this.parent.grid.getCurrentViewRecords().filter(function(t,i){t[d[0]]!==e.rowData[d[0]]||(o=i)});else{var l=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o=l?-1!==this.parent.getRows().indexOf(r)?this.parent.getRows().indexOf(r):-1!==this.parent.getFrozenRightRows().indexOf(r)?this.parent.getFrozenRightRows().indexOf(r):this.parent.getMovableRows().indexOf(r):-1===this.parent.getRows().indexOf(r)&&this.parent.getFrozenColumns()>0?this.parent.grid.getMovableRows().indexOf(r):this.parent.getRows().indexOf(r)}var p={};if(t.extend(p,e),p.cancel=!1,p.type="save",r=this.parent.grid.getRows()[r.rowIndex],this.parent.trigger(T,p),p.cancel)this.parent.grid.isEdit=!0;else if(r.rowIndex===this.parent.getCurrentViewRecords().length-1&&"tab"===this.keyPress&&(this.isTabLastRow=!0),a(this.parent)||this.parent.dataSource instanceof n.DataManager&&this.parent.dataSource.adaptor instanceof n.RemoteSaveAdaptor){if(a(this.parent)||this.parent.dataSource instanceof n.DataManager&&this.parent.dataSource.adaptor instanceof n.RemoteSaveAdaptor){var h=this.parent.grid.query;this.parent.grid.dataSource.update(d[0],e.rowData,h.fromTable,h,e.previousValue).then(function(n){t.isNullOrUndefined(n)||(e.rowData[e.columnName]=n[e.columnName]),i.updateCell(e,o),i.afterCellSave(e,r,o)})}}else if(s(this.parent)){var c={requestType:"save",data:e.rowData,action:"edit",row:r,rowIndex:o,rowData:e.rowData,columnName:e.columnName,filterChoiceCount:null,excelSearchOperator:null};this.parent.grid.getDataModule().eventPromise(c,this.parent.grid.query)}else this.updateCell(e,o),this.afterCellSave(e,r,o)}this.parent.enableVirtualization&&(this.parent.grid.contentModule.virtualData={})},e.prototype.afterCellSave=function(e,i,r){var n;this.parent.grid.aggregateModule&&this.parent.grid.aggregateModule.refresh(e.rowData),this.parent.grid.editModule.destroyWidgets([this.parent.grid.getColumnByField(e.columnName)]),this.parent.grid.editModule.formObj.destroy(),"tab"!==this.keyPress&&"shiftTab"!==this.keyPress&&(this.updateGridEditMode("Normal"),this.isOnBatch=!1),this.enableToolbarItems("save");this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0?(n=e.cell.closest(".e-frozen-left-header")||e.cell.closest(".e-frozen-left-content")?this.parent.grid.getRows()[r]:e.cell.closest(".e-movableheader")||e.cell.closest(".e-movablecontent")?this.parent.grid.getMovableRows()[r]:this.parent.grid.getFrozenRightRows()[r],t.removeClass([n],["e-editedrow","e-batchrow"]),t.removeClass(n.querySelectorAll(".e-rowcell"),["e-editedbatchcell","e-updatedtd"])):this.parent.getFrozenColumns()>0&&(n=e.cell.closest(".e-frozenheader")||e.cell.closest(".e-frozencontent")?this.parent.grid.getRows()[r]:this.parent.grid.getMovableRows()[r],t.removeClass([n],["e-editedrow","e-batchrow"]),t.removeClass(n.querySelectorAll(".e-rowcell"),["e-editedbatchcell","e-updatedtd"])),t.removeClass([i],["e-editedrow","e-batchrow"]),t.removeClass(i.querySelectorAll(".e-rowcell"),["e-editedbatchcell","e-updatedtd"]),!1!==this.parent.isCellSaveFocus&&this.parent.grid.focusModule.restoreFocus(),v({value:e.rowData,action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,e.columnName),i.rowIndex===this.parent.getCurrentViewRecords().length-1&&"enter"===this.keyPress&&(this.keyPress=null);var o={type:"save",column:this.parent.getColumnByField(e.columnName),data:e.rowData,previousData:e.previousValue,row:i,target:e.cell};this.parent.aggregates.map(function(e){return!0===e.showChildSummary}).length&&this.parent.grid.refresh(),this.parent.trigger(F,o)},e.prototype.lastCellTab=function(){!this.parent.grid.isEdit&&this.isOnBatch&&"tab"===this.keyPress&&"Cell"===this.parent.editSettings.mode&&(this.parent.editSettings.allowNextRowEdit?this.enableToolbarItems("edit"):(this.updateGridEditMode("Normal"),this.isOnBatch=!1,this.keyPress=null))},e.prototype.updateCell=function(e,t){this.parent.grid.editModule.updateCell(t,e.columnName,e.rowData[e.columnName]),this.parent.grid.getRowsObject()[t].data=e.rowData},e.prototype.crudAction=function(e,i){v(e,this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,i,this.addRowRecord),this.parent.parentData=[];for(var r=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,o=0;o<r.length;o++){r[o].index=o;var s=this.parent.grid.getPrimaryKeyFieldNames()[0];e.value[s]===r[o][s]&&"add"===e.action&&(r[o].level=this.internalProperties.level,r[o].taskData=this.internalProperties.taskData,r[o].uniqueID=this.internalProperties.uniqueID,t.isNullOrUndefined(this.internalProperties.parentItem)||(r[o].parentItem=this.internalProperties.parentItem,r[o].parentUniqueID=this.internalProperties.parentUniqueID),r[o].childRecords=this.internalProperties.childRecords),t.setValue("uniqueIDCollection."+r[o].uniqueID+".index",o,this.parent);var d=this.parent.dataSource.adaptor;(a(this.parent)||d instanceof n.RemoteSaveAdaptor)&&t.setValue("uniqueIDCollection."+r[o].uniqueID,r[o],this.parent),r[o].level||this.parent.parentData.push(r[o])}this.parent.enableInfiniteScrolling||"add"===e.action&&null!=this.previousNewRowPosition&&(this.parent.setProperties({editSettings:{newRowPosition:this.previousNewRowPosition}},!0),this.previousNewRowPosition=null)},e.prototype.updateIndex=function(e,i,r){for(var n=0;n<this.parent.getDataRows().length;n++){var o=r[n];if(!t.isNullOrUndefined(o)){var a=t.getValue("uniqueIDCollection."+o.uniqueID+".index",this.parent);if(o.index=a,!t.isNullOrUndefined(o.parentItem)){var s=t.getValue("uniqueIDCollection."+o.parentItem.uniqueID+".index",this.parent);o.parentItem.index=s}}}var d=-1,l=this.parent.treeColumnIndex;if(this.parent.getFrozenColumns()>0)for(var p=i[0].querySelectorAll(".e-rowcell"),h=0;h<p.length;h++)if(p[h].classList.contains("e-gridrowindex0level0")){l=h;break}for(var c=0;c<this.parent.getRows().length;c++){i[c].classList.contains("e-detailrow")||d++;var u=r[d];if(!t.isNullOrUndefined(u)){a=u.index;var g=u.level,f=i[c];t.isNullOrUndefined(u.parentItem)||(a=t.getValue("uniqueIDCollection."+u.parentItem.uniqueID+".index",this.parent));var y=f.cells[l];if(!t.isNullOrUndefined(y)){for(h=0;h<y.classList.length;h++){var m=y.classList[h],v=m.match(/e-gridrowindex/i),w=m.match(/e-griddetailrowindex/i);null!=v&&t.removeClass([y],m),null!=w&&t.removeClass([y],m)}i[c].classList.contains("e-detailrow")?t.addClass([y],"e-griddetailrowindex"+a+"level"+g):t.addClass([y],"e-gridrowindex"+a+"level"+g)}}}},e.prototype.beginAdd=function(){var e,i=this.addRowIndex,r=this.parent.grid.getCurrentViewRecords();"Batch"===this.parent.editSettings.mode&&(i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex(),(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)&&(r=this.batchEditModule.getBatchRecords()));var n=this.parent.grid.getDataRows(),o=n.length?+n[0].getAttribute("data-rowindex"):0,a=n.length?+n[n.length-1].getAttribute("data-rowindex"):0,s=this.selectedIndex>=o&&this.selectedIndex<=a,d=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex;if("Dialog"!==this.parent.editSettings.mode){if("Above"===this.parent.editSettings.newRowPosition)e="before";else if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(this.selectedIndex>-1||d)&&s&&(e="after",!t.isNullOrUndefined(r[i])&&r[i].expanded))if("Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)){if(i+=c(r[i]).length,"Child"!==this.parent.editSettings.newRowPosition){i+=this.batchEditModule.getBatchChildCount()}}else i+=c(r[i]).length;if((this.selectedIndex>-1||d)&&s&&(i||"Child"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)){i>=n.length-1&&(i=n.length-2);var l=this.parent.grid.contentModule.rows[0],p=document.activeElement;n[i+1][e](n[0]),t.setValue("batchIndex",i+1,this.batchEditModule);var h="Above"===this.parent.editSettings.newRowPosition?i:i+1;"Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule.rows.splice(0,1),this.parent.grid.contentModule.rows.splice(h,0,l));var u=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;if(this.parent.frozenRows||this.parent.getFrozenColumns()||this.parent.frozenColumns||u){var g=this.parent.getMovableDataRows(),f=this.parent.grid.getRowsObject()[0];if(g[i+1][e](g[0]),u){var y=this.parent.getFrozenRightDataRows();y[i+1][e](y[0])}"Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule.freezeRows.splice(0,1),this.parent.grid.contentModule.freezeRows.splice(h,0,f)),t.setValue("batchIndex",i+1,this.batchEditModule)}if("Row"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode){for(var m=this.parent.grid.getContentTable().querySelectorAll(".e-griderror"),v=0;v<m.length;v++)m[v].remove();t.setValue("errorRules",[],this.parent.grid.editModule.formObj)}d&&(this.prevAriaRowIndex="-1"),(!this.parent.enableVirtualization||this.parent.enableVirtualization&&!Object.keys(this.parent.grid.contentModule.emptyRowData).length)&&p.focus(),this.parent.enableVirtualization&&!Object.keys(this.parent.grid.contentModule.emptyRowData).length&&this.parent.grid.contentModule.createEmptyRowdata()}}if("Batch"===this.parent.editSettings.mode&&!t.isNullOrUndefined(this.addRowIndex)&&-1!==this.addRowIndex&&this.isAddedRowByMethod&&!this.isAddedRowByContextMenu){i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex();var w=this.parent.getBatchChanges().addedRecords,R=void 0;if(w.length)for(v=0;v<w.length;v++)t.isNullOrUndefined(w[v].uniqueID)&&(R=w[v]);var C={action:"add",data:R,index:i,seletedRow:0};this.beginAddEdit(C),this.batchEditModule.batchAddRowRecord.push(this.batchEditModule.addRowRecord),this.batchEditModule.batchAddedRecords.push(C.data)}},e.prototype.beginEdit=function(e){if("refresh"===e.requestType&&this.isOnBatch)e.cancel=!0;else if("Cell"!==this.parent.editSettings.mode||"beginEdit"!==e.requestType){if(this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-frame")))return e.cancel=!0,void(this.doubleClickTarget=null);if("delete"===e.requestType){var i=e.data;if(t.isNullOrUndefined(e.data[0].uniqueID))for(var r=this.parent.getPrimaryKeyFieldNames(),n=function(t){o.parent.flatData.filter(function(n){n[r[0]]===e.data[t][r[0]]&&(i[t]=n)})},o=this,a=0;a<i.length;a++)n(a);for(a=0;a<i.length;a++){this.deleteUniqueID(i[a].uniqueID);for(var s=c(i[a]),d=0;d<s.length;d++)this.deleteUniqueID(s[d].uniqueID);e.data=e.data.concat(s)}}if("add"===e.requestType||this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)){if((-1===this.parent.grid.selectedRowIndex&&this.isAddedRowByMethod||e.index!==this.parent.grid.selectedRowIndex)&&0!==e.index||(this.selectedIndex=this.parent.grid.selectedRowIndex),this.parent.enableVirtualization){var l='.e-row[data-rowindex="'+this.selectedIndex+'"]',p=void 0;this.selectedIndex>-1&&"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition?(this.prevAriaRowIndex=this.selectedIndex.toString(),p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.prevAriaRowIndex&&"-1"!==this.prevAriaRowIndex?(l='.e-row[data-rowindex="'+this.prevAriaRowIndex+'"]',p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.addRowIndex=0}else this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)?0!==e.index?this.addRowIndex=e.index:this.addRowIndex=this.parent.grid.selectedRowIndex:this.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0;this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)?(this.addRowRecord=this.parent.flatData[this.parent.grid.selectedRowIndex],this.parent.enableVirtualization&&this.isAddedRowByContextMenu&&(this.addRowRecord=this.parent.getCurrentViewRecords()[this.addRowIndex])):this.addRowRecord=this.parent.getSelectedRecords()[0]}this.isAddedRowByMethod&&0!==e.index&&(this.addRowRecord=this.parent.flatData[e.index],this.addRowIndex=e.index),"Child"===this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(this.addRowRecord)&&!t.isNullOrUndefined(this.parent.getSelectedRecords()[0])&&(this.addRowRecord=this.parent.getSelectedRecords()[0]),this.isAddedRowByMethod=!1,e=this.beginAddEdit(e)}else e.cancel=!0},e.prototype.savePreviousRowPosition=function(){null===this.previousNewRowPosition&&(this.previousNewRowPosition=this.parent.editSettings.newRowPosition)},e.prototype.beginAddEdit=function(e){var r=e.data;if("add"===e.action){var o=this.parent.grid.getPrimaryKeyFieldNames()[0],a=null;r.taskData=t.isNullOrUndefined(r.taskData)?t.extend({},e.data):r.taskData;var s=void 0;s=this.parent.enableVirtualization&&0!==e.index?this.parent.flatData:"Batch"===this.parent.editSettings.mode&&this.isAddedRowByMethod&&!t.isNullOrUndefined(this.addRowIndex)?this.batchEditModule.batchRecords:this.parent.grid.getCurrentViewRecords(),this.parent.enableVirtualization&&0!==e.index&&(this.addRowIndex=this.parent.flatData.indexOf(this.addRowRecord),this.selectedIndex=this.addRowIndex);var d=this.addRowIndex;r.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r.uniqueID,r,this.parent);var l=0,p=void 0,h=void 0,u=void 0,g=void 0,f=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex,m=this.parent.getRows(),v=m.length?s.indexOf(s[0]):0,w=m.length?+m[m.length-1].getAttribute("data-rowindex"):0,C=!(!this.parent.enableVirtualization||0===e.index)||this.selectedIndex>=v&&this.selectedIndex<=w;if(s.length&&(p=s[this.addRowIndex][this.parent.idMapping],g=s[this.addRowIndex][this.parent.parentIdMapping],s[this.addRowIndex].parentItem&&(h=s[this.addRowIndex].parentItem.uniqueID),u=s[this.addRowIndex].parentItem),"Top"!==this.parent.editSettings.newRowPosition&&s.length){if(l=s[this.addRowIndex].level,"Above"===this.parent.editSettings.newRowPosition)a="before",d=s[this.addRowIndex].index;else if("Below"===this.parent.editSettings.newRowPosition){a="after";var x=c(s[this.addRowIndex]).length,b=s[this.addRowIndex].index;d=x>0?b+x:b}else if("Child"===this.parent.editSettings.newRowPosition){a="after",(this.selectedIndex>-1||f)&&C&&(r.parentItem=t.extend({},s[this.addRowIndex]),r.parentUniqueID=r.parentItem.uniqueID,delete r.parentItem.childRecords,delete r.parentItem[this.parent.childMapping]);var S=c(s[this.addRowIndex]).length,I=s[this.addRowIndex].index;this.selectedIndex>=0&&(r.level=l+1),d=S>0?I+S:I,this.isSelfReference&&(this.parent.isLocalData||-1!==this.parent.editModule.selectedIndex?r.taskData[this.parent.parentIdMapping]=r[this.parent.parentIdMapping]=p:r.taskData[this.parent.parentIdMapping]=r[this.parent.parentIdMapping]=null,t.isNullOrUndefined(r.parentItem)||R(o,r.parentItem,"add",this.parent,this.isSelfReference,r))}if("Above"!==this.parent.editSettings.newRowPosition&&"Below"!==this.parent.editSettings.newRowPosition||((this.selectedIndex>-1||f)&&l&&C&&(r.parentUniqueID=h,r.parentItem=t.extend({},u),delete r.parentItem.childRecords,delete r.parentItem[this.parent.childMapping]),r.level=l,this.isSelfReference&&(r.taskData[this.parent.parentIdMapping]=r[this.parent.parentIdMapping]=g,t.isNullOrUndefined(r.parentItem)||R(o,r.parentItem,"add",this.parent,this.isSelfReference,r))),null!=a&&(this.selectedIndex>-1||f)&&C&&(e.index="before"===a?d:d+1),"Bottom"===this.parent.editSettings.newRowPosition){var D=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource;e.index=D.length}}t.isNullOrUndefined(r.level)&&(r.level=l),r.hasChildRecords=!1,r.childRecords=[],r.index=0}if("add"===e.action&&(this.internalProperties={level:r.level,parentItem:r.parentItem,uniqueID:r.uniqueID,taskData:r.taskData,parentUniqueID:t.isNullOrUndefined(r.parentItem)?void 0:r.parentItem.uniqueID,childRecords:r.childRecords}),"delete"===e.requestType)for(var M=e.data,O=0;O<M.length;O++)if(M[O].parentItem){u=y(this.parent,M[O].parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var P=u.childRecords.indexOf(M[O]);u.childRecords.splice(P,1)}}return e},e.prototype.addRecord=function(e,i,r){if(this.parent.editSettings.newRowPosition!==this.previousNewRowPosition&&null!==this.previousNewRowPosition||(this.previousNewRowPosition=this.parent.editSettings.newRowPosition),this.isSelfReference||t.isNullOrUndefined(e)||!Object.hasOwnProperty.call(e,this.parent.childMapping))e?(i>-1?(this.selectedIndex=i,this.addRowIndex=i):(this.selectedIndex=this.parent.selectedRowIndex,this.addRowIndex=this.parent.selectedRowIndex),r&&this.parent.setProperties({editSettings:{newRowPosition:r}},!0),this.parent.grid.editModule.addRecord(e,i)):this.parent.grid.editModule.addRecord(e,i);else{var n=[],o=this.parent.editSettings.mode,a=this.parent.grid.editSettings.mode;n.push(e),this.parent.setProperties({editSettings:{mode:"Batch"}},!0),this.parent.grid.setProperties({editSettings:{mode:"Batch"}},!0),t.isNullOrUndefined(r)||this.parent.setProperties({editSettings:{newRowPosition:r}},!0);var s={addedRecords:n,changedRecords:[],deletedRecords:[]};this.parent.notify(ge,{updatedRecords:s,index:i}),this.parent.setProperties({editSettings:{mode:o}},!0),this.parent.grid.setProperties({editSettings:{mode:a}},!0),this.parent.refresh()}},e.prototype.editFormValidate=function(){return this.parent.grid.editModule.editFormValidate()},e.prototype.destroyForm=function(){this.parent.grid.editModule.destroyForm()},e.prototype.contentready=function(e){t.isNullOrUndefined(e.args.requestType)||"delete"!==e.args.requestType.toString()&&"save"!==e.args.requestType.toString()&&("Batch"!==this.parent.editSettings.mode||"batchsave"!==e.args.requestType.toString())||(this.updateIndex(this.parent.grid.dataSource,this.parent.getRows(),this.parent.getCurrentViewRecords()),(this.parent.frozenRows||this.parent.getFrozenColumns()||this.parent.frozenColumns)&&this.parent.grid.dataSource.length===this.parent.getMovableDataRows().length&&this.updateIndex(this.parent.grid.dataSource,this.parent.getMovableDataRows(),this.parent.getCurrentViewRecords()))},e.prototype.editCell=function(e,t){"Cell"!==this.parent.editSettings.mode&&"Batch"!==this.parent.editSettings.mode||("Batch"!==this.parent.editSettings.mode&&(this.isOnBatch=!0,this.updateGridEditMode("Batch")),this.parent.grid.editModule.editCell(e,t))},e}(),Et=function(){function e(e){i.Grid.Inject(i.CommandColumn),this.parent=e}return e.prototype.getModuleName=function(){return"commandColumn"},e.prototype.destroy=function(){},e}(),At=function(){function e(e){i.Grid.Inject(i.DetailRow),this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"detailRow"},e.prototype.addEventListener=function(){this.parent.on("dataBoundArg",this.dataBoundArg,this),this.parent.on("detaildataBound",this.detaildataBound,this),this.parent.grid.on("detail-indentcell-info",this.setIndentVisibility,this),this.parent.on("childRowExpand",this.childRowExpand,this),this.parent.on("rowExpandCollapse",this.rowExpandCollapse,this),this.parent.on("actioncomplete",this.actioncomplete,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("dataBoundArg",this.dataBoundArg),this.parent.off("detaildataBound",this.detaildataBound),this.parent.off("childRowExpand",this.childRowExpand),this.parent.off("rowExpandCollapse",this.rowExpandCollapse),this.parent.off("actioncomplete",this.actioncomplete),this.parent.grid.off("detail-indentcell-info",this.setIndentVisibility))},e.prototype.setIndentVisibility=function(e){e.visible=!1},e.prototype.dataBoundArg=function(){for(var e=this.parent.getRows().filter(function(e){return!e.classList.contains("e-detailrow")}),r=0;r<e.length;r++){var n=e[r].getElementsByClassName("e-detailrowcollapse"),o=this.parent.grid.getRowObjectFromUID(e[r].getAttribute("data-Uid")),a=i.getObject("parentItem",this.parent.grid.getCurrentViewRecords()[r]);(t.isNullOrUndefined(a)||!t.isNullOrUndefined(a)&&h(this.parent,o.data,this.parent.grid.getCurrentViewRecords()))&&this.parent.grid.detailRowModule.expand(n[0])}},e.prototype.childRowExpand=function(e){var i=e.row.getElementsByClassName("e-detailrowcollapse");t.isNullOrUndefined(i[0])||this.parent.grid.detailRowModule.expand(i[0])},e.prototype.rowExpandCollapse=function(e){if(!a(this.parent))for(var t=0;t<e.detailrows.length;t++)e.detailrows[t].style.display=e.action},e.prototype.detaildataBound=function(e){var i=e.data,r=e.detailElement.parentElement.previousSibling,n="e-gridrowindex"+(t.isNullOrUndefined(i.parentItem)?i.index:i.parentItem.index)+"level"+i.level,o=r.querySelector("."+n).classList,a=[].slice.call(o).filter(function(e){return e===n}),s=a[0].length,d="e-griddetail"+a.toString().slice(6,s);t.addClass([e.detailElement.parentElement],d)},e.prototype.actioncomplete=function(e){if("beginEdit"===e.requestType||"add"===e.requestType){var t=e.row.querySelectorAll(".e-editcell")[0].getAttribute("colSpan"),r=(parseInt(t,10)-1).toString();e.row.querySelectorAll(".e-editcell")[0].setAttribute("colSpan",r)}for(var n=this.parent.grid.contentModule.getRows(),o=0;o<n.length;o++)n[o].cells[0].visible=!1;i.getObject("focusModule",this.parent.grid).refreshMatrix(!0)({rows:this.parent.grid.contentModule.getRows()})},e.prototype.destroy=function(){this.removeEventListener()},e}(),Nt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),kt=function(e){function r(t,i){var r=e.call(this,t,i)||this;return r.isExpandCollapse=!1,r.translateY=0,r.maxiPage=0,r.recordAdded=!1,r.startIndex=-1,r.endIndex=-1,r.preTranslate=0,r.isRemoteExpand=!1,r.isDataSourceChanged=!1,r.addEventListener(),r}return Nt(r,e),r.prototype.getModelGenerator=function(){return new vt(this.parent)},r.prototype.getRowByIndex=function(e){return this.parent.getDataRows().filter(function(t){return parseInt(t.getAttribute("data-rowindex"),10)===e})[0]},r.prototype.getMovableVirtualRowByIndex=function(e){return this.getRowCollection(e,!0)},r.prototype.getFrozenRightVirtualRowByIndex=function(e){return this.getRowCollection(e,!1,!1,!0)},r.prototype.getRowCollection=function(e,t,i,r){var n=parseInt(this.parent.getRows()[0].getAttribute(Ne),10),o=t?this.parent.getMovableDataRows():this.parent.getDataRows();o=r?this.parent.getFrozenRightDataRows():o;var a=(i?this.parent.getCurrentViewRecords():o)[e-n];return this.parent.frozenRows&&this.parent.pageSettings.currentPage>1&&(a=i?e<=this.parent.frozenRows?this.parent.getRowsObject()[e].data:a:e<=this.parent.frozenRows?o[e]:o[e-n+this.parent.frozenRows]),a},r.prototype.addEventListener=function(){this.parent.on(me,this.virtualOtherAction,this),this.parent.on(we,this.indexModifier,this)},r.prototype.virtualOtherAction=function(e){e.setTop?(this.translateY=0,this.startIndex=0,this.endIndex=this.parent.pageSettings.pageSize-1):e.isExpandCollapse&&(this.isExpandCollapse=!0)},r.prototype.indexModifier=function(e){var t=this.parent.getContent().querySelector(".e-content");if(this.recordAdded&&this.startIndex>-1&&this.endIndex>-1){if(this.endIndex>e.count-this.parent.pageSettings.pageSize){var i=~~(t.scrollTop/this.parent.getRowHeight()),r=i+this.parent.getRows().length;r>e.count&&(r=i+(e.count-i)),this.startIndex=r-this.parent.getRows().length,this.endIndex=r}else("Top"!==this.parent.root.editSettings.newRowPosition&&-1!==this.parent.root.editModule.selectedIndex||-1!==this.parent.root.editModule.selectedIndex)&&(this.startIndex+=1,this.endIndex+=1);this.recordAdded=!1}this.isDataSourceChanged&&(this.startIndex=0,this.endIndex=this.parent.pageSettings.pageSize-1),e.startIndex=this.startIndex,e.endIndex=this.endIndex},r.prototype.eventListener=function(t){var i=this;this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url&&s(this.parent)?e.prototype.eventListener.call(this,"on"):(this.parent[t]("data-ready",this.onDataReady,this),this.parent[t]("refresh-virtual-block",this.refreshContentRows,this),this.fn=function(){i.observers.observes(function(e){return i.scrollListeners(e)},i.onEnteredAction(),i.parent),i.parent.off("content-ready",i.fn)},this.parent.addEventListener("dataBound",this.dataBoundEvent.bind(this)),this.parent.addEventListener("rowSelected",this.rowSelectedEvent.bind(this)),this.parent[t]("select-virtual-Row",this.toSelectVirtualRow,this),this.parent.on("content-ready",this.fn,this),this.parent.addEventListener(F,this.onActionComplete.bind(this)),this.parent[t]("virtual-scroll-edit-action-begin",this.beginEdit,this),this.parent[t]("virtual-scroll-add-action-begin",this.beginAdd,this),this.parent[t]("virtual-scroll-edit-success",this.virtualEditSuccess,this),this.parent[t]("edit-reset",this.resetIseditValue,this),this.parent[t]("get-virtual-data",this.getData,this),this.parent[t]("virtual-scroll-edit-cancel",this.cancelEdit,this),this.parent[t]("select-row-on-context-open",this.toSelectRowOnContextOpen,this),this.parent[t]("refresh-virtual-editform-cells",this.refreshCell,this),this.parent[t]("virtaul-cell-focus",this.cellFocus,this))},r.prototype.cellFocus=function(t){e.prototype.virtualCellFocus.call(this,t)},r.prototype.onDataReady=function(i){if(e.prototype.onDataReady.call(this,i),!(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url&&s(this.parent))){if(!t.isNullOrUndefined(i.count)){if(this.totalRecords=i.count,this.parent.isFrozenGrid()&&i.count<Object.keys(this.parent.dataSource).length){var r=this.parent.enableColumnVirtualization?this.getColumnOffset(this.parent.columns.length-1)+"px":"100%",o=this.parent.getRowHeight()*i.count-this.parent.getRowHeight()*this.parent.pageSettings.pageSize;t.getValue("virtualEle",this).setVirtualHeight(o,r)}this.parent.enableColumnVirtualization||this.parent.isFrozenGrid()||t.getValue("virtualEle",this).setVirtualHeight(this.parent.getRowHeight()*i.count,"100%")}(!t.isNullOrUndefined(i.requestType)&&"collapseAll"===i.requestType.toString()||this.isDataSourceChanged&&(-1===this.startIndex||0===this.startIndex&&0===this.preStartIndex))&&(this.contents.scrollTop=0,this.isDataSourceChanged=!1)}},r.prototype.renderTable=function(){e.prototype.renderTable.call(this),this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url&&s(this.parent)||(t.getValue("observer",this).options.debounceEvent=!1,this.observers=new Ut(t.getValue("observer",this).element,t.getValue("observer",this).options),this.contents=this.getPanel().firstChild)},r.prototype.getTranslateY=function(t,i,r,o){return this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)?this.isRemoteExpand?(this.isRemoteExpand=!1,this.preTranslate):(this.preTranslate=e.prototype.getTranslateY.call(this,t,i,r,o),e.prototype.getTranslateY.call(this,t,i,r,o)):e.prototype.getTranslateY.call(this,t,i,r,o)},r.prototype.dataBoundEvent=function(){var i="initialRowTop";if(this.parent.getRows().length&&!this[i]&&!t.isNullOrUndefined(this.parent.getRowByIndex(0))){var r=this.parent.getRowByIndex(0).getBoundingClientRect().top,n=this.parent.element.getBoundingClientRect().top;this[i]=r>0?this.parent.getRowByIndex(0).getBoundingClientRect().top-n:this.content.getBoundingClientRect().top-this.parent.getRowByIndex(0).getBoundingClientRect().height}e.prototype.dataBound.call(this)},r.prototype.rowSelectedEvent=function(t){e.prototype.rowSelected.call(this,t)},r.prototype.toSelectVirtualRow=function(i){if(!this.parent.isEdit){var r="containerRect";t.isNullOrUndefined(this.observer[r])&&(this.observer[r]=this.observers[r]),(t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule)||0!==i.selectedIndex||t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule.addRowIndex))&&e.prototype.selectVirtualRow.call(this,i)}},r.prototype.refreshCell=function(e){e.cells=this.generateCells()},r.prototype.generateCells=function(){for(var e=[],t=0;t<this.parent.columns.length;t++)e.push(this.generateCell(this.parent.columns[t]));return e},r.prototype.generateCell=function(e,r,n,o,a,s){var d={visible:e.visible,isDataCell:!t.isNullOrUndefined(e.field||e.template),isTemplate:!t.isNullOrUndefined(e.template),rowID:r,column:e,cellType:t.isNullOrUndefined(n)?i.CellType.Data:n,colSpan:o,commands:e.commands,isForeignKey:e.isForeignColumn&&e.isForeignColumn(),foreignKeyData:e.isForeignColumn&&e.isForeignColumn()&&t.getValue(e.field,s)};return(d.isDataCell||"checkbox"===d.column.type||d.commands)&&(d.index=a),new i.Cell(d)},r.prototype.beginEdit=function(e){this.editedRowIndex=e.index;var t='.e-row[data-rowindex="'+e.index+'"]',i=this.parent.getContent().querySelector(t).rowIndex,r=this.parent.getCurrentViewRecords()[i];e.data=r},r.prototype.beginAdd=function(t){var i={newRowPosition:this.rowPosition,addRowIndex:this.addRowIndex,dataRowIndex:this.dataRowIndex};this.parent.notify("get-row-position",i),this.rowPosition=i.newRowPosition,this.addRowIndex=i.addRowIndex,this.dataRowIndex=i.dataRowIndex;var r=this.parent.getRows(),n=r.length?+r[0].getAttribute("data-rowindex"):0,o=r.length?+r[r.length-1].getAttribute("data-rowindex"):0,a=this.parent.selectedRowIndex>=n&&this.parent.selectedRowIndex<=o;"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition&&(this.isAdd=!0),"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition&&(this.addRowIndex&&-1!==this.addRowIndex||-1!==this.parent.selectedRowIndex&&a)||e.prototype.addActionBegin.call(this,t)},r.prototype.restoreEditState=function(){e.prototype.restoreEdit.call(this)},r.prototype.resetIseditValue=function(){this.parent.notify("reset-edit-props",{}),"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition||!this.isAdd||e.prototype.resetIsedit.call(this)},r.prototype.virtualEditSuccess=function(){var e=this.parent.getContent().querySelector(".e-content");this.isAdd&&e.querySelector(".e-addedrow")&&(this.recordAdded=!0)},r.prototype.cancelEdit=function(t){e.prototype.editCancel.call(this,t)},r.prototype.toSelectRowOnContextOpen=function(t){e.prototype.selectRowOnContextOpen.call(this,t)},r.prototype.restoreNewRow=function(){var e=this.parent.getContent().querySelector(".e-content");this.isAdd&&!e.querySelector(".e-addedrow")&&(this.parent.isEdit=!1,this.parent.editModule.addRecord(null,this.parent.root.editModule.selectedIndex))},r.prototype.getData=function(t){e.prototype.getVirtualData.call(this,t)},r.prototype.onActionComplete=function(t){if("add"===t.requestType){var i={newRowPosition:this.rowPosition,addRowIndex:this.addRowIndex,dataRowIndex:this.dataRowIndex};this.parent.notify("get-row-position",i),this.rowPosition=i.newRowPosition,this.addRowIndex=i.addRowIndex,this.dataRowIndex=this.parent.root.editModule.selectedIndex}e.prototype.actionComplete.call(this,t)},r.prototype.onEnteredAction=function(){var e=this;return function(i,r,n,o,a,s){if(!e.parent.directVirtualRender){t.Browser.isIE&&!a&&s&&!e.preventEvent&&e.parent.showSpinner();var d="X"===r.axis,l=e.getColumnOffset(d?e.vgenerator.getColumnIndexes()[0]-1:e.prevInfo.columnIndexes[0]-1);if(d){var p=Object.keys(e.vgenerator.cOffsets).length-e.prevInfo.columnIndexes.length,h=e.vgenerator.cOffsets[p-1];l=l>h?h:l}e.parent.isFrozenGrid()||(e.virtualEle.adjustTable(l,e.translateY),e.parent.enableColumnVirtualization&&e.header.virtualEle.adjustTable(l,0))}}},r.prototype.scrollListeners=function(e){this.scrollAfterEdit();var i=e.sentinel,r=this.parent.pageSettings.pageSize-Math.ceil(this.parent.pageSettings.pageSize/2),o=this.parent.getContent().querySelector(".e-content"),a=r*this.parent.getRowHeight(),d=e.offset.top-this.translateY<0,l=Math.ceil(e.offset.top-this.translateY)>=a,p="selectedRowIndex",h=this.parent.currentViewData;if(d&&"right"!==e.direction&&"left"!==e.direction){var c=+(this.parent.height.toString().indexOf("%")<0?this.parent.height:this.parent.element.getBoundingClientRect().height),u=~~(o.scrollTop/this.parent.getRowHeight())+Math.ceil(c/this.parent.getRowHeight())-this.parent.pageSettings.pageSize;if(u=u>0?u:0,t.isNullOrUndefined(this[p])||-1===this[p]||u===this[p]||(u=this[p]),this.startIndex=u,this.endIndex=u+this.parent.pageSettings.pageSize,this.endIndex>this.totalRecords){var g=this.totalRecords-1,f=this.endIndex%g;this.endIndex=g,this.startIndex=this.startIndex-f<0?0:this.startIndex-f}h.length&&h[0].index>=this.parent.pageSettings.pageSize/2&&h[0].index-this.startIndex<this.parent.pageSettings.pageSize/2&&(this.startIndex=h[0].index-this.parent.pageSettings.pageSize/2,this.endIndex=this.startIndex+this.parent.pageSettings.pageSize);var y=Math.ceil(e.offset.top/this.parent.getRowHeight());y%=this.parent.pageSettings.pageSize;var m=0;if(!t.isNullOrUndefined(this.parent.getRows()[y])&&!t.isNullOrUndefined(this.parent.getContent().querySelectorAll(".e-content tr")[y])){m=+this.parent.getContent().querySelectorAll(".e-content tr")[y].querySelector("td").getAttribute("index")}if(0===m)this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*this.parent.getRowHeight():this.translateY=e.offset.top;else{var v=this.parent.getRowHeight();this.translateY=e.offset.top-r*v>0?e.offset.top-r*v+10:0}}else if(l&&"right"!==e.direction&&"left"!==e.direction){var w=~~(o.scrollTop/this.parent.getRowHeight()),R=!(this[p]+this.parent.pageSettings.pageSize<this.totalRecords);t.isNullOrUndefined(this[p])||-1===this[p]||w===this[p]||R||(w=this[p]);var C=w+this.parent.pageSettings.pageSize;C>this.totalRecords&&(C=w+(this.totalRecords-w)),this.startIndex=R?w:C-this.parent.pageSettings.pageSize,this.endIndex=C,h.length&&this.startIndex>h[0].index&&this.startIndex-h[0].index<this.parent.pageSettings.pageSize/2&&(this.startIndex=h[0].index+this.parent.pageSettings.pageSize/2),e.offset.top>this.parent.getRowHeight()*this.totalRecords?this.translateY=this.getTranslateY(e.offset.top,o.getBoundingClientRect().height):this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*this.parent.getRowHeight():this.translateY=e.offset.top}if(l&&e.offset.top<this.parent.getRowHeight()*this.totalRecords||d||"right"===e.direction||"left"===e.direction||this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)){var x=this.currentInfo=t.getValue("getInfoFromView",this).apply(this,[e.direction,i,e.offset]);this.previousInfo=x,this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization?x.columnIndexes:[]);var b=x.loadNext&&!x.loadSelf?x.nextInfo.page:x.page;this.parent.setProperties({pageSettings:{currentPage:b}},!0),this.requestType="virtualscroll","right"!==e.direction&&"left"!==e.direction&&(x.event="refresh-virtual-block"===x.event?"model-changed":x.event),this.parent.notify(x.event,{requestType:"virtualscroll",virtualInfo:x,focusElement:e.focusElement})}},r.prototype.appendContent=function(i,r,o){var a=this.parent.isFrozenGrid();if(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)||this.parent.isFrozenGrid())t.getValue("isExpandCollapse",o)&&(this.isRemoteExpand=!0),a&&t.isNullOrUndefined(this.requestType)&&-1===t.getValue("requestTypes",this).indexOf("isFrozen")&&(t.getValue("requestTypes",this).push("isFrozen"),this.requestType="isFrozen"),e.prototype.appendContent.call(this,i,r,o),-1!==t.getValue("requestTypes",this).indexOf("isFrozen")&&(t.getValue("requestTypes",this).splice(t.getValue("requestTypes",this).indexOf("isFrozen"),1),this.requestType="isFrozen"===this.requestType?void 0:this.requestType),!a||this.isExpandCollapse&&0!==this.translateY?this.isExpandCollapse=!1:(this.translateY=this.translateY<0?0:this.translateY,t.getValue("virtualEle",this).adjustTable(0,this.translateY));else{var d=o.virtualInfo.sentinelInfo&&"Y"===o.virtualInfo.sentinelInfo.axis&&t.getValue("currentInfo",this).page&&t.getValue("currentInfo",this).page!==o.virtualInfo.page?t.getValue("currentInfo",this):o.virtualInfo,l=d.columnIndexes[0]-1,p=this.getColumnOffset(l),h=void 0;if(this.parent.enableColumnVirtualization){this.header.virtualEle.adjustTable(p,0);var c=d.columnIndexes;h=this.getColumnOffset(c[c.length-1])-this.getColumnOffset(c[0]-1)+"",this.header.virtualEle.setWrapperWidth(h)}this.virtualEle.setWrapperWidth(h,t.Browser.isIE||"edge"===t.Browser.info.name),(i=this.parent.createElement("tbody")).appendChild(r);this.getTable().querySelector("tbody").replaceWith(i),this.isExpandCollapse&&0!==this.translateY?this.isExpandCollapse=!1:(this.translateY=this.translateY<0?0:this.translateY,t.getValue("virtualEle",this).adjustTable(p,this.translateY)),t.setValue("prevInfo",this.previousInfo?this.previousInfo:d,this),"virtualscroll"===o.requestType&&"X"===o.virtualInfo.sentinelInfo.axis&&this.parent.notify("auto-col",{});e.prototype.focusCell.call(this,o);this.isAdd&&!this.parent.getContent().querySelector(".e-content").querySelector(".e-addedrow")&&"Top"!==this.rowPosition&&"Bottom"!==this.rowPosition&&(this.dataRowIndex>=this.startIndex?this.restoreNewRow():this.addRowIndex&&this.addRowIndex>-1&&(this.isAdd=!1,this.parent.isEdit=!1)),this.restoreEditState(),e.prototype.restoreAdd.call(this),e.prototype.ensureSelectedRowPosition.call(this)}},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("data-ready",this.onDataReady),this.parent.off("content-ready",this.fn),this.parent.off("select-virtual-Row",this.toSelectVirtualRow),this.parent.off("dataBound",this.dataBoundEvent),this.parent.off("rowSelected",this.rowSelectedEvent),this.parent.off(me,this.virtualOtherAction),this.parent.off(we,this.indexModifier),this.parent.off("virtual-scroll-edit-action-begin",this.beginEdit),this.parent.off("virtual-scroll-add-action-begin",this.beginAdd),this.parent.off("virtual-scroll-edit-success",this.virtualEditSuccess),this.parent.off("edit-reset",this.resetIseditValue),this.parent.off("get-virtual-data",this.getData),this.parent.off("virtual-scroll-edit-cancel",this.cancelEdit),this.parent.off("select-row-on-context-open",this.toSelectRowOnContextOpen),this.parent.off("refresh-virtual-editform-cells",this.refreshCell),this.parent.off("virtaul-cell-focus",this.cellFocus))},r}(i.VirtualContentRenderer),Ut=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.isWheeling=!1,t.newPos=0,t.lastPos=0,t.timer=0,t}return Nt(i,e),i.prototype.observes=function(i,r,n){if(e.prototype.containerRect=t.getValue("options",this).container.getBoundingClientRect(),t.EventHandler.add(t.getValue("options",this).container,"scroll",this.virtualScrollHandlers(i,r,n),this),t.getValue("options",this).movableContainer){e.prototype.movableContainerRect=t.getValue("options",this).movableContainer.getBoundingClientRect(),t.EventHandler.add(t.getValue("options",this).movableContainer,"scroll",this.virtualScrollHandlers(i,r,n),this)}},i.prototype.clear=function(){this.lastPos=null},i.prototype.virtualScrollHandlers=function(e,i,r){var o=this,a="options",d=t.debounce(e,50);return this[a].prevTop=this[a].prevLeft=0,function(t){var l=o[a].movableContainer?o[a].container.scrollTop:t.target.scrollTop,p=o[a].movableContainer?o[a].scrollbar.scrollLeft:t.target.scrollLeft,h=o[a].prevTop<l?"down":"up";h=o[a].prevLeft===p?h:o[a].prevLeft<p?"right":"left",o[a].prevTop=l,o[a].prevLeft=p;var c=o.sentinelInfo[h],u=0;if(o.newPos=l,null!=o.lastPos&&(u=o.newPos-o.lastPos),o.lastPos=o.newPos,o.timer&&clearTimeout(o.timer),o.timer=setTimeout(o.clear,0),(u>100||u<-100)&&t&&t.preventDefault&&(t.returnValue=!1,t.preventDefault()),-1!==o[a].axes.indexOf(c.axis)){var g=o.check(h);if(c.entered&&"X"===c.axis&&(!o.movableEle||"right"!==h&&"left"!==h?i(o.element,c,h,{top:l,left:p},o.fromWheel,g):i(o.movableEle,c,h,{top:l,left:p},o.fromWheel,g)),g){var f=d;"X"===c.axis?f({direction:h,sentinel:c,offset:{top:l,left:p},focusElement:document.activeElement}):r.dataSource instanceof n.DataManager&&void 0!==r.dataSource.dataSource.url&&!r.dataSource.dataSource.offline&&""!==r.dataSource.dataSource.url||s(r)?f({direction:h,sentinel:c,offset:{top:l,left:p},focusElement:document.activeElement}):e({direction:h,sentinel:c,offset:{top:l,left:p},focusElement:document.activeElement})}o.fromWheel=!1}}},i}(i.InterSectionObserver),qt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Vt=function(){function e(e){this.prevstartIndex=-1,this.prevendIndex=-1,this.parent=e,i.Grid.Inject(Bt),this.addEventListener()}return e.prototype.returnVisualData=function(e){e.data=this.visualData},e.prototype.getModuleName=function(){return"virtualScroll"},e.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on(J,this.collapseExpandVirtualchilds,this),this.parent.on(X,this.virtualPageAction,this),this.parent.on("destroy",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(J,this.collapseExpandVirtualchilds),this.parent.off(X,this.virtualPageAction),this.parent.off("destroy",this.destroy))},e.prototype.collapseExpandVirtualchilds=function(e){this.parent.grid.notify(me,{isExpandCollapse:!0}),this.expandCollapseRec=e.record,e.record.expanded="collapse"!==e.action;var i={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length};(this.parent.enableVirtualization&&"Cell"===this.parent.selectionSettings.mode||"Row"===this.parent.selectionSettings.mode&&!this.parent.selectionSettings.persistSelection)&&this.parent.grid.clearSelection();var r=t.getValue("isCollapseAll",this.parent)?"collapseAll":"refresh";t.getValue("grid.renderModule",this.parent).dataManagerSuccess(i,{requestType:r})},e.prototype.virtualPageAction=function(e){var i=this,r=new n.DataManager(e.result),o=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),a=r.executeLocal((new n.Query).where(o)),s=a.filter(function(e){return h(i.parent,e,a)});this.visualData=s,this.parent.grid.notify(ve,{data:s});var d={startIndex:-1,endIndex:-1,count:e.count};this.parent.grid.notify(we,d);var l=d.startIndex,p=d.endIndex;if(e.count=s.length,-1===l&&-1===p){var c=new n.Query,u=this.parent.grid.pageSettings.pageSize,g=u*(this.parent.grid.pageSettings.currentPage-1);c=c.skip(g).take(u),r.dataSource.json=s,e.result=r.executeLocal(c)}else{var f=e.actionArgs.requestType;if(("filtering"===f||"collapseAll"===f||"searching"===f||"refresh"===f&&this.parent.enableCollapseAll&&p>s.length)&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.getContent().firstElementChild.scrollTop=0,this.parent.grid.notify(me,{setTop:!0})),!t.isNullOrUndefined(this.expandCollapseRec)&&("virtualscroll"===e.actionArgs.requestType||"refresh"===e.actionArgs.requestType&&l!==this.prevstartIndex)&&l<this.parent.getRows().length&&p<=l+this.parent.getRows().length&&(l=0),!t.isNullOrUndefined(this.expandCollapseRec)){var y=this.parent.getRows(),m=s.indexOf(this.expandCollapseRec);s.slice(m,m+y.length).length<y.length&&m>=0&&0!==l?(l=m=(m=s.length-y.length)>0?m:0,p=s.length):t.getValue("isCollapseAll",this.parent)&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify(me,{setTop:!0}))}!this.parent.enableCollapseAll&&!this.parent.expandStateMapping||t.isNullOrUndefined(this.expandCollapseRec)||(e.count<this.parent.getRows()[0].getBoundingClientRect().height?l=0:this.parent.isExpandAll||(l=-1===this.prevstartIndex?0:this.prevstartIndex)),this.expandCollapseRec=null,l=l<0?0:l,e.result=s.slice(l,p),this.prevstartIndex=l,this.prevendIndex=p}this.parent.notify("updateAction",e)},e.prototype.destroy=function(){this.removeEventListener()},e}(),Bt=function(e){function r(i,r){var n=e.call(this,i,r)||this;return t.getValue("parent",n).off("initial-load",t.getValue("instantiateRenderer",n),n),t.getValue("parent",n).on("initial-load",n.instantiateRenderers,n),n}return qt(r,e),r.prototype.getModuleName=function(){return"treeVirtualScroll"},r.prototype.instantiateRenderers=function(){var e=t.getValue("parent",this);t.getValue("parent",this).log(["limitation","virtual_height"],"virtualization");var r=t.getValue("locator",this).getService("rendererFactory");e.isFrozenGrid()||(e.enableColumnVirtualization&&t.getValue("addRenderer",r).apply(r,[i.RenderType.Header,new i.VirtualHeaderRenderer(t.getValue("parent",this),t.getValue("locator",this))]),t.getValue("addRenderer",r).apply(r,[i.RenderType.Content,new kt(t.getValue("parent",this),t.getValue("locator",this))])),this.ensurePageSize()},r.prototype.ensurePageSize=function(){var e=t.getValue("parent",this),i=e.getRowHeight();t.isNullOrUndefined(e.height)||"string"!=typeof e.height||-1===e.height.indexOf("%")||(e.element.style.height=e.height);var r=2*~~((e.height.toString().indexOf("%")<0?e.height:e.element.getBoundingClientRect().height)/i),n=e.pageSettings.pageSize;e.setProperties({pageSettings:{pageSize:n<r?r:n}},!0)},r}(i.VirtualScroll),Tt=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Lt=function(e){function r(t,i){var r=e.call(this,t,i)||this;return r.addEventListener(),r}return Tt(r,e),r.prototype.renderTable=function(){this.freezeRowGenerator=new i.FreezeRowModelGenerator(this.parent),this.virtualRenderer=new kt(this.parent,this.serviceLoc),this.virtualRenderer.header=this.serviceLoc.getService("rendererFactory").getRenderer(i.RenderType.Header).virtualHdrRenderer,i.FreezeContentRender.prototype.renderTable.call(this),this.virtualRenderer.setPanel(this.parent.getContent()),this.scrollbar=this.parent.getContent().querySelector(".e-movablescrollbar");var e=this.getMovableContent(),t=this.parent.height;if(this.virtualRenderer.virtualEle.content=this.virtualRenderer.content=this.getPanel().querySelector("."+Ae),this.virtualRenderer.virtualEle.content.style.overflowX="hidden",this.virtualRenderer.virtualEle.renderFrozenWrapper(t),this.virtualRenderer.virtualEle.renderFrozenPlaceHolder(),this.parent.enableColumnVirtualization){this.virtualRenderer.virtualEle.movableContent=this.virtualRenderer.movableContent=this.getPanel().querySelector("."+Pe),this.virtualRenderer.virtualEle.renderMovableWrapper(t),this.virtualRenderer.virtualEle.renderMovablePlaceHolder();var r=e.querySelector("table");this.virtualRenderer.virtualEle.movableTable=r,this.virtualRenderer.virtualEle.movableWrapper.appendChild(r),e.appendChild(this.virtualRenderer.virtualEle.movableWrapper),e.appendChild(this.virtualRenderer.virtualEle.movablePlaceholder)}this.virtualRenderer.virtualEle.wrapper.appendChild(this.getFrozenContent()),this.virtualRenderer.virtualEle.wrapper.appendChild(e),this.virtualRenderer.virtualEle.table=this.getTable(),i.setDebounce(this.parent,this.virtualRenderer,this.scrollbar,this.getMovableContent())},r.prototype.appendContent=function(i,r,n){t.getValue("observer",this.virtualRenderer).options.debounceEvent=!1,this.virtualRenderer.observers=new Ut(t.getValue("observer",this.virtualRenderer).element,t.getValue("observer",this.virtualRenderer).options,t.getValue("observer",this.virtualRenderer).movableEle),this.virtualRenderer.contents=this.getPanel().firstChild,e.prototype.appendContent.call(this,i,r,n)},r.prototype.generateRows=function(t,i){return e.prototype.generateRows.call(this,t,i)},r}(i.VirtualFreezeRenderer),Ft=function(e){function r(t,i){var r=e.call(this,t,i)||this;return r.serviceLoc=i,r.eventListener("on"),r}return Tt(r,e),r.prototype.renderTable=function(){this.virtualRenderer=new kt(this.parent,this.serviceLoc),this.virtualRenderer.header=this.serviceLoc.getService("rendererFactory").getRenderer(i.RenderType.Header).virtualHdrRenderer,this.freezeRowGenerator=new i.FreezeRowModelGenerator(this.parent),i.ColumnFreezeContentRenderer.prototype.renderTable.call(this),this.virtualRenderer.setPanel(this.parent.getContent()),this.scrollbar=this.parent.getContent().querySelector(".e-movablescrollbar");var t=this.getFrozenRightContent(),r=this.getFrozenContent(),n=this.getMovableContent();"Right"===this.parent.getFrozenMode()&&(r=t),this.virtualRenderer.virtualEle.content=this.virtualRenderer.content=this.getPanel().querySelector("."+Ae),this.virtualRenderer.virtualEle.content.style.overflowX="hidden";var o=this.parent.height;this.virtualRenderer.virtualEle.renderFrozenWrapper(o),this.virtualRenderer.virtualEle.renderFrozenPlaceHolder(),e.prototype.renderVirtualFrozenLeft.call(this,r,n),e.prototype.renderVirtualFrozenRight.call(this,r,n),e.prototype.renderVirtualFrozenLeftRight.call(this,r,n,t),this.virtualRenderer.virtualEle.table=this.getTable(),i.setDebounce(this.parent,this.virtualRenderer,this.scrollbar,this.getMovableContent())},r.prototype.appendContent=function(i,r,n){t.getValue("observer",this.virtualRenderer).options.debounceEvent=!1,this.virtualRenderer.observers=new Ut(t.getValue("observer",this.virtualRenderer).element,t.getValue("observer",this.virtualRenderer).options,t.getValue("observer",this.virtualRenderer).movableEle),this.virtualRenderer.contents=this.getPanel().firstChild,e.prototype.appendContent.call(this,i,r,n)},r}(i.ColumnVirtualFreezeRenderer),zt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Tt(t,e),t.prototype.renderTable=function(){e.prototype.renderTable.call(this)},t.prototype.rfshMovable=function(){e.prototype.rfshMovable.call(this)},t}(i.VirtualFreezeHdrRenderer),jt=function(){function e(e){i.Grid.Inject(i.Freeze),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("rowExpandCollapse",this.rowExpandCollapse,this),this.parent.on("dataBoundArg",this.dataBoundArg,this),this.parent.grid.on("dblclick",this.dblClickHandler,this),this.parent.grid.on("initial-load",this.instantiateRenderer,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("rowExpandCollapse",this.rowExpandCollapse),this.parent.off("dataBoundArg",this.dataBoundArg),this.parent.grid.off("dblclick",this.dblClickHandler),this.parent.grid.off("initial-load",this.instantiateRenderer))},e.prototype.instantiateRenderer=function(){var e=t.getValue("serviceLocator",this.parent.grid).getService("rendererFactory");this.parent.getFrozenColumns()&&(this.parent.enableColumnVirtualization?t.getValue("addRenderer",e).apply(e,[i.RenderType.Header,new zt(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]):t.getValue("addRenderer",e).apply(e,[i.RenderType.Header,new i.FreezeRender(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]),this.parent.enableVirtualization?t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new Lt(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]):t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new i.FreezeContentRender(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))])),(this.parent.getFrozenLeftColumnsCount()||this.parent.getFrozenRightColumnsCount())&&(t.getValue("addRenderer",e).apply(e,[i.RenderType.Header,new i.ColumnFreezeHeaderRenderer(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]),this.parent.enableVirtualization?t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new Ft(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]):t.getValue("addRenderer",e).apply(e,[i.RenderType.Content,new i.ColumnFreezeContentRenderer(t.getValue("grid",this.parent),t.getValue("serviceLocator",this.parent.grid))]))},e.prototype.rowExpandCollapse=function(e){var t,i,r=this.parent.getMovableDataRows(),n=this.parent.getRows(),o=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o&&(i=this.parent.getFrozenRightRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))})),t=e.detailrows.length?e.detailrows:r.filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))});for(var a=0;a<t.length;a++){var s=this.parent.grid.getRowObjectFromUID(t[a].getAttribute("data-Uid")).data;t[a].style.display=e.action,o&&(i[a].style.display=e.action);var d="none"===e.action?".e-treecolumn-container .e-treegridcollapse":".e-treecolumn-container .e-treegridexpand";if(n[t[a].rowIndex].querySelector(d)){for(var l=[],p=0;p<r.length;p++)r[p].querySelector(".e-gridrowindex"+s.index+"level"+(s.level+1))&&l.push(r[p]);l.length&&this.rowExpandCollapse({detailrows:l,action:e.action})}}},e.prototype.dblClickHandler=function(e){i.parentsUntil(e.target,"e-rowcell")&&this.parent.grid.editSettings.allowEditOnDblClick&&"Cell"!==this.parent.editSettings.mode&&!e.target.classList.contains("e-treegridcollapse")&&!e.target.classList.contains("e-treegridexpand")&&this.parent.grid.editModule.startEdit(i.parentsUntil(e.target,"e-row"))},e.prototype.dataBoundArg=function(){this.parent.getColumns().filter(function(e){return e.showCheckbox}).length&&this.parent.freezeModule&&this.parent.initialRender&&t.addClass([this.parent.element.getElementsByClassName("e-grid")[0]],"e-checkselection")},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.getModuleName=function(){return"freeze"},e}(),_t=function(){function e(e){i.Grid.Inject(i.ColumnChooser),this.parent=e}return e.prototype.openColumnChooser=function(e,t){return this.parent.grid.columnChooserModule.openColumnChooser(e,t)},e.prototype.destroy=function(){},e.prototype.getModuleName=function(){return"ColumnChooser"},e}(),Ht=function(){function e(e){this.parent=e,i.Grid.Inject(i.InfiniteScroll),this.addEventListener()}return e.prototype.getModuleName=function(){return"infiniteScroll"},e.prototype.addEventListener=function(){this.parent.on(X,this.infinitePageAction,this),this.parent.on("infinite-remote-expand",this.infiniteRemoteExpand,this),this.parent.grid.on("delete-complete",this.infiniteDeleteHandler,this),this.parent.grid.on("infinite-edit-handler",this.infiniteEditHandler,this),this.parent.grid.on("infinite-crud-cancel",this.createRows,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on(J,this.collapseExpandInfinitechilds,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("infinite-remote-expand",this.infiniteRemoteExpand),this.parent.grid.off("delete-complete",this.infiniteDeleteHandler),this.parent.grid.off("infinite-edit-handler",this.infiniteEditHandler),this.parent.off(X,this.infinitePageAction),this.parent.grid.off("infinite-crud-cancel",this.createRows),this.parent.grid.off("content-ready",this.contentready),this.parent.off(J,this.collapseExpandInfinitechilds))},e.prototype.infiniteRemoteExpand=function(e){for(var t=this.parent.grid.getRowsObject(),r=this.parent.grid.infiniteScrollModule.serviceLocator,n=new i.RowRenderer(r,null,this.parent.grid),o=this.parent.getRows(),a=e.index===o.length-1?"after":"before",s=this.parent.grid.getColumns(),d=this.parent.grid.infiniteScrollModule.generateRows(e.childData,e),l=[],p=0;p<d.length;p++)l.push(n.render(d[p],s));t.splice.apply(t,[e.index+1,0].concat(d));for(p=0;p<l.length;p++)"after"===a?o[e.index+p][a](l[p]):o[e.index+p+1][a](l[p]),o.splice(e.index+1+p,0,l[p]);i.resetRowIndex(this.parent.grid,this.parent.grid.getRowsObject(),this.parent.grid.getRows(),0)},e.prototype.contentready=function(){if(this.parent.infiniteScrollSettings.enableCache&&!t.isNullOrUndefined(this.parent.editModule)){this.parent.editModule.updateIndex(this.parent.grid.dataSource,this.parent.getRows(),this.parent.getCurrentViewRecords()),this.parent.getFrozenColumns()&&this.parent.editModule.updateIndex(this.parent.grid.dataSource,this.parent.getMovableDataRows(),this.parent.getCurrentViewRecords())}},e.prototype.collapseExpandInfinitechilds=function(e){e.record.expanded="collapse"!==e.action;var i={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length},r=t.getValue("isCollapseAll",this.parent)?"collapseAll":"refresh";t.getValue("grid.renderModule",this.parent).dataManagerSuccess(i,{requestType:r})},e.prototype.infinitePageAction=function(e){var i=this,r=new n.DataManager(e.result),o=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),a=r.executeLocal((new n.Query).where(o)),s=a.filter(function(e){return h(i.parent,e,a)}),d=t.getValue("actionArgs",e.actionArgs),l=t.getValue("actions",this.parent.grid.infiniteScrollModule);this.parent.grid.infiniteScrollModule.isInitialRender&&!this.parent.initialRender&&(this.parent.grid.pageSettings.currentPage=1);var p=!!l.some(function(e){return e===d.requestType})||!!this.parent.initialRender;if(this.visualData=s,e.count=s.length,t.getValue("isPrinting",e.actionArgs))e.result=s;else{var c=new n.Query,u=this.parent.infiniteScrollSettings.enableCache;u&&this.parent.infiniteScrollSettings.initialBlocks>this.parent.infiniteScrollSettings.maxBlocks&&(this.parent.infiniteScrollSettings.initialBlocks=this.parent.infiniteScrollSettings.maxBlocks);var g=p?this.parent.grid.pageSettings.pageSize*this.parent.infiniteScrollSettings.initialBlocks:this.parent.grid.pageSettings.pageSize,f=this.parent.grid.pageSettings.currentPage;if(t.isNullOrUndefined(d))c=c.page(f,g);else{var y=t.getValue("lastIndex",this.parent.grid.infiniteScrollModule),m=t.getValue("firstIndex",this.parent.grid.infiniteScrollModule);if(u||"delete"!==d.requestType)u&&"delete"===d.requestType||"save"===d.requestType&&"add"===d.action?c=(c=c.skip(m)).take(this.parent.infiniteScrollSettings.initialBlocks*this.parent.pageSettings.pageSize):("expand"!==e.actionArgs.action&&"collapse"!==e.actionArgs.action||1===this.parent.grid.pageSettings.currentPage||(f=1,g=this.parent.grid.pageSettings.pageSize*this.parent.grid.pageSettings.currentPage),c=c.page(f,g));else{var v=y-d.data.length+1,w=d.data.length;c=c.skip(v).take(w)}}r.dataSource.json=s,u||t.isNullOrUndefined(d)||"save"!==d.requestType||"add"!==d.action?e.result=r.executeLocal(c):e.result=[d.data]}this.parent.notify("updateAction",e)},e.prototype.infiniteEditHandler=function(e){var t=this.parent.grid.infiniteScrollModule.infiniteCurrentViewData,i=Object.keys(t);if("delete"===e.e.requestType&&e.result.length>1)for(var r=1;r<e.result.length;r++)t[i[i.length-1]].push(e.result[r])},e.prototype.infiniteDeleteHandler=function(e){if("delete"===e.requestType){var t=this.parent.grid.getRowsObject(),i=this.parent.getRows(),r=e.data instanceof Array?e.data:[e.data],n=this.parent.grid.getPrimaryKeyFieldNames()[0];if(this.removeRows(i,t,r,n,!0),this.parent.getFrozenColumns()>0){var o=this.parent.grid.getMovableRowsObject(),a=this.parent.grid.getMovableRows();this.removeRows(a,o,r,n)}}},e.prototype.removeRows=function(e,i,r,n,o){for(var a=this,s=function(s){i.filter(function(d,l){if(d.data[n]===r[s][n]){if(o){var p=Math.ceil((l+1)/a.parent.grid.pageSettings.pageSize);a.parent.grid.infiniteScrollModule.resetInfiniteCurrentViewData(p,l)}i.splice(l,1),t.remove(e[l]),e.splice(l,1)}})},d=0;d<r.length;d++)s(d)},e.prototype.createRows=function(e){var r,n=e.args.e,o=e.row,a=this.parent.grid.infiniteScrollModule.serviceLocator,s=new i.RowRenderer(a,null,this.parent.grid),d=this.parent.getCurrentViewRecords(),l=e.isMovable?this.parent.grid.getMovableRows():this.parent.grid.getDataRows();r=e.isFrozenRight?this.parent.element.querySelector(".e-frozen-right-content").querySelector("tbody"):this.parent.grid.isFrozenGrid()?e.isMovable?this.parent.grid.getMovableVirtualContent().querySelector("tbody"):this.parent.grid.getFrozenVirtualContent().querySelector("tbody"):this.parent.getContent().querySelector("tbody"),this.parent.frozenRows&&(r=e.isFrozenRows&&"add"!==this.parent.grid.infiniteScrollModule.requestType||!e.isFrozenRows&&"add"===this.parent.grid.infiniteScrollModule.requestType?this.parent.grid.isFrozenGrid()?e.isMovable?this.parent.grid.getMovableVirtualHeader().querySelector("tbody"):e.isFrozenRight?this.parent.element.querySelector(".e-frozen-right-header").querySelector("tbody"):this.parent.grid.getFrozenVirtualHeader().querySelector("tbody"):this.parent.getHeaderContent().querySelector("tbody"):r);for(var p,h=this.parent.editModule.addRowIndex,u=0;u<o.length;u++){var g=s.render(o[u],this.parent.grid.getColumns());"save"===n.requestType&&"add"===n.action?-1!==t.getValue("selectedIndex",this.parent.editModule)&&"Top"!==this.parent.editSettings.newRowPosition?"Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition?(p="after",h+=c(d[h]).length,"Child"===this.parent.editSettings.newRowPosition&&(h-=1),l[h][p](g)):"Above"===this.parent.editSettings.newRowPosition&&(p="before",l[this.parent.editModule.addRowIndex][p](g)):"Bottom"===this.parent.editSettings.newRowPosition?r.appendChild(g):r.insertBefore(g,r.firstElementChild):"delete"===n.requestType&&r.appendChild(g)}e.cancel=!0},e.prototype.destroy=function(){this.removeEventListener()},e}();e.TreeGrid=pt,e.load="load",e.rowDataBound=q,e.dataBound="dataBound",e.queryCellInfo=V,e.beforeDataBound=B,e.actionBegin=T,e.dataStateChange=L,e.actionComplete=F,e.rowSelecting="rowSelecting",e.rowSelected=z,e.checkboxChange=j,e.rowDeselected=_,e.toolbarClick=H,e.beforeExcelExport=G,e.beforePdfExport=Q,e.resizeStop="resizeStop",e.expanded=K,e.expanding="expanding",e.collapsed=W,e.collapsing="collapsing",e.remoteExpand=Y,e.localPagedExpandCollapse=J,e.pagingActions=X,e.printGridInit=$,e.contextMenuOpen=Z,e.contextMenuClick=ee,e.beforeCopy="beforeCopy",e.beforePaste="beforePaste",e.savePreviousRowPosition="savePreviousRowPosition",e.crudAction=te,e.beginEdit=ie,e.beginAdd=re,e.recordDoubleClick=ne,e.cellSave=oe,e.cellSaved=ae,e.cellEdit=se,e.batchDelete=de,e.batchCancel=le,e.batchAdd=pe,e.beforeBatchDelete=he,e.beforeBatchAdd=ce,e.beforeBatchSave=ue,e.batchSave=ge,e.keyPressed=fe,e.updateData="update-data",e.doubleTap=ye,e.virtualColumnIndex="virtualColumnIndex",e.virtualActionArgs=me,e.destroy="destroy",e.dataListener=ve,e.indexModifier=we,e.beforeStartEdit=Re,e.beforeBatchCancel=Ce,e.batchEditFormRendered="batcheditform-rendered",e.detailDataBound=xe,e.rowDrag="rowDrag",e.rowDragStartHelper=be,e.rowDrop="rowDrop",e.rowDragStart="rowDragStart",e.rowsAdd=Se,e.rowsRemove=Ie,e.rowdraging=De,e.rowDropped=Me,e.autoCol="auto-col",e.rowDeselecting=Oe,e.headerContent="e-headercontent",e.movableContent=Pe,e.movableHeader="e-movableheader",e.frozenContent=Ee,e.frozenHeader="e-frozenheader",e.content=Ae,e.table="e-table",e.leftRight="Left-Right",e.frozenRight="frozen-right",e.frozenLeft="frozen-left",e.dataColIndex="data-colindex",e.ariaColIndex="aria-colindex",e.dataRowIndex=Ne,e.ariaRowIndex="aria-rowindex",e.DataManipulation=He,e.Reorder=ht,e.Resize=ct,e.RowDD=ut,e.Column=C,e.EditSettings=et,e.Predicate=S,e.FilterSettings=I,e.PageSettings=Ke,e.SearchSettings=Le,e.SelectionSettings=je,e.AggregateColumn=Je,e.AggregateRow=Xe,e.SortDescriptor=rt,e.SortSettings=nt,e.RowDropSettings=yt,e.InfiniteScrollSettings=st,e.Render=_e,e.TreeVirtualRowModelGenerator=vt,e.isRemoteData=a,e.isCountRequired=s,e.isCheckboxcolumn=d,e.isFilterChildHierarchy=l,e.findParentRecords=p,e.getExpandStatus=h,e.findChildrenRecords=c,e.isOffline=u,e.extendArray=g,e.getPlainData=f,e.getParentData=y,e.isHidden=m,e.Filter=wt,e.ExcelExport=Rt,e.PdfExport=Ct,e.Page=xt,e.Toolbar=bt,e.Aggregate=St,e.Sort=It,e.TreeClipboard=Ue,e.ColumnMenu=Dt,e.ContextMenu=Mt,e.Edit=Pt,e.CommandColumn=Et,e.Selection=qe,e.DetailRow=At,e.VirtualScroll=Vt,e.TreeVirtual=Bt,e.Freeze=jt,e.ColumnChooser=_t,e.Logger=k,e.treeGridDetails=U,e.InfiniteScroll=Ht,Object.defineProperty(e,"__esModule",{value:!0})});
11
11
  //# sourceMappingURL=ej2-treegrid.umd.min.js.map