@syncfusion/ej2-treegrid 26.1.42 → 26.2.4
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.
- package/dist/ej2-treegrid.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +43 -32
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +44 -32
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +2 -2
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/hotfix/26.1.35_Vol2.txt +1 -0
- package/package.json +9 -9
- package/src/treegrid/actions/selection.js +9 -0
- package/src/treegrid/actions/virtual-scroll.js +2 -2
- package/src/treegrid/base/data.d.ts +0 -1
- package/src/treegrid/base/data.js +4 -13
- package/src/treegrid/base/treegrid.d.ts +1 -0
- package/src/treegrid/base/treegrid.js +27 -9
- package/src/treegrid/renderer/virtual-row-model-generator.js +1 -7
- package/src/treegrid/renderer/virtual-tree-content-render.js +1 -1
- package/styles/fluent2.css +10 -10
- package/styles/treegrid/fluent2.css +10 -10
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-treegrid.min.js
|
|
3
|
-
* version : 26.
|
|
3
|
+
* version : 26.2.4
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. 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
|
-
this.ej=this.ej||{},this.ej.treegrid=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[parseInt(t.toString(),10)].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[parseInt(r.toString(),10)])&&t.push(e[parseInt(r.toString(),10)]);return t}function h(e,i,r){var n,o=t.isNullOrUndefined(i.parentItem)?null:m(e,i.parentItem.uniqueID);return null==o||(!e.initialRender||t.isNullOrUndefined(o[e.expandStateMapping])||o[e.expandStateMapping]?!1!==o.expanded&&(!o.parentItem||(n=m(e,o.parentItem.uniqueID),n&&e.initialRender&&!t.isNullOrUndefined(n[e.expandStateMapping])&&!n[e.expandStateMapping]?(n.expanded=!1,!1):(!n||!1!==n.expanded)&&(!n||h(e,n)))):(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[parseInt(n.toString(),10)]),(r[parseInt(n.toString(),10)].hasChildRecords||!t.isNullOrUndefined(r[parseInt(n.toString(),10)].childRecords)&&r[parseInt(n.toString(),10)].childRecords.length)&&(i=i.concat(c(r[parseInt(n.toString(),10)])));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[parseInt(n.toString(),10)]),t={};for(var o=0;o<i.length;o++)t[i[parseInt(o.toString(),10)]]=e[parseInt(n.toString(),10)][i[parseInt(o.toString(),10)]];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 m(e,t,i){if(i){return e.uniqueIDFilterCollection[""+t]}return e.uniqueIDCollection[""+t]}function y(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}function S(e,i,r,o,a,s,d){var l,p,h,c=e.value,u=e.action,f=i.grid.getPrimaryKeyFieldNames()[0],y=i.dataSource instanceof n.DataManager?i.dataSource.dataSource.json:i.dataSource,S=[],R=c,x=!1;if("Batch"===i.editSettings.mode&&(h=i.grid.editModule.getBatchChanges()),"add"===u||"batchsave"===u&&"Batch"===i.editSettings.mode&&h.addedRecords.length){var C=v(e,y,i,r,o,a,d);c=C.value,x=C.isSkip}if(c instanceof Array?S=g(c):S.push(t.extend({},c)),!x&&("add"!==u||"Top"!==i.editSettings.newRowPosition&&"Bottom"!==i.editSettings.newRowPosition))for(var b=0;b<S.length;b++){"object"==typeof S[parseInt(b.toString(),10)][""+f]&&(S[parseInt(b.toString(),10)]=S[parseInt(b.toString(),10)][""+f]);var D=S[parseInt(b.toString(),10)].taskData?Object.keys(S[parseInt(b.toString(),10)].taskData):Object.keys(S[parseInt(b.toString(),10)]);l=y.length;for(;l--&&l>=0&&"break"!==function(){if(y[parseInt(l.toString(),10)][""+f]===S[parseInt(b.toString(),10)][""+f]){if("delete"!==u){if("edit"===u){for(p=0;p<D.length;p++)if(Object.prototype.hasOwnProperty.call(y[parseInt(l.toString(),10)],D[parseInt(p.toString(),10)])&&("Cell"!==i.editSettings.mode||!t.isNullOrUndefined(h)&&0===h.changedRecords.length||D[parseInt(p.toString(),10)]===s)){var e=m(i,S[parseInt(b.toString(),10)].uniqueID);y[parseInt(l.toString(),10)][D[parseInt(p.toString(),10)]]=S[parseInt(b.toString(),10)][D[parseInt(p.toString(),10)]],e&&e.taskData&&(e.taskData[D[parseInt(p.toString(),10)]]=e[D[parseInt(p.toString(),10)]]=y[parseInt(l.toString(),10)][D[parseInt(p.toString(),10)]])}}else if("add"===u||"batchsave"===u){var n=void 0;"Child"===i.editSettings.newRowPosition?r?(R.taskData[""+i.parentIdMapping]=y[parseInt(l.toString(),10)][""+i.idMapping],y.splice(l+1,0,R.taskData)):(Object.prototype.hasOwnProperty.call(y[parseInt(l.toString(),10)],i.childMapping)||(y[parseInt(l.toString(),10)][""+i.childMapping]=[]),y[parseInt(l.toString(),10)][""+i.childMapping].push(R.taskData),I(f,y[parseInt(l.toString(),10)],u,i,r,R)):"Below"===i.editSettings.newRowPosition?(y.splice(l+1,0,R.taskData),t.isNullOrUndefined(R.parentItem)||I(f,y[l+1],u,i,r,R)):o?"Above"===i.editSettings.newRowPosition&&(y.splice(l,0,R.taskData),t.isNullOrUndefined(R.parentItem)||I(f,y[parseInt(l.toString(),10)],u,i,r,R)):(n=0,y.splice(n,0,R.taskData))}return"break"}var a=y[parseInt(l.toString(),10)];if(y.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[parseInt(g.toString(),10)][""+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,I(f,d,u,i,r));break}return"break"}}else t.isNullOrUndefined(y[parseInt(l.toString(),10)][""+i.childMapping])||w(y[parseInt(l.toString(),10)][""+i.childMapping],S[parseInt(b.toString(),10)],u,f,i,r,R,s)&&I(f,y[parseInt(l.toString(),10)],u,i,r)}(););}}function v(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=f(t.isNullOrUndefined(s)?d=t.extend({},p[o+1]):d=t.extend({},s));break;case"Below":case"Child":if(t.isNullOrUndefined(s)){var h=r.grid.getPrimaryKeyFieldNames()[0],c=p[parseInt(o.toString(),10)];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}}function w(e,i,r,n,o,a,s,d){for(var l=!1,p=e.length;p--&&p>=0;)if(e[parseInt(p.toString(),10)][""+n]===i[""+n]||a&&e[parseInt(p.toString(),10)][o.parentIdMapping]===i[o.idMapping]){if("edit"===r){for(var h=Object.keys(i),c=m(o,i.uniqueID),u=0;u<h.length;u++)if(Object.prototype.hasOwnProperty.call(e[parseInt(p.toString(),10)],h[parseInt(u.toString(),10)])&&("Cell"!==o.editSettings.mode||h[parseInt(u.toString(),10)]===d)&&(c[h[parseInt(u.toString(),10)]]=c.taskData[h[parseInt(u.toString(),10)]]=e[parseInt(p.toString(),10)][h[parseInt(u.toString(),10)]]=i[h[parseInt(u.toString(),10)]],"Normal"===o.grid.editSettings.mode&&"Cell"===o.editSettings.mode&&!t.isNullOrUndefined(o.grid.editModule))){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[parseInt(p.toString(),10)][o.idMapping],e.splice(p+1,0,s),I(n,e[parseInt(p.toString(),10)],r,o,a,s)):(Object.prototype.hasOwnProperty.call(e[parseInt(p.toString(),10)],o.childMapping)||(e[parseInt(p.toString(),10)][o.childMapping]=[]),e[parseInt(p.toString(),10)][o.childMapping].push(s.taskData),I(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Above"===o.editSettings.newRowPosition?(e.splice(p,0,s.taskData),t.isNullOrUndefined(s.parentItem)||I(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Below"===o.editSettings.newRowPosition&&(e.splice(p+1,0,s.taskData),t.isNullOrUndefined(s.parentItem)||I(n,e[parseInt(p.toString(),10)],r,o,a,s)):(e.splice(p,1),e.length||(l=!0))}else t.isNullOrUndefined(e[parseInt(p.toString(),10)][o.childMapping])||w(e[parseInt(p.toString(),10)][o.childMapping],i,r,n,o,a,s,d)&&I(n,e[parseInt(p.toString(),10)],r,o,a);return l}function I(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){if(t[""+e]===i[""+e])return void(d=r)}),o.enableVirtualization&&t.isNullOrUndefined(d)){var p=t.getValue("uniqueIDCollection."+s.parentUniqueID,o);i=p}if(t.isNullOrUndefined(d)||(i=l[parseInt(d.toString(),10)]),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[parseInt(g.toString(),10)][""+c]===i[""+c]){u[parseInt(g.toString(),10)]=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 y=void 0;if((o.frozenRows||o.getFrozenColumns())&&(y=o.getRowByIndex(d)),!o.enableVirtualization&&!t.isNullOrUndefined(f)||!t.isNullOrUndefined(y)){var S=o.treeColumnIndex;o.allowRowDragAndDrop&&o.enableImmutableMode&&(S+=1),o.renderModule.cellRender({data:i,cell:f.cells[parseInt(S.toString(),10)]?f.cells[parseInt(S.toString(),10)]:y.cells[S-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 m(o,s.parentItem.uniqueID).childRecords.push(s)}var R=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)}}(),x=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},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[parseInt(i.toString(),10)]]=e[t[parseInt(i.toString(),10)]],this.parent&&this.parent.isReact&&"template"===t[parseInt(i.toString(),10)]){this.parent.clipboardModule.treeGridParent.renderModule.refreshReactColumnTemplateByUid(this.uid)}},e}(),b=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return R(i,e),x([t.Property(null)],i.prototype,"columns",void 0),i}(C),D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return R(t,e),t}(b),M=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)}}(),O=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},P=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return M(i,e),O([t.Property("Spinner")],i.prototype,"indicatorType",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)}}(),A=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},N=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return E(i,e),A([t.Property()],i.prototype,"field",void 0),A([t.Property()],i.prototype,"operator",void 0),A([t.Property()],i.prototype,"value",void 0),A([t.Property()],i.prototype,"matchCase",void 0),A([t.Property()],i.prototype,"ignoreAccent",void 0),A([t.Property()],i.prototype,"predicate",void 0),A([t.Property({})],i.prototype,"actualFilterValue",void 0),A([t.Property({})],i.prototype,"actualOperator",void 0),A([t.Property()],i.prototype,"type",void 0),A([t.Property()],i.prototype,"ejpredicate",void 0),A([t.Property()],i.prototype,"uid",void 0),A([t.Property()],i.prototype,"isForeignKey",void 0),i}(t.ChildProperty),U=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return E(i,e),A([t.Collection([],N)],i.prototype,"columns",void 0),A([t.Property("FilterBar")],i.prototype,"type",void 0),A([t.Property()],i.prototype,"mode",void 0),A([t.Property(!0)],i.prototype,"showFilterBarStatus",void 0),A([t.Property(1500)],i.prototype,"immediateModeDelay",void 0),A([t.Property()],i.prototype,"operators",void 0),A([t.Property(!1)],i.prototype,"ignoreAccent",void 0),A([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),k=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)}}(),q=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},T=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return k(i,e),q([t.Property("Both")],i.prototype,"wrapMode",void 0),i}(t.ChildProperty),V=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="https://ej2.syncfusion.com/documentation/treegrid",z="https://ej2.syncfusion.com/documentation",L=!1,F=function(e){function r(t){return i.Grid.Inject(i.Logger),e.call(this,t)||this}return V(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[parseInt(o.toString(),10)]],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",""),L&&"primary_column_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace("Editing","Row DragAndDrop"),L=!1);var l=d.indexOf("https"),p=d.substring(l);"module_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/modules"):"primary_column_missing"===n[parseInt(o.toString(),10)]||"selection_key_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,z+"/api/treegrid/column/#isprimarykey"):"grid_remote_edit"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/edit"):"virtual_height"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/virtual"):"check_datasource_columns"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/columns"):"locale_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace(p,B+"/global-local/#localization")),"datasource_syntax_mismatch"===n[parseInt(o.toString(),10)]?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&&(L=!0,this.log("primary_column_missing",t));for(var n=0;n<r.length;n++){var o=j[r[parseInt(n.toString(),10)]],a=o.check(t,i);if(a.success){var s=o.generateMessage(t,i,a.options);console[o.logType](s)}}},r}(i.Logger),j={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"+z+"/api/treegrid#childmapping\n"+z+"/api/treegrid#idmapping\n"+z+"/api/treegrid#$parentidmapping"}}},_="actionFailure",H=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)}}(),G=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 H(i,e),i.prototype.setCopyData=function(i){var r=this.treeGridParent.getCurrentViewRecords();if(""===window.getSelection().toString()){this.clipBoardTextArea.value=this.copyContent="";var n=this.treeGridParent.grid.getRows();if("Cell"!==this.treeGridParent.selectionSettings.mode){for(var o=this.treeGridParent.getSelectedRowIndexes().sort(function(e,t){return e-t}),a=0;a<o.length;a++)if(a>0&&(this.treeCopyContent+="\n"),!n[o[parseInt(a.toString(),10)]].classList.contains("e-summaryrow")){var s=[].slice.call(n[o[parseInt(a.toString(),10)]].querySelectorAll(".e-rowcell")),d=this.treeGridParent.getSelectedRecords()[parseInt(a.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(d)&&("Parent"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.parentContentData(r,o[parseInt(a.toString(),10)],n,i,a),this.getCopyData(s,!1,"\t",i),this.treeCopyContent+=this.copyContent,this.copiedUniqueIdCollection.push(d),this.copyContent="","Child"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.childContentData(r,o[parseInt(a.toString(),10)],n,i))}if(i){for(var l=[],a=0;a<this.treeGridParent.getVisibleColumns().length;a++)l[parseInt(a.toString(),10)]=this.treeGridParent.getVisibleColumns()[parseInt(a.toString(),10)].headerText;this.getCopyData(l,!1,"\t",i),this.treeCopyContent=this.copyContent+"\n"+this.treeCopyContent}var p={data:this.treeCopyContent,cancel:!1};if(this.treeGridParent.trigger("beforeCopy",p),p.cancel)return;this.clipBoardTextArea.value=this.copyContent=p.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){if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem))for(var a=e[parseInt(i.toString(),10)].parentItem.level,s=0;s<a+1;s++)for(var d=0;d<e.length;d++)if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem)&&e[parseInt(d.toString(),10)].uniqueID===e[parseInt(i.toString(),10)].parentItem.uniqueID){i=d;var l=[].slice.call(r[parseInt(i.toString(),10)].querySelectorAll(".e-rowcell")),p=e[parseInt(d.toString(),10)].uniqueID;if(-1===this.copiedUniqueIdCollection.indexOf(p)){this.getCopyData(l,!1,"\t",n),this.treeCopyContent=o>0?this.treeCopyContent+this.copyContent+"\n":this.copyContent+"\n"+this.treeCopyContent,this.copiedUniqueIdCollection.push(p),this.copyContent="";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){if(e[parseInt(i.toString(),10)].hasChildRecords)for(var o=e[parseInt(i.toString(),10)].childRecords,a=0;a<o.length;a++)for(var s=0;s<e.length;s++)if(!t.isNullOrUndefined(o[parseInt(a.toString(),10)].uniqueID)&&e[parseInt(s.toString(),10)].uniqueID===o[parseInt(a.toString(),10)].uniqueID){if(!t.isNullOrUndefined(r[parseInt(s.toString(),10)])&&!r[parseInt(s.toString(),10)].classList.contains("e-summaryrow")){var d=[].slice.call(r[parseInt(s.toString(),10)].querySelectorAll(".e-rowcell")),l=e[parseInt(s.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&(this.getCopyData(d,!1,"\t",n),this.treeCopyContent+="\n"+this.copyContent,this.copyContent="",this.copiedUniqueIdCollection.push(l),this.childContentData(e,s,r,n))}break}},i}(i.Clipboard),Q=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("checkboxChange",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[parseInt(r.toString(),10)].showCheckbox&&(e=i[parseInt(r.toString(),10)].uid);for(var n=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv").length,o=0;o<n;o++)this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv")[parseInt(o.toString(),10)].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=this.parent.getHeaderContent().querySelectorAll(".e-checkbox-wrapper")[0],o=n.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){if(t.isNullOrUndefined(e)){this.parent.trigger(_,{error:"The provided value for the rowIndexes is undefined. Please ensure the rowIndexes contains number."})}for(var i=0;i<e.length;i++){var r=this.parent.getCurrentViewRecords()[e[parseInt(i.toString(),10)]],n=m(this.parent,r.uniqueID),o="uncheck"===(r=n).checkboxState?"check":"uncheck";r.checkboxState=o;for(var a=Object.keys(r),s=0;s<a.length;s++)Object.prototype.hasOwnProperty.call(n,a[parseInt(s.toString(),10)])&&(n[a[parseInt(s.toString(),10)]]=r[a[parseInt(s.toString(),10)]]);this.traverSelection(r,o,!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[parseInt(a.toString(),10)].isSummaryRow||(o[parseInt(a.toString(),10)].hasChildRecords?this.traverSelection(o[parseInt(a.toString(),10)],i,!0):this.updateSelectedItems(o[parseInt(a.toString(),10)],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=m(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=m(this.parent,r[parseInt(s.toString(),10)].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=!t.isNullOrUndefined(this.parent.filterModule)&&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[parseInt(d.toString(),10)].checkboxState)continue;if(n)continue;s[parseInt(d.toString(),10)].checkboxState="check",this.updateSelectedItems(s[parseInt(d.toString(),10)],s[parseInt(d.toString(),10)].checkboxState)}else this.selectedItems.indexOf(s[parseInt(d.toString(),10)])>-1&&(s[parseInt(d.toString(),10)].checkboxState="uncheck",this.updateSelectedItems(s[parseInt(d.toString(),10)],s[parseInt(d.toString(),10)].checkboxState),this.parent.autoCheckHierarchy&&this.updateParentSelection(s[parseInt(d.toString(),10)]));!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.grid.currentViewData.filter(function(t){return t.uniqueID===e.uniqueID}),a=this.parent.grid.currentViewData.indexOf(o[0]),s=m(this.parent,e.uniqueID),d=this.parent.getRows()[parseInt(a.toString(),10)];if(a>-1){var l=void 0;(this.parent.frozenRows||this.parent.getFrozenColumns())&&(l=this.parent.getDataRows()[parseInt(a.toString(),10)]),n=d.querySelectorAll(".e-hierarchycheckbox .e-frame")[0]?d.querySelectorAll(".e-hierarchycheckbox .e-frame")[0]:l.querySelectorAll(".e-hierarchycheckbox .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||this.parent.allowPaging)&&!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;a>-1&&(t.isNullOrUndefined(n)||(n.classList.add(c),d.querySelector(".e-treecheckselect").setAttribute("aria-checked","check"===i?"true":"uncheck"===i?"false":"mixed")))},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(p=0;p<r;p++)s[parseInt(p.toString(),10)].classList.contains("e-summaryrow")||this.updateSelectedItems(i[parseInt(p.toString(),10)],i[parseInt(p.toString(),10)].checkboxState)}else if("delete"===o||"add"===e.action){var l=[];"delete"===o?l=e.data:l.push(e.data);for(var p=0;p<l.length;p++){if("delete"===o){var h=this.parent.flatData.indexOf(l[parseInt(p.toString(),10)]),u=this.selectedIndexes.indexOf(h);this.selectedIndexes.splice(u,1),this.updateSelectedItems(l[parseInt(p.toString(),10)],"uncheck")}t.isNullOrUndefined(l[parseInt(p.toString(),10)].parentItem)||this.updateParentSelection(l[parseInt(p.toString(),10)].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.filterModule.filteredResult: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[parseInt(r.toString(),10)].hasChildRecords?n.updateParentSelection(i[parseInt(r.toString(),10)]):i[parseInt(r.toString(),10)].hasChildRecords||t.isNullOrUndefined(i[parseInt(r.toString(),10)])||n.updateSelectedItems(i[parseInt(r.toString(),10)],i[parseInt(r.toString(),10)].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}(),K=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("printGrid-Init",this.printTreeGrid,this)},e.prototype.removeEventListener=function(){this.parent.grid.off("printGrid-Init",this.printTreeGrid)},e.prototype.printTreeGrid=function(e){var r=i.getObject("printgrid",e),n=i.getObject("element",e);r.addEventListener("queryCellInfo",this.parent.grid.queryCellInfo),r.addEventListener("rowDataBound",this.parent.grid.rowDataBound),r.addEventListener("beforeDataBound",this.parent.grid.beforeDataBound),t.addClass([n],"e-treegrid")},e.prototype.print=function(){this.parent.grid.print()},e.prototype.destroy=function(){this.removeEventListener()},e}(),W=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)}}(),Y=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},J=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return W(i,e),Y([t.Property()],i.prototype,"fields",void 0),Y([t.Property(!1)],i.prototype,"ignoreCase",void 0),Y([t.Property("contains")],i.prototype,"operator",void 0),Y([t.Property()],i.prototype,"key",void 0),Y([t.Property()],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),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)}}(),$=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},Z=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return X(i,e),$([t.Property("Row")],i.prototype,"mode",void 0),$([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),$([t.Property("Single")],i.prototype,"type",void 0),$([t.Property(!1)],i.prototype,"persistSelection",void 0),$([t.Property("Default")],i.prototype,"checkboxMode",void 0),$([t.Property(!1)],i.prototype,"checkboxOnly",void 0),$([t.Property(!0)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),ee=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()))&&!t.isNullOrUndefined(e.row)){e.row.style.display="none";var o=this.parent.grid.getRowsObject();this.parent.grid.isFrozenGrid()||t.isNullOrUndefined(e.row.getAttribute("data-uid"))||(o.filter(function(t){return t.uid===e.row.getAttribute("data-uid")})[0].visible=!1)}if(a(this.parent)&&!u(this.parent)){var s=this.parent,d=this.parent.getCurrentViewRecords().filter(function(e){return t.getValue(s.idMapping,e)===t.getValue(s.parentIdMapping,r)});if(d.length>0&&!d[0].isSummaryRow&&!t.isNullOrUndefined(e.row)){var p=d[0].expanded?"table-row":"none";e.row.setAttribute("style","display: "+p+";")}}i.getObject("isSummaryRow",e.data)&&t.addClass([e.row],"e-summaryrow"),t.isNullOrUndefined(e.row)||(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")));if(this.parent.rowDragAndDropModule&&this.parent.grid.rowDragAndDropModule&&(this.parent.grid.rowDragAndDropModule.dragStartData||this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.getContentTable().scrollHeight<=this.parent.getContent().clientHeight){this.parent.getVisibleRecords()[this.parent.getVisibleRecords().length-1].uniqueID!==e.data.uniqueID||t.isNullOrUndefined(e.row)||e.row.cells[0].classList.contains("e-lastrowcell")||this.parent.lastRowBorder(e.row,!0)}if(this.parent.isReact){var c=this;c.parent.renderReactTemplates(function(){c.parent.trigger("rowDataBound",e)})}else this.parent.trigger("rowDataBound",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 m=t.isNullOrUndefined(a.hasFilteredChildRecords)?a.hasChildRecords:a.hasFilteredChildRecords;if(m&&!t.isNullOrUndefined(a.childRecords)&&(m=this.parent.isFromGantt&&!this.parent.loadChildOnDemand?a.hasChildRecords:!(0===a.childRecords.length)),m){t.addClass([e.cell],"e-treerowcell"),e.cell.setAttribute("aria-expanded",a.expanded?"true":"false");var y=t.createElement("span",{className:"e-icons"}),S=void 0;S=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([y],S?"e-treegridexpand":"e-treegridcollapse"),d+=18,u.appendChild(y),g.style.width="4px",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 v=o.getFrozenRightColumns(),w=o.getFrozenLeftColumns(),I=o.getMovableColumns();v.length>0&&v[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):w.length>0&&w[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):I.length>0&&I[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 R=e.cell.querySelectorAll(".e-frame")[0];d+=parseInt(R.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 x=i.getObject(e.column.field,e.data);x=t.isNullOrUndefined(x)?null:x,null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML=x:e.column.template?e.cell.innerHTML=null:e.cell.innerHTML=x}this.parent.args=e;var C=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex];if(t.isNullOrUndefined(this.parent.rowTemplate)&&!this.parent.isReact||this.parent.isReact&&!e.column.template)this.parent.trigger("queryCellInfo",e);else if(this.parent.isReact&&C.field!==e.column.field){var b=this;b.parent.renderReactTemplates(function(){b.parent.trigger("queryCellInfo",e)})}}},e.prototype.updateTreeCell=function(e,r){var n=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex],o=e.column.index;t.isNullOrUndefined(n.field)&&e.cell.setAttribute("data-colindex",o+""),n.field!==e.column.field||t.isNullOrUndefined(n.template)||(e.column.template=n.template,e.column.templateFn=i.templateCompiler(e.column.template),e.cell.classList.add("e-templatecell"));var a=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 s=e.cell.children.length,d=this.parent.element.id+e.column.uid;if(n.field!==e.column.field||t.isNullOrUndefined(n.template))for(;0<s;s=e.cell.children.length)r.appendChild(e.cell.children[parseInt((0).toString(),10)]);else{if(this.parent.isReact&&"string"!=typeof e.column.template){e.column.templateFn(e.data,this.parent,"columnTemplate",d,null,null,r),t.isNullOrUndefined(this.parent.grid.portals)&&(this.parent.grid.portals=this.parent.portals),this.parent.notify("renderReactTemplate",this.parent.portals);var l=this;l.parent.renderReactTemplates(function(){l.parent.trigger("queryCellInfo",e)})}else{var p=e.column.templateFn(i.extend({index:""},e.data),this.parent,"template",d,this.parent.isStringTemplate);i.appendChildren(r,p)}delete e.column.template,delete e.column.templateFn,e.cell.innerHTML=""}}else r.innerHTML=a,e.cell.innerHTML=""},e.prototype.refreshReactColumnTemplateByUid=function(e){var r=this;this.parent.isReact&&this.parent.clearTemplate(["columnTemplate"],void 0,function(){var n=r.parent.grid.getRowsObject(),o=r.parent.getDataRows(),a=r.parent.grid.getIndentCount(),s=r.parent.grid.getNormalizedColumnIndex(e);if(0!==o.length)for(var d=0;d<n.length;d++)if(n[parseInt(d.toString(),10)].isDataRow&&!t.isNullOrUndefined(n[parseInt(d.toString(),10)].index)){var l=n[parseInt(d.toString(),10)].cells[parseInt(s.toString(),10)],p=new i.CellRenderer(r.parent.grid,r.parent.grid.serviceLocator),h=o.length>=n.length?r.parent.getCellFromIndex(n[parseInt(d.toString(),10)].index,s-a):r.parent.getRows()[n[parseInt(d.toString(),10)].index].querySelector(".e-templatecell");p.refreshTD(h,l,n[parseInt(d.toString(),10)].data,{index:n[parseInt(d.toString(),10)].index});var c=r.parent.getRows()[parseInt(d.toString(),10)].cells[parseInt(s.toString(),10)];r.cellRender({data:n[parseInt(d.toString(),10)].data,cell:c,column:l.column})}})},e.prototype.columnTemplateResult=function(e){this.templateResult=e.template},e.prototype.reactTemplateRender=function(e,t){this.parent.portals=e,this.parent.notify("renderReactTemplate",this.parent.portals),this.parent.renderReactTemplates(t)},e.prototype.destroy=function(){this.parent.grid.off("template-result",this.columnTemplateResult),this.parent.grid.off("reactTemplateRender",this.reactTemplateRender)},e}(),te=function(){function e(e){this.addedRecords="addedRecords",this.parent=e,this.parentItems=[],this.taskIds=[],this.hierarchyData=[],this.storedIndex=-1,this.sortedData=[],this.preCurrentPage=-1,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("remoteExpand",this.collectExpandingRecs,this),this.parent.on("dataProcessor",this.dataProcessor,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("remoteExpand",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 i=this;if(this.parent.flatData=t.isNullOrUndefined(e)||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 r=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 o=this.parent.query.params.filter(function(e){return"IdMapping"===e.key});this.parent.initialRender&&!o.length&&(this.parent.query.where(this.parent.parentIdMapping,"equal",null),this.parent.query.addParams("IdMapping",this.parent.idMapping))}if(!this.parent.hasChildMapping){var s=this.parent.query.clone();s.queries=[],(s=s.select([this.parent.parentIdMapping])).isCountRequired=!0,r.executeQuery(s).then(function(e){i.parentItems=n.DataUtil.distinct(e.result,i.parent.parentIdMapping,!1);0===(e.result?0:1)&&(t.setValue("grid.contentModule.isLoaded",!0,i.parent),t.isNullOrUndefined(i.zerothLevelData)||(t.setValue("cancel",!1,i.zerothLevelData),t.getValue("grid.renderModule",i.parent).dataManagerSuccess(i.zerothLevelData),i.zerothLevelData=null),i.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[parseInt(r.toString(),10)];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){for(var a=[],s=new n.DataManager(this.hierarchyData).executeLocal((new n.Query).group(this.parent.parentIdMapping)),r=0;r<s.length;r++){var d=s[parseInt(r.toString(),10)],l=this.taskIds.indexOf(d.key);if(!t.isNullOrUndefined(d.key)&&l>-1){var p=d.items;this.hierarchyData[parseInt(l.toString(),10)][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){a(this.parent)&&this.parent.enableVirtualization&&"virtualscroll"===e.actionArgs.requestType&&this.parent.hideSpinner();var r=e.result;if(a(this.parent)&&this.parent.enableVirtualization&&("virtualscroll"===e.actionArgs.requestType||"clearFilter"===e.actionArgs.action||""===e.actionArgs.searchString)&&(this.parent.query.expands=[]),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)||a(this.parent)&&this.parent.loadChildOnDemand&&e.actionArgs.isExpandCollapse&&this.parent.enableVirtualization||this.convertToFlatData(r)}else for(var n=this,o=0;o<r.length;o++)!function(e){if(s(n.parent)&&r[parseInt(e.toString(),10)].hasChildRecords&&n.parent.initialRender&&(r[parseInt(e.toString(),10)].expanded=!1),a(n.parent)&&n.parent.enableVirtualization){var o=[],d=n.parent;r.filter(function(t){t[""+d.parentIdMapping]===r[parseInt(e.toString(),10)][""+d.idMapping]&&o.push(t)}),o.length?r[parseInt(e.toString(),10)].expanded=!0:r[parseInt(e.toString(),10)].hasChildRecords&&(r[parseInt(e.toString(),10)].expanded=!1)}t.isNullOrUndefined(r[parseInt(e.toString(),10)].index)&&(r[parseInt(e.toString(),10)].taskData=t.extend({},r[parseInt(e.toString(),10)]),r[parseInt(e.toString(),10)].uniqueID=i.getUid(n.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r[parseInt(e.toString(),10)].uniqueID,r[parseInt(e.toString(),10)],n.parent),r[parseInt(e.toString(),10)].level=0,a(n.parent)&&n.parent.enableVirtualization&&r[parseInt(e.toString(),10)][""+n.parent.parentIdMapping]&&0===r[parseInt(e.toString(),10)].level&&(r[parseInt(e.toString(),10)].level=r[parseInt(e.toString(),10)].level+1),r[parseInt(e.toString(),10)].index=Math.ceil(1e3*Math.random()),(r[parseInt(e.toString(),10)][n.parent.hasChildMapping]||-1!==n.parentItems.indexOf(r[parseInt(e.toString(),10)][n.parent.idMapping]))&&(r[parseInt(e.toString(),10)].hasChildRecords=!0),r[parseInt(e.toString(),10)].checkboxState="uncheck")}(o);else this.zerothLevelData=e,t.setValue("cancel",!0,e);if(a(this.parent)&&this.parent.loadChildOnDemand&&e.actionArgs.isExpandCollapse&&this.parent.enableVirtualization?e.result=r:a(this.parent)&&this.parent.enableVirtualization&&!this.parent.loadChildOnDemand?e.result=r:e.result=this.parent.loadChildOnDemand?this.parent.flatData:r,a(this.parent)&&this.parent.enableVirtualization&&this.parent.loadChildOnDemand&&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 d=e.query.queries.filter(function(e){return"onAggregates"===e.fn});e.result=this.parent.summaryModule.calculateSummaryValue(d,this.parent.flatData,!0)}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[parseInt(a.toString(),10)].style.display="table-row",this.parent.loadChildOnDemand){var s=e.rows[parseInt(a.toString(),10)].getElementsByClassName("e-treegridcollapse")[0];o=this.parent.rowTemplate?this.parent.grid.getCurrentViewRecords()[e.rows[parseInt(a.toString(),10)].rowIndex]:this.parent.grid.getRowObjectFromUID(e.rows[parseInt(a.toString(),10)].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[parseInt(a.toString(),10)].querySelector(".e-detailrowcollapse");t.isNullOrUndefined(l)||this.parent.grid.detailRowModule.expand(l)}}else this.fetchRemoteChildData({action:e.name,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;var p=parseInt(e.record[this.parent.idMapping],10);if(isNaN(p)&&(p=e.record[this.parent.idMapping].toString()),this.parent.enableVirtualization&&"remoteExpand"===e.action)d.take(this.parent.grid.pageSettings.pageSize),(h=[]).push("ExpandingAction",p.toString()),d.expand(h);else if(this.parent.enableVirtualization&&"collapse"===e.action){d.take(this.parent.grid.pageSettings.pageSize);var h=[];h.push("CollapsingAction",p.toString()),d.expand(h)}if(d.where(this.parent.parentIdMapping,"equal",e.record[this.parent.idMapping]),"remoteExpand"===e.action&&this.parent.grid.filterModule&&this.parent.grid.filterModule.value){var c=this.parent.grid.getDataModule().generateQuery().queries.filter(function(e){return"onPage"!==e.fn&&void 0!==e.e.predicates});d.queries.push(c[0])}o.showSpinner(this.parent.element),s.executeQuery(d).then(function(s){var d,l=r.parent.grid.currentViewData.slice(),p=r.parent.idMapping;if(r.parent.isGantt&&!r.parent.loadChildOnDemand&&r.parent.hasChildMapping){for(y=0;y<r.parent.grid.currentViewData.length;y++)if(e.record[p]===r.parent.grid.currentViewData[y][p]){d=y;break}}else d=l.indexOf(e.record);if(r.parent.enableVirtualization&&("collapse"===e.action||"remoteExpand"===e.action)){l=[];for(y=0;y<d;y++)l.push(r.parent.grid.currentViewData[parseInt(y.toString(),10)])}-1===d&&r.parent.grid.getRowsObject().forEach(function(t){t.data.uniqueID===e.record.uniqueID&&(d=t.index)});var h=i.getObject("actual.nextLevel",s),c=s.result,u=[];if("remoteExpand"===e.action&&r.parent.grid.filterModule&&r.parent.grid.filterModule.value){for(y=0;y<l.length;y++)Object.prototype.hasOwnProperty.call(l[parseInt(y.toString(),10)],r.parent.parentIdMapping)&&null!==l[parseInt(y.toString(),10)][""+r.parent.parentIdMapping]&&0===l[parseInt(y.toString(),10)].level&&(l.splice(y,1),y--);for(y=0;y<c.length;y++)e.record[""+r.parent.idMapping]!==c[parseInt(y.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===c[parseInt(y.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(c,y)&&u.push(c[parseInt(y.toString(),10)]);c=u}if(r.parent.enableVirtualization&&"remoteExpand"===e.action){e.record.childRecords=[];for(y=0;y<c.length;y++)e.record[""+r.parent.idMapping]!==c[parseInt(y.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===c[parseInt(y.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(c,y)&&e.record.childRecords.push(c[parseInt(y.toString(),10)])}else e.record.childRecords=c;for(var g=0;g<c.length;g++){if(r.parent.enableVirtualization&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"remoteExpand"===e.action)r.parent.remoteExpandedData.push(e.record);else if(r.parent.enableVirtualization&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"===e.action)for(y=0;y<r.parent.remoteExpandedData.length;y++)e.record[""+r.parent.idMapping]===r.parent.remoteExpandedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&r.parent.remoteExpandedData.splice(y,1);if(c[parseInt(g.toString(),10)].taskData=t.extend({},c[parseInt(g.toString(),10)]),c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping]&&r.parent.enableVirtualization&&r.parent.remoteExpandedData.length)for(y=0;y<r.parent.remoteExpandedData.length;y++)c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping]===r.parent.remoteExpandedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&(c[parseInt(g.toString(),10)].level=r.parent.remoteExpandedData[parseInt(y.toString(),10)].level+1,delete(f=r.parent.remoteExpandedData[parseInt(y.toString(),10)]).childRecords,c[parseInt(g.toString(),10)].parentItem=f,c[parseInt(g.toString(),10)].parentUniqueID=e.record.uniqueID);else if(r.parent.enableVirtualization)!c[parseInt(g.toString(),10)][""+r.parent.hasChildMapping]&&-1===r.parentItems.indexOf(c[parseInt(g.toString(),10)][""+r.parent.idMapping])||h&&!h[parseInt(g.toString(),10)]?(delete(f=t.extend({},e.record)).childRecords,c[parseInt(g.toString(),10)].parentItem=f,c[parseInt(g.toString(),10)].parentUniqueID=e.record.uniqueID):t.isNullOrUndefined(c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping])?(c[parseInt(g.toString(),10)].level=0,"remoteExpand"===e.action&&(c[parseInt(g.toString(),10)].childRecords=[],c[parseInt(g.toString(),10)].childRecords=e.record.childRecords)):c[parseInt(g.toString(),10)].level=e.record.level;else{c[parseInt(g.toString(),10)].level=e.record.level+1;var f=t.extend({},e.record);delete f.childRecords,c[parseInt(g.toString(),10)].parentItem=f,c[parseInt(g.toString(),10)].parentUniqueID=e.record.uniqueID}if(c[parseInt(g.toString(),10)].index=Math.ceil(1e3*Math.random()),c[parseInt(g.toString(),10)].uniqueID=i.getUid(r.parent.element.id+"_data_"),c[parseInt(g.toString(),10)].checkboxState="uncheck",r.parent.enableVirtualization&&t.isNullOrUndefined(c[parseInt(g.toString(),10)].level))for(var m=0;m<r.parent.grid.currentViewData.length;m++)r.parent.grid.currentViewData[parseInt(m.toString(),10)][""+r.parent.idMapping]===c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping]&&(c[parseInt(g.toString(),10)].level=r.parent.grid.currentViewData[parseInt(m.toString(),10)].level+1);if(t.setValue("uniqueIDCollection."+c[parseInt(g.toString(),10)].uniqueID,c[parseInt(g.toString(),10)],r.parent),(c[parseInt(g.toString(),10)][""+r.parent.hasChildMapping]||-1!==r.parentItems.indexOf(c[parseInt(g.toString(),10)][""+r.parent.idMapping]))&&(!h||h[parseInt(g.toString(),10)]))if(c[parseInt(g.toString(),10)].hasChildRecords=!0,r.parent.enableVirtualization&&r.parent.loadChildOnDemand){for(y=0;y<r.parent.remoteCollapsedData.length;y++)c[parseInt(g.toString(),10)][""+r.parent.idMapping]===r.parent.remoteCollapsedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&(c[parseInt(g.toString(),10)].expanded=r.parent.remoteCollapsedData[parseInt(y.toString(),10)].expanded);if("collapse"===e.action&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]!==e.record[""+r.parent.idMapping]&&!1!==c[parseInt(g.toString(),10)].expanded)c[parseInt(g.toString(),10)].expanded=!0;else if("collapse"===e.action&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping])c[parseInt(g.toString(),10)].expanded=!1,r.parent.remoteCollapsedData.push(e.record);else if("remoteExpand"===e.action){for(y=0;y<r.parent.grid.currentViewData.length;y++)r.parent.grid.currentViewData[parseInt(y.toString(),10)][""+r.parent.idMapping]===c[parseInt(g.toString(),10)][""+r.parent.idMapping]&&c.splice(g,1,r.parent.grid.currentViewData[parseInt(y.toString(),10)]);if(c[parseInt(g.toString(),10)][r.parent.idMapping]===e.record[""+r.parent.idMapping])for(var y=0;y<r.parent.remoteCollapsedData.length;y++)e.record[""+r.parent.idMapping]===r.parent.remoteCollapsedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&r.parent.remoteCollapsedData.splice(y,1);!1!==c[parseInt(g.toString(),10)].expanded&&(c[parseInt(g.toString(),10)].expanded=!0)}}else r.parent.enableVirtualization&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"!==e.action?c[parseInt(g.toString(),10)].expanded=!0:r.parent.enableVirtualization&&r.parent.loadChildOnDemand||(c[parseInt(g.toString(),10)].expanded=!1);l.splice(d+g+1,0,c[parseInt(g.toString(),10)])}if(l.length>c.length&&l.length!==r.parent.grid.pageSettings.pageSize+r.parent.grid.contentModule.getBlockSize()&&r.parent.enableVirtualization&&"remoteExpand"===e.action&&(l=r.preCurrentPage>1||r.parent.grid.pageSettings.currentPage>1?l.slice(0,r.parent.grid.pageSettings.pageSize+r.parent.grid.contentModule.getBlockSize()):l.slice(0,r.parent.grid.pageSettings.pageSize),r.preCurrentPage=r.parent.grid.pageSettings.currentPage),t.setValue("result",l,s),t.setValue("action","beforecontentrender",s),r.parent.trigger("actionComplete",s),o.hideSpinner(r.parent.element),r.parent.grid.aggregates.length>0&&!r.parent.enableVirtualization){var S=i.getObject("query",s);if(t.isNullOrUndefined(S)&&(S=t.getValue("grid.renderModule.data",r.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(S)){var v=S.queries.filter(function(e){return"onAggregates"===e.fn});s.result=r.parent.summaryModule.calculateSummaryValue(v,s.result,!0)}}r.parent.enableVirtualization&&(r.parent.grid.pageSettings.totalRecordsCount=s.count),s.count=r.parent.grid.pageSettings.totalRecordsCount;var w={};r.parent.enableVirtualization&&r.remoteVirtualAction(w);var I={index:d,childData:c};r.parent.enableInfiniteScrolling?r.parent.notify("infinite-remote-expand",I):t.getValue("grid.renderModule",r.parent).dataManagerSuccess(s,w),r.parent.trigger("expanded",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(){if(this.isSortAction=!0,a(this.parent)&&this.parent.enableVirtualization){var e=this.parent.query.queries.indexOf(this.parent.query.queries.filter(function(e){return"onSortBy"===e.fn})[0]);-1!==e&&this.parent.query.queries.splice(e,1),0===this.parent.grid.sortSettings.columns.length&&this.parent.query.sortBy(null,null)}},e.prototype.createRecords=function(e,r){for(var n=[],o=0,d=Object.keys(e).length;o<d;o++){var l=t.extend({},e[parseInt(o.toString(),10)]);l.taskData=e[parseInt(o.toString(),10)];var p=0;if(this.storedIndex++,Object.prototype.hasOwnProperty.call(l,"index")||(l.index=this.storedIndex),(!t.isNullOrUndefined(l[this.parent.childMapping])&&!s(this.parent)||l[this.parent.hasChildMapping]&&s(this.parent))&&(l.hasChildRecords=!0,this.parent.enableCollapseAll||!t.isNullOrUndefined(this.parent.dataStateChange)&&t.isNullOrUndefined(l[this.parent.childMapping])?l.expanded=!1:l.expanded=!!t.isNullOrUndefined(l[this.parent.expandStateMapping])||l[this.parent.expandStateMapping]),Object.prototype.hasOwnProperty.call(l,"index")||(l.index=(l.hasChildRecords,this.storedIndex)),this.isSelfReference&&t.isNullOrUndefined(l[this.parent.parentIdMapping])&&this.parent.parentData.push(l),l.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+l.uniqueID,l,this.parent),!t.isNullOrUndefined(r)){var h=t.extend({},r);delete h.childRecords,delete h[this.parent.childMapping],this.isSelfReference&&delete h.taskData[this.parent.childMapping],l.parentItem=h,l.parentUniqueID=h.uniqueID,p=r.level+1}Object.prototype.hasOwnProperty.call(l,"level")||(l.level=p),l.checkboxState="uncheck";if(this.parent.enableVirtualization&&this.parent.loadChildOnDemand&&a(this.parent)&&!this.parent.initialRender){if(!l.hasChildRecords&&t.isNullOrUndefined(l[""+this.parent.parentIdMapping])){l.hasChildRecords=!0;for(var c=0;c<this.parent.remoteCollapsedData.length;c++)this.parent.remoteCollapsedData[parseInt(c.toString(),10)][""+this.parent.idMapping]===l[""+this.parent.idMapping]&&(l.expanded=!1)}else 0===l.level&&t.isNullOrUndefined(r)&&!l.hasChildRecords&&(l.level=l.level+1);l[""+this.parent.hasChildMapping]&&!t.isNullOrUndefined(l[""+this.parent.expandStateMapping])&&(l.expanded=l[""+this.parent.expandStateMapping],l.hasChildRecords=!0),this.parent.flatData.push(l)}else(t.isNullOrUndefined(l[""+this.parent.parentIdMapping])||l.parentItem)&&(this.parent.flatData.push(l),this.parent.infiniteScrollData.push(l));if(this.isSelfReference||0!==l.level||this.parent.parentData.push(l),!t.isNullOrUndefined(l[this.parent.childMapping]&&l[this.parent.childMapping].length)){var u=this.createRecords(l[this.parent.childMapping],l);l.childRecords=u}n.push(l)}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,m=this.parent.getPrimaryKeyFieldNames()[0],y=i.getObject("data",f);t.isNullOrUndefined(f)||t.isNullOrUndefined(f.action)||"add"!==f.action||t.isNullOrUndefined(f.data)||!t.isNullOrUndefined(f.data[""+m])||(f.data[""+m]=e.result[f.index][""+m],y.taskData[""+m]=e.result[f.index][""+m]),(!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 S,v,w=(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,I=s(this.parent)?t.getValue("count",this.parent.dataSource):w.length,R=new n.Query,x=i.getObject("query",e);if(t.isNullOrUndefined(x)||(S=x.queries.filter(function(e){return"onWhere"===e.fn}),v=x.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(x)&&(S.length||v.length)&&this.parent.isLocalData){t.isNullOrUndefined(x)&&(x=new n.Query,x=t.getValue("grid.renderModule.data",this.parent).filterQuery(x),x=t.getValue("grid.renderModule.data",this.parent).searchQuery(x));var C=x.queries.filter(function(e){return"onWhere"===e.fn}),b=x.queries.filter(function(e){return"onSearch"===e.fn});R.queries=C.concat(b);var D=new n.DataManager(w).executeLocal(R);if(this.parent.notify("updateFilterRecs",{data:D}),w=this.dataResults.result,this.dataResults.result=null,this.parent.grid.aggregates.length>0){P=i.getObject("query",e);if(t.isNullOrUndefined(x)&&(x=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(P)){B=P.queries.filter(function(e){return"onAggregates"===e.fn});w=this.parent.summaryModule.calculateSummaryValue(B,w,!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 M=i.getObject("query",e);t.isNullOrUndefined(M)&&(M=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query));B=M.queries.filter(function(e){return"onAggregates"===e.fn});w=this.parent.summaryModule.calculateSummaryValue(B,this.parent.flatData,!0)}if(this.parent.grid.sortSettings.columns.length>0||this.isSortAction){this.isSortAction=!1;for(var O=this.parent.parentData,P=i.getObject("query",e),E=new n.Query,A=this.parent.grid.sortSettings.columns.length-1;A>=0;A--){var N=this.parent.grid.renderModule.data.getColumnByField(this.parent.grid.sortSettings.columns[parseInt(A.toString(),10)].field),U=N.sortComparer&&u(this.parent)?N.sortComparer.bind(N):this.parent.grid.sortSettings.columns[parseInt(A.toString(),10)].direction;E.sortBy(this.parent.grid.sortSettings.columns[parseInt(A.toString(),10)].field,U)}var k=new n.DataManager(O).executeLocal(E);if(this.parent.allowRowDragAndDrop&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var q=k.indexOf(this.parent.rowDragAndDropModule.draggedRecord);k.splice(q,1);var T=k.indexOf(this.parent.rowDragAndDropModule.droppedRecord);this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"topSegment"===this.parent.rowDragAndDropModule.dropPosition?k.splice(T,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&k.splice(T+1,0,this.parent.rowDragAndDropModule.draggedRecord)}var V={modifiedData:k,filteredData:w,srtQry:E};if(this.parent.notify("createSort",V),w=V.modifiedData,this.dataResults.result=null,this.sortedData=w,this.parent.notify("updateModel",{}),this.parent.grid.aggregates.length>0&&!t.isNullOrUndefined(P)){var B=i.getObject("query",e).queries.filter(function(e){return"onAggregates"===e.fn});w=this.parent.summaryModule.calculateSummaryValue(B,this.sortedData,!1)}}I=s(this.parent)?t.getValue("count",this.parent.dataSource):w.length;var z=this.paging(w,I,o,l,d,e);w=z.result,I=z.count,e.result=w,e.count=I,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("pagingActions",{result:e,count:i,actionArgs:d}),e=this.dataResults.result,i=this.dataResults.count}}else this.parent.notify("pagingActions",{result:e,count:i,actionArgs:a}),e=this.dataResults.result,i=s(this.parent)?t.getValue("count",this.parent.dataSource):this.dataResults.count;if((!0===n||a.isPdfExport&&(t.isNullOrUndefined(a.isCollapsedStatePersist)||a.isCollapsedStatePersist))&&"AllPages"===this.parent.printMode){for(var l=[],p=0;p<e.length;p++)h(this.parent,e[parseInt(p.toString(),10)],this.parent.parentData)&&l.push(e[parseInt(p.toString(),10)]);i=(e=l).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("crudAction",{value:e,action:t||i}),"batchsave"===i&&"Batch"===this.parent.editSettings.mode&&this.parent.notify("batchSave",{})},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 ie=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)}}(),re=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},ne=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ie(i,e),re([t.Property(12)],i.prototype,"pageSize",void 0),re([t.Property(8)],i.prototype,"pageCount",void 0),re([t.Property(1)],i.prototype,"currentPage",void 0),re([t.Property()],i.prototype,"totalRecordsCount",void 0),re([t.Property(!1)],i.prototype,"enableQueryString",void 0),re([t.Property(!1)],i.prototype,"pageSizes",void 0),re([t.Property(null)],i.prototype,"template",void 0),re([t.Property("All")],i.prototype,"pageSizeMode",void 0),i}(t.ChildProperty),oe=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)}}(),ae=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},se=function(e){function r(){var i=null!==e&&e.apply(this,arguments)||this;return i.intl=new t.Internationalization,i.templateFn={},i}return oe(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)},ae([t.Property()],r.prototype,"type",void 0),ae([t.Property()],r.prototype,"footerTemplate",void 0),ae([t.Property()],r.prototype,"field",void 0),ae([t.Property()],r.prototype,"format",void 0),ae([t.Property()],r.prototype,"columnName",void 0),ae([t.Property()],r.prototype,"customAggregate",void 0),r}(t.ChildProperty),de=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return oe(i,e),ae([t.Collection([],se)],i.prototype,"columns",void 0),ae([t.Property(!0)],i.prototype,"showChildSummary",void 0),i}(t.ChildProperty),le=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)}}(),pe=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},he=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return le(i,e),pe([t.Property(!1)],i.prototype,"allowAdding",void 0),pe([t.Property(!1)],i.prototype,"allowEditing",void 0),pe([t.Property(!1)],i.prototype,"allowDeleting",void 0),pe([t.Property("Cell")],i.prototype,"mode",void 0),pe([t.Property("Top")],i.prototype,"newRowPosition",void 0),pe([t.Property(!0)],i.prototype,"allowEditOnDblClick",void 0),pe([t.Property(!0)],i.prototype,"showConfirmDialog",void 0),pe([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),pe([t.Property("")],i.prototype,"template",void 0),pe([t.Property({})],i.prototype,"dialog",void 0),pe([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),ce=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,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},ge=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ce(i,e),ue([t.Property()],i.prototype,"field",void 0),ue([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),fe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ce(i,e),ue([t.Collection([],ge)],i.prototype,"columns",void 0),ue([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),me=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},Se=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return me(i,e),ye([t.Property(!1)],i.prototype,"enableCache",void 0),ye([t.Property(3)],i.prototype,"maxBlocks",void 0),ye([t.Property(3)],i.prototype,"initialBlocks",void 0),i}(t.ChildProperty),ve=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)}}(),we=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},Ie=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[parseInt(o.toString(),10)]]===t[i[parseInt(o.toString(),10)]]||-1!==n.indexOf(i[parseInt(o.toString(),10)])||e[i[parseInt(o.toString(),10)]]instanceof Date&&t[i[parseInt(o.toString(),10)]]instanceof Date&&e[i[parseInt(o.toString(),10)]].getTime()===t[i[parseInt(o.toString(),10)]].getTime())){r=!1;break}return r}return!1},l.Inject(Q,F),t.setValue("mergePersistData",o.mergePersistTreeGridData,o);t.isNullOrUndefined(o.injectedModules.Logger)||i.Grid.Inject(i.Logger);o.injectedModules.filter(function(e){"freeze"===e.prototype.getModuleName()&&i.Grid.Inject(i.Freeze)});return o.grid=new i.Grid,o}ve(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.serverExcelExport=function(e){this.isExcel=!0,this.exportTreeGrid(e)},d.prototype.serverPdfExport=function(e){this.isExcel=!1,this.exportTreeGrid(e)},d.prototype.serverCsvExport=function(e){this.isExcel=!0,this.exportTreeGrid(e)},d.prototype.exportTreeGrid=function(e){var t=this.grid.getDataModule().generateQuery(!0),i=(new n.UrlAdaptor).processQuery(new n.DataManager({url:""}),t),r=JSON.parse(i.data),o=JSON.parse(this.addOnPersist(["allowPaging","pageSettings","sortSettings","allowPdfExport","allowExcelExport","aggregates","filterSettings","columns","locale","searchSettings","idMapping","parentIdMapping","childMapping","treeColumnIndex"])),a=["field","headerText","type","format","visible","template","index","width","textAlign","headerTextAlign","columns"];o.filterSettings.columns=r.where,o.searchSettings.fields=r.search&&r.search[0].fields||[],o.sortSettings.columns=r.sorted,o.columns=this.setHeaderText(o.columns,a);var s=this.createElement("form",{id:"ExportForm",styles:"display:none;"}),d=this.createElement("input",{id:"treeGridInput",attrs:{name:"treeGridModel"}});d.value=JSON.stringify(o),s.method="POST",s.action=e,s.appendChild(d),document.body.appendChild(s),s.submit(),s.remove()},d.prototype.setHeaderText=function(e,r){for(var n=0;n<e.length;n++){var o=this.getColumnByUid(e[parseInt(n.toString(),10)].uid);this.stackedHeader&&t.isNullOrUndefined(o)&&(o=t.isNullOrUndefined(e[parseInt(n.toString(),10)].field)?e[parseInt(n.toString(),10)]:this.getColumnByField(e[parseInt(n.toString(),10)].field)),e[parseInt(n.toString(),10)].headerText=o.headerText,t.isNullOrUndefined(o.template)||(e[parseInt(n.toString(),10)].template="true"),e[parseInt(n.toString(),10)].format&&(e[parseInt(n.toString(),10)].format=i.getNumberFormat(this.getFormat(o.format),o.type,!1,this.currencyCode),this.isExcel||"datetime"!==o.type&&"date"!==o.type||(e[parseInt(n.toString(),10)].format=e[parseInt(n.toString(),10)].format.toString().replace("AM/PM","tt")),e[parseInt(n.toString(),10)].type=o.type),e[parseInt(n.toString(),10)].columns&&this.setHeaderText(e[parseInt(n.toString(),10)].columns,r);for(var a=Object.keys(e[parseInt(n.toString(),10)]),s=0;s<a.length;s++)r.indexOf(a[parseInt(s.toString(),10)])<0&&delete e[parseInt(n.toString(),10)][a[parseInt(s.toString(),10)]]}return e},d.prototype.getFormat=function(e){return"object"==typeof e?t.isNullOrUndefined(e.format)?e.skeleton:e.format:e},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,i,r){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)){this.trigger(_,{error:"The provided value for the columnName and direction is undefined. Please ensure the columnName and direction contains string."})}this.sortModule&&this.sortModule.sortColumn(e,i,r)},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,i){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)){this.trigger(_,{error:"The provided value for the fromFName and toFName is undefined. Please ensure the fromFName and toFName contains string."})}this.grid.reorderColumns(e,i)},d.prototype.TreeGridLocale=function(){if(!t.isNullOrUndefined(this.locale)){var e=t.L10n.locale,r={};t.setValue(this.locale,{},r);var n=void 0;n={},n=i.getObject(this.locale,e);var o=void 0;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 r=void 0,n=void 0,o=void 0,a=void 0,s=void 0;switch(e.action){case"ctrlDownArrow":this.expandAll();break;case"ctrlUpArrow":this.collapseAll();break;case"ctrlShiftUpArrow":o=(r=e.target).closest(".e-rowcell"),t.isNullOrUndefined(o)||(a=o.closest("tr"),t.isNullOrUndefined(a)||t.isNullOrUndefined(a.getElementsByClassName("e-treegridexpand")[0])||this.expandCollapseRequest(a.querySelector(".e-treegridexpand")));break;case"ctrlShiftDownArrow":o=(r=e.target).closest(".e-rowcell"),t.isNullOrUndefined(o)||(a=o.closest("tr"),t.isNullOrUndefined(a)||t.isNullOrUndefined(a.getElementsByClassName("e-treegridcollapse")[0])||this.expandCollapseRequest(a.querySelector(".e-treegridcollapse")));break;case"downArrow":if(!this.enableVirtualization&&t.isNullOrUndefined(this.rowTemplate)&&(r=e.target,t.isNullOrUndefined(r.querySelectorAll(".e-rowcell"))||(r=i.parentsUntil(r,"e-rowcell")),!t.isNullOrUndefined(r)&&(n=r.parentElement,!t.isNullOrUndefined(n)))){p=n.cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(p).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(p).edit.obj)&&(n=r),null!==(s=this.findnextRowElement(n))){var d=r.cellIndex,l=s.children[parseInt(d.toString(),10)];t.addClass([l],"e-focused"),t.addClass([l],"e-focus")}else this.clearSelection()}break;case"upArrow":if(!this.enableVirtualization&&t.isNullOrUndefined(this.rowTemplate)&&(r=e.target,t.isNullOrUndefined(r.querySelectorAll(".e-rowcell"))||(r=i.parentsUntil(r,"e-rowcell")),!t.isNullOrUndefined(r)&&(n=r.parentElement,!t.isNullOrUndefined(n)))){var p=n.cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(p).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(p).edit.obj)&&(n=r),null!==(s=this.findPreviousRowElement(n))){var h=r.cellIndex;if(!t.isNullOrUndefined(h)){var c=s.children[parseInt(h.toString(),10)];t.addClass([c],"e-focused"),t.addClass([c],"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.remoteCollapsedData=[],this.remoteExpandedData=[],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.isReact&&t.isNullOrUndefined(this.changedProperties.columns)&&this.grid.splitFrozenCount(this.getColumns()),this.isDestroyed)return e;e.push({member:"filter",args:[this,this.filterSettings],name:"Filter"}),t.isNullOrUndefined(this.toolbar)||e.push({member:"toolbar",args:[this],name:"Toolbar"}),this.contextMenuItems&&e.push({member:"contextMenu",args:[this],name:"ContextMenu"}),this.allowPaging&&e.push({member:"pager",args:[this,this.pageSettings],name:"Page"}),this.allowReordering&&e.push({member:"reorder",args:[this],name:"Reorder"}),this.allowSorting&&e.push({member:"sort",args:[this],name:"Sort"}),this.aggregates.length>0&&e.push({member:"summary",args:[this],name:"Aggregate"}),this.allowResizing&&e.push({member:"resize",args:[this],name:"Resize"}),this.allowExcelExport&&e.push({member:"ExcelExport",args:[this],name:"ExcelExport"});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>0&&e.push({member:"freeze",args:[this],name:"Freeze"}),this.detailTemplate&&e.push({member:"detailRow",args:[this],name:"DetailRow"}),this.allowPdfExport&&e.push({member:"PdfExport",args:[this],name:"PdfExport"}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this],name:"ColumnMenu"}),this.showColumnChooser&&e.push({member:"ColumnChooser",args:[this],name:"ColumnChooser"}),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],name:"RowDD"})),(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&e.push({member:"edit",args:[this],name:"Edit"}),!t.isNullOrUndefined(this.columns)&&this.isCommandColumn(this.columns)&&e.push({member:"commandColumn",args:[this],name:"CommandColumn"}),this.allowSelection&&e.push({member:"selection",args:[this],name:"Selection"}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this],name:"VirtualScroll"}),this.enableInfiniteScrolling&&e.push({member:"infiniteScroll",args:[this],name:"InfiniteScroll"}),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),this.element&&(t.EventHandler.remove(this.element,"touchend",this.mouseClickHandler),this.keyboardModule&&(this.keyboardModule.destroy(),this.keyboardModule=null),this.allowKeyboard&&this.element.removeAttribute("tabIndex"))},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,this.grid.vueInstance=this.vueInstance),o.createSpinner({target:this.element},this.createElement),this.log(["mapping_fields_missing"]),this.renderModule=new ee(this),this.dataModule=new te(this),this.printModule=new K(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[parseInt(t.toString(),10)].member&&(e[parseInt(t.toString(),10)].member="treeVirtualScroll");return e};this.grid.root=this.root?this.root:this,this.grid.appendTo(i),this.actionFailureHandler(),this.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].setAttribute("tabindex","0");var n=this.element.getElementsByClassName("e-content")[0].querySelector(".e-table");t.isNullOrUndefined(n)||n.setAttribute("role","treegrid"),this.isIndentEnabled&&this.refreshToolbarItems(),this.wireEvents(),this.renderComplete();var a=this.grid.destroyTemplate;this.grid.destroyTemplate=function(i,r){a.apply(e.grid);e.isReact&&t.isNullOrUndefined(e.portals)||e.clearTemplate(i,r)}},d.prototype.actionFailureHandler=function(){var e=this,i=[],r=this.getPrimaryKeyFieldNames(),n=this.flatData.length;(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&0===r.length&&0!==n&&i.push("For the CRUD actions, it is necessary to enable Primary Key field for the unique data column."),this.allowRowDragAndDrop&&0===r.length&&0!==n&&i.push("For the Row Drag and Drop actions, it is necessary to enable Primary Key field for the unique data column."),this.allowPaging&&this.enableVirtualization&&i.push("Paging is not allowed in virtualization case."),0===n&&0===this.columns.length&&i.push("Either of the Data source or columns should be given."),this.frozenColumns>0&&this.columnModel.filter(function(e){return e.isFrozen})&&i.push("Use only one attribute for Frozen either IsFrozen or FrozenColumns."),this.enableVirtualization&&!t.isNullOrUndefined(this.detailTemplate)&&i.push("Virtual scrolling is not compatible with the detail template"),this.stackedHeader&&!t.isNullOrUndefined(this.detailTemplate)&&i.push("Virtual scrolling is not compatible with the detail template"),!(this.frozenColumns>0||this.columnModel.filter(function(e){return e.isFrozen})||this.frozenRows>0)||t.isNullOrUndefined(this.detailTemplate)&&t.isNullOrUndefined(this.rowTemplate)||i.push("Frozen rows and columns are not supported with the Detail template and row template."),(this.frozenColumns>0||this.columnModel.filter(function(e){return e.isFrozen}).length>0||this.frozenRows>0)&&"Cell"===this.editSettings.mode&&i.push("Frozen rows and columns are not supported with cell editing."),this.allowSelection&&!t.isNullOrUndefined(this.rowTemplate)&&i.push("Selection is not supported in RowTemplate"),this.treeColumnIndex<0&&i.push("For showing tree structure it is must to set the TreeColumnIndex value."),this.treeColumnIndex>=this.columns.length&&i.push("TreeColumnIndex value should not exceed the total column count."),(this.enableVirtualization&&!/[0-9]$/.test(this.columnModel.filter(function(e){return e.width}).toString())&&!/[px]$/.test(this.columnModel.filter(function(e){return e.width}).toString())||/[0-9]$/.test(this.height.toString())&&/[px]$/.test(this.height.toString()))&&i.push("column width and height should be in pixels"),"Children"===this.childMapping||t.isNullOrUndefined(this.idMapping)||i.push("Both IdMapping and ChildMapping should not be used together for tree grid rendering."),(!t.isNullOrUndefined(this.idMapping)&&t.isNullOrUndefined(this.parentIdMapping)||t.isNullOrUndefined(this.idMapping)&&!t.isNullOrUndefined(this.parentIdMapping))&&i.push("IdMapping and ParentIdMapping properties should be defined and vice versa.");var o=this.columnModel.filter(function(e){return e.showCheckbox}),a=this.columns[this.treeColumnIndex];if(0!==o.length&&(o!==a&&i.push("ShowCheckbox column should not be defined other than the tree column."),o.length>1&&i.push("Only one column can have the ShowCheckbox option enabled.")),0!==this.columnModel.filter(function(t){return"Right"===t.textAlign&&t.field===e.columnModel[e.treeColumnIndex].field}).length&&i.push("TextAlign right for the tree column is not applicable."),i.length>0){var s={error:{}};i.forEach(function(e,t){s.error[parseInt(t.toString(),10)]=e}),this.trigger(_,s)}},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 G(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.enableVirtualMaskRow=this.enableVirtualMaskRow,this.grid.loadingIndicator=this.loadingIndicator,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);this.grid.templateDotnetInstance=this.templateDotnetInstance;this.grid.isJsComponent=!0;this.grid.enableHtmlSanitizer=this.enableHtmlSanitizer},d.prototype.triggerEvents=function(e){this.trigger(i.getObject("name",e),e)},d.prototype.IsExpandCollapseClicked=function(e){if(!t.isNullOrUndefined(e.target)&&(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse")||e.target.classList.contains("e-summarycell"))&&!this.selectionSettings.checkboxOnly&&(!t.isNullOrUndefined(e.data)&&e.data.hasChildRecords||-1!==e.rowIndex&&t.isNullOrUndefined(e.data)))return void(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("rowDeselecting",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()[parseInt(i.toString(),10)].getElementsByClassName("e-frame e-icons e-uncheck").length&&e.grid.selectionModule.updateRowSelection(e.getRows()[parseInt(i.toString(),10)],e.getCurrentViewRecords()[parseInt(i.toString(),10)].index);e.selectedRowIndex=e.grid.selectedRowIndex,e.notify("rowSelected",t),e.trigger("rowSelected",t)},this.grid.rowDeselected=function(i){e.selectedRowIndex=e.grid.selectedRowIndex,t.isNullOrUndefined(i.data)||e.notify("rowDeselected",i),e.trigger("rowDeselected",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("checkboxChange",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 F(e.grid)}},this.grid.printComplete=this.triggerEvents.bind(this),this.grid.actionFailure=function(t){e.trigger(_,t)},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[parseInt(r.toString(),10)]],"e-lastrowcell"):t.removeClass([e.cells[parseInt(r.toString(),10)]],"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(i){if(e.updateRowTemplate(),e.updateColumnModel(),e.updateAltRow(e.getRows()),e.notify("dataBoundArg",i),a(e)&&!u(e)&&!e.hasChildMapping){var r=void 0;r=e.dataResults.result?0:1,t.setValue("grid.contentModule.isLoaded",!(r>0),e)}if(e.isPixelHeight()&&e.initialRender)for(var n=e.getContentTable().rows,o=[].slice.call(n),s=o.length-1;s>0;s--)if(!y(o[parseInt(s.toString(),10)])){o[parseInt(s.toString(),10)].nextElementSibling&&e.lastRowBorder(o[parseInt(s.toString(),10)],!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 d=e.getCurrentViewRecords().indexOf(e.grid.selectionModule.data);e.grid.selectionModule.updateRowSelection(e.getRows()[parseInt(d.toString(),10)],d)}}e.trigger("dataBound",i),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("beforeDataBound",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("toolbarClick",t,function(r){r.cancel||e.notify("toolbarClick",t),i.resolve(r)}),i}},this.grid.cellSelecting=function(r){var o=e.grid.selectionModule.actualTarget;t.isNullOrUndefined(o)||!o.classList.contains("e-treegridexpand")&&!o.classList.contains("e-treegridcollapse")||(r.cancel=!0);var a=new n.Deferred;return e.trigger(i.getObject("name",r),r,function(e){a.resolve(e)}),a},this.grid.beginEdit=function(i){if(!t.isNullOrUndefined(i.row)&&i.row.classList.contains("e-summaryrow"))return void(i.cancel=!0);var r=new n.Deferred;return e.trigger("beginEdit",i,function(e){r.resolve(e)}),r}},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("dataStateChange",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("cellSave",i,function(t){t.cancel||e.notify("cellSave",t),o.resolve(t)}),o},this.grid.cellSaved=function(t){e.trigger("cellSaved",t),e.notify("cellSaved",t)},this.grid.cellEdit=function(t){var i=new n.Deferred;return t.promise=i,e.notify("cellEdit",t),i},this.grid.batchAdd=function(t){e.trigger("batchAdd",t),e.notify("batchAdd",t)},this.grid.beforeBatchSave=function(t){e.trigger("beforeBatchSave",t),e.notify("beforeBatchSave",t)},this.grid.beforeBatchAdd=function(t){e.trigger("beforeBatchAdd",t),e.notify("beforeBatchAdd",t)},this.grid.batchDelete=function(t){e.trigger("batchDelete",t),e.notify("batchDelete",t)},this.grid.beforeBatchDelete=function(t){e.trigger("beforeBatchDelete",t),e.notify("beforeBatchDelete",t)},this.grid.batchCancel=function(t){"Cell"!==e.editSettings.mode&&e.trigger("batchCancel",t),e.notify("batchCancel",t)}},d.prototype.updateRowTemplate=function(){var e=this;this.rowTemplate&&(this.isReact&&0===this.getContentTable().rows.length?setTimeout(function(){if(e.treeColumnRowTemplate(),e.enableCollapseAll)for(var t=e.getCurrentViewRecords(),i=e.getContentTable().rows,r=0;r<i.length;r++){var n={data:t[parseInt(r.toString(),10)],row:i[parseInt(r.toString(),10)]};e.renderModule.RowModifier(n)}},0):this.treeColumnRowTemplate())},d.prototype.bindedDataSource=function(){if(this.dataSource&&s(this)){var e=this.flatData,i=t.getValue("count",this.dataSource);this.grid.dataSource={result:e,count:i}}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.dataSource.json=g(this.dataSource.dataSource.json),this.grid.dataSource.ready=this.dataSource.ready;var r=this;t.isNullOrUndefined(this.grid.dataSource.ready)||this.grid.dataSource.ready.then(function(e){var t=r.grid.dataSource;t.dataSource.offline=!0,t.isDataAvailable=!0,t.dataSource.json=e.result,t.adaptor=new n.JsonAdaptor})}},d.prototype.extendedGridActionEvents=function(){var e=this;this.grid.actionBegin=function(r){if("sorting"===r.requestType&&r.target&&r.target.parentElement&&r.target.parentElement.classList.contains("e-hierarchycheckbox")&&(r.cancel=!0),"reorder"===i.getObject("requestType",r)&&e.notify("getColumnIndex",{}),a(e)&&e.enableVirtualization&&("virtualscroll"===r.requestType?(e.query.expand("VirtualScrollingAction"),e.showSpinner()):"searching"===r.requestType&&""===r.searchString?e.query.expand("ClearSearchingAction"):"clearFilter"===r.action&&e.query.expand("ClearFilteringAction")),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("actionBegin",r,function(t){t.cancel||e.notify("beginEdit",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("beginAdd",t),"batchsave"===t.requestType&&e.notify("batchSave",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||a(e)&&e.enableVirtualization||e.expandAll()),"searching"===t.requestType&&(""===e.searchSettings.key||!e.enableVirtualization||e.initialRender||a(e)&&e.enableVirtualization||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("actionComplete",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(".e-movablecontent"),o=e.grid.element.querySelector(".e-frozencontent");n.style.height=o.style.height="auto"}e.trigger("actionComplete",t)}}},d.prototype.extendedGridEvents=function(){var e=this,i=this;this.grid.recordDoubleClick=function(t){e.trigger("recordDoubleClick",t),e.notify("recordDoubleClick",t)},this.grid.detailDataBound=function(t){e.notify("detaildataBound",t),e.trigger("detailDataBound",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("contextMenuClick",t),e.trigger("contextMenuClick",t)},this.grid.contextMenuOpen=function(t){e.notify("contextMenuOpen",t),e.trigger("contextMenuOpen",t)},this.grid.queryCellInfo=function(t){e.renderModule.cellRender(t)}},d.prototype.bindGridDragEvents=function(){var e=this;this.grid.rowDragStartHelper=function(t){e.trigger("rowDragStartHelper",t)},this.grid.rowDragStart=function(t){e.trigger("rowDragStart",t)},this.grid.rowDrag=function(t){if(e.grid.isEdit)return void(t.cancel=!0);e.notify("row-draging",t),e.trigger("rowDrag",t)},this.grid.rowDrop=function(t){if(e.grid.isEdit)return void(t.cancel=!0);e.notify("row-dropped",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[parseInt(i.toString(),10)])&&this.columns.push(t[parseInt(i.toString(),10)])}},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[parseInt(i.toString(),10)]){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[parseInt(i.toString(),10)])}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[parseInt(n.toString(),10)]){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[parseInt(n.toString(),10)])}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[parseInt(d.toString(),10)].uid);if(a=l||{},o={},"string"==typeof this.columns[parseInt(d.toString(),10)])a.field=o.field=this.columns[parseInt(d.toString(),10)];else for(var p=0,h=Object.keys(n[parseInt(d.toString(),10)]);p<h.length;p++){var c=h[p];r===this.treeColumnIndex&&"template"===c?o[""+c]=n[parseInt(d.toString(),10)][""+c]:"columns"!==c||t.isNullOrUndefined(n[parseInt(d.toString(),10)][""+c])?this.initialRender&&!t.isNullOrUndefined(l)&&this.enablePersistence&&"edit"===c?a[""+c]=o[""+c]=l[""+c]:l&&"sortComparer"===c||(a[""+c]=o[""+c]=n[parseInt(d.toString(),10)][""+c]):(a[""+c]=this.getGridColumns(n[parseInt(d.toString(),10)][""+c],!1,this.columnModel.length-1),o[""+c]=n[parseInt(d.toString(),10)][""+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){var r=Object.keys(e),o=!1;r.indexOf("columns")>-1&&!t.isNullOrUndefined(e.columns)&&(this.grid.columns=this.getGridColumns(e.columns),this.grid.updateColumnObject(),o=!0);for(var a=0,d=r;a<d.length;a++){var l=d[a];switch(l){case"treeColumnIndex":this.grid.refreshColumns();break;case"allowPaging":this.grid.allowPaging=this.allowPaging;break;case"pageSettings":this.grid.pageSettings=i.getActualProperties(this.pageSettings),o=!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 p=t.getValue("count",this.dataSource);this.grid.dataSource={result:this.flatData,count:p}}else{var h=this.dataSource;this.grid.dataSource=h instanceof n.DataManager?new n.DataManager(h.dataSource,h.defaultQuery,h.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[""+l]?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[""+l].mode&&("Cell"===e[""+l].mode||"Row"===e[""+l].mode)&&this.grid.closeEdit(),this.grid.editSettings=this.getGridEditSettings()}o&&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[parseInt(n.toString(),10)]]&&(this[i[parseInt(n.toString(),10)]]=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=["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],n=0;n<e.length;n++)for(var o=this[e[parseInt(n.toString(),10)]],a=0,s=i[e[parseInt(n.toString(),10)]];!t.isNullOrUndefined(s)&&a<s.length;a++)delete o[""+s[parseInt(a.toString(),10)]];return this.ignoreInArrays(r,this.columns),this.addOnPersist(e)},d.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)t[parseInt(i.toString(),10)].columns?(this.ignoreInColumn(e,t[parseInt(i.toString(),10)]),this.ignoreInArrays(e,t[parseInt(i.toString(),10)].columns)):this.ignoreInColumn(e,t[parseInt(i.toString(),10)])},d.prototype.ignoreInColumn=function(e,i){if(t.isNullOrUndefined(i.template))for(var r=0;r<e.length;r++)delete i[e[parseInt(r.toString(),10)]],i.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);if((i.classList.contains("e-treegridexpand")||i.classList.contains("e-treegridcollapse"))&&this.grid.isEllipsisTooltip()&&this.grid.toolTipObj.close(),this.isEditCollapse=!1,this.notify("checkboxSelection",{target:i}),this.grid.isCheckBoxSelection&&!this.grid.isPersistSelection&&this.aggregates.map(function(e){return!0===e.showChildSummary}).length){var r=this.grid.getHeaderContent().querySelector(".e-checkselectall");if(this.grid.getSelectedRowIndexes().length===this.getCurrentViewRecords().length){var n=r.nextElementSibling;t.removeClass([n],["e-stop","e-uncheck"]),t.addClass([n],["e-check"])}}}},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()[parseInt(e.toString(),10)];t.extend(r,i),this.grid.editModule.updateRow(e,r)}},d.prototype.deleteRecord=function(e,i){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)||this.getSelectedRecords().length<=0){this.trigger(_,{error:"The provided value for the fieldName and data is undefined. Please ensure the fieldName and data contains number."})}this.grid.editModule&&this.grid.editModule.deleteRecord(e,i)},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){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the tr is undefined. Please ensure the tr contains HTMLTableRowElement."})}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()[parseInt(n.toString(),10)];if(t.isNullOrUndefined(o)){this.trigger(_,{error:"The provided value for the record is undefined. Please ensure the record contains ITreeData."})}S({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){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the pageNo is undefined. Please ensure the pageNo contains number."})}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,i){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the keys is undefined. Please ensure the keys contains string."})}this.grid.hideColumns(e,i),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[parseInt(a.toString(),10)]);s<d.length;s++){var l=d[s];o[""+l]=n[parseInt(a.toString(),10)][""+l]}this.columnModel.push(new C(o)),r!==this.columnModel[parseInt(a.toString(),10)].field||"checkbox"===this.columnModel[parseInt(a.toString(),10)].type||t.isNullOrUndefined(i)||""===i||(this.columnModel[parseInt(a.toString(),10)].template=i)}}return this.deepMerge=["columns"],this.grid.columns.length!==this.columnModel.length&&(this.stackedHeader=!0),this.stackedHeader&&this.allowResizing&&!t.isNullOrUndefined(this.columns)&&this.updateColumnsWidth(this.columns),this.stackedHeader||t.isNullOrUndefined(this.columns)||t.merge(this.columns,this.columnModel),this.deepMerge=void 0,this.columnModel},d.prototype.updateColumnsWidth=function(e){var i=this;e.forEach(function(e){if(!t.isNullOrUndefined(e)&&e.columns)i.updateColumnsWidth(e.columns);else if(!t.isNullOrUndefined(e)&&e.field){var r=i.grid.getColumnByField(e.field);t.isNullOrUndefined(r)||(e.width=r.width)}})},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.setFrozenCount=function(){this.grid.setFrozenCount.apply(this.grid)},d.prototype.splitFrozenCount=function(e){this.grid.splitFrozenCount.apply(this.grid,[e])},d.prototype.isFrozenGrid=function(){return this.grid.isFrozenGrid()},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[parseInt(i.toString(),10)].classList.contains("e-summaryrow")||e.push(t[parseInt(i.toString(),10)]);return e},d.prototype.getCurrentViewRecords=function(){return this.grid.currentViewData.filter(function(e){return t.isNullOrUndefined(e.isSummaryRow)})},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[parseInt(i.toString(),10)]),t[parseInt(i.toString(),10)].expanded||(i+=c(t[parseInt(i.toString(),10)]).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;if(this.isCollapseAll=!1,t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)&&t.isNullOrUndefined(n)){this.trigger(_,{error:"The provided value for the row is undefined. Please ensure the row contains row element."})}var s=this.parentData;if(this.enableVirtualization||(s=this.flatData.filter(function(e){return e.hasChildRecords})),i=this.getCollapseExpandRecords(e,i),!t.isNullOrUndefined(e)&&e.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(e,!1),this.isExpandAll&&!a(this)){var d={data:s,row:e,cancel:!1},l=!1;this.grid.pagerModule&&!t.isNullOrUndefined(this.grid.pagerModule.pagerObj.pagerdropdownModule)&&(l=!!this.grid.pagerModule.pagerObj.pagerdropdownModule.dropDownListObject.value),this.isExpandingEventTriggered?(!this.allowPaging||l&&"All"===this.grid.pagerModule.pagerObj.pagerdropdownModule.dropDownListObject.value)&&!this.expandAllPrevent&&this.isExpandingEventTriggered&&this.expandRows(e,i,s):this.trigger("expanding",d,function(a){o.expandAllPrevent=a.cancel,a.cancel||t.isNullOrUndefined(i)||(a.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s))}),this.isExpandingEventTriggered=!0}else if(!this.isExpandAll||this.isExpandAll&&a(this)){d={data:i,row:e,cancel:!1};this.trigger("expanding",d,function(t){t.cancel||(t.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s))})}},d.prototype.expandRows=function(e,i,r){this.expandCollapse("expand",e,i);if((!a(this)||u(this))&&(!s(this)||!t.isNullOrUndefined(i.Children))){var n={data:i,row:e};t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(n.data,!0),this.isExpandAll&&!this.isExpandedEventTriggered?(this.isExpandedEventTriggered=!0,n={data:r,row:e},this.trigger("expanded",n)):this.isExpandAll||this.trigger("expanded",n)}},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[parseInt(a.toString(),10)])}},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.enableVirtualization&&this.isCollapseAll?this.isExpandAll&&-1===e.rowIndex?this.grid.getCurrentViewRecords()[parseInt(e.getAttribute("data-rowindex"),10)]:this.grid.getCurrentViewRecords()[e.rowIndex]:this.rowTemplate?this.grid.getCurrentViewRecords()[e.rowIndex]:this.grid.getCurrentViewRecords()[parseInt(e.getAttribute("data-rowindex"),10)]),i},d.prototype.collapseRow=function(e,i,r){var n=this;if(this.isExpandAll=!1,t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the row is undefined. Please ensure the row contains row element."})}var o=this.parentData;if(this.enableVirtualization||(o=this.flatData.filter(function(e){return e.hasChildRecords})),i=this.getCollapseExpandRecords(e,i),this.isCollapseAll&&!a(this)){s={data:o,row:e,cancel:!1};this.isCollapsingEventTriggered?this.allowPaging||this.collapseAllPrevent||!this.isCollapsingEventTriggered||this.collapseRows(e,i,o):this.trigger("collapsing",s,function(t){n.collapseAllPrevent=t.cancel,t.cancel||(t.collapseAll&&n.expandCollapseAllChildren(i,"collapse",r),n.collapseRows(e,i,o))}),this.isCollapsingEventTriggered=!0}else if(!this.isCollapseAll||this.isCollapseAll&&a(this)){var s={data:i,row:e,cancel:!1};this.trigger("collapsing",s,function(r){r.cancel||t.isNullOrUndefined(i)||n.collapseRows(e,i,o)})}},d.prototype.collapseRows=function(e,i,r){this.expandCollapse("collapse",e,i);var n={data:i,row:e};a(this)||(t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(n.data,!1),this.isCollapseAll&&!this.isCollapsedEventTriggered?(this.isCollapsedEventTriggered=!0,n={data:r,row:e},this.trigger("collapsed",n)):this.isCollapseAll||this.trigger("collapsed",n),this.enableInfiniteScrolling&&this.grid.getContent().firstElementChild.scrollHeight-this.grid.getContent().firstElementChild.scrollTop<this.grid.getRowHeight()+ +this.height&&this.grid.getContent().firstElementChild.scrollBy(0,this.grid.getRowHeight()))},d.prototype.updateExpandStateMapping=function(e,t){var i=e;if(i.length)for(var r=0;r<i.length;r++)i[parseInt(r.toString(),10)][this.expandStateMapping]=t,S({value:i[parseInt(r.toString(),10)],action:"edit"},this,this.isSelfReference,i[parseInt(r.toString(),10)].index,this.grid.selectedRowIndex,this.expandStateMapping);else e[""+this.expandStateMapping]=t,S({value:e,action:"edit"},this,this.isSelfReference,e.index,this.grid.selectedRowIndex,this.expandStateMapping)},d.prototype.expandAtLevel=function(e){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the level is undefined. Please ensure the level contains number."})}if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){r=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!0),t.hasChildRecords&&t.level===e});this.expandAction(r,null,e,!0)}else{var r=this.getRecordDetails(e),n=i.getObject("records",r);this.expandAction(n,null,e)}},d.prototype.expandByKey=function(e){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the key is undefined. Please ensure the key contains number."})}this.expandCollapseActionByKey(e,"Expand")},d.prototype.expandAction=function(e,i,r,n){void 0===n&&(n=!1);for(var o=this,s=0;s<e.length;s++)!function(s){if(!t.isNullOrUndefined(e[parseInt(s.toString(),10)].parentItem)){var d=e[parseInt(s.toString(),10)].parentItem.uniqueID,l=o.flatData.filter(function(e){return e.uniqueID===d});a(o)&&(l=o.getCurrentViewRecords().filter(function(e){return e.uniqueID===d})),!1===l[0].expanded?(e.push(l[0]),l[0].expanded=!0):h(o,l[0],o.parentData)||l[0].expanded&&void 0!==l[0].parentItem&&e.push(l[0])}n||o.expandRow(null,e[parseInt(s.toString(),10)],i,r)}(s);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(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the level is undefined. Please ensure the level contains number."})}if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var r=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!1),t.hasChildRecords&&t.level===e});this.collapseAction(r,null,!0)}else{var n=this.getRecordDetails(e),o=i.getObject("records",n);this.collapseAction(o)}},d.prototype.collapseByKey=function(e){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the key is undefined. Please ensure the key contains number."})}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[parseInt(r.toString(),10)],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(){if(0===this.getCurrentViewRecords().length){this.trigger(_,{error:"The provided value for the datasource is undefined. Please ensure to add the dataSource."})}this.isExpandedEventTriggered=!1,this.isExpandingEventTriggered=!1,this.expandCollapseAll("expand")},d.prototype.collapseAll=function(){if(0===this.getCurrentViewRecords().length){this.trigger(_,{error:"The provided value for the datasource is undefined. Please ensure to add the dataSource."})}this.isCollapsedEventTriggered=!1,this.isCollapsingEventTriggered=!1,this.expandCollapseAll("collapse")},d.prototype.expandCollapseAll=function(e){var i;if(!(i=this.rowTemplate?[].slice.call(this.grid.getContentTable().querySelectorAll("tr")).filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))}):this.getRows().filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))})).length&&this.getRows().length&&i.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)}),i.length)for(n=0;n<i.length;n++)"collapse"===e?t.isNullOrUndefined(this.getCurrentViewRecords()[i[parseInt(n.toString(),10)].rowIndex])||this.collapseRow(i[parseInt(n.toString(),10)]):this.enableVirtualization?"true"!==i[0].getAttribute("aria-expanded")&&this.expandRow(i[0]):this.expandRow(i[parseInt(n.toString(),10)]);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(var n=0;n<i.length;n++)"collapse"===e?this.collapseRow(i[parseInt(n.toString(),10)]):this.expandRow(i[parseInt(n.toString(),10)]);this.isExpandAll=!1,this.isCollapseAll=!1},d.prototype.expandCollapse=function(e,i,r,n){var o,d=this,l={row:i,data:r,childData:[],requestType:e},p=this.grid.currentViewData.filter(function(e){return e.parentUniqueID===r.uniqueID});(!a(this)&&"expand"===e&&this.isSelfReference&&s(this)&&!p.length||"collapse"===e||this.isExpandAll&&this.loadChildOnDemand&&!a(this)&&this.isSelfReference&&s(this))&&this.updateChildOnDemand(l);var c=this.getRows();if(this.rowTemplate){R=this.getContentTable().rows;c=[].slice.call(R)}var g;if(t.isNullOrUndefined(i)?(g=this.grid.currentViewData.indexOf(r),i=c[parseInt(g.toString(),10)]):g=+i.getAttribute("data-rowindex"),t.isNullOrUndefined(i)||i.setAttribute("aria-expanded","expand"===e?"true":"false"),!(this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)||a(this)||s(this)){var f=void 0;if("expand"===e){if(f="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(f="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 m=c.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);else{s(this)&&!p.length&&"collapse"!==e||this.localExpand(e,i,r);var S=this.getVisibleRecords()[this.getVisibleRecords().length-1].index,v=this.getRowByIndex(S);this.grid.getContentTable().clientHeight<=this.grid.getContent().clientHeight&&!t.isNullOrUndefined(v)&&!v.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(v,!0)}if(s(this)&&"expand"===e){var w=this.getCurrentViewRecords().filter(function(e){return h(d,e,d.parentData)});this.dataResults.result=w}if(!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 I=this.getRows(),R=this.getContentTable().rows,x=(I=[].slice.call(R)).length-1;x>=0;x--)if(!y(I[parseInt(x.toString(),10)])){var C=this.getContentTable().scrollHeight,b=this.getContent().clientHeight;this.lastRowBorder(I[parseInt(x.toString(),10)],C<=b);break}this.notify("rowExpandCollapse",{detailrows:m,action:f,record:r,row:i}),this.updateAltRow(c)}else this.notify("localPagedExpandCollapse",{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[parseInt(a.toString(),10)].parentUniqueID===e.data.uniqueID&&(o.splice(a,1),a-=1);return void(this.dataResults.result=o)}var d=new n.Deferred;e.childDataBind=d.resolve;var l=e.data;this.trigger("dataStateChange",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[parseInt(a.toString(),10)].taskData===l.taskData){o=a;break}for(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,a=0;a<h;a++)l[r.childMapping]&&d.filter(function(e,t){e[r.parentIdMapping]===l[r.idMapping]&&d.splice(t,1)}),p[parseInt(a.toString(),10)]?(p[parseInt(a.toString(),10)].level=l.level+1,p[parseInt(a.toString(),10)].index=Math.ceil(1e3*Math.random()),p[parseInt(a.toString(),10)].parentItem=t.extend({},l),p[parseInt(a.toString(),10)].taskData=t.extend({},p[parseInt(a.toString(),10)]),delete p[parseInt(a.toString(),10)].parentItem.childRecords,delete p[parseInt(a.toString(),10)].taskData.parentItem,p[parseInt(a.toString(),10)].parentUniqueID=l.uniqueID,p[parseInt(a.toString(),10)].uniqueID=i.getUid(r.element.id+"_data_"),t.setValue("uniqueIDCollection."+p[parseInt(a.toString(),10)].uniqueID,p[parseInt(a.toString(),10)],r),(!t.isNullOrUndefined(p[parseInt(a.toString(),10)][r.childMapping])||p[parseInt(a.toString(),10)][r.hasChildMapping]&&s(r))&&(p[parseInt(a.toString(),10)].hasChildRecords=!0),s(r)&&l[r.childMapping]&&l[r.childMapping][parseInt(a.toString(),10)]?n.splice(o+1+a,0,p[parseInt(a.toString(),10)]):n.splice(o+1+a,l[r.childMapping]&&l[r.childMapping][parseInt(a.toString(),10)]?1:0,p[parseInt(a.toString(),10)])):n.splice(o+1+a,1);n[parseInt(o.toString(),10)][""+r.childMapping]=p,n[parseInt(o.toString(),10)].childRecords=p,n[parseInt(o.toString(),10)].expanded=!0,t.setValue("uniqueIDCollection."+n[parseInt(o.toString(),10)].uniqueID,n[parseInt(o.toString(),10)],r);for(var c=0;c<e.childData.length;c++)d.push(e.childData[parseInt(c.toString(),10)])}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.enableInfiniteScrolling&&(r.getContentTable().parentElement.scrollTop=u),r.trigger("expanded",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("remoteExpand",{record:i,rows:a,parentRow:t});var s={row:t,data:i};a.length>0&&this.trigger("expanded",s)}else"collapse"===e&&this.enableVirtualization?this.dataModule.fetchRemoteChildData({action:e,record:o.data,rows:null,parentRow:o.row}):(this.collapseRemoteChild({record:i,rows:a}),this.trigger("collapsed",o))},d.prototype.localExpand=function(e,i,r){var n,o=this.grid.currentViewData.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(I=0;I<o.length;I++){var g=this.grid.getRowIndexByPrimaryKey(o[parseInt(I.toString(),10)][""+u]);n.push(this.getRows()[parseInt(g.toString(),10)])}}else n=p.filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))});var f=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.frozenRows||this.frozenColumns||this.getFrozenColumns()||f)&&(d=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))})),f&&(l=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))}));var m=this.grid.getRowsObject(),y=this.grid.currentViewData,S=y.filter(function(e){return e.uniqueID===r.uniqueID}),v=y.indexOf(S[0]);t.isNullOrUndefined(m[parseInt(v.toString(),10)].visible)||!1===m[parseInt(v.toString(),10)].visible||(m[parseInt(v.toString(),10)].visible=!0);for(var w=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))}),I=0;I<n.length;I++){if(t.isNullOrUndefined(n[parseInt(I.toString(),10)])||(n[parseInt(I.toString(),10)].style.display=c),!t.isNullOrUndefined(n[parseInt(I.toString(),10)])&&!this.allowPaging&&!(this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this))){m[n[parseInt(I.toString(),10)].rowIndex].visible="none"!==c;var R=y.filter(function(e){return e.uniqueID===S[0].parentUniqueID});!t.isNullOrUndefined(R[0])&&p[y.indexOf(R[0])].getElementsByClassName("e-treegridcollapse").length&&(m[parseInt(v.toString(),10)].visible=!1)}t.isNullOrUndefined(d)||(d[parseInt(I.toString(),10)].style.display=c),t.isNullOrUndefined(l)||(l[parseInt(I.toString(),10)].style.display=c),this.notify("childRowExpand",{row:n[parseInt(I.toString(),10)]}),!t.isNullOrUndefined(o[parseInt(I.toString(),10)].childRecords)&&o[parseInt(I.toString(),10)].childRecords.length>0&&("expand"!==e||t.isNullOrUndefined(o[parseInt(I.toString(),10)].expanded)||o[parseInt(I.toString(),10)].expanded)&&(this.expandCollapse(e,n[parseInt(I.toString(),10)],o[parseInt(I.toString(),10)],!0),this.frozenColumns<=this.treeColumnIndex&&!t.isNullOrUndefined(d)&&this.expandCollapse(e,d[parseInt(I.toString(),10)],o[parseInt(I.toString(),10)],!0))}for(I=0;I<w.length;I++)t.isNullOrUndefined(w[parseInt(I.toString(),10)])||this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||(m[w[parseInt(I.toString(),10)].rowIndex].visible="none"!==c,w[parseInt(I.toString(),10)].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[parseInt(r.toString(),10)];"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(){var e=this.getContentTable().rows;e=[].slice.call(e);for(var t=this.grid.getRowsObject(),i=0;i<e.length;i++){var r=this.grid.getContentTable().rows[parseInt(i.toString(),10)].cells[this.treeColumnIndex],n=e[parseInt(i.toString(),10)],o={data:0!==t.length?t[parseInt(i.toString(),10)].data:new Object,row:n,cell:r,column:this.getColumns()[this.treeColumnIndex]};this.renderModule.cellRender(o)}},d.prototype.collapseRemoteChild=function(e,i){t.isNullOrUndefined(i)||i||this.loadChildOnDemand||(e.record.expanded=!1);var r,n,o=e.rows,a=[],s=[],d=this.getFrozenLeftColumnsCount()>0||this.getFrozenRightColumnsCount()>0;d&&(a=this.getRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))}),s=this.getRows().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[parseInt(l.toString(),10)].style.display="none",r=o[parseInt(l.toString(),10)];var p=o[parseInt(l.toString(),10)].querySelector(".e-detailrowexpand");if(t.isNullOrUndefined(p)||this.grid.detailRowModule.collapse(p),d&&(a[parseInt(l.toString(),10)].style.display="none",s[parseInt(l.toString(),10)].style.display="none",o[parseInt(l.toString(),10)].querySelector(".e-treecolumn-container .e-treegridexpand")||(a[parseInt(l.toString(),10)].querySelector(".e-treecolumn-container .e-treegridexpand")?r=a[parseInt(l.toString(),10)]:s[parseInt(l.toString(),10)].querySelector(".e-treecolumn-container .e-treegridexpand")&&(r=s[parseInt(l.toString(),10)]))),r.querySelector(".e-treecolumn-container .e-treegridexpand")){var h=r.querySelector(".e-treecolumn-container .e-treegridexpand");n=this.rowTemplate?this.grid.getCurrentViewRecords()[o[parseInt(l.toString(),10)].rowIndex]:this.grid.getRowObjectFromUID(o[parseInt(l.toString(),10)].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[parseInt(g.toString(),10)].querySelector(".e-gridrowindex"+n.index+"level"+(n.level+1))&&c.push(u[parseInt(g.toString(),10)]);c.length&&n.expanded&&this.collapseRemoteChild({record:n,rows:c},!1)}}},d.prototype.sanitize=function(e){return this.enableHtmlSanitizer&&"string"==typeof e?t.SanitizeHtmlHelper.sanitize(e):e},d.prototype.updateRowAndCellElements=function(e,t,i){for(var r=0;r<e.length;r++)this.renderModule.cellRender({data:e[parseInt(r.toString(),10)],cell:t[parseInt(r.toString(),10)].cells[parseInt(i.toString(),10)],column:this.grid.getColumns()[this.treeColumnIndex],requestType:"rowDragAndDrop"}),"indenting"!==this.action&&"outdenting"!==this.action||this.renderModule.RowModifier({data:e[parseInt(r.toString(),10)],row:t[parseInt(r.toString(),10)]})},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,i,r,n,o,a,s,d){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the fieldName, filterOperator and filterValue are undefined. Please ensure the fieldName, filterOperator and filterValue."})}this.grid.filterByColumn(e,i,r,n,o,a,s,d)},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,i,r){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the index is undefined. Please ensure the index contains number."})}this.clipboardModule.paste(e,i,r)},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.getCellFromIndex(e,t)},d.prototype.getMovableDataRows=function(){return this.grid.getDataRows()},d.prototype.getMovableRowByIndex=function(e){return this.grid.getRowByIndex(e)},d.prototype.getMovableRows=function(){return this.grid.getRows()},d.prototype.getFrozenRightRowByIndex=function(e){return this.grid.getRowByIndex(e)},d.prototype.getFrozenRightRows=function(){return this.grid.getRows()},d.prototype.getFrozenRightDataRows=function(){return this.grid.getDataRows()},d.prototype.getFrozenRightCellFromIndex=function(e,t){return this.grid.getCellFromIndex(e,t)},d.prototype.getFrozenLeftColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getFrozenRightColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getMovableColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(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(!t.isNullOrUndefined(this.columns)&&this.columns,0)+this.frozenColumns},d.prototype.getFrozenCount=function(e,t){for(var i=0,r=e.length;i<r;i++)e[parseInt(i.toString(),10)].columns?t=this.getFrozenCount(e[parseInt(i.toString(),10)].columns,t):e[parseInt(i.toString(),10)].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,i,r){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the fromIndexes, toIndex and position is undefined. Please ensure the fromIndexes and toIndex contains number and position contains string."})}this.rowDragAndDropModule.reorderRows(e,i,r)},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 we([t.Property(0)],d.prototype,"frozenRows",void 0),we([t.Property(0)],d.prototype,"frozenColumns",void 0),we([t.Property("Ellipsis")],d.prototype,"clipMode",void 0),we([t.Property([])],d.prototype,"columns",void 0),we([t.Property(null)],d.prototype,"childMapping",void 0),we([t.Property(null)],d.prototype,"hasChildMapping",void 0),we([t.Property(0)],d.prototype,"treeColumnIndex",void 0),we([t.Property(null)],d.prototype,"idMapping",void 0),we([t.Property(null)],d.prototype,"parentIdMapping",void 0),we([t.Property(!1)],d.prototype,"enableCollapseAll",void 0),we([t.Property(null)],d.prototype,"expandStateMapping",void 0),we([t.Property(!1)],d.prototype,"allowRowDragAndDrop",void 0),we([t.Property([])],d.prototype,"dataSource",void 0),we([t.Property()],d.prototype,"query",void 0),we([t.Property()],d.prototype,"cloneQuery",void 0),we([t.Property("AllPages")],d.prototype,"printMode",void 0),we([t.Property(!1)],d.prototype,"allowPaging",void 0),we([t.Property(!1)],d.prototype,"loadChildOnDemand",void 0),we([t.Property(!1)],d.prototype,"allowTextWrap",void 0),we([t.Complex({},T)],d.prototype,"textWrapSettings",void 0),we([t.Property(!1)],d.prototype,"allowReordering",void 0),we([t.Property(!1)],d.prototype,"allowResizing",void 0),we([t.Property(!1)],d.prototype,"autoCheckHierarchy",void 0),we([t.Complex({},ne)],d.prototype,"pageSettings",void 0),we([t.Complex({},i.RowDropSettings)],d.prototype,"rowDropSettings",void 0),we([t.Property("USD")],d.prototype,"currencyCode",void 0),we([t.Property()],d.prototype,"pagerTemplate",void 0),we([t.Property(!1)],d.prototype,"showColumnMenu",void 0),we([t.Property(!1)],d.prototype,"showColumnChooser",void 0),we([t.Property(!1)],d.prototype,"allowSorting",void 0),we([t.Property(!0)],d.prototype,"allowMultiSorting",void 0),we([t.Complex({},fe)],d.prototype,"sortSettings",void 0),we([t.Collection([],de)],d.prototype,"aggregates",void 0),we([t.Complex({},he)],d.prototype,"editSettings",void 0),we([t.Property(!1)],d.prototype,"allowFiltering",void 0),we([t.Property()],d.prototype,"detailTemplate",void 0),we([t.Complex({},U)],d.prototype,"filterSettings",void 0),we([t.Complex({},J)],d.prototype,"searchSettings",void 0),we([t.Property()],d.prototype,"toolbar",void 0),we([t.Property()],d.prototype,"toolbarTemplate",void 0),we([t.Property("Default")],d.prototype,"gridLines",void 0),we([t.Property()],d.prototype,"contextMenuItems",void 0),we([t.Property()],d.prototype,"columnMenuItems",void 0),we([t.Property()],d.prototype,"rowTemplate",void 0),we([t.Property("Parent")],d.prototype,"copyHierarchyMode",void 0),we([t.Property(null)],d.prototype,"rowHeight",void 0),we([t.Property(!0)],d.prototype,"enableAltRow",void 0),we([t.Property(!0)],d.prototype,"allowKeyboard",void 0),we([t.Property(!1)],d.prototype,"enableHover",void 0),we([t.Property(!1)],d.prototype,"enableAutoFill",void 0),we([t.Property(!1)],d.prototype,"enableAdaptiveUI",void 0),we([t.Property(!1)],d.prototype,"enableImmutableMode",void 0),we([t.Property("auto")],d.prototype,"height",void 0),we([t.Property("auto")],d.prototype,"width",void 0),we([t.Complex({},P)],d.prototype,"loadingIndicator",void 0),we([t.Property(!0)],d.prototype,"enableVirtualMaskRow",void 0),we([t.Property(!1)],d.prototype,"enableVirtualization",void 0),we([t.Property(!1)],d.prototype,"enableColumnVirtualization",void 0),we([t.Property(!1)],d.prototype,"enableHtmlSanitizer",void 0),we([t.Property(!1)],d.prototype,"enableInfiniteScrolling",void 0),we([t.Complex({},Se)],d.prototype,"infiniteScrollSettings",void 0),we([t.Property("All")],d.prototype,"columnQueryMode",void 0),we([t.Event()],d.prototype,"created",void 0),we([t.Event()],d.prototype,"load",void 0),we([t.Event()],d.prototype,"expanding",void 0),we([t.Event()],d.prototype,"expanded",void 0),we([t.Event()],d.prototype,"collapsing",void 0),we([t.Event()],d.prototype,"collapsed",void 0),we([t.Event()],d.prototype,"cellSave",void 0),we([t.Event()],d.prototype,"cellSaved",void 0),we([t.Event()],d.prototype,"actionBegin",void 0),we([t.Event()],d.prototype,"actionComplete",void 0),we([t.Event()],d.prototype,"beginEdit",void 0),we([t.Event()],d.prototype,"batchAdd",void 0),we([t.Event()],d.prototype,"batchDelete",void 0),we([t.Event()],d.prototype,"batchCancel",void 0),we([t.Event()],d.prototype,"beforeBatchAdd",void 0),we([t.Event()],d.prototype,"beforeBatchDelete",void 0),we([t.Event()],d.prototype,"beforeBatchSave",void 0),we([t.Event()],d.prototype,"cellEdit",void 0),we([t.Event()],d.prototype,"actionFailure",void 0),we([t.Event()],d.prototype,"dataBound",void 0),we([t.Event()],d.prototype,"dataSourceChanged",void 0),we([t.Event()],d.prototype,"dataStateChange",void 0),we([t.Event()],d.prototype,"recordDoubleClick",void 0),we([t.Event()],d.prototype,"rowDataBound",void 0),we([t.Event()],d.prototype,"detailDataBound",void 0),we([t.Event()],d.prototype,"queryCellInfo",void 0),we([t.Property(!0)],d.prototype,"allowSelection",void 0),we([t.Event()],d.prototype,"rowSelecting",void 0),we([t.Event()],d.prototype,"rowSelected",void 0),we([t.Event()],d.prototype,"rowDeselecting",void 0),we([t.Event()],d.prototype,"rowDeselected",void 0),we([t.Event()],d.prototype,"headerCellInfo",void 0),we([t.Event()],d.prototype,"cellSelecting",void 0),we([t.Event()],d.prototype,"columnMenuOpen",void 0),we([t.Event()],d.prototype,"columnMenuClick",void 0),we([t.Event()],d.prototype,"cellSelected",void 0),we([t.Event()],d.prototype,"cellDeselecting",void 0),we([t.Event()],d.prototype,"cellDeselected",void 0),we([t.Event()],d.prototype,"resizeStart",void 0),we([t.Event()],d.prototype,"resizing",void 0),we([t.Event()],d.prototype,"resizeStop",void 0),we([t.Event()],d.prototype,"columnDragStart",void 0),we([t.Event()],d.prototype,"columnDrag",void 0),we([t.Event()],d.prototype,"columnDrop",void 0),we([t.Event()],d.prototype,"checkboxChange",void 0),we([t.Event()],d.prototype,"printComplete",void 0),we([t.Event()],d.prototype,"beforePrint",void 0),we([t.Event()],d.prototype,"toolbarClick",void 0),we([t.Event()],d.prototype,"beforeDataBound",void 0),we([t.Event()],d.prototype,"contextMenuOpen",void 0),we([t.Event()],d.prototype,"contextMenuClick",void 0),we([t.Event()],d.prototype,"beforeCopy",void 0),we([t.Event()],d.prototype,"beforePaste",void 0),we([t.Event()],d.prototype,"rowDrag",void 0),we([t.Event()],d.prototype,"rowDragStart",void 0),we([t.Event()],d.prototype,"rowDragStartHelper",void 0),we([t.Event()],d.prototype,"rowDrop",void 0),we([t.Property(-1)],d.prototype,"selectedRowIndex",void 0),we([t.Complex({},Z)],d.prototype,"selectionSettings",void 0),we([t.Property(!1)],d.prototype,"allowExcelExport",void 0),we([t.Property(!1)],d.prototype,"allowPdfExport",void 0),we([t.Event()],d.prototype,"pdfQueryCellInfo",void 0),we([t.Event()],d.prototype,"pdfHeaderQueryCellInfo",void 0),we([t.Event()],d.prototype,"excelQueryCellInfo",void 0),we([t.Event()],d.prototype,"excelHeaderQueryCellInfo",void 0),we([t.Event()],d.prototype,"beforeExcelExport",void 0),we([t.Event()],d.prototype,"excelExportComplete",void 0),we([t.Event()],d.prototype,"beforePdfExport",void 0),we([t.Event()],d.prototype,"pdfExportComplete",void 0),d=l=we([t.NotifyPropertyChanges],d)}(t.Component),Re=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[parseInt(n.toString(),10)])){e=n;break}this.parent.setProperties({treeColumnIndex:e},!0)},e}(),xe=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}(),Ce=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("row-draging",this.Rowdraging,this),this.parent.on("row-dropped",this.rowDropped,this),this.parent.on("rows-add",this.rowsAdded,this),this.parent.on("rows-remove",this.rowsRemoved,this)},e.prototype.reorderRows=function(e,i,r){var n=this.parent;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 o=[],a=0;a<e.length;a++){g=this.parent.getRowByIndex(e[parseInt(a.toString(),10)]).rowIndex;o[parseInt(a.toString(),10)]=this.parent.getCurrentViewRecords()[parseInt(g.toString(),10)]}var d={data:o,dropIndex:i};if(s(this.parent)||this.dropRows(d,!0),n.isLocalData&&(n.flatData=this.orderToIndex(n.flatData)),"outdenting"===this.parent.action&&(t.isNullOrUndefined(o[0].parentItem)||(o[0].level=o[0].parentItem.level+1)),this.parent.grid.refresh(),this.parent.enableImmutableMode&&"middleSegment"===this.dropPosition){g=void 0;this.parent.allowRowDragAndDrop?g=this.parent.treeColumnIndex+1:"indenting"===this.parent.action&&(g=this.parent.treeColumnIndex);var l=this.parent.getRows()[e[0]],p=d.data[0],h=[];(y=[]).push(p),h.push(l);var c=m(this.parent,d.data[0].parentUniqueID),u=this.parent.getRows()[parseInt(i.toString(),10)];y.push(c),h.push(u),this.parent.updateRowAndCellElements(y,h,g)}if(this.parent.enableImmutableMode&&"outdenting"===this.parent.action){var g=void 0;this.parent.allowRowDragAndDrop?g=this.parent.treeColumnIndex+1:"outdenting"===this.parent.action&&(g=this.parent.treeColumnIndex);var f=d.data[0],l=this.parent.getRows()[e[0]],y=[],h=[];y.push(f),h.push(l),this.parent.updateRowAndCellElements(y,h,g)}}},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()[parseInt(n.toString(),10)]: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()[parseInt(n.toString(),10)]: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(p=0;p<r.getCurrentViewRecords().length;p++)r.getCurrentViewRecords()[parseInt(p.toString(),10)].taskData===s.parentItem.taskData&&(d=p,r.enableVirtualization&&(d=parseInt(r.getRows()[parseInt(p.toString(),10)].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;for(var d=void 0,l=this.selectedRecord.parentItem,p=0;p<r.getCurrentViewRecords().length;p++)r.getCurrentViewRecords()[parseInt(p.toString(),10)].uniqueID===l.uniqueID&&(d=p);this.parent.enableVirtualization&&this.selectedRecord&&(d=parseInt(this.parent.getRows()[parseInt(d.toString(),10)].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("actionBegin",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[parseInt(i.toString(),10)].index=i,!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem)){var r=t.getValue("uniqueIDCollection."+e[parseInt(i.toString(),10)].parentUniqueID,this.parent);e[parseInt(i.toString(),10)].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[parseInt(o.toString(),10)]).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){for(var l,p=this.parent,h=e.records,o=e.records.length-1;o>-1;o--){l=h[parseInt(o.toString(),10)],!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]=[]),!t.isNullOrUndefined(l[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[parseInt(u.toString(),10)])&&(h.splice(u,0,c[parseInt(u.toString(),10)]),c[parseInt(u.toString(),10)].taskData=t.extend({},c[parseInt(u.toString(),10)]),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[parseInt(o.toString(),10)].uniqueID,r[parseInt(o.toString(),10)],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[parseInt(t.toString(),10)],(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))for(var s=this.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords,d=0;d<s.length;d++)o.parentItem.taskData[this.parent.childMapping][parseInt(d.toString(),10)]=s[parseInt(d.toString(),10)].taskData}else{for(var l=Object.keys(e),d=0;d<l.length;d++)e[parseInt(d.toString(),10)][this.parent.childMapping]===o.taskData[this.parent.childMapping]&&(i=d);"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[parseInt(s.toString(),10)].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,m=f+g,y=m+g,S=i.getObject("originalEvent.event",n),v=i.getObject("originalEvent.event",n),w="mousemove"===S.type?S.pageY:t.isNullOrUndefined(v)||t.isNullOrUndefined(v.changedTouches)?null:v.changedTouches[0].pageY;this.parent.enableVirtualization&&(w="mousemove"===S.type?S.clientY:t.isNullOrUndefined(v)||t.isNullOrUndefined(v.changedTouches)?null:v.changedTouches[0].clientY);var I=w<=f,R=w>f&&w<=m,x=w>m&&w<=y;if(I||R||x){if(I&&"Invalid"!==this.dropPosition&&(this.removeChildBorder(),this.dropPosition="topSegment",this.removetopOrBottomBorder(),this.addFirstrowBorder(o),this.removeErrorElem(),this.removeLastrowBorder(o),this.topOrBottomBorder(n.target)),R&&"Invalid"!==this.dropPosition){this.removetopOrBottomBorder();var C=[],b=t.closest(n.target,"tr");(C=[].slice.call(b.querySelectorAll(".e-rowcell,.e-rowdragdrop,.e-detailrowcollapse"))).length>0&&this.addRemoveClasses(C,!0,"e-childborder"),this.addLastRowborder(o),this.addFirstrowBorder(o),this.dropPosition="middleSegment"}x&&"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=this.parent.sanitize(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=this.parent.sanitize(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[parseInt(r.toString(),10)].classList.add(i):e[parseInt(r.toString(),10)].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()[parseInt(a.toString(),10)];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),t.isNullOrUndefined(r.rowDropSettings.targetID)&&!this.canDrop&&this.removetopOrBottomBorder(),r.rowDropSettings.targetID&&(l=i.parentsUntil(e.target,"e-treegrid"))&&l.id===this.parent.rowDropSettings.targetID&&l.ej2_instances[0].rowDragAndDropModule.updateIcon(e.rows,a,e),e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)){var l=i.parentsUntil(e.target,"e-treegrid");l||(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),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()[parseInt(a.toString(),10)],l=e.data[0];if("middleSegment"===this.dropPosition){var p=[],h=[];p.push(l),h.push(d);l=m(this.parent,e.data[0].parentUniqueID),a=this.parent.grid.getRowIndexByPrimaryKey(l[""+o]);var c=this.parent.getRows()[parseInt(a.toString(),10)];p.push(l),h.push(c);for(var u=0;u<p.length;u++)this.parent.renderModule.cellRender({data:p[parseInt(u.toString(),10)],cell:h[parseInt(u.toString(),10)].cells[parseInt(n.toString(),10)],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[parseInt(n.toString(),10)],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[parseInt(u.toString(),10)]=p[parseInt(u.toString(),10)].index;var g=r.dataSource;if(null!==this.parent.idMapping&&(t.isNullOrUndefined(this.dropPosition)||"bottomSegment"===this.dropPosition||"Invalid"===this.dropPosition)&&!g.length){for(var f=[],u=0;u<p.length;u++)if(p[parseInt(u.toString(),10)].hasChildRecords){f.push(p[parseInt(u.toString(),10)]);for(var m=c(p[parseInt(u.toString(),10)]),y=0;y<m.length;y++)f.push(m[parseInt(y.toString(),10)])}f.length&&(p=f)}n.notify("rows-remove",{indexes:h,records:p}),r.notify("rows-add",{toIndex:d,records:p});var S=r.rowDragAndDropModule.treeGridData;if(!t.isNullOrUndefined(S))for(u=0;u<S.length;u++)if(S[parseInt(u.toString(),10)].index=u,!t.isNullOrUndefined(S[parseInt(u.toString(),10)].parentItem)){var v=t.getValue("uniqueIDCollection."+S[parseInt(u.toString(),10)].parentUniqueID+".index",r);S[parseInt(u.toString(),10)].parentItem.index=v}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()[parseInt(o.toString(),10)];this.droppedRecord=m(this.parent,a.parentItem.uniqueID)}"middleSegment"===this.dropPosition&&(this.parent.getCurrentViewRecords()[parseInt(r.toString(),10)].level===i.level?this.droppedRecord=m(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()[parseInt(d.toString(),10)];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()[parseInt(p.toString(),10)]}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=this,m=0;m<g;m++)!function(a){if(r=h[parseInt(a.toString(),10)],f.draggedRecord=r,"Invalid"!==f.dropPosition&&!t.isNullOrUndefined(f.droppedRecord)){if(n.rowDropSettings.targetID&&!i||f.deleteDragRow(),f.draggedRecord===f.droppedRecord){var s=f.getTargetIdx(e.target.offsetParent.parentElement);isNaN(s)&&(s=f.getTargetIdx(e.target.parentElement)),e.dropIndex=s,o=f.droppedRecord=f.parent.getCurrentViewRecords()[e.dropIndex]}(o.parentItem||"middleSegment"===f.dropPosition)&&-1!==(g=(u=n.parentData).indexOf(f.draggedRecord))&&u.splice(g,1);var d=f.treeGridData.indexOf(o);if(f.dropAtTop(d),"bottomSegment"===f.dropPosition){if(o.hasChildRecords?(c=f.getChildCount(o,0),f.parent.parentIdMapping&&f.treeData.splice(d+c+1,0,f.draggedRecord.taskData),f.treeGridData.splice(d+c+1,0,f.draggedRecord)):(f.parent.parentIdMapping&&f.treeData.splice(d+1,0,f.draggedRecord.taskData),f.treeGridData.splice(d+1,0,f.draggedRecord)),t.isNullOrUndefined(o.parentItem)&&(delete r.parentItem,delete r.parentUniqueID,r.level=0,f.parent.parentIdMapping&&(r[f.parent.parentIdMapping]=null)),o.parentItem){var l=f.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,f.parent.parentIdMapping&&(r[f.parent.parentIdMapping]=o[f.parent.parentIdMapping],r.parentItem=o.parentItem,r.level=o.level)}if(r.hasChildRecords){f.updateChildRecordLevel(r,1),f.updateChildRecord(r,d+c+1)}}f.dropMiddle(d)}if(t.isNullOrUndefined(r.parentItem)){var u=n.parentData,g=u.indexOf(f.droppedRecord),m=0;u.filter(function(e){r.uniqueID===e.uniqueID&&m++}),"bottomSegment"===f.dropPosition&&0===m?u.splice(g+1,0,r):"topSegment"===f.dropPosition&&0===m&&u.splice(g,0,r)}n.rowDragAndDropModule.refreshGridDataSource()}(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[parseInt(e.toString(),10)].parentItem,this.draggedRecord.parentUniqueID=this.treeGridData[parseInt(e.toString(),10)].parentUniqueID,this.draggedRecord.level=this.treeGridData[parseInt(e.toString(),10)].level,this.treeGridData.splice(parseInt(e.toString(),10),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=m(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[parseInt(a.toString(),10)]:t.getValue("uniqueIDCollection."+e.childRecords[parseInt(a.toString(),10)].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[parseInt(o.toString(),10)]:t.getValue("uniqueIDCollection."+e.childRecords[parseInt(o.toString(),10)].uniqueID,this.parent);var a=void 0;e.parentItem&&(a=m(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||S({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[parseInt(g.toString(),10)][this.parent.idMapping]===o.taskData[this.parent.idMapping]&&(p=g);for(g=0;g<this.treeGridData.length;g++)this.treeGridData[parseInt(g.toString(),10)][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 m=this.parent.parentData.indexOf(o);-1!==m&&(r.parentData.splice(m,1),i.splice(m,1))}if(-1===f&&!r.parentIdMapping)for(var y=r.getPrimaryKeyFieldNames()[0],v=0;v<this.treeGridData.length;v++)this.treeGridData[parseInt(v.toString(),10)][""+y]===o[""+y]&&(f=v);if(!r.parentIdMapping){var w=this.getChildCount(o,0);this.treeGridData.splice(f,w+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=m(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[parseInt(s.toString(),10)],!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[parseInt(l.toString(),10)][this.parent.idMapping]===i.taskData[this.parent.idMapping]&&(r=l);for(var p=0;p<this.treeGridData.length;p++)if(this.treeGridData[parseInt(p.toString(),10)][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[parseInt(r.toString(),10)]).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("row-draging",this.Rowdraging),this.parent.off("row-dropped",this.rowDropped),this.parent.off("rows-add",this.rowsAdded),this.parent.off("rows-remove",this.rowsRemoved))},e.prototype.getModuleName=function(){return"rowDragAndDrop"},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)}}(),De=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},Me=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return be(i,e),De([t.Property()],i.prototype,"targetID",void 0),i}(t.ChildProperty),Oe=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)}}(),Pe=function(e){function i(t){var i=e.call(this,t)||this;return i.addEventListener(),i}return Oe(i,e),i.prototype.addEventListener=function(){this.parent.on("data-listener",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");var a=e.prototype.generateRows.call(this,i,r);if(!t.isNullOrUndefined(this.visualData))for(var d=0;d<a.length;d++)a[parseInt(d.toString(),10)].index=this.visualData.indexOf(a[parseInt(d.toString(),10)].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.data={},this.groups={}):"virtualscroll"===e&&this.cache[parseInt(i.toString(),10)]&&this.cache[parseInt(i.toString(),10)].length>this.parent.contentModule.getBlockSize()&&(this.cache[parseInt(i.toString(),10)].length>this.parent.contentModule.getBlockSize()?this.cache[parseInt(i.toString(),10)]=this.cache[parseInt(i.toString(),10)].slice(0,this.parent.contentModule.getBlockSize()):delete this.cache[parseInt(i.toString(),10)])}else(t||"virtualscroll"===e)&&(this.cache={},this.data={},this.groups={});return t},i}(i.VirtualRowModelGenerator),Ee=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[parseInt(r.toString(),10)];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=m(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=m(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=m(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)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[parseInt(o.toString(),10)].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[parseInt(o.toString(),10)].uniqueID)||(this.filteredResult.push(r[parseInt(o.toString(),10)]),t.setValue("uniqueIDFilterCollection."+r[parseInt(o.toString(),10)].uniqueID,r[parseInt(o.toString(),10)],this.parent),n=!0)}if("None"===s&&(0!==this.parent.grid.filterSettings.columns.length||""!==this.parent.grid.searchSettings.key)&&-1!==this.flatFilteredData.indexOf(r[parseInt(o.toString(),10)])){n=!0;break}!t.isNullOrUndefined(a)&&a.length&&(n=this.checkChildExsist(r[parseInt(o.toString(),10)])),"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=m(this.parent,e[parseInt(i.toString(),10)].parentUniqueID);if(-1!==e.indexOf(r)){var n=m(this.parent,e[parseInt(i.toString(),10)].parentUniqueID,!0);e[parseInt(i.toString(),10)].filterLevel=n.filterLevel+1}else e[parseInt(i.toString(),10)].filterLevel=0,this.filteredParentRecs.push(e[parseInt(i.toString(),10)])}},e.prototype.clearFilterLevel=function(e){var i,r=0,n=e.flatData,o=n.length;for(r;r<o;r++){var a=(i=n[parseInt(r.toString(),10)]).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}(),Ae=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=new i.Data(this.parent.grid),h=Object();if(t.setValue("isCsv",s,h),t.setValue("cancel",!1,h),t.isNullOrUndefined(e)||(this.isCollapsedStatePersist=e.isCollapsedStatePersist),!t.isNullOrUndefined(e)){if(!t.isNullOrUndefined(e.dataSource)&&!e.dataSource.dataSource)return this.parent.grid.excelExportModule.Map(this.parent.grid,e,r,o,s,a);if("CurrentPage"===e.exportType)return e.dataSource=this.parent.getCurrentViewRecords(),this.parent.grid.excelExportModule.Map(this.parent.grid,e,r,o,s,a)}return new Promise(function(c){var u=!d.isLocal()||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),g=new n.Query;if(d.isLocal()||((g=d.generateQuery(g)).queries=d.parent.grid.getDataModule().generateQuery().queries,g=i.ExportHelper.getQuery(d.parent.grid,p),t.isNullOrUndefined(d.parent.filterModule)&&(g.queries=g.queries.slice(1,2),g.params=g.params.slice(0,0)),t.setValue("query",g,h)),d.parent.trigger("beforeExcelExport",t.extend(h,e)),i.getObject("cancel",h))return null;u.executeQuery(g).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,c(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){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}),this.parent.aggregates.length>0&&(e.query=a.query),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&&m(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[parseInt(t.toString(),10)].rows&&(e.worksheets[parseInt(t.toString(),10)].pageSetup={isSummaryRowBelow:!1})},e.prototype.isLocal=function(){return!a(this.parent)&&u(this.parent)},e}(),Ne=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("beforePdfExport",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.query=o.query,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}(),Ue=function(){function e(e){i.Grid.Inject(i.Page),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("localPagedExpandCollapse",this.collapseExpandPagedchilds,this),this.parent.on("pagingActions",this.pageAction,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("localPagedExpandCollapse",this.collapseExpandPagedchilds),this.parent.off("pagingActions",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){if(t.isNullOrUndefined(e)){this.parent.trigger(_,{error:"The provided value for the message is undefined. Please ensure the message contains string."})}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=this,a=0;a<i.length;a++)!function(t){n.push(i[parseInt(t.toString(),10)]);var r=[];i[parseInt(t.toString(),10)].hasChildRecords&&(r=e.filter(function(e){return i[parseInt(t.toString(),10)].uniqueID===e.parentUniqueID}),n=o.pageRoot(e,r,n))}(a);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;m=(g=this.parent.grid.pageSettings.pageSize)*((f=this.parent.grid.pageSettings.currentPage)-1);a=a.skip(m).take(g),r=i.executeLocal(a);var s=this.pageRoot(e.result,r);e.result=s}else{var d=new n.DataManager(e.result),p=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),c=d.executeLocal((new n.Query).where(p)),u=void 0;u=l(this.parent)&&"collapse"!==e.actionArgs.action&&"expand"!==e.actionArgs.action?c:c.filter(function(e){return h(t.parent,e)}),e.count=u.length;var a=new n.Query,g=this.parent.grid.pageSettings.pageSize;this.updatePageSize(e);var f=this.parent.grid.pageSettings.currentPage;u.length<f*g&&(f=(f=Math.floor(u.length/g)+(u.length%g?1:0))||1,this.parent.grid.setProperties({pageSettings:{currentPage:f}},!0));var m=g*(f-1);a=a.skip(m).take(g),d.dataSource.json=u,e.result=d.executeLocal(a)}this.parent.notify("updateAction",e)},e}(),ke=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("rowSelected",this.refreshToolbar,this),this.parent.on("rowDeselected",this.refreshToolbar,this),this.parent.on("toolbarClick",this.toolbarClickHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("rowSelected",this.refreshToolbar),this.parent.off("rowDeselected",this.refreshToolbar),this.parent.off("toolbarClick",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;"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.indentOutdentAction(null,"indent"),e.item.id===i.grid.element.id+"_outdent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule.indentOutdentAction(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}(),qe=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[parseInt(s.toString(),10)])||a.push(r[parseInt(s.toString(),10)]);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){for(var m=0,d=g;m<d;m++)if(o=h[parseInt(m.toString(),10)],l=this.getChildRecordsLength(o,c)){for(var y=this,S=1,v=u;S<=v;S++)!function(e,r){var a=void 0;a={};for(var s=0;s<f.length;s++)a[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(s.toString(),10)]))?f[parseInt(s.toString(),10)]:i.getObject("field",f[parseInt(s.toString(),10)]))]=null;if(a=y.createSummaryItem(a,y.parent.aggregates[e-1]),!y.parent.aggregates[e-1].showChildSummary)return"continue";var d;c.map(function(e,t){if(e.uniqueID===o.uniqueID)return void(d=t)});var p=d+l+e,h=t.extend({},o);delete h.childRecords,delete h[y.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)}(S);this.flatChildRecords=[]}}else{for(var w={},I=0,R=f.length;I<R;I++)w[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(I.toString(),10)]))?f[parseInt(I.toString(),10)]:i.getObject("field",f[parseInt(I.toString(),10)]))]=null;for(var S=1,x=u;S<=x;S++)this.createSummaryItem(w,this.parent.aggregates[S-1])}return c},e.prototype.getChildRecordsLength=function(e,r){for(var n,o=0,a=Object.keys(r).length;o<a;o++)if(n=r[parseInt(o.toString(),10)],e===(t.isNullOrUndefined(n.parentItem)?null:r.filter(function(e){return e.uniqueID===n.parentItem.uniqueID})[0])){if(this.flatChildRecords.push(n),!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[parseInt(r.toString(),10)].columnName)?i.columns[parseInt(r.toString(),10)].field:i.columns[parseInt(r.toString(),10)].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[parseInt(r.toString(),10)],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[parseInt(r.toString(),10)],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(){return 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[parseInt(g.toString(),10)];var f=e.field+" - "+u[parseInt(g.toString(),10)].toLowerCase(),m="Custom"!==u[parseInt(g.toString(),10)]?i.getObject("aggregates",c):i.calculateAggregate(u[parseInt(g.toString(),10)],c,e,this.parent),y=e.columnName,S="Custom"!==u[parseInt(g.toString(),10)]?m[""+f]:m;a[""+y]=a[""+y]||{},a[""+y][""+f]=S,a[""+y][u[parseInt(g.toString(),10)]]=t.isNullOrUndefined(m)?" ":l(S)}s.format=e.getFormatter();var v=t.createElement("td",{className:"e-summary"});if(this.parent.isReact){p.fn(a[e.columnName],this.parent,p.property,"",null,null,v),this.parent.renderReactTemplates()}else i.appendChildren(v,p.fn(a[e.columnName],this.parent,p.property));var w=a[""+e.columnName][""+h];return-1===v.innerHTML.indexOf(w)?v.innerHTML+w:v.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}(),Te=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(m(this.parent,e[parseInt(r.toString(),10)].uniqueID,!0))||(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[parseInt(r.toString(),10)]):(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[parseInt(r.toString(),10)]),e[parseInt(r.toString(),10)].hasChildRecords){var o=new n.DataManager(e[parseInt(r.toString(),10)].childRecords).executeLocal(i);if(this.parent.allowRowDragAndDrop&&-1!==e[parseInt(r.toString(),10)].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}(),Ve=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}(),Be=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)){if((n||o||a.grid.isEdit)&&t.isNullOrUndefined(s)){for(var d=0,l=e.items;d<l.length;d++){var p=l[d];"Outdent"!==p.text&&"Indent"!==p.text||a.grid.contextMenuModule.hiddenItems.push(p.text)}a.grid.contextMenuModule.contextMenu.hideItems(a.grid.contextMenuModule.hiddenItems),n.style.display=o.style.display="none"}}else{var h=e.event.target.closest("td");if(!t.isNullOrUndefined(h)&&(t.isNullOrUndefined(h)||h.classList.contains("e-rowcell")&&0===h.querySelectorAll(".e-gridform").length)){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 c=a.getCurrentViewRecords()[s.rowIndex];t.isNullOrUndefined(c)||(c.level>a.getCurrentViewRecords()[s.rowIndex-1].level?n.style.display="none":n.style.display="block",c.level===a.getCurrentViewRecords()[s.rowIndex-1].level&&(n.style.display="block"),0===c.level?o.style.display="none":o.style.display="block")}}else{for(var u=0,g=e.items;u<g.length;u++)"Outdent"!==(p=g[u]).text&&"Indent"!==p.text||a.grid.contextMenuModule.hiddenItems.push(p.text);a.grid.contextMenuModule.contextMenu.hideItems(a.grid.contextMenuModule.hiddenItems),n.style.display=o.style.display="none"}}},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}(),ze=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("cellSaved",this.cellSaved,this),this.parent.on("batchAdd",this.batchAdd,this),this.parent.on("beforeBatchAdd",this.beforeBatchAdd,this),this.parent.on("batchSave",this.batchSave,this),this.parent.on("beforeBatchDelete",this.beforeBatchDelete,this),this.parent.on("beforeBatchSave",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("cellSaved",this.cellSaved),this.parent.off("batchAdd",this.batchAdd),this.parent.off("batchSave",this.batchSave),this.parent.off("beforeBatchAdd",this.beforeBatchAdd),this.parent.off("beforeBatchDelete",this.beforeBatchDelete),this.parent.off("beforeBatchSave",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[parseInt(o.toString(),10)][""+r]),i.splice(e,1);this.batchAddedRecords=this.batchRecords=this.batchAddRowRecord=this.batchDeletedRecords=this.currentViewRecords=[]},e.prototype.cellSaved=function(e){if(e.column.index===this.parent.treeColumnIndex&&this.parent.renderModule.cellRender({data:e.rowData,cell:e.cell,column:this.parent.grid.getColumnByIndex(e.column.index)}),this.isAdd&&"Batch"===this.parent.editSettings.mode&&"Bottom"!==this.parent.editSettings.newRowPosition){var r=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,o=void 0,a=this.parent.grid.getPrimaryKeyFieldNames()[0],s=void 0,d=void 0,l=this.selectedIndex>-1?this.batchRecords[parseInt(this.addRowIndex.toString(),10)].parentItem:null,p=void 0,h=void 0,u=void 0,f="Top"===this.parent.editSettings.newRowPosition||-1===this.selectedIndex?0:"Above"===this.parent.editSettings.newRowPosition?this.addRowIndex:this.addRowIndex+1;if(f=this.getActualRowObjectIndex(f),this.newBatchRowAdded){if(this.batchRecords.length&&(p=this.batchRecords[this.addRowIndex][this.parent.idMapping],u=this.batchRecords[this.addRowIndex][this.parent.parentIdMapping],this.batchRecords[parseInt(this.addRowIndex.toString(),10)].parentItem&&(h=this.batchRecords[parseInt(this.addRowIndex.toString(),10)].parentItem.uniqueID)),this.batchAddedRecords=g(this.batchAddedRecords),this.batchAddRowRecord=g(this.batchAddRowRecord),this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]),o=this.parent.grid.getRowsObject()[parseInt(f.toString(),10)].changes,o.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+o.uniqueID,o,this.parent),!Object.prototype.hasOwnProperty.call(o,"level")){if(this.batchIndex=-1===this.selectedIndex?0:this.batchIndex,"Child"===this.parent.editSettings.newRowPosition){if(o.primaryParent=l,this.selectedIndex>-1){o.parentItem=t.extend({},this.batchRecords[this.addRowIndex]),o.parentUniqueID=o.parentItem.uniqueID,delete o.parentItem.childRecords,delete o.parentItem[this.parent.childMapping],o.level=o.parentItem.level+1,o.index=this.batchIndex;var m=c(this.batchRecords[this.addRowIndex]).length,y=c(this.batchRecords[this.addRowIndex])[m-1];y=t.isNullOrUndefined(y)?this.batchRecords[this.addRowIndex]:y,s=r.map(function(e){return e[""+a]}).indexOf(y[""+a]),this.isSelfReference&&(o[this.parent.parentIdMapping]=p),I(a,o.parentItem,"add",this.parent,this.isSelfReference,o)}}else if(("Above"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)&&!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])){if(o.level=this.batchRecords[parseInt(this.addRowIndex.toString(),10)].level,o.level&&this.selectedIndex>-1&&(o.parentItem=l,o.parentUniqueID=h,delete o.parentItem.childRecords,delete o.parentItem[this.parent.childMapping]),o.index="Below"===this.parent.editSettings.newRowPosition?this.batchIndex:this.batchIndex-1,"Below"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){var m=c(this.batchRecords[this.addRowIndex]).length,y=c(this.batchRecords[this.addRowIndex])[m-1];y=t.isNullOrUndefined(y)?this.batchRecords[this.addRowIndex]:y,s=r.map(function(e){return e[""+a]}).indexOf(y[""+a])}if("Above"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){y=this.batchRecords[this.addRowIndex];s=r.map(function(e){return e[""+a]}).indexOf(y[""+a])}this.isSelfReference&&(o[this.parent.parentIdMapping]=u)}o.index=-1===o.index?0:o.index,o.hasChildRecords=!1,o.childRecords=[],this.batchRecords.splice(o.index,0,o),this.currentViewRecords.splice(o.index,0,o),d=s||o.index,"Above"!==this.parent.editSettings.newRowPosition&&(d=0===o.index?d:d+1),r.splice(d,0,o),this.batchAddedRecords.push(o)}this.parent.grid.getRowsObject()[parseInt(f.toString(),10)].data=o,this.newBatchRowAdded=!1}}},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("beginAdd",{}),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()[parseInt(h.toString(),10)]),(this.parent.frozenRows||this.parent.frozenColumns||this.parent.getFrozenColumns())&&a.push(this.parent.grid.getHeaderContent()[parseInt(h.toString(),10)]);if(!t.isNullOrUndefined(r.parentItem)){var u=m(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 y=this.batchRecords.map(function(e){return e[""+d]}).indexOf(s[parseInt(h.toString(),10)][""+d]);-1!==y&&this.batchRecords.splice(y,1)}for(h=0;h<a.length;h++)t.isNullOrUndefined(a[parseInt(h.toString(),10)])||this.parent.grid.selectionModule.selectedRecords.push(a[parseInt(h.toString(),10)])},e.prototype.updateRowIndex=function(){for(var e=this.parent.grid.getDataRows(),t=0;t<e.length;t++)e[parseInt(t.toString(),10)].setAttribute("data-rowindex",t.toString())},e.prototype.updateChildCount=function(e){for(var i=this.parent.grid.getPrimaryKeyFieldNames()[0],r="Child"===this.parent.editSettings.newRowPosition?"primaryParent":"parentItem",n=0;n<this.parent.getBatchChanges().addedRecords.length;n++)t.isNullOrUndefined(this.parent.getBatchChanges().addedRecords[parseInt(n.toString(),10)][""+r])||this.parent.getBatchChanges().addedRecords[parseInt(n.toString(),10)][""+r][""+i]===e[parseInt(this.addRowIndex.toString(),10)][""+i]&&(this.batchChildCount=this.batchChildCount+1)},e.prototype.beforeBatchSave=function(e){var t=e.batchChanges.changedRecords;if(e.batchChanges.changedRecords.length)for(r=0;r<t.length;r++)S({value:t[parseInt(r.toString(),10)],action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,void 0);if(e.batchChanges.deletedRecords.length)for(var i=e.batchChanges.deletedRecords,r=0;r<i.length;r++){this.deleteUniqueID(i[parseInt(r.toString(),10)].uniqueID);for(var n=c(i[parseInt(r.toString(),10)]),o=0;o<n.length;o++)this.deleteUniqueID(n[parseInt(o.toString(),10)].uniqueID);e.batchChanges.deletedRecords=e.batchChanges.deletedRecords.concat(n)}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=this.parent.grid.getCurrentViewRecords(),r=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,o=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords))for(l=0;l<this.batchAddedRecords.length;l++)if(-1!==(e=r.map(function(e){return e[""+o]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)][""+o]))&&r.splice(e,1),"Child"===this.parent.editSettings.newRowPosition&&(e=i.map(function(e){return e[""+o]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)].parentItem?this.batchAddedRecords[parseInt(l.toString(),10)].parentItem[""+o]:this.batchAddedRecords[parseInt(l.toString(),10)][""+o]),!t.isNullOrUndefined(i[parseInt(e.toString(),10)])))for(var a=i[parseInt(e.toString(),10)].childRecords,s=0;a&&s<a.length;s++)a[parseInt(s.toString(),10)][""+o]===this.batchAddedRecords[parseInt(l.toString(),10)][""+o]&&i[parseInt(e.toString(),10)].childRecords.splice(s,1);if(!t.isNullOrUndefined(this.parent.targetElement)){var d=this.parent.targetElement.closest("tr");this.parent.collapseRow(d),this.parent.targetElement=null}if(!t.isNullOrUndefined(this.batchDeletedRecords))for(var l=0;l<this.batchDeletedRecords.length;l++)if(!t.isNullOrUndefined(this.batchDeletedRecords[parseInt(l.toString(),10)].parentItem)){e=i.map(function(e){return e[""+o]}).indexOf(this.batchDeletedRecords[parseInt(l.toString(),10)].parentItem[""+o]);var p=0===this.batchDeletedRecords[parseInt(l.toString(),10)].index?this.batchDeletedRecords[parseInt(l.toString(),10)].index:this.batchDeletedRecords[parseInt(l.toString(),10)].index-1;t.isNullOrUndefined(i[parseInt(e.toString(),10)])||i[parseInt(e.toString(),10)].childRecords.splice(p,0,this.batchDeletedRecords[parseInt(l.toString(),10)])}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=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,a=this.parent.grid.getCurrentViewRecords(),s=this.parent.grid.getPrimaryKeyFieldNames()[0],d=r.addedRecords,l=void 0,p=void 0,h=void 0;if(d.length>1&&"Bottom"!==this.parent.editSettings.newRowPosition&&d.reverse(),"Bottom"!==this.parent.editSettings.newRowPosition&&!Object.hasOwnProperty.call(e,"updatedRecords")){if(o.splice(o.length-d.length,d.length),this.parent.editModule.isAddedRowByMethod&&d.length&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){d.reverse();for(var c=0;c<d.length;c++){var u=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[parseInt(c.toString(),10)].getAttribute("data-rowindex"),10);o.splice(u,0,d[parseInt(c.toString(),10)])}}if(this.parent.allowPaging||o.length===a.length){var f=g(o);if(f.length){var m=f.map(function(e){return e[""+s]}).indexOf(a[0][""+s]),y=m+this.parent.grid.pageSettings.pageSize;a=f.splice(m,y)}}else a.length>d.length&&a.splice(a.length-d.length,d.length)}for(0===this.batchAddRowRecord.length&&this.batchAddRowRecord.push(this.parent.flatData[e.index]),this.parent.editModule.isAddedRowByContextMenu&&d.reverse(),i=0;i<d.length;i++){var v=t.extend({},d[parseInt(i.toString(),10)]);if(delete v.parentItem,delete v.uniqueID,delete v.index,delete v.level,delete v.hasChildRecords,delete v.childRecords,delete v.parentUniqueID,t.isNullOrUndefined(v.primaryParent)||delete v.primaryParent,d.length>1&&this.parent.editModule.isAddedRowByContextMenu){var w=this.parent.editSettings.newRowPosition;this.parent.editSettings.newRowPosition=this.parent.editModule.previousNewRowPosition,this.parent.editModule.previousNewRowPosition=w}if(d[parseInt(i.toString(),10)].taskData=v,h=this.batchAddRowRecord[parseInt(i.toString(),10)],t.isNullOrUndefined(h)&&(h=this.batchAddRowRecord[i-1]),this.isSelfReference&&(t.isNullOrUndefined(d[parseInt(i.toString(),10)].parentItem)||I(s,d[parseInt(i.toString(),10)].parentItem,"add",this.parent,this.isSelfReference,d[parseInt(i.toString(),10)])),t.isNullOrUndefined(h)||(p=h.index),"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(d[parseInt(i.toString(),10)].parentItem)&&-1===this.selectedIndex&&(l=-1,h=null),S({value:d[parseInt(i.toString(),10)],action:"add"},this.parent,this.isSelfReference,p,l,void 0,h),l=null,"Child"===this.parent.editSettings.newRowPosition&&!t.isNullOrUndefined(d[parseInt(i.toString(),10)].parentItem)&&(t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.isSelfReference))for(var R=a.map(function(e){return e[""+s]}).indexOf(d[parseInt(i.toString(),10)].parentItem[""+s]),x=a[parseInt(R.toString(),10)].childRecords,C=0;C<x.length;C++)x[parseInt(C.toString(),10)][""+s]===d[parseInt(i.toString(),10)][""+s]&&a[parseInt(R.toString(),10)].childRecords.splice(C,1)}if(r.deletedRecords.length)for(i=0;i<r.deletedRecords.length;i++)S({value:r.deletedRecords[parseInt(i.toString(),10)],action:"delete"},this.parent,this.isSelfReference,p,l,void 0,h);this.parent.parentData=[];for(var b=0;b<o.length;b++)o[parseInt(b.toString(),10)].index=b,t.setValue("uniqueIDCollection."+o[parseInt(b.toString(),10)].uniqueID+".index",b,this.parent),o[parseInt(b.toString(),10)].level||this.parent.parentData.push(o[parseInt(b.toString(),10)])}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();return("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&this.selectedIndex>-1&&(!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])&&this.batchRecords[this.addRowIndex].expanded&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length?(e+=c(this.batchRecords[this.addRowIndex]).length,"Child"!==this.parent.editSettings.newRowPosition&&(e+=this.getBatchChildCount())):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),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[parseInt(r.toString(),10)].index,1)},e.prototype.nextCellIndex=function(e){this.parent.getSelectedRows().length?e.index=this.parent.getSelectedRows()[0].rowIndex:e.index=this.batchIndex},e}(),Le=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 ze(this.parent),this.addEventListener()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.addEventListener=function(){this.parent.on("crudAction",this.crudAction,this),this.parent.on("beginEdit",this.beginEdit,this),this.parent.on("beginAdd",this.beginAdd,this),this.parent.on("recordDoubleClick",this.recordDoubleClick,this),this.parent.on("cellSave",this.cellSave,this),this.parent.on("batchCancel",this.batchCancel,this),this.parent.grid.on("key-pressed",this.keyPressed,this),this.parent.grid.on("batchedit-form",this.lastCellTab,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on("cellEdit",this.cellEdit,this),this.parent.on("actionBegin",this.editActionEvents,this),this.parent.on("actionComplete",this.editActionEvents,this),this.parent.grid.on("double-tap",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("edit-form",this.beforeStartEdit,this),this.parent.grid.on("before-batch-cancel",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){if(this.doubleClickTarget=e.target,e.target.classList.contains("e-frame")&&0===this.parent.getCurrentViewRecords().length&&(this.doubleClickTarget=null),e.target.classList.contains("e-treegridcollapse")||e.target.classList.contains("e-treegridexpand")){var r=i.parentsUntil(e.target,"e-row"),n=r&&parseInt(r.getAttribute("data-rowindex"),10);!t.isNullOrUndefined(n)&&n>=0&&this.parent.allowPaging&&(this.parent.grid.getDataRows()[n].dataset.uid=this.parent.grid.contentModule.getRows()[n].uid)}},e.prototype.getRowPosition=function(e){e.newRowPosition=this.parent.editSettings.newRowPosition,e.addRowIndex=this.addRowIndex,e.dataRowIndex=+this.prevAriaRowIndex},e.prototype.beforeStartEdit=function(e){"Cell"===this.parent.editSettings.mode&&this.parent.trigger("actionBegin",e)},e.prototype.beforeBatchCancel=function(e){"Cell"===this.parent.editSettings.mode&&(e.requestType="cancel",this.parent.trigger("actionComplete",e))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("crudAction",this.crudAction),this.parent.off("beginEdit",this.beginEdit),this.parent.off("beginAdd",this.beginAdd),this.parent.off("recordDoubleClick",this.recordDoubleClick),this.parent.off("batchCancel",this.batchCancel),this.parent.grid.off("key-pressed",this.keyPressed),this.parent.grid.off("batchedit-form",this.lastCellTab),this.parent.grid.off("content-ready",this.contentready),this.parent.off("cellEdit",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("double-tap",this.recordDoubleClick),this.parent.off("savePreviousRowPosition",this.savePreviousRowPosition),this.parent.grid.off("edit-form",this.beforeStartEdit),this.parent.grid.off("before-batch-cancel",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=!t.isNullOrUndefined(s.dataSource)&&s.dataSource.adaptor;if(!t.isNullOrUndefined(d)&&(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()[parseInt(l.toString(),10)][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[parseInt(c.toString(),10)].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.getRows(),d=this.parent.grid.getRowsObject(),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[parseInt(o.toString(),10)];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&&(o+=1,d=s[parseInt(o.toString(),10)],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("cellEdit",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.prototype.cellSave=function(e){var i=this;if("Cell"===this.parent.editSettings.mode&&this.parent.element.querySelector("form")){e.cancel=!0;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){if(t[d[0]]===e.rowData[d[0]])return void(o=i)});else{var l=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o=l?(this.parent.getRows().indexOf(r),this.parent.getRows().indexOf(r)):-1===this.parent.getRows().indexOf(r)&&this.parent.getFrozenColumns()>0?this.parent.grid.getRows().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("actionBegin",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;if(this.parent.isGantt&&!this.parent.loadChildOnDemand)this.updateCell(e,o),t.setValue("isEdit",!1,this.parent.grid),this.afterCellSave(e,r);else{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),t.setValue("isEdit",!1,i.parent.grid),i.afterCellSave(e,r)})}}}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),t.setValue("isEdit",!1,this.parent.grid),this.afterCellSave(e,r)}this.parent.enableVirtualization&&(this.parent.grid.contentModule.virtualData={})},e.prototype.afterCellSave=function(e,i){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"),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(),S({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 r={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("actionComplete",r)},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()[parseInt(t.toString(),10)].data=e.rowData},e.prototype.crudAction=function(e,i){S(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[parseInt(o.toString(),10)].index=o;var s=this.parent.grid.getPrimaryKeyFieldNames()[0];e.value[""+s]===r[parseInt(o.toString(),10)][""+s]&&"add"===e.action&&(r[parseInt(o.toString(),10)].level=this.internalProperties.level,r[parseInt(o.toString(),10)].taskData=this.internalProperties.taskData,r[parseInt(o.toString(),10)].uniqueID=this.internalProperties.uniqueID,t.isNullOrUndefined(this.internalProperties.parentItem)||(r[parseInt(o.toString(),10)].parentItem=this.internalProperties.parentItem,r[parseInt(o.toString(),10)].parentUniqueID=this.internalProperties.parentUniqueID),r[parseInt(o.toString(),10)].childRecords=this.internalProperties.childRecords),t.setValue("uniqueIDCollection."+r[parseInt(o.toString(),10)].uniqueID+".index",o,this.parent);var d=this.parent.dataSource.adaptor;(a(this.parent)||d instanceof n.RemoteSaveAdaptor)&&t.setValue("uniqueIDCollection."+r[parseInt(o.toString(),10)].uniqueID,r[parseInt(o.toString(),10)],this.parent),r[parseInt(o.toString(),10)].level||this.parent.parentData.push(r[parseInt(o.toString(),10)])}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[parseInt(n.toString(),10)];if(!t.isNullOrUndefined(o)){u=t.getValue("uniqueIDCollection."+o.uniqueID+".index",this.parent);if(o.index=u,!t.isNullOrUndefined(o.parentItem)){var a=t.getValue("uniqueIDCollection."+o.parentItem.uniqueID+".index",this.parent);o.parentItem.index=a}}}var s=-1,d=this.parent.treeColumnIndex;if(this.parent.getFrozenColumns()>0)for(var l=i[0].querySelectorAll(".e-rowcell"),p=0;p<l.length;p++)if(l[parseInt(p.toString(),10)].classList.contains("e-gridrowindex0level0")){d=p;break}for(var h=0;h<this.parent.getRows().length;h++){i[parseInt(h.toString(),10)].classList.contains("e-detailrow")||s++;var c=r[parseInt(s.toString(),10)];if(!t.isNullOrUndefined(c)){var u=c.index,g=c.level,f=i[parseInt(h.toString(),10)];t.isNullOrUndefined(c.parentItem)||(u=t.getValue("uniqueIDCollection."+c.parentItem.uniqueID+".index",this.parent));var m=f.cells[parseInt(d.toString(),10)];if(!t.isNullOrUndefined(m)){for(p=0;p<m.classList.length;p++){var y=m.classList[parseInt(p.toString(),10)],S=y.match(/e-gridrowindex/i),v=y.match(/e-griddetailrowindex/i);null!=S&&t.removeClass([m],y),null!=v&&t.removeClass([m],y)}i[parseInt(h.toString(),10)].classList.contains("e-detailrow")?t.addClass([m],"e-griddetailrowindex"+u+"level"+g):t.addClass([m],"e-gridrowindex"+u+"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&&("Above"===this.parent.editSettings.newRowPosition?e="before":("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(this.selectedIndex>-1||d)&&s&&(e="after",!t.isNullOrUndefined(r[parseInt(i.toString(),10)])&&r[parseInt(i.toString(),10)].expanded&&("Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)?(i+=c(r[parseInt(i.toString(),10)]).length,"Child"!==this.parent.editSettings.newRowPosition&&(i+=this.batchEditModule.getBatchChildCount())):this.parent.enableVirtualization||(i+=c(r[parseInt(i.toString(),10)]).length))),(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="rows",p=this.parent.grid.contentModule[""+l][0],h=document.activeElement;n[i+1][""+e](n[0]),t.setValue("batchIndex",i+1,this.batchEditModule);var u="Above"===this.parent.editSettings.newRowPosition?i:i+1;if("Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule[""+l].splice(0,1),this.parent.grid.contentModule[""+l].splice(u,0,p)),"Row"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode){for(var g=this.parent.grid.getContentTable().querySelectorAll(".e-griderror"),f=0;f<g.length;f++)g[parseInt(f.toString(),10)].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)&&h.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 m=this.parent.getBatchChanges().addedRecords,y=void 0;if(m.length)for(f=0;f<m.length;f++)t.isNullOrUndefined(m[parseInt(f.toString(),10)].uniqueID)&&(y=m[parseInt(f.toString(),10)]);var S={action:"add",data:y,index:i,seletedRow:0};this.beginAddEdit(S),this.batchEditModule.batchAddRowRecord.push(this.batchEditModule.addRowRecord),this.batchEditModule.batchAddedRecords.push(S.data)}},e.prototype.beginEdit=function(e){if("refresh"===e.requestType&&this.isOnBatch)return void(e.cancel=!0);if("Cell"===this.parent.editSettings.mode&&"beginEdit"===e.requestType)return void(e.cancel=!0);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=this,o=0;o<i.length;o++)!function(t){n.parent.flatData.filter(function(n){n[""+r[0]]===e.data[parseInt(t.toString(),10)][r[0]]&&(i[parseInt(t.toString(),10)]=n)})}(o);for(o=0;o<i.length;o++){this.deleteUniqueID(i[parseInt(o.toString(),10)].uniqueID);for(var a=c(i[parseInt(o.toString(),10)]),s=0;s<a.length;s++)this.deleteUniqueID(a[parseInt(s.toString(),10)].uniqueID);e.data=e.data.concat(a)}}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 d='.e-row[data-rowindex="'+this.selectedIndex+'"]',l=void 0;this.selectedIndex>-1&&"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition?(this.prevAriaRowIndex=this.selectedIndex.toString(),l=this.parent.getContent().querySelector(d),this.addRowIndex=l?l.rowIndex:0):this.prevAriaRowIndex&&"-1"!==this.prevAriaRowIndex?(d='.e-row[data-rowindex="'+this.prevAriaRowIndex+'"]',l=this.parent.getContent().querySelector(d),this.addRowIndex=l?l.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.isAddedRowByContextMenu&&-1!==this.parent.grid.selectedRowIndex)&&(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.parent.getSelectedRecords()[0])||(this.addRowRecord=this.parent.getSelectedRecords()[0]),t.isNullOrUndefined(this.addRowRecord)&&this.parent.getCurrentViewRecords().length>this.addRowIndex&&"save"===e.requestType&&0!==this.parent.getSelectedRecords().length&&(this.addRowRecord=this.parent.getCurrentViewRecords()[this.addRowIndex]),this.isAddedRowByMethod=!1,e=this.beginAddEdit(e)},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,y=this.parent.getRows(),S=y.length?s.indexOf(s[0]):0,v=y.length?+y[y.length-1].getAttribute("data-rowindex"):0,w=!(!this.parent.enableVirtualization||0===e.index)||this.selectedIndex>=S&&this.selectedIndex<=v;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 R=c(s[this.addRowIndex]).length,x=s[this.addRowIndex].index;d=R>0?x+R:x}else if("Child"===this.parent.editSettings.newRowPosition){a="after",(this.selectedIndex>-1||f)&&w&&(r.parentItem=t.extend({},s[this.addRowIndex]),r.parentUniqueID=r.parentItem.uniqueID,delete r.parentItem.childRecords,delete r.parentItem[this.parent.childMapping]);var C=c(s[this.addRowIndex]).length,b=s[this.addRowIndex].index;this.selectedIndex>=0&&(r.level=l+1),d=C>0?b+C:b,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)||I(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&&w&&(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)||I(o,r.parentItem,"add",this.parent,this.isSelfReference,r))),null!=a&&(this.selectedIndex>-1||f)&&w&&(e.index="before"===a?d:d+1),"Bottom"===this.parent.editSettings.newRowPosition){l=0;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[parseInt(O.toString(),10)].parentItem){u=m(this.parent,M[parseInt(O.toString(),10)].parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var P=u.childRecords.indexOf(M[parseInt(O.toString(),10)]);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("batchSave",{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.getDataRows().length&&this.updateIndex(this.parent.grid.dataSource,this.parent.getDataRows(),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}(),Fe=function(){function e(e){i.Grid.Inject(i.CommandColumn),this.parent=e}return e.prototype.getModuleName=function(){return"commandColumn"},e.prototype.destroy=function(){},e}(),je=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[parseInt(r.toString(),10)].getElementsByClassName("e-detailrowcollapse"),o=this.parent.grid.getRowObjectFromUID(e[parseInt(r.toString(),10)].getAttribute("data-Uid")),a=i.getObject("parentItem",this.parent.grid.getCurrentViewRecords()[parseInt(r.toString(),10)]);(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[parseInt(t.toString(),10)].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[parseInt(o.toString(),10)].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}(),_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)}}(),He=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 _e(r,e),r.prototype.getModelGenerator=function(){return new Pe(this.parent)},r.prototype.getRowByIndex=function(e){return this.parent.enableVirtualization&&this.parent.isFrozenGrid()?this.getRowCollection(e,!0):this.parent.getDataRows().filter(function(t){return parseInt(t.getAttribute("data-rowindex"),10)===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("data-rowindex"),10),o=this.parent.getDataRows(),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()[parseInt(e.toString(),10)].data:a:e<=this.parent.frozenRows?o[parseInt(e.toString(),10)]:o[e-n+this.parent.frozenRows]),a},r.prototype.addEventListener=function(){this.parent.on("virtual-action-args",this.virtualOtherAction,this),this.parent.on("index-modifier",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||"delete"===e.requestType&&this.endIndex>e.count-this.parent.pageSettings.pageSize)&&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),this.endIndex-this.startIndex!==this.parent.pageSettings.pageSize&&this.totalRecords>this.parent.pageSettings.pageSize&&this.endIndex===this.totalRecords?(e.startIndex=this.endIndex-this.parent.pageSettings.pageSize,e.endIndex=this.endIndex):(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("actionComplete",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 Ge(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(){if(this.parent.getRows().length&&!t.isNullOrUndefined(this.parent.getRowByIndex(0))&&!this.initialRowTop){var i=this.parent.getRowByIndex(0).getBoundingClientRect().top,r=this.parent.element.getBoundingClientRect().top;this.initialRowTop=i>0?this.parent.getRowByIndex(0).getBoundingClientRect().top-r: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),this.parent.notify("virtualTransform",{requestType:"transformChange"})},r.prototype.toSelectVirtualRow=function(i){if(!this.parent.isEdit){t.isNullOrUndefined(this.observer.containerRect)&&(this.observer.containerRect=this.observers.containerRect),(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[parseInt(t.toString(),10)]));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()[parseInt(i.toString(),10)];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.enableVirtualMaskRow||e.parent.showSpinner(),e.parent.enableVirtualMaskRow&&!e.preventEvent&&setTimeout(function(){e.parent.showMaskRow(r.axis),e.parent.notify("showGanttShimmer",{requestType:"showShimmer"})},0);var d=e.content.getBoundingClientRect().height,l=e.prevInfo.offsets?e.prevInfo.offsets.top:null,p="X"===r.axis,h=e.getColumnOffset(p?e.vgenerator.getColumnIndexes()[0]-1:e.prevInfo.columnIndexes[0]-1);if(p){var c=Object.keys(e.vgenerator.cOffsets).length-e.prevInfo.columnIndexes.length,u=e.vgenerator.cOffsets[c-1];h=h>u?u:h}var g=e.getTranslateY(o.top,d,p&&l===o.top?e.prevInfo:void 0,!0);if(!e.parent.isFrozenGrid()||e.parent.enableVirtualMaskRow){if(e.parent.enableVirtualMaskRow){var f=o.top-e.translateY<0;g=Math.round(e.translateY)>g&&!f?Math.round(e.translateY):g,e.virtualEle.adjustTable(h,g)}else e.virtualEle.adjustTable(h,e.translateY);e.parent.enableColumnVirtualization&&e.header.virtualEle.adjustTable(h,0)}}}},r.prototype.scrollListeners=function(e){this.scrollAfterEdit();var i=e.sentinel,r=this.parent.getRowHeight(),o=this.parent.pageSettings.pageSize-Math.ceil(this.parent.pageSettings.pageSize/2),a=this.parent.getContent().querySelector(".e-content"),d=o*r,l=e.offset.top-this.translateY<=0,p=Math.ceil(e.offset.top-this.translateY)+r>=d,h=this.parent.currentViewData;if(l&&"right"!==e.direction&&"left"!==e.direction){var c=+(this.parent.height.toString().indexOf("%")<0?parseInt(this.parent.height.toString(),10):this.parent.element.getBoundingClientRect().height),u=~~(a.scrollTop/r)+Math.ceil(c/r)-this.parent.pageSettings.pageSize;if(u=u>0?u:0,!t.isNullOrUndefined(this.selectedRowIndex)&&-1!==this.selectedRowIndex&&u!==this.selectedRowIndex&&this.parent.rowHeight*this.parent.pageSettings.pageSize<a.scrollTop&&(u=this.selectedRowIndex),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.parent.selectionModule.isRowSelected&&(this.startIndex=h[0].index-this.parent.pageSettings.pageSize/2,this.endIndex=this.startIndex+this.parent.pageSettings.pageSize);var m=Math.ceil(e.offset.top/r);m%=this.parent.pageSettings.pageSize;var y=0;t.isNullOrUndefined(this.parent.getRows()[parseInt(m.toString(),10)])||t.isNullOrUndefined(this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)])||(y=+this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)].querySelector("td").getAttribute("index")),0===y?this.translateY=e.offset.top-o*r>0?e.offset.top-o*this.parent.getRowHeight()+r:0:this.parent.getFrozenColumns()>0?(e.offset.top=e.offset.top+80,this.translateY=e.offset.top-o*r>0?e.offset.top-o*r+10:0):this.translateY=e.offset.top-o*r>0?e.offset.top-o*r+10:0}else if(p&&"right"!==e.direction&&"left"!==e.direction){var S=~~(a.scrollTop/r),v=!(this.selectedRowIndex+this.parent.pageSettings.pageSize<this.totalRecords);t.isNullOrUndefined(this.selectedRowIndex)||-1===this.selectedRowIndex||S===this.selectedRowIndex||v||(S=this.selectedRowIndex);var w=S+this.parent.pageSettings.pageSize;w>this.totalRecords&&(w=S+(this.totalRecords-S)),this.startIndex=!v||t.isNullOrUndefined(this.selectedRowIndex)?w-this.parent.pageSettings.pageSize:S,this.endIndex=w,S+this.parent.pageSettings.pageSize>this.totalRecords&&this.endIndex-this.startIndex<this.parent.pageSettings.pageSize/2&&this.endIndex-S<this.parent.pageSettings.pageSize/2&&(this.startIndex=w-this.parent.pageSettings.pageSize/2),h.length&&this.startIndex>h[0].index&&this.startIndex-h[0].index<this.parent.pageSettings.pageSize/2&&this.parent.selectionModule.isRowSelected&&(this.startIndex=h[0].index+this.parent.pageSettings.pageSize/2),e.offset.top>r*this.totalRecords?this.translateY=this.getTranslateY(e.offset.top,a.getBoundingClientRect().height):this.totalRecords===this.endIndex?this.translateY=this.totalRecords*r-(this.endIndex-this.startIndex)*r:this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*r:this.parent.getFrozenColumns()>0?this.translateY=e.offset.top-(2*r+this.parent.pageSettings.pageSize):this.translateY=e.offset.top}if(p&&e.offset.top<r*this.totalRecords||l||"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&&(p||l)||s(this.parent)){var I=this.currentInfo=t.getValue("getInfoFromView",this).apply(this,[e.direction,i,e.offset]);this.previousInfo=I,this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization?I.columnIndexes:[]);var R=I.loadNext&&!I.loadSelf?I.nextInfo.page:I.page;this.parent.setProperties({pageSettings:{currentPage:R}},!0),p&&this.endIndex===this.totalRecords&&I.loadNext&&(I.loadNext=!1),this.requestType="virtualscroll","right"!==e.direction&&"left"!==e.direction&&(I.event="refresh-virtual-block"===I.event?"model-changed":I.event),this.parent.enableVirtualMaskRow&&(this.parent.showMaskRow(i.axis),this.parent.addShimmerEffect(),this.parent.notify("showGanttShimmer",{requestType:"showShimmer"})),this.parent.notify(I.event,{requestType:"virtualscroll",virtualInfo:I,focusElement:e.focusElement})}else this.parent.enableVirtualMaskRow&&(this.parent.removeMaskRow(),this.parent.notify("removeGanttShimmer",{requestType:"hideShimmer"}))},r.prototype.appendContent=function(i,r,o){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),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);else{var a=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,d=a.columnIndexes[0]-1,l=this.getColumnOffset(d),p=void 0;if(this.parent.enableColumnVirtualization){this.header.virtualEle.adjustTable(l,0);var h=a.columnIndexes;p=this.getColumnOffset(h[h.length-1])-this.getColumnOffset(h[0]-1)+"",this.header.virtualEle.setWrapperWidth(p)}this.virtualEle.setWrapperWidth(p,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(l,this.translateY)),t.setValue("prevInfo",this.previousInfo?this.previousInfo:a,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("virtual-action-args",this.virtualOtherAction),this.parent.off("index-modifier",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),Ge=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 _e(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="chrome"===t.Browser.info.name?200:100,d=t.debounce(e,a),l=t.debounce(e,50);return this.options.prevTop=this.options.prevLeft=0,function(t){var a=o.options.movableContainer?o.options.container.scrollTop:t.target.scrollTop,p=o.options.movableContainer?o.options.scrollbar.scrollLeft:t.target.scrollLeft,h=o.options.prevTop<a?"down":"up";h=o.options.prevLeft===p?h:o.options.prevLeft<p?"right":"left",o.options.prevTop=a,o.options.prevLeft=p;var c=o.sentinelInfo[""+h],u=0;if(o.newPos=a,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.options.axes.indexOf(c.axis)){o.containerRect=o.options.container.getBoundingClientRect();var g=o.check(h);if(c.entered&&("X"===c.axis||r.enableVirtualMaskRow)&&(!o.movableEle||"right"!==h&&"left"!==h?i(o.element,c,h,{top:a,left:p},o.fromWheel,g):i(o.movableEle,c,h,{top:a,left:p},o.fromWheel,g)),g){var f=l;"X"===c.axis?f({direction:h,sentinel:c,offset:{top:a,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)||r.enableVirtualMaskRow?(f=r.enableVirtualMaskRow?d:f)({direction:h,sentinel:c,offset:{top:a,left:p},focusElement:document.activeElement}):e({direction:h,sentinel:c,offset:{top:a,left:p},focusElement:document.activeElement})}o.fromWheel=!1}}},i}(i.InterSectionObserver),Qe=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)}}(),Ke=function(){function e(e){this.prevstartIndex=-1,this.prevendIndex=-1,this.parent=e,i.Grid.Inject(We),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("localPagedExpandCollapse",this.collapseExpandVirtualchilds,this),this.parent.on("pagingActions",this.virtualPageAction,this),this.parent.on("destroy",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("localPagedExpandCollapse",this.collapseExpandVirtualchilds),this.parent.off("pagingActions",this.virtualPageAction),this.parent.off("destroy",this.destroy))},e.prototype.collapseExpandVirtualchilds=function(e){this.parent.grid.notify("virtual-action-args",{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 r=this,o=new n.DataManager(e.result),a=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),s=o.executeLocal((new n.Query).where(a)).filter(function(e){return h(r.parent,e)});this.visualData=s,e.count=s.length,this.parent.grid.notify("data-listener",{data:s});var d={startIndex:-1,endIndex:-1,count:e.count,requestType:e.actionArgs.requestType};this.parent.grid.notify("index-modifier",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),o.dataSource.json=s,e.result=o.executeLocal(c)}else{var f=e.actionArgs.requestType;("filtering"===f||"collapseAll"===f||"searching"===f||"refresh"===f&&this.parent.enableCollapseAll&&p>s.length&&t.isNullOrUndefined(this.expandCollapseRec))&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.getContent().firstElementChild.scrollTop=0,this.parent.grid.notify("virtual-action-args",{setTop:!0})),("save"===f&&e.actionArgs.index>=d.count-this.parent.grid.pageSettings.pageSize||"refresh"===f&&this.parent.isGantt&&this.parent.isAddedFromGantt)&&((d.endIndex+this.parent.pageSettings.pageSize>=d.count&&this.parent.root&&d.count-d.endIndex==this.visualData.length-this.parent.root.previousFlatData.length||!this.parent.isGantt||!this.parent.isAddedFromGantt)&&(l=d.startIndex+(d.count-d.endIndex),p=d.count),this.parent.isAddedFromGantt=!1);var m=this.parent.grid.contentModule.virtualEle.wrapper,y=i.getTransformValues(m).height;if(!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&&0===y&&(l=0),!t.isNullOrUndefined(this.expandCollapseRec)){var S=this.parent.getRows(),v=s.indexOf(this.expandCollapseRec);s.slice(v,v+S.length).length<S.length&&v>=0&&0!==l?(l=v=(v=s.length-S.length)>0?v:0,p=s.length):t.getValue("isCollapseAll",this.parent)&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify("virtual-action-args",{setTop:!0}))}"collapseAll"===this.prevrequestType&&"virtualscroll"===e.actionArgs.requestType&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify("virtual-action-args",{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,0===p&&s.length>0?e.result=s:e.result=s.slice(l,p),this.prevstartIndex=l,this.prevendIndex=p,this.prevrequestType=e.actionArgs.requestType}this.parent.notify("updateAction",e)},e.prototype.destroy=function(){this.removeEventListener()},e}(),We=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 Qe(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.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 He(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?parseInt(e.height.toString(),10):e.element.getBoundingClientRect().height)/i),n=e.pageSettings.pageSize;e.setProperties({pageSettings:{pageSize:n<r?r:n}},!0)},r}(i.VirtualScroll),Ye=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)},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))},e.prototype.rowExpandCollapse=function(e){var i,r,n=this.parent.getDataRows(),o=this.parent.getRows(),a=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;a&&(r=this.parent.getRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))})),i=e.detailrows.length?e.detailrows:n.filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))});for(var s=0;s<i.length;s++){var d=i[parseInt(s.toString(),10)],l=this.parent.grid.getRowObjectFromUID(d.getAttribute("data-Uid")).data;!t.isNullOrUndefined(n)&&d.parentElement.firstElementChild.clientHeight>0&&(d.style.height=d.parentElement.firstElementChild.clientHeight+"px"),d.style.display=e.action,a&&r.length&&(r[parseInt(s.toString(),10)].style.display=e.action);var p="none"===e.action?".e-treecolumn-container .e-treegridcollapse":".e-treecolumn-container .e-treegridexpand";if(o[d.rowIndex].querySelector(p)){for(var h=[],c=0;c<n.length;c++)n[parseInt(c.toString(),10)].querySelector(".e-gridrowindex"+l.index+"level"+(l.level+1))&&h.push(n[parseInt(c.toString(),10)]);if(h.length){var u=this.parent.getCurrentViewRecords()[h[0].rowIndex];this.rowExpandCollapse({detailrows:h,action:e.action,record:u})}}}},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.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}(),Je=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}(),Xe=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("pagingActions",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)},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("pagingActions",this.infinitePageAction),this.parent.grid.off("infinite-crud-cancel",this.createRows),this.parent.grid.off("content-ready",this.contentready))},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[parseInt(p.toString(),10)],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[parseInt(p.toString(),10)]):o[e.index+p+1][""+a](l[parseInt(p.toString(),10)]),o.splice(e.index+1+p,0,l[parseInt(p.toString(),10)]);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.getDataRows(),this.parent.getCurrentViewRecords())}},e.prototype.infinitePageAction=function(e){var i=new n.DataManager(e.result),r=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),o=i.executeLocal((new n.Query).where(r)),a=t.getValue("actionArgs",e.actionArgs),s=t.getValue("actions",this.parent.grid.infiniteScrollModule);this.parent.grid.infiniteScrollModule.isInitialRender&&!this.parent.initialRender&&(this.parent.grid.pageSettings.currentPage=1);var d=!!s.some(function(e){return e===a.requestType})||!!this.parent.initialRender;if(this.visualData=o,e.count=o.length,t.getValue("isPrinting",e.actionArgs))e.result=o;else{var l=new n.Query,p=this.parent.infiniteScrollSettings.enableCache;p&&this.parent.infiniteScrollSettings.initialBlocks>this.parent.infiniteScrollSettings.maxBlocks&&(this.parent.infiniteScrollSettings.initialBlocks=this.parent.infiniteScrollSettings.maxBlocks);var h=d?this.parent.grid.pageSettings.pageSize*this.parent.infiniteScrollSettings.initialBlocks:this.parent.grid.pageSettings.pageSize,c=this.parent.grid.pageSettings.currentPage;if(t.isNullOrUndefined(a))l=l.page(c,h);else{var u=t.getValue("lastIndex",this.parent.grid.infiniteScrollModule),g=t.getValue("firstIndex",this.parent.grid.infiniteScrollModule);if(p||"delete"!==a.requestType)l=p&&"delete"===a.requestType||"save"===a.requestType&&"add"===a.action?(l=l.skip(g)).take(this.parent.infiniteScrollSettings.initialBlocks*this.parent.pageSettings.pageSize):l.page(c,h);else{var f=u-a.data.length+1,m=a.data.length;l=l.skip(f).take(m)}}i.dataSource.json=o,p||t.isNullOrUndefined(a)||"save"!==a.requestType||"add"!==a.action?e.result=i.executeLocal(l):e.result=[a.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[parseInt(r.toString(),10)])},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.getRowsObject(),a=this.parent.grid.getRows();this.removeRows(a,o,r,n)}}},e.prototype.removeRows=function(e,i,r,n,o){for(var a=this,s=0;s<r.length;s++)!function(s){i.filter(function(d,l){if(d.data[""+n]===r[parseInt(s.toString(),10)][""+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[parseInt(l.toString(),10)]),e.splice(l,1)}})}(s)},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.getRows():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.getContent().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.getHeaderContent().querySelector("tbody"):e.isFrozenRight?this.parent.element.querySelector(".e-frozen-right-header").querySelector("tbody"):this.parent.grid.getHeaderContent().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[parseInt(u.toString(),10)],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[parseInt(h.toString(),10)]).length,"Child"===this.parent.editSettings.newRowPosition&&(h-=1),l[parseInt(h.toString(),10)][""+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}();return Ie.Inject(Ee,Ue,Te,Re,ke,qe,xe,Ve,Ae,Ne,Fe,Be,Le,Q,Ke,je,Ce,Ye,Je,F,Xe),e.Aggregate=qe,e.AggregateColumn=se,e.AggregateRow=de,e.Column=C,e.ColumnChooser=Je,e.ColumnMenu=Ve,e.CommandColumn=Fe,e.ContextMenu=Be,e.DataManipulation=te,e.DetailRow=je,e.Edit=Le,e.EditSettings=he,e.ExcelExport=Ae,e.Filter=Ee,e.FilterSettings=U,e.Freeze=Ye,e.InfiniteScroll=Xe,e.InfiniteScrollSettings=Se,e.LoadingIndicator=P,e.Logger=F,e.Page=Ue,e.PageSettings=ne,e.PdfExport=Ne,e.Predicate=N,e.Render=ee,e.Reorder=Re,e.Resize=xe,e.RowDD=Ce,e.RowDropSettings=Me,e.SearchSettings=J,e.Selection=Q,e.SelectionSettings=Z,e.Sort=Te,e.SortDescriptor=ge,e.SortSettings=fe,e.StackedColumn=D,e.Toolbar=ke,e.TreeClipboard=G,e.TreeGrid=Ie,e.TreeGridColumn=b,e.TreeVirtual=We,e.TreeVirtualRowModelGenerator=Pe,e.VirtualScroll=Ke,e.actionBegin="actionBegin",e.actionComplete="actionComplete",e.actionFailure=_,e.ariaColIndex="aria-colindex",e.ariaRowIndex="aria-rowindex",e.autoCol="auto-col",e.batchAdd="batchAdd",e.batchCancel="batchCancel",e.batchDelete="batchDelete",e.batchEditFormRendered="batcheditform-rendered",e.batchSave="batchSave",e.beforeBatchAdd="beforeBatchAdd",e.beforeBatchCancel="before-batch-cancel",e.beforeBatchDelete="beforeBatchDelete",e.beforeBatchSave="beforeBatchSave",e.beforeCopy="beforeCopy",e.beforeDataBound="beforeDataBound",e.beforeExcelExport="beforeExcelExport",e.beforePaste="beforePaste",e.beforePdfExport="beforePdfExport",e.beforeStartEdit="edit-form",e.beginAdd="beginAdd",e.beginEdit="beginEdit",e.cellEdit="cellEdit",e.cellSave="cellSave",e.cellSaved="cellSaved",e.checkboxChange="checkboxChange",e.collapsed="collapsed",e.collapsing="collapsing",e.content="e-content",e.contextMenuClick="contextMenuClick",e.contextMenuOpen="contextMenuOpen",e.crudAction="crudAction",e.dataBound="dataBound",e.dataColIndex="data-colindex",e.dataListener="data-listener",e.dataRowIndex="data-rowindex",e.dataStateChange="dataStateChange",e.destroy="destroy",e.detailDataBound="detailDataBound",e.doubleTap="double-tap",e.expanded="expanded",e.expanding="expanding",e.extendArray=g,e.findChildrenRecords=c,e.findParentRecords=p,e.frozenContent="e-frozencontent",e.frozenHeader="e-frozenheader",e.frozenLeft="frozen-left",e.frozenRight="frozen-right",e.getExpandStatus=h,e.getParentData=m,e.getPlainData=f,e.headerContent="e-headercontent",e.indexModifier="index-modifier",e.isCheckboxcolumn=d,e.isCountRequired=s,e.isFilterChildHierarchy=l,e.isHidden=y,e.isOffline=u,e.isRemoteData=a,e.keyPressed="key-pressed",e.leftRight="Left-Right",e.load="load",e.localPagedExpandCollapse="localPagedExpandCollapse",e.movableContent="e-movablecontent",e.movableHeader="e-movableheader",e.pagingActions="pagingActions",e.printGridInit="printGrid-Init",e.queryCellInfo="queryCellInfo",e.recordDoubleClick="recordDoubleClick",e.remoteExpand="remoteExpand",e.resizeStop="resizeStop",e.rowDataBound="rowDataBound",e.rowDeselected="rowDeselected",e.rowDeselecting="rowDeselecting",e.rowDrag="rowDrag",e.rowDragStart="rowDragStart",e.rowDragStartHelper="rowDragStartHelper",e.rowDrop="rowDrop",e.rowDropped="row-dropped",e.rowSelected="rowSelected",e.rowSelecting="rowSelecting",e.rowdraging="row-draging",e.rowsAdd="rows-add",e.rowsRemove="rows-remove",e.savePreviousRowPosition="savePreviousRowPosition",e.table="e-table",e.toolbarClick="toolbarClick",e.treeGridDetails=j,e.updateData="update-data",e.virtualActionArgs="virtual-action-args",e.virtualColumnIndex="virtualColumnIndex",e}({},ej.base,ej.grids,ej.buttons,ej.data,ej.popups),this.ejs=ej;
|
|
10
|
+
this.ej=this.ej||{},this.ej.treegrid=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[parseInt(t.toString(),10)].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[parseInt(r.toString(),10)])&&t.push(e[parseInt(r.toString(),10)]);return t}function h(e,i,r){var n,o=t.isNullOrUndefined(i.parentItem)?null:m(e,i.parentItem.uniqueID);return null==o||(!e.initialRender||t.isNullOrUndefined(o[e.expandStateMapping])||o[e.expandStateMapping]?!1!==o.expanded&&(!o.parentItem||(n=m(e,o.parentItem.uniqueID),n&&e.initialRender&&!t.isNullOrUndefined(n[e.expandStateMapping])&&!n[e.expandStateMapping]?(n.expanded=!1,!1):(!n||!1!==n.expanded)&&(!n||h(e,n)))):(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[parseInt(n.toString(),10)]),(r[parseInt(n.toString(),10)].hasChildRecords||!t.isNullOrUndefined(r[parseInt(n.toString(),10)].childRecords)&&r[parseInt(n.toString(),10)].childRecords.length)&&(i=i.concat(c(r[parseInt(n.toString(),10)])));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[parseInt(n.toString(),10)]),t={};for(var o=0;o<i.length;o++)t[i[parseInt(o.toString(),10)]]=e[parseInt(n.toString(),10)][i[parseInt(o.toString(),10)]];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 m(e,t,i){if(i){return e.uniqueIDFilterCollection[""+t]}return e.uniqueIDCollection[""+t]}function y(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}function S(e,i,r,o,a,s,d){var l,p,h,c=e.value,u=e.action,f=i.grid.getPrimaryKeyFieldNames()[0],y=i.dataSource instanceof n.DataManager?i.dataSource.dataSource.json:i.dataSource,S=[],R=c,x=!1;if("Batch"===i.editSettings.mode&&(h=i.grid.editModule.getBatchChanges()),"add"===u||"batchsave"===u&&"Batch"===i.editSettings.mode&&h.addedRecords.length){var C=v(e,y,i,r,o,a,d);c=C.value,x=C.isSkip}if(c instanceof Array?S=g(c):S.push(t.extend({},c)),!x&&("add"!==u||"Top"!==i.editSettings.newRowPosition&&"Bottom"!==i.editSettings.newRowPosition))for(var b=0;b<S.length;b++){"object"==typeof S[parseInt(b.toString(),10)][""+f]&&(S[parseInt(b.toString(),10)]=S[parseInt(b.toString(),10)][""+f]);var D=S[parseInt(b.toString(),10)].taskData?Object.keys(S[parseInt(b.toString(),10)].taskData):Object.keys(S[parseInt(b.toString(),10)]);l=y.length;for(;l--&&l>=0&&"break"!==function(){if(y[parseInt(l.toString(),10)][""+f]===S[parseInt(b.toString(),10)][""+f]){if("delete"!==u){if("edit"===u){for(p=0;p<D.length;p++)if(Object.prototype.hasOwnProperty.call(y[parseInt(l.toString(),10)],D[parseInt(p.toString(),10)])&&("Cell"!==i.editSettings.mode||!t.isNullOrUndefined(h)&&0===h.changedRecords.length||D[parseInt(p.toString(),10)]===s)){var e=m(i,S[parseInt(b.toString(),10)].uniqueID);y[parseInt(l.toString(),10)][D[parseInt(p.toString(),10)]]=S[parseInt(b.toString(),10)][D[parseInt(p.toString(),10)]],e&&e.taskData&&(e.taskData[D[parseInt(p.toString(),10)]]=e[D[parseInt(p.toString(),10)]]=y[parseInt(l.toString(),10)][D[parseInt(p.toString(),10)]])}}else if("add"===u||"batchsave"===u){var n=void 0;"Child"===i.editSettings.newRowPosition?r?(R.taskData[""+i.parentIdMapping]=y[parseInt(l.toString(),10)][""+i.idMapping],y.splice(l+1,0,R.taskData)):(Object.prototype.hasOwnProperty.call(y[parseInt(l.toString(),10)],i.childMapping)||(y[parseInt(l.toString(),10)][""+i.childMapping]=[]),y[parseInt(l.toString(),10)][""+i.childMapping].push(R.taskData),I(f,y[parseInt(l.toString(),10)],u,i,r,R)):"Below"===i.editSettings.newRowPosition?(y.splice(l+1,0,R.taskData),t.isNullOrUndefined(R.parentItem)||I(f,y[l+1],u,i,r,R)):o?"Above"===i.editSettings.newRowPosition&&(y.splice(l,0,R.taskData),t.isNullOrUndefined(R.parentItem)||I(f,y[parseInt(l.toString(),10)],u,i,r,R)):(n=0,y.splice(n,0,R.taskData))}return"break"}var a=y[parseInt(l.toString(),10)];if(y.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[parseInt(g.toString(),10)][""+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,I(f,d,u,i,r));break}return"break"}}else t.isNullOrUndefined(y[parseInt(l.toString(),10)][""+i.childMapping])||w(y[parseInt(l.toString(),10)][""+i.childMapping],S[parseInt(b.toString(),10)],u,f,i,r,R,s)&&I(f,y[parseInt(l.toString(),10)],u,i,r)}(););}}function v(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=f(t.isNullOrUndefined(s)?d=t.extend({},p[o+1]):d=t.extend({},s));break;case"Below":case"Child":if(t.isNullOrUndefined(s)){var h=r.grid.getPrimaryKeyFieldNames()[0],c=p[parseInt(o.toString(),10)];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}}function w(e,i,r,n,o,a,s,d){for(var l=!1,p=e.length;p--&&p>=0;)if(e[parseInt(p.toString(),10)][""+n]===i[""+n]||a&&e[parseInt(p.toString(),10)][o.parentIdMapping]===i[o.idMapping]){if("edit"===r){for(var h=Object.keys(i),c=m(o,i.uniqueID),u=0;u<h.length;u++)if(Object.prototype.hasOwnProperty.call(e[parseInt(p.toString(),10)],h[parseInt(u.toString(),10)])&&("Cell"!==o.editSettings.mode||h[parseInt(u.toString(),10)]===d)&&(c[h[parseInt(u.toString(),10)]]=c.taskData[h[parseInt(u.toString(),10)]]=e[parseInt(p.toString(),10)][h[parseInt(u.toString(),10)]]=i[h[parseInt(u.toString(),10)]],"Normal"===o.grid.editSettings.mode&&"Cell"===o.editSettings.mode&&!t.isNullOrUndefined(o.grid.editModule))){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[parseInt(p.toString(),10)][o.idMapping],e.splice(p+1,0,s),I(n,e[parseInt(p.toString(),10)],r,o,a,s)):(Object.prototype.hasOwnProperty.call(e[parseInt(p.toString(),10)],o.childMapping)||(e[parseInt(p.toString(),10)][o.childMapping]=[]),e[parseInt(p.toString(),10)][o.childMapping].push(s.taskData),I(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Above"===o.editSettings.newRowPosition?(e.splice(p,0,s.taskData),t.isNullOrUndefined(s.parentItem)||I(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Below"===o.editSettings.newRowPosition&&(e.splice(p+1,0,s.taskData),t.isNullOrUndefined(s.parentItem)||I(n,e[parseInt(p.toString(),10)],r,o,a,s)):(e.splice(p,1),e.length||(l=!0))}else t.isNullOrUndefined(e[parseInt(p.toString(),10)][o.childMapping])||w(e[parseInt(p.toString(),10)][o.childMapping],i,r,n,o,a,s,d)&&I(n,e[parseInt(p.toString(),10)],r,o,a);return l}function I(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){if(t[""+e]===i[""+e])return void(d=r)}),o.enableVirtualization&&t.isNullOrUndefined(d)){var p=t.getValue("uniqueIDCollection."+s.parentUniqueID,o);i=p}if(t.isNullOrUndefined(d)||(i=l[parseInt(d.toString(),10)]),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[parseInt(g.toString(),10)][""+c]===i[""+c]){u[parseInt(g.toString(),10)]=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 y=void 0;if((o.frozenRows||o.getFrozenColumns())&&(y=o.getRowByIndex(d)),!o.enableVirtualization&&!t.isNullOrUndefined(f)||!t.isNullOrUndefined(y)){var S=o.treeColumnIndex;o.allowRowDragAndDrop&&o.enableImmutableMode&&(S+=1),o.renderModule.cellRender({data:i,cell:f.cells[parseInt(S.toString(),10)]?f.cells[parseInt(S.toString(),10)]:y.cells[S-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 m(o,s.parentItem.uniqueID).childRecords.push(s)}var R=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)}}(),x=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},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[parseInt(i.toString(),10)]]=e[t[parseInt(i.toString(),10)]],this.parent&&this.parent.isReact&&"template"===t[parseInt(i.toString(),10)]){this.parent.clipboardModule.treeGridParent.renderModule.refreshReactColumnTemplateByUid(this.uid)}},e}(),b=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return R(i,e),x([t.Property(null)],i.prototype,"columns",void 0),i}(C),D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return R(t,e),t}(b),M=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)}}(),O=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},P=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return M(i,e),O([t.Property("Spinner")],i.prototype,"indicatorType",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)}}(),A=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},N=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return E(i,e),A([t.Property()],i.prototype,"field",void 0),A([t.Property()],i.prototype,"operator",void 0),A([t.Property()],i.prototype,"value",void 0),A([t.Property()],i.prototype,"matchCase",void 0),A([t.Property()],i.prototype,"ignoreAccent",void 0),A([t.Property()],i.prototype,"predicate",void 0),A([t.Property({})],i.prototype,"actualFilterValue",void 0),A([t.Property({})],i.prototype,"actualOperator",void 0),A([t.Property()],i.prototype,"type",void 0),A([t.Property()],i.prototype,"ejpredicate",void 0),A([t.Property()],i.prototype,"uid",void 0),A([t.Property()],i.prototype,"isForeignKey",void 0),i}(t.ChildProperty),U=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return E(i,e),A([t.Collection([],N)],i.prototype,"columns",void 0),A([t.Property("FilterBar")],i.prototype,"type",void 0),A([t.Property()],i.prototype,"mode",void 0),A([t.Property(!0)],i.prototype,"showFilterBarStatus",void 0),A([t.Property(1500)],i.prototype,"immediateModeDelay",void 0),A([t.Property()],i.prototype,"operators",void 0),A([t.Property(!1)],i.prototype,"ignoreAccent",void 0),A([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),k=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)}}(),q=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},T=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return k(i,e),q([t.Property("Both")],i.prototype,"wrapMode",void 0),i}(t.ChildProperty),V=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="https://ej2.syncfusion.com/documentation/treegrid",z="https://ej2.syncfusion.com/documentation",L=!1,F=function(e){function r(t){return i.Grid.Inject(i.Logger),e.call(this,t)||this}return V(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[parseInt(o.toString(),10)]],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",""),L&&"primary_column_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace("Editing","Row DragAndDrop"),L=!1);var l=d.indexOf("https"),p=d.substring(l);"module_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/modules"):"primary_column_missing"===n[parseInt(o.toString(),10)]||"selection_key_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,z+"/api/treegrid/column/#isprimarykey"):"grid_remote_edit"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/edit"):"virtual_height"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/virtual"):"check_datasource_columns"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/columns"):"locale_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace(p,B+"/global-local/#localization")),"datasource_syntax_mismatch"===n[parseInt(o.toString(),10)]?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&&(L=!0,this.log("primary_column_missing",t));for(var n=0;n<r.length;n++){var o=j[r[parseInt(n.toString(),10)]],a=o.check(t,i);if(a.success){var s=o.generateMessage(t,i,a.options);console[o.logType](s)}}},r}(i.Logger),j={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"+z+"/api/treegrid#childmapping\n"+z+"/api/treegrid#idmapping\n"+z+"/api/treegrid#$parentidmapping"}}},_="actionFailure",H=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)}}(),G=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 H(i,e),i.prototype.setCopyData=function(i){var r=this.treeGridParent.getCurrentViewRecords();if(""===window.getSelection().toString()){this.clipBoardTextArea.value=this.copyContent="";var n=this.treeGridParent.grid.getRows();if("Cell"!==this.treeGridParent.selectionSettings.mode){for(var o=this.treeGridParent.getSelectedRowIndexes().sort(function(e,t){return e-t}),a=0;a<o.length;a++)if(a>0&&(this.treeCopyContent+="\n"),!n[o[parseInt(a.toString(),10)]].classList.contains("e-summaryrow")){var s=[].slice.call(n[o[parseInt(a.toString(),10)]].querySelectorAll(".e-rowcell")),d=this.treeGridParent.getSelectedRecords()[parseInt(a.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(d)&&("Parent"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.parentContentData(r,o[parseInt(a.toString(),10)],n,i,a),this.getCopyData(s,!1,"\t",i),this.treeCopyContent+=this.copyContent,this.copiedUniqueIdCollection.push(d),this.copyContent="","Child"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.childContentData(r,o[parseInt(a.toString(),10)],n,i))}if(i){for(var l=[],a=0;a<this.treeGridParent.getVisibleColumns().length;a++)l[parseInt(a.toString(),10)]=this.treeGridParent.getVisibleColumns()[parseInt(a.toString(),10)].headerText;this.getCopyData(l,!1,"\t",i),this.treeCopyContent=this.copyContent+"\n"+this.treeCopyContent}var p={data:this.treeCopyContent,cancel:!1};if(this.treeGridParent.trigger("beforeCopy",p),p.cancel)return;this.clipBoardTextArea.value=this.copyContent=p.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){if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem))for(var a=e[parseInt(i.toString(),10)].parentItem.level,s=0;s<a+1;s++)for(var d=0;d<e.length;d++)if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem)&&e[parseInt(d.toString(),10)].uniqueID===e[parseInt(i.toString(),10)].parentItem.uniqueID){i=d;var l=[].slice.call(r[parseInt(i.toString(),10)].querySelectorAll(".e-rowcell")),p=e[parseInt(d.toString(),10)].uniqueID;if(-1===this.copiedUniqueIdCollection.indexOf(p)){this.getCopyData(l,!1,"\t",n),this.treeCopyContent=o>0?this.treeCopyContent+this.copyContent+"\n":this.copyContent+"\n"+this.treeCopyContent,this.copiedUniqueIdCollection.push(p),this.copyContent="";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){if(e[parseInt(i.toString(),10)].hasChildRecords)for(var o=e[parseInt(i.toString(),10)].childRecords,a=0;a<o.length;a++)for(var s=0;s<e.length;s++)if(!t.isNullOrUndefined(o[parseInt(a.toString(),10)].uniqueID)&&e[parseInt(s.toString(),10)].uniqueID===o[parseInt(a.toString(),10)].uniqueID){if(!t.isNullOrUndefined(r[parseInt(s.toString(),10)])&&!r[parseInt(s.toString(),10)].classList.contains("e-summaryrow")){var d=[].slice.call(r[parseInt(s.toString(),10)].querySelectorAll(".e-rowcell")),l=e[parseInt(s.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&(this.getCopyData(d,!1,"\t",n),this.treeCopyContent+="\n"+this.copyContent,this.copyContent="",this.copiedUniqueIdCollection.push(l),this.childContentData(e,s,r,n))}break}},i}(i.Clipboard),Q=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 r,n,o=i.getObject("target",e),s=i.parentsUntil(o,"e-checkbox-wrapper");if(s&&s.querySelectorAll(".e-treecheckselect").length>0){n=s.querySelector('input[type="checkbox"]');var d=[];d.push(o.closest("tr").rowIndex),this.selectCheckboxes(d),this.triggerChkChangeEvent(n,n.nextElementSibling.classList.contains("e-check"),o.closest("tr"))}else if(s&&s.querySelectorAll(".e-treeselectall").length>0&&this.parent.autoCheckHierarchy){var l=!s.querySelector(".e-frame").classList.contains("e-check")&&!s.querySelector(".e-frame").classList.contains("e-stop");this.headerSelection(l),n=s.querySelector('input[type="checkbox"]'),this.triggerChkChangeEvent(n,l,o.closest("tr"))}!t.isNullOrUndefined(this.parent.parentQuery)&&this.parent.selectionSettings.persistSelection&&this.parent.columnModel.filter(function(e){return"checkbox"===e.type}).length>0&&a(this.parent)&&this.parent.parentQuery.length>0&&((r=this.parent.query.queries).push.apply(r,this.parent.parentQuery),this.parent.parentQuery=[])},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("checkboxChange",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[parseInt(r.toString(),10)].showCheckbox&&(e=i[parseInt(r.toString(),10)].uid);for(var n=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv").length,o=0;o<n;o++)this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv")[parseInt(o.toString(),10)].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=this.parent.getHeaderContent().querySelectorAll(".e-checkbox-wrapper")[0],o=n.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){if(t.isNullOrUndefined(e)){this.parent.trigger(_,{error:"The provided value for the rowIndexes is undefined. Please ensure the rowIndexes contains number."})}for(var i=0;i<e.length;i++){var r=this.parent.getCurrentViewRecords()[e[parseInt(i.toString(),10)]],n=m(this.parent,r.uniqueID),o="uncheck"===(r=n).checkboxState?"check":"uncheck";r.checkboxState=o;for(var a=Object.keys(r),s=0;s<a.length;s++)Object.prototype.hasOwnProperty.call(n,a[parseInt(s.toString(),10)])&&(n[a[parseInt(s.toString(),10)]]=r[a[parseInt(s.toString(),10)]]);this.traverSelection(r,o,!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[parseInt(a.toString(),10)].isSummaryRow||(o[parseInt(a.toString(),10)].hasChildRecords?this.traverSelection(o[parseInt(a.toString(),10)],i,!0):this.updateSelectedItems(o[parseInt(a.toString(),10)],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=m(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=m(this.parent,r[parseInt(s.toString(),10)].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=!t.isNullOrUndefined(this.parent.filterModule)&&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[parseInt(d.toString(),10)].checkboxState)continue;if(n)continue;s[parseInt(d.toString(),10)].checkboxState="check",this.updateSelectedItems(s[parseInt(d.toString(),10)],s[parseInt(d.toString(),10)].checkboxState)}else this.selectedItems.indexOf(s[parseInt(d.toString(),10)])>-1&&(s[parseInt(d.toString(),10)].checkboxState="uncheck",this.updateSelectedItems(s[parseInt(d.toString(),10)],s[parseInt(d.toString(),10)].checkboxState),this.parent.autoCheckHierarchy&&this.updateParentSelection(s[parseInt(d.toString(),10)]));!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.grid.currentViewData.filter(function(t){return t.uniqueID===e.uniqueID}),a=this.parent.grid.currentViewData.indexOf(o[0]),s=m(this.parent,e.uniqueID),d=this.parent.getRows()[parseInt(a.toString(),10)];if(a>-1){var l=void 0;(this.parent.frozenRows||this.parent.getFrozenColumns())&&(l=this.parent.getDataRows()[parseInt(a.toString(),10)]),n=d.querySelectorAll(".e-hierarchycheckbox .e-frame")[0]?d.querySelectorAll(".e-hierarchycheckbox .e-frame")[0]:l.querySelectorAll(".e-hierarchycheckbox .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||this.parent.allowPaging)&&!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;a>-1&&(t.isNullOrUndefined(n)||(n.classList.add(c),d.querySelector(".e-treecheckselect").setAttribute("aria-checked","check"===i?"true":"uncheck"===i?"false":"mixed")))},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(p=0;p<r;p++)s[parseInt(p.toString(),10)].classList.contains("e-summaryrow")||this.updateSelectedItems(i[parseInt(p.toString(),10)],i[parseInt(p.toString(),10)].checkboxState)}else if("delete"===o||"add"===e.action){var l=[];"delete"===o?l=e.data:l.push(e.data);for(var p=0;p<l.length;p++){if("delete"===o){var h=this.parent.flatData.indexOf(l[parseInt(p.toString(),10)]),u=this.selectedIndexes.indexOf(h);this.selectedIndexes.splice(u,1),this.updateSelectedItems(l[parseInt(p.toString(),10)],"uncheck")}t.isNullOrUndefined(l[parseInt(p.toString(),10)].parentItem)||this.updateParentSelection(l[parseInt(p.toString(),10)].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.filterModule.filteredResult: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[parseInt(r.toString(),10)].hasChildRecords?n.updateParentSelection(i[parseInt(r.toString(),10)]):i[parseInt(r.toString(),10)].hasChildRecords||t.isNullOrUndefined(i[parseInt(r.toString(),10)])||n.updateSelectedItems(i[parseInt(r.toString(),10)],i[parseInt(r.toString(),10)].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}(),K=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("printGrid-Init",this.printTreeGrid,this)},e.prototype.removeEventListener=function(){this.parent.grid.off("printGrid-Init",this.printTreeGrid)},e.prototype.printTreeGrid=function(e){var r=i.getObject("printgrid",e),n=i.getObject("element",e);r.addEventListener("queryCellInfo",this.parent.grid.queryCellInfo),r.addEventListener("rowDataBound",this.parent.grid.rowDataBound),r.addEventListener("beforeDataBound",this.parent.grid.beforeDataBound),t.addClass([n],"e-treegrid")},e.prototype.print=function(){this.parent.grid.print()},e.prototype.destroy=function(){this.removeEventListener()},e}(),W=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)}}(),Y=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},J=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return W(i,e),Y([t.Property()],i.prototype,"fields",void 0),Y([t.Property(!1)],i.prototype,"ignoreCase",void 0),Y([t.Property("contains")],i.prototype,"operator",void 0),Y([t.Property()],i.prototype,"key",void 0),Y([t.Property()],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),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)}}(),$=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},Z=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return X(i,e),$([t.Property("Row")],i.prototype,"mode",void 0),$([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),$([t.Property("Single")],i.prototype,"type",void 0),$([t.Property(!1)],i.prototype,"persistSelection",void 0),$([t.Property("Default")],i.prototype,"checkboxMode",void 0),$([t.Property(!1)],i.prototype,"checkboxOnly",void 0),$([t.Property(!0)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),ee=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()))&&!t.isNullOrUndefined(e.row)){e.row.style.display="none";var o=this.parent.grid.getRowsObject();this.parent.grid.isFrozenGrid()||t.isNullOrUndefined(e.row.getAttribute("data-uid"))||(o.filter(function(t){return t.uid===e.row.getAttribute("data-uid")})[0].visible=!1)}if(a(this.parent)&&!u(this.parent)){var s=this.parent,d=this.parent.getCurrentViewRecords().filter(function(e){return t.getValue(s.idMapping,e)===t.getValue(s.parentIdMapping,r)});if(d.length>0&&!d[0].isSummaryRow&&!t.isNullOrUndefined(e.row)){var p=d[0].expanded?"table-row":"none";e.row.setAttribute("style","display: "+p+";")}}i.getObject("isSummaryRow",e.data)&&t.addClass([e.row],"e-summaryrow"),t.isNullOrUndefined(e.row)||(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")));if(this.parent.rowDragAndDropModule&&this.parent.grid.rowDragAndDropModule&&(this.parent.grid.rowDragAndDropModule.dragStartData||this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.getContentTable().scrollHeight<=this.parent.getContent().clientHeight){this.parent.getVisibleRecords()[this.parent.getVisibleRecords().length-1].uniqueID!==e.data.uniqueID||t.isNullOrUndefined(e.row)||e.row.cells[0].classList.contains("e-lastrowcell")||this.parent.lastRowBorder(e.row,!0)}if(this.parent.isReact){var c=this;c.parent.renderReactTemplates(function(){c.parent.trigger("rowDataBound",e)})}else this.parent.trigger("rowDataBound",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 m=t.isNullOrUndefined(a.hasFilteredChildRecords)?a.hasChildRecords:a.hasFilteredChildRecords;if(m&&!t.isNullOrUndefined(a.childRecords)&&(m=this.parent.isFromGantt&&!this.parent.loadChildOnDemand?a.hasChildRecords:!(0===a.childRecords.length)),m){t.addClass([e.cell],"e-treerowcell"),e.cell.setAttribute("aria-expanded",a.expanded?"true":"false");var y=t.createElement("span",{className:"e-icons"}),S=void 0;S=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([y],S?"e-treegridexpand":"e-treegridcollapse"),d+=18,u.appendChild(y),g.style.width="4px",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 v=o.getFrozenRightColumns(),w=o.getFrozenLeftColumns(),I=o.getMovableColumns();v.length>0&&v[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):w.length>0&&w[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):I.length>0&&I[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 R=e.cell.querySelectorAll(".e-frame")[0];d+=parseInt(R.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 x=i.getObject(e.column.field,e.data);x=t.isNullOrUndefined(x)?null:x,null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML=x:e.column.template?e.cell.innerHTML=null:e.cell.innerHTML=x}this.parent.args=e;var C=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex];if(t.isNullOrUndefined(this.parent.rowTemplate)&&!this.parent.isReact||this.parent.isReact&&!e.column.template)this.parent.trigger("queryCellInfo",e);else if(this.parent.isReact&&C.field!==e.column.field){var b=this;b.parent.renderReactTemplates(function(){b.parent.trigger("queryCellInfo",e)})}}},e.prototype.updateTreeCell=function(e,r){var n=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex],o=e.column.index;t.isNullOrUndefined(n.field)&&e.cell.setAttribute("data-colindex",o+""),n.field!==e.column.field||t.isNullOrUndefined(n.template)||(e.column.template=n.template,e.column.templateFn=i.templateCompiler(e.column.template),e.cell.classList.add("e-templatecell"));var a=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 s=e.cell.children.length,d=this.parent.element.id+e.column.uid;if(n.field!==e.column.field||t.isNullOrUndefined(n.template))for(;0<s;s=e.cell.children.length)r.appendChild(e.cell.children[parseInt((0).toString(),10)]);else{if(this.parent.isReact&&"string"!=typeof e.column.template){e.column.templateFn(e.data,this.parent,"columnTemplate",d,null,null,r),t.isNullOrUndefined(this.parent.grid.portals)&&(this.parent.grid.portals=this.parent.portals),this.parent.notify("renderReactTemplate",this.parent.portals);var l=this;l.parent.renderReactTemplates(function(){l.parent.trigger("queryCellInfo",e)})}else{var p=e.column.templateFn(i.extend({index:""},e.data),this.parent,"template",d,this.parent.isStringTemplate);i.appendChildren(r,p)}delete e.column.template,delete e.column.templateFn,e.cell.innerHTML=""}}else r.innerHTML=a,e.cell.innerHTML=""},e.prototype.refreshReactColumnTemplateByUid=function(e){var r=this;this.parent.isReact&&this.parent.clearTemplate(["columnTemplate"],void 0,function(){var n=r.parent.grid.getRowsObject(),o=r.parent.getDataRows(),a=r.parent.grid.getIndentCount(),s=r.parent.grid.getNormalizedColumnIndex(e);if(0!==o.length)for(var d=0;d<n.length;d++)if(n[parseInt(d.toString(),10)].isDataRow&&!t.isNullOrUndefined(n[parseInt(d.toString(),10)].index)){var l=n[parseInt(d.toString(),10)].cells[parseInt(s.toString(),10)],p=new i.CellRenderer(r.parent.grid,r.parent.grid.serviceLocator),h=o.length>=n.length?r.parent.getCellFromIndex(n[parseInt(d.toString(),10)].index,s-a):r.parent.getRows()[n[parseInt(d.toString(),10)].index].querySelector(".e-templatecell");p.refreshTD(h,l,n[parseInt(d.toString(),10)].data,{index:n[parseInt(d.toString(),10)].index});var c=r.parent.getRows()[parseInt(d.toString(),10)].cells[parseInt(s.toString(),10)];r.cellRender({data:n[parseInt(d.toString(),10)].data,cell:c,column:l.column})}})},e.prototype.columnTemplateResult=function(e){this.templateResult=e.template},e.prototype.reactTemplateRender=function(e,t){this.parent.portals=e,this.parent.notify("renderReactTemplate",this.parent.portals),this.parent.renderReactTemplates(t)},e.prototype.destroy=function(){this.parent.grid.off("template-result",this.columnTemplateResult),this.parent.grid.off("reactTemplateRender",this.reactTemplateRender)},e}(),te=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("remoteExpand",this.collectExpandingRecs,this),this.parent.on("dataProcessor",this.dataProcessor,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("remoteExpand",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 i=this;if(this.parent.flatData=t.isNullOrUndefined(e)||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 r=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 o=this.parent.query.params.filter(function(e){return"IdMapping"===e.key});this.parent.initialRender&&!o.length&&(this.parent.query.where(this.parent.parentIdMapping,"equal",null),this.parent.query.addParams("IdMapping",this.parent.idMapping))}if(!this.parent.hasChildMapping){var s=this.parent.query.clone();s.queries=[],(s=s.select([this.parent.parentIdMapping])).isCountRequired=!0,r.executeQuery(s).then(function(e){i.parentItems=n.DataUtil.distinct(e.result,i.parent.parentIdMapping,!1);0===(e.result?0:1)&&(t.setValue("grid.contentModule.isLoaded",!0,i.parent),t.isNullOrUndefined(i.zerothLevelData)||(t.setValue("cancel",!1,i.zerothLevelData),t.getValue("grid.renderModule",i.parent).dataManagerSuccess(i.zerothLevelData),i.zerothLevelData=null),i.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[parseInt(r.toString(),10)];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){for(var a=[],s=new n.DataManager(this.hierarchyData).executeLocal((new n.Query).group(this.parent.parentIdMapping)),r=0;r<s.length;r++){var d=s[parseInt(r.toString(),10)],l=this.taskIds.indexOf(d.key);if(!t.isNullOrUndefined(d.key)&&l>-1){var p=d.items;this.hierarchyData[parseInt(l.toString(),10)][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){a(this.parent)&&this.parent.enableVirtualization&&"virtualscroll"===e.actionArgs.requestType&&this.parent.hideSpinner();var r=e.result;if(a(this.parent)&&this.parent.enableVirtualization&&("virtualscroll"===e.actionArgs.requestType||"clearFilter"===e.actionArgs.action||""===e.actionArgs.searchString)&&(this.parent.query.expands=[]),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)||a(this.parent)&&this.parent.loadChildOnDemand&&e.actionArgs.isExpandCollapse&&this.parent.enableVirtualization||this.convertToFlatData(r)}else for(var n=this,o=0;o<r.length;o++)!function(e){if(s(n.parent)&&r[parseInt(e.toString(),10)].hasChildRecords&&n.parent.initialRender&&(r[parseInt(e.toString(),10)].expanded=!1),a(n.parent)&&n.parent.enableVirtualization){var o=[],d=n.parent;r.filter(function(t){t[""+d.parentIdMapping]===r[parseInt(e.toString(),10)][""+d.idMapping]&&o.push(t)}),o.length?r[parseInt(e.toString(),10)].expanded=!0:r[parseInt(e.toString(),10)].hasChildRecords&&(r[parseInt(e.toString(),10)].expanded=!1)}t.isNullOrUndefined(r[parseInt(e.toString(),10)].index)&&(r[parseInt(e.toString(),10)].taskData=t.extend({},r[parseInt(e.toString(),10)]),r[parseInt(e.toString(),10)].uniqueID=i.getUid(n.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r[parseInt(e.toString(),10)].uniqueID,r[parseInt(e.toString(),10)],n.parent),r[parseInt(e.toString(),10)].level=0,a(n.parent)&&n.parent.enableVirtualization&&r[parseInt(e.toString(),10)][""+n.parent.parentIdMapping]&&0===r[parseInt(e.toString(),10)].level&&(r[parseInt(e.toString(),10)].level=r[parseInt(e.toString(),10)].level+1),r[parseInt(e.toString(),10)].index=Math.ceil(1e3*Math.random()),(r[parseInt(e.toString(),10)][n.parent.hasChildMapping]||-1!==n.parentItems.indexOf(r[parseInt(e.toString(),10)][n.parent.idMapping]))&&(r[parseInt(e.toString(),10)].hasChildRecords=!0),r[parseInt(e.toString(),10)].checkboxState="uncheck")}(o);else this.zerothLevelData=e,t.setValue("cancel",!0,e);if(a(this.parent)&&this.parent.loadChildOnDemand&&e.actionArgs.isExpandCollapse&&this.parent.enableVirtualization?e.result=r:a(this.parent)&&this.parent.enableVirtualization&&!this.parent.loadChildOnDemand?e.result=r:e.result=this.parent.loadChildOnDemand?this.parent.flatData:r,a(this.parent)&&this.parent.enableVirtualization&&this.parent.loadChildOnDemand&&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 d=e.query.queries.filter(function(e){return"onAggregates"===e.fn});e.result=this.parent.summaryModule.calculateSummaryValue(d,this.parent.flatData,!0)}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[parseInt(a.toString(),10)].style.display="table-row",this.parent.loadChildOnDemand){var s=e.rows[parseInt(a.toString(),10)].getElementsByClassName("e-treegridcollapse")[0];o=this.parent.rowTemplate?this.parent.grid.getCurrentViewRecords()[e.rows[parseInt(a.toString(),10)].rowIndex]:this.parent.grid.getRowObjectFromUID(e.rows[parseInt(a.toString(),10)].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[parseInt(a.toString(),10)].querySelector(".e-detailrowcollapse");t.isNullOrUndefined(l)||this.parent.grid.detailRowModule.expand(l)}}else this.fetchRemoteChildData({action:e.name,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;var p=parseInt(e.record[this.parent.idMapping],10);if(isNaN(p)&&(p=e.record[this.parent.idMapping].toString()),this.parent.enableVirtualization&&"remoteExpand"===e.action)d.take(this.parent.pageSettings.pageSize),(h=[]).push("ExpandingAction",p.toString()),d.expand(h);else if(this.parent.enableVirtualization&&"collapse"===e.action){d.take(this.parent.grid.pageSettings.pageSize);var h=[];h.push("CollapsingAction",p.toString()),d.expand(h)}if(d.where(this.parent.parentIdMapping,"equal",e.record[this.parent.idMapping]),"remoteExpand"===e.action&&this.parent.grid.filterModule&&this.parent.grid.filterModule.value){var c=this.parent.grid.getDataModule().generateQuery().queries.filter(function(e){return"onPage"!==e.fn&&void 0!==e.e.predicates});d.queries.push(c[0])}o.showSpinner(this.parent.element),s.executeQuery(d).then(function(s){var d,l=r.parent.grid.currentViewData.slice(),p=r.parent.idMapping;if(r.parent.isGantt&&!r.parent.loadChildOnDemand&&r.parent.hasChildMapping){for(y=0;y<r.parent.grid.currentViewData.length;y++)if(e.record[p]===r.parent.grid.currentViewData[y][p]){d=y;break}}else d=l.indexOf(e.record);if(r.parent.enableVirtualization&&("collapse"===e.action||"remoteExpand"===e.action)){l=[];for(y=0;y<d;y++)l.push(r.parent.grid.currentViewData[parseInt(y.toString(),10)])}-1===d&&r.parent.grid.getRowsObject().forEach(function(t){t.data.uniqueID===e.record.uniqueID&&(d=t.index)});var h=i.getObject("actual.nextLevel",s),c=s.result,u=[];if("remoteExpand"===e.action&&r.parent.grid.filterModule&&r.parent.grid.filterModule.value){for(y=0;y<l.length;y++)Object.prototype.hasOwnProperty.call(l[parseInt(y.toString(),10)],r.parent.parentIdMapping)&&null!==l[parseInt(y.toString(),10)][""+r.parent.parentIdMapping]&&0===l[parseInt(y.toString(),10)].level&&(l.splice(y,1),y--);for(y=0;y<c.length;y++)e.record[""+r.parent.idMapping]!==c[parseInt(y.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===c[parseInt(y.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(c,y)&&u.push(c[parseInt(y.toString(),10)]);c=u}if(r.parent.enableVirtualization&&"remoteExpand"===e.action){e.record.childRecords=[];for(y=0;y<c.length;y++)e.record[""+r.parent.idMapping]!==c[parseInt(y.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===c[parseInt(y.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(c,y)&&e.record.childRecords.push(c[parseInt(y.toString(),10)])}else e.record.childRecords=c;for(var g=0;g<c.length;g++){if(r.parent.enableVirtualization&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"remoteExpand"===e.action)r.parent.remoteExpandedData.push(e.record);else if(r.parent.enableVirtualization&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"===e.action)for(y=0;y<r.parent.remoteExpandedData.length;y++)e.record[""+r.parent.idMapping]===r.parent.remoteExpandedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&r.parent.remoteExpandedData.splice(y,1);if(c[parseInt(g.toString(),10)].taskData=t.extend({},c[parseInt(g.toString(),10)]),c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping]&&r.parent.enableVirtualization&&r.parent.remoteExpandedData.length)for(y=0;y<r.parent.remoteExpandedData.length;y++)c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping]===r.parent.remoteExpandedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&(c[parseInt(g.toString(),10)].level=r.parent.remoteExpandedData[parseInt(y.toString(),10)].level+1,delete(f=r.parent.remoteExpandedData[parseInt(y.toString(),10)]).childRecords,c[parseInt(g.toString(),10)].parentItem=f,c[parseInt(g.toString(),10)].parentUniqueID=e.record.uniqueID);else if(r.parent.enableVirtualization)!c[parseInt(g.toString(),10)][""+r.parent.hasChildMapping]&&-1===r.parentItems.indexOf(c[parseInt(g.toString(),10)][""+r.parent.idMapping])||h&&!h[parseInt(g.toString(),10)]?(delete(f=t.extend({},e.record)).childRecords,c[parseInt(g.toString(),10)].parentItem=f,c[parseInt(g.toString(),10)].parentUniqueID=e.record.uniqueID):t.isNullOrUndefined(c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping])?(c[parseInt(g.toString(),10)].level=0,"remoteExpand"===e.action&&(c[parseInt(g.toString(),10)].childRecords=[],c[parseInt(g.toString(),10)].childRecords=e.record.childRecords)):c[parseInt(g.toString(),10)].level=e.record.level;else{c[parseInt(g.toString(),10)].level=e.record.level+1;var f=t.extend({},e.record);delete f.childRecords,c[parseInt(g.toString(),10)].parentItem=f,c[parseInt(g.toString(),10)].parentUniqueID=e.record.uniqueID}if(c[parseInt(g.toString(),10)].index=Math.ceil(1e3*Math.random()),c[parseInt(g.toString(),10)].uniqueID=i.getUid(r.parent.element.id+"_data_"),c[parseInt(g.toString(),10)].checkboxState="uncheck",r.parent.enableVirtualization&&t.isNullOrUndefined(c[parseInt(g.toString(),10)].level))for(var m=0;m<r.parent.grid.currentViewData.length;m++)r.parent.grid.currentViewData[parseInt(m.toString(),10)][""+r.parent.idMapping]===c[parseInt(g.toString(),10)][""+r.parent.parentIdMapping]&&(c[parseInt(g.toString(),10)].level=r.parent.grid.currentViewData[parseInt(m.toString(),10)].level+1);if(t.setValue("uniqueIDCollection."+c[parseInt(g.toString(),10)].uniqueID,c[parseInt(g.toString(),10)],r.parent),(c[parseInt(g.toString(),10)][""+r.parent.hasChildMapping]||-1!==r.parentItems.indexOf(c[parseInt(g.toString(),10)][""+r.parent.idMapping]))&&(!h||h[parseInt(g.toString(),10)]))if(c[parseInt(g.toString(),10)].hasChildRecords=!0,r.parent.enableVirtualization&&r.parent.loadChildOnDemand){for(y=0;y<r.parent.remoteCollapsedData.length;y++)c[parseInt(g.toString(),10)][""+r.parent.idMapping]===r.parent.remoteCollapsedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&(c[parseInt(g.toString(),10)].expanded=r.parent.remoteCollapsedData[parseInt(y.toString(),10)].expanded);if("collapse"===e.action&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]!==e.record[""+r.parent.idMapping]&&!1!==c[parseInt(g.toString(),10)].expanded)c[parseInt(g.toString(),10)].expanded=!0;else if("collapse"===e.action&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping])c[parseInt(g.toString(),10)].expanded=!1,r.parent.remoteCollapsedData.push(e.record);else if("remoteExpand"===e.action){for(y=0;y<r.parent.grid.currentViewData.length;y++)r.parent.grid.currentViewData[parseInt(y.toString(),10)][""+r.parent.idMapping]===c[parseInt(g.toString(),10)][""+r.parent.idMapping]&&c.splice(g,1,r.parent.grid.currentViewData[parseInt(y.toString(),10)]);if(c[parseInt(g.toString(),10)][r.parent.idMapping]===e.record[""+r.parent.idMapping])for(var y=0;y<r.parent.remoteCollapsedData.length;y++)e.record[""+r.parent.idMapping]===r.parent.remoteCollapsedData[parseInt(y.toString(),10)][""+r.parent.idMapping]&&r.parent.remoteCollapsedData.splice(y,1);!1!==c[parseInt(g.toString(),10)].expanded&&(c[parseInt(g.toString(),10)].expanded=!0)}}else r.parent.enableVirtualization&&c[parseInt(g.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"!==e.action?c[parseInt(g.toString(),10)].expanded=!0:r.parent.enableVirtualization&&r.parent.loadChildOnDemand||(c[parseInt(g.toString(),10)].expanded=!1);l.splice(d+g+1,0,c[parseInt(g.toString(),10)])}if(t.setValue("result",l,s),t.setValue("action","beforecontentrender",s),r.parent.trigger("actionComplete",s),o.hideSpinner(r.parent.element),r.parent.grid.aggregates.length>0&&!r.parent.enableVirtualization){var S=i.getObject("query",s);if(t.isNullOrUndefined(S)&&(S=t.getValue("grid.renderModule.data",r.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(S)){var v=S.queries.filter(function(e){return"onAggregates"===e.fn});s.result=r.parent.summaryModule.calculateSummaryValue(v,s.result,!0)}}r.parent.enableVirtualization&&(r.parent.grid.pageSettings.totalRecordsCount=s.count),s.count=r.parent.grid.pageSettings.totalRecordsCount,"remoteExpand"===e.action&&r.parent.allowPaging&&(r.parent.grid.pageSettings.totalRecordsCount=r.parent.grid.currentViewData.length+c.length);var w={};r.parent.enableVirtualization&&r.remoteVirtualAction(w);var I={index:d,childData:c};r.parent.enableInfiniteScrolling?r.parent.notify("infinite-remote-expand",I):t.getValue("grid.renderModule",r.parent).dataManagerSuccess(s,w),r.parent.trigger("expanded",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(){if(this.isSortAction=!0,a(this.parent)&&this.parent.enableVirtualization){var e=this.parent.query.queries.indexOf(this.parent.query.queries.filter(function(e){return"onSortBy"===e.fn})[0]);-1!==e&&this.parent.query.queries.splice(e,1),0===this.parent.grid.sortSettings.columns.length&&this.parent.query.sortBy(null,null)}},e.prototype.createRecords=function(e,r){for(var n=[],o=0,d=Object.keys(e).length;o<d;o++){var l=t.extend({},e[parseInt(o.toString(),10)]);l.taskData=e[parseInt(o.toString(),10)];var p=0;if(this.storedIndex++,Object.prototype.hasOwnProperty.call(l,"index")||(l.index=this.storedIndex),(!t.isNullOrUndefined(l[this.parent.childMapping])&&!s(this.parent)||l[this.parent.hasChildMapping]&&s(this.parent))&&(l.hasChildRecords=!0,this.parent.enableCollapseAll||!t.isNullOrUndefined(this.parent.dataStateChange)&&t.isNullOrUndefined(l[this.parent.childMapping])?l.expanded=!1:l.expanded=!!t.isNullOrUndefined(l[this.parent.expandStateMapping])||l[this.parent.expandStateMapping]),Object.prototype.hasOwnProperty.call(l,"index")||(l.index=(l.hasChildRecords,this.storedIndex)),this.isSelfReference&&t.isNullOrUndefined(l[this.parent.parentIdMapping])&&this.parent.parentData.push(l),l.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+l.uniqueID,l,this.parent),!t.isNullOrUndefined(r)){var h=t.extend({},r);delete h.childRecords,delete h[this.parent.childMapping],this.isSelfReference&&delete h.taskData[this.parent.childMapping],l.parentItem=h,l.parentUniqueID=h.uniqueID,p=r.level+1}Object.prototype.hasOwnProperty.call(l,"level")||(l.level=p),l.checkboxState="uncheck";if(this.parent.enableVirtualization&&this.parent.loadChildOnDemand&&a(this.parent)&&!this.parent.initialRender){if(!l.hasChildRecords&&t.isNullOrUndefined(l[""+this.parent.parentIdMapping])){l.hasChildRecords=!0;for(var c=0;c<this.parent.remoteCollapsedData.length;c++)this.parent.remoteCollapsedData[parseInt(c.toString(),10)][""+this.parent.idMapping]===l[""+this.parent.idMapping]&&(l.expanded=!1)}else 0===l.level&&t.isNullOrUndefined(r)&&!l.hasChildRecords&&(l.level=l.level+1);l[""+this.parent.hasChildMapping]&&!t.isNullOrUndefined(l[""+this.parent.expandStateMapping])&&(l.expanded=l[""+this.parent.expandStateMapping],l.hasChildRecords=!0),this.parent.flatData.push(l)}else(t.isNullOrUndefined(l[""+this.parent.parentIdMapping])||l.parentItem)&&(this.parent.flatData.push(l),this.parent.infiniteScrollData.push(l));if(this.isSelfReference||0!==l.level||this.parent.parentData.push(l),!t.isNullOrUndefined(l[this.parent.childMapping]&&l[this.parent.childMapping].length)){var u=this.createRecords(l[this.parent.childMapping],l);l.childRecords=u}n.push(l)}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,m=this.parent.getPrimaryKeyFieldNames()[0],y=i.getObject("data",f);t.isNullOrUndefined(f)||t.isNullOrUndefined(f.action)||"add"!==f.action||t.isNullOrUndefined(f.data)||!t.isNullOrUndefined(f.data[""+m])||(f.data[""+m]=e.result[f.index][""+m],y.taskData[""+m]=e.result[f.index][""+m]),(!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 S,v,w=(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,I=s(this.parent)?t.getValue("count",this.parent.dataSource):w.length,R=new n.Query,x=i.getObject("query",e);if(t.isNullOrUndefined(x)||(S=x.queries.filter(function(e){return"onWhere"===e.fn}),v=x.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(x)&&(S.length||v.length)&&this.parent.isLocalData){t.isNullOrUndefined(x)&&(x=new n.Query,x=t.getValue("grid.renderModule.data",this.parent).filterQuery(x),x=t.getValue("grid.renderModule.data",this.parent).searchQuery(x));var C=x.queries.filter(function(e){return"onWhere"===e.fn}),b=x.queries.filter(function(e){return"onSearch"===e.fn});R.queries=C.concat(b);var D=new n.DataManager(w).executeLocal(R);if(this.parent.notify("updateFilterRecs",{data:D}),w=this.dataResults.result,this.dataResults.result=null,this.parent.grid.aggregates.length>0){P=i.getObject("query",e);if(t.isNullOrUndefined(x)&&(x=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(P)){B=P.queries.filter(function(e){return"onAggregates"===e.fn});w=this.parent.summaryModule.calculateSummaryValue(B,w,!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 M=i.getObject("query",e);t.isNullOrUndefined(M)&&(M=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query));B=M.queries.filter(function(e){return"onAggregates"===e.fn});w=this.parent.summaryModule.calculateSummaryValue(B,this.parent.flatData,!0)}if(this.parent.grid.sortSettings.columns.length>0||this.isSortAction){this.isSortAction=!1;for(var O=this.parent.parentData,P=i.getObject("query",e),E=new n.Query,A=this.parent.grid.sortSettings.columns.length-1;A>=0;A--){var N=this.parent.grid.renderModule.data.getColumnByField(this.parent.grid.sortSettings.columns[parseInt(A.toString(),10)].field),U=N.sortComparer&&u(this.parent)?N.sortComparer.bind(N):this.parent.grid.sortSettings.columns[parseInt(A.toString(),10)].direction;E.sortBy(this.parent.grid.sortSettings.columns[parseInt(A.toString(),10)].field,U)}var k=new n.DataManager(O).executeLocal(E);if(this.parent.allowRowDragAndDrop&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var q=k.indexOf(this.parent.rowDragAndDropModule.draggedRecord);k.splice(q,1);var T=k.indexOf(this.parent.rowDragAndDropModule.droppedRecord);this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"topSegment"===this.parent.rowDragAndDropModule.dropPosition?k.splice(T,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&k.splice(T+1,0,this.parent.rowDragAndDropModule.draggedRecord)}var V={modifiedData:k,filteredData:w,srtQry:E};if(this.parent.notify("createSort",V),w=V.modifiedData,this.dataResults.result=null,this.sortedData=w,this.parent.notify("updateModel",{}),this.parent.grid.aggregates.length>0&&!t.isNullOrUndefined(P)){var B=i.getObject("query",e).queries.filter(function(e){return"onAggregates"===e.fn});w=this.parent.summaryModule.calculateSummaryValue(B,this.sortedData,!1)}}I=s(this.parent)?t.getValue("count",this.parent.dataSource):w.length;var z=this.paging(w,I,o,l,d,e);w=z.result,I=z.count,e.result=w,e.count=I,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("pagingActions",{result:e,count:i,actionArgs:d}),e=this.dataResults.result,i=this.dataResults.count}}else this.parent.notify("pagingActions",{result:e,count:i,actionArgs:a}),e=this.dataResults.result,i=s(this.parent)?t.getValue("count",this.parent.dataSource):this.dataResults.count;if((!0===n||a.isPdfExport&&(t.isNullOrUndefined(a.isCollapsedStatePersist)||a.isCollapsedStatePersist))&&"AllPages"===this.parent.printMode){for(var l=[],p=0;p<e.length;p++)h(this.parent,e[parseInt(p.toString(),10)],this.parent.parentData)&&l.push(e[parseInt(p.toString(),10)]);i=(e=l).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("crudAction",{value:e,action:t||i}),"batchsave"===i&&"Batch"===this.parent.editSettings.mode&&this.parent.notify("batchSave",{})},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 ie=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)}}(),re=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},ne=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ie(i,e),re([t.Property(12)],i.prototype,"pageSize",void 0),re([t.Property(8)],i.prototype,"pageCount",void 0),re([t.Property(1)],i.prototype,"currentPage",void 0),re([t.Property()],i.prototype,"totalRecordsCount",void 0),re([t.Property(!1)],i.prototype,"enableQueryString",void 0),re([t.Property(!1)],i.prototype,"pageSizes",void 0),re([t.Property(null)],i.prototype,"template",void 0),re([t.Property("All")],i.prototype,"pageSizeMode",void 0),i}(t.ChildProperty),oe=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)}}(),ae=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},se=function(e){function r(){var i=null!==e&&e.apply(this,arguments)||this;return i.intl=new t.Internationalization,i.templateFn={},i}return oe(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)},ae([t.Property()],r.prototype,"type",void 0),ae([t.Property()],r.prototype,"footerTemplate",void 0),ae([t.Property()],r.prototype,"field",void 0),ae([t.Property()],r.prototype,"format",void 0),ae([t.Property()],r.prototype,"columnName",void 0),ae([t.Property()],r.prototype,"customAggregate",void 0),r}(t.ChildProperty),de=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return oe(i,e),ae([t.Collection([],se)],i.prototype,"columns",void 0),ae([t.Property(!0)],i.prototype,"showChildSummary",void 0),i}(t.ChildProperty),le=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)}}(),pe=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},he=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return le(i,e),pe([t.Property(!1)],i.prototype,"allowAdding",void 0),pe([t.Property(!1)],i.prototype,"allowEditing",void 0),pe([t.Property(!1)],i.prototype,"allowDeleting",void 0),pe([t.Property("Cell")],i.prototype,"mode",void 0),pe([t.Property("Top")],i.prototype,"newRowPosition",void 0),pe([t.Property(!0)],i.prototype,"allowEditOnDblClick",void 0),pe([t.Property(!0)],i.prototype,"showConfirmDialog",void 0),pe([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),pe([t.Property("")],i.prototype,"template",void 0),pe([t.Property({})],i.prototype,"dialog",void 0),pe([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),ce=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,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},ge=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ce(i,e),ue([t.Property()],i.prototype,"field",void 0),ue([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),fe=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ce(i,e),ue([t.Collection([],ge)],i.prototype,"columns",void 0),ue([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),me=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},Se=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return me(i,e),ye([t.Property(!1)],i.prototype,"enableCache",void 0),ye([t.Property(3)],i.prototype,"maxBlocks",void 0),ye([t.Property(3)],i.prototype,"initialBlocks",void 0),i}(t.ChildProperty),ve=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)}}(),we=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},Ie=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[parseInt(o.toString(),10)]]===t[i[parseInt(o.toString(),10)]]||-1!==n.indexOf(i[parseInt(o.toString(),10)])||e[i[parseInt(o.toString(),10)]]instanceof Date&&t[i[parseInt(o.toString(),10)]]instanceof Date&&e[i[parseInt(o.toString(),10)]].getTime()===t[i[parseInt(o.toString(),10)]].getTime())){r=!1;break}return r}return!1},l.Inject(Q,F),t.setValue("mergePersistData",o.mergePersistTreeGridData,o);t.isNullOrUndefined(o.injectedModules.Logger)||i.Grid.Inject(i.Logger);o.injectedModules.filter(function(e){"freeze"===e.prototype.getModuleName()&&i.Grid.Inject(i.Freeze)});return o.grid=new i.Grid,o}ve(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.serverExcelExport=function(e){this.isExcel=!0,this.exportTreeGrid(e)},d.prototype.serverPdfExport=function(e){this.isExcel=!1,this.exportTreeGrid(e)},d.prototype.serverCsvExport=function(e){this.isExcel=!0,this.exportTreeGrid(e)},d.prototype.exportTreeGrid=function(e){var t=this.grid.getDataModule().generateQuery(!0),i=(new n.UrlAdaptor).processQuery(new n.DataManager({url:""}),t),r=JSON.parse(i.data),o=JSON.parse(this.addOnPersist(["allowPaging","pageSettings","sortSettings","allowPdfExport","allowExcelExport","aggregates","filterSettings","columns","locale","searchSettings","idMapping","parentIdMapping","childMapping","treeColumnIndex"])),a=["field","headerText","type","format","visible","template","index","width","textAlign","headerTextAlign","columns"];o.filterSettings.columns=r.where,o.searchSettings.fields=r.search&&r.search[0].fields||[],o.sortSettings.columns=r.sorted,o.columns=this.setHeaderText(o.columns,a);var s=this.createElement("form",{id:"ExportForm",styles:"display:none;"}),d=this.createElement("input",{id:"treeGridInput",attrs:{name:"treeGridModel"}});d.value=JSON.stringify(o),s.method="POST",s.action=e,s.appendChild(d),document.body.appendChild(s),s.submit(),s.remove()},d.prototype.setHeaderText=function(e,r){for(var n=0;n<e.length;n++){var o=this.getColumnByUid(e[parseInt(n.toString(),10)].uid);this.stackedHeader&&t.isNullOrUndefined(o)&&(o=t.isNullOrUndefined(e[parseInt(n.toString(),10)].field)?e[parseInt(n.toString(),10)]:this.getColumnByField(e[parseInt(n.toString(),10)].field)),e[parseInt(n.toString(),10)].headerText=o.headerText,t.isNullOrUndefined(o.template)||(e[parseInt(n.toString(),10)].template="true"),e[parseInt(n.toString(),10)].format&&(e[parseInt(n.toString(),10)].format=i.getNumberFormat(this.getFormat(o.format),o.type,!1,this.currencyCode),this.isExcel||"datetime"!==o.type&&"date"!==o.type||(e[parseInt(n.toString(),10)].format=e[parseInt(n.toString(),10)].format.toString().replace("AM/PM","tt")),e[parseInt(n.toString(),10)].type=o.type),e[parseInt(n.toString(),10)].columns&&this.setHeaderText(e[parseInt(n.toString(),10)].columns,r);for(var a=Object.keys(e[parseInt(n.toString(),10)]),s=0;s<a.length;s++)r.indexOf(a[parseInt(s.toString(),10)])<0&&delete e[parseInt(n.toString(),10)][a[parseInt(s.toString(),10)]]}return e},d.prototype.getFormat=function(e){return"object"==typeof e?t.isNullOrUndefined(e.format)?e.skeleton:e.format:e},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,i,r){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)){this.trigger(_,{error:"The provided value for the columnName and direction is undefined. Please ensure the columnName and direction contains string."})}this.sortModule&&this.sortModule.sortColumn(e,i,r)},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,i){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)){this.trigger(_,{error:"The provided value for the fromFName and toFName is undefined. Please ensure the fromFName and toFName contains string."})}this.grid.reorderColumns(e,i)},d.prototype.TreeGridLocale=function(){if(!t.isNullOrUndefined(this.locale)){var e=t.L10n.locale,r={};t.setValue(this.locale,{},r);var n=void 0;n={},n=i.getObject(this.locale,e);var o=void 0;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 r=void 0,n=void 0,o=void 0,a=void 0,s=void 0;switch(e.action){case"ctrlDownArrow":this.expandAll();break;case"ctrlUpArrow":this.collapseAll();break;case"ctrlShiftUpArrow":o=(r=e.target).closest(".e-rowcell"),t.isNullOrUndefined(o)||(a=o.closest("tr"),t.isNullOrUndefined(a)||t.isNullOrUndefined(a.getElementsByClassName("e-treegridexpand")[0])||this.expandCollapseRequest(a.querySelector(".e-treegridexpand")));break;case"ctrlShiftDownArrow":o=(r=e.target).closest(".e-rowcell"),t.isNullOrUndefined(o)||(a=o.closest("tr"),t.isNullOrUndefined(a)||t.isNullOrUndefined(a.getElementsByClassName("e-treegridcollapse")[0])||this.expandCollapseRequest(a.querySelector(".e-treegridcollapse")));break;case"downArrow":if(!this.enableVirtualization&&t.isNullOrUndefined(this.rowTemplate)&&(r=e.target,t.isNullOrUndefined(r.querySelectorAll(".e-rowcell"))||(r=i.parentsUntil(r,"e-rowcell")),!t.isNullOrUndefined(r)&&(n=r.parentElement,!t.isNullOrUndefined(n)))){p=n.cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(p).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(p).edit.obj)&&(n=r),null!==(s=this.findnextRowElement(n))){var d=r.cellIndex,l=s.children[parseInt(d.toString(),10)];t.addClass([l],"e-focused"),t.addClass([l],"e-focus")}else this.clearSelection()}break;case"upArrow":if(!this.enableVirtualization&&t.isNullOrUndefined(this.rowTemplate)&&(r=e.target,t.isNullOrUndefined(r.querySelectorAll(".e-rowcell"))||(r=i.parentsUntil(r,"e-rowcell")),!t.isNullOrUndefined(r)&&(n=r.parentElement,!t.isNullOrUndefined(n)))){var p=n.cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(p).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(p).edit.obj)&&(n=r),null!==(s=this.findPreviousRowElement(n))){var h=r.cellIndex;if(!t.isNullOrUndefined(h)){var c=s.children[parseInt(h.toString(),10)];t.addClass([c],"e-focused"),t.addClass([c],"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.remoteCollapsedData=[],this.remoteExpandedData=[],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.isReact&&t.isNullOrUndefined(this.changedProperties.columns)&&this.grid.splitFrozenCount(this.getColumns()),this.isDestroyed)return e;e.push({member:"filter",args:[this,this.filterSettings],name:"Filter"}),t.isNullOrUndefined(this.toolbar)||e.push({member:"toolbar",args:[this],name:"Toolbar"}),this.contextMenuItems&&e.push({member:"contextMenu",args:[this],name:"ContextMenu"}),this.allowPaging&&e.push({member:"pager",args:[this,this.pageSettings],name:"Page"}),this.allowReordering&&e.push({member:"reorder",args:[this],name:"Reorder"}),this.allowSorting&&e.push({member:"sort",args:[this],name:"Sort"}),this.aggregates.length>0&&e.push({member:"summary",args:[this],name:"Aggregate"}),this.allowResizing&&e.push({member:"resize",args:[this],name:"Resize"}),this.allowExcelExport&&e.push({member:"ExcelExport",args:[this],name:"ExcelExport"});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>0&&e.push({member:"freeze",args:[this],name:"Freeze"}),this.detailTemplate&&e.push({member:"detailRow",args:[this],name:"DetailRow"}),this.allowPdfExport&&e.push({member:"PdfExport",args:[this],name:"PdfExport"}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this],name:"ColumnMenu"}),this.showColumnChooser&&e.push({member:"ColumnChooser",args:[this],name:"ColumnChooser"}),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],name:"RowDD"})),(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&e.push({member:"edit",args:[this],name:"Edit"}),!t.isNullOrUndefined(this.columns)&&this.isCommandColumn(this.columns)&&e.push({member:"commandColumn",args:[this],name:"CommandColumn"}),this.allowSelection&&e.push({member:"selection",args:[this],name:"Selection"}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this],name:"VirtualScroll"}),this.enableInfiniteScrolling&&e.push({member:"infiniteScroll",args:[this],name:"InfiniteScroll"}),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),this.element&&(t.EventHandler.remove(this.element,"touchend",this.mouseClickHandler),this.keyboardModule&&(this.keyboardModule.destroy(),this.keyboardModule=null),this.allowKeyboard&&this.element.removeAttribute("tabIndex"))},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,this.grid.vueInstance=this.vueInstance),o.createSpinner({target:this.element},this.createElement),this.log(["mapping_fields_missing"]),this.renderModule=new ee(this),this.dataModule=new te(this),this.printModule=new K(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[parseInt(t.toString(),10)].member&&(e[parseInt(t.toString(),10)].member="treeVirtualScroll");return e};this.grid.root=this.root?this.root:this,this.grid.appendTo(i),this.actionFailureHandler(),this.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].setAttribute("tabindex","0");var n=this.element.getElementsByClassName("e-content")[0].querySelector(".e-table");t.isNullOrUndefined(n)||n.setAttribute("role","treegrid"),this.isIndentEnabled&&this.refreshToolbarItems(),this.wireEvents(),this.renderComplete();var a=this.grid.destroyTemplate;this.grid.destroyTemplate=function(i,r){a.apply(e.grid);e.isReact&&t.isNullOrUndefined(e.portals)||e.clearTemplate(i,r)}},d.prototype.actionFailureHandler=function(){var e=this,i=[],r=this.getPrimaryKeyFieldNames(),n=this.flatData.length;(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&0===r.length&&0!==n&&i.push("For the CRUD actions, it is necessary to enable Primary Key field for the unique data column."),this.allowRowDragAndDrop&&0===r.length&&0!==n&&i.push("For the Row Drag and Drop actions, it is necessary to enable Primary Key field for the unique data column."),this.allowPaging&&this.enableVirtualization&&i.push("Paging is not allowed in virtualization case."),0===n&&0===this.columns.length&&i.push("Either of the Data source or columns should be given."),this.frozenColumns>0&&this.columnModel.filter(function(e){return e.isFrozen})&&i.push("Use only one attribute for Frozen either IsFrozen or FrozenColumns."),this.enableVirtualization&&!t.isNullOrUndefined(this.detailTemplate)&&i.push("Virtual scrolling is not compatible with the detail template"),this.stackedHeader&&!t.isNullOrUndefined(this.detailTemplate)&&i.push("Virtual scrolling is not compatible with the detail template"),!(this.frozenColumns>0||this.columnModel.filter(function(e){return e.isFrozen})||this.frozenRows>0)||t.isNullOrUndefined(this.detailTemplate)&&t.isNullOrUndefined(this.rowTemplate)||i.push("Frozen rows and columns are not supported with the Detail template and row template."),(this.frozenColumns>0||this.columnModel.filter(function(e){return e.isFrozen}).length>0||this.frozenRows>0)&&"Cell"===this.editSettings.mode&&i.push("Frozen rows and columns are not supported with cell editing."),this.allowSelection&&!t.isNullOrUndefined(this.rowTemplate)&&i.push("Selection is not supported in RowTemplate"),this.treeColumnIndex<0&&i.push("For showing tree structure it is must to set the TreeColumnIndex value."),this.treeColumnIndex>=this.columns.length&&i.push("TreeColumnIndex value should not exceed the total column count."),(this.enableVirtualization&&!/[0-9]$/.test(this.columnModel.filter(function(e){return e.width}).toString())&&!/[px]$/.test(this.columnModel.filter(function(e){return e.width}).toString())||/[0-9]$/.test(this.height.toString())&&/[px]$/.test(this.height.toString()))&&i.push("column width and height should be in pixels"),"Children"===this.childMapping||t.isNullOrUndefined(this.idMapping)||i.push("Both IdMapping and ChildMapping should not be used together for tree grid rendering."),(!t.isNullOrUndefined(this.idMapping)&&t.isNullOrUndefined(this.parentIdMapping)||t.isNullOrUndefined(this.idMapping)&&!t.isNullOrUndefined(this.parentIdMapping))&&i.push("IdMapping and ParentIdMapping properties should be defined and vice versa.");var o=this.columnModel.filter(function(e){return e.showCheckbox}),a=this.columns[this.treeColumnIndex];if(0!==o.length&&(o!==a&&i.push("ShowCheckbox column should not be defined other than the tree column."),o.length>1&&i.push("Only one column can have the ShowCheckbox option enabled.")),0!==this.columnModel.filter(function(t){return"Right"===t.textAlign&&t.field===e.columnModel[e.treeColumnIndex].field}).length&&i.push("TextAlign right for the tree column is not applicable."),i.length>0){var s={error:{}};i.forEach(function(e,t){s.error[parseInt(t.toString(),10)]=e}),this.trigger(_,s)}},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 G(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.enableVirtualMaskRow=this.enableVirtualMaskRow,this.grid.loadingIndicator=this.loadingIndicator,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);this.grid.templateDotnetInstance=this.templateDotnetInstance;this.grid.isJsComponent=!0;this.grid.enableHtmlSanitizer=this.enableHtmlSanitizer},d.prototype.triggerEvents=function(e){this.trigger(i.getObject("name",e),e)},d.prototype.IsExpandCollapseClicked=function(e){if(!t.isNullOrUndefined(e.target)&&(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse")||e.target.classList.contains("e-summarycell"))&&!this.selectionSettings.checkboxOnly&&(!t.isNullOrUndefined(e.data)&&e.data.hasChildRecords||-1!==e.rowIndex&&t.isNullOrUndefined(e.data)))return void(e.cancel=!0)},d.prototype.bindGridEvents=function(){var e=this;this.grid.rowSelecting=function(i){e.IsExpandCollapseClicked(i),!t.isNullOrUndefined(i.data)&&e.selectionSettings.persistSelection&&e.columnModel.filter(function(e){return"checkbox"===e.type}).length>0&&a(e)&&(t.isNullOrUndefined(i.data.parentItem)||(e.parentQuery=e.query.queries.filter(function(t){return t.e.field===e.parentIdMapping}),e.query.queries=e.query.queries.slice(0,0))),e.trigger("rowSelecting",i)},this.grid.rowDeselecting=function(i){e.IsExpandCollapseClicked(i),t.isNullOrUndefined(i.data)&&e.selectionSettings.persistSelection&&e.columnModel.filter(function(e){return"checkbox"===e.type}).length>0&&a(e)&&t.isNullOrUndefined(i.data.parentItem)&&(e.parentQuery=e.query.queries.filter(function(t){return t.e.field===e.parentIdMapping}),e.query.queries=e.query.queries.slice(0,0)),e.trigger("rowDeselecting",i)},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()[parseInt(i.toString(),10)].getElementsByClassName("e-frame e-icons e-uncheck").length&&e.grid.selectionModule.updateRowSelection(e.getRows()[parseInt(i.toString(),10)],e.getCurrentViewRecords()[parseInt(i.toString(),10)].index);e.selectedRowIndex=e.grid.selectedRowIndex,e.notify("rowSelected",t),e.trigger("rowSelected",t)},this.grid.rowDeselected=function(i){e.selectedRowIndex=e.grid.selectedRowIndex,t.isNullOrUndefined(i.data)||e.notify("rowDeselected",i),e.trigger("rowDeselected",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("checkboxChange",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 F(e.grid)}},this.grid.printComplete=this.triggerEvents.bind(this),this.grid.actionFailure=function(t){e.trigger(_,t)},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[parseInt(r.toString(),10)]],"e-lastrowcell"):t.removeClass([e.cells[parseInt(r.toString(),10)]],"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(i){if(e.updateRowTemplate(),e.updateColumnModel(),e.updateAltRow(e.getRows()),e.notify("dataBoundArg",i),a(e)&&!u(e)&&!e.hasChildMapping){var r=void 0;r=e.dataResults.result?0:1,t.setValue("grid.contentModule.isLoaded",!(r>0),e)}if(e.isPixelHeight()&&e.initialRender)for(var n=e.getContentTable().rows,o=[].slice.call(n),s=o.length-1;s>0;s--)if(!y(o[parseInt(s.toString(),10)])){o[parseInt(s.toString(),10)].nextElementSibling&&e.lastRowBorder(o[parseInt(s.toString(),10)],!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 d=e.getCurrentViewRecords().indexOf(e.grid.selectionModule.data);e.grid.selectionModule.updateRowSelection(e.getRows()[parseInt(d.toString(),10)],d)}}e.trigger("dataBound",i),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("beforeDataBound",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("toolbarClick",t,function(r){r.cancel||e.notify("toolbarClick",t),i.resolve(r)}),i}},this.grid.cellSelecting=function(r){var o=e.grid.selectionModule.actualTarget;t.isNullOrUndefined(o)||!o.classList.contains("e-treegridexpand")&&!o.classList.contains("e-treegridcollapse")||(r.cancel=!0);var a=new n.Deferred;return e.trigger(i.getObject("name",r),r,function(e){a.resolve(e)}),a},this.grid.beginEdit=function(i){if(!t.isNullOrUndefined(i.row)&&i.row.classList.contains("e-summaryrow"))return void(i.cancel=!0);var r=new n.Deferred;return e.trigger("beginEdit",i,function(e){r.resolve(e)}),r}},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("dataStateChange",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("cellSave",i,function(t){t.cancel||e.notify("cellSave",t),o.resolve(t)}),o},this.grid.cellSaved=function(t){e.trigger("cellSaved",t),e.notify("cellSaved",t)},this.grid.cellEdit=function(t){var i=new n.Deferred;return t.promise=i,e.notify("cellEdit",t),i},this.grid.batchAdd=function(t){e.trigger("batchAdd",t),e.notify("batchAdd",t)},this.grid.beforeBatchSave=function(t){e.trigger("beforeBatchSave",t),e.notify("beforeBatchSave",t)},this.grid.beforeBatchAdd=function(t){e.trigger("beforeBatchAdd",t),e.notify("beforeBatchAdd",t)},this.grid.batchDelete=function(t){e.trigger("batchDelete",t),e.notify("batchDelete",t)},this.grid.beforeBatchDelete=function(t){e.trigger("beforeBatchDelete",t),e.notify("beforeBatchDelete",t)},this.grid.batchCancel=function(t){"Cell"!==e.editSettings.mode&&e.trigger("batchCancel",t),e.notify("batchCancel",t)}},d.prototype.updateRowTemplate=function(){var e=this;this.rowTemplate&&(this.isReact&&0===this.getContentTable().rows.length?setTimeout(function(){if(e.treeColumnRowTemplate(),e.enableCollapseAll)for(var t=e.getCurrentViewRecords(),i=e.getContentTable().rows,r=0;r<i.length;r++){var n={data:t[parseInt(r.toString(),10)],row:i[parseInt(r.toString(),10)]};e.renderModule.RowModifier(n)}},0):this.treeColumnRowTemplate())},d.prototype.bindedDataSource=function(){if(this.dataSource&&s(this)){var e=this.flatData,i=t.getValue("count",this.dataSource);this.grid.dataSource={result:e,count:i}}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.dataSource.json=g(this.dataSource.dataSource.json),this.grid.dataSource.ready=this.dataSource.ready;var r=this;t.isNullOrUndefined(this.grid.dataSource.ready)||this.grid.dataSource.ready.then(function(e){var t=r.grid.dataSource;t.dataSource.offline=!0,t.isDataAvailable=!0,t.dataSource.json=e.result,t.adaptor=new n.JsonAdaptor})}},d.prototype.extendedGridActionEvents=function(){var e=this;this.grid.actionBegin=function(r){if("sorting"===r.requestType&&r.target&&r.target.parentElement&&r.target.parentElement.classList.contains("e-hierarchycheckbox")&&(r.cancel=!0),"reorder"===i.getObject("requestType",r)&&e.notify("getColumnIndex",{}),a(e)&&e.enableVirtualization&&("virtualscroll"===r.requestType?(e.query.expand("VirtualScrollingAction"),e.showSpinner()):"searching"===r.requestType&&""===r.searchString?e.query.expand("ClearSearchingAction"):"clearFilter"===r.action&&e.query.expand("ClearFilteringAction")),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("actionBegin",r,function(t){t.cancel||e.notify("beginEdit",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("beginAdd",t),"batchsave"===t.requestType&&e.notify("batchSave",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||a(e)&&e.enableVirtualization||e.expandAll()),"searching"===t.requestType&&(""===e.searchSettings.key||!e.enableVirtualization||e.initialRender||a(e)&&e.enableVirtualization||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("actionComplete",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(".e-movablecontent"),o=e.grid.element.querySelector(".e-frozencontent");n.style.height=o.style.height="auto"}e.trigger("actionComplete",t)}}},d.prototype.extendedGridEvents=function(){var e=this,i=this;this.grid.recordDoubleClick=function(t){e.trigger("recordDoubleClick",t),e.notify("recordDoubleClick",t)},this.grid.detailDataBound=function(t){e.notify("detaildataBound",t),e.trigger("detailDataBound",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("contextMenuClick",t),e.trigger("contextMenuClick",t)},this.grid.contextMenuOpen=function(t){e.notify("contextMenuOpen",t),e.trigger("contextMenuOpen",t)},this.grid.queryCellInfo=function(t){e.renderModule.cellRender(t)}},d.prototype.bindGridDragEvents=function(){var e=this;this.grid.rowDragStartHelper=function(t){e.trigger("rowDragStartHelper",t)},this.grid.rowDragStart=function(t){e.trigger("rowDragStart",t)},this.grid.rowDrag=function(t){if(e.grid.isEdit)return void(t.cancel=!0);e.notify("row-draging",t),e.trigger("rowDrag",t)},this.grid.rowDrop=function(t){if(e.grid.isEdit)return void(t.cancel=!0);e.notify("row-dropped",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[parseInt(i.toString(),10)])&&this.columns.push(t[parseInt(i.toString(),10)])}},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[parseInt(i.toString(),10)]){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[parseInt(i.toString(),10)])}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[parseInt(n.toString(),10)]){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[parseInt(n.toString(),10)])}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[parseInt(d.toString(),10)].uid);if(a=l||{},o={},"string"==typeof this.columns[parseInt(d.toString(),10)])a.field=o.field=this.columns[parseInt(d.toString(),10)];else for(var p=0,h=Object.keys(n[parseInt(d.toString(),10)]);p<h.length;p++){var c=h[p];r===this.treeColumnIndex&&"template"===c?o[""+c]=n[parseInt(d.toString(),10)][""+c]:"columns"!==c||t.isNullOrUndefined(n[parseInt(d.toString(),10)][""+c])?this.initialRender&&!t.isNullOrUndefined(l)&&this.enablePersistence&&"edit"===c?a[""+c]=o[""+c]=l[""+c]:l&&"sortComparer"===c||(a[""+c]=o[""+c]=n[parseInt(d.toString(),10)][""+c]):(a[""+c]=this.getGridColumns(n[parseInt(d.toString(),10)][""+c],!1,this.columnModel.length-1),o[""+c]=n[parseInt(d.toString(),10)][""+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){var r=Object.keys(e),o=!1;r.indexOf("columns")>-1&&!t.isNullOrUndefined(e.columns)&&0===this.frozenColumns&&0===this.frozenRows&&!this.columnModel.some(function(e){return e.isFrozen||e.freeze})&&(this.grid.columns=this.getGridColumns(e.columns),this.grid.updateColumnObject(),o=!0);for(var a=0,d=r;a<d.length;a++){var l=d[a];switch(l){case"treeColumnIndex":this.grid.refreshColumns();break;case"allowPaging":this.grid.allowPaging=this.allowPaging;break;case"pageSettings":this.grid.pageSettings=i.getActualProperties(this.pageSettings),o=!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 p=t.getValue("count",this.dataSource);this.grid.dataSource={result:this.flatData,count:p}}else{var h=this.dataSource;this.grid.dataSource=h instanceof n.DataManager?new n.DataManager(h.dataSource,h.defaultQuery,h.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[""+l]?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[""+l].mode&&("Cell"===e[""+l].mode||"Row"===e[""+l].mode)&&this.grid.closeEdit(),this.grid.editSettings=this.getGridEditSettings()}o&&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[parseInt(n.toString(),10)]]&&(this[i[parseInt(n.toString(),10)]]=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=["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],n=0;n<e.length;n++)for(var o=this[e[parseInt(n.toString(),10)]],a=0,s=i[e[parseInt(n.toString(),10)]];!t.isNullOrUndefined(s)&&a<s.length;a++)delete o[""+s[parseInt(a.toString(),10)]];return this.ignoreInArrays(r,this.columns),this.addOnPersist(e)},d.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)t[parseInt(i.toString(),10)].columns?(this.ignoreInColumn(e,t[parseInt(i.toString(),10)]),this.ignoreInArrays(e,t[parseInt(i.toString(),10)].columns)):this.ignoreInColumn(e,t[parseInt(i.toString(),10)])},d.prototype.ignoreInColumn=function(e,i){if(t.isNullOrUndefined(i.template))for(var r=0;r<e.length;r++)delete i[e[parseInt(r.toString(),10)]],i.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);if((i.classList.contains("e-treegridexpand")||i.classList.contains("e-treegridcollapse"))&&this.grid.isEllipsisTooltip()&&this.grid.toolTipObj.close(),this.isEditCollapse=!1,this.notify("checkboxSelection",{target:i}),this.grid.isCheckBoxSelection&&!this.grid.isPersistSelection&&this.aggregates.map(function(e){return!0===e.showChildSummary}).length){var r=this.grid.getHeaderContent().querySelector(".e-checkselectall");if(this.grid.getSelectedRowIndexes().length===this.getCurrentViewRecords().length){var n=r.nextElementSibling;t.removeClass([n],["e-stop","e-uncheck"]),t.addClass([n],["e-check"])}}}},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()[parseInt(e.toString(),10)];t.extend(r,i),this.grid.editModule.updateRow(e,r)}},d.prototype.deleteRecord=function(e,i){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)||this.getSelectedRecords().length<=0){this.trigger(_,{error:"The provided value for the fieldName and data is undefined. Please ensure the fieldName and data contains number."})}this.grid.editModule&&this.grid.editModule.deleteRecord(e,i)},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){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the tr is undefined. Please ensure the tr contains HTMLTableRowElement."})}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()[parseInt(n.toString(),10)];if(t.isNullOrUndefined(o)){this.trigger(_,{error:"The provided value for the record is undefined. Please ensure the record contains ITreeData."})}S({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){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the pageNo is undefined. Please ensure the pageNo contains number."})}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,i){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the keys is undefined. Please ensure the keys contains string."})}this.grid.hideColumns(e,i),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[parseInt(a.toString(),10)]);s<d.length;s++){var l=d[s];o[""+l]=n[parseInt(a.toString(),10)][""+l]}this.columnModel.push(new C(o)),r!==this.columnModel[parseInt(a.toString(),10)].field||"checkbox"===this.columnModel[parseInt(a.toString(),10)].type||t.isNullOrUndefined(i)||""===i||(this.columnModel[parseInt(a.toString(),10)].template=i)}}return this.deepMerge=["columns"],this.grid.columns.length!==this.columnModel.length&&(this.stackedHeader=!0),this.stackedHeader&&this.allowResizing&&!t.isNullOrUndefined(this.columns)&&this.updateColumnsWidth(this.columns),this.stackedHeader||t.isNullOrUndefined(this.columns)||t.merge(this.columns,this.columnModel),this.deepMerge=void 0,this.columnModel},d.prototype.updateColumnsWidth=function(e){var i=this;e.forEach(function(e){if(!t.isNullOrUndefined(e)&&e.columns)i.updateColumnsWidth(e.columns);else if(!t.isNullOrUndefined(e)&&e.field){var r=i.grid.getColumnByField(e.field);t.isNullOrUndefined(r)||(e.width=r.width)}})},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.setFrozenCount=function(){this.grid.setFrozenCount.apply(this.grid)},d.prototype.splitFrozenCount=function(e){this.grid.splitFrozenCount.apply(this.grid,[e])},d.prototype.isFrozenGrid=function(){return this.grid.isFrozenGrid()},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[parseInt(i.toString(),10)].classList.contains("e-summaryrow")||e.push(t[parseInt(i.toString(),10)]);return e},d.prototype.getCurrentViewRecords=function(){return this.grid.currentViewData.filter(function(e){return t.isNullOrUndefined(e.isSummaryRow)})},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[parseInt(i.toString(),10)]),t[parseInt(i.toString(),10)].expanded||(i+=c(t[parseInt(i.toString(),10)]).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;if(this.isCollapseAll=!1,t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)&&t.isNullOrUndefined(n)){this.trigger(_,{error:"The provided value for the row is undefined. Please ensure the row contains row element."})}var s=this.parentData;if(this.enableVirtualization||(s=this.flatData.filter(function(e){return e.hasChildRecords})),i=this.getCollapseExpandRecords(e,i),!t.isNullOrUndefined(e)&&e.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(e,!1),this.isExpandAll&&!a(this)){var d={data:s,row:e,cancel:!1},l=!1;this.grid.pagerModule&&!t.isNullOrUndefined(this.grid.pagerModule.pagerObj.pagerdropdownModule)&&(l=!!this.grid.pagerModule.pagerObj.pagerdropdownModule.dropDownListObject.value),this.isExpandingEventTriggered?(!this.allowPaging||l&&"All"===this.grid.pagerModule.pagerObj.pagerdropdownModule.dropDownListObject.value)&&!this.expandAllPrevent&&this.isExpandingEventTriggered&&this.expandRows(e,i,s):this.trigger("expanding",d,function(a){o.expandAllPrevent=a.cancel,a.cancel||t.isNullOrUndefined(i)||(a.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s))}),this.isExpandingEventTriggered=!0}else if(!this.isExpandAll||this.isExpandAll&&a(this)){d={data:i,row:e,cancel:!1};this.trigger("expanding",d,function(t){t.cancel||(t.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s))})}},d.prototype.expandRows=function(e,i,r){this.expandCollapse("expand",e,i);if((!a(this)||u(this))&&(!s(this)||!t.isNullOrUndefined(i.Children))){var n={data:i,row:e};t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(n.data,!0),this.isExpandAll&&!this.isExpandedEventTriggered?(this.isExpandedEventTriggered=!0,n={data:r,row:e},this.trigger("expanded",n)):this.isExpandAll||this.trigger("expanded",n)}},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[parseInt(a.toString(),10)])}},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)&&!t.isNullOrUndefined(e)&&(i=this.detailTemplate?this.grid.getCurrentViewRecords()[e.getAttribute("data-rowindex")]:this.enableVirtualization&&(this.isCollapseAll||this.isExpandAll)?-1===e.rowIndex?this.grid.getCurrentViewRecords()[parseInt(e.getAttribute("data-rowindex"),10)]:this.grid.getCurrentViewRecords()[e.rowIndex]:this.rowTemplate?this.grid.getCurrentViewRecords()[e.rowIndex]:this.grid.getCurrentViewRecords()[parseInt(e.getAttribute("data-rowindex"),10)]),i},d.prototype.collapseRow=function(e,i,r){var n=this;if(this.isExpandAll=!1,t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the row is undefined. Please ensure the row contains row element."})}var o=this.parentData;if(this.enableVirtualization||(o=this.flatData.filter(function(e){return e.hasChildRecords})),i=this.getCollapseExpandRecords(e,i),this.isCollapseAll&&!a(this)){s={data:o,row:e,cancel:!1};this.isCollapsingEventTriggered?this.allowPaging||this.collapseAllPrevent||!this.isCollapsingEventTriggered||this.collapseRows(e,i,o):this.trigger("collapsing",s,function(t){n.collapseAllPrevent=t.cancel,t.cancel||(t.collapseAll&&n.expandCollapseAllChildren(i,"collapse",r),n.collapseRows(e,i,o))}),this.isCollapsingEventTriggered=!0}else if(!this.isCollapseAll||this.isCollapseAll&&a(this)){var s={data:i,row:e,cancel:!1};this.trigger("collapsing",s,function(r){r.cancel||t.isNullOrUndefined(i)||n.collapseRows(e,i,o)})}},d.prototype.collapseRows=function(e,i,r){this.expandCollapse("collapse",e,i);var n={data:i,row:e};a(this)||(t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(n.data,!1),this.isCollapseAll&&!this.isCollapsedEventTriggered?(this.isCollapsedEventTriggered=!0,n={data:r,row:e},this.trigger("collapsed",n)):this.isCollapseAll||this.trigger("collapsed",n),this.enableInfiniteScrolling&&this.grid.getContent().firstElementChild.scrollHeight-this.grid.getContent().firstElementChild.scrollTop<this.grid.getRowHeight()+ +this.height&&this.grid.getContent().firstElementChild.scrollBy(0,this.grid.getRowHeight()))},d.prototype.updateExpandStateMapping=function(e,t){var i=e;if(i.length)for(var r=0;r<i.length;r++)i[parseInt(r.toString(),10)][this.expandStateMapping]=t,S({value:i[parseInt(r.toString(),10)],action:"edit"},this,this.isSelfReference,i[parseInt(r.toString(),10)].index,this.grid.selectedRowIndex,this.expandStateMapping);else e[""+this.expandStateMapping]=t,S({value:e,action:"edit"},this,this.isSelfReference,e.index,this.grid.selectedRowIndex,this.expandStateMapping)},d.prototype.expandAtLevel=function(e){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the level is undefined. Please ensure the level contains number."})}if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){r=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!0),t.hasChildRecords&&t.level===e});this.expandAction(r,null,e,!0)}else{var r=this.getRecordDetails(e),n=i.getObject("records",r);this.expandAction(n,null,e)}},d.prototype.expandByKey=function(e){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the key is undefined. Please ensure the key contains number."})}this.expandCollapseActionByKey(e,"Expand")},d.prototype.expandAction=function(e,i,r,n){void 0===n&&(n=!1);for(var o=this,s=0;s<e.length;s++)!function(s){if(!t.isNullOrUndefined(e[parseInt(s.toString(),10)].parentItem)){var d=e[parseInt(s.toString(),10)].parentItem.uniqueID,l=o.flatData.filter(function(e){return e.uniqueID===d});a(o)&&(l=o.getCurrentViewRecords().filter(function(e){return e.uniqueID===d})),!1===l[0].expanded?(e.push(l[0]),l[0].expanded=!0):h(o,l[0],o.parentData)||l[0].expanded&&void 0!==l[0].parentItem&&e.push(l[0])}n||o.expandRow(null,e[parseInt(s.toString(),10)],i,r)}(s);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(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the level is undefined. Please ensure the level contains number."})}if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var r=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!1),t.hasChildRecords&&t.level===e});this.collapseAction(r,null,!0)}else{var n=this.getRecordDetails(e),o=i.getObject("records",n);this.collapseAction(o)}},d.prototype.collapseByKey=function(e){if(t.isNullOrUndefined(e)){this.trigger(_,{error:"The provided value for the key is undefined. Please ensure the key contains number."})}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[parseInt(r.toString(),10)],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(){if(0===this.getCurrentViewRecords().length){this.trigger(_,{error:"The provided value for the datasource is undefined. Please ensure to add the dataSource."})}this.isExpandedEventTriggered=!1,this.isExpandingEventTriggered=!1,this.expandCollapseAll("expand")},d.prototype.collapseAll=function(){if(0===this.getCurrentViewRecords().length){this.trigger(_,{error:"The provided value for the datasource is undefined. Please ensure to add the dataSource."})}this.isCollapsedEventTriggered=!1,this.isCollapsingEventTriggered=!1,this.expandCollapseAll("collapse")},d.prototype.expandCollapseAll=function(e){var i;if(!(i=this.rowTemplate?[].slice.call(this.grid.getContentTable().querySelectorAll("tr")).filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))}):this.getRows().filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))})).length&&this.getRows().length&&i.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)}),i.length)for(n=0;n<i.length;n++)"collapse"===e?t.isNullOrUndefined(this.getCurrentViewRecords()[i[parseInt(n.toString(),10)].rowIndex])||this.collapseRow(i[parseInt(n.toString(),10)]):this.enableVirtualization?"true"!==i[0].getAttribute("aria-expanded")&&this.expandRow(i[0]):this.expandRow(i[parseInt(n.toString(),10)]);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(var n=0;n<i.length;n++)"collapse"===e?this.collapseRow(i[parseInt(n.toString(),10)]):this.expandRow(i[parseInt(n.toString(),10)]);this.isExpandAll=!1,this.isCollapseAll=!1},d.prototype.expandCollapse=function(e,i,r,n){var o,d=this,l={row:i,data:r,childData:[],requestType:e};t.isNullOrUndefined(r)||(o=this.grid.currentViewData.filter(function(e){return e.parentUniqueID===r.uniqueID}));var p;(!a(this)&&"expand"===e&&this.isSelfReference&&s(this)&&!o.length||"collapse"===e||this.isExpandAll&&this.loadChildOnDemand&&!a(this)&&this.isSelfReference&&s(this))&&this.updateChildOnDemand(l);var c=this.getRows();if(this.rowTemplate){R=this.getContentTable().rows;c=[].slice.call(R)}var g;if(t.isNullOrUndefined(i)?(g=this.grid.currentViewData.indexOf(r),i=c[parseInt(g.toString(),10)]):g=+i.getAttribute("data-rowindex"),t.isNullOrUndefined(i)||i.setAttribute("aria-expanded","expand"===e?"true":"false"),!(this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)||a(this)||s(this)){var f=void 0;if("expand"===e){if(f="table-row",n||t.isNullOrUndefined(r)||(r.expanded=!0,this.uniqueIDCollection[r.uniqueID].expanded=r.expanded),t.isNullOrUndefined(i)||(p=i.getElementsByClassName("e-treegridcollapse")[0]),n&&!t.isNullOrUndefined(r[this.expandStateMapping])&&r[this.expandStateMapping]&&t.isNullOrUndefined(p)&&(p=i.getElementsByClassName("e-treegridexpand")[0]),t.isNullOrUndefined(p))return;p.classList.contains("e-treegridexpand")||t.addClass([p],"e-treegridexpand"),t.removeClass([p],"e-treegridcollapse")}else{if(f="none",n&&!s(this)||t.isNullOrUndefined(i)||(r.expanded=!1,this.uniqueIDCollection[r.uniqueID].expanded=r.expanded),t.isNullOrUndefined(i)||(p=i.getElementsByClassName("e-treegridexpand")[0]),n&&!t.isNullOrUndefined(r[this.expandStateMapping])&&!r[this.expandStateMapping]&&t.isNullOrUndefined(p)&&(p=i.getElementsByClassName("e-treegridcollapse")[0]),t.isNullOrUndefined(p))return;p.classList.contains("e-treegridcollapse")||t.addClass([p],"e-treegridcollapse"),t.removeClass([p],"e-treegridexpand")}i.querySelectorAll(".e-treerowcell")[0].setAttribute("aria-expanded","expand"===e?"true":"false");var m=c.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);else{s(this)&&!o.length&&"collapse"!==e||this.localExpand(e,i,r);var S=this.getVisibleRecords()[this.getVisibleRecords().length-1].index,v=this.getRowByIndex(S);this.grid.getContentTable().clientHeight<=this.grid.getContent().clientHeight&&!t.isNullOrUndefined(v)&&!v.cells[0].classList.contains("e-lastrowcell")&&this.lastRowBorder(v,!0)}if(s(this)&&"expand"===e){var w=this.getCurrentViewRecords().filter(function(e){return h(d,e,d.parentData)});this.dataResults.result=w}if(!t.isNullOrUndefined(p)&&p.closest(".e-treerowcell").classList.contains("e-cellselectionbackground")&&(p.closest(".e-treerowcell").classList.remove("e-cellselectionbackground"),p.closest(".e-treerowcell").removeAttribute("aria-selected")),this.isPixelHeight()&&!i.cells[0].classList.contains("e-lastrowcell"))for(var I=this.getRows(),R=this.getContentTable().rows,x=(I=[].slice.call(R)).length-1;x>=0;x--)if(!y(I[parseInt(x.toString(),10)])){var C=this.getContentTable().scrollHeight,b=this.getContent().clientHeight;this.lastRowBorder(I[parseInt(x.toString(),10)],C<=b);break}this.notify("rowExpandCollapse",{detailrows:m,action:f,record:r,row:i}),this.updateAltRow(c)}else this.notify("localPagedExpandCollapse",{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[parseInt(a.toString(),10)].parentUniqueID===e.data.uniqueID&&(o.splice(a,1),a-=1);return void(this.dataResults.result=o)}var d=new n.Deferred;e.childDataBind=d.resolve;var l=e.data;this.trigger("dataStateChange",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[parseInt(a.toString(),10)].taskData===l.taskData){o=a;break}for(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,a=0;a<h;a++)l[r.childMapping]&&d.filter(function(e,t){e[r.parentIdMapping]===l[r.idMapping]&&d.splice(t,1)}),p[parseInt(a.toString(),10)]?(p[parseInt(a.toString(),10)].level=l.level+1,p[parseInt(a.toString(),10)].index=Math.ceil(1e3*Math.random()),p[parseInt(a.toString(),10)].parentItem=t.extend({},l),p[parseInt(a.toString(),10)].taskData=t.extend({},p[parseInt(a.toString(),10)]),delete p[parseInt(a.toString(),10)].parentItem.childRecords,delete p[parseInt(a.toString(),10)].taskData.parentItem,p[parseInt(a.toString(),10)].parentUniqueID=l.uniqueID,p[parseInt(a.toString(),10)].uniqueID=i.getUid(r.element.id+"_data_"),t.setValue("uniqueIDCollection."+p[parseInt(a.toString(),10)].uniqueID,p[parseInt(a.toString(),10)],r),(!t.isNullOrUndefined(p[parseInt(a.toString(),10)][r.childMapping])||p[parseInt(a.toString(),10)][r.hasChildMapping]&&s(r))&&(p[parseInt(a.toString(),10)].hasChildRecords=!0),s(r)&&l[r.childMapping]&&l[r.childMapping][parseInt(a.toString(),10)]?n.splice(o+1+a,0,p[parseInt(a.toString(),10)]):n.splice(o+1+a,l[r.childMapping]&&l[r.childMapping][parseInt(a.toString(),10)]?1:0,p[parseInt(a.toString(),10)])):n.splice(o+1+a,1);n[parseInt(o.toString(),10)][""+r.childMapping]=p,n[parseInt(o.toString(),10)].childRecords=p,n[parseInt(o.toString(),10)].expanded=!0,t.setValue("uniqueIDCollection."+n[parseInt(o.toString(),10)].uniqueID,n[parseInt(o.toString(),10)],r);for(var c=0;c<e.childData.length;c++)d.push(e.childData[parseInt(c.toString(),10)])}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.enableInfiniteScrolling&&(r.getContentTable().parentElement.scrollTop=u),r.trigger("expanded",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("remoteExpand",{record:i,rows:a,parentRow:t});var s={row:t,data:i};a.length>0&&this.trigger("expanded",s)}else"collapse"===e&&this.enableVirtualization?this.dataModule.fetchRemoteChildData({action:e,record:o.data,rows:null,parentRow:o.row}):(this.collapseRemoteChild({record:i,rows:a}),this.trigger("collapsed",o))},d.prototype.localExpand=function(e,i,r){var n,o=this.grid.currentViewData.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(I=0;I<o.length;I++){var g=this.grid.getRowIndexByPrimaryKey(o[parseInt(I.toString(),10)][""+u]);n.push(this.getRows()[parseInt(g.toString(),10)])}}else n=p.filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))});var f=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.frozenRows||this.frozenColumns||this.getFrozenColumns()||f)&&(d=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))})),f&&(l=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))}));var m=this.grid.getRowsObject(),y=this.grid.currentViewData,S=y.filter(function(e){return e.uniqueID===r.uniqueID}),v=y.indexOf(S[0]);t.isNullOrUndefined(m[parseInt(v.toString(),10)].visible)||!1===m[parseInt(v.toString(),10)].visible||(m[parseInt(v.toString(),10)].visible=!0);for(var w=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))}),I=0;I<n.length;I++){if(t.isNullOrUndefined(n[parseInt(I.toString(),10)])||(n[parseInt(I.toString(),10)].style.display=c),!t.isNullOrUndefined(n[parseInt(I.toString(),10)])&&!this.allowPaging&&!(this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this))){m[n[parseInt(I.toString(),10)].rowIndex].visible="none"!==c;var R=y.filter(function(e){return e.uniqueID===S[0].parentUniqueID});!t.isNullOrUndefined(R[0])&&p[y.indexOf(R[0])].getElementsByClassName("e-treegridcollapse").length&&(m[parseInt(v.toString(),10)].visible=!1)}t.isNullOrUndefined(d)||(d[parseInt(I.toString(),10)].style.display=c),t.isNullOrUndefined(l)||(l[parseInt(I.toString(),10)].style.display=c),this.notify("childRowExpand",{row:n[parseInt(I.toString(),10)]}),!t.isNullOrUndefined(o[parseInt(I.toString(),10)].childRecords)&&o[parseInt(I.toString(),10)].childRecords.length>0&&("expand"!==e||t.isNullOrUndefined(o[parseInt(I.toString(),10)].expanded)||o[parseInt(I.toString(),10)].expanded)&&(this.expandCollapse(e,n[parseInt(I.toString(),10)],o[parseInt(I.toString(),10)],!0),this.frozenColumns<=this.treeColumnIndex&&!t.isNullOrUndefined(d)&&this.expandCollapse(e,d[parseInt(I.toString(),10)],o[parseInt(I.toString(),10)],!0))}for(I=0;I<w.length;I++)t.isNullOrUndefined(w[parseInt(I.toString(),10)])||this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||(m[w[parseInt(I.toString(),10)].rowIndex].visible="none"!==c,w[parseInt(I.toString(),10)].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[parseInt(r.toString(),10)];"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(){var e=this.getContentTable().rows;e=[].slice.call(e);for(var t=this.grid.getRowsObject(),i=0;i<e.length;i++){var r=this.grid.getContentTable().rows[parseInt(i.toString(),10)].cells[this.treeColumnIndex],n=e[parseInt(i.toString(),10)],o={data:0!==t.length?t[parseInt(i.toString(),10)].data:new Object,row:n,cell:r,column:this.getColumns()[this.treeColumnIndex]};this.renderModule.cellRender(o)}},d.prototype.collapseRemoteChild=function(e,i){t.isNullOrUndefined(i)||i||this.loadChildOnDemand||(e.record.expanded=!1);var r,n,o=e.rows,a=[],s=[],d=this.getFrozenLeftColumnsCount()>0||this.getFrozenRightColumnsCount()>0;d&&(a=this.getRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))}),s=this.getRows().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[parseInt(l.toString(),10)].style.display="none",r=o[parseInt(l.toString(),10)];var p=o[parseInt(l.toString(),10)].querySelector(".e-detailrowexpand");if(t.isNullOrUndefined(p)||this.grid.detailRowModule.collapse(p),d&&(a[parseInt(l.toString(),10)].style.display="none",s[parseInt(l.toString(),10)].style.display="none",o[parseInt(l.toString(),10)].querySelector(".e-treecolumn-container .e-treegridexpand")||(a[parseInt(l.toString(),10)].querySelector(".e-treecolumn-container .e-treegridexpand")?r=a[parseInt(l.toString(),10)]:s[parseInt(l.toString(),10)].querySelector(".e-treecolumn-container .e-treegridexpand")&&(r=s[parseInt(l.toString(),10)]))),r.querySelector(".e-treecolumn-container .e-treegridexpand")){var h=r.querySelector(".e-treecolumn-container .e-treegridexpand");n=this.rowTemplate?this.grid.getCurrentViewRecords()[o[parseInt(l.toString(),10)].rowIndex]:this.grid.getRowObjectFromUID(o[parseInt(l.toString(),10)].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[parseInt(g.toString(),10)].querySelector(".e-gridrowindex"+n.index+"level"+(n.level+1))&&c.push(u[parseInt(g.toString(),10)]);c.length&&n.expanded&&this.collapseRemoteChild({record:n,rows:c},!1)}}},d.prototype.sanitize=function(e){return this.enableHtmlSanitizer&&"string"==typeof e?t.SanitizeHtmlHelper.sanitize(e):e},d.prototype.updateRowAndCellElements=function(e,t,i){for(var r=0;r<e.length;r++)this.renderModule.cellRender({data:e[parseInt(r.toString(),10)],cell:t[parseInt(r.toString(),10)].cells[parseInt(i.toString(),10)],column:this.grid.getColumns()[this.treeColumnIndex],requestType:"rowDragAndDrop"}),"indenting"!==this.action&&"outdenting"!==this.action||this.renderModule.RowModifier({data:e[parseInt(r.toString(),10)],row:t[parseInt(r.toString(),10)]})},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,i,r,n,o,a,s,d){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the fieldName, filterOperator and filterValue are undefined. Please ensure the fieldName, filterOperator and filterValue."})}this.grid.filterByColumn(e,i,r,n,o,a,s,d)},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,i,r){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the index is undefined. Please ensure the index contains number."})}this.clipboardModule.paste(e,i,r)},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.getCellFromIndex(e,t)},d.prototype.getMovableDataRows=function(){return this.grid.getDataRows()},d.prototype.getMovableRowByIndex=function(e){return this.grid.getRowByIndex(e)},d.prototype.getMovableRows=function(){return this.grid.getRows()},d.prototype.getFrozenRightRowByIndex=function(e){return this.grid.getRowByIndex(e)},d.prototype.getFrozenRightRows=function(){return this.grid.getRows()},d.prototype.getFrozenRightDataRows=function(){return this.grid.getDataRows()},d.prototype.getFrozenRightCellFromIndex=function(e,t){return this.grid.getCellFromIndex(e,t)},d.prototype.getFrozenLeftColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getFrozenRightColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getMovableColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(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(!t.isNullOrUndefined(this.columns)&&this.columns,0)+this.frozenColumns},d.prototype.getFrozenCount=function(e,t){for(var i=0,r=e.length;i<r;i++)e[parseInt(i.toString(),10)].columns?t=this.getFrozenCount(e[parseInt(i.toString(),10)].columns,t):e[parseInt(i.toString(),10)].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,i,r){if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)){this.trigger(_,{error:"The provided value for the fromIndexes, toIndex and position is undefined. Please ensure the fromIndexes and toIndex contains number and position contains string."})}this.rowDragAndDropModule.reorderRows(e,i,r)},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 we([t.Property(0)],d.prototype,"frozenRows",void 0),we([t.Property(0)],d.prototype,"frozenColumns",void 0),we([t.Property("Ellipsis")],d.prototype,"clipMode",void 0),we([t.Property([])],d.prototype,"columns",void 0),we([t.Property(null)],d.prototype,"childMapping",void 0),we([t.Property(null)],d.prototype,"hasChildMapping",void 0),we([t.Property(0)],d.prototype,"treeColumnIndex",void 0),we([t.Property(null)],d.prototype,"idMapping",void 0),we([t.Property(null)],d.prototype,"parentIdMapping",void 0),we([t.Property(!1)],d.prototype,"enableCollapseAll",void 0),we([t.Property(null)],d.prototype,"expandStateMapping",void 0),we([t.Property(!1)],d.prototype,"allowRowDragAndDrop",void 0),we([t.Property([])],d.prototype,"dataSource",void 0),we([t.Property()],d.prototype,"query",void 0),we([t.Property()],d.prototype,"cloneQuery",void 0),we([t.Property("AllPages")],d.prototype,"printMode",void 0),we([t.Property(!1)],d.prototype,"allowPaging",void 0),we([t.Property(!1)],d.prototype,"loadChildOnDemand",void 0),we([t.Property(!1)],d.prototype,"allowTextWrap",void 0),we([t.Complex({},T)],d.prototype,"textWrapSettings",void 0),we([t.Property(!1)],d.prototype,"allowReordering",void 0),we([t.Property(!1)],d.prototype,"allowResizing",void 0),we([t.Property(!1)],d.prototype,"autoCheckHierarchy",void 0),we([t.Complex({},ne)],d.prototype,"pageSettings",void 0),we([t.Complex({},i.RowDropSettings)],d.prototype,"rowDropSettings",void 0),we([t.Property("USD")],d.prototype,"currencyCode",void 0),we([t.Property()],d.prototype,"pagerTemplate",void 0),we([t.Property(!1)],d.prototype,"showColumnMenu",void 0),we([t.Property(!1)],d.prototype,"showColumnChooser",void 0),we([t.Property(!1)],d.prototype,"allowSorting",void 0),we([t.Property(!0)],d.prototype,"allowMultiSorting",void 0),we([t.Complex({},fe)],d.prototype,"sortSettings",void 0),we([t.Collection([],de)],d.prototype,"aggregates",void 0),we([t.Complex({},he)],d.prototype,"editSettings",void 0),we([t.Property(!1)],d.prototype,"allowFiltering",void 0),we([t.Property()],d.prototype,"detailTemplate",void 0),we([t.Complex({},U)],d.prototype,"filterSettings",void 0),we([t.Complex({},J)],d.prototype,"searchSettings",void 0),we([t.Property()],d.prototype,"toolbar",void 0),we([t.Property()],d.prototype,"toolbarTemplate",void 0),we([t.Property("Default")],d.prototype,"gridLines",void 0),we([t.Property()],d.prototype,"contextMenuItems",void 0),we([t.Property()],d.prototype,"columnMenuItems",void 0),we([t.Property()],d.prototype,"rowTemplate",void 0),we([t.Property("Parent")],d.prototype,"copyHierarchyMode",void 0),we([t.Property(null)],d.prototype,"rowHeight",void 0),we([t.Property(!0)],d.prototype,"enableAltRow",void 0),we([t.Property(!0)],d.prototype,"allowKeyboard",void 0),we([t.Property(!1)],d.prototype,"enableHover",void 0),we([t.Property(!1)],d.prototype,"enableAutoFill",void 0),we([t.Property(!1)],d.prototype,"enableAdaptiveUI",void 0),we([t.Property(!1)],d.prototype,"enableImmutableMode",void 0),we([t.Property("auto")],d.prototype,"height",void 0),we([t.Property("auto")],d.prototype,"width",void 0),we([t.Complex({},P)],d.prototype,"loadingIndicator",void 0),we([t.Property(!0)],d.prototype,"enableVirtualMaskRow",void 0),we([t.Property(!1)],d.prototype,"enableVirtualization",void 0),we([t.Property(!1)],d.prototype,"enableColumnVirtualization",void 0),we([t.Property(!1)],d.prototype,"enableHtmlSanitizer",void 0),we([t.Property(!1)],d.prototype,"enableInfiniteScrolling",void 0),we([t.Complex({},Se)],d.prototype,"infiniteScrollSettings",void 0),we([t.Property("All")],d.prototype,"columnQueryMode",void 0),we([t.Event()],d.prototype,"created",void 0),we([t.Event()],d.prototype,"load",void 0),we([t.Event()],d.prototype,"expanding",void 0),we([t.Event()],d.prototype,"expanded",void 0),we([t.Event()],d.prototype,"collapsing",void 0),we([t.Event()],d.prototype,"collapsed",void 0),we([t.Event()],d.prototype,"cellSave",void 0),we([t.Event()],d.prototype,"cellSaved",void 0),we([t.Event()],d.prototype,"actionBegin",void 0),we([t.Event()],d.prototype,"actionComplete",void 0),we([t.Event()],d.prototype,"beginEdit",void 0),we([t.Event()],d.prototype,"batchAdd",void 0),we([t.Event()],d.prototype,"batchDelete",void 0),we([t.Event()],d.prototype,"batchCancel",void 0),we([t.Event()],d.prototype,"beforeBatchAdd",void 0),we([t.Event()],d.prototype,"beforeBatchDelete",void 0),we([t.Event()],d.prototype,"beforeBatchSave",void 0),we([t.Event()],d.prototype,"cellEdit",void 0),we([t.Event()],d.prototype,"actionFailure",void 0),we([t.Event()],d.prototype,"dataBound",void 0),we([t.Event()],d.prototype,"dataSourceChanged",void 0),we([t.Event()],d.prototype,"dataStateChange",void 0),we([t.Event()],d.prototype,"recordDoubleClick",void 0),we([t.Event()],d.prototype,"rowDataBound",void 0),we([t.Event()],d.prototype,"detailDataBound",void 0),we([t.Event()],d.prototype,"queryCellInfo",void 0),we([t.Property(!0)],d.prototype,"allowSelection",void 0),we([t.Event()],d.prototype,"rowSelecting",void 0),we([t.Event()],d.prototype,"rowSelected",void 0),we([t.Event()],d.prototype,"rowDeselecting",void 0),we([t.Event()],d.prototype,"rowDeselected",void 0),we([t.Event()],d.prototype,"headerCellInfo",void 0),we([t.Event()],d.prototype,"cellSelecting",void 0),we([t.Event()],d.prototype,"columnMenuOpen",void 0),we([t.Event()],d.prototype,"columnMenuClick",void 0),we([t.Event()],d.prototype,"cellSelected",void 0),we([t.Event()],d.prototype,"cellDeselecting",void 0),we([t.Event()],d.prototype,"cellDeselected",void 0),we([t.Event()],d.prototype,"resizeStart",void 0),we([t.Event()],d.prototype,"resizing",void 0),we([t.Event()],d.prototype,"resizeStop",void 0),we([t.Event()],d.prototype,"columnDragStart",void 0),we([t.Event()],d.prototype,"columnDrag",void 0),we([t.Event()],d.prototype,"columnDrop",void 0),we([t.Event()],d.prototype,"checkboxChange",void 0),we([t.Event()],d.prototype,"printComplete",void 0),we([t.Event()],d.prototype,"beforePrint",void 0),we([t.Event()],d.prototype,"toolbarClick",void 0),we([t.Event()],d.prototype,"beforeDataBound",void 0),we([t.Event()],d.prototype,"contextMenuOpen",void 0),we([t.Event()],d.prototype,"contextMenuClick",void 0),we([t.Event()],d.prototype,"beforeCopy",void 0),we([t.Event()],d.prototype,"beforePaste",void 0),we([t.Event()],d.prototype,"rowDrag",void 0),we([t.Event()],d.prototype,"rowDragStart",void 0),we([t.Event()],d.prototype,"rowDragStartHelper",void 0),we([t.Event()],d.prototype,"rowDrop",void 0),we([t.Property(-1)],d.prototype,"selectedRowIndex",void 0),we([t.Complex({},Z)],d.prototype,"selectionSettings",void 0),we([t.Property(!1)],d.prototype,"allowExcelExport",void 0),we([t.Property(!1)],d.prototype,"allowPdfExport",void 0),we([t.Event()],d.prototype,"pdfQueryCellInfo",void 0),we([t.Event()],d.prototype,"pdfHeaderQueryCellInfo",void 0),we([t.Event()],d.prototype,"excelQueryCellInfo",void 0),we([t.Event()],d.prototype,"excelHeaderQueryCellInfo",void 0),we([t.Event()],d.prototype,"beforeExcelExport",void 0),we([t.Event()],d.prototype,"excelExportComplete",void 0),we([t.Event()],d.prototype,"beforePdfExport",void 0),we([t.Event()],d.prototype,"pdfExportComplete",void 0),d=l=we([t.NotifyPropertyChanges],d)}(t.Component),Re=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[parseInt(n.toString(),10)])){e=n;break}this.parent.setProperties({treeColumnIndex:e},!0)},e}(),xe=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}(),Ce=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("row-draging",this.Rowdraging,this),this.parent.on("row-dropped",this.rowDropped,this),this.parent.on("rows-add",this.rowsAdded,this),this.parent.on("rows-remove",this.rowsRemoved,this)},e.prototype.reorderRows=function(e,i,r){var n=this.parent;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 o=[],a=0;a<e.length;a++){g=this.parent.getRowByIndex(e[parseInt(a.toString(),10)]).rowIndex;o[parseInt(a.toString(),10)]=this.parent.getCurrentViewRecords()[parseInt(g.toString(),10)]}var d={data:o,dropIndex:i};if(s(this.parent)||this.dropRows(d,!0),n.isLocalData&&(n.flatData=this.orderToIndex(n.flatData)),"outdenting"===this.parent.action&&(t.isNullOrUndefined(o[0].parentItem)||(o[0].level=o[0].parentItem.level+1)),this.parent.grid.refresh(),this.parent.enableImmutableMode&&"middleSegment"===this.dropPosition){g=void 0;this.parent.allowRowDragAndDrop?g=this.parent.treeColumnIndex+1:"indenting"===this.parent.action&&(g=this.parent.treeColumnIndex);var l=this.parent.getRows()[e[0]],p=d.data[0],h=[];(y=[]).push(p),h.push(l);var c=m(this.parent,d.data[0].parentUniqueID),u=this.parent.getRows()[parseInt(i.toString(),10)];y.push(c),h.push(u),this.parent.updateRowAndCellElements(y,h,g)}if(this.parent.enableImmutableMode&&"outdenting"===this.parent.action){var g=void 0;this.parent.allowRowDragAndDrop?g=this.parent.treeColumnIndex+1:"outdenting"===this.parent.action&&(g=this.parent.treeColumnIndex);var f=d.data[0],l=this.parent.getRows()[e[0]],y=[],h=[];y.push(f),h.push(l),this.parent.updateRowAndCellElements(y,h,g)}}},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()[parseInt(n.toString(),10)]: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()[parseInt(n.toString(),10)]: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(p=0;p<r.getCurrentViewRecords().length;p++)r.getCurrentViewRecords()[parseInt(p.toString(),10)].taskData===s.parentItem.taskData&&(d=p,r.enableVirtualization&&(d=parseInt(r.getRows()[parseInt(p.toString(),10)].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;for(var d=void 0,l=this.selectedRecord.parentItem,p=0;p<r.getCurrentViewRecords().length;p++)r.getCurrentViewRecords()[parseInt(p.toString(),10)].uniqueID===l.uniqueID&&(d=p);this.parent.enableVirtualization&&this.selectedRecord&&(d=parseInt(this.parent.getRows()[parseInt(d.toString(),10)].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("actionBegin",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[parseInt(i.toString(),10)].index=i,!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem)){var r=t.getValue("uniqueIDCollection."+e[parseInt(i.toString(),10)].parentUniqueID,this.parent);e[parseInt(i.toString(),10)].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[parseInt(o.toString(),10)]).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){for(var l,p=this.parent,h=e.records,o=e.records.length-1;o>-1;o--){l=h[parseInt(o.toString(),10)],!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]=[]),!t.isNullOrUndefined(l[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[parseInt(u.toString(),10)])&&(h.splice(u,0,c[parseInt(u.toString(),10)]),c[parseInt(u.toString(),10)].taskData=t.extend({},c[parseInt(u.toString(),10)]),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[parseInt(o.toString(),10)].uniqueID,r[parseInt(o.toString(),10)],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[parseInt(t.toString(),10)],(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))for(var s=this.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords,d=0;d<s.length;d++)o.parentItem.taskData[this.parent.childMapping][parseInt(d.toString(),10)]=s[parseInt(d.toString(),10)].taskData}else{for(var l=Object.keys(e),d=0;d<l.length;d++)e[parseInt(d.toString(),10)][this.parent.childMapping]===o.taskData[this.parent.childMapping]&&(i=d);"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[parseInt(s.toString(),10)].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,m=f+g,y=m+g,S=i.getObject("originalEvent.event",n),v=i.getObject("originalEvent.event",n),w="mousemove"===S.type?S.pageY:t.isNullOrUndefined(v)||t.isNullOrUndefined(v.changedTouches)?null:v.changedTouches[0].pageY;this.parent.enableVirtualization&&(w="mousemove"===S.type?S.clientY:t.isNullOrUndefined(v)||t.isNullOrUndefined(v.changedTouches)?null:v.changedTouches[0].clientY);var I=w<=f,R=w>f&&w<=m,x=w>m&&w<=y;if(I||R||x){if(I&&"Invalid"!==this.dropPosition&&(this.removeChildBorder(),this.dropPosition="topSegment",this.removetopOrBottomBorder(),this.addFirstrowBorder(o),this.removeErrorElem(),this.removeLastrowBorder(o),this.topOrBottomBorder(n.target)),R&&"Invalid"!==this.dropPosition){this.removetopOrBottomBorder();var C=[],b=t.closest(n.target,"tr");(C=[].slice.call(b.querySelectorAll(".e-rowcell,.e-rowdragdrop,.e-detailrowcollapse"))).length>0&&this.addRemoveClasses(C,!0,"e-childborder"),this.addLastRowborder(o),this.addFirstrowBorder(o),this.dropPosition="middleSegment"}x&&"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=this.parent.sanitize(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=this.parent.sanitize(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[parseInt(r.toString(),10)].classList.add(i):e[parseInt(r.toString(),10)].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()[parseInt(a.toString(),10)];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),t.isNullOrUndefined(r.rowDropSettings.targetID)&&!this.canDrop&&this.removetopOrBottomBorder(),r.rowDropSettings.targetID&&(l=i.parentsUntil(e.target,"e-treegrid"))&&l.id===this.parent.rowDropSettings.targetID&&l.ej2_instances[0].rowDragAndDropModule.updateIcon(e.rows,a,e),e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)){var l=i.parentsUntil(e.target,"e-treegrid");l||(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),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()[parseInt(a.toString(),10)],l=e.data[0];if("middleSegment"===this.dropPosition){var p=[],h=[];p.push(l),h.push(d);l=m(this.parent,e.data[0].parentUniqueID),a=this.parent.grid.getRowIndexByPrimaryKey(l[""+o]);var c=this.parent.getRows()[parseInt(a.toString(),10)];p.push(l),h.push(c);for(var u=0;u<p.length;u++)this.parent.renderModule.cellRender({data:p[parseInt(u.toString(),10)],cell:h[parseInt(u.toString(),10)].cells[parseInt(n.toString(),10)],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[parseInt(n.toString(),10)],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[parseInt(u.toString(),10)]=p[parseInt(u.toString(),10)].index;var g=r.dataSource;if(null!==this.parent.idMapping&&(t.isNullOrUndefined(this.dropPosition)||"bottomSegment"===this.dropPosition||"Invalid"===this.dropPosition)&&!g.length){for(var f=[],u=0;u<p.length;u++)if(p[parseInt(u.toString(),10)].hasChildRecords){f.push(p[parseInt(u.toString(),10)]);for(var m=c(p[parseInt(u.toString(),10)]),y=0;y<m.length;y++)f.push(m[parseInt(y.toString(),10)])}f.length&&(p=f)}n.notify("rows-remove",{indexes:h,records:p}),r.notify("rows-add",{toIndex:d,records:p});var S=r.rowDragAndDropModule.treeGridData;if(!t.isNullOrUndefined(S))for(u=0;u<S.length;u++)if(S[parseInt(u.toString(),10)].index=u,!t.isNullOrUndefined(S[parseInt(u.toString(),10)].parentItem)){var v=t.getValue("uniqueIDCollection."+S[parseInt(u.toString(),10)].parentUniqueID+".index",r);S[parseInt(u.toString(),10)].parentItem.index=v}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()[parseInt(o.toString(),10)];this.droppedRecord=m(this.parent,a.parentItem.uniqueID)}"middleSegment"===this.dropPosition&&(this.parent.getCurrentViewRecords()[parseInt(r.toString(),10)].level===i.level?this.droppedRecord=m(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()[parseInt(d.toString(),10)];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()[parseInt(p.toString(),10)]}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=this,m=0;m<g;m++)!function(a){if(r=h[parseInt(a.toString(),10)],f.draggedRecord=r,"Invalid"!==f.dropPosition&&!t.isNullOrUndefined(f.droppedRecord)){if(n.rowDropSettings.targetID&&!i||f.deleteDragRow(),f.draggedRecord===f.droppedRecord){var s=f.getTargetIdx(e.target.offsetParent.parentElement);isNaN(s)&&(s=f.getTargetIdx(e.target.parentElement)),e.dropIndex=s,o=f.droppedRecord=f.parent.getCurrentViewRecords()[e.dropIndex]}(o.parentItem||"middleSegment"===f.dropPosition)&&-1!==(g=(u=n.parentData).indexOf(f.draggedRecord))&&u.splice(g,1);var d=f.treeGridData.indexOf(o);if(f.dropAtTop(d),"bottomSegment"===f.dropPosition){if(o.hasChildRecords?(c=f.getChildCount(o,0),f.parent.parentIdMapping&&f.treeData.splice(d+c+1,0,f.draggedRecord.taskData),f.treeGridData.splice(d+c+1,0,f.draggedRecord)):(f.parent.parentIdMapping&&f.treeData.splice(d+1,0,f.draggedRecord.taskData),f.treeGridData.splice(d+1,0,f.draggedRecord)),t.isNullOrUndefined(o.parentItem)&&(delete r.parentItem,delete r.parentUniqueID,r.level=0,f.parent.parentIdMapping&&(r[f.parent.parentIdMapping]=null)),o.parentItem){var l=f.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,f.parent.parentIdMapping&&(r[f.parent.parentIdMapping]=o[f.parent.parentIdMapping],r.parentItem=o.parentItem,r.level=o.level)}if(r.hasChildRecords){f.updateChildRecordLevel(r,1),f.updateChildRecord(r,d+c+1)}}f.dropMiddle(d)}if(t.isNullOrUndefined(r.parentItem)){var u=n.parentData,g=u.indexOf(f.droppedRecord),m=0;u.filter(function(e){r.uniqueID===e.uniqueID&&m++}),"bottomSegment"===f.dropPosition&&0===m?u.splice(g+1,0,r):"topSegment"===f.dropPosition&&0===m&&u.splice(g,0,r)}n.rowDragAndDropModule.refreshGridDataSource()}(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[parseInt(e.toString(),10)].parentItem,this.draggedRecord.parentUniqueID=this.treeGridData[parseInt(e.toString(),10)].parentUniqueID,this.draggedRecord.level=this.treeGridData[parseInt(e.toString(),10)].level,this.treeGridData.splice(parseInt(e.toString(),10),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=m(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[parseInt(a.toString(),10)]:t.getValue("uniqueIDCollection."+e.childRecords[parseInt(a.toString(),10)].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[parseInt(o.toString(),10)]:t.getValue("uniqueIDCollection."+e.childRecords[parseInt(o.toString(),10)].uniqueID,this.parent);var a=void 0;e.parentItem&&(a=m(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||S({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[parseInt(g.toString(),10)][this.parent.idMapping]===o.taskData[this.parent.idMapping]&&(p=g);for(g=0;g<this.treeGridData.length;g++)this.treeGridData[parseInt(g.toString(),10)][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 m=this.parent.parentData.indexOf(o);-1!==m&&(r.parentData.splice(m,1),i.splice(m,1))}if(-1===f&&!r.parentIdMapping)for(var y=r.getPrimaryKeyFieldNames()[0],v=0;v<this.treeGridData.length;v++)this.treeGridData[parseInt(v.toString(),10)][""+y]===o[""+y]&&(f=v);if(!r.parentIdMapping){var w=this.getChildCount(o,0);this.treeGridData.splice(f,w+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=m(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[parseInt(s.toString(),10)],!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[parseInt(l.toString(),10)][this.parent.idMapping]===i.taskData[this.parent.idMapping]&&(r=l);for(var p=0;p<this.treeGridData.length;p++)if(this.treeGridData[parseInt(p.toString(),10)][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[parseInt(r.toString(),10)]).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("row-draging",this.Rowdraging),this.parent.off("row-dropped",this.rowDropped),this.parent.off("rows-add",this.rowsAdded),this.parent.off("rows-remove",this.rowsRemoved))},e.prototype.getModuleName=function(){return"rowDragAndDrop"},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)}}(),De=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},Me=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return be(i,e),De([t.Property()],i.prototype,"targetID",void 0),i}(t.ChildProperty),Oe=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)}}(),Pe=function(e){function i(t){var i=e.call(this,t)||this;return i.addEventListener(),i}return Oe(i,e),i.prototype.addEventListener=function(){this.parent.on("data-listener",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");var a=e.prototype.generateRows.call(this,i,r);if(!t.isNullOrUndefined(this.visualData))for(var d=0;d<a.length;d++)a[parseInt(d.toString(),10)].index=this.visualData.indexOf(a[parseInt(d.toString(),10)].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.data={},this.groups={}):"virtualscroll"===e&&this.cache[parseInt(i.toString(),10)]&&this.cache[parseInt(i.toString(),10)].length>this.parent.contentModule.getBlockSize()&&delete this.cache[parseInt(i.toString(),10)]}else(t||"virtualscroll"===e)&&(this.cache={},this.data={},this.groups={});return t},i}(i.VirtualRowModelGenerator),Ee=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[parseInt(r.toString(),10)];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=m(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=m(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=m(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)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[parseInt(o.toString(),10)].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[parseInt(o.toString(),10)].uniqueID)||(this.filteredResult.push(r[parseInt(o.toString(),10)]),t.setValue("uniqueIDFilterCollection."+r[parseInt(o.toString(),10)].uniqueID,r[parseInt(o.toString(),10)],this.parent),n=!0)}if("None"===s&&(0!==this.parent.grid.filterSettings.columns.length||""!==this.parent.grid.searchSettings.key)&&-1!==this.flatFilteredData.indexOf(r[parseInt(o.toString(),10)])){n=!0;break}!t.isNullOrUndefined(a)&&a.length&&(n=this.checkChildExsist(r[parseInt(o.toString(),10)])),"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=m(this.parent,e[parseInt(i.toString(),10)].parentUniqueID);if(-1!==e.indexOf(r)){var n=m(this.parent,e[parseInt(i.toString(),10)].parentUniqueID,!0);e[parseInt(i.toString(),10)].filterLevel=n.filterLevel+1}else e[parseInt(i.toString(),10)].filterLevel=0,this.filteredParentRecs.push(e[parseInt(i.toString(),10)])}},e.prototype.clearFilterLevel=function(e){var i,r=0,n=e.flatData,o=n.length;for(r;r<o;r++){var a=(i=n[parseInt(r.toString(),10)]).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}(),Ae=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=new i.Data(this.parent.grid),h=Object();if(t.setValue("isCsv",s,h),t.setValue("cancel",!1,h),t.isNullOrUndefined(e)||(this.isCollapsedStatePersist=e.isCollapsedStatePersist),!t.isNullOrUndefined(e)){if(!t.isNullOrUndefined(e.dataSource)&&!e.dataSource.dataSource)return this.parent.grid.excelExportModule.Map(this.parent.grid,e,r,o,s,a);if("CurrentPage"===e.exportType)return e.dataSource=this.parent.getCurrentViewRecords(),this.parent.grid.excelExportModule.Map(this.parent.grid,e,r,o,s,a)}return new Promise(function(c){var u=!d.isLocal()||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),g=new n.Query;if(d.isLocal()||((g=d.generateQuery(g)).queries=d.parent.grid.getDataModule().generateQuery().queries,g=i.ExportHelper.getQuery(d.parent.grid,p),t.isNullOrUndefined(d.parent.filterModule)&&(g.queries=g.queries.slice(1,2),g.params=g.params.slice(0,0)),t.setValue("query",g,h)),d.parent.trigger("beforeExcelExport",t.extend(h,e)),i.getObject("cancel",h))return null;u.executeQuery(g).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,c(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){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}),this.parent.aggregates.length>0&&(e.query=a.query),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&&m(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[parseInt(t.toString(),10)].rows&&(e.worksheets[parseInt(t.toString(),10)].pageSetup={isSummaryRowBelow:!1})},e.prototype.isLocal=function(){return!a(this.parent)&&u(this.parent)},e}(),Ne=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("beforePdfExport",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.query=o.query,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}(),Ue=function(){function e(e){i.Grid.Inject(i.Page),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("localPagedExpandCollapse",this.collapseExpandPagedchilds,this),this.parent.on("pagingActions",this.pageAction,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("localPagedExpandCollapse",this.collapseExpandPagedchilds),this.parent.off("pagingActions",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){if(t.isNullOrUndefined(e)){this.parent.trigger(_,{error:"The provided value for the message is undefined. Please ensure the message contains string."})}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=this,a=0;a<i.length;a++)!function(t){n.push(i[parseInt(t.toString(),10)]);var r=[];i[parseInt(t.toString(),10)].hasChildRecords&&(r=e.filter(function(e){return i[parseInt(t.toString(),10)].uniqueID===e.parentUniqueID}),n=o.pageRoot(e,r,n))}(a);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;m=(g=this.parent.grid.pageSettings.pageSize)*((f=this.parent.grid.pageSettings.currentPage)-1);a=a.skip(m).take(g),r=i.executeLocal(a);var s=this.pageRoot(e.result,r);e.result=s}else{var d=new n.DataManager(e.result),p=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),c=d.executeLocal((new n.Query).where(p)),u=void 0;u=l(this.parent)&&"collapse"!==e.actionArgs.action&&"expand"!==e.actionArgs.action?c:c.filter(function(e){return h(t.parent,e)}),e.count=u.length;var a=new n.Query,g=this.parent.grid.pageSettings.pageSize;this.updatePageSize(e);var f=this.parent.grid.pageSettings.currentPage;u.length<f*g&&(f=(f=Math.floor(u.length/g)+(u.length%g?1:0))||1,this.parent.grid.setProperties({pageSettings:{currentPage:f}},!0));var m=g*(f-1);a=a.skip(m).take(g),d.dataSource.json=u,e.result=d.executeLocal(a)}this.parent.notify("updateAction",e)},e}(),ke=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("rowSelected",this.refreshToolbar,this),this.parent.on("rowDeselected",this.refreshToolbar,this),this.parent.on("toolbarClick",this.toolbarClickHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("rowSelected",this.refreshToolbar),this.parent.off("rowDeselected",this.refreshToolbar),this.parent.off("toolbarClick",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;"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.indentOutdentAction(null,"indent"),e.item.id===i.grid.element.id+"_outdent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule.indentOutdentAction(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}(),qe=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[parseInt(s.toString(),10)])||a.push(r[parseInt(s.toString(),10)]);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){for(var m=0,d=g;m<d;m++)if(o=h[parseInt(m.toString(),10)],l=this.getChildRecordsLength(o,c)){for(var y=this,S=1,v=u;S<=v;S++)!function(e,r){var a=void 0;a={};for(var s=0;s<f.length;s++)a[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(s.toString(),10)]))?f[parseInt(s.toString(),10)]:i.getObject("field",f[parseInt(s.toString(),10)]))]=null;if(a=y.createSummaryItem(a,y.parent.aggregates[e-1]),!y.parent.aggregates[e-1].showChildSummary)return"continue";var d;c.map(function(e,t){if(e.uniqueID===o.uniqueID)return void(d=t)});var p=d+l+e,h=t.extend({},o);delete h.childRecords,delete h[y.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)}(S);this.flatChildRecords=[]}}else{for(var w={},I=0,R=f.length;I<R;I++)w[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(I.toString(),10)]))?f[parseInt(I.toString(),10)]:i.getObject("field",f[parseInt(I.toString(),10)]))]=null;for(var S=1,x=u;S<=x;S++)this.createSummaryItem(w,this.parent.aggregates[S-1])}return c},e.prototype.getChildRecordsLength=function(e,r){for(var n,o=0,a=Object.keys(r).length;o<a;o++)if(n=r[parseInt(o.toString(),10)],e===(t.isNullOrUndefined(n.parentItem)?null:r.filter(function(e){return e.uniqueID===n.parentItem.uniqueID})[0])){if(this.flatChildRecords.push(n),!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[parseInt(r.toString(),10)].columnName)?i.columns[parseInt(r.toString(),10)].field:i.columns[parseInt(r.toString(),10)].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[parseInt(r.toString(),10)],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[parseInt(r.toString(),10)],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(){return 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[parseInt(g.toString(),10)];var f=e.field+" - "+u[parseInt(g.toString(),10)].toLowerCase(),m="Custom"!==u[parseInt(g.toString(),10)]?i.getObject("aggregates",c):i.calculateAggregate(u[parseInt(g.toString(),10)],c,e,this.parent),y=e.columnName,S="Custom"!==u[parseInt(g.toString(),10)]?m[""+f]:m;a[""+y]=a[""+y]||{},a[""+y][""+f]=S,a[""+y][u[parseInt(g.toString(),10)]]=t.isNullOrUndefined(m)?" ":l(S)}s.format=e.getFormatter();var v=t.createElement("td",{className:"e-summary"});if(this.parent.isReact){p.fn(a[e.columnName],this.parent,p.property,"",null,null,v),this.parent.renderReactTemplates()}else i.appendChildren(v,p.fn(a[e.columnName],this.parent,p.property));var w=a[""+e.columnName][""+h];return-1===v.innerHTML.indexOf(w)?v.innerHTML+w:v.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}(),Te=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(m(this.parent,e[parseInt(r.toString(),10)].uniqueID,!0))||(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[parseInt(r.toString(),10)]):(this.storedIndex++,this.flatSortedData[this.storedIndex]=e[parseInt(r.toString(),10)]),e[parseInt(r.toString(),10)].hasChildRecords){var o=new n.DataManager(e[parseInt(r.toString(),10)].childRecords).executeLocal(i);if(this.parent.allowRowDragAndDrop&&-1!==e[parseInt(r.toString(),10)].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}(),Ve=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}(),Be=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)){if((n||o||a.grid.isEdit)&&t.isNullOrUndefined(s)){for(var d=0,l=e.items;d<l.length;d++){var p=l[d];"Outdent"!==p.text&&"Indent"!==p.text||a.grid.contextMenuModule.hiddenItems.push(p.text)}a.grid.contextMenuModule.contextMenu.hideItems(a.grid.contextMenuModule.hiddenItems),n.style.display=o.style.display="none"}}else{var h=e.event.target.closest("td");if(!t.isNullOrUndefined(h)&&(t.isNullOrUndefined(h)||h.classList.contains("e-rowcell")&&0===h.querySelectorAll(".e-gridform").length)){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 c=a.getCurrentViewRecords()[s.rowIndex];t.isNullOrUndefined(c)||(c.level>a.getCurrentViewRecords()[s.rowIndex-1].level?n.style.display="none":n.style.display="block",c.level===a.getCurrentViewRecords()[s.rowIndex-1].level&&(n.style.display="block"),0===c.level?o.style.display="none":o.style.display="block")}}else{for(var u=0,g=e.items;u<g.length;u++)"Outdent"!==(p=g[u]).text&&"Indent"!==p.text||a.grid.contextMenuModule.hiddenItems.push(p.text);a.grid.contextMenuModule.contextMenu.hideItems(a.grid.contextMenuModule.hiddenItems),n.style.display=o.style.display="none"}}},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}(),ze=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("cellSaved",this.cellSaved,this),this.parent.on("batchAdd",this.batchAdd,this),this.parent.on("beforeBatchAdd",this.beforeBatchAdd,this),this.parent.on("batchSave",this.batchSave,this),this.parent.on("beforeBatchDelete",this.beforeBatchDelete,this),this.parent.on("beforeBatchSave",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("cellSaved",this.cellSaved),this.parent.off("batchAdd",this.batchAdd),this.parent.off("batchSave",this.batchSave),this.parent.off("beforeBatchAdd",this.beforeBatchAdd),this.parent.off("beforeBatchDelete",this.beforeBatchDelete),this.parent.off("beforeBatchSave",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[parseInt(o.toString(),10)][""+r]),i.splice(e,1);this.batchAddedRecords=this.batchRecords=this.batchAddRowRecord=this.batchDeletedRecords=this.currentViewRecords=[]},e.prototype.cellSaved=function(e){if(e.column.index===this.parent.treeColumnIndex&&this.parent.renderModule.cellRender({data:e.rowData,cell:e.cell,column:this.parent.grid.getColumnByIndex(e.column.index)}),this.isAdd&&"Batch"===this.parent.editSettings.mode&&"Bottom"!==this.parent.editSettings.newRowPosition){var r=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,o=void 0,a=this.parent.grid.getPrimaryKeyFieldNames()[0],s=void 0,d=void 0,l=this.selectedIndex>-1?this.batchRecords[parseInt(this.addRowIndex.toString(),10)].parentItem:null,p=void 0,h=void 0,u=void 0,f="Top"===this.parent.editSettings.newRowPosition||-1===this.selectedIndex?0:"Above"===this.parent.editSettings.newRowPosition?this.addRowIndex:this.addRowIndex+1;if(f=this.getActualRowObjectIndex(f),this.newBatchRowAdded){if(this.batchRecords.length&&(p=this.batchRecords[this.addRowIndex][this.parent.idMapping],u=this.batchRecords[this.addRowIndex][this.parent.parentIdMapping],this.batchRecords[parseInt(this.addRowIndex.toString(),10)].parentItem&&(h=this.batchRecords[parseInt(this.addRowIndex.toString(),10)].parentItem.uniqueID)),this.batchAddedRecords=g(this.batchAddedRecords),this.batchAddRowRecord=g(this.batchAddRowRecord),this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]),o=this.parent.grid.getRowsObject()[parseInt(f.toString(),10)].changes,o.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+o.uniqueID,o,this.parent),!Object.prototype.hasOwnProperty.call(o,"level")){if(this.batchIndex=-1===this.selectedIndex?0:this.batchIndex,"Child"===this.parent.editSettings.newRowPosition){if(o.primaryParent=l,this.selectedIndex>-1){o.parentItem=t.extend({},this.batchRecords[this.addRowIndex]),o.parentUniqueID=o.parentItem.uniqueID,delete o.parentItem.childRecords,delete o.parentItem[this.parent.childMapping],o.level=o.parentItem.level+1,o.index=this.batchIndex;var m=c(this.batchRecords[this.addRowIndex]).length,y=c(this.batchRecords[this.addRowIndex])[m-1];y=t.isNullOrUndefined(y)?this.batchRecords[this.addRowIndex]:y,s=r.map(function(e){return e[""+a]}).indexOf(y[""+a]),this.isSelfReference&&(o[this.parent.parentIdMapping]=p),I(a,o.parentItem,"add",this.parent,this.isSelfReference,o)}}else if(("Above"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)&&!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])){if(o.level=this.batchRecords[parseInt(this.addRowIndex.toString(),10)].level,o.level&&this.selectedIndex>-1&&(o.parentItem=l,o.parentUniqueID=h,delete o.parentItem.childRecords,delete o.parentItem[this.parent.childMapping]),o.index="Below"===this.parent.editSettings.newRowPosition?this.batchIndex:this.batchIndex-1,"Below"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){var m=c(this.batchRecords[this.addRowIndex]).length,y=c(this.batchRecords[this.addRowIndex])[m-1];y=t.isNullOrUndefined(y)?this.batchRecords[this.addRowIndex]:y,s=r.map(function(e){return e[""+a]}).indexOf(y[""+a])}if("Above"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){y=this.batchRecords[this.addRowIndex];s=r.map(function(e){return e[""+a]}).indexOf(y[""+a])}this.isSelfReference&&(o[this.parent.parentIdMapping]=u)}o.index=-1===o.index?0:o.index,o.hasChildRecords=!1,o.childRecords=[],this.batchRecords.splice(o.index,0,o),this.currentViewRecords.splice(o.index,0,o),d=s||o.index,"Above"!==this.parent.editSettings.newRowPosition&&(d=0===o.index?d:d+1),r.splice(d,0,o),this.batchAddedRecords.push(o)}this.parent.grid.getRowsObject()[parseInt(f.toString(),10)].data=o,this.newBatchRowAdded=!1}}},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("beginAdd",{}),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()[parseInt(h.toString(),10)]),(this.parent.frozenRows||this.parent.frozenColumns||this.parent.getFrozenColumns())&&a.push(this.parent.grid.getHeaderContent()[parseInt(h.toString(),10)]);if(!t.isNullOrUndefined(r.parentItem)){var u=m(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 y=this.batchRecords.map(function(e){return e[""+d]}).indexOf(s[parseInt(h.toString(),10)][""+d]);-1!==y&&this.batchRecords.splice(y,1)}for(h=0;h<a.length;h++)t.isNullOrUndefined(a[parseInt(h.toString(),10)])||this.parent.grid.selectionModule.selectedRecords.push(a[parseInt(h.toString(),10)])},e.prototype.updateRowIndex=function(){for(var e=this.parent.grid.getDataRows(),t=0;t<e.length;t++)e[parseInt(t.toString(),10)].setAttribute("data-rowindex",t.toString())},e.prototype.updateChildCount=function(e){for(var i=this.parent.grid.getPrimaryKeyFieldNames()[0],r="Child"===this.parent.editSettings.newRowPosition?"primaryParent":"parentItem",n=0;n<this.parent.getBatchChanges().addedRecords.length;n++)t.isNullOrUndefined(this.parent.getBatchChanges().addedRecords[parseInt(n.toString(),10)][""+r])||this.parent.getBatchChanges().addedRecords[parseInt(n.toString(),10)][""+r][""+i]===e[parseInt(this.addRowIndex.toString(),10)][""+i]&&(this.batchChildCount=this.batchChildCount+1)},e.prototype.beforeBatchSave=function(e){var t=e.batchChanges.changedRecords;if(e.batchChanges.changedRecords.length)for(r=0;r<t.length;r++)S({value:t[parseInt(r.toString(),10)],action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,void 0);if(e.batchChanges.deletedRecords.length)for(var i=e.batchChanges.deletedRecords,r=0;r<i.length;r++){this.deleteUniqueID(i[parseInt(r.toString(),10)].uniqueID);for(var n=c(i[parseInt(r.toString(),10)]),o=0;o<n.length;o++)this.deleteUniqueID(n[parseInt(o.toString(),10)].uniqueID);e.batchChanges.deletedRecords=e.batchChanges.deletedRecords.concat(n)}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=this.parent.grid.getCurrentViewRecords(),r=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,o=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords))for(l=0;l<this.batchAddedRecords.length;l++)if(-1!==(e=r.map(function(e){return e[""+o]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)][""+o]))&&r.splice(e,1),"Child"===this.parent.editSettings.newRowPosition&&(e=i.map(function(e){return e[""+o]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)].parentItem?this.batchAddedRecords[parseInt(l.toString(),10)].parentItem[""+o]:this.batchAddedRecords[parseInt(l.toString(),10)][""+o]),!t.isNullOrUndefined(i[parseInt(e.toString(),10)])))for(var a=i[parseInt(e.toString(),10)].childRecords,s=0;a&&s<a.length;s++)a[parseInt(s.toString(),10)][""+o]===this.batchAddedRecords[parseInt(l.toString(),10)][""+o]&&i[parseInt(e.toString(),10)].childRecords.splice(s,1);if(!t.isNullOrUndefined(this.parent.targetElement)){var d=this.parent.targetElement.closest("tr");this.parent.collapseRow(d),this.parent.targetElement=null}if(!t.isNullOrUndefined(this.batchDeletedRecords))for(var l=0;l<this.batchDeletedRecords.length;l++)if(!t.isNullOrUndefined(this.batchDeletedRecords[parseInt(l.toString(),10)].parentItem)){e=i.map(function(e){return e[""+o]}).indexOf(this.batchDeletedRecords[parseInt(l.toString(),10)].parentItem[""+o]);var p=0===this.batchDeletedRecords[parseInt(l.toString(),10)].index?this.batchDeletedRecords[parseInt(l.toString(),10)].index:this.batchDeletedRecords[parseInt(l.toString(),10)].index-1;t.isNullOrUndefined(i[parseInt(e.toString(),10)])||i[parseInt(e.toString(),10)].childRecords.splice(p,0,this.batchDeletedRecords[parseInt(l.toString(),10)])}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=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,a=this.parent.grid.getCurrentViewRecords(),s=this.parent.grid.getPrimaryKeyFieldNames()[0],d=r.addedRecords,l=void 0,p=void 0,h=void 0;if(d.length>1&&"Bottom"!==this.parent.editSettings.newRowPosition&&d.reverse(),"Bottom"!==this.parent.editSettings.newRowPosition&&!Object.hasOwnProperty.call(e,"updatedRecords")){if(o.splice(o.length-d.length,d.length),this.parent.editModule.isAddedRowByMethod&&d.length&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){d.reverse();for(var c=0;c<d.length;c++){var u=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[parseInt(c.toString(),10)].getAttribute("data-rowindex"),10);o.splice(u,0,d[parseInt(c.toString(),10)])}}if(this.parent.allowPaging||o.length===a.length){var f=g(o);if(f.length){var m=f.map(function(e){return e[""+s]}).indexOf(a[0][""+s]),y=m+this.parent.grid.pageSettings.pageSize;a=f.splice(m,y)}}else a.length>d.length&&a.splice(a.length-d.length,d.length)}for(0===this.batchAddRowRecord.length&&this.batchAddRowRecord.push(this.parent.flatData[e.index]),this.parent.editModule.isAddedRowByContextMenu&&d.reverse(),i=0;i<d.length;i++){var v=t.extend({},d[parseInt(i.toString(),10)]);if(delete v.parentItem,delete v.uniqueID,delete v.index,delete v.level,delete v.hasChildRecords,delete v.childRecords,delete v.parentUniqueID,t.isNullOrUndefined(v.primaryParent)||delete v.primaryParent,d.length>1&&this.parent.editModule.isAddedRowByContextMenu){var w=this.parent.editSettings.newRowPosition;this.parent.editSettings.newRowPosition=this.parent.editModule.previousNewRowPosition,this.parent.editModule.previousNewRowPosition=w}if(d[parseInt(i.toString(),10)].taskData=v,h=this.batchAddRowRecord[parseInt(i.toString(),10)],t.isNullOrUndefined(h)&&(h=this.batchAddRowRecord[i-1]),this.isSelfReference&&(t.isNullOrUndefined(d[parseInt(i.toString(),10)].parentItem)||I(s,d[parseInt(i.toString(),10)].parentItem,"add",this.parent,this.isSelfReference,d[parseInt(i.toString(),10)])),t.isNullOrUndefined(h)||(p=h.index),"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(d[parseInt(i.toString(),10)].parentItem)&&-1===this.selectedIndex&&(l=-1,h=null),S({value:d[parseInt(i.toString(),10)],action:"add"},this.parent,this.isSelfReference,p,l,void 0,h),l=null,"Child"===this.parent.editSettings.newRowPosition&&!t.isNullOrUndefined(d[parseInt(i.toString(),10)].parentItem)&&(t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.isSelfReference))for(var R=a.map(function(e){return e[""+s]}).indexOf(d[parseInt(i.toString(),10)].parentItem[""+s]),x=a[parseInt(R.toString(),10)].childRecords,C=0;C<x.length;C++)x[parseInt(C.toString(),10)][""+s]===d[parseInt(i.toString(),10)][""+s]&&a[parseInt(R.toString(),10)].childRecords.splice(C,1)}if(r.deletedRecords.length)for(i=0;i<r.deletedRecords.length;i++)S({value:r.deletedRecords[parseInt(i.toString(),10)],action:"delete"},this.parent,this.isSelfReference,p,l,void 0,h);this.parent.parentData=[];for(var b=0;b<o.length;b++)o[parseInt(b.toString(),10)].index=b,t.setValue("uniqueIDCollection."+o[parseInt(b.toString(),10)].uniqueID+".index",b,this.parent),o[parseInt(b.toString(),10)].level||this.parent.parentData.push(o[parseInt(b.toString(),10)])}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();return("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&this.selectedIndex>-1&&(!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])&&this.batchRecords[this.addRowIndex].expanded&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length?(e+=c(this.batchRecords[this.addRowIndex]).length,"Child"!==this.parent.editSettings.newRowPosition&&(e+=this.getBatchChildCount())):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),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[parseInt(r.toString(),10)].index,1)},e.prototype.nextCellIndex=function(e){this.parent.getSelectedRows().length?e.index=this.parent.getSelectedRows()[0].rowIndex:e.index=this.batchIndex},e}(),Le=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 ze(this.parent),this.addEventListener()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.addEventListener=function(){this.parent.on("crudAction",this.crudAction,this),this.parent.on("beginEdit",this.beginEdit,this),this.parent.on("beginAdd",this.beginAdd,this),this.parent.on("recordDoubleClick",this.recordDoubleClick,this),this.parent.on("cellSave",this.cellSave,this),this.parent.on("batchCancel",this.batchCancel,this),this.parent.grid.on("key-pressed",this.keyPressed,this),this.parent.grid.on("batchedit-form",this.lastCellTab,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on("cellEdit",this.cellEdit,this),this.parent.on("actionBegin",this.editActionEvents,this),this.parent.on("actionComplete",this.editActionEvents,this),this.parent.grid.on("double-tap",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("edit-form",this.beforeStartEdit,this),this.parent.grid.on("before-batch-cancel",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){if(this.doubleClickTarget=e.target,e.target.classList.contains("e-frame")&&0===this.parent.getCurrentViewRecords().length&&(this.doubleClickTarget=null),e.target.classList.contains("e-treegridcollapse")||e.target.classList.contains("e-treegridexpand")){var r=i.parentsUntil(e.target,"e-row"),n=r&&parseInt(r.getAttribute("data-rowindex"),10);!t.isNullOrUndefined(n)&&n>=0&&this.parent.allowPaging&&(this.parent.grid.getDataRows()[n].dataset.uid=this.parent.grid.contentModule.getRows()[n].uid)}},e.prototype.getRowPosition=function(e){e.newRowPosition=this.parent.editSettings.newRowPosition,e.addRowIndex=this.addRowIndex,e.dataRowIndex=+this.prevAriaRowIndex},e.prototype.beforeStartEdit=function(e){"Cell"===this.parent.editSettings.mode&&this.parent.trigger("actionBegin",e)},e.prototype.beforeBatchCancel=function(e){"Cell"===this.parent.editSettings.mode&&(e.requestType="cancel",this.parent.trigger("actionComplete",e))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("crudAction",this.crudAction),this.parent.off("beginEdit",this.beginEdit),this.parent.off("beginAdd",this.beginAdd),this.parent.off("recordDoubleClick",this.recordDoubleClick),this.parent.off("batchCancel",this.batchCancel),this.parent.grid.off("key-pressed",this.keyPressed),this.parent.grid.off("batchedit-form",this.lastCellTab),this.parent.grid.off("content-ready",this.contentready),this.parent.off("cellEdit",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("double-tap",this.recordDoubleClick),this.parent.off("savePreviousRowPosition",this.savePreviousRowPosition),this.parent.grid.off("edit-form",this.beforeStartEdit),this.parent.grid.off("before-batch-cancel",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=!t.isNullOrUndefined(s.dataSource)&&s.dataSource.adaptor;if(!t.isNullOrUndefined(d)&&(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()[parseInt(l.toString(),10)][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[parseInt(c.toString(),10)].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.getRows(),d=this.parent.grid.getRowsObject(),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[parseInt(o.toString(),10)];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&&(o+=1,d=s[parseInt(o.toString(),10)],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("cellEdit",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.prototype.cellSave=function(e){var i=this;if("Cell"===this.parent.editSettings.mode&&this.parent.element.querySelector("form")){e.cancel=!0;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){if(t[d[0]]===e.rowData[d[0]])return void(o=i)});else{var l=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o=l?(this.parent.getRows().indexOf(r),this.parent.getRows().indexOf(r)):-1===this.parent.getRows().indexOf(r)&&this.parent.getFrozenColumns()>0?this.parent.grid.getRows().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("actionBegin",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;if(this.parent.isGantt&&!this.parent.loadChildOnDemand)this.updateCell(e,o),t.setValue("isEdit",!1,this.parent.grid),this.afterCellSave(e,r);else{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),t.setValue("isEdit",!1,i.parent.grid),i.afterCellSave(e,r)})}}}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),t.setValue("isEdit",!1,this.parent.grid),this.afterCellSave(e,r)}this.parent.enableVirtualization&&(this.parent.grid.contentModule.virtualData={})},e.prototype.afterCellSave=function(e,i){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"),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(),S({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 r={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("actionComplete",r)},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()[parseInt(t.toString(),10)].data=e.rowData},e.prototype.crudAction=function(e,i){S(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[parseInt(o.toString(),10)].index=o;var s=this.parent.grid.getPrimaryKeyFieldNames()[0];e.value[""+s]===r[parseInt(o.toString(),10)][""+s]&&"add"===e.action&&(r[parseInt(o.toString(),10)].level=this.internalProperties.level,r[parseInt(o.toString(),10)].taskData=this.internalProperties.taskData,r[parseInt(o.toString(),10)].uniqueID=this.internalProperties.uniqueID,t.isNullOrUndefined(this.internalProperties.parentItem)||(r[parseInt(o.toString(),10)].parentItem=this.internalProperties.parentItem,r[parseInt(o.toString(),10)].parentUniqueID=this.internalProperties.parentUniqueID),r[parseInt(o.toString(),10)].childRecords=this.internalProperties.childRecords),t.setValue("uniqueIDCollection."+r[parseInt(o.toString(),10)].uniqueID+".index",o,this.parent);var d=this.parent.dataSource.adaptor;(a(this.parent)||d instanceof n.RemoteSaveAdaptor)&&t.setValue("uniqueIDCollection."+r[parseInt(o.toString(),10)].uniqueID,r[parseInt(o.toString(),10)],this.parent),r[parseInt(o.toString(),10)].level||this.parent.parentData.push(r[parseInt(o.toString(),10)])}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[parseInt(n.toString(),10)];if(!t.isNullOrUndefined(o)){u=t.getValue("uniqueIDCollection."+o.uniqueID+".index",this.parent);if(o.index=u,!t.isNullOrUndefined(o.parentItem)){var a=t.getValue("uniqueIDCollection."+o.parentItem.uniqueID+".index",this.parent);o.parentItem.index=a}}}var s=-1,d=this.parent.treeColumnIndex;if(this.parent.getFrozenColumns()>0)for(var l=i[0].querySelectorAll(".e-rowcell"),p=0;p<l.length;p++)if(l[parseInt(p.toString(),10)].classList.contains("e-gridrowindex0level0")){d=p;break}for(var h=0;h<this.parent.getRows().length;h++){i[parseInt(h.toString(),10)].classList.contains("e-detailrow")||s++;var c=r[parseInt(s.toString(),10)];if(!t.isNullOrUndefined(c)){var u=c.index,g=c.level,f=i[parseInt(h.toString(),10)];t.isNullOrUndefined(c.parentItem)||(u=t.getValue("uniqueIDCollection."+c.parentItem.uniqueID+".index",this.parent));var m=f.cells[parseInt(d.toString(),10)];if(!t.isNullOrUndefined(m)){for(p=0;p<m.classList.length;p++){var y=m.classList[parseInt(p.toString(),10)],S=y.match(/e-gridrowindex/i),v=y.match(/e-griddetailrowindex/i);null!=S&&t.removeClass([m],y),null!=v&&t.removeClass([m],y)}i[parseInt(h.toString(),10)].classList.contains("e-detailrow")?t.addClass([m],"e-griddetailrowindex"+u+"level"+g):t.addClass([m],"e-gridrowindex"+u+"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&&("Above"===this.parent.editSettings.newRowPosition?e="before":("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(this.selectedIndex>-1||d)&&s&&(e="after",!t.isNullOrUndefined(r[parseInt(i.toString(),10)])&&r[parseInt(i.toString(),10)].expanded&&("Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)?(i+=c(r[parseInt(i.toString(),10)]).length,"Child"!==this.parent.editSettings.newRowPosition&&(i+=this.batchEditModule.getBatchChildCount())):this.parent.enableVirtualization||(i+=c(r[parseInt(i.toString(),10)]).length))),(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="rows",p=this.parent.grid.contentModule[""+l][0],h=document.activeElement;n[i+1][""+e](n[0]),t.setValue("batchIndex",i+1,this.batchEditModule);var u="Above"===this.parent.editSettings.newRowPosition?i:i+1;if("Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule[""+l].splice(0,1),this.parent.grid.contentModule[""+l].splice(u,0,p)),"Row"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode){for(var g=this.parent.grid.getContentTable().querySelectorAll(".e-griderror"),f=0;f<g.length;f++)g[parseInt(f.toString(),10)].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)&&h.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 m=this.parent.getBatchChanges().addedRecords,y=void 0;if(m.length)for(f=0;f<m.length;f++)t.isNullOrUndefined(m[parseInt(f.toString(),10)].uniqueID)&&(y=m[parseInt(f.toString(),10)]);var S={action:"add",data:y,index:i,seletedRow:0};this.beginAddEdit(S),this.batchEditModule.batchAddRowRecord.push(this.batchEditModule.addRowRecord),this.batchEditModule.batchAddedRecords.push(S.data)}},e.prototype.beginEdit=function(e){if("refresh"===e.requestType&&this.isOnBatch)return void(e.cancel=!0);if("Cell"===this.parent.editSettings.mode&&"beginEdit"===e.requestType)return void(e.cancel=!0);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=this,o=0;o<i.length;o++)!function(t){n.parent.flatData.filter(function(n){n[""+r[0]]===e.data[parseInt(t.toString(),10)][r[0]]&&(i[parseInt(t.toString(),10)]=n)})}(o);for(o=0;o<i.length;o++){this.deleteUniqueID(i[parseInt(o.toString(),10)].uniqueID);for(var a=c(i[parseInt(o.toString(),10)]),s=0;s<a.length;s++)this.deleteUniqueID(a[parseInt(s.toString(),10)].uniqueID);e.data=e.data.concat(a)}}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 d='.e-row[data-rowindex="'+this.selectedIndex+'"]',l=void 0;this.selectedIndex>-1&&"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition?(this.prevAriaRowIndex=this.selectedIndex.toString(),l=this.parent.getContent().querySelector(d),this.addRowIndex=l?l.rowIndex:0):this.prevAriaRowIndex&&"-1"!==this.prevAriaRowIndex?(d='.e-row[data-rowindex="'+this.prevAriaRowIndex+'"]',l=this.parent.getContent().querySelector(d),this.addRowIndex=l?l.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.isAddedRowByContextMenu&&-1!==this.parent.grid.selectedRowIndex)&&(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.parent.getSelectedRecords()[0])||(this.addRowRecord=this.parent.getSelectedRecords()[0]),t.isNullOrUndefined(this.addRowRecord)&&this.parent.getCurrentViewRecords().length>this.addRowIndex&&"save"===e.requestType&&0!==this.parent.getSelectedRecords().length&&(this.addRowRecord=this.parent.getCurrentViewRecords()[this.addRowIndex]),this.isAddedRowByMethod=!1,e=this.beginAddEdit(e)},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,y=this.parent.getRows(),S=y.length?s.indexOf(s[0]):0,v=y.length?+y[y.length-1].getAttribute("data-rowindex"):0,w=!(!this.parent.enableVirtualization||0===e.index)||this.selectedIndex>=S&&this.selectedIndex<=v;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 R=c(s[this.addRowIndex]).length,x=s[this.addRowIndex].index;d=R>0?x+R:x}else if("Child"===this.parent.editSettings.newRowPosition){a="after",(this.selectedIndex>-1||f)&&w&&(r.parentItem=t.extend({},s[this.addRowIndex]),r.parentUniqueID=r.parentItem.uniqueID,delete r.parentItem.childRecords,delete r.parentItem[this.parent.childMapping]);var C=c(s[this.addRowIndex]).length,b=s[this.addRowIndex].index;this.selectedIndex>=0&&(r.level=l+1),d=C>0?b+C:b,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)||I(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&&w&&(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)||I(o,r.parentItem,"add",this.parent,this.isSelfReference,r))),null!=a&&(this.selectedIndex>-1||f)&&w&&(e.index="before"===a?d:d+1),"Bottom"===this.parent.editSettings.newRowPosition){l=0;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[parseInt(O.toString(),10)].parentItem){u=m(this.parent,M[parseInt(O.toString(),10)].parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var P=u.childRecords.indexOf(M[parseInt(O.toString(),10)]);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("batchSave",{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.getDataRows().length&&this.updateIndex(this.parent.grid.dataSource,this.parent.getDataRows(),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}(),Fe=function(){function e(e){i.Grid.Inject(i.CommandColumn),this.parent=e}return e.prototype.getModuleName=function(){return"commandColumn"},e.prototype.destroy=function(){},e}(),je=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[parseInt(r.toString(),10)].getElementsByClassName("e-detailrowcollapse"),o=this.parent.grid.getRowObjectFromUID(e[parseInt(r.toString(),10)].getAttribute("data-Uid")),a=i.getObject("parentItem",this.parent.grid.getCurrentViewRecords()[parseInt(r.toString(),10)]);(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[parseInt(t.toString(),10)].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[parseInt(o.toString(),10)].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}(),_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)}}(),He=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 _e(r,e),r.prototype.getModelGenerator=function(){return new Pe(this.parent)},r.prototype.getRowByIndex=function(e){return this.parent.enableVirtualization&&this.parent.isFrozenGrid()?this.getRowCollection(e,!0):this.parent.getDataRows().filter(function(t){return parseInt(t.getAttribute("data-rowindex"),10)===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("data-rowindex"),10),o=this.parent.getDataRows(),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()[parseInt(e.toString(),10)].data:a:e<=this.parent.frozenRows?o[parseInt(e.toString(),10)]:o[e-n+this.parent.frozenRows]),a},r.prototype.addEventListener=function(){this.parent.on("virtual-action-args",this.virtualOtherAction,this),this.parent.on("index-modifier",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||"delete"===e.requestType&&this.endIndex>e.count-this.parent.pageSettings.pageSize)&&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),this.endIndex-this.startIndex!==this.parent.pageSettings.pageSize&&this.totalRecords>this.parent.pageSettings.pageSize&&this.endIndex===this.totalRecords?(e.startIndex=this.endIndex-this.parent.pageSettings.pageSize,e.endIndex=this.endIndex):(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("actionComplete",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 Ge(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(){if(this.parent.getRows().length&&!t.isNullOrUndefined(this.parent.getRowByIndex(0))&&!this.initialRowTop){var i=this.parent.getRowByIndex(0).getBoundingClientRect().top,r=this.parent.element.getBoundingClientRect().top;this.initialRowTop=i>0?this.parent.getRowByIndex(0).getBoundingClientRect().top-r: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),this.parent.notify("virtualTransform",{requestType:"transformChange"})},r.prototype.toSelectVirtualRow=function(i){if(!this.parent.isEdit){t.isNullOrUndefined(this.observer.containerRect)&&(this.observer.containerRect=this.observers.containerRect),(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[parseInt(t.toString(),10)]));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()[parseInt(i.toString(),10)];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.enableVirtualMaskRow||e.parent.showSpinner(),e.parent.enableVirtualMaskRow&&!e.preventEvent&&setTimeout(function(){e.parent.showMaskRow(r.axis),e.parent.notify("showGanttShimmer",{requestType:"showShimmer"})},0);var d=e.content.getBoundingClientRect().height,l=e.prevInfo.offsets?e.prevInfo.offsets.top:null,p="X"===r.axis,h=e.getColumnOffset(p?e.vgenerator.getColumnIndexes()[0]-1:e.prevInfo.columnIndexes[0]-1);if(p){var c=Object.keys(e.vgenerator.cOffsets).length-e.prevInfo.columnIndexes.length,u=e.vgenerator.cOffsets[c-1];h=h>u?u:h}var g=e.getTranslateY(o.top,d,p&&l===o.top?e.prevInfo:void 0,!0);if(!e.parent.isFrozenGrid()||e.parent.enableVirtualMaskRow){if(e.parent.enableVirtualMaskRow){var f=o.top-e.translateY<0;g=Math.round(e.translateY)>g&&!f?Math.round(e.translateY):g,e.virtualEle.adjustTable(h,g)}else e.virtualEle.adjustTable(h,e.translateY);e.parent.enableColumnVirtualization&&e.header.virtualEle.adjustTable(h,0)}}}},r.prototype.scrollListeners=function(e){this.scrollAfterEdit();var i=e.sentinel,r=this.parent.getRowHeight(),o=this.parent.pageSettings.pageSize-Math.ceil(this.parent.pageSettings.pageSize/2),a=this.parent.getContent().querySelector(".e-content"),d=o*r,l=e.offset.top-this.translateY<=0,p=Math.ceil(e.offset.top-this.translateY)+r>=d,h=this.parent.currentViewData;if(l&&"right"!==e.direction&&"left"!==e.direction){var c=+(this.parent.height.toString().indexOf("%")<0?parseInt(this.parent.height.toString(),10):this.parent.element.getBoundingClientRect().height),u=~~(a.scrollTop/r)+Math.ceil(c/r)-this.parent.pageSettings.pageSize;if(u=u>0?u:0,!t.isNullOrUndefined(this.selectedRowIndex)&&-1!==this.selectedRowIndex&&u!==this.selectedRowIndex&&this.parent.rowHeight*this.parent.pageSettings.pageSize<a.scrollTop&&(u=this.selectedRowIndex),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.parent.selectionModule.isRowSelected&&(this.startIndex=h[0].index-this.parent.pageSettings.pageSize/2,this.endIndex=this.startIndex+this.parent.pageSettings.pageSize);var m=Math.ceil(e.offset.top/r);m%=this.parent.pageSettings.pageSize;var y=0;t.isNullOrUndefined(this.parent.getRows()[parseInt(m.toString(),10)])||t.isNullOrUndefined(this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)])||(y=+this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)].querySelector("td").getAttribute("index")),0===y?this.translateY=e.offset.top-o*r>0?e.offset.top-o*this.parent.getRowHeight()+r:0:this.parent.getFrozenColumns()>0?(e.offset.top=e.offset.top+80,this.translateY=e.offset.top-o*r>0?e.offset.top-o*r+10:0):this.translateY=e.offset.top-o*r>0?e.offset.top-o*r+10:0}else if(p&&"right"!==e.direction&&"left"!==e.direction){var S=~~(a.scrollTop/r),v=!(this.selectedRowIndex+this.parent.pageSettings.pageSize<this.totalRecords);t.isNullOrUndefined(this.selectedRowIndex)||-1===this.selectedRowIndex||S===this.selectedRowIndex||v||(S=this.selectedRowIndex);var w=S+this.parent.pageSettings.pageSize;w>this.totalRecords&&(w=S+(this.totalRecords-S)),this.startIndex=!v||t.isNullOrUndefined(this.selectedRowIndex)?w-this.parent.pageSettings.pageSize:S,this.endIndex=w,S+this.parent.pageSettings.pageSize>this.totalRecords&&this.endIndex-this.startIndex<this.parent.pageSettings.pageSize/2&&this.endIndex-S<this.parent.pageSettings.pageSize/2&&(this.startIndex=w-this.parent.pageSettings.pageSize/2),h.length&&this.startIndex>h[0].index&&this.startIndex-h[0].index<this.parent.pageSettings.pageSize/2&&this.parent.selectionModule.isRowSelected&&(this.startIndex=h[0].index+this.parent.pageSettings.pageSize/2),e.offset.top>r*this.totalRecords?this.translateY=this.getTranslateY(e.offset.top,a.getBoundingClientRect().height):this.totalRecords===this.endIndex?this.translateY=this.totalRecords*r-(this.endIndex-this.startIndex)*r:this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*r:this.parent.getFrozenColumns()>0?this.translateY=e.offset.top-(2*r+this.parent.pageSettings.pageSize):this.translateY=e.offset.top}if(p&&e.offset.top<r*this.totalRecords||l||"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&&(p||l)||s(this.parent)){var I=this.currentInfo=t.getValue("getInfoFromView",this).apply(this,[e.direction,i,e.offset]);this.previousInfo=I,this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization?I.columnIndexes:[]);var R=I.loadNext&&!I.loadSelf?I.nextInfo.page:I.page;this.parent.setProperties({pageSettings:{currentPage:R}},!0),p&&this.endIndex===this.totalRecords&&I.loadNext&&(I.loadNext=!1),this.requestType="virtualscroll","right"!==e.direction&&"left"!==e.direction&&(I.event="refresh-virtual-block"===I.event?"model-changed":I.event),this.parent.enableVirtualMaskRow&&(this.parent.showMaskRow(i.axis),this.parent.addShimmerEffect(),this.parent.notify("showGanttShimmer",{requestType:"showShimmer"})),this.parent.notify(I.event,{requestType:"virtualscroll",virtualInfo:I,focusElement:e.focusElement})}else this.parent.enableVirtualMaskRow&&(this.parent.removeMaskRow(),this.parent.notify("removeGanttShimmer",{requestType:"hideShimmer"}))},r.prototype.appendContent=function(i,r,o){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))t.getValue("isExpandCollapse",o)&&(this.isRemoteExpand=!0),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);else{var a=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,d=a.columnIndexes[0]-1,l=this.getColumnOffset(d),p=void 0;if(this.parent.enableColumnVirtualization){this.header.virtualEle.adjustTable(l,0);var h=a.columnIndexes;p=this.getColumnOffset(h[h.length-1])-this.getColumnOffset(h[0]-1)+"",this.header.virtualEle.setWrapperWidth(p)}this.virtualEle.setWrapperWidth(p,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(l,this.translateY)),t.setValue("prevInfo",this.previousInfo?this.previousInfo:a,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("virtual-action-args",this.virtualOtherAction),this.parent.off("index-modifier",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),Ge=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 _e(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="chrome"===t.Browser.info.name?200:100,d=t.debounce(e,a),l=t.debounce(e,50);return this.options.prevTop=this.options.prevLeft=0,function(t){var a=o.options.movableContainer?o.options.container.scrollTop:t.target.scrollTop,p=o.options.movableContainer?o.options.scrollbar.scrollLeft:t.target.scrollLeft,h=o.options.prevTop<a?"down":"up";h=o.options.prevLeft===p?h:o.options.prevLeft<p?"right":"left",o.options.prevTop=a,o.options.prevLeft=p;var c=o.sentinelInfo[""+h],u=0;if(o.newPos=a,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.options.axes.indexOf(c.axis)){o.containerRect=o.options.container.getBoundingClientRect();var g=o.check(h);if(c.entered&&("X"===c.axis||r.enableVirtualMaskRow)&&(!o.movableEle||"right"!==h&&"left"!==h?i(o.element,c,h,{top:a,left:p},o.fromWheel,g):i(o.movableEle,c,h,{top:a,left:p},o.fromWheel,g)),g){var f=l;"X"===c.axis?f({direction:h,sentinel:c,offset:{top:a,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)||r.enableVirtualMaskRow?(f=r.enableVirtualMaskRow?d:f)({direction:h,sentinel:c,offset:{top:a,left:p},focusElement:document.activeElement}):e({direction:h,sentinel:c,offset:{top:a,left:p},focusElement:document.activeElement})}o.fromWheel=!1}}},i}(i.InterSectionObserver),Qe=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)}}(),Ke=function(){function e(e){this.prevstartIndex=-1,this.prevendIndex=-1,this.parent=e,i.Grid.Inject(We),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("localPagedExpandCollapse",this.collapseExpandVirtualchilds,this),this.parent.on("pagingActions",this.virtualPageAction,this),this.parent.on("destroy",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("localPagedExpandCollapse",this.collapseExpandVirtualchilds),this.parent.off("pagingActions",this.virtualPageAction),this.parent.off("destroy",this.destroy))},e.prototype.collapseExpandVirtualchilds=function(e){this.parent.grid.notify("virtual-action-args",{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 r=this,o=new n.DataManager(e.result),a=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),s=o.executeLocal((new n.Query).where(a)).filter(function(e){return h(r.parent,e)});this.visualData=s,e.count=s.length,this.parent.grid.notify("data-listener",{data:s});var d={startIndex:-1,endIndex:-1,count:e.count,requestType:e.actionArgs.requestType};this.parent.grid.notify("index-modifier",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),o.dataSource.json=s,e.result=o.executeLocal(c)}else{var f=e.actionArgs.requestType;("filtering"===f||"collapseAll"===f||"searching"===f||"refresh"===f&&t.getValue("isExpandAll",this.parent)||"refresh"===f&&this.parent.enableCollapseAll&&p>s.length&&t.isNullOrUndefined(this.expandCollapseRec))&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.getContent().firstElementChild.scrollTop=0,this.parent.grid.notify("virtual-action-args",{setTop:!0})),("save"===f&&e.actionArgs.index>=d.count-this.parent.grid.pageSettings.pageSize||"refresh"===f&&this.parent.isGantt&&this.parent.isAddedFromGantt)&&((d.endIndex+this.parent.pageSettings.pageSize>=d.count&&this.parent.root&&d.count-d.endIndex==this.visualData.length-this.parent.root.previousFlatData.length||!this.parent.isGantt||!this.parent.isAddedFromGantt)&&(l=d.startIndex+(d.count-d.endIndex),p=d.count),this.parent.isAddedFromGantt=!1);var m=this.parent.grid.contentModule.virtualEle.wrapper,y=i.getTransformValues(m).height;if(!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&&0===y&&(l=0),!t.isNullOrUndefined(this.expandCollapseRec)){var S=this.parent.getRows(),v=s.indexOf(this.expandCollapseRec);s.slice(v,v+S.length).length<S.length&&v>=0&&0!==l?(l=v=(v=s.length-S.length)>0?v:0,p=s.length):t.getValue("isCollapseAll",this.parent)&&(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify("virtual-action-args",{setTop:!0}))}"collapseAll"!==this.prevrequestType||"virtualscroll"!==e.actionArgs.requestType||t.isNullOrUndefined(this.parent.idMapping)||(l=0,p=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify("virtual-action-args",{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,0===p&&s.length>0?e.result=s:e.result=s.slice(l,p),this.prevstartIndex=l,this.prevendIndex=p,this.prevrequestType=e.actionArgs.requestType}this.parent.notify("updateAction",e)},e.prototype.destroy=function(){this.removeEventListener()},e}(),We=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 Qe(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.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 He(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?parseInt(e.height.toString(),10):e.element.getBoundingClientRect().height)/i),n=e.pageSettings.pageSize;e.setProperties({pageSettings:{pageSize:n<r?r:n}},!0)},r}(i.VirtualScroll),Ye=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)},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))},e.prototype.rowExpandCollapse=function(e){var i,r,n=this.parent.getDataRows(),o=this.parent.getRows(),a=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;a&&(r=this.parent.getRows().filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))})),i=e.detailrows.length?e.detailrows:n.filter(function(t){return t.querySelector(".e-gridrowindex"+e.record.index+"level"+(e.record.level+1))});for(var s=0;s<i.length;s++){var d=i[parseInt(s.toString(),10)],l=this.parent.grid.getRowObjectFromUID(d.getAttribute("data-Uid")).data;!t.isNullOrUndefined(n)&&d.parentElement.firstElementChild.clientHeight>0&&(d.style.height=d.parentElement.firstElementChild.clientHeight+"px"),d.style.display=e.action,a&&r.length&&(r[parseInt(s.toString(),10)].style.display=e.action);var p="none"===e.action?".e-treecolumn-container .e-treegridcollapse":".e-treecolumn-container .e-treegridexpand";if(o[d.rowIndex].querySelector(p)){for(var h=[],c=0;c<n.length;c++)n[parseInt(c.toString(),10)].querySelector(".e-gridrowindex"+l.index+"level"+(l.level+1))&&h.push(n[parseInt(c.toString(),10)]);if(h.length){var u=this.parent.getCurrentViewRecords()[h[0].rowIndex];this.rowExpandCollapse({detailrows:h,action:e.action,record:u})}}}},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.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}(),Je=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}(),Xe=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("pagingActions",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)},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("pagingActions",this.infinitePageAction),this.parent.grid.off("infinite-crud-cancel",this.createRows),this.parent.grid.off("content-ready",this.contentready))},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[parseInt(p.toString(),10)],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[parseInt(p.toString(),10)]):o[e.index+p+1][""+a](l[parseInt(p.toString(),10)]),o.splice(e.index+1+p,0,l[parseInt(p.toString(),10)]);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.getDataRows(),this.parent.getCurrentViewRecords())}},e.prototype.infinitePageAction=function(e){var i=new n.DataManager(e.result),r=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),o=i.executeLocal((new n.Query).where(r)),a=t.getValue("actionArgs",e.actionArgs),s=t.getValue("actions",this.parent.grid.infiniteScrollModule);this.parent.grid.infiniteScrollModule.isInitialRender&&!this.parent.initialRender&&(this.parent.grid.pageSettings.currentPage=1);var d=!!s.some(function(e){return e===a.requestType})||!!this.parent.initialRender;if(this.visualData=o,e.count=o.length,t.getValue("isPrinting",e.actionArgs))e.result=o;else{var l=new n.Query,p=this.parent.infiniteScrollSettings.enableCache;p&&this.parent.infiniteScrollSettings.initialBlocks>this.parent.infiniteScrollSettings.maxBlocks&&(this.parent.infiniteScrollSettings.initialBlocks=this.parent.infiniteScrollSettings.maxBlocks);var h=d?this.parent.grid.pageSettings.pageSize*this.parent.infiniteScrollSettings.initialBlocks:this.parent.grid.pageSettings.pageSize,c=this.parent.grid.pageSettings.currentPage;if(t.isNullOrUndefined(a))l=l.page(c,h);else{var u=t.getValue("lastIndex",this.parent.grid.infiniteScrollModule),g=t.getValue("firstIndex",this.parent.grid.infiniteScrollModule);if(p||"delete"!==a.requestType)l=p&&"delete"===a.requestType||"save"===a.requestType&&"add"===a.action?(l=l.skip(g)).take(this.parent.infiniteScrollSettings.initialBlocks*this.parent.pageSettings.pageSize):l.page(c,h);else{var f=u-a.data.length+1,m=a.data.length;l=l.skip(f).take(m)}}i.dataSource.json=o,p||t.isNullOrUndefined(a)||"save"!==a.requestType||"add"!==a.action?e.result=i.executeLocal(l):e.result=[a.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[parseInt(r.toString(),10)])},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.getRowsObject(),a=this.parent.grid.getRows();this.removeRows(a,o,r,n)}}},e.prototype.removeRows=function(e,i,r,n,o){for(var a=this,s=0;s<r.length;s++)!function(s){i.filter(function(d,l){if(d.data[""+n]===r[parseInt(s.toString(),10)][""+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[parseInt(l.toString(),10)]),e.splice(l,1)}})}(s)},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.getRows():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.getContent().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.getHeaderContent().querySelector("tbody"):e.isFrozenRight?this.parent.element.querySelector(".e-frozen-right-header").querySelector("tbody"):this.parent.grid.getHeaderContent().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[parseInt(u.toString(),10)],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[parseInt(h.toString(),10)]).length,"Child"===this.parent.editSettings.newRowPosition&&(h-=1),l[parseInt(h.toString(),10)][""+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}();return Ie.Inject(Ee,Ue,Te,Re,ke,qe,xe,Ve,Ae,Ne,Fe,Be,Le,Q,Ke,je,Ce,Ye,Je,F,Xe),e.Aggregate=qe,e.AggregateColumn=se,e.AggregateRow=de,e.Column=C,e.ColumnChooser=Je,e.ColumnMenu=Ve,e.CommandColumn=Fe,e.ContextMenu=Be,e.DataManipulation=te,e.DetailRow=je,e.Edit=Le,e.EditSettings=he,e.ExcelExport=Ae,e.Filter=Ee,e.FilterSettings=U,e.Freeze=Ye,e.InfiniteScroll=Xe,e.InfiniteScrollSettings=Se,e.LoadingIndicator=P,e.Logger=F,e.Page=Ue,e.PageSettings=ne,e.PdfExport=Ne,e.Predicate=N,e.Render=ee,e.Reorder=Re,e.Resize=xe,e.RowDD=Ce,e.RowDropSettings=Me,e.SearchSettings=J,e.Selection=Q,e.SelectionSettings=Z,e.Sort=Te,e.SortDescriptor=ge,e.SortSettings=fe,e.StackedColumn=D,e.Toolbar=ke,e.TreeClipboard=G,e.TreeGrid=Ie,e.TreeGridColumn=b,e.TreeVirtual=We,e.TreeVirtualRowModelGenerator=Pe,e.VirtualScroll=Ke,e.actionBegin="actionBegin",e.actionComplete="actionComplete",e.actionFailure=_,e.ariaColIndex="aria-colindex",e.ariaRowIndex="aria-rowindex",e.autoCol="auto-col",e.batchAdd="batchAdd",e.batchCancel="batchCancel",e.batchDelete="batchDelete",e.batchEditFormRendered="batcheditform-rendered",e.batchSave="batchSave",e.beforeBatchAdd="beforeBatchAdd",e.beforeBatchCancel="before-batch-cancel",e.beforeBatchDelete="beforeBatchDelete",e.beforeBatchSave="beforeBatchSave",e.beforeCopy="beforeCopy",e.beforeDataBound="beforeDataBound",e.beforeExcelExport="beforeExcelExport",e.beforePaste="beforePaste",e.beforePdfExport="beforePdfExport",e.beforeStartEdit="edit-form",e.beginAdd="beginAdd",e.beginEdit="beginEdit",e.cellEdit="cellEdit",e.cellSave="cellSave",e.cellSaved="cellSaved",e.checkboxChange="checkboxChange",e.collapsed="collapsed",e.collapsing="collapsing",e.content="e-content",e.contextMenuClick="contextMenuClick",e.contextMenuOpen="contextMenuOpen",e.crudAction="crudAction",e.dataBound="dataBound",e.dataColIndex="data-colindex",e.dataListener="data-listener",e.dataRowIndex="data-rowindex",e.dataStateChange="dataStateChange",e.destroy="destroy",e.detailDataBound="detailDataBound",e.doubleTap="double-tap",e.expanded="expanded",e.expanding="expanding",e.extendArray=g,e.findChildrenRecords=c,e.findParentRecords=p,e.frozenContent="e-frozencontent",e.frozenHeader="e-frozenheader",e.frozenLeft="frozen-left",e.frozenRight="frozen-right",e.getExpandStatus=h,e.getParentData=m,e.getPlainData=f,e.headerContent="e-headercontent",e.indexModifier="index-modifier",e.isCheckboxcolumn=d,e.isCountRequired=s,e.isFilterChildHierarchy=l,e.isHidden=y,e.isOffline=u,e.isRemoteData=a,e.keyPressed="key-pressed",e.leftRight="Left-Right",e.load="load",e.localPagedExpandCollapse="localPagedExpandCollapse",e.movableContent="e-movablecontent",e.movableHeader="e-movableheader",e.pagingActions="pagingActions",e.printGridInit="printGrid-Init",e.queryCellInfo="queryCellInfo",e.recordDoubleClick="recordDoubleClick",e.remoteExpand="remoteExpand",e.resizeStop="resizeStop",e.rowDataBound="rowDataBound",e.rowDeselected="rowDeselected",e.rowDeselecting="rowDeselecting",e.rowDrag="rowDrag",e.rowDragStart="rowDragStart",e.rowDragStartHelper="rowDragStartHelper",e.rowDrop="rowDrop",e.rowDropped="row-dropped",e.rowSelected="rowSelected",e.rowSelecting="rowSelecting",e.rowdraging="row-draging",e.rowsAdd="rows-add",e.rowsRemove="rows-remove",e.savePreviousRowPosition="savePreviousRowPosition",e.table="e-table",e.toolbarClick="toolbarClick",e.treeGridDetails=j,e.updateData="update-data",e.virtualActionArgs="virtual-action-args",e.virtualColumnIndex="virtualColumnIndex",e}({},ej.base,ej.grids,ej.buttons,ej.data,ej.popups),this.ejs=ej;
|
|
11
11
|
//# sourceMappingURL=ej2-treegrid.min.js.map
|