@syncfusion/ej2-treegrid 31.2.15 → 32.1.19

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 (155) hide show
  1. package/dist/ej2-treegrid.min.js +1 -10
  2. package/dist/ej2-treegrid.umd.min.js +1 -10
  3. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-treegrid.es2015.js +1052 -318
  5. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  6. package/dist/es6/ej2-treegrid.es5.js +1058 -321
  7. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  8. package/dist/global/ej2-treegrid.min.js +1 -10
  9. package/dist/global/ej2-treegrid.min.js.map +1 -1
  10. package/dist/global/index.d.ts +0 -9
  11. package/package.json +5 -5
  12. package/src/treegrid/actions/batch-edit.js +21 -3
  13. package/src/treegrid/actions/context-menu.d.ts +1 -0
  14. package/src/treegrid/actions/context-menu.js +16 -0
  15. package/src/treegrid/actions/edit.d.ts +4 -1
  16. package/src/treegrid/actions/edit.js +56 -3
  17. package/src/treegrid/actions/freeze-column.js +1 -1
  18. package/src/treegrid/actions/rowdragdrop.js +3 -0
  19. package/src/treegrid/actions/selection.d.ts +226 -8
  20. package/src/treegrid/actions/selection.js +759 -288
  21. package/src/treegrid/actions/summary.js +1 -1
  22. package/src/treegrid/actions/virtual-scroll.js +6 -3
  23. package/src/treegrid/base/data.js +2 -1
  24. package/src/treegrid/base/treegrid-model.d.ts +16 -0
  25. package/src/treegrid/base/treegrid.d.ts +50 -4
  26. package/src/treegrid/base/treegrid.js +157 -19
  27. package/src/treegrid/models/column.d.ts +24 -0
  28. package/src/treegrid/models/column.js +12 -0
  29. package/src/treegrid/renderer/virtual-tree-content-render.d.ts +5 -0
  30. package/src/treegrid/renderer/virtual-tree-content-render.js +24 -2
  31. package/styles/bds-lite.scss +17 -18
  32. package/styles/bds.scss +18 -19
  33. package/styles/bootstrap-dark-lite.scss +17 -18
  34. package/styles/bootstrap-dark.scss +18 -19
  35. package/styles/bootstrap-lite.scss +17 -18
  36. package/styles/bootstrap.scss +18 -19
  37. package/styles/bootstrap4-lite.scss +17 -18
  38. package/styles/bootstrap4.scss +18 -19
  39. package/styles/bootstrap5-dark-lite.scss +17 -18
  40. package/styles/bootstrap5-dark.scss +18 -19
  41. package/styles/bootstrap5-lite.scss +18 -18
  42. package/styles/bootstrap5.3-lite.css +81 -1
  43. package/styles/bootstrap5.3-lite.scss +18 -18
  44. package/styles/bootstrap5.3.css +81 -1
  45. package/styles/bootstrap5.3.scss +19 -19
  46. package/styles/bootstrap5.scss +19 -19
  47. package/styles/fabric-dark-lite.scss +18 -18
  48. package/styles/fabric-dark.scss +19 -19
  49. package/styles/fabric-lite.scss +18 -18
  50. package/styles/fabric.scss +19 -19
  51. package/styles/fluent-dark-lite.scss +18 -18
  52. package/styles/fluent-dark.scss +19 -19
  53. package/styles/fluent-lite.scss +18 -18
  54. package/styles/fluent.scss +19 -19
  55. package/styles/fluent2-lite.css +152 -4
  56. package/styles/fluent2-lite.scss +18 -18
  57. package/styles/fluent2.css +152 -4
  58. package/styles/fluent2.scss +19 -19
  59. package/styles/highcontrast-light-lite.scss +18 -18
  60. package/styles/highcontrast-light.scss +19 -19
  61. package/styles/highcontrast-lite.scss +18 -18
  62. package/styles/highcontrast.scss +19 -19
  63. package/styles/material-dark-lite.scss +18 -18
  64. package/styles/material-dark.scss +19 -19
  65. package/styles/material-lite.scss +17 -18
  66. package/styles/material.scss +18 -19
  67. package/styles/material3-dark-lite.css +140 -1
  68. package/styles/material3-dark-lite.scss +18 -18
  69. package/styles/material3-dark.css +140 -1
  70. package/styles/material3-dark.scss +19 -21
  71. package/styles/material3-lite.css +140 -1
  72. package/styles/material3-lite.scss +18 -18
  73. package/styles/material3.css +140 -1
  74. package/styles/material3.scss +19 -21
  75. package/styles/tailwind-dark-lite.scss +18 -18
  76. package/styles/tailwind-dark.scss +19 -19
  77. package/styles/tailwind-lite.scss +18 -18
  78. package/styles/tailwind.scss +19 -19
  79. package/styles/tailwind3-lite.css +119 -1
  80. package/styles/tailwind3-lite.scss +18 -18
  81. package/styles/tailwind3.css +119 -1
  82. package/styles/tailwind3.scss +19 -19
  83. package/styles/treegrid/_all.scss +2 -2
  84. package/styles/treegrid/_bds-definition.scss +2 -0
  85. package/styles/treegrid/_bigger.scss +2 -0
  86. package/styles/treegrid/_bootstrap-dark-definition.scss +2 -0
  87. package/styles/treegrid/_bootstrap-definition.scss +2 -0
  88. package/styles/treegrid/_bootstrap4-definition.scss +2 -0
  89. package/styles/treegrid/_bootstrap5-dark-definition.scss +26 -1
  90. package/styles/treegrid/_bootstrap5-definition.scss +2 -0
  91. package/styles/treegrid/_bootstrap5.3-definition.scss +2 -0
  92. package/styles/treegrid/_fabric-dark-definition.scss +2 -0
  93. package/styles/treegrid/_fabric-definition.scss +2 -0
  94. package/styles/treegrid/_fluent-dark-definition.scss +27 -1
  95. package/styles/treegrid/_fluent-definition.scss +2 -0
  96. package/styles/treegrid/_fluent2-definition.scss +2 -0
  97. package/styles/treegrid/_highcontrast-definition.scss +2 -0
  98. package/styles/treegrid/_highcontrast-light-definition.scss +2 -0
  99. package/styles/treegrid/_layout.scss +5 -2
  100. package/styles/treegrid/_material-dark-definition.scss +2 -0
  101. package/styles/treegrid/_material-definition.scss +2 -0
  102. package/styles/treegrid/_material3-dark-definition.scss +26 -1
  103. package/styles/treegrid/_material3-definition.scss +2 -0
  104. package/styles/treegrid/_tailwind-dark-definition.scss +26 -1
  105. package/styles/treegrid/_tailwind-definition.scss +2 -0
  106. package/styles/treegrid/_tailwind3-definition.scss +2 -0
  107. package/styles/treegrid/_theme-variables.scss +1 -0
  108. package/styles/treegrid/bds.scss +19 -19
  109. package/styles/treegrid/bootstrap-dark.scss +19 -19
  110. package/styles/treegrid/bootstrap.scss +19 -19
  111. package/styles/treegrid/bootstrap4.scss +19 -19
  112. package/styles/treegrid/bootstrap5-dark.scss +19 -19
  113. package/styles/treegrid/bootstrap5.3.css +81 -1
  114. package/styles/treegrid/bootstrap5.3.scss +19 -19
  115. package/styles/treegrid/bootstrap5.scss +19 -19
  116. package/styles/treegrid/fabric-dark.scss +19 -19
  117. package/styles/treegrid/fabric.scss +19 -19
  118. package/styles/treegrid/fluent-dark.scss +19 -19
  119. package/styles/treegrid/fluent.scss +19 -19
  120. package/styles/treegrid/fluent2.css +152 -4
  121. package/styles/treegrid/fluent2.scss +19 -19
  122. package/styles/treegrid/highcontrast-light.scss +19 -19
  123. package/styles/treegrid/highcontrast.scss +19 -19
  124. package/styles/treegrid/icons/_bds.scss +1 -0
  125. package/styles/treegrid/icons/_bootstrap-dark.scss +1 -0
  126. package/styles/treegrid/icons/_bootstrap.scss +1 -0
  127. package/styles/treegrid/icons/_bootstrap4.scss +1 -0
  128. package/styles/treegrid/icons/_bootstrap5-dark.scss +1 -1
  129. package/styles/treegrid/icons/_bootstrap5.3.scss +1 -0
  130. package/styles/treegrid/icons/_bootstrap5.scss +1 -0
  131. package/styles/treegrid/icons/_fabric-dark.scss +1 -0
  132. package/styles/treegrid/icons/_fabric.scss +1 -0
  133. package/styles/treegrid/icons/_fluent-dark.scss +1 -1
  134. package/styles/treegrid/icons/_fluent.scss +1 -0
  135. package/styles/treegrid/icons/_fluent2.scss +1 -0
  136. package/styles/treegrid/icons/_fusionnew.scss +1 -0
  137. package/styles/treegrid/icons/_highcontrast-light.scss +1 -0
  138. package/styles/treegrid/icons/_highcontrast.scss +1 -0
  139. package/styles/treegrid/icons/_material-dark.scss +1 -0
  140. package/styles/treegrid/icons/_material.scss +1 -0
  141. package/styles/treegrid/icons/_material3-dark.scss +1 -1
  142. package/styles/treegrid/icons/_material3.scss +1 -0
  143. package/styles/treegrid/icons/_tailwind-dark.scss +1 -0
  144. package/styles/treegrid/icons/_tailwind.scss +1 -0
  145. package/styles/treegrid/icons/_tailwind3.scss +1 -0
  146. package/styles/treegrid/material-dark.scss +19 -19
  147. package/styles/treegrid/material.scss +19 -19
  148. package/styles/treegrid/material3-dark.css +140 -1
  149. package/styles/treegrid/material3-dark.scss +19 -20
  150. package/styles/treegrid/material3.css +140 -1
  151. package/styles/treegrid/material3.scss +19 -20
  152. package/styles/treegrid/tailwind-dark.scss +19 -19
  153. package/styles/treegrid/tailwind.scss +19 -19
  154. package/styles/treegrid/tailwind3.css +119 -1
  155. package/styles/treegrid/tailwind3.scss +19 -19
