@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.
- package/dist/ej2-treegrid.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +32 -13
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +32 -13
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +2 -2
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/treegrid/actions/selection.d.ts +7 -0
- package/src/treegrid/actions/selection.js +32 -13
|
@@ -970,6 +970,20 @@ class Selection {
|
|
|
970
970
|
this.resetSelectionCaches();
|
|
971
971
|
this.removeEventListener();
|
|
972
972
|
}
|
|
973
|
+
/**
|
|
974
|
+
* Gets the actual record from the data model's uniqueIDCollection.
|
|
975
|
+
*
|
|
976
|
+
* @param {ITreeData} record - The record (may be stale reference).
|
|
977
|
+
* @returns {ITreeData} The actual record from the data model.
|
|
978
|
+
*/
|
|
979
|
+
getRecordFromUidCollection(record) {
|
|
980
|
+
if (!record) {
|
|
981
|
+
return record;
|
|
982
|
+
}
|
|
983
|
+
const uidMap = this.parent.uniqueIDCollection;
|
|
984
|
+
const uid = record.uniqueID;
|
|
985
|
+
return (uidMap && uid != null) ? (uidMap[String(uid)] ? uidMap[String(uid)] : record) : record;
|
|
986
|
+
}
|
|
973
987
|
/**
|
|
974
988
|
* Handles checkbox click events from the DOM and dispatches selection logic.
|
|
975
989
|
*
|
|
@@ -995,8 +1009,7 @@ class Selection {
|
|
|
995
1009
|
}
|
|
996
1010
|
else if (checkWrap && checkWrap.querySelectorAll('.e-treeselectall').length > 0 && this.parent.autoCheckHierarchy) {
|
|
997
1011
|
const frame = checkWrap.querySelector('.e-frame');
|
|
998
|
-
const
|
|
999
|
-
const targetState = currentStateIsUncheck; // If currently uncheck, target state is to check all.
|
|
1012
|
+
const targetState = frame.classList.contains('e-uncheck') || frame.classList.contains('e-stop');
|
|
1000
1013
|
this.headerSelection(targetState);
|
|
1001
1014
|
checkBox = checkWrap.querySelector('input[type="checkbox"]');
|
|
1002
1015
|
this.triggerChkChangeEvent(checkBox, targetState, target.closest('tr'));
|
|
@@ -1163,6 +1176,7 @@ class Selection {
|
|
|
1163
1176
|
const flatRec = getParentData(this.parent, viewRec.uniqueID);
|
|
1164
1177
|
const nextState = (flatRec.checkboxState === 'check') ? 'uncheck' : 'check';
|
|
1165
1178
|
flatRec.checkboxState = nextState;
|
|
1179
|
+
viewRec.checkboxState = nextState;
|
|
1166
1180
|
this.traverSelection(flatRec, nextState, false);
|
|
1167
1181
|
}
|
|
1168
1182
|
}
|
|
@@ -1214,10 +1228,11 @@ class Selection {
|
|
|
1214
1228
|
if (child.hasChildRecords) {
|
|
1215
1229
|
this.traverSelection(child, checkboxState, true);
|
|
1216
1230
|
}
|
|
1217
|
-
|
|
1231
|
+
const updatedChild = this.getRecordFromUidCollection(child);
|
|
1232
|
+
if (updatedChild.checkboxState === 'check') {
|
|
1218
1233
|
checkedCount++;
|
|
1219
1234
|
}
|
|
1220
|
-
else if (
|
|
1235
|
+
else if (updatedChild.checkboxState === 'indeterminate') {
|
|
1221
1236
|
indeterminateCount++;
|
|
1222
1237
|
}
|
|
1223
1238
|
}
|
|
@@ -1340,11 +1355,12 @@ class Selection {
|
|
|
1340
1355
|
if (!child || child.isSummaryRow) {
|
|
1341
1356
|
continue;
|
|
1342
1357
|
}
|
|
1358
|
+
const actualChild = this.getRecordFromUidCollection(child);
|
|
1343
1359
|
summary.total++;
|
|
1344
|
-
if (
|
|
1360
|
+
if (actualChild.checkboxState === 'check') {
|
|
1345
1361
|
summary.checked++;
|
|
1346
1362
|
}
|
|
1347
|
-
else if (
|
|
1363
|
+
else if (actualChild.checkboxState === 'indeterminate') {
|
|
1348
1364
|
summary.indeterminate++;
|
|
1349
1365
|
}
|
|
1350
1366
|
}
|
|
@@ -1472,12 +1488,13 @@ class Selection {
|
|
|
1472
1488
|
if (!record) {
|
|
1473
1489
|
continue;
|
|
1474
1490
|
}
|
|
1475
|
-
const
|
|
1491
|
+
const actualRecord = this.getRecordFromUidCollection(record);
|
|
1492
|
+
const previousState = actualRecord.checkboxState;
|
|
1476
1493
|
if (previousState === targetState) {
|
|
1477
1494
|
continue;
|
|
1478
1495
|
}
|
|
1479
|
-
|
|
1480
|
-
this.updateSelectedItems(
|
|
1496
|
+
actualRecord.checkboxState = targetState;
|
|
1497
|
+
this.updateSelectedItems(actualRecord, targetState, true);
|
|
1481
1498
|
}
|
|
1482
1499
|
}
|
|
1483
1500
|
/**
|
|
@@ -1504,9 +1521,10 @@ class Selection {
|
|
|
1504
1521
|
if (item.hasChildRecords && isFilterOrSearch && item.level === 0 && this.parent.autoCheckHierarchy) {
|
|
1505
1522
|
this.updateParentSelection(item);
|
|
1506
1523
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1524
|
+
const actualItem = this.getRecordFromUidCollection(item);
|
|
1525
|
+
if (actualItem.uniqueID && actualItem.checkboxState === 'check') {
|
|
1526
|
+
newSelectedItems.push(actualItem);
|
|
1527
|
+
newSelectedUidMap.set(actualItem.uniqueID, true);
|
|
1510
1528
|
}
|
|
1511
1529
|
}
|
|
1512
1530
|
if (!isFilterOrSearch) {
|
|
@@ -1678,7 +1696,8 @@ class Selection {
|
|
|
1678
1696
|
this.totalSelectableCount = this.countSelectableRecords(recordsForHeaderLogic);
|
|
1679
1697
|
let checkedCountForHeaderLogic = 0;
|
|
1680
1698
|
for (const record of recordsForHeaderLogic) {
|
|
1681
|
-
|
|
1699
|
+
const actualRecord = this.getRecordFromUidCollection(record);
|
|
1700
|
+
if (actualRecord && !actualRecord.isSummaryRow && actualRecord.checkboxState === 'check') {
|
|
1682
1701
|
checkedCountForHeaderLogic++;
|
|
1683
1702
|
}
|
|
1684
1703
|
}
|