@cqsjjb/jjb-react-admin-component 3.3.1-beta.4 → 3.3.1-beta.5
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/AdaptiveTree/index.js +3 -2
- package/package.json +1 -1
package/AdaptiveTree/index.js
CHANGED
|
@@ -109,6 +109,7 @@ export default props => {
|
|
|
109
109
|
|
|
110
110
|
// 获得指定索引的节点 ID
|
|
111
111
|
const getLevelIndexNodeIds = (targetIndexArr, key) => {
|
|
112
|
+
const children = props?.fieldNames?.children || 'children';
|
|
112
113
|
const pathNodes = [];
|
|
113
114
|
const pathNodesIds = [];
|
|
114
115
|
let currentData = props.treeData || [];
|
|
@@ -121,10 +122,10 @@ export default props => {
|
|
|
121
122
|
}
|
|
122
123
|
nextNode = currentData[index];
|
|
123
124
|
} else {
|
|
124
|
-
if (!currentData?.children || !Array.isArray(currentData
|
|
125
|
+
if (!currentData?.[children] || !Array.isArray(currentData[children]) || index < 0 || index >= currentData[children].length) {
|
|
125
126
|
return null;
|
|
126
127
|
}
|
|
127
|
-
nextNode = currentData
|
|
128
|
+
nextNode = currentData?.[children][index];
|
|
128
129
|
}
|
|
129
130
|
pathNodes.push(nextNode);
|
|
130
131
|
pathNodesIds.push(nextNode[key]);
|