@riil-frontend/component-topology 13.0.0-dev.1 → 13.0.0-dev.10
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 +1 -1
- package/build/index.css +1 -1
- package/build/index.js +29 -29
- package/es/components/ColorPanel/index.js +68 -58
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/core/components/TopoView/topoView.js +7 -4
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -15
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +10 -91
- package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +2 -27
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -52
- package/es/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +120 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +29 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +29 -0
- package/es/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +77 -0
- package/es/core/editor/components/settings/core/updateElementProperty.js +3 -2
- package/es/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
- package/es/core/editor/hooks/useKeyboardShortcut.js +4 -0
- package/es/core/editor/hooks/useNewElementTheme.js +20 -16
- package/es/core/editor/utils/edgeTypeStyleUtil.js +11 -32
- package/es/core/hooks/useGraphAlarmDisplay.js +4 -0
- package/es/core/hooks/usePolling.js +2 -1
- package/es/core/hooks/useResourceConfig.js +1 -2
- package/es/core/hooks/useTopoEdit.js +210 -248
- package/es/core/models/AttributeMetricDisplay.js +4 -3
- package/es/core/models/HistoryManager.js +11 -9
- package/es/core/models/TopoApp.js +39 -45
- package/es/core/models/topoData.js +9 -17
- package/es/core/models/utils/linkUtils.js +65 -52
- package/es/core/store/models/topoConfig.js +7 -11
- package/es/core/utils/edgeUtil.js +7 -10
- package/es/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +2 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +4 -2
- package/es/networkTopo/models/EdgeGroupTagTipBuilder.js +7 -7
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +7 -63
- package/es/networkTopo/services/topo/basic.js +27 -17
- package/es/networkTopo/utils/__tests__/relateTopoData.js +205 -0
- package/es/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/es/networkTopo/utils/exitLinkUtil.js +25 -13
- package/es/networkTopo/utils/relateTopoDataUtil.js +149 -0
- package/es/style.js +1 -1
- package/es/utils/ResourceConfigUtil.js +1 -16
- package/es/utils/clusterUtil.js +3 -3
- package/es/utils/htElementUtils.js +19 -85
- package/lib/components/ColorPanel/index.js +71 -59
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/core/components/TopoView/topoView.js +15 -19
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +5 -14
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +11 -95
- package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +3 -28
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +3 -28
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +6 -56
- package/lib/core/editor/components/Toolbar/widgets/components/FontColorDropdown.js +136 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontFamilySelect.js +38 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontSizeSelect.js +38 -0
- package/lib/core/editor/components/Toolbar/widgets/components/FontStyleSelect.js +89 -0
- package/lib/core/editor/components/settings/core/updateElementProperty.js +7 -2
- package/lib/core/editor/components/settings/propertyViews/view/GlobalEdgeToggle.js +2 -2
- package/lib/core/editor/hooks/useKeyboardShortcut.js +4 -0
- package/lib/core/editor/hooks/useNewElementTheme.js +20 -16
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +10 -33
- package/lib/core/hooks/useGraphAlarmDisplay.js +4 -0
- package/lib/core/hooks/usePolling.js +6 -5
- package/lib/core/hooks/useResourceConfig.js +1 -2
- package/lib/core/hooks/useTopoEdit.js +216 -272
- package/lib/core/models/AttributeMetricDisplay.js +6 -6
- package/lib/core/models/HistoryManager.js +13 -17
- package/lib/core/models/TopoApp.js +39 -43
- package/lib/core/models/topoData.js +9 -17
- package/lib/core/models/utils/linkUtils.js +65 -51
- package/lib/core/store/models/topoConfig.js +13 -25
- package/lib/core/utils/edgeUtil.js +8 -10
- package/lib/core/viewer/components/plugins/ElementDetailDrawer/hooks/useElementDetailManager.js +3 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/EventsCard.js +6 -2
- package/lib/networkTopo/models/EdgeGroupTagTipBuilder.js +6 -6
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +6 -64
- package/lib/networkTopo/services/topo/basic.js +32 -18
- package/lib/networkTopo/utils/__tests__/relateTopoData.js +210 -0
- package/lib/networkTopo/utils/edgeGroupTagUtil.js +2 -2
- package/lib/networkTopo/utils/exitLinkUtil.js +25 -13
- package/lib/networkTopo/utils/relateTopoDataUtil.js +164 -0
- package/lib/style.js +1 -1
- package/lib/utils/ResourceConfigUtil.js +1 -16
- package/lib/utils/clusterUtil.js +2 -2
- package/lib/utils/htElementUtils.js +22 -94
- package/package.json +2 -2
- package/es/networkTopo/models/LinkTagsTipsBuilder.js +0 -235
- package/lib/networkTopo/models/LinkTagsTipsBuilder.js +0 -245
- /package/es/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
- /package/lib/core/editor/components/Toolbar/widgets/{FontColorButton.module.scss → components/FontColorDropdown.module.scss} +0 -0
@@ -1,14 +1,68 @@
|
|
1
1
|
import _Balloon from "@alifd/next/es/balloon";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
3
|
|
3
4
|
/* eslint-disable eqeqeq */
|
4
5
|
|
5
6
|
/* eslint-disable jsx-a11y/alt-text */
|
6
7
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
8
|
+
import PropTypes from 'prop-types';
|
7
9
|
import classnames from 'classnames';
|
8
10
|
import Color from 'color';
|
9
11
|
import { SketchPicker } from 'react-color';
|
10
12
|
import ColorBlock from "./components/ColorBlock";
|
11
13
|
import styles from "./index.module.scss";
|
14
|
+
var defaultColorList = [{
|
15
|
+
color: 'rgba(255, 255, 255, 1)',
|
16
|
+
borderColor: 'rgba(219, 219, 219, 1)'
|
17
|
+
}, {
|
18
|
+
color: 'rgba(245, 245, 245, 1)',
|
19
|
+
borderColor: 'rgba(208, 208, 208, 1)'
|
20
|
+
}, {
|
21
|
+
color: 'rgba(230, 230, 230, 1)',
|
22
|
+
borderColor: 'rgba(196, 196, 196, 1)'
|
23
|
+
}, {
|
24
|
+
color: 'rgba(168, 168, 168, 1)',
|
25
|
+
borderColor: 'rgba(146, 146, 146, 1)'
|
26
|
+
}, {
|
27
|
+
color: 'rgba(97, 97, 97, 1)',
|
28
|
+
borderColor: 'rgba(85, 85, 85, 1)'
|
29
|
+
}, {
|
30
|
+
color: 'rgba(49, 49, 49, 1)',
|
31
|
+
borderColor: 'rgba(43, 43, 43, 1)'
|
32
|
+
}, {
|
33
|
+
color: 'rgba(251, 115, 80, 1)',
|
34
|
+
borderColor: 'rgba(213, 98, 69, 1)'
|
35
|
+
}, {
|
36
|
+
color: 'rgba(255, 166, 41, 1)',
|
37
|
+
borderColor: 'rgba(219, 144, 45, 1)'
|
38
|
+
}, {
|
39
|
+
color: 'rgba(255, 205, 42, 1)',
|
40
|
+
borderColor: 'rgba(216, 175, 37, 1)'
|
41
|
+
}, {
|
42
|
+
color: 'rgba(18, 174, 92, 1)',
|
43
|
+
borderColor: 'rgba(23, 148, 79, 1)'
|
44
|
+
}, {
|
45
|
+
color: 'rgba(83, 184, 255, 1)',
|
46
|
+
borderColor: 'rgba(74, 156, 217, 1)'
|
47
|
+
}, {
|
48
|
+
color: 'rgba(183, 128, 255, 1)',
|
49
|
+
borderColor: 'rgba(155, 109, 216, 1)'
|
50
|
+
}, {
|
51
|
+
color: 'rgba(254, 192, 174, 1)',
|
52
|
+
borderColor: 'rgba(217, 163, 148, 1)'
|
53
|
+
}, {
|
54
|
+
color: 'rgba(252, 209, 156, 1)',
|
55
|
+
borderColor: 'rgba(215, 178, 133, 1)'
|
56
|
+
}, {
|
57
|
+
color: 'rgba(255, 232, 163, 1)',
|
58
|
+
borderColor: 'rgba(217, 198, 139, 1)'
|
59
|
+
}, {
|
60
|
+
color: 'rgba(176, 244, 197, 1)',
|
61
|
+
borderColor: 'rgba(153, 209, 171, 1)'
|
62
|
+
}, {
|
63
|
+
color: 'rgba(189, 227, 255, 1)',
|
64
|
+
borderColor: 'rgba(161, 193, 217, 1)'
|
65
|
+
}];
|
12
66
|
/**
|
13
67
|
* 颜色选择
|
14
68
|
*
|
@@ -22,7 +76,9 @@ function ColorPanel(props) {
|
|
22
76
|
|
23
77
|
var value = props.value,
|
24
78
|
showClear = props.showClear,
|
25
|
-
dataSource = props.dataSource,
|
79
|
+
_props$dataSource = props.dataSource,
|
80
|
+
dataSource = _props$dataSource === void 0 ? defaultColorList : _props$dataSource,
|
81
|
+
colorPickerBalloonProps = props.colorPickerBalloonProps,
|
26
82
|
onChange = props.onChange,
|
27
83
|
onPickerFocus = props.onPickerFocus,
|
28
84
|
onPickerBlur = props.onPickerBlur;
|
@@ -169,9 +225,7 @@ function ColorPanel(props) {
|
|
169
225
|
onClick: function onClick() {
|
170
226
|
changClick('17');
|
171
227
|
}
|
172
|
-
}, /*#__PURE__*/React.createElement(_Balloon, {
|
173
|
-
visible: visible,
|
174
|
-
trigger: defaultTrigger,
|
228
|
+
}, /*#__PURE__*/React.createElement(_Balloon, _extends({
|
175
229
|
closable: false,
|
176
230
|
triggerType: "click",
|
177
231
|
animation: false,
|
@@ -180,9 +234,12 @@ function ColorPanel(props) {
|
|
180
234
|
alignEdge: true,
|
181
235
|
style: {
|
182
236
|
paddingBottom: 0
|
183
|
-
}
|
237
|
+
}
|
238
|
+
}, colorPickerBalloonProps, {
|
239
|
+
visible: visible,
|
240
|
+
trigger: defaultTrigger,
|
184
241
|
onClose: close
|
185
|
-
}, /*#__PURE__*/React.createElement(SketchPicker, {
|
242
|
+
}), /*#__PURE__*/React.createElement(SketchPicker, {
|
186
243
|
color: data !== null && data !== void 0 ? data : undefined // width={230}
|
187
244
|
,
|
188
245
|
disableAlpha: true,
|
@@ -198,61 +255,14 @@ function ColorPanel(props) {
|
|
198
255
|
}))))));
|
199
256
|
}
|
200
257
|
|
258
|
+
ColorPanel.propTypes = {
|
259
|
+
dataSource: PropTypes.array
|
260
|
+
};
|
201
261
|
ColorPanel.defaultProps = {
|
202
262
|
value: undefined,
|
203
263
|
showClear: false,
|
204
|
-
dataSource:
|
205
|
-
|
206
|
-
borderColor: 'rgba(219, 219, 219, 1)'
|
207
|
-
}, {
|
208
|
-
color: 'rgba(245, 245, 245, 1)',
|
209
|
-
borderColor: 'rgba(208, 208, 208, 1)'
|
210
|
-
}, {
|
211
|
-
color: 'rgba(230, 230, 230, 1)',
|
212
|
-
borderColor: 'rgba(196, 196, 196, 1)'
|
213
|
-
}, {
|
214
|
-
color: 'rgba(168, 168, 168, 1)',
|
215
|
-
borderColor: 'rgba(146, 146, 146, 1)'
|
216
|
-
}, {
|
217
|
-
color: 'rgba(97, 97, 97, 1)',
|
218
|
-
borderColor: 'rgba(85, 85, 85, 1)'
|
219
|
-
}, {
|
220
|
-
color: 'rgba(49, 49, 49, 1)',
|
221
|
-
borderColor: 'rgba(43, 43, 43, 1)'
|
222
|
-
}, {
|
223
|
-
color: 'rgba(251, 115, 80, 1)',
|
224
|
-
borderColor: 'rgba(213, 98, 69, 1)'
|
225
|
-
}, {
|
226
|
-
color: 'rgba(255, 166, 41, 1)',
|
227
|
-
borderColor: 'rgba(219, 144, 45, 1)'
|
228
|
-
}, {
|
229
|
-
color: 'rgba(255, 205, 42, 1)',
|
230
|
-
borderColor: 'rgba(216, 175, 37, 1)'
|
231
|
-
}, {
|
232
|
-
color: 'rgba(18, 174, 92, 1)',
|
233
|
-
borderColor: 'rgba(23, 148, 79, 1)'
|
234
|
-
}, {
|
235
|
-
color: 'rgba(83, 184, 255, 1)',
|
236
|
-
borderColor: 'rgba(74, 156, 217, 1)'
|
237
|
-
}, {
|
238
|
-
color: 'rgba(183, 128, 255, 1)',
|
239
|
-
borderColor: 'rgba(155, 109, 216, 1)'
|
240
|
-
}, {
|
241
|
-
color: 'rgba(254, 192, 174, 1)',
|
242
|
-
borderColor: 'rgba(217, 163, 148, 1)'
|
243
|
-
}, {
|
244
|
-
color: 'rgba(252, 209, 156, 1)',
|
245
|
-
borderColor: 'rgba(215, 178, 133, 1)'
|
246
|
-
}, {
|
247
|
-
color: 'rgba(255, 232, 163, 1)',
|
248
|
-
borderColor: 'rgba(217, 198, 139, 1)'
|
249
|
-
}, {
|
250
|
-
color: 'rgba(176, 244, 197, 1)',
|
251
|
-
borderColor: 'rgba(153, 209, 171, 1)'
|
252
|
-
}, {
|
253
|
-
color: 'rgba(189, 227, 255, 1)',
|
254
|
-
borderColor: 'rgba(161, 193, 217, 1)'
|
255
|
-
}],
|
264
|
+
dataSource: defaultColorList,
|
265
|
+
colorPickerBalloonProps: {},
|
256
266
|
onChange: function onChange() {},
|
257
267
|
onPickerFocus: function onPickerFocus() {},
|
258
268
|
onPickerBlur: function onPickerBlur() {}
|
@@ -64,7 +64,7 @@ function ResourceSelectDrawer(props) {
|
|
64
64
|
_context.prev = 9;
|
65
65
|
_context.t0 = _context["catch"](1);
|
66
66
|
setLoading(false);
|
67
|
-
rlog.error('ResourceSelectDrawer.handleOk', _context.t0);
|
67
|
+
rlog.error('ResourceSelectDrawer.handleOk', _context.t0, _context.t0.stack);
|
68
68
|
|
69
69
|
case 13:
|
70
70
|
case "end":
|
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
|
|
5
5
|
import classnames from 'classnames';
|
6
6
|
import TopoGraph, { TopoEvent } from '@riil-frontend/component-topology-graph';
|
7
7
|
import PortalContainer from '@riil-frontend/component-topology-graph/es/components/PortalContainer';
|
8
|
-
import
|
8
|
+
import Logger from 'loglevel'; // 通用
|
9
9
|
|
10
10
|
import showMessage from "../../utils/showMessage";
|
11
11
|
import { TPL_TREE } from "../../../utils/template";
|
@@ -28,6 +28,7 @@ import editorStyles from "./editor.module.scss";
|
|
28
28
|
import basicIcons from "../../common/icons/basicIcons";
|
29
29
|
import HelpIcon from "../../editor/components/BottomFloatTool/HelpIcon";
|
30
30
|
import { updateNodesNameVisible } from "../../models/utils/nodeNameVisibleUtil";
|
31
|
+
var rlog = Logger.getLogger('topo');
|
31
32
|
|
32
33
|
var Topology = function Topology(props) {
|
33
34
|
var _classnames;
|
@@ -115,7 +116,7 @@ var Topology = function Topology(props) {
|
|
115
116
|
}
|
116
117
|
}, []);
|
117
118
|
var handleGraphDataLoaded = useCallback(function () {
|
118
|
-
rlog.info('TopoView.handleGraphDataLoaded', new Date().toString(), {
|
119
|
+
rlog.info('TopoView.handleGraphDataLoaded: 数据加载完成', new Date().toString(), {
|
119
120
|
topoMod: topo.store.getState().topoMod,
|
120
121
|
topoData: topoData,
|
121
122
|
htElements: topo.getDataModel().getDatas().toArray()
|
@@ -125,13 +126,15 @@ var Topology = function Topology(props) {
|
|
125
126
|
fixLink(topo);
|
126
127
|
handleClusterNoPermission(topo);
|
127
128
|
updateEdgeExpanded(topo);
|
129
|
+
topo.selectionModel.init();
|
128
130
|
var htHistoryManager = topo.getDataModel().getHistoryManager();
|
129
131
|
|
130
|
-
if (htHistoryManager) {
|
132
|
+
if (topo.store.getState().topoMod.viewState === 'edit' && htHistoryManager) {
|
131
133
|
topo.historyManager = new HistoryManager(topo, htHistoryManager);
|
134
|
+
topo.historyManager.clear();
|
135
|
+
rlog.info('TopoView.handleGraphDataLoaded: 初始化HistoryManager ', topo.historyManager.toString());
|
132
136
|
}
|
133
137
|
|
134
|
-
topo.selectionModel.init();
|
135
138
|
topoDispatchers.update({
|
136
139
|
graphLoaded2: true
|
137
140
|
});
|
@@ -36,14 +36,14 @@ function EdgeColorButton(props) {
|
|
36
36
|
});
|
37
37
|
};
|
38
38
|
|
39
|
-
var
|
39
|
+
var getCustomLines = function getCustomLines(list) {
|
40
40
|
return list.filter(isCustomEdge);
|
41
41
|
};
|
42
42
|
|
43
43
|
useEffect(function () {
|
44
44
|
if (graphLoaded) {
|
45
45
|
var edges = getEdgesBySelection(topo);
|
46
|
-
var list =
|
46
|
+
var list = getCustomLines(edges);
|
47
47
|
setLineWidth(1); // eslint-disable-next-line eqeqeq
|
48
48
|
|
49
49
|
if (selection.length == 1 && list.length === 1) {
|
@@ -32,21 +32,11 @@ var LINE_TYPE_OPTIONS = [{
|
|
32
32
|
value: 'doublearc',
|
33
33
|
label: '双弧线',
|
34
34
|
icon: 'topo_linear_icon_arcline'
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
];
|
41
|
-
|
42
|
-
if (localStorage.getItem('topo.test.edge.customType') === 'true') {
|
43
|
-
LINE_TYPE_OPTIONS.push({
|
44
|
-
value: 'points',
|
45
|
-
label: '自由线形',
|
46
|
-
icon: 'topo_linear_icon_pointsline'
|
47
|
-
});
|
48
|
-
}
|
49
|
-
|
35
|
+
}, {
|
36
|
+
value: 'points',
|
37
|
+
label: '自由线形',
|
38
|
+
icon: 'topo_linear_icon_pointsline'
|
39
|
+
}];
|
50
40
|
var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
51
41
|
var value = props.value,
|
52
42
|
onChange = props.onChange,
|
@@ -3,33 +3,20 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
|
4
4
|
/* eslint-disable jsx-a11y/alt-text */
|
5
5
|
import React, { useState } from 'react';
|
6
|
-
import
|
6
|
+
import FontColorDropdown from "./components/FontColorDropdown";
|
7
7
|
import WidgetBox from "./WidgetBox";
|
8
|
-
import ColorPanel from "../../../../../components/ColorPanel";
|
9
|
-
import FontColorRange from "../../../../../components/ColorPanel/components/FontColorRange";
|
10
|
-
import styles from "./FontColorButton.module.scss";
|
11
8
|
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
12
9
|
|
13
|
-
function
|
14
|
-
var
|
15
|
-
onChange = props.onChange,
|
10
|
+
function FontColorButton(props) {
|
11
|
+
var showLabel = props.showLabel,
|
16
12
|
topo = props.topo,
|
17
|
-
|
18
|
-
background = props.background,
|
13
|
+
style = props.style,
|
19
14
|
setStyle = props.setStyle,
|
20
|
-
|
21
|
-
fieldDisabled = _props$fieldDisabled === void 0 ? {} : _props$fieldDisabled;
|
22
|
-
|
23
|
-
var _useState = useState(false),
|
24
|
-
disabled = _useState[0],
|
25
|
-
setDisabled = _useState[1];
|
26
|
-
|
27
|
-
var backgroundEnabled = fieldDisabled.background !== true;
|
28
|
-
var opacityEnabled = fieldDisabled.opacity !== true;
|
15
|
+
fieldDisabled = props.fieldDisabled;
|
29
16
|
|
30
17
|
var backOpacityChange = function backOpacityChange(value) {
|
31
18
|
topo.historyManager.beginTransaction();
|
32
|
-
|
19
|
+
setStyle({
|
33
20
|
opacity: (value / 100).toFixed(2) * 1
|
34
21
|
});
|
35
22
|
topo.historyManager.endTransaction();
|
@@ -111,84 +98,16 @@ function FontColorDropdown(props) {
|
|
111
98
|
};
|
112
99
|
}();
|
113
100
|
|
114
|
-
var onFocus = function onFocus() {// topo.historyManager.beginTransaction();
|
115
|
-
};
|
116
|
-
|
117
|
-
var onBlur = function onBlur() {// topo.historyManager.endTransaction();
|
118
|
-
};
|
119
|
-
|
120
|
-
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
121
|
-
src: "/img/topo/editor/toolbar/\u6587\u5B57\u989C\u8272\u53CA\u586B\u5145/Disable.svg",
|
122
|
-
alt: ""
|
123
|
-
}) : /*#__PURE__*/React.createElement("img", {
|
124
|
-
src: "/img/topo/editor/toolbar/\u6587\u5B57\u989C\u8272\u53CA\u586B\u5145/Normal.svg",
|
125
|
-
alt: ""
|
126
|
-
});
|
127
|
-
return /*#__PURE__*/React.createElement(DropdownButton, {
|
128
|
-
disabled: disabled,
|
129
|
-
trigger: icon
|
130
|
-
}, /*#__PURE__*/React.createElement("div", {
|
131
|
-
className: styles.content
|
132
|
-
}, /*#__PURE__*/React.createElement("div", {
|
133
|
-
className: styles.fontColor
|
134
|
-
}, /*#__PURE__*/React.createElement("span", null, "\u5B57\u4F53\u989C\u8272"), /*#__PURE__*/React.createElement("div", {
|
135
|
-
style: {
|
136
|
-
marginTop: '10px',
|
137
|
-
marginLeft: '-4px'
|
138
|
-
}
|
139
|
-
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
140
|
-
value: color,
|
141
|
-
onChange: colorChang,
|
142
|
-
onPickerFocus: onFocus,
|
143
|
-
onPickerBlur: onBlur
|
144
|
-
}))), (backgroundEnabled || opacityEnabled) && /*#__PURE__*/React.createElement("div", {
|
145
|
-
className: styles.backgroundColor
|
146
|
-
}, /*#__PURE__*/React.createElement("span", null, "\u80CC\u666F\u586B\u5145"), /*#__PURE__*/React.createElement("div", {
|
147
|
-
className: styles.backOpacity
|
148
|
-
}, /*#__PURE__*/React.createElement("img", {
|
149
|
-
src: "/img/topo/editor/toolbar/\u80CC\u666F\u586B\u5145\u53CA\u8FB9\u6846/\u80CC\u666F\u586B\u5145.svg"
|
150
|
-
}), /*#__PURE__*/React.createElement(FontColorRange, {
|
151
|
-
max: 100,
|
152
|
-
min: 0,
|
153
|
-
unit: "%",
|
154
|
-
list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
|
155
|
-
onChange: backOpacityChange,
|
156
|
-
defaultValue: opacity === undefined ? opacity : Math.round(opacity * 100) // disabled={!background}
|
157
|
-
|
158
|
-
})), /*#__PURE__*/React.createElement("div", {
|
159
|
-
style: {
|
160
|
-
marginTop: '10px',
|
161
|
-
marginLeft: '-4px',
|
162
|
-
marginBottom: '3px'
|
163
|
-
}
|
164
|
-
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
165
|
-
showClear: true,
|
166
|
-
value: background,
|
167
|
-
onChange: backgroundChang,
|
168
|
-
onPickerFocus: onFocus,
|
169
|
-
onPickerBlur: onBlur
|
170
|
-
})))));
|
171
|
-
}
|
172
|
-
|
173
|
-
function FontColorButton(props) {
|
174
|
-
var showLabel = props.showLabel,
|
175
|
-
topo = props.topo,
|
176
|
-
style = props.style,
|
177
|
-
setStyle = props.setStyle,
|
178
|
-
fieldDisabled = props.fieldDisabled;
|
179
101
|
return /*#__PURE__*/React.createElement(WidgetBox, {
|
180
102
|
label: "\u6587\u5B57\u989C\u8272",
|
181
103
|
tooltip: "\u6587\u5B57\u989C\u8272",
|
182
104
|
showLabel: showLabel
|
183
105
|
}, /*#__PURE__*/React.createElement(FontColorDropdown, {
|
184
|
-
|
185
|
-
background: style.background,
|
186
|
-
opacity: style.opacity,
|
106
|
+
value: style,
|
187
107
|
fieldDisabled: fieldDisabled,
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
},
|
108
|
+
onColorChange: colorChang,
|
109
|
+
onBackgroundChange: backgroundChang,
|
110
|
+
onOpacityChange: backOpacityChange,
|
192
111
|
topo: topo
|
193
112
|
}));
|
194
113
|
}
|
@@ -1,33 +1,8 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
|
-
import
|
3
|
-
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter
|
2
|
+
import FontFamilySelect from "./components/FontFamilySelect";
|
3
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter";
|
4
4
|
import WidgetBox from "./WidgetBox";
|
5
5
|
|
6
|
-
function FontFamilySelect(props) {
|
7
|
-
var value = props.value,
|
8
|
-
onChange = props.onChange;
|
9
|
-
var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
|
10
|
-
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
11
|
-
value: (items.includes(value) ? value : null) || '',
|
12
|
-
valueRender: function valueRender(val) {
|
13
|
-
return /*#__PURE__*/React.createElement("div", {
|
14
|
-
style: {
|
15
|
-
width: 48
|
16
|
-
}
|
17
|
-
}, val || '微软雅黑');
|
18
|
-
},
|
19
|
-
onSelect: onChange
|
20
|
-
}, items.map(function (item) {
|
21
|
-
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
22
|
-
key: item
|
23
|
-
}, /*#__PURE__*/React.createElement("div", {
|
24
|
-
style: {
|
25
|
-
fontFamily: item
|
26
|
-
}
|
27
|
-
}, item));
|
28
|
-
}));
|
29
|
-
}
|
30
|
-
|
31
6
|
function FontFamilyWidget(props) {
|
32
7
|
var topo = props.topo,
|
33
8
|
showLabel = props.showLabel,
|
@@ -1,33 +1,8 @@
|
|
1
|
-
import React, { useEffect
|
2
|
-
import
|
3
|
-
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import FontSizeSelect from "./components/FontSizeSelect";
|
3
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter";
|
4
4
|
import WidgetBox from "./WidgetBox";
|
5
5
|
|
6
|
-
function FontSizeSelect(props) {
|
7
|
-
var value = props.value,
|
8
|
-
disabled = props.disabled,
|
9
|
-
onChange = props.onChange;
|
10
|
-
var items = [12, 14, 16, 18, 20, 24, 30, 36, 48, 60, 80];
|
11
|
-
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
12
|
-
value: "" + (value || ''),
|
13
|
-
valueRender: function valueRender(val) {
|
14
|
-
return /*#__PURE__*/React.createElement("div", {
|
15
|
-
style: {
|
16
|
-
width: 18
|
17
|
-
}
|
18
|
-
}, val || 20);
|
19
|
-
},
|
20
|
-
disabled: disabled,
|
21
|
-
onSelect: function onSelect(val) {
|
22
|
-
return onChange(parseInt(val, 10));
|
23
|
-
}
|
24
|
-
}, items.map(function (item) {
|
25
|
-
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
26
|
-
key: item
|
27
|
-
}, item);
|
28
|
-
}));
|
29
|
-
}
|
30
|
-
|
31
6
|
function FontSizeWidget(props) {
|
32
7
|
var topo = props.topo,
|
33
8
|
showLabel = props.showLabel,
|
@@ -1,26 +1,7 @@
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import DropdownMenu from "./components/DropdownMenu";
|
5
|
-
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
2
|
+
import FontStyleSelect from "./components/FontStyleSelect";
|
3
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter";
|
6
4
|
import WidgetBox from "./WidgetBox";
|
7
|
-
import Tooltip from "../components/Tooltip";
|
8
|
-
var items = [{
|
9
|
-
key: 'bold',
|
10
|
-
label: '加粗',
|
11
|
-
icon: 'bold',
|
12
|
-
tooltip: '加粗'
|
13
|
-
}, {
|
14
|
-
key: 'italic',
|
15
|
-
label: '斜体',
|
16
|
-
icon: 'Italics',
|
17
|
-
tooltip: '斜体'
|
18
|
-
}, {
|
19
|
-
key: 'underline',
|
20
|
-
label: '下划线',
|
21
|
-
icon: 'Underline',
|
22
|
-
tooltip: '下划线'
|
23
|
-
}];
|
24
5
|
|
25
6
|
function buildValue(obj) {
|
26
7
|
return Object.keys(obj).filter(function (key) {
|
@@ -89,39 +70,12 @@ function FontStyleButton(props) {
|
|
89
70
|
tooltip: "\u6587\u5B57\u6837\u5F0F\uFF08\u52A0\u7C97\u3001\u659C\u4F53\u3001\u4E0B\u5212\u7EBF\uFF09",
|
90
71
|
disabled: disabled,
|
91
72
|
showLabel: showLabel
|
92
|
-
}, /*#__PURE__*/React.createElement(
|
73
|
+
}, /*#__PURE__*/React.createElement(FontStyleSelect, {
|
93
74
|
value: value,
|
94
|
-
valueRender: function valueRender() {
|
95
|
-
return /*#__PURE__*/React.createElement("img", {
|
96
|
-
src: "/img/topo/editor/toolbar/bold/" + (disabled ? 'Disable' : 'Normal') + ".svg",
|
97
|
-
alt: ""
|
98
|
-
});
|
99
|
-
},
|
100
|
-
multiple: true,
|
101
75
|
disabled: disabled,
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
key: item.key,
|
106
|
-
disabled: fieldDisabled[item.key]
|
107
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
108
|
-
trigger: /*#__PURE__*/React.createElement("div", {
|
109
|
-
style: {
|
110
|
-
display: 'flex',
|
111
|
-
alignItems: 'center'
|
112
|
-
}
|
113
|
-
}, /*#__PURE__*/React.createElement("img", {
|
114
|
-
src: "/img/topo/editor/toolbar/" + item.icon + "/" + (fieldDisabled[item.key] ? 'Disable' : 'Normal') + ".svg",
|
115
|
-
alt: ""
|
116
|
-
}), /*#__PURE__*/React.createElement("span", {
|
117
|
-
style: fieldDisabled[item.key] ? {} : {
|
118
|
-
color: variables['$color-text1-4']
|
119
|
-
}
|
120
|
-
}, item.label)),
|
121
|
-
align: "r",
|
122
|
-
popupStyle: {}
|
123
|
-
}, item.tooltip));
|
124
|
-
})));
|
76
|
+
fieldDisabled: fieldDisabled,
|
77
|
+
onChange: handleSelect
|
78
|
+
}));
|
125
79
|
}
|
126
80
|
|
127
81
|
export default textStyleSettingRouter(FontStyleButton, {
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
var _excluded = ["topo", "value", "onChange", "fieldDisabled"];
|
4
|
+
|
5
|
+
/* eslint-disable jsx-a11y/alt-text */
|
6
|
+
import React, { useState } from 'react';
|
7
|
+
import DropdownButton from "./DropdownButton";
|
8
|
+
import ColorPanel from "../../../../../../components/ColorPanel";
|
9
|
+
import FontColorRange from "../../../../../../components/ColorPanel/components/FontColorRange";
|
10
|
+
import styles from "./FontColorDropdown.module.scss";
|
11
|
+
|
12
|
+
function FontColorDropdown(props) {
|
13
|
+
var color = props.color,
|
14
|
+
opacity = props.opacity,
|
15
|
+
background = props.background,
|
16
|
+
_props$fieldDisabled = props.fieldDisabled,
|
17
|
+
fieldDisabled = _props$fieldDisabled === void 0 ? {} : _props$fieldDisabled,
|
18
|
+
colorPickerBalloonProps = props.colorPickerBalloonProps,
|
19
|
+
backgroundPickerBalloonProps = props.backgroundPickerBalloonProps,
|
20
|
+
onChange = props.onChange,
|
21
|
+
onColorChange = props.onColorChange,
|
22
|
+
onBackgroundChange = props.onBackgroundChange,
|
23
|
+
onOpacityChange = props.onOpacityChange;
|
24
|
+
|
25
|
+
var _useState = useState(false),
|
26
|
+
disabled = _useState[0],
|
27
|
+
setDisabled = _useState[1];
|
28
|
+
|
29
|
+
var backgroundEnabled = fieldDisabled.background !== true;
|
30
|
+
var opacityEnabled = fieldDisabled.opacity !== true;
|
31
|
+
|
32
|
+
var onFocus = function onFocus() {};
|
33
|
+
|
34
|
+
var onBlur = function onBlur() {};
|
35
|
+
|
36
|
+
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
37
|
+
src: "/img/topo/editor/toolbar/\u6587\u5B57\u989C\u8272\u53CA\u586B\u5145/Disable.svg",
|
38
|
+
alt: ""
|
39
|
+
}) : /*#__PURE__*/React.createElement("img", {
|
40
|
+
src: "/img/topo/editor/toolbar/\u6587\u5B57\u989C\u8272\u53CA\u586B\u5145/Normal.svg",
|
41
|
+
alt: ""
|
42
|
+
});
|
43
|
+
return /*#__PURE__*/React.createElement(DropdownButton, {
|
44
|
+
disabled: disabled,
|
45
|
+
trigger: icon
|
46
|
+
}, /*#__PURE__*/React.createElement("div", {
|
47
|
+
className: styles.content
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
49
|
+
className: styles.fontColor
|
50
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u5B57\u4F53\u989C\u8272"), /*#__PURE__*/React.createElement("div", {
|
51
|
+
style: {
|
52
|
+
marginTop: '10px',
|
53
|
+
marginLeft: '-4px'
|
54
|
+
}
|
55
|
+
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
56
|
+
value: color,
|
57
|
+
colorPickerBalloonProps: colorPickerBalloonProps,
|
58
|
+
onChange: onColorChange,
|
59
|
+
onPickerFocus: onFocus,
|
60
|
+
onPickerBlur: onBlur
|
61
|
+
}))), (backgroundEnabled || opacityEnabled) && /*#__PURE__*/React.createElement("div", {
|
62
|
+
className: styles.backgroundColor
|
63
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u80CC\u666F\u586B\u5145"), /*#__PURE__*/React.createElement("div", {
|
64
|
+
className: styles.backOpacity
|
65
|
+
}, /*#__PURE__*/React.createElement("img", {
|
66
|
+
src: "/img/topo/editor/toolbar/\u80CC\u666F\u586B\u5145\u53CA\u8FB9\u6846/\u80CC\u666F\u586B\u5145.svg"
|
67
|
+
}), /*#__PURE__*/React.createElement(FontColorRange, {
|
68
|
+
max: 100,
|
69
|
+
min: 0,
|
70
|
+
unit: "%",
|
71
|
+
list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
|
72
|
+
onChange: onOpacityChange,
|
73
|
+
defaultValue: opacity === undefined ? opacity : Math.round(opacity * 100) // disabled={!background}
|
74
|
+
|
75
|
+
})), /*#__PURE__*/React.createElement("div", {
|
76
|
+
style: {
|
77
|
+
marginTop: '10px',
|
78
|
+
marginLeft: '-4px',
|
79
|
+
marginBottom: '3px'
|
80
|
+
}
|
81
|
+
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
82
|
+
showClear: true,
|
83
|
+
value: background,
|
84
|
+
colorPickerBalloonProps: backgroundPickerBalloonProps,
|
85
|
+
onChange: onBackgroundChange,
|
86
|
+
onPickerFocus: onFocus,
|
87
|
+
onPickerBlur: onBlur
|
88
|
+
})))));
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
*
|
92
|
+
* @param {*} props
|
93
|
+
* @param {{color, background, opacity}} props.value
|
94
|
+
* @returns
|
95
|
+
*/
|
96
|
+
|
97
|
+
|
98
|
+
function FontColorD(props) {
|
99
|
+
var topo = props.topo,
|
100
|
+
value = props.value,
|
101
|
+
onChange = props.onChange,
|
102
|
+
fieldDisabled = props.fieldDisabled,
|
103
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
104
|
+
|
105
|
+
return /*#__PURE__*/React.createElement(FontColorDropdown, _extends({}, otherProps, {
|
106
|
+
color: value.color,
|
107
|
+
background: value.background,
|
108
|
+
opacity: value.opacity,
|
109
|
+
fieldDisabled: fieldDisabled,
|
110
|
+
setStyle: onChange,
|
111
|
+
onChange: onChange,
|
112
|
+
topo: topo
|
113
|
+
}));
|
114
|
+
}
|
115
|
+
|
116
|
+
ColorPanel.defaultProps = {
|
117
|
+
colorPickerBalloonProps: {},
|
118
|
+
backgroundPickerBalloonProps: {}
|
119
|
+
};
|
120
|
+
export default FontColorD;
|