zy-react-library 1.0.147 → 1.0.148
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TreeSelect } from "antd";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { getTreeNodePaths, processTreeDataByLevel, processTreeDataForOnlyLastLevel } from "../../../utils";
|
|
3
|
+
import { arrayObjectDeduplication, getDataType, getTreeNodePaths, processTreeDataByLevel, processTreeDataForOnlyLastLevel } from "../../../utils";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 基础下拉树组件(不建议直接使用此组件,二次继承使用)
|
|
@@ -37,6 +37,22 @@ function BasicSelectTree(props) {
|
|
|
37
37
|
|
|
38
38
|
const handleChange = (value, label, extra) => {
|
|
39
39
|
if (value) {
|
|
40
|
+
if (getDataType(value) === "Array") {
|
|
41
|
+
const parentNodes = [];
|
|
42
|
+
for (let i = 0; i < value.length; i++) {
|
|
43
|
+
const currentParentNodes = getTreeNodePaths({
|
|
44
|
+
data: treeData,
|
|
45
|
+
targetId: value[i],
|
|
46
|
+
idKey,
|
|
47
|
+
childrenKey,
|
|
48
|
+
isIncludeOneself: onGetNodePathsIsIncludeOneself,
|
|
49
|
+
});
|
|
50
|
+
parentNodes.push(...currentParentNodes);
|
|
51
|
+
}
|
|
52
|
+
onGetNodePaths?.(arrayObjectDeduplication(parentNodes, idKey));
|
|
53
|
+
onGetLabel?.(label);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
40
56
|
const parentNodes = getTreeNodePaths({
|
|
41
57
|
data: treeData,
|
|
42
58
|
targetId: value,
|
package/hooks/useTable/index.js
CHANGED