xh-lab-rc 0.18.2 → 0.18.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.
|
@@ -13,6 +13,7 @@ export interface ILabOperateTree {
|
|
|
13
13
|
leafOperateListElement?: React.ReactElement;
|
|
14
14
|
onSelect?: (node: INode) => void;
|
|
15
15
|
onCheckChange?: (checkedKeys: any, info: any) => void;
|
|
16
|
+
onOpenPopover?: (info: any) => void;
|
|
16
17
|
iconElementByNodeType?: {
|
|
17
18
|
'2'?: React.ReactElement;
|
|
18
19
|
'4'?: React.ReactElement;
|
|
@@ -149,6 +149,10 @@ var LabOperateTree = function LabOperateTree() {
|
|
|
149
149
|
}, props.leafOperateListElement),
|
|
150
150
|
open: openMarkData[v.SOURCE_PATH],
|
|
151
151
|
onOpenChange: function onOpenChange(newOpen) {
|
|
152
|
+
if (newOpen) {
|
|
153
|
+
var _props$onOpenPopover;
|
|
154
|
+
props === null || props === void 0 || (_props$onOpenPopover = props.onOpenPopover) === null || _props$onOpenPopover === void 0 || _props$onOpenPopover.call(props, v);
|
|
155
|
+
}
|
|
152
156
|
initOperateTree(_toConsumableArray(props.treeData), _defineProperty({}, v.SOURCE_PATH, newOpen));
|
|
153
157
|
},
|
|
154
158
|
trigger: "click",
|
|
@@ -171,7 +175,7 @@ var LabOperateTree = function LabOperateTree() {
|
|
|
171
175
|
setOperateTreeData(newTreeData);
|
|
172
176
|
};
|
|
173
177
|
|
|
174
|
-
//
|
|
178
|
+
// 选择第一个和展开收起
|
|
175
179
|
useEffect(function () {
|
|
176
180
|
var _props$treeData;
|
|
177
181
|
if (((_props$treeData = props.treeData) === null || _props$treeData === void 0 ? void 0 : _props$treeData.length) > 0) {
|
|
@@ -179,22 +183,17 @@ var LabOperateTree = function LabOperateTree() {
|
|
|
179
183
|
initOperateTree(props.treeData, openMarkData);
|
|
180
184
|
setSelectedKeys([leafItemTreeList === null || leafItemTreeList === void 0 || (_leafItemTreeList$3 = leafItemTreeList[0]) === null || _leafItemTreeList$3 === void 0 ? void 0 : _leafItemTreeList$3.SOURCE_PATH]);
|
|
181
185
|
props === null || props === void 0 || (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 || _props$onSelect.call(props, leafItemTreeList === null || leafItemTreeList === void 0 ? void 0 : leafItemTreeList[0]);
|
|
182
|
-
if (
|
|
186
|
+
if ((props === null || props === void 0 ? void 0 : props.expandAll) === undefined) {
|
|
183
187
|
setExpandKeys(expandKeysList);
|
|
188
|
+
} else if ((props === null || props === void 0 ? void 0 : props.expandAll) === false) {
|
|
189
|
+
setExpandKeys([]);
|
|
190
|
+
} else if ((props === null || props === void 0 ? void 0 : props.expandAll) === true) {
|
|
191
|
+
setExpandKeys(allItemTreeList.map(function (v) {
|
|
192
|
+
return v.SOURCE_PATH;
|
|
193
|
+
}));
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
|
-
}, [props.treeData, props.showIcon, props.showOperateIcon]);
|
|
187
|
-
|
|
188
|
-
// 展开收起
|
|
189
|
-
useEffect(function () {
|
|
190
|
-
if (!(props !== null && props !== void 0 && props.expandAll)) {
|
|
191
|
-
setExpandKeys([]);
|
|
192
|
-
} else {
|
|
193
|
-
setExpandKeys(allItemTreeList.map(function (v) {
|
|
194
|
-
return v.SOURCE_PATH;
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
}, [props.expandAll]);
|
|
196
|
+
}, [props.treeData, props.showIcon, props.showOperateIcon, props.expandAll]);
|
|
198
197
|
|
|
199
198
|
// 受控勾选
|
|
200
199
|
useEffect(function () {
|