@ptsecurity/mosaic 14.10.1 → 14.10.3
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/core/version.mjs +2 -2
- package/esm2020/tree/control/base-tree-control.mjs +1 -1
- package/esm2020/tree/control/flat-tree-control.mjs +34 -34
- package/esm2020/tree/control/tree-control.mjs +1 -1
- package/esm2020/tree/toggle.mjs +2 -2
- package/fesm2015/ptsecurity-mosaic-core.mjs +1 -1
- package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tree.mjs +34 -34
- package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-core.mjs +1 -1
- package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-tree.mjs +34 -34
- package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
- package/package.json +4 -4
- package/tree/control/base-tree-control.d.ts +1 -1
- package/tree/control/flat-tree-control.d.ts +1 -2
- package/tree/control/tree-control.d.ts +1 -1
@@ -348,7 +348,7 @@ class McTreeNodeToggleBaseDirective extends McTreeNodeToggleMixinBase {
|
|
348
348
|
this.treeNode = treeNode;
|
349
349
|
this._recursive = false;
|
350
350
|
this.tree.treeControl.filterValue
|
351
|
-
.pipe(map((value) =>
|
351
|
+
.pipe(map((value) => !!value && value.length > 0))
|
352
352
|
.subscribe((state) => this.disabled = state);
|
353
353
|
}
|
354
354
|
get recursive() {
|
@@ -1520,61 +1520,61 @@ class FlatTreeControl extends BaseTreeControl {
|
|
1520
1520
|
hasValue(value) {
|
1521
1521
|
return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
|
1522
1522
|
}
|
1523
|
-
filterNodes(value) {
|
1523
|
+
filterNodes(value = null) {
|
1524
1524
|
this.saveExpansionState();
|
1525
|
-
|
1526
|
-
this.expansionModel.clear();
|
1527
|
-
const filteredNodes = this.dataNodes
|
1528
|
-
.filter((node) => this.compareViewValues(this.getViewValue(node), value));
|
1525
|
+
const filteredNodes = [];
|
1529
1526
|
const filteredNodesWithTheirParents = new Set();
|
1530
|
-
|
1531
|
-
this.
|
1532
|
-
.
|
1527
|
+
for (const node of this.dataNodes) {
|
1528
|
+
if (this.compareViewValues(this.getViewValue(node), value)) {
|
1529
|
+
filteredNodes.push(node);
|
1530
|
+
}
|
1531
|
+
}
|
1532
|
+
for (const filteredNode of filteredNodes) {
|
1533
|
+
for (const node of this.getParents(filteredNode, [])) {
|
1533
1534
|
filteredNodesWithTheirParents.add(node);
|
1534
|
-
|
1535
|
-
});
|
1535
|
+
}
|
1536
1536
|
filteredNodesWithTheirParents.add(filteredNode);
|
1537
|
-
this.expandDataNode(filteredNode);
|
1538
1537
|
if (this.isExpandable(filteredNode)) {
|
1539
1538
|
const childNodeLevel = this.getLevel(filteredNode) + 1;
|
1540
|
-
this.getDescendants(filteredNode)
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
});
|
1539
|
+
for (const childNode of this.getDescendants(filteredNode)) {
|
1540
|
+
if (this.getLevel(childNode) === childNodeLevel &&
|
1541
|
+
(!this.isExpandable(childNode) || !this.hasFilteredDescendant(childNode, filteredNodes))) {
|
1542
|
+
filteredNodesWithTheirParents.add(childNode);
|
1543
|
+
}
|
1544
|
+
}
|
1547
1545
|
}
|
1548
|
-
}
|
1546
|
+
}
|
1547
|
+
this.filterModel.clear();
|
1549
1548
|
this.filterModel.select(...Array.from(filteredNodesWithTheirParents));
|
1549
|
+
// set current expansion state according to filtered tree
|
1550
|
+
this.expansionModel.setSelection(...Array.from(filteredNodesWithTheirParents).filter((node) => this.isExpandable(node)));
|
1550
1551
|
this.updateFilterValue(value);
|
1551
1552
|
this.restoreExpansionState();
|
1552
1553
|
}
|
1553
1554
|
updateFilterValue(value) {
|
1554
1555
|
Promise.resolve().then(() => this.filterValue.next(value));
|
1555
1556
|
}
|
1556
|
-
expandDataNode(dataNode) {
|
1557
|
-
if (this.isExpandable(dataNode)) {
|
1558
|
-
this.expansionModel.select(dataNode);
|
1559
|
-
}
|
1560
|
-
}
|
1561
1557
|
saveExpansionState() {
|
1562
|
-
if (this.filterValue.value
|
1558
|
+
if (!this.filterValue.value) {
|
1563
1559
|
this.expandedItemsBeforeFiltration = this.expansionModel.selected;
|
1564
1560
|
}
|
1565
1561
|
}
|
1566
1562
|
restoreExpansionState() {
|
1567
|
-
if (this.filterValue.value
|
1568
|
-
this.expansionModel.
|
1569
|
-
this.expansionModel.select(...this.expandedItemsBeforeFiltration);
|
1563
|
+
if (!this.filterValue.value) {
|
1564
|
+
this.expansionModel.setSelection(...this.expandedItemsBeforeFiltration);
|
1570
1565
|
}
|
1571
1566
|
}
|
1572
1567
|
hasFilteredDescendant(dataNode, filteredNodes) {
|
1573
|
-
const filteredViewValues =
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1568
|
+
const filteredViewValues = [];
|
1569
|
+
for (const node of filteredNodes) {
|
1570
|
+
filteredViewValues.push(this.getViewValue(node));
|
1571
|
+
}
|
1572
|
+
for (const node of this.getDescendants(dataNode)) {
|
1573
|
+
if (filteredViewValues.includes(this.getViewValue(node))) {
|
1574
|
+
return true;
|
1575
|
+
}
|
1576
|
+
}
|
1577
|
+
return false;
|
1578
1578
|
}
|
1579
1579
|
}
|
1580
1580
|
|