@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
|
@@ -7,18 +7,18 @@ order: 3
|
|
|
7
7
|
|
|
8
8
|
图标原比例显示,垂直居中
|
|
9
9
|
|
|
10
|
-
- onChange
|
|
11
10
|
- defaultValue
|
|
12
11
|
- value
|
|
12
|
+
- onChange `function(value)`
|
|
13
13
|
- dataSource
|
|
14
14
|
```
|
|
15
15
|
[
|
|
16
16
|
{
|
|
17
|
-
|
|
17
|
+
name: '图标库1',
|
|
18
18
|
icons: [
|
|
19
|
-
{
|
|
20
|
-
{
|
|
21
|
-
{
|
|
19
|
+
{id: '1', name: '图标1', url: ''},
|
|
20
|
+
{id: '2', name: '图标2', url: ''},
|
|
21
|
+
{id: '3', name: '图标3', url: ''}
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
]
|
|
@@ -32,7 +32,8 @@ var Drawer = function Drawer(props) {
|
|
|
32
32
|
width: "40%",
|
|
33
33
|
headerStyle: headerStyle,
|
|
34
34
|
bodyStyle: bodyStyle,
|
|
35
|
-
closeMode: ['close', 'esc']
|
|
35
|
+
closeMode: ['close', 'esc'],
|
|
36
|
+
className: styles.drawer
|
|
36
37
|
}, drawerProps, {
|
|
37
38
|
visible: visible,
|
|
38
39
|
onClose: onClose
|
|
@@ -5,12 +5,13 @@ import _ from 'lodash';
|
|
|
5
5
|
import useNextFormTable from '@ahooksjs/next-form-table';
|
|
6
6
|
import useFilterPlugin from '@ahooksjs/use-filter-plugin';
|
|
7
7
|
import useSortablePlugin from '@ahooksjs/use-sortable-plugin';
|
|
8
|
-
import useSelectionPlugin from
|
|
8
|
+
import useSelectionPlugin from "../../plugins/useSelectionPlugin";
|
|
9
9
|
import { fetchCommonQuery } from '@riil-frontend/component-topology-utils/es/services/cmdb';
|
|
10
10
|
import { getTitleCell } from '@riil-frontend/component-topology-utils/es/utils/table';
|
|
11
11
|
import { DICT } from '@riil-frontend/component-topology-utils/es/utils/storage';
|
|
12
12
|
import { formatDataForTable, getIp } from "../../utils/format";
|
|
13
13
|
import RiilTable from "../FormTable";
|
|
14
|
+
import styles from "./ResourceSelect.module.scss";
|
|
14
15
|
var PRIMARY_KEY = 'id';
|
|
15
16
|
|
|
16
17
|
var getTableData = /*#__PURE__*/function () {
|
|
@@ -181,7 +182,7 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
181
182
|
}
|
|
182
183
|
}];
|
|
183
184
|
return /*#__PURE__*/React.createElement(RiilTable, {
|
|
184
|
-
className: className,
|
|
185
|
+
className: className || styles.table,
|
|
185
186
|
formProps: formProps,
|
|
186
187
|
tableProps: tableProps,
|
|
187
188
|
paginationProps: paginationProps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["visible", "setVisible", "onAdd", "getTableData", "onOk"];
|
|
3
|
+
var _excluded = ["visible", "setVisible", "onAdd", "getTableData", "onOk", "layer", "topo"];
|
|
4
4
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
5
5
|
import ResourceTable from "../../common/components/ResourceTable/ResourceTable";
|
|
6
6
|
import Drawer from "../Drawer";
|
|
@@ -11,6 +11,8 @@ export default function ResourceSelectDrawer(props) {
|
|
|
11
11
|
onAdd = props.onAdd,
|
|
12
12
|
getTableData = props.getTableData,
|
|
13
13
|
onOk = props.onOk,
|
|
14
|
+
layer = props.layer,
|
|
15
|
+
topo = props.topo,
|
|
14
16
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
15
17
|
|
|
16
18
|
var tableRef = useRef(); // TODO 默认处理
|
package/es/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/es/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js
RENAMED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
export var DEFAULT_NODE_ICONS = [{
|
|
3
|
+
id: 'ciType/network.switch',
|
|
4
|
+
name: '交换机',
|
|
5
|
+
ciType: 'network.switch',
|
|
6
|
+
jsonUrl: '/ht/image/topo/l/交换机_96.json',
|
|
7
|
+
oldId: 'editor.icon.switch'
|
|
8
|
+
}, {
|
|
9
|
+
id: 'ciType/network.coreswitch',
|
|
10
|
+
name: '核心交换机',
|
|
11
|
+
jsonUrl: '/ht/image/topo/l/核心交换机_96.json',
|
|
12
|
+
oldId: 'editor.icon.coreswitch'
|
|
13
|
+
}, {
|
|
14
|
+
id: 'ciType/network.router',
|
|
15
|
+
name: '路由器',
|
|
16
|
+
ciType: 'network.router',
|
|
17
|
+
jsonUrl: '/ht/image/topo/l/路由器_96.json',
|
|
18
|
+
oldId: 'editor.icon.router'
|
|
19
|
+
}, {
|
|
20
|
+
id: 'ciType/db',
|
|
21
|
+
name: '数据库',
|
|
22
|
+
jsonUrl: '/ht/image/topo/l/数据库_96.json',
|
|
23
|
+
oldId: 'editor.icon.db'
|
|
24
|
+
}, {
|
|
25
|
+
id: 'dc',
|
|
26
|
+
name: '数据中心',
|
|
27
|
+
jsonUrl: '/ht/image/topo/l/数据中心_144.json',
|
|
28
|
+
oldId: 'editor.icon.dc'
|
|
29
|
+
}, {
|
|
30
|
+
id: 'firewall',
|
|
31
|
+
name: '防火墙',
|
|
32
|
+
jsonUrl: '/ht/image/topo/l/防火墙_96.json',
|
|
33
|
+
oldId: 'editor.icon.firewall'
|
|
34
|
+
}, {
|
|
35
|
+
id: 'server',
|
|
36
|
+
name: '服务器',
|
|
37
|
+
jsonUrl: '/ht/image/topo/l/服务器_96.json',
|
|
38
|
+
oldId: 'editor.icon.server'
|
|
39
|
+
}, {
|
|
40
|
+
id: 'icon.cloud',
|
|
41
|
+
name: '云',
|
|
42
|
+
jsonUrl: '/ht/image/topo/l/云_144.json',
|
|
43
|
+
oldId: 'editor.icon.cloud'
|
|
44
|
+
}, {
|
|
45
|
+
id: 'building',
|
|
46
|
+
name: '楼宇',
|
|
47
|
+
jsonUrl: '/ht/image/topo/l/楼宇_144.json',
|
|
48
|
+
oldId: 'editor.icon.building'
|
|
49
|
+
}, {
|
|
50
|
+
id: 'internet',
|
|
51
|
+
name: '互联网',
|
|
52
|
+
jsonUrl: '/ht/image/topo/l/互联网_144.json',
|
|
53
|
+
oldId: 'editor.icon.internet'
|
|
54
|
+
}].map(function (item) {
|
|
55
|
+
return _extends({}, item, {
|
|
56
|
+
url: item.url || item.jsonUrl.replace('.json', '.png')
|
|
57
|
+
});
|
|
58
|
+
}); // 注册
|
|
59
|
+
|
|
60
|
+
DEFAULT_NODE_ICONS.forEach(function (icon) {
|
|
61
|
+
ht.Default.setImage(icon.id, icon.jsonUrl || icon.url);
|
|
62
|
+
});
|
|
1
63
|
export default {
|
|
2
64
|
'editor.icon.cloud.small': {
|
|
3
65
|
url: '/ht/image/topo/s/云_64.png',
|
package/es/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
|
}
|
|
@@ -159,9 +159,9 @@ var UploadIconDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
159
159
|
type: _this.props.type,
|
|
160
160
|
data: files.map(function (file) {
|
|
161
161
|
return {
|
|
162
|
-
id: file.response.
|
|
162
|
+
id: file.response.result,
|
|
163
163
|
name: getFileName(file),
|
|
164
|
-
url: topoServer.icon.getDownloadUrl(file.response.
|
|
164
|
+
url: topoServer.icon.getDownloadUrl(file.response.result),
|
|
165
165
|
json: file.json
|
|
166
166
|
};
|
|
167
167
|
})
|
|
@@ -8,9 +8,31 @@ import TextPropertyView from "./text/TextPropertyView";
|
|
|
8
8
|
import NodePropertyView from "./node/NodePropertyView";
|
|
9
9
|
import ViewPropertyView from "./view/ViewPropertyView";
|
|
10
10
|
import LinkPropertyView from "./link/LinkPropertyView";
|
|
11
|
-
export default function Settings(props) {
|
|
12
|
-
var _selection$;
|
|
13
11
|
|
|
12
|
+
function getElementType(selection) {
|
|
13
|
+
var selectionElement = selection[0];
|
|
14
|
+
var selectionSize = selection.length;
|
|
15
|
+
var elementType;
|
|
16
|
+
|
|
17
|
+
if (!selectionSize) {
|
|
18
|
+
elementType = 'view';
|
|
19
|
+
} else if (isGroup(selectionElement)) {
|
|
20
|
+
elementType = 'group';
|
|
21
|
+
} else if (isNode(selectionElement)) {
|
|
22
|
+
elementType = 'node';
|
|
23
|
+
} else if (isEdge(selectionElement)) {
|
|
24
|
+
elementType = 'line';
|
|
25
|
+
} else if (isLayer(selectionElement)) {
|
|
26
|
+
// 分层
|
|
27
|
+
elementType = 'layer';
|
|
28
|
+
} else if (isText(selectionElement)) {
|
|
29
|
+
elementType = 'text';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return elementType;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default function Settings(props) {
|
|
14
36
|
var topo = props.topo,
|
|
15
37
|
topoEditApi = props.topoEditApi,
|
|
16
38
|
selection = props.selection,
|
|
@@ -22,9 +44,27 @@ export default function Settings(props) {
|
|
|
22
44
|
useEffect(function () {// const selectionModel = topo.getSelectionModel();
|
|
23
45
|
// console.info('selection change', selection)
|
|
24
46
|
}, [selection]);
|
|
25
|
-
var
|
|
47
|
+
var propertyPanelMap = {
|
|
48
|
+
view: SettingsForm,
|
|
49
|
+
node: NodePropertyView,
|
|
50
|
+
layer: LayerSettingsForm,
|
|
51
|
+
text: TextPropertyView
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (localStorage.getItem('topo.debug') === 'true') {
|
|
55
|
+
Object.assign(propertyPanelMap, {
|
|
56
|
+
line: LinkPropertyView,
|
|
57
|
+
view: ViewPropertyView
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
if (!selectionSize) {
|
|
61
|
+
// 未选择元素
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
} // TODO 待优化
|
|
65
|
+
|
|
26
66
|
|
|
27
|
-
var updateElementProperty =
|
|
67
|
+
var updateElementProperty = function updateElementProperty(name, value) {
|
|
28
68
|
// const element = topo.getDataModel().getDataById(selection[0].id);
|
|
29
69
|
var element = topo.getSelectionModel().getFirstData(); // console.info('updateElementProperty', {selection, element, name, value});
|
|
30
70
|
|
|
@@ -43,52 +83,17 @@ export default function Settings(props) {
|
|
|
43
83
|
} else if (name === 'image') {
|
|
44
84
|
element.setImage(value);
|
|
45
85
|
}
|
|
46
|
-
}, [(_selection$ = selection[0]) === null || _selection$ === void 0 ? void 0 : _selection$.id]);
|
|
47
|
-
var propertyPanelMap = {
|
|
48
|
-
view: SettingsForm,
|
|
49
|
-
layer: LayerSettingsForm // text: TextPropertyView,
|
|
50
|
-
// node: NodePropertyView,
|
|
51
|
-
|
|
52
86
|
};
|
|
53
87
|
|
|
54
|
-
|
|
55
|
-
Object.assign(propertyPanelMap, {
|
|
56
|
-
text: TextPropertyView,
|
|
57
|
-
node: NodePropertyView,
|
|
58
|
-
line: LinkPropertyView,
|
|
59
|
-
view: ViewPropertyView
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
if (!selectionSize) {
|
|
63
|
-
// 未选择元素
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var elementType;
|
|
69
|
-
var selectionElement = selection[0];
|
|
70
|
-
|
|
71
|
-
if (!selectionSize) {
|
|
72
|
-
elementType = 'view';
|
|
73
|
-
} else if (isGroup(selectionElement)) {
|
|
74
|
-
elementType = 'group';
|
|
75
|
-
} else if (isNode(selectionElement)) {
|
|
76
|
-
elementType = 'node';
|
|
77
|
-
} else if (isEdge(selectionElement)) {
|
|
78
|
-
elementType = 'line';
|
|
79
|
-
} else if (isLayer(selectionElement)) {
|
|
80
|
-
// 分层
|
|
81
|
-
elementType = 'layer';
|
|
82
|
-
} else if (isText(selectionElement)) {
|
|
83
|
-
elementType = 'text';
|
|
84
|
-
}
|
|
85
|
-
|
|
88
|
+
var elementType = getElementType(selection);
|
|
86
89
|
var Component = propertyPanelMap[elementType];
|
|
87
90
|
|
|
88
91
|
if (!Component) {
|
|
89
92
|
return null;
|
|
90
93
|
}
|
|
91
94
|
|
|
95
|
+
var attrTypes = ['attrObject', 'position', 'styleMap'];
|
|
96
|
+
|
|
92
97
|
var values = _extends({}, selection[0]);
|
|
93
98
|
|
|
94
99
|
attrTypes.forEach(function (type) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.settingsPanel {
|
|
2
|
-
width:
|
|
2
|
+
width: 280px;
|
|
3
3
|
height: 100%;
|
|
4
4
|
position: absolute;
|
|
5
5
|
top: 0;
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
}
|
|
35
35
|
.next-collapse-panel-title {
|
|
36
36
|
background: none;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
padding-bottom: 0;
|
|
39
|
+
}
|
|
40
|
+
.next-collapse-panel-content {
|
|
41
|
+
padding-left: 32px;
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
|
|
File without changes
|
|
@@ -33,6 +33,7 @@ export default function NodeSizeInput(props) {
|
|
|
33
33
|
}, /*#__PURE__*/React.createElement(_NumberPicker, {
|
|
34
34
|
name: "width",
|
|
35
35
|
min: 1,
|
|
36
|
+
max: 2000,
|
|
36
37
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
37
38
|
style: {
|
|
38
39
|
width: '100%'
|
|
@@ -43,6 +44,7 @@ export default function NodeSizeInput(props) {
|
|
|
43
44
|
}, /*#__PURE__*/React.createElement(_NumberPicker, {
|
|
44
45
|
name: "height",
|
|
45
46
|
min: 1,
|
|
47
|
+
max: 2000,
|
|
46
48
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
47
49
|
style: {
|
|
48
50
|
width: '100%'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
|
|
4
|
+
<title>topo/source/Icon/解锁</title>
|
|
5
|
+
<desc>Created with Sketch.</desc>
|
|
6
|
+
<g id="topo/source/Icon/解锁" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
7
|
+
<g id="Icon-HTSCIT_lianjieduankai" fill-rule="nonzero">
|
|
8
|
+
<g id="编组">
|
|
9
|
+
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="16" height="16"></rect>
|
|
10
|
+
<path d="M12.16836,11.80814 L4.69432,4.33403 L5.41203,3.61632 L12.88607,11.09043 L12.16836,11.80814 Z M6.20072,10.5109 L5.48301,9.79326 L6.9976,8.27867 L7.71531,8.99638 L6.20072,10.5109 Z" id="形状" fill="#4D6277"></path>
|
|
11
|
+
<polygon id="路径" fill="#4D6277" points="9.79536 5.48126 10.51307 6.19897 8.99848 7.71363 8.28077 6.99592"></polygon>
|
|
12
|
+
<path d="M9.729,3.303 L12.704,6.271 L10.128,8.847 L10.842,9.554 L13.775,6.621 L14.132,6.264 L13.775,5.907 L10.086,2.225 L9.729,1.868 L9.379,2.225 L6.439,5.158 L7.16,5.872 L9.729,3.303 Z M6.264,12.711 L3.296,9.743 L5.879,7.16 L5.158,6.439 L2.225,9.372 L1.868,9.729 L2.225,10.086 L5.914,13.775 L6.271,14.132 L6.621,13.775 L9.561,10.842 L8.847,10.128 L6.264,12.711 Z" id="形状" fill="#4D6277"></path>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
|
|
4
|
+
<title>topo/source/Icon/锁</title>
|
|
5
|
+
<desc>Created with Sketch.</desc>
|
|
6
|
+
<g id="topo/source/Icon/锁" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
7
|
+
<g id="Icon-HTSCIT_lianjie" fill-rule="nonzero">
|
|
8
|
+
<g id="编组">
|
|
9
|
+
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="16" height="16"></rect>
|
|
10
|
+
<path d="M6.264,12.711 L3.296,9.743 L5.879,7.16 L5.158,6.439 L2.225,9.372 L1.868,9.729 L2.225,10.086 L5.914,13.775 L6.271,14.132 L6.621,13.775 L9.561,10.842 L8.847,10.128 L6.264,12.711 Z M9.729,3.303 L12.704,6.271 L10.128,8.847 L10.842,9.554 L13.775,6.621 L14.132,6.264 L13.775,5.907 L10.086,2.225 L9.729,1.868 L9.379,2.225 L6.439,5.158 L7.16,5.872 L9.729,3.303 Z" id="形状" fill="#4D6277"></path>
|
|
11
|
+
<polygon id="路径" fill="#4D6277" points="10.51846 6.20114 6.20226 10.51727 5.48462 9.79956 9.80075 5.48336"></polygon>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function FontStyleCheckbox(props: any): JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _Button from "@alifd/next/lib/button";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import styles from "./FontStyleCheckbox.module.scss";
|
|
6
|
+
import b from "./img/bold.svg";
|
|
7
|
+
import i from "./img/italics.svg";
|
|
8
|
+
import u from "./img/underline.svg";
|
|
9
|
+
export default function FontStyleCheckbox(props) {
|
|
10
|
+
var value = props.value,
|
|
11
|
+
onChange = props.onChange;
|
|
12
|
+
var options = [{
|
|
13
|
+
name: 'bold',
|
|
14
|
+
img: b,
|
|
15
|
+
title: '粗体'
|
|
16
|
+
}, {
|
|
17
|
+
name: 'italic',
|
|
18
|
+
img: i,
|
|
19
|
+
title: '斜体'
|
|
20
|
+
}, {
|
|
21
|
+
name: 'underline',
|
|
22
|
+
img: u,
|
|
23
|
+
title: '下划线'
|
|
24
|
+
}];
|
|
25
|
+
|
|
26
|
+
var handleClick = function handleClick(name) {
|
|
27
|
+
var _extends2;
|
|
28
|
+
|
|
29
|
+
onChange(_extends({}, value, (_extends2 = {}, _extends2[name] = !value[name], _extends2)));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return /*#__PURE__*/React.createElement(_Button.Group, {
|
|
33
|
+
className: styles.buttonGroup
|
|
34
|
+
}, options.map(function (item) {
|
|
35
|
+
var _classnames;
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(_Button, {
|
|
38
|
+
key: item.name,
|
|
39
|
+
className: classnames(styles.button, (_classnames = {}, _classnames[styles.checked] = value[item.name], _classnames)),
|
|
40
|
+
onClick: function onClick() {
|
|
41
|
+
handleClick(item.name);
|
|
42
|
+
},
|
|
43
|
+
title: item.title
|
|
44
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
45
|
+
src: item.img,
|
|
46
|
+
alt: ""
|
|
47
|
+
}));
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import "@alifd/theme-19926/variables";
|
|
2
|
+
|
|
3
|
+
.buttonGroup {
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.button {
|
|
8
|
+
flex: 1;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
|
|
13
|
+
&:global {
|
|
14
|
+
&.next-btn.next-btn-normal:hover {
|
|
15
|
+
background: #F2F7FD;
|
|
16
|
+
border: 1px solid $input-border-color;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.checked {
|
|
23
|
+
|
|
24
|
+
&:global {
|
|
25
|
+
&.next-btn.next-btn-normal {
|
|
26
|
+
background: #F2F7FD;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function TextStyle(props: any): JSX.Element;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import _NumberPicker from "@alifd/next/lib/number-picker";
|
|
2
|
+
import _Form from "@alifd/next/lib/form";
|
|
3
|
+
import _Field from "@alifd/next/lib/field";
|
|
4
|
+
import _Select from "@alifd/next/lib/select";
|
|
5
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
6
|
+
import ColorPicker from "../../../LinkDynamicStyleSettingDrawer/rule/ColorPicker";
|
|
7
|
+
import FontStyleCheckbox from "./FontStyleCheckbox";
|
|
8
|
+
var Option = _Select.Option;
|
|
9
|
+
|
|
10
|
+
function parseValue(value) {
|
|
11
|
+
return {
|
|
12
|
+
fontFamily: value.font.fontFamily || '黑体',
|
|
13
|
+
fontSize: value.font.fontSize || 12,
|
|
14
|
+
color: value.color || '#000000',
|
|
15
|
+
fontStyleChecked: {
|
|
16
|
+
underline: value.underline,
|
|
17
|
+
bold: value.font.bold,
|
|
18
|
+
italic: value.font.italic
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function TextStyle(props) {
|
|
24
|
+
var value = props.value,
|
|
25
|
+
_onChange = props.onChange;
|
|
26
|
+
|
|
27
|
+
var field = _Field.useField({
|
|
28
|
+
autoUnmount: false,
|
|
29
|
+
values: parseValue(value),
|
|
30
|
+
onChange: function onChange(name, value) {
|
|
31
|
+
var values = field.getValues();
|
|
32
|
+
var aValues = {
|
|
33
|
+
color: values.color,
|
|
34
|
+
underline: values.fontStyleChecked.underline,
|
|
35
|
+
font: {
|
|
36
|
+
fontFamily: values.fontFamily,
|
|
37
|
+
fontSize: values.fontSize,
|
|
38
|
+
bold: values.fontStyleChecked.bold,
|
|
39
|
+
italic: values.fontStyleChecked.italic
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
_onChange && _onChange(aValues);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
field.setValues(parseValue(value));
|
|
48
|
+
}, [value]);
|
|
49
|
+
return /*#__PURE__*/React.createElement(_Form, {
|
|
50
|
+
field: field,
|
|
51
|
+
labelAlign: "top",
|
|
52
|
+
component: "div"
|
|
53
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
style: {
|
|
55
|
+
display: 'flex'
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
style: {
|
|
59
|
+
flex: 1,
|
|
60
|
+
paddingRight: 12
|
|
61
|
+
}
|
|
62
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
63
|
+
label: "\u5B57\u4F53"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
|
65
|
+
defaultValue: "\u9ED1\u4F53",
|
|
66
|
+
name: "fontFamily",
|
|
67
|
+
style: {
|
|
68
|
+
width: '100%',
|
|
69
|
+
marginRight: 8
|
|
70
|
+
}
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Option, {
|
|
72
|
+
value: "\u5B8B\u4F53"
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
style: {
|
|
75
|
+
fontFamily: '宋体'
|
|
76
|
+
}
|
|
77
|
+
}, "\u5B8B\u4F53")), /*#__PURE__*/React.createElement(Option, {
|
|
78
|
+
value: "\u9ED1\u4F53"
|
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
style: {
|
|
81
|
+
fontFamily: '黑体'
|
|
82
|
+
}
|
|
83
|
+
}, "\u9ED1\u4F53")), /*#__PURE__*/React.createElement(Option, {
|
|
84
|
+
value: "Arial"
|
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
style: {
|
|
87
|
+
fontFamily: 'Arial'
|
|
88
|
+
}
|
|
89
|
+
}, "Arial"))))), /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
style: {
|
|
91
|
+
width: 70
|
|
92
|
+
}
|
|
93
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
94
|
+
label: "\u5B57\u53F7",
|
|
95
|
+
hasFeedback: true,
|
|
96
|
+
required: true,
|
|
97
|
+
requiredMessage: "\u4E0D\u80FD\u4E3A\u7A7A",
|
|
98
|
+
requiredTrigger: "onBlur",
|
|
99
|
+
asterisk: false
|
|
100
|
+
}, /*#__PURE__*/React.createElement(_NumberPicker, {
|
|
101
|
+
name: "fontSize",
|
|
102
|
+
min: 8,
|
|
103
|
+
max: 36,
|
|
104
|
+
style: {
|
|
105
|
+
width: '100%',
|
|
106
|
+
marginRight: 8
|
|
107
|
+
},
|
|
108
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
109
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
style: {
|
|
111
|
+
display: 'flex'
|
|
112
|
+
}
|
|
113
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
style: {
|
|
115
|
+
flex: 1,
|
|
116
|
+
paddingRight: 12
|
|
117
|
+
}
|
|
118
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
119
|
+
label: "\u6837\u5F0F"
|
|
120
|
+
}, /*#__PURE__*/React.createElement(FontStyleCheckbox, {
|
|
121
|
+
name: "fontStyleChecked"
|
|
122
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
style: {
|
|
124
|
+
width: 70
|
|
125
|
+
}
|
|
126
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
127
|
+
label: "\u989C\u8272"
|
|
128
|
+
}, /*#__PURE__*/React.createElement(ColorPicker, {
|
|
129
|
+
name: "color",
|
|
130
|
+
align: "br"
|
|
131
|
+
}))))));
|
|
132
|
+
}
|
|
133
|
+
;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default fontStyleUtil;
|
|
2
|
+
declare namespace fontStyleUtil {
|
|
3
|
+
export function toMap(font?: string): {
|
|
4
|
+
fontFamily: string;
|
|
5
|
+
fontSize: number;
|
|
6
|
+
bold: boolean;
|
|
7
|
+
italic: boolean;
|
|
8
|
+
};
|
|
9
|
+
export function toMap(font?: string): {
|
|
10
|
+
fontFamily: string;
|
|
11
|
+
fontSize: number;
|
|
12
|
+
bold: boolean;
|
|
13
|
+
italic: boolean;
|
|
14
|
+
};
|
|
15
|
+
export function build(style: any): string;
|
|
16
|
+
export function build(style: any): string;
|
|
17
|
+
export function getFontStyleMap(obj: any, prefix: any): {};
|
|
18
|
+
export function getFontStyleMap(obj: any, prefix: any): {};
|
|
19
|
+
}
|