@syncfusion/ej2-treegrid 34.2.8 → 35.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +16 -2
  2. package/dist/ej2-treegrid.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js +2 -2
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +1054 -590
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +1159 -618
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +2 -2
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +5 -5
  13. package/src/global.js +1 -1
  14. package/src/treegrid/actions/crud-actions.js +4 -9
  15. package/src/treegrid/actions/dom-virtualization.d.ts +71 -0
  16. package/src/treegrid/actions/dom-virtualization.js +251 -0
  17. package/src/treegrid/actions/edit.d.ts +1 -4
  18. package/src/treegrid/actions/edit.js +23 -191
  19. package/src/treegrid/actions/filter.js +1 -1
  20. package/src/treegrid/actions/index.d.ts +1 -0
  21. package/src/treegrid/actions/index.js +1 -0
  22. package/src/treegrid/actions/page.js +12 -6
  23. package/src/treegrid/actions/rowdragdrop.js +20 -1
  24. package/src/treegrid/actions/selection.d.ts +21 -0
  25. package/src/treegrid/actions/selection.js +198 -32
  26. package/src/treegrid/actions/summary.js +25 -9
  27. package/src/treegrid/actions/toolbar.js +8 -5
  28. package/src/treegrid/base/constant.d.ts +6 -0
  29. package/src/treegrid/base/constant.js +6 -0
  30. package/src/treegrid/base/data.d.ts +17 -0
  31. package/src/treegrid/base/data.js +189 -132
  32. package/src/treegrid/base/treegrid-model.d.ts +35 -4
  33. package/src/treegrid/base/treegrid.d.ts +45 -7
  34. package/src/treegrid/base/treegrid.js +181 -73
  35. package/src/treegrid/enum.d.ts +12 -0
  36. package/src/treegrid/models/column.d.ts +2 -2
  37. package/src/treegrid/models/dom-virtualization-settings-model.d.ts +50 -0
  38. package/src/treegrid/models/dom-virtualization-settings.d.ts +43 -0
  39. package/src/treegrid/models/dom-virtualization-settings.js +47 -0
  40. package/src/treegrid/models/index.d.ts +2 -0
  41. package/src/treegrid/models/index.js +1 -0
  42. package/src/treegrid/models/summary-model.d.ts +1 -1
  43. package/src/treegrid/models/summary.d.ts +1 -1
  44. package/src/treegrid/renderer/dom-virtual-tree-content-renderer.d.ts +20 -0
  45. package/src/treegrid/renderer/dom-virtual-tree-content-renderer.js +49 -0
  46. package/src/treegrid/renderer/index.d.ts +1 -0
  47. package/src/treegrid/renderer/index.js +1 -0
  48. package/src/treegrid/renderer/render.js +4 -3
  49. package/src/treegrid/renderer/virtual-tree-content-render.js +1 -2
  50. package/helpers/e2e/index.d.ts +0 -1
  51. package/helpers/e2e/index.js +0 -8
  52. package/helpers/e2e/treegridhelper.d.ts +0 -21
  53. package/helpers/e2e/treegridhelper.js +0 -83
  54. package/styles/bds-lite.css +0 -402
  55. package/styles/bds-lite.scss +0 -3
  56. package/styles/bds.css +0 -422
  57. package/styles/bds.scss +0 -4
  58. package/styles/bootstrap-dark-lite.css +0 -406
  59. package/styles/bootstrap-dark-lite.scss +0 -3
  60. package/styles/bootstrap-dark.css +0 -426
  61. package/styles/bootstrap-dark.scss +0 -4
  62. package/styles/bootstrap-lite.css +0 -409
  63. package/styles/bootstrap-lite.scss +0 -3
  64. package/styles/bootstrap.css +0 -432
  65. package/styles/bootstrap.scss +0 -4
  66. package/styles/bootstrap4-lite.css +0 -406
  67. package/styles/bootstrap4-lite.scss +0 -3
  68. package/styles/bootstrap4.css +0 -426
  69. package/styles/bootstrap4.scss +0 -4
  70. package/styles/bootstrap5-dark-lite.css +0 -406
  71. package/styles/bootstrap5-dark-lite.scss +0 -3
  72. package/styles/bootstrap5-dark.css +0 -426
  73. package/styles/bootstrap5-dark.scss +0 -4
  74. package/styles/bootstrap5-lite.css +0 -406
  75. package/styles/bootstrap5-lite.scss +0 -3
  76. package/styles/bootstrap5.3-lite.css +0 -490
  77. package/styles/bootstrap5.3-lite.scss +0 -3
  78. package/styles/bootstrap5.3.css +0 -510
  79. package/styles/bootstrap5.3.scss +0 -4
  80. package/styles/bootstrap5.css +0 -426
  81. package/styles/bootstrap5.scss +0 -4
  82. package/styles/fabric-dark-lite.css +0 -409
  83. package/styles/fabric-dark-lite.scss +0 -3
  84. package/styles/fabric-dark.css +0 -432
  85. package/styles/fabric-dark.scss +0 -4
  86. package/styles/fabric-lite.css +0 -409
  87. package/styles/fabric-lite.scss +0 -3
  88. package/styles/fabric.css +0 -432
  89. package/styles/fabric.scss +0 -4
  90. package/styles/fluent-dark-lite.css +0 -417
  91. package/styles/fluent-dark-lite.scss +0 -3
  92. package/styles/fluent-dark.css +0 -444
  93. package/styles/fluent-dark.scss +0 -4
  94. package/styles/fluent-lite.css +0 -417
  95. package/styles/fluent-lite.scss +0 -3
  96. package/styles/fluent.css +0 -444
  97. package/styles/fluent.scss +0 -4
  98. package/styles/fluent2-lite.css +0 -507
  99. package/styles/fluent2-lite.scss +0 -3
  100. package/styles/fluent2.css +0 -531
  101. package/styles/fluent2.scss +0 -4
  102. package/styles/highcontrast-light-lite.css +0 -406
  103. package/styles/highcontrast-light-lite.scss +0 -3
  104. package/styles/highcontrast-light.css +0 -426
  105. package/styles/highcontrast-light.scss +0 -4
  106. package/styles/highcontrast-lite.css +0 -413
  107. package/styles/highcontrast-lite.scss +0 -3
  108. package/styles/highcontrast.css +0 -439
  109. package/styles/highcontrast.scss +0 -4
  110. package/styles/material-dark-lite.css +0 -406
  111. package/styles/material-dark-lite.scss +0 -3
  112. package/styles/material-dark.css +0 -426
  113. package/styles/material-dark.scss +0 -4
  114. package/styles/material-lite.css +0 -406
  115. package/styles/material-lite.scss +0 -3
  116. package/styles/material.css +0 -426
  117. package/styles/material.scss +0 -4
  118. package/styles/material3-dark-lite.css +0 -488
  119. package/styles/material3-dark-lite.scss +0 -3
  120. package/styles/material3-dark.css +0 -508
  121. package/styles/material3-dark.scss +0 -4
  122. package/styles/material3-lite.css +0 -490
  123. package/styles/material3-lite.scss +0 -3
  124. package/styles/material3.css +0 -510
  125. package/styles/material3.scss +0 -4
  126. package/styles/tailwind-dark-lite.css +0 -406
  127. package/styles/tailwind-dark-lite.scss +0 -3
  128. package/styles/tailwind-dark.css +0 -426
  129. package/styles/tailwind-dark.scss +0 -4
  130. package/styles/tailwind-lite.css +0 -406
  131. package/styles/tailwind-lite.scss +0 -3
  132. package/styles/tailwind.css +0 -426
  133. package/styles/tailwind.scss +0 -4
  134. package/styles/tailwind3-lite.css +0 -480
  135. package/styles/tailwind3-lite.scss +0 -3
  136. package/styles/tailwind3.css +0 -500
  137. package/styles/tailwind3.scss +0 -4
  138. package/styles/treegrid/_all.scss +0 -2
  139. package/styles/treegrid/_bds-definition.scss +0 -28
  140. package/styles/treegrid/_bigger.scss +0 -70
  141. package/styles/treegrid/_bootstrap-dark-definition.scss +0 -33
  142. package/styles/treegrid/_bootstrap-definition.scss +0 -33
  143. package/styles/treegrid/_bootstrap4-definition.scss +0 -33
  144. package/styles/treegrid/_bootstrap5-dark-definition.scss +0 -28
  145. package/styles/treegrid/_bootstrap5-definition.scss +0 -28
  146. package/styles/treegrid/_bootstrap5.3-definition.scss +0 -28
  147. package/styles/treegrid/_fabric-dark-definition.scss +0 -33
  148. package/styles/treegrid/_fabric-definition.scss +0 -33
  149. package/styles/treegrid/_fluent-dark-definition.scss +0 -29
  150. package/styles/treegrid/_fluent-definition.scss +0 -29
  151. package/styles/treegrid/_fluent2-definition.scss +0 -28
  152. package/styles/treegrid/_fusionnew-definition.scss +0 -26
  153. package/styles/treegrid/_highcontrast-definition.scss +0 -33
  154. package/styles/treegrid/_highcontrast-light-definition.scss +0 -33
  155. package/styles/treegrid/_icons.scss +0 -47
  156. package/styles/treegrid/_layout.scss +0 -531
  157. package/styles/treegrid/_material-dark-definition.scss +0 -33
  158. package/styles/treegrid/_material-definition.scss +0 -33
  159. package/styles/treegrid/_material3-dark-definition.scss +0 -28
  160. package/styles/treegrid/_material3-definition.scss +0 -28
  161. package/styles/treegrid/_tailwind-dark-definition.scss +0 -28
  162. package/styles/treegrid/_tailwind-definition.scss +0 -28
  163. package/styles/treegrid/_tailwind3-definition.scss +0 -28
  164. package/styles/treegrid/_theme.scss +0 -1
  165. package/styles/treegrid/_variables.scss +0 -2
  166. package/styles/treegrid/bds.css +0 -422
  167. package/styles/treegrid/bds.scss +0 -4
  168. package/styles/treegrid/bootstrap-dark.css +0 -426
  169. package/styles/treegrid/bootstrap-dark.scss +0 -4
  170. package/styles/treegrid/bootstrap.css +0 -432
  171. package/styles/treegrid/bootstrap.scss +0 -4
  172. package/styles/treegrid/bootstrap4.css +0 -426
  173. package/styles/treegrid/bootstrap4.scss +0 -4
  174. package/styles/treegrid/bootstrap5-dark.css +0 -426
  175. package/styles/treegrid/bootstrap5-dark.scss +0 -4
  176. package/styles/treegrid/bootstrap5.3.css +0 -510
  177. package/styles/treegrid/bootstrap5.3.scss +0 -4
  178. package/styles/treegrid/bootstrap5.css +0 -426
  179. package/styles/treegrid/bootstrap5.scss +0 -4
  180. package/styles/treegrid/fabric-dark.css +0 -432
  181. package/styles/treegrid/fabric-dark.scss +0 -4
  182. package/styles/treegrid/fabric.css +0 -432
  183. package/styles/treegrid/fabric.scss +0 -4
  184. package/styles/treegrid/fluent-dark.css +0 -444
  185. package/styles/treegrid/fluent-dark.scss +0 -4
  186. package/styles/treegrid/fluent.css +0 -444
  187. package/styles/treegrid/fluent.scss +0 -4
  188. package/styles/treegrid/fluent2.css +0 -531
  189. package/styles/treegrid/fluent2.scss +0 -4
  190. package/styles/treegrid/highcontrast-light.css +0 -426
  191. package/styles/treegrid/highcontrast-light.scss +0 -4
  192. package/styles/treegrid/highcontrast.css +0 -439
  193. package/styles/treegrid/highcontrast.scss +0 -4
  194. package/styles/treegrid/icons/_bds.scss +0 -38
  195. package/styles/treegrid/icons/_bootstrap-dark.scss +0 -48
  196. package/styles/treegrid/icons/_bootstrap.scss +0 -48
  197. package/styles/treegrid/icons/_bootstrap4.scss +0 -48
  198. package/styles/treegrid/icons/_bootstrap5-dark.scss +0 -1
  199. package/styles/treegrid/icons/_bootstrap5.3.scss +0 -48
  200. package/styles/treegrid/icons/_bootstrap5.scss +0 -48
  201. package/styles/treegrid/icons/_fabric-dark.scss +0 -48
  202. package/styles/treegrid/icons/_fabric.scss +0 -48
  203. package/styles/treegrid/icons/_fluent-dark.scss +0 -1
  204. package/styles/treegrid/icons/_fluent.scss +0 -48
  205. package/styles/treegrid/icons/_fluent2.scss +0 -48
  206. package/styles/treegrid/icons/_fusionnew.scss +0 -31
  207. package/styles/treegrid/icons/_highcontrast-light.scss +0 -48
  208. package/styles/treegrid/icons/_highcontrast.scss +0 -48
  209. package/styles/treegrid/icons/_material-dark.scss +0 -48
  210. package/styles/treegrid/icons/_material.scss +0 -48
  211. package/styles/treegrid/icons/_material3-dark.scss +0 -1
  212. package/styles/treegrid/icons/_material3.scss +0 -48
  213. package/styles/treegrid/icons/_tailwind-dark.scss +0 -48
  214. package/styles/treegrid/icons/_tailwind.scss +0 -48
  215. package/styles/treegrid/icons/_tailwind3.scss +0 -48
  216. package/styles/treegrid/material-dark.css +0 -426
  217. package/styles/treegrid/material-dark.scss +0 -4
  218. package/styles/treegrid/material.css +0 -426
  219. package/styles/treegrid/material.scss +0 -4
  220. package/styles/treegrid/material3-dark.css +0 -508
  221. package/styles/treegrid/material3-dark.scss +0 -4
  222. package/styles/treegrid/material3.css +0 -510
  223. package/styles/treegrid/material3.scss +0 -4
  224. package/styles/treegrid/tailwind-dark.css +0 -426
  225. package/styles/treegrid/tailwind-dark.scss +0 -4
  226. package/styles/treegrid/tailwind.css +0 -426
  227. package/styles/treegrid/tailwind.scss +0 -4
  228. package/styles/treegrid/tailwind3.css +0 -500
  229. package/styles/treegrid/tailwind3.scss +0 -4
