@riil-frontend/component-topology 2.3.20 → 2.4.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/build/1.js +2 -2
  3. package/build/2.js +1 -1
  4. package/build/index.css +1 -1
  5. package/build/index.js +28 -28
  6. 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
  7. package/es/components/Drawer/index.js +2 -1
  8. package/es/components/Drawer/index.module.scss +13 -0
  9. package/es/components/ResourceList/ResourceSelect.js +3 -2
  10. package/es/components/ResourceList/ResourceSelect.module.scss +7 -0
  11. package/es/components/ResourceSelect/ResourceSelectDrawer.js +3 -1
  12. package/es/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.d.ts +15 -0
  13. package/es/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js +62 -0
  14. package/es/core/common/text.module.scss +5 -0
  15. package/es/core/components/TopoView/Topo.js +0 -6
  16. package/es/core/components/titlebar/TitleBar.module.scss +7 -1
  17. package/es/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +7 -3
  18. package/es/core/editor/components/iconManage/UploadIconDialog.js +2 -2
  19. package/es/core/editor/components/settings/README.md +2 -0
  20. package/es/core/editor/components/settings/Settings.js +47 -42
  21. package/es/core/editor/components/settings/Settings.module.scss +8 -2
  22. package/es/core/editor/components/settings/common/{NodeSizeInput.d.ts → NodeSizeInput/NodeSizeInput.d.ts} +0 -0
  23. package/es/core/editor/components/settings/common/{NodeSizeInput.js → NodeSizeInput/NodeSizeInput.js} +2 -0
  24. package/es/core/editor/components/settings/common/NodeSizeInput/img/icon_/350/247/243/351/224/201.svg +16 -0
  25. package/es/core/editor/components/settings/common/NodeSizeInput/img/icon_/351/224/201.svg +15 -0
  26. package/es/core/editor/components/settings/common/text/FontStyleCheckbox.d.ts +1 -0
  27. package/es/core/editor/components/settings/common/text/FontStyleCheckbox.js +50 -0
  28. package/es/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +31 -0
  29. package/es/core/editor/components/settings/common/text/TextStyle.d.ts +1 -0
  30. package/es/core/editor/components/settings/common/text/TextStyle.js +133 -0
  31. package/es/core/editor/components/settings/common/text/fontStyleUtil.d.ts +19 -0
  32. package/es/core/editor/components/settings/common/text/fontStyleUtil.js +53 -0
  33. package/es/core/editor/components/settings/common/text/img/bold.svg +12 -0
  34. package/es/core/editor/components/settings/common/text/img/italics.svg +10 -0
  35. package/es/core/editor/components/settings/common/text/img/underline.svg +12 -0
  36. package/es/core/editor/components/settings/group/GroupNodeList/ResourceList.js +22 -6
  37. package/es/core/editor/components/settings/group/GroupNodeList/ResourceList.module.scss +16 -0
  38. package/es/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -0
  39. package/es/core/editor/components/settings/group/GroupNodeList/icon.js +20 -1
  40. package/es/core/editor/components/settings/node/NodeIconSelect.d.ts +1 -0
  41. package/es/core/editor/components/settings/node/NodeIconSelect.js +42 -0
  42. package/es/core/editor/components/settings/node/NodePropertyView.d.ts +1 -1
  43. package/es/core/editor/components/settings/node/NodePropertyView.js +121 -126
  44. package/es/core/editor/components/settings/node/NodeRelateResourceButton.d.ts +4 -0
  45. package/es/core/editor/components/settings/node/NodeRelateResourceButton.js +22 -0
  46. package/es/core/editor/components/settings/node/TopoTreeSelect.d.ts +1 -0
  47. package/es/core/editor/components/settings/node/TopoTreeSelect.js +40 -0
  48. package/es/core/editor/components/settings/text/TextPropertyView.js +30 -144
  49. package/es/core/editor/components/settings/view/ViewPropertyView.js +1 -1
  50. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +4 -4
  51. package/es/core/editor/{buildContextmenu.d.ts → contextmenu/buildContextmenu.d.ts} +1 -4
  52. package/es/core/editor/contextmenu/buildContextmenu.js +10 -0
  53. package/es/hooks/useSelection.js +9 -3
  54. package/es/plugins/useSelectionPlugin.d.ts +23 -0
  55. package/es/plugins/useSelectionPlugin.js +84 -0
  56. package/es/style.js +1 -0
  57. package/es/topoCenter/store/topoTreeMod.d.ts +3 -2
  58. package/es/topoCenter/store/topoTreeMod.js +34 -180
  59. package/es/utils/htElementDataUtil.js +1 -1
  60. package/es/utils/topoData.js +1 -1
  61. package/es/utils/tree.js +1 -1
  62. package/lib/components/Drawer/index.js +2 -1
  63. package/lib/components/Drawer/index.module.scss +13 -0
  64. package/lib/components/ResourceList/ResourceSelect.js +4 -2
  65. package/lib/components/ResourceList/ResourceSelect.module.scss +7 -0
  66. package/lib/components/ResourceSelect/ResourceSelectDrawer.js +3 -1
  67. package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.d.ts +15 -0
  68. package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js +68 -1
  69. package/lib/core/common/text.module.scss +5 -0
  70. package/lib/core/components/TopoView/Topo.js +0 -12
  71. package/lib/core/components/titlebar/TitleBar.module.scss +7 -1
  72. package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +7 -3
  73. package/lib/core/editor/components/iconManage/UploadIconDialog.js +2 -2
  74. package/lib/core/editor/components/settings/README.md +2 -0
  75. package/lib/core/editor/components/settings/Settings.js +45 -42
  76. package/lib/core/editor/components/settings/Settings.module.scss +8 -2
  77. package/lib/core/editor/components/settings/common/{NodeSizeInput.d.ts → NodeSizeInput/NodeSizeInput.d.ts} +0 -0
  78. package/lib/core/editor/components/settings/common/{NodeSizeInput.js → NodeSizeInput/NodeSizeInput.js} +2 -0
  79. package/lib/core/editor/components/settings/common/NodeSizeInput/img/icon_/350/247/243/351/224/201.svg +16 -0
  80. package/lib/core/editor/components/settings/common/NodeSizeInput/img/icon_/351/224/201.svg +15 -0
  81. package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.d.ts +1 -0
  82. package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.js +68 -0
  83. package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +31 -0
  84. package/lib/core/editor/components/settings/common/text/TextStyle.d.ts +1 -0
  85. package/lib/core/editor/components/settings/common/text/TextStyle.js +150 -0
  86. package/lib/core/editor/components/settings/common/text/fontStyleUtil.d.ts +19 -0
  87. package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +58 -0
  88. package/lib/core/editor/components/settings/common/text/img/bold.svg +12 -0
  89. package/lib/core/editor/components/settings/common/text/img/italics.svg +10 -0
  90. package/lib/core/editor/components/settings/common/text/img/underline.svg +12 -0
  91. package/lib/core/editor/components/settings/group/GroupNodeList/ResourceList.js +22 -7
  92. package/lib/core/editor/components/settings/group/GroupNodeList/ResourceList.module.scss +16 -0
  93. package/lib/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -0
  94. package/lib/core/editor/components/settings/group/GroupNodeList/icon.js +23 -1
  95. package/lib/core/editor/components/settings/node/NodeIconSelect.d.ts +1 -0
  96. package/lib/core/editor/components/settings/node/NodeIconSelect.js +57 -0
  97. package/lib/core/editor/components/settings/node/NodePropertyView.d.ts +1 -1
  98. package/lib/core/editor/components/settings/node/NodePropertyView.js +127 -129
  99. package/lib/core/editor/components/settings/node/NodeRelateResourceButton.d.ts +4 -0
  100. package/lib/core/editor/components/settings/node/NodeRelateResourceButton.js +31 -0
  101. package/lib/core/editor/components/settings/node/TopoTreeSelect.d.ts +1 -0
  102. package/lib/core/editor/components/settings/node/TopoTreeSelect.js +53 -0
  103. package/lib/core/editor/components/settings/text/TextPropertyView.js +29 -149
  104. package/lib/core/editor/components/settings/view/ViewPropertyView.js +1 -1
  105. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +5 -4
  106. package/lib/core/editor/{buildContextmenu.d.ts → contextmenu/buildContextmenu.d.ts} +1 -4
  107. package/lib/core/editor/{buildContextmenu.js → contextmenu/buildContextmenu.js} +3 -7
  108. package/lib/hooks/useSelection.js +9 -3
  109. package/lib/plugins/useSelectionPlugin.d.ts +23 -0
  110. package/lib/plugins/useSelectionPlugin.js +90 -0
  111. package/lib/style.js +1 -0
  112. package/lib/topoCenter/store/topoTreeMod.d.ts +3 -2
  113. package/lib/topoCenter/store/topoTreeMod.js +34 -184
  114. package/lib/utils/htElementDataUtil.js +1 -1
  115. package/lib/utils/topoData.js +1 -1
  116. package/lib/utils/tree.js +1 -1
  117. package/package.json +6 -6
  118. package/es/core/editor/buildContextmenu.js +0 -14
