@riil-frontend/component-topology 2.12.4 → 2.12.6-alpha.0
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/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +28 -28
- package/es/components/Link/index.module.scss +2 -2
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/components/SingleResourceDrawer/SingleResourceDrawer.js +58 -0
- package/es/components/SingleResourceDrawer/index.js +2 -52
- package/es/core/components/TopoView/topoView.js +7 -23
- package/es/core/editor/components/EditorPlugin.js +2 -1
- package/es/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
- package/es/core/editor/components/resource/SingleResourceDrawer/SelectDrawer.js +54 -0
- package/es/core/editor/components/resource/SingleResourceDrawer/SingleResourceDrawer.js +58 -0
- package/es/core/editor/components/resource/SingleResourceDrawer/index.js +2 -0
- package/es/core/editor/components/settings/common/GroupNodeList/ResourceList.js +1 -1
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
- package/es/core/editor/components/settings/group/DataTab/GroupNodeList.js +1 -1
- package/es/core/editor/components/settings/group/DataTab/RelateData.js +2 -1
- package/es/core/editor/components/settings/node/NodePropertyView.js +1 -1
- package/es/core/editor/components/settings/node/data/BindResourceDrawer.js +65 -0
- package/es/core/editor/components/settings/node/data/NodeRelateResourceButton.js +41 -0
- package/es/hooks/useSelection.js +4 -3
- package/es/hooks/useTopoEdit.js +172 -143
- package/es/models/topoCreateMod.js +5 -0
- package/es/models/topoMod.js +45 -43
- package/es/style.js +3 -6
- package/es/utils/htElementUtils.js +25 -1
- package/lib/components/Link/index.module.scss +2 -2
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/components/SingleResourceDrawer/SingleResourceDrawer.js +72 -0
- package/lib/components/SingleResourceDrawer/index.js +2 -57
- package/lib/core/components/TopoView/topoView.js +7 -23
- package/lib/core/editor/components/EditorPlugin.js +2 -1
- package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
- package/lib/core/editor/components/resource/SingleResourceDrawer/SelectDrawer.js +68 -0
- package/lib/core/editor/components/resource/SingleResourceDrawer/SingleResourceDrawer.js +72 -0
- package/lib/core/editor/components/resource/SingleResourceDrawer/index.js +11 -0
- package/lib/core/editor/components/settings/common/GroupNodeList/ResourceList.js +1 -3
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
- package/lib/core/editor/components/settings/group/DataTab/GroupNodeList.js +1 -1
- package/lib/core/editor/components/settings/group/DataTab/RelateData.js +2 -1
- package/lib/core/editor/components/settings/node/NodePropertyView.js +1 -1
- package/lib/core/editor/components/settings/node/data/BindResourceDrawer.js +79 -0
- package/lib/core/editor/components/settings/node/data/NodeRelateResourceButton.js +54 -0
- package/lib/hooks/useSelection.js +4 -3
- package/lib/hooks/useTopoEdit.js +174 -144
- package/lib/models/topoCreateMod.js +5 -0
- package/lib/models/topoMod.js +45 -43
- package/lib/style.js +3 -6
- package/lib/utils/htElementUtils.js +27 -1
- package/package.json +15 -15
- package/CHANGELOG.md +0 -26
- package/es/core/editor/components/settings/node/NodeRelateResourceButton.js +0 -22
- package/lib/core/editor/components/settings/node/NodeRelateResourceButton.js +0 -31
|
@@ -35,7 +35,7 @@ function ResourceSelectDrawer(props) {
|
|
|
35
35
|
setLoading(true);
|
|
36
36
|
selected = resourceSelectRef.current.getSelectedRowKeys();
|
|
37
37
|
_context.next = 4;
|
|
38
|
-
return onOk(selected);
|
|
38
|
+
return onOk(selectionMode === 'single' ? selected[0] : selected);
|
|
39
39
|
|
|
40
40
|
case 4:
|
|
41
41
|
shouldClose = _context.sent;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _Message from "@alifd/next/lib/message";
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import { isAvailableArray } from '@riil-frontend/utils';
|
|
4
|
+
import Drawer from "../Drawer";
|
|
5
|
+
import ResourceList from "../ResourceList";
|
|
6
|
+
/**
|
|
7
|
+
* 旧版单选
|
|
8
|
+
* @param props
|
|
9
|
+
* @return {*}
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var SingleResourceDrawer = function SingleResourceDrawer(props) {
|
|
14
|
+
var store = props.store,
|
|
15
|
+
visible = props.visible,
|
|
16
|
+
loading = props.loading,
|
|
17
|
+
selectedKey = props.selectedKey,
|
|
18
|
+
totalSelection = props.totalSelection,
|
|
19
|
+
onSave = props.onSave,
|
|
20
|
+
onClose = props.onClose;
|
|
21
|
+
var ref = useRef();
|
|
22
|
+
|
|
23
|
+
var onDrawerSave = function onDrawerSave() {
|
|
24
|
+
var data = ref.current.getSelectedData();
|
|
25
|
+
|
|
26
|
+
if (!isAvailableArray(data)) {
|
|
27
|
+
_Message.error('请选择一项资源。');
|
|
28
|
+
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var intercept = onSave(data[0]);
|
|
33
|
+
|
|
34
|
+
if (!intercept) {
|
|
35
|
+
onClose();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var initialData = {
|
|
40
|
+
selected: [selectedKey],
|
|
41
|
+
total: totalSelection
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement(Drawer, {
|
|
44
|
+
title: "\u9009\u62E9\u8D44\u6E90",
|
|
45
|
+
visible: visible,
|
|
46
|
+
loading: loading,
|
|
47
|
+
onSave: onDrawerSave,
|
|
48
|
+
onClose: onClose,
|
|
49
|
+
buttons: ['确定', '取消']
|
|
50
|
+
}, /*#__PURE__*/React.createElement(ResourceList, {
|
|
51
|
+
ref: ref,
|
|
52
|
+
store: store,
|
|
53
|
+
initialData: initialData,
|
|
54
|
+
selectionMode: "single"
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default SingleResourceDrawer;
|
|
@@ -1,52 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { isAvailableArray } from '@riil-frontend/utils';
|
|
4
|
-
import Drawer from "../Drawer";
|
|
5
|
-
import ResourceList from "../ResourceList";
|
|
6
|
-
|
|
7
|
-
var SingleResourceDrawer = function SingleResourceDrawer(props) {
|
|
8
|
-
var store = props.store,
|
|
9
|
-
visible = props.visible,
|
|
10
|
-
loading = props.loading,
|
|
11
|
-
selectedKey = props.selectedKey,
|
|
12
|
-
totalSelection = props.totalSelection,
|
|
13
|
-
onSave = props.onSave,
|
|
14
|
-
onClose = props.onClose;
|
|
15
|
-
var ref = useRef();
|
|
16
|
-
|
|
17
|
-
var onDrawerSave = function onDrawerSave() {
|
|
18
|
-
var data = ref.current.getSelectedData();
|
|
19
|
-
|
|
20
|
-
if (!isAvailableArray(data)) {
|
|
21
|
-
_Message.error('请选择一项资源。');
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var intercept = onSave(data[0]);
|
|
27
|
-
|
|
28
|
-
if (!intercept) {
|
|
29
|
-
onClose();
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
var initialData = {
|
|
34
|
-
selected: [selectedKey],
|
|
35
|
-
total: totalSelection
|
|
36
|
-
};
|
|
37
|
-
return /*#__PURE__*/React.createElement(Drawer, {
|
|
38
|
-
title: "\u9009\u62E9\u8D44\u6E90",
|
|
39
|
-
visible: visible,
|
|
40
|
-
loading: loading,
|
|
41
|
-
onSave: onDrawerSave,
|
|
42
|
-
onClose: onClose,
|
|
43
|
-
buttons: ['确定', '取消']
|
|
44
|
-
}, /*#__PURE__*/React.createElement(ResourceList, {
|
|
45
|
-
ref: ref,
|
|
46
|
-
store: store,
|
|
47
|
-
initialData: initialData,
|
|
48
|
-
selectionMode: "single"
|
|
49
|
-
}));
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default SingleResourceDrawer;
|
|
1
|
+
import Drawer from "./SelectDrawer";
|
|
2
|
+
export default Drawer;
|
|
@@ -75,16 +75,8 @@ var TopoView = function TopoView(props) {
|
|
|
75
75
|
onLineDelete: onLineDelete,
|
|
76
76
|
topoShowType: topoShowType
|
|
77
77
|
});
|
|
78
|
-
var
|
|
79
|
-
showSingleResDrawer = topoEditApi.showSingleResDrawer,
|
|
80
|
-
initialSingleRes = topoEditApi.initialSingleRes,
|
|
81
|
-
showComboResDrawer = topoEditApi.showComboResDrawer,
|
|
82
|
-
initialComboRes = topoEditApi.initialComboRes,
|
|
83
|
-
resSelections = topoEditApi.resSelections,
|
|
84
|
-
onExitEdit = topoEditApi.onExitEdit,
|
|
78
|
+
var onExitEdit = topoEditApi.onExitEdit,
|
|
85
79
|
onBindData = topoEditApi.onBindData,
|
|
86
|
-
onSaveSingleRes = topoEditApi.onSaveSingleRes,
|
|
87
|
-
onCloseSigleResDrawer = topoEditApi.onCloseSigleResDrawer,
|
|
88
80
|
onSaveComboRes = topoEditApi.onSaveComboRes,
|
|
89
81
|
onCloseComboResDrawer = topoEditApi.onCloseComboResDrawer,
|
|
90
82
|
onDeleteElement = topoEditApi.onDeleteElement,
|
|
@@ -240,20 +232,12 @@ var TopoView = function TopoView(props) {
|
|
|
240
232
|
topoEditApi: topoEditApi,
|
|
241
233
|
selection: selection,
|
|
242
234
|
editorProps: props.editorProps
|
|
243
|
-
})), /*#__PURE__*/React.createElement(
|
|
244
|
-
visible:
|
|
245
|
-
loading: topoLoading,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
onSave: onSaveSingleRes,
|
|
250
|
-
onClose: onCloseSigleResDrawer
|
|
251
|
-
}), /*#__PURE__*/React.createElement(ComboResDrawer, {
|
|
252
|
-
visible: showComboResDrawer,
|
|
253
|
-
loading: topoLoading,
|
|
254
|
-
initialData: initialComboRes,
|
|
255
|
-
totalSelection: resSelections,
|
|
256
|
-
isLayerTopo: topoShowType === 'layers',
|
|
235
|
+
})), /*#__PURE__*/React.createElement(ComboResDrawer, {
|
|
236
|
+
visible: topoEditApi.showComboResDrawer,
|
|
237
|
+
loading: topoEditApi.topoLoading,
|
|
238
|
+
initialData: topoEditApi.initialComboRes,
|
|
239
|
+
totalSelection: topoEditApi.resSelections,
|
|
240
|
+
isLayerTopo: topoEditApi.topoShowType === 'layers',
|
|
257
241
|
onSave: onSaveComboRes,
|
|
258
242
|
onClose: onCloseComboResDrawer
|
|
259
243
|
}), /*#__PURE__*/React.createElement(ViewerPlugin, {
|
|
@@ -6,7 +6,8 @@ import ResourceViewAttributeSettingPlugin from "./ResourceViewAttributeSetting/R
|
|
|
6
6
|
import LinkDrawer from "../../../components/Link";
|
|
7
7
|
export default function TopoEditPlugin(props) {
|
|
8
8
|
var topo = props.topo,
|
|
9
|
-
topoContext = props.topoContext
|
|
9
|
+
topoContext = props.topoContext,
|
|
10
|
+
topoEditApi = props.topoEditApi;
|
|
10
11
|
var store = topo.store;
|
|
11
12
|
|
|
12
13
|
var _store$useModel = store.useModel('topoEdit'),
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _Message from "@alifd/next/lib/message";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
|
+
import ResourceSelectDrawer from "../../../../../components/ResourceSelectDrawer";
|
|
6
|
+
|
|
7
|
+
var SingleSelectDrawer = function SingleSelectDrawer(props) {
|
|
8
|
+
var visible = props.visible,
|
|
9
|
+
totalSelection = props.totalSelection,
|
|
10
|
+
onSave = props.onSave,
|
|
11
|
+
onClose = props.onClose;
|
|
12
|
+
|
|
13
|
+
var onDrawerSave = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(selected) {
|
|
15
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
16
|
+
while (1) {
|
|
17
|
+
switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
if (selected.length) {
|
|
20
|
+
_context.next = 3;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_Message.error('请选择一项资源。');
|
|
25
|
+
|
|
26
|
+
return _context.abrupt("return", false);
|
|
27
|
+
|
|
28
|
+
case 3:
|
|
29
|
+
_context.next = 5;
|
|
30
|
+
return onSave(selected[0]);
|
|
31
|
+
|
|
32
|
+
case 5:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
return function onDrawerSave(_x) {
|
|
41
|
+
return _ref.apply(this, arguments);
|
|
42
|
+
};
|
|
43
|
+
}();
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/React.createElement(ResourceSelectDrawer, {
|
|
46
|
+
visible: visible,
|
|
47
|
+
excludeIds: totalSelection,
|
|
48
|
+
selectionMode: "single",
|
|
49
|
+
onOk: onDrawerSave,
|
|
50
|
+
onClose: onClose
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default SingleSelectDrawer;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _Message from "@alifd/next/lib/message";
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import { isAvailableArray } from '@riil-frontend/utils';
|
|
4
|
+
import Drawer from "../Drawer";
|
|
5
|
+
import ResourceList from "../ResourceList";
|
|
6
|
+
/**
|
|
7
|
+
* 旧版单选
|
|
8
|
+
* @param props
|
|
9
|
+
* @return {*}
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var SingleResourceDrawer = function SingleResourceDrawer(props) {
|
|
14
|
+
var store = props.store,
|
|
15
|
+
visible = props.visible,
|
|
16
|
+
loading = props.loading,
|
|
17
|
+
selectedKey = props.selectedKey,
|
|
18
|
+
totalSelection = props.totalSelection,
|
|
19
|
+
onSave = props.onSave,
|
|
20
|
+
onClose = props.onClose;
|
|
21
|
+
var ref = useRef();
|
|
22
|
+
|
|
23
|
+
var onDrawerSave = function onDrawerSave() {
|
|
24
|
+
var data = ref.current.getSelectedData();
|
|
25
|
+
|
|
26
|
+
if (!isAvailableArray(data)) {
|
|
27
|
+
_Message.error('请选择一项资源。');
|
|
28
|
+
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var intercept = onSave(data[0]);
|
|
33
|
+
|
|
34
|
+
if (!intercept) {
|
|
35
|
+
onClose();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var initialData = {
|
|
40
|
+
selected: [selectedKey],
|
|
41
|
+
total: totalSelection
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement(Drawer, {
|
|
44
|
+
title: "\u9009\u62E9\u8D44\u6E90",
|
|
45
|
+
visible: visible,
|
|
46
|
+
loading: loading,
|
|
47
|
+
onSave: onDrawerSave,
|
|
48
|
+
onClose: onClose,
|
|
49
|
+
buttons: ['确定', '取消']
|
|
50
|
+
}, /*#__PURE__*/React.createElement(ResourceList, {
|
|
51
|
+
ref: ref,
|
|
52
|
+
store: store,
|
|
53
|
+
initialData: initialData,
|
|
54
|
+
selectionMode: "single"
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default SingleResourceDrawer;
|
|
@@ -5,7 +5,7 @@ import { getIconById } from "../../common/GroupNodeList/icon";
|
|
|
5
5
|
export default function GroupNodeList(props) {
|
|
6
6
|
var topo = props.topo,
|
|
7
7
|
group = props.group;
|
|
8
|
-
var nodes = getGroupChildrenData(
|
|
8
|
+
var nodes = getGroupChildrenData(group);
|
|
9
9
|
var data = nodes.map(function (node) {
|
|
10
10
|
return {
|
|
11
11
|
title: node.name,
|
|
@@ -6,6 +6,7 @@ var CollapsePanel = _Collapse.Panel;
|
|
|
6
6
|
export default function GroupRelateData(props) {
|
|
7
7
|
var topo = props.topo,
|
|
8
8
|
topoEditApi = props.topoEditApi,
|
|
9
|
+
group = props.group,
|
|
9
10
|
values = props.values,
|
|
10
11
|
editorProps = props.editorProps;
|
|
11
12
|
|
|
@@ -32,7 +33,7 @@ export default function GroupRelateData(props) {
|
|
|
32
33
|
}))
|
|
33
34
|
}, /*#__PURE__*/React.createElement(GroupNodeList, {
|
|
34
35
|
topo: topo,
|
|
35
|
-
group:
|
|
36
|
+
group: group
|
|
36
37
|
}));
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -10,7 +10,7 @@ import NodeSizeInput from "../common/NodeSizeInput/NodeSizeInput";
|
|
|
10
10
|
import textStyles from "../../../../common/text.module.scss";
|
|
11
11
|
import TopoTreeSelect from "./TopoTreeSelect";
|
|
12
12
|
import NodeIconSelect from "./NodeIconSelect";
|
|
13
|
-
import NodeRelateResourceButton from "./NodeRelateResourceButton";
|
|
13
|
+
import NodeRelateResourceButton from "./data/NodeRelateResourceButton";
|
|
14
14
|
import styles from "./NodePropertyView.module.scss";
|
|
15
15
|
import TabView from "../common/tab/TabView";
|
|
16
16
|
var Option = _Select.Option;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _Message from "@alifd/next/lib/message";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
|
+
import ResourceSelectDrawer from "../../../../../../components/ResourceSelectDrawer";
|
|
6
|
+
/**
|
|
7
|
+
* 关联、重新关联资源
|
|
8
|
+
* @param props
|
|
9
|
+
* @return {*}
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var BindResourceDrawer = function BindResourceDrawer(props) {
|
|
14
|
+
var visible = props.visible,
|
|
15
|
+
topoEditApi = props.topoEditApi,
|
|
16
|
+
node = props.node,
|
|
17
|
+
currentResId = props.currentResId,
|
|
18
|
+
onClose = props.onClose;
|
|
19
|
+
|
|
20
|
+
var handleSave = /*#__PURE__*/function () {
|
|
21
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(selected) {
|
|
22
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23
|
+
while (1) {
|
|
24
|
+
switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
if (selected) {
|
|
27
|
+
_context.next = 3;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_Message.error('请选择一项资源。');
|
|
32
|
+
|
|
33
|
+
return _context.abrupt("return", false);
|
|
34
|
+
|
|
35
|
+
case 3:
|
|
36
|
+
_context.next = 5;
|
|
37
|
+
return topoEditApi.bindNodeResource({
|
|
38
|
+
id: node.id,
|
|
39
|
+
newResId: selected,
|
|
40
|
+
oldResId: currentResId
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
case 5:
|
|
44
|
+
case "end":
|
|
45
|
+
return _context.stop();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, _callee);
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
return function handleSave(_x) {
|
|
52
|
+
return _ref.apply(this, arguments);
|
|
53
|
+
};
|
|
54
|
+
}();
|
|
55
|
+
|
|
56
|
+
return /*#__PURE__*/React.createElement(ResourceSelectDrawer, {
|
|
57
|
+
visible: visible,
|
|
58
|
+
excludeIds: topoEditApi.resSelections,
|
|
59
|
+
selectionMode: "single",
|
|
60
|
+
onOk: handleSave,
|
|
61
|
+
onClose: onClose
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default BindResourceDrawer;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _Button from "@alifd/next/lib/button";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import BindResourceDrawer from "./BindResourceDrawer";
|
|
5
|
+
/**
|
|
6
|
+
* @return {React.ReactNode | null}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export default function NodeRelateResourceButton(props) {
|
|
10
|
+
var _node$attrObject$data;
|
|
11
|
+
|
|
12
|
+
var topo = props.topo,
|
|
13
|
+
topoEditApi = props.topoEditApi,
|
|
14
|
+
node = props.node;
|
|
15
|
+
var hide = ((_node$attrObject$data = node.attrObject.data) === null || _node$attrObject$data === void 0 ? void 0 : _node$attrObject$data.relateResource) === false;
|
|
16
|
+
var currentResId = node.tag;
|
|
17
|
+
|
|
18
|
+
var _useState = useState(false),
|
|
19
|
+
visible = _useState[0],
|
|
20
|
+
setVisible = _useState[1];
|
|
21
|
+
|
|
22
|
+
return !hide ? /*#__PURE__*/React.createElement(_Button, {
|
|
23
|
+
type: "primary",
|
|
24
|
+
text: true,
|
|
25
|
+
onClick: function onClick() {
|
|
26
|
+
topoEditApi.openBindNodeResourceDrawer({
|
|
27
|
+
id: currentResId
|
|
28
|
+
});
|
|
29
|
+
setVisible(true);
|
|
30
|
+
}
|
|
31
|
+
}, "\u9009\u62E9\u8D44\u6E90", /*#__PURE__*/React.createElement(BindResourceDrawer, _extends({
|
|
32
|
+
visible: visible,
|
|
33
|
+
currentResId: currentResId
|
|
34
|
+
}, props, {
|
|
35
|
+
onClose: function onClose() {
|
|
36
|
+
setVisible(false);
|
|
37
|
+
setVisible(true);
|
|
38
|
+
}
|
|
39
|
+
}))) : null;
|
|
40
|
+
}
|
|
41
|
+
;
|
package/es/hooks/useSelection.js
CHANGED
|
@@ -44,8 +44,8 @@ export default function (props) {
|
|
|
44
44
|
var selectionModel = topoApp.getSelectionModel();
|
|
45
45
|
var selectionArr = selectionModel.getSelection().getArray().map(function (item) {
|
|
46
46
|
return getElementData(item);
|
|
47
|
-
});
|
|
48
|
-
|
|
47
|
+
});
|
|
48
|
+
console.info('updateSelection', selectionArr);
|
|
49
49
|
setSelection(selectionArr);
|
|
50
50
|
}, []);
|
|
51
51
|
var initSelection = useCallback(function () {
|
|
@@ -53,7 +53,7 @@ export default function (props) {
|
|
|
53
53
|
var selectionModel = topoApp.getSelectionModel();
|
|
54
54
|
updateSelection();
|
|
55
55
|
selectionModel.addSelectionChangeListener(function (e) {
|
|
56
|
-
|
|
56
|
+
console.info('selectionChangeListener', e);
|
|
57
57
|
updateSelection();
|
|
58
58
|
});
|
|
59
59
|
dataModel.addDataPropertyChangeListener(function (e) {
|
|
@@ -64,6 +64,7 @@ export default function (props) {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
console.info('PropertyChangeListener', e);
|
|
67
68
|
var selectionIds = selectionModel.getSelection().getArray().map(function (item) {
|
|
68
69
|
return item.getId();
|
|
69
70
|
});
|