@syncfusion/ej2-treegrid 34.1.29 → 34.1.30

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 34.1.29
3
+ * version : 34.1.30
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-treegrid",
3
- "version": "34.1.29",
3
+ "version": "34.1.30",
4
4
  "description": "Essential JS 2 TreeGrid Component",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,9 +8,9 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-treegrid.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~34.1.29",
11
+ "@syncfusion/ej2-base": "~34.1.30",
12
12
  "@syncfusion/ej2-data": "~34.1.29",
13
- "@syncfusion/ej2-grids": "~34.1.29",
13
+ "@syncfusion/ej2-grids": "~34.1.30",
14
14
  "@syncfusion/ej2-popups": "~34.1.29"
15
15
  },
16
16
  "devDependencies": {},
@@ -57,6 +57,13 @@ export declare class Selection {
57
57
  * @returns {void}
58
58
  */
59
59
  destroy(): void;
60
+ /**
61
+ * Gets the actual record from the data model's uniqueIDCollection.
62
+ *
63
+ * @param {ITreeData} record - The record (may be stale reference).
64
+ * @returns {ITreeData} The actual record from the data model.
65
+ */
66
+ private getRecordFromUidCollection;
60
67
  /**
61
68
  * Handles checkbox click events from the DOM and dispatches selection logic.
62
69
  *
@@ -91,6 +91,20 @@ var Selection = /** @class */ (function () {
91
91
  this.resetSelectionCaches();
92
92
  this.removeEventListener();
93
93
  };
94
+ /**
95
+ * Gets the actual record from the data model's uniqueIDCollection.
96
+ *
97
+ * @param {ITreeData} record - The record (may be stale reference).
98
+ * @returns {ITreeData} The actual record from the data model.
99
+ */
100
+ Selection.prototype.getRecordFromUidCollection = function (record) {
101
+ if (!record) {
102
+ return record;
103
+ }
104
+ var uidMap = this.parent.uniqueIDCollection;
105
+ var uid = record.uniqueID;
106
+ return (uidMap && uid != null) ? (uidMap[String(uid)] ? uidMap[String(uid)] : record) : record;
107
+ };
94
108
  /**
95
109
  * Handles checkbox click events from the DOM and dispatches selection logic.
96
110
  *
@@ -117,8 +131,7 @@ var Selection = /** @class */ (function () {
117
131
  }
118
132
  else if (checkWrap && checkWrap.querySelectorAll('.e-treeselectall').length > 0 && this.parent.autoCheckHierarchy) {
119
133
  var frame = checkWrap.querySelector('.e-frame');
120
- var currentStateIsUncheck = !frame.classList.contains('e-check') && !frame.classList.contains('e-stop');
121
- var targetState = currentStateIsUncheck; // If currently uncheck, target state is to check all.
134
+ var targetState = frame.classList.contains('e-uncheck') || frame.classList.contains('e-stop');
122
135
  this.headerSelection(targetState);
123
136
  checkBox = checkWrap.querySelector('input[type="checkbox"]');
124
137
  this.triggerChkChangeEvent(checkBox, targetState, target.closest('tr'));
@@ -285,6 +298,7 @@ var Selection = /** @class */ (function () {
285
298
  var flatRec = getParentData(this.parent, viewRec.uniqueID);
286
299
  var nextState = (flatRec.checkboxState === 'check') ? 'uncheck' : 'check';
287
300
  flatRec.checkboxState = nextState;
301
+ viewRec.checkboxState = nextState;
288
302
  this.traverSelection(flatRec, nextState, false);
289
303
  }
290
304
  };
@@ -336,10 +350,11 @@ var Selection = /** @class */ (function () {
336
350
  if (child.hasChildRecords) {
337
351
  this.traverSelection(child, checkboxState, true);
338
352
  }
339
- if (child.checkboxState === 'check') {
353
+ var updatedChild = this.getRecordFromUidCollection(child);
354
+ if (updatedChild.checkboxState === 'check') {
340
355
  checkedCount++;
341
356
  }
342
- else if (child.checkboxState === 'indeterminate') {
357
+ else if (updatedChild.checkboxState === 'indeterminate') {
343
358
  indeterminateCount++;
344
359
  }
345
360
  }
@@ -463,11 +478,12 @@ var Selection = /** @class */ (function () {
463
478
  if (!child || child.isSummaryRow) {
464
479
  continue;
465
480
  }
481
+ var actualChild = this.getRecordFromUidCollection(child);
466
482
  summary.total++;
467
- if (child.checkboxState === 'check') {
483
+ if (actualChild.checkboxState === 'check') {
468
484
  summary.checked++;
469
485
  }
470
- else if (child.checkboxState === 'indeterminate') {
486
+ else if (actualChild.checkboxState === 'indeterminate') {
471
487
  summary.indeterminate++;
472
488
  }
473
489
  }
@@ -595,12 +611,13 @@ var Selection = /** @class */ (function () {
595
611
  if (!record) {
596
612
  continue;
597
613
  }
598
- var previousState = record.checkboxState;
614
+ var actualRecord = this.getRecordFromUidCollection(record);
615
+ var previousState = actualRecord.checkboxState;
599
616
  if (previousState === targetState) {
600
617
  continue;
601
618
  }
602
- record.checkboxState = targetState;
603
- this.updateSelectedItems(record, targetState, true);
619
+ actualRecord.checkboxState = targetState;
620
+ this.updateSelectedItems(actualRecord, targetState, true);
604
621
  }
605
622
  };
606
623
  /**
@@ -628,9 +645,10 @@ var Selection = /** @class */ (function () {
628
645
  if (item.hasChildRecords && isFilterOrSearch && item.level === 0 && this.parent.autoCheckHierarchy) {
629
646
  this.updateParentSelection(item);
630
647
  }
631
- if (item.uniqueID && item.checkboxState === 'check') {
632
- newSelectedItems.push(item);
633
- newSelectedUidMap.set(item.uniqueID, true);
648
+ var actualItem = this.getRecordFromUidCollection(item);
649
+ if (actualItem.uniqueID && actualItem.checkboxState === 'check') {
650
+ newSelectedItems.push(actualItem);
651
+ newSelectedUidMap.set(actualItem.uniqueID, true);
634
652
  }
635
653
  }
636
654
  if (!isFilterOrSearch) {
@@ -805,7 +823,8 @@ var Selection = /** @class */ (function () {
805
823
  var checkedCountForHeaderLogic = 0;
806
824
  for (var _i = 0, recordsForHeaderLogic_1 = recordsForHeaderLogic; _i < recordsForHeaderLogic_1.length; _i++) {
807
825
  var record = recordsForHeaderLogic_1[_i];
808
- if (record && !record.isSummaryRow && record.checkboxState === 'check') {
826
+ var actualRecord = this.getRecordFromUidCollection(record);
827
+ if (actualRecord && !actualRecord.isSummaryRow && actualRecord.checkboxState === 'check') {
809
828
  checkedCountForHeaderLogic++;
810
829
  }
811
830
  }