@syncfusion/ej2-treegrid 24.1.46 → 24.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/ej2-treegrid.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js +2 -2
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +8 -28
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +6 -27
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +2 -2
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +9 -9
  13. package/src/treegrid/actions/context-menu.js +1 -0
  14. package/src/treegrid/actions/infinite-scroll.d.ts +0 -1
  15. package/src/treegrid/actions/infinite-scroll.js +2 -24
  16. package/src/treegrid/actions/page.js +2 -2
  17. package/src/treegrid/base/data.js +1 -1
  18. package/src/treegrid/base/treegrid.js +1 -1
  19. package/styles/bootstrap-dark.css +1 -2
  20. package/styles/bootstrap.css +1 -2
  21. package/styles/bootstrap4.css +1 -2
  22. package/styles/bootstrap5-dark.css +1 -2
  23. package/styles/bootstrap5.css +1 -2
  24. package/styles/fabric-dark.css +1 -2
  25. package/styles/fabric.css +1 -2
  26. package/styles/fluent-dark.css +1 -2
  27. package/styles/fluent.css +1 -2
  28. package/styles/highcontrast-light.css +1 -2
  29. package/styles/highcontrast.css +1 -2
  30. package/styles/material-dark.css +1 -2
  31. package/styles/material.css +1 -2
  32. package/styles/material3-dark.css +1 -2
  33. package/styles/material3.css +1 -2
  34. package/styles/tailwind-dark.css +1 -2
  35. package/styles/tailwind.css +1 -2
  36. package/styles/treegrid/_layout.scss +1 -2
  37. package/styles/treegrid/bootstrap-dark.css +1 -2
  38. package/styles/treegrid/bootstrap.css +1 -2
  39. package/styles/treegrid/bootstrap4.css +1 -2
  40. package/styles/treegrid/bootstrap5-dark.css +1 -2
  41. package/styles/treegrid/bootstrap5.css +1 -2
  42. package/styles/treegrid/fabric-dark.css +1 -2
  43. package/styles/treegrid/fabric.css +1 -2
  44. package/styles/treegrid/fluent-dark.css +1 -2
  45. package/styles/treegrid/fluent.css +1 -2
  46. package/styles/treegrid/highcontrast-light.css +1 -2
  47. package/styles/treegrid/highcontrast.css +1 -2
  48. package/styles/treegrid/material-dark.css +1 -2
  49. package/styles/treegrid/material.css +1 -2
  50. package/styles/treegrid/material3-dark.css +1 -2
  51. package/styles/treegrid/material3.css +1 -2
  52. package/styles/treegrid/tailwind-dark.css +1 -2
  53. package/styles/treegrid/tailwind.css +1 -2
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * filename: ej2-treegrid.umd.min.js
3
- * version : 24.1.46
3
+ * version : 24.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
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-grids","@syncfusion/ej2-buttons","@syncfusion/ej2-data","@syncfusion/ej2-popups"],t):t(e.ej={},e.ej2Base,e.ej2Grids,e.ej2Buttons,e.ej2Data,e.ej2Popups)}(this,function(e,t,i,r,n,o){"use strict";function a(e){if(e.dataSource instanceof n.DataManager){var t=e.dataSource.adaptor;return t instanceof n.ODataAdaptor||t instanceof n.WebApiAdaptor||t instanceof n.WebMethodAdaptor||t instanceof n.CacheAdaptor||t instanceof n.UrlAdaptor}return!1}function s(e){return!!(e.dataSource&&"result"in e.dataSource)}function d(e){for(var t=0;t<e.columns.length;t++)if(e.columns[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:y(e,i.parentItem.uniqueID);return null==o||(!e.initialRender||t.isNullOrUndefined(o[e.expandStateMapping])||o[e.expandStateMapping]?!1!==o.expanded&&(!o.parentItem||((n=y(e,o.parentItem.uniqueID))&&e.initialRender&&!t.isNullOrUndefined(n[e.expandStateMapping])&&!n[e.expandStateMapping]?(n.expanded=!1,!1):(!n||!1!==n.expanded)&&(!n||h(e,n,r)))):(o.expanded=!1,!1))}function c(e){var i=[];if(t.isNullOrUndefined(e)||!e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)&&!e.childRecords.length)return[];if(!t.isNullOrUndefined(e.childRecords))for(var r=e.childRecords.filter(function(e){return!e.isSummaryRow}),n=0,o=Object.keys(r).length;n<o;n++)i.push(r[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 y(e,t,i){if(i){return e.uniqueIDFilterCollection[""+t]}return e.uniqueIDCollection[""+t]}function m(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}function S(e,i,r,o,a,s,d){var l,p,h,c=e.value,u=e.action,m=i.grid.getPrimaryKeyFieldNames()[0],S=i.dataSource instanceof n.DataManager?i.dataSource.dataSource.json:i.dataSource,w=[],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=function(e,i,r,n,o,a,s){var d,l=!1,p=r.grid.getCurrentViewRecords();switch(d=t.extend({},e.value),d=f(d),r.editSettings.newRowPosition){case"Top":i.unshift(d),l=!0;break;case"Bottom":i.push(d),l=!0;break;case"Above":d=t.isNullOrUndefined(s)?f(d=t.extend({},p[o+1])):f(d=t.extend({},s));break;case"Below":case"Child":if(t.isNullOrUndefined(s)){var h=r.grid.getPrimaryKeyFieldNames()[0],c=p[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}}(e,S,i,0,o,a,d);c=C.value,x=C.isSkip}if(c instanceof Array?w=g(c):w.push(t.extend({},c)),!x&&("add"!==u||"Top"!==i.editSettings.newRowPosition&&"Bottom"!==i.editSettings.newRowPosition))for(var b=0;b<w.length;b++){"object"==typeof w[parseInt(b.toString(),10)][""+m]&&(w[parseInt(b.toString(),10)]=w[parseInt(b.toString(),10)][""+m]);var D=w[parseInt(b.toString(),10)].taskData?Object.keys(w[parseInt(b.toString(),10)].taskData):Object.keys(w[parseInt(b.toString(),10)]);l=S.length;for(var M=function(){if(S[parseInt(l.toString(),10)][""+m]===w[parseInt(b.toString(),10)][""+m]){if("delete"!==u){if("edit"===u){for(p=0;p<D.length;p++)if(Object.prototype.hasOwnProperty.call(S[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=y(i,w[parseInt(b.toString(),10)].uniqueID);S[parseInt(l.toString(),10)][D[parseInt(p.toString(),10)]]=w[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)]]=S[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]=S[parseInt(l.toString(),10)][""+i.idMapping],S.splice(l+1,0,R.taskData)):(Object.prototype.hasOwnProperty.call(S[parseInt(l.toString(),10)],i.childMapping)||(S[parseInt(l.toString(),10)][""+i.childMapping]=[]),S[parseInt(l.toString(),10)][""+i.childMapping].push(R.taskData),v(m,S[parseInt(l.toString(),10)],u,i,r,R)):"Below"===i.editSettings.newRowPosition?(S.splice(l+1,0,R.taskData),t.isNullOrUndefined(R.parentItem)||v(m,S[l+1],u,i,r,R)):o?"Above"===i.editSettings.newRowPosition&&(S.splice(l,0,R.taskData),t.isNullOrUndefined(R.parentItem)||v(m,S[parseInt(l.toString(),10)],u,i,r,R)):(n=0,S.splice(n,0,R.taskData))}return"break"}var a=S[parseInt(l.toString(),10)];if(S.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,v(m,d,u,i,r));break}return"break"}}else t.isNullOrUndefined(S[parseInt(l.toString(),10)][""+i.childMapping])||I(S[parseInt(l.toString(),10)][""+i.childMapping],w[parseInt(b.toString(),10)],u,m,i,r,R,s)&&v(m,S[parseInt(l.toString(),10)],u,i,r)};l--&&l>=0;){if("break"===M())break}}}function I(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=y(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)){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),v(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),v(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Above"===o.editSettings.newRowPosition?(e.splice(p,0,s.taskData),t.isNullOrUndefined(s.parentItem)||v(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)||v(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])||I(e[parseInt(p.toString(),10)][o.childMapping],i,r,n,o,a,s,d)&&v(n,e[parseInt(p.toString(),10)],r,o,a);return l}function v(e,i,r,o,a,s){if("Above"!==o.editSettings.newRowPosition&&"Below"!==o.editSettings.newRowPosition||"add"!==r&&"batchsave"!==r||t.isNullOrUndefined(s.parentItem)){var d,l=o.grid.getCurrentViewRecords();if(l.map(function(t,r){t[""+e]!==i[""+e]||(d=r)}),o.enableVirtualization&&t.isNullOrUndefined(d)){var p=t.getValue("uniqueIDCollection."+s.parentUniqueID,o);i=p}if(t.isNullOrUndefined(d)||(i=l[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 m=void 0;if((o.frozenRows||o.getFrozenColumns())&&(m=o.getRowByIndex(d)),!o.enableVirtualization&&!t.isNullOrUndefined(f)||!t.isNullOrUndefined(m)){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)]:m.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{y(o,s.parentItem.uniqueID).childRecords.push(s)}}var 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)}}(),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},x=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}(),C=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return w(i,e),R([t.Property(null)],i.prototype,"columns",void 0),i}(x),b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t}(C),D=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),M=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},O=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return D(i,e),M([t.Property("Spinner")],i.prototype,"indicatorType",void 0),i}(t.ChildProperty),P=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),E=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},A=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),E([t.Property()],i.prototype,"field",void 0),E([t.Property()],i.prototype,"operator",void 0),E([t.Property()],i.prototype,"value",void 0),E([t.Property()],i.prototype,"matchCase",void 0),E([t.Property()],i.prototype,"ignoreAccent",void 0),E([t.Property()],i.prototype,"predicate",void 0),E([t.Property({})],i.prototype,"actualFilterValue",void 0),E([t.Property({})],i.prototype,"actualOperator",void 0),E([t.Property()],i.prototype,"type",void 0),E([t.Property()],i.prototype,"ejpredicate",void 0),E([t.Property()],i.prototype,"uid",void 0),E([t.Property()],i.prototype,"isForeignKey",void 0),i}(t.ChildProperty),N=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),E([t.Collection([],A)],i.prototype,"columns",void 0),E([t.Property("FilterBar")],i.prototype,"type",void 0),E([t.Property()],i.prototype,"mode",void 0),E([t.Property(!0)],i.prototype,"showFilterBarStatus",void 0),E([t.Property(1500)],i.prototype,"immediateModeDelay",void 0),E([t.Property()],i.prototype,"operators",void 0),E([t.Property(!1)],i.prototype,"ignoreAccent",void 0),E([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),U=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)}}(),k=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},q=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return U(i,e),k([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)}}(),T="https://ej2.syncfusion.com/documentation/treegrid",B="https://ej2.syncfusion.com/documentation",L=!1,j=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,T+"/modules"):"primary_column_missing"===n[parseInt(o.toString(),10)]||"selection_key_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/api/treegrid/column/#isprimarykey"):"grid_remote_edit"===n[parseInt(o.toString(),10)]?d=d.replace(p,T+"/edit"):"virtual_height"===n[parseInt(o.toString(),10)]?d=d.replace(p,T+"/virtual"):"check_datasource_columns"===n[parseInt(o.toString(),10)]?d=d.replace(p,T+"/columns"):"locale_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace(p,T+"/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=z[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),z={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"+B+"/api/treegrid#childmapping\n"+B+"/api/treegrid#idmapping\n"+B+"/api/treegrid#$parentidmapping"}}},F="rowDataBound",_="queryCellInfo",H="beforeDataBound",G="actionBegin",Q="dataStateChange",K="actionComplete",W="rowSelected",Y="checkboxChange",J="rowDeselected",X="toolbarClick",$="beforeExcelExport",Z="beforePdfExport",ee="expanded",te="expanding",ie="collapsed",re="collapsing",ne="remoteExpand",oe="localPagedExpandCollapse",ae="pagingActions",se="printGrid-Init",de="contextMenuOpen",le="contextMenuClick",pe="crudAction",he="beginEdit",ce="beginAdd",ue="recordDoubleClick",ge="cellSave",fe="cellSaved",ye="cellEdit",me="batchDelete",Se="batchCancel",Ie="batchAdd",ve="beforeBatchDelete",we="beforeBatchAdd",Re="beforeBatchSave",xe="batchSave",Ce="key-pressed",be="double-tap",De="virtual-action-args",Me="data-listener",Oe="index-modifier",Pe="edit-form",Ee="before-batch-cancel",Ae="detailDataBound",Ne="rowDragStartHelper",Ue="rows-add",ke="rows-remove",qe="row-draging",Ve="row-dropped",Te="rowDeselecting",Be="e-movablecontent",Le="e-frozencontent",je="data-rowindex",ze=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)}}(),Fe=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 ze(i,e),i.prototype.setCopyData=function(i){var r="copyContent",n=this.treeGridParent.getCurrentViewRecords();if(""===window.getSelection().toString()){this.clipBoardTextArea.value=this[""+r]="";var o=this.treeGridParent.grid.getRows();if("Cell"!==this.treeGridParent.selectionSettings.mode){for(var a=this.treeGridParent.getSelectedRowIndexes().sort(function(e,t){return e-t}),s=0;s<a.length;s++)if(s>0&&(this.treeCopyContent+="\n"),!o[a[parseInt(s.toString(),10)]].classList.contains("e-summaryrow")){var d=[].slice.call(o[a[parseInt(s.toString(),10)]].querySelectorAll(".e-rowcell")),l=this.treeGridParent.getSelectedRecords()[parseInt(s.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&("Parent"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.parentContentData(n,a[parseInt(s.toString(),10)],o,i,s),this.getCopyData(d,!1,"\t",i),this.treeCopyContent+=this[""+r],this.copiedUniqueIdCollection.push(l),this[""+r]="","Child"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.childContentData(n,a[parseInt(s.toString(),10)],o,i))}if(i){var p=[];for(s=0;s<this.treeGridParent.getVisibleColumns().length;s++)p[parseInt(s.toString(),10)]=this.treeGridParent.getVisibleColumns()[parseInt(s.toString(),10)].headerText;this.getCopyData(p,!1,"\t",i),this.treeCopyContent=this[""+r]+"\n"+this.treeCopyContent}var h={data:this.treeCopyContent,cancel:!1};if(this.treeGridParent.trigger("beforeCopy",h),h.cancel)return;this.clipBoardTextArea.value=this[""+r]=h.data,t.Browser.userAgent.match(/ipad|ipod|iphone/i)?this.clipBoardTextArea.setSelectionRange(0,this.clipBoardTextArea.value.length):this.clipBoardTextArea.select(),this.isSelect=!0,this.copiedUniqueIdCollection=[],this.treeCopyContent=""}else e.prototype.setCopyData.call(this,i)}},i.prototype.parentContentData=function(e,i,r,n,o){var a="copyContent",s="parentItem";if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)][""+s]))for(var d=e[parseInt(i.toString(),10)][""+s].level,l=0;l<d+1;l++)for(var p=0;p<e.length;p++)if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)][""+s])&&e[parseInt(p.toString(),10)].uniqueID===e[parseInt(i.toString(),10)][""+s].uniqueID){i=p;var h=[].slice.call(r[parseInt(i.toString(),10)].querySelectorAll(".e-rowcell")),c=e[parseInt(p.toString(),10)].uniqueID;if(-1===this.copiedUniqueIdCollection.indexOf(c)){this.getCopyData(h,!1,"\t",n),this.treeCopyContent=o>0?this.treeCopyContent+this[""+a]+"\n":this[""+a]+"\n"+this.treeCopyContent,this.copiedUniqueIdCollection.push(c),this[""+a]="";break}}},i.prototype.copy=function(t){e.prototype.copy.call(this,t)},i.prototype.paste=function(t,i,r){e.prototype.paste.call(this,t,i,r)},i.prototype.getModuleName=function(){return"clipboard"},i.prototype.destroy=function(){e.prototype.destroy.call(this)},i.prototype.childContentData=function(e,i,r,n){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),_e=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(Y,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,o=(n=this.parent.getHeaderContent().querySelectorAll(".e-checkbox-wrapper")[0]).querySelector(".e-frame").classList.contains("e-check");this.parent.autoCheckHierarchy&&o&&this.headerSelection(o)}},e.prototype.renderColumnCheckbox=function(e){var i=this.parent.createElement("input",{className:"e-treecheckselect",attrs:{type:"checkbox","aria-label":"checkbox"}}),n=e.data;e.cell.classList.add("e-treegridcheckbox"),e.cell.setAttribute("aria-label","checkbox");var o=!t.isNullOrUndefined(n.checkboxState)&&"uncheck"!==n.checkboxState,a=r.createCheckBox(this.parent.createElement,!1,{checked:o,label:" "});if(a.classList.add("e-hierarchycheckbox"),this.parent.allowTextWrap&&(a.querySelector(".e-frame").style.width="18px"),"indeterminate"===n.checkboxState){var s=a.querySelectorAll(".e-frame")[0];t.removeClass([s],["e-check","e-stop","e-uncheck"]),a.querySelector(".e-frame").classList.add("e-stop")}return a.insertBefore(i.cloneNode(),a.firstChild),a},e.prototype.columnCheckbox=function(e){var i=this.renderColumnCheckbox(e),r=e.cell.querySelector(".e-treecolumn-container");if(t.isNullOrUndefined(r)){var n=this.parent.createElement("span",{className:"e-treecheckbox"}),o=e.cell.innerHTML;e.cell.innerHTML="",n.innerHTML=o;var a=this.parent.createElement("div",{className:"e-treecheckbox-container"});a.appendChild(i),a.appendChild(n),e.cell.appendChild(a)}else e.cell.querySelector(".e-hierarchycheckbox")||r.insertBefore(i,r.querySelectorAll(".e-treecell")[0])},e.prototype.selectCheckboxes=function(e){for(var t=0;t<e.length;t++){var i=this.parent.getCurrentViewRecords()[e[parseInt(t.toString(),10)]],r=y(this.parent,i.uniqueID),n="uncheck"===(i=r).checkboxState?"check":"uncheck";i.checkboxState=n;for(var o=Object.keys(i),a=0;a<o.length;a++)Object.prototype.hasOwnProperty.call(r,o[parseInt(a.toString(),10)])&&(r[o[parseInt(a.toString(),10)]]=i[o[parseInt(a.toString(),10)]]);this.traverSelection(i,n,!1),this.parent.autoCheckHierarchy&&this.headerSelection()}},e.prototype.traverSelection=function(e,i,r){var n=0;if(this.updateSelectedItems(e,i),!r&&e.parentItem&&this.parent.autoCheckHierarchy&&this.updateParentSelection(e.parentItem),e.childRecords&&this.parent.autoCheckHierarchy){var o=e.childRecords;!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(o=this.getFilteredChildRecords(o)),n=o.length;for(var a=0;a<n;a++)o[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=y(this.parent,e.uniqueID);n&&n.childRecords&&(r=n.childRecords),!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(r=this.getFilteredChildRecords(r)),i=r&&r.length;var o=0,a=0;if(!t.isNullOrUndefined(n)){for(var s=0;s<r.length;s++){var d=y(this.parent,r[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=y(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(var l=0;l<r;l++)s[parseInt(l.toString(),10)].classList.contains("e-summaryrow")||this.updateSelectedItems(i[parseInt(l.toString(),10)],i[parseInt(l.toString(),10)].checkboxState)}else if("delete"===o||"add"===e.action){var p=[];"delete"===o?p=e.data:p.push(e.data);for(l=0;l<p.length;l++){if("delete"===o){var h=this.parent.flatData.indexOf(p[parseInt(l.toString(),10)]),u=this.selectedIndexes.indexOf(h);this.selectedIndexes.splice(u,1),this.updateSelectedItems(p[parseInt(l.toString(),10)],"uncheck")}t.isNullOrUndefined(p[parseInt(l.toString(),10)].parentItem)||this.updateParentSelection(p[parseInt(l.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}(),He=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(se,this.printTreeGrid,this)},e.prototype.removeEventListener=function(){this.parent.grid.off(se,this.printTreeGrid)},e.prototype.printTreeGrid=function(e){var r=i.getObject("printgrid",e),n=i.getObject("element",e);r.addEventListener(_,this.parent.grid.queryCellInfo),r.addEventListener(F,this.parent.grid.rowDataBound),r.addEventListener(H,this.parent.grid.beforeDataBound),t.addClass([n],"e-treegrid")},e.prototype.print=function(){this.parent.grid.print()},e.prototype.destroy=function(){this.removeEventListener()},e}(),Ge=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qe=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ge(i,e),Qe([t.Property()],i.prototype,"fields",void 0),Qe([t.Property(!1)],i.prototype,"ignoreCase",void 0),Qe([t.Property("contains")],i.prototype,"operator",void 0),Qe([t.Property()],i.prototype,"key",void 0),Qe([t.Property()],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),We=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ye=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Je=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return We(i,e),Ye([t.Property("Row")],i.prototype,"mode",void 0),Ye([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),Ye([t.Property("Single")],i.prototype,"type",void 0),Ye([t.Property(!1)],i.prototype,"persistSelection",void 0),Ye([t.Property("Default")],i.prototype,"checkboxMode",void 0),Ye([t.Property(!1)],i.prototype,"checkboxOnly",void 0),Ye([t.Property(!0)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),Xe=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))){if((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(F,e)})}else this.parent.trigger(F,e)}},e.prototype.cellRender=function(e){if(e.data){var r,n,o=this.parent.grid,a=e.data,s=t.isNullOrUndefined(a.filterLevel)?a.level:a.filterLevel,d=0,l=this.parent.getColumnByUid(e.column.uid),p=a.isSummaryRow,c=this.parent.getFrozenColumns();r=t.isNullOrUndefined(a.parentItem)?a.index:a.parentItem.index;if((this.parent.enableColumnVirtualization&&!this.parent.initialRender?this.parent.getVirtualColIndexByUid(e.column.uid):o.getColumnIndexByUid(e.column.uid))!==this.parent.treeColumnIndex||"add"!==e.requestType&&"rowDragAndDrop"!==e.requestType&&"delete"!==e.requestType&&!t.isNullOrUndefined(e.cell.querySelector(".e-treecell")))this.templateResult&&(this.templateResult=null);else{for(var u=t.createElement("div",{className:"e-treecolumn-container"}),g=t.createElement("span",{className:"e-icons e-none",styles:"width: 10px; display: inline-block"}),f=0;f<s;f++)d+=10,u.appendChild(g.cloneNode());var y=t.isNullOrUndefined(a.hasFilteredChildRecords)?a.hasChildRecords:a.hasFilteredChildRecords;if(y&&!t.isNullOrUndefined(a.childRecords)&&(y=this.parent.isFromGantt&&!this.parent.loadChildOnDemand?a.hasChildRecords:!(0===a.childRecords.length)),y){t.addClass([e.cell],"e-treerowcell"),e.cell.setAttribute("aria-expanded",a.expanded?"true":"false");var m=t.createElement("span",{className:"e-icons"}),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([m],S?"e-treegridexpand":"e-treegridcollapse"),d+=18,u.appendChild(m),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 I=o.getFrozenRightColumns(),v=o.getFrozenLeftColumns(),w=o.getMovableColumns();I.length>0&&I[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):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)}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,(t.isNullOrUndefined(this.parent.rowTemplate)&&!this.parent.isReact||this.parent.isReact&&!e.column.template)&&this.parent.trigger(_,e)}},e.prototype.updateTreeCell=function(e,r){var n=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex],o="templateFn",a=e.column.index;t.isNullOrUndefined(n.field)&&e.cell.setAttribute("data-colindex",a+""),n.field!==e.column.field||t.isNullOrUndefined(n.template)||(e.column.template=n.template,e.column[""+o]=i.templateCompiler(e.column.template),e.cell.classList.add("e-templatecell"));var s=null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML:e.cell.innerHTML;if("object"==typeof e.column.template&&this.templateResult)i.appendChildren(r,this.templateResult),this.templateResult=null,e.cell.innerHTML="";else if(e.cell.classList.contains("e-templatecell")){var d=e.cell.children.length,l=this.parent.element.id+e.column.uid;if(n.field!==e.column.field||t.isNullOrUndefined(n.template))for(;0<d;d=e.cell.children.length)r.appendChild(e.cell.children[parseInt((0).toString(),10)]);else{if(this.parent.isReact&&"string"!=typeof e.column.template){e.column[""+o](e.data,this.parent,"columnTemplate",l,null,null,r),t.isNullOrUndefined(this.parent.grid.portals)&&(this.parent.grid.portals=this.parent.portals),this.parent.notify("renderReactTemplate",this.parent.portals);var p=this;p.parent.renderReactTemplates(function(){p.parent.trigger(_,e)})}else{var h=e.column[""+o](i.extend({index:""},e.data),this.parent,"template",l,this.parent.isStringTemplate);i.appendChildren(r,h)}delete e.column.template,delete e.column[""+o],e.cell.innerHTML=""}}else r.innerHTML=s,e.cell.innerHTML=""},e.prototype.refreshReactColumnTemplateByUid=function(e){var r=this;this.parent.isReact&&this.parent.clearTemplate(["columnTemplate"],void 0,function(){for(var n=r.parent.grid.getRowsObject(),o=r.parent.grid.getIndentCount(),a=r.parent.grid.getNormalizedColumnIndex(e),s=0;s<n.length;s++)if(n[parseInt(s.toString(),10)].isDataRow&&!t.isNullOrUndefined(n[parseInt(s.toString(),10)].index)){var d=n[parseInt(s.toString(),10)].cells[parseInt(a.toString(),10)],l=new i.CellRenderer(r.parent.grid,r.parent.grid.serviceLocator),p=r.parent.getCellFromIndex(n[parseInt(s.toString(),10)].index,a-o);l.refreshTD(p,d,n[parseInt(s.toString(),10)].data,{index:n[parseInt(s.toString(),10)].index});var h=r.parent.getRows()[parseInt(s.toString(),10)].cells[parseInt(a.toString(),10)];r.cellRender({data:n[parseInt(s.toString(),10)].data,cell:h,column:d.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}(),$e=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(ne,this.collectExpandingRecs,this),this.parent.on("dataProcessor",this.dataProcessor,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ne,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=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){var a=[],s=new n.DataManager(this.hierarchyData).executeLocal((new n.Query).group(this.parent.parentIdMapping));for(r=0;r<s.length;r++){var d=s[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){var r="actionArgs";a(this.parent)&&this.parent.enableVirtualization&&"virtualscroll"===e[""+r].requestType&&this.parent.hideSpinner();var n=e.result;if(a(this.parent)&&this.parent.enableVirtualization&&("virtualscroll"===e[""+r].requestType||"clearFilter"===e[""+r].action||""===e[""+r].searchString)&&(this.parent.query.expands=[]),this.parent.hasChildMapping||this.parentItems.length||this.parent.loadChildOnDemand)if(this.parent.loadChildOnDemand){t.isNullOrUndefined(n)||this.parent.loadChildOnDemand&&s(this.parent)&&!t.isNullOrUndefined(this.parent.dataResults.expandRecord)||a(this.parent)&&this.parent.loadChildOnDemand&&e[""+r].isExpandCollapse&&this.parent.enableVirtualization||this.convertToFlatData(n)}else for(var o=function(e){if(s(d.parent)&&n[parseInt(e.toString(),10)].hasChildRecords&&d.parent.initialRender&&(n[parseInt(e.toString(),10)].expanded=!1),a(d.parent)&&d.parent.enableVirtualization){var r=[],o=d.parent;n.filter(function(t){t[""+o.parentIdMapping]===n[parseInt(e.toString(),10)][""+o.idMapping]&&r.push(t)}),r.length?n[parseInt(e.toString(),10)].expanded=!0:n[parseInt(e.toString(),10)].hasChildRecords&&(n[parseInt(e.toString(),10)].expanded=!1)}t.isNullOrUndefined(n[parseInt(e.toString(),10)].index)&&(n[parseInt(e.toString(),10)].taskData=t.extend({},n[parseInt(e.toString(),10)]),n[parseInt(e.toString(),10)].uniqueID=i.getUid(d.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+n[parseInt(e.toString(),10)].uniqueID,n[parseInt(e.toString(),10)],d.parent),n[parseInt(e.toString(),10)].level=0,a(d.parent)&&d.parent.enableVirtualization&&n[parseInt(e.toString(),10)][""+d.parent.parentIdMapping]&&0===n[parseInt(e.toString(),10)].level&&(n[parseInt(e.toString(),10)].level=n[parseInt(e.toString(),10)].level+1),n[parseInt(e.toString(),10)].index=Math.ceil(1e3*Math.random()),(n[parseInt(e.toString(),10)][d.parent.hasChildMapping]||-1!==d.parentItems.indexOf(n[parseInt(e.toString(),10)][d.parent.idMapping]))&&(n[parseInt(e.toString(),10)].hasChildRecords=!0),n[parseInt(e.toString(),10)].checkboxState="uncheck")},d=this,l=0;l<n.length;l++)o(l);else this.zerothLevelData=e,t.setValue("cancel",!0,e);if(a(this.parent)&&this.parent.loadChildOnDemand&&e[""+r].isExpandCollapse&&this.parent.enableVirtualization?e.result=n:a(this.parent)&&this.parent.enableVirtualization&&!this.parent.loadChildOnDemand?e.result=n:e.result=this.parent.loadChildOnDemand?this.parent.flatData:n,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 p=e.query.queries.filter(function(e){return"onAggregates"===e.fn});e.result=this.parent.summaryModule.calculateSummaryValue(p,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});if(d.queries=l,d.isCountRequired=!0,this.parent.enableVirtualization&&"remoteExpand"===e.action){d.take(this.parent.pageSettings.pageSize);(p=[]).push("ExpandingAction",parseInt(e.record[this.parent.idMapping],10).toString()),d.expand(p)}else if(this.parent.enableVirtualization&&"collapse"===e.action){d.take(this.parent.grid.pageSettings.pageSize);var p;(p=[]).push("CollapsingAction",parseInt(e.record[this.parent.idMapping],10).toString()),d.expand(p)}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 h=this.parent.grid.getDataModule().generateQuery().queries.filter(function(e){return"onPage"!==e.fn&&void 0!==e.e.predicates});d.queries.push(h[0])}o.showSpinner(this.parent.element),s.executeQuery(d).then(function(s){var d,l="remoteExpandedData",p="remoteCollapsedData",h=r.parent.grid.currentViewData.slice(),c=r.parent.idMapping;if(r.parent.isGantt&&!r.parent.loadChildOnDemand&&r.parent.hasChildMapping){for(var u=0;u<r.parent.grid.currentViewData.length;u++)if(e.record[c]===r.parent.grid.currentViewData[u][c]){d=u;break}}else d=h.indexOf(e.record);if(r.parent.enableVirtualization&&("collapse"===e.action||"remoteExpand"===e.action)){h=[];for(u=0;u<d;u++)h.push(r.parent.grid.currentViewData[parseInt(u.toString(),10)])}-1===d&&r.parent.grid.getRowsObject().forEach(function(t){t.data.uniqueID===e.record.uniqueID&&(d=t.index)});var g=i.getObject("actual.nextLevel",s),f=s.result,y=[];if("remoteExpand"===e.action&&r.parent.grid.filterModule&&r.parent.grid.filterModule.value){for(u=0;u<h.length;u++)Object.prototype.hasOwnProperty.call(h[parseInt(u.toString(),10)],r.parent.parentIdMapping)&&null!==h[parseInt(u.toString(),10)][""+r.parent.parentIdMapping]&&0===h[parseInt(u.toString(),10)].level&&(h.splice(u,1),u--);for(u=0;u<f.length;u++)e.record[""+r.parent.idMapping]!==f[parseInt(u.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===f[parseInt(u.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(f,u)&&y.push(f[parseInt(u.toString(),10)]);f=y}if(r.parent.enableVirtualization&&"remoteExpand"===e.action){e.record.childRecords=[];for(u=0;u<f.length;u++)e.record[""+r.parent.idMapping]!==f[parseInt(u.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===f[parseInt(u.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(f,u)&&e.record.childRecords.push(f[parseInt(u.toString(),10)])}else e.record.childRecords=f;for(var m=0;m<f.length;m++){if(r.parent.enableVirtualization&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"remoteExpand"===e.action)r.parent[""+l].push(e.record);else if(r.parent.enableVirtualization&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"===e.action)for(u=0;u<r.parent[""+l].length;u++)e.record[""+r.parent.idMapping]===r.parent[""+l][parseInt(u.toString(),10)][""+r.parent.idMapping]&&r.parent[""+l].splice(u,1);if(f[parseInt(m.toString(),10)].taskData=t.extend({},f[parseInt(m.toString(),10)]),f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping]&&r.parent.enableVirtualization&&r.parent[""+l].length){for(u=0;u<r.parent[""+l].length;u++)if(f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping]===r.parent[""+l][parseInt(u.toString(),10)][""+r.parent.idMapping]){f[parseInt(m.toString(),10)].level=r.parent[""+l][parseInt(u.toString(),10)].level+1;delete(S=r.parent[""+l][parseInt(u.toString(),10)]).childRecords,f[parseInt(m.toString(),10)].parentItem=S,f[parseInt(m.toString(),10)].parentUniqueID=e.record.uniqueID}}else if(r.parent.enableVirtualization)if(!f[parseInt(m.toString(),10)][""+r.parent.hasChildMapping]&&-1===r.parentItems.indexOf(f[parseInt(m.toString(),10)][""+r.parent.idMapping])||g&&!g[parseInt(m.toString(),10)]){delete(S=t.extend({},e.record)).childRecords,f[parseInt(m.toString(),10)].parentItem=S,f[parseInt(m.toString(),10)].parentUniqueID=e.record.uniqueID}else t.isNullOrUndefined(f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping])?(f[parseInt(m.toString(),10)].level=0,"remoteExpand"===e.action&&(f[parseInt(m.toString(),10)].childRecords=[],f[parseInt(m.toString(),10)].childRecords=e.record.childRecords)):f[parseInt(m.toString(),10)].level=e.record.level;else{f[parseInt(m.toString(),10)].level=e.record.level+1;var S;delete(S=t.extend({},e.record)).childRecords,f[parseInt(m.toString(),10)].parentItem=S,f[parseInt(m.toString(),10)].parentUniqueID=e.record.uniqueID}if(f[parseInt(m.toString(),10)].index=Math.ceil(1e3*Math.random()),f[parseInt(m.toString(),10)].uniqueID=i.getUid(r.parent.element.id+"_data_"),f[parseInt(m.toString(),10)].checkboxState="uncheck",r.parent.enableVirtualization&&t.isNullOrUndefined(f[parseInt(m.toString(),10)].level))for(var I=0;I<r.parent.grid.currentViewData.length;I++)r.parent.grid.currentViewData[parseInt(I.toString(),10)][""+r.parent.idMapping]===f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping]&&(f[parseInt(m.toString(),10)].level=r.parent.grid.currentViewData[parseInt(I.toString(),10)].level+1);if(t.setValue("uniqueIDCollection."+f[parseInt(m.toString(),10)].uniqueID,f[parseInt(m.toString(),10)],r.parent),(f[parseInt(m.toString(),10)][""+r.parent.hasChildMapping]||-1!==r.parentItems.indexOf(f[parseInt(m.toString(),10)][""+r.parent.idMapping]))&&(!g||g[parseInt(m.toString(),10)]))if(f[parseInt(m.toString(),10)].hasChildRecords=!0,r.parent.enableVirtualization&&r.parent.loadChildOnDemand){for(u=0;u<r.parent[""+p].length;u++)f[parseInt(m.toString(),10)][""+r.parent.idMapping]===r.parent[""+p][parseInt(u.toString(),10)][""+r.parent.idMapping]&&(f[parseInt(m.toString(),10)].expanded=r.parent[""+p][parseInt(u.toString(),10)].expanded);if("collapse"===e.action&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]!==e.record[""+r.parent.idMapping]&&!1!==f[parseInt(m.toString(),10)].expanded)f[parseInt(m.toString(),10)].expanded=!0;else if("collapse"===e.action&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping])f[parseInt(m.toString(),10)].expanded=!1,r.parent[""+p].push(e.record);else if("remoteExpand"===e.action){for(u=0;u<r.parent.grid.currentViewData.length;u++)r.parent.grid.currentViewData[parseInt(u.toString(),10)][""+r.parent.idMapping]===f[parseInt(m.toString(),10)][""+r.parent.idMapping]&&f.splice(m,1,r.parent.grid.currentViewData[parseInt(u.toString(),10)]);if(f[parseInt(m.toString(),10)][r.parent.idMapping]===e.record[""+r.parent.idMapping])for(u=0;u<r.parent[""+p].length;u++)e.record[""+r.parent.idMapping]===r.parent[""+p][parseInt(u.toString(),10)][""+r.parent.idMapping]&&r.parent[""+p].splice(u,1);!1!==f[parseInt(m.toString(),10)].expanded&&(f[parseInt(m.toString(),10)].expanded=!0)}}else r.parent.enableVirtualization&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"!==e.action?f[parseInt(m.toString(),10)].expanded=!0:r.parent.enableVirtualization&&r.parent.loadChildOnDemand||(f[parseInt(m.toString(),10)].expanded=!1);h.splice(d+m+1,0,f[parseInt(m.toString(),10)])}if(t.setValue("result",h,s),t.setValue("action","beforecontentrender",s),r.parent.trigger(K,s),o.hideSpinner(r.parent.element),r.parent.grid.aggregates.length>0&&!r.parent.enableVirtualization){var v=i.getObject("query",s);if(t.isNullOrUndefined(v)&&(v=t.getValue("grid.renderModule.data",r.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(v)){var w=v.queries.filter(function(e){return"onAggregates"===e.fn});s.result=r.parent.summaryModule.calculateSummaryValue(w,s.result,!0)}}r.parent.enableVirtualization&&(r.parent.grid.pageSettings.totalRecordsCount=s.count),s.count=r.parent.grid.pageSettings.totalRecordsCount;var R={};r.parent.enableVirtualization&&r.remoteVirtualAction(R);var x={index:d,childData:f};r.parent.enableInfiniteScrolling?r.parent.notify("infinite-remote-expand",x):t.getValue("grid.renderModule",r.parent).dataManagerSuccess(s,R),r.parent.trigger(ee,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";var c="remoteCollapsedData";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 u=0;u<this.parent[""+c].length;u++)this.parent[""+c][parseInt(u.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 g=this.createRecords(l[this.parent.childMapping],l);l.childRecords=g}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,y=this.parent.getPrimaryKeyFieldNames()[0],m=i.getObject("data",f);t.isNullOrUndefined(f)||t.isNullOrUndefined(f.action)||"add"!==f.action||t.isNullOrUndefined(f.data)||!t.isNullOrUndefined(f.data[""+y])||(f.data[""+y]=e.result[f.index][""+y],m.taskData[""+y]=e.result[f.index][""+y]),(!t.isNullOrUndefined(p)&&Object.keys(p).length||"save"===h)&&(h=h||p.requestType,c=c||i.getObject("data",p),g=g||i.getObject("action",p),"Batch"===this.parent.editSettings.mode&&(this.batchChanges=this.parent.grid.editModule.getBatchChanges()),this.parent.isLocalData&&this.updateAction(c,g,h));var S,I,v=(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,w=s(this.parent)?t.getValue("count",this.parent.dataSource):v.length,R=new n.Query,x=i.getObject("query",e);if(t.isNullOrUndefined(x)||(S=x.queries.filter(function(e){return"onWhere"===e.fn}),I=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||I.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(v).executeLocal(R);if(this.parent.notify("updateFilterRecs",{data:D}),v=this.dataResults.result,this.dataResults.result=null,this.parent.grid.aggregates.length>0){var M=i.getObject("query",e);if(t.isNullOrUndefined(x)&&(x=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(M)){var O=M.queries.filter(function(e){return"onAggregates"===e.fn});v=this.parent.summaryModule.calculateSummaryValue(O,v,!0)}}}if(this.parent.grid.aggregates.length&&0===this.parent.grid.sortSettings.columns.length&&0===this.parent.grid.filterSettings.columns.length&&!this.parent.grid.searchSettings.key.length){var P=i.getObject("query",e);t.isNullOrUndefined(P)&&(P=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query));O=P.queries.filter(function(e){return"onAggregates"===e.fn});v=this.parent.summaryModule.calculateSummaryValue(O,this.parent.flatData,!0)}if(this.parent.grid.sortSettings.columns.length>0||this.isSortAction){this.isSortAction=!1;for(var E=this.parent.parentData,A=(M=i.getObject("query",e),new n.Query),N=this.parent.grid.sortSettings.columns.length-1;N>=0;N--){var U=this.parent.grid.renderModule.data.getColumnByField(this.parent.grid.sortSettings.columns[parseInt(N.toString(),10)].field),k=U.sortComparer&&u(this.parent)?U.sortComparer.bind(U):this.parent.grid.sortSettings.columns[parseInt(N.toString(),10)].direction;A.sortBy(this.parent.grid.sortSettings.columns[parseInt(N.toString(),10)].field,k)}var q=new n.DataManager(E).executeLocal(A);if(this.parent.allowRowDragAndDrop&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var V=q.indexOf(this.parent.rowDragAndDropModule.draggedRecord);q.splice(V,1);var T=q.indexOf(this.parent.rowDragAndDropModule.droppedRecord);this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"topSegment"===this.parent.rowDragAndDropModule.dropPosition?q.splice(T,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&q.splice(T+1,0,this.parent.rowDragAndDropModule.draggedRecord)}var B={modifiedData:q,filteredData:v,srtQry:A};if(this.parent.notify("createSort",B),v=B.modifiedData,this.dataResults.result=null,this.sortedData=v,this.parent.notify("updateModel",{}),this.parent.grid.aggregates.length>0&&!t.isNullOrUndefined(M)){O=i.getObject("query",e).queries.filter(function(e){return"onAggregates"===e.fn});v=this.parent.summaryModule.calculateSummaryValue(O,this.sortedData,!1)}}w=s(this.parent)?t.getValue("count",this.parent.dataSource):v.length;var L=this.paging(v,w,o,l,d,e);v=L.result,w=L.count,e.result=v,e.count=w,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(ae,{result:e,count:i,actionArgs:d}),e=this.dataResults.result,i=this.dataResults.count}}else this.parent.notify(ae,{result:e,count:i}),e=this.dataResults.result,i=s(this.parent)?t.getValue("count",this.parent.dataSource):this.dataResults.count;var l="isCollapsedStatePersist";if((!0===n||a.isPdfExport&&(t.isNullOrUndefined(a[""+l])||a[""+l]))&&"AllPages"===this.parent.printMode){for(var p=[],c=0;c<e.length;c++){h(this.parent,e[parseInt(c.toString(),10)],this.parent.parentData)&&p.push(e[parseInt(c.toString(),10)])}i=(e=p).length}return{result:e,count:i}},e.prototype.updateData=function(e){this.dataResults=e},e.prototype.updateAction=function(e,t,i){"delete"!==i&&"save"!==i||this.parent.notify(pe,{value:e,action:t||i}),"batchsave"===i&&"Batch"===this.parent.editSettings.mode&&this.parent.notify(xe,{})},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 Ze=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)}}(),et=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},tt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ze(i,e),et([t.Property(12)],i.prototype,"pageSize",void 0),et([t.Property(8)],i.prototype,"pageCount",void 0),et([t.Property(1)],i.prototype,"currentPage",void 0),et([t.Property()],i.prototype,"totalRecordsCount",void 0),et([t.Property(!1)],i.prototype,"enableQueryString",void 0),et([t.Property(!1)],i.prototype,"pageSizes",void 0),et([t.Property(null)],i.prototype,"template",void 0),et([t.Property("All")],i.prototype,"pageSizeMode",void 0),i}(t.ChildProperty),it=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)}}(),rt=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},nt=function(e){function r(){var i=null!==e&&e.apply(this,arguments)||this;return i.intl=new t.Internationalization,i.templateFn={},i}return it(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)},rt([t.Property()],r.prototype,"type",void 0),rt([t.Property()],r.prototype,"footerTemplate",void 0),rt([t.Property()],r.prototype,"field",void 0),rt([t.Property()],r.prototype,"format",void 0),rt([t.Property()],r.prototype,"columnName",void 0),rt([t.Property()],r.prototype,"customAggregate",void 0),r}(t.ChildProperty),ot=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return it(i,e),rt([t.Collection([],nt)],i.prototype,"columns",void 0),rt([t.Property(!0)],i.prototype,"showChildSummary",void 0),i}(t.ChildProperty),at=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)}}(),st=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},dt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return at(i,e),st([t.Property(!1)],i.prototype,"allowAdding",void 0),st([t.Property(!1)],i.prototype,"allowEditing",void 0),st([t.Property(!1)],i.prototype,"allowDeleting",void 0),st([t.Property("Cell")],i.prototype,"mode",void 0),st([t.Property("Top")],i.prototype,"newRowPosition",void 0),st([t.Property(!0)],i.prototype,"allowEditOnDblClick",void 0),st([t.Property(!0)],i.prototype,"showConfirmDialog",void 0),st([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),st([t.Property("")],i.prototype,"template",void 0),st([t.Property({})],i.prototype,"dialog",void 0),st([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),lt=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)}}(),pt=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},ht=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return lt(i,e),pt([t.Property()],i.prototype,"field",void 0),pt([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),ct=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return lt(i,e),pt([t.Collection([],ht)],i.prototype,"columns",void 0),pt([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),ut=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)}}(),gt=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},ft=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ut(i,e),gt([t.Property(!1)],i.prototype,"enableCache",void 0),gt([t.Property(3)],i.prototype,"maxBlocks",void 0),gt([t.Property(3)],i.prototype,"initialBlocks",void 0),i}(t.ChildProperty),yt=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)}}(),mt=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},St=function(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)])){if(!(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(_e),t.setValue("mergePersistData",o.mergePersistTreeGridData,o);return t.isNullOrUndefined(o.injectedModules.Logger)||i.Grid.Inject(i.Logger),o.grid=new i.Grid,o}yt(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"]));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,["field","headerText","type","format","visible","template","index","width","textAlign","headerTextAlign","columns"]);var a=this.createElement("form",{id:"ExportForm",styles:"display:none;"}),s=this.createElement("input",{id:"treeGridInput",attrs:{name:"treeGridModel"}});s.value=JSON.stringify(o),a.method="POST",a.action=e,a.appendChild(s),document.body.appendChild(a),a.submit(),a.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,t,i){this.sortModule&&this.sortModule.sortColumn(e,t,i)},d.prototype.clearSorting=function(){this.sortModule&&this.sortModule.clearSorting()},d.prototype.removeSortColumn=function(e){this.sortModule&&this.sortModule.removeSortColumn(e)},d.prototype.search=function(e){this.grid.search(e)},d.prototype.autoFitColumns=function(e){this.resizeModule.autoFitColumns(e),this.updateColumnModel()},d.prototype.reorderColumns=function(e,t){this.grid.reorderColumns(e,t)},d.prototype.TreeGridLocale=function(){var e=t.L10n.locale,r={};t.setValue(this.locale,{},r);var n;n={},n=i.getObject(this.locale,e);var o;o={},o=i.getObject(this.getModuleName(),n),t.setValue("grid",o,i.getObject(this.locale,r)),t.L10n.load(r)},d.prototype.print=function(){this.printModule.print()},d.prototype.treeGridkeyActionHandler=function(e){if(this.allowKeyboard){var i=void 0,r=void 0,n=void 0,o=void 0,a=void 0;switch(e.action){case"ctrlDownArrow":this.expandAll();break;case"ctrlUpArrow":this.collapseAll();break;case"ctrlShiftUpArrow":n=(i=e.target).closest(".e-rowcell"),t.isNullOrUndefined(n)||(o=n.closest("tr"),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.getElementsByClassName("e-treegridexpand")[0])||this.expandCollapseRequest(o.querySelector(".e-treegridexpand")));break;case"ctrlShiftDownArrow":n=(i=e.target).closest(".e-rowcell"),t.isNullOrUndefined(n)||(o=n.closest("tr"),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.getElementsByClassName("e-treegridcollapse")[0])||this.expandCollapseRequest(o.querySelector(".e-treegridcollapse")));break;case"downArrow":if(!this.enableVirtualization){var s=(r=(i=e.target).parentElement).cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(s).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(s).edit.obj)&&(r=i),null!==(a=this.findnextRowElement(r))){var d=a.rowIndex;this.selectRow(d);var l=e.target.cellIndex,p=a.children[parseInt(l.toString(),10)];t.addClass([p],"e-focused"),t.addClass([p],"e-focus")}else this.clearSelection()}break;case"upArrow":if(!this.enableVirtualization){s=(r=(i=e.target).parentElement).cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(s).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(s).edit.obj)&&(r=i),null!==(a=this.findPreviousRowElement(r))){var h=a.rowIndex;this.selectRow(h);var c=e.target.cellIndex,u=a.children[parseInt(c.toString(),10)];t.addClass([u],"e-focused"),t.addClass([u],"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),t.EventHandler.add(this.element,"mousemove",this.mouseMoveHandler,this),this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.treeGridkeyActionHandler.bind(this),keyConfigs:this.keyConfigs,eventName:"keydown"}),this.allowKeyboard&&(this.element.tabIndex=-1===this.element.tabIndex?0:this.element.tabIndex)},d.prototype.requiredModules=function(){var e=[];if(this.grid.splitFrozenCount(this.getColumns()),this.isDestroyed)return e;e.push({member:"filter",args:[this,this.filterSettings]}),t.isNullOrUndefined(this.toolbar)||e.push({member:"toolbar",args:[this]}),this.contextMenuItems&&e.push({member:"contextMenu",args:[this]}),this.allowPaging&&e.push({member:"pager",args:[this,this.pageSettings]}),this.allowReordering&&e.push({member:"reorder",args:[this]}),this.allowSorting&&e.push({member:"sort",args:[this]}),this.aggregates.length>0&&e.push({member:"summary",args:[this]}),e.push({member:"resize",args:[this]}),this.allowExcelExport&&e.push({member:"ExcelExport",args:[this]});var i=this.injectedModules.filter(function(e){return"freeze"===e.prototype.getModuleName()});return(this.frozenColumns||this.frozenRows||this.getFrozenColumns()||this.grid.getFrozenLeftColumnsCount()||this.grid.getFrozenRightColumnsCount()||i.length)&&e.push({member:"freeze",args:[this]}),this.detailTemplate&&e.push({member:"detailRow",args:[this]}),this.allowPdfExport&&e.push({member:"PdfExport",args:[this]}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this]}),this.showColumnChooser&&e.push({member:"ColumnChooser",args:[this]}),this.extendRequiredModules(e),e},d.prototype.extendRequiredModules=function(e){var i=this.injectedModules.filter(function(e){return"rowDragAndDrop"===e.prototype.getModuleName()});(this.allowRowDragAndDrop||i.length)&&(t.isNullOrUndefined(this.toolbar)||!this.toolbar.includes("Indent")&&!this.toolbar.includes("Outdent")||(this.isIndentEnabled=!0),e.push({member:"rowDragAndDrop",args:[this]})),(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&e.push({member:"edit",args:[this]}),this.isCommandColumn(this.columns)&&e.push({member:"commandColumn",args:[this]}),this.allowSelection&&e.push({member:"selection",args:[this]}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this]}),this.enableInfiniteScrolling&&e.push({member:"infiniteScroll",args:[this]}),e.push({member:"logger",args:[this.grid]})},d.prototype.isCommandColumn=function(e){var t=this;return e.some(function(e){return e.columns?t.isCommandColumn(e.columns):!(!e.commands&&!e.commandsTemplate)})},d.prototype.unwireEvents=function(){this.grid&&this.grid.element&&t.EventHandler.remove(this.grid.element,"click",this.mouseClickHandler)},d.prototype.log=function(e,t){this.loggerModule&&this.loggerModule.treeLog(e,t,this)},d.prototype.render=function(){var e=this;this.isReact&&(this.grid.isReact=!0,this.grid.portals=[]),this.isVue&&(this.grid.isVue=!0,this.grid.vueInstance=this.vueInstance),o.createSpinner({target:this.element},this.createElement),this.log(["mapping_fields_missing"]),this.renderModule=new Xe(this),this.dataModule=new $e(this),this.printModule=new He(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.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].setAttribute("tabindex","0");this.element.getElementsByClassName("e-content")[0].querySelector(".e-table").setAttribute("role","treegrid"),this.isIndentEnabled&&this.refreshToolbarItems(),this.wireEvents(),this.renderComplete();var n=this.grid.destroyTemplate;this.grid.destroyTemplate=function(i,r){n.apply(e.grid);e.isReact&&t.isNullOrUndefined(e.portals)||e.clearTemplate(i,r)}},d.prototype.refreshToolbarItems=function(){var e=this.toolbarModule.getToolbar(),t=this.element.id+"_gridcontrol_indent",i=this.element.id+"_gridcontrol_outdent",r=e.querySelector("#"+t).parentElement,n=e.querySelector("#"+i).parentElement;r.classList.add("e-hidden"),n.classList.add("e-hidden")},d.prototype.afterGridRender=function(){t.isNullOrUndefined(this.grid.clipboardModule)||this.grid.clipboardModule.destroy(),this.clipboardModule=this.grid.clipboardModule=new Fe(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);var e="templateDotnetInstance";this.grid[""+e]=this[""+e];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){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))||(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(Te,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(W,t),e.trigger(W,t)},this.grid.rowDeselected=function(i){e.selectedRowIndex=e.grid.selectedRowIndex,t.isNullOrUndefined(i.data)||e.notify(J,i),e.trigger(J,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(Y,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 j(e.grid)}},this.grid.printComplete=this.triggerEvents.bind(this),this.grid.actionFailure=this.triggerEvents.bind(this),this.extendedGridDataBoundEvent(),this.extendedGridEvents(),this.extendedGridActionEvents(),this.extendedGridEditEvents(),this.bindGridDragEvents(),this.bindCallBackEvents()},d.prototype.lastRowBorder=function(e,i){for(var r=0;r<e.cells.length;r++)i?t.addClass([e.cells[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(!m(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(H,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(X,t,function(r){r.cancel||e.notify(X,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")){var r=new n.Deferred;return e.trigger(he,i,function(e){r.resolve(e)}),r}i.cancel=!0}},d.prototype.extendedGridEditEvents=function(){var e=this;this.grid.dataStateChange=function(i){e.isExpandRefresh?(e.isExpandRefresh=!1,e.grid.dataSource={result:e.flatData,count:t.getValue("count",e.grid.dataSource)}):("infiniteScroll"!==i.action.requestType&&(e.infiniteScrollData=[]),e.trigger(Q,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(ge,i,function(t){t.cancel||e.notify(ge,t),o.resolve(t)}),o},this.grid.cellSaved=function(t){e.trigger(fe,t),e.notify(fe,t)},this.grid.cellEdit=function(t){var i=new n.Deferred;return t.promise=i,e.notify(ye,t),i},this.grid.batchAdd=function(t){e.trigger(Ie,t),e.notify(Ie,t)},this.grid.beforeBatchSave=function(t){e.trigger(Re,t),e.notify(Re,t)},this.grid.beforeBatchAdd=function(t){e.trigger(we,t),e.notify(we,t)},this.grid.batchDelete=function(t){e.trigger(me,t),e.notify(me,t)},this.grid.beforeBatchDelete=function(t){e.trigger(ve,t),e.notify(ve,t)},this.grid.batchCancel=function(t){"Cell"!==e.editSettings.mode&&e.trigger(Se,t),e.notify(Se,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(){var e="dataSource";if(this.dataSource&&s(this)){var i=this.flatData,r=t.getValue("count",this.dataSource);this.grid.dataSource={result:i,count:r}}else this.grid.dataSource=this.dataSource instanceof n.DataManager?new n.DataManager(this.dataSource.dataSource,this.dataSource.defaultQuery,this.dataSource.adaptor):this.flatData;if(this.dataSource instanceof n.DataManager&&(this.dataSource.dataSource.offline||this.dataSource.ready)){this.grid.dataSource[""+e].json=g(this.dataSource[""+e].json),this.grid.dataSource.ready=this.dataSource.ready;var o=this;t.isNullOrUndefined(this.grid.dataSource.ready)||this.grid.dataSource.ready.then(function(t){var i=o.grid.dataSource;i[""+e].offline=!0,i.isDataAvailable=!0,i[""+e].json=t.result,i.adaptor=new n.JsonAdaptor})}},d.prototype.extendedGridActionEvents=function(){var e=this;this.grid.actionBegin=function(r){"sorting"===r.requestType&&r.target&&r.target.parentElement&&r.target.parentElement.classList.contains("e-hierarchycheckbox")&&(r.cancel=!0);if("reorder"===i.getObject("requestType",r)&&e.notify("getColumnIndex",{}),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(G,r,function(t){t.cancel||e.notify(he,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(ce,t),"batchsave"===t.requestType&&e.notify(xe,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(K,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("."+Be),o=e.grid.element.querySelector("."+Le);n.style.height=o.style.height="auto"}e.trigger(K,t)}}},d.prototype.extendedGridEvents=function(){var e=this,i=this;this.grid.recordDoubleClick=function(t){e.trigger(ue,t),e.notify(ue,t)},this.grid.detailDataBound=function(t){e.notify("detaildataBound",t),e.trigger(Ae,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(le,t),e.trigger(le,t)},this.grid.contextMenuOpen=function(t){e.notify(de,t),e.trigger(de,t)},this.grid.queryCellInfo=function(t){e.renderModule.cellRender(t)}},d.prototype.bindGridDragEvents=function(){var e=this;this.grid.rowDragStartHelper=function(t){e.trigger(Ne,t)},this.grid.rowDragStart=function(t){e.trigger("rowDragStart",t)},this.grid.rowDrag=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(qe,t),e.trigger("rowDrag",t))},this.grid.rowDrop=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(Ve,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 x(o)),s.push(a),!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex])&&this.enableRtl&&a.field===this.columnModel[this.treeColumnIndex].field&&(t.isNullOrUndefined(this.treeColumnTextAlign)&&(this.treeColumnTextAlign=this.columnModel[this.treeColumnIndex].textAlign,this.treeColumnField=this.columnModel[this.treeColumnIndex].field),a.textAlign="Right")}return s},d.prototype.onPropertyChanged=function(e){for(var r=!1,o=0,a=Object.keys(e);o<a.length;o++){var d=a[o];switch(d){case"treeColumnIndex":this.grid.refreshColumns();break;case"allowPaging":this.grid.allowPaging=this.allowPaging;break;case"pageSettings":this.grid.pageSettings=i.getActualProperties(this.pageSettings),r=!0;break;case"enableVirtualization":this.grid.enableVirtualization=this.enableVirtualization;break;case"enableColumnVirtualization":this.grid.enableColumnVirtualization=this.enableColumnVirtualization;break;case"toolbar":this.grid.toolbar=this.getGridToolbar();break;case"allowSelection":this.grid.allowSelection=this.allowSelection;break;case"selectionSettings":this.grid.selectionSettings=i.getActualProperties(this.selectionSettings);break;case"allowSorting":this.grid.allowSorting=this.allowSorting;break;case"allowMultiSorting":this.grid.allowMultiSorting=this.allowMultiSorting;break;case"sortSettings":this.grid.sortSettings=i.getActualProperties(this.sortSettings);break;case"searchSettings":this.grid.searchSettings=i.getActualProperties(this.searchSettings);break;case"allowFiltering":this.grid.allowFiltering=this.allowFiltering;break;case"filterSettings":this.initialRender||(this.grid.filterSettings=i.getActualProperties(this.filterSettings));break;case"showColumnMenu":this.grid.showColumnMenu=this.showColumnMenu;break;case"allowRowDragAndDrop":this.grid.allowRowDragAndDrop=this.allowRowDragAndDrop;break;case"aggregates":this.grid.aggregates=i.getActualProperties(this.aggregates);break;case"enableInfiniteScrolling":this.grid.enableInfiniteScrolling=this.enableInfiniteScrolling;break;case"dataSource":if(this.isLocalData=!(this.dataSource instanceof n.DataManager)||!t.isNullOrUndefined(this.dataSource.ready)||this.dataSource.adaptor instanceof n.RemoteSaveAdaptor,this.convertTreeData(this.dataSource),this.isLocalData){if(s(this)){var l=t.getValue("count",this.dataSource);this.grid.dataSource={result:this.flatData,count:l}}else{var p=this.dataSource;this.grid.dataSource=p instanceof n.DataManager?new n.DataManager(p.dataSource,p.defaultQuery,p.adaptor):this.flatData}this.enableVirtualization&&(this.grid.contentModule.isDataSourceChanged=!0)}else this.bindedDataSource(),this.enableVirtualization&&(this.grid.contentModule.removeEventListener(),this.grid.contentModule.eventListener("on"),this.grid.contentModule.renderTable());break;case"query":this.grid.query=this.query;break;case"enableCollapseAll":e[""+d]?this.collapseAll():this.expandAll();break;case"expandStateMapping":this.grid.refresh();break;case"gridLines":this.grid.gridLines=this.gridLines;break;case"rowTemplate":this.grid.rowTemplate=i.getActualProperties(this.rowTemplate);break;case"frozenRows":this.grid.frozenRows=this.frozenRows;break;case"frozenColumns":this.grid.frozenColumns=this.frozenColumns;break;case"rowHeight":this.grid.rowHeight=this.rowHeight;break;case"height":t.isNullOrUndefined(this.height)||"string"!=typeof this.height||-1===this.height.indexOf("%")||(this.element.style.height=this.height),this.grid.height=this.height;break;case"width":t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(this.element.style.width=this.width),this.grid.width=this.width;break;case"locale":this.grid.locale=this.locale,this.TreeGridLocale(),this.grid.toolbar=this.getGridToolbar(),this.grid.contextMenuItems=this.getContextMenu();break;case"selectedRowIndex":this.grid.selectedRowIndex=this.selectedRowIndex;break;case"enableAltRow":this.grid.enableAltRow=this.enableAltRow;break;case"enableHover":this.grid.enableHover=this.enableHover;break;case"enableAutoFill":this.grid.enableAutoFill=this.enableAutoFill;break;case"enableAdaptiveUI":this.grid.enableAdaptiveUI=this.enableAdaptiveUI;break;case"enableImmutableMode":this.grid.enableImmutableMode=this.enableImmutableMode;break;case"allowExcelExport":this.grid.allowExcelExport=this.allowExcelExport;break;case"allowPdfExport":this.grid.allowPdfExport=this.allowPdfExport;break;case"enableRtl":t.isNullOrUndefined(this.treeColumnField)||this.updateTreeColumnTextAlign(),this.grid.enableRtl=this.enableRtl;break;case"allowReordering":this.grid.allowReordering=this.allowReordering;break;case"allowResizing":this.grid.allowResizing=this.allowResizing;break;case"textWrapSettings":this.grid.textWrapSettings=i.getActualProperties(this.textWrapSettings);break;case"allowTextWrap":this.grid.allowTextWrap=i.getActualProperties(this.allowTextWrap),this.grid.refresh();break;case"contextMenuItems":this.grid.contextMenuItems=this.getContextMenu();break;case"showColumnChooser":this.grid.showColumnChooser=this.showColumnChooser;break;case"detailTemplate":this.grid.detailTemplate=i.getActualProperties(this.detailTemplate);break;case"columnMenuItems":this.grid.columnMenuItems=i.getActualProperties(this.columnMenuItems);break;case"editSettings":this.grid.isEdit&&"Normal"===this.grid.editSettings.mode&&e[""+d].mode&&("Cell"===e[""+d].mode||"Row"===e[""+d].mode)&&this.grid.closeEdit(),this.grid.editSettings=this.getGridEditSettings()}r&&this.grid.refresh()}},d.prototype.updateTreeColumnTextAlign=function(){this.grid.getColumnByField(this.treeColumnField).textAlign=this.enableRtl?"Right":this.treeColumnTextAlign,this.grid.refreshColumns()},d.prototype.destroy=function(){var e=this.element;if(e){var t=!(!e.querySelector(".e-gridheader")||!e.querySelector(".e-gridcontent"));t&&this.unwireEvents(),this.removeListener(),t&&r.prototype.destroy.call(this),this.grid&&this.grid.destroy(),this.dataModule&&this.dataModule.destroy();for(var i=["dataModule","sortModule","renderModule","filterModule","printModule","clipboardModule","excelExportModule","pdfExportModule","toolbarModule","summaryModule","reorderModule","resizeModule","pagerModule","keyboardModule","columnMenuModule","contextMenuModule","editModule","virtualScrollModule","selectionModule","detailRow","rowDragAndDropModule","freezeModule"],n=0;n<i.length;n++)this[i[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=0;r<e.length;r++)for(var n=this[e[parseInt(r.toString(),10)]],o=0,a=i[e[parseInt(r.toString(),10)]];!t.isNullOrUndefined(a)&&o<a.length;o++){delete n[""+a[parseInt(o.toString(),10)]]}return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(e)},d.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)t[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;if(!i.classList.contains("e-treegridexpand")&&!i.classList.contains("e-treegridcollapse")||this.isEditCollapse||this.grid.isEdit||this.expandCollapseRequest(i),this.isEditCollapse=!1,this.notify("checkboxSelection",{target:i}),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.mouseMoveHandler=function(e){var t=!1,r=this.getColumns();"EllipsisWithTooltip"===this.clipMode&&(t=!0);var n=i.parentsUntil(e.target,"e-ellipsistooltip");if((t||-1!==this.treeColumnIndex&&"EllipsisWithTooltip"===r[this.treeColumnIndex].clipMode)&&null!==n&&parseInt(n.getAttribute("data-colindex"),10)===this.treeColumnIndex&&n.children[0].scrollWidth>n.children[0].clientWidth){new o.Tooltip({content:n.textContent}).appendTo(n)}},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,t){this.grid.editModule&&this.grid.editModule.deleteRecord(e,t)},d.prototype.startEdit=function(e){this.grid.editModule&&this.grid.editModule.startEdit(e)},d.prototype.editCell=function(e,t){this.editModule&&this.editModule.editCell(e,t)},d.prototype.enableToolbarItems=function(e,t){this.grid.toolbarModule&&this.grid.toolbarModule.enableItems(e,t)},d.prototype.endEdit=function(){this.grid.editModule&&this.grid.editModule.endEdit()},d.prototype.openColumnChooser=function(e,t){this.columnChooserModule&&this.columnChooserModule.openColumnChooser(e,t)},d.prototype.deleteRow=function(e){this.grid.editModule&&this.grid.editModule.deleteRow(e)},d.prototype.getPrimaryKeyFieldNames=function(){return this.grid.getPrimaryKeyFieldNames()},d.prototype.setCellValue=function(e,i,r){this.grid.setCellValue(e,i,r);var n=this.grid.getRowIndexByPrimaryKey(e),o=this.getCurrentViewRecords()[parseInt(n.toString(),10)];t.isNullOrUndefined(o)||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){this.grid.pagerModule&&this.grid.pagerModule.goToPage(e)},d.prototype.updateExternalMessage=function(e){this.pagerModule&&this.grid.pagerModule.updateExternalMessage(e)},d.prototype.getCellFromIndex=function(e,t){return this.grid.getCellFromIndex(e,t)},d.prototype.getColumnByField=function(e){return i.iterateArrayOrObject(this.columnModel,function(t){if(t.field===e)return t})[0]},d.prototype.getColumnByUid=function(e){var t=this.initialRender?this.grid.columns:this.columns;return this.grid.columns.length!==this.columnModel.length&&(t=this.grid.columnModel),i.iterateArrayOrObject(t,function(t){if(t.uid===e)return t})[0]},d.prototype.getColumnFieldNames=function(){return this.grid.getColumnFieldNames()},d.prototype.getFooterContent=function(){return this.grid.getFooterContent()},d.prototype.getFooterContentTable=function(){return this.grid.getFooterContentTable()},d.prototype.showColumns=function(e,t){this.grid.showColumns(e,t),this.updateColumnModel()},d.prototype.hideColumns=function(e,t){this.grid.hideColumns(e,t),this.updateColumnModel()},d.prototype.getColumnHeaderByField=function(e){return this.grid.getColumnHeaderByField(e)},d.prototype.getColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getColumnHeaderByUid=function(e){return this.grid.getColumnHeaderByUid(e)},d.prototype.getColumnIndexByField=function(e){return this.grid.getColumnIndexByField(e)},d.prototype.getVirtualColIndexByUid=function(e){var r=i.iterateArrayOrObject(this.grid.columnModel,function(t,i){if(t.uid===e)return i})[0];return t.isNullOrUndefined(r)?-1:r},d.prototype.getColumnIndexByUid=function(e){return this.grid.getColumnIndexByUid(e)},d.prototype.getColumns=function(e){return this.updateColumnModel(this.grid.getColumns(e)),this.columnModel},d.prototype.updateColumnModel=function(e){var i,r,n=t.isNullOrUndefined(e)?this.grid.getColumns():e;-1!==this.treeColumnIndex&&this.columnModel[this.treeColumnIndex]&&!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex].template)&&(i=this.columnModel[this.treeColumnIndex].template,r=this.columnModel[this.treeColumnIndex].field);var o;if(!this.enableColumnVirtualization||this.enableColumnVirtualization&&this.columnModel.length===n.length){this.columnModel=[];for(var a=0;a<n.length;a++){o={};for(var s=0,d=Object.keys(n[parseInt(a.toString(),10)]);s<d.length;s++){var l=d[s];o[""+l]=n[parseInt(a.toString(),10)][""+l]}this.columnModel.push(new x(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&&this.updateColumnsWidth(this.columns),this.stackedHeader||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(e.columns)i.updateColumnsWidth(e.columns);else if(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.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,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,r,n):this.trigger(te,d,function(t){o.expandAllPrevent=t.cancel,t.cancel||(t.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s,r,n))}),this.isExpandingEventTriggered=!0}else if(!this.isExpandAll||this.isExpandAll&&a(this)){d={data:i,row:e,cancel:!1};this.trigger(te,d,function(t){t.cancel||(t.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s,r,n))})}},d.prototype.expandRows=function(e,i,r,n,o){this.expandCollapse("expand",e,i);if((!a(this)||u(this))&&(!s(this)||!t.isNullOrUndefined(i.Children))){var d={data:i,row:e};t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(d.data,!0),this.isExpandAll&&!this.isExpandedEventTriggered?(this.isExpandedEventTriggered=!0,d={data:r,row:e},this.trigger(ee,d)):this.isExpandAll||this.trigger(ee,d)}},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.grid.getCurrentViewRecords()[parseInt(e.getAttribute("data-rowindex"),10)]),i},d.prototype.collapseRow=function(e,t,i){var r=this,n=this.parentData;if(this.enableVirtualization||(n=this.flatData.filter(function(e){return e.hasChildRecords})),t=this.getCollapseExpandRecords(e,t),this.isCollapseAll&&!a(this)){var o={data:n,row:e,cancel:!1};this.isCollapsingEventTriggered?this.allowPaging||this.collapseAllPrevent||!this.isCollapsingEventTriggered||this.collapseRows(e,t,n,i):this.trigger(re,o,function(o){r.collapseAllPrevent=o.cancel,o.cancel||(o.collapseAll&&r.expandCollapseAllChildren(t,"collapse",i),r.collapseRows(e,t,n,i))}),this.isCollapsingEventTriggered=!0}else if(!this.isCollapseAll||this.isCollapseAll&&a(this)){o={data:t,row:e,cancel:!1};this.trigger(re,o,function(o){o.cancel||r.collapseRows(e,t,n,i)})}},d.prototype.collapseRows=function(e,i,r,n){this.expandCollapse("collapse",e,i);var o={data:i,row:e};if(!a(this)&&(t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(o.data,!1),this.isCollapseAll&&!this.isCollapsedEventTriggered?(this.isCollapsedEventTriggered=!0,o={data:r,row:e},this.trigger(ie,o)):this.isCollapseAll||this.trigger(ie,o),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((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!0),t.hasChildRecords&&t.level===e});this.expandAction(t,null,e,!0)}else{t=this.getRecordDetails(e);var r=i.getObject("records",t);this.expandAction(r,null,e)}},d.prototype.expandByKey=function(e){this.expandCollapseActionByKey(e,"Expand")},d.prototype.expandAction=function(e,i,r,n){void 0===n&&(n=!1);for(var o=function(o){if(!t.isNullOrUndefined(e[parseInt(o.toString(),10)].parentItem)){var d=e[parseInt(o.toString(),10)].parentItem.uniqueID,l=s.flatData.filter(function(e){return e.uniqueID===d});a(s)&&(l=s.getCurrentViewRecords().filter(function(e){return e.uniqueID===d})),!1===l[0].expanded?(e.push(l[0]),l[0].expanded=!0):h(s,l[0],s.parentData)||l[0].expanded&&void 0!==l[0].parentItem&&e.push(l[0])}n||s.expandRow(null,e[parseInt(o.toString(),10)],i,r)},s=this,d=0;d<e.length;d++)o(d);n&&this.expandRow(null,e,i,r)},d.prototype.getRecordDetails=function(e){var t=this.getRows().filter(function(t){return-1!==t.className.indexOf("level"+e)&&(t.querySelector(".e-treegridcollapse")||t.querySelector(".e-treegridexpand"))});return{records:this.getCurrentViewRecords().filter(function(t){return t.level===e&&t.hasChildRecords}),rows:t}},d.prototype.collapseAtLevel=function(e){if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!1),t.hasChildRecords&&t.level===e});this.collapseAction(t,null,!0)}else{var r=this.getRecordDetails(e),n=i.getObject("records",r);this.collapseAction(n)}},d.prototype.collapseByKey=function(e){this.expandCollapseActionByKey(e,"Collapse")},d.prototype.expandCollapseActionByKey=function(e,i){var r=this.getPrimaryKeyFieldNames()[0],n=a(this)?this.getCurrentViewRecords():this.grid.dataSource;if(!t.isNullOrUndefined(r)){var o=n.filter(function(t){return t[""+r].toString()===e.toString()});"Expand"===i?this.expandAction(o,e,null):this.collapseAction(o,e)}},d.prototype.collapseAction=function(e,t,i){if(void 0===i&&(i=!1),i)this.collapseRow(null,e);else for(var r=0;r<e.length;r++)this.collapseRow(null,e[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(){this.isExpandedEventTriggered=!1,this.isExpandingEventTriggered=!1,this.expandCollapseAll("expand")},d.prototype.collapseAll=function(){this.isCollapsedEventTriggered=!1,this.isCollapsingEventTriggered=!1,this.expandCollapseAll("collapse")},d.prototype.expandCollapseAll=function(e){var i=this.getRows().filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))});if(!i.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(var r=0;r<i.length;r++)"collapse"===e?t.isNullOrUndefined(this.getCurrentViewRecords()[i[parseInt(r.toString(),10)].rowIndex])||this.collapseRow(i[parseInt(r.toString(),10)]):this.enableVirtualization?"true"!==i[0].getAttribute("aria-expanded")&&this.expandRow(i[0]):this.expandRow(i[parseInt(r.toString(),10)]);else if(this.allowPaging){var n=this.enableCollapseAll;this.setProperties({enableCollapseAll:!0},!0),this.grid.pagerModule.goToPage(1),this.setProperties({enableCollapseAll:n},!0)}}else for(r=0;r<i.length;r++)"collapse"===e?this.collapseRow(i[parseInt(r.toString(),10)]):this.expandRow(i[parseInt(r.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){var g=this.getContentTable().rows;c=[].slice.call(g)}var f;if(t.isNullOrUndefined(i)?(f=this.grid.currentViewData.indexOf(r),i=c[parseInt(f.toString(),10)]):f=+i.getAttribute("data-rowindex"),t.isNullOrUndefined(i)||i.setAttribute("aria-expanded","expand"===e?"true":"false"),!(this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization||this.enableInfiniteScrolling)||a(this)||s(this)){var y=void 0;if("expand"===e){if(y="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(y="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 S=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 I=this.getVisibleRecords()[this.getVisibleRecords().length-1].index,v=this.getRowByIndex(I);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 R=this.getRows(),x=(g=this.getContentTable().rows,(R=[].slice.call(g)).length-1);x>=0;x--)if(!m(R[parseInt(x.toString(),10)])){var C=this.getContentTable().scrollHeight,b=this.getContent().clientHeight;this.lastRowBorder(R[parseInt(x.toString(),10)],C<=b);break}this.notify("rowExpandCollapse",{detailrows:S,action:y,record:r,row:i}),this.updateAltRow(c)}else this.notify(oe,{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);this.dataResults.result=o}else{var d=new n.Deferred;e.childDataBind=d.resolve;var l=e.data;this.trigger(Q,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}var d=t.getValue("result",r.dataSource),p=g(e.childData),h=l[r.childMapping]&&l[r.childMapping].length>p.length?l[r.childMapping].length:p.length;for(a=0;a<h;a++)l[r.childMapping]&&d.filter(function(e,t){e[r.parentIdMapping]===l[r.idMapping]&&d.splice(t,1)}),p[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(ee,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(ne,{record:i,rows:a,parentRow:t});var s={row:t,data:i};a.length>0&&this.trigger(ee,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(ie,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(var g=0;g<o.length;g++){var f=this.grid.getRowIndexByPrimaryKey(o[parseInt(g.toString(),10)][""+u]);n.push(this.getRows()[parseInt(f.toString(),10)])}}else n=p.filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))});var y=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.frozenRows||this.frozenColumns||this.getFrozenColumns()||y)&&(d=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))})),y&&(l=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))}));var m=this.grid.getRowsObject(),S=this.grid.currentViewData,I=S.filter(function(e){return e.uniqueID===r.uniqueID}),v=S.indexOf(I[0]);t.isNullOrUndefined(m[parseInt(v.toString(),10)].visible)||!1===m[parseInt(v.toString(),10)].visible||(m[parseInt(v.toString(),10)].visible=!0);var w=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))});for(g=0;g<n.length;g++){if(t.isNullOrUndefined(n[parseInt(g.toString(),10)])||(n[parseInt(g.toString(),10)].style.display=c),!t.isNullOrUndefined(n[parseInt(g.toString(),10)])&&!this.allowPaging&&!(this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this))){m[n[parseInt(g.toString(),10)].rowIndex].visible="none"!==c;var R=S.filter(function(e){return e.uniqueID===I[0].parentUniqueID});!t.isNullOrUndefined(R[0])&&p[S.indexOf(R[0])].getElementsByClassName("e-treegridcollapse").length&&(m[parseInt(v.toString(),10)].visible=!1)}t.isNullOrUndefined(d)||(d[parseInt(g.toString(),10)].style.display=c),t.isNullOrUndefined(l)||(l[parseInt(g.toString(),10)].style.display=c),this.notify("childRowExpand",{row:n[parseInt(g.toString(),10)]}),!t.isNullOrUndefined(o[parseInt(g.toString(),10)].childRecords)&&o[parseInt(g.toString(),10)].childRecords.length>0&&("expand"!==e||t.isNullOrUndefined(o[parseInt(g.toString(),10)].expanded)||o[parseInt(g.toString(),10)].expanded)&&(this.expandCollapse(e,n[parseInt(g.toString(),10)],o[parseInt(g.toString(),10)],!0),this.frozenColumns<=this.treeColumnIndex&&!t.isNullOrUndefined(d)&&this.expandCollapse(e,d[parseInt(g.toString(),10)],o[parseInt(g.toString(),10)],!0))}for(g=0;g<w.length;g++)t.isNullOrUndefined(w[parseInt(g.toString(),10)])||this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||(m[w[parseInt(g.toString(),10)].rowIndex].visible="none"!==c,w[parseInt(g.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){i||(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,t,i,r,n,o,a,s){this.grid.filterByColumn(e,t,i,r,n,o,a,s)},d.prototype.clearFiltering=function(){this.grid.clearFiltering()},d.prototype.removeFilteredColsByField=function(e,t){this.grid.removeFilteredColsByField(e,t)},d.prototype.selectRow=function(e,t){this.grid.selectRow(e,t)},d.prototype.selectRows=function(e){this.grid.selectRows(e)},d.prototype.clearSelection=function(){this.grid.clearSelection()},d.prototype.copy=function(e){this.clipboardModule.copy(e)},d.prototype.paste=function(e,t,i){this.clipboardModule.paste(e,t,i)},d.prototype.selectCell=function(e,t){this.grid.selectCell(e,t)},d.prototype.getSelectedRows=function(){return this.grid.getSelectedRows()},d.prototype.getMovableCellFromIndex=function(e,t){return this.grid.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(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,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},d.prototype.indent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"indent"))},d.prototype.outdent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"outdent"))};var l;return mt([t.Property(0)],d.prototype,"frozenRows",void 0),mt([t.Property(0)],d.prototype,"frozenColumns",void 0),mt([t.Property("Ellipsis")],d.prototype,"clipMode",void 0),mt([t.Property([])],d.prototype,"columns",void 0),mt([t.Property(null)],d.prototype,"childMapping",void 0),mt([t.Property(null)],d.prototype,"hasChildMapping",void 0),mt([t.Property(0)],d.prototype,"treeColumnIndex",void 0),mt([t.Property(null)],d.prototype,"idMapping",void 0),mt([t.Property(null)],d.prototype,"parentIdMapping",void 0),mt([t.Property(!1)],d.prototype,"enableCollapseAll",void 0),mt([t.Property(null)],d.prototype,"expandStateMapping",void 0),mt([t.Property(!1)],d.prototype,"allowRowDragAndDrop",void 0),mt([t.Property([])],d.prototype,"dataSource",void 0),mt([t.Property()],d.prototype,"query",void 0),mt([t.Property()],d.prototype,"cloneQuery",void 0),mt([t.Property("AllPages")],d.prototype,"printMode",void 0),mt([t.Property(!1)],d.prototype,"allowPaging",void 0),mt([t.Property(!1)],d.prototype,"loadChildOnDemand",void 0),mt([t.Property(!1)],d.prototype,"allowTextWrap",void 0),mt([t.Complex({},q)],d.prototype,"textWrapSettings",void 0),mt([t.Property(!1)],d.prototype,"allowReordering",void 0),mt([t.Property(!1)],d.prototype,"allowResizing",void 0),mt([t.Property(!1)],d.prototype,"autoCheckHierarchy",void 0),mt([t.Complex({},tt)],d.prototype,"pageSettings",void 0),mt([t.Complex({},i.RowDropSettings)],d.prototype,"rowDropSettings",void 0),mt([t.Property("USD")],d.prototype,"currencyCode",void 0),mt([t.Property()],d.prototype,"pagerTemplate",void 0),mt([t.Property(!1)],d.prototype,"showColumnMenu",void 0),mt([t.Property(!1)],d.prototype,"showColumnChooser",void 0),mt([t.Property(!1)],d.prototype,"allowSorting",void 0),mt([t.Property(!0)],d.prototype,"allowMultiSorting",void 0),mt([t.Complex({},ct)],d.prototype,"sortSettings",void 0),mt([t.Collection([],ot)],d.prototype,"aggregates",void 0),mt([t.Complex({},dt)],d.prototype,"editSettings",void 0),mt([t.Property(!1)],d.prototype,"allowFiltering",void 0),mt([t.Property()],d.prototype,"detailTemplate",void 0),mt([t.Complex({},N)],d.prototype,"filterSettings",void 0),mt([t.Complex({},Ke)],d.prototype,"searchSettings",void 0),mt([t.Property()],d.prototype,"toolbar",void 0),mt([t.Property()],d.prototype,"toolbarTemplate",void 0),mt([t.Property("Default")],d.prototype,"gridLines",void 0),mt([t.Property()],d.prototype,"contextMenuItems",void 0),mt([t.Property()],d.prototype,"columnMenuItems",void 0),mt([t.Property()],d.prototype,"rowTemplate",void 0),mt([t.Property("Parent")],d.prototype,"copyHierarchyMode",void 0),mt([t.Property(null)],d.prototype,"rowHeight",void 0),mt([t.Property(!0)],d.prototype,"enableAltRow",void 0),mt([t.Property(!0)],d.prototype,"allowKeyboard",void 0),mt([t.Property(!1)],d.prototype,"enableHover",void 0),mt([t.Property(!1)],d.prototype,"enableAutoFill",void 0),mt([t.Property(!1)],d.prototype,"enableAdaptiveUI",void 0),mt([t.Property(!1)],d.prototype,"enableImmutableMode",void 0),mt([t.Property("auto")],d.prototype,"height",void 0),mt([t.Property("auto")],d.prototype,"width",void 0),mt([t.Complex({},O)],d.prototype,"loadingIndicator",void 0),mt([t.Property(!0)],d.prototype,"enableVirtualMaskRow",void 0),mt([t.Property(!1)],d.prototype,"enableVirtualization",void 0),mt([t.Property(!1)],d.prototype,"enableColumnVirtualization",void 0),mt([t.Property(!1)],d.prototype,"enableHtmlSanitizer",void 0),mt([t.Property(!1)],d.prototype,"enableInfiniteScrolling",void 0),mt([t.Complex({},ft)],d.prototype,"infiniteScrollSettings",void 0),mt([t.Property("All")],d.prototype,"columnQueryMode",void 0),mt([t.Event()],d.prototype,"created",void 0),mt([t.Event()],d.prototype,"load",void 0),mt([t.Event()],d.prototype,"expanding",void 0),mt([t.Event()],d.prototype,"expanded",void 0),mt([t.Event()],d.prototype,"collapsing",void 0),mt([t.Event()],d.prototype,"collapsed",void 0),mt([t.Event()],d.prototype,"cellSave",void 0),mt([t.Event()],d.prototype,"cellSaved",void 0),mt([t.Event()],d.prototype,"actionBegin",void 0),mt([t.Event()],d.prototype,"actionComplete",void 0),mt([t.Event()],d.prototype,"beginEdit",void 0),mt([t.Event()],d.prototype,"batchAdd",void 0),mt([t.Event()],d.prototype,"batchDelete",void 0),mt([t.Event()],d.prototype,"batchCancel",void 0),mt([t.Event()],d.prototype,"beforeBatchAdd",void 0),mt([t.Event()],d.prototype,"beforeBatchDelete",void 0),mt([t.Event()],d.prototype,"beforeBatchSave",void 0),mt([t.Event()],d.prototype,"cellEdit",void 0),mt([t.Event()],d.prototype,"actionFailure",void 0),mt([t.Event()],d.prototype,"dataBound",void 0),mt([t.Event()],d.prototype,"dataSourceChanged",void 0),mt([t.Event()],d.prototype,"dataStateChange",void 0),mt([t.Event()],d.prototype,"recordDoubleClick",void 0),mt([t.Event()],d.prototype,"rowDataBound",void 0),mt([t.Event()],d.prototype,"detailDataBound",void 0),mt([t.Event()],d.prototype,"queryCellInfo",void 0),mt([t.Property(!0)],d.prototype,"allowSelection",void 0),mt([t.Event()],d.prototype,"rowSelecting",void 0),mt([t.Event()],d.prototype,"rowSelected",void 0),mt([t.Event()],d.prototype,"rowDeselecting",void 0),mt([t.Event()],d.prototype,"rowDeselected",void 0),mt([t.Event()],d.prototype,"headerCellInfo",void 0),mt([t.Event()],d.prototype,"cellSelecting",void 0),mt([t.Event()],d.prototype,"columnMenuOpen",void 0),mt([t.Event()],d.prototype,"columnMenuClick",void 0),mt([t.Event()],d.prototype,"cellSelected",void 0),mt([t.Event()],d.prototype,"cellDeselecting",void 0),mt([t.Event()],d.prototype,"cellDeselected",void 0),mt([t.Event()],d.prototype,"resizeStart",void 0),mt([t.Event()],d.prototype,"resizing",void 0),mt([t.Event()],d.prototype,"resizeStop",void 0),mt([t.Event()],d.prototype,"columnDragStart",void 0),mt([t.Event()],d.prototype,"columnDrag",void 0),mt([t.Event()],d.prototype,"columnDrop",void 0),mt([t.Event()],d.prototype,"checkboxChange",void 0),mt([t.Event()],d.prototype,"printComplete",void 0),mt([t.Event()],d.prototype,"beforePrint",void 0),mt([t.Event()],d.prototype,"toolbarClick",void 0),mt([t.Event()],d.prototype,"beforeDataBound",void 0),mt([t.Event()],d.prototype,"contextMenuOpen",void 0),mt([t.Event()],d.prototype,"contextMenuClick",void 0),mt([t.Event()],d.prototype,"beforeCopy",void 0),mt([t.Event()],d.prototype,"beforePaste",void 0),mt([t.Event()],d.prototype,"rowDrag",void 0),mt([t.Event()],d.prototype,"rowDragStart",void 0),mt([t.Event()],d.prototype,"rowDragStartHelper",void 0),mt([t.Event()],d.prototype,"rowDrop",void 0),mt([t.Property(-1)],d.prototype,"selectedRowIndex",void 0),mt([t.Complex({},Je)],d.prototype,"selectionSettings",void 0),mt([t.Property(!1)],d.prototype,"allowExcelExport",void 0),mt([t.Property(!1)],d.prototype,"allowPdfExport",void 0),mt([t.Event()],d.prototype,"pdfQueryCellInfo",void 0),mt([t.Event()],d.prototype,"pdfHeaderQueryCellInfo",void 0),mt([t.Event()],d.prototype,"excelQueryCellInfo",void 0),mt([t.Event()],d.prototype,"excelHeaderQueryCellInfo",void 0),mt([t.Event()],d.prototype,"beforeExcelExport",void 0),mt([t.Event()],d.prototype,"excelExportComplete",void 0),mt([t.Event()],d.prototype,"beforePdfExport",void 0),mt([t.Event()],d.prototype,"pdfExportComplete",void 0),d=l=mt([t.NotifyPropertyChanges],d)}(t.Component),It=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}(),vt=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}(),wt=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(qe,this.Rowdraging,this),this.parent.on(Ve,this.rowDropped,this),this.parent.on(Ue,this.rowsAdded,this),this.parent.on(ke,this.rowsRemoved,this)},e.prototype.reorderRows=function(e,i,r){var n=this.parent,o="updateRowAndCellElements";if(e[0]!==i&&-1!==["above","below","child"].indexOf(r)){"above"===r&&(this.dropPosition="topSegment"),"below"===r&&(this.dropPosition="bottomSegment"),"child"===r&&(this.dropPosition="middleSegment"),this.parent.dropPosition=this.dropPosition;for(var a=[],d=0;d<e.length;d++){var l=this.parent.getRowByIndex(e[parseInt(d.toString(),10)]).rowIndex;a[parseInt(d.toString(),10)]=this.parent.getCurrentViewRecords()[parseInt(l.toString(),10)]}var p={data:a,dropIndex:i};if(s(this.parent)||this.dropRows(p,!0),n.isLocalData&&(n.flatData=this.orderToIndex(n.flatData)),"outdenting"===this.parent.action&&(t.isNullOrUndefined(a[0].parentItem)||(a[0].level=a[0].parentItem.level+1)),this.parent.grid.refresh(),this.parent.enableImmutableMode&&"middleSegment"===this.dropPosition){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"indenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var h=this.parent.getRows()[e[0]],c=p.data[0],u=[];(m=[]).push(c),u.push(h);var g=y(this.parent,p.data[0].parentUniqueID),f=this.parent.getRows()[parseInt(i.toString(),10)];m.push(g),u.push(f),this.parent[""+o](m,u,l)}if(this.parent.enableImmutableMode&&"outdenting"===this.parent.action){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"outdenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var m,S=p.data[0];h=this.parent.getRows()[e[0]],u=[];(m=[]).push(S),u.push(h),this.parent[""+o](m,u,l)}}},e.prototype.indentOutdentAction=function(e,i){var r=this.parent,n=-1;if(!t.isNullOrUndefined(e)||-1!==this.parent.selectedRowIndex){this.parent.enableVirtualization&&-1!==this.parent.selectedRowIndex?n=this.parent.getSelectedRows()[0].rowIndex:-1!==this.parent.selectedRowIndex&&(n=this.parent.selectedRowIndex),this.selectedItem=t.isNullOrUndefined(e)?r.getCurrentViewRecords()[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(var l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[parseInt(l.toString(),10)].taskData===s.parentItem.taskData&&(d=l,r.enableVirtualization&&(d=parseInt(r.getRows()[parseInt(l.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;d=void 0;var p=this.selectedRecord.parentItem;for(l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[parseInt(l.toString(),10)].uniqueID===p.uniqueID&&(d=l);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(G,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){var l,p=this.parent,h=e.records;for(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]=[]),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)){var s=this.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords;for(l=0;l<s.length;l++)o.parentItem.taskData[this.parent.childMapping][parseInt(l.toString(),10)]=s[parseInt(l.toString(),10)].taskData}}else{for(var d=Object.keys(e),l=0;l<d.length;l++)e[parseInt(l.toString(),10)][this.parent.childMapping]===o.taskData[this.parent.childMapping]&&(i=l);"topSegment"===this.dropPosition?this.parent.idMapping||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.idMapping||e.splice(i+1,0,r.taskData))}this.parent.parentIdMapping&&(r.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(r[this.parent.parentIdMapping]=o[this.parent.parentIdMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.parentIdMapping]):(r[this.parent.parentIdMapping]=o[this.parent.idMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.idMapping]):(r.taskData[this.parent.parentIdMapping]=null,r[this.parent.parentIdMapping]=null))},e.prototype.removeFirstrowBorder=function(e){var t="bottomSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-firstrow-border").length>0&&e&&(0!==e.rowIndex||t)&&this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove()},e.prototype.removeLastrowBorder=function(e){var t,i=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow")),r=(t=this.parent.enableVirtualization?e&&!i&&this.parent.getRows()[this.parent.getCurrentViewRecords().length-1].getAttribute("data-uid")!==e.getAttribute("data-uid"):e&&!i&&this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length-1).getAttribute("data-uid")!==e.getAttribute("data-uid"))||"topSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-lastrow-border").length>0&&e&&(t||r)&&this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove()},e.prototype.updateIcon=function(e,r,n){var o=n.target?t.closest(n.target,"tr"):null;this.dropPosition=void 0;var a=0;this.removeFirstrowBorder(o),this.removeLastrowBorder(o);for(var s=0;s<n.rows.length;s++)(t.isNullOrUndefined(o)||o.getAttribute("data-uid")!==n.rows[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,y=f+g,m=y+g,S=i.getObject("originalEvent.event",n),I=i.getObject("originalEvent.event",n),v="mousemove"===S.type?S.pageY:t.isNullOrUndefined(I)||t.isNullOrUndefined(I.changedTouches)?null:I.changedTouches[0].pageY,w=v<=f,R=v>f&&v<=y,x=v>y&&v<=m;if(w||R||x){if(w&&"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){if((l=i.parentsUntil(e.target,"e-treegrid"))&&l.id===this.parent.rowDropSettings.targetID){l.ej2_instances[0].rowDragAndDropModule.updateIcon(e.rows,a,e)}}if(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)){var l;(l=i.parentsUntil(e.target,"e-treegrid"))||(n.style.cursor="default")}},e.prototype.rowDropped=function(e){var r=this.parent;if(r.rowDropSettings.targetID?(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)||i.parentsUntil(e.target,"e-treegrid")&&i.parentsUntil(e.target,"e-treegrid").id===r.rowDropSettings.targetID||e.target&&document.getElementById(r.rowDropSettings.targetID))&&(t.setValue("dropPosition",this.dropPosition,e),r.trigger("rowDrop",e),!e.cancel&&r.rowDropSettings.targetID&&(this.dragDropGrid(e),r.isLocalData&&(r.flatData=this.orderToIndex(r.flatData)))):i.parentsUntil(e.target,"e-content")&&(this.parent.element.querySelector(".e-errorelem")&&(this.dropPosition="Invalid"),t.setValue("dropPosition",this.dropPosition,e),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=y(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){var f=[];for(u=0;u<p.length;u++)if(p[parseInt(u.toString(),10)].hasChildRecords){f.push(p[parseInt(u.toString(),10)]);for(var y=c(p[parseInt(u.toString(),10)]),m=0;m<y.length;m++)f.push(y[parseInt(m.toString(),10)])}f.length&&(p=f)}n.notify(ke,{indexes:h,records:p}),r.notify(Ue,{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 I=t.getValue("uniqueIDCollection."+S[parseInt(u.toString(),10)].parentUniqueID+".index",r);S[parseInt(u.toString(),10)].parentItem.index=I}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=y(this.parent,a.parentItem.uniqueID)}if("middleSegment"===this.dropPosition){this.parent.getCurrentViewRecords()[parseInt(r.toString(),10)].level===i.level?this.droppedRecord=y(this.parent,i.uniqueID):this.getParentData(i)}},e.prototype.dropRows=function(e,i){if("Invalid"!==this.dropPosition&&!a(this.parent)){var r,n=this.parent,o=void 0;if(t.isNullOrUndefined(e.dropIndex)){var s=this.parent.getPrimaryKeyFieldNames()[0],d=-1===n.selectedRowIndex?this.parent.grid.getRowIndexByPrimaryKey(e.data[0][""+s])-1:n.getSelectedRowIndexes()[0]-1,l=n.getCurrentViewRecords()[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=function(a){if(r=h[parseInt(a.toString(),10)],y.draggedRecord=r,"Invalid"!==y.dropPosition){if(n.rowDropSettings.targetID&&!i||y.deleteDragRow(),y.draggedRecord===y.droppedRecord){var s=y.getTargetIdx(e.target.offsetParent.parentElement);isNaN(s)&&(s=y.getTargetIdx(e.target.parentElement)),e.dropIndex=s,o=y.droppedRecord=y.parent.getCurrentViewRecords()[e.dropIndex]}if(o.parentItem||"middleSegment"===y.dropPosition){-1!==(g=(u=n.parentData).indexOf(y.draggedRecord))&&u.splice(g,1)}var d=y.treeGridData.indexOf(o);if(y.dropAtTop(d),"bottomSegment"===y.dropPosition){if(o.hasChildRecords?(c=y.getChildCount(o,0),y.parent.parentIdMapping&&y.treeData.splice(d+c+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+c+1,0,y.draggedRecord)):(y.parent.parentIdMapping&&y.treeData.splice(d+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+1,0,y.draggedRecord)),t.isNullOrUndefined(o.parentItem)&&(delete r.parentItem,delete r.parentUniqueID,r.level=0,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=null)),o.parentItem){var l=y.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords,p=l.indexOf(o)+1;l.splice(p,0,r),r.parentItem=o.parentItem,r.parentUniqueID=o.parentUniqueID,r.level=o.level,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=o[y.parent.parentIdMapping],r.parentItem=o.parentItem,r.level=o.level)}if(r.hasChildRecords){y.updateChildRecordLevel(r,1),y.updateChildRecord(r,d+c+1)}}y.dropMiddle(d)}if(t.isNullOrUndefined(r.parentItem)){var u,g=(u=n.parentData).indexOf(y.droppedRecord),f=0;u.filter(function(e){r.uniqueID===e.uniqueID&&f++}),"bottomSegment"===y.dropPosition&&0===f?u.splice(g+1,0,r):"topSegment"===y.dropPosition&&0===f&&u.splice(g,0,r)}n.rowDragAndDropModule.refreshGridDataSource()},y=this,m=0;m<g;m++)f(m)}},e.prototype.dropMiddle=function(e){var i=this.parent,r=c(this.droppedRecord),n=t.isNullOrUndefined(r)||0===r.length?e+1:r.length+e+1;"middleSegment"===this.dropPosition&&(i.parentIdMapping?(this.treeData.splice(n,0,this.draggedRecord.taskData),this.treeGridData.splice(n,0,this.draggedRecord)):this.treeGridData.splice(n,0,this.draggedRecord),this.recordLevel(),this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,n))},e.prototype.dropAtTop=function(e){var t=this.parent;if("topSegment"===this.dropPosition){if(t.parentIdMapping&&this.treeData.splice(e,0,this.draggedRecord.taskData),this.draggedRecord.parentItem=this.treeGridData[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=y(this.parent,this.draggedRecord.uniqueID);!t.isNullOrUndefined(e.childRecords)&&e.childRecords.length&&(e.hasChildRecords=!0),this.removeRecords(e)},e.prototype.updateChildRecord=function(e,i){var r,n=this.parent,o=0;if(!e.hasChildRecords)return 0;o=e.childRecords.length;for(var a=0;a<o;a++)r=this.isMultipleGrid?e.childRecords[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=y(this.parent,e.parentItem.uniqueID)),t.isNullOrUndefined(a)&&!t.isNullOrUndefined(e.parentItem)&&(a=e.parentItem),r.level=e.parentItem?a.level+i:e.level+1,r.hasChildRecords&&(i--,i=this.updateChildRecordLevel(r,i))}return i},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;var o=e,a=!t.isNullOrUndefined(r.parentIdMapping),s=this.getChildrecordsByParentID(o.parentUniqueID)[0];if(o){if(o.parentItem){var d=s?s.childRecords:[],l=0;d&&d.length>0&&(l=d.indexOf(o),s.childRecords.splice(l,1),this.parent.parentIdMapping&&!r.enableImmutableMode||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 y=this.parent.parentData.indexOf(o);-1!==y&&(r.parentData.splice(y,1),i.splice(y,1))}if(-1===f&&!r.parentIdMapping)for(var m=r.getPrimaryKeyFieldNames()[0],I=0;I<this.treeGridData.length;I++)this.treeGridData[parseInt(I.toString(),10)][""+m]===o[""+m]&&(f=I);if(!r.parentIdMapping){var v=this.getChildCount(o,0);this.treeGridData.splice(f,v+1)}o.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(s.expanded=!1,s.hasChildRecords=!1,s.hasFilteredChildRecords=!1),-1!==this.parent[this.modifiedRecords].indexOf(s)||t.isNullOrUndefined(s)||this.parent[this.modifiedRecords].push(s),t.isNullOrUndefined(s)||this.updateModifiedRecords(s)}},e.prototype.updateModifiedRecords=function(e){var i=y(this.parent,e.parentUniqueID);t.isNullOrUndefined(i)||(this.parent[this.modifiedRecords].push(i),this.updateModifiedRecords(i))},e.prototype.removeChildItem=function(e){var i,r,o,a;a=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;for(var s=0;s<e.childRecords.length;s++){i=e.childRecords[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(qe,this.Rowdraging),this.parent.off(Ve,this.rowDropped),this.parent.off(Ue,this.rowsAdded),this.parent.off(ke,this.rowsRemoved))},e.prototype.getModuleName=function(){return"rowDragAndDrop"},e}(),Rt=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)}}(),xt=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},Ct=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Rt(i,e),xt([t.Property()],i.prototype,"targetID",void 0),i}(t.ChildProperty),bt=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)}}(),Dt=function(e){function i(t){var i=e.call(this,t)||this;return i.addEventListener(),i}return bt(i,e),i.prototype.addEventListener=function(){this.parent.on(Me,this.getDatas,this)},i.prototype.getDatas=function(e){this.visualData=e.data},i.prototype.getDataInfo=function(){return e.prototype.getData.call(this)},i.prototype.generateRows=function(i,r){!t.isNullOrUndefined(r.virtualInfo)&&r.virtualInfo.loadNext&&r.virtualInfo.nextInfo.page!==this.parent.pageSettings.currentPage?this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.nextInfo.page}},!0):t.isNullOrUndefined(r.virtualInfo)||r.virtualInfo.loadNext||r.virtualInfo.page===this.parent.pageSettings.currentPage||this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.page}},!0);var o=this.getDataInfo();if(t.isNullOrUndefined(r.virtualInfo)||("right"!==r.virtualInfo.direction&&"left"!==r.virtualInfo.direction?(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))&&1!==r.virtualInfo.blockIndexes.length||(r.virtualInfo.blockIndexes=o.blockIndexes):r.virtualInfo.blockIndexes=this.getBlockIndexes(r.virtualInfo.page)),this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))return e.prototype.generateRows.call(this,i,r);t.isNullOrUndefined(r.requestType)||"collapseAll"!==r.requestType.toString()||(r.requestType="refresh");for(var a=e.prototype.generateRows.call(this,i,r),d=0;d<a.length;d++)a[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),Mt=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=y(this.parent,n.parentItem.uniqueID,!0);t.setValue("hasFilteredChildRecords",!0,d),d&&d.parentItem&&this.updateParentFilteredRecord(d)}}this.flatFilteredData.length>0&&this.isHierarchyFilter&&this.updateFilterLevel(),this.parent.notify("updateAction",{result:this.filteredResult})},e.prototype.updateParentFilteredRecord=function(e){var i=y(this.parent,e.parentItem.uniqueID,!0),r=t.getValue("uniqueIDFilterCollection",this.parent);i&&Object.prototype.hasOwnProperty.call(r,i.uniqueID)&&t.setValue("hasFilteredChildRecords",!0,i),i&&i.parentItem&&this.updateParentFilteredRecord(i)},e.prototype.addParentRecord=function(e){var i=y(this.parent,e.parentUniqueID);if("None"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key){if(!t.isNullOrUndefined(i)){"Child"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key?this.addParentRecord(i):-1!==this.flatFilteredData.indexOf(i)&&this.addParentRecord(i)}-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))}else if(t.isNullOrUndefined(i)){if(-1!==this.flatFilteredData.indexOf(e))return void(-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent),e.hasFilteredChildRecords=!0))}else this.addParentRecord(i),-1!==this.flatFilteredData.indexOf(i)||-1!==this.filteredResult.indexOf(i)?-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent)):-1===this.filteredResult.indexOf(e)&&-1!==this.flatFilteredData.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))},e.prototype.checkChildExsist=function(e){for(var r=i.getObject("childRecords",e),n=!1,o=0;o<r.length;o++){var a=r[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=y(this.parent,e[parseInt(i.toString(),10)].parentUniqueID);if(-1!==e.indexOf(r)){var n=y(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){for(var i,r=0,n=e.flatData,o=n.length;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}(),Ot=function(){function e(e){this.isCollapsedStatePersist=!1,i.Grid.Inject(i.ExcelExport),this.parent=e,this.dataResults={},this.addEventListener()}return e.prototype.getModuleName=function(){return"ExcelExport"},e.prototype.addEventListener=function(){this.parent.on("updateResults",this.updateExcelResultModel,this),this.parent.on("excelCellInfo",this.excelQueryCellInfo,this),this.parent.grid.on("export-RowDataBound",this.exportRowDataBound,this),this.parent.grid.on("finalPageSetup",this.finalPageSetup,this)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateResults",this.updateExcelResultModel),this.parent.off("excelCellInfo",this.excelQueryCellInfo),this.parent.grid.off("export-RowDataBound",this.exportRowDataBound),this.parent.grid.off("finalPageSetup",this.finalPageSetup))},e.prototype.updateExcelResultModel=function(e){this.dataResults=e},e.prototype.Map=function(e,r,o,a,s){var d=this,l=this.parent.dataSource,p=Object();return t.setValue("isCsv",s,p),t.setValue("cancel",!1,p),t.isNullOrUndefined(e)||(this.isCollapsedStatePersist=e.isCollapsedStatePersist),new Promise(function(h){var c=!d.isLocal()||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),u=new n.Query;if(d.isLocal()||(u=d.generateQuery(u),t.setValue("query",u,p)),d.parent.trigger($,t.extend(p,e)),i.getObject("cancel",p))return null;c.executeQuery(u).then(function(i){var n=null;return t.isNullOrUndefined(e)||t.isNullOrUndefined(e.dataSource)||(n=e.dataSource),e=d.manipulateExportProperties(e,l,i),d.parent.grid.excelExportModule.Map(d.parent.grid,e,r,o,s,a).then(function(t){null!=n?e.dataSource=n:delete e.dataSource,h(t)})})})},e.prototype.generateQuery=function(e,r){return!t.isNullOrUndefined(r)&&"CurrentPage"===r.exportType&&this.parent.allowPaging&&(r.exportType="AllPages",e.addParams("ExportType","CurrentPage"),e.where(this.parent.parentIdMapping,"equal",null),e=i.getObject("grid.renderModule.data.pageQuery",this.parent)(e)),e},e.prototype.manipulateExportProperties=function(e,r,o){var a=Object();if(t.setValue("query",this.parent.grid.getDataModule().generateQuery(!0),a),t.setValue("isExport",!0,a),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.exportType)||t.setValue("exportType",e.exportType,a),this.isLocal()||(this.parent.parentData=[],this.parent.dataModule.convertToFlatData(i.getObject("result",o)),t.setValue("expresults",this.parent.flatData,a)),this.parent.notify("dataProcessor",a),a=this.dataResults,r=t.isNullOrUndefined(a.result)?this.parent.flatData.slice(0):a.result,this.isLocal()||(this.parent.flatData=[]),e&&e.dataSource&&this.isLocal()){var s=this.parent.flatData,d=e.dataSource instanceof n.DataManager?e.dataSource.dataSource.json:e.dataSource;this.parent.dataModule.convertToFlatData(d),r=this.parent.flatData,this.parent.flatData=s}return e=t.isNullOrUndefined(e)?Object():e,e.dataSource=new n.DataManager({json:r}),e.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&&y(this.parent,i.parentItem.uniqueID,Boolean(r))){var a=!1,s=!1,d=h(this.parent,i,this.parent.parentData);!this.isCollapsedStatePersist||d&&this.parent.isLocalData||(a=!0,s=!i.expanded),e.excelRows[n-1].grouping={outlineLevel:o,isCollapsed:s,isHidden:a}}else i.hasChildRecords&&t.isNullOrUndefined(i.parentItem)&&(e.excelRows[n-1].grouping={outlineLevel:o})}},e.prototype.finalPageSetup=function(e){for(var t=0;t<e.worksheets.length;t++)e.worksheets[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}(),Pt=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(Z,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}(),Et=function(){function e(e){i.Grid.Inject(i.Page),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(oe,this.collapseExpandPagedchilds,this),this.parent.on(ae,this.pageAction,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(oe,this.collapseExpandPagedchilds),this.parent.off(ae,this.pageAction))},e.prototype.getModuleName=function(){return"pager"},e.prototype.refresh=function(){this.parent.grid.pagerModule.refresh()},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.goToPage=function(e){this.parent.grid.pagerModule.goToPage(e)},e.prototype.updateExternalMessage=function(e){this.parent.grid.pagerModule.updateExternalMessage(e)},e.prototype.collapseExpandPagedchilds=function(e){if(e.record.expanded="collapse"!==e.action,this.parent.flatData.map(function(t){return t.expanded=t.uniqueID===e.record.uniqueID&&t.expanded!==e.record.expanded?e.record.expanded:t.expanded}),this.parent.enableImmutableMode){var i=this.parent.getPrimaryKeyFieldNames()[0],r=this.parent.flatData.filter(function(t){return t[""+i]===e.record[""+i]});r.length&&(r[0].expanded=e.record.expanded)}var n={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length};if(t.getValue("grid.renderModule",this.parent).dataManagerSuccess(n),this.parent.enableImmutableMode){var o=void 0;"collapse"===n.action?(o=n.row.getElementsByClassName("e-treegridexpand")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridexpand"),t.addClass([o],"e-treegridcollapse"))):"expand"===n.action&&(o=n.row.getElementsByClassName("e-treegridcollapse")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridcollapse"),t.addClass([o],"e-treegridexpand")))}},e.prototype.pageRoot=function(e,i,r){for(var n=t.isNullOrUndefined(r)?[]:r,o=function(t){n.push(i[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=a.pageRoot(e,r,n))},a=this,s=0;s<i.length;s++)o(s);return n},e.prototype.updatePageSize=function(e){var t=e.result.length,i=this.parent.grid.pagerModule;!0===this.parent.pageSettings.pageSizes&&i.pagerObj.pagerdropdownModule.dropDownListObject.value===i.pagerObj.getLocalizedLabel("All")&&(i.pagerObj.totalRecordsCount=t,this.parent.grid.pageSettings.pageSize=t)},e.prototype.pageAction=function(e){var t=this,i=new n.DataManager(e.result);if("Root"===this.parent.pageSettings.pageSizeMode){var r=[],o=this.parent.grid.filterSettings.columns.length>0&&("Child"===this.parent.filterSettings.hierarchyMode||"None"===this.parent.filterSettings.hierarchyMode)?"filterLevel":"level",a=(new n.Query).where(o,"equal",0);r=i.executeLocal(a),e.count=r.length;var s=(f=this.parent.grid.pageSettings.pageSize)*((y=this.parent.grid.pageSettings.currentPage)-1);a=a.skip(s).take(f),r=i.executeLocal(a);var d=this.pageRoot(e.result,r);e.result=d}else{var p=new n.DataManager(e.result),c=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),u=p.executeLocal((new n.Query).where(c)),g=void 0;g=!l(this.parent)||this.parent.searchSettings.key===this.parent.grid.searchSettings.key&&this.parent.filterSettings.columns.length===this.parent.grid.filterSettings.columns.length?u.filter(function(e){return h(t.parent,e,u)}):u,e.count=g.length;a=new n.Query;var f=this.parent.grid.pageSettings.pageSize;this.updatePageSize(e);var y=this.parent.grid.pageSettings.currentPage;g.length<y*f&&(y=(y=Math.floor(g.length/f)+(g.length%f?1:0))||1,this.parent.grid.setProperties({pageSettings:{currentPage:y}},!0));s=f*(y-1);a=a.skip(s).take(f),p.dataSource.json=g,e.result=p.executeLocal(a)}this.parent.notify("updateAction",e)},e}(),At=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(W,this.refreshToolbar,this),this.parent.on(J,this.refreshToolbar,this),this.parent.on(X,this.toolbarClickHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(W,this.refreshToolbar),this.parent.off(J,this.refreshToolbar),this.parent.off(X,this.toolbarClickHandler))},e.prototype.refreshToolbar=function(e){var i=this.parent.grid.toolbarModule.getToolbar();if(!t.isNullOrUndefined(i)){var r=this.parent,n=void 0,o=void 0,a=r.element.id+"_gridcontrol_indent",s=r.element.id+"_gridcontrol_outdent",d=i.querySelector("#"+a),l=i.querySelector("#"+s),p=e.row,h=r.getSelectedRows()[0];if(t.isNullOrUndefined(p[0])||(p=p[0]),p=t.isNullOrUndefined(h)||h.rowIndex===p.rowIndex?p:h,null!==d&&null!==l){if(n=i.querySelector("#"+a).parentElement,o=i.querySelector("#"+s).parentElement,0===p.rowIndex||r.getSelectedRowIndexes().length>1)n.classList.add("e-hidden"),o.classList.add("e-hidden");else if("rowDeselected"!==e.name||!t.isNullOrUndefined(h)&&r.grid.isCheckBoxSelection){var c=r.getCurrentViewRecords()[p.rowIndex];t.isNullOrUndefined(c)||(c.level>r.getCurrentViewRecords()[p.rowIndex-1].level?n.classList.add("e-hidden"):n.classList.remove("e-hidden"),c.level===r.getCurrentViewRecords()[p.rowIndex-1].level&&n.classList.remove("e-hidden"),0===c.level&&o.classList.add("e-hidden"),0!==c.level&&o.classList.remove("e-hidden"))}"rowDeselected"===e.name&&t.isNullOrUndefined(h)&&!r.grid.isCheckBoxSelection&&(this.parent.toolbar.includes("Indent")&&n.classList.add("e-hidden"),this.parent.toolbar.includes("Outdent")&&o.classList.add("e-hidden"))}}},e.prototype.toolbarClickHandler=function(e){var i=this.parent,r="indentOutdentAction";"Cell"===this.parent.editSettings.mode&&"Batch"===this.parent.grid.editSettings.mode&&e.item.id===this.parent.grid.element.id+"_update"&&(e.cancel=!0,this.parent.grid.editModule.saveCell()),e.item.id===this.parent.grid.element.id+"_expandall"&&this.parent.expandAll(),e.item.id===this.parent.grid.element.id+"_collapseall"&&this.parent.collapseAll(),e.item.id===i.grid.element.id+"_indent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[""+r](null,"indent"),e.item.id===i.grid.element.id+"_outdent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[""+r](null,"outdent")},e.prototype.getToolbar=function(){return this.parent.grid.toolbarModule.getToolbar()},e.prototype.enableItems=function(e,t){this.parent.grid.toolbarModule.enableItems(e,t)},e.prototype.destroy=function(){this.removeEventListener()},e}(),Nt=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){var y=0;for(d=g;y<d;y++)if(o=h[parseInt(y.toString(),10)],l=this.getChildRecordsLength(o,c)){for(var m=function(e,r){var a=void 0;a={};for(var s=0;s<f.length;s++){a[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(s.toString(),10)]))?f[parseInt(s.toString(),10)]:i.getObject("field",f[parseInt(s.toString(),10)]))]=null}if(a=S.createSummaryItem(a,S.parent.aggregates[e-1]),!S.parent.aggregates[e-1].showChildSummary)return"continue";var d;c.map(function(e,t){e.uniqueID!==o.uniqueID||(d=t)});var p=d+l+e,h=t.extend({},o);delete h.childRecords,delete h[S.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,I=1,v=u;I<=v;I++)m(I);this.flatChildRecords=[]}}else{for(var w={},R=0,x=f.length;R<x;R++){w[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(R.toString(),10)]))?f[parseInt(R.toString(),10)]:i.getObject("field",f[parseInt(R.toString(),10)]))]=null}I=1;for(var C=u;I<=C;I++)this.createSummaryItem(w,this.parent.aggregates[I-1])}return c},e.prototype.getChildRecordsLength=function(e,r){for(var n,o=0,a=Object.keys(r).length;o<a;o++){n=r[parseInt(o.toString(),10)];if(e===(t.isNullOrUndefined(n.parentItem)?null:r.filter(function(e){return e.uniqueID===n.parentItem.uniqueID})[0])){this.flatChildRecords.push(n);if(!i.getObject("hasChildRecords",n))continue;this.getChildRecordsLength(n,r)}}return this.flatChildRecords.length},e.prototype.createSummaryItem=function(e,i){for(var r=0,o=Object.keys(i.columns).length;r<o;r++)for(var a=t.isNullOrUndefined(i.columns[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(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(),y="Custom"!==u[parseInt(g.toString(),10)]?i.getObject("aggregates",c):i.calculateAggregate(u[parseInt(g.toString(),10)],c,e,this.parent),m=e.columnName,S="Custom"!==u[parseInt(g.toString(),10)]?y[""+f]:y;a[""+m]=a[""+m]||{},a[""+m][""+f]=S,a[""+m][u[parseInt(g.toString(),10)]]=t.isNullOrUndefined(y)?" ":l(S)}s.format=e.getFormatter();var I=t.createElement("td",{className:"e-summary"});if(this.parent.isReact){p.fn(a[e.columnName],this.parent,p.property,"",null,null,I);var v=this;v.parent.renderReactTemplates(function(){v.parent.trigger(_,v.parent.args)})}else i.appendChildren(I,p.fn(a[e.columnName],this.parent,p.property));var w=a[""+e.columnName][""+h];return-1===I.innerHTML.indexOf(w)?I.innerHTML+w:I.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}(),Ut=function(){function e(e){i.Grid.Inject(i.Sort),this.parent=e,this.taskIds=[],this.flatSortedData=[],this.storedIndex=-1,this.isSelfReference=!t.isNullOrUndefined(this.parent.parentIdMapping),this.addEventListener()}return e.prototype.getModuleName=function(){return"sort"},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this),this.parent.on("createSort",this.createdSortedRecords,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateModel",this.updateModel),this.parent.off("createSort",this.createdSortedRecords))},e.prototype.createdSortedRecords=function(e){var t=e.modifiedData,i=e.srtQry;this.iterateSort(t,i),this.storedIndex=-1,e.modifiedData=this.flatSortedData,this.flatSortedData=[]},e.prototype.iterateSort=function(e,i){for(var r=0;r<e.length;r++)if(this.parent.grid.filterSettings.columns.length>0||""!==this.parent.grid.searchSettings.key?t.isNullOrUndefined(y(this.parent,e[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}(),kt=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}(),qt=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++){"Outdent"!==(g=l[d]).text&&"Indent"!==g.text||a.grid.contextMenuModule.hiddenItems.push(g.text)}a.grid.contextMenuModule.contextMenu.hideItems(a.grid.contextMenuModule.hiddenItems)}}else{var p=e.event.target.closest("td");if(!t.isNullOrUndefined(p)&&(t.isNullOrUndefined(p)||p.classList.contains("e-rowcell")&&0===p.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 h=a.getCurrentViewRecords()[s.rowIndex];t.isNullOrUndefined(h)||(h.level>a.getCurrentViewRecords()[s.rowIndex-1].level?n.style.display="none":n.style.display="block",h.level===a.getCurrentViewRecords()[s.rowIndex-1].level&&(n.style.display="block"),0===h.level?o.style.display="none":o.style.display="block")}}else{for(var c=0,u=e.items;c<u.length;c++){var g;"Outdent"!==(g=u[c]).text&&"Indent"!==g.text||a.grid.contextMenuModule.hiddenItems.push(g.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}(),Vt=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(fe,this.cellSaved,this),this.parent.on(Ie,this.batchAdd,this),this.parent.on(we,this.beforeBatchAdd,this),this.parent.on(xe,this.batchSave,this),this.parent.on(ve,this.beforeBatchDelete,this),this.parent.on(Re,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(fe,this.cellSaved),this.parent.off(Ie,this.batchAdd),this.parent.off(xe,this.batchSave),this.parent.off(we,this.beforeBatchAdd),this.parent.off(ve,this.beforeBatchDelete),this.parent.off(Re,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="parentItem",p=this.selectedIndex>-1?this.batchRecords[parseInt(this.addRowIndex.toString(),10)][""+l]:null,h=void 0,u=void 0,f=void 0,y="Top"===this.parent.editSettings.newRowPosition||-1===this.selectedIndex?0:"Above"===this.parent.editSettings.newRowPosition?this.addRowIndex:this.addRowIndex+1;if(y=this.getActualRowObjectIndex(y),this.newBatchRowAdded){if(this.batchRecords.length&&(h=this.batchRecords[this.addRowIndex][this.parent.idMapping],f=this.batchRecords[this.addRowIndex][this.parent.parentIdMapping],this.batchRecords[parseInt(this.addRowIndex.toString(),10)][""+l]&&(u=this.batchRecords[parseInt(this.addRowIndex.toString(),10)][""+l].uniqueID)),this.batchAddedRecords=g(this.batchAddedRecords),this.batchAddRowRecord=g(this.batchAddRowRecord),this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]),o=this.parent.grid.getRowsObject()[parseInt(y.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=p,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,S=c(this.batchRecords[this.addRowIndex])[m-1];S=t.isNullOrUndefined(S)?this.batchRecords[this.addRowIndex]:S,s=r.map(function(e){return e[""+a]}).indexOf(S[""+a]),this.isSelfReference&&(o[this.parent.parentIdMapping]=h),v(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=p,o.parentUniqueID=u,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){m=c(this.batchRecords[this.addRowIndex]).length,S=c(this.batchRecords[this.addRowIndex])[m-1];S=t.isNullOrUndefined(S)?this.batchRecords[this.addRowIndex]:S,s=r.map(function(e){return e[""+a]}).indexOf(S[""+a])}if("Above"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){S=this.batchRecords[this.addRowIndex];s=r.map(function(e){return e[""+a]}).indexOf(S[""+a])}this.isSelfReference&&(o[this.parent.parentIdMapping]=f)}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(y.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(ce,{}),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=y(this.parent,r.parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var f=u.childRecords.indexOf(r);u.childRecords.splice(f,1)}this.batchDeletedRecords=g(this.batchDeletedRecords),this.batchDeletedRecords.push(r)}n.push(r),s=n;for(h=0;h<s.length;h++){var m=this.batchRecords.map(function(e){return e[""+d]}).indexOf(s[parseInt(h.toString(),10)][""+d]);-1!==m&&this.batchRecords.splice(m,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="addedRecords",n="Child"===this.parent.editSettings.newRowPosition?"primaryParent":"parentItem",o=0;o<this.parent.getBatchChanges()[""+r].length;o++)t.isNullOrUndefined(this.parent.getBatchChanges()[""+r][parseInt(o.toString(),10)][""+n])||this.parent.getBatchChanges()[""+r][parseInt(o.toString(),10)][""+n][""+i]===e[parseInt(this.addRowIndex.toString(),10)][""+i]&&(this.batchChildCount=this.batchChildCount+1)},e.prototype.beforeBatchSave=function(e){var t="deletedRecords",i=e.batchChanges.changedRecords;if(e.batchChanges.changedRecords.length)for(var r=0;r<i.length;r++)S({value:i[parseInt(r.toString(),10)],action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,void 0);if(e.batchChanges[""+t].length){var n=e.batchChanges[""+t];for(r=0;r<n.length;r++){this.deleteUniqueID(n[parseInt(r.toString(),10)].uniqueID);for(var o=c(n[parseInt(r.toString(),10)]),a=0;a<o.length;a++)this.deleteUniqueID(o[parseInt(a.toString(),10)].uniqueID);e.batchChanges[""+t]=e.batchChanges[""+t].concat(o)}}this.isAdd=!1},e.prototype.deleteUniqueID=function(e){delete this.parent.uniqueIDFilterCollection[""+e];delete this.parent.uniqueIDCollection[""+e]},e.prototype.batchCancelAction=function(){var e,i="targetElement",r="parentItem",o=this.parent.grid.getCurrentViewRecords(),a="childRecords",s=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,d=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords))for(var l=0;l<this.batchAddedRecords.length;l++)if(-1!==(e=s.map(function(e){return e[""+d]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)][""+d]))&&s.splice(e,1),"Child"===this.parent.editSettings.newRowPosition&&(e=o.map(function(e){return e[""+d]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)][""+r]?this.batchAddedRecords[parseInt(l.toString(),10)][""+r][""+d]:this.batchAddedRecords[parseInt(l.toString(),10)][""+d]),!t.isNullOrUndefined(o[parseInt(e.toString(),10)])))for(var p=o[parseInt(e.toString(),10)][""+a],h=0;p&&h<p.length;h++)p[parseInt(h.toString(),10)][""+d]===this.batchAddedRecords[parseInt(l.toString(),10)][""+d]&&o[parseInt(e.toString(),10)][""+a].splice(h,1);if(!t.isNullOrUndefined(this.parent[""+i])){var c=this.parent[""+i].closest("tr");this.parent.collapseRow(c),this.parent[""+i]=null}if(!t.isNullOrUndefined(this.batchDeletedRecords))for(l=0;l<this.batchDeletedRecords.length;l++)if(!t.isNullOrUndefined(this.batchDeletedRecords[parseInt(l.toString(),10)][""+r])){e=o.map(function(e){return e[""+d]}).indexOf(this.batchDeletedRecords[parseInt(l.toString(),10)][""+r][""+d]);var u=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(o[parseInt(e.toString(),10)])||o[parseInt(e.toString(),10)][""+a].splice(u,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="deletedRecords",a=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,s=this.parent.grid.getCurrentViewRecords(),d=this.parent.grid.getPrimaryKeyFieldNames()[0],l=r.addedRecords,p=void 0,h=void 0,c=void 0;if(l.length>1&&"Bottom"!==this.parent.editSettings.newRowPosition&&l.reverse(),"Bottom"!==this.parent.editSettings.newRowPosition&&!Object.hasOwnProperty.call(e,"updatedRecords")){if(a.splice(a.length-l.length,l.length),this.parent.editModule.isAddedRowByMethod&&l.length&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){l.reverse();for(var u=0;u<l.length;u++){var f=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[parseInt(u.toString(),10)].getAttribute("data-rowindex"),10);a.splice(f,0,l[parseInt(u.toString(),10)])}}if(this.parent.allowPaging||a.length===s.length){var y=g(a);if(y.length){var m=y.map(function(e){return e[""+d]}).indexOf(s[0][""+d]),I=m+this.parent.grid.pageSettings.pageSize;s=y.splice(m,I)}}else s.length>l.length&&s.splice(s.length-l.length,l.length)}for(0===this.batchAddRowRecord.length&&this.batchAddRowRecord.push(this.parent.flatData[e.index]),this.parent.editModule.isAddedRowByContextMenu&&l.reverse(),i=0;i<l.length;i++){var w=t.extend({},l[parseInt(i.toString(),10)]);if(delete w.parentItem,delete w.uniqueID,delete w.index,delete w.level,delete w.hasChildRecords,delete w.childRecords,delete w.parentUniqueID,t.isNullOrUndefined(w.primaryParent)||delete w.primaryParent,l.length>1&&this.parent.editModule.isAddedRowByContextMenu){var R=this.parent.editSettings.newRowPosition;this.parent.editSettings.newRowPosition=this.parent.editModule.previousNewRowPosition,this.parent.editModule.previousNewRowPosition=R}if(l[parseInt(i.toString(),10)].taskData=w,c=this.batchAddRowRecord[parseInt(i.toString(),10)],t.isNullOrUndefined(c)&&(c=this.batchAddRowRecord[i-1]),this.isSelfReference&&(t.isNullOrUndefined(l[parseInt(i.toString(),10)].parentItem)||v(d,l[parseInt(i.toString(),10)].parentItem,"add",this.parent,this.isSelfReference,l[parseInt(i.toString(),10)])),t.isNullOrUndefined(c)||(h=c.index),"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(l[parseInt(i.toString(),10)].parentItem)&&-1===this.selectedIndex&&(p=-1,c=null),S({value:l[parseInt(i.toString(),10)],action:"add"},this.parent,this.isSelfReference,h,p,void 0,c),p=null,"Child"===this.parent.editSettings.newRowPosition&&!t.isNullOrUndefined(l[parseInt(i.toString(),10)].parentItem)&&(t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.isSelfReference))for(var x=s.map(function(e){return e[""+d]}).indexOf(l[parseInt(i.toString(),10)].parentItem[""+d]),C=s[parseInt(x.toString(),10)].childRecords,b=0;b<C.length;b++)C[parseInt(b.toString(),10)][""+d]===l[parseInt(i.toString(),10)][""+d]&&s[parseInt(x.toString(),10)].childRecords.splice(b,1)}if(r[""+o].length)for(i=0;i<r[""+o].length;i++)S({value:r[""+o][parseInt(i.toString(),10)],action:"delete"},this.parent,this.isSelfReference,h,p,void 0,c);this.parent.parentData=[];for(var D=0;D<a.length;D++)a[parseInt(D.toString(),10)].index=D,t.setValue("uniqueIDCollection."+a[parseInt(D.toString(),10)].uniqueID+".index",D,this.parent),a[parseInt(D.toString(),10)].level||this.parent.parentData.push(a[parseInt(D.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();if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&this.selectedIndex>-1){if(!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])&&this.batchRecords[this.addRowIndex].expanded)if(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length){if(e+=c(this.batchRecords[this.addRowIndex]).length,"Child"!==this.parent.editSettings.newRowPosition){e+=this.getBatchChildCount()}}else e+=c(this.batchRecords[this.addRowIndex]).length;e>=i.length&&(e=i.length-1),this.updateChildCount(this.parent.grid.getCurrentViewRecords()),this.batchChildCount&&(e+=this.batchChildCount),this.batchChildCount=0}return e},e.prototype.immutableBatchAction=function(e){e.args.cancel=!0;var t=this.parent.grid.getBatchChanges(),i=[];Object.keys(t).length&&(i=t.addedRecords);for(var r=0;r<i.length;r++)e.rows.splice(i[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}(),Tt=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 Vt(this.parent),this.addEventListener()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.addEventListener=function(){this.parent.on(pe,this.crudAction,this),this.parent.on(he,this.beginEdit,this),this.parent.on(ce,this.beginAdd,this),this.parent.on(ue,this.recordDoubleClick,this),this.parent.on(ge,this.cellSave,this),this.parent.on(Se,this.batchCancel,this),this.parent.grid.on(Ce,this.keyPressed,this),this.parent.grid.on("batchedit-form",this.lastCellTab,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on(ye,this.cellEdit,this),this.parent.on("actionBegin",this.editActionEvents,this),this.parent.on("actionComplete",this.editActionEvents,this),this.parent.grid.on(be,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(Pe,this.beforeStartEdit,this),this.parent.grid.on(Ee,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(G,e)},e.prototype.beforeBatchCancel=function(e){"Cell"===this.parent.editSettings.mode&&this.parent.trigger(K,e)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(pe,this.crudAction),this.parent.off(he,this.beginEdit),this.parent.off(ce,this.beginAdd),this.parent.off(ue,this.recordDoubleClick),this.parent.off(Se,this.batchCancel),this.parent.grid.off(Ce,this.keyPressed),this.parent.grid.off("batchedit-form",this.lastCellTab),this.parent.grid.off("content-ready",this.contentready),this.parent.off(ye,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(be,this.recordDoubleClick),this.parent.off("savePreviousRowPosition",this.savePreviousRowPosition),this.parent.grid.off(Pe,this.beforeStartEdit),this.parent.grid.off(Ee,this.beforeBatchCancel),this.parent.grid.off("dblclick",this.gridDblClick),this.parent.grid.off("reset-edit-props",this.resetIsOnBatch),this.parent.grid.off("get-row-position",this.getRowPosition))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.applyFormValidation=function(e){this.parent.grid.editModule.applyFormValidation(e)},e.prototype.editActionEvents=function(e){var r=i.getObject("editAction",e),o=i.getObject("name",r),s=this.parent,d=s.dataSource.adaptor;if((a(s)||d instanceof n.RemoteSaveAdaptor)&&"save"===r.requestType&&"add"===r.action&&("Child"===s.editSettings.newRowPosition||"Below"===s.editSettings.newRowPosition||"Above"===s.editSettings.newRowPosition))if("actionBegin"===o){var l=t.isNullOrUndefined(r.row)||!Object.keys(r.row).length?this.selectedIndex:r.row.rowIndex-1,p=t.isNullOrUndefined(l)||-1===l?-1:s.getCurrentViewRecords()[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(ye,e,function(e){e.cancel||"Cell"!==i.parent.editSettings.mode?e.cancel&&"Cell"===i.parent.editSettings.mode&&(i.isOnBatch=!1,i.updateGridEditMode("Normal")):i.enableToolbarItems("edit"),t.isNullOrUndefined(r)||r.resolve(e)}),this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-summarycell")))return e.cancel=!0,void(this.doubleClickTarget=null);"Cell"===this.parent.editSettings.mode&&("tab"===this.keyPress||"shiftTab"===this.keyPress?this.keyPress=null:"enter"===this.keyPress&&(e.cancel=!0,this.keyPress=null,t.setValue("isEditCollapse",!1,this.parent)),e.columnObject.allowEditing||(e.cancel=!0)),this.parent.enableVirtualization&&(this.parent.grid.contentModule.editedRowIndex=this.parent.grid.editModule.editModule.index)},e.prototype.enableToolbarItems=function(e){if(!t.isNullOrUndefined(this.parent.grid.toolbarModule)){var i=this.parent.element.id+"_gridcontrol_";this.parent.grid.toolbarModule.enableItems([i+"add",i+"edit",i+"delete"],"save"===e),this.parent.grid.toolbarModule.enableItems([i+"update",i+"cancel"],"edit"===e)}},e.prototype.batchCancel=function(){if("Cell"===this.parent.editSettings.mode){var e=t.getValue("editModule.cellDetails",this.parent.grid.editModule),i=this.parent.getCellFromIndex(e.rowIndex,this.parent.treeColumnIndex);this.parent.renderModule.cellRender({data:e.rowData,cell:i,column:this.parent.grid.getColumns()[this.parent.treeColumnIndex]}),this.updateGridEditMode("Normal"),this.isOnBatch=!1}"Batch"===this.parent.editSettings.mode&&this.parent.notify("batchCancelAction",{})},e.prototype.customCellSave=function(e){s(this.parent)&&"Cell"===this.parent.editSettings.mode&&"edit"===e.action&&(this.updateCell(e,e.rowIndex),this.afterCellSave(e,e.row,e.rowIndex))},e.prototype.cellSave=function(e){var i=this;if("Cell"===this.parent.editSettings.mode&&this.parent.element.querySelector("form")){e.cancel=!0;t.setValue("isEditCollapse",!0,this.parent),e.rowData[e.columnName]=e.value;var r;r=t.isNullOrUndefined(e.cell)?this.parent.grid.editModule.editModule.form.parentElement.parentNode:e.cell.parentNode;var o,d=this.parent.getPrimaryKeyFieldNames();if(t.isNullOrUndefined(r))this.parent.grid.getCurrentViewRecords().filter(function(t,i){t[d[0]]!==e.rowData[d[0]]||(o=i)});else{var l=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o=l?(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(G,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,o);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,o)})}}}else if(s(this.parent)){var c={requestType:"save",data:e.rowData,action:"edit",row:r,rowIndex:o,rowData:e.rowData,columnName:e.columnName,filterChoiceCount:null,excelSearchOperator:null};this.parent.grid.getDataModule().eventPromise(c,this.parent.grid.query)}else this.updateCell(e,o),t.setValue("isEdit",!1,this.parent.grid),this.afterCellSave(e,r,o)}this.parent.enableVirtualization&&(this.parent.grid.contentModule.virtualData={})},e.prototype.afterCellSave=function(e,i,r){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 n={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(K,n)},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)){var a=t.getValue("uniqueIDCollection."+o.uniqueID+".index",this.parent);if(o.index=a,!t.isNullOrUndefined(o.parentItem)){var s=t.getValue("uniqueIDCollection."+o.parentItem.uniqueID+".index",this.parent);o.parentItem.index=s}}}var d=-1,l=this.parent.treeColumnIndex;if(this.parent.getFrozenColumns()>0)for(var p=i[0].querySelectorAll(".e-rowcell"),h=0;h<p.length;h++)if(p[parseInt(h.toString(),10)].classList.contains("e-gridrowindex0level0")){l=h;break}for(var c=0;c<this.parent.getRows().length;c++){i[parseInt(c.toString(),10)].classList.contains("e-detailrow")||d++;var u=r[parseInt(d.toString(),10)];if(!t.isNullOrUndefined(u)){a=u.index;var g=u.level,f=i[parseInt(c.toString(),10)];t.isNullOrUndefined(u.parentItem)||(a=t.getValue("uniqueIDCollection."+u.parentItem.uniqueID+".index",this.parent));var y=f.cells[parseInt(l.toString(),10)];if(!t.isNullOrUndefined(y)){for(h=0;h<y.classList.length;h++){var m=y.classList[parseInt(h.toString(),10)],S=m.match(/e-gridrowindex/i),I=m.match(/e-griddetailrowindex/i);null!=S&&t.removeClass([y],m),null!=I&&t.removeClass([y],m)}i[parseInt(c.toString(),10)].classList.contains("e-detailrow")?t.addClass([y],"e-griddetailrowindex"+a+"level"+g):t.addClass([y],"e-gridrowindex"+a+"level"+g)}}}},e.prototype.beginAdd=function(){var e,i=this.addRowIndex,r=this.parent.grid.getCurrentViewRecords();"Batch"===this.parent.editSettings.mode&&(i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex(),(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)&&(r=this.batchEditModule.getBatchRecords()));var n=this.parent.grid.getDataRows(),o=n.length?+n[0].getAttribute("data-rowindex"):0,a=n.length?+n[n.length-1].getAttribute("data-rowindex"):0,s=this.selectedIndex>=o&&this.selectedIndex<=a,d=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex;if("Dialog"!==this.parent.editSettings.mode){if("Above"===this.parent.editSettings.newRowPosition)e="before";else if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(this.selectedIndex>-1||d)&&s&&(e="after",!t.isNullOrUndefined(r[parseInt(i.toString(),10)])&&r[parseInt(i.toString(),10)].expanded))if("Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)){if(i+=c(r[parseInt(i.toString(),10)]).length,"Child"!==this.parent.editSettings.newRowPosition){i+=this.batchEditModule.getBatchChildCount()}}else this.parent.enableVirtualization||(i+=c(r[parseInt(i.toString(),10)]).length);if((this.selectedIndex>-1||d)&&s&&(i||"Child"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)){i>=n.length-1&&(i=n.length-2);var l=this.parent.grid.contentModule.rows[0],p=document.activeElement;n[i+1][""+e](n[0]),t.setValue("batchIndex",i+1,this.batchEditModule);var h="Above"===this.parent.editSettings.newRowPosition?i:i+1;if("Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule.rows.splice(0,1),this.parent.grid.contentModule.rows.splice(h,0,l)),"Row"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode){for(var u=this.parent.grid.getContentTable().querySelectorAll(".e-griderror"),g=0;g<u.length;g++)u[parseInt(g.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)&&p.focus(),this.parent.enableVirtualization&&!Object.keys(this.parent.grid.contentModule.emptyRowData).length&&this.parent.grid.contentModule.createEmptyRowdata()}}if("Batch"===this.parent.editSettings.mode&&!t.isNullOrUndefined(this.addRowIndex)&&-1!==this.addRowIndex&&this.isAddedRowByMethod&&!this.isAddedRowByContextMenu){i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex();var f=this.parent.getBatchChanges().addedRecords,y=void 0;if(f.length)for(g=0;g<f.length;g++)t.isNullOrUndefined(f[parseInt(g.toString(),10)].uniqueID)&&(y=f[parseInt(g.toString(),10)]);var m={action:"add",data:y,index:i,seletedRow:0};this.beginAddEdit(m),this.batchEditModule.batchAddRowRecord.push(this.batchEditModule.addRowRecord),this.batchEditModule.batchAddedRecords.push(m.data)}},e.prototype.beginEdit=function(e){if("refresh"===e.requestType&&this.isOnBatch)e.cancel=!0;else if("Cell"!==this.parent.editSettings.mode||"beginEdit"!==e.requestType){if(this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-frame")))return e.cancel=!0,void(this.doubleClickTarget=null);if("delete"===e.requestType){var i=e.data;if(t.isNullOrUndefined(e.data[0].uniqueID))for(var r=this.parent.getPrimaryKeyFieldNames(),n=function(t){o.parent.flatData.filter(function(n){n[""+r[0]]===e.data[parseInt(t.toString(),10)][r[0]]&&(i[parseInt(t.toString(),10)]=n)})},o=this,a=0;a<i.length;a++)n(a);for(a=0;a<i.length;a++){this.deleteUniqueID(i[parseInt(a.toString(),10)].uniqueID);for(var s=c(i[parseInt(a.toString(),10)]),d=0;d<s.length;d++)this.deleteUniqueID(s[parseInt(d.toString(),10)].uniqueID);e.data=e.data.concat(s)}}if("add"===e.requestType||this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)){if((-1===this.parent.grid.selectedRowIndex&&this.isAddedRowByMethod||e.index!==this.parent.grid.selectedRowIndex)&&0!==e.index||(this.selectedIndex=this.parent.grid.selectedRowIndex),this.parent.enableVirtualization){var l='.e-row[data-rowindex="'+this.selectedIndex+'"]',p=void 0;this.selectedIndex>-1&&"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition?(this.prevAriaRowIndex=this.selectedIndex.toString(),p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.prevAriaRowIndex&&"-1"!==this.prevAriaRowIndex?(l='.e-row[data-rowindex="'+this.prevAriaRowIndex+'"]',p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.addRowIndex=0}else this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)?0!==e.index?this.addRowIndex=e.index:this.addRowIndex=this.parent.grid.selectedRowIndex:this.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0;(this.isAddedRowByMethod||this.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.addRowRecord)&&!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)}else e.cancel=!0},e.prototype.savePreviousRowPosition=function(){null===this.previousNewRowPosition&&(this.previousNewRowPosition=this.parent.editSettings.newRowPosition)},e.prototype.beginAddEdit=function(e){var r=e.data;if("add"===e.action){var o=this.parent.grid.getPrimaryKeyFieldNames()[0],a=null;r.taskData=t.isNullOrUndefined(r.taskData)?t.extend({},e.data):r.taskData;var s=void 0;s=this.parent.enableVirtualization&&0!==e.index?this.parent.flatData:"Batch"===this.parent.editSettings.mode&&this.isAddedRowByMethod&&!t.isNullOrUndefined(this.addRowIndex)?this.batchEditModule.batchRecords:this.parent.grid.getCurrentViewRecords(),this.parent.enableVirtualization&&0!==e.index&&(this.addRowIndex=this.parent.flatData.indexOf(this.addRowRecord),this.selectedIndex=this.addRowIndex);var d=this.addRowIndex;r.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r.uniqueID,r,this.parent);var l=0,p=void 0,h=void 0,u=void 0,g=void 0,f=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex,m=this.parent.getRows(),S=m.length?s.indexOf(s[0]):0,I=m.length?+m[m.length-1].getAttribute("data-rowindex"):0,w=!(!this.parent.enableVirtualization||0===e.index)||this.selectedIndex>=S&&this.selectedIndex<=I;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)||v(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)||v(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){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=y(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(xe,{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}(),Bt=function(){function e(e){i.Grid.Inject(i.CommandColumn),this.parent=e}return e.prototype.getModuleName=function(){return"commandColumn"},e.prototype.destroy=function(){},e}(),Lt=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}(),jt=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)}}(),zt=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 jt(r,e),r.prototype.getModelGenerator=function(){return new Dt(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(je),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(De,this.virtualOtherAction,this),this.parent.on(Oe,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(K,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 Ft(t.getValue("observer",this).element,t.getValue("observer",this).options),this.contents=this.getPanel().firstChild)},r.prototype.getTranslateY=function(t,i,r,o){return this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)?this.isRemoteExpand?(this.isRemoteExpand=!1,this.preTranslate):(this.preTranslate=e.prototype.getTranslateY.call(this,t,i,r,o),e.prototype.getTranslateY.call(this,t,i,r,o)):e.prototype.getTranslateY.call(this,t,i,r,o)},r.prototype.dataBoundEvent=function(){var i="initialRowTop";if(!t.isNullOrUndefined(this.parent.getRowByIndex(0))&&this.parent.getRows().length&&!this[""+i]){var r=this.parent.getRowByIndex(0).getBoundingClientRect().top,n=this.parent.element.getBoundingClientRect().top;this[""+i]=r>0?this.parent.getRowByIndex(0).getBoundingClientRect().top-n:this.content.getBoundingClientRect().top-this.parent.getRowByIndex(0).getBoundingClientRect().height}e.prototype.dataBound.call(this)},r.prototype.rowSelectedEvent=function(t){e.prototype.rowSelected.call(this,t)},r.prototype.toSelectVirtualRow=function(i){if(!this.parent.isEdit){var r="containerRect";t.isNullOrUndefined(this.observer[""+r])&&(this.observer[""+r]=this.observers[""+r]),(t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule)||0!==i.selectedIndex||t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule.addRowIndex))&&e.prototype.selectVirtualRow.call(this,i)}},r.prototype.refreshCell=function(e){e.cells=this.generateCells()},r.prototype.generateCells=function(){for(var e=[],t=0;t<this.parent.columns.length;t++)e.push(this.generateCell(this.parent.columns[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="selectedRowIndex",c=this.parent.currentViewData;if(l&&"right"!==e.direction&&"left"!==e.direction){var u=+(this.parent.height.toString().indexOf("%")<0?parseInt(this.parent.height.toString(),10):this.parent.element.getBoundingClientRect().height),g=~~(a.scrollTop/r)+Math.ceil(u/r)-this.parent.pageSettings.pageSize;if(g=g>0?g:0,t.isNullOrUndefined(this[""+h])||-1===this[""+h]||g===this[""+h]||(g=this[""+h]),this.startIndex=g,this.endIndex=g+this.parent.pageSettings.pageSize,this.endIndex>this.totalRecords){var f=this.totalRecords-1,y=this.endIndex%f;this.endIndex=f,this.startIndex=this.startIndex-y<0?0:this.startIndex-y}c.length&&c[0].index>=this.parent.pageSettings.pageSize/2&&c[0].index-this.startIndex<this.parent.pageSettings.pageSize/2&&this.parent.selectionModule.isRowSelected&&(this.startIndex=c[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 S=0;if(!t.isNullOrUndefined(this.parent.getRows()[parseInt(m.toString(),10)])&&!t.isNullOrUndefined(this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)])){S=+this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)].querySelector("td").getAttribute("index")}0===S?(e.offset.top=a.scrollTop,this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*r:this.translateY=e.offset.top):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 I=~~(a.scrollTop/r),v=!(this[""+h]+this.parent.pageSettings.pageSize<this.totalRecords);t.isNullOrUndefined(this[""+h])||-1===this[""+h]||I===this[""+h]||v||(I=this[""+h]);var w=I+this.parent.pageSettings.pageSize;w>this.totalRecords&&(w=I+(this.totalRecords-I)),this.startIndex=!v||t.isNullOrUndefined(this[""+h])?w-this.parent.pageSettings.pageSize:I,this.endIndex=w,I+this.parent.pageSettings.pageSize>this.totalRecords&&this.endIndex-this.startIndex<this.parent.pageSettings.pageSize/2&&this.endIndex-I<this.parent.pageSettings.pageSize/2&&(this.startIndex=w-this.parent.pageSettings.pageSize/2),c.length&&this.startIndex>c[0].index&&this.startIndex-c[0].index<this.parent.pageSettings.pageSize/2&&this.parent.selectionModule.isRowSelected&&(this.startIndex=c[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.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 R=this.currentInfo=t.getValue("getInfoFromView",this).apply(this,[e.direction,i,e.offset]);this.previousInfo=R,this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization?R.columnIndexes:[]);var x=R.loadNext&&!R.loadSelf?R.nextInfo.page:R.page;this.parent.setProperties({pageSettings:{currentPage:x}},!0),this.requestType="virtualscroll","right"!==e.direction&&"left"!==e.direction&&(R.event="refresh-virtual-block"===R.event?"model-changed":R.event),this.parent.enableVirtualMaskRow&&(this.parent.showMaskRow(i.axis),this.parent.addShimmerEffect(),this.parent.notify("showGanttShimmer",{requestType:"showShimmer"})),this.parent.notify(R.event,{requestType:"virtualscroll",virtualInfo:R,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(De,this.virtualOtherAction),this.parent.off(Oe,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),Ft=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 jt(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),_t=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)}}(),Ht=function(){function e(e){this.prevstartIndex=-1,this.prevendIndex=-1,this.parent=e,i.Grid.Inject(Gt),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(oe,this.collapseExpandVirtualchilds,this),this.parent.on(ae,this.virtualPageAction,this),this.parent.on("destroy",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(oe,this.collapseExpandVirtualchilds),this.parent.off(ae,this.virtualPageAction),this.parent.off("destroy",this.destroy))},e.prototype.collapseExpandVirtualchilds=function(e){this.parent.grid.notify(De,{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)),d=s.filter(function(e){return h(r.parent,e,s)});this.visualData=d,e.count=d.length,this.parent.grid.notify(Me,{data:d});var l={startIndex:-1,endIndex:-1,count:e.count,requestType:e.actionArgs.requestType};this.parent.grid.notify(Oe,l);var p=l.startIndex,c=l.endIndex;if(e.count=d.length,-1===p&&-1===c){var u=new n.Query,g=this.parent.grid.pageSettings.pageSize,f=g*(this.parent.grid.pageSettings.currentPage-1);u=u.skip(f).take(g),o.dataSource.json=d,e.result=o.executeLocal(u)}else{var y=e.actionArgs.requestType;("filtering"===y||"collapseAll"===y||"searching"===y||"refresh"===y&&this.parent.enableCollapseAll&&c>d.length&&t.isNullOrUndefined(this.expandCollapseRec))&&(p=0,c=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.getContent().firstElementChild.scrollTop=0,this.parent.grid.notify(De,{setTop:!0})),("save"===y&&e.actionArgs.index>=l.count-this.parent.grid.pageSettings.pageSize||"refresh"===y&&this.parent.isGantt&&this.parent.isAddedFromGantt&&this.parent.grid.pageSettings.currentPage===this.parent.grid.contentModule.maxPage)&&(p=l.startIndex+(l.count-l.endIndex),c=l.count,this.parent.isAddedFromGantt=!1);var m=this.parent.grid.contentModule.virtualEle.wrapper,S=i.getTransformValues(m).height;if(!t.isNullOrUndefined(this.expandCollapseRec)&&("virtualscroll"===e.actionArgs.requestType||"refresh"===e.actionArgs.requestType&&p!==this.prevstartIndex)&&p<this.parent.getRows().length&&c<=p+this.parent.getRows().length&&0===S&&(p=0),!t.isNullOrUndefined(this.expandCollapseRec)){var I=this.parent.getRows(),v=d.indexOf(this.expandCollapseRec);d.slice(v,v+I.length).length<I.length&&v>=0&&0!==p?(p=v=(v=d.length-I.length)>0?v:0,c=d.length):t.getValue("isCollapseAll",this.parent)&&(p=0,c=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify(De,{setTop:!0}))}!this.parent.enableCollapseAll&&!this.parent.expandStateMapping||t.isNullOrUndefined(this.expandCollapseRec)||(e.count<this.parent.getRows()[0].getBoundingClientRect().height?p=0:this.parent.isExpandAll||(p=-1===this.prevstartIndex?0:this.prevstartIndex)),this.expandCollapseRec=null,p=p<0?0:p,0===c&&d.length>0?e.result=d:e.result=d.slice(p,c),this.prevstartIndex=p,this.prevendIndex=c}this.parent.notify("updateAction",e)},e.prototype.destroy=function(){this.removeEventListener()},e}(),Gt=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 _t(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 zt(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),Qt=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}(),Kt=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}(),Wt=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(ae,this.infinitePageAction,this),this.parent.on("infinite-remote-expand",this.infiniteRemoteExpand,this),this.parent.grid.on("delete-complete",this.infiniteDeleteHandler,this),this.parent.grid.on("infinite-edit-handler",this.infiniteEditHandler,this),this.parent.grid.on("infinite-crud-cancel",this.createRows,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on(oe,this.collapseExpandInfinitechilds,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("infinite-remote-expand",this.infiniteRemoteExpand),this.parent.grid.off("delete-complete",this.infiniteDeleteHandler),this.parent.grid.off("infinite-edit-handler",this.infiniteEditHandler),this.parent.off(ae,this.infinitePageAction),this.parent.grid.off("infinite-crud-cancel",this.createRows),this.parent.grid.off("content-ready",this.contentready),this.parent.off(oe,this.collapseExpandInfinitechilds))},e.prototype.infiniteRemoteExpand=function(e){for(var t=this.parent.grid.getRowsObject(),r=this.parent.grid.infiniteScrollModule.serviceLocator,n=new i.RowRenderer(r,null,this.parent.grid),o=this.parent.getRows(),a=e.index===o.length-1?"after":"before",s=this.parent.grid.getColumns(),d=this.parent.grid.infiniteScrollModule.generateRows(e.childData,e),l=[],p=0;p<d.length;p++)l.push(n.render(d[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.collapseExpandInfinitechilds=function(e){e.record.expanded="collapse"!==e.action;var i={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length},r=t.getValue("isCollapseAll",this.parent)?"collapseAll":"refresh";t.getValue("grid.renderModule",this.parent).dataManagerSuccess(i,{requestType:r})},e.prototype.infinitePageAction=function(e){var i=this,r=new n.DataManager(e.result),o=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),a=r.executeLocal((new n.Query).where(o)),s=a.filter(function(e){return h(i.parent,e,a)}),d=t.getValue("actionArgs",e.actionArgs),l=t.getValue("actions",this.parent.grid.infiniteScrollModule);this.parent.grid.infiniteScrollModule.isInitialRender&&!this.parent.initialRender&&(this.parent.grid.pageSettings.currentPage=1);var p=!!l.some(function(e){return e===d.requestType})||!!this.parent.initialRender;if(this.visualData=s,e.count=s.length,t.getValue("isPrinting",e.actionArgs))e.result=s;else{var c=new n.Query,u=this.parent.infiniteScrollSettings.enableCache;u&&this.parent.infiniteScrollSettings.initialBlocks>this.parent.infiniteScrollSettings.maxBlocks&&(this.parent.infiniteScrollSettings.initialBlocks=this.parent.infiniteScrollSettings.maxBlocks);var g=p?this.parent.grid.pageSettings.pageSize*this.parent.infiniteScrollSettings.initialBlocks:this.parent.grid.pageSettings.pageSize,f=this.parent.grid.pageSettings.currentPage;if(t.isNullOrUndefined(d))c=c.page(f,g);else{var y=t.getValue("lastIndex",this.parent.grid.infiniteScrollModule),m=t.getValue("firstIndex",this.parent.grid.infiniteScrollModule);if(u||"delete"!==d.requestType)u&&"delete"===d.requestType||"save"===d.requestType&&"add"===d.action?c=(c=c.skip(m)).take(this.parent.infiniteScrollSettings.initialBlocks*this.parent.pageSettings.pageSize):("expand"!==e.actionArgs.action&&"collapse"!==e.actionArgs.action||1===this.parent.grid.pageSettings.currentPage||(f=1,g=this.parent.grid.pageSettings.pageSize*this.parent.grid.pageSettings.currentPage),c=c.page(f,g));else{var S=y-d.data.length+1,I=d.data.length;c=c.skip(S).take(I)}}r.dataSource.json=s,u||t.isNullOrUndefined(d)||"save"!==d.requestType||"add"!==d.action?e.result=r.executeLocal(c):e.result=[d.data]}this.parent.notify("updateAction",e)},e.prototype.infiniteEditHandler=function(e){var t=this.parent.grid.infiniteScrollModule.infiniteCurrentViewData,i=Object.keys(t);if("delete"===e.e.requestType&&e.result.length>1)for(var r=1;r<e.result.length;r++)t[i[i.length-1]].push(e.result[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=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)}})},d=0;d<r.length;d++)s(d)},e.prototype.createRows=function(e){var r,n=e.args.e,o=e.row,a=this.parent.grid.infiniteScrollModule.serviceLocator,s=new i.RowRenderer(a,null,this.parent.grid),d=this.parent.getCurrentViewRecords(),l=e.isMovable?this.parent.grid.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}();e.TreeGrid=St,e.load="load",e.rowDataBound=F,e.dataBound="dataBound",e.queryCellInfo=_,e.beforeDataBound=H,e.actionBegin=G,e.dataStateChange=Q,e.actionComplete=K,e.rowSelecting="rowSelecting",e.rowSelected=W,e.checkboxChange=Y,e.rowDeselected=J,e.toolbarClick=X,e.beforeExcelExport=$,e.beforePdfExport=Z,e.resizeStop="resizeStop",e.expanded=ee,e.expanding=te,e.collapsed=ie,e.collapsing=re,e.remoteExpand=ne,e.localPagedExpandCollapse=oe,e.pagingActions=ae,e.printGridInit=se,e.contextMenuOpen=de,e.contextMenuClick=le,e.beforeCopy="beforeCopy",e.beforePaste="beforePaste",e.savePreviousRowPosition="savePreviousRowPosition",e.crudAction=pe,e.beginEdit=he,e.beginAdd=ce,e.recordDoubleClick=ue,e.cellSave=ge,e.cellSaved=fe,e.cellEdit=ye,e.batchDelete=me,e.batchCancel=Se,e.batchAdd=Ie,e.beforeBatchDelete=ve,e.beforeBatchAdd=we,e.beforeBatchSave=Re,e.batchSave=xe,e.keyPressed=Ce,e.updateData="update-data",e.doubleTap=be,e.virtualColumnIndex="virtualColumnIndex",e.virtualActionArgs=De,e.destroy="destroy",e.dataListener=Me,e.indexModifier=Oe,e.beforeStartEdit=Pe,e.beforeBatchCancel=Ee,e.batchEditFormRendered="batcheditform-rendered",e.detailDataBound=Ae,e.rowDrag="rowDrag",e.rowDragStartHelper=Ne,e.rowDrop="rowDrop",e.rowDragStart="rowDragStart",e.rowsAdd=Ue,e.rowsRemove=ke,e.rowdraging=qe,e.rowDropped=Ve,e.autoCol="auto-col",e.rowDeselecting=Te,e.headerContent="e-headercontent",e.movableContent=Be,e.movableHeader="e-movableheader",e.frozenContent=Le,e.frozenHeader="e-frozenheader",e.content="e-content",e.table="e-table",e.leftRight="Left-Right",e.frozenRight="frozen-right",e.frozenLeft="frozen-left",e.dataColIndex="data-colindex",e.ariaColIndex="aria-colindex",e.dataRowIndex=je,e.ariaRowIndex="aria-rowindex",e.DataManipulation=$e,e.Reorder=It,e.Resize=vt,e.RowDD=wt,e.Column=x,e.TreeGridColumn=C,e.StackedColumn=b,e.EditSettings=dt,e.Predicate=A,e.FilterSettings=N,e.PageSettings=tt,e.SearchSettings=Ke,e.SelectionSettings=Je,e.AggregateColumn=nt,e.AggregateRow=ot,e.SortDescriptor=ht,e.SortSettings=ct,e.RowDropSettings=Ct,e.InfiniteScrollSettings=ft,e.LoadingIndicator=O,e.Render=Xe,e.TreeVirtualRowModelGenerator=Dt,e.isRemoteData=a,e.isCountRequired=s,e.isCheckboxcolumn=d,e.isFilterChildHierarchy=l,e.findParentRecords=p,e.getExpandStatus=h,e.findChildrenRecords=c,e.isOffline=u,e.extendArray=g,e.getPlainData=f,e.getParentData=y,e.isHidden=m,e.Filter=Mt,e.ExcelExport=Ot,e.PdfExport=Pt,e.Page=Et,e.Toolbar=At,e.Aggregate=Nt,e.Sort=Ut,e.TreeClipboard=Fe,e.ColumnMenu=kt,e.ContextMenu=qt,e.Edit=Tt,e.CommandColumn=Bt,e.Selection=_e,e.DetailRow=Lt,e.VirtualScroll=Ht,e.TreeVirtual=Gt,e.Freeze=Qt,e.ColumnChooser=Kt,e.Logger=j,e.treeGridDetails=z,e.InfiniteScroll=Wt,Object.defineProperty(e,"__esModule",{value:!0})});
10
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-popups")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-grids","@syncfusion/ej2-buttons","@syncfusion/ej2-data","@syncfusion/ej2-popups"],t):t(e.ej={},e.ej2Base,e.ej2Grids,e.ej2Buttons,e.ej2Data,e.ej2Popups)}(this,function(e,t,i,r,n,o){"use strict";function a(e){if(e.dataSource instanceof n.DataManager){var t=e.dataSource.adaptor;return t instanceof n.ODataAdaptor||t instanceof n.WebApiAdaptor||t instanceof n.WebMethodAdaptor||t instanceof n.CacheAdaptor||t instanceof n.UrlAdaptor}return!1}function s(e){return!!(e.dataSource&&"result"in e.dataSource)}function d(e){for(var t=0;t<e.columns.length;t++)if(e.columns[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:y(e,i.parentItem.uniqueID);return null==o||(!e.initialRender||t.isNullOrUndefined(o[e.expandStateMapping])||o[e.expandStateMapping]?!1!==o.expanded&&(!o.parentItem||((n=y(e,o.parentItem.uniqueID))&&e.initialRender&&!t.isNullOrUndefined(n[e.expandStateMapping])&&!n[e.expandStateMapping]?(n.expanded=!1,!1):(!n||!1!==n.expanded)&&(!n||h(e,n,r)))):(o.expanded=!1,!1))}function c(e){var i=[];if(t.isNullOrUndefined(e)||!e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)&&!e.childRecords.length)return[];if(!t.isNullOrUndefined(e.childRecords))for(var r=e.childRecords.filter(function(e){return!e.isSummaryRow}),n=0,o=Object.keys(r).length;n<o;n++)i.push(r[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 y(e,t,i){if(i){return e.uniqueIDFilterCollection[""+t]}return e.uniqueIDCollection[""+t]}function m(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}function S(e,i,r,o,a,s,d){var l,p,h,c=e.value,u=e.action,m=i.grid.getPrimaryKeyFieldNames()[0],S=i.dataSource instanceof n.DataManager?i.dataSource.dataSource.json:i.dataSource,w=[],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=function(e,i,r,n,o,a,s){var d,l=!1,p=r.grid.getCurrentViewRecords();switch(d=t.extend({},e.value),d=f(d),r.editSettings.newRowPosition){case"Top":i.unshift(d),l=!0;break;case"Bottom":i.push(d),l=!0;break;case"Above":d=t.isNullOrUndefined(s)?f(d=t.extend({},p[o+1])):f(d=t.extend({},s));break;case"Below":case"Child":if(t.isNullOrUndefined(s)){var h=r.grid.getPrimaryKeyFieldNames()[0],c=p[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}}(e,S,i,0,o,a,d);c=C.value,x=C.isSkip}if(c instanceof Array?w=g(c):w.push(t.extend({},c)),!x&&("add"!==u||"Top"!==i.editSettings.newRowPosition&&"Bottom"!==i.editSettings.newRowPosition))for(var b=0;b<w.length;b++){"object"==typeof w[parseInt(b.toString(),10)][""+m]&&(w[parseInt(b.toString(),10)]=w[parseInt(b.toString(),10)][""+m]);var D=w[parseInt(b.toString(),10)].taskData?Object.keys(w[parseInt(b.toString(),10)].taskData):Object.keys(w[parseInt(b.toString(),10)]);l=S.length;for(var M=function(){if(S[parseInt(l.toString(),10)][""+m]===w[parseInt(b.toString(),10)][""+m]){if("delete"!==u){if("edit"===u){for(p=0;p<D.length;p++)if(Object.prototype.hasOwnProperty.call(S[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=y(i,w[parseInt(b.toString(),10)].uniqueID);S[parseInt(l.toString(),10)][D[parseInt(p.toString(),10)]]=w[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)]]=S[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]=S[parseInt(l.toString(),10)][""+i.idMapping],S.splice(l+1,0,R.taskData)):(Object.prototype.hasOwnProperty.call(S[parseInt(l.toString(),10)],i.childMapping)||(S[parseInt(l.toString(),10)][""+i.childMapping]=[]),S[parseInt(l.toString(),10)][""+i.childMapping].push(R.taskData),v(m,S[parseInt(l.toString(),10)],u,i,r,R)):"Below"===i.editSettings.newRowPosition?(S.splice(l+1,0,R.taskData),t.isNullOrUndefined(R.parentItem)||v(m,S[l+1],u,i,r,R)):o?"Above"===i.editSettings.newRowPosition&&(S.splice(l,0,R.taskData),t.isNullOrUndefined(R.parentItem)||v(m,S[parseInt(l.toString(),10)],u,i,r,R)):(n=0,S.splice(n,0,R.taskData))}return"break"}var a=S[parseInt(l.toString(),10)];if(S.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,v(m,d,u,i,r));break}return"break"}}else t.isNullOrUndefined(S[parseInt(l.toString(),10)][""+i.childMapping])||I(S[parseInt(l.toString(),10)][""+i.childMapping],w[parseInt(b.toString(),10)],u,m,i,r,R,s)&&v(m,S[parseInt(l.toString(),10)],u,i,r)};l--&&l>=0;){if("break"===M())break}}}function I(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=y(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)){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),v(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),v(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Above"===o.editSettings.newRowPosition?(e.splice(p,0,s.taskData),t.isNullOrUndefined(s.parentItem)||v(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)||v(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])||I(e[parseInt(p.toString(),10)][o.childMapping],i,r,n,o,a,s,d)&&v(n,e[parseInt(p.toString(),10)],r,o,a);return l}function v(e,i,r,o,a,s){if("Above"!==o.editSettings.newRowPosition&&"Below"!==o.editSettings.newRowPosition||"add"!==r&&"batchsave"!==r||t.isNullOrUndefined(s.parentItem)){var d,l=o.grid.getCurrentViewRecords();if(l.map(function(t,r){t[""+e]!==i[""+e]||(d=r)}),o.enableVirtualization&&t.isNullOrUndefined(d)){var p=t.getValue("uniqueIDCollection."+s.parentUniqueID,o);i=p}if(t.isNullOrUndefined(d)||(i=l[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 m=void 0;if((o.frozenRows||o.getFrozenColumns())&&(m=o.getRowByIndex(d)),!o.enableVirtualization&&!t.isNullOrUndefined(f)||!t.isNullOrUndefined(m)){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)]:m.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{y(o,s.parentItem.uniqueID).childRecords.push(s)}}var 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)}}(),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},x=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}(),C=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return w(i,e),R([t.Property(null)],i.prototype,"columns",void 0),i}(x),b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return w(t,e),t}(C),D=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),M=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},O=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return D(i,e),M([t.Property("Spinner")],i.prototype,"indicatorType",void 0),i}(t.ChildProperty),P=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),E=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},A=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),E([t.Property()],i.prototype,"field",void 0),E([t.Property()],i.prototype,"operator",void 0),E([t.Property()],i.prototype,"value",void 0),E([t.Property()],i.prototype,"matchCase",void 0),E([t.Property()],i.prototype,"ignoreAccent",void 0),E([t.Property()],i.prototype,"predicate",void 0),E([t.Property({})],i.prototype,"actualFilterValue",void 0),E([t.Property({})],i.prototype,"actualOperator",void 0),E([t.Property()],i.prototype,"type",void 0),E([t.Property()],i.prototype,"ejpredicate",void 0),E([t.Property()],i.prototype,"uid",void 0),E([t.Property()],i.prototype,"isForeignKey",void 0),i}(t.ChildProperty),N=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return P(i,e),E([t.Collection([],A)],i.prototype,"columns",void 0),E([t.Property("FilterBar")],i.prototype,"type",void 0),E([t.Property()],i.prototype,"mode",void 0),E([t.Property(!0)],i.prototype,"showFilterBarStatus",void 0),E([t.Property(1500)],i.prototype,"immediateModeDelay",void 0),E([t.Property()],i.prototype,"operators",void 0),E([t.Property(!1)],i.prototype,"ignoreAccent",void 0),E([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),U=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)}}(),k=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},q=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return U(i,e),k([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)}}(),T="https://ej2.syncfusion.com/documentation/treegrid",B="https://ej2.syncfusion.com/documentation",L=!1,j=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,T+"/modules"):"primary_column_missing"===n[parseInt(o.toString(),10)]||"selection_key_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,B+"/api/treegrid/column/#isprimarykey"):"grid_remote_edit"===n[parseInt(o.toString(),10)]?d=d.replace(p,T+"/edit"):"virtual_height"===n[parseInt(o.toString(),10)]?d=d.replace(p,T+"/virtual"):"check_datasource_columns"===n[parseInt(o.toString(),10)]?d=d.replace(p,T+"/columns"):"locale_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace(p,T+"/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=z[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),z={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"+B+"/api/treegrid#childmapping\n"+B+"/api/treegrid#idmapping\n"+B+"/api/treegrid#$parentidmapping"}}},F="rowDataBound",_="queryCellInfo",H="beforeDataBound",G="actionBegin",Q="dataStateChange",K="actionComplete",W="rowSelected",Y="checkboxChange",J="rowDeselected",X="toolbarClick",$="beforeExcelExport",Z="beforePdfExport",ee="expanded",te="expanding",ie="collapsed",re="collapsing",ne="remoteExpand",oe="localPagedExpandCollapse",ae="pagingActions",se="printGrid-Init",de="contextMenuOpen",le="contextMenuClick",pe="crudAction",he="beginEdit",ce="beginAdd",ue="recordDoubleClick",ge="cellSave",fe="cellSaved",ye="cellEdit",me="batchDelete",Se="batchCancel",Ie="batchAdd",ve="beforeBatchDelete",we="beforeBatchAdd",Re="beforeBatchSave",xe="batchSave",Ce="key-pressed",be="double-tap",De="virtual-action-args",Me="data-listener",Oe="index-modifier",Pe="edit-form",Ee="before-batch-cancel",Ae="detailDataBound",Ne="rowDragStartHelper",Ue="rows-add",ke="rows-remove",qe="row-draging",Ve="row-dropped",Te="rowDeselecting",Be="e-movablecontent",Le="e-frozencontent",je="data-rowindex",ze=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)}}(),Fe=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 ze(i,e),i.prototype.setCopyData=function(i){var r="copyContent",n=this.treeGridParent.getCurrentViewRecords();if(""===window.getSelection().toString()){this.clipBoardTextArea.value=this[""+r]="";var o=this.treeGridParent.grid.getRows();if("Cell"!==this.treeGridParent.selectionSettings.mode){for(var a=this.treeGridParent.getSelectedRowIndexes().sort(function(e,t){return e-t}),s=0;s<a.length;s++)if(s>0&&(this.treeCopyContent+="\n"),!o[a[parseInt(s.toString(),10)]].classList.contains("e-summaryrow")){var d=[].slice.call(o[a[parseInt(s.toString(),10)]].querySelectorAll(".e-rowcell")),l=this.treeGridParent.getSelectedRecords()[parseInt(s.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&("Parent"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.parentContentData(n,a[parseInt(s.toString(),10)],o,i,s),this.getCopyData(d,!1,"\t",i),this.treeCopyContent+=this[""+r],this.copiedUniqueIdCollection.push(l),this[""+r]="","Child"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.childContentData(n,a[parseInt(s.toString(),10)],o,i))}if(i){var p=[];for(s=0;s<this.treeGridParent.getVisibleColumns().length;s++)p[parseInt(s.toString(),10)]=this.treeGridParent.getVisibleColumns()[parseInt(s.toString(),10)].headerText;this.getCopyData(p,!1,"\t",i),this.treeCopyContent=this[""+r]+"\n"+this.treeCopyContent}var h={data:this.treeCopyContent,cancel:!1};if(this.treeGridParent.trigger("beforeCopy",h),h.cancel)return;this.clipBoardTextArea.value=this[""+r]=h.data,t.Browser.userAgent.match(/ipad|ipod|iphone/i)?this.clipBoardTextArea.setSelectionRange(0,this.clipBoardTextArea.value.length):this.clipBoardTextArea.select(),this.isSelect=!0,this.copiedUniqueIdCollection=[],this.treeCopyContent=""}else e.prototype.setCopyData.call(this,i)}},i.prototype.parentContentData=function(e,i,r,n,o){var a="copyContent",s="parentItem";if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)][""+s]))for(var d=e[parseInt(i.toString(),10)][""+s].level,l=0;l<d+1;l++)for(var p=0;p<e.length;p++)if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)][""+s])&&e[parseInt(p.toString(),10)].uniqueID===e[parseInt(i.toString(),10)][""+s].uniqueID){i=p;var h=[].slice.call(r[parseInt(i.toString(),10)].querySelectorAll(".e-rowcell")),c=e[parseInt(p.toString(),10)].uniqueID;if(-1===this.copiedUniqueIdCollection.indexOf(c)){this.getCopyData(h,!1,"\t",n),this.treeCopyContent=o>0?this.treeCopyContent+this[""+a]+"\n":this[""+a]+"\n"+this.treeCopyContent,this.copiedUniqueIdCollection.push(c),this[""+a]="";break}}},i.prototype.copy=function(t){e.prototype.copy.call(this,t)},i.prototype.paste=function(t,i,r){e.prototype.paste.call(this,t,i,r)},i.prototype.getModuleName=function(){return"clipboard"},i.prototype.destroy=function(){e.prototype.destroy.call(this)},i.prototype.childContentData=function(e,i,r,n){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),_e=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(Y,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,o=(n=this.parent.getHeaderContent().querySelectorAll(".e-checkbox-wrapper")[0]).querySelector(".e-frame").classList.contains("e-check");this.parent.autoCheckHierarchy&&o&&this.headerSelection(o)}},e.prototype.renderColumnCheckbox=function(e){var i=this.parent.createElement("input",{className:"e-treecheckselect",attrs:{type:"checkbox","aria-label":"checkbox"}}),n=e.data;e.cell.classList.add("e-treegridcheckbox"),e.cell.setAttribute("aria-label","checkbox");var o=!t.isNullOrUndefined(n.checkboxState)&&"uncheck"!==n.checkboxState,a=r.createCheckBox(this.parent.createElement,!1,{checked:o,label:" "});if(a.classList.add("e-hierarchycheckbox"),this.parent.allowTextWrap&&(a.querySelector(".e-frame").style.width="18px"),"indeterminate"===n.checkboxState){var s=a.querySelectorAll(".e-frame")[0];t.removeClass([s],["e-check","e-stop","e-uncheck"]),a.querySelector(".e-frame").classList.add("e-stop")}return a.insertBefore(i.cloneNode(),a.firstChild),a},e.prototype.columnCheckbox=function(e){var i=this.renderColumnCheckbox(e),r=e.cell.querySelector(".e-treecolumn-container");if(t.isNullOrUndefined(r)){var n=this.parent.createElement("span",{className:"e-treecheckbox"}),o=e.cell.innerHTML;e.cell.innerHTML="",n.innerHTML=o;var a=this.parent.createElement("div",{className:"e-treecheckbox-container"});a.appendChild(i),a.appendChild(n),e.cell.appendChild(a)}else e.cell.querySelector(".e-hierarchycheckbox")||r.insertBefore(i,r.querySelectorAll(".e-treecell")[0])},e.prototype.selectCheckboxes=function(e){for(var t=0;t<e.length;t++){var i=this.parent.getCurrentViewRecords()[e[parseInt(t.toString(),10)]],r=y(this.parent,i.uniqueID),n="uncheck"===(i=r).checkboxState?"check":"uncheck";i.checkboxState=n;for(var o=Object.keys(i),a=0;a<o.length;a++)Object.prototype.hasOwnProperty.call(r,o[parseInt(a.toString(),10)])&&(r[o[parseInt(a.toString(),10)]]=i[o[parseInt(a.toString(),10)]]);this.traverSelection(i,n,!1),this.parent.autoCheckHierarchy&&this.headerSelection()}},e.prototype.traverSelection=function(e,i,r){var n=0;if(this.updateSelectedItems(e,i),!r&&e.parentItem&&this.parent.autoCheckHierarchy&&this.updateParentSelection(e.parentItem),e.childRecords&&this.parent.autoCheckHierarchy){var o=e.childRecords;!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(o=this.getFilteredChildRecords(o)),n=o.length;for(var a=0;a<n;a++)o[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=y(this.parent,e.uniqueID);n&&n.childRecords&&(r=n.childRecords),!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0&&this.parent.autoCheckHierarchy&&(r=this.getFilteredChildRecords(r)),i=r&&r.length;var o=0,a=0;if(!t.isNullOrUndefined(n)){for(var s=0;s<r.length;s++){var d=y(this.parent,r[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=y(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(var l=0;l<r;l++)s[parseInt(l.toString(),10)].classList.contains("e-summaryrow")||this.updateSelectedItems(i[parseInt(l.toString(),10)],i[parseInt(l.toString(),10)].checkboxState)}else if("delete"===o||"add"===e.action){var p=[];"delete"===o?p=e.data:p.push(e.data);for(l=0;l<p.length;l++){if("delete"===o){var h=this.parent.flatData.indexOf(p[parseInt(l.toString(),10)]),u=this.selectedIndexes.indexOf(h);this.selectedIndexes.splice(u,1),this.updateSelectedItems(p[parseInt(l.toString(),10)],"uncheck")}t.isNullOrUndefined(p[parseInt(l.toString(),10)].parentItem)||this.updateParentSelection(p[parseInt(l.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}(),He=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(se,this.printTreeGrid,this)},e.prototype.removeEventListener=function(){this.parent.grid.off(se,this.printTreeGrid)},e.prototype.printTreeGrid=function(e){var r=i.getObject("printgrid",e),n=i.getObject("element",e);r.addEventListener(_,this.parent.grid.queryCellInfo),r.addEventListener(F,this.parent.grid.rowDataBound),r.addEventListener(H,this.parent.grid.beforeDataBound),t.addClass([n],"e-treegrid")},e.prototype.print=function(){this.parent.grid.print()},e.prototype.destroy=function(){this.removeEventListener()},e}(),Ge=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qe=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ge(i,e),Qe([t.Property()],i.prototype,"fields",void 0),Qe([t.Property(!1)],i.prototype,"ignoreCase",void 0),Qe([t.Property("contains")],i.prototype,"operator",void 0),Qe([t.Property()],i.prototype,"key",void 0),Qe([t.Property()],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),We=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ye=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Je=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return We(i,e),Ye([t.Property("Row")],i.prototype,"mode",void 0),Ye([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),Ye([t.Property("Single")],i.prototype,"type",void 0),Ye([t.Property(!1)],i.prototype,"persistSelection",void 0),Ye([t.Property("Default")],i.prototype,"checkboxMode",void 0),Ye([t.Property(!1)],i.prototype,"checkboxOnly",void 0),Ye([t.Property(!0)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),Xe=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))){if((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(F,e)})}else this.parent.trigger(F,e)}},e.prototype.cellRender=function(e){if(e.data){var r,n,o=this.parent.grid,a=e.data,s=t.isNullOrUndefined(a.filterLevel)?a.level:a.filterLevel,d=0,l=this.parent.getColumnByUid(e.column.uid),p=a.isSummaryRow,c=this.parent.getFrozenColumns();r=t.isNullOrUndefined(a.parentItem)?a.index:a.parentItem.index;if((this.parent.enableColumnVirtualization&&!this.parent.initialRender?this.parent.getVirtualColIndexByUid(e.column.uid):o.getColumnIndexByUid(e.column.uid))!==this.parent.treeColumnIndex||"add"!==e.requestType&&"rowDragAndDrop"!==e.requestType&&"delete"!==e.requestType&&!t.isNullOrUndefined(e.cell.querySelector(".e-treecell")))this.templateResult&&(this.templateResult=null);else{for(var u=t.createElement("div",{className:"e-treecolumn-container"}),g=t.createElement("span",{className:"e-icons e-none",styles:"width: 10px; display: inline-block"}),f=0;f<s;f++)d+=10,u.appendChild(g.cloneNode());var y=t.isNullOrUndefined(a.hasFilteredChildRecords)?a.hasChildRecords:a.hasFilteredChildRecords;if(y&&!t.isNullOrUndefined(a.childRecords)&&(y=this.parent.isFromGantt&&!this.parent.loadChildOnDemand?a.hasChildRecords:!(0===a.childRecords.length)),y){t.addClass([e.cell],"e-treerowcell"),e.cell.setAttribute("aria-expanded",a.expanded?"true":"false");var m=t.createElement("span",{className:"e-icons"}),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([m],S?"e-treegridexpand":"e-treegridcollapse"),d+=18,u.appendChild(m),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 I=o.getFrozenRightColumns(),v=o.getFrozenLeftColumns(),w=o.getMovableColumns();I.length>0&&I[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+a.level):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)}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,(t.isNullOrUndefined(this.parent.rowTemplate)&&!this.parent.isReact||this.parent.isReact&&!e.column.template)&&this.parent.trigger(_,e)}},e.prototype.updateTreeCell=function(e,r){var n=t.getValue("columnModel",this.parent)[this.parent.treeColumnIndex],o="templateFn",a=e.column.index;t.isNullOrUndefined(n.field)&&e.cell.setAttribute("data-colindex",a+""),n.field!==e.column.field||t.isNullOrUndefined(n.template)||(e.column.template=n.template,e.column[""+o]=i.templateCompiler(e.column.template),e.cell.classList.add("e-templatecell"));var s=null!=e.cell.querySelector(".e-treecell")?e.cell.querySelector(".e-treecell").innerHTML:e.cell.innerHTML;if("object"==typeof e.column.template&&this.templateResult)i.appendChildren(r,this.templateResult),this.templateResult=null,e.cell.innerHTML="";else if(e.cell.classList.contains("e-templatecell")){var d=e.cell.children.length,l=this.parent.element.id+e.column.uid;if(n.field!==e.column.field||t.isNullOrUndefined(n.template))for(;0<d;d=e.cell.children.length)r.appendChild(e.cell.children[parseInt((0).toString(),10)]);else{if(this.parent.isReact&&"string"!=typeof e.column.template){e.column[""+o](e.data,this.parent,"columnTemplate",l,null,null,r),t.isNullOrUndefined(this.parent.grid.portals)&&(this.parent.grid.portals=this.parent.portals),this.parent.notify("renderReactTemplate",this.parent.portals);var p=this;p.parent.renderReactTemplates(function(){p.parent.trigger(_,e)})}else{var h=e.column[""+o](i.extend({index:""},e.data),this.parent,"template",l,this.parent.isStringTemplate);i.appendChildren(r,h)}delete e.column.template,delete e.column[""+o],e.cell.innerHTML=""}}else r.innerHTML=s,e.cell.innerHTML=""},e.prototype.refreshReactColumnTemplateByUid=function(e){var r=this;this.parent.isReact&&this.parent.clearTemplate(["columnTemplate"],void 0,function(){for(var n=r.parent.grid.getRowsObject(),o=r.parent.grid.getIndentCount(),a=r.parent.grid.getNormalizedColumnIndex(e),s=0;s<n.length;s++)if(n[parseInt(s.toString(),10)].isDataRow&&!t.isNullOrUndefined(n[parseInt(s.toString(),10)].index)){var d=n[parseInt(s.toString(),10)].cells[parseInt(a.toString(),10)],l=new i.CellRenderer(r.parent.grid,r.parent.grid.serviceLocator),p=r.parent.getCellFromIndex(n[parseInt(s.toString(),10)].index,a-o);l.refreshTD(p,d,n[parseInt(s.toString(),10)].data,{index:n[parseInt(s.toString(),10)].index});var h=r.parent.getRows()[parseInt(s.toString(),10)].cells[parseInt(a.toString(),10)];r.cellRender({data:n[parseInt(s.toString(),10)].data,cell:h,column:d.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}(),$e=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(ne,this.collectExpandingRecs,this),this.parent.on("dataProcessor",this.dataProcessor,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(ne,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=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){var a=[],s=new n.DataManager(this.hierarchyData).executeLocal((new n.Query).group(this.parent.parentIdMapping));for(r=0;r<s.length;r++){var d=s[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){var r="actionArgs";a(this.parent)&&this.parent.enableVirtualization&&"virtualscroll"===e[""+r].requestType&&this.parent.hideSpinner();var n=e.result;if(a(this.parent)&&this.parent.enableVirtualization&&("virtualscroll"===e[""+r].requestType||"clearFilter"===e[""+r].action||""===e[""+r].searchString)&&(this.parent.query.expands=[]),this.parent.hasChildMapping||this.parentItems.length||this.parent.loadChildOnDemand)if(this.parent.loadChildOnDemand){t.isNullOrUndefined(n)||this.parent.loadChildOnDemand&&s(this.parent)&&!t.isNullOrUndefined(this.parent.dataResults.expandRecord)||a(this.parent)&&this.parent.loadChildOnDemand&&e[""+r].isExpandCollapse&&this.parent.enableVirtualization||this.convertToFlatData(n)}else for(var o=function(e){if(s(d.parent)&&n[parseInt(e.toString(),10)].hasChildRecords&&d.parent.initialRender&&(n[parseInt(e.toString(),10)].expanded=!1),a(d.parent)&&d.parent.enableVirtualization){var r=[],o=d.parent;n.filter(function(t){t[""+o.parentIdMapping]===n[parseInt(e.toString(),10)][""+o.idMapping]&&r.push(t)}),r.length?n[parseInt(e.toString(),10)].expanded=!0:n[parseInt(e.toString(),10)].hasChildRecords&&(n[parseInt(e.toString(),10)].expanded=!1)}t.isNullOrUndefined(n[parseInt(e.toString(),10)].index)&&(n[parseInt(e.toString(),10)].taskData=t.extend({},n[parseInt(e.toString(),10)]),n[parseInt(e.toString(),10)].uniqueID=i.getUid(d.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+n[parseInt(e.toString(),10)].uniqueID,n[parseInt(e.toString(),10)],d.parent),n[parseInt(e.toString(),10)].level=0,a(d.parent)&&d.parent.enableVirtualization&&n[parseInt(e.toString(),10)][""+d.parent.parentIdMapping]&&0===n[parseInt(e.toString(),10)].level&&(n[parseInt(e.toString(),10)].level=n[parseInt(e.toString(),10)].level+1),n[parseInt(e.toString(),10)].index=Math.ceil(1e3*Math.random()),(n[parseInt(e.toString(),10)][d.parent.hasChildMapping]||-1!==d.parentItems.indexOf(n[parseInt(e.toString(),10)][d.parent.idMapping]))&&(n[parseInt(e.toString(),10)].hasChildRecords=!0),n[parseInt(e.toString(),10)].checkboxState="uncheck")},d=this,l=0;l<n.length;l++)o(l);else this.zerothLevelData=e,t.setValue("cancel",!0,e);if(a(this.parent)&&this.parent.loadChildOnDemand&&e[""+r].isExpandCollapse&&this.parent.enableVirtualization?e.result=n:a(this.parent)&&this.parent.enableVirtualization&&!this.parent.loadChildOnDemand?e.result=n:e.result=this.parent.loadChildOnDemand?this.parent.flatData:n,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 p=e.query.queries.filter(function(e){return"onAggregates"===e.fn});e.result=this.parent.summaryModule.calculateSummaryValue(p,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});if(d.queries=l,d.isCountRequired=!0,this.parent.enableVirtualization&&"remoteExpand"===e.action){d.take(this.parent.pageSettings.pageSize);(p=[]).push("ExpandingAction",parseInt(e.record[this.parent.idMapping],10).toString()),d.expand(p)}else if(this.parent.enableVirtualization&&"collapse"===e.action){d.take(this.parent.grid.pageSettings.pageSize);var p;(p=[]).push("CollapsingAction",parseInt(e.record[this.parent.idMapping],10).toString()),d.expand(p)}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 h=this.parent.grid.getDataModule().generateQuery().queries.filter(function(e){return"onPage"!==e.fn&&void 0!==e.e.predicates});d.queries.push(h[0])}o.showSpinner(this.parent.element),s.executeQuery(d).then(function(s){var d,l="remoteExpandedData",p="remoteCollapsedData",h=r.parent.grid.currentViewData.slice(),c=r.parent.idMapping;if(r.parent.isGantt&&!r.parent.loadChildOnDemand&&r.parent.hasChildMapping){for(var u=0;u<r.parent.grid.currentViewData.length;u++)if(e.record[c]===r.parent.grid.currentViewData[u][c]){d=u;break}}else d=h.indexOf(e.record);if(r.parent.enableVirtualization&&("collapse"===e.action||"remoteExpand"===e.action)){h=[];for(u=0;u<d;u++)h.push(r.parent.grid.currentViewData[parseInt(u.toString(),10)])}-1===d&&r.parent.grid.getRowsObject().forEach(function(t){t.data.uniqueID===e.record.uniqueID&&(d=t.index)});var g=i.getObject("actual.nextLevel",s),f=s.result,y=[];if("remoteExpand"===e.action&&r.parent.grid.filterModule&&r.parent.grid.filterModule.value){for(u=0;u<h.length;u++)Object.prototype.hasOwnProperty.call(h[parseInt(u.toString(),10)],r.parent.parentIdMapping)&&null!==h[parseInt(u.toString(),10)][""+r.parent.parentIdMapping]&&0===h[parseInt(u.toString(),10)].level&&(h.splice(u,1),u--);for(u=0;u<f.length;u++)e.record[""+r.parent.idMapping]!==f[parseInt(u.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===f[parseInt(u.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(f,u)&&y.push(f[parseInt(u.toString(),10)]);f=y}if(r.parent.enableVirtualization&&"remoteExpand"===e.action){e.record.childRecords=[];for(u=0;u<f.length;u++)e.record[""+r.parent.idMapping]!==f[parseInt(u.toString(),10)][""+r.parent.idMapping]&&e.record[""+r.parent.idMapping]===f[parseInt(u.toString(),10)][""+r.parent.parentIdMapping]&&Object.prototype.hasOwnProperty.call(f,u)&&e.record.childRecords.push(f[parseInt(u.toString(),10)])}else e.record.childRecords=f;for(var m=0;m<f.length;m++){if(r.parent.enableVirtualization&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"remoteExpand"===e.action)r.parent[""+l].push(e.record);else if(r.parent.enableVirtualization&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"===e.action)for(u=0;u<r.parent[""+l].length;u++)e.record[""+r.parent.idMapping]===r.parent[""+l][parseInt(u.toString(),10)][""+r.parent.idMapping]&&r.parent[""+l].splice(u,1);if(f[parseInt(m.toString(),10)].taskData=t.extend({},f[parseInt(m.toString(),10)]),f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping]&&r.parent.enableVirtualization&&r.parent[""+l].length){for(u=0;u<r.parent[""+l].length;u++)if(f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping]===r.parent[""+l][parseInt(u.toString(),10)][""+r.parent.idMapping]){f[parseInt(m.toString(),10)].level=r.parent[""+l][parseInt(u.toString(),10)].level+1;delete(S=r.parent[""+l][parseInt(u.toString(),10)]).childRecords,f[parseInt(m.toString(),10)].parentItem=S,f[parseInt(m.toString(),10)].parentUniqueID=e.record.uniqueID}}else if(r.parent.enableVirtualization)if(!f[parseInt(m.toString(),10)][""+r.parent.hasChildMapping]&&-1===r.parentItems.indexOf(f[parseInt(m.toString(),10)][""+r.parent.idMapping])||g&&!g[parseInt(m.toString(),10)]){delete(S=t.extend({},e.record)).childRecords,f[parseInt(m.toString(),10)].parentItem=S,f[parseInt(m.toString(),10)].parentUniqueID=e.record.uniqueID}else t.isNullOrUndefined(f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping])?(f[parseInt(m.toString(),10)].level=0,"remoteExpand"===e.action&&(f[parseInt(m.toString(),10)].childRecords=[],f[parseInt(m.toString(),10)].childRecords=e.record.childRecords)):f[parseInt(m.toString(),10)].level=e.record.level;else{f[parseInt(m.toString(),10)].level=e.record.level+1;var S;delete(S=t.extend({},e.record)).childRecords,f[parseInt(m.toString(),10)].parentItem=S,f[parseInt(m.toString(),10)].parentUniqueID=e.record.uniqueID}if(f[parseInt(m.toString(),10)].index=Math.ceil(1e3*Math.random()),f[parseInt(m.toString(),10)].uniqueID=i.getUid(r.parent.element.id+"_data_"),f[parseInt(m.toString(),10)].checkboxState="uncheck",r.parent.enableVirtualization&&t.isNullOrUndefined(f[parseInt(m.toString(),10)].level))for(var I=0;I<r.parent.grid.currentViewData.length;I++)r.parent.grid.currentViewData[parseInt(I.toString(),10)][""+r.parent.idMapping]===f[parseInt(m.toString(),10)][""+r.parent.parentIdMapping]&&(f[parseInt(m.toString(),10)].level=r.parent.grid.currentViewData[parseInt(I.toString(),10)].level+1);if(t.setValue("uniqueIDCollection."+f[parseInt(m.toString(),10)].uniqueID,f[parseInt(m.toString(),10)],r.parent),(f[parseInt(m.toString(),10)][""+r.parent.hasChildMapping]||-1!==r.parentItems.indexOf(f[parseInt(m.toString(),10)][""+r.parent.idMapping]))&&(!g||g[parseInt(m.toString(),10)]))if(f[parseInt(m.toString(),10)].hasChildRecords=!0,r.parent.enableVirtualization&&r.parent.loadChildOnDemand){for(u=0;u<r.parent[""+p].length;u++)f[parseInt(m.toString(),10)][""+r.parent.idMapping]===r.parent[""+p][parseInt(u.toString(),10)][""+r.parent.idMapping]&&(f[parseInt(m.toString(),10)].expanded=r.parent[""+p][parseInt(u.toString(),10)].expanded);if("collapse"===e.action&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]!==e.record[""+r.parent.idMapping]&&!1!==f[parseInt(m.toString(),10)].expanded)f[parseInt(m.toString(),10)].expanded=!0;else if("collapse"===e.action&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping])f[parseInt(m.toString(),10)].expanded=!1,r.parent[""+p].push(e.record);else if("remoteExpand"===e.action){for(u=0;u<r.parent.grid.currentViewData.length;u++)r.parent.grid.currentViewData[parseInt(u.toString(),10)][""+r.parent.idMapping]===f[parseInt(m.toString(),10)][""+r.parent.idMapping]&&f.splice(m,1,r.parent.grid.currentViewData[parseInt(u.toString(),10)]);if(f[parseInt(m.toString(),10)][r.parent.idMapping]===e.record[""+r.parent.idMapping])for(u=0;u<r.parent[""+p].length;u++)e.record[""+r.parent.idMapping]===r.parent[""+p][parseInt(u.toString(),10)][""+r.parent.idMapping]&&r.parent[""+p].splice(u,1);!1!==f[parseInt(m.toString(),10)].expanded&&(f[parseInt(m.toString(),10)].expanded=!0)}}else r.parent.enableVirtualization&&f[parseInt(m.toString(),10)][""+r.parent.idMapping]===e.record[""+r.parent.idMapping]&&"collapse"!==e.action?f[parseInt(m.toString(),10)].expanded=!0:r.parent.enableVirtualization&&r.parent.loadChildOnDemand||(f[parseInt(m.toString(),10)].expanded=!1);h.splice(d+m+1,0,f[parseInt(m.toString(),10)])}if(t.setValue("result",h,s),t.setValue("action","beforecontentrender",s),r.parent.trigger(K,s),o.hideSpinner(r.parent.element),r.parent.grid.aggregates.length>0&&!r.parent.enableVirtualization){var v=i.getObject("query",s);if(t.isNullOrUndefined(v)&&(v=t.getValue("grid.renderModule.data",r.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(v)){var w=v.queries.filter(function(e){return"onAggregates"===e.fn});s.result=r.parent.summaryModule.calculateSummaryValue(w,s.result,!0)}}r.parent.enableVirtualization&&(r.parent.grid.pageSettings.totalRecordsCount=s.count),s.count=r.parent.grid.pageSettings.totalRecordsCount;var R={};r.parent.enableVirtualization&&r.remoteVirtualAction(R);var x={index:d,childData:f};r.parent.enableInfiniteScrolling?r.parent.notify("infinite-remote-expand",x):t.getValue("grid.renderModule",r.parent).dataManagerSuccess(s,R),r.parent.trigger(ee,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";var c="remoteCollapsedData";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 u=0;u<this.parent[""+c].length;u++)this.parent[""+c][parseInt(u.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 g=this.createRecords(l[this.parent.childMapping],l);l.childRecords=g}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,y=this.parent.getPrimaryKeyFieldNames()[0],m=i.getObject("data",f);t.isNullOrUndefined(f)||t.isNullOrUndefined(f.action)||"add"!==f.action||t.isNullOrUndefined(f.data)||!t.isNullOrUndefined(f.data[""+y])||(f.data[""+y]=e.result[f.index][""+y],m.taskData[""+y]=e.result[f.index][""+y]),(!t.isNullOrUndefined(p)&&Object.keys(p).length||"save"===h)&&(h=h||p.requestType,c=c||i.getObject("data",p),g=g||i.getObject("action",p),"Batch"===this.parent.editSettings.mode&&(this.batchChanges=this.parent.grid.editModule.getBatchChanges()),this.parent.isLocalData&&this.updateAction(c,g,h));var S,I,v=(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,w=s(this.parent)?t.getValue("count",this.parent.dataSource):v.length,R=new n.Query,x=i.getObject("query",e);if(t.isNullOrUndefined(x)||(S=x.queries.filter(function(e){return"onWhere"===e.fn}),I=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||I.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(v).executeLocal(R);if(this.parent.notify("updateFilterRecs",{data:D}),v=this.dataResults.result,this.dataResults.result=null,this.parent.grid.aggregates.length>0){var M=i.getObject("query",e);if(t.isNullOrUndefined(x)&&(x=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query)),!t.isNullOrUndefined(M)){var O=M.queries.filter(function(e){return"onAggregates"===e.fn});v=this.parent.summaryModule.calculateSummaryValue(O,v,!0)}}}if(this.parent.grid.aggregates.length&&0===this.parent.grid.sortSettings.columns.length&&0===this.parent.grid.filterSettings.columns.length&&!this.parent.grid.searchSettings.key.length){var P=i.getObject("query",e);t.isNullOrUndefined(P)&&(P=t.getValue("grid.renderModule.data",this.parent).aggregateQuery(new n.Query));O=P.queries.filter(function(e){return"onAggregates"===e.fn});v=this.parent.summaryModule.calculateSummaryValue(O,this.parent.flatData,!0)}if(this.parent.grid.sortSettings.columns.length>0||this.isSortAction){this.isSortAction=!1;for(var E=this.parent.parentData,A=(M=i.getObject("query",e),new n.Query),N=this.parent.grid.sortSettings.columns.length-1;N>=0;N--){var U=this.parent.grid.renderModule.data.getColumnByField(this.parent.grid.sortSettings.columns[parseInt(N.toString(),10)].field),k=U.sortComparer&&u(this.parent)?U.sortComparer.bind(U):this.parent.grid.sortSettings.columns[parseInt(N.toString(),10)].direction;A.sortBy(this.parent.grid.sortSettings.columns[parseInt(N.toString(),10)].field,k)}var q=new n.DataManager(E).executeLocal(A);if(this.parent.allowRowDragAndDrop&&!t.isNullOrUndefined(this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition){var V=q.indexOf(this.parent.rowDragAndDropModule.draggedRecord);q.splice(V,1);var T=q.indexOf(this.parent.rowDragAndDropModule.droppedRecord);this.parent.rowDragAndDropModule.droppedRecord.hasChildRecords&&"topSegment"===this.parent.rowDragAndDropModule.dropPosition?q.splice(T,0,this.parent.rowDragAndDropModule.draggedRecord):"bottomSegment"===this.parent.rowDragAndDropModule.dropPosition&&q.splice(T+1,0,this.parent.rowDragAndDropModule.draggedRecord)}var B={modifiedData:q,filteredData:v,srtQry:A};if(this.parent.notify("createSort",B),v=B.modifiedData,this.dataResults.result=null,this.sortedData=v,this.parent.notify("updateModel",{}),this.parent.grid.aggregates.length>0&&!t.isNullOrUndefined(M)){O=i.getObject("query",e).queries.filter(function(e){return"onAggregates"===e.fn});v=this.parent.summaryModule.calculateSummaryValue(O,this.sortedData,!1)}}w=s(this.parent)?t.getValue("count",this.parent.dataSource):v.length;var L=this.paging(v,w,o,l,d,e);v=L.result,w=L.count,e.result=v,e.count=w,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(ae,{result:e,count:i,actionArgs:d}),e=this.dataResults.result,i=this.dataResults.count}}else this.parent.notify(ae,{result:e,count:i,actionArgs:a}),e=this.dataResults.result,i=s(this.parent)?t.getValue("count",this.parent.dataSource):this.dataResults.count;var l="isCollapsedStatePersist";if((!0===n||a.isPdfExport&&(t.isNullOrUndefined(a[""+l])||a[""+l]))&&"AllPages"===this.parent.printMode){for(var p=[],c=0;c<e.length;c++){h(this.parent,e[parseInt(c.toString(),10)],this.parent.parentData)&&p.push(e[parseInt(c.toString(),10)])}i=(e=p).length}return{result:e,count:i}},e.prototype.updateData=function(e){this.dataResults=e},e.prototype.updateAction=function(e,t,i){"delete"!==i&&"save"!==i||this.parent.notify(pe,{value:e,action:t||i}),"batchsave"===i&&"Batch"===this.parent.editSettings.mode&&this.parent.notify(xe,{})},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 Ze=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)}}(),et=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},tt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ze(i,e),et([t.Property(12)],i.prototype,"pageSize",void 0),et([t.Property(8)],i.prototype,"pageCount",void 0),et([t.Property(1)],i.prototype,"currentPage",void 0),et([t.Property()],i.prototype,"totalRecordsCount",void 0),et([t.Property(!1)],i.prototype,"enableQueryString",void 0),et([t.Property(!1)],i.prototype,"pageSizes",void 0),et([t.Property(null)],i.prototype,"template",void 0),et([t.Property("All")],i.prototype,"pageSizeMode",void 0),i}(t.ChildProperty),it=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)}}(),rt=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},nt=function(e){function r(){var i=null!==e&&e.apply(this,arguments)||this;return i.intl=new t.Internationalization,i.templateFn={},i}return it(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)},rt([t.Property()],r.prototype,"type",void 0),rt([t.Property()],r.prototype,"footerTemplate",void 0),rt([t.Property()],r.prototype,"field",void 0),rt([t.Property()],r.prototype,"format",void 0),rt([t.Property()],r.prototype,"columnName",void 0),rt([t.Property()],r.prototype,"customAggregate",void 0),r}(t.ChildProperty),ot=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return it(i,e),rt([t.Collection([],nt)],i.prototype,"columns",void 0),rt([t.Property(!0)],i.prototype,"showChildSummary",void 0),i}(t.ChildProperty),at=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)}}(),st=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},dt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return at(i,e),st([t.Property(!1)],i.prototype,"allowAdding",void 0),st([t.Property(!1)],i.prototype,"allowEditing",void 0),st([t.Property(!1)],i.prototype,"allowDeleting",void 0),st([t.Property("Cell")],i.prototype,"mode",void 0),st([t.Property("Top")],i.prototype,"newRowPosition",void 0),st([t.Property(!0)],i.prototype,"allowEditOnDblClick",void 0),st([t.Property(!0)],i.prototype,"showConfirmDialog",void 0),st([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),st([t.Property("")],i.prototype,"template",void 0),st([t.Property({})],i.prototype,"dialog",void 0),st([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),lt=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)}}(),pt=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},ht=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return lt(i,e),pt([t.Property()],i.prototype,"field",void 0),pt([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),ct=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return lt(i,e),pt([t.Collection([],ht)],i.prototype,"columns",void 0),pt([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),ut=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)}}(),gt=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},ft=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ut(i,e),gt([t.Property(!1)],i.prototype,"enableCache",void 0),gt([t.Property(3)],i.prototype,"maxBlocks",void 0),gt([t.Property(3)],i.prototype,"initialBlocks",void 0),i}(t.ChildProperty),yt=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)}}(),mt=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},St=function(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)])){if(!(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(_e),t.setValue("mergePersistData",o.mergePersistTreeGridData,o);return t.isNullOrUndefined(o.injectedModules.Logger)||i.Grid.Inject(i.Logger),o.grid=new i.Grid,o}yt(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"]));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,["field","headerText","type","format","visible","template","index","width","textAlign","headerTextAlign","columns"]);var a=this.createElement("form",{id:"ExportForm",styles:"display:none;"}),s=this.createElement("input",{id:"treeGridInput",attrs:{name:"treeGridModel"}});s.value=JSON.stringify(o),a.method="POST",a.action=e,a.appendChild(s),document.body.appendChild(a),a.submit(),a.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,t,i){this.sortModule&&this.sortModule.sortColumn(e,t,i)},d.prototype.clearSorting=function(){this.sortModule&&this.sortModule.clearSorting()},d.prototype.removeSortColumn=function(e){this.sortModule&&this.sortModule.removeSortColumn(e)},d.prototype.search=function(e){this.grid.search(e)},d.prototype.autoFitColumns=function(e){this.resizeModule.autoFitColumns(e),this.updateColumnModel()},d.prototype.reorderColumns=function(e,t){this.grid.reorderColumns(e,t)},d.prototype.TreeGridLocale=function(){var e=t.L10n.locale,r={};t.setValue(this.locale,{},r);var n;n={},n=i.getObject(this.locale,e);var o;o={},o=i.getObject(this.getModuleName(),n),t.setValue("grid",o,i.getObject(this.locale,r)),t.L10n.load(r)},d.prototype.print=function(){this.printModule.print()},d.prototype.treeGridkeyActionHandler=function(e){if(this.allowKeyboard){var i=void 0,r=void 0,n=void 0,o=void 0,a=void 0;switch(e.action){case"ctrlDownArrow":this.expandAll();break;case"ctrlUpArrow":this.collapseAll();break;case"ctrlShiftUpArrow":n=(i=e.target).closest(".e-rowcell"),t.isNullOrUndefined(n)||(o=n.closest("tr"),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.getElementsByClassName("e-treegridexpand")[0])||this.expandCollapseRequest(o.querySelector(".e-treegridexpand")));break;case"ctrlShiftDownArrow":n=(i=e.target).closest(".e-rowcell"),t.isNullOrUndefined(n)||(o=n.closest("tr"),t.isNullOrUndefined(o)||t.isNullOrUndefined(o.getElementsByClassName("e-treegridcollapse")[0])||this.expandCollapseRequest(o.querySelector(".e-treegridcollapse")));break;case"downArrow":if(!this.enableVirtualization){var s=(r=(i=e.target).parentElement).cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(s).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(s).edit.obj)&&(r=i),null!==(a=this.findnextRowElement(r))){var d=a.rowIndex;this.selectRow(d);var l=e.target.cellIndex,p=a.children[parseInt(l.toString(),10)];t.addClass([p],"e-focused"),t.addClass([p],"e-focus")}else this.clearSelection()}break;case"upArrow":if(!this.enableVirtualization){s=(r=(i=e.target).parentElement).cellIndex;if("dropdownedit"===this.grid.getColumnByIndex(s).editType&&t.isNullOrUndefined(this.grid.getColumnByIndex(s).edit.obj)&&(r=i),null!==(a=this.findPreviousRowElement(r))){var h=a.rowIndex;this.selectRow(h);var c=e.target.cellIndex,u=a.children[parseInt(c.toString(),10)];t.addClass([u],"e-focused"),t.addClass([u],"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),t.EventHandler.add(this.element,"mousemove",this.mouseMoveHandler,this),this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.treeGridkeyActionHandler.bind(this),keyConfigs:this.keyConfigs,eventName:"keydown"}),this.allowKeyboard&&(this.element.tabIndex=-1===this.element.tabIndex?0:this.element.tabIndex)},d.prototype.requiredModules=function(){var e=[];if(this.grid.splitFrozenCount(this.getColumns()),this.isDestroyed)return e;e.push({member:"filter",args:[this,this.filterSettings]}),t.isNullOrUndefined(this.toolbar)||e.push({member:"toolbar",args:[this]}),this.contextMenuItems&&e.push({member:"contextMenu",args:[this]}),this.allowPaging&&e.push({member:"pager",args:[this,this.pageSettings]}),this.allowReordering&&e.push({member:"reorder",args:[this]}),this.allowSorting&&e.push({member:"sort",args:[this]}),this.aggregates.length>0&&e.push({member:"summary",args:[this]}),e.push({member:"resize",args:[this]}),this.allowExcelExport&&e.push({member:"ExcelExport",args:[this]});var i=this.injectedModules.filter(function(e){return"freeze"===e.prototype.getModuleName()});return(this.frozenColumns||this.frozenRows||this.getFrozenColumns()||this.grid.getFrozenLeftColumnsCount()||this.grid.getFrozenRightColumnsCount()||i.length)&&e.push({member:"freeze",args:[this]}),this.detailTemplate&&e.push({member:"detailRow",args:[this]}),this.allowPdfExport&&e.push({member:"PdfExport",args:[this]}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this]}),this.showColumnChooser&&e.push({member:"ColumnChooser",args:[this]}),this.extendRequiredModules(e),e},d.prototype.extendRequiredModules=function(e){var i=this.injectedModules.filter(function(e){return"rowDragAndDrop"===e.prototype.getModuleName()});(this.allowRowDragAndDrop||i.length)&&(t.isNullOrUndefined(this.toolbar)||!this.toolbar.includes("Indent")&&!this.toolbar.includes("Outdent")||(this.isIndentEnabled=!0),e.push({member:"rowDragAndDrop",args:[this]})),(this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing)&&e.push({member:"edit",args:[this]}),this.isCommandColumn(this.columns)&&e.push({member:"commandColumn",args:[this]}),this.allowSelection&&e.push({member:"selection",args:[this]}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this]}),this.enableInfiniteScrolling&&e.push({member:"infiniteScroll",args:[this]}),e.push({member:"logger",args:[this.grid]})},d.prototype.isCommandColumn=function(e){var t=this;return e.some(function(e){return e.columns?t.isCommandColumn(e.columns):!(!e.commands&&!e.commandsTemplate)})},d.prototype.unwireEvents=function(){this.grid&&this.grid.element&&t.EventHandler.remove(this.grid.element,"click",this.mouseClickHandler)},d.prototype.log=function(e,t){this.loggerModule&&this.loggerModule.treeLog(e,t,this)},d.prototype.render=function(){var e=this;this.isReact&&(this.grid.isReact=!0,this.grid.portals=[]),this.isVue&&(this.grid.isVue=!0,this.grid.vueInstance=this.vueInstance),o.createSpinner({target:this.element},this.createElement),this.log(["mapping_fields_missing"]),this.renderModule=new Xe(this),this.dataModule=new $e(this),this.printModule=new He(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.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].setAttribute("tabindex","0");this.element.getElementsByClassName("e-content")[0].querySelector(".e-table").setAttribute("role","treegrid"),this.isIndentEnabled&&this.refreshToolbarItems(),this.wireEvents(),this.renderComplete();var n=this.grid.destroyTemplate;this.grid.destroyTemplate=function(i,r){n.apply(e.grid);e.isReact&&t.isNullOrUndefined(e.portals)||e.clearTemplate(i,r)}},d.prototype.refreshToolbarItems=function(){var e=this.toolbarModule.getToolbar(),t=this.element.id+"_gridcontrol_indent",i=this.element.id+"_gridcontrol_outdent",r=e.querySelector("#"+t).parentElement,n=e.querySelector("#"+i).parentElement;r.classList.add("e-hidden"),n.classList.add("e-hidden")},d.prototype.afterGridRender=function(){t.isNullOrUndefined(this.grid.clipboardModule)||this.grid.clipboardModule.destroy(),this.clipboardModule=this.grid.clipboardModule=new Fe(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);var e="templateDotnetInstance";this.grid[""+e]=this[""+e];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){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))||(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(Te,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(W,t),e.trigger(W,t)},this.grid.rowDeselected=function(i){e.selectedRowIndex=e.grid.selectedRowIndex,t.isNullOrUndefined(i.data)||e.notify(J,i),e.trigger(J,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(Y,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 j(e.grid)}},this.grid.printComplete=this.triggerEvents.bind(this),this.grid.actionFailure=this.triggerEvents.bind(this),this.extendedGridDataBoundEvent(),this.extendedGridEvents(),this.extendedGridActionEvents(),this.extendedGridEditEvents(),this.bindGridDragEvents(),this.bindCallBackEvents()},d.prototype.lastRowBorder=function(e,i){for(var r=0;r<e.cells.length;r++)i?t.addClass([e.cells[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(!m(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(H,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(X,t,function(r){r.cancel||e.notify(X,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")){var r=new n.Deferred;return e.trigger(he,i,function(e){r.resolve(e)}),r}i.cancel=!0}},d.prototype.extendedGridEditEvents=function(){var e=this;this.grid.dataStateChange=function(i){e.isExpandRefresh?(e.isExpandRefresh=!1,e.grid.dataSource={result:e.flatData,count:t.getValue("count",e.grid.dataSource)}):("infiniteScroll"!==i.action.requestType&&(e.infiniteScrollData=[]),e.trigger(Q,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(ge,i,function(t){t.cancel||e.notify(ge,t),o.resolve(t)}),o},this.grid.cellSaved=function(t){e.trigger(fe,t),e.notify(fe,t)},this.grid.cellEdit=function(t){var i=new n.Deferred;return t.promise=i,e.notify(ye,t),i},this.grid.batchAdd=function(t){e.trigger(Ie,t),e.notify(Ie,t)},this.grid.beforeBatchSave=function(t){e.trigger(Re,t),e.notify(Re,t)},this.grid.beforeBatchAdd=function(t){e.trigger(we,t),e.notify(we,t)},this.grid.batchDelete=function(t){e.trigger(me,t),e.notify(me,t)},this.grid.beforeBatchDelete=function(t){e.trigger(ve,t),e.notify(ve,t)},this.grid.batchCancel=function(t){"Cell"!==e.editSettings.mode&&e.trigger(Se,t),e.notify(Se,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(){var e="dataSource";if(this.dataSource&&s(this)){var i=this.flatData,r=t.getValue("count",this.dataSource);this.grid.dataSource={result:i,count:r}}else this.grid.dataSource=this.dataSource instanceof n.DataManager?new n.DataManager(this.dataSource.dataSource,this.dataSource.defaultQuery,this.dataSource.adaptor):this.flatData;if(this.dataSource instanceof n.DataManager&&(this.dataSource.dataSource.offline||this.dataSource.ready)){this.grid.dataSource[""+e].json=g(this.dataSource[""+e].json),this.grid.dataSource.ready=this.dataSource.ready;var o=this;t.isNullOrUndefined(this.grid.dataSource.ready)||this.grid.dataSource.ready.then(function(t){var i=o.grid.dataSource;i[""+e].offline=!0,i.isDataAvailable=!0,i[""+e].json=t.result,i.adaptor=new n.JsonAdaptor})}},d.prototype.extendedGridActionEvents=function(){var e=this;this.grid.actionBegin=function(r){"sorting"===r.requestType&&r.target&&r.target.parentElement&&r.target.parentElement.classList.contains("e-hierarchycheckbox")&&(r.cancel=!0);if("reorder"===i.getObject("requestType",r)&&e.notify("getColumnIndex",{}),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(G,r,function(t){t.cancel||e.notify(he,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(ce,t),"batchsave"===t.requestType&&e.notify(xe,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(K,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("."+Be),o=e.grid.element.querySelector("."+Le);n.style.height=o.style.height="auto"}e.trigger(K,t)}}},d.prototype.extendedGridEvents=function(){var e=this,i=this;this.grid.recordDoubleClick=function(t){e.trigger(ue,t),e.notify(ue,t)},this.grid.detailDataBound=function(t){e.notify("detaildataBound",t),e.trigger(Ae,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(le,t),e.trigger(le,t)},this.grid.contextMenuOpen=function(t){e.notify(de,t),e.trigger(de,t)},this.grid.queryCellInfo=function(t){e.renderModule.cellRender(t)}},d.prototype.bindGridDragEvents=function(){var e=this;this.grid.rowDragStartHelper=function(t){e.trigger(Ne,t)},this.grid.rowDragStart=function(t){e.trigger("rowDragStart",t)},this.grid.rowDrag=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(qe,t),e.trigger("rowDrag",t))},this.grid.rowDrop=function(t){e.grid.isEdit?t.cancel=!0:(e.notify(Ve,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 x(o)),s.push(a),!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex])&&this.enableRtl&&a.field===this.columnModel[this.treeColumnIndex].field&&(t.isNullOrUndefined(this.treeColumnTextAlign)&&(this.treeColumnTextAlign=this.columnModel[this.treeColumnIndex].textAlign,this.treeColumnField=this.columnModel[this.treeColumnIndex].field),a.textAlign="Right")}return s},d.prototype.onPropertyChanged=function(e){for(var r=!1,o=0,a=Object.keys(e);o<a.length;o++){var d=a[o];switch(d){case"treeColumnIndex":this.grid.refreshColumns();break;case"allowPaging":this.grid.allowPaging=this.allowPaging;break;case"pageSettings":this.grid.pageSettings=i.getActualProperties(this.pageSettings),r=!0;break;case"enableVirtualization":this.grid.enableVirtualization=this.enableVirtualization;break;case"enableColumnVirtualization":this.grid.enableColumnVirtualization=this.enableColumnVirtualization;break;case"toolbar":this.grid.toolbar=this.getGridToolbar();break;case"allowSelection":this.grid.allowSelection=this.allowSelection;break;case"selectionSettings":this.grid.selectionSettings=i.getActualProperties(this.selectionSettings);break;case"allowSorting":this.grid.allowSorting=this.allowSorting;break;case"allowMultiSorting":this.grid.allowMultiSorting=this.allowMultiSorting;break;case"sortSettings":this.grid.sortSettings=i.getActualProperties(this.sortSettings);break;case"searchSettings":this.grid.searchSettings=i.getActualProperties(this.searchSettings);break;case"allowFiltering":this.grid.allowFiltering=this.allowFiltering;break;case"filterSettings":this.initialRender||(this.grid.filterSettings=i.getActualProperties(this.filterSettings));break;case"showColumnMenu":this.grid.showColumnMenu=this.showColumnMenu;break;case"allowRowDragAndDrop":this.grid.allowRowDragAndDrop=this.allowRowDragAndDrop;break;case"aggregates":this.grid.aggregates=i.getActualProperties(this.aggregates);break;case"enableInfiniteScrolling":this.grid.enableInfiniteScrolling=this.enableInfiniteScrolling;break;case"dataSource":if(this.isLocalData=!(this.dataSource instanceof n.DataManager)||!t.isNullOrUndefined(this.dataSource.ready)||this.dataSource.adaptor instanceof n.RemoteSaveAdaptor,this.convertTreeData(this.dataSource),this.isLocalData){if(s(this)){var l=t.getValue("count",this.dataSource);this.grid.dataSource={result:this.flatData,count:l}}else{var p=this.dataSource;this.grid.dataSource=p instanceof n.DataManager?new n.DataManager(p.dataSource,p.defaultQuery,p.adaptor):this.flatData}this.enableVirtualization&&(this.grid.contentModule.isDataSourceChanged=!0)}else this.bindedDataSource(),this.enableVirtualization&&(this.grid.contentModule.removeEventListener(),this.grid.contentModule.eventListener("on"),this.grid.contentModule.renderTable());break;case"query":this.grid.query=this.query;break;case"enableCollapseAll":e[""+d]?this.collapseAll():this.expandAll();break;case"expandStateMapping":this.grid.refresh();break;case"gridLines":this.grid.gridLines=this.gridLines;break;case"rowTemplate":this.grid.rowTemplate=i.getActualProperties(this.rowTemplate);break;case"frozenRows":this.grid.frozenRows=this.frozenRows;break;case"frozenColumns":this.grid.frozenColumns=this.frozenColumns;break;case"rowHeight":this.grid.rowHeight=this.rowHeight;break;case"height":t.isNullOrUndefined(this.height)||"string"!=typeof this.height||-1===this.height.indexOf("%")||(this.element.style.height=this.height),this.grid.height=this.height;break;case"width":t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(this.element.style.width=this.width),this.grid.width=this.width;break;case"locale":this.grid.locale=this.locale,this.TreeGridLocale(),this.grid.toolbar=this.getGridToolbar(),this.grid.contextMenuItems=this.getContextMenu();break;case"selectedRowIndex":this.grid.selectedRowIndex=this.selectedRowIndex;break;case"enableAltRow":this.grid.enableAltRow=this.enableAltRow;break;case"enableHover":this.grid.enableHover=this.enableHover;break;case"enableAutoFill":this.grid.enableAutoFill=this.enableAutoFill;break;case"enableAdaptiveUI":this.grid.enableAdaptiveUI=this.enableAdaptiveUI;break;case"enableImmutableMode":this.grid.enableImmutableMode=this.enableImmutableMode;break;case"allowExcelExport":this.grid.allowExcelExport=this.allowExcelExport;break;case"allowPdfExport":this.grid.allowPdfExport=this.allowPdfExport;break;case"enableRtl":t.isNullOrUndefined(this.treeColumnField)||this.updateTreeColumnTextAlign(),this.grid.enableRtl=this.enableRtl;break;case"allowReordering":this.grid.allowReordering=this.allowReordering;break;case"allowResizing":this.grid.allowResizing=this.allowResizing;break;case"textWrapSettings":this.grid.textWrapSettings=i.getActualProperties(this.textWrapSettings);break;case"allowTextWrap":this.grid.allowTextWrap=i.getActualProperties(this.allowTextWrap),this.grid.refresh();break;case"contextMenuItems":this.grid.contextMenuItems=this.getContextMenu();break;case"showColumnChooser":this.grid.showColumnChooser=this.showColumnChooser;break;case"detailTemplate":this.grid.detailTemplate=i.getActualProperties(this.detailTemplate);break;case"columnMenuItems":this.grid.columnMenuItems=i.getActualProperties(this.columnMenuItems);break;case"editSettings":this.grid.isEdit&&"Normal"===this.grid.editSettings.mode&&e[""+d].mode&&("Cell"===e[""+d].mode||"Row"===e[""+d].mode)&&this.grid.closeEdit(),this.grid.editSettings=this.getGridEditSettings()}r&&this.grid.refresh()}},d.prototype.updateTreeColumnTextAlign=function(){this.grid.getColumnByField(this.treeColumnField).textAlign=this.enableRtl?"Right":this.treeColumnTextAlign,this.grid.refreshColumns()},d.prototype.destroy=function(){var e=this.element;if(e){var t=!(!e.querySelector(".e-gridheader")||!e.querySelector(".e-gridcontent"));t&&this.unwireEvents(),this.removeListener(),t&&r.prototype.destroy.call(this),this.grid&&this.grid.destroy(),this.dataModule&&this.dataModule.destroy();for(var i=["dataModule","sortModule","renderModule","filterModule","printModule","clipboardModule","excelExportModule","pdfExportModule","toolbarModule","summaryModule","reorderModule","resizeModule","pagerModule","keyboardModule","columnMenuModule","contextMenuModule","editModule","virtualScrollModule","selectionModule","detailRow","rowDragAndDropModule","freezeModule"],n=0;n<i.length;n++)this[i[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=0;r<e.length;r++)for(var n=this[e[parseInt(r.toString(),10)]],o=0,a=i[e[parseInt(r.toString(),10)]];!t.isNullOrUndefined(a)&&o<a.length;o++){delete n[""+a[parseInt(o.toString(),10)]]}return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(e)},d.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)t[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;if(!i.classList.contains("e-treegridexpand")&&!i.classList.contains("e-treegridcollapse")||this.isEditCollapse||this.grid.isEdit||this.expandCollapseRequest(i),this.isEditCollapse=!1,this.notify("checkboxSelection",{target:i}),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.mouseMoveHandler=function(e){var t=!1,r=this.getColumns();"EllipsisWithTooltip"===this.clipMode&&(t=!0);var n=i.parentsUntil(e.target,"e-ellipsistooltip");if((t||-1!==this.treeColumnIndex&&"EllipsisWithTooltip"===r[this.treeColumnIndex].clipMode)&&null!==n&&parseInt(n.getAttribute("data-colindex"),10)===this.treeColumnIndex&&n.children[0].scrollWidth>n.children[0].clientWidth){new o.Tooltip({content:n.textContent}).appendTo(n)}},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,t){this.grid.editModule&&this.grid.editModule.deleteRecord(e,t)},d.prototype.startEdit=function(e){this.grid.editModule&&this.grid.editModule.startEdit(e)},d.prototype.editCell=function(e,t){this.editModule&&this.editModule.editCell(e,t)},d.prototype.enableToolbarItems=function(e,t){this.grid.toolbarModule&&this.grid.toolbarModule.enableItems(e,t)},d.prototype.endEdit=function(){this.grid.editModule&&this.grid.editModule.endEdit()},d.prototype.openColumnChooser=function(e,t){this.columnChooserModule&&this.columnChooserModule.openColumnChooser(e,t)},d.prototype.deleteRow=function(e){this.grid.editModule&&this.grid.editModule.deleteRow(e)},d.prototype.getPrimaryKeyFieldNames=function(){return this.grid.getPrimaryKeyFieldNames()},d.prototype.setCellValue=function(e,i,r){this.grid.setCellValue(e,i,r);var n=this.grid.getRowIndexByPrimaryKey(e),o=this.getCurrentViewRecords()[parseInt(n.toString(),10)];t.isNullOrUndefined(o)||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){this.grid.pagerModule&&this.grid.pagerModule.goToPage(e)},d.prototype.updateExternalMessage=function(e){this.pagerModule&&this.grid.pagerModule.updateExternalMessage(e)},d.prototype.getCellFromIndex=function(e,t){return this.grid.getCellFromIndex(e,t)},d.prototype.getColumnByField=function(e){return i.iterateArrayOrObject(this.columnModel,function(t){if(t.field===e)return t})[0]},d.prototype.getColumnByUid=function(e){var t=this.initialRender?this.grid.columns:this.columns;return this.grid.columns.length!==this.columnModel.length&&(t=this.grid.columnModel),i.iterateArrayOrObject(t,function(t){if(t.uid===e)return t})[0]},d.prototype.getColumnFieldNames=function(){return this.grid.getColumnFieldNames()},d.prototype.getFooterContent=function(){return this.grid.getFooterContent()},d.prototype.getFooterContentTable=function(){return this.grid.getFooterContentTable()},d.prototype.showColumns=function(e,t){this.grid.showColumns(e,t),this.updateColumnModel()},d.prototype.hideColumns=function(e,t){this.grid.hideColumns(e,t),this.updateColumnModel()},d.prototype.getColumnHeaderByField=function(e){return this.grid.getColumnHeaderByField(e)},d.prototype.getColumnHeaderByIndex=function(e){return this.grid.getColumnHeaderByIndex(e)},d.prototype.getColumnHeaderByUid=function(e){return this.grid.getColumnHeaderByUid(e)},d.prototype.getColumnIndexByField=function(e){return this.grid.getColumnIndexByField(e)},d.prototype.getVirtualColIndexByUid=function(e){var r=i.iterateArrayOrObject(this.grid.columnModel,function(t,i){if(t.uid===e)return i})[0];return t.isNullOrUndefined(r)?-1:r},d.prototype.getColumnIndexByUid=function(e){return this.grid.getColumnIndexByUid(e)},d.prototype.getColumns=function(e){return this.updateColumnModel(this.grid.getColumns(e)),this.columnModel},d.prototype.updateColumnModel=function(e){var i,r,n=t.isNullOrUndefined(e)?this.grid.getColumns():e;-1!==this.treeColumnIndex&&this.columnModel[this.treeColumnIndex]&&!t.isNullOrUndefined(this.columnModel[this.treeColumnIndex].template)&&(i=this.columnModel[this.treeColumnIndex].template,r=this.columnModel[this.treeColumnIndex].field);var o;if(!this.enableColumnVirtualization||this.enableColumnVirtualization&&this.columnModel.length===n.length){this.columnModel=[];for(var a=0;a<n.length;a++){o={};for(var s=0,d=Object.keys(n[parseInt(a.toString(),10)]);s<d.length;s++){var l=d[s];o[""+l]=n[parseInt(a.toString(),10)][""+l]}this.columnModel.push(new x(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&&this.updateColumnsWidth(this.columns),this.stackedHeader||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(e.columns)i.updateColumnsWidth(e.columns);else if(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.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,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,r,n):this.trigger(te,d,function(t){o.expandAllPrevent=t.cancel,t.cancel||(t.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s,r,n))}),this.isExpandingEventTriggered=!0}else if(!this.isExpandAll||this.isExpandAll&&a(this)){d={data:i,row:e,cancel:!1};this.trigger(te,d,function(t){t.cancel||(t.expandAll&&o.expandCollapseAllChildren(i,"expand",r,n),o.expandRows(e,i,s,r,n))})}},d.prototype.expandRows=function(e,i,r,n,o){this.expandCollapse("expand",e,i);if((!a(this)||u(this))&&(!s(this)||!t.isNullOrUndefined(i.Children))){var d={data:i,row:e};t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(d.data,!0),this.isExpandAll&&!this.isExpandedEventTriggered?(this.isExpandedEventTriggered=!0,d={data:r,row:e},this.trigger(ee,d)):this.isExpandAll||this.trigger(ee,d)}},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.grid.getCurrentViewRecords()[parseInt(e.getAttribute("data-rowindex"),10)]),i},d.prototype.collapseRow=function(e,t,i){var r=this,n=this.parentData;if(this.enableVirtualization||(n=this.flatData.filter(function(e){return e.hasChildRecords})),t=this.getCollapseExpandRecords(e,t),this.isCollapseAll&&!a(this)){var o={data:n,row:e,cancel:!1};this.isCollapsingEventTriggered?this.allowPaging||this.collapseAllPrevent||!this.isCollapsingEventTriggered||this.collapseRows(e,t,n,i):this.trigger(re,o,function(o){r.collapseAllPrevent=o.cancel,o.cancel||(o.collapseAll&&r.expandCollapseAllChildren(t,"collapse",i),r.collapseRows(e,t,n,i))}),this.isCollapsingEventTriggered=!0}else if(!this.isCollapseAll||this.isCollapseAll&&a(this)){o={data:t,row:e,cancel:!1};this.trigger(re,o,function(o){o.cancel||r.collapseRows(e,t,n,i)})}},d.prototype.collapseRows=function(e,i,r,n){this.expandCollapse("collapse",e,i);var o={data:i,row:e};if(!a(this)&&(t.isNullOrUndefined(this.expandStateMapping)||this.updateExpandStateMapping(o.data,!1),this.isCollapseAll&&!this.isCollapsedEventTriggered?(this.isCollapsedEventTriggered=!0,o={data:r,row:e},this.trigger(ie,o)):this.isCollapseAll||this.trigger(ie,o),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((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!0),t.hasChildRecords&&t.level===e});this.expandAction(t,null,e,!0)}else{t=this.getRecordDetails(e);var r=i.getObject("records",t);this.expandAction(r,null,e)}},d.prototype.expandByKey=function(e){this.expandCollapseActionByKey(e,"Expand")},d.prototype.expandAction=function(e,i,r,n){void 0===n&&(n=!1);for(var o=function(o){if(!t.isNullOrUndefined(e[parseInt(o.toString(),10)].parentItem)){var d=e[parseInt(o.toString(),10)].parentItem.uniqueID,l=s.flatData.filter(function(e){return e.uniqueID===d});a(s)&&(l=s.getCurrentViewRecords().filter(function(e){return e.uniqueID===d})),!1===l[0].expanded?(e.push(l[0]),l[0].expanded=!0):h(s,l[0],s.parentData)||l[0].expanded&&void 0!==l[0].parentItem&&e.push(l[0])}n||s.expandRow(null,e[parseInt(o.toString(),10)],i,r)},s=this,d=0;d<e.length;d++)o(d);n&&this.expandRow(null,e,i,r)},d.prototype.getRecordDetails=function(e){var t=this.getRows().filter(function(t){return-1!==t.className.indexOf("level"+e)&&(t.querySelector(".e-treegridcollapse")||t.querySelector(".e-treegridexpand"))});return{records:this.getCurrentViewRecords().filter(function(t){return t.level===e&&t.hasChildRecords}),rows:t}},d.prototype.collapseAtLevel=function(e){if((this.allowPaging&&"All"===this.pageSettings.pageSizeMode||this.enableVirtualization)&&!a(this)){var t=this.grid.dataSource.filter(function(t){return t.hasChildRecords&&t.level===e&&(t.expanded=!1),t.hasChildRecords&&t.level===e});this.collapseAction(t,null,!0)}else{var r=this.getRecordDetails(e),n=i.getObject("records",r);this.collapseAction(n)}},d.prototype.collapseByKey=function(e){this.expandCollapseActionByKey(e,"Collapse")},d.prototype.expandCollapseActionByKey=function(e,i){var r=this.getPrimaryKeyFieldNames()[0],n=a(this)?this.getCurrentViewRecords():this.grid.dataSource;if(!t.isNullOrUndefined(r)){var o=n.filter(function(t){return t[""+r].toString()===e.toString()});"Expand"===i?this.expandAction(o,e,null):this.collapseAction(o,e)}},d.prototype.collapseAction=function(e,t,i){if(void 0===i&&(i=!1),i)this.collapseRow(null,e);else for(var r=0;r<e.length;r++)this.collapseRow(null,e[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(){this.isExpandedEventTriggered=!1,this.isExpandingEventTriggered=!1,this.expandCollapseAll("expand")},d.prototype.collapseAll=function(){this.isCollapsedEventTriggered=!1,this.isCollapsingEventTriggered=!1,this.expandCollapseAll("collapse")},d.prototype.expandCollapseAll=function(e){var i=this.getRows().filter(function(t){return t.querySelector(".e-treegrid"+("expand"===e?"collapse":"expand"))});if(!i.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(var r=0;r<i.length;r++)"collapse"===e?t.isNullOrUndefined(this.getCurrentViewRecords()[i[parseInt(r.toString(),10)].rowIndex])||this.collapseRow(i[parseInt(r.toString(),10)]):this.enableVirtualization?"true"!==i[0].getAttribute("aria-expanded")&&this.expandRow(i[0]):this.expandRow(i[parseInt(r.toString(),10)]);else if(this.allowPaging){var n=this.enableCollapseAll;this.setProperties({enableCollapseAll:!0},!0),this.grid.pagerModule.goToPage(1),this.setProperties({enableCollapseAll:n},!0)}}else for(r=0;r<i.length;r++)"collapse"===e?this.collapseRow(i[parseInt(r.toString(),10)]):this.expandRow(i[parseInt(r.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){var g=this.getContentTable().rows;c=[].slice.call(g)}var f;if(t.isNullOrUndefined(i)?(f=this.grid.currentViewData.indexOf(r),i=c[parseInt(f.toString(),10)]):f=+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 y=void 0;if("expand"===e){if(y="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(y="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 S=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 I=this.getVisibleRecords()[this.getVisibleRecords().length-1].index,v=this.getRowByIndex(I);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 R=this.getRows(),x=(g=this.getContentTable().rows,(R=[].slice.call(g)).length-1);x>=0;x--)if(!m(R[parseInt(x.toString(),10)])){var C=this.getContentTable().scrollHeight,b=this.getContent().clientHeight;this.lastRowBorder(R[parseInt(x.toString(),10)],C<=b);break}this.notify("rowExpandCollapse",{detailrows:S,action:y,record:r,row:i}),this.updateAltRow(c)}else this.notify(oe,{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);this.dataResults.result=o}else{var d=new n.Deferred;e.childDataBind=d.resolve;var l=e.data;this.trigger(Q,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}var d=t.getValue("result",r.dataSource),p=g(e.childData),h=l[r.childMapping]&&l[r.childMapping].length>p.length?l[r.childMapping].length:p.length;for(a=0;a<h;a++)l[r.childMapping]&&d.filter(function(e,t){e[r.parentIdMapping]===l[r.idMapping]&&d.splice(t,1)}),p[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(ee,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(ne,{record:i,rows:a,parentRow:t});var s={row:t,data:i};a.length>0&&this.trigger(ee,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(ie,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(var g=0;g<o.length;g++){var f=this.grid.getRowIndexByPrimaryKey(o[parseInt(g.toString(),10)][""+u]);n.push(this.getRows()[parseInt(f.toString(),10)])}}else n=p.filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))});var y=this.grid.getFrozenLeftColumnsCount()>0||this.grid.getFrozenRightColumnsCount()>0;(this.frozenRows||this.frozenColumns||this.getFrozenColumns()||y)&&(d=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))})),y&&(l=this.getRows().filter(function(e){return e.querySelector(".e-gridrowindex"+r.index+"level"+(r.level+1))}));var m=this.grid.getRowsObject(),S=this.grid.currentViewData,I=S.filter(function(e){return e.uniqueID===r.uniqueID}),v=S.indexOf(I[0]);t.isNullOrUndefined(m[parseInt(v.toString(),10)].visible)||!1===m[parseInt(v.toString(),10)].visible||(m[parseInt(v.toString(),10)].visible=!0);var w=p.filter(function(e){return e.classList.contains("e-griddetailrowindex"+r.index+"level"+(r.level+1))});for(g=0;g<n.length;g++){if(t.isNullOrUndefined(n[parseInt(g.toString(),10)])||(n[parseInt(g.toString(),10)].style.display=c),!t.isNullOrUndefined(n[parseInt(g.toString(),10)])&&!this.allowPaging&&!(this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this))){m[n[parseInt(g.toString(),10)].rowIndex].visible="none"!==c;var R=S.filter(function(e){return e.uniqueID===I[0].parentUniqueID});!t.isNullOrUndefined(R[0])&&p[S.indexOf(R[0])].getElementsByClassName("e-treegridcollapse").length&&(m[parseInt(v.toString(),10)].visible=!1)}t.isNullOrUndefined(d)||(d[parseInt(g.toString(),10)].style.display=c),t.isNullOrUndefined(l)||(l[parseInt(g.toString(),10)].style.display=c),this.notify("childRowExpand",{row:n[parseInt(g.toString(),10)]}),!t.isNullOrUndefined(o[parseInt(g.toString(),10)].childRecords)&&o[parseInt(g.toString(),10)].childRecords.length>0&&("expand"!==e||t.isNullOrUndefined(o[parseInt(g.toString(),10)].expanded)||o[parseInt(g.toString(),10)].expanded)&&(this.expandCollapse(e,n[parseInt(g.toString(),10)],o[parseInt(g.toString(),10)],!0),this.frozenColumns<=this.treeColumnIndex&&!t.isNullOrUndefined(d)&&this.expandCollapse(e,d[parseInt(g.toString(),10)],o[parseInt(g.toString(),10)],!0))}for(g=0;g<w.length;g++)t.isNullOrUndefined(w[parseInt(g.toString(),10)])||this.allowPaging||this.enableVirtualization||this.enableInfiniteScrolling||a(this)||s(this)||(m[w[parseInt(g.toString(),10)].rowIndex].visible="none"!==c,w[parseInt(g.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){i||(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,t,i,r,n,o,a,s){this.grid.filterByColumn(e,t,i,r,n,o,a,s)},d.prototype.clearFiltering=function(){this.grid.clearFiltering()},d.prototype.removeFilteredColsByField=function(e,t){this.grid.removeFilteredColsByField(e,t)},d.prototype.selectRow=function(e,t){this.grid.selectRow(e,t)},d.prototype.selectRows=function(e){this.grid.selectRows(e)},d.prototype.clearSelection=function(){this.grid.clearSelection()},d.prototype.copy=function(e){this.clipboardModule.copy(e)},d.prototype.paste=function(e,t,i){this.clipboardModule.paste(e,t,i)},d.prototype.selectCell=function(e,t){this.grid.selectCell(e,t)},d.prototype.getSelectedRows=function(){return this.grid.getSelectedRows()},d.prototype.getMovableCellFromIndex=function(e,t){return this.grid.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(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,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},d.prototype.indent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"indent"))},d.prototype.outdent=function(e){t.isNullOrUndefined(this.rowDragAndDropModule)||(e=e,this.rowDragAndDropModule[this.indentOutdentAction](e,"outdent"))};var l;return mt([t.Property(0)],d.prototype,"frozenRows",void 0),mt([t.Property(0)],d.prototype,"frozenColumns",void 0),mt([t.Property("Ellipsis")],d.prototype,"clipMode",void 0),mt([t.Property([])],d.prototype,"columns",void 0),mt([t.Property(null)],d.prototype,"childMapping",void 0),mt([t.Property(null)],d.prototype,"hasChildMapping",void 0),mt([t.Property(0)],d.prototype,"treeColumnIndex",void 0),mt([t.Property(null)],d.prototype,"idMapping",void 0),mt([t.Property(null)],d.prototype,"parentIdMapping",void 0),mt([t.Property(!1)],d.prototype,"enableCollapseAll",void 0),mt([t.Property(null)],d.prototype,"expandStateMapping",void 0),mt([t.Property(!1)],d.prototype,"allowRowDragAndDrop",void 0),mt([t.Property([])],d.prototype,"dataSource",void 0),mt([t.Property()],d.prototype,"query",void 0),mt([t.Property()],d.prototype,"cloneQuery",void 0),mt([t.Property("AllPages")],d.prototype,"printMode",void 0),mt([t.Property(!1)],d.prototype,"allowPaging",void 0),mt([t.Property(!1)],d.prototype,"loadChildOnDemand",void 0),mt([t.Property(!1)],d.prototype,"allowTextWrap",void 0),mt([t.Complex({},q)],d.prototype,"textWrapSettings",void 0),mt([t.Property(!1)],d.prototype,"allowReordering",void 0),mt([t.Property(!1)],d.prototype,"allowResizing",void 0),mt([t.Property(!1)],d.prototype,"autoCheckHierarchy",void 0),mt([t.Complex({},tt)],d.prototype,"pageSettings",void 0),mt([t.Complex({},i.RowDropSettings)],d.prototype,"rowDropSettings",void 0),mt([t.Property("USD")],d.prototype,"currencyCode",void 0),mt([t.Property()],d.prototype,"pagerTemplate",void 0),mt([t.Property(!1)],d.prototype,"showColumnMenu",void 0),mt([t.Property(!1)],d.prototype,"showColumnChooser",void 0),mt([t.Property(!1)],d.prototype,"allowSorting",void 0),mt([t.Property(!0)],d.prototype,"allowMultiSorting",void 0),mt([t.Complex({},ct)],d.prototype,"sortSettings",void 0),mt([t.Collection([],ot)],d.prototype,"aggregates",void 0),mt([t.Complex({},dt)],d.prototype,"editSettings",void 0),mt([t.Property(!1)],d.prototype,"allowFiltering",void 0),mt([t.Property()],d.prototype,"detailTemplate",void 0),mt([t.Complex({},N)],d.prototype,"filterSettings",void 0),mt([t.Complex({},Ke)],d.prototype,"searchSettings",void 0),mt([t.Property()],d.prototype,"toolbar",void 0),mt([t.Property()],d.prototype,"toolbarTemplate",void 0),mt([t.Property("Default")],d.prototype,"gridLines",void 0),mt([t.Property()],d.prototype,"contextMenuItems",void 0),mt([t.Property()],d.prototype,"columnMenuItems",void 0),mt([t.Property()],d.prototype,"rowTemplate",void 0),mt([t.Property("Parent")],d.prototype,"copyHierarchyMode",void 0),mt([t.Property(null)],d.prototype,"rowHeight",void 0),mt([t.Property(!0)],d.prototype,"enableAltRow",void 0),mt([t.Property(!0)],d.prototype,"allowKeyboard",void 0),mt([t.Property(!1)],d.prototype,"enableHover",void 0),mt([t.Property(!1)],d.prototype,"enableAutoFill",void 0),mt([t.Property(!1)],d.prototype,"enableAdaptiveUI",void 0),mt([t.Property(!1)],d.prototype,"enableImmutableMode",void 0),mt([t.Property("auto")],d.prototype,"height",void 0),mt([t.Property("auto")],d.prototype,"width",void 0),mt([t.Complex({},O)],d.prototype,"loadingIndicator",void 0),mt([t.Property(!0)],d.prototype,"enableVirtualMaskRow",void 0),mt([t.Property(!1)],d.prototype,"enableVirtualization",void 0),mt([t.Property(!1)],d.prototype,"enableColumnVirtualization",void 0),mt([t.Property(!1)],d.prototype,"enableHtmlSanitizer",void 0),mt([t.Property(!1)],d.prototype,"enableInfiniteScrolling",void 0),mt([t.Complex({},ft)],d.prototype,"infiniteScrollSettings",void 0),mt([t.Property("All")],d.prototype,"columnQueryMode",void 0),mt([t.Event()],d.prototype,"created",void 0),mt([t.Event()],d.prototype,"load",void 0),mt([t.Event()],d.prototype,"expanding",void 0),mt([t.Event()],d.prototype,"expanded",void 0),mt([t.Event()],d.prototype,"collapsing",void 0),mt([t.Event()],d.prototype,"collapsed",void 0),mt([t.Event()],d.prototype,"cellSave",void 0),mt([t.Event()],d.prototype,"cellSaved",void 0),mt([t.Event()],d.prototype,"actionBegin",void 0),mt([t.Event()],d.prototype,"actionComplete",void 0),mt([t.Event()],d.prototype,"beginEdit",void 0),mt([t.Event()],d.prototype,"batchAdd",void 0),mt([t.Event()],d.prototype,"batchDelete",void 0),mt([t.Event()],d.prototype,"batchCancel",void 0),mt([t.Event()],d.prototype,"beforeBatchAdd",void 0),mt([t.Event()],d.prototype,"beforeBatchDelete",void 0),mt([t.Event()],d.prototype,"beforeBatchSave",void 0),mt([t.Event()],d.prototype,"cellEdit",void 0),mt([t.Event()],d.prototype,"actionFailure",void 0),mt([t.Event()],d.prototype,"dataBound",void 0),mt([t.Event()],d.prototype,"dataSourceChanged",void 0),mt([t.Event()],d.prototype,"dataStateChange",void 0),mt([t.Event()],d.prototype,"recordDoubleClick",void 0),mt([t.Event()],d.prototype,"rowDataBound",void 0),mt([t.Event()],d.prototype,"detailDataBound",void 0),mt([t.Event()],d.prototype,"queryCellInfo",void 0),mt([t.Property(!0)],d.prototype,"allowSelection",void 0),mt([t.Event()],d.prototype,"rowSelecting",void 0),mt([t.Event()],d.prototype,"rowSelected",void 0),mt([t.Event()],d.prototype,"rowDeselecting",void 0),mt([t.Event()],d.prototype,"rowDeselected",void 0),mt([t.Event()],d.prototype,"headerCellInfo",void 0),mt([t.Event()],d.prototype,"cellSelecting",void 0),mt([t.Event()],d.prototype,"columnMenuOpen",void 0),mt([t.Event()],d.prototype,"columnMenuClick",void 0),mt([t.Event()],d.prototype,"cellSelected",void 0),mt([t.Event()],d.prototype,"cellDeselecting",void 0),mt([t.Event()],d.prototype,"cellDeselected",void 0),mt([t.Event()],d.prototype,"resizeStart",void 0),mt([t.Event()],d.prototype,"resizing",void 0),mt([t.Event()],d.prototype,"resizeStop",void 0),mt([t.Event()],d.prototype,"columnDragStart",void 0),mt([t.Event()],d.prototype,"columnDrag",void 0),mt([t.Event()],d.prototype,"columnDrop",void 0),mt([t.Event()],d.prototype,"checkboxChange",void 0),mt([t.Event()],d.prototype,"printComplete",void 0),mt([t.Event()],d.prototype,"beforePrint",void 0),mt([t.Event()],d.prototype,"toolbarClick",void 0),mt([t.Event()],d.prototype,"beforeDataBound",void 0),mt([t.Event()],d.prototype,"contextMenuOpen",void 0),mt([t.Event()],d.prototype,"contextMenuClick",void 0),mt([t.Event()],d.prototype,"beforeCopy",void 0),mt([t.Event()],d.prototype,"beforePaste",void 0),mt([t.Event()],d.prototype,"rowDrag",void 0),mt([t.Event()],d.prototype,"rowDragStart",void 0),mt([t.Event()],d.prototype,"rowDragStartHelper",void 0),mt([t.Event()],d.prototype,"rowDrop",void 0),mt([t.Property(-1)],d.prototype,"selectedRowIndex",void 0),mt([t.Complex({},Je)],d.prototype,"selectionSettings",void 0),mt([t.Property(!1)],d.prototype,"allowExcelExport",void 0),mt([t.Property(!1)],d.prototype,"allowPdfExport",void 0),mt([t.Event()],d.prototype,"pdfQueryCellInfo",void 0),mt([t.Event()],d.prototype,"pdfHeaderQueryCellInfo",void 0),mt([t.Event()],d.prototype,"excelQueryCellInfo",void 0),mt([t.Event()],d.prototype,"excelHeaderQueryCellInfo",void 0),mt([t.Event()],d.prototype,"beforeExcelExport",void 0),mt([t.Event()],d.prototype,"excelExportComplete",void 0),mt([t.Event()],d.prototype,"beforePdfExport",void 0),mt([t.Event()],d.prototype,"pdfExportComplete",void 0),d=l=mt([t.NotifyPropertyChanges],d)}(t.Component),It=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}(),vt=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}(),wt=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(qe,this.Rowdraging,this),this.parent.on(Ve,this.rowDropped,this),this.parent.on(Ue,this.rowsAdded,this),this.parent.on(ke,this.rowsRemoved,this)},e.prototype.reorderRows=function(e,i,r){var n=this.parent,o="updateRowAndCellElements";if(e[0]!==i&&-1!==["above","below","child"].indexOf(r)){"above"===r&&(this.dropPosition="topSegment"),"below"===r&&(this.dropPosition="bottomSegment"),"child"===r&&(this.dropPosition="middleSegment"),this.parent.dropPosition=this.dropPosition;for(var a=[],d=0;d<e.length;d++){var l=this.parent.getRowByIndex(e[parseInt(d.toString(),10)]).rowIndex;a[parseInt(d.toString(),10)]=this.parent.getCurrentViewRecords()[parseInt(l.toString(),10)]}var p={data:a,dropIndex:i};if(s(this.parent)||this.dropRows(p,!0),n.isLocalData&&(n.flatData=this.orderToIndex(n.flatData)),"outdenting"===this.parent.action&&(t.isNullOrUndefined(a[0].parentItem)||(a[0].level=a[0].parentItem.level+1)),this.parent.grid.refresh(),this.parent.enableImmutableMode&&"middleSegment"===this.dropPosition){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"indenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var h=this.parent.getRows()[e[0]],c=p.data[0],u=[];(m=[]).push(c),u.push(h);var g=y(this.parent,p.data[0].parentUniqueID),f=this.parent.getRows()[parseInt(i.toString(),10)];m.push(g),u.push(f),this.parent[""+o](m,u,l)}if(this.parent.enableImmutableMode&&"outdenting"===this.parent.action){l=void 0;this.parent.allowRowDragAndDrop?l=this.parent.treeColumnIndex+1:"outdenting"===this.parent.action&&(l=this.parent.treeColumnIndex);var m,S=p.data[0];h=this.parent.getRows()[e[0]],u=[];(m=[]).push(S),u.push(h),this.parent[""+o](m,u,l)}}},e.prototype.indentOutdentAction=function(e,i){var r=this.parent,n=-1;if(!t.isNullOrUndefined(e)||-1!==this.parent.selectedRowIndex){this.parent.enableVirtualization&&-1!==this.parent.selectedRowIndex?n=this.parent.getSelectedRows()[0].rowIndex:-1!==this.parent.selectedRowIndex&&(n=this.parent.selectedRowIndex),this.selectedItem=t.isNullOrUndefined(e)?r.getCurrentViewRecords()[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(var l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[parseInt(l.toString(),10)].taskData===s.parentItem.taskData&&(d=l,r.enableVirtualization&&(d=parseInt(r.getRows()[parseInt(l.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;d=void 0;var p=this.selectedRecord.parentItem;for(l=0;l<r.getCurrentViewRecords().length;l++)r.getCurrentViewRecords()[parseInt(l.toString(),10)].uniqueID===p.uniqueID&&(d=l);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(G,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){var l,p=this.parent,h=e.records;for(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]=[]),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)){var s=this.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords;for(l=0;l<s.length;l++)o.parentItem.taskData[this.parent.childMapping][parseInt(l.toString(),10)]=s[parseInt(l.toString(),10)].taskData}}else{for(var d=Object.keys(e),l=0;l<d.length;l++)e[parseInt(l.toString(),10)][this.parent.childMapping]===o.taskData[this.parent.childMapping]&&(i=l);"topSegment"===this.dropPosition?this.parent.idMapping||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.idMapping||e.splice(i+1,0,r.taskData))}this.parent.parentIdMapping&&(r.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(r[this.parent.parentIdMapping]=o[this.parent.parentIdMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.parentIdMapping]):(r[this.parent.parentIdMapping]=o[this.parent.idMapping],r.taskData[this.parent.parentIdMapping]=o[this.parent.idMapping]):(r.taskData[this.parent.parentIdMapping]=null,r[this.parent.parentIdMapping]=null))},e.prototype.removeFirstrowBorder=function(e){var t="bottomSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-firstrow-border").length>0&&e&&(0!==e.rowIndex||t)&&this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove()},e.prototype.removeLastrowBorder=function(e){var t,i=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow")),r=(t=this.parent.enableVirtualization?e&&!i&&this.parent.getRows()[this.parent.getCurrentViewRecords().length-1].getAttribute("data-uid")!==e.getAttribute("data-uid"):e&&!i&&this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length-1).getAttribute("data-uid")!==e.getAttribute("data-uid"))||"topSegment"===this.dropPosition;this.parent.element.getElementsByClassName("e-lastrow-border").length>0&&e&&(t||r)&&this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove()},e.prototype.updateIcon=function(e,r,n){var o=n.target?t.closest(n.target,"tr"):null;this.dropPosition=void 0;var a=0;this.removeFirstrowBorder(o),this.removeLastrowBorder(o);for(var s=0;s<n.rows.length;s++)(t.isNullOrUndefined(o)||o.getAttribute("data-uid")!==n.rows[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,y=f+g,m=y+g,S=i.getObject("originalEvent.event",n),I=i.getObject("originalEvent.event",n),v="mousemove"===S.type?S.pageY:t.isNullOrUndefined(I)||t.isNullOrUndefined(I.changedTouches)?null:I.changedTouches[0].pageY,w=v<=f,R=v>f&&v<=y,x=v>y&&v<=m;if(w||R||x){if(w&&"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){if((l=i.parentsUntil(e.target,"e-treegrid"))&&l.id===this.parent.rowDropSettings.targetID){l.ej2_instances[0].rowDragAndDropModule.updateIcon(e.rows,a,e)}}if(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)){var l;(l=i.parentsUntil(e.target,"e-treegrid"))||(n.style.cursor="default")}},e.prototype.rowDropped=function(e){var r=this.parent;if(r.rowDropSettings.targetID?(e.target&&t.closest(e.target,"#"+r.rowDropSettings.targetID)||i.parentsUntil(e.target,"e-treegrid")&&i.parentsUntil(e.target,"e-treegrid").id===r.rowDropSettings.targetID||e.target&&document.getElementById(r.rowDropSettings.targetID))&&(t.setValue("dropPosition",this.dropPosition,e),r.trigger("rowDrop",e),!e.cancel&&r.rowDropSettings.targetID&&(this.dragDropGrid(e),r.isLocalData&&(r.flatData=this.orderToIndex(r.flatData)))):i.parentsUntil(e.target,"e-content")&&(this.parent.element.querySelector(".e-errorelem")&&(this.dropPosition="Invalid"),t.setValue("dropPosition",this.dropPosition,e),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=y(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){var f=[];for(u=0;u<p.length;u++)if(p[parseInt(u.toString(),10)].hasChildRecords){f.push(p[parseInt(u.toString(),10)]);for(var y=c(p[parseInt(u.toString(),10)]),m=0;m<y.length;m++)f.push(y[parseInt(m.toString(),10)])}f.length&&(p=f)}n.notify(ke,{indexes:h,records:p}),r.notify(Ue,{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 I=t.getValue("uniqueIDCollection."+S[parseInt(u.toString(),10)].parentUniqueID+".index",r);S[parseInt(u.toString(),10)].parentItem.index=I}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=y(this.parent,a.parentItem.uniqueID)}if("middleSegment"===this.dropPosition){this.parent.getCurrentViewRecords()[parseInt(r.toString(),10)].level===i.level?this.droppedRecord=y(this.parent,i.uniqueID):this.getParentData(i)}},e.prototype.dropRows=function(e,i){if("Invalid"!==this.dropPosition&&!a(this.parent)){var r,n=this.parent,o=void 0;if(t.isNullOrUndefined(e.dropIndex)){var s=this.parent.getPrimaryKeyFieldNames()[0],d=-1===n.selectedRowIndex?this.parent.grid.getRowIndexByPrimaryKey(e.data[0][""+s])-1:n.getSelectedRowIndexes()[0]-1,l=n.getCurrentViewRecords()[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=function(a){if(r=h[parseInt(a.toString(),10)],y.draggedRecord=r,"Invalid"!==y.dropPosition){if(n.rowDropSettings.targetID&&!i||y.deleteDragRow(),y.draggedRecord===y.droppedRecord){var s=y.getTargetIdx(e.target.offsetParent.parentElement);isNaN(s)&&(s=y.getTargetIdx(e.target.parentElement)),e.dropIndex=s,o=y.droppedRecord=y.parent.getCurrentViewRecords()[e.dropIndex]}if(o.parentItem||"middleSegment"===y.dropPosition){-1!==(g=(u=n.parentData).indexOf(y.draggedRecord))&&u.splice(g,1)}var d=y.treeGridData.indexOf(o);if(y.dropAtTop(d),"bottomSegment"===y.dropPosition){if(o.hasChildRecords?(c=y.getChildCount(o,0),y.parent.parentIdMapping&&y.treeData.splice(d+c+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+c+1,0,y.draggedRecord)):(y.parent.parentIdMapping&&y.treeData.splice(d+1,0,y.draggedRecord.taskData),y.treeGridData.splice(d+1,0,y.draggedRecord)),t.isNullOrUndefined(o.parentItem)&&(delete r.parentItem,delete r.parentUniqueID,r.level=0,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=null)),o.parentItem){var l=y.getChildrecordsByParentID(o.parentUniqueID)[0].childRecords,p=l.indexOf(o)+1;l.splice(p,0,r),r.parentItem=o.parentItem,r.parentUniqueID=o.parentUniqueID,r.level=o.level,y.parent.parentIdMapping&&(r[y.parent.parentIdMapping]=o[y.parent.parentIdMapping],r.parentItem=o.parentItem,r.level=o.level)}if(r.hasChildRecords){y.updateChildRecordLevel(r,1),y.updateChildRecord(r,d+c+1)}}y.dropMiddle(d)}if(t.isNullOrUndefined(r.parentItem)){var u,g=(u=n.parentData).indexOf(y.droppedRecord),f=0;u.filter(function(e){r.uniqueID===e.uniqueID&&f++}),"bottomSegment"===y.dropPosition&&0===f?u.splice(g+1,0,r):"topSegment"===y.dropPosition&&0===f&&u.splice(g,0,r)}n.rowDragAndDropModule.refreshGridDataSource()},y=this,m=0;m<g;m++)f(m)}},e.prototype.dropMiddle=function(e){var i=this.parent,r=c(this.droppedRecord),n=t.isNullOrUndefined(r)||0===r.length?e+1:r.length+e+1;"middleSegment"===this.dropPosition&&(i.parentIdMapping?(this.treeData.splice(n,0,this.draggedRecord.taskData),this.treeGridData.splice(n,0,this.draggedRecord)):this.treeGridData.splice(n,0,this.draggedRecord),this.recordLevel(),this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,n))},e.prototype.dropAtTop=function(e){var t=this.parent;if("topSegment"===this.dropPosition){if(t.parentIdMapping&&this.treeData.splice(e,0,this.draggedRecord.taskData),this.draggedRecord.parentItem=this.treeGridData[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=y(this.parent,this.draggedRecord.uniqueID);!t.isNullOrUndefined(e.childRecords)&&e.childRecords.length&&(e.hasChildRecords=!0),this.removeRecords(e)},e.prototype.updateChildRecord=function(e,i){var r,n=this.parent,o=0;if(!e.hasChildRecords)return 0;o=e.childRecords.length;for(var a=0;a<o;a++)r=this.isMultipleGrid?e.childRecords[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=y(this.parent,e.parentItem.uniqueID)),t.isNullOrUndefined(a)&&!t.isNullOrUndefined(e.parentItem)&&(a=e.parentItem),r.level=e.parentItem?a.level+i:e.level+1,r.hasChildRecords&&(i--,i=this.updateChildRecordLevel(r,i))}return i},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;var o=e,a=!t.isNullOrUndefined(r.parentIdMapping),s=this.getChildrecordsByParentID(o.parentUniqueID)[0];if(o){if(o.parentItem){var d=s?s.childRecords:[],l=0;d&&d.length>0&&(l=d.indexOf(o),s.childRecords.splice(l,1),this.parent.parentIdMapping&&!r.enableImmutableMode||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 y=this.parent.parentData.indexOf(o);-1!==y&&(r.parentData.splice(y,1),i.splice(y,1))}if(-1===f&&!r.parentIdMapping)for(var m=r.getPrimaryKeyFieldNames()[0],I=0;I<this.treeGridData.length;I++)this.treeGridData[parseInt(I.toString(),10)][""+m]===o[""+m]&&(f=I);if(!r.parentIdMapping){var v=this.getChildCount(o,0);this.treeGridData.splice(f,v+1)}o.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(s.expanded=!1,s.hasChildRecords=!1,s.hasFilteredChildRecords=!1),-1!==this.parent[this.modifiedRecords].indexOf(s)||t.isNullOrUndefined(s)||this.parent[this.modifiedRecords].push(s),t.isNullOrUndefined(s)||this.updateModifiedRecords(s)}},e.prototype.updateModifiedRecords=function(e){var i=y(this.parent,e.parentUniqueID);t.isNullOrUndefined(i)||(this.parent[this.modifiedRecords].push(i),this.updateModifiedRecords(i))},e.prototype.removeChildItem=function(e){var i,r,o,a;a=this.parent.dataSource instanceof n.DataManager&&u(this.parent)?this.parent.dataSource.dataSource.json:this.parent.dataSource;for(var s=0;s<e.childRecords.length;s++){i=e.childRecords[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(qe,this.Rowdraging),this.parent.off(Ve,this.rowDropped),this.parent.off(Ue,this.rowsAdded),this.parent.off(ke,this.rowsRemoved))},e.prototype.getModuleName=function(){return"rowDragAndDrop"},e}(),Rt=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)}}(),xt=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},Ct=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Rt(i,e),xt([t.Property()],i.prototype,"targetID",void 0),i}(t.ChildProperty),bt=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)}}(),Dt=function(e){function i(t){var i=e.call(this,t)||this;return i.addEventListener(),i}return bt(i,e),i.prototype.addEventListener=function(){this.parent.on(Me,this.getDatas,this)},i.prototype.getDatas=function(e){this.visualData=e.data},i.prototype.getDataInfo=function(){return e.prototype.getData.call(this)},i.prototype.generateRows=function(i,r){!t.isNullOrUndefined(r.virtualInfo)&&r.virtualInfo.loadNext&&r.virtualInfo.nextInfo.page!==this.parent.pageSettings.currentPage?this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.nextInfo.page}},!0):t.isNullOrUndefined(r.virtualInfo)||r.virtualInfo.loadNext||r.virtualInfo.page===this.parent.pageSettings.currentPage||this.parent.setProperties({pageSettings:{currentPage:r.virtualInfo.page}},!0);var o=this.getDataInfo();if(t.isNullOrUndefined(r.virtualInfo)||("right"!==r.virtualInfo.direction&&"left"!==r.virtualInfo.direction?(this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))&&1!==r.virtualInfo.blockIndexes.length||(r.virtualInfo.blockIndexes=o.blockIndexes):r.virtualInfo.blockIndexes=this.getBlockIndexes(r.virtualInfo.page)),this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent))return e.prototype.generateRows.call(this,i,r);t.isNullOrUndefined(r.requestType)||"collapseAll"!==r.requestType.toString()||(r.requestType="refresh");for(var a=e.prototype.generateRows.call(this,i,r),d=0;d<a.length;d++)a[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),Mt=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=y(this.parent,n.parentItem.uniqueID,!0);t.setValue("hasFilteredChildRecords",!0,d),d&&d.parentItem&&this.updateParentFilteredRecord(d)}}this.flatFilteredData.length>0&&this.isHierarchyFilter&&this.updateFilterLevel(),this.parent.notify("updateAction",{result:this.filteredResult})},e.prototype.updateParentFilteredRecord=function(e){var i=y(this.parent,e.parentItem.uniqueID,!0),r=t.getValue("uniqueIDFilterCollection",this.parent);i&&Object.prototype.hasOwnProperty.call(r,i.uniqueID)&&t.setValue("hasFilteredChildRecords",!0,i),i&&i.parentItem&&this.updateParentFilteredRecord(i)},e.prototype.addParentRecord=function(e){var i=y(this.parent,e.parentUniqueID);if("None"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key){if(!t.isNullOrUndefined(i)){"Child"!==(""===this.parent.grid.searchSettings.key?this.parent.filterSettings.hierarchyMode:this.parent.searchSettings.hierarchyMode)||0===this.parent.grid.filterSettings.columns.length&&""===this.parent.grid.searchSettings.key?this.addParentRecord(i):-1!==this.flatFilteredData.indexOf(i)&&this.addParentRecord(i)}-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))}else if(t.isNullOrUndefined(i)){if(-1!==this.flatFilteredData.indexOf(e))return void(-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent),e.hasFilteredChildRecords=!0))}else this.addParentRecord(i),-1!==this.flatFilteredData.indexOf(i)||-1!==this.filteredResult.indexOf(i)?-1===this.filteredResult.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent)):-1===this.filteredResult.indexOf(e)&&-1!==this.flatFilteredData.indexOf(e)&&(this.filteredResult.push(e),t.setValue("uniqueIDFilterCollection."+e.uniqueID,e,this.parent))},e.prototype.checkChildExsist=function(e){for(var r=i.getObject("childRecords",e),n=!1,o=0;o<r.length;o++){var a=r[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=y(this.parent,e[parseInt(i.toString(),10)].parentUniqueID);if(-1!==e.indexOf(r)){var n=y(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){for(var i,r=0,n=e.flatData,o=n.length;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}(),Ot=function(){function e(e){this.isCollapsedStatePersist=!1,i.Grid.Inject(i.ExcelExport),this.parent=e,this.dataResults={},this.addEventListener()}return e.prototype.getModuleName=function(){return"ExcelExport"},e.prototype.addEventListener=function(){this.parent.on("updateResults",this.updateExcelResultModel,this),this.parent.on("excelCellInfo",this.excelQueryCellInfo,this),this.parent.grid.on("export-RowDataBound",this.exportRowDataBound,this),this.parent.grid.on("finalPageSetup",this.finalPageSetup,this)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateResults",this.updateExcelResultModel),this.parent.off("excelCellInfo",this.excelQueryCellInfo),this.parent.grid.off("export-RowDataBound",this.exportRowDataBound),this.parent.grid.off("finalPageSetup",this.finalPageSetup))},e.prototype.updateExcelResultModel=function(e){this.dataResults=e},e.prototype.Map=function(e,r,o,a,s){var d=this,l=this.parent.dataSource,p=Object();return t.setValue("isCsv",s,p),t.setValue("cancel",!1,p),t.isNullOrUndefined(e)||(this.isCollapsedStatePersist=e.isCollapsedStatePersist),new Promise(function(h){var c=!d.isLocal()||l instanceof n.DataManager?d.parent.dataSource:new n.DataManager(l),u=new n.Query;if(d.isLocal()||(u=d.generateQuery(u),t.setValue("query",u,p)),d.parent.trigger($,t.extend(p,e)),i.getObject("cancel",p))return null;c.executeQuery(u).then(function(i){var n=null;return t.isNullOrUndefined(e)||t.isNullOrUndefined(e.dataSource)||(n=e.dataSource),e=d.manipulateExportProperties(e,l,i),d.parent.grid.excelExportModule.Map(d.parent.grid,e,r,o,s,a).then(function(t){null!=n?e.dataSource=n:delete e.dataSource,h(t)})})})},e.prototype.generateQuery=function(e,r){return!t.isNullOrUndefined(r)&&"CurrentPage"===r.exportType&&this.parent.allowPaging&&(r.exportType="AllPages",e.addParams("ExportType","CurrentPage"),e.where(this.parent.parentIdMapping,"equal",null),e=i.getObject("grid.renderModule.data.pageQuery",this.parent)(e)),e},e.prototype.manipulateExportProperties=function(e,r,o){var a=Object();if(t.setValue("query",this.parent.grid.getDataModule().generateQuery(!0),a),t.setValue("isExport",!0,a),t.isNullOrUndefined(e)||t.isNullOrUndefined(e.exportType)||t.setValue("exportType",e.exportType,a),this.isLocal()||(this.parent.parentData=[],this.parent.dataModule.convertToFlatData(i.getObject("result",o)),t.setValue("expresults",this.parent.flatData,a)),this.parent.notify("dataProcessor",a),a=this.dataResults,r=t.isNullOrUndefined(a.result)?this.parent.flatData.slice(0):a.result,this.isLocal()||(this.parent.flatData=[]),e&&e.dataSource&&this.isLocal()){var s=this.parent.flatData,d=e.dataSource instanceof n.DataManager?e.dataSource.dataSource.json:e.dataSource;this.parent.dataModule.convertToFlatData(d),r=this.parent.flatData,this.parent.flatData=s}return e=t.isNullOrUndefined(e)?Object():e,e.dataSource=new n.DataManager({json:r}),e.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&&y(this.parent,i.parentItem.uniqueID,Boolean(r))){var a=!1,s=!1,d=h(this.parent,i,this.parent.parentData);!this.isCollapsedStatePersist||d&&this.parent.isLocalData||(a=!0,s=!i.expanded),e.excelRows[n-1].grouping={outlineLevel:o,isCollapsed:s,isHidden:a}}else i.hasChildRecords&&t.isNullOrUndefined(i.parentItem)&&(e.excelRows[n-1].grouping={outlineLevel:o})}},e.prototype.finalPageSetup=function(e){for(var t=0;t<e.worksheets.length;t++)e.worksheets[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}(),Pt=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(Z,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}(),Et=function(){function e(e){i.Grid.Inject(i.Page),this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(oe,this.collapseExpandPagedchilds,this),this.parent.on(ae,this.pageAction,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(oe,this.collapseExpandPagedchilds),this.parent.off(ae,this.pageAction))},e.prototype.getModuleName=function(){return"pager"},e.prototype.refresh=function(){this.parent.grid.pagerModule.refresh()},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.goToPage=function(e){this.parent.grid.pagerModule.goToPage(e)},e.prototype.updateExternalMessage=function(e){this.parent.grid.pagerModule.updateExternalMessage(e)},e.prototype.collapseExpandPagedchilds=function(e){if(e.record.expanded="collapse"!==e.action,this.parent.flatData.map(function(t){return t.expanded=t.uniqueID===e.record.uniqueID&&t.expanded!==e.record.expanded?e.record.expanded:t.expanded}),this.parent.enableImmutableMode){var i=this.parent.getPrimaryKeyFieldNames()[0],r=this.parent.flatData.filter(function(t){return t[""+i]===e.record[""+i]});r.length&&(r[0].expanded=e.record.expanded)}var n={result:this.parent.flatData,row:e.row,action:e.action,record:e.record,count:this.parent.flatData.length};if(t.getValue("grid.renderModule",this.parent).dataManagerSuccess(n),this.parent.enableImmutableMode){var o=void 0;"collapse"===n.action?(o=n.row.getElementsByClassName("e-treegridexpand")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridexpand"),t.addClass([o],"e-treegridcollapse"))):"expand"===n.action&&(o=n.row.getElementsByClassName("e-treegridcollapse")[0],t.isNullOrUndefined(o)||(t.removeClass([o],"e-treegridcollapse"),t.addClass([o],"e-treegridexpand")))}},e.prototype.pageRoot=function(e,i,r){for(var n=t.isNullOrUndefined(r)?[]:r,o=function(t){n.push(i[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=a.pageRoot(e,r,n))},a=this,s=0;s<i.length;s++)o(s);return n},e.prototype.updatePageSize=function(e){var t=e.result.length,i=this.parent.grid.pagerModule;!0===this.parent.pageSettings.pageSizes&&i.pagerObj.pagerdropdownModule.dropDownListObject.value===i.pagerObj.getLocalizedLabel("All")&&(i.pagerObj.totalRecordsCount=t,this.parent.grid.pageSettings.pageSize=t)},e.prototype.pageAction=function(e){var t=this,i=new n.DataManager(e.result);if("Root"===this.parent.pageSettings.pageSizeMode){var r=[],o=this.parent.grid.filterSettings.columns.length>0&&("Child"===this.parent.filterSettings.hierarchyMode||"None"===this.parent.filterSettings.hierarchyMode)?"filterLevel":"level",a=(new n.Query).where(o,"equal",0);r=i.executeLocal(a),e.count=r.length;var s=(f=this.parent.grid.pageSettings.pageSize)*((y=this.parent.grid.pageSettings.currentPage)-1);a=a.skip(s).take(f),r=i.executeLocal(a);var d=this.pageRoot(e.result,r);e.result=d}else{var p=new n.DataManager(e.result),c=new n.Predicate("expanded","notequal",null).or("expanded","notequal",void 0),u=p.executeLocal((new n.Query).where(c)),g=void 0;g=l(this.parent)&&"collapse"!==e.actionArgs.action&&"expand"!==e.actionArgs.action?u:u.filter(function(e){return h(t.parent,e,u)}),e.count=g.length;a=new n.Query;var f=this.parent.grid.pageSettings.pageSize;this.updatePageSize(e);var y=this.parent.grid.pageSettings.currentPage;g.length<y*f&&(y=(y=Math.floor(g.length/f)+(g.length%f?1:0))||1,this.parent.grid.setProperties({pageSettings:{currentPage:y}},!0));s=f*(y-1);a=a.skip(s).take(f),p.dataSource.json=g,e.result=p.executeLocal(a)}this.parent.notify("updateAction",e)},e}(),At=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(W,this.refreshToolbar,this),this.parent.on(J,this.refreshToolbar,this),this.parent.on(X,this.toolbarClickHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(W,this.refreshToolbar),this.parent.off(J,this.refreshToolbar),this.parent.off(X,this.toolbarClickHandler))},e.prototype.refreshToolbar=function(e){var i=this.parent.grid.toolbarModule.getToolbar();if(!t.isNullOrUndefined(i)){var r=this.parent,n=void 0,o=void 0,a=r.element.id+"_gridcontrol_indent",s=r.element.id+"_gridcontrol_outdent",d=i.querySelector("#"+a),l=i.querySelector("#"+s),p=e.row,h=r.getSelectedRows()[0];if(t.isNullOrUndefined(p[0])||(p=p[0]),p=t.isNullOrUndefined(h)||h.rowIndex===p.rowIndex?p:h,null!==d&&null!==l){if(n=i.querySelector("#"+a).parentElement,o=i.querySelector("#"+s).parentElement,0===p.rowIndex||r.getSelectedRowIndexes().length>1)n.classList.add("e-hidden"),o.classList.add("e-hidden");else if("rowDeselected"!==e.name||!t.isNullOrUndefined(h)&&r.grid.isCheckBoxSelection){var c=r.getCurrentViewRecords()[p.rowIndex];t.isNullOrUndefined(c)||(c.level>r.getCurrentViewRecords()[p.rowIndex-1].level?n.classList.add("e-hidden"):n.classList.remove("e-hidden"),c.level===r.getCurrentViewRecords()[p.rowIndex-1].level&&n.classList.remove("e-hidden"),0===c.level&&o.classList.add("e-hidden"),0!==c.level&&o.classList.remove("e-hidden"))}"rowDeselected"===e.name&&t.isNullOrUndefined(h)&&!r.grid.isCheckBoxSelection&&(this.parent.toolbar.includes("Indent")&&n.classList.add("e-hidden"),this.parent.toolbar.includes("Outdent")&&o.classList.add("e-hidden"))}}},e.prototype.toolbarClickHandler=function(e){var i=this.parent,r="indentOutdentAction";"Cell"===this.parent.editSettings.mode&&"Batch"===this.parent.grid.editSettings.mode&&e.item.id===this.parent.grid.element.id+"_update"&&(e.cancel=!0,this.parent.grid.editModule.saveCell()),e.item.id===this.parent.grid.element.id+"_expandall"&&this.parent.expandAll(),e.item.id===this.parent.grid.element.id+"_collapseall"&&this.parent.collapseAll(),e.item.id===i.grid.element.id+"_indent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[""+r](null,"indent"),e.item.id===i.grid.element.id+"_outdent"&&i.getSelectedRecords().length&&!t.isNullOrUndefined(i.rowDragAndDropModule)&&this.parent.rowDragAndDropModule[""+r](null,"outdent")},e.prototype.getToolbar=function(){return this.parent.grid.toolbarModule.getToolbar()},e.prototype.enableItems=function(e,t){this.parent.grid.toolbarModule.enableItems(e,t)},e.prototype.destroy=function(){this.removeEventListener()},e}(),Nt=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){var y=0;for(d=g;y<d;y++)if(o=h[parseInt(y.toString(),10)],l=this.getChildRecordsLength(o,c)){for(var m=function(e,r){var a=void 0;a={};for(var s=0;s<f.length;s++){a[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(s.toString(),10)]))?f[parseInt(s.toString(),10)]:i.getObject("field",f[parseInt(s.toString(),10)]))]=null}if(a=S.createSummaryItem(a,S.parent.aggregates[e-1]),!S.parent.aggregates[e-1].showChildSummary)return"continue";var d;c.map(function(e,t){e.uniqueID!==o.uniqueID||(d=t)});var p=d+l+e,h=t.extend({},o);delete h.childRecords,delete h[S.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,I=1,v=u;I<=v;I++)m(I);this.flatChildRecords=[]}}else{for(var w={},R=0,x=f.length;R<x;R++){w[""+(t.isNullOrUndefined(i.getObject("field",f[parseInt(R.toString(),10)]))?f[parseInt(R.toString(),10)]:i.getObject("field",f[parseInt(R.toString(),10)]))]=null}I=1;for(var C=u;I<=C;I++)this.createSummaryItem(w,this.parent.aggregates[I-1])}return c},e.prototype.getChildRecordsLength=function(e,r){for(var n,o=0,a=Object.keys(r).length;o<a;o++){n=r[parseInt(o.toString(),10)];if(e===(t.isNullOrUndefined(n.parentItem)?null:r.filter(function(e){return e.uniqueID===n.parentItem.uniqueID})[0])){this.flatChildRecords.push(n);if(!i.getObject("hasChildRecords",n))continue;this.getChildRecordsLength(n,r)}}return this.flatChildRecords.length},e.prototype.createSummaryItem=function(e,i){for(var r=0,o=Object.keys(i.columns).length;r<o;r++)for(var a=t.isNullOrUndefined(i.columns[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(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(),y="Custom"!==u[parseInt(g.toString(),10)]?i.getObject("aggregates",c):i.calculateAggregate(u[parseInt(g.toString(),10)],c,e,this.parent),m=e.columnName,S="Custom"!==u[parseInt(g.toString(),10)]?y[""+f]:y;a[""+m]=a[""+m]||{},a[""+m][""+f]=S,a[""+m][u[parseInt(g.toString(),10)]]=t.isNullOrUndefined(y)?" ":l(S)}s.format=e.getFormatter();var I=t.createElement("td",{className:"e-summary"});if(this.parent.isReact){p.fn(a[e.columnName],this.parent,p.property,"",null,null,I);var v=this;v.parent.renderReactTemplates(function(){v.parent.trigger(_,v.parent.args)})}else i.appendChildren(I,p.fn(a[e.columnName],this.parent,p.property));var w=a[""+e.columnName][""+h];return-1===I.innerHTML.indexOf(w)?I.innerHTML+w:I.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}(),Ut=function(){function e(e){i.Grid.Inject(i.Sort),this.parent=e,this.taskIds=[],this.flatSortedData=[],this.storedIndex=-1,this.isSelfReference=!t.isNullOrUndefined(this.parent.parentIdMapping),this.addEventListener()}return e.prototype.getModuleName=function(){return"sort"},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this),this.parent.on("createSort",this.createdSortedRecords,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateModel",this.updateModel),this.parent.off("createSort",this.createdSortedRecords))},e.prototype.createdSortedRecords=function(e){var t=e.modifiedData,i=e.srtQry;this.iterateSort(t,i),this.storedIndex=-1,e.modifiedData=this.flatSortedData,this.flatSortedData=[]},e.prototype.iterateSort=function(e,i){for(var r=0;r<e.length;r++)if(this.parent.grid.filterSettings.columns.length>0||""!==this.parent.grid.searchSettings.key?t.isNullOrUndefined(y(this.parent,e[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}(),kt=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}(),qt=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++){"Outdent"!==(g=l[d]).text&&"Indent"!==g.text||a.grid.contextMenuModule.hiddenItems.push(g.text)}a.grid.contextMenuModule.contextMenu.hideItems(a.grid.contextMenuModule.hiddenItems),n.style.display=o.style.display="none"}}else{var p=e.event.target.closest("td");if(!t.isNullOrUndefined(p)&&(t.isNullOrUndefined(p)||p.classList.contains("e-rowcell")&&0===p.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 h=a.getCurrentViewRecords()[s.rowIndex];t.isNullOrUndefined(h)||(h.level>a.getCurrentViewRecords()[s.rowIndex-1].level?n.style.display="none":n.style.display="block",h.level===a.getCurrentViewRecords()[s.rowIndex-1].level&&(n.style.display="block"),0===h.level?o.style.display="none":o.style.display="block")}}else{for(var c=0,u=e.items;c<u.length;c++){var g;"Outdent"!==(g=u[c]).text&&"Indent"!==g.text||a.grid.contextMenuModule.hiddenItems.push(g.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}(),Vt=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(fe,this.cellSaved,this),this.parent.on(Ie,this.batchAdd,this),this.parent.on(we,this.beforeBatchAdd,this),this.parent.on(xe,this.batchSave,this),this.parent.on(ve,this.beforeBatchDelete,this),this.parent.on(Re,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(fe,this.cellSaved),this.parent.off(Ie,this.batchAdd),this.parent.off(xe,this.batchSave),this.parent.off(we,this.beforeBatchAdd),this.parent.off(ve,this.beforeBatchDelete),this.parent.off(Re,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="parentItem",p=this.selectedIndex>-1?this.batchRecords[parseInt(this.addRowIndex.toString(),10)][""+l]:null,h=void 0,u=void 0,f=void 0,y="Top"===this.parent.editSettings.newRowPosition||-1===this.selectedIndex?0:"Above"===this.parent.editSettings.newRowPosition?this.addRowIndex:this.addRowIndex+1;if(y=this.getActualRowObjectIndex(y),this.newBatchRowAdded){if(this.batchRecords.length&&(h=this.batchRecords[this.addRowIndex][this.parent.idMapping],f=this.batchRecords[this.addRowIndex][this.parent.parentIdMapping],this.batchRecords[parseInt(this.addRowIndex.toString(),10)][""+l]&&(u=this.batchRecords[parseInt(this.addRowIndex.toString(),10)][""+l].uniqueID)),this.batchAddedRecords=g(this.batchAddedRecords),this.batchAddRowRecord=g(this.batchAddRowRecord),this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]),o=this.parent.grid.getRowsObject()[parseInt(y.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=p,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,S=c(this.batchRecords[this.addRowIndex])[m-1];S=t.isNullOrUndefined(S)?this.batchRecords[this.addRowIndex]:S,s=r.map(function(e){return e[""+a]}).indexOf(S[""+a]),this.isSelfReference&&(o[this.parent.parentIdMapping]=h),v(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=p,o.parentUniqueID=u,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){m=c(this.batchRecords[this.addRowIndex]).length,S=c(this.batchRecords[this.addRowIndex])[m-1];S=t.isNullOrUndefined(S)?this.batchRecords[this.addRowIndex]:S,s=r.map(function(e){return e[""+a]}).indexOf(S[""+a])}if("Above"===this.parent.editSettings.newRowPosition&&this.selectedIndex>-1){S=this.batchRecords[this.addRowIndex];s=r.map(function(e){return e[""+a]}).indexOf(S[""+a])}this.isSelfReference&&(o[this.parent.parentIdMapping]=f)}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(y.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(ce,{}),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=y(this.parent,r.parentItem.uniqueID);if(!t.isNullOrUndefined(u)&&u.hasChildRecords){var f=u.childRecords.indexOf(r);u.childRecords.splice(f,1)}this.batchDeletedRecords=g(this.batchDeletedRecords),this.batchDeletedRecords.push(r)}n.push(r),s=n;for(h=0;h<s.length;h++){var m=this.batchRecords.map(function(e){return e[""+d]}).indexOf(s[parseInt(h.toString(),10)][""+d]);-1!==m&&this.batchRecords.splice(m,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="addedRecords",n="Child"===this.parent.editSettings.newRowPosition?"primaryParent":"parentItem",o=0;o<this.parent.getBatchChanges()[""+r].length;o++)t.isNullOrUndefined(this.parent.getBatchChanges()[""+r][parseInt(o.toString(),10)][""+n])||this.parent.getBatchChanges()[""+r][parseInt(o.toString(),10)][""+n][""+i]===e[parseInt(this.addRowIndex.toString(),10)][""+i]&&(this.batchChildCount=this.batchChildCount+1)},e.prototype.beforeBatchSave=function(e){var t="deletedRecords",i=e.batchChanges.changedRecords;if(e.batchChanges.changedRecords.length)for(var r=0;r<i.length;r++)S({value:i[parseInt(r.toString(),10)],action:"edit"},this.parent,this.isSelfReference,this.addRowIndex,this.selectedIndex,void 0);if(e.batchChanges[""+t].length){var n=e.batchChanges[""+t];for(r=0;r<n.length;r++){this.deleteUniqueID(n[parseInt(r.toString(),10)].uniqueID);for(var o=c(n[parseInt(r.toString(),10)]),a=0;a<o.length;a++)this.deleteUniqueID(o[parseInt(a.toString(),10)].uniqueID);e.batchChanges[""+t]=e.batchChanges[""+t].concat(o)}}this.isAdd=!1},e.prototype.deleteUniqueID=function(e){delete this.parent.uniqueIDFilterCollection[""+e];delete this.parent.uniqueIDCollection[""+e]},e.prototype.batchCancelAction=function(){var e,i="targetElement",r="parentItem",o=this.parent.grid.getCurrentViewRecords(),a="childRecords",s=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,d=this.parent.grid.getPrimaryKeyFieldNames()[0];if(!t.isNullOrUndefined(this.batchAddedRecords))for(var l=0;l<this.batchAddedRecords.length;l++)if(-1!==(e=s.map(function(e){return e[""+d]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)][""+d]))&&s.splice(e,1),"Child"===this.parent.editSettings.newRowPosition&&(e=o.map(function(e){return e[""+d]}).indexOf(this.batchAddedRecords[parseInt(l.toString(),10)][""+r]?this.batchAddedRecords[parseInt(l.toString(),10)][""+r][""+d]:this.batchAddedRecords[parseInt(l.toString(),10)][""+d]),!t.isNullOrUndefined(o[parseInt(e.toString(),10)])))for(var p=o[parseInt(e.toString(),10)][""+a],h=0;p&&h<p.length;h++)p[parseInt(h.toString(),10)][""+d]===this.batchAddedRecords[parseInt(l.toString(),10)][""+d]&&o[parseInt(e.toString(),10)][""+a].splice(h,1);if(!t.isNullOrUndefined(this.parent[""+i])){var c=this.parent[""+i].closest("tr");this.parent.collapseRow(c),this.parent[""+i]=null}if(!t.isNullOrUndefined(this.batchDeletedRecords))for(l=0;l<this.batchDeletedRecords.length;l++)if(!t.isNullOrUndefined(this.batchDeletedRecords[parseInt(l.toString(),10)][""+r])){e=o.map(function(e){return e[""+d]}).indexOf(this.batchDeletedRecords[parseInt(l.toString(),10)][""+r][""+d]);var u=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(o[parseInt(e.toString(),10)])||o[parseInt(e.toString(),10)][""+a].splice(u,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="deletedRecords",a=this.parent.grid.dataSource instanceof n.DataManager?this.parent.grid.dataSource.dataSource.json:this.parent.grid.dataSource,s=this.parent.grid.getCurrentViewRecords(),d=this.parent.grid.getPrimaryKeyFieldNames()[0],l=r.addedRecords,p=void 0,h=void 0,c=void 0;if(l.length>1&&"Bottom"!==this.parent.editSettings.newRowPosition&&l.reverse(),"Bottom"!==this.parent.editSettings.newRowPosition&&!Object.hasOwnProperty.call(e,"updatedRecords")){if(a.splice(a.length-l.length,l.length),this.parent.editModule.isAddedRowByMethod&&l.length&&!t.isNullOrUndefined(this.parent.editModule.addRowIndex)&&!this.parent.editModule.isAddedRowByContextMenu){l.reverse();for(var u=0;u<l.length;u++){var f=parseInt(this.parent.getContentTable().getElementsByClassName("e-insertedrow")[parseInt(u.toString(),10)].getAttribute("data-rowindex"),10);a.splice(f,0,l[parseInt(u.toString(),10)])}}if(this.parent.allowPaging||a.length===s.length){var y=g(a);if(y.length){var m=y.map(function(e){return e[""+d]}).indexOf(s[0][""+d]),I=m+this.parent.grid.pageSettings.pageSize;s=y.splice(m,I)}}else s.length>l.length&&s.splice(s.length-l.length,l.length)}for(0===this.batchAddRowRecord.length&&this.batchAddRowRecord.push(this.parent.flatData[e.index]),this.parent.editModule.isAddedRowByContextMenu&&l.reverse(),i=0;i<l.length;i++){var w=t.extend({},l[parseInt(i.toString(),10)]);if(delete w.parentItem,delete w.uniqueID,delete w.index,delete w.level,delete w.hasChildRecords,delete w.childRecords,delete w.parentUniqueID,t.isNullOrUndefined(w.primaryParent)||delete w.primaryParent,l.length>1&&this.parent.editModule.isAddedRowByContextMenu){var R=this.parent.editSettings.newRowPosition;this.parent.editSettings.newRowPosition=this.parent.editModule.previousNewRowPosition,this.parent.editModule.previousNewRowPosition=R}if(l[parseInt(i.toString(),10)].taskData=w,c=this.batchAddRowRecord[parseInt(i.toString(),10)],t.isNullOrUndefined(c)&&(c=this.batchAddRowRecord[i-1]),this.isSelfReference&&(t.isNullOrUndefined(l[parseInt(i.toString(),10)].parentItem)||v(d,l[parseInt(i.toString(),10)].parentItem,"add",this.parent,this.isSelfReference,l[parseInt(i.toString(),10)])),t.isNullOrUndefined(c)||(h=c.index),"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition&&t.isNullOrUndefined(l[parseInt(i.toString(),10)].parentItem)&&-1===this.selectedIndex&&(p=-1,c=null),S({value:l[parseInt(i.toString(),10)],action:"add"},this.parent,this.isSelfReference,h,p,void 0,c),p=null,"Child"===this.parent.editSettings.newRowPosition&&!t.isNullOrUndefined(l[parseInt(i.toString(),10)].parentItem)&&(t.isNullOrUndefined(this.parent.editModule.addRowIndex)||this.isSelfReference))for(var x=s.map(function(e){return e[""+d]}).indexOf(l[parseInt(i.toString(),10)].parentItem[""+d]),C=s[parseInt(x.toString(),10)].childRecords,b=0;b<C.length;b++)C[parseInt(b.toString(),10)][""+d]===l[parseInt(i.toString(),10)][""+d]&&s[parseInt(x.toString(),10)].childRecords.splice(b,1)}if(r[""+o].length)for(i=0;i<r[""+o].length;i++)S({value:r[""+o][parseInt(i.toString(),10)],action:"delete"},this.parent,this.isSelfReference,h,p,void 0,c);this.parent.parentData=[];for(var D=0;D<a.length;D++)a[parseInt(D.toString(),10)].index=D,t.setValue("uniqueIDCollection."+a[parseInt(D.toString(),10)].uniqueID+".index",D,this.parent),a[parseInt(D.toString(),10)].level||this.parent.parentData.push(a[parseInt(D.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();if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&this.selectedIndex>-1){if(!t.isNullOrUndefined(this.batchRecords[this.addRowIndex])&&this.batchRecords[this.addRowIndex].expanded)if(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length){if(e+=c(this.batchRecords[this.addRowIndex]).length,"Child"!==this.parent.editSettings.newRowPosition){e+=this.getBatchChildCount()}}else e+=c(this.batchRecords[this.addRowIndex]).length;e>=i.length&&(e=i.length-1),this.updateChildCount(this.parent.grid.getCurrentViewRecords()),this.batchChildCount&&(e+=this.batchChildCount),this.batchChildCount=0}return e},e.prototype.immutableBatchAction=function(e){e.args.cancel=!0;var t=this.parent.grid.getBatchChanges(),i=[];Object.keys(t).length&&(i=t.addedRecords);for(var r=0;r<i.length;r++)e.rows.splice(i[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}(),Tt=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 Vt(this.parent),this.addEventListener()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.addEventListener=function(){this.parent.on(pe,this.crudAction,this),this.parent.on(he,this.beginEdit,this),this.parent.on(ce,this.beginAdd,this),this.parent.on(ue,this.recordDoubleClick,this),this.parent.on(ge,this.cellSave,this),this.parent.on(Se,this.batchCancel,this),this.parent.grid.on(Ce,this.keyPressed,this),this.parent.grid.on("batchedit-form",this.lastCellTab,this),this.parent.grid.on("content-ready",this.contentready,this),this.parent.on(ye,this.cellEdit,this),this.parent.on("actionBegin",this.editActionEvents,this),this.parent.on("actionComplete",this.editActionEvents,this),this.parent.grid.on(be,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(Pe,this.beforeStartEdit,this),this.parent.grid.on(Ee,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(G,e)},e.prototype.beforeBatchCancel=function(e){"Cell"===this.parent.editSettings.mode&&this.parent.trigger(K,e)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(pe,this.crudAction),this.parent.off(he,this.beginEdit),this.parent.off(ce,this.beginAdd),this.parent.off(ue,this.recordDoubleClick),this.parent.off(Se,this.batchCancel),this.parent.grid.off(Ce,this.keyPressed),this.parent.grid.off("batchedit-form",this.lastCellTab),this.parent.grid.off("content-ready",this.contentready),this.parent.off(ye,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(be,this.recordDoubleClick),this.parent.off("savePreviousRowPosition",this.savePreviousRowPosition),this.parent.grid.off(Pe,this.beforeStartEdit),this.parent.grid.off(Ee,this.beforeBatchCancel),this.parent.grid.off("dblclick",this.gridDblClick),this.parent.grid.off("reset-edit-props",this.resetIsOnBatch),this.parent.grid.off("get-row-position",this.getRowPosition))},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.applyFormValidation=function(e){this.parent.grid.editModule.applyFormValidation(e)},e.prototype.editActionEvents=function(e){var r=i.getObject("editAction",e),o=i.getObject("name",r),s=this.parent,d=s.dataSource.adaptor;if((a(s)||d instanceof n.RemoteSaveAdaptor)&&"save"===r.requestType&&"add"===r.action&&("Child"===s.editSettings.newRowPosition||"Below"===s.editSettings.newRowPosition||"Above"===s.editSettings.newRowPosition))if("actionBegin"===o){var l=t.isNullOrUndefined(r.row)||!Object.keys(r.row).length?this.selectedIndex:r.row.rowIndex-1,p=t.isNullOrUndefined(l)||-1===l?-1:s.getCurrentViewRecords()[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(ye,e,function(e){e.cancel||"Cell"!==i.parent.editSettings.mode?e.cancel&&"Cell"===i.parent.editSettings.mode&&(i.isOnBatch=!1,i.updateGridEditMode("Normal")):i.enableToolbarItems("edit"),t.isNullOrUndefined(r)||r.resolve(e)}),this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-summarycell")))return e.cancel=!0,void(this.doubleClickTarget=null);"Cell"===this.parent.editSettings.mode&&("tab"===this.keyPress||"shiftTab"===this.keyPress?this.keyPress=null:"enter"===this.keyPress&&(e.cancel=!0,this.keyPress=null,t.setValue("isEditCollapse",!1,this.parent)),e.columnObject.allowEditing||(e.cancel=!0)),this.parent.enableVirtualization&&(this.parent.grid.contentModule.editedRowIndex=this.parent.grid.editModule.editModule.index)},e.prototype.enableToolbarItems=function(e){if(!t.isNullOrUndefined(this.parent.grid.toolbarModule)){var i=this.parent.element.id+"_gridcontrol_";this.parent.grid.toolbarModule.enableItems([i+"add",i+"edit",i+"delete"],"save"===e),this.parent.grid.toolbarModule.enableItems([i+"update",i+"cancel"],"edit"===e)}},e.prototype.batchCancel=function(){if("Cell"===this.parent.editSettings.mode){var e=t.getValue("editModule.cellDetails",this.parent.grid.editModule),i=this.parent.getCellFromIndex(e.rowIndex,this.parent.treeColumnIndex);this.parent.renderModule.cellRender({data:e.rowData,cell:i,column:this.parent.grid.getColumns()[this.parent.treeColumnIndex]}),this.updateGridEditMode("Normal"),this.isOnBatch=!1}"Batch"===this.parent.editSettings.mode&&this.parent.notify("batchCancelAction",{})},e.prototype.customCellSave=function(e){s(this.parent)&&"Cell"===this.parent.editSettings.mode&&"edit"===e.action&&(this.updateCell(e,e.rowIndex),this.afterCellSave(e,e.row,e.rowIndex))},e.prototype.cellSave=function(e){var i=this;if("Cell"===this.parent.editSettings.mode&&this.parent.element.querySelector("form")){e.cancel=!0;t.setValue("isEditCollapse",!0,this.parent),e.rowData[e.columnName]=e.value;var r;r=t.isNullOrUndefined(e.cell)?this.parent.grid.editModule.editModule.form.parentElement.parentNode:e.cell.parentNode;var o,d=this.parent.getPrimaryKeyFieldNames();if(t.isNullOrUndefined(r))this.parent.grid.getCurrentViewRecords().filter(function(t,i){t[d[0]]!==e.rowData[d[0]]||(o=i)});else{var l=this.parent.getFrozenLeftColumnsCount()>0||this.parent.getFrozenRightColumnsCount()>0;o=l?(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(G,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,o);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,o)})}}}else if(s(this.parent)){var c={requestType:"save",data:e.rowData,action:"edit",row:r,rowIndex:o,rowData:e.rowData,columnName:e.columnName,filterChoiceCount:null,excelSearchOperator:null};this.parent.grid.getDataModule().eventPromise(c,this.parent.grid.query)}else this.updateCell(e,o),t.setValue("isEdit",!1,this.parent.grid),this.afterCellSave(e,r,o)}this.parent.enableVirtualization&&(this.parent.grid.contentModule.virtualData={})},e.prototype.afterCellSave=function(e,i,r){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 n={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(K,n)},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)){var a=t.getValue("uniqueIDCollection."+o.uniqueID+".index",this.parent);if(o.index=a,!t.isNullOrUndefined(o.parentItem)){var s=t.getValue("uniqueIDCollection."+o.parentItem.uniqueID+".index",this.parent);o.parentItem.index=s}}}var d=-1,l=this.parent.treeColumnIndex;if(this.parent.getFrozenColumns()>0)for(var p=i[0].querySelectorAll(".e-rowcell"),h=0;h<p.length;h++)if(p[parseInt(h.toString(),10)].classList.contains("e-gridrowindex0level0")){l=h;break}for(var c=0;c<this.parent.getRows().length;c++){i[parseInt(c.toString(),10)].classList.contains("e-detailrow")||d++;var u=r[parseInt(d.toString(),10)];if(!t.isNullOrUndefined(u)){a=u.index;var g=u.level,f=i[parseInt(c.toString(),10)];t.isNullOrUndefined(u.parentItem)||(a=t.getValue("uniqueIDCollection."+u.parentItem.uniqueID+".index",this.parent));var y=f.cells[parseInt(l.toString(),10)];if(!t.isNullOrUndefined(y)){for(h=0;h<y.classList.length;h++){var m=y.classList[parseInt(h.toString(),10)],S=m.match(/e-gridrowindex/i),I=m.match(/e-griddetailrowindex/i);null!=S&&t.removeClass([y],m),null!=I&&t.removeClass([y],m)}i[parseInt(c.toString(),10)].classList.contains("e-detailrow")?t.addClass([y],"e-griddetailrowindex"+a+"level"+g):t.addClass([y],"e-gridrowindex"+a+"level"+g)}}}},e.prototype.beginAdd=function(){var e,i=this.addRowIndex,r=this.parent.grid.getCurrentViewRecords();"Batch"===this.parent.editSettings.mode&&(i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex(),(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)&&(r=this.batchEditModule.getBatchRecords()));var n=this.parent.grid.getDataRows(),o=n.length?+n[0].getAttribute("data-rowindex"):0,a=n.length?+n[n.length-1].getAttribute("data-rowindex"):0,s=this.selectedIndex>=o&&this.selectedIndex<=a,d=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex;if("Dialog"!==this.parent.editSettings.mode){if("Above"===this.parent.editSettings.newRowPosition)e="before";else if(("Below"===this.parent.editSettings.newRowPosition||"Child"===this.parent.editSettings.newRowPosition)&&(this.selectedIndex>-1||d)&&s&&(e="after",!t.isNullOrUndefined(r[parseInt(i.toString(),10)])&&r[parseInt(i.toString(),10)].expanded))if("Batch"===this.parent.editSettings.mode&&(this.parent.getBatchChanges()[this.addedRecords].length>1||this.parent.getBatchChanges()[this.deletedRecords].length)){if(i+=c(r[parseInt(i.toString(),10)]).length,"Child"!==this.parent.editSettings.newRowPosition){i+=this.batchEditModule.getBatchChildCount()}}else this.parent.enableVirtualization||(i+=c(r[parseInt(i.toString(),10)]).length);if((this.selectedIndex>-1||d)&&s&&(i||"Child"===this.parent.editSettings.newRowPosition||"Below"===this.parent.editSettings.newRowPosition)){i>=n.length-1&&(i=n.length-2);var l=this.parent.grid.contentModule.rows[0],p=document.activeElement;n[i+1][""+e](n[0]),t.setValue("batchIndex",i+1,this.batchEditModule);var h="Above"===this.parent.editSettings.newRowPosition?i:i+1;if("Batch"===this.parent.editSettings.mode&&(this.parent.grid.contentModule.rows.splice(0,1),this.parent.grid.contentModule.rows.splice(h,0,l)),"Row"===this.parent.editSettings.mode||"Cell"===this.parent.editSettings.mode){for(var u=this.parent.grid.getContentTable().querySelectorAll(".e-griderror"),g=0;g<u.length;g++)u[parseInt(g.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)&&p.focus(),this.parent.enableVirtualization&&!Object.keys(this.parent.grid.contentModule.emptyRowData).length&&this.parent.grid.contentModule.createEmptyRowdata()}}if("Batch"===this.parent.editSettings.mode&&!t.isNullOrUndefined(this.addRowIndex)&&-1!==this.addRowIndex&&this.isAddedRowByMethod&&!this.isAddedRowByContextMenu){i=this.batchEditModule.getAddRowIndex(),this.selectedIndex=this.batchEditModule.getSelectedIndex();var f=this.parent.getBatchChanges().addedRecords,y=void 0;if(f.length)for(g=0;g<f.length;g++)t.isNullOrUndefined(f[parseInt(g.toString(),10)].uniqueID)&&(y=f[parseInt(g.toString(),10)]);var m={action:"add",data:y,index:i,seletedRow:0};this.beginAddEdit(m),this.batchEditModule.batchAddRowRecord.push(this.batchEditModule.addRowRecord),this.batchEditModule.batchAddedRecords.push(m.data)}},e.prototype.beginEdit=function(e){if("refresh"===e.requestType&&this.isOnBatch)e.cancel=!0;else if("Cell"!==this.parent.editSettings.mode||"beginEdit"!==e.requestType){if(this.doubleClickTarget&&(this.doubleClickTarget.classList.contains("e-treegridexpand")||this.doubleClickTarget.classList.contains("e-treegridcollapse")||this.doubleClickTarget.classList.contains("e-frame")))return e.cancel=!0,void(this.doubleClickTarget=null);if("delete"===e.requestType){var i=e.data;if(t.isNullOrUndefined(e.data[0].uniqueID))for(var r=this.parent.getPrimaryKeyFieldNames(),n=function(t){o.parent.flatData.filter(function(n){n[""+r[0]]===e.data[parseInt(t.toString(),10)][r[0]]&&(i[parseInt(t.toString(),10)]=n)})},o=this,a=0;a<i.length;a++)n(a);for(a=0;a<i.length;a++){this.deleteUniqueID(i[parseInt(a.toString(),10)].uniqueID);for(var s=c(i[parseInt(a.toString(),10)]),d=0;d<s.length;d++)this.deleteUniqueID(s[parseInt(d.toString(),10)].uniqueID);e.data=e.data.concat(s)}}if("add"===e.requestType||this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)){if((-1===this.parent.grid.selectedRowIndex&&this.isAddedRowByMethod||e.index!==this.parent.grid.selectedRowIndex)&&0!==e.index||(this.selectedIndex=this.parent.grid.selectedRowIndex),this.parent.enableVirtualization){var l='.e-row[data-rowindex="'+this.selectedIndex+'"]',p=void 0;this.selectedIndex>-1&&"Top"!==this.parent.editSettings.newRowPosition&&"Bottom"!==this.parent.editSettings.newRowPosition?(this.prevAriaRowIndex=this.selectedIndex.toString(),p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.prevAriaRowIndex&&"-1"!==this.prevAriaRowIndex?(l='.e-row[data-rowindex="'+this.prevAriaRowIndex+'"]',p=this.parent.getContent().querySelector(l),this.addRowIndex=p?p.rowIndex:0):this.addRowIndex=0}else this.isAddedRowByMethod&&(this.parent.enableVirtualization||this.parent.enableInfiniteScrolling)?0!==e.index?this.addRowIndex=e.index:this.addRowIndex=this.parent.grid.selectedRowIndex:this.addRowIndex=this.parent.grid.selectedRowIndex>-1?this.parent.grid.selectedRowIndex:0;(this.isAddedRowByMethod||this.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.addRowRecord)&&!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)}else e.cancel=!0},e.prototype.savePreviousRowPosition=function(){null===this.previousNewRowPosition&&(this.previousNewRowPosition=this.parent.editSettings.newRowPosition)},e.prototype.beginAddEdit=function(e){var r=e.data;if("add"===e.action){var o=this.parent.grid.getPrimaryKeyFieldNames()[0],a=null;r.taskData=t.isNullOrUndefined(r.taskData)?t.extend({},e.data):r.taskData;var s=void 0;s=this.parent.enableVirtualization&&0!==e.index?this.parent.flatData:"Batch"===this.parent.editSettings.mode&&this.isAddedRowByMethod&&!t.isNullOrUndefined(this.addRowIndex)?this.batchEditModule.batchRecords:this.parent.grid.getCurrentViewRecords(),this.parent.enableVirtualization&&0!==e.index&&(this.addRowIndex=this.parent.flatData.indexOf(this.addRowRecord),this.selectedIndex=this.addRowIndex);var d=this.addRowIndex;r.uniqueID=i.getUid(this.parent.element.id+"_data_"),t.setValue("uniqueIDCollection."+r.uniqueID,r,this.parent);var l=0,p=void 0,h=void 0,u=void 0,g=void 0,f=this.parent.enableVirtualization&&this.addRowIndex>-1&&"-1"!==this.prevAriaRowIndex,m=this.parent.getRows(),S=m.length?s.indexOf(s[0]):0,I=m.length?+m[m.length-1].getAttribute("data-rowindex"):0,w=!(!this.parent.enableVirtualization||0===e.index)||this.selectedIndex>=S&&this.selectedIndex<=I;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)||v(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)||v(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){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=y(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(xe,{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}(),Bt=function(){function e(e){i.Grid.Inject(i.CommandColumn),this.parent=e}return e.prototype.getModuleName=function(){return"commandColumn"},e.prototype.destroy=function(){},e}(),Lt=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}(),jt=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)}}(),zt=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 jt(r,e),r.prototype.getModelGenerator=function(){return new Dt(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(je),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(De,this.virtualOtherAction,this),this.parent.on(Oe,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(K,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 Ft(t.getValue("observer",this).element,t.getValue("observer",this).options),this.contents=this.getPanel().firstChild)},r.prototype.getTranslateY=function(t,i,r,o){return this.parent.dataSource instanceof n.DataManager&&void 0!==this.parent.dataSource.dataSource.url&&!this.parent.dataSource.dataSource.offline&&""!==this.parent.dataSource.dataSource.url||s(this.parent)?this.isRemoteExpand?(this.isRemoteExpand=!1,this.preTranslate):(this.preTranslate=e.prototype.getTranslateY.call(this,t,i,r,o),e.prototype.getTranslateY.call(this,t,i,r,o)):e.prototype.getTranslateY.call(this,t,i,r,o)},r.prototype.dataBoundEvent=function(){var i="initialRowTop";if(!t.isNullOrUndefined(this.parent.getRowByIndex(0))&&this.parent.getRows().length&&!this[""+i]){var r=this.parent.getRowByIndex(0).getBoundingClientRect().top,n=this.parent.element.getBoundingClientRect().top;this[""+i]=r>0?this.parent.getRowByIndex(0).getBoundingClientRect().top-n:this.content.getBoundingClientRect().top-this.parent.getRowByIndex(0).getBoundingClientRect().height}e.prototype.dataBound.call(this)},r.prototype.rowSelectedEvent=function(t){e.prototype.rowSelected.call(this,t)},r.prototype.toSelectVirtualRow=function(i){if(!this.parent.isEdit){var r="containerRect";t.isNullOrUndefined(this.observer[""+r])&&(this.observer[""+r]=this.observers[""+r]),(t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule)||0!==i.selectedIndex||t.isNullOrUndefined(this.parent.clipboardModule.treeGridParent.editModule.addRowIndex))&&e.prototype.selectVirtualRow.call(this,i)}},r.prototype.refreshCell=function(e){e.cells=this.generateCells()},r.prototype.generateCells=function(){for(var e=[],t=0;t<this.parent.columns.length;t++)e.push(this.generateCell(this.parent.columns[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="selectedRowIndex",c=this.parent.currentViewData;if(l&&"right"!==e.direction&&"left"!==e.direction){var u=+(this.parent.height.toString().indexOf("%")<0?parseInt(this.parent.height.toString(),10):this.parent.element.getBoundingClientRect().height),g=~~(a.scrollTop/r)+Math.ceil(u/r)-this.parent.pageSettings.pageSize;if(g=g>0?g:0,t.isNullOrUndefined(this[""+h])||-1===this[""+h]||g===this[""+h]||(g=this[""+h]),this.startIndex=g,this.endIndex=g+this.parent.pageSettings.pageSize,this.endIndex>this.totalRecords){var f=this.totalRecords-1,y=this.endIndex%f;this.endIndex=f,this.startIndex=this.startIndex-y<0?0:this.startIndex-y}c.length&&c[0].index>=this.parent.pageSettings.pageSize/2&&c[0].index-this.startIndex<this.parent.pageSettings.pageSize/2&&this.parent.selectionModule.isRowSelected&&(this.startIndex=c[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 S=0;if(!t.isNullOrUndefined(this.parent.getRows()[parseInt(m.toString(),10)])&&!t.isNullOrUndefined(this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)])){S=+this.parent.getContent().querySelectorAll(".e-content tr")[parseInt(m.toString(),10)].querySelector("td").getAttribute("index")}0===S?(e.offset.top=a.scrollTop,this.parent.allowRowDragAndDrop?this.translateY=e.offset.top-2*r:this.translateY=e.offset.top):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 I=~~(a.scrollTop/r),v=!(this[""+h]+this.parent.pageSettings.pageSize<this.totalRecords);t.isNullOrUndefined(this[""+h])||-1===this[""+h]||I===this[""+h]||v||(I=this[""+h]);var w=I+this.parent.pageSettings.pageSize;w>this.totalRecords&&(w=I+(this.totalRecords-I)),this.startIndex=!v||t.isNullOrUndefined(this[""+h])?w-this.parent.pageSettings.pageSize:I,this.endIndex=w,I+this.parent.pageSettings.pageSize>this.totalRecords&&this.endIndex-this.startIndex<this.parent.pageSettings.pageSize/2&&this.endIndex-I<this.parent.pageSettings.pageSize/2&&(this.startIndex=w-this.parent.pageSettings.pageSize/2),c.length&&this.startIndex>c[0].index&&this.startIndex-c[0].index<this.parent.pageSettings.pageSize/2&&this.parent.selectionModule.isRowSelected&&(this.startIndex=c[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.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 R=this.currentInfo=t.getValue("getInfoFromView",this).apply(this,[e.direction,i,e.offset]);this.previousInfo=R,this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization?R.columnIndexes:[]);var x=R.loadNext&&!R.loadSelf?R.nextInfo.page:R.page;this.parent.setProperties({pageSettings:{currentPage:x}},!0),this.requestType="virtualscroll","right"!==e.direction&&"left"!==e.direction&&(R.event="refresh-virtual-block"===R.event?"model-changed":R.event),this.parent.enableVirtualMaskRow&&(this.parent.showMaskRow(i.axis),this.parent.addShimmerEffect(),this.parent.notify("showGanttShimmer",{requestType:"showShimmer"})),this.parent.notify(R.event,{requestType:"virtualscroll",virtualInfo:R,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(De,this.virtualOtherAction),this.parent.off(Oe,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),Ft=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 jt(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),_t=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)}}(),Ht=function(){function e(e){this.prevstartIndex=-1,this.prevendIndex=-1,this.parent=e,i.Grid.Inject(Gt),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(oe,this.collapseExpandVirtualchilds,this),this.parent.on(ae,this.virtualPageAction,this),this.parent.on("destroy",this.destroy,this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(oe,this.collapseExpandVirtualchilds),this.parent.off(ae,this.virtualPageAction),this.parent.off("destroy",this.destroy))},e.prototype.collapseExpandVirtualchilds=function(e){this.parent.grid.notify(De,{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)),d=s.filter(function(e){return h(r.parent,e,s)});this.visualData=d,e.count=d.length,this.parent.grid.notify(Me,{data:d});var l={startIndex:-1,endIndex:-1,count:e.count,requestType:e.actionArgs.requestType};this.parent.grid.notify(Oe,l);var p=l.startIndex,c=l.endIndex;if(e.count=d.length,-1===p&&-1===c){var u=new n.Query,g=this.parent.grid.pageSettings.pageSize,f=g*(this.parent.grid.pageSettings.currentPage-1);u=u.skip(f).take(g),o.dataSource.json=d,e.result=o.executeLocal(u)}else{var y=e.actionArgs.requestType;("filtering"===y||"collapseAll"===y||"searching"===y||"refresh"===y&&this.parent.enableCollapseAll&&c>d.length&&t.isNullOrUndefined(this.expandCollapseRec))&&(p=0,c=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.getContent().firstElementChild.scrollTop=0,this.parent.grid.notify(De,{setTop:!0})),("save"===y&&e.actionArgs.index>=l.count-this.parent.grid.pageSettings.pageSize||"refresh"===y&&this.parent.isGantt&&this.parent.isAddedFromGantt&&this.parent.grid.pageSettings.currentPage===this.parent.grid.contentModule.maxPage)&&(p=l.startIndex+(l.count-l.endIndex),c=l.count,this.parent.isAddedFromGantt=!1);var m=this.parent.grid.contentModule.virtualEle.wrapper,S=i.getTransformValues(m).height;if(!t.isNullOrUndefined(this.expandCollapseRec)&&("virtualscroll"===e.actionArgs.requestType||"refresh"===e.actionArgs.requestType&&p!==this.prevstartIndex)&&p<this.parent.getRows().length&&c<=p+this.parent.getRows().length&&0===S&&(p=0),!t.isNullOrUndefined(this.expandCollapseRec)){var I=this.parent.getRows(),v=d.indexOf(this.expandCollapseRec);d.slice(v,v+I.length).length<I.length&&v>=0&&0!==p?(p=v=(v=d.length-I.length)>0?v:0,c=d.length):t.getValue("isCollapseAll",this.parent)&&(p=0,c=this.parent.grid.pageSettings.pageSize-1,this.parent.grid.notify(De,{setTop:!0}))}!this.parent.enableCollapseAll&&!this.parent.expandStateMapping||t.isNullOrUndefined(this.expandCollapseRec)||(e.count<this.parent.getRows()[0].getBoundingClientRect().height?p=0:this.parent.isExpandAll||(p=-1===this.prevstartIndex?0:this.prevstartIndex)),this.expandCollapseRec=null,p=p<0?0:p,0===c&&d.length>0?e.result=d:e.result=d.slice(p,c),this.prevstartIndex=p,this.prevendIndex=c}this.parent.notify("updateAction",e)},e.prototype.destroy=function(){this.removeEventListener()},e}(),Gt=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 _t(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 zt(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),Qt=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}(),Kt=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}(),Wt=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(ae,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(ae,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,y=a.data.length;l=l.skip(f).take(y)}}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=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)}})},d=0;d<r.length;d++)s(d)},e.prototype.createRows=function(e){var r,n=e.args.e,o=e.row,a=this.parent.grid.infiniteScrollModule.serviceLocator,s=new i.RowRenderer(a,null,this.parent.grid),d=this.parent.getCurrentViewRecords(),l=e.isMovable?this.parent.grid.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}();e.TreeGrid=St,e.load="load",e.rowDataBound=F,e.dataBound="dataBound",e.queryCellInfo=_,e.beforeDataBound=H,e.actionBegin=G,e.dataStateChange=Q,e.actionComplete=K,e.rowSelecting="rowSelecting",e.rowSelected=W,e.checkboxChange=Y,e.rowDeselected=J,e.toolbarClick=X,e.beforeExcelExport=$,e.beforePdfExport=Z,e.resizeStop="resizeStop",e.expanded=ee,e.expanding=te,e.collapsed=ie,e.collapsing=re,e.remoteExpand=ne,e.localPagedExpandCollapse=oe,e.pagingActions=ae,e.printGridInit=se,e.contextMenuOpen=de,e.contextMenuClick=le,e.beforeCopy="beforeCopy",e.beforePaste="beforePaste",e.savePreviousRowPosition="savePreviousRowPosition",e.crudAction=pe,e.beginEdit=he,e.beginAdd=ce,e.recordDoubleClick=ue,e.cellSave=ge,e.cellSaved=fe,e.cellEdit=ye,e.batchDelete=me,e.batchCancel=Se,e.batchAdd=Ie,e.beforeBatchDelete=ve,e.beforeBatchAdd=we,e.beforeBatchSave=Re,e.batchSave=xe,e.keyPressed=Ce,e.updateData="update-data",e.doubleTap=be,e.virtualColumnIndex="virtualColumnIndex",e.virtualActionArgs=De,e.destroy="destroy",e.dataListener=Me,e.indexModifier=Oe,e.beforeStartEdit=Pe,e.beforeBatchCancel=Ee,e.batchEditFormRendered="batcheditform-rendered",e.detailDataBound=Ae,e.rowDrag="rowDrag",e.rowDragStartHelper=Ne,e.rowDrop="rowDrop",e.rowDragStart="rowDragStart",e.rowsAdd=Ue,e.rowsRemove=ke,e.rowdraging=qe,e.rowDropped=Ve,e.autoCol="auto-col",e.rowDeselecting=Te,e.headerContent="e-headercontent",e.movableContent=Be,e.movableHeader="e-movableheader",e.frozenContent=Le,e.frozenHeader="e-frozenheader",e.content="e-content",e.table="e-table",e.leftRight="Left-Right",e.frozenRight="frozen-right",e.frozenLeft="frozen-left",e.dataColIndex="data-colindex",e.ariaColIndex="aria-colindex",e.dataRowIndex=je,e.ariaRowIndex="aria-rowindex",e.DataManipulation=$e,e.Reorder=It,e.Resize=vt,e.RowDD=wt,e.Column=x,e.TreeGridColumn=C,e.StackedColumn=b,e.EditSettings=dt,e.Predicate=A,e.FilterSettings=N,e.PageSettings=tt,e.SearchSettings=Ke,e.SelectionSettings=Je,e.AggregateColumn=nt,e.AggregateRow=ot,e.SortDescriptor=ht,e.SortSettings=ct,e.RowDropSettings=Ct,e.InfiniteScrollSettings=ft,e.LoadingIndicator=O,e.Render=Xe,e.TreeVirtualRowModelGenerator=Dt,e.isRemoteData=a,e.isCountRequired=s,e.isCheckboxcolumn=d,e.isFilterChildHierarchy=l,e.findParentRecords=p,e.getExpandStatus=h,e.findChildrenRecords=c,e.isOffline=u,e.extendArray=g,e.getPlainData=f,e.getParentData=y,e.isHidden=m,e.Filter=Mt,e.ExcelExport=Ot,e.PdfExport=Pt,e.Page=Et,e.Toolbar=At,e.Aggregate=Nt,e.Sort=Ut,e.TreeClipboard=Fe,e.ColumnMenu=kt,e.ContextMenu=qt,e.Edit=Tt,e.CommandColumn=Bt,e.Selection=_e,e.DetailRow=Lt,e.VirtualScroll=Ht,e.TreeVirtual=Gt,e.Freeze=Qt,e.ColumnChooser=Kt,e.Logger=j,e.treeGridDetails=z,e.InfiniteScroll=Wt,Object.defineProperty(e,"__esModule",{value:!0})});
11
11
  //# sourceMappingURL=ej2-treegrid.umd.min.js.map