@smartbit4all/ng-client 3.1.63 → 3.1.65
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/esm2020/lib/smart-grid/api/grid-api/model/gridRow.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridViewDescriptor.mjs +1 -1
- package/esm2020/lib/smart-grid/smart-grid.component.mjs +49 -21
- package/fesm2015/smartbit4all-ng-client.mjs +48 -18
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +48 -20
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-grid/api/grid-api/model/gridRow.d.ts +0 -4
- package/lib/smart-grid/smart-grid.component.d.ts +2 -1
- package/package.json +1 -1
- package/smartbit4all-ng-client-3.1.65.tgz +0 -0
- package/smartbit4all-ng-client-3.1.63.tgz +0 -0
|
@@ -11217,23 +11217,43 @@ class SmartGridComponent {
|
|
|
11217
11217
|
renderCards() {
|
|
11218
11218
|
// TODO
|
|
11219
11219
|
}
|
|
11220
|
+
isMultipleSelection() {
|
|
11221
|
+
const selectionMode = this.service.gridModel.view?.descriptor?.selectionMode;
|
|
11222
|
+
return selectionMode === GridSelectionMode.Multiple;
|
|
11223
|
+
}
|
|
11220
11224
|
renderTree() {
|
|
11221
11225
|
if (!this.treeDataSource) {
|
|
11222
11226
|
this.treeFlattener = new MatTreeFlattener(this.transformer, this.getLevel, this.isExpandable, this.getChildren);
|
|
11223
11227
|
this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);
|
|
11224
11228
|
this.treeDataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11229
|
+
this.treeChecklistSelection = new SelectionModel(this.isMultipleSelection());
|
|
11230
|
+
}
|
|
11231
|
+
let nodes = this.treeControl?.dataNodes;
|
|
11232
|
+
let expandedNodes;
|
|
11233
|
+
if (nodes) {
|
|
11234
|
+
expandedNodes = nodes
|
|
11235
|
+
.filter((node) => this.treeControl?.isExpandable(node))
|
|
11236
|
+
.filter((node) => this.treeControl?.isExpanded(node))
|
|
11237
|
+
.map((node) => node.id);
|
|
11238
|
+
}
|
|
11239
|
+
else {
|
|
11240
|
+
expandedNodes = [];
|
|
11228
11241
|
}
|
|
11242
|
+
this.smartGrid.gridModel.page.rows.forEach((row) => (row.level = undefined));
|
|
11229
11243
|
this.treeDataSource.data = this.smartGrid.gridModel.page.rows.filter((row) => !row.parent);
|
|
11230
|
-
// TODO handle and set expansion..
|
|
11231
11244
|
this.treeChecklistSelection?.clear();
|
|
11232
11245
|
this.treeControl?.dataNodes.forEach((node) => {
|
|
11233
11246
|
if (node.selected) {
|
|
11234
11247
|
this.treeChecklistSelection?.select(node);
|
|
11235
11248
|
}
|
|
11236
11249
|
});
|
|
11250
|
+
this.treeControl?.collapseAll();
|
|
11251
|
+
expandedNodes.forEach((rowId) => {
|
|
11252
|
+
let row = this.treeControl?.dataNodes.find((row) => rowId === row.id);
|
|
11253
|
+
if (row) {
|
|
11254
|
+
this.treeControl?.expand(row);
|
|
11255
|
+
}
|
|
11256
|
+
});
|
|
11237
11257
|
}
|
|
11238
11258
|
getTreeItem(row) {
|
|
11239
11259
|
let columns = this.smartGrid?.gridModel.view?.orderedColumnNames;
|
|
@@ -11250,20 +11270,25 @@ class SmartGridComponent {
|
|
|
11250
11270
|
}
|
|
11251
11271
|
let selectionBefore = this.treeChecklistSelection.selected.map((row) => row.id);
|
|
11252
11272
|
this.treeChecklistSelection.toggle(node);
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
11257
|
-
|
|
11273
|
+
if (this.isMultipleSelection()) {
|
|
11274
|
+
const descendants = this.treeControl.getDescendants(node);
|
|
11275
|
+
this.treeChecklistSelection.isSelected(node)
|
|
11276
|
+
? this.treeChecklistSelection.select(...descendants)
|
|
11277
|
+
: this.treeChecklistSelection.deselect(...descendants);
|
|
11278
|
+
this.checkAllParentsSelection(node);
|
|
11279
|
+
}
|
|
11258
11280
|
let selectionAfter = this.treeChecklistSelection.selected.map((row) => row.id);
|
|
11259
11281
|
let selectedIds = selectionAfter.filter((s) => !selectionBefore.includes(s));
|
|
11260
11282
|
let unselectedIds = selectionBefore.filter((s) => !selectionAfter.includes(s));
|
|
11261
|
-
this.
|
|
11262
|
-
|
|
11263
|
-
.
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
.
|
|
11283
|
+
if (this.dev) {
|
|
11284
|
+
// when service call is active (!dev), onSelect will toggle row.selected
|
|
11285
|
+
this.service.gridModel.page.rows
|
|
11286
|
+
?.filter((row) => selectedIds.includes(row.id))
|
|
11287
|
+
.forEach((row) => (row.selected = true));
|
|
11288
|
+
this.service.gridModel.page.rows
|
|
11289
|
+
?.filter((row) => unselectedIds.includes(row.id))
|
|
11290
|
+
.forEach((row) => (row.selected = false));
|
|
11291
|
+
}
|
|
11267
11292
|
let union = selectedIds.concat(unselectedIds);
|
|
11268
11293
|
this.onSelectList(union);
|
|
11269
11294
|
}
|
|
@@ -11497,9 +11522,7 @@ class SmartGridComponent {
|
|
|
11497
11522
|
}
|
|
11498
11523
|
}
|
|
11499
11524
|
async onSelect(rowId) {
|
|
11500
|
-
this.
|
|
11501
|
-
this.selectRowInternal(rowId);
|
|
11502
|
-
this.refresh();
|
|
11525
|
+
this.onSelectList([rowId]);
|
|
11503
11526
|
}
|
|
11504
11527
|
async selectRowInternal(rowId) {
|
|
11505
11528
|
const row = this.service.gridModel.page.rows?.find((gridRow) => gridRow.id === rowId);
|
|
@@ -11508,8 +11531,13 @@ class SmartGridComponent {
|
|
|
11508
11531
|
}
|
|
11509
11532
|
async onSelectList(rowIds) {
|
|
11510
11533
|
this.isBlocked = true;
|
|
11511
|
-
|
|
11512
|
-
|
|
11534
|
+
if (this.dev) {
|
|
11535
|
+
this.render();
|
|
11536
|
+
}
|
|
11537
|
+
else {
|
|
11538
|
+
rowIds.forEach((rowId) => this.selectRowInternal(rowId));
|
|
11539
|
+
this.refresh();
|
|
11540
|
+
}
|
|
11513
11541
|
}
|
|
11514
11542
|
async onSelectAll(selected) {
|
|
11515
11543
|
this.isBlocked = true;
|