@@ -1,6 +1,5 @@
1
- import _Input from "@alifd/next/lib/input";
2
1
  import _Tab from "@alifd/next/lib/tab";
3
- import _Button from "@alifd/next/lib/button";
2
+ import _Input from "@alifd/next/lib/input";
4
3
  import _Field from "@alifd/next/lib/field";
5
4
  import _extends from "@babel/runtime/helpers/extends";
6
5
  import _Radio from "@alifd/next/lib/radio";
@@ -12,94 +11,49 @@ import React, { useState, useEffect } from 'react';
12
11
  import ColorPicker from "../../LinkDynamicStyleSettingDrawer/rule/ColorPicker";
13
12
  import ResourceSelectButton from "../group/GroupNodeList/ResourceSelectButton";
14
13
  import { getIconMap } from "../group/GroupNodeList/icon";
15
- import NodeSizeInput from "../common/NodeSizeInput";
14
+ import NodeSizeInput from "../common/NodeSizeInput/NodeSizeInput";
15
+ import textStyles from "../../../../common/text.module.scss";
16
+ import TopoTreeSelect from "./TopoTreeSelect";
17
+ import NodeIconSelect from "./NodeIconSelect";
18
+ import NodeRelateResourceButton from "./NodeRelateResourceButton";
16
19
  var FormItem = _Form.Item;
