@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.
- package/README.md +16 -2
- 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 +1028 -588
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +1120 -608
- 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 +5 -5
- package/src/global.js +1 -1
- package/src/treegrid/actions/crud-actions.js +4 -9
- package/src/treegrid/actions/dom-virtualization.d.ts +66 -0
- package/src/treegrid/actions/dom-virtualization.js +240 -0
- package/src/treegrid/actions/edit.d.ts +1 -4
- package/src/treegrid/actions/edit.js +23 -191
- package/src/treegrid/actions/filter.js +1 -1
- package/src/treegrid/actions/index.d.ts +1 -0
- package/src/treegrid/actions/index.js +1 -0
- package/src/treegrid/actions/page.js +12 -6
- package/src/treegrid/actions/rowdragdrop.js +20 -1
- package/src/treegrid/actions/selection.d.ts +21 -0
- package/src/treegrid/actions/selection.js +197 -31
- package/src/treegrid/actions/toolbar.js +8 -5
- package/src/treegrid/base/constant.d.ts +4 -0
- package/src/treegrid/base/constant.js +4 -0
- package/src/treegrid/base/data.d.ts +17 -0
- package/src/treegrid/base/data.js +189 -132
- package/src/treegrid/base/treegrid-model.d.ts +35 -4
- package/src/treegrid/base/treegrid.d.ts +43 -7
- package/src/treegrid/base/treegrid.js +181 -73
- package/src/treegrid/enum.d.ts +12 -0
- package/src/treegrid/models/column.d.ts +2 -2
- package/src/treegrid/models/dom-virtualization-settings-model.d.ts +50 -0
- package/src/treegrid/models/dom-virtualization-settings.d.ts +43 -0
- package/src/treegrid/models/dom-virtualization-settings.js +47 -0
- package/src/treegrid/models/index.d.ts +2 -0
- package/src/treegrid/models/index.js +1 -0
- package/src/treegrid/models/summary-model.d.ts +1 -1
- package/src/treegrid/models/summary.d.ts +1 -1
- package/src/treegrid/renderer/dom-virtual-tree-content-renderer.d.ts +20 -0
- package/src/treegrid/renderer/dom-virtual-tree-content-renderer.js +49 -0
- package/src/treegrid/renderer/index.d.ts +1 -0
- package/src/treegrid/renderer/index.js +1 -0
- package/src/treegrid/renderer/render.js +4 -3
- package/src/treegrid/renderer/virtual-tree-content-render.js +1 -2
- package/helpers/e2e/index.d.ts +0 -1
- package/helpers/e2e/index.js +0 -8
- package/helpers/e2e/treegridhelper.d.ts +0 -21
- package/helpers/e2e/treegridhelper.js +0 -83
- package/styles/bds-lite.css +0 -402
- package/styles/bds-lite.scss +0 -3
- package/styles/bds.css +0 -422
- package/styles/bds.scss +0 -4
- package/styles/bootstrap-dark-lite.css +0 -406
- package/styles/bootstrap-dark-lite.scss +0 -3
- package/styles/bootstrap-dark.css +0 -426
- package/styles/bootstrap-dark.scss +0 -4
- package/styles/bootstrap-lite.css +0 -409
- package/styles/bootstrap-lite.scss +0 -3
- package/styles/bootstrap.css +0 -432
- package/styles/bootstrap.scss +0 -4
- package/styles/bootstrap4-lite.css +0 -406
- package/styles/bootstrap4-lite.scss +0 -3
- package/styles/bootstrap4.css +0 -426
- package/styles/bootstrap4.scss +0 -4
- package/styles/bootstrap5-dark-lite.css +0 -406
- package/styles/bootstrap5-dark-lite.scss +0 -3
- package/styles/bootstrap5-dark.css +0 -426
- package/styles/bootstrap5-dark.scss +0 -4
- package/styles/bootstrap5-lite.css +0 -406
- package/styles/bootstrap5-lite.scss +0 -3
- package/styles/bootstrap5.3-lite.css +0 -490
- package/styles/bootstrap5.3-lite.scss +0 -3
- package/styles/bootstrap5.3.css +0 -510
- package/styles/bootstrap5.3.scss +0 -4
- package/styles/bootstrap5.css +0 -426
- package/styles/bootstrap5.scss +0 -4
- package/styles/fabric-dark-lite.css +0 -409
- package/styles/fabric-dark-lite.scss +0 -3
- package/styles/fabric-dark.css +0 -432
- package/styles/fabric-dark.scss +0 -4
- package/styles/fabric-lite.css +0 -409
- package/styles/fabric-lite.scss +0 -3
- package/styles/fabric.css +0 -432
- package/styles/fabric.scss +0 -4
- package/styles/fluent-dark-lite.css +0 -417
- package/styles/fluent-dark-lite.scss +0 -3
- package/styles/fluent-dark.css +0 -444
- package/styles/fluent-dark.scss +0 -4
- package/styles/fluent-lite.css +0 -417
- package/styles/fluent-lite.scss +0 -3
- package/styles/fluent.css +0 -444
- package/styles/fluent.scss +0 -4
- package/styles/fluent2-lite.css +0 -507
- package/styles/fluent2-lite.scss +0 -3
- package/styles/fluent2.css +0 -531
- package/styles/fluent2.scss +0 -4
- package/styles/highcontrast-light-lite.css +0 -406
- package/styles/highcontrast-light-lite.scss +0 -3
- package/styles/highcontrast-light.css +0 -426
- package/styles/highcontrast-light.scss +0 -4
- package/styles/highcontrast-lite.css +0 -413
- package/styles/highcontrast-lite.scss +0 -3
- package/styles/highcontrast.css +0 -439
- package/styles/highcontrast.scss +0 -4
- package/styles/material-dark-lite.css +0 -406
- package/styles/material-dark-lite.scss +0 -3
- package/styles/material-dark.css +0 -426
- package/styles/material-dark.scss +0 -4
- package/styles/material-lite.css +0 -406
- package/styles/material-lite.scss +0 -3
- package/styles/material.css +0 -426
- package/styles/material.scss +0 -4
- package/styles/material3-dark-lite.css +0 -488
- package/styles/material3-dark-lite.scss +0 -3
- package/styles/material3-dark.css +0 -508
- package/styles/material3-dark.scss +0 -4
- package/styles/material3-lite.css +0 -490
- package/styles/material3-lite.scss +0 -3
- package/styles/material3.css +0 -510
- package/styles/material3.scss +0 -4
- package/styles/tailwind-dark-lite.css +0 -406
- package/styles/tailwind-dark-lite.scss +0 -3
- package/styles/tailwind-dark.css +0 -426
- package/styles/tailwind-dark.scss +0 -4
- package/styles/tailwind-lite.css +0 -406
- package/styles/tailwind-lite.scss +0 -3
- package/styles/tailwind.css +0 -426
- package/styles/tailwind.scss +0 -4
- package/styles/tailwind3-lite.css +0 -480
- package/styles/tailwind3-lite.scss +0 -3
- package/styles/tailwind3.css +0 -500
- package/styles/tailwind3.scss +0 -4
- package/styles/treegrid/_all.scss +0 -2
- package/styles/treegrid/_bds-definition.scss +0 -28
- package/styles/treegrid/_bigger.scss +0 -70
- package/styles/treegrid/_bootstrap-dark-definition.scss +0 -33
- package/styles/treegrid/_bootstrap-definition.scss +0 -33
- package/styles/treegrid/_bootstrap4-definition.scss +0 -33
- package/styles/treegrid/_bootstrap5-dark-definition.scss +0 -28
- package/styles/treegrid/_bootstrap5-definition.scss +0 -28
- package/styles/treegrid/_bootstrap5.3-definition.scss +0 -28
- package/styles/treegrid/_fabric-dark-definition.scss +0 -33
- package/styles/treegrid/_fabric-definition.scss +0 -33
- package/styles/treegrid/_fluent-dark-definition.scss +0 -29
- package/styles/treegrid/_fluent-definition.scss +0 -29
- package/styles/treegrid/_fluent2-definition.scss +0 -28
- package/styles/treegrid/_fusionnew-definition.scss +0 -26
- package/styles/treegrid/_highcontrast-definition.scss +0 -33
- package/styles/treegrid/_highcontrast-light-definition.scss +0 -33
- package/styles/treegrid/_icons.scss +0 -47
- package/styles/treegrid/_layout.scss +0 -531
- package/styles/treegrid/_material-dark-definition.scss +0 -33
- package/styles/treegrid/_material-definition.scss +0 -33
- package/styles/treegrid/_material3-dark-definition.scss +0 -28
- package/styles/treegrid/_material3-definition.scss +0 -28
- package/styles/treegrid/_tailwind-dark-definition.scss +0 -28
- package/styles/treegrid/_tailwind-definition.scss +0 -28
- package/styles/treegrid/_tailwind3-definition.scss +0 -28
- package/styles/treegrid/_theme.scss +0 -1
- package/styles/treegrid/_variables.scss +0 -2
- package/styles/treegrid/bds.css +0 -422
- package/styles/treegrid/bds.scss +0 -4
- package/styles/treegrid/bootstrap-dark.css +0 -426
- package/styles/treegrid/bootstrap-dark.scss +0 -4
- package/styles/treegrid/bootstrap.css +0 -432
- package/styles/treegrid/bootstrap.scss +0 -4
- package/styles/treegrid/bootstrap4.css +0 -426
- package/styles/treegrid/bootstrap4.scss +0 -4
- package/styles/treegrid/bootstrap5-dark.css +0 -426
- package/styles/treegrid/bootstrap5-dark.scss +0 -4
- package/styles/treegrid/bootstrap5.3.css +0 -510
- package/styles/treegrid/bootstrap5.3.scss +0 -4
- package/styles/treegrid/bootstrap5.css +0 -426
- package/styles/treegrid/bootstrap5.scss +0 -4
- package/styles/treegrid/fabric-dark.css +0 -432
- package/styles/treegrid/fabric-dark.scss +0 -4
- package/styles/treegrid/fabric.css +0 -432
- package/styles/treegrid/fabric.scss +0 -4
- package/styles/treegrid/fluent-dark.css +0 -444
- package/styles/treegrid/fluent-dark.scss +0 -4
- package/styles/treegrid/fluent.css +0 -444
- package/styles/treegrid/fluent.scss +0 -4
- package/styles/treegrid/fluent2.css +0 -531
- package/styles/treegrid/fluent2.scss +0 -4
- package/styles/treegrid/highcontrast-light.css +0 -426
- package/styles/treegrid/highcontrast-light.scss +0 -4
- package/styles/treegrid/highcontrast.css +0 -439
- package/styles/treegrid/highcontrast.scss +0 -4
- package/styles/treegrid/icons/_bds.scss +0 -38
- package/styles/treegrid/icons/_bootstrap-dark.scss +0 -48
- package/styles/treegrid/icons/_bootstrap.scss +0 -48
- package/styles/treegrid/icons/_bootstrap4.scss +0 -48
- package/styles/treegrid/icons/_bootstrap5-dark.scss +0 -1
- package/styles/treegrid/icons/_bootstrap5.3.scss +0 -48
- package/styles/treegrid/icons/_bootstrap5.scss +0 -48
- package/styles/treegrid/icons/_fabric-dark.scss +0 -48
- package/styles/treegrid/icons/_fabric.scss +0 -48
- package/styles/treegrid/icons/_fluent-dark.scss +0 -1
- package/styles/treegrid/icons/_fluent.scss +0 -48
- package/styles/treegrid/icons/_fluent2.scss +0 -48
- package/styles/treegrid/icons/_fusionnew.scss +0 -31
- package/styles/treegrid/icons/_highcontrast-light.scss +0 -48
- package/styles/treegrid/icons/_highcontrast.scss +0 -48
- package/styles/treegrid/icons/_material-dark.scss +0 -48
- package/styles/treegrid/icons/_material.scss +0 -48
- package/styles/treegrid/icons/_material3-dark.scss +0 -1
- package/styles/treegrid/icons/_material3.scss +0 -48
- package/styles/treegrid/icons/_tailwind-dark.scss +0 -48
- package/styles/treegrid/icons/_tailwind.scss +0 -48
- package/styles/treegrid/icons/_tailwind3.scss +0 -48
- package/styles/treegrid/material-dark.css +0 -426
- package/styles/treegrid/material-dark.scss +0 -4
- package/styles/treegrid/material.css +0 -426
- package/styles/treegrid/material.scss +0 -4
- package/styles/treegrid/material3-dark.css +0 -508
- package/styles/treegrid/material3-dark.scss +0 -4
- package/styles/treegrid/material3.css +0 -510
- package/styles/treegrid/material3.scss +0 -4
- package/styles/treegrid/tailwind-dark.css +0 -426
- package/styles/treegrid/tailwind-dark.scss +0 -4
- package/styles/treegrid/tailwind.css +0 -426
- package/styles/treegrid/tailwind.scss +0 -4
- package/styles/treegrid/tailwind3.css +0 -500
- 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
|
|
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);
|
|
@@ -209,6 +212,7 @@ var Selection = /** @class */ (function () {
|
|
|
209
212
|
var value = false; // Initial state can be false.
|
|
210
213
|
var rowChkBox = this.parent.createElement('input', { className: 'e-treeselectall', attrs: { 'type': '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 =
|
|
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
|
|
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
|
|
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
|
-
|
|
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,
|
|
645
|
-
var item =
|
|
646
|
-
if (item.hasChildRecords &&
|
|
647
|
-
this.
|
|
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
|
|
659
|
-
var record = allFlatData_1[
|
|
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
|
|
674
|
-
var item = _c
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|
|
@@ -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,5 @@ 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;
|
|
@@ -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,5 @@ 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';
|
|
@@ -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
|