@syncfusion/ej2-treegrid 34.2.6 → 35.1.37

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