17
20
  var Row = _Grid.Row,
18
21
  Col = _Grid.Col;
19
22
  var Option = _Select.Option;
20
23
  var CollapsePanel = _Collapse.Panel;
21
- var RadioGroup = _Radio.Group; // 字体样式格式 label.font: bold italic 12px 黑体 / 12px 黑体
24
+ var RadioGroup = _Radio.Group;
22
25
 
23
- var fontStyleUtil = {
24
- toMap: function toMap(font, prefix) {
25
- var arr = font.trim().split(' ');
26
- var bold = font.indexOf('bold') > -1;
27
- var italic = font.indexOf('bold') > -1;
28
- var map = {
29
- fontFamily: arr[1],
30
- fontSize: parseInt(arr[0].replace('px', ''), 10),
31
- bold: bold,
32
- italic: italic,
33
- underline: false
34
- };
35
- return Object.keys(map).reduce(function (result, key) {
36
- result["" + prefix + key] = map[key];
37
- return result;
38
- }, {});
39
- },
40
- getFontStyleMap: function getFontStyleMap(obj, prefix) {
41
- var map = {};
42
- Object.keys(obj).forEach(function (key) {
43
- if (key.startsWith(prefix)) {
44
- map[key.replace(prefix, '')] = obj[key];
45
- }
46
- });
47
- console.error(obj, prefix, map);
48
- return map;
49
- },
50
- build: function build(style) {
51
- return style.fontSize + "px " + style.fontFamily;
26
+ function parseValues(values) {
27
+ return _extends({}, values);
28
+ }
29
+
30
+ function getBindType(values) {
31
+ if (values.tag) {
32
+ return 'resource';
52
33
  }
53
- }; // 线型--node.s('dash',false) ---false代表是实线,默认为true代表虚线
54
- // 线型为实线时设置颜色--node.s('borderColor','rgba(0,0,0,0.00)') //默认颜色rgba(0,0,0,0.00)
55
- // 线型为虚线时设置颜色--node.s('dashColor','rgb(173,173,173)') //默认颜色rgb(173,173,173)
56
- // 线宽--node.s('borderWidth',1)//默认宽度是1
57
- //
58
- //
59
- // 为了实现切换时更好的效果,在设置线型为虚线时可以这样设置:
60
- // node.s('dash',true);
61
- // node.s('borderColor','rgba(0,0,0,0.00)');//将borderColor改为默认
62
- // node.s('dashColor','当前设置的颜色')
63
- // 虚线颜色用的是dashColor
64
- //
65
- // 设置线型为实线时
66
- // node.s('dash',false);
67
- // node.s('borderColor','当前设置的颜色');
68
- // node.s('dashColor','rgb(173,173,173)');dash可设置为默认
69
- // 实线用的是borderColor
70
34
 
71
- function parseValues(values) {
72
- return _extends({}, values, fontStyleUtil.toMap(values['styleMap.label.font'], 'styleMap.label.fontStyle.'), {
73
- // 层间线
74
- 'styleMap.borderType': values['styleMap.dash'] === false ? 'solid' : 'dash',
75
- 'styleMap.dashColor': values['styleMap.dashColor'] || 'rgb(173,173,173)',
76
- 'styleMap.borderWidth': values['styleMap.borderWidth'] || 1
77
- });
35
+ if (values.attr.bindType) {
36
+ return values.attr.bindType;
37
+ }
38
+
39
+ return 'none';
78
40
  }
79
41
 
80
- export default function TextPropertyView(props) {
42
+ export default function NodePropertyView(props) {
43
+ var _topo$options$editor;
44
+
81
45
  var topo = props.topo,
82
46
  topoEditApi = props.topoEditApi,
83
47
  values = props.values,
84
48
  _onChange = props.onChange,
85
49
  editorProps = props.editorProps;
50
+ var bindType = getBindType(values);
86
51
 
87
52
  var field = _Field.useField({
88
53
  autoUnmount: false,
89
54
  values: parseValues(values),
90
55
  onChange: function onChange(name, value) {
91
- var newValues = field.getValues(); // 文字font样式
92
-
93
- if (name.startsWith('styleMap.label.fontStyle.')) {
94
- name = 'styleMap.label.font';
95
- value = fontStyleUtil.build(fontStyleUtil.getFontStyleMap(newValues, 'styleMap.label.fontStyle.'));
96
- } // 层间线
97
-
98
-
99
- if (name === 'styleMap.borderType') {
100
- name = 'styleMap.dash';
101
- value = value === 'dash';
102
- }
56
+ var newValues = field.getValues();
103
57
 
104
58
  if (values[name] !== value) {
105
59
  _onChange(name, value, newValues);
@@ -107,67 +61,108 @@ export default function TextPropertyView(props) {
107
61
  }
108
62
  });
109
63
 
64
+ var setBindType = function setBindType(value) {
65
+ _onChange('attrObject.bindType', value);
66
+ };
67
+
110
68
  useEffect(function () {
111
69
  field.setValues(parseValues(values));
112
70
  }, [values]);
113
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Tab, null, /*#__PURE__*/React.createElement(_Tab.Item, {
71
+
72
+ var renderData = function renderData() {
73
+ return /*#__PURE__*/React.createElement(_Collapse, {
74
+ defaultExpandedKeys: ['相关资源'],
75
+ style: {
76
+ border: 'none'
77
+ }
78
+ }, /*#__PURE__*/React.createElement(CollapsePanel, {
79
+ key: "\u76F8\u5173\u8D44\u6E90",
80
+ title: "\u76F8\u5173\u8D44\u6E90"
81
+ }, /*#__PURE__*/React.createElement(_Form, {
82
+ field: field,
83
+ labelAlign: "top"
84
+ }, !values.tag && /*#__PURE__*/React.createElement(_Form.Item, {
85
+ label: "\u5173\u8054\u7C7B\u578B"
86
+ }, /*#__PURE__*/React.createElement(_Select, {
87
+ name: "bindType",
88
+ value: bindType,
89
+ style: {
90
+ width: '100%',
91
+ marginRight: 8
92
+ },
93
+ onChange: setBindType
94
+ }, /*#__PURE__*/React.createElement(Option, {
95
+ value: "none"
96
+ }, "\u672A\u5173\u8054"), /*#__PURE__*/React.createElement(Option, {
97
+ value: "resource"
98
+ }, "\u5173\u8054\u8D44\u6E90"), /*#__PURE__*/React.createElement(Option, {
99
+ value: "topo"
100
+ }, "\u5173\u8054\u62D3\u6251"))), bindType === 'resource' && /*#__PURE__*/React.createElement(_Form.Item, {
101
+ label: "\u5173\u8054\u8D44\u6E90"
102
+ }, /*#__PURE__*/React.createElement("div", {
103
+ style: {
104
+ display: 'flex'
105
+ }
106
+ }, /*#__PURE__*/React.createElement("div", {
107
+ className: textStyles.textEllipsis,
108
+ style: {
109
+ flex: 1,
110
+ paddingRight: 16,
111
+ color: '#4D6277'
112
+ },
113
+ title: values.tag ? values.name : null
114
+ }, values.tag ? values.name : '—'), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
115
+ node: values,
116
+ topo: topo,
117
+ topoEditApi: topoEditApi
118
+ }))), bindType === 'topo' && /*#__PURE__*/React.createElement(_Form.Item, {
119
+ label: "\u5173\u8054\u62D3\u6251"
120
+ }, /*#__PURE__*/React.createElement(TopoTreeSelect, null)))));
121
+ };
122
+
123
+ var renderViewSetting = function renderViewSetting() {
124
+ return /*#__PURE__*/React.createElement(_Form, {
125
+ field: field,
126
+ labelAlign: "top"
127
+ }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
128
+ defaultExpandedKeys: ['显示设置'],
129
+ style: {
130
+ border: 'none'
131
+ }
132
+ }, /*#__PURE__*/React.createElement(CollapsePanel, {
133
+ key: "\u663E\u793A\u8BBE\u7F6E",
134
+ title: "\u663E\u793A\u8BBE\u7F6E"
135
+ }, /*#__PURE__*/React.createElement(_Form.Item, {
136
+ label: "\u56FE\u7247\u540D\u79F0"
137
+ }, /*#__PURE__*/React.createElement(_Input, {
138
+ name: "attrObject.name"
139
+ })), /*#__PURE__*/React.createElement(_Form.Item, {
140
+ label: "\u663E\u793A\u56FE\u7247"
141
+ }, /*#__PURE__*/React.createElement(NodeIconSelect, {
142
+ name: "image",
143
+ topo: topo
144
+ })), /*#__PURE__*/React.createElement(_Form.Item, {
145
+ label: "\u56FE\u7247\u5C3A\u5BF8"
146
+ }, /*#__PURE__*/React.createElement(NodeSizeInput, {
147
+ value: {
148
+ width: values.width,
149
+ height: values.height
150
+ },
151
+ onChange: function onChange(size) {
152
+ _onChange('width', size.width);
153
+
154
+ _onChange('height', size.height);
155
+ }
156
+ }))))));
157
+ }; // 未绑定资源的节点,根据参数控制是否可关联资源
158
+
159
+
160
+ var showRelateResource = !!values.tag || !values.tag && ((_topo$options$editor = topo.options.editor) === null || _topo$options$editor === void 0 ? void 0 : _topo$options$editor.enableRelateResource) !== false;
161
+ return /*#__PURE__*/React.createElement("div", null, showRelateResource ? /*#__PURE__*/React.createElement(_Tab, null, /*#__PURE__*/React.createElement(_Tab.Item, {
114
162
  title: "\u6570\u636E",
115
163
  key: "1"
116
- }, /*#__PURE__*/React.createElement(_Collapse, {
117
- defaultExpandedKeys: ['相关资源'],
118
- style: {
119
- border: 'none'
120
- }
121
- }, /*#__PURE__*/React.createElement(CollapsePanel, {
122
- key: "\u76F8\u5173\u8D44\u6E90",
123
- title: "\u76F8\u5173\u8D44\u6E90"
124
- }, "\u5173\u8054\u8D44\u6E90", /*#__PURE__*/React.createElement("br", null), values.name, /*#__PURE__*/React.createElement(_Button, {
125
- text: true,
126
- onClick: function onClick() {
127
- topoEditApi.bindNodeResource({});
128
- }
129
- })))), /*#__PURE__*/React.createElement(_Tab.Item, {
164
+ }, renderData()), /*#__PURE__*/React.createElement(_Tab.Item, {
130
165
  title: "\u8BBE\u7F6E",
131
166
  key: "2"
132
- }, /*#__PURE__*/React.createElement(_Form, {
133
- field: field,
134
- labelAlign: "top"
135
- }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
136
- defaultExpandedKeys: ['显示设置'],
137
- style: {
138
- border: 'none'
139
- }
140
- }, /*#__PURE__*/React.createElement(CollapsePanel, {
141
- key: "\u663E\u793A\u8BBE\u7F6E",
142
- title: "\u663E\u793A\u8BBE\u7F6E"
143
- }, /*#__PURE__*/React.createElement(_Form.Item, {
144
- label: "\u540D\u79F0"
145
- }, /*#__PURE__*/React.createElement(_Input, {
146
- name: "attrObject.name"
147
- })), /*#__PURE__*/React.createElement(_Form.Item, {
148
- label: "\u663E\u793A\u56FE\u7247"
149
- }, /*#__PURE__*/React.createElement(_Select, {
150
- name: "image",
151
- style: {
152
- width: '100%',
153
- marginRight: 8
154
- }
155
- }, Object.keys(getIconMap(topo)).map(function (id) {
156
- return /*#__PURE__*/React.createElement(Option, {
157
- key: id,
158
- value: id
159
- }, id);
160
- }))), /*#__PURE__*/React.createElement(_Form.Item, {
161
- label: "\u56FE\u7247\u5C3A\u5BF8"
162
- }, /*#__PURE__*/React.createElement(NodeSizeInput, {
163
- value: {
164
- width: values.width,
165
- height: values.height
166
- },
167
- onChange: function onChange(size) {
168
- _onChange('width', size.width);
169
-
170
- _onChange('height', size.height);
171
- }
172
- })))))))));
167
+ }, renderViewSetting())) : renderViewSetting());
173
168
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @return {React.ReactNode | null}
3
+ */
4
+ export default function NodeRelateResourceButton(props: any): any | null;
@@ -0,0 +1,22 @@
1
+ import _Button from "@alifd/next/lib/button";
2
+ import React from 'react';
3
+
4
+ /**
5
+ * @return {React.ReactNode | null}
6
+ */
7
+ export default function NodeRelateResourceButton(props) {
8
+ var _node$attr$data;
9
+
10
+ var topo = props.topo,
11
+ topoEditApi = props.topoEditApi,
12
+ node = props.node;
13
+ var hide = ((_node$attr$data = node.attr.data) === null || _node$attr$data === void 0 ? void 0 : _node$attr$data.relateResource) === false;
14
+ return !hide ? /*#__PURE__*/React.createElement(_Button, {
15
+ type: "primary",
16
+ text: true,
17
+ onClick: function onClick() {
18
+ topoEditApi.bindNodeResource({});
19
+ }
20
+ }, "\u9009\u62E9\u8D44\u6E90") : null;
21
+ }
22
+ ;
@@ -0,0 +1 @@
1
+ export default function TopoTreeSelect(props: any): JSX.Element;
@@ -0,0 +1,40 @@
1
+ import _TreeSelect from "@alifd/next/lib/tree-select";
2
+ import React, { useState, useEffect, useRef, useCallback } from 'react';
3
+ var TreeNode = _TreeSelect.Node;
4
+ export default function TopoTreeSelect(props) {
5
+ var onChange = props.onChange;
6
+ return /*#__PURE__*/React.createElement(_TreeSelect, {
7
+ treeDefaultExpandAll: true,
8
+ onChange: onChange,
9
+ style: {
10
+ width: '100%',
11
+ marginRight: 8
12
+ }
13
+ }, /*#__PURE__*/React.createElement(TreeNode, {
14
+ key: "1",
15
+ value: "1",
16
+ label: "Component"
17
+ }, /*#__PURE__*/React.createElement(TreeNode, {
18
+ key: "2",
19
+ value: "2",
20
+ label: "Form"
21
+ }, /*#__PURE__*/React.createElement(TreeNode, {
22
+ key: "4",
23
+ value: "4",
24
+ label: "Input"
25
+ }), /*#__PURE__*/React.createElement(TreeNode, {
26
+ key: "5",
27
+ value: "5",
28
+ label: "Select",
29
+ disabled: true
30
+ })), /*#__PURE__*/React.createElement(TreeNode, {
31
+ key: "3",
32
+ value: "3",
33
+ label: "Display"
34
+ }, /*#__PURE__*/React.createElement(TreeNode, {
35
+ key: "6",
36
+ value: "6",
37
+ label: "Table"
38
+ }))));
39
+ }
40
+ ;
@@ -1,77 +1,19 @@
1
- import _NumberPicker from "@alifd/next/lib/number-picker";
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 _Select from "@alifd/next/lib/select";
8
- import _Grid from "@alifd/next/lib/grid";
9
- import _Form from "@alifd/next/lib/form";
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
- var arr = font.trim().split(' ');
24
- var bold = font.indexOf('bold') > -1;
25
- var italic = font.indexOf('bold') > -1;
26
- var map = {
27
- fontFamily: arr[1],
28
- fontSize: parseInt(arr[0].replace('px', ''), 10),
29
- bold: bold,
30
- italic: italic,
31
- underline: false
32
- };
33
- return Object.keys(map).reduce(function (result, key) {
34
- result["" + prefix + key] = map[key];
35
- return result;
36
- }, {});
37
- },
38
- getFontStyleMap: function getFontStyleMap(obj, prefix) {
39
- var map = {};
40
- Object.keys(obj).forEach(function (key) {
41
- if (key.startsWith(prefix)) {
42
- map[key.replace(prefix, '')] = obj[key];
43
- }
44
- });
45
- console.error(obj, prefix, map);
46
- return map;
47
- },
48
- build: function build(style) {
49
- return style.fontSize + "px " + style.fontFamily;
50
- }
51
- }; // 线型--node.s('dash',false) ---false代表是实线,默认为true代表虚线
52
- // 线型为实线时设置颜色--node.s('borderColor','rgba(0,0,0,0.00)') //默认颜色rgba(0,0,0,0.00)
53
- // 线型为虚线时设置颜色--node.s('dashColor','rgb(173,173,173)') //默认颜色rgb(173,173,173)
54
- // 线宽--node.s('borderWidth',1)//默认宽度是1
55
- //
56
- //
57
- // 为了实现切换时更好的效果,在设置线型为虚线时可以这样设置:
58
- // node.s('dash',true);
59
- // node.s('borderColor','rgba(0,0,0,0.00)');//将borderColor改为默认
60
- // node.s('dashColor','当前设置的颜色')
61
- // 虚线颜色用的是dashColor
62
- //
63
- // 设置线型为实线时
64
- // node.s('dash',false);
65
- // node.s('borderColor','当前设置的颜色');
66
- // node.s('dashColor','rgb(173,173,173)');dash可设置为默认
67
- // 实线用的是borderColor
68
9
 