@@ -1,12 +1,3 @@
1
- /*!
2
- * filename: index.d.ts
3
- * version : 31.2.15
4
- * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
- * Use of this code is subject to the terms of our license.
6
- * A copy of the current license can be obtained at any time by e-mailing
7
- * licensing@syncfusion.com. Any infringement will be prosecuted under
8
- * applicable laws.
9
- */
10
1
  import * as _treegrid from '@syncfusion/ej2-treegrid';
11
2
 
12
3
  export declare namespace ej {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-treegrid",
3
- "version": "31.2.15",
3
+ "version": "32.1.19",
4
4
  "description": "Essential JS 2 TreeGrid Component",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,10 +8,10 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-treegrid.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~31.2.12",
12
- "@syncfusion/ej2-data": "~31.2.12",
13
- "@syncfusion/ej2-grids": "~31.2.15",
14
- "@syncfusion/ej2-popups": "~31.2.12"
11
+ "@syncfusion/ej2-base": "~32.1.19",
12
+ "@syncfusion/ej2-data": "~32.1.19",
13
+ "@syncfusion/ej2-grids": "~32.1.19",
14
+ "@syncfusion/ej2-popups": "~32.1.19"
15
15
  },
16
16
  "devDependencies": {},
17
17
  "keywords": [
@@ -273,13 +273,22 @@ var BatchEdit = /** @class */ (function () {
273
273
  focusModule.getContent().matrix.matrix = this.matrix;
274
274
  }
275
275
  else {
276
- actualIndex = table.getElementsByClassName('e-batchrow')[0].rowIndex;
276
+ if (this.parent.frozenRows) {
277
+ actualIndex = this.batchIndex;
278
+ }
279
+ else if (this.parent.editModule.isAddedMultipleRowsByMethod) {
280
+ actualIndex = e.index;
281
+ }
282
+ else {
283
+ actualIndex = table.getElementsByClassName('e-batchrow')[0].rowIndex;
284
+ }
277
285
  // if (this.parent.frozenRows || this.parent.frozenColumns) {
278
286
  // actualIndex = this.batchIndex;
279
287
  // }
280
288
  }
281
289
  focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
282
- if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
290
+ if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
291
+ !this.parent.editModule['isAddedRowByContextMenu'] && !this.parent.editModule.isAddedMultipleRowsByMethod) {
283
292
  var newlyAddedRecords = this.parent.getBatchChanges()['addedRecords'];
284
293
  var index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('aria-rowindex'), 10) - 1;
285
294
  this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
@@ -528,7 +537,12 @@ var BatchEdit = /** @class */ (function () {
528
537
  this.parent.editModule['previousNewRowPosition'] = rowPosition;
529
538
  }
530
539
  addRecords[parseInt(i.toString(), 10)].taskData = taskData;
531
- addRowRecord_1 = this.batchAddRowRecord[parseInt(i.toString(), 10)];
540
+ if (this.batchAddRowRecord.length > 1) {
541
+ addRowRecord_1 = this.batchAddRowRecord[parseInt(i.toString(), 10)];
542
+ }
543
+ else {
544
+ addRowRecord_1 = this.batchAddRowRecord[0];
545
+ }
532
546
  if (isNullOrUndefined(addRowRecord_1)) {
533
547
  addRowRecord_1 = this.batchAddRowRecord[i - 1];
534
548
  }
@@ -543,6 +557,10 @@ var BatchEdit = /** @class */ (function () {
543
557
  if (isNullOrUndefined(addRecords[parseInt(i.toString(), 10)].index)) {
544
558
  addRowIndex = 0;
545
559
  }
560
+ if (this.parent.editModule.isAddedMultipleRowsByMethod && this.isSelfReference && (this.parent.editSettings.newRowPosition === 'Above' || this.parent.editSettings.newRowPosition === 'Below')) {
561
+ addRowIndex = args.index;
562
+ addRowRecord_1 = this.parent.flatData[args.index];
563
+ }
546
564
  if (this.parent.editSettings.newRowPosition !== 'Top' && this.parent.editSettings.newRowPosition !== 'Bottom') {
547
565
  if (isNullOrUndefined(addRecords[parseInt(i.toString(), 10)].parentItem) && this.selectedIndex === -1) {
548
566
  selectedIndex = -1;
@@ -17,6 +17,7 @@ export declare class ContextMenu {
17
17
  * @returns {void}
18
18
  */
19
19
  removeEventListener(): void;
20
+ private contextMenuItemClick;
20
21
  private contextMenuOpen;
21
22
  private contextMenuClick;
22
23
  /**
@@ -18,6 +18,7 @@ var ContextMenu = /** @class */ (function () {
18
18
  ContextMenu.prototype.addEventListener = function () {
19
19
  this.parent.on('contextMenuOpen', this.contextMenuOpen, this);
20
20
  this.parent.on('contextMenuClick', this.contextMenuClick, this);
21
+ this.parent.on('contextMenuItemClick', this.contextMenuItemClick, this);
21
22
  };
22
23
  /**
23
24
  * @hidden
@@ -29,6 +30,21 @@ var ContextMenu = /** @class */ (function () {
29
30
  }
30
31
  this.parent.off('contextMenuOpen', this.contextMenuOpen);
31
32
  this.parent.off('contextMenuClick', this.contextMenuClick);
33
+ this.parent.off('contextMenuItemClick', this.contextMenuItemClick);
34
+ };
35
+ ContextMenu.prototype.contextMenuItemClick = function (args) {
36
+ var id = args.item && args.item.id ? args.item.id : '';
37
+ var delId = this.parent.element.id + '_gridcontrol_cmenu_Delete';
38
+ if (id !== delId) {
39
+ return;
40
+ }
41
+ if (this.parent.getSelectedRecords()[0].hasChildRecords || this.parent.getSelectedRecords().length > 1) {
42
+ this.parent.deleteRecord();
43
+ }
44
+ else {
45
+ this.parent.deleteRow(this.parent.getSelectedRows()[0]);
46
+ }
47
+ args.cancel = true;
32
48
  };
33
49
  ContextMenu.prototype.contextMenuOpen = function (args) {
34
50
  var addRow = select('#' + this.parent.element.id + '_gridcontrol_cmenu_AddRow', args.element);
@@ -26,6 +26,9 @@ export declare class Edit {
26
26
  private editedRowIndex;
27
27
  private isScrollByFocus;
28
28
  private isIndexUndefined;
29
+ isAddedMultipleRowsByMethod: boolean;
30
+ private multipleRowIndex;
31
+ private updatedRecords;
29
32
  /**
30
33
  * Constructor for Edit module
31
34
  *
@@ -93,7 +96,7 @@ export declare class Edit {
93
96
  *
94
97
  * @returns {void}
95
98
  */
96
- addRecord(data?: Object, index?: number, position?: RowPosition): void;
99
+ addRecord(data?: Object | Object[], index?: number, position?: RowPosition): void;
97
100
  /**
98
101
  * Checks the status of validation at the time of editing. If validation is passed, it returns true.
99
102
  *
@@ -23,6 +23,7 @@ var Edit = /** @class */ (function () {
23
23
  this.isAddedRowByMethod = false;
24
24
  this.isAddedRowByContextMenu = false;
25
25
  this.isIndexUndefined = false;
26
+ this.isAddedMultipleRowsByMethod = false;
26
27
  Grid.Inject(GridEdit);
27
28
  this.parent = parent;
28
29
  this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
@@ -682,7 +683,8 @@ var Edit = /** @class */ (function () {
682
683
  }
683
684
  }
684
685
  }
685
- if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
686
+ if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 &&
687
+ !this.isAddedMultipleRowsByMethod && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
686
688
  index = this.batchEditModule.getAddRowIndex();
687
689
  this.selectedIndex = this.batchEditModule.getSelectedIndex();
688
690
  var batchAddedRecords = this.parent.getBatchChanges()['addedRecords'];
@@ -704,6 +706,28 @@ var Edit = /** @class */ (function () {
704
706
  this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
705
707
  this.batchEditModule['batchAddedRecords'].push(args['data']);
706
708
  }
709
+ else if (this.parent.editSettings.mode === 'Batch' && this.isAddedMultipleRowsByMethod && (this.parent.editSettings.newRowPosition === 'Above' || this.parent.editSettings.newRowPosition === 'Below')) {
710
+ index = this.multipleRowIndex;
711
+ this.selectedIndex = this.multipleRowIndex;
712
+ var batchAddedRecords = this.updatedRecords.addedRecords;
713
+ var newlyAddedRecord = void 0;
714
+ if (batchAddedRecords.length) {
715
+ for (var i = 0; i < batchAddedRecords.length; i++) {
716
+ if (isNullOrUndefined(batchAddedRecords[parseInt(i.toString(), 10)].uniqueID)) {
717
+ newlyAddedRecord = batchAddedRecords[parseInt(i.toString(), 10)];
718
+ }
719
+ var args = {
720
+ action: 'add',
721
+ data: newlyAddedRecord,
722
+ index: index,
723
+ seletedRow: 0
724
+ };
725
+ this.beginAddEdit(args);
726
+ this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
727
+ this.batchEditModule['batchAddedRecords'].push(args['data']);
728
+ }
729
+ }
730
+ }
707
731
  };
708
732
  // private beforeDataBound(args: BeforeDataBoundArgs): void {
709
733
  // if (this.parent.grid.isEdit && this.parent.dataSource instanceof DataManager &&
@@ -998,7 +1022,35 @@ var Edit = /** @class */ (function () {
998
1022
  if (isNullOrUndefined(index)) {
999
1023
  this.isIndexUndefined = true;
1000
1024
  }
1001
- if (!this.isSelfReference && !isNullOrUndefined(data) && Object.hasOwnProperty.call(data, this.parent.childMapping)) {
1025
+ if (!isNullOrUndefined(data) && Array.isArray(data)) {
1026
+ var addRecords = [];
1027
+ var previousEditMode = this.parent.editSettings.mode;
1028
+ var previousGridEditMode = this.parent.grid.editSettings.mode;
1029
+ if (!this.isSelfReference && !isNullOrUndefined(data) && Object.hasOwnProperty.call(data, this.parent.childMapping)) {
1030
+ addRecords.push(data);
1031
+ }
1032
+ else if (Array.isArray(data)) {
1033
+ addRecords = data;
1034
+ }
1035
+ this.parent.setProperties({ editSettings: { mode: 'Batch' } }, true);
1036
+ this.parent.grid.setProperties({ editSettings: { mode: 'Batch' } }, true);
1037
+ if (!isNullOrUndefined(position)) {
1038
+ this.parent.setProperties({ editSettings: { newRowPosition: position } }, true);
1039
+ }
1040
+ this.updatedRecords = { addedRecords: addRecords, changedRecords: [], deletedRecords: [] };
1041
+ if ((position === 'Above' || position === 'Below') && this.isSelfReference) {
1042
+ this.isAddedMultipleRowsByMethod = true;
1043
+ this.multipleRowIndex = index;
1044
+ this.addRowIndex = index;
1045
+ this.parent.notify(events.batchAdd, { updatedRecords: this.updatedRecords, index: index });
1046
+ }
1047
+ var updatedRecords = this.updatedRecords;
1048
+ this.parent.notify(events.batchSave, { updatedRecords: updatedRecords, index: index });
1049
+ this.parent.setProperties({ editSettings: { mode: previousEditMode } }, true);
1050
+ this.parent.grid.setProperties({ editSettings: { mode: previousGridEditMode } }, true);
1051
+ this.parent.refresh();
1052
+ }
1053
+ else if (!this.isSelfReference && !isNullOrUndefined(data) && Object.hasOwnProperty.call(data, this.parent.childMapping)) {
1002
1054
  var addRecords = [];
1003
1055
  var previousEditMode = this.parent.editSettings.mode;
1004
1056
  var previousGridEditMode = this.parent.grid.editSettings.mode;
@@ -1008,7 +1060,8 @@ var Edit = /** @class */ (function () {
1008
1060
  if (!isNullOrUndefined(position)) {
1009
1061
  this.parent.setProperties({ editSettings: { newRowPosition: position } }, true);
1010
1062
  }
1011
- var updatedRecords = { addedRecords: addRecords, changedRecords: [], deletedRecords: [] };
1063
+ this.updatedRecords = { addedRecords: addRecords, changedRecords: [], deletedRecords: [] };
1064
+ var updatedRecords = this.updatedRecords;
1012
1065
  this.parent.notify(events.batchSave, { updatedRecords: updatedRecords, index: index });
1013
1066
  this.parent.setProperties({ editSettings: { mode: previousEditMode } }, true);
1014
1067
  this.parent.grid.setProperties({ editSettings: { mode: previousGridEditMode } }, true);
@@ -62,7 +62,7 @@ var Freeze = /** @class */ (function () {
62
62
  }
63
63
  var queryselector = args.action === 'e-childrow-hidden' ? '.e-treecolumn-container .e-treegridcollapse'
64
64
  : '.e-treecolumn-container .e-treegridexpand';
65
- if (frozenrows[row.rowIndex].querySelector(queryselector)) {
65
+ if (frozenrows[parseInt(row.getAttribute('aria-rowindex'), 10) - 1].querySelector(queryselector)) {
66
66
  var cRow = [];
67
67
  for (var i_1 = 0; i_1 < movableRows.length; i_1++) {
68
68
  if (movableRows[parseInt(i_1.toString(), 10)].querySelector('.e-gridrowindex' + rData.index + 'level' + (rData.level + 1))) {
@@ -205,6 +205,9 @@ var RowDD = /** @class */ (function () {
205
205
  this.selectedItem = isNullOrUndefined(record) ?
206
206
  tObj.getCurrentViewRecords()[parseInt(selectedItemIndex.toString(), 10)] : record;
207
207
  var primaryKeyField = this.parent.getPrimaryKeyFieldNames()[0];
208
+ if (!primaryKeyField) {
209
+ return;
210
+ }
208
211
  var rowIndex = this.parent.grid.getRowIndexByPrimaryKey(this.selectedItem["" + primaryKeyField]);
209
212
  this.selectedRow = this.parent[this.selectedRows] = selectedItemIndex !== -1 ?
210
213
  this.parent.getSelectedRows()[0]
@@ -1,4 +1,5 @@
1
1
  import { TreeGrid } from '../base/treegrid';
2
+ import { ITreeData } from '../base/interface';
2
3
  /**
3
4
  * TreeGrid Selection module
4
5
  *
@@ -11,41 +12,258 @@ export declare class Selection {
11
12
  private selectedIndexes;
12
13
  private filteredList;
13
14
  private searchingRecords;
15
+ private headerCheckboxFrameEl;
16
+ private checkboxColIndexCache;
17
+ private parentSelectionCounters;
18
+ private selectedUidMap;
19
+ private totalSelectableCount;
20
+ private headerSelectionState;
21
+ private checkedItemCount;
14
22
  /**
15
- * Constructor for Selection module
23
+ * Creates an instance of Selection.
16
24
  *
17
- * @param {TreeGrid} parent - Tree Grid instance
25
+ * @param {TreeGrid} parent - The TreeGrid instance this selection module is associated with.
18
26
  */
19
27
  constructor(parent: TreeGrid);
20
28
  /**
21
- * For internal use only - Get the module name.
29
+ * Gets the module name.
22
30
  *
23
- * @private
24
- * @returns {string} Returns Selection module name
31
+ * @returns {string} The name of the module ('selection').
25
32
  */
26
33
  private getModuleName;
34
+ private visibleUidIndex;
35
+ /**
36
+ * Builds a map from visible record uniqueID to its visible index.
37
+ * This map is crucial for finding the *current visible index* of a record.
38
+ *
39
+ * @returns {void}
40
+ */
41
+ private buildVisibleUidMap;
42
+ /**
43
+ * Adds required event listeners for selection handling.
44
+ *
45
+ * @returns {void}
46
+ */
27
47
  addEventListener(): void;
48
+ /**
49
+ * Removes previously added event listeners.
50
+ *
51
+ * @returns {void}
52
+ */
28
53
  removeEventListener(): void;
29
54
  /**
30
- * To destroy the Selection
55
+ * Destroys the selection module and clears internal caches.
31
56
  *
32
57
  * @returns {void}
33
- * @hidden
34
58
  */
35
59
  destroy(): void;
60
+ /**
61
+ * Handles checkbox click events from the DOM and dispatches selection logic.
62
+ *
63
+ * @param {Object} args - Event args containing the click target.
64
+ * @returns {void}
65
+ */
36
66
  private checkboxSelection;
67
+ /**
68
+ * Triggers the checkboxChange event with the appropriate arguments.
69
+ *
70
+ * @param {HTMLInputElement} checkBox - The checkbox input element that changed.
71
+ * @param {boolean} checkState - The new checked state.
72
+ * @param {HTMLTableRowElement} rowElement - The row element where the change occurred.
73
+ * @returns {void}
74
+ */
37
75
  private triggerChkChangeEvent;
76
+ /**
77
+ * Determines the index of the checkbox column in the header.
78
+ *
79
+ * @returns {number} The index of the checkbox column, or -1 if not found.
80
+ */
38
81
  private getCheckboxcolumnIndex;
82
+ /**
83
+ * Renders and initializes the header checkbox element.
84
+ *
85
+ * @returns {void}
86
+ */
39
87
  private headerCheckbox;
88
+ /**
89
+ * Renders a checkbox element for a column cell.
90
+ *
91
+ * @param {QueryCellInfoEventArgs} args - The QueryCellInfoEventArgs for the cell.
92
+ * @returns {Element} The rendered checkbox wrapper element.
93
+ */
40
94
  private renderColumnCheckbox;
95
+ /**
96
+ * Injects the checkbox into a column cell during QueryCellInfo.
97
+ *
98
+ * @param {QueryCellInfoEventArgs} container - The cell event args.
99
+ * @returns {void}
100
+ */
41
101
  private columnCheckbox;
102
+ /**
103
+ * Selects or toggles checkboxes for the provided row indexes.
104
+ *
105
+ * @param {number[]} rowIndexes - Array of row indexes to toggle selection for.
106
+ * @returns {void}
107
+ */
42
108
  selectCheckboxes(rowIndexes: number[]): void;
109
+ /**
110
+ * Traverses selection for a record and cascades selections to children/parents as necessary.
111
+ *
112
+ * @param {ITreeData} record - The record to process.
113
+ * @param {string} checkboxState - The desired checkbox state ('check'|'uncheck'|'indeterminate').
114
+ * @param {boolean} isChildItem - True if this invocation is for a child during recursion.
115
+ * @returns {void}
116
+ */
43
117
  private traverSelection;
118
+ /**
119
+ * Filters provided child records against the current filter result.
120
+ *
121
+ * @param {ITreeData[]} childRecords - The array of child records to filter.
122
+ * @returns {ITreeData[]} The filtered child records array.
123
+ */
44
124
  private getFilteredChildRecords;
125
+ /**
126
+ * Derives children for a record from flatData using the parentItem link.
127
+ * Used when childRecords is missing or empty.
128
+ *
129
+ * @param {ITreeData} record - The record for which to find child elements.
130
+ * @returns {ITreeData[]} An array of child records derived from flatData.
131
+ */
132
+ private getChildrenFromFlat;
133
+ /**
134
+ * Updates parent selection by rebuilding summary and applying deltas, then bubbling up if required.
135
+ *
136
+ * @param {ITreeData} parentRecord - The parent record reference.
137
+ * @param {string} [previousChildState] - Previous state of the child that changed.
138
+ * @param {string} [nextChildState] - Next state of the child that changed.
139
+ * @returns {void}
140
+ */
45
141
  private updateParentSelection;
142
+ /**
143
+ * Builds a selection summary for a record's children.
144
+ *
145
+ * @param {Object} record - The record whose children should be summarized.
146
+ * @param {boolean} [ignoreFilter] - If true, ignore current filter when computing summary.
147
+ * @returns {{ total: number, checked: number, indeterminate: number }} The computed summary.
148
+ */
149
+ private buildSelectionSummary;
150
+ /**
151
+ * Applies a delta to a selection summary based on a state change.
152
+ *
153
+ * @param {Object} summary - The summary to modify. Object with numeric properties: total, checked, indeterminate.
154
+ * @param {string} state - The state that changed ('check' | 'indeterminate').
155
+ * @param {number} delta - The delta to apply (e.g. +1 or -1).
156
+ * @returns {void}
157
+ */
158
+ private applySummaryDelta;
159
+ /**
160
+ * Derives the parent's checkbox state based on children summary counts.
161
+ *
162
+ * @param {ITreeData} record The parent record.
163
+ * @param {{ total: number, checked: number, indeterminate: number }} summary The children summary.
164
+ * @returns {'check'|'indeterminate'|'uncheck'} The derived checkbox state.
165
+ */
166
+ private deriveParentState;
167
+ /**
168
+ * Handles header checkbox (select all / clear all) behavior.
169
+ *
170
+ * @param {boolean} [checkAll] - Optional explicit flag to check or uncheck all.
171
+ * @returns {void}
172
+ */
46
173
  private headerSelection;
174
+ /**
175
+ * Finalizes parent states after a bulk header operation (e.g., Select All).
176
+ * This ensures parent states (checked/indeterminate) are correct after cascades.
177
+ *
178
+ * @param {ITreeData[]} records - The records that were processed in the bulk operation.
179
+ * @returns {void}
180
+ */
181
+ private finalizeParentsAfterBulk;
182
+ /**
183
+ * Processes header selection for each record, setting their state silently in the data model.
184
+ * Called during bulk operations like "select all".
185
+ *
186
+ * @param {ITreeData[]} records - The records to process.
187
+ * @param {string} targetState - The target state to set on each record.
188
+ * @returns {void}
189
+ */
190
+ private processHeaderSelection;
191
+ /**
192
+ * Rebuilds `selectedItems`, `selectedUidMap`, and `selectedIndexes` based on the current data states in the model.
193
+ * This method is called after bulk operations (like headerSelection, grid actions, etc.) to synchronize internal collections.
194
+ * It ensures `selectedItems` retains original selection order *as much as possible* for currently checked items
195
+ * and `selectedIndexes` reflects their *current visible order*.
196
+ *
197
+ * @param {ITreeData[]} records - The records that were processed (or the full data set if re-evaluating everything).
198
+ * @param {string} requestType - The data action type such as filtering, searching, refresh,etc.
199
+ * @returns {void}
200
+ */
201
+ private updateSelectedCollectionsAfterBulk;
202
+ /**
203
+ * Refreshes visible checkbox DOM elements to reflect the current data state.
204
+ * This method exclusively updates the UI representation of checkboxes.
205
+ *
206
+ * @returns {void}
207
+ */
208
+ private refreshVisibleCheckboxes;
209
+ /**
210
+ * Resets internal selection caches to their initial state.
211
+ * This is usually called before a bulk selection operation (like "select all").
212
+ *
213
+ * @returns {void}
214
+ */
215
+ resetSelectionCaches(): void;
216
+ /**
217
+ * Counts selectable (non-summary) records in the provided array.
218
+ *
219
+ * @param {ITreeData[]} records - The records to count.
220
+ * @returns {number} The number of selectable records.
221
+ */
222
+ private countSelectableRecords;
223
+ /**
224
+ * Resolves the list of records used for header selection operations (e.g., for `select all`).
225
+ *
226
+ * @param {boolean} [includeAll] - If true and data is local, returns flatData (all records for full dataset actions).
227
+ * @returns {ITreeData[]} The array of records to consider for header operations.
228
+ */
229
+ private resolveHeaderSelectionList;
230
+ /**
231
+ * Updates the header checkbox state (checked/indeterminate/unchecked) based on current selections.
232
+ *
233
+ * @returns {void}
234
+ */
235
+ private updateHeaderCheckboxState;
236
+ /**
237
+ * Updates selection arrays (selectedItems, selectedUidMap, selectedIndexes) and visible DOM for a single record.
238
+ * This is the core method for managing the state of a single checkbox.
239
+ *
240
+ * @param {ITreeData} currentRecord - The record to update.
241
+ * @param {string} checkState - The new checkbox state ('check' | 'uncheck' | 'indeterminate').
242
+ * @param {boolean} [silent] - If true, update is silent (only updates data model, no collection management or DOM update).
243
+ * @returns {void}
244
+ */
47
245
  private updateSelectedItems;
246
+ /**
247
+ * Handles various grid actions and updates selection state accordingly.
248
+ * This method ensures that selection state is maintained and UI is refreshed after grid operations.
249
+ *
250
+ * @param {CellSaveEventArgs} args - Action arguments containing requestType and data.
251
+ * @returns {void}
252
+ */
48
253
  private updateGridActions;
49
- getCheckedrecords(): Object[];
254
+ /**
255
+ * Retrieves checked record objects.
256
+ * This array maintains the `ITreeData` objects in the order they were selected.
257
+ *
258
+ * @returns {ITreeData[]} Array of checked records.
259
+ */
260
+ getCheckedrecords(): ITreeData[];
261
+ /**
262
+ * Retrieves visible indexes of checked rows in the current view, in the order they were selected.
263
+ * This method dynamically generates the list of visible indexes by iterating through `selectedItems`
264
+ * (which preserves selection order) and finding their *current* visible index.
265
+ *
266
+ * @returns {number[]} Array of checked row indexes in selection order.
267
+ */
50
268
  getCheckedRowIndexes(): number[];
51
269
  }