@@ -67,6 +67,7 @@ var Selection = /** @class */ (function () {
67
67
  this.parent.on('updateGridActions', this.updateGridActions, this);
68
68
  this.parent.grid.on('colgroup-refresh', this.headerCheckbox, this);
69
69
  this.parent.on('checkboxSelection', this.checkboxSelection, this);
70
+ this.parent.on(events.hierarchyCheckstateUpdate, this.rowDropCompleteSelection, this);
70
71
  };
71
72
  /**
72
73
  * Removes previously added event listeners.
@@ -82,6 +83,7 @@ var Selection = /** @class */ (function () {
82
83
  this.parent.grid.off('colgroup-refresh', this.headerCheckbox);
83
84
  this.parent.off('checkboxSelection', this.checkboxSelection);
84
85
  this.parent.off('updateGridActions', this.updateGridActions);
86
+ this.parent.off(events.hierarchyCheckstateUpdate, this.rowDropCompleteSelection);
85
87
  };
86
88
  /**
87
89
  * Destroys the selection module and clears internal caches.
@@ -129,8 +131,9 @@ var Selection = /** @class */ (function () {
129
131
  this.selectCheckboxes(rowIndex);
130
132
  var newCheckState = checkBox.nextElementSibling.classList.contains('e-check');
131
133
  this.triggerChkChangeEvent(checkBox, newCheckState, target.closest('tr'));
134
+ this.updateHeaderCheckboxState();
132
135
  }
133
- else if (checkWrap && checkWrap.querySelectorAll('.e-treeselectall').length > 0 && this.parent.autoCheckHierarchy) {
136
+ else if (checkWrap && checkWrap.querySelectorAll('.e-treeselectall').length > 0) {
134
137
  var frame = checkWrap.querySelector('.e-frame');
135
138
  var targetState = frame.classList.contains('e-uncheck') || frame.classList.contains('e-stop');
136
139
  this.headerSelection(targetState);
@@ -207,8 +210,9 @@ var Selection = /** @class */ (function () {
207
210
  var headerElement = this.parent.getHeaderContent().querySelectorAll('.e-headercelldiv')[this.columnIndex];
208
211
  if (headerElement && headerElement.querySelectorAll('.e-treeselectall').length === 0) {
209
212
  var value = false; // Initial state can be false.
210
- var rowChkBox = this.parent.createElement('input', { className: 'e-treeselectall', attrs: { 'type': 'checkbox' } });
213
+ var rowChkBox = this.parent.createElement('input', { className: 'e-treeselectall', attrs: { 'type': 'checkbox', 'aria-label': 'Select all checkbox' } });
211
214
  var checkWrap = createCheckBox(this.parent.createElement, false, { checked: value, label: ' ' });
215
+ headerElement.classList.add('e-headerchkcelldiv');
212
216
  checkWrap.classList.add('e-hierarchycheckbox');
213
217
  checkWrap.insertBefore(rowChkBox.cloneNode(), checkWrap.firstChild);
214
218
  if (!isNullOrUndefined(headerElement)) {
@@ -225,6 +229,7 @@ var Selection = /** @class */ (function () {
225
229
  this.headerSelection();
226
230
  } // Update status based on current selections
227
231
  }
232
+ this.updateHeaderCheckboxState();
228
233
  }
229
234
  };
230
235
  /**
@@ -297,7 +302,16 @@ var Selection = /** @class */ (function () {
297
302
  for (var i = 0; i < rowIndexes.length; i++) {
298
303
  var viewRec = this.parent.getCurrentViewRecords()[rowIndexes[parseInt(i.toString(), 10)]];
299
304
  var flatRec = getParentData(this.parent, viewRec.uniqueID);
300
- var nextState = (flatRec.checkboxState === 'check') ? 'uncheck' : 'check';
305
+ var nextState = void 0;
306
+ if (flatRec.checkboxState === 'check') {
307
+ nextState = 'uncheck';
308
+ }
309
+ else if (flatRec.checkboxState === 'indeterminate') {
310
+ nextState = this.shouldConsiderAllChildren() ? 'uncheck' : 'check';
311
+ }
312
+ else {
313
+ nextState = 'check';
314
+ }
301
315
  flatRec.checkboxState = nextState;
302
316
  viewRec.checkboxState = nextState;
303
317
  this.traverSelection(flatRec, nextState, false);
@@ -320,7 +334,7 @@ var Selection = /** @class */ (function () {
320
334
  if ((!effectiveChildren || effectiveChildren.length === 0) && this.parent.autoCheckHierarchy) {
321
335
  effectiveChildren = this.getChildrenFromFlat(record);
322
336
  }
323
- if (this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0
337
+ if (this.parent.hierarchyCheckboxMode === 'filteredHierarchy' && this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0
324
338
  && effectiveChildren && effectiveChildren.length) {
325
339
  effectiveChildren = this.getFilteredChildRecords(effectiveChildren);
326
340
  }
@@ -367,8 +381,15 @@ var Selection = /** @class */ (function () {
367
381
  };
368
382
  }
369
383
  var summary = this.parentSelectionCounters[record.uniqueID];
384
+ if (this.shouldConsiderAllChildren()) {
385
+ summary = this.buildSelectionSummary(record, true, true);
386
+ if (record.uniqueID) {
387
+ this.parentSelectionCounters[record.uniqueID] = summary;
388
+ }
389
+ }
370
390
  var finalState = this.deriveParentState(record, summary);
371
- if (checkboxState === 'check' && summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0) {
391
+ if (checkboxState === 'check' && summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0
392
+ && !this.shouldConsiderAllChildren()) {
372
393
  finalState = 'check';
373
394
  }
374
395
  this.updateSelectedItems(record, finalState);
@@ -434,7 +455,9 @@ var Selection = /** @class */ (function () {
434
455
  if (!parent) {
435
456
  return;
436
457
  }
437
- var summary = this.buildSelectionSummary(parent);
458
+ var ignoreFilter = this.parent.hierarchyCheckboxMode === 'filteredHierarchy';
459
+ var useFullChildList = this.shouldConsiderAllChildren();
460
+ var summary = this.buildSelectionSummary(parent, !ignoreFilter, useFullChildList);
438
461
  if (previousChildState) {
439
462
  this.applySummaryDelta(summary, previousChildState, -1);
440
463
  }
@@ -448,11 +471,10 @@ var Selection = /** @class */ (function () {
448
471
  if (parent.checkboxState === desiredState) {
449
472
  return;
450
473
  }
451
- var parentPrev = parent.checkboxState;
452
474
  parent.checkboxState = desiredState;
453
475
  this.updateSelectedItems(parent, desiredState);
454
476
  if (parent.parentItem) {
455
- this.updateParentSelection(parent.parentItem, parentPrev, desiredState);
477
+ this.updateParentSelection(parent.parentItem);
456
478
  }
457
479
  };
458
480
  /**
@@ -460,9 +482,11 @@ var Selection = /** @class */ (function () {
460
482
  *
461
483
  * @param {Object} record - The record whose children should be summarized.
462
484
  * @param {boolean} [ignoreFilter] - If true, ignore current filter when computing summary.
485
+ * @param {boolean} [useFullChildList] - If true, skip the `getFilteredChildRecords` narrowing
486
+ * step even when a filter is active.
463
487
  * @returns {{ total: number, checked: number, indeterminate: number }} The computed summary.
464
488
  */
465
- Selection.prototype.buildSelectionSummary = function (record, ignoreFilter) {
489
+ Selection.prototype.buildSelectionSummary = function (record, ignoreFilter, useFullChildList) {
466
490
  var summary = { total: 0, checked: 0, indeterminate: 0 };
467
491
  var children = [];
468
492
  if (record && Array.isArray(record.childRecords) && record.childRecords.length) {
@@ -471,7 +495,8 @@ var Selection = /** @class */ (function () {
471
495
  else {
472
496
  children = this.getChildrenFromFlat(record);
473
497
  }
474
- if (!ignoreFilter && this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0) {
498
+ var filterActive = !!(this.parent.filterModule && this.parent.filterModule.filteredResult.length > 0);
499
+ if (!ignoreFilter && !useFullChildList && filterActive) {
475
500
  children = this.getFilteredChildRecords(children);
476
501
  }
477
502
  for (var i = 0; i < children.length; i++) {
@@ -490,6 +515,22 @@ var Selection = /** @class */ (function () {
490
515
  }
491
516
  return summary;
492
517
  };
518
+ /**
519
+ * Decides whether the parent `checkboxState` derivation should consider the full original
520
+ * child set instead of the filtered subset.
521
+ *
522
+ * @returns {boolean} `true` when derivation should use the full child list.
523
+ */
524
+ Selection.prototype.shouldConsiderAllChildren = function () {
525
+ if (this.parent.hierarchyCheckboxMode !== 'filteredHierarchy') {
526
+ return false;
527
+ }
528
+ var filterActive = !!(this.parent.filterModule && this.parent.filterModule.filteredResult &&
529
+ this.parent.filterModule.filteredResult.length > 0);
530
+ var searchActive = !!(this.parent.grid && this.parent.grid.searchSettings && this.parent.grid.searchSettings.key &&
531
+ this.parent.grid.searchSettings.key.length);
532
+ return filterActive || searchActive;
533
+ };
493
534
  /**
494
535
  * Applies a delta to a selection summary based on a state change.
495
536
  *
@@ -555,6 +596,13 @@ var Selection = /** @class */ (function () {
555
596
  this.filteredList = [];
556
597
  }
557
598
  var records = this.resolveHeaderSelectionList(true);
599
+ if (!isNullOrUndefined(checkAll)
600
+ && (this.parent.hierarchyCheckboxMode === 'hierarchy' ||
601
+ (this.parent.hierarchyCheckboxMode === 'filteredHierarchy' && checkAll))
602
+ && !isRemoteData(this.parent)
603
+ && this.parent.flatData.length > records.length) {
604
+ records = this.parent.flatData;
605
+ }
558
606
  if (!isNullOrUndefined(checkAll)) {
559
607
  this.resetSelectionCaches();
560
608
  var targetState = checkAll ? 'check' : 'uncheck';
@@ -578,16 +626,18 @@ var Selection = /** @class */ (function () {
578
626
  */
579
627
  Selection.prototype.finalizeParentsAfterBulk = function (records) {
580
628
  var all = records;
629
+ var useFullChildList = this.shouldConsiderAllChildren();
581
630
  for (var i = 0; i < all.length; i++) {
582
631
  var rec = all[parseInt(i.toString(), 10)];
583
632
  if (!rec || !rec.hasChildRecords) {
584
633
  continue;
585
634
  }
586
- var summary = this.buildSelectionSummary(rec, true);
635
+ var summary = this.buildSelectionSummary(rec, true, useFullChildList);
587
636
  this.parentSelectionCounters[rec.uniqueID] = summary;
588
637
  var finalState = this.deriveParentState(rec, summary);
589
638
  if (this.headerSelectionState === 'check' &&
590
- summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0) {
639
+ summary.total > 0 && summary.checked === summary.total && summary.indeterminate === 0 &&
640
+ !useFullChildList) {
591
641
  finalState = 'check';
592
642
  }
593
643
  else if (this.headerSelectionState === 'uncheck') {
@@ -637,15 +687,32 @@ var Selection = /** @class */ (function () {
637
687
  var hasSearch = !!(this.parent.grid && this.parent.grid.searchSettings &&
638
688
  this.parent.grid.searchSettings.key && this.parent.grid.searchSettings.key.length);
639
689
  var isFilterOrSearch = hasFilter || hasSearch || requestType === 'refresh' || requestType === 'searching';
690
+ var isSortOrPageRequest = requestType === 'sorting' || requestType === 'paging';
691
+ var isFilterCleared = (requestType === 'filtering' || requestType === 'searching' ||
692
+ requestType === 'refresh') && !isFilterOrSearch;
693
+ var shouldUpdateParents = isSortOrPageRequest || isFilterCleared;
640
694
  var currentlySelectedItemsInOrder = isFilterOrSearch ? records : this.selectedItems.slice();
695
+ var parentsToUpdate = shouldUpdateParents && this.parent.flatData ?
696
+ this.parent.flatData : currentlySelectedItemsInOrder;
641
697
  var newSelectedItems = [];
642
698
  var newSelectedUidMap = new Map();
643
699
  var newSelectedIndexes = [];
644
- for (var _i = 0, currentlySelectedItemsInOrder_1 = currentlySelectedItemsInOrder; _i < currentlySelectedItemsInOrder_1.length; _i++) {
645
- var item = currentlySelectedItemsInOrder_1[_i];
646
- if (item.hasChildRecords && isFilterOrSearch && item.level === 0 && this.parent.autoCheckHierarchy) {
647
- this.updateParentSelection(item);
700
+ for (var _i = 0, parentsToUpdate_1 = parentsToUpdate; _i < parentsToUpdate_1.length; _i++) {
701
+ var item = parentsToUpdate_1[_i];
702
+ if (shouldUpdateParents && item.hasChildRecords && item.level === 0 && this.parent.autoCheckHierarchy) {
703
+ var actualRecord = this.getRecordFromUidCollection(item);
704
+ var isFilteredHierarchyMode = this.parent.hierarchyCheckboxMode === 'filteredHierarchy';
705
+ if (isFilterCleared && isFilteredHierarchyMode && actualRecord &&
706
+ (actualRecord.checkboxState === 'check' || actualRecord.checkboxState === 'uncheck')) {
707
+ this.traverSelection(actualRecord, actualRecord.checkboxState, false);
708
+ }
709
+ else {
710
+ this.updateParentSelection(item);
711
+ }
648
712
  }
713
+ }
714
+ for (var _a = 0, currentlySelectedItemsInOrder_1 = currentlySelectedItemsInOrder; _a < currentlySelectedItemsInOrder_1.length; _a++) {
715
+ var item = currentlySelectedItemsInOrder_1[_a];
649
716
  var actualItem = this.getRecordFromUidCollection(item);
650
717
  if (actualItem.uniqueID && actualItem.checkboxState === 'check') {
651
718
  newSelectedItems.push(actualItem);
@@ -655,8 +722,8 @@ var Selection = /** @class */ (function () {
655
722
  if (!isFilterOrSearch) {
656
723
  var allFlatData = this.parent.flatData;
657
724
  if (allFlatData) {
658
- for (var _a = 0, allFlatData_1 = allFlatData; _a < allFlatData_1.length; _a++) {
659
- var record = allFlatData_1[_a];
725
+ for (var _b = 0, allFlatData_1 = allFlatData; _b < allFlatData_1.length; _b++) {
726
+ var record = allFlatData_1[_b];
660
727
  if (!record || record.isSummaryRow) {
661
728
  continue;
662
729
  }
@@ -670,8 +737,8 @@ var Selection = /** @class */ (function () {
670
737
  this.selectedItems = newSelectedItems;
671
738
  this.selectedUidMap = newSelectedUidMap;
672
739
  this.buildVisibleUidMap();
673
- for (var _b = 0, _c = this.selectedItems; _b < _c.length; _b++) {
674
- var item = _c[_b];
740
+ for (var _c = 0, _d = this.selectedItems; _c < _d.length; _c++) {
741
+ var item = _d[_c];
675
742
  var visibleIdx = this.visibleUidIndex[item.uniqueID];
676
743
  if (visibleIdx !== undefined) {
677
744
  newSelectedIndexes.push(visibleIdx);
@@ -965,7 +1032,8 @@ var Selection = /** @class */ (function () {
965
1032
  else if (args.requestType === 'add' && this.parent.autoCheckHierarchy) {
966
1033
  args.data.checkboxState = 'uncheck';
967
1034
  }
968
- else if (requestType === 'filtering' || requestType === 'searching' || requestType === 'refresh') {
1035
+ else if (requestType === 'filtering' || requestType === 'searching' || requestType === 'refresh' ||
1036
+ requestType === 'save' || requestType === 'cancel') {
969
1037
  this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(), requestType);
970
1038
  this.refreshVisibleCheckboxes();
971
1039
  if (this.parent.autoCheckHierarchy) {
@@ -977,22 +1045,109 @@ var Selection = /** @class */ (function () {
977
1045
  if ((requestType === 'filtering' || requestType === 'searching' || requestType === 'refresh' ||
978
1046
  requestType === 'sorting' || requestType === 'paging' || requestType === 'expanding' ||
979
1047
  requestType === 'expand' || requestType === 'collapsing' || requestType === 'collapse') && !isRemoteData(this.parent)) {
980
- if (!(isCheckboxcolumn(this.parent) && (requestType === 'refresh' && this.parent['isVirtualExpandCollapse']))) {
981
- this.selectedItems = [];
982
- this.selectedUidMap = new Map();
983
- this.selectedIndexes = [];
984
- }
985
- if (requestType === 'filtering' || requestType === 'searching' || requestType === 'sorting') {
986
- this.headerSelection(false);
987
- }
1048
+ this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(), requestType);
988
1049
  this.refreshVisibleCheckboxes();
989
- if (this.parent.autoCheckHierarchy) {
990
- this.updateHeaderCheckboxState();
991
- }
1050
+ this.updateHeaderCheckboxState();
992
1051
  }
993
1052
  }
994
1053
  }
995
1054
  };
1055
+ /**
1056
+ *
1057
+ * @param {Object} args - The notification payload from `rowDragdrop.dropRows`.
1058
+ * @returns {void}
1059
+ */
1060
+ Selection.prototype.rowDropCompleteSelection = function (args) {
1061
+ var _this = this;
1062
+ var dragged = args.draggedRecords;
1063
+ var draggedUids = new Set();
1064
+ for (var dragIndex = 0; dragIndex < dragged.length; dragIndex++) {
1065
+ var draggedRecord = dragged[parseInt(dragIndex.toString(), 10)];
1066
+ var draggedUid = draggedRecord.uniqueID;
1067
+ if (draggedUid) {
1068
+ draggedUids.add(draggedUid);
1069
+ }
1070
+ }
1071
+ var walked = new Set();
1072
+ var deriveState = function (startingRecord) {
1073
+ if (!startingRecord) {
1074
+ return;
1075
+ }
1076
+ var recordUid = startingRecord.uniqueID;
1077
+ if (!recordUid || walked.has(recordUid) || draggedUids.has(recordUid)) {
1078
+ return;
1079
+ }
1080
+ var liveRecord = _this.parent.uniqueIDCollection[String(recordUid)] || startingRecord;
1081
+ walked.add(recordUid);
1082
+ var childRecords = _this.getChildrenFromFlat(liveRecord);
1083
+ var totalChildren = 0;
1084
+ var checkedChildren = 0;
1085
+ var indeterminateChildren = 0;
1086
+ for (var childIndex = 0; childIndex < childRecords.length; childIndex++) {
1087
+ var childRecord = childRecords[parseInt(childIndex.toString(), 10)];
1088
+ if (!childRecord || childRecord.isSummaryRow) {
1089
+ continue;
1090
+ }
1091
+ if (childRecord.hasChildRecords) {
1092
+ deriveState(childRecord);
1093
+ }
1094
+ totalChildren++;
1095
+ if (childRecord.checkboxState === 'check') {
1096
+ checkedChildren++;
1097
+ }
1098
+ else if (childRecord.checkboxState === 'indeterminate') {
1099
+ indeterminateChildren++;
1100
+ }
1101
+ }
1102
+ var summary = {
1103
+ total: totalChildren,
1104
+ checked: checkedChildren,
1105
+ indeterminate: indeterminateChildren
1106
+ };
1107
+ _this.parentSelectionCounters["" + recordUid] = summary;
1108
+ var desiredState = _this.deriveParentState(liveRecord, { total: totalChildren, checked: checkedChildren, indeterminate: indeterminateChildren });
1109
+ if (liveRecord.checkboxState !== desiredState) {
1110
+ _this.updateSelectedItems(liveRecord, desiredState);
1111
+ }
1112
+ };
1113
+ var startingAncestors = [];
1114
+ var startingAncestorUids = new Set();
1115
+ var collectAncestorChain = function (record) {
1116
+ var currentRecord = record;
1117
+ while (currentRecord) {
1118
+ var currentUid = currentRecord.uniqueID;
1119
+ if (currentUid && !startingAncestorUids.has(currentUid)) {
1120
+ startingAncestors.push(currentRecord);
1121
+ startingAncestorUids.add(currentUid);
1122
+ }
1123
+ currentRecord = currentRecord.parentItem;
1124
+ }
1125
+ };
1126
+ if (args && args.oldParents) {
1127
+ for (var oldIndex = 0; oldIndex < args.oldParents.length; oldIndex++) {
1128
+ var oldParent = args.oldParents[parseInt(oldIndex.toString(), 10)];
1129
+ if (oldParent) {
1130
+ collectAncestorChain(oldParent);
1131
+ }
1132
+ }
1133
+ }
1134
+ for (var dragIndex = 0; dragIndex < dragged.length; dragIndex++) {
1135
+ var draggedRecord = dragged[parseInt(dragIndex.toString(), 10)];
1136
+ var newParent = draggedRecord && draggedRecord.parentItem;
1137
+ if (newParent) {
1138
+ collectAncestorChain(newParent);
1139
+ }
1140
+ }
1141
+ if (args && args.droppedRecord && args.dropPosition === 'middleSegment') {
1142
+ collectAncestorChain(args.droppedRecord);
1143
+ }
1144
+ for (var startIndex = 0; startIndex < startingAncestors.length; startIndex++) {
1145
+ deriveState(startingAncestors[parseInt(startIndex.toString(), 10)]);
1146
+ }
1147
+ this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(true), '');
1148
+ this.refreshVisibleCheckboxes();
1149
+ this.updateHeaderCheckboxState();
1150
+ };
996
1151
  /**
997
1152
  * Retrieves checked record objects.
998
1153
  * This array maintains the `ITreeData` objects in the order they were selected.
@@ -1019,6 +1174,17 @@ var Selection = /** @class */ (function () {
1019
1174
  }
1020
1175
  return orderedVisibleIndexes;
1021
1176
  };
1177
+ /**
1178
+ * Deletes all currently checked records in the TreeGrid.
1179
+ *
1180
+ * @returns {void}
1181
+ */
1182
+ Selection.prototype.deleteCheckedRecords = function () {
1183
+ if (!isNullOrUndefined(this.parent.editModule) && !isNullOrUndefined(this.parent.editSettings)
1184
+ && this.parent.editSettings.allowDeleting) {
1185
+ this.parent.deleteRecord(this.parent.getPrimaryKeyFieldNames()[0], this.getCheckedrecords());
1186
+ }
1187
+ };
1022
1188
  return Selection;
1023
1189
  }());
1024
1190
  export { Selection };
@@ -53,11 +53,25 @@ var Aggregate = /** @class */ (function () {
53
53
  var childRecordsLength;
54
54
  var columns = this.parent.getColumns();
55
55
  if (this.parent.aggregates.filter(function (x) { return x.showChildSummary; }).length) {
56
- for (var i = 0, len = dataLength; i < len; i++) {
56
+ var _loop_1 = function (i, len) {
57
57
  parentRecord = parentRecords[parseInt(i.toString(), 10)];
58
- childRecordsLength = this.getChildRecordsLength(parentRecord, flatRecords);
58
+ childRecordsLength = this_1.getChildRecordsLength(parentRecord, flatRecords);
59
59
  if (childRecordsLength) {
60
- var _loop_1 = function (summaryRowIndex, len_1) {
60
+ var childRecords_1 = getObject('childRecords', parentRecord) || [];
61
+ var existingSummaryRows = childRecords_1.filter(function (e) {
62
+ return getObject('isSummaryRow', e) && getObject('parentUniqueID', e) === parentRecord.uniqueID;
63
+ });
64
+ existingSummaryRows.forEach(function (summaryRow) {
65
+ var summaryIndex = flatRecords.indexOf(summaryRow);
66
+ if (summaryIndex !== -1) {
67
+ flatRecords.splice(summaryIndex, 1);
68
+ }
69
+ var childSummaryIndex = childRecords_1.indexOf(summaryRow);
70
+ if (childSummaryIndex !== -1) {
71
+ childRecords_1.splice(childSummaryIndex, 1);
72
+ }
73
+ });
74
+ var _loop_2 = function (summaryRowIndex, len_1) {
61
75
  var item = void 0;
62
76
  item = {};
63
77
  for (var i_1 = 0; i_1 < columns.length; i_1++) {
@@ -84,9 +98,8 @@ var Aggregate = /** @class */ (function () {
84
98
  setValue('isSummaryRow', true, item);
85
99
  setValue('parentUniqueID', summaryParent.uniqueID, item);
86
100
  if (isSort) {
87
- var childRecords = getObject('childRecords', parentRecord);
88
- if (childRecords.length) {
89
- childRecords.push(item);
101
+ if (childRecords_1.length) {
102
+ childRecords_1.push(item);
90
103
  }
91
104
  }
92
105
  flatRecords.splice(currentIndex, 0, item);
@@ -95,12 +108,15 @@ var Aggregate = /** @class */ (function () {
95
108
  return "continue";
96
109
  }
97
110
  };
98
- var this_1 = this;
99
111
  for (var summaryRowIndex = 1, len_1 = summaryLength; summaryRowIndex <= len_1; summaryRowIndex++) {
100
- _loop_1(summaryRowIndex, len_1);
112
+ _loop_2(summaryRowIndex, len_1);
101
113
  }
102
- this.flatChildRecords = [];
114
+ this_1.flatChildRecords = [];
103
115
  }
116
+ };
117
+ var this_1 = this;
118
+ for (var i = 0, len = dataLength; i < len; i++) {
119
+ _loop_1(i, len);
104
120
  }
105
121
  }
106
122
  else {
@@ -1,6 +1,7 @@
1
1
  import { Grid, Toolbar as tool } from '@syncfusion/ej2-grids';
2
2
  import * as events from '../base/constant';
3
3
  import { isNullOrUndefined } from '@syncfusion/ej2-base';
4
+ import { isCheckboxcolumn } from '../utils';
4
5
  /**
5
6
  * Toolbar Module for TreeGrid
6
7
  *
@@ -99,11 +100,6 @@ var Toolbar = /** @class */ (function () {
99
100
  Toolbar.prototype.toolbarClickHandler = function (args) {
100
101
  var tObj = this.parent;
101
102
  var indentOutdentAction = 'indentOutdentAction';
102
- if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
103
- args.item.id === this.parent.grid.element.id + '_update') {
104
- args.cancel = true;
105
- this.parent.grid.editModule.saveCell();
106
- }
107
103
  if (args.item.id === this.parent.grid.element.id + '_expandall') {
108
104
  this.parent.expandAll();
109
105
  }
@@ -118,6 +114,13 @@ var Toolbar = /** @class */ (function () {
118
114
  && !isNullOrUndefined(tObj.rowDragAndDropModule)) {
119
115
  this.parent.rowDragAndDropModule["" + indentOutdentAction](null, 'outdent');
120
116
  }
117
+ if (args.item.id === tObj.grid.element.id + '_delete'
118
+ && isCheckboxcolumn(this.parent)
119
+ && this.parent.getCheckedRecords().length > 0
120
+ && !isNullOrUndefined(this.parent.selectionModule)) {
121
+ this.parent.selectionModule['deleteCheckedRecords']();
122
+ args.cancel = true;
123
+ }
121
124
  };
122
125
  /**
123
126
  * Gets the toolbar of the TreeGrid.
@@ -45,6 +45,8 @@ export declare const remoteExpand: string;
45
45
  /** @hidden */
46
46
  export declare const localPagedExpandCollapse: string;
47
47
  /** @hidden */
48
+ export declare const virtualExpandCollapse: string;
49
+ /** @hidden */
48
50
  export declare const pagingActions: string;
49
51
  /** @hidden */
50
52
  export declare const printGridInit: string;
@@ -158,3 +160,7 @@ export declare const ariaRowIndex: string;
158
160
  export declare const actionFailure: string;
159
161
  /** @hidden */
160
162
  export declare const collapseActionComplete: string;
163
+ /** @hidden */
164
+ export declare const hierarchyCheckstateUpdate: string;
165
+ /** @hidden */
166
+ export declare const beforeDomVirtualRenderRows: string;
@@ -45,6 +45,8 @@ export var remoteExpand = 'remoteExpand';
45
45
  /** @hidden */
46
46
  export var localPagedExpandCollapse = 'localPagedExpandCollapse';
47
47
  /** @hidden */
48
+ export var virtualExpandCollapse = 'virtualExpandCollapse';
49
+ /** @hidden */
48
50
  export var pagingActions = 'pagingActions';
49
51
  /** @hidden */
50
52
  export var printGridInit = 'printGrid-Init';
@@ -158,3 +160,7 @@ export var ariaRowIndex = 'aria-rowindex';
158
160
  export var actionFailure = 'actionFailure';
159
161
  /** @hidden */
160
162
  export var collapseActionComplete = 'collapseActionComplete';
163
+ /** @hidden */
164
+ export var hierarchyCheckstateUpdate = 'hierarchy-checkstate-update';
165
+ /** @hidden */
166
+ export var beforeDomVirtualRenderRows = 'before-dom-virtual-rows-render';
@@ -18,6 +18,22 @@ export declare class DataManipulation {
18
18
  private hierarchyData;
19
19
  private isSelfReference;
20
20
  private isSortAction;
21
+ private enableCollapseAll;
22
+ private uniqueIDCollection;
23
+ private childMapping;
24
+ private hasChildMapping;
25
+ private expandStateMapping;
26
+ private parentIdMapping;
27
+ private idMapping;
28
+ private cachedElementId;
29
+ private enableVirtualization;
30
+ private loadChildOnDemand;
31
+ private initialRender;
32
+ private isCountRequired;
33
+ private rowDragAndDropTargetID;
34
+ private isVirtualRemote;
35
+ private isRemoteData;
36
+ private remoteCollapsedList;
21
37
  private infiniteScrollData;
22
38
  constructor(grid: TreeGrid);
23
39
  /**
@@ -75,6 +91,7 @@ export declare class DataManipulation {
75
91
  private fetchRemoteChildData;
76
92
  private remoteVirtualAction;
77
93
  private beginSorting;
94
+ private createConvertRecords;
78
95
  private createRecords;
79
96
  /**
80
97
  * Function to perform filtering/sorting action for local data