@arsedizioni/ars-utils 21.2.351 → 21.2.352
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.
|
@@ -2887,11 +2887,8 @@ class TreePickerComponent {
|
|
|
2887
2887
|
return this._isSelectableNode(node);
|
|
2888
2888
|
}
|
|
2889
2889
|
_isSelectableNode(node) {
|
|
2890
|
-
console.log('Checking if node is selectable:', node.id);
|
|
2891
2890
|
const depth = this._maps().depthMap.get(node.id) ?? 0;
|
|
2892
|
-
|
|
2893
|
-
console.log('Node', node.id, 'depth:', depth, 'selectable:', selectable);
|
|
2894
|
-
return selectable;
|
|
2891
|
+
return depth < this.maxDepth() || this._overrideSubtreeSet().has(node.id);
|
|
2895
2892
|
}
|
|
2896
2893
|
constructor() {
|
|
2897
2894
|
/** Nested tree data to display. */
|
|
@@ -2905,8 +2902,8 @@ class TreePickerComponent {
|
|
|
2905
2902
|
/** Maximum number of tree levels to display (default: 3). */
|
|
2906
2903
|
this.maxDepth = input(3, ...(ngDevMode ? [{ debugName: "maxDepth" }] : /* istanbul ignore next */ []));
|
|
2907
2904
|
/**
|
|
2908
|
-
* List of node IDs at depth >= maxDepth that
|
|
2909
|
-
*
|
|
2905
|
+
* List of node IDs at depth >= maxDepth that unlock selection for themselves
|
|
2906
|
+
* and all their descendants, regardless of depth.
|
|
2910
2907
|
*/
|
|
2911
2908
|
this.maxDepthOverrides = input([], ...(ngDevMode ? [{ debugName: "maxDepthOverrides" }] : /* istanbul ignore next */ []));
|
|
2912
2909
|
/**
|
|
@@ -2925,8 +2922,27 @@ class TreePickerComponent {
|
|
|
2925
2922
|
this.changed = output();
|
|
2926
2923
|
this._treeRef = viewChild((MatTree), ...(ngDevMode ? [{ debugName: "_treeRef" }] : /* istanbul ignore next */ []));
|
|
2927
2924
|
this._elRef = inject(ElementRef);
|
|
2928
|
-
/**
|
|
2929
|
-
|
|
2925
|
+
/**
|
|
2926
|
+
* Set of all node IDs selectable via overrides: each listed root and all its descendants.
|
|
2927
|
+
* Recomputed whenever the tree data or the override list changes.
|
|
2928
|
+
*/
|
|
2929
|
+
this._overrideSubtreeSet = computed(() => {
|
|
2930
|
+
const overrideIds = new Set(this.maxDepthOverrides());
|
|
2931
|
+
const maps = this._maps();
|
|
2932
|
+
const result = new Set();
|
|
2933
|
+
for (const id of overrideIds) {
|
|
2934
|
+
const root = maps.nodeMap.get(id);
|
|
2935
|
+
if (!root)
|
|
2936
|
+
continue;
|
|
2937
|
+
const addSubtree = (n) => {
|
|
2938
|
+
result.add(n.id);
|
|
2939
|
+
for (const child of (n.children ?? []))
|
|
2940
|
+
addSubtree(child);
|
|
2941
|
+
};
|
|
2942
|
+
addSubtree(root);
|
|
2943
|
+
}
|
|
2944
|
+
return result;
|
|
2945
|
+
}, ...(ngDevMode ? [{ debugName: "_overrideSubtreeSet" }] : /* istanbul ignore next */ []));
|
|
2930
2946
|
/** All three maps rebuilt lazily as a single computed whenever taxonomy changes. */
|
|
2931
2947
|
this._maps = computed(() => {
|
|
2932
2948
|
const parentMap = new Map();
|