@ptsecurity/mosaic 14.10.2 → 14.10.4
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/autocomplete/autocomplete-trigger.directive.d.ts +1 -0
- package/esm2020/autocomplete/autocomplete-trigger.directive.mjs +11 -4
- 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-autocomplete.mjs +10 -3
- package/fesm2015/ptsecurity-mosaic-autocomplete.mjs.map +1 -1
- 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-autocomplete.mjs +10 -3
- package/fesm2020/ptsecurity-mosaic-autocomplete.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
@@ -346,7 +346,7 @@ class McTreeNodeToggleBaseDirective extends McTreeNodeToggleMixinBase {
|
|
346
346
|
this.treeNode = treeNode;
|
347
347
|
this._recursive = false;
|
348
348
|
this.tree.treeControl.filterValue
|
349
|
-
.pipe(map((value) => value
|
349
|
+
.pipe(map((value) => !!value && value.length > 0))
|
350
350
|
.subscribe((state) => this.disabled = state);
|
351
351
|
}
|
352
352
|
get recursive() {
|
@@ -929,61 +929,61 @@ class FlatTreeControl extends BaseTreeControl {
|
|
929
929
|
hasValue(value) {
|
930
930
|
return this.dataNodes.find((node) => this.compareValues(this.getValue(node), value));
|
931
931
|
}
|
932
|
-
filterNodes(value) {
|
932
|
+
filterNodes(value = null) {
|
933
933
|
this.saveExpansionState();
|
934
|
-
|
935
|
-
this.expansionModel.clear();
|
936
|
-
const filteredNodes = this.dataNodes
|
937
|
-
.filter((node) => this.compareViewValues(this.getViewValue(node), value));
|
934
|
+
const filteredNodes = [];
|
938
935
|
const filteredNodesWithTheirParents = new Set();
|
939
|
-
|
940
|
-
this.
|
941
|
-
.
|
936
|
+
for (const node of this.dataNodes) {
|
937
|
+
if (this.compareViewValues(this.getViewValue(node), value)) {
|
938
|
+
filteredNodes.push(node);
|
939
|
+
}
|
940
|
+
}
|
941
|
+
for (const filteredNode of filteredNodes) {
|
942
|
+
for (const node of this.getParents(filteredNode, [])) {
|
942
943
|
filteredNodesWithTheirParents.add(node);
|
943
|
-
|
944
|
-
});
|
944
|
+
}
|
945
945
|
filteredNodesWithTheirParents.add(filteredNode);
|
946
|
-
this.expandDataNode(filteredNode);
|
947
946
|
if (this.isExpandable(filteredNode)) {
|
948
947
|
const childNodeLevel = this.getLevel(filteredNode) + 1;
|
949
|
-
this.getDescendants(filteredNode)
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
});
|
948
|
+
for (const childNode of this.getDescendants(filteredNode)) {
|
949
|
+
if (this.getLevel(childNode) === childNodeLevel &&
|
950
|
+
(!this.isExpandable(childNode) || !this.hasFilteredDescendant(childNode, filteredNodes))) {
|
951
|
+
filteredNodesWithTheirParents.add(childNode);
|
952
|
+
}
|
953
|
+
}
|
956
954
|
}
|
957
|
-
}
|
955
|
+
}
|
956
|
+
this.filterModel.clear();
|
958
957
|
this.filterModel.select(...Array.from(filteredNodesWithTheirParents));
|
958
|
+
// set current expansion state according to filtered tree
|
959
|
+
this.expansionModel.setSelection(...Array.from(filteredNodesWithTheirParents).filter((node) => this.isExpandable(node)));
|
959
960
|
this.updateFilterValue(value);
|
960
961
|
this.restoreExpansionState();
|
961
962
|
}
|
962
963
|
updateFilterValue(value) {
|
963
964
|
Promise.resolve().then(() => this.filterValue.next(value));
|
964
965
|
}
|
965
|
-
expandDataNode(dataNode) {
|
966
|
-
if (this.isExpandable(dataNode)) {
|
967
|
-
this.expansionModel.select(dataNode);
|
968
|
-
}
|
969
|
-
}
|
970
966
|
saveExpansionState() {
|
971
|
-
if (this.filterValue.value
|
967
|
+
if (!this.filterValue.value) {
|
972
968
|
this.expandedItemsBeforeFiltration = this.expansionModel.selected;
|
973
969
|
}
|
974
970
|
}
|
975
971
|
restoreExpansionState() {
|
976
|
-
if (this.filterValue.value
|
977
|
-
this.expansionModel.
|
978
|
-
this.expansionModel.select(...this.expandedItemsBeforeFiltration);
|
972
|
+
if (!this.filterValue.value) {
|
973
|
+
this.expansionModel.setSelection(...this.expandedItemsBeforeFiltration);
|
979
974
|
}
|
980
975
|
}
|
981
976
|
hasFilteredDescendant(dataNode, filteredNodes) {
|
982
|
-
const filteredViewValues =
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
977
|
+
const filteredViewValues = [];
|
978
|
+
for (const node of filteredNodes) {
|
979
|
+
filteredViewValues.push(this.getViewValue(node));
|
980
|
+
}
|
981
|
+
for (const node of this.getDescendants(dataNode)) {
|
982
|
+
if (filteredViewValues.includes(this.getViewValue(node))) {
|
983
|
+
return true;
|
984
|
+
}
|
985
|
+
}
|
986
|
+
return false;
|
987
987
|
}
|
988
988
|
}
|
989
989
|
|