@c10t/nice-component-library 0.0.35 → 0.0.36
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.
|
@@ -83,7 +83,7 @@ export declare class CvaFlatTreeComponent implements ControlValueAccessor, OnIni
|
|
|
83
83
|
toggleTreeControl(treeControl: FlatTreeControl<FlatTreeNodeModel>, node: FlatTreeNodeModel): void;
|
|
84
84
|
toggleSelectedTree(node?: FlatTreeNodeModel): void;
|
|
85
85
|
onChangeSearchText(): void;
|
|
86
|
-
getDisplayTreeDataSource(dataOrigin: FlatTreeNodeModel[], copiedData: FlatTreeNodeModel[]):
|
|
86
|
+
getDisplayTreeDataSource(dataOrigin: FlatTreeNodeModel[], copiedData: FlatTreeNodeModel[]): void;
|
|
87
87
|
getCheckedSelectedTreeDataSource(dataOrigin: FlatTreeNodeModel[], copiedData: FlatTreeNodeModel[]): any[];
|
|
88
88
|
expandTreeDataSource(treeControl: FlatTreeControl<FlatTreeNodeModel>, expandProperty: 'isExpanded' | 'isFilterExpanded'): void;
|
|
89
89
|
onLeafNodeClick(node: FlatTreeNodeModel): void;
|
|
@@ -8533,38 +8533,32 @@ class CvaFlatTreeComponent {
|
|
|
8533
8533
|
}
|
|
8534
8534
|
getDisplayTreeDataSource(dataOrigin, copiedData) {
|
|
8535
8535
|
if (!Array.isArray(dataOrigin)) {
|
|
8536
|
-
return
|
|
8536
|
+
return;
|
|
8537
8537
|
}
|
|
8538
|
-
let copiedNode;
|
|
8539
8538
|
for (const node of dataOrigin) {
|
|
8540
|
-
copiedNode = {
|
|
8541
|
-
|
|
8542
|
-
children: [],
|
|
8543
|
-
};
|
|
8544
|
-
if (!node.children || !FlatTreeService.hasChild(node)) {
|
|
8545
|
-
node.display = node.displayValue.toLowerCase().includes(this.searchText.toLowerCase().trim())
|
|
8546
|
-
&& this.getDisplayInputFunc(node);
|
|
8547
|
-
if (node.display) {
|
|
8548
|
-
copiedData.push(node);
|
|
8549
|
-
}
|
|
8550
|
-
}
|
|
8551
|
-
else {
|
|
8539
|
+
const copiedNode = { ...node, children: [] };
|
|
8540
|
+
if (FlatTreeService.hasChild(node)) {
|
|
8552
8541
|
this.getDisplayTreeDataSource(node.children, copiedNode.children ? copiedNode.children : []);
|
|
8553
8542
|
// parent display
|
|
8554
|
-
node.display =
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8543
|
+
node.display = this.getDisplayInputFunc(node) &&
|
|
8544
|
+
(node.displayValue.toLowerCase().includes(this.searchText.toLowerCase().trim())
|
|
8545
|
+
|| node.children.some(childNode => childNode.display));
|
|
8546
|
+
const childDisplay = node.children.filter(child => child.display);
|
|
8547
|
+
node.checked = (childDisplay.length > 0 && childDisplay.every(childNode => childNode.checked))
|
|
8548
|
+
|| (childDisplay.length === 0 && this.value.includes(node.value));
|
|
8558
8549
|
copiedNode.display = node.display;
|
|
8559
8550
|
copiedNode.checked = node.checked;
|
|
8560
8551
|
if (node.display) {
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8552
|
+
copiedData.push(copiedNode);
|
|
8553
|
+
}
|
|
8554
|
+
console.log(this.value.includes(node.value), 'node', node, 'copiedNode', copiedNode);
|
|
8555
|
+
}
|
|
8556
|
+
else {
|
|
8557
|
+
node.display = node.displayValue.toLowerCase().includes(this.searchText.toLowerCase().trim())
|
|
8558
|
+
&& this.getDisplayInputFunc(node);
|
|
8559
|
+
node.checked = this.value.includes(node.value);
|
|
8560
|
+
if (node.display) {
|
|
8561
|
+
copiedData.push(node);
|
|
8568
8562
|
}
|
|
8569
8563
|
}
|
|
8570
8564
|
}
|