@riil-frontend/component-topology 2.3.21 → 2.4.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/demo/5/345/205/266/344/273/226/347/273/204/344/273/266//345/233/276/346/240/207/351/200/211/346/213/251.md +5 -5
- package/es/components/Drawer/index.js +2 -1
- package/es/components/Drawer/index.module.scss +13 -0
- package/es/components/ResourceList/ResourceSelect.js +3 -2
- package/es/components/ResourceList/ResourceSelect.module.scss +7 -0
- package/es/components/ResourceSelect/ResourceSelectDrawer.js +3 -1
- package/es/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.d.ts +15 -0
- package/es/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js +62 -0
- package/es/core/common/text.module.scss +5 -0
- package/es/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +7 -3
- package/es/core/editor/components/iconManage/UploadIconDialog.js +2 -2
- package/es/core/editor/components/settings/Settings.js +47 -42
- package/es/core/editor/components/settings/Settings.module.scss +6 -1
- package/es/core/editor/components/settings/common/{NodeSizeInput.d.ts → NodeSizeInput/NodeSizeInput.d.ts} +0 -0
- package/es/core/editor/components/settings/common/{NodeSizeInput.js → NodeSizeInput/NodeSizeInput.js} +2 -0
- package/es/core/editor/components/settings/common/NodeSizeInput/img/icon_/350/247/243/351/224/201.svg +16 -0
- package/es/core/editor/components/settings/common/NodeSizeInput/img/icon_/351/224/201.svg +15 -0
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.d.ts +1 -0
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.js +50 -0
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +31 -0
- package/es/core/editor/components/settings/common/text/TextStyle.d.ts +1 -0
- package/es/core/editor/components/settings/common/text/TextStyle.js +133 -0
- package/es/core/editor/components/settings/common/text/fontStyleUtil.d.ts +19 -0
- package/es/core/editor/components/settings/common/text/fontStyleUtil.js +53 -0
- package/es/core/editor/components/settings/common/text/img/bold.svg +12 -0
- package/es/core/editor/components/settings/common/text/img/italics.svg +10 -0
- package/es/core/editor/components/settings/common/text/img/underline.svg +12 -0
- package/es/core/editor/components/settings/group/GroupNodeList/ResourceList.js +22 -6
- package/es/core/editor/components/settings/group/GroupNodeList/ResourceList.module.scss +16 -0
- package/es/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -0
- package/es/core/editor/components/settings/group/GroupNodeList/icon.js +20 -1
- package/es/core/editor/components/settings/node/NodeIconSelect.d.ts +1 -0
- package/es/core/editor/components/settings/node/NodeIconSelect.js +42 -0
- package/es/core/editor/components/settings/node/NodePropertyView.d.ts +1 -1
- package/es/core/editor/components/settings/node/NodePropertyView.js +68 -86
- package/es/core/editor/components/settings/node/NodeRelateResourceButton.d.ts +4 -0
- package/es/core/editor/components/settings/node/NodeRelateResourceButton.js +22 -0
- package/es/core/editor/components/settings/node/TopoTreeSelect.d.ts +1 -0
- package/es/core/editor/components/settings/node/TopoTreeSelect.js +40 -0
- package/es/core/editor/components/settings/text/TextPropertyView.js +31 -144
- package/es/core/editor/components/settings/view/ViewPropertyView.js +1 -1
- package/es/core/editor/{buildContextmenu.d.ts → contextmenu/buildContextmenu.d.ts} +1 -4
- package/es/core/editor/contextmenu/buildContextmenu.js +10 -0
- package/es/hooks/useSelection.js +9 -3
- package/es/plugins/useSelectionPlugin.d.ts +23 -0
- package/es/plugins/useSelectionPlugin.js +84 -0
- package/es/style.js +1 -0
- package/es/utils/topoData.js +1 -1
- package/lib/components/Drawer/index.js +2 -1
- package/lib/components/Drawer/index.module.scss +13 -0
- package/lib/components/ResourceList/ResourceSelect.js +4 -2
- package/lib/components/ResourceList/ResourceSelect.module.scss +7 -0
- package/lib/components/ResourceSelect/ResourceSelectDrawer.js +3 -1
- package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.d.ts +15 -0
- package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js +68 -1
- package/lib/core/common/text.module.scss +5 -0
- package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +7 -3
- package/lib/core/editor/components/iconManage/UploadIconDialog.js +2 -2
- package/lib/core/editor/components/settings/Settings.js +45 -42
- package/lib/core/editor/components/settings/Settings.module.scss +6 -1
- package/lib/core/editor/components/settings/common/{NodeSizeInput.d.ts → NodeSizeInput/NodeSizeInput.d.ts} +0 -0
- package/lib/core/editor/components/settings/common/{NodeSizeInput.js → NodeSizeInput/NodeSizeInput.js} +2 -0
- package/lib/core/editor/components/settings/common/NodeSizeInput/img/icon_/350/247/243/351/224/201.svg +16 -0
- package/lib/core/editor/components/settings/common/NodeSizeInput/img/icon_/351/224/201.svg +15 -0
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.d.ts +1 -0
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.js +68 -0
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +31 -0
- package/lib/core/editor/components/settings/common/text/TextStyle.d.ts +1 -0
- package/lib/core/editor/components/settings/common/text/TextStyle.js +150 -0
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.d.ts +19 -0
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +58 -0
- package/lib/core/editor/components/settings/common/text/img/bold.svg +12 -0
- package/lib/core/editor/components/settings/common/text/img/italics.svg +10 -0
- package/lib/core/editor/components/settings/common/text/img/underline.svg +12 -0
- package/lib/core/editor/components/settings/group/GroupNodeList/ResourceList.js +22 -7
- package/lib/core/editor/components/settings/group/GroupNodeList/ResourceList.module.scss +16 -0
- package/lib/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -0
- package/lib/core/editor/components/settings/group/GroupNodeList/icon.js +23 -1
- package/lib/core/editor/components/settings/node/NodeIconSelect.d.ts +1 -0
- package/lib/core/editor/components/settings/node/NodeIconSelect.js +57 -0
- package/lib/core/editor/components/settings/node/NodePropertyView.d.ts +1 -1
- package/lib/core/editor/components/settings/node/NodePropertyView.js +74 -89
- package/lib/core/editor/components/settings/node/NodeRelateResourceButton.d.ts +4 -0
- package/lib/core/editor/components/settings/node/NodeRelateResourceButton.js +31 -0
- package/lib/core/editor/components/settings/node/TopoTreeSelect.d.ts +1 -0
- package/lib/core/editor/components/settings/node/TopoTreeSelect.js +53 -0
- package/lib/core/editor/components/settings/text/TextPropertyView.js +30 -149
- package/lib/core/editor/components/settings/view/ViewPropertyView.js +1 -1
- package/lib/core/editor/{buildContextmenu.d.ts → contextmenu/buildContextmenu.d.ts} +1 -4
- package/lib/core/editor/{buildContextmenu.js → contextmenu/buildContextmenu.js} +3 -7
- package/lib/hooks/useSelection.js +9 -3
- package/lib/plugins/useSelectionPlugin.d.ts +23 -0
- package/lib/plugins/useSelectionPlugin.js +90 -0
- package/lib/style.js +1 -0
- package/lib/utils/topoData.js +1 -1
- package/package.json +6 -6
- package/es/core/editor/buildContextmenu.js +0 -14
|
@@ -1,77 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _Input from "@alifd/next/lib/input";
|
|
1
|
+
import _Form from "@alifd/next/lib/form";
|
|
3
2
|
import _Field from "@alifd/next/lib/field";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
5
|
-
import _Radio from "@alifd/next/lib/radio";
|
|
6
4
|
import _Collapse from "@alifd/next/lib/collapse";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import React, { useState, useEffect } from 'react';
|
|
11
|
-
import ColorPicker from "../../LinkDynamicStyleSettingDrawer/rule/ColorPicker";
|
|
12
|
-
import GroupNodeList from "../group/GroupNodeList/GroupNodeList";
|
|
13
|
-
import ResourceSelectButton from "../group/GroupNodeList/ResourceSelectButton";
|
|
14
|
-
var FormItem = _Form.Item;
|
|
15
|
-
var Row = _Grid.Row,
|
|
16
|
-
Col = _Grid.Col;
|
|
17
|
-
var Option = _Select.Option;
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
|
+
import TextStyle from "../common/text/TextStyle";
|
|
7
|
+
import fontStyleUtil from "../common/text/fontStyleUtil";
|
|
18
8
|
var CollapsePanel = _Collapse.Panel;
|
|
19
|
-
var RadioGroup = _Radio.Group; // 字体样式格式 label.font: bold italic 12px 黑体 / 12px 黑体
|
|
20
|
-
|
|
21
|
-
var fontStyleUtil = {
|
|
22
|
-
toMap: function toMap(font, prefix) {
|
|
23
|
-
if (font === void 0) {
|
|
24
|
-
font = '';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var arr = font.trim().split(' ');
|
|
28
|
-
var bold = font.indexOf('bold') > -1;
|
|
29
|
-
var italic = font.indexOf('bold') > -1;
|
|
30
|
-
var map = {
|
|
31
|
-
fontFamily: arr[1],
|
|
32
|
-
fontSize: parseInt(arr[0].replace('px', ''), 10),
|
|
33
|
-
bold: bold,
|
|
34
|
-
italic: italic,
|
|
35
|
-
underline: false
|
|
36
|
-
};
|
|
37
|
-
return Object.keys(map).reduce(function (result, key) {
|
|
38
|
-
result["" + prefix + key] = map[key];
|
|
39
|
-
return result;
|
|
40
|
-
}, {});
|
|
41
|
-
},
|
|
42
|
-
getFontStyleMap: function getFontStyleMap(obj, prefix) {
|
|
43
|
-
var map = {};
|
|
44
|
-
Object.keys(obj).forEach(function (key) {
|
|
45
|
-
if (key.startsWith(prefix)) {
|
|
46
|
-
map[key.replace(prefix, '')] = obj[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
console.error(obj, prefix, map);
|
|
50
|
-
return map;
|
|
51
|
-
},
|
|
52
|
-
build: function build(style) {
|
|
53
|
-
return style.fontSize + "px " + style.fontFamily;
|
|
54
|
-
}
|
|
55
|
-
}; // 线型--node.s('dash',false) ---false代表是实线,默认为true代表虚线
|
|
56
|
-
// 线型为实线时设置颜色--node.s('borderColor','rgba(0,0,0,0.00)') //默认颜色rgba(0,0,0,0.00)
|
|
57
|
-
// 线型为虚线时设置颜色--node.s('dashColor','rgb(173,173,173)') //默认颜色rgb(173,173,173)
|
|
58
|
-
// 线宽--node.s('borderWidth',1)//默认宽度是1
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
// 为了实现切换时更好的效果,在设置线型为虚线时可以这样设置:
|
|
62
|
-
// node.s('dash',true);
|
|
63
|
-
// node.s('borderColor','rgba(0,0,0,0.00)');//将borderColor改为默认
|
|
64
|
-
// node.s('dashColor','当前设置的颜色')
|
|
65
|
-
// 虚线颜色用的是dashColor
|
|
66
|
-
//
|
|
67
|
-
// 设置线型为实线时
|
|
68
|
-
// node.s('dash',false);
|
|
69
|
-
// node.s('borderColor','当前设置的颜色');
|
|
70
|
-
// node.s('dashColor','rgb(173,173,173)');dash可设置为默认
|
|
71
|
-
// 实线用的是borderColor
|
|
72
9
|
|
|
73
10
|
function parseValues(values) {
|
|
74
|
-
return _extends({}, values,
|
|
11
|
+
return _extends({}, values, {
|
|
12
|
+
'styleMap.textObj': {
|
|
13
|
+
color: values.styleMap['text.color'],
|
|
14
|
+
underline: values.styleMap['text.decoration'] === 'underline',
|
|
15
|
+
font: fontStyleUtil.toMap(values.styleMap['text.font'])
|
|
16
|
+
}
|
|
17
|
+
});
|
|
75
18
|
}
|
|
76
19
|
|
|
77
20
|
export default function TextPropertyView(props) {
|
|
@@ -86,15 +29,18 @@ export default function TextPropertyView(props) {
|
|
|
86
29
|
onChange: function onChange(name, value) {
|
|
87
30
|
var newValues = field.getValues(); // 文字font样式
|
|
88
31
|
|
|
89
|
-
if (name
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
32
|
+
if (name === 'styleMap.textObj') {
|
|
33
|
+
_onChange('styleMap.text.color', value.color, newValues);
|
|
34
|
+
|
|
35
|
+
_onChange('styleMap.label.color', value.color, newValues);
|
|
36
|
+
|
|
37
|
+
var font = fontStyleUtil.build(value);
|
|
38
|
+
|
|
39
|
+
_onChange('styleMap.text.font', font, newValues);
|
|
93
40
|
|
|
41
|
+
_onChange('styleMap.text.decoration', value.underline ? 'underline' : undefined, newValues);
|
|
94
42
|
|
|
95
|
-
|
|
96
|
-
name = 'styleMap.dash';
|
|
97
|
-
value = value === 'dash';
|
|
43
|
+
return;
|
|
98
44
|
}
|
|
99
45
|
|
|
100
46
|
if (values[name] !== value) {
|
|
@@ -106,84 +52,25 @@ export default function TextPropertyView(props) {
|
|
|
106
52
|
useEffect(function () {
|
|
107
53
|
field.setValues(parseValues(values));
|
|
108
54
|
}, [values]);
|
|
109
|
-
return /*#__PURE__*/React.createElement("div",
|
|
110
|
-
field: field,
|
|
111
|
-
labelAlign: "top"
|
|
112
|
-
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
113
|
-
label: "\u540D\u79F0",
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
114
56
|
style: {
|
|
115
|
-
|
|
116
|
-
paddingRight: 12
|
|
57
|
+
paddingTop: 8
|
|
117
58
|
}
|
|
118
|
-
}, /*#__PURE__*/React.createElement(
|
|
119
|
-
|
|
120
|
-
|
|
59
|
+
}, /*#__PURE__*/React.createElement(_Form, {
|
|
60
|
+
field: field,
|
|
61
|
+
labelAlign: "top"
|
|
62
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
|
|
121
63
|
defaultExpandedKeys: ['显示设置'],
|
|
122
64
|
style: {
|
|
123
65
|
border: 'none'
|
|
124
66
|
}
|
|
125
67
|
}, /*#__PURE__*/React.createElement(CollapsePanel, {
|
|
126
68
|
key: "\u663E\u793A\u8BBE\u7F6E",
|
|
127
|
-
title: "\u663E\u793A\u8BBE\u7F6E"
|
|
128
|
-
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
129
|
-
label: "\u5B57\u4F53"
|
|
130
|
-
}, /*#__PURE__*/React.createElement(_Select, {
|
|
131
|
-
name: "styleMap.text.fontStyle.fontFamily",
|
|
132
|
-
style: {
|
|
133
|
-
width: '100%',
|
|
134
|
-
marginRight: 8
|
|
135
|
-
}
|
|
136
|
-
}, /*#__PURE__*/React.createElement(Option, {
|
|
137
|
-
value: "\u5B8B\u4F53"
|
|
138
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
title: "\u663E\u793A\u8BBE\u7F6E",
|
|
139
70
|
style: {
|
|
140
|
-
|
|
71
|
+
padding: 0
|
|
141
72
|
}
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
145
|
-
style: {
|
|
146
|
-
fontFamily: '宋体'
|
|
147
|
-
}
|
|
148
|
-
}, "\u9ED1\u4F53")), /*#__PURE__*/React.createElement(Option, {
|
|
149
|
-
value: "Arial"
|
|
150
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
151
|
-
style: {
|
|
152
|
-
fontFamily: 'Arial'
|
|
153
|
-
}
|
|
154
|
-
}, "Arial")))), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
155
|
-
label: "\u5B57\u53F7",
|
|
156
|
-
hasFeedback: true,
|
|
157
|
-
required: true,
|
|
158
|
-
requiredMessage: "\u4E0D\u80FD\u4E3A\u7A7A",
|
|
159
|
-
requiredTrigger: "onBlur",
|
|
160
|
-
asterisk: false
|
|
161
|
-
}, /*#__PURE__*/React.createElement(_NumberPicker, {
|
|
162
|
-
name: "styleMap.text.fontStyle.fontSize",
|
|
163
|
-
min: 8,
|
|
164
|
-
max: 36,
|
|
165
|
-
style: {
|
|
166
|
-
width: '100%',
|
|
167
|
-
marginRight: 8
|
|
168
|
-
},
|
|
169
|
-
placeholder: "\u8BF7\u8F93\u5165"
|
|
170
|
-
})), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
171
|
-
label: "\u6837\u5F0F"
|
|
172
|
-
}, /*#__PURE__*/React.createElement(RadioGroup, {
|
|
173
|
-
shape: "button"
|
|
174
|
-
}, /*#__PURE__*/React.createElement(_Radio, {
|
|
175
|
-
id: "banana",
|
|
176
|
-
value: "banana"
|
|
177
|
-
}, "B"), /*#__PURE__*/React.createElement(_Radio, {
|
|
178
|
-
id: "watermelon",
|
|
179
|
-
value: "watermelon"
|
|
180
|
-
}, "I"), /*#__PURE__*/React.createElement(_Radio, {
|
|
181
|
-
id: "peach",
|
|
182
|
-
value: "peach"
|
|
183
|
-
}, "U"))), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
184
|
-
label: "\u989C\u8272"
|
|
185
|
-
}, /*#__PURE__*/React.createElement(ColorPicker, {
|
|
186
|
-
name: "styleMap.text.color",
|
|
187
|
-
align: "bl"
|
|
73
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(TextStyle, {
|
|
74
|
+
name: "styleMap.textObj"
|
|
188
75
|
})))))));
|
|
189
76
|
}
|
|
@@ -13,7 +13,7 @@ import { getIconMap } from "../group/GroupNodeList/icon";
|
|
|
13
13
|
import LayoutSettings from "../common/LayoutSettings";
|
|
14
14
|
import LineType from "../common/LineType";
|
|
15
15
|
import NodeAlignType from "../common/NodeAlignType";
|
|
16
|
-
import NodeSizeInput from "../common/NodeSizeInput";
|
|
16
|
+
import NodeSizeInput from "../common/NodeSizeInput/NodeSizeInput";
|
|
17
17
|
var FormItem = _Form.Item;
|
|
18
18
|
var Row = _Grid.Row,
|
|
19
19
|
Col = _Grid.Col;
|
package/es/hooks/useSelection.js
CHANGED
|
@@ -10,7 +10,9 @@ function getElementData(element) {
|
|
|
10
10
|
// 业务id
|
|
11
11
|
name: element.getName(),
|
|
12
12
|
attrObject: element.getAttrObject(),
|
|
13
|
-
|
|
13
|
+
attr: element.getAttrObject(),
|
|
14
|
+
styleMap: element.getStyleMap(),
|
|
15
|
+
style: element.getStyleMap()
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
if (className === 'ht.Edge') {
|
|
@@ -51,18 +53,22 @@ export default function (props) {
|
|
|
51
53
|
var selectionModel = topoApp.getSelectionModel();
|
|
52
54
|
updateSelection();
|
|
53
55
|
selectionModel.addSelectionChangeListener(function (e) {
|
|
54
|
-
// console.info('
|
|
56
|
+
// console.info('selectionChangeListener', e);
|
|
55
57
|
updateSelection();
|
|
56
58
|
});
|
|
57
59
|
dataModel.addDataPropertyChangeListener(function (e) {
|
|
58
60
|
var property = e.property,
|
|
59
61
|
data = e.data;
|
|
62
|
+
|
|
63
|
+
if (['position'].indexOf(property) !== -1) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
60
67
|
var selectionIds = selectionModel.getSelection().getArray().map(function (item) {
|
|
61
68
|
return item.getId();
|
|
62
69
|
});
|
|
63
70
|
|
|
64
71
|
if (selectionIds.indexOf(data.getId()) > -1) {
|
|
65
|
-
// console.info('DataPropertyChange');
|
|
66
72
|
updateSelection();
|
|
67
73
|
}
|
|
68
74
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default useTableSelectionPlugin;
|
|
2
|
+
/**
|
|
3
|
+
* Modified version of @ahooksjs/use-selection-plugin.
|
|
4
|
+
* Selected keys can be persistent across page changes, if not be reset.
|
|
5
|
+
*/
|
|
6
|
+
declare function useTableSelectionPlugin(options?: {}): {
|
|
7
|
+
middlewares: (ctx: any, next: any) => any;
|
|
8
|
+
props: () => {
|
|
9
|
+
tableProps: {
|
|
10
|
+
rowSelection: {
|
|
11
|
+
onChange: (selectedRowKeys: any, records: any) => void;
|
|
12
|
+
selectedRowKeys: any;
|
|
13
|
+
mode: any;
|
|
14
|
+
getProps: (record: any) => {
|
|
15
|
+
disabled: any;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
primaryKey: any;
|
|
19
|
+
};
|
|
20
|
+
getSelectedRowKeys: () => any;
|
|
21
|
+
setSelectedRowKeys: (selectedRowKeys: any) => void;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Modified version of @ahooksjs/use-selection-plugin.
|
|
4
|
+
* Selected keys can be persistent across page changes, if not be reset.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var useTableSelectionPlugin = function useTableSelectionPlugin(options) {
|
|
8
|
+
if (options === void 0) {
|
|
9
|
+
options = {};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
var _useState = useState({
|
|
13
|
+
selectedRowKeys: options.defaultSelectedRowKeys || []
|
|
14
|
+
}),
|
|
15
|
+
state = _useState[0],
|
|
16
|
+
setSelectedRowKeys = _useState[1];
|
|
17
|
+
|
|
18
|
+
var _options = options,
|
|
19
|
+
_options$primaryKey = _options.primaryKey,
|
|
20
|
+
primaryKey = _options$primaryKey === void 0 ? 'id' : _options$primaryKey,
|
|
21
|
+
_options$mode = _options.mode,
|
|
22
|
+
mode = _options$mode === void 0 ? 'multiple' : _options$mode,
|
|
23
|
+
_options$checkIsNeedR = _options.checkIsNeedReset,
|
|
24
|
+
checkIsNeedReset = _options$checkIsNeedR === void 0 ? function () {
|
|
25
|
+
return true;
|
|
26
|
+
} : _options$checkIsNeedR,
|
|
27
|
+
checkIsDisabled = _options.checkIsDisabled;
|
|
28
|
+
|
|
29
|
+
var onChange = function onChange(selectedRowKeys, records) {
|
|
30
|
+
setSelectedRowKeys({
|
|
31
|
+
selectedRowKeys: selectedRowKeys
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var getSelectedRowKeys = function getSelectedRowKeys() {
|
|
36
|
+
return state.selectedRowKeys;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var $setSelectedRowKeys = function $setSelectedRowKeys(selectedRowKeys) {
|
|
40
|
+
setSelectedRowKeys({
|
|
41
|
+
selectedRowKeys: selectedRowKeys
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
middlewares: function middlewares(ctx, next) {
|
|
47
|
+
var isNeedReset = checkIsNeedReset(ctx);
|
|
48
|
+
|
|
49
|
+
if (isNeedReset) {
|
|
50
|
+
return next().then(function () {
|
|
51
|
+
setSelectedRowKeys({
|
|
52
|
+
selectedRowKeys: []
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return next();
|
|
58
|
+
},
|
|
59
|
+
props: function props() {
|
|
60
|
+
var getProps = checkIsDisabled ? function (record) {
|
|
61
|
+
return {
|
|
62
|
+
disabled: checkIsDisabled(record)
|
|
63
|
+
};
|
|
64
|
+
} : undefined;
|
|
65
|
+
return {
|
|
66
|
+
tableProps: {
|
|
67
|
+
rowSelection: {
|
|
68
|
+
// onSelect,
|
|
69
|
+
// onSelectAll,
|
|
70
|
+
onChange: onChange,
|
|
71
|
+
selectedRowKeys: state.selectedRowKeys,
|
|
72
|
+
mode: mode,
|
|
73
|
+
getProps: getProps
|
|
74
|
+
},
|
|
75
|
+
primaryKey: primaryKey
|
|
76
|
+
},
|
|
77
|
+
getSelectedRowKeys: getSelectedRowKeys,
|
|
78
|
+
setSelectedRowKeys: $setSelectedRowKeys
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default useTableSelectionPlugin;
|
package/es/style.js
CHANGED
|
@@ -25,6 +25,7 @@ import '@alifd/next/lib/tab/style';
|
|
|
25
25
|
import '@alifd/next/lib/radio/style';
|
|
26
26
|
import '@alifd/next/lib/collapse/style';
|
|
27
27
|
import '@alifd/next/lib/list/style';
|
|
28
|
+
import '@alifd/next/lib/tree-select/style';
|
|
28
29
|
import '@alifd/next/lib/avatar/style';
|
|
29
30
|
|
|
30
31
|
import './index.scss';
|
package/es/utils/topoData.js
CHANGED
|
@@ -4,7 +4,7 @@ import { isAvailableArray } from '@riil-frontend/utils';
|
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import topoPermissionUtil from "./topoPermissionUtil";
|
|
6
6
|
import buildViewerContextMenu from "../core/viewer/contextmenu/buildContextmenu";
|
|
7
|
-
import buildEditorContextMenu from "../core/editor/buildContextmenu";
|
|
7
|
+
import buildEditorContextMenu from "../core/editor/contextmenu/buildContextmenu";
|
|
8
8
|
import { getDefaultNodeIcon as _getDefaultNodeIcon } from "./topoIconUtil";
|
|
9
9
|
import mergeContextmenu from "../core/common/contextmenu/mergeContextmenu";
|
|
10
10
|
/**
|
|
@@ -44,7 +44,8 @@ var Drawer = function Drawer(props) {
|
|
|
44
44
|
width: "40%",
|
|
45
45
|
headerStyle: headerStyle,
|
|
46
46
|
bodyStyle: bodyStyle,
|
|
47
|
-
closeMode: ['close', 'esc']
|
|
47
|
+
closeMode: ['close', 'esc'],
|
|
48
|
+
className: _indexModule["default"].drawer
|
|
48
49
|
}, drawerProps, {
|
|
49
50
|
visible: visible,
|
|
50
51
|
onClose: onClose
|
|
@@ -21,7 +21,7 @@ var _useFilterPlugin = _interopRequireDefault(require("@ahooksjs/use-filter-plug
|
|
|
21
21
|
|
|
22
22
|
var _useSortablePlugin = _interopRequireDefault(require("@ahooksjs/use-sortable-plugin"));
|
|
23
23
|
|
|
24
|
-
var _useSelectionPlugin = _interopRequireDefault(require("
|
|
24
|
+
var _useSelectionPlugin = _interopRequireDefault(require("../../plugins/useSelectionPlugin"));
|
|
25
25
|
|
|
26
26
|
var _cmdb = require("@riil-frontend/component-topology-utils/es/services/cmdb");
|
|
27
27
|
|
|
@@ -33,6 +33,8 @@ var _format = require("../../utils/format");
|
|
|
33
33
|
|
|
34
34
|
var _FormTable = _interopRequireDefault(require("../FormTable"));
|
|
35
35
|
|
|
36
|
+
var _ResourceSelectModule = _interopRequireDefault(require("./ResourceSelect.module.scss"));
|
|
37
|
+
|
|
36
38
|
var PRIMARY_KEY = 'id';
|
|
37
39
|
|
|
38
40
|
var getTableData = /*#__PURE__*/function () {
|
|
@@ -204,7 +206,7 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
204
206
|
}
|
|
205
207
|
}];
|
|
206
208
|
return /*#__PURE__*/_react["default"].createElement(_FormTable["default"], {
|
|
207
|
-
className: className,
|
|
209
|
+
className: className || _ResourceSelectModule["default"].table,
|
|
208
210
|
formProps: formProps,
|
|
209
211
|
tableProps: tableProps,
|
|
210
212
|
paginationProps: paginationProps,
|
|
@@ -19,7 +19,7 @@ var _Drawer = _interopRequireDefault(require("../Drawer"));
|
|
|
19
19
|
|
|
20
20
|
var _ResourceSelectDrawerModule = _interopRequireDefault(require("./ResourceSelectDrawer.module.scss"));
|
|
21
21
|
|
|
22
|
-
var _excluded = ["visible", "setVisible", "onAdd", "getTableData", "onOk"];
|
|
22
|
+
var _excluded = ["visible", "setVisible", "onAdd", "getTableData", "onOk", "layer", "topo"];
|
|
23
23
|
|
|
24
24
|
function ResourceSelectDrawer(props) {
|
|
25
25
|
var visible = props.visible,
|
|
@@ -27,6 +27,8 @@ function ResourceSelectDrawer(props) {
|
|
|
27
27
|
onAdd = props.onAdd,
|
|
28
28
|
getTableData = props.getTableData,
|
|
29
29
|
onOk = props.onOk,
|
|
30
|
+
layer = props.layer,
|
|
31
|
+
topo = props.topo,
|
|
30
32
|
otherProps = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
|
|
31
33
|
var tableRef = (0, _react.useRef)(); // TODO 默认处理
|
|
32
34
|
|
package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.d.ts
RENAMED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
export const DEFAULT_NODE_ICONS: ({
|
|
2
|
+
url: any;
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
ciType: string;
|
|
6
|
+
jsonUrl: string;
|
|
7
|
+
oldId: string;
|
|
8
|
+
} | {
|
|
9
|
+
url: any;
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
jsonUrl: string;
|
|
13
|
+
oldId: string;
|
|
14
|
+
ciType?: undefined;
|
|
15
|
+
})[];
|
|
1
16
|
declare var _default: {
|
|
2
17
|
'editor.icon.cloud.small': {
|
|
3
18
|
url: string;
|
package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js
RENAMED
|
@@ -1,7 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
exports.__esModule = true;
|
|
4
|
-
exports["default"] = void 0;
|
|
6
|
+
exports["default"] = exports.DEFAULT_NODE_ICONS = void 0;
|
|
7
|
+
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var DEFAULT_NODE_ICONS = [{
|
|
11
|
+
id: 'ciType/network.switch',
|
|
12
|
+
name: '交换机',
|
|
13
|
+
ciType: 'network.switch',
|
|
14
|
+
jsonUrl: '/ht/image/topo/l/交换机_96.json',
|
|
15
|
+
oldId: 'editor.icon.switch'
|
|
16
|
+
}, {
|
|
17
|
+
id: 'ciType/network.coreswitch',
|
|
18
|
+
name: '核心交换机',
|
|
19
|
+
jsonUrl: '/ht/image/topo/l/核心交换机_96.json',
|
|
20
|
+
oldId: 'editor.icon.coreswitch'
|
|
21
|
+
}, {
|
|
22
|
+
id: 'ciType/network.router',
|
|
23
|
+
name: '路由器',
|
|
24
|
+
ciType: 'network.router',
|
|
25
|
+
jsonUrl: '/ht/image/topo/l/路由器_96.json',
|
|
26
|
+
oldId: 'editor.icon.router'
|
|
27
|
+
}, {
|
|
28
|
+
id: 'ciType/db',
|
|
29
|
+
name: '数据库',
|
|
30
|
+
jsonUrl: '/ht/image/topo/l/数据库_96.json',
|
|
31
|
+
oldId: 'editor.icon.db'
|
|
32
|
+
}, {
|
|
33
|
+
id: 'dc',
|
|
34
|
+
name: '数据中心',
|
|
35
|
+
jsonUrl: '/ht/image/topo/l/数据中心_144.json',
|
|
36
|
+
oldId: 'editor.icon.dc'
|
|
37
|
+
}, {
|
|
38
|
+
id: 'firewall',
|
|
39
|
+
name: '防火墙',
|
|
40
|
+
jsonUrl: '/ht/image/topo/l/防火墙_96.json',
|
|
41
|
+
oldId: 'editor.icon.firewall'
|
|
42
|
+
}, {
|
|
43
|
+
id: 'server',
|
|
44
|
+
name: '服务器',
|
|
45
|
+
jsonUrl: '/ht/image/topo/l/服务器_96.json',
|
|
46
|
+
oldId: 'editor.icon.server'
|
|
47
|
+
}, {
|
|
48
|
+
id: 'icon.cloud',
|
|
49
|
+
name: '云',
|
|
50
|
+
jsonUrl: '/ht/image/topo/l/云_144.json',
|
|
51
|
+
oldId: 'editor.icon.cloud'
|
|
52
|
+
}, {
|
|
53
|
+
id: 'building',
|
|
54
|
+
name: '楼宇',
|
|
55
|
+
jsonUrl: '/ht/image/topo/l/楼宇_144.json',
|
|
56
|
+
oldId: 'editor.icon.building'
|
|
57
|
+
}, {
|
|
58
|
+
id: 'internet',
|
|
59
|
+
name: '互联网',
|
|
60
|
+
jsonUrl: '/ht/image/topo/l/互联网_144.json',
|
|
61
|
+
oldId: 'editor.icon.internet'
|
|
62
|
+
}].map(function (item) {
|
|
63
|
+
return (0, _extends2["default"])({}, item, {
|
|
64
|
+
url: item.url || item.jsonUrl.replace('.json', '.png')
|
|
65
|
+
});
|
|
66
|
+
}); // 注册
|
|
67
|
+
|
|
68
|
+
exports.DEFAULT_NODE_ICONS = DEFAULT_NODE_ICONS;
|
|
69
|
+
DEFAULT_NODE_ICONS.forEach(function (icon) {
|
|
70
|
+
ht.Default.setImage(icon.id, icon.jsonUrl || icon.url);
|
|
71
|
+
});
|
|
5
72
|
var _default = {
|
|
6
73
|
'editor.icon.cloud.small': {
|
|
7
74
|
url: '/ht/image/topo/s/云_64.png',
|
package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
@import "@alifd/
|
|
1
|
+
@import "@alifd/theme-19926/variables";
|
|
2
2
|
|
|
3
3
|
.swatch {
|
|
4
4
|
background: #fff;
|
|
5
|
-
border-radius:
|
|
6
|
-
border: 1px solid
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
border: 1px solid $input-border-color;
|
|
7
7
|
display: inline-block;
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
width: 70px;
|
|
10
10
|
height: 28px;
|
|
11
|
+
|
|
12
|
+
&:hover {
|
|
13
|
+
border: 1px solid $input-hover-border-color;
|
|
14
|
+
}
|
|
11
15
|
}
|
|
@@ -176,9 +176,9 @@ var UploadIconDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
176
176
|
type: _this.props.type,
|
|
177
177
|
data: files.map(function (file) {
|
|
178
178
|
return {
|
|
179
|
-
id: file.response.
|
|
179
|
+
id: file.response.result,
|
|
180
180
|
name: getFileName(file),
|
|
181
|
-
url: _index["default"].icon.getDownloadUrl(file.response.
|
|
181
|
+
url: _index["default"].icon.getDownloadUrl(file.response.result),
|
|
182
182
|
json: file.json
|
|
183
183
|
};
|
|
184
184
|
})
|