69
10
  function parseValues(values) {
70
- return _extends({}, values, fontStyleUtil.toMap(values['styleMap.label.font'], 'styleMap.label.fontStyle.'), {
71
- // 层间线
72
- 'styleMap.borderType': values['styleMap.dash'] === false ? 'solid' : 'dash',
73
- 'styleMap.dashColor': values['styleMap.dashColor'] || 'rgb(173,173,173)',
74
- 'styleMap.borderWidth': values['styleMap.borderWidth'] || 1
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
+ }
75
17
  });
76
18
  }
77
19
 
@@ -87,15 +29,18 @@ export default function TextPropertyView(props) {
87
29
  onChange: function onChange(name, value) {
88
30
  var newValues = field.getValues(); // 文字font样式
89
31
 
90
- if (name.startsWith('styleMap.label.fontStyle.')) {
91
- name = 'styleMap.label.font';
92
- value = fontStyleUtil.build(fontStyleUtil.getFontStyleMap(newValues, 'styleMap.label.fontStyle.'));
93
- } // 层间线
32
+ if (name === 'styleMap.textObj') {
33
+ _onChange('styleMap.text.color', value.color, newValues);
94
34
 
35
+ _onChange('styleMap.label.color', value.color, newValues);
95
36
 
96
- if (name === 'styleMap.borderType') {
97
- name = 'styleMap.dash';
98
- value = value === 'dash';
37
+ var font = fontStyleUtil.build(value);
38
+
39
+ _onChange('styleMap.text.font', font, newValues);
40
+
41
+ _onChange('styleMap.text.decoration', value.underline ? 'underline' : undefined, newValues);
42
+
43
+ return;
99
44
  }
100
45
 
101
46
  if (values[name] !== value) {
@@ -107,84 +52,25 @@ export default function TextPropertyView(props) {
107
52
  useEffect(function () {
108
53
  field.setValues(parseValues(values));
109
54
  }, [values]);
110
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Form, {
111
- field: field,
112
- labelAlign: "top"
113
- }, /*#__PURE__*/React.createElement(_Form.Item, {
114
- label: "\u540D\u79F0",
55
+ return /*#__PURE__*/React.createElement("div", {
115
56
  style: {
116
- paddingLeft: 12,
117
- paddingRight: 12
57
+ paddingTop: 8
118
58
  }
119
- }, /*#__PURE__*/React.createElement(_Input, {
120
- name: "name"
121
- })), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
59
+ }, /*#__PURE__*/React.createElement(_Form, {
60
+ field: field,
61
+ labelAlign: "top"
62
+ }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
122
63
  defaultExpandedKeys: ['显示设置'],
123
64
  style: {
124
65
  border: 'none'
125
66
  }
126
67
  }, /*#__PURE__*/React.createElement(CollapsePanel, {
127
68
  key: "\u663E\u793A\u8BBE\u7F6E",
128
- title: "\u6587\u672C"
129
- }, /*#__PURE__*/React.createElement(_Form.Item, {
130
- label: "\u5B57\u4F53"
131
- }, /*#__PURE__*/React.createElement(_Select, {
132
- name: "styleMap.label.fontStyle.fontFamily",
69
+ title: "\u663E\u793A\u8BBE\u7F6E",
133
70
  style: {
134
- width: '100%',
135
- marginRight: 8
71
+ padding: 0
136
72
  }
137
- }, /*#__PURE__*/React.createElement(Option, {
138
- value: "\u5B8B\u4F53"
139
- }, /*#__PURE__*/React.createElement("div", {
140
- style: {
141
- fontFamily: '宋体'
142
- }
143
- }, "\u5B8B\u4F53")), /*#__PURE__*/React.createElement(Option, {
144
- value: "\u9ED1\u4F53"
145
- }, /*#__PURE__*/React.createElement("div", {
146
- style: {
147
- fontFamily: '宋体'
148
- }
149
- }, "\u9ED1\u4F53")), /*#__PURE__*/React.createElement(Option, {
150
- value: "Arial"
151
- }, /*#__PURE__*/React.createElement("div", {
152
- style: {
153
- fontFamily: 'Arial'
154
- }
155
- }, "Arial")))), /*#__PURE__*/React.createElement(_Form.Item, {
156
- label: "\u5B57\u53F7",
157
- hasFeedback: true,
158
- required: true,
159
- requiredMessage: "\u4E0D\u80FD\u4E3A\u7A7A",
160
- requiredTrigger: "onBlur",
161
- asterisk: false
162
- }, /*#__PURE__*/React.createElement(_NumberPicker, {
163
- name: "styleMap.label.fontStyle.fontSize",
164
- min: 8,
165
- max: 36,
166
- style: {
167
- width: '100%',
168
- marginRight: 8
169
- },
170
- placeholder: "\u8BF7\u8F93\u5165"
171
- })), /*#__PURE__*/React.createElement(_Form.Item, {
172
- label: "\u6837\u5F0F"
173
- }, /*#__PURE__*/React.createElement(RadioGroup, {
174
- shape: "button"
175
- }, /*#__PURE__*/React.createElement(_Radio, {
176
- id: "banana",
177
- value: "banana"
178
- }, "B"), /*#__PURE__*/React.createElement(_Radio, {
179
- id: "watermelon",
180
- value: "watermelon"
181
- }, "I"), /*#__PURE__*/React.createElement(_Radio, {
182
- id: "peach",
183
- value: "peach"
184
- }, "U"))), /*#__PURE__*/React.createElement(_Form.Item, {
185
- label: "\u989C\u8272"
186
- }, /*#__PURE__*/React.createElement(ColorPicker, {
187
- name: "styleMap.label.color",
188
- align: "bl"
73
+ }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(TextStyle, {
74
+ name: "styleMap.textObj"
189
75
  })))))));
190
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;
@@ -1,12 +1,13 @@
1
1
  import _Button from "@alifd/next/lib/button";
2
2
  import React, { useState, useEffect, useRef, useCallback } from 'react';
3
+ import classnames from 'classnames';
3
4
  import TitleWidget from "../../../components/titlebar/widgets/TitleWidget";
4
5
  import styles from "../../../components/titlebar/TitleBar.module.scss";
5
6
  export default function TopoEditorTitleBar(props) {
6
7
  var topo = props.topo,
7
8
  topoEditApi = props.topoEditApi;
8
9
  return /*#__PURE__*/React.createElement("div", {
9
- className: styles.titlebar
10
+ className: classnames(styles.titlebar, styles.titlebarEditMode)
10
11
  }, /*#__PURE__*/React.createElement("div", {
11
12
  className: styles.left
12
13
  }, /*#__PURE__*/React.createElement(TitleWidget, {
@@ -22,16 +23,15 @@ export default function TopoEditorTitleBar(props) {
22
23
  topoEditApi.addResourceToView();
23
24
  }
24
25
  }, "\u6DFB\u52A0\u8D44\u6E90"), /*#__PURE__*/React.createElement(_Button, {
25
- type: "primary",
26
26
  className: styles.button,
27
27
  onClick: function onClick() {
28
28
  topo.save();
29
29
  }
30
30
  }, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(_Button, {
31
+ className: styles.button,
31
32
  onClick: function onClick() {
32
33
  topo.exitEditMode();
33
- },
34
- className: styles.button
34
+ }
35
35
  }, "\u9000\u51FA"))));
36
36
  }
37
37
  ;
@@ -1,9 +1,6 @@
1
1
  export default function buildContextmenu(topoApp: any): {
2
2
  node: {
3
3
  enable: boolean;
4
- items: {
5
- label: string;
6
- id: string;
7
- }[];
4
+ items: any[];
8
5
  };
9
6
  };
@@ -0,0 +1,10 @@
1
+ export default function buildContextmenu(topoApp) {
2
+ return {
3
+ node: {
4
+ enable: true,
5
+ items: [// { label: '打开属性设置', id: 'openSet' },
6
+ // { label: '打开全局属性设置', id: 'openAllSet' },
7
+ ]
8
+ }
9
+ };
10
+ }
@@ -10,7 +10,9 @@ function getElementData(element) {
10
10
  // 业务id
11
11
  name: element.getName(),
12
12
  attrObject: element.getAttrObject(),
13
- styleMap: element.getStyleMap()
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('SelectionChange');
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
  });