@syncfusion/ej2-treegrid 34.2.8 → 35.1.46

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 (229) hide show
  1. package/README.md +16 -2
  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 +1054 -590
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +1159 -618
  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 +5 -5
  13. package/src/global.js +1 -1
  14. package/src/treegrid/actions/crud-actions.js +4 -9
  15. package/src/treegrid/actions/dom-virtualization.d.ts +71 -0
  16. package/src/treegrid/actions/dom-virtualization.js +251 -0
  17. package/src/treegrid/actions/edit.d.ts +1 -4
  18. package/src/treegrid/actions/edit.js +23 -191
  19. package/src/treegrid/actions/filter.js +1 -1
  20. package/src/treegrid/actions/index.d.ts +1 -0
  21. package/src/treegrid/actions/index.js +1 -0
  22. package/src/treegrid/actions/page.js +12 -6
  23. package/src/treegrid/actions/rowdragdrop.js +20 -1
  24. package/src/treegrid/actions/selection.d.ts +21 -0
  25. package/src/treegrid/actions/selection.js +198 -32
  26. package/src/treegrid/actions/summary.js +25 -9
  27. package/src/treegrid/actions/toolbar.js +8 -5
  28. package/src/treegrid/base/constant.d.ts +6 -0
  29. package/src/treegrid/base/constant.js +6 -0
  30. package/src/treegrid/base/data.d.ts +17 -0
  31. package/src/treegrid/base/data.js +189 -132
  32. package/src/treegrid/base/treegrid-model.d.ts +35 -4
  33. package/src/treegrid/base/treegrid.d.ts +45 -7
  34. package/src/treegrid/base/treegrid.js +181 -73
  35. package/src/treegrid/enum.d.ts +12 -0
  36. package/src/treegrid/models/column.d.ts +2 -2
  37. package/src/treegrid/models/dom-virtualization-settings-model.d.ts +50 -0
  38. package/src/treegrid/models/dom-virtualization-settings.d.ts +43 -0
  39. package/src/treegrid/models/dom-virtualization-settings.js +47 -0
  40. package/src/treegrid/models/index.d.ts +2 -0
  41. package/src/treegrid/models/index.js +1 -0
  42. package/src/treegrid/models/summary-model.d.ts +1 -1
  43. package/src/treegrid/models/summary.d.ts +1 -1
  44. package/src/treegrid/renderer/dom-virtual-tree-content-renderer.d.ts +20 -0
  45. package/src/treegrid/renderer/dom-virtual-tree-content-renderer.js +49 -0
  46. package/src/treegrid/renderer/index.d.ts +1 -0
  47. package/src/treegrid/renderer/index.js +1 -0
  48. package/src/treegrid/renderer/render.js +4 -3
  49. package/src/treegrid/renderer/virtual-tree-content-render.js +1 -2
  50. package/helpers/e2e/index.d.ts +0 -1
  51. package/helpers/e2e/index.js +0 -8
  52. package/helpers/e2e/treegridhelper.d.ts +0 -21
  53. package/helpers/e2e/treegridhelper.js +0 -83
  54. package/styles/bds-lite.css +0 -402
  55. package/styles/bds-lite.scss +0 -3
  56. package/styles/bds.css +0 -422
  57. package/styles/bds.scss +0 -4
  58. package/styles/bootstrap-dark-lite.css +0 -406
  59. package/styles/bootstrap-dark-lite.scss +0 -3
  60. package/styles/bootstrap-dark.css +0 -426
  61. package/styles/bootstrap-dark.scss +0 -4
  62. package/styles/bootstrap-lite.css +0 -409
  63. package/styles/bootstrap-lite.scss +0 -3
  64. package/styles/bootstrap.css +0 -432
  65. package/styles/bootstrap.scss +0 -4
  66. package/styles/bootstrap4-lite.css +0 -406
  67. package/styles/bootstrap4-lite.scss +0 -3
  68. package/styles/bootstrap4.css +0 -426
  69. package/styles/bootstrap4.scss +0 -4
  70. package/styles/bootstrap5-dark-lite.css +0 -406
  71. package/styles/bootstrap5-dark-lite.scss +0 -3
  72. package/styles/bootstrap5-dark.css +0 -426
  73. package/styles/bootstrap5-dark.scss +0 -4
  74. package/styles/bootstrap5-lite.css +0 -406
  75. package/styles/bootstrap5-lite.scss +0 -3
  76. package/styles/bootstrap5.3-lite.css +0 -490
  77. package/styles/bootstrap5.3-lite.scss +0 -3
  78. package/styles/bootstrap5.3.css +0 -510
  79. package/styles/bootstrap5.3.scss +0 -4
  80. package/styles/bootstrap5.css +0 -426
  81. package/styles/bootstrap5.scss +0 -4
  82. package/styles/fabric-dark-lite.css +0 -409
  83. package/styles/fabric-dark-lite.scss +0 -3
  84. package/styles/fabric-dark.css +0 -432
  85. package/styles/fabric-dark.scss +0 -4
  86. package/styles/fabric-lite.css +0 -409
  87. package/styles/fabric-lite.scss +0 -3
  88. package/styles/fabric.css +0 -432
  89. package/styles/fabric.scss +0 -4
  90. package/styles/fluent-dark-lite.css +0 -417
  91. package/styles/fluent-dark-lite.scss +0 -3
  92. package/styles/fluent-dark.css +0 -444
  93. package/styles/fluent-dark.scss +0 -4
  94. package/styles/fluent-lite.css +0 -417
  95. package/styles/fluent-lite.scss +0 -3
  96. package/styles/fluent.css +0 -444
  97. package/styles/fluent.scss +0 -4
  98. package/styles/fluent2-lite.css +0 -507
  99. package/styles/fluent2-lite.scss +0 -3
  100. package/styles/fluent2.css +0 -531
  101. package/styles/fluent2.scss +0 -4
  102. package/styles/highcontrast-light-lite.css +0 -406
  103. package/styles/highcontrast-light-lite.scss +0 -3
  104. package/styles/highcontrast-light.css +0 -426
  105. package/styles/highcontrast-light.scss +0 -4
  106. package/styles/highcontrast-lite.css +0 -413
  107. package/styles/highcontrast-lite.scss +0 -3
  108. package/styles/highcontrast.css +0 -439
  109. package/styles/highcontrast.scss +0 -4
  110. package/styles/material-dark-lite.css +0 -406
  111. package/styles/material-dark-lite.scss +0 -3
  112. package/styles/material-dark.css +0 -426
  113. package/styles/material-dark.scss +0 -4
  114. package/styles/material-lite.css +0 -406
  115. package/styles/material-lite.scss +0 -3
  116. package/styles/material.css +0 -426
  117. package/styles/material.scss +0 -4
  118. package/styles/material3-dark-lite.css +0 -488
  119. package/styles/material3-dark-lite.scss +0 -3
  120. package/styles/material3-dark.css +0 -508
  121. package/styles/material3-dark.scss +0 -4
  122. package/styles/material3-lite.css +0 -490
  123. package/styles/material3-lite.scss +0 -3
  124. package/styles/material3.css +0 -510
  125. package/styles/material3.scss +0 -4
  126. package/styles/tailwind-dark-lite.css +0 -406
  127. package/styles/tailwind-dark-lite.scss +0 -3
  128. package/styles/tailwind-dark.css +0 -426
  129. package/styles/tailwind-dark.scss +0 -4
  130. package/styles/tailwind-lite.css +0 -406
  131. package/styles/tailwind-lite.scss +0 -3
  132. package/styles/tailwind.css +0 -426
  133. package/styles/tailwind.scss +0 -4
  134. package/styles/tailwind3-lite.css +0 -480
  135. package/styles/tailwind3-lite.scss +0 -3
  136. package/styles/tailwind3.css +0 -500
  137. package/styles/tailwind3.scss +0 -4
  138. package/styles/treegrid/_all.scss +0 -2
  139. package/styles/treegrid/_bds-definition.scss +0 -28
  140. package/styles/treegrid/_bigger.scss +0 -70
  141. package/styles/treegrid/_bootstrap-dark-definition.scss +0 -33
  142. package/styles/treegrid/_bootstrap-definition.scss +0 -33
  143. package/styles/treegrid/_bootstrap4-definition.scss +0 -33
  144. package/styles/treegrid/_bootstrap5-dark-definition.scss +0 -28
  145. package/styles/treegrid/_bootstrap5-definition.scss +0 -28
  146. package/styles/treegrid/_bootstrap5.3-definition.scss +0 -28
  147. package/styles/treegrid/_fabric-dark-definition.scss +0 -33
  148. package/styles/treegrid/_fabric-definition.scss +0 -33
  149. package/styles/treegrid/_fluent-dark-definition.scss +0 -29
  150. package/styles/treegrid/_fluent-definition.scss +0 -29
  151. package/styles/treegrid/_fluent2-definition.scss +0 -28
  152. package/styles/treegrid/_fusionnew-definition.scss +0 -26
  153. package/styles/treegrid/_highcontrast-definition.scss +0 -33
  154. package/styles/treegrid/_highcontrast-light-definition.scss +0 -33
  155. package/styles/treegrid/_icons.scss +0 -47
  156. package/styles/treegrid/_layout.scss +0 -531
  157. package/styles/treegrid/_material-dark-definition.scss +0 -33
  158. package/styles/treegrid/_material-definition.scss +0 -33
  159. package/styles/treegrid/_material3-dark-definition.scss +0 -28
  160. package/styles/treegrid/_material3-definition.scss +0 -28
  161. package/styles/treegrid/_tailwind-dark-definition.scss +0 -28
  162. package/styles/treegrid/_tailwind-definition.scss +0 -28
  163. package/styles/treegrid/_tailwind3-definition.scss +0 -28
  164. package/styles/treegrid/_theme.scss +0 -1
  165. package/styles/treegrid/_variables.scss +0 -2
  166. package/styles/treegrid/bds.css +0 -422
  167. package/styles/treegrid/bds.scss +0 -4
  168. package/styles/treegrid/bootstrap-dark.css +0 -426
  169. package/styles/treegrid/bootstrap-dark.scss +0 -4
  170. package/styles/treegrid/bootstrap.css +0 -432
  171. package/styles/treegrid/bootstrap.scss +0 -4
  172. package/styles/treegrid/bootstrap4.css +0 -426
  173. package/styles/treegrid/bootstrap4.scss +0 -4
  174. package/styles/treegrid/bootstrap5-dark.css +0 -426
  175. package/styles/treegrid/bootstrap5-dark.scss +0 -4
  176. package/styles/treegrid/bootstrap5.3.css +0 -510
  177. package/styles/treegrid/bootstrap5.3.scss +0 -4
  178. package/styles/treegrid/bootstrap5.css +0 -426
  179. package/styles/treegrid/bootstrap5.scss +0 -4
  180. package/styles/treegrid/fabric-dark.css +0 -432
  181. package/styles/treegrid/fabric-dark.scss +0 -4
  182. package/styles/treegrid/fabric.css +0 -432
  183. package/styles/treegrid/fabric.scss +0 -4
  184. package/styles/treegrid/fluent-dark.css +0 -444
  185. package/styles/treegrid/fluent-dark.scss +0 -4
  186. package/styles/treegrid/fluent.css +0 -444
  187. package/styles/treegrid/fluent.scss +0 -4
  188. package/styles/treegrid/fluent2.css +0 -531
  189. package/styles/treegrid/fluent2.scss +0 -4
  190. package/styles/treegrid/highcontrast-light.css +0 -426
  191. package/styles/treegrid/highcontrast-light.scss +0 -4
  192. package/styles/treegrid/highcontrast.css +0 -439
  193. package/styles/treegrid/highcontrast.scss +0 -4
  194. package/styles/treegrid/icons/_bds.scss +0 -38
  195. package/styles/treegrid/icons/_bootstrap-dark.scss +0 -48
  196. package/styles/treegrid/icons/_bootstrap.scss +0 -48
  197. package/styles/treegrid/icons/_bootstrap4.scss +0 -48
  198. package/styles/treegrid/icons/_bootstrap5-dark.scss +0 -1
  199. package/styles/treegrid/icons/_bootstrap5.3.scss +0 -48
  200. package/styles/treegrid/icons/_bootstrap5.scss +0 -48
  201. package/styles/treegrid/icons/_fabric-dark.scss +0 -48
  202. package/styles/treegrid/icons/_fabric.scss +0 -48
  203. package/styles/treegrid/icons/_fluent-dark.scss +0 -1
  204. package/styles/treegrid/icons/_fluent.scss +0 -48
  205. package/styles/treegrid/icons/_fluent2.scss +0 -48
  206. package/styles/treegrid/icons/_fusionnew.scss +0 -31
  207. package/styles/treegrid/icons/_highcontrast-light.scss +0 -48
  208. package/styles/treegrid/icons/_highcontrast.scss +0 -48
  209. package/styles/treegrid/icons/_material-dark.scss +0 -48
  210. package/styles/treegrid/icons/_material.scss +0 -48
  211. package/styles/treegrid/icons/_material3-dark.scss +0 -1
  212. package/styles/treegrid/icons/_material3.scss +0 -48
  213. package/styles/treegrid/icons/_tailwind-dark.scss +0 -48
  214. package/styles/treegrid/icons/_tailwind.scss +0 -48
  215. package/styles/treegrid/icons/_tailwind3.scss +0 -48
  216. package/styles/treegrid/material-dark.css +0 -426
  217. package/styles/treegrid/material-dark.scss +0 -4
  218. package/styles/treegrid/material.css +0 -426
  219. package/styles/treegrid/material.scss +0 -4
  220. package/styles/treegrid/material3-dark.css +0 -508
  221. package/styles/treegrid/material3-dark.scss +0 -4
  222. package/styles/treegrid/material3.css +0 -510
  223. package/styles/treegrid/material3.scss +0 -4
  224. package/styles/treegrid/tailwind-dark.css +0 -426
  225. package/styles/treegrid/tailwind-dark.scss +0 -4
  226. package/styles/treegrid/tailwind.css +0 -426
  227. package/styles/treegrid/tailwind.scss +0 -4
  228. package/styles/treegrid/tailwind3.css +0 -500
  229. package/styles/treegrid/tailwind3.scss +0 -4
@@ -1,5 +1,5 @@
1
1
  import { merge, Property, ChildProperty, Collection, isNullOrUndefined, Browser, initializeTelemetryFeature, removeClass, addClass, getValue, createElement, setValue, extend as extend$1, Internationalization, getEnumValue, compile, Component, initializeTelemetry, L10n, EventHandler, KeyboardEvents, SanitizeHtmlHelper, Complex, Event, NotifyPropertyChanges, closest, setStyleAttribute, select, classList, debounce, remove } from '@syncfusion/ej2-base';
2
- import { Logger as Logger$1, Grid, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, setEnableSeamlessScrolling, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, RowDD as RowDD$1, Scroll, VirtualRowModelGenerator, Filter as Filter$1, ExcelExport as ExcelExport$1, Data, ExportHelper, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, Aggregate as Aggregate$1, calculateAggregate, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, Edit as Edit$1, resetRowIndex, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, VirtualContentRenderer, Cell, getVisiblePage, InterSectionObserver, getTransformValues, VirtualScroll as VirtualScroll$1, RenderType, VirtualHeaderRenderer, ColumnChooser as ColumnChooser$1, InfiniteScroll as InfiniteScroll$1, getRowIndexFromElement, RowRenderer } from '@syncfusion/ej2-grids';
2
+ import { Logger as Logger$1, Grid, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, setEnableSeamlessScrolling, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, RowDD as RowDD$1, Scroll, VirtualRowModelGenerator, DomVirtualContentRenderer, Filter as Filter$1, ExcelExport as ExcelExport$1, Data, ExportHelper, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, Aggregate as Aggregate$1, calculateAggregate, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, Edit as Edit$1, resetRowIndex, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, VirtualContentRenderer, Cell, getVisiblePage, InterSectionObserver, getTransformValues, VirtualScroll as VirtualScroll$1, RenderType, VirtualHeaderRenderer, ColumnChooser as ColumnChooser$1, InfiniteScroll as InfiniteScroll$1, getRowIndexFromElement, RowRenderer, destroy as destroy$1, DomVirtualization as DomVirtualization$1, initialLoad } from '@syncfusion/ej2-grids';
3
3
  import { createCheckBox } from '@syncfusion/ej2-buttons';
4
4
  import { DataManager, ODataAdaptor, WebApiAdaptor, WebMethodAdaptor, CacheAdaptor, UrlAdaptor, Query, DataUtil, RemoteSaveAdaptor, Deferred, JsonAdaptor, Predicate as Predicate$1 } from '@syncfusion/ej2-data';
5
5
  import { showSpinner, hideSpinner, createSpinner } from '@syncfusion/ej2-popups';
@@ -389,6 +389,8 @@ const remoteExpand = 'remoteExpand';
389
389
  /** @hidden */
390
390
  const localPagedExpandCollapse = 'localPagedExpandCollapse';
391
391
  /** @hidden */
392
+ const virtualExpandCollapse = 'virtualExpandCollapse';
393
+ /** @hidden */
392
394
  const pagingActions = 'pagingActions';
393
395
  /** @hidden */
394
396
  const printGridInit = 'printGrid-Init';
@@ -502,6 +504,10 @@ const ariaRowIndex = 'aria-rowindex';
502
504
  const actionFailure = 'actionFailure';
503
505
  /** @hidden */
504
506
  const collapseActionComplete = 'collapseActionComplete';
507
+ /** @hidden */
508
+ const hierarchyCheckstateUpdate = 'hierarchy-checkstate-update';
509
+ /** @hidden */
510
+ const beforeDomVirtualRenderRows = 'before-dom-virtual-rows-render';
505
511
 
506
512
  /**
507
513
  * The `Clipboard` module is used to handle clipboard copy action.
@@ -946,6 +952,7 @@ class Selection {
946
952
  this.parent.on('updateGridActions', this.updateGridActions, this);
947
953
  this.parent.grid.on('colgroup-refresh', this.headerCheckbox, this);
948
954
  this.parent.on('checkboxSelection', this.checkboxSelection, this);
955
+ this.parent.on(hierarchyCheckstateUpdate, this.rowDropCompleteSelection, this);
949
956
  }
950
957
  /**
951
958
  * Removes previously added event listeners.
@@ -961,6 +968,7 @@ class Selection {
961
968
  this.parent.grid.off('colgroup-refresh', this.headerCheckbox);
962
969
  this.parent.off('checkboxSelection', this.checkboxSelection);
963
970
  this.parent.off('updateGridActions', this.updateGridActions);
971
+ this.parent.off(hierarchyCheckstateUpdate, this.rowDropCompleteSelection);
964
972
  }
965
973
  /**
966
974
  * Destroys the selection module and clears internal caches.
@@ -1007,8 +1015,9 @@ class Selection {
1007
1015
  this.selectCheckboxes(rowIndex);
1008
1016
  const newCheckState = checkBox.nextElementSibling.classList.contains('e-check');
1009
1017
  this.triggerChkChangeEvent(checkBox, newCheckState, target.closest('tr'));
1018
+ this.updateHeaderCheckboxState();
1010
1019
  }
1011
- else if (checkWrap && checkWrap.querySelectorAll('.e-treeselectall').length > 0 && this.parent.autoCheckHierarchy) {
1020
+ else if (checkWrap && checkWrap.querySelectorAll('.e-treeselectall').length > 0) {
1012
1021
  const frame = checkWrap.querySelector('.e-frame');
1013
1022
  const targetState = frame.classList.contains('e-uncheck') || frame.classList.contains('e-stop');
1014
1023
  this.headerSelection(targetState);
@@ -1085,8 +1094,9 @@ class Selection {
1085
1094
  const headerElement = this.parent.getHeaderContent().querySelectorAll('.e-headercelldiv')[this.columnIndex];
1086
1095
  if (headerElement && headerElement.querySelectorAll('.e-treeselectall').length === 0) {
1087
1096
  const value = false; // Initial state can be false.
1088
- const rowChkBox = this.parent.createElement('input', { className: 'e-treeselectall', attrs: { 'type': 'checkbox' } });
1097
+ const rowChkBox = this.parent.createElement('input', { className: 'e-treeselectall', attrs: { 'type': 'checkbox', 'aria-label': 'Select all checkbox' } });
1089
1098
  const checkWrap = createCheckBox(this.parent.createElement, false, { checked: value, label: ' ' });
1099
+ headerElement.classList.add('e-headerchkcelldiv');
1090
1100
  checkWrap.classList.add('e-hierarchycheckbox');
1091
1101
  checkWrap.insertBefore(rowChkBox.cloneNode(), checkWrap.firstChild);
1092
1102
  if (!isNullOrUndefined(headerElement)) {
@@ -1103,6 +1113,7 @@ class Selection {
1103
1113
  this.headerSelection();
1104
1114
  } // Update status based on current selections
1105
1115
  }
1116
+ this.updateHeaderCheckboxState();
1106
1117
  }
1107
1118
  }
1108
1119
  /**
@@ -1175,7 +1186,16 @@ class Selection {
1175
1186
  for (let i = 0; i < rowIndexes.length; i++) {
1176
1187
  const viewRec = this.parent.getCurrentViewRecords()[rowIndexes[parseInt(i.toString(), 10)]];
1177
1188
  const flatRec = getParentData(this.parent, viewRec.uniqueID);
1178
- const nextState = (flatRec.checkboxState === 'check') ? 'uncheck' : 'check';
1189
+ let nextState;
1190
+ if (flatRec.checkboxState === 'check') {
1191
+ nextState = 'uncheck';
1192
+ }
1193
+ else if (flatRec.checkboxState === 'indeterminate') {
1194
+ nextState = this.shouldConsiderAllChildren() ? 'uncheck' : 'check';
1195
+ }
1196
+ else {
1197
+ nextState = 'check';
1198
+ }
1179
1199
  flatRec.checkboxState = nextState;
1180
1200
  viewRec.checkboxState = nextState;
1181
1201
  this.traverSelection(flatRec, nextState, false);
@@ -1198,7 +1218,7 @@ class Selection {
1198
1218
  if ((!effectiveChildren || effectiveChildren.length === 0) && this.parent.autoCheckHierarchy) {
1199
1219
  effectiveChildren = this.getChildrenFromFlat(record);
1200
1220
  }
1201
- if (this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0
1221
+ if (this.parent.hierarchyCheckboxMode === 'filteredHierarchy' && this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0
1202
1222
  && effectiveChildren && effectiveChildren.length) {
1203
1223
  effectiveChildren = this.getFilteredChildRecords(effectiveChildren);
1204
1224
  }
@@ -1244,9 +1264,16 @@ class Selection {
1244
1264
  indeterminate: indeterminateCount
1245
1265
  };
1246
1266
  }
1247
- const summary = this.parentSelectionCounters[record.uniqueID];
1267
+ let summary = this.parentSelectionCounters[record.uniqueID];
1268
+ if (this.shouldConsiderAllChildren()) {
1269
+ summary = this.buildSelectionSummary(record, true, true);
1270
+ if (record.uniqueID) {
1271
+ this.parentSelectionCounters[record.uniqueID] = summary;
1272
+ }
1273
+ }
1248
1274
  let finalState = this.deriveParentState(record, summary);
1249
- if (checkboxState === 'check' && summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0) {
1275
+ if (checkboxState === 'check' && summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0
1276
+ && !this.shouldConsiderAllChildren()) {
1250
1277
  finalState = 'check';
1251
1278
  }
1252
1279
  this.updateSelectedItems(record, finalState);
@@ -1311,7 +1338,9 @@ class Selection {
1311
1338
  if (!parent) {
1312
1339
  return;
1313
1340
  }
1314
- const summary = this.buildSelectionSummary(parent);
1341
+ const ignoreFilter = this.parent.hierarchyCheckboxMode === 'filteredHierarchy';
1342
+ const useFullChildList = this.shouldConsiderAllChildren();
1343
+ const summary = this.buildSelectionSummary(parent, !ignoreFilter, useFullChildList);
1315
1344
  if (previousChildState) {
1316
1345
  this.applySummaryDelta(summary, previousChildState, -1);
1317
1346
  }
@@ -1325,11 +1354,10 @@ class Selection {
1325
1354
  if (parent.checkboxState === desiredState) {
1326
1355
  return;
1327
1356
  }
1328
- const parentPrev = parent.checkboxState;
1329
1357
  parent.checkboxState = desiredState;
1330
1358
  this.updateSelectedItems(parent, desiredState);
1331
1359
  if (parent.parentItem) {
1332
- this.updateParentSelection(parent.parentItem, parentPrev, desiredState);
1360
+ this.updateParentSelection(parent.parentItem);
1333
1361
  }
1334
1362
  }
1335
1363
  /**
@@ -1337,9 +1365,11 @@ class Selection {
1337
1365
  *
1338
1366
  * @param {Object} record - The record whose children should be summarized.
1339
1367
  * @param {boolean} [ignoreFilter] - If true, ignore current filter when computing summary.
1368
+ * @param {boolean} [useFullChildList] - If true, skip the `getFilteredChildRecords` narrowing
1369
+ * step even when a filter is active.
1340
1370
  * @returns {{ total: number, checked: number, indeterminate: number }} The computed summary.
1341
1371
  */
