@riil-frontend/component-topology 2.12.2 → 2.12.5-alpha.2
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 +21 -21
- package/es/components/Link/index.js +1 -1
- package/es/components/Link/index.module.scss +2 -2
- package/es/components/MultiResourceDrawer/index.js +3 -2
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -0
- package/es/components/ResourceSelectDrawer/ResourceSelectList.js +6 -1
- package/es/components/SingleResourceDrawer/SelectDrawer.js +54 -0
- package/es/components/SingleResourceDrawer/index.js +3 -3
- package/es/core/common/icons/defaultIcons.js +9 -2
- package/es/core/components/TopoView/topoView.js +3 -2
- package/es/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
- package/es/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +1 -1
- package/es/core/editor/components/ResourceViewAttributeSetting/Setting.js +1 -1
- package/es/core/editor/components/settings/Settings.js +5 -29
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.js +0 -0
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.module.scss +0 -0
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceSelectButton.js +12 -14
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/icon.js +0 -0
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
- package/es/core/editor/components/settings/group/DataTab/GroupNodeList.js +19 -0
- package/es/core/editor/components/settings/group/DataTab/RelateData.js +45 -0
- package/es/core/editor/components/settings/group/GroupPropertyView.js +44 -0
- package/es/core/editor/components/settings/group/GroupPropertyView.module.scss +3 -0
- package/es/core/editor/components/settings/group/SettingTab/GroupExpandSetting.js +27 -0
- package/es/core/editor/components/settings/group/SettingTab/NodeIconSelect.js +32 -0
- package/es/core/editor/components/settings/group/SettingTab/Setting.js +86 -0
- package/es/core/editor/components/settings/group/hooks/useGroup.js +9 -0
- package/es/core/editor/components/settings/group/hooks/useGroupExpand.js +20 -0
- package/es/core/editor/components/settings/layer/LayerSettingsForm.js +2 -2
- package/es/core/editor/components/settings/{group/GroupNodeList/GroupNodeList.js → layer/NodeList.js} +3 -3
- package/es/core/editor/components/settings/link/LinkPropertyView.js +3 -3
- package/es/core/editor/components/settings/node/NodeIconSelect.js +1 -1
- package/es/core/editor/components/settings/propertyViews.js +23 -0
- package/es/core/models/TopoApp.js +28 -16
- package/es/hooks/useContainerLinkTopo.js +1 -1
- package/es/hooks/usePolling.js +1 -1
- package/es/hooks/useTopoEdit.js +139 -103
- package/es/style.js +3 -4
- package/es/topoCenter/models/TopoCenter.js +40 -12
- package/es/utils/htElementUtils.js +36 -7
- package/lib/components/Link/index.js +6 -6
- package/lib/components/Link/index.module.scss +2 -2
- package/lib/components/MultiResourceDrawer/index.js +3 -2
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -0
- package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +6 -1
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +68 -0
- package/lib/components/SingleResourceDrawer/index.js +3 -3
- package/lib/core/common/icons/defaultIcons.js +11 -2
- package/lib/core/components/TopoView/topoView.js +15 -13
- package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
- package/lib/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +3 -3
- package/lib/core/editor/components/ResourceViewAttributeSetting/Setting.js +2 -2
- package/lib/core/editor/components/settings/Settings.js +5 -34
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.js +0 -0
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.module.scss +0 -0
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceSelectButton.js +13 -14
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/icon.js +0 -0
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
- package/lib/core/editor/components/settings/group/DataTab/GroupNodeList.js +33 -0
- package/lib/core/editor/components/settings/group/DataTab/RelateData.js +57 -0
- package/lib/core/editor/components/settings/group/GroupPropertyView.js +58 -0
- package/lib/core/editor/components/settings/group/GroupPropertyView.module.scss +3 -0
- package/lib/core/editor/components/settings/group/SettingTab/GroupExpandSetting.js +37 -0
- package/lib/core/editor/components/settings/group/SettingTab/NodeIconSelect.js +45 -0
- package/lib/core/editor/components/settings/group/SettingTab/Setting.js +106 -0
- package/lib/core/editor/components/settings/group/hooks/useGroup.js +15 -0
- package/lib/core/editor/components/settings/group/hooks/useGroupExpand.js +26 -0
- package/lib/core/editor/components/settings/layer/LayerSettingsForm.js +3 -3
- package/lib/core/editor/components/settings/{group/GroupNodeList/GroupNodeList.js → layer/NodeList.js} +3 -3
- package/lib/core/editor/components/settings/link/LinkPropertyView.js +3 -3
- package/lib/core/editor/components/settings/node/NodeIconSelect.js +1 -1
- package/lib/core/editor/components/settings/propertyViews.js +38 -0
- package/lib/core/models/TopoApp.js +29 -17
- package/lib/hooks/useContainerLinkTopo.js +2 -2
- package/lib/hooks/usePolling.js +3 -3
- package/lib/hooks/useTopoEdit.js +149 -112
- package/lib/style.js +3 -4
- package/lib/topoCenter/models/TopoCenter.js +40 -12
- package/lib/utils/htElementUtils.js +44 -7
- package/package.json +10 -10
|
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
5
5
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';
|
|
6
6
|
import { useBoolean } from 'ahooks';
|
|
7
7
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
8
|
-
import
|
|
8
|
+
import TopoEvent from '@riil-frontend/component-topology-graph/es/event';
|
|
9
9
|
import styles from "./index.module.scss";
|
|
10
10
|
import LinkSetting from "./setting";
|
|
11
11
|
/**
|
|
@@ -10,7 +10,12 @@ function ResourceSelectList(props, ref) {
|
|
|
10
10
|
ref: ref,
|
|
11
11
|
limitTypes: RESOURCE_LIMIT_TYPES,
|
|
12
12
|
defaultCondition: excludeIds.length ? "!id('" + excludeIds.join("','") + "')" : undefined,
|
|
13
|
-
request: getRequest()
|
|
13
|
+
request: getRequest(),
|
|
14
|
+
tableProps: selectionMode ? {
|
|
15
|
+
rowSelection: {
|
|
16
|
+
mode: selectionMode
|
|
17
|
+
}
|
|
18
|
+
} : undefined
|
|
14
19
|
});
|
|
15
20
|
}
|
|
16
21
|
|
|
@@ -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 "../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;
|
|
@@ -8,7 +8,7 @@ var SingleResourceDrawer = function SingleResourceDrawer(props) {
|
|
|
8
8
|
var store = props.store,
|
|
9
9
|
visible = props.visible,
|
|
10
10
|
loading = props.loading,
|
|
11
|
-
|
|
11
|
+
selectedKey = props.selectedKey,
|
|
12
12
|
totalSelection = props.totalSelection,
|
|
13
13
|
onSave = props.onSave,
|
|
14
14
|
onClose = props.onClose;
|
|
@@ -23,7 +23,7 @@ var SingleResourceDrawer = function SingleResourceDrawer(props) {
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
var intercept = onSave(data);
|
|
26
|
+
var intercept = onSave(data[0]);
|
|
27
27
|
|
|
28
28
|
if (!intercept) {
|
|
29
29
|
onClose();
|
|
@@ -31,7 +31,7 @@ var SingleResourceDrawer = function SingleResourceDrawer(props) {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
var initialData = {
|
|
34
|
-
selected:
|
|
34
|
+
selected: [selectedKey],
|
|
35
35
|
total: totalSelection
|
|
36
36
|
};
|
|
37
37
|
return /*#__PURE__*/React.createElement(Drawer, {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { getIconMap } from '@riil-frontend/component-topology-graph/es/icons/ciTypeIcons';
|
|
3
|
+
/**
|
|
4
|
+
* 默认节点图标
|
|
5
|
+
*
|
|
6
|
+
* @type {(*|{url: *})[]}
|
|
7
|
+
*/
|
|
8
|
+
|
|
2
9
|
export var DEFAULT_NODE_ICONS = [{
|
|
3
10
|
id: 'ciType/network.switch',
|
|
4
11
|
name: '交换机',
|
|
@@ -60,7 +67,7 @@ export var DEFAULT_NODE_ICONS = [{
|
|
|
60
67
|
DEFAULT_NODE_ICONS.forEach(function (icon) {
|
|
61
68
|
ht.Default.setImage(icon.id, icon.jsonUrl || icon.url);
|
|
62
69
|
});
|
|
63
|
-
export default {
|
|
70
|
+
export default _extends({}, getIconMap(), {
|
|
64
71
|
'editor.icon.cloud.small': {
|
|
65
72
|
url: '/ht/image/topo/s/云_64.png',
|
|
66
73
|
json: '/ht/image/topo/s/云_64.json'
|
|
@@ -127,4 +134,4 @@ export default {
|
|
|
127
134
|
'editor.icon.library.small': '/ht/image/topo/s/库_48.json',
|
|
128
135
|
'editor.icon.balanc.small': '/ht/image/topo/s/负载均衡_48.json',
|
|
129
136
|
'editor.icon.calendar.small': '/ht/image/topo/s/日历_48.json'
|
|
130
|
-
};
|
|
137
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import TopoContainer
|
|
4
|
+
import TopoContainer from '@riil-frontend/component-topology-graph/es/components/TopoGraph';
|
|
5
|
+
import TopoEvent from '@riil-frontend/component-topology-graph/es/event';
|
|
5
6
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
6
7
|
import useTopoEdit from "../../../hooks/useTopoEdit";
|
|
7
8
|
import usePolling from "../../../hooks/usePolling";
|
|
@@ -244,7 +245,7 @@ var TopoView = function TopoView(props) {
|
|
|
244
245
|
visible: showSingleResDrawer,
|
|
245
246
|
loading: topoLoading,
|
|
246
247
|
store: store,
|
|
247
|
-
|
|
248
|
+
selectedKey: initialSingleRes,
|
|
248
249
|
totalSelection: resSelections,
|
|
249
250
|
onSave: onSaveSingleRes,
|
|
250
251
|
onClose: onCloseSigleResDrawer
|
package/es/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import TopoEvent from '@riil-frontend/component-topology-graph/es/event';
|
|
4
4
|
import Setting from "./Setting";
|
|
5
5
|
import '@riil-frontend/css/lib/index.scss';
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useState, useEffect, useRef, useCallback, useImperativeHandle, forwardRef } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import TopoEvent from '@riil-frontend/component-topology-graph/es/event';
|
|
4
4
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
5
5
|
import BatchAttrMetricDrawer from "../../../../components/BatchAttrMetric";
|
|
6
6
|
import { updateAllCiDoc, updateCiDoc } from "../../../../utils/topoData";
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
|
-
import SettingsForm from "./SettingsForm";
|
|
4
|
-
import LayerSettingsForm from "./layer/LayerSettingsForm";
|
|
5
3
|
import styles from "./Settings.module.scss";
|
|
6
4
|
import { isEdge, isGroup, isLayer, isNode, isText } from "../../../../utils/htElementDataUtil";
|
|
7
|
-
import
|
|
8
|
-
import NodePropertyView from "./node/NodePropertyView";
|
|
9
|
-
import ViewPropertyView from "./view/ViewPropertyView";
|
|
10
|
-
import LinkPropertyView from "./link/LinkPropertyView";
|
|
5
|
+
import propertyPanelMap from "./propertyViews";
|
|
11
6
|
import useSettingRuntimeState from "./useSettingRuntimeState";
|
|
12
7
|
|
|
13
8
|
function getElementType(selection) {
|
|
@@ -45,26 +40,7 @@ export default function Settings(props) {
|
|
|
45
40
|
}).join(',');
|
|
46
41
|
useEffect(function () {// const selectionModel = topo.getSelectionModel();
|
|
47
42
|
// console.info('selection change', selection)
|
|
48
|
-
}, [selection]);
|
|
49
|
-
var propertyPanelMap = {
|
|
50
|
-
view: SettingsForm,
|
|
51
|
-
node: NodePropertyView,
|
|
52
|
-
layer: LayerSettingsForm,
|
|
53
|
-
text: TextPropertyView
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
if (localStorage.getItem('topo.debug') === 'true') {
|
|
57
|
-
Object.assign(propertyPanelMap, {
|
|
58
|
-
line: LinkPropertyView,
|
|
59
|
-
view: ViewPropertyView
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
if (!selectionSize) {
|
|
63
|
-
// 未选择元素
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
} // TODO 待优化
|
|
67
|
-
|
|
43
|
+
}, [selection]); // TODO 待优化
|
|
68
44
|
|
|
69
45
|
var updateElementProperty = function updateElementProperty(name, value) {
|
|
70
46
|
// const element = topo.getDataModel().getDataById(selection[0].id);
|
|
@@ -88,9 +64,9 @@ export default function Settings(props) {
|
|
|
88
64
|
};
|
|
89
65
|
|
|
90
66
|
var elementType = getElementType(selection);
|
|
91
|
-
var
|
|
67
|
+
var PropertyView = propertyPanelMap[elementType];
|
|
92
68
|
|
|
93
|
-
if (!
|
|
69
|
+
if (!PropertyView) {
|
|
94
70
|
return null;
|
|
95
71
|
}
|
|
96
72
|
|
|
@@ -107,7 +83,7 @@ export default function Settings(props) {
|
|
|
107
83
|
className: styles.settingsPanel
|
|
108
84
|
}, /*#__PURE__*/React.createElement("div", {
|
|
109
85
|
className: styles.settings
|
|
110
|
-
}, /*#__PURE__*/React.createElement(
|
|
86
|
+
}, /*#__PURE__*/React.createElement(PropertyView, {
|
|
111
87
|
type: elementType,
|
|
112
88
|
topo: topo,
|
|
113
89
|
topoEditApi: topoEditApi,
|
|
File without changes
|
package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.module.scss
RENAMED
|
File without changes
|
package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceSelectButton.js
RENAMED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import _Button from "@alifd/next/lib/button";
|
|
2
2
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
3
|
import ResourceSelectDrawer from "../../../../../../components/ResourceSelect/ResourceSelectDrawer";
|
|
4
|
+
import { TopoEvent } from "@riil-frontend/component-topology-graph";
|
|
4
5
|
export default function ResourceSelectButton(props) {
|
|
5
6
|
var topo = props.topo,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
onAdd = props.onAdd;
|
|
7
|
+
group = props.group,
|
|
8
|
+
topoEditApi = props.topoEditApi;
|
|
9
9
|
|
|
10
10
|
var _useState = useState(false),
|
|
11
11
|
isSelectResource = _useState[0],
|
|
12
12
|
setIsSelectResource = _useState[1];
|
|
13
13
|
|
|
14
|
-
var ResourceSelectComponent = resourceSelectComponent || ResourceSelectDrawer; // const ResourceSelectComponent = ResourceSelectDrawer;
|
|
15
|
-
// TODO
|
|
16
|
-
|
|
17
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
15
|
onClick: function onClick(e) {
|
|
19
16
|
return e.stopPropagation();
|
|
@@ -23,14 +20,15 @@ export default function ResourceSelectButton(props) {
|
|
|
23
20
|
type: "primary",
|
|
24
21
|
onClick: function onClick(e) {
|
|
25
22
|
e.stopPropagation();
|
|
26
|
-
|
|
23
|
+
topoEditApi.onBindData({
|
|
24
|
+
type: TopoEvent.DATA_TYPE_RESOURCE_COMBO,
|
|
25
|
+
data: {
|
|
26
|
+
dtype: 'container',
|
|
27
|
+
id: group.tag,
|
|
28
|
+
tag: group.attr.tag
|
|
29
|
+
}
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
|
-
}, "\
|
|
29
|
-
layer: layer,
|
|
30
|
-
visible: isSelectResource,
|
|
31
|
-
setVisible: setIsSelectResource,
|
|
32
|
-
topo: topo,
|
|
33
|
-
existedIds: []
|
|
34
|
-
}));
|
|
32
|
+
}, "\u6DFB\u52A0\u8D44\u6E90"));
|
|
35
33
|
}
|
|
36
34
|
;
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
|
+
import ResourceList from "../../common/GroupNodeList/ResourceList";
|
|
3
|
+
import { getGroupChildrenData } from "../../../../../../utils/htElementUtils";
|
|
4
|
+
import { getIconById } from "../../common/GroupNodeList/icon";
|
|
5
|
+
export default function GroupNodeList(props) {
|
|
6
|
+
var topo = props.topo,
|
|
7
|
+
group = props.group;
|
|
8
|
+
var nodes = getGroupChildrenData(topo.getDataModel().getDataById(group.id));
|
|
9
|
+
var data = nodes.map(function (node) {
|
|
10
|
+
return {
|
|
11
|
+
title: node.name,
|
|
12
|
+
img: getIconById(node.image, topo)
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ResourceList, {
|
|
16
|
+
data: data
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _Collapse from "@alifd/next/lib/collapse";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ResourceSelectButton from "../../common/GroupNodeList/ResourceSelectButton";
|
|
4
|
+
import GroupNodeList from "./GroupNodeList";
|
|
5
|
+
var CollapsePanel = _Collapse.Panel;
|
|
6
|
+
export default function GroupRelateData(props) {
|
|
7
|
+
var topo = props.topo,
|
|
8
|
+
topoEditApi = props.topoEditApi,
|
|
9
|
+
values = props.values,
|
|
10
|
+
editorProps = props.editorProps;
|
|
11
|
+
|
|
12
|
+
var createResourcePanel = function createResourcePanel() {
|
|
13
|
+
return /*#__PURE__*/React.createElement(CollapsePanel, {
|
|
14
|
+
key: "\u5173\u8054\u8D44\u6E90",
|
|
15
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
style: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
paddingRight: 12
|
|
19
|
+
}
|
|
20
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
style: {
|
|
22
|
+
flex: 1
|
|
23
|
+
}
|
|
24
|
+
}, "\u5173\u8054\u8D44\u6E90"), /*#__PURE__*/React.createElement(ResourceSelectButton, {
|
|
25
|
+
topo: topo,
|
|
26
|
+
topoEditApi: topoEditApi,
|
|
27
|
+
group: values,
|
|
28
|
+
onAdd: function onAdd() {
|
|
29
|
+
/*TODO 刷新列表 refreshList*/
|
|
30
|
+
},
|
|
31
|
+
resourceSelectComponent: editorProps === null || editorProps === void 0 ? void 0 : editorProps.groupResourceSelectComponent
|
|
32
|
+
}))
|
|
33
|
+
}, /*#__PURE__*/React.createElement(GroupNodeList, {
|
|
34
|
+
topo: topo,
|
|
35
|
+
group: values
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/React.createElement(_Collapse, {
|
|
40
|
+
defaultExpandedKeys: ['关联资源'],
|
|
41
|
+
style: {
|
|
42
|
+
border: 'none'
|
|
43
|
+
}
|
|
44
|
+
}, createResourcePanel());
|
|
45
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _Tab from "@alifd/next/lib/tab";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import TabView from "../common/tab/TabView";
|
|
4
|
+
import styles from "./GroupPropertyView.module.scss";
|
|
5
|
+
import useGroup from "./hooks/useGroup";
|
|
6
|
+
import GroupSetting from "./SettingTab/Setting";
|
|
7
|
+
import GroupRelateData from "./DataTab/RelateData";
|
|
8
|
+
export default function GroupPropertyView(props) {
|
|
9
|
+
var topo = props.topo,
|
|
10
|
+
topoEditApi = props.topoEditApi,
|
|
11
|
+
values = props.values,
|
|
12
|
+
onChange = props.onChange,
|
|
13
|
+
settingRuntimeState = props.settingRuntimeState,
|
|
14
|
+
editorProps = props.editorProps;
|
|
15
|
+
var group = useGroup({
|
|
16
|
+
topo: topo,
|
|
17
|
+
id: values.id
|
|
18
|
+
});
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: styles.GroupPropertyView
|
|
21
|
+
}, /*#__PURE__*/React.createElement(TabView, null, /*#__PURE__*/React.createElement(_Tab.Item, {
|
|
22
|
+
title: "\u6570\u636E",
|
|
23
|
+
key: "1"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(GroupRelateData, {
|
|
25
|
+
group: group,
|
|
26
|
+
topo: topo,
|
|
27
|
+
topoEditApi: topoEditApi,
|
|
28
|
+
values: values,
|
|
29
|
+
onChange: onChange,
|
|
30
|
+
settingRuntimeState: settingRuntimeState,
|
|
31
|
+
editorProps: editorProps
|
|
32
|
+
})), /*#__PURE__*/React.createElement(_Tab.Item, {
|
|
33
|
+
title: "\u8BBE\u7F6E",
|
|
34
|
+
key: "2"
|
|
35
|
+
}, /*#__PURE__*/React.createElement(GroupSetting, {
|
|
36
|
+
group: group,
|
|
37
|
+
topo: topo,
|
|
38
|
+
topoEditApi: topoEditApi,
|
|
39
|
+
values: values,
|
|
40
|
+
onChange: onChange,
|
|
41
|
+
settingRuntimeState: settingRuntimeState,
|
|
42
|
+
editorProps: editorProps
|
|
43
|
+
}))));
|
|
44
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _Radio from "@alifd/next/lib/radio";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var list = [{
|
|
4
|
+
value: true,
|
|
5
|
+
label: '展开'
|
|
6
|
+
}, {
|
|
7
|
+
value: false,
|
|
8
|
+
label: '收起'
|
|
9
|
+
}];
|
|
10
|
+
/**
|
|
11
|
+
* 区域展开折叠
|
|
12
|
+
*
|
|
13
|
+
* @param props
|
|
14
|
+
* @return {*}
|
|
15
|
+
* @constructor
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export default function GroupExpandSetting(props) {
|
|
19
|
+
var expanded = props.expanded,
|
|
20
|
+
setExpanded = props.setExpanded;
|
|
21
|
+
return /*#__PURE__*/React.createElement(_Radio.Group, {
|
|
22
|
+
dataSource: list,
|
|
23
|
+
value: expanded,
|
|
24
|
+
onChange: setExpanded
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import { getIconGroups } from "../../common/GroupNodeList/icon";
|
|
3
|
+
import IconSelect from '@riil-frontend/component-topo-icon-select';
|
|
4
|
+
|
|
5
|
+
function NodeIconSelect(props, ref) {
|
|
6
|
+
var value = props.value,
|
|
7
|
+
onChange = props.onChange,
|
|
8
|
+
topo = props.topo;
|
|
9
|
+
var iconGroups = getIconGroups(topo, 'node');
|
|
10
|
+
var newId = value;
|
|
11
|
+
var a = iconGroups[0].icons.filter(function (item) {
|
|
12
|
+
return newId.indexOf(item.oldId) !== -1;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (a.length) {
|
|
16
|
+
newId = a[0].id;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
useImperativeHandle(ref, function () {
|
|
20
|
+
return {};
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/React.createElement(IconSelect, {
|
|
23
|
+
value: newId,
|
|
24
|
+
iconList: iconGroups,
|
|
25
|
+
onChange: onChange,
|
|
26
|
+
style: {
|
|
27
|
+
width: '100%'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default /*#__PURE__*/forwardRef(NodeIconSelect);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _Form from "@alifd/next/lib/form";
|
|
2
|
+
import _Input from "@alifd/next/lib/input";
|
|
3
|
+
import _Field from "@alifd/next/lib/field";
|
|
4
|
+
import _Collapse from "@alifd/next/lib/collapse";
|
|
5
|
+
import _Select from "@alifd/next/lib/select";
|
|
6
|
+
import React, { useEffect } from 'react';
|
|
7
|
+
import NodeSizeInput from "../../common/NodeSizeInput/NodeSizeInput";
|
|
8
|
+
import NodeIconSelect from "./NodeIconSelect";
|
|
9
|
+
import GroupExpandSetting from "./GroupExpandSetting";
|
|
10
|
+
import useGroupExpand from "../hooks/useGroupExpand";
|
|
11
|
+
var Option = _Select.Option;
|
|
12
|
+
var CollapsePanel = _Collapse.Panel;
|
|
13
|
+
export default function GroupSetting(props) {
|
|
14
|
+
var topo = props.topo,
|
|
15
|
+
topoEditApi = props.topoEditApi,
|
|
16
|
+
values = props.values,
|
|
17
|
+
_onChange = props.onChange,
|
|
18
|
+
settingRuntimeState = props.settingRuntimeState,
|
|
19
|
+
editorProps = props.editorProps,
|
|
20
|
+
group = props.group;
|
|
21
|
+
|
|
22
|
+
var field = _Field.useField({
|
|
23
|
+
autoUnmount: false,
|
|
24
|
+
values: values,
|
|
25
|
+
onChange: function onChange(name, value) {
|
|
26
|
+
var newValues = field.getValues();
|
|
27
|
+
|
|
28
|
+
if (values[name] !== value) {
|
|
29
|
+
_onChange(name, value, newValues);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
field.setValues(values);
|
|
36
|
+
}, [values]);
|
|
37
|
+
var groupExpand = useGroupExpand({
|
|
38
|
+
group: group
|
|
39
|
+
});
|
|
40
|
+
var expanded = groupExpand.expanded;
|
|
41
|
+
return /*#__PURE__*/React.createElement(_Form, {
|
|
42
|
+
field: field,
|
|
43
|
+
labelAlign: "top"
|
|
44
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
45
|
+
label: "\u533A\u57DF\u540D\u79F0",
|
|
46
|
+
style: {
|
|
47
|
+
paddingLeft: 32,
|
|
48
|
+
paddingRight: 16
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/React.createElement(_Input, {
|
|
51
|
+
name: "attrObject.name"
|
|
52
|
+
})), /*#__PURE__*/React.createElement(_Collapse, {
|
|
53
|
+
defaultExpandedKeys: ['显示设置'],
|
|
54
|
+
style: {
|
|
55
|
+
border: 'none'
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement(CollapsePanel, {
|
|
58
|
+
key: "\u663E\u793A\u8BBE\u7F6E",
|
|
59
|
+
title: "\u663E\u793A\u8BBE\u7F6E"
|
|
60
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
61
|
+
label: "\u9ED8\u8BA4\u663E\u793A\u65B9\u5F0F"
|
|
62
|
+
}, /*#__PURE__*/React.createElement(GroupExpandSetting, {
|
|
63
|
+
group: group,
|
|
64
|
+
expanded: expanded,
|
|
65
|
+
setExpanded: groupExpand.setExpanded
|
|
66
|
+
})), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
67
|
+
label: "\u663E\u793A\u56FE\u7247"
|
|
68
|
+
}, /*#__PURE__*/React.createElement(NodeIconSelect, {
|
|
69
|
+
name: "image",
|
|
70
|
+
topo: topo
|
|
71
|
+
})), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
72
|
+
label: "\u56FE\u7247\u5C3A\u5BF8"
|
|
73
|
+
}, /*#__PURE__*/React.createElement(NodeSizeInput, {
|
|
74
|
+
node: values,
|
|
75
|
+
value: {
|
|
76
|
+
width: values.width,
|
|
77
|
+
height: values.height
|
|
78
|
+
},
|
|
79
|
+
onChange: function onChange(size) {
|
|
80
|
+
_onChange('width', size.width);
|
|
81
|
+
|
|
82
|
+
_onChange('height', size.height);
|
|
83
|
+
},
|
|
84
|
+
settingRuntimeState: settingRuntimeState
|
|
85
|
+
}))))));
|
|
86
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
export default function useGroupExpand(props) {
|
|
3
|
+
var group = props.group; // TODO 缺少:绘图区双击展开折叠后,更新状态
|
|
4
|
+
|
|
5
|
+
var _useState = useState(group.isExpanded()),
|
|
6
|
+
expanded = _useState[0],
|
|
7
|
+
_setExpanded = _useState[1];
|
|
8
|
+
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
_setExpanded(group.isExpanded());
|
|
11
|
+
}, [group]);
|
|
12
|
+
return {
|
|
13
|
+
expanded: expanded,
|
|
14
|
+
setExpanded: function setExpanded(val) {
|
|
15
|
+
_setExpanded(val);
|
|
16
|
+
|
|
17
|
+
group.setExpanded(val);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -9,8 +9,8 @@ import _Grid from "@alifd/next/lib/grid";
|
|
|
9
9
|
import _Form from "@alifd/next/lib/form";
|
|
10
10
|
import React, { useState, useEffect } from 'react';
|
|
11
11
|
import ColorPicker from "../../LinkDynamicStyleSettingDrawer/rule/ColorPicker";
|
|
12
|
-
import GroupNodeList from "
|
|
13
|
-
import ResourceSelectButton from "../
|
|
12
|
+
import GroupNodeList from "./NodeList";
|
|
13
|
+
import ResourceSelectButton from "../common/GroupNodeList/ResourceSelectButton";
|
|
14
14
|
var FormItem = _Form.Item;
|
|
15
15
|
var Row = _Grid.Row,
|
|
16
16
|
Col = _Grid.Col;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
|
-
import ResourceList from "
|
|
3
|
-
import { getGroupNodes } from "
|
|
4
|
-
import { getIconById } from "
|
|
2
|
+
import ResourceList from "../common/GroupNodeList/ResourceList";
|
|
3
|
+
import { getGroupNodes } from "../../../../../utils/htElementUtils";
|
|
4
|
+
import { getIconById } from "../common/GroupNodeList/icon";
|
|
5
5
|
export default function GroupNodeList(props) {
|
|
6
6
|
var topo = props.topo,
|
|
7
7
|
group = props.group;
|