1342
- buildSelectionSummary(record, ignoreFilter) {
1372
+ buildSelectionSummary(record, ignoreFilter, useFullChildList) {
1343
1373
  const summary = { total: 0, checked: 0, indeterminate: 0 };
1344
1374
  let children = [];
1345
1375
  if (record && Array.isArray(record.childRecords) && record.childRecords.length) {
@@ -1348,7 +1378,8 @@ class Selection {
1348
1378
  else {
1349
1379
  children = this.getChildrenFromFlat(record);
1350
1380
  }
1351
- if (!ignoreFilter && this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0) {
1381
+ const filterActive = !!(this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0);
1382
+ if (!ignoreFilter && !useFullChildList && filterActive) {
1352
1383
  children = this.getFilteredChildRecords(children);
1353
1384
  }
1354
1385
  for (let i = 0; i < children.length; i++) {
@@ -1367,6 +1398,22 @@ class Selection {
1367
1398
  }
1368
1399
  return summary;
1369
1400
  }
1401
+ /**
1402
+ * Decides whether the parent `checkboxState` derivation should consider the full original
1403
+ * child set instead of the filtered subset.
1404
+ *
1405
+ * @returns {boolean} `true` when derivation should use the full child list.
1406
+ */
1407
+ shouldConsiderAllChildren() {
1408
+ if (this.parent.hierarchyCheckboxMode !== 'filteredHierarchy') {
1409
+ return false;
1410
+ }
1411
+ const filterActive = !!(this.parent.filterModule && this.parent.filterModule.filteredResult &&
1412
+ this.parent.filterModule.filteredResult.length > 0);
1413
+ const searchActive = !!(this.parent.grid && this.parent.grid.searchSettings && this.parent.grid.searchSettings.key &&
1414
+ this.parent.grid.searchSettings.key.length);
1415
+ return filterActive || searchActive;
1416
+ }
1370
1417
  /**
1371
1418
  * Applies a delta to a selection summary based on a state change.
1372
1419
  *
@@ -1431,7 +1478,14 @@ class Selection {
1431
1478
  && !this.parent.grid.searchSettings.key.length) {
1432
1479
  this.filteredList = [];
1433
1480
  }
1434
- const records = this.resolveHeaderSelectionList(true);
1481
+ let records = this.resolveHeaderSelectionList(true);
1482
+ if (!isNullOrUndefined(checkAll)
1483
+ && (this.parent.hierarchyCheckboxMode === 'hierarchy' ||
1484
+ (this.parent.hierarchyCheckboxMode === 'filteredHierarchy' && checkAll))
1485
+ && !isRemoteData(this.parent)
1486
+ && this.parent.flatData.length > records.length) {
1487
+ records = this.parent.flatData;
1488
+ }
1435
1489
  if (!isNullOrUndefined(checkAll)) {
1436
1490
  this.resetSelectionCaches();
1437
1491
  const targetState = checkAll ? 'check' : 'uncheck';
@@ -1455,16 +1509,18 @@ class Selection {
1455
1509
  */
1456
1510
  finalizeParentsAfterBulk(records) {
1457
1511
  const all = records;
1512
+ const useFullChildList = this.shouldConsiderAllChildren();
1458
1513
  for (let i = 0; i < all.length; i++) {
1459
1514
  const rec = all[parseInt(i.toString(), 10)];
1460
1515
  if (!rec || !rec.hasChildRecords) {
1461
1516
  continue;
1462
1517
  }
1463
- const summary = this.buildSelectionSummary(rec, true);
1518
+ const summary = this.buildSelectionSummary(rec, true, useFullChildList);
1464
1519
  this.parentSelectionCounters[rec.uniqueID] = summary;
1465
1520
  let finalState = this.deriveParentState(rec, summary);
1466
1521
  if (this.headerSelectionState === 'check' &&
1467
- summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0) {
1522
+ summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0 &&
1523
+ !useFullChildList) {
1468
1524
  finalState = 'check';
1469
1525
  }
1470
1526
  else if (this.headerSelectionState === 'uncheck') {
@@ -1514,14 +1570,30 @@ class Selection {
1514
1570
  const hasSearch = !!(this.parent.grid && this.parent.grid.searchSettings &&
1515
1571
  this.parent.grid.searchSettings.key && this.parent.grid.searchSettings.key.length);
1516
1572
  const isFilterOrSearch = hasFilter || hasSearch || requestType === 'refresh' || requestType === 'searching';
1573
+ const isSortOrPageRequest = requestType === 'sorting' || requestType === 'paging';
1574
+ const isFilterCleared = (requestType === 'filtering' || requestType === 'searching' ||
1575
+ requestType === 'refresh') && !isFilterOrSearch;
1576
+ const shouldUpdateParents = isSortOrPageRequest || isFilterCleared;
1517
1577
  const currentlySelectedItemsInOrder = isFilterOrSearch ? records : this.selectedItems.slice();
1578
+ const parentsToUpdate = shouldUpdateParents && this.parent.flatData ?
1579
+ this.parent.flatData : currentlySelectedItemsInOrder;
1518
1580
  const newSelectedItems = [];
1519
1581
  const newSelectedUidMap = new Map();
1520
1582
  const newSelectedIndexes = [];
1521
- for (const item of currentlySelectedItemsInOrder) {
1522
- if (item.hasChildRecords && isFilterOrSearch && item.level === 0 && this.parent.autoCheckHierarchy) {
1523
- this.updateParentSelection(item);
1583
+ for (const item of parentsToUpdate) {
1584
+ if (shouldUpdateParents && item.hasChildRecords && item.level === 0 && this.parent.autoCheckHierarchy) {
1585
+ const actualRecord = this.getRecordFromUidCollection(item);
1586
+ const isFilteredHierarchyMode = this.parent.hierarchyCheckboxMode === 'filteredHierarchy';
1587
+ if (isFilterCleared && isFilteredHierarchyMode && actualRecord &&
1588
+ (actualRecord.checkboxState === 'check' || actualRecord.checkboxState === 'uncheck')) {
1589
+ this.traverSelection(actualRecord, actualRecord.checkboxState, false);
1590
+ }
1591
+ else {
1592
+ this.updateParentSelection(item);
1593
+ }
1524
1594
  }
1595
+ }
1596
+ for (const item of currentlySelectedItemsInOrder) {
1525
1597
  const actualItem = this.getRecordFromUidCollection(item);
1526
1598
  if (actualItem.uniqueID && actualItem.checkboxState === 'check') {
1527
1599
  newSelectedItems.push(actualItem);
@@ -1838,7 +1910,8 @@ class Selection {
1838
1910
  else if (args.requestType === 'add' && this.parent.autoCheckHierarchy) {
1839
1911
  args.data.checkboxState = 'uncheck';
1840
1912
  }
1841
- else if (requestType === 'filtering' || requestType === 'searching' || requestType === 'refresh') {
1913
+ else if (requestType === 'filtering' || requestType === 'searching' || requestType === 'refresh' ||
1914
+ requestType === 'save' || requestType === 'cancel') {
1842
1915
  this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(), requestType);
1843
1916
  this.refreshVisibleCheckboxes();
1844
1917
  if (this.parent.autoCheckHierarchy) {
@@ -1850,21 +1923,107 @@ class Selection {
1850
1923
  if ((requestType === 'filtering' || requestType === 'searching' || requestType === 'refresh' ||
1851
1924
  requestType === 'sorting' || requestType === 'paging' || requestType === 'expanding' ||
1852
1925
  requestType === 'expand' || requestType === 'collapsing' || requestType === 'collapse') && !isRemoteData(this.parent)) {
1853
- if (!(isCheckboxcolumn(this.parent) && (requestType === 'refresh' && this.parent['isVirtualExpandCollapse']))) {
1854
- this.selectedItems = [];
1855
- this.selectedUidMap = new Map();
1856
- this.selectedIndexes = [];
1857
- }
1858
- if (requestType === 'filtering' || requestType === 'searching' || requestType === 'sorting') {
1859
- this.headerSelection(false);
1860
- }
1926
+ this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(), requestType);
1861
1927
  this.refreshVisibleCheckboxes();
1862
- if (this.parent.autoCheckHierarchy) {
1863
- this.updateHeaderCheckboxState();
1864
- }
1928
+ this.updateHeaderCheckboxState();
1929
+ }
1930
+ }
1931
+ }
1932
+ }
1933
+ /**
1934
+ *
1935
+ * @param {Object} args - The notification payload from `rowDragdrop.dropRows`.
1936
+ * @returns {void}
1937
+ */
1938
+ rowDropCompleteSelection(args) {
1939
+ const dragged = args.draggedRecords;
1940
+ const draggedUids = new Set();
1941
+ for (let dragIndex = 0; dragIndex < dragged.length; dragIndex++) {
1942
+ const draggedRecord = dragged[parseInt(dragIndex.toString(), 10)];
1943
+ const draggedUid = draggedRecord.uniqueID;
1944
+ if (draggedUid) {
1945
+ draggedUids.add(draggedUid);
1946
+ }
1947
+ }
1948
+ const walked = new Set();
1949
+ const deriveState = (startingRecord) => {
1950
+ if (!startingRecord) {
1951
+ return;
1952
+ }
1953
+ const recordUid = startingRecord.uniqueID;
1954
+ if (!recordUid || walked.has(recordUid) || draggedUids.has(recordUid)) {
1955
+ return;
1956
+ }
1957
+ const liveRecord = this.parent.uniqueIDCollection[String(recordUid)] || startingRecord;
1958
+ walked.add(recordUid);
1959
+ const childRecords = this.getChildrenFromFlat(liveRecord);
1960
+ let totalChildren = 0;
1961
+ let checkedChildren = 0;
1962
+ let indeterminateChildren = 0;
1963
+ for (let childIndex = 0; childIndex < childRecords.length; childIndex++) {
1964
+ const childRecord = childRecords[parseInt(childIndex.toString(), 10)];
1965
+ if (!childRecord || childRecord.isSummaryRow) {
1966
+ continue;
1967
+ }
1968
+ if (childRecord.hasChildRecords) {
1969
+ deriveState(childRecord);
1970
+ }
1971
+ totalChildren++;
1972
+ if (childRecord.checkboxState === 'check') {
1973
+ checkedChildren++;
1974
+ }
1975
+ else if (childRecord.checkboxState === 'indeterminate') {
1976
+ indeterminateChildren++;
1977
+ }
1978
+ }
1979
+ const summary = {
1980
+ total: totalChildren,
1981
+ checked: checkedChildren,
1982
+ indeterminate: indeterminateChildren
1983
+ };
1984
+ this.parentSelectionCounters[`${recordUid}`] = summary;
1985
+ const desiredState = this.deriveParentState(liveRecord, { total: totalChildren, checked: checkedChildren, indeterminate: indeterminateChildren });
1986
+ if (liveRecord.checkboxState !== desiredState) {
1987
+ this.updateSelectedItems(liveRecord, desiredState);
1988
+ }
1989
+ };
1990
+ const startingAncestors = [];
1991
+ const startingAncestorUids = new Set();
1992
+ const collectAncestorChain = (record) => {
1993
+ let currentRecord = record;
1994
+ while (currentRecord) {
1995
+ const currentUid = currentRecord.uniqueID;
1996
+ if (currentUid && !startingAncestorUids.has(currentUid)) {
1997
+ startingAncestors.push(currentRecord);
1998
+ startingAncestorUids.add(currentUid);
1999
+ }
2000
+ currentRecord = currentRecord.parentItem;
2001
+ }
2002
+ };
2003
+ if (args && args.oldParents) {
2004
+ for (let oldIndex = 0; oldIndex < args.oldParents.length; oldIndex++) {
2005
+ const oldParent = args.oldParents[parseInt(oldIndex.toString(), 10)];
2006
+ if (oldParent) {
2007
+ collectAncestorChain(oldParent);
1865
2008
  }
1866
2009
  }
1867
2010
  }
2011
+ for (let dragIndex = 0; dragIndex < dragged.length; dragIndex++) {
2012
+ const draggedRecord = dragged[parseInt(dragIndex.toString(), 10)];
2013
+ const newParent = draggedRecord && draggedRecord.parentItem;
2014
+ if (newParent) {
2015
+ collectAncestorChain(newParent);
2016
+ }
2017
+ }
2018
+ if (args && args.droppedRecord && args.dropPosition === 'middleSegment') {
2019
+ collectAncestorChain(args.droppedRecord);
2020
+ }
2021
+ for (let startIndex = 0; startIndex < startingAncestors.length; startIndex++) {
2022
+ deriveState(startingAncestors[parseInt(startIndex.toString(), 10)]);
2023
+ }
2024
+ this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(true), '');
2025
+ this.refreshVisibleCheckboxes();
2026
+ this.updateHeaderCheckboxState();
1868
2027
  }
1869
2028
  /**
1870
2029
  * Retrieves checked record objects.
@@ -1891,6 +2050,17 @@ class Selection {
1891
2050
  }
1892
2051
  return orderedVisibleIndexes;
1893
2052
  }
2053
+ /**
2054
+ * Deletes all currently checked records in the TreeGrid.
2055
+ *
2056
+ * @returns {void}
2057
+ */
2058
+ deleteCheckedRecords() {
2059
+ if (!isNullOrUndefined(this.parent.editModule) && !isNullOrUndefined(this.parent.editSettings)
2060
+ && this.parent.editSettings.allowDeleting) {
2061
+ this.parent.deleteRecord(this.parent.getPrimaryKeyFieldNames()[0], this.getCheckedrecords());
2062
+ }
2063
+ }
1894
2064
  }
1895
2065
 
1896
2066
  /**
@@ -2045,7 +2215,7 @@ class Render {
2045
2215
  const collapsed = (this.parent.initialRender && (!(isNullOrUndefined(parentData[this.parent.expandStateMapping]) ||
2046
2216
  parentData[this.parent.expandStateMapping]) || this.parent.enableCollapseAll)) ||
2047
2217
  !getExpandStatus(this.parent, args.data, this.parent.grid.getCurrentViewRecords());
2048
- if (collapsed && !isNullOrUndefined(args.row)) {
2218
+ if (collapsed && !isNullOrUndefined(args.row) && !this.parent.enableDomVirtualization) {
2049
2219
  this.parent['toggleRowVisibility'](args.row, 'e-childrow-hidden');
2050
2220
  const rowsObj = this.parent.grid.getRowsObject();
2051
2221
  if (!this.parent.grid.isFrozenGrid() && !isNullOrUndefined(args.row.getAttribute('data-uid'))) {
@@ -2058,7 +2228,8 @@ class Render {
2058
2228
  const parentrec = this.parent.getCurrentViewRecords().filter((rec) => {
2059
2229
  return getValue(proxy.idMapping, rec) === getValue(proxy.parentIdMapping, data);
2060
2230
  });
2061
- if (parentrec.length > 0 && !parentrec[0].isSummaryRow && !isNullOrUndefined(args.row)) {
2231
+ if (parentrec.length > 0 && !parentrec[0].isSummaryRow && !isNullOrUndefined(args.row) &&
2232
+ !this.parent.enableDomVirtualization) {
2062
2233
  const display = parentrec[0].expanded ? 'e-childrow-visible' : 'e-childrow-hidden';
2063
2234
  this.parent['toggleRowVisibility'](args.row, display);
2064
2235
  }
@@ -2080,7 +2251,7 @@ class Render {
2080
2251
  else if (args.row.querySelector('.e-treegridcollapse')) {
2081
2252
  args.row.setAttribute('aria-expanded', 'false');
2082
2253
  }
2083
- if (this.parent.enableCollapseAll && this.parent.initialRender) {
2254
+ if (this.parent.enableCollapseAll && this.parent.initialRender && !this.parent.enableDomVirtualization) {
2084
2255
  if (!isNullOrUndefined(data.parentItem)) {
2085
2256
  this.parent['toggleRowVisibility'](args.row, 'e-childrow-hidden');
2086
2257
  }
@@ -2422,6 +2593,8 @@ class DataManipulation {
2422
2593
  this.addEventListener();
2423
2594
  this.dataResults = {};
2424
2595
  this.isSelfReference = !isNullOrUndefined(this.parent.parentIdMapping);
2596
+ this.enableCollapseAll = this.parent.enableCollapseAll;
2597
+ this.uniqueIDCollection = this.parent.uniqueIDCollection;
2425
2598
  }
2426
2599
  /**
2427
2600
  * @hidden
@@ -2530,17 +2703,19 @@ class DataManipulation {
2530
2703
  this.hierarchyData = data;
2531
2704
  }
2532
2705
  else {
2706
+ const idMapping = this.parent.idMapping;
2533
2707
  const keys = Object.keys(data);
2534
2708
  for (let i = 0; i < keys.length; i++) {
2535
2709
  const tempData = data[parseInt(i.toString(), 10)];
2536
2710
  this.hierarchyData.push(extend$1({}, tempData));
2537
- if (!isNullOrUndefined(tempData[this.parent.idMapping])) {
2538
- this.taskIds.push(tempData[this.parent.idMapping]);
2711
+ if (!isNullOrUndefined(tempData[`${idMapping}`])) {
2712
+ this.taskIds.push(tempData[`${idMapping}`]);
2539
2713
  }
2540
2714
  }
2541
2715
  }
2542
2716
  if (this.isSelfReference) {
2543
2717
  const selfData = [];
2718
+ const childMapping = this.parent.childMapping;
2544
2719
  const mappingData = new DataManager(this.hierarchyData).executeLocal(new Query()
2545
2720
  .group(this.parent.parentIdMapping));
2546
2721
  for (let i = 0; i < mappingData.length; i++) {
@@ -2549,7 +2724,7 @@ class DataManipulation {
2549
2724
  if (!isNullOrUndefined(groupData.key)) {
2550
2725
  if (index > -1) {
2551
2726
  const childData = (groupData.items);
2552
- this.hierarchyData[parseInt(index.toString(), 10)][this.parent.childMapping] = childData;
2727
+ this.hierarchyData[parseInt(index.toString(), 10)][`${childMapping}`] = childData;
2553
2728
  continue;
2554
2729
  }
2555
2730
  }
@@ -2611,16 +2786,20 @@ class DataManipulation {
2611
2786
  }
2612
2787
  else {
2613
2788
  if (this.parent.loadChildOnDemand) {
2789
+ const isRemote = isRemoteData(this.parent);
2790
+ const enableVirtualization = this.parent.enableVirtualization;
2791
+ const getUidval = getUid(this.parent.element.id + '_data_');
2792
+ const parentIdMapping = this.parent.parentIdMapping;
2793
+ const idMapping = this.parent.idMapping;
2614
2794
  for (let rec = 0; rec < records.length; rec++) {
2615
2795
  if (isCountRequired(this.parent) && records[parseInt(rec.toString(), 10)].hasChildRecords &&
2616
2796
  this.parent.initialRender) {
2617
2797
  records[parseInt(rec.toString(), 10)].expanded = false;
2618
2798
  }
2619
- if (isRemoteData(this.parent) && this.parent.enableVirtualization) {
2799
+ if (isRemote && enableVirtualization) {
2620
2800
  const childRecords = [];
2621
- const parent = this.parent;
2622
2801
  records.filter((e) => {
2623
- if (e[`${parent.parentIdMapping}`] === records[parseInt(rec.toString(), 10)][`${parent.idMapping}`]) {
2802
+ if (e[`${parentIdMapping}`] === records[parseInt(rec.toString(), 10)][`${idMapping}`]) {
2624
2803
  childRecords.push(e);
2625
2804
  }
2626
2805
  });
@@ -2633,17 +2812,17 @@ class DataManipulation {
2633
2812
  }
2634
2813
  if (isNullOrUndefined(records[parseInt(rec.toString(), 10)].index)) {
2635
2814
  records[parseInt(rec.toString(), 10)].taskData = extend$1({}, records[parseInt(rec.toString(), 10)]);
2636
- records[parseInt(rec.toString(), 10)].uniqueID = getUid(this.parent.element.id + '_data_');
2815
+ records[parseInt(rec.toString(), 10)].uniqueID = getUidval;
2637
2816
  setValue('uniqueIDCollection.' + records[parseInt(rec.toString(), 10)].uniqueID, records[parseInt(rec.toString(), 10)], this.parent);
2638
- if (isRemoteData(this.parent) && this.parent.enableVirtualization && records[parseInt(rec.toString(), 10)][`${this.parent.parentIdMapping}`] && (isNullOrUndefined(records[parseInt(rec.toString(), 10)].level) || records[parseInt(rec.toString(), 10)].level === 0)) {
2639
- const parentID = records[parseInt(rec.toString(), 10)][`${this.parent.parentIdMapping}`];
2640
- const parentRec = records.find((record) => record[`${this.parent.idMapping}`] === parentID);
2817
+ if (isRemote && enableVirtualization && records[parseInt(rec.toString(), 10)][`${parentIdMapping}`] && (isNullOrUndefined(records[parseInt(rec.toString(), 10)].level) || records[parseInt(rec.toString(), 10)].level === 0)) {
2818
+ const parentID = records[parseInt(rec.toString(), 10)][`${parentIdMapping}`];
2819
+ const parentRec = records.find((record) => record[`${idMapping}`] === parentID);
2641
2820
  if (parentRec) {
2642
2821
  records[parseInt(rec.toString(), 10)].level = parentRec.level + 1;
2643
2822
  }
2644
2823
  else {
2645
- const parentRec = args.actual.flatData.find((record) => record[`${this.parent.idMapping}`] === parentID);
2646
- if (isNullOrUndefined(parentRec[`${this.parent.parentIdMapping}`])) {
2824
+ const parentRec = args.actual.flatData.find((record) => record[`${idMapping}`] === parentID);
2825
+ if (isNullOrUndefined(parentRec[`${parentIdMapping}`])) {
2647
2826
  records[parseInt(rec.toString(), 10)].level = 1;
2648
2827
  }
2649
2828
  else {
@@ -2656,7 +2835,7 @@ class DataManipulation {
2656
2835
  }
2657
2836
  records[parseInt(rec.toString(), 10)].index = Math.ceil(Math.random() * 1000);
2658
2837
  if ((records[parseInt(rec.toString(), 10)][this.parent.hasChildMapping] ||
2659
- this.parentItems.indexOf(records[parseInt(rec.toString(), 10)][this.parent.idMapping]) !== -1)) {
2838
+ this.parentItems.indexOf(records[parseInt(rec.toString(), 10)][`${idMapping}`]) !== -1)) {
2660
2839
  records[parseInt(rec.toString(), 10)].hasChildRecords = true;
2661
2840
  }
2662
2841
  records[parseInt(rec.toString(), 10)].checkboxState = 'uncheck';
@@ -2709,33 +2888,42 @@ class DataManipulation {
2709
2888
  gridRows = [].slice.call(rows);
2710
2889
  }
2711
2890
  let childRecord;
2712
- if (rowDetails.rows.length > 0) {
2713
- if (!isChild) {
2714
- rowDetails.record.expanded = true;
2715
- }
2716
- for (let i = 0; i < rowDetails.rows.length; i++) {
2717
- this.parent['toggleRowVisibility'](rowDetails.rows[parseInt(i.toString(), 10)], 'e-childrow-visible');
2718
- if (!this.parent.loadChildOnDemand) {
2719
- const targetEle = rowDetails.rows[parseInt(i.toString(), 10)].getElementsByClassName('e-treegridcollapse')[0];
2720
- childRecord = this.parent.rowTemplate ?
2721
- this.parent.grid.getCurrentViewRecords()[rowDetails.rows[parseInt(i.toString(), 10)].rowIndex] :
2722
- this.parent.grid.getRowObjectFromUID(rowDetails.rows[parseInt(i.toString(), 10)].getAttribute('data-uid')).data;
2723
- if (!isNullOrUndefined(targetEle) && childRecord.expanded) {
2724
- addClass([targetEle], 'e-treegridexpand');
2725
- removeClass([targetEle], 'e-treegridcollapse');
2891
+ if (rowDetails.rows.length > 0 || (this.parent.enableDomVirtualization &&
2892
+ this.parent.uniqueIDCollpaseCollection[rowDetails.record.uniqueID])) {
2893
+ if (this.parent.enableDomVirtualization) {
2894
+ this.parent.notify(virtualExpandCollapse, { action: 'expand', row: rowDetails.parentRow, record: rowDetails.record });
2895
+ this.parent.notify(localPagedExpandCollapse, { action: 'expand', row: rowDetails.parentRow, record: rowDetails.record });
2896
+ }
2897
+ else {
2898
+ if (!isChild) {
2899
+ rowDetails.record.expanded = true;
2900
+ }
2901
+ const rowTemplate = this.parent.rowTemplate;
2902
+ const loadChildOnDemand = this.parent.loadChildOnDemand;
2903
+ for (let i = 0; i < rowDetails.rows.length; i++) {
2904
+ this.parent['toggleRowVisibility'](rowDetails.rows[parseInt(i.toString(), 10)], 'e-childrow-visible');
2905
+ if (!loadChildOnDemand) {
2906
+ const targetEle = rowDetails.rows[parseInt(i.toString(), 10)].getElementsByClassName('e-treegridcollapse')[0];
2907
+ childRecord = rowTemplate ?
2908
+ this.parent.grid.getCurrentViewRecords()[rowDetails.rows[parseInt(i.toString(), 10)].rowIndex] :
2909
+ this.parent.grid.getRowObjectFromUID(rowDetails.rows[parseInt(i.toString(), 10)].getAttribute('data-uid')).data;
2910
+ if (!isNullOrUndefined(targetEle) && childRecord.expanded) {
2911
+ addClass([targetEle], 'e-treegridexpand');
2912
+ removeClass([targetEle], 'e-treegridcollapse');
2913
+ }
2914
+ let childRows = [];
2915
+ childRows = gridRows.filter((r) => r.querySelector('.e-gridrowindex' + childRecord.index + 'level' + (childRecord.level + 1)));
2916
+ if (childRows.length && childRecord.expanded) {
2917
+ this.collectExpandingRecs({ record: childRecord, rows: childRows, parentRow: rowDetails.parentRow }, true);
2918
+ }
2726
2919
  }
2727
- let childRows = [];
2728
- childRows = gridRows.filter((r) => r.querySelector('.e-gridrowindex' + childRecord.index + 'level' + (childRecord.level + 1)));
2729
- if (childRows.length && childRecord.expanded) {
2730
- this.collectExpandingRecs({ record: childRecord, rows: childRows, parentRow: rowDetails.parentRow }, true);
2920
+ const expandingTd = rowDetails.rows[parseInt(i.toString(), 10)].querySelector('.e-detailrowcollapse');
2921
+ if (!isNullOrUndefined(expandingTd)) {
2922
+ this.parent.grid.detailRowModule.expand(expandingTd);
2731
2923
  }
2732
2924
  }
2733
- const expandingTd = rowDetails.rows[parseInt(i.toString(), 10)].querySelector('.e-detailrowcollapse');
2734
- if (!isNullOrUndefined(expandingTd)) {
2735
- this.parent.grid.detailRowModule.expand(expandingTd);
2736
- }
2925
+ this.parent.grid.pageSettings.totalRecordsCount += rowDetails.rows.length;
2737
2926
  }
2738
- this.parent.grid.pageSettings.totalRecordsCount += rowDetails.rows.length;
2739
2927
  }
2740
2928
  else {
2741
2929
  this.fetchRemoteChildData({ action: rowDetails[`${name}`], record: rowDetails.record, rows: rowDetails.rows, parentRow: rowDetails.parentRow });
@@ -2774,12 +2962,14 @@ class DataManipulation {
2774
2962
  const remoteExpandedData = 'remoteExpandedData';
2775
2963
  const remoteCollapsedData = 'remoteCollapsedData';
2776
2964
  const level = 'level';
2777
- let datas = this.parent.grid.currentViewData.slice();
2965
+ const currentViewData = this.parent.grid.currentViewData;
2966
+ let datas = currentViewData.slice();
2778
2967
  let inx;
2779
2968
  const idMapping = this.parent.idMapping;
2969
+ const parentIdMapping = this.parent.parentIdMapping;
2780
2970
  if (this.parent['isGantt'] && this.parent.loadChildOnDemand && this.parent.hasChildMapping) {
2781
- for (let i = 0; i < this.parent.grid.currentViewData.length; i++) {
2782
- if (rowDetails.record[idMapping] === this.parent.grid.currentViewData[i][idMapping]) {
2971
+ for (let i = 0; i < currentViewData.length; i++) {
2972
+ if (rowDetails.record[idMapping] === currentViewData[i][idMapping]) {
2783
2973
  inx = i;
2784
2974
  break;
2785
2975
  }
@@ -2791,7 +2981,7 @@ class DataManipulation {
2791
2981
  if (this.parent.enableVirtualization && (rowDetails.action === 'collapse' || rowDetails.action === 'remoteExpand')) {
2792
2982
  datas = [];
2793
2983
  for (let i = 0; i < inx; i++) {
2794
- datas.push(this.parent.grid.currentViewData[parseInt(i.toString(), 10)]);
2984
+ datas.push(currentViewData[parseInt(i.toString(), 10)]);
2795
2985
  }
2796
2986
  }
2797
2987
  if (inx === -1) {
@@ -2806,14 +2996,14 @@ class DataManipulation {
2806
2996
  const resultChildData = [];
2807
2997
  if (rowDetails.action === 'remoteExpand' && this.parent.grid.filterModule && this.parent.grid.filterModule['value']) {
2808
2998
  for (let i = 0; i < datas.length; i++) {
2809
- if (Object.prototype.hasOwnProperty.call(datas[parseInt(i.toString(), 10)], this.parent.parentIdMapping) && datas[parseInt(i.toString(), 10)]['' + this.parent.parentIdMapping] !== null && datas[parseInt(i.toString(), 10)].level === 0) {
2999
+ if (Object.prototype.hasOwnProperty.call(datas[parseInt(i.toString(), 10)], parentIdMapping) && datas[parseInt(i.toString(), 10)]['' + parentIdMapping] !== null && datas[parseInt(i.toString(), 10)].level === 0) {
2810
3000
  datas.splice(i, 1);
2811
3001
  i--;
2812
3002
  }
2813
3003
  }
2814
3004
  for (let i = 0; i < result.length; i++) {
2815
- if (rowDetails.record['' + this.parent.idMapping] !== result[parseInt(i.toString(), 10)]['' + this.parent.idMapping] &&
2816
- rowDetails.record['' + this.parent.idMapping] === result[parseInt(i.toString(), 10)]['' + this.parent.parentIdMapping]) {
3005
+ if (rowDetails.record['' + idMapping] !== result[parseInt(i.toString(), 10)]['' + idMapping] &&
3006
+ rowDetails.record['' + idMapping] === result[parseInt(i.toString(), 10)]['' + parentIdMapping]) {
2817
3007
  if (Object.prototype.hasOwnProperty.call(result, i)) {
2818
3008
  resultChildData.push(result[parseInt(i.toString(), 10)]);
2819
3009
  }
@@ -2824,8 +3014,8 @@ class DataManipulation {
2824
3014
  if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2825
3015
  rowDetails.record.childRecords = [];
2826
3016
  for (let i = 0; i < result.length; i++) {
2827
- if (rowDetails.record['' + this.parent.idMapping] !== result[parseInt(i.toString(), 10)]['' + this.parent.idMapping] &&
2828
- rowDetails.record['' + this.parent.idMapping] === result[parseInt(i.toString(), 10)]['' + this.parent.parentIdMapping] && Object.prototype.hasOwnProperty.call(result, i)) {
3017
+ if (rowDetails.record['' + idMapping] !== result[parseInt(i.toString(), 10)]['' + idMapping] &&
3018
+ rowDetails.record['' + idMapping] === result[parseInt(i.toString(), 10)]['' + parentIdMapping] && Object.prototype.hasOwnProperty.call(result, i)) {
2829
3019
  rowDetails.record.childRecords.push(result[parseInt(i.toString(), 10)]);
2830
3020
  }
2831
3021
  }
@@ -2835,20 +3025,20 @@ class DataManipulation {
2835
3025
  }
2836
3026
  for (let r = 0; r < result.length; r++) {
2837
3027
  const record = result[parseInt(r.toString(), 10)];
2838
- if (this.parent.enableVirtualization && record[`${this.parent.idMapping}`] === rowDetails.record[`${this.parent.idMapping}`] && rowDetails.action === 'remoteExpand') {
3028
+ if (this.parent.enableVirtualization && record[`${idMapping}`] === rowDetails.record[`${idMapping}`] && rowDetails.action === 'remoteExpand') {
2839
3029
  this.parent[`${remoteExpandedData}`].push(rowDetails.record);
2840
3030
  }
2841
- else if (this.parent.enableVirtualization && record[`${this.parent.idMapping}`] === rowDetails.record[`${this.parent.idMapping}`] && rowDetails.action === 'collapse') {
3031
+ else if (this.parent.enableVirtualization && record[`${idMapping}`] === rowDetails.record[`${idMapping}`] && rowDetails.action === 'collapse') {
2842
3032
  for (let i = 0; i < this.parent[`${remoteExpandedData}`].length; i++) {
2843
- if (rowDetails.record[`${this.parent.idMapping}`] === this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)][`${this.parent.idMapping}`]) {
3033
+ if (rowDetails.record[`${idMapping}`] === this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)][`${idMapping}`]) {
2844
3034
  this.parent[`${remoteExpandedData}`].splice(i, 1);
2845
3035
  }
2846
3036
  }
2847
3037
  }
2848
3038
  record.taskData = extend$1({}, record);
2849
- if (record[`${this.parent.parentIdMapping}`] && this.parent.enableVirtualization && this.parent[`${remoteExpandedData}`].length) {
3039
+ if (record[`${parentIdMapping}`] && this.parent.enableVirtualization && this.parent[`${remoteExpandedData}`].length) {
2850
3040
  for (let i = 0; i < this.parent[`${remoteExpandedData}`].length; i++) {
2851
- if (record[`${this.parent.parentIdMapping}`] === this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)][`${this.parent.idMapping}`]) {
3041
+ if (record[`${parentIdMapping}`] === this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)][`${idMapping}`]) {
2852
3042
  record.level = this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)][`${level}`] + 1;
2853
3043
  const parentData = this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)];
2854
3044
  delete parentData.childRecords;
@@ -2859,9 +3049,9 @@ class DataManipulation {
2859
3049
  }
2860
3050
  else if (this.parent.enableVirtualization) {
2861
3051
  if ((record[`${this.parent.hasChildMapping}`] ||
2862
- this.parentItems.indexOf(record[`${this.parent.idMapping}`]) !== -1)
3052
+ this.parentItems.indexOf(record[`${idMapping}`]) !== -1)
2863
3053
  && !(haveChild && !haveChild[parseInt(r.toString(), 10)])) {
2864
- if (isNullOrUndefined(record[`${this.parent.parentIdMapping}`])) {
3054
+ if (isNullOrUndefined(record[`${parentIdMapping}`])) {
2865
3055
  record.level = 0;
2866
3056
  if (rowDetails.action === 'remoteExpand') {
2867
3057
  record.childRecords = [];
@@ -2888,45 +3078,45 @@ class DataManipulation {
2888
3078
  }
2889
3079
  record.index = Math.ceil(Math.random() * 1000);
2890
3080
  record.uniqueID = getUid(this.parent.element.id + '_data_');
2891
- if (rowDetails.record[`${this.parent.idMapping}`] === record[`${this.parent.idMapping}`]) {
3081
+ if (rowDetails.record[`${idMapping}`] === record[`${idMapping}`]) {
2892
3082
  rowDetails.record.uniqueID = record.uniqueID;
2893
3083
  }
2894
3084
  record.checkboxState = 'uncheck';
2895
3085
  if (this.parent.enableVirtualization && isNullOrUndefined(record.level)) {
2896
- for (let p = 0; p < this.parent.grid.currentViewData.length; p++) {
2897
- if (this.parent.grid.currentViewData[parseInt(p.toString(), 10)][`${this.parent.idMapping}`] === record[`${this.parent.parentIdMapping}`]) {
2898
- record.level = this.parent.grid.currentViewData[parseInt(p.toString(), 10)]['level'] + 1;
3086
+ for (let p = 0; p < currentViewData.length; p++) {
3087
+ if (currentViewData[parseInt(p.toString(), 10)][`${idMapping}`] === record[`${parentIdMapping}`]) {
3088
+ record.level = currentViewData[parseInt(p.toString(), 10)]['level'] + 1;
2899
3089
  }
2900
3090
  }
2901
3091
  }
2902
3092
  setValue('uniqueIDCollection.' + record.uniqueID, record, this.parent);
2903
3093
  // delete result[r].parentItem.childRecords;
2904
3094
  if ((record[`${this.parent.hasChildMapping}`] ||
2905
- this.parentItems.indexOf(record[`${this.parent.idMapping}`]) !== -1)
3095
+ this.parentItems.indexOf(record[`${idMapping}`]) !== -1)
2906
3096
  && !(haveChild && !haveChild[parseInt(r.toString(), 10)])) {
2907
3097
  record.hasChildRecords = true;
2908
3098
  if (this.parent.enableVirtualization && !this.parent.loadChildOnDemand) {
2909
3099
  for (let i = 0; i < this.parent[`${remoteCollapsedData}`].length; i++) {
2910
- if (record[`${this.parent.idMapping}`] === this.parent[`${remoteCollapsedData}`][parseInt(i.toString(), 10)][`${this.parent.idMapping}`]) {
3100
+ if (record[`${idMapping}`] === this.parent[`${remoteCollapsedData}`][parseInt(i.toString(), 10)][`${idMapping}`]) {
2911
3101
  record.expanded = this.parent[`${remoteCollapsedData}`][parseInt(i.toString(), 10)]['expanded'];
2912
3102
  }
2913
3103
  }
2914
- if (rowDetails.action === 'collapse' && record[`${this.parent.idMapping}`] !== rowDetails.record[`${this.parent.idMapping}`] && record.expanded !== false) {
3104
+ if (rowDetails.action === 'collapse' && record[`${idMapping}`] !== rowDetails.record[`${idMapping}`] && record.expanded !== false) {
2915
3105
  record.expanded = true;
2916
3106
  }
2917
- else if (rowDetails.action === 'collapse' && record[`${this.parent.idMapping}`] === rowDetails.record[`${this.parent.idMapping}`]) {
3107
+ else if (rowDetails.action === 'collapse' && record[`${idMapping}`] === rowDetails.record[`${idMapping}`]) {
2918
3108
  record.expanded = false;
2919
3109
  this.parent[`${remoteCollapsedData}`].push(rowDetails.record);
2920
3110
  }
2921
3111
  else if (rowDetails.action === 'remoteExpand') {
2922
- for (let i = 0; i < this.parent.grid.currentViewData.length; i++) {
2923
- if (this.parent.grid.currentViewData[parseInt(i.toString(), 10)][`${this.parent.idMapping}`] === record[`${this.parent.idMapping}`]) {
2924
- result.splice(r, 1, this.parent.grid.currentViewData[parseInt(i.toString(), 10)]);
3112
+ for (let i = 0; i < currentViewData.length; i++) {
3113
+ if (currentViewData[parseInt(i.toString(), 10)][`${this.parent.idMapping}`] === record[`${this.parent.idMapping}`]) {
3114
+ result.splice(r, 1, currentViewData[parseInt(i.toString(), 10)]);
2925
3115
  }
2926
3116
  }
2927
3117
  if (record[this.parent.idMapping] === rowDetails.record[`${this.parent.idMapping}`]) {
2928
3118
  for (let i = 0; i < this.parent[`${remoteCollapsedData}`].length; i++) {
2929
- if (rowDetails.record[`${this.parent.idMapping}`] === this.parent[`${remoteCollapsedData}`][parseInt(i.toString(), 10)][`${this.parent.idMapping}`]) {
3119
+ if (rowDetails.record[`${idMapping}`] === this.parent[`${remoteCollapsedData}`][parseInt(i.toString(), 10)][`${this.parent.idMapping}`]) {
2930
3120
  this.parent[`${remoteCollapsedData}`].splice(i, 1);
2931
3121
  }
2932
3122
  }
@@ -2936,19 +3126,19 @@ class DataManipulation {
2936
3126
  }
2937
3127
  }
2938
3128
  }
2939
- else if (this.parent.enableVirtualization && record[`${this.parent.idMapping}`] === rowDetails.record[`${this.parent.idMapping}`] && rowDetails.action !== 'collapse') {
3129
+ else if (this.parent.enableVirtualization && record[`${idMapping}`] === rowDetails.record[`${idMapping}`] && rowDetails.action !== 'collapse') {
2940
3130
  record.expanded = true;
2941
3131
  }
2942
3132
  else if (!(this.parent.enableVirtualization && !this.parent.loadChildOnDemand)) {
2943
3133
  record.expanded = false;
2944
3134
  }
2945
3135
  }
2946
- const exists = datas.some((data) => data[`${this.parent.idMapping}`] === record[this.parent.idMapping]);
3136
+ const exists = datas.some((data) => data[`${idMapping}`] === record[`${idMapping}`]);
2947
3137
  if (!exists) {
2948
3138
  datas.splice(inx + r + 1, 0, record);
2949
3139
  }
2950
3140
  }
2951
- const localIdMapping = this.parent.idMapping;
3141
+ const localIdMapping = idMapping;
2952
3142
  if (this.parent.enableVirtualization && this.parent.loadChildOnDemand) {
2953
3143
  datas.sort(function (firstRecord, secondRecord) {
2954
3144
  return firstRecord[`${localIdMapping}`] - secondRecord[`${localIdMapping}`];
@@ -2976,7 +3166,7 @@ class DataManipulation {
2976
3166
  this.parent.grid.pageSettings.totalRecordsCount = e.count;
2977
3167
  }
2978
3168
  e.count = this.parent.grid.pageSettings.totalRecordsCount;
2979
- const virtualArgs = {};
3169
+ let virtualArgs = {};
2980
3170
  if (this.parent.enableVirtualization) {
2981
3171
  this.remoteVirtualAction(virtualArgs);
2982
3172
  }
@@ -2985,6 +3175,7 @@ class DataManipulation {
2985
3175
  this.parent.notify('infinite-remote-expand', notifyArgs);
2986
3176
  }
2987
3177
  else {
3178
+ virtualArgs = this.parent.enableDomVirtualization ? { requestType: 'refresh' } : virtualArgs;
2988
3179
  getValue('grid.renderModule', this.parent).dataManagerSuccess(e, virtualArgs);
2989
3180
  }
2990
3181
  this.parent.trigger(expanded, args);
@@ -3016,100 +3207,123 @@ class DataManipulation {
3016
3207
  }
3017
3208
  }
3018
3209
  }
3019
- createRecords(data, parentRecords) {
3210
+ createConvertRecords(data, parentRecords) {
3020
3211
  const treeGridData = [];
3212
+ const flatData = this.parent.flatData;
3213
+ const parentData = this.parent.parentData;
3021
3214
  const keys = Object.keys(data);
3022
- for (let i = 0, len = keys.length; i < len; i++) {
3023
- const currentData = extend$1({}, data[parseInt(i.toString(), 10)]);
3215
+ let levelBase = 0;
3216
+ let parentItem = null;
3217
+ let parentUniqueID = null;
3218
+ if (!isNullOrUndefined(parentRecords)) {
3219
+ parentItem = Object.assign({}, parentRecords);
3220
+ delete parentItem.childRecords;
3221
+ delete parentItem[this.childMapping];
3222
+ if (this.isSelfReference) {
3223
+ delete parentItem.taskData[this.childMapping];
3224
+ }
3225
+ levelBase = (parentItem.level || 0) + 1;
3226
+ parentUniqueID = parentItem.uniqueID;
3227
+ }
3228
+ for (let i = 0; i < keys.length; i++) {
3229
+ const currentData = Object.assign({}, data[parseInt(i.toString(), 10)]);
3024
3230
  currentData.taskData = data[parseInt(i.toString(), 10)];
3025
- let level = 0;
3026
- this.storedIndex++;
3027
- if (!Object.prototype.hasOwnProperty.call(currentData, 'index')) {
3231
+ if (!currentData.index) {
3232
+ this.storedIndex++;
3028
3233
  currentData.index = this.storedIndex;
3029
3234
  }
3030
- const childMapping = currentData[this.parent.childMapping];
3031
- const hasChildren = !isNullOrUndefined(childMapping) && childMapping.length > 0;
3032
- const shouldCount = isCountRequired(this.parent);
3033
- const hasChildMapping = currentData[this.parent.hasChildMapping];
3034
- if ((hasChildren && !shouldCount) || (hasChildMapping && shouldCount)) {
3035
- currentData.hasChildRecords = true;
3036
- }
3037
3235
  else {
3038
- currentData.hasChildRecords = false;
3236
+ this.storedIndex++;
3039
3237
  }
3040
- if ((!isNullOrUndefined(childMapping) && !shouldCount) ||
3041
- (hasChildMapping) && shouldCount) {
3042
- if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
3043
- && isNullOrUndefined(childMapping)) {
3238
+ const childMapping = currentData[this.childMapping];
3239
+ const hasChildren = childMapping && childMapping.length > 0;
3240
+ const hasChildMapping = currentData[this.hasChildMapping];
3241
+ currentData.hasChildRecords = ((hasChildren && !this.isCountRequired) ||
3242
+ (hasChildMapping && this.isCountRequired)) ? true : false;
3243
+ if (currentData.hasChildRecords) {
3244
+ if (this.enableCollapseAll || (!isNullOrUndefined(this.parent.dataStateChange) && !childMapping)) {
3044
3245
  currentData.expanded = false;
3045
3246
  }
3046
3247
  else {
3047
- currentData.expanded = !isNullOrUndefined(currentData[this.parent.expandStateMapping])
3048
- ? currentData[this.parent.expandStateMapping] : true;
3248
+ currentData.expanded = !isNullOrUndefined(currentData[`${this.expandStateMapping}`]) ? currentData[`${this.expandStateMapping}`] : true;
3049
3249
  }
3050
3250
  }
3051
- if (this.isSelfReference && isNullOrUndefined(currentData[this.parent.parentIdMapping])) {
3052
- this.parent.parentData.push(currentData);
3251
+ if (this.isSelfReference && !currentData[`${this.parentIdMapping}`]) {
3252
+ parentData.push(currentData);
3053
3253
  }
3054
- currentData.uniqueID = getUid(this.parent.element.id + '_data_');
3055
- this.parent.uniqueIDCollection[currentData.uniqueID] = currentData;
3056
- if (!isNullOrUndefined(parentRecords)) {
3057
- const parentData = extend$1({}, parentRecords);
3058
- delete parentData.childRecords;
3059
- delete parentData[this.parent.childMapping];
3060
- if (this.isSelfReference) {
3061
- delete parentData.taskData[this.parent.childMapping];
3062
- }
3063
- currentData.parentItem = parentData;
3064
- currentData.parentUniqueID = parentData.uniqueID;
3065
- level = parentRecords.level + 1;
3254
+ currentData.uniqueID = getUid(this.cachedElementId);
3255
+ this.uniqueIDCollection[currentData.uniqueID] = currentData;
3256
+ if (parentItem) {
3257
+ currentData.parentItem = parentItem;
3258
+ currentData.parentUniqueID = parentUniqueID;
3259
+ currentData.level = levelBase;
3066
3260
  }
3067
- if (!Object.prototype.hasOwnProperty.call(currentData, 'level')) {
3068
- currentData.level = level;
3261
+ else {
3262
+ currentData.level = 0;
3069
3263
  }
3070
3264
  currentData.checkboxState = 'uncheck';
3071
- const remoteCollapsedData = 'remoteCollapsedData';
3072
- if (this.parent.enableVirtualization && !this.parent.loadChildOnDemand && isRemoteData(this.parent)
3073
- && !this.parent.initialRender) {
3074
- if (!currentData.hasChildRecords && isNullOrUndefined(currentData[`${this.parent.parentIdMapping}`])) {
3265
+ if (this.isVirtualRemote) {
3266
+ if (!currentData.hasChildRecords && !currentData[`${this.parentIdMapping}`]) {
3075
3267
  currentData.hasChildRecords = true;
3076
- for (let c = 0; c < this.parent[`${remoteCollapsedData}`].length; c++) {
3077
- if (this.parent[`${remoteCollapsedData}`][parseInt(c.toString(), 10)][`${this.parent.idMapping}`] === currentData[`${this.parent.idMapping}`]) {
3268
+ const remoteCollapsedLen = this.remoteCollapsedList.length;
3269
+ const currentId = currentData[`${this.idMapping}`];
3270
+ for (let c = 0; c < remoteCollapsedLen; c++) {
3271
+ if (this.remoteCollapsedList[parseInt(c.toString(), 10)][`${this.idMapping}`] === currentId) {
3078
3272
  currentData.expanded = false;
3273
+ break;
3079
3274
  }
3080
3275
  }
3081
3276
  }
3082
- else if (currentData.level === 0 && isNullOrUndefined(parentRecords) && !currentData.hasChildRecords) {
3083
- currentData.level = currentData.level + 1;
3277
+ else if (currentData.level === 0 && !parentRecords && !currentData.hasChildRecords) {
3278
+ currentData.level++;
3084
3279
  }
3085
- if (currentData[`${this.parent.hasChildMapping}`] && !isNullOrUndefined(currentData[`${this.parent.expandStateMapping}`])) {
3086
- currentData.expanded = currentData[`${this.parent.expandStateMapping}`];
3280
+ if (currentData[`${this.parent.hasChildMapping}`] && currentData[`${this.expandStateMapping}`] !== undefined) {
3281
+ currentData.expanded = currentData[`${this.expandStateMapping}`];
3087
3282
  currentData.hasChildRecords = true;
3088
3283
  }
3089
- this.parent.flatData.push(currentData);
3284
+ flatData.push(currentData);
3090
3285
  }
3091
- else if (isNullOrUndefined(currentData[`${this.parent.parentIdMapping}`]) || currentData.parentItem) {
3092
- if (!isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
3286
+ else if (!currentData[`${this.parentIdMapping}`] || parentItem) {
3287
+ if (!isNullOrUndefined(this.rowDragAndDropTargetID)) {
3093
3288
  if (!this.parent.rowDragAndDropModule['isDuplicateData'](currentData)) {
3094
- this.parent.flatData.push(currentData);
3289
+ flatData.push(currentData);
3095
3290
  }
3096
3291
  }
3097
3292
  else {
3098
- this.parent.flatData.push(currentData);
3293
+ flatData.push(currentData);
3099
3294
  }
3100
- this.parent['infiniteScrollData'].push(currentData);
3295
+ this.infiniteScrollData.push(currentData);
3101
3296
  }
3102
3297
  if (!this.isSelfReference && currentData.level === 0) {
3103
- this.parent.parentData.push(currentData);
3298
+ parentData.push(currentData);
3104
3299
  }
3105
- if (!isNullOrUndefined(currentData[this.parent.childMapping] && currentData[this.parent.childMapping].length)) {
3106
- const record = this.createRecords(currentData[this.parent.childMapping], currentData);
3107
- currentData.childRecords = record;
3300
+ if (hasChildren) {
3301
+ currentData.childRecords = this.createConvertRecords(childMapping, currentData);
3108
3302
  }
3109
3303
  treeGridData.push(currentData);
3110
3304
  }
3111
3305
  return treeGridData;
3112
3306
  }
3307
+ createRecords(data) {
3308
+ this.childMapping = this.parent.childMapping;
3309
+ this.hasChildMapping = this.parent.hasChildMapping;
3310
+ this.expandStateMapping = this.parent.expandStateMapping;
3311
+ this.parentIdMapping = this.parent.parentIdMapping;
3312
+ this.idMapping = this.parent.idMapping;
3313
+ this.cachedElementId = this.parent.element.id + '_data_';
3314
+ this.loadChildOnDemand = this.parent.loadChildOnDemand;
3315
+ this.initialRender = this.parent.initialRender;
3316
+ this.isCountRequired = isCountRequired(this.parent);
3317
+ this.rowDragAndDropTargetID = this.parent.rowDropSettings.targetID;
3318
+ this.isVirtualRemote = this.parent.enableVirtualization && !this.loadChildOnDemand &&
3319
+ isRemoteData(this.parent) && !this.initialRender;
3320
+ this.isRemoteData = isRemoteData(this.parent);
3321
+ const remoteCollapsedData = 'remoteCollapsedData';
3322
+ this.remoteCollapsedList = this.isVirtualRemote ? this.parent[`${remoteCollapsedData}`] : [];
3323
+ this.infiniteScrollData = this.parent['infiniteScrollData'];
3324
+ this.uniqueIDCollection = this.parent.uniqueIDCollection;
3325
+ return this.createConvertRecords(data);
3326
+ }
3113
3327
  /**
3114
3328
  * Function to perform filtering/sorting action for local data
3115
3329
  *
@@ -3150,8 +3364,9 @@ class DataManipulation {
3150
3364
  dataObj = expresults;
3151
3365
  }
3152
3366
  else {
3153
- dataObj = isCountRequired(this.parent) ? getValue('result', this.parent.grid.dataSource)
3154
- : this.parent.grid.dataSource;
3367
+ dataObj = isCountRequired(this.parent) ? getValue('result', this.parent.grid.dataSource) :
3368
+ this.parent.enableDomVirtualization && (action === 'collapse' || action === 'expand') ? args.result
3369
+ : this.parent.grid.dataSource;
3155
3370
  }
3156
3371
  let results = dataObj instanceof DataManager ? dataObj.dataSource.json : dataObj;
3157
3372
  let count = isCountRequired(this.parent) ? getValue('count', this.parent.dataSource)
@@ -3210,6 +3425,9 @@ class DataManipulation {
3210
3425
  }
3211
3426
  count = isCountRequired(this.parent) ? getValue('count', this.parent.dataSource)
3212
3427
  : results.length;
3428
+ if (this.parent.enableDomVirtualization) {
3429
+ this.parent.virtualDomScrollData = results;
3430
+ }
3213
3431
  const temp = this.paging(results, count, isExport, isPrinting, exportType, args);
3214
3432
  results = temp.result;
3215
3433
  count = temp.count;
@@ -3225,9 +3443,9 @@ class DataManipulation {
3225
3443
  count = isCountRequired(this.parent) ? getValue('count', this.parent.dataSource)
3226
3444
  : this.dataResults.count;
3227
3445
  }
3228
- else if ((this.parent.enableVirtualization || this.parent.enableInfiniteScrolling) && (!isExport || exportType === 'CurrentPage')
3229
- && getValue('requestType', args) !== 'save') {
3230
- const actArgs = this.parent.enableInfiniteScrolling ? args : getValue('actionArgs', args);
3446
+ else if ((this.parent.enableVirtualization || this.parent.enableInfiniteScrolling || this.parent.enableDomVirtualization) &&
3447
+ (!isExport || exportType === 'CurrentPage') && getValue('requestType', args) !== 'save') {
3448
+ const actArgs = this.parent.enableInfiniteScrolling || this.parent.enableDomVirtualization ? args : getValue('actionArgs', args);
3231
3449
  this.parent.notify(pagingActions, { result: results, count: count, actionArgs: actArgs });
3232
3450
  results = this.dataResults.result;
3233
3451
  count = this.dataResults.count;
@@ -3609,9 +3827,9 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
3609
3827
  else {
3610
3828
  if (action === 'edit') {
3611
3829
  for (j = 0; j < keys.length; j++) {
3612
- if (Object.prototype.hasOwnProperty.call(treeData[parseInt(i.toString(), 10)], keys[parseInt(j.toString(), 10)]) && ((control.editSettings.mode !== 'Cell'
3613
- || (!isNullOrUndefined(batchChanges) && batchChanges[`${changedRecords}`].length === 0))
3614
- || keys[parseInt(j.toString(), 10)] === columnName)) {
3830
+ if (Object.prototype.hasOwnProperty.call(treeData[parseInt(i.toString(), 10)], keys[parseInt(j.toString(), 10)]) &&
3831
+ ((!isNullOrUndefined(control.editSettings.mode) || (!isNullOrUndefined(batchChanges) && batchChanges[`${changedRecords}`].length === 0))
3832
+ || keys[parseInt(j.toString(), 10)] === columnName)) {
3615
3833
  const editedData = getParentData(control, modifiedData[parseInt(k.toString(), 10)].uniqueID);
3616
3834
  treeData[parseInt(i.toString(), 10)][keys[parseInt(j.toString(), 10)]] =
3617
3835
  modifiedData[parseInt(k.toString(), 10)][keys[parseInt(j.toString(), 10)]];
@@ -3759,16 +3977,11 @@ function removeChildRecords(childRecords, modifiedData, action, key, control, is
3759
3977
  const editedData = getParentData(control, modifiedData.uniqueID);
3760
3978
  for (let i = 0; i < keys.length; i++) {
3761
3979
  if (Object.prototype.hasOwnProperty.call(childRecords[parseInt(j.toString(), 10)], keys[parseInt(i.toString(), 10)]) &&
3762
- (control.editSettings.mode !== 'Cell' || keys[parseInt(i.toString(), 10)] === columnName)) {
3980
+ (!isNullOrUndefined(control.editSettings.mode) || keys[parseInt(i.toString(), 10)] === columnName)) {
3763
3981
  editedData[keys[parseInt(i.toString(), 10)]] =
3764
3982
  editedData.taskData[keys[parseInt(i.toString(), 10)]] =
3765
3983
  childRecords[parseInt(j.toString(), 10)][keys[parseInt(i.toString(), 10)]] =
3766
3984
  modifiedData[keys[parseInt(i.toString(), 10)]];
3767
- if (control.grid.editSettings.mode === 'Normal' && control.editSettings.mode === 'Cell' && !isNullOrUndefined(control.grid.editModule)) {
3768
- const editModule = 'editModule';
3769
- control.grid.editModule[`${editModule}`].editRowIndex = modifiedData.index;
3770
- control.grid.editModule[`${editModule}`].updateCurrentViewData(modifiedData);
3771
- }
3772
3985
  }
3773
3986
  }
3774
3987
  break;
@@ -3995,6 +4208,33 @@ var __decorate$c = (undefined && undefined.__decorate) || function (decorators,
3995
4208
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3996
4209
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3997
4210
  };
4211
+ /**
4212
+ * Configures the DOM virtualization settings for TreeGrid.
4213
+ */
4214
+ class DomVirtualizationSettings extends ChildProperty {
4215
+ }
4216
+ __decorate$c([
4217
+ Property('Row')
4218
+ ], DomVirtualizationSettings.prototype, "virtualDomType", void 0);
4219
+ __decorate$c([
4220
+ Property(5)
4221
+ ], DomVirtualizationSettings.prototype, "rowBuffer", void 0);
4222
+ __decorate$c([
4223
+ Property(0)
4224
+ ], DomVirtualizationSettings.prototype, "scrollThrottle", void 0);
4225
+ __decorate$c([
4226
+ Property(500)
4227
+ ], DomVirtualizationSettings.prototype, "maxPoolSize", void 0);
4228
+ __decorate$c([
4229
+ Property(false)
4230
+ ], DomVirtualizationSettings.prototype, "autoRowHeight", void 0);
4231
+
4232
+ var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4233
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4234
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4235
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4236
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4237
+ };
3998
4238
  var TreeGrid_1;
3999
4239
  /**
4000
4240
  * Represents the TreeGrid component.
@@ -4013,6 +4253,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4013
4253
  /** @hidden */
4014
4254
  this.uniqueIDCollection = {};
4015
4255
  /** @hidden */
4256
+ this.uniqueIDCollpaseCollection = {};
4257
+ /** @hidden */
4016
4258
  this.uniqueIDFilterCollection = {};
4017
4259
  this.changedRecords = 'changedRecords';
4018
4260
  this.deletedRecords = 'deletedRecords';
@@ -4255,6 +4497,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4255
4497
  }
4256
4498
  this.TreeGridLocale();
4257
4499
  this.initProperties();
4500
+ this.autoCheckHierarchy = (this.hierarchyCheckboxMode === 'hierarchy' || this.hierarchyCheckboxMode === 'filteredHierarchy')
4501
+ ? true : false;
4258
4502
  this.defaultLocale = {
4259
4503
  Above: 'Above',
4260
4504
  Below: 'Below',
@@ -4307,7 +4551,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4307
4551
  }
4308
4552
  /**
4309
4553
  * Searches for TreeGrid records using a specified search string.
4310
- * Customize the search behavior through the [searchSettings](./#searchsettings/).
4554
+ * Customize the search behavior through the [searchSettings](./index-default#searchsettings).
4311
4555
  *
4312
4556
  * @param {string} searchString - The string used as the search key.
4313
4557
  * @returns {void}
@@ -4355,7 +4599,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4355
4599
  }
4356
4600
  /**
4357
4601
  * Prints all the pages of the TreeGrid and hides the pager by default.
4358
- * Customize print options using the [printMode](./#printmode).
4602
+ * Customize print options using the [printMode](./index-default#printmode).
4359
4603
  *
4360
4604
  * @returns {void}
4361
4605
  */
@@ -4370,6 +4614,20 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4370
4614
  let row;
4371
4615
  let summaryElement;
4372
4616
  switch (e.action) {
4617
+ case 'space': {
4618
+ target = e.target;
4619
+ const checkboxWrapper = target && target.closest('.e-checkbox-wrapper');
4620
+ const headerCheckbox = checkboxWrapper && checkboxWrapper.querySelector('.e-treeselectall');
4621
+ if (headerCheckbox && this.selectionModule) {
4622
+ if (this.selectionModule['headerSelectionState'] === 'check') {
4623
+ this.selectionModule['headerSelection'](false);
4624
+ }
4625
+ else {
4626
+ this.selectionModule['headerSelection'](true);
4627
+ }
4628
+ }
4629
+ break;
4630
+ }
4373
4631
  case 'ctrlDownArrow':
4374
4632
  this.expandAll();
4375
4633
  break;
@@ -4504,7 +4762,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4504
4762
  ctrlShiftUpArrow: 'ctrl+shift+uparrow',
4505
4763
  ctrlShiftDownArrow: 'ctrl+shift+downarrow',
4506
4764
  downArrow: 'downArrow',
4507
- upArrow: 'upArrow'
4765
+ upArrow: 'upArrow',
4766
+ space: 'space'
4508
4767
  };
4509
4768
  this.isLocalData = (!(this.dataSource instanceof DataManager) || this.dataSource.dataSource.offline
4510
4769
  || (!isNullOrUndefined(this.dataSource.ready)) || this.dataSource.adaptor instanceof RemoteSaveAdaptor);
@@ -4689,7 +4948,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4689
4948
  name: 'Selection'
4690
4949
  });
4691
4950
  }
4692
- if (this.enableVirtualization) {
4951
+ if (this.enableVirtualization && !this.enableDomVirtualization) {
4693
4952
  modules.push({
4694
4953
  member: 'virtualScroll',
4695
4954
  args: [this],
@@ -4703,6 +4962,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4703
4962
  name: 'InfiniteScroll'
4704
4963
  });
4705
4964
  }
4965
+ if (this.enableDomVirtualization) {
4966
+ modules.push({
4967
+ member: 'domVirtualization',
4968
+ args: [this],
4969
+ name: 'DomVirtualization'
4970
+ });
4971
+ }
4706
4972
  modules.push({
4707
4973
  member: 'logger',
4708
4974
  args: [this.grid]
@@ -4805,7 +5071,10 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4805
5071
  let modules = [];
4806
5072
  modules = gridRequiredModules.apply(this);
4807
5073
  for (let i = 0; i < modules.length; i++) {
4808
- if (modules[parseInt(i.toString(), 10)].member === 'virtualscroll') {
5074
+ if (modules[parseInt(i.toString(), 10)].member === 'domVirtualization') {
5075
+ modules[parseInt(i.toString(), 10)].member = 'treeDomVirtualization';
5076
+ }
5077
+ else if (modules[parseInt(i.toString(), 10)].member === 'virtualscroll') {
4809
5078
  modules[parseInt(i.toString(), 10)].member = 'treeVirtualScroll';
4810
5079
  }
4811
5080
  }
@@ -4998,6 +5267,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4998
5267
  this.grid.allowSorting = this.allowSorting;
4999
5268
  this.grid.allowMultiSorting = this.allowMultiSorting;
5000
5269
  this.grid.allowFiltering = this.allowFiltering;
5270
+ this.grid.enableDomVirtualization = this.enableDomVirtualization;
5271
+ this.grid.domVirtualizationSettings = this.domVirtualizationSettings;
5001
5272
  this.grid.enableVirtualization = this.enableVirtualization;
5002
5273
  this.grid.enableColumnVirtualization = this.enableColumnVirtualization;
5003
5274
  this.grid.enableInfiniteScrolling = this.enableInfiniteScrolling;
@@ -5099,7 +5370,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5099
5370
  this.trigger(rowDeselecting, args);
5100
5371
  };
5101
5372
  this.grid.rowSelected = (args) => {
5102
- if (this.enableVirtualization) {
5373
+ if (this.enableVirtualization && !this.enableDomVirtualization) {
5103
5374
  this.virtualScrollModule.updateSelection(args);
5104
5375
  }
5105
5376
  this.selectedRowIndex = this.grid.selectedRowIndex;
@@ -5257,8 +5528,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5257
5528
  const dataSource = 'dataSource';
5258
5529
  const requestType = getObject('action', args);
5259
5530
  if (((isRemoteData(treeGrid) && !isOffline(treeGrid)) || isCountRequired(this)) && requestType !== 'edit') {
5260
- treeGrid.notify('updateRemoteLevel', args);
5261
- args = (treeGrid.dataResults);
5531
+ if (this.enableDomVirtualization && requestType === 'collapse' && !this.enableVirtualization) {
5532
+ args.result = args.result.slice();
5533
+ }
5534
+ else {
5535
+ treeGrid.notify('updateRemoteLevel', args);
5536
+ args = (treeGrid.dataResults);
5537
+ }
5262
5538
  }
5263
5539
  else if (treeGrid.flatData.length === 0 && isOffline(treeGrid) && treeGrid.dataSource instanceof DataManager) {
5264
5540
  const dm = treeGrid.dataSource;
@@ -5462,6 +5738,14 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5462
5738
  }
5463
5739
  extendedGridActionEvents() {
5464
5740
  this.grid.actionBegin = (args) => {
5741
+ const newArgs = Object.assign({}, args);
5742
+ let changeArgs = false;
5743
+ if (newArgs.requestType === 'save' && this['isGantt'] && !isNullOrUndefined(this.editSettings)
5744
+ && this.editSettings.mode === 'Cell') {
5745
+ delete newArgs.requestType;
5746
+ newArgs.type = 'save';
5747
+ changeArgs = true;
5748
+ }
5465
5749
  if (args.requestType === 'sorting' && args.target && args.target.parentElement &&
5466
5750
  args.target.parentElement.classList.contains('e-hierarchycheckbox')) {
5467
5751
  args.cancel = true;
@@ -5498,7 +5782,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5498
5782
  }
5499
5783
  if (this.action !== 'indenting' && this.action !== 'outdenting') {
5500
5784
  const callBackPromise = new Deferred();
5501
- this.trigger(actionBegin, args, (actionArgs) => {
5785
+ this.trigger(actionBegin, changeArgs ? newArgs : args, (actionArgs) => {
5502
5786
  if (!actionArgs.cancel) {
5503
5787
  this.notify(beginEdit, actionArgs);
5504
5788
  }
@@ -5508,6 +5792,14 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5508
5792
  }
5509
5793
  };
5510
5794
  this.grid.actionComplete = (args) => {
5795
+ const newArgs = Object.assign({}, args);
5796
+ let changeArgs = false;
5797
+ if (newArgs.requestType === 'save' && this['isGantt'] && !isNullOrUndefined(this.editSettings)
5798
+ && this.editSettings.mode === 'Cell') {
5799
+ delete newArgs.requestType;
5800
+ newArgs.type = 'save';
5801
+ changeArgs = true;
5802
+ }
5511
5803
  this.notify('actioncomplete', args);
5512
5804
  this.updateColumnModel();
5513
5805
  this.updateTreeGridModel();
@@ -5556,7 +5848,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5556
5848
  const frozenContent$1 = this.grid.element.querySelector('.' + frozenContent);
5557
5849
  movableContent$1.style.height = frozenContent$1.style.height = 'auto';
5558
5850
  }
5559
- this.trigger(actionComplete, args);
5851
+ this.trigger(actionComplete, changeArgs ? newArgs : args);
5560
5852
  }
5561
5853
  };
5562
5854
  }
@@ -5681,7 +5973,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5681
5973
  edit.mode = 'Normal';
5682
5974
  break;
5683
5975
  case 'Cell':
5684
- edit.mode = 'Normal';
5976
+ edit.mode = this.editSettings.mode;
5685
5977
  edit.showConfirmDialog = false;
5686
5978
  break;
5687
5979
  }
@@ -5889,6 +6181,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5889
6181
  case 'enableVirtualization':
5890
6182
  this.grid.enableVirtualization = this.enableVirtualization;
5891
6183
  break;
6184
+ case 'enableDomVirtualization':
6185
+ this.grid.enableDomVirtualization = this.enableDomVirtualization;
6186
+ break;
5892
6187
  case 'enableColumnVirtualization':
5893
6188
  this.grid.enableColumnVirtualization = this.enableColumnVirtualization;
5894
6189
  break;
@@ -6096,6 +6391,10 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6096
6391
  this.grid.enableColumnSpan = this.enableColumnSpan;
6097
6392
  this.refreshColumns();
6098
6393
  break;
6394
+ case 'hierarchyCheckboxMode':
6395
+ this.autoCheckHierarchy = (this.hierarchyCheckboxMode === 'filteredHierarchy' ||
6396
+ this.hierarchyCheckboxMode === 'hierarchy');
6397
+ break;
6099
6398
  }
6100
6399
  }
6101
6400
  if (requireRefresh) {
@@ -6159,6 +6458,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6159
6458
  }
6160
6459
  this.dataResults = null;
6161
6460
  this.uniqueIDCollection = {};
6461
+ this.uniqueIDCollpaseCollection = {};
6162
6462
  this.uniqueIDFilterCollection = {};
6163
6463
  this.element.innerHTML = '';
6164
6464
  this.grid = null;
@@ -6233,6 +6533,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6233
6533
  }
6234
6534
  }
6235
6535
  mouseClickHandler(e) {
6536
+ this.resetDoubleClickTarget();
6236
6537
  if (!isNullOrUndefined(e.touches)) {
6237
6538
  return;
6238
6539
  }
@@ -7740,9 +8041,15 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7740
8041
  if (!rows.length && this.getRows().length) {
7741
8042
  rows.push(this.getRows()[0]);
7742
8043
  }
7743
- this.isExpandAll = true;
7744
- this.isCollapseAll = true;
7745
- if (((this.allowPaging && (this.pageSettings.pageSizeMode === 'All' || this.pageSettings.pageSizeMode === 'Root')) || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
8044
+ this.isExpandAll = this.enableDomVirtualization ? action !== 'collapse' : true;
8045
+ this.isCollapseAll = this.enableDomVirtualization ? action === 'collapse' : true;
8046
+ if (this.enableDomVirtualization) {
8047
+ const collapseArgs = { data: this.parentData, row: rows[0] };
8048
+ this.trigger(collapsed, collapseArgs);
8049
+ this.notify(virtualExpandCollapse, { action: action, row: rows[0] });
8050
+ this.notify(localPagedExpandCollapse, { action: action, row: rows[0] });
8051
+ }
8052
+ else if (((this.allowPaging && (this.pageSettings.pageSizeMode === 'All' || this.pageSettings.pageSizeMode === 'Root')) || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
7746
8053
  this.flatData.filter((e) => {
7747
8054
  if (e.hasChildRecords) {
7748
8055
  e.expanded = action === 'collapse' ? false : true;
@@ -7811,62 +8118,65 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7811
8118
  if (!isNullOrUndefined(row)) {
7812
8119
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
7813
8120
  }
7814
- if (((this.allowPaging && (this.pageSettings.pageSizeMode === 'All' || this.pageSettings.pageSizeMode === 'Root')) || this.enableVirtualization) && !isRemoteData(this)
8121
+ if (((this.allowPaging && (this.pageSettings.pageSizeMode === 'All' || this.pageSettings.pageSizeMode === 'Root')) || this.enableVirtualization || this.enableDomVirtualization) && !isRemoteData(this)
7815
8122
  && !isCountRequired(this)) {
8123
+ this.notify(virtualExpandCollapse, { action: action, row: row, record: record });
7816
8124
  this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
7817
8125
  }
7818
8126
  else {
7819
- let displayAction;
7820
- if (action === 'expand') {
7821
- displayAction = 'e-childrow-visible';
7822
- if (!isChild) {
7823
- record.expanded = true;
7824
- this.flatData.forEach(function (e) {
7825
- e.expanded = e.uniqueID === record.uniqueID && e.expanded !== record.expanded ? record.expanded : e.expanded;
7826
- });
7827
- this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
7828
- }
7829
- if (!isNullOrUndefined(row)) {
7830
- targetEle = row.getElementsByClassName('e-treegridcollapse')[0];
7831
- }
7832
- if (isChild && !isNullOrUndefined(record[this.expandStateMapping]) &&
7833
- record[this.expandStateMapping] && isNullOrUndefined(targetEle)) {
7834
- targetEle = row.getElementsByClassName('e-treegridexpand')[0];
7835
- }
7836
- if (isNullOrUndefined(targetEle)) {
7837
- return;
7838
- }
7839
- if (!targetEle.classList.contains('e-treegridexpand')) {
7840
- addClass([targetEle], 'e-treegridexpand');
8127
+ const isExpand = action === 'expand';
8128
+ const displayAction = isExpand ? 'e-childrow-visible' : 'e-childrow-hidden';
8129
+ const expandStateMap = this.expandStateMapping;
8130
+ const recordUniqueID = record.uniqueID;
8131
+ if (!isChild) {
8132
+ record.expanded = isExpand;
8133
+ const flatRecord = this.flatData[record.index];
8134
+ if (!isNullOrUndefined(flatRecord)) {
8135
+ flatRecord.expanded = flatRecord.uniqueID === record.uniqueID &&
8136
+ flatRecord.expanded !== record.expanded ? record.expanded : flatRecord.expanded;
8137
+ }
8138
+ this.uniqueIDCollection[`${recordUniqueID}`].expanded = isExpand;
8139
+ }
8140
+ else if (isExpand || isCountRequired(this)) {
8141
+ record.expanded = isExpand;
8142
+ const flatRecord = this.flatData[record.index];
8143
+ if (!isNullOrUndefined(flatRecord)) {
8144
+ flatRecord.expanded = flatRecord.uniqueID === record.uniqueID &&
8145
+ flatRecord.expanded !== record.expanded ? record.expanded : flatRecord.expanded;
8146
+ }
8147
+ this.uniqueIDCollection[`${recordUniqueID}`].expanded = isExpand;
8148
+ }
8149
+ if (!isNullOrUndefined(row)) {
8150
+ const collapseEle = row.getElementsByClassName('e-treegridcollapse')[0];
8151
+ const expandEle = row.getElementsByClassName('e-treegridexpand')[0];
8152
+ targetEle = isExpand ? collapseEle : expandEle;
8153
+ if (isChild && !isNullOrUndefined(record[`${expandStateMap}`]) &&
8154
+ ((isExpand && record[`${expandStateMap}`]) || (!isExpand && !record[`${expandStateMap}`])) &&
8155
+ isNullOrUndefined(targetEle)) {
8156
+ targetEle = isExpand ? expandEle : collapseEle;
8157
+ }
8158
+ }
8159
+ if (isNullOrUndefined(targetEle)) {
8160
+ return;
8161
+ }
8162
+ const targetClsList = targetEle.classList;
8163
+ const expandClass = 'e-treegridexpand';
8164
+ const collapseClass = 'e-treegridcollapse';
8165
+ if (isExpand) {
8166
+ if (!targetClsList.contains(expandClass)) {
8167
+ addClass([targetEle], expandClass);
8168
+ removeClass([targetEle], collapseClass);
7841
8169
  }
7842
- removeClass([targetEle], 'e-treegridcollapse');
7843
8170
  }
7844
8171
  else {
7845
- displayAction = 'e-childrow-hidden';
7846
- if (!isChild || isCountRequired(this)) {
7847
- record.expanded = false;
7848
- this.flatData.forEach(function (e) {
7849
- e.expanded = e.uniqueID === record.uniqueID && e.expanded !== record.expanded ? record.expanded : e.expanded;
7850
- });
7851
- this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
7852
- }
7853
- if (!isNullOrUndefined(row)) {
7854
- targetEle = row.getElementsByClassName('e-treegridexpand')[0];
7855
- }
7856
- if (isChild && !isNullOrUndefined(record[this.expandStateMapping]) &&
7857
- !record[this.expandStateMapping] && isNullOrUndefined(targetEle)) {
7858
- targetEle = row.getElementsByClassName('e-treegridcollapse')[0];
7859
- }
7860
- if (isNullOrUndefined(targetEle)) {
7861
- return;
7862
- }
7863
- if (!targetEle.classList.contains('e-treegridcollapse')) {
7864
- addClass([targetEle], 'e-treegridcollapse');
8172
+ if (!targetClsList.contains(collapseClass)) {
8173
+ addClass([targetEle], collapseClass);
8174
+ removeClass([targetEle], expandClass);
7865
8175
  }
7866
- removeClass([targetEle], 'e-treegridexpand');
7867
8176
  }
7868
- row.querySelectorAll('.e-treerowcell')[0].setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
7869
- const detailrows = gridRows.filter((r) => r.classList.contains('e-griddetailrowindex' + record.index + 'level' + (record.level + 1)));
8177
+ row.querySelectorAll('.e-treerowcell')[0].setAttribute('aria-expanded', isExpand ? 'true' : 'false');
8178
+ const detailRowClass = 'e-griddetailrowindex' + record.index + 'level' + (record.level + 1);
8179
+ const detailrows = gridRows.filter((r) => r.classList.contains(detailRowClass));
7870
8180
  if (isRemoteData(this) && !isOffline(this)) {
7871
8181
  this.remoteExpand(action, row, record);
7872
8182
  }
@@ -7877,29 +8187,37 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7877
8187
  if (this.enableInfiniteScrolling && action === 'collapse' && !this.isCollapseAll) {
7878
8188
  this.notify(collapseActionComplete, { isCollapse: true, data: record, row: row });
7879
8189
  }
7880
- const lastrowIdx = this.getVisibleRecords()[this.getVisibleRecords().length - 1]['index'];
7881
- const lastRow = this.getRowByIndex(lastrowIdx);
7882
- const borderElement = lastRow ? lastRow.nextElementSibling ? lastRow.nextElementSibling.classList.contains('e-detailrow') ? lastRow.nextElementSibling : lastRow : lastRow : null;
7883
- if (!this.isInfiniteCollapse && this.grid.getContentTable().clientHeight <= this.grid.getContent().clientHeight && !isNullOrUndefined(borderElement) && !borderElement.cells[0].classList.contains('e-lastrowcell')) {
7884
- this.lastRowBorder(borderElement, true);
8190
+ const visibleRecords = this.getVisibleRecords();
8191
+ const lastRecord = visibleRecords[visibleRecords.length - 1];
8192
+ if (!isNullOrUndefined(lastRecord)) {
8193
+ const lastrowIdx = lastRecord.index;
8194
+ const lastRow = this.getRowByIndex(lastrowIdx);
8195
+ const borderElement = (lastRow ? lastRow.nextElementSibling ? lastRow.nextElementSibling.classList.contains('e-detailrow') ? lastRow.nextElementSibling : lastRow : lastRow : null);
8196
+ if (!this.isInfiniteCollapse && this.grid.getContentTable().clientHeight <= this.grid.getContent().clientHeight && !isNullOrUndefined(borderElement) && !(borderElement.cells[0].classList.contains('e-lastrowcell'))) {
8197
+ this.lastRowBorder(borderElement, true);
8198
+ }
7885
8199
  }
7886
8200
  }
7887
- if (isCountRequired(this) && action === 'expand') {
8201
+ if (isCountRequired(this) && isExpand) {
7888
8202
  const currentData = this.getCurrentViewRecords();
7889
- const visibleRecords = currentData.filter((e) => {
8203
+ const filteredRecords = currentData.filter((e) => {
7890
8204
  return getExpandStatus(this, e, this.parentData);
7891
8205
  });
7892
- this.dataResults.result = visibleRecords;
8206
+ this.dataResults.result = filteredRecords;
7893
8207
  }
7894
- if (!isNullOrUndefined(targetEle) && targetEle.closest('.e-treerowcell').classList.contains('e-cellselectionbackground')) {
7895
- targetEle.closest('.e-treerowcell').classList.remove('e-cellselectionbackground');
7896
- targetEle.closest('.e-treerowcell').removeAttribute('aria-selected');
8208
+ if (!isNullOrUndefined(targetEle)) {
8209
+ const treeRowCell = targetEle.closest('.e-treerowcell');
8210
+ if (!isNullOrUndefined(treeRowCell) && treeRowCell.classList.contains('e-cellselectionbackground')) {
8211
+ treeRowCell.classList.remove('e-cellselectionbackground');
8212
+ treeRowCell.removeAttribute('aria-selected');
8213
+ }
7897
8214
  }
7898
8215
  if (this.isPixelHeight() && !row.cells[0].classList.contains('e-lastrowcell') && !this.isInfiniteCollapse) {
7899
8216
  let totalRows = this.getRows();
7900
8217
  const rows = this.getContentTable().rows;
7901
8218
  totalRows = [].slice.call(rows);
7902
- for (let i = totalRows.length - 1; i >= 0; i--) {
8219
+ const len = totalRows.length;
8220
+ for (let i = len - 1; i >= 0; i--) {
7903
8221
  if (!isHidden(totalRows[parseInt(i.toString(), 10)])) {
7904
8222
  const table = this.getContentTable();
7905
8223
  const sHeight = table.scrollHeight;
@@ -8037,7 +8355,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
8037
8355
  this.dataModule[`${fetchRemoteChildData}`]({ action: action, record: args.data, rows: null, parentRow: args.row });
8038
8356
  }
8039
8357
  else {
8040
- this.collapseRemoteChild({ record: record, rows: rows });
8358
+ if (this.enableDomVirtualization) {
8359
+ this.notify(virtualExpandCollapse, { action: action, row: row, record: record });
8360
+ this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
8361
+ }
8362
+ else {
8363
+ this.collapseRemoteChild({ record: record, rows: rows });
8364
+ }
8041
8365
  this.trigger(collapsed, args);
8042
8366
  }
8043
8367
  }
@@ -8300,6 +8624,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
8300
8624
  Array.prototype.push.apply(args.elements, cells);
8301
8625
  }
8302
8626
  }
8627
+ resetDoubleClickTarget() {
8628
+ if (this.editModule) {
8629
+ this.notify('resetDoubleClickTarget', {});
8630
+ }
8631
+ }
8303
8632
  partialFilterUpdate(args) {
8304
8633
  const gridFiltered = args.gridFiltered;
8305
8634
  if ((this.allowFiltering && this.filterModule && this.grid.filterSettings.columns.length) ||
@@ -8783,424 +9112,433 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
8783
9112
  return this.grid.getRowIndexByPrimaryKey(value);
8784
9113
  }
8785
9114
  };
8786
- __decorate$c([
9115
+ __decorate$d([
8787
9116
  Property(0)
8788
9117
  ], TreeGrid.prototype, "frozenRows", void 0);
8789
- __decorate$c([
9118
+ __decorate$d([
8790
9119
  Property(0)
8791
9120
  ], TreeGrid.prototype, "frozenColumns", void 0);
8792
- __decorate$c([
9121
+ __decorate$d([
8793
9122
  Property('Ellipsis')
8794
9123
  ], TreeGrid.prototype, "clipMode", void 0);
8795
- __decorate$c([
9124
+ __decorate$d([
8796
9125
  Property([])
8797
9126
  ], TreeGrid.prototype, "columns", void 0);
8798
- __decorate$c([
9127
+ __decorate$d([
8799
9128
  Property(null)
8800
9129
  ], TreeGrid.prototype, "childMapping", void 0);
8801
- __decorate$c([
9130
+ __decorate$d([
8802
9131
  Property(null)
8803
9132
  ], TreeGrid.prototype, "hasChildMapping", void 0);
8804
- __decorate$c([
9133
+ __decorate$d([
8805
9134
  Property(0)
8806
9135
  ], TreeGrid.prototype, "treeColumnIndex", void 0);
8807
- __decorate$c([
9136
+ __decorate$d([
8808
9137
  Property(null)
8809
9138
  ], TreeGrid.prototype, "idMapping", void 0);
8810
- __decorate$c([
9139
+ __decorate$d([
8811
9140
  Property(null)
8812
9141
  ], TreeGrid.prototype, "parentIdMapping", void 0);
8813
- __decorate$c([
9142
+ __decorate$d([
8814
9143
  Property(false)
8815
9144
  ], TreeGrid.prototype, "enableCollapseAll", void 0);
8816
- __decorate$c([
9145
+ __decorate$d([
8817
9146
  Property(null)
8818
9147
  ], TreeGrid.prototype, "expandStateMapping", void 0);
8819
- __decorate$c([
9148
+ __decorate$d([
8820
9149
  Property(false)
8821
9150
  ], TreeGrid.prototype, "allowRowDragAndDrop", void 0);
8822
- __decorate$c([
9151
+ __decorate$d([
8823
9152
  Property([])
8824
9153
  ], TreeGrid.prototype, "dataSource", void 0);
8825
- __decorate$c([
9154
+ __decorate$d([
8826
9155
  Property()
8827
9156
  ], TreeGrid.prototype, "query", void 0);
8828
- __decorate$c([
9157
+ __decorate$d([
8829
9158
  Property()
8830
9159
  ], TreeGrid.prototype, "cloneQuery", void 0);
8831
- __decorate$c([
9160
+ __decorate$d([
8832
9161
  Property('AllPages')
8833
9162
  ], TreeGrid.prototype, "printMode", void 0);
8834
- __decorate$c([
9163
+ __decorate$d([
8835
9164
  Property(false)
8836
9165
  ], TreeGrid.prototype, "allowPaging", void 0);
8837
- __decorate$c([
9166
+ __decorate$d([
8838
9167
  Property(true)
8839
9168
  ], TreeGrid.prototype, "loadChildOnDemand", void 0);
8840
- __decorate$c([
9169
+ __decorate$d([
8841
9170
  Property(false)
8842
9171
  ], TreeGrid.prototype, "allowTextWrap", void 0);
8843
- __decorate$c([
9172
+ __decorate$d([
8844
9173
  Complex({}, TextWrapSettings)
8845
9174
  ], TreeGrid.prototype, "textWrapSettings", void 0);
8846
- __decorate$c([
9175
+ __decorate$d([
8847
9176
  Property(false)
8848
9177
  ], TreeGrid.prototype, "allowReordering", void 0);
8849
- __decorate$c([
9178
+ __decorate$d([
8850
9179
  Property(false)
8851
9180
  ], TreeGrid.prototype, "allowResizing", void 0);
8852
- __decorate$c([
9181
+ __decorate$d([
8853
9182
  Property(false)
8854
9183
  ], TreeGrid.prototype, "autoCheckHierarchy", void 0);
8855
- __decorate$c([
9184
+ __decorate$d([
9185
+ Property('self')
9186
+ ], TreeGrid.prototype, "hierarchyCheckboxMode", void 0);
9187
+ __decorate$d([
8856
9188
  Complex({}, PageSettings)
8857
9189
  ], TreeGrid.prototype, "pageSettings", void 0);
8858
- __decorate$c([
9190
+ __decorate$d([
8859
9191
  Complex({}, RowDropSettings$1)
8860
9192
  ], TreeGrid.prototype, "rowDropSettings", void 0);
8861
- __decorate$c([
9193
+ __decorate$d([
8862
9194
  Property('USD')
8863
9195
  ], TreeGrid.prototype, "currencyCode", void 0);
8864
- __decorate$c([
9196
+ __decorate$d([
8865
9197
  Property()
8866
9198
  ], TreeGrid.prototype, "pagerTemplate", void 0);
8867
- __decorate$c([
9199
+ __decorate$d([
8868
9200
  Property(false)
8869
9201
  ], TreeGrid.prototype, "showColumnMenu", void 0);
8870
- __decorate$c([
9202
+ __decorate$d([
8871
9203
  Property(false)
8872
9204
  ], TreeGrid.prototype, "showColumnChooser", void 0);
8873
- __decorate$c([
9205
+ __decorate$d([
8874
9206
  Complex({}, ColumnChooserSettings)
8875
9207
  ], TreeGrid.prototype, "columnChooserSettings", void 0);
8876
- __decorate$c([
9208
+ __decorate$d([
8877
9209
  Property(false)
8878
9210
  ], TreeGrid.prototype, "allowSorting", void 0);
8879
- __decorate$c([
9211
+ __decorate$d([
8880
9212
  Property(true)
8881
9213
  ], TreeGrid.prototype, "allowMultiSorting", void 0);
8882
- __decorate$c([
9214
+ __decorate$d([
8883
9215
  Complex({}, SortSettings)
8884
9216
  ], TreeGrid.prototype, "sortSettings", void 0);
8885
- __decorate$c([
9217
+ __decorate$d([
8886
9218
  Collection([], AggregateRow)
8887
9219
  ], TreeGrid.prototype, "aggregates", void 0);
8888
- __decorate$c([
9220
+ __decorate$d([
8889
9221
  Complex({}, EditSettings)
8890
9222
  ], TreeGrid.prototype, "editSettings", void 0);
8891
- __decorate$c([
9223
+ __decorate$d([
8892
9224
  Property(false)
8893
9225
  ], TreeGrid.prototype, "allowFiltering", void 0);
8894
- __decorate$c([
9226
+ __decorate$d([
8895
9227
  Property()
8896
9228
  ], TreeGrid.prototype, "detailTemplate", void 0);
8897
- __decorate$c([
9229
+ __decorate$d([
8898
9230
  Complex({}, FilterSettings)
8899
9231
  ], TreeGrid.prototype, "filterSettings", void 0);
8900
- __decorate$c([
9232
+ __decorate$d([
8901
9233
  Complex({}, SearchSettings)
8902
9234
  ], TreeGrid.prototype, "searchSettings", void 0);
8903
- __decorate$c([
9235
+ __decorate$d([
8904
9236
  Property()
8905
9237
  ], TreeGrid.prototype, "toolbar", void 0);
8906
- __decorate$c([
9238
+ __decorate$d([
8907
9239
  Property()
8908
9240
  ], TreeGrid.prototype, "toolbarTemplate", void 0);
8909
- __decorate$c([
9241
+ __decorate$d([
8910
9242
  Property('Default')
8911
9243
  ], TreeGrid.prototype, "gridLines", void 0);
8912
- __decorate$c([
9244
+ __decorate$d([
8913
9245
  Property()
8914
9246
  ], TreeGrid.prototype, "contextMenuItems", void 0);
8915
- __decorate$c([
9247
+ __decorate$d([
8916
9248
  Property()
8917
9249
  ], TreeGrid.prototype, "columnMenuItems", void 0);
8918
- __decorate$c([
9250
+ __decorate$d([
8919
9251
  Property()
8920
9252
  ], TreeGrid.prototype, "rowTemplate", void 0);
8921
- __decorate$c([
9253
+ __decorate$d([
8922
9254
  Property('Parent')
8923
9255
  ], TreeGrid.prototype, "copyHierarchyMode", void 0);
8924
- __decorate$c([
9256
+ __decorate$d([
8925
9257
  Property(null)
8926
9258
  ], TreeGrid.prototype, "rowHeight", void 0);
8927
- __decorate$c([
9259
+ __decorate$d([
8928
9260
  Property(true)
8929
9261
  ], TreeGrid.prototype, "enableAltRow", void 0);
8930
- __decorate$c([
9262
+ __decorate$d([
8931
9263
  Property(true)
8932
9264
  ], TreeGrid.prototype, "allowKeyboard", void 0);
8933
- __decorate$c([
9265
+ __decorate$d([
8934
9266
  Property(false)
8935
9267
  ], TreeGrid.prototype, "enableHover", void 0);
8936
- __decorate$c([
9268
+ __decorate$d([
8937
9269
  Property(false)
8938
9270
  ], TreeGrid.prototype, "enableAutoFill", void 0);
8939
- __decorate$c([
9271
+ __decorate$d([
8940
9272
  Property(false)
8941
9273
  ], TreeGrid.prototype, "enableAdaptiveUI", void 0);
8942
- __decorate$c([
9274
+ __decorate$d([
8943
9275
  Property(false)
8944
9276
  ], TreeGrid.prototype, "enableImmutableMode", void 0);
8945
- __decorate$c([
9277
+ __decorate$d([
8946
9278
  Property(false)
8947
9279
  ], TreeGrid.prototype, "enableStickyHeader", void 0);
8948
- __decorate$c([
9280
+ __decorate$d([
8949
9281
  Property()
8950
9282
  ], TreeGrid.prototype, "emptyRecordTemplate", void 0);
8951
- __decorate$c([
9283
+ __decorate$d([
8952
9284
  Property('auto')
8953
9285
  ], TreeGrid.prototype, "height", void 0);
8954
- __decorate$c([
9286
+ __decorate$d([
8955
9287
  Property('auto')
8956
9288
  ], TreeGrid.prototype, "width", void 0);
8957
- __decorate$c([
9289
+ __decorate$d([
8958
9290
  Complex({}, LoadingIndicator)
8959
9291
  ], TreeGrid.prototype, "loadingIndicator", void 0);
8960
- __decorate$c([
9292
+ __decorate$d([
8961
9293
  Property(true)
8962
9294
  ], TreeGrid.prototype, "enableVirtualMaskRow", void 0);
8963
- __decorate$c([
9295
+ __decorate$d([
8964
9296
  Property(false)
8965
9297
  ], TreeGrid.prototype, "enableVirtualization", void 0);
8966
- __decorate$c([
9298
+ __decorate$d([
8967
9299
  Property(false)
8968
9300
  ], TreeGrid.prototype, "enableColumnVirtualization", void 0);
8969
- __decorate$c([
9301
+ __decorate$d([
8970
9302
  Property(false)
8971
9303
  ], TreeGrid.prototype, "enableHtmlSanitizer", void 0);
8972
- __decorate$c([
9304
+ __decorate$d([
8973
9305
  Property(false)
8974
9306
  ], TreeGrid.prototype, "enableInfiniteScrolling", void 0);
8975
- __decorate$c([
9307
+ __decorate$d([
8976
9308
  Complex({}, InfiniteScrollSettings)
8977
9309
  ], TreeGrid.prototype, "infiniteScrollSettings", void 0);
8978
- __decorate$c([
9310
+ __decorate$d([
9311
+ Property(false)
9312
+ ], TreeGrid.prototype, "enableDomVirtualization", void 0);
9313
+ __decorate$d([
9314
+ Complex({}, DomVirtualizationSettings)
9315
+ ], TreeGrid.prototype, "domVirtualizationSettings", void 0);
9316
+ __decorate$d([
8979
9317
  Property('All')
8980
9318
  ], TreeGrid.prototype, "columnQueryMode", void 0);
8981
- __decorate$c([
9319
+ __decorate$d([
8982
9320
  Property(true)
8983
9321
  ], TreeGrid.prototype, "allowSelection", void 0);
8984
- __decorate$c([
9322
+ __decorate$d([
8985
9323
  Property(-1)
8986
9324
  ], TreeGrid.prototype, "selectedRowIndex", void 0);
8987
- __decorate$c([
9325
+ __decorate$d([
8988
9326
  Property(null)
8989
9327
  ], TreeGrid.prototype, "isRowSelectable", void 0);
8990
- __decorate$c([
9328
+ __decorate$d([
8991
9329
  Complex({}, SelectionSettings)
8992
9330
  ], TreeGrid.prototype, "selectionSettings", void 0);
8993
- __decorate$c([
9331
+ __decorate$d([
8994
9332
  Property(false)
8995
9333
  ], TreeGrid.prototype, "allowExcelExport", void 0);
8996
- __decorate$c([
9334
+ __decorate$d([
8997
9335
  Property(false)
8998
9336
  ], TreeGrid.prototype, "allowPdfExport", void 0);
8999
- __decorate$c([
9337
+ __decorate$d([
9000
9338
  Property(false)
9001
9339
  ], TreeGrid.prototype, "enableColumnSpan", void 0);
9002
- __decorate$c([
9340
+ __decorate$d([
9003
9341
  Property(false)
9004
9342
  ], TreeGrid.prototype, "enableRowSpan", void 0);
9005
- __decorate$c([
9343
+ __decorate$d([
9006
9344
  Event()
9007
9345
  ], TreeGrid.prototype, "created", void 0);
9008
- __decorate$c([
9346
+ __decorate$d([
9009
9347
  Event()
9010
9348
  ], TreeGrid.prototype, "load", void 0);
9011
- __decorate$c([
9349
+ __decorate$d([
9012
9350
  Event()
9013
9351
  ], TreeGrid.prototype, "expanding", void 0);
9014
- __decorate$c([
9352
+ __decorate$d([
9015
9353
  Event()
9016
9354
  ], TreeGrid.prototype, "expanded", void 0);
9017
- __decorate$c([
9355
+ __decorate$d([
9018
9356
  Event()
9019
9357
  ], TreeGrid.prototype, "collapsing", void 0);
9020
- __decorate$c([
9358
+ __decorate$d([
9021
9359
  Event()
9022
9360
  ], TreeGrid.prototype, "collapsed", void 0);
9023
- __decorate$c([
9361
+ __decorate$d([
9024
9362
  Event()
9025
9363
  ], TreeGrid.prototype, "cellSave", void 0);
9026
- __decorate$c([
9364
+ __decorate$d([
9027
9365
  Event()
9028
9366
  ], TreeGrid.prototype, "cellSaved", void 0);
9029
- __decorate$c([
9367
+ __decorate$d([
9030
9368
  Event()
9031
9369
  ], TreeGrid.prototype, "actionBegin", void 0);
9032
- __decorate$c([
9370
+ __decorate$d([
9033
9371
  Event()
9034
9372
  ], TreeGrid.prototype, "actionComplete", void 0);
9035
- __decorate$c([
9373
+ __decorate$d([
9036
9374
  Event()
9037
9375
  ], TreeGrid.prototype, "beginEdit", void 0);
9038
- __decorate$c([
9376
+ __decorate$d([
9039
9377
  Event()
9040
9378
  ], TreeGrid.prototype, "batchAdd", void 0);
9041
- __decorate$c([
9379
+ __decorate$d([
9042
9380
  Event()
9043
9381
  ], TreeGrid.prototype, "batchDelete", void 0);
9044
- __decorate$c([
9382
+ __decorate$d([
9045
9383
  Event()
9046
9384
  ], TreeGrid.prototype, "batchCancel", void 0);
9047
- __decorate$c([
9385
+ __decorate$d([
9048
9386
  Event()
9049
9387
  ], TreeGrid.prototype, "beforeBatchAdd", void 0);
9050
- __decorate$c([
9388
+ __decorate$d([
9051
9389
  Event()
9052
9390
  ], TreeGrid.prototype, "beforeBatchDelete", void 0);
9053
- __decorate$c([
9391
+ __decorate$d([
9054
9392
  Event()
9055
9393
  ], TreeGrid.prototype, "beforeBatchSave", void 0);
9056
- __decorate$c([
9394
+ __decorate$d([
9057
9395
  Event()
9058
9396
  ], TreeGrid.prototype, "cellEdit", void 0);
9059
- __decorate$c([
9397
+ __decorate$d([
9060
9398
  Event()
9061
9399
  ], TreeGrid.prototype, "actionFailure", void 0);
9062
- __decorate$c([
9400
+ __decorate$d([
9063
9401
  Event()
9064
9402
  ], TreeGrid.prototype, "dataBound", void 0);
9065
- __decorate$c([
9403
+ __decorate$d([
9066
9404
  Event()
9067
9405
  ], TreeGrid.prototype, "dataSourceChanged", void 0);
9068
- __decorate$c([
9406
+ __decorate$d([
9069
9407
  Event()
9070
9408
  ], TreeGrid.prototype, "dataStateChange", void 0);
9071
- __decorate$c([
9409
+ __decorate$d([
9072
9410
  Event()
9073
9411
  ], TreeGrid.prototype, "recordDoubleClick", void 0);
9074
- __decorate$c([
9412
+ __decorate$d([
9075
9413
  Event()
9076
9414
  ], TreeGrid.prototype, "rowDataBound", void 0);
9077
- __decorate$c([
9415
+ __decorate$d([
9078
9416
  Event()
9079
9417
  ], TreeGrid.prototype, "detailDataBound", void 0);
9080
- __decorate$c([
9418
+ __decorate$d([
9081
9419
  Event()
9082
9420
  ], TreeGrid.prototype, "queryCellInfo", void 0);
9083
- __decorate$c([
9421
+ __decorate$d([
9084
9422
  Event()
9085
9423
  ], TreeGrid.prototype, "rowSelecting", void 0);
9086
- __decorate$c([
9424
+ __decorate$d([
9087
9425
  Event()
9088
9426
  ], TreeGrid.prototype, "rowSelected", void 0);
9089
- __decorate$c([
9427
+ __decorate$d([
9090
9428
  Event()
9091
9429
  ], TreeGrid.prototype, "rowDeselecting", void 0);
9092
- __decorate$c([
9430
+ __decorate$d([
9093
9431
  Event()
9094
9432
  ], TreeGrid.prototype, "rowDeselected", void 0);
9095
- __decorate$c([
9433
+ __decorate$d([
9096
9434
  Event()
9097
9435
  ], TreeGrid.prototype, "headerCellInfo", void 0);
9098
- __decorate$c([
9436
+ __decorate$d([
9099
9437
  Event()
9100
9438
  ], TreeGrid.prototype, "cellSelecting", void 0);
9101
- __decorate$c([
9439
+ __decorate$d([
9102
9440
  Event()
9103
9441
  ], TreeGrid.prototype, "columnMenuOpen", void 0);
9104
- __decorate$c([
9442
+ __decorate$d([
9105
9443
  Event()
9106
9444
  ], TreeGrid.prototype, "columnMenuClick", void 0);
9107
- __decorate$c([
9445
+ __decorate$d([
9108
9446
  Event()
9109
9447
  ], TreeGrid.prototype, "cellSelected", void 0);
9110
- __decorate$c([
9448
+ __decorate$d([
9111
9449
  Event()
9112
9450
  ], TreeGrid.prototype, "cellDeselecting", void 0);
9113
- __decorate$c([
9451
+ __decorate$d([
9114
9452
  Event()
9115
9453
  ], TreeGrid.prototype, "cellDeselected", void 0);
9116
- __decorate$c([
9454
+ __decorate$d([
9117
9455
  Event()
9118
9456
  ], TreeGrid.prototype, "resizeStart", void 0);
9119
- __decorate$c([
9457
+ __decorate$d([
9120
9458
  Event()
9121
9459
  ], TreeGrid.prototype, "resizing", void 0);
9122
- __decorate$c([
9460
+ __decorate$d([
9123
9461
  Event()
9124
9462
  ], TreeGrid.prototype, "resizeStop", void 0);
9125
- __decorate$c([
9463
+ __decorate$d([
9126
9464
  Event()
9127
9465
  ], TreeGrid.prototype, "columnDragStart", void 0);
9128
- __decorate$c([
9466
+ __decorate$d([
9129
9467
  Event()
9130
9468
  ], TreeGrid.prototype, "columnDrag", void 0);
9131
- __decorate$c([
9469
+ __decorate$d([
9132
9470
  Event()
9133
9471
  ], TreeGrid.prototype, "columnDrop", void 0);
9134
- __decorate$c([
9472
+ __decorate$d([
9135
9473
  Event()
9136
9474
  ], TreeGrid.prototype, "checkboxChange", void 0);
9137
- __decorate$c([
9475
+ __decorate$d([
9138
9476
  Event()
9139
9477
  ], TreeGrid.prototype, "printComplete", void 0);
9140
- __decorate$c([
9478
+ __decorate$d([
9141
9479
  Event()
9142
9480
  ], TreeGrid.prototype, "beforePrint", void 0);
9143
- __decorate$c([
9481
+ __decorate$d([
9144
9482
  Event()
9145
9483
  ], TreeGrid.prototype, "toolbarClick", void 0);
9146
- __decorate$c([
9484
+ __decorate$d([
9147
9485
  Event()
9148
9486
  ], TreeGrid.prototype, "beforeDataBound", void 0);
9149
- __decorate$c([
9487
+ __decorate$d([
9150
9488
  Event()
9151
9489
  ], TreeGrid.prototype, "contextMenuOpen", void 0);
9152
- __decorate$c([
9490
+ __decorate$d([
9153
9491
  Event()
9154
9492
  ], TreeGrid.prototype, "contextMenuClick", void 0);
9155
- __decorate$c([
9493
+ __decorate$d([
9156
9494
  Event()
9157
9495
  ], TreeGrid.prototype, "beforeCopy", void 0);
9158
- __decorate$c([
9496
+ __decorate$d([
9159
9497
  Event()
9160
9498
  ], TreeGrid.prototype, "beforePaste", void 0);
9161
- __decorate$c([
9499
+ __decorate$d([
9162
9500
  Event()
9163
9501
  ], TreeGrid.prototype, "rowDrag", void 0);
9164
- __decorate$c([
9502
+ __decorate$d([
9165
9503
  Event()
9166
9504
  ], TreeGrid.prototype, "rowDragStart", void 0);
9167
- __decorate$c([
9505
+ __decorate$d([
9168
9506
  Event()
9169
9507
  ], TreeGrid.prototype, "rowDragStartHelper", void 0);
9170
- __decorate$c([
9508
+ __decorate$d([
9171
9509
  Event()
9172
9510
  ], TreeGrid.prototype, "rowDrop", void 0);
9173
- __decorate$c([
9511
+ __decorate$d([
9174
9512
  Event()
9175
9513
  ], TreeGrid.prototype, "pdfQueryCellInfo", void 0);
9176
- __decorate$c([
9514
+ __decorate$d([
9177
9515
  Event()
9178
9516
  ], TreeGrid.prototype, "pdfHeaderQueryCellInfo", void 0);
9179
- __decorate$c([
9517
+ __decorate$d([
9180
9518
  Event()
9181
9519
  ], TreeGrid.prototype, "excelQueryCellInfo", void 0);
9182
- __decorate$c([
9520
+ __decorate$d([
9183
9521
  Event()
9184
9522
  ], TreeGrid.prototype, "pdfAggregateQueryCellInfo", void 0);
9185
- __decorate$c([
9523
+ __decorate$d([
9186
9524
  Event()
9187
9525
  ], TreeGrid.prototype, "excelAggregateQueryCellInfo", void 0);
9188
- __decorate$c([
9526
+ __decorate$d([
9189
9527
  Event()
9190
9528
  ], TreeGrid.prototype, "excelHeaderQueryCellInfo", void 0);
9191
- __decorate$c([
9529
+ __decorate$d([
9192
9530
  Event()
9193
9531
  ], TreeGrid.prototype, "beforeExcelExport", void 0);
9194
- __decorate$c([
9532
+ __decorate$d([
9195
9533
  Event()
9196
9534
  ], TreeGrid.prototype, "excelExportComplete", void 0);
9197
- __decorate$c([
9535
+ __decorate$d([
9198
9536
  Event()
9199
9537
  ], TreeGrid.prototype, "beforePdfExport", void 0);
9200
- __decorate$c([
9538
+ __decorate$d([
9201
9539
  Event()
9202
9540
  ], TreeGrid.prototype, "pdfExportComplete", void 0);
9203
- TreeGrid = TreeGrid_1 = __decorate$c([
9541
+ TreeGrid = TreeGrid_1 = __decorate$d([
9204
9542
  NotifyPropertyChanges
9205
9543
  ], TreeGrid);
9206
9544
 
@@ -10606,6 +10944,7 @@ class RowDD {
10606
10944
  * @returns {void} - This function does not return any value.
10607
10945
  */
10608
10946
  dropRows(args, isByMethod) {
10947
+ const oldParentsList = [];
10609
10948
  if (this.dropPosition !== 'Invalid' && !isRemoteData(this.parent)) {
10610
10949
  const tObj = this.parent;
10611
10950
  let draggedRecord;
@@ -10648,6 +10987,15 @@ class RowDD {
10648
10987
  else {
10649
10988
  dragRecords = args.data;
10650
10989
  }
10990
+ if (isCheckboxcolumn(this.parent) && this.parent.autoCheckHierarchy) {
10991
+ for (let dragIndex = 0; dragIndex < dragRecords.length; dragIndex++) {
10992
+ const drag = dragRecords[parseInt(dragIndex.toString(), 10)];
10993
+ const oldParent = drag && drag.parentItem;
10994
+ if (oldParent) {
10995
+ oldParentsList.push(oldParent);
10996
+ }
10997
+ }
10998
+ }
10651
10999
  this.parent[this.modifiedRecords].push(args.data[0], droppedRecord);
10652
11000
  let count = 0;
10653
11001
  const multiplegrid = this.parent.rowDropSettings.targetID;
@@ -10759,6 +11107,15 @@ class RowDD {
10759
11107
  }
10760
11108
  }
10761
11109
  }
11110
+ if (this.dropPosition !== 'Invalid' && !isNullOrUndefined(args.data) && args.data.length
11111
+ && isCheckboxcolumn(this.parent) && this.parent.autoCheckHierarchy) {
11112
+ this.parent.notify(hierarchyCheckstateUpdate, {
11113
+ draggedRecords: args.data,
11114
+ oldParents: oldParentsList,
11115
+ droppedRecord: this.droppedRecord,
11116
+ dropPosition: this.dropPosition
11117
+ });
11118
+ }
10762
11119
  }
10763
11120
  /**
10764
11121
  * Handles the logic for inserting a dragged record into the middle of a parent record's child records.
@@ -11205,7 +11562,7 @@ class RowDD {
11205
11562
  }
11206
11563
  }
11207
11564
 
11208
- var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11565
+ var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
11209
11566
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11210
11567
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11211
11568
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -11216,7 +11573,7 @@ var __decorate$d = (undefined && undefined.__decorate) || function (decorators,
11216
11573
  */
11217
11574
  class RowDropSettings extends ChildProperty {
11218
11575
  }
11219
- __decorate$d([
11576
+ __decorate$e([
11220
11577
  Property()
11221
11578
  ], RowDropSettings.prototype, "targetID", void 0);
11222
11579
 
@@ -11309,6 +11666,38 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
11309
11666
  }
11310
11667
  }
11311
11668
 
11669
+ /**
11670
+ * DomVirtualTreeContentRenderer extends Grid's DOM virtualization rendering layer to provide tree-specific hierarchy support.
11671
+ *
11672
+ * @hidden
11673
+ */
11674
+ class DomVirtualTreeContentRenderer extends DomVirtualContentRenderer {
11675
+ /**
11676
+ * Constructor for DomVirtualTreeContentRenderer
11677
+ *
11678
+ * @param {IGrid} parent - Grid/TreeGrid instance
11679
+ * @param {ServiceLocator} locator - Service locator for dependency injection
11680
+ */
11681
+ constructor(parent, locator) {
11682
+ super(parent, locator);
11683
+ this.addEventListener();
11684
+ }
11685
+ addEventListener() {
11686
+ if (this.parent.isDestroyed) {
11687
+ return;
11688
+ }
11689
+ }
11690
+ removeEventListener() {
11691
+ if (this.parent.isDestroyed) {
11692
+ return;
11693
+ }
11694
+ }
11695
+ destroy() {
11696
+ this.removeEventListener();
11697
+ super.destroy();
11698
+ }
11699
+ }
11700
+
11312
11701
  /**
11313
11702
  * TreeGrid Filter module will handle filtering action
11314
11703
  *
@@ -11321,7 +11710,7 @@ class Filter {
11321
11710
  * @param {TreeGrid} parent - Tree Grid instance
11322
11711
  */
11323
11712
  constructor(parent) {
11324
- initializeTelemetryFeature('Filter', 'TreeGrid');
11713
+ initializeTelemetryFeature('Filter', 'Treegrid');
11325
11714
  Grid.Inject(Filter$1);
11326
11715
  this.parent = parent;
11327
11716
  this.isHierarchyFilter = false;
@@ -12106,11 +12495,16 @@ class Page {
12106
12495
  */
12107
12496
  collapseExpandPagedchilds(rowDetails) {
12108
12497
  rowDetails.record.expanded = rowDetails.action === 'collapse' ? false : true;
12109
- this.parent.flatData.map((e) => e.expanded = e.uniqueID === rowDetails.record.uniqueID &&
12498
+ let flatData = this.parent.flatData;
12499
+ const isRemote = isRemoteData(this.parent) && !isOffline(this.parent);
12500
+ if (this.parent.enableDomVirtualization && isRemote) {
12501
+ flatData = this.parent.getCurrentViewRecords();
12502
+ }
12503
+ flatData.map((e) => e.expanded = e.uniqueID === rowDetails.record.uniqueID &&
12110
12504
  e.expanded !== rowDetails.record.expanded ? rowDetails.record.expanded : e.expanded);
12111
12505
  if (this.parent.enableImmutableMode) {
12112
12506
  const primaryKeyField = this.parent.getPrimaryKeyFieldNames()[0];
12113
- const record = this.parent.flatData.filter((e) => {
12507
+ const record = flatData.filter((e) => {
12114
12508
  return e[`${primaryKeyField}`] === rowDetails.record[`${primaryKeyField}`];
12115
12509
  });
12116
12510
  if (record.length) {
@@ -12118,13 +12512,14 @@ class Page {
12118
12512
  }
12119
12513
  }
12120
12514
  const ret = {
12121
- result: this.parent.flatData,
12515
+ result: flatData,
12122
12516
  row: rowDetails.row,
12123
12517
  action: rowDetails.action,
12124
12518
  record: rowDetails.record,
12125
- count: this.parent.flatData.length
12519
+ count: flatData.length
12126
12520
  };
12127
- getValue('grid.renderModule', this.parent).dataManagerSuccess(ret);
12521
+ const request = this.parent.enableDomVirtualization ? { requestType: 'refresh' } : undefined;
12522
+ getValue('grid.renderModule', this.parent).dataManagerSuccess(ret, request);
12128
12523
  if (this.parent.enableImmutableMode) {
12129
12524
  const row = 'row';
12130
12525
  const action = 'action';
@@ -12318,11 +12713,6 @@ class Toolbar {
12318
12713
  toolbarClickHandler(args) {
12319
12714
  const tObj = this.parent;
12320
12715
  const indentOutdentAction = 'indentOutdentAction';
12321
- if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
12322
- args.item.id === this.parent.grid.element.id + '_update') {
12323
- args.cancel = true;
12324
- this.parent.grid.editModule.saveCell();
12325
- }
12326
12716
  if (args.item.id === this.parent.grid.element.id + '_expandall') {
12327
12717
  this.parent.expandAll();
12328
12718
  }
@@ -12337,6 +12727,13 @@ class Toolbar {
12337
12727
  && !isNullOrUndefined(tObj.rowDragAndDropModule)) {
12338
12728
  this.parent.rowDragAndDropModule[`${indentOutdentAction}`](null, 'outdent');
12339
12729
  }
12730
+ if (args.item.id === tObj.grid.element.id + '_delete'
12731
+ && isCheckboxcolumn(this.parent)
12732
+ && this.parent.getCheckedRecords().length > 0
12733
+ && !isNullOrUndefined(this.parent.selectionModule)) {
12734
+ this.parent.selectionModule['deleteCheckedRecords']();
12735
+ args.cancel = true;
12736
+ }
12340
12737
  }
12341
12738
  /**
12342
12739
  * Gets the toolbar of the TreeGrid.
@@ -12424,6 +12821,18 @@ class Aggregate {
12424
12821
  parentRecord = parentRecords[parseInt(i.toString(), 10)];
12425
12822
  childRecordsLength = this.getChildRecordsLength(parentRecord, flatRecords);
12426
12823
  if (childRecordsLength) {
12824
+ const childRecords = getObject('childRecords', parentRecord) || [];
12825
+ const existingSummaryRows = childRecords.filter((e) => getObject('isSummaryRow', e) && getObject('parentUniqueID', e) === parentRecord.uniqueID);
12826
+ existingSummaryRows.forEach((summaryRow) => {
12827
+ const summaryIndex = flatRecords.indexOf(summaryRow);
12828
+ if (summaryIndex !== -1) {
12829
+ flatRecords.splice(summaryIndex, 1);
12830
+ }
12831
+ const childSummaryIndex = childRecords.indexOf(summaryRow);
12832
+ if (childSummaryIndex !== -1) {
12833
+ childRecords.splice(childSummaryIndex, 1);
12834
+ }
12835
+ });
12427
12836
  for (let summaryRowIndex = 1, len = summaryLength; summaryRowIndex <= len; summaryRowIndex++) {
12428
12837
  let item;
12429
12838
  item = {};
@@ -12451,7 +12860,6 @@ class Aggregate {
12451
12860
  setValue('isSummaryRow', true, item);
12452
12861
  setValue('parentUniqueID', summaryParent.uniqueID, item);
12453
12862
  if (isSort) {
12454
- const childRecords = getObject('childRecords', parentRecord);
12455
12863
  if (childRecords.length) {
12456
12864
  childRecords.push(item);
12457
12865
  }
@@ -13646,14 +14054,13 @@ class Edit {
13646
14054
  this.parent.on(cellEdit, this.cellEdit, this);
13647
14055
  this.parent.on('actionBegin', this.editActionEvents, this);
13648
14056
  this.parent.on('actionComplete', this.editActionEvents, this);
14057
+ this.parent.on('resetDoubleClickTarget', this.resetDoubleClickTarget, this);
13649
14058
  this.parent.grid.on(doubleTap, this.recordDoubleClick, this);
13650
14059
  this.parent.grid.on('dblclick', this.gridDblClick, this);
13651
14060
  this.parent.grid.on('recordAdded', this.customCellSave, this);
13652
14061
  this.parent.on('savePreviousRowPosition', this.savePreviousRowPosition, this);
13653
14062
  // this.parent.on(events.beforeDataBound, this.beforeDataBound, this);
13654
14063
  this.parent.grid.on(beforeStartEdit, this.beforeStartEdit, this);
13655
- this.parent.grid.on(beforeBatchCancel, this.beforeBatchCancel, this);
13656
- this.parent.grid.on('reset-edit-props', this.resetIsOnBatch, this);
13657
14064
  this.parent.grid.on('get-row-position', this.getRowPosition, this);
13658
14065
  this.parent.grid.on('last-row-validation', this.lastRowValidation, this);
13659
14066
  }
@@ -13669,7 +14076,6 @@ class Edit {
13669
14076
  /* eslint-disable-next-line */
13670
14077
  this.parent.grid.getDataRows()[rowIndex].dataset.uid = this.parent.grid.contentModule.getRows()[rowIndex].uid;
13671
14078
  }
13672
- this.doubleClickTarget = null;
13673
14079
  }
13674
14080
  }
13675
14081
  getRowPosition(addArgs) {
@@ -13677,17 +14083,14 @@ class Edit {
13677
14083
  addArgs.addRowIndex = this.addRowIndex;
13678
14084
  addArgs.dataRowIndex = +this.prevAriaRowIndex;
13679
14085
  }
14086
+ resetDoubleClickTarget() {
14087
+ this.doubleClickTarget = null;
14088
+ }
13680
14089
  beforeStartEdit(args) {
13681
14090
  if (this.parent.editSettings.mode === 'Cell') {
13682
14091
  this.parent.trigger(actionBegin, args);
13683
14092
  }
13684
14093
  }
13685
- beforeBatchCancel(args) {
13686
- if (this.parent.editSettings.mode === 'Cell') {
13687
- args['requestType'] = 'cancel';
13688
- this.parent.trigger(actionComplete, args);
13689
- }
13690
- }
13691
14094
  /**
13692
14095
  * @hidden
13693
14096
  * @returns {void}
@@ -13711,9 +14114,8 @@ class Edit {
13711
14114
  this.parent.grid.off(doubleTap, this.recordDoubleClick);
13712
14115
  this.parent.off('savePreviousRowPosition', this.savePreviousRowPosition);
13713
14116
  this.parent.grid.off(beforeStartEdit, this.beforeStartEdit);
13714
- this.parent.grid.off(beforeBatchCancel, this.beforeBatchCancel);
14117
+ this.parent.off('resetDoubleClickTarget', this.resetDoubleClickTarget);
13715
14118
  this.parent.grid.off('dblclick', this.gridDblClick);
13716
- this.parent.grid.off('reset-edit-props', this.resetIsOnBatch);
13717
14119
  this.parent.grid.off('get-row-position', this.getRowPosition);
13718
14120
  this.parent.grid.off('last-row-validation', this.lastRowValidation);
13719
14121
  //this.parent.grid.off('click', this.gridSingleClick);
@@ -13839,33 +14241,10 @@ class Edit {
13839
14241
  return;
13840
14242
  }
13841
14243
  const column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('aria-colindex') - 1);
13842
- if (this.parent.editSettings.mode === 'Cell' && !this.isOnBatch && column && !column.isPrimaryKey &&
14244
+ if (this.parent.editSettings.mode === 'Cell' && column && !column.isPrimaryKey &&
13843
14245
  this.parent.editSettings.allowEditing && column.allowEditing && !(target.classList.contains('e-treegridexpand') ||
13844
14246
  target.classList.contains('e-treegridcollapse')) && this.parent.editSettings.allowEditOnDblClick) {
13845
- this.isOnBatch = true;
13846
14247
  this.parent.grid.setProperties({ selectedRowIndex: args.rowIndex }, true);
13847
- if (this.parent.enableVirtualization) {
13848
- const tr = parentsUntil(args.target, 'e-row');
13849
- this.prevAriaRowIndex = tr.getAttribute('aria-rowindex');
13850
- tr.setAttribute('aria-rowindex', (tr.rowIndex + 1) + '');
13851
- }
13852
- this.updateGridEditMode('Batch');
13853
- }
13854
- else if (this.parent.editSettings.mode === 'Cell' && (!column.allowEditing || column.isPrimaryKey)) {
13855
- this.isOnBatch = true;
13856
- this.updateGridEditMode('Batch');
13857
- }
13858
- }
13859
- updateGridEditMode(mode) {
13860
- this.parent.grid.setProperties({ editSettings: { mode: mode } }, true);
13861
- const updateMethod = getObject('updateEditObj', this.parent.grid.editModule);
13862
- updateMethod.apply(this.parent.grid.editModule);
13863
- this.parent.grid.isEdit = false;
13864
- }
13865
- resetIsOnBatch() {
13866
- if (this.parent.enableVirtualization && this.parent.editSettings.mode === 'Cell' && !this.parent['isGantt']) {
13867
- this.isOnBatch = false;
13868
- this.updateGridEditMode('Normal');
13869
14248
  }
13870
14249
  }
13871
14250
  keyPressed(args) {
@@ -13876,7 +14255,9 @@ class Edit {
13876
14255
  this.recordDoubleClick(args);
13877
14256
  }
13878
14257
  if (args.action === 'escape') {
13879
- this.closeEdit();
14258
+ if (this.parent.grid.isEdit) {
14259
+ this.closeEdit();
14260
+ }
13880
14261
  }
13881
14262
  }
13882
14263
  deleteUniqueID(value) {
@@ -13889,6 +14270,13 @@ class Edit {
13889
14270
  const promise = 'promise';
13890
14271
  const prom = args[`${promise}`];
13891
14272
  delete args[`${promise}`];
14273
+ if (this.doubleClickTarget && (this.doubleClickTarget.classList.contains('e-treegridexpand') ||
14274
+ this.doubleClickTarget.classList.contains('e-treegridcollapse') || this.doubleClickTarget.classList.contains('e-summarycell') ||
14275
+ this.doubleClickTarget.closest('.e-hierarchycheckbox'))) {
14276
+ args.cancel = true;
14277
+ this.doubleClickTarget = null;
14278
+ return;
14279
+ }
13892
14280
  if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
13893
14281
  args.row.setAttribute('aria-rowindex', this.prevAriaRowIndex);
13894
14282
  this.prevAriaRowIndex = undefined;
@@ -13898,21 +14286,11 @@ class Edit {
13898
14286
  if (!celleditArgs.cancel && this.parent.editSettings.mode === 'Cell') {
13899
14287
  this.enableToolbarItems('edit');
13900
14288
  }
13901
- else if (celleditArgs.cancel && this.parent.editSettings.mode === 'Cell') {
13902
- this.isOnBatch = false;
13903
- this.updateGridEditMode('Normal');
13904
- }
13905
14289
  if (!isNullOrUndefined(prom)) {
13906
14290
  prom.resolve(celleditArgs);
13907
14291
  }
13908
14292
  });
13909
14293
  }
13910
- if (this.doubleClickTarget && (this.doubleClickTarget.classList.contains('e-treegridexpand') ||
13911
- this.doubleClickTarget.classList.contains('e-treegridcollapse') || this.doubleClickTarget.classList.contains('e-summarycell'))) {
13912
- args.cancel = true;
13913
- this.doubleClickTarget = null;
13914
- return;
13915
- }
13916
14294
  if (this.parent.editSettings.mode === 'Cell') {
13917
14295
  if (this.keyPress === 'tab' || this.keyPress === 'shiftTab') {
13918
14296
  this.keyPress = null;
@@ -13941,20 +14319,6 @@ class Edit {
13941
14319
  }
13942
14320
  }
13943
14321
  batchCancel() {
13944
- if (this.parent.editSettings.mode === 'Cell') {
13945
- const cellDetails = getValue('editModule.cellDetails', this.parent.grid.editModule);
13946
- if (!isNullOrUndefined(this.editedRowIndex)) {
13947
- cellDetails.rowIndex = this.editedRowIndex;
13948
- }
13949
- const treeCell = this.parent.getCellFromIndex(cellDetails.rowIndex, this.parent.treeColumnIndex);
13950
- this.parent.renderModule.cellRender({
13951
- data: cellDetails.rowData,
13952
- cell: treeCell,
13953
- column: this.parent.grid.getColumns()[this.parent.treeColumnIndex]
13954
- });
13955
- this.updateGridEditMode('Normal');
13956
- this.isOnBatch = false;
13957
- }
13958
14322
  if (this.parent.editSettings.mode === 'Batch') {
13959
14323
  this.parent.notify('batchCancelAction', {});
13960
14324
  }
@@ -13962,137 +14326,16 @@ class Edit {
13962
14326
  customCellSave(args) {
13963
14327
  if (isCountRequired(this.parent) && this.parent.editSettings.mode === 'Cell' && args.action === 'edit') {
13964
14328
  this.updateCell(args, args.rowIndex);
13965
- this.afterCellSave(args, args.row);
13966
14329
  }
13967
14330
  }
13968
14331
  cellSave(args) {
13969
- if (this.parent.editSettings.mode === 'Cell' && this.parent.element.querySelector('form')) {
13970
- args.cancel = true;
13971
- const editModule = 'editModule';
13972
- setValue('isEditCollapse', true, this.parent);
13973
- args.rowData[args.columnName] = args.value;
13974
- let row;
13975
- if (isNullOrUndefined(args.cell)) {
13976
- row = this.parent.grid.editModule[`${editModule}`].form.parentElement.parentNode;
13977
- }
13978
- else {
13979
- row = args.cell.parentNode;
13980
- }
13981
- let rowIndex;
13982
- const primaryKeys = this.parent.getPrimaryKeyFieldNames();
13983
- if (isNullOrUndefined(row)) {
13984
- this.parent.grid.getCurrentViewRecords().filter((e, i) => {
13985
- if (e[primaryKeys[0]] === args.rowData[primaryKeys[0]]) {
13986
- rowIndex = i;
13987
- return;
13988
- }
13989
- });
13990
- }
13991
- else {
13992
- const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
13993
- this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
13994
- if (freeze) {
13995
- if (this.parent.getRows().indexOf(row) !== -1) {
13996
- rowIndex = this.parent.getRows().indexOf(row);
13997
- }
13998
- else {
13999
- rowIndex = this.parent.getRows().indexOf(row);
14000
- }
14001
- }
14002
- else {
14003
- rowIndex = (this.parent.getRows().indexOf(row) === -1 && (this.parent.getFrozenColumns() > 0)) ?
14004
- this.parent.grid.getRows().indexOf(row) : this.parent.getRows().indexOf(row);
14005
- }
14006
- }
14007
- const arg = {};
14008
- extend$1(arg, args);
14009
- arg.cancel = false;
14010
- arg.type = 'save';
14011
- row = this.parent.grid.getRows()[row.rowIndex];
14012
- this.parent.trigger(actionBegin, arg);
14013
- if (!arg.cancel) {
14014
- if ((row.rowIndex === this.parent.getCurrentViewRecords().length - 1) && this.keyPress === 'tab') {
14015
- this.isTabLastRow = true;
14016
- }
14017
- if (!isRemoteData(this.parent) &&
14018
- !(this.parent.dataSource instanceof DataManager && this.parent.dataSource.adaptor instanceof RemoteSaveAdaptor)) {
14019
- if (isCountRequired(this.parent)) {
14020
- const eventPromise = 'eventPromise';
14021
- const editArgs = { requestType: 'save', data: args.rowData, action: 'edit', row: row,
14022
- rowIndex: rowIndex, rowData: args.rowData, columnName: args.columnName,
14023
- filterChoiceCount: null, excelSearchOperator: null };
14024
- this.parent.grid.getDataModule()[`${eventPromise}`](editArgs, this.parent.grid.query);
14025
- }
14026
- else {
14027
- this.updateCell(args, rowIndex);
14028
- setValue('isEdit', false, this.parent.grid);
14029
- this.afterCellSave(args, row);
14030
- }
14031
- }
14032
- else if (isRemoteData(this.parent) ||
14033
- (this.parent.dataSource instanceof DataManager && this.parent.dataSource.adaptor instanceof RemoteSaveAdaptor)) {
14034
- const query = this.parent.grid.query;
14035
- if (this.parent['isGantt'] && this.parent.loadChildOnDemand) {
14036
- this.updateCell(args, rowIndex);
14037
- setValue('isEdit', false, this.parent.grid);
14038
- this.afterCellSave(args, row);
14039
- }
14040
- else {
14041
- let crud = null;
14042
- crud = this.parent.grid.dataSource.update(primaryKeys[0], args.rowData, query.fromTable, query, args.previousValue);
14043
- crud.then((e) => {
14044
- if (!isNullOrUndefined(e)) {
14045
- args.rowData[args.columnName] = e[args.columnName];
14046
- }
14047
- this.updateCell(args, rowIndex);
14048
- setValue('isEdit', false, this.parent.grid);
14049
- this.afterCellSave(args, row);
14050
- });
14051
- }
14052
- }
14053
- }
14054
- else {
14055
- this.parent.grid.isEdit = true;
14056
- }
14057
- }
14058
14332
  if (this.parent.enableVirtualization) {
14059
14333
  this.parent.grid.contentModule['virtualData'] = {};
14060
14334
  }
14061
14335
  }
14062
- afterCellSave(args, row) {
14063
- if (this.parent.grid.aggregateModule) {
14064
- this.parent.grid.aggregateModule.refresh(args.rowData);
14065
- }
14066
- this.parent.grid.editModule.destroyWidgets([this.parent.grid.getColumnByField(args.columnName)]);
14067
- this.parent.grid.editModule.formObj.destroy();
14068
- if (this.keyPress !== 'tab' && this.keyPress !== 'shiftTab') {
14069
- this.updateGridEditMode('Normal');
14070
- this.isOnBatch = false;
14071
- }
14072
- this.enableToolbarItems('save');
14073
- removeClass([row], ['e-editedrow', 'e-batchrow']);
14074
- removeClass(row.querySelectorAll('.e-rowcell'), ['e-editedbatchcell', 'e-updatedtd']);
14075
- if (this.parent['isCellSaveFocus'] !== false) {
14076
- this.parent.grid.focusModule.restoreFocus();
14077
- }
14078
- editAction({ value: args.rowData, action: 'edit' }, this.parent, this.isSelfReference, this.addRowIndex, this.selectedIndex, args.columnName);
14079
- if ((row.rowIndex === this.parent.getCurrentViewRecords().length - 1) && this.keyPress === 'enter') {
14080
- this.keyPress = null;
14081
- }
14082
- const saveArgs = {
14083
- type: 'save', column: this.parent.getColumnByField(args.columnName), data: args.rowData,
14084
- previousData: args.previousValue, row: row, target: args.cell
14085
- };
14086
- if (this.parent.aggregates.some((ag) => ag.showChildSummary === true)) {
14087
- this.parent.grid.refresh();
14088
- }
14089
- this.parent.trigger(actionComplete, saveArgs);
14090
- }
14091
14336
  lastCellTab() {
14092
- if (!this.parent.grid.isEdit && this.isOnBatch && this.keyPress === 'tab' && this.parent.editSettings.mode === 'Cell') {
14337
+ if (!this.parent.grid.isEdit && this.keyPress === 'tab' && this.parent.editSettings.mode === 'Cell') {
14093
14338
  if (!this.parent.editSettings.allowNextRowEdit) {
14094
- this.updateGridEditMode('Normal');
14095
- this.isOnBatch = false;
14096
14339
  this.keyPress = null;
14097
14340
  }
14098
14341
  else {
@@ -14350,12 +14593,13 @@ class Edit {
14350
14593
  args.cancel = true;
14351
14594
  return;
14352
14595
  }
14353
- if (this.parent.editSettings.mode === 'Cell' && args.requestType === 'beginEdit') {
14596
+ if (this.parent.editSettings.mode === 'Cell' && args.requestType === 'beginEdit' && args.row.classList.contains('e-summaryrow')) {
14354
14597
  args.cancel = true;
14355
14598
  return;
14356
14599
  }
14357
14600
  if (this.doubleClickTarget && args.requestType !== 'delete' && (this.doubleClickTarget.classList.contains('e-treegridexpand') ||
14358
- this.doubleClickTarget.classList.contains('e-treegridcollapse') || this.doubleClickTarget.classList.contains('e-frame'))) {
14601
+ this.doubleClickTarget.classList.contains('e-treegridcollapse') || this.doubleClickTarget.classList.contains('e-frame') ||
14602
+ this.doubleClickTarget.closest('.e-hierarchycheckbox'))) {
14359
14603
  args.cancel = true;
14360
14604
  this.doubleClickTarget = null;
14361
14605
  return;
@@ -14661,6 +14905,7 @@ class Edit {
14661
14905
  else {
14662
14906
  this.selectedIndex = this.parent.selectedRowIndex;
14663
14907
  this.addRowIndex = this.parent.selectedRowIndex;
14908
+ index = this.parent.selectedRowIndex;
14664
14909
  }
14665
14910
  if (position) {
14666
14911
  this.parent.setProperties({ editSettings: { newRowPosition: position } }, true);
@@ -14706,10 +14951,6 @@ class Edit {
14706
14951
  */
14707
14952
  editCell(rowIndex, field) {
14708
14953
  if (this.parent.editSettings.mode === 'Cell' || this.parent.editSettings.mode === 'Batch') {
14709
- if (this.parent.editSettings.mode !== 'Batch') {
14710
- this.isOnBatch = true;
14711
- this.updateGridEditMode('Batch');
14712
- }
14713
14954
  this.parent.grid.editModule.editCell(rowIndex, field);
14714
14955
  }
14715
14956
  }
@@ -15391,7 +15632,6 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15391
15632
  resetIseditValue() {
15392
15633
  const resetIsEdit = 'resetIsedit';
15393
15634
  const isAdd = 'isAdd';
15394
- this.parent.notify('reset-edit-props', {});
15395
15635
  if ((this.rowPosition === 'Top' || this.rowPosition === 'Bottom') && this[`${isAdd}`]) {
15396
15636
  super[`${resetIsEdit}`]();
15397
15637
  }
@@ -15713,7 +15953,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15713
15953
  }
15714
15954
  }
15715
15955
  }
15716
- if (((downScroll && scrollArgs.direction !== 'up' && (scrollArgs.offset.top < (rowHeight * this.totalRecords)))
15956
+ if (((downScroll && scrollArgs.direction !== 'up' && (scrollArgs.offset.top <= (rowHeight * this.totalRecords)))
15717
15957
  || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left') ||
15718
15958
  ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
15719
15959
  && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== ''))) {
@@ -16911,5 +17151,229 @@ class InfiniteScroll {
16911
17151
  }
16912
17152
  }
16913
17153
 
16914
- export { Aggregate, AggregateColumn, AggregateRow, Column, ColumnChooser, ColumnMenu, CommandColumn, ContextMenu, ContextMenuItems, DataManipulation, DetailRow, Edit, EditSettings, ExcelExport, Filter, FilterSettings, Freeze, InfiniteScroll, InfiniteScrollSettings, LoadingIndicator, Logger, Page, PageSettings, PdfExport, Predicate, Render, Reorder, Resize, RowDD, RowDropSettings, SearchSettings, Selection, SelectionSettings, Sort, SortDescriptor, SortSettings, StackedColumn, Toolbar, ToolbarItem, TreeClipboard, TreeGrid, TreeGridColumn, TreeVirtual, TreeVirtualRowModelGenerator, VirtualScroll, actionBegin, actionComplete, actionFailure, ariaColIndex, ariaRowIndex, autoCol, batchAdd, batchCancel, batchDelete, batchEditFormRendered, batchSave, beforeBatchAdd, beforeBatchCancel, beforeBatchDelete, beforeBatchSave, beforeCopy, beforeDataBound, beforeExcelExport, beforePaste, beforePdfExport, beforeStartEdit, beginAdd, beginEdit, cellEdit, cellSave, cellSaved, checkboxChange, collapseActionComplete, collapsed, collapsing, content, contextMenuClick, contextMenuOpen, crudAction, dataBound, dataListener, dataStateChange, destroy, detailDataBound, doubleTap, expanded, expanding, extendArray, findChildrenRecords, findParentRecords, frozenContent, frozenHeader, frozenLeft, frozenRight, getExpandStatus, getParentData, getPlainData, headerContent, indexModifier, isCheckboxcolumn, isCountRequired, isFilterChildHierarchy, isHidden, isOffline, isRemoteData, keyPressed, leftRight, load, localPagedExpandCollapse, movableContent, movableHeader, pagingActions, printGridInit, queryCellInfo, recordDoubleClick, remoteExpand, resizeStop, rowDataBound, rowDeselected, rowDeselecting, rowDrag, rowDragStart, rowDragStartHelper, rowDrop, rowDropped, rowSelected, rowSelecting, rowdraging, rowsAdd, rowsRemove, savePreviousRowPosition, table, toolbarClick, treeGridDetails, updateData, virtualActionArgs, virtualColumnIndex };
17154
+ /**
17155
+ * TreeGrid DOM Virtualization module handles high-performance rendering of large hierarchical datasets.
17156
+ *
17157
+ * @hidden
17158
+ */
17159
+ class DomVirtualization {
17160
+ /**
17161
+ * Constructor for DomVirtualization module
17162
+ *
17163
+ * @param {TreeGrid} parent - TreeGrid instance
17164
+ * @param {ServiceLocator} locator - Service locator for dependency injection
17165
+ */
17166
+ constructor(parent, locator) {
17167
+ /** @hidden */
17168
+ this.startIndex = -1;
17169
+ /** @hidden */
17170
+ this.endIndex = -1;
17171
+ initializeTelemetryFeature('DomVirtualization', 'TreeGrid');
17172
+ this.parent = parent;
17173
+ this.locator = locator;
17174
+ Grid.Inject(DomVirtualTreeExtension);
17175
+ this.addEventListener();
17176
+ }
17177
+ getModuleName() {
17178
+ return 'domVirtualization';
17179
+ }
17180
+ /**
17181
+ * @hidden
17182
+ * @returns {void}
17183
+ */
17184
+ addEventListener() {
17185
+ if (this.parent.isDestroyed) {
17186
+ return;
17187
+ }
17188
+ this.parent.on(destroy$1, this.destroy, this);
17189
+ this.parent.on(virtualExpandCollapse, this.collapseExpandVirtualchilds, this);
17190
+ this.parent.on(pagingActions, this.virtualPageAction, this);
17191
+ this.parent.grid.on(beforeDomVirtualRenderRows, this.updateCurrentDomVirtualRecords, this);
17192
+ }
17193
+ /**
17194
+ * @hidden
17195
+ * @returns {void}
17196
+ */
17197
+ removeEventListener() {
17198
+ if (this.parent.isDestroyed) {
17199
+ return;
17200
+ }
17201
+ this.parent.off(destroy$1, this.destroy);
17202
+ this.parent.off(virtualExpandCollapse, this.collapseExpandVirtualchilds);
17203
+ this.parent.off(pagingActions, this.virtualPageAction);
17204
+ this.parent.grid.off(beforeDomVirtualRenderRows, this.updateCurrentDomVirtualRecords);
17205
+ }
17206
+ /**
17207
+ * Handles the action related to virtual scrolling with paging details.
17208
+ *
17209
+ * @param {Object} pageingDetails - Contains the result data, count of results, and action arguments.
17210
+ * @param {ITreeData[]} pageingDetails.result - The result data to be handled.
17211
+ * @param {number} pageingDetails.count - The count of results.
17212
+ * @param {ActionEventArgs} pageingDetails.actionArgs - The action arguments related to the virtual page action.
17213
+ * @returns {void}
17214
+ */
17215
+ virtualPageAction(pageingDetails) {
17216
+ const actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
17217
+ const action = getValue('action', pageingDetails.actionArgs);
17218
+ const isFiltering = (pageingDetails.actionArgs.requestType === 'filtering' && (pageingDetails.actionArgs.action !== 'clear-filter' && pageingDetails.actionArgs.action !== 'clearFilter')) ||
17219
+ (!isNullOrUndefined(this.parent['filterModule']) && (this.parent['filterModule'].filteredResult && this.parent['filterModule'].filteredResult.length > 0));
17220
+ const isFlatHierarchy = this.parent.filterSettings.hierarchyMode === 'Child' ||
17221
+ this.parent.filterSettings.hierarchyMode === 'None';
17222
+ let parents = pageingDetails.result;
17223
+ parents = isFiltering && isFlatHierarchy ? parents.filter((e) => {
17224
+ if (isNullOrUndefined(e.parentItem)) {
17225
+ return true;
17226
+ }
17227
+ const hasParentInFilteredList = parents.some((p) => p.uniqueID === e.parentItem.uniqueID);
17228
+ return hasParentInFilteredList ? getExpandStatus(this.parent, e) : true;
17229
+ }) : parents.filter((e) => getExpandStatus(this.parent, e));
17230
+ this.parent.virtualDomScrollData = parents;
17231
+ const dm = new DataManager(parents);
17232
+ this.visualData = parents;
17233
+ let query = new Query();
17234
+ if (this.parent.allowPaging || this.parent.enableVirtualization) {
17235
+ let take = isNullOrUndefined(actionArgs.requestType) || actionArgs.requestType === 'dom-virtualscroll' ?
17236
+ pageingDetails.actionArgs.result.length : pageingDetails.result.length;
17237
+ if (action === 'collapse') {
17238
+ take = this.parent.grid.currentViewData.length;
17239
+ }
17240
+ let skip = this.parent.grid.pageSettings.currentPage <= 1 ? 0 :
17241
+ (this.parent.grid.pageSettings.currentPage - 1) * this.parent.grid.pageSettings.pageSize;
17242
+ if (actionArgs.requestType === 'dom-virtualscroll') {
17243
+ const pagingQueries = (pageingDetails.actionArgs && pageingDetails.actionArgs.query
17244
+ && pageingDetails.actionArgs.query.queries) || [];
17245
+ const takeQuery = pagingQueries.filter((q) => q.fn === 'onTake');
17246
+ const explicitTake = takeQuery.length > 0
17247
+ ? takeQuery[parseInt((takeQuery.length - 1).toString(), 10)] : undefined;
17248
+ if (!isNullOrUndefined(explicitTake) && typeof explicitTake.e.nos === 'number') {
17249
+ take = explicitTake.e.nos;
17250
+ }
17251
+ }
17252
+ else if ((actionArgs.requestType === 'filtering' || actionArgs.requestType === 'searching') && skip > 0) {
17253
+ skip = 0;
17254
+ this.parent.grid.setProperties({ pageSettings: { currentPage: 1 } }, true);
17255
+ }
17256
+ query = query.skip(skip).take(take);
17257
+ }
17258
+ dm.dataSource.json = this.visualData;
17259
+ pageingDetails.result = dm.executeLocal(query);
17260
+ pageingDetails.count = this.visualData.length;
17261
+ this.parent.notify('updateAction', pageingDetails);
17262
+ }
17263
+ calculateChildCount(startIndex, level, records) {
17264
+ let count = 0;
17265
+ for (let i = startIndex; i < records.length; i++) {
17266
+ if (records[i + 1] && (level === records[i + 1].level || level === records[i + 1].level + 1)) {
17267
+ break;
17268
+ }
17269
+ count++;
17270
+ }
17271
+ return count;
17272
+ }
17273
+ /**
17274
+ * Handles the virtual child collapse or expand action in a tree grid.
17275
+ *
17276
+ * @param {object} row - Object containing information about the collapse/expand action.
17277
+ * @param {string} row.action - The type of action, either "collapse" or "expand".
17278
+ * @param {HTMLTableRowElement} row.row - The HTML row element that is affected by the action.
17279
+ * @param {ITreeData} row.record - The tree data record associated with the row.
17280
+ * @param {RowCollapsedEventArgs} row.args - Additional event arguments related to the row collapse or expand.
17281
+ *
17282
+ * @returns {void} No return value as the function executes a procedure.
17283
+ */
17284
+ collapseExpandVirtualchilds(row) {
17285
+ const contentModule = this.parent.grid.contentModule;
17286
+ const isRemote = isRemoteData(this.parent) && !isOffline(this.parent);
17287
+ const flatData = isRemote ? this.parent.getCurrentViewRecords() : this.parent.enableVirtualization ?
17288
+ this.parent.virtualDomScrollData.slice() : this.parent.grid.currentViewData.slice();
17289
+ const totalflatData = this.parent.infiniteScrollData;
17290
+ const uniqueIDCollpaseCollection = this.parent.uniqueIDCollpaseCollection;
17291
+ const startIndex = contentModule.currentStartIndex;
17292
+ if (getValue('isCollapseAll', this.parent) || getValue('isExpandAll', this.parent)) {
17293
+ if (row.action === 'collapse') {
17294
+ flatData.filter((e) => {
17295
+ if (e.hasChildRecords) {
17296
+ e.expanded = row.action === 'collapse' ? false : true;
17297
+ }
17298
+ });
17299
+ flatData.splice(0, flatData.length, ...this.parent.parentData);
17300
+ // this.parent.pageSettings.totalRecordsCount = this.parent.parentData.length;
17301
+ }
17302
+ else {
17303
+ totalflatData.filter((e) => {
17304
+ if (e.hasChildRecords) {
17305
+ e.expanded = row.action === 'collapse' ? false : true;
17306
+ }
17307
+ });
17308
+ flatData.splice(0, flatData.length, ...totalflatData);
17309
+ // this.parent.pageSettings.totalRecordsCount = totalflatData.length;
17310
+ }
17311
+ }
17312
+ else {
17313
+ row.record.expanded = row.action === 'collapse' ? false : true;
17314
+ for (let i = startIndex; i < flatData.length; i++) {
17315
+ if (row.record.uniqueID === flatData[parseInt(i.toString(), 10)].uniqueID &&
17316
+ row.record.childRecords.length > 0) {
17317
+ if (row.action === 'collapse') {
17318
+ const level = flatData[parseInt(i.toString(), 10)].level;
17319
+ const count = this.calculateChildCount(i, level, flatData);
17320
+ // this.parent.pageSettings.totalRecordsCount -= count;
17321
+ uniqueIDCollpaseCollection[row.record.uniqueID] = flatData.splice(i + 1, count);
17322
+ }
17323
+ else {
17324
+ if (uniqueIDCollpaseCollection[row.record.uniqueID] && uniqueIDCollpaseCollection[row.record.uniqueID].length) {
17325
+ flatData.splice(i + 1, 0, ...uniqueIDCollpaseCollection[row.record.uniqueID]);
17326
+ // this.parent.pageSettings.totalRecordsCount += uniqueIDCollpaseCollection[row.record.uniqueID].length;
17327
+ }
17328
+ else {
17329
+ uniqueIDCollpaseCollection[row.record.uniqueID] = row.record.childRecords;
17330
+ flatData.splice(i + 1, 0, ...uniqueIDCollpaseCollection[row.record.uniqueID]);
17331
+ // this.parent.pageSettings.totalRecordsCount += uniqueIDCollpaseCollection[row.record.uniqueID].length;
17332
+ }
17333
+ }
17334
+ break;
17335
+ }
17336
+ }
17337
+ }
17338
+ const actionDetails = {
17339
+ result: flatData,
17340
+ row: row.row,
17341
+ action: row.action,
17342
+ record: row.record,
17343
+ count: flatData.length
17344
+ };
17345
+ getValue('grid.renderModule', this.parent).dataManagerSuccess(actionDetails, { requestType: 'refresh' });
17346
+ }
17347
+ updateCurrentDomVirtualRecords(args) {
17348
+ this.startIndex = args.startIndex;
17349
+ this.endIndex = args.endIndex;
17350
+ this.parent.currentDomVirtualRecords = this.parent.virtualDomScrollData.slice(this.startIndex, this.endIndex);
17351
+ }
17352
+ destroy() {
17353
+ this.removeEventListener();
17354
+ }
17355
+ }
17356
+ class DomVirtualTreeExtension extends DomVirtualization$1 {
17357
+ /**
17358
+ * Constructor for DomVirtualTreeExtension
17359
+ *
17360
+ * @param {IGrid} parent - Grid instance (actually TreeGrid)
17361
+ * @param {ServiceLocator} locator - Service locator for dependency injection
17362
+ */
17363
+ constructor(parent, locator) {
17364
+ super(parent, locator);
17365
+ getValue('parent', this).off(initialLoad, getValue('instantiateRenderer', this), this);
17366
+ getValue('parent', this).on(initialLoad, this.instantiateRenderers, this);
17367
+ }
17368
+ getModuleName() {
17369
+ return 'treeDomVirtualization';
17370
+ }
17371
+ instantiateRenderers() {
17372
+ const rendererFactory = getValue('locator', this).getService('rendererFactory');
17373
+ getValue('addRenderer', rendererFactory)
17374
+ .apply(rendererFactory, [RenderType.Content, new DomVirtualTreeContentRenderer(getValue('parent', this), getValue('locator', this))]);
17375
+ }
17376
+ }
17377
+
17378
+ export { Aggregate, AggregateColumn, AggregateRow, Column, ColumnChooser, ColumnMenu, CommandColumn, ContextMenu, ContextMenuItems, DataManipulation, DetailRow, DomVirtualTreeContentRenderer, DomVirtualTreeExtension, DomVirtualization, DomVirtualizationSettings, Edit, EditSettings, ExcelExport, Filter, FilterSettings, Freeze, InfiniteScroll, InfiniteScrollSettings, LoadingIndicator, Logger, Page, PageSettings, PdfExport, Predicate, Render, Reorder, Resize, RowDD, RowDropSettings, SearchSettings, Selection, SelectionSettings, Sort, SortDescriptor, SortSettings, StackedColumn, Toolbar, ToolbarItem, TreeClipboard, TreeGrid, TreeGridColumn, TreeVirtual, TreeVirtualRowModelGenerator, VirtualScroll, actionBegin, actionComplete, actionFailure, ariaColIndex, ariaRowIndex, autoCol, batchAdd, batchCancel, batchDelete, batchEditFormRendered, batchSave, beforeBatchAdd, beforeBatchCancel, beforeBatchDelete, beforeBatchSave, beforeCopy, beforeDataBound, beforeDomVirtualRenderRows, beforeExcelExport, beforePaste, beforePdfExport, beforeStartEdit, beginAdd, beginEdit, cellEdit, cellSave, cellSaved, checkboxChange, collapseActionComplete, collapsed, collapsing, content, contextMenuClick, contextMenuOpen, crudAction, dataBound, dataListener, dataStateChange, destroy, detailDataBound, doubleTap, expanded, expanding, extendArray, findChildrenRecords, findParentRecords, frozenContent, frozenHeader, frozenLeft, frozenRight, getExpandStatus, getParentData, getPlainData, headerContent, hierarchyCheckstateUpdate, indexModifier, isCheckboxcolumn, isCountRequired, isFilterChildHierarchy, isHidden, isOffline, isRemoteData, keyPressed, leftRight, load, localPagedExpandCollapse, movableContent, movableHeader, pagingActions, printGridInit, queryCellInfo, recordDoubleClick, remoteExpand, resizeStop, rowDataBound, rowDeselected, rowDeselecting, rowDrag, rowDragStart, rowDragStartHelper, rowDrop, rowDropped, rowSelected, rowSelecting, rowdraging, rowsAdd, rowsRemove, savePreviousRowPosition, table, toolbarClick, treeGridDetails, updateData, virtualActionArgs, virtualColumnIndex, virtualExpandCollapse };
16915
17379
  //# sourceMappingURL=ej2-treegrid.es2015.js.map