@riil-frontend/component-topology 6.0.0-alpha.30 → 6.0.0-alpha.32

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 (95) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +20 -20
  5. package/es/core/editor/components/EditorPlugin.js +2 -1
  6. package/es/core/editor/components/Sidebar/Sidebar.js +2 -1
  7. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +2 -3
  8. package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +1 -0
  9. package/es/core/editor/components/Toolbar/buttons.js +5 -4
  10. package/es/core/editor/components/Toolbar/hooks/textStyleSetting/EmptySetting.js +8 -0
  11. package/es/core/editor/components/Toolbar/hooks/textStyleSetting/edgeTagSetting.js +8 -0
  12. package/es/core/editor/components/Toolbar/hooks/textStyleSetting/globalTag.js +36 -0
  13. package/es/core/editor/components/Toolbar/hooks/textStyleSetting/nodeTagSetting.js +8 -0
  14. package/es/core/editor/components/Toolbar/hooks/textStyleSetting/text.js +8 -0
  15. package/es/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +54 -14
  16. package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +29 -9
  17. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +15 -0
  18. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +4 -0
  19. package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +16 -16
  20. package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +20 -18
  21. package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +85 -39
  22. package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +20 -25
  23. package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +22 -6
  24. package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +15 -11
  25. package/es/core/editor/components/Toolbar/widgets/components/DropdownButton.js +23 -8
  26. package/es/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +13 -5
  27. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +40 -0
  28. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +13 -0
  29. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +13 -0
  30. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/index.js +12 -0
  31. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +13 -0
  32. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +13 -0
  33. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +25 -0
  34. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +46 -0
  35. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +25 -0
  36. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +36 -0
  37. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +17 -0
  38. package/es/core/editor/components/settings/CloseablePanel.js +7 -2
  39. package/es/core/editor/components/settings/CloseablePanel.module.scss +9 -0
  40. package/es/core/editor/components/settings/PropertyView.js +7 -5
  41. package/es/core/editor/components/settings/common/AlignSetting/index.js +1 -2
  42. package/es/core/editor/components/settings/common/text/fontStyleUtil.js +5 -4
  43. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
  44. package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +1 -1
  45. package/es/core/editor/utils/textStyleUtil.js +0 -0
  46. package/es/core/hooks/usePolling.js +2 -5
  47. package/es/core/models/AttributeMetricDisplay.js +4 -0
  48. package/es/core/models/TopoApp.js +1 -1
  49. package/es/utils/htElementUtils.js +3 -0
  50. package/lib/core/editor/components/EditorPlugin.js +3 -1
  51. package/lib/core/editor/components/Sidebar/Sidebar.js +2 -1
  52. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +2 -3
  53. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +1 -0
  54. package/lib/core/editor/components/Toolbar/buttons.js +5 -4
  55. package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/EmptySetting.js +13 -0
  56. package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/edgeTagSetting.js +13 -0
  57. package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/globalTag.js +47 -0
  58. package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/nodeTagSetting.js +13 -0
  59. package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/text.js +13 -0
  60. package/lib/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +57 -17
  61. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +29 -8
  62. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +15 -0
  63. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +5 -0
  64. package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +17 -16
  65. package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +21 -18
  66. package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +89 -39
  67. package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +20 -25
  68. package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +22 -6
  69. package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +14 -11
  70. package/lib/core/editor/components/Toolbar/widgets/components/DropdownButton.js +23 -8
  71. package/lib/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +14 -5
  72. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +54 -0
  73. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +23 -0
  74. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +23 -0
  75. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/index.js +25 -0
  76. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +23 -0
  77. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +23 -0
  78. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +40 -0
  79. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +58 -0
  80. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +39 -0
  81. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +47 -0
  82. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +28 -0
  83. package/lib/core/editor/components/settings/CloseablePanel.js +8 -2
  84. package/lib/core/editor/components/settings/CloseablePanel.module.scss +9 -0
  85. package/lib/core/editor/components/settings/PropertyView.js +9 -7
  86. package/lib/core/editor/components/settings/common/AlignSetting/index.js +1 -2
  87. package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +5 -4
  88. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
  89. package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +1 -1
  90. package/lib/core/editor/utils/textStyleUtil.js +1 -0
  91. package/lib/core/hooks/usePolling.js +2 -5
  92. package/lib/core/models/AttributeMetricDisplay.js +4 -0
  93. package/lib/core/models/TopoApp.js +1 -1
  94. package/lib/utils/htElementUtils.js +5 -0
  95. package/package.json +2 -2
@@ -41,8 +41,10 @@ export default function CommonEdgePropertyView(props) {
41
41
  }, [values]);
42
42
 
43
43
  var setLineColor = function setLineColor(color) {
44
- var style = edge.a("styles") || {};
44
+ // 同时修改实线、虚线
45
45
  edge.s("edge.color", color);
46
+ edge.s("edge.dash.color", color);
47
+ var style = edge.a("styles") || {};
46
48
  edge.a("styles", _extends({}, style, {
47
49
  color: color
48
50
  }));
@@ -93,6 +95,10 @@ export default function CommonEdgePropertyView(props) {
93
95
  style: {
94
96
  width: "100%"
95
97
  },
98
+ onChange: function onChange(val) {
99
+ // 同时修改实线、虚线的线宽
100
+ edge.s('edge.dash.width', val);
101
+ },
96
102
  onFocus: function onFocus() {
97
103
  topo.historyManager.beginTransaction();
98
104
  },
@@ -37,7 +37,7 @@ export default function TextPropertyView(props) {
37
37
 
38
38
  _onChange('styleMap.label.color', value.color, newValues);
39
39
 
40
- var font = fontStyleUtil.build(value);
40
+ var font = fontStyleUtil.build(value.font);
41
41
 
42
42
  _onChange('styleMap.text.font', font, newValues);
43
43
 
File without changes
@@ -61,11 +61,8 @@ var usePolling = function usePolling(props) {
61
61
 
62
62
 
63
63
  useEffect(function () {
64
- var isViewer = topoState.viewState === 'view';
65
-
66
- if (topo.options.enableDefaultMetricLoader && isViewer) {
64
+ if (topo.options.enableDefaultMetricLoader) {
67
65
  rlog.debug('usePolling.useEffect: 开始轮询', {
68
- isViewer: isViewer,
69
66
  pollingSwitch: pollingSwitch,
70
67
  resIdsList: resIdsList,
71
68
  resourceOverviewState: resourceOverviewState,
@@ -80,7 +77,7 @@ var usePolling = function usePolling(props) {
80
77
  stopPoll();
81
78
  }
82
79
  };
83
- }, [topoState.viewState, pollingSwitch, resIdsList, displayConfig, resourceOverviewState.id, resourceOverviewState.metricCodes]);
80
+ }, [pollingSwitch, resIdsList, displayConfig, resourceOverviewState.id, resourceOverviewState.metricCodes]);
84
81
  /**
85
82
  *
86
83
  * @returns {{id, attributes: object[], metrics: object[]}[]} 属性和指标
@@ -650,7 +650,11 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
650
650
  var htTopo = topo.getHtTopo();
651
651
 
652
652
  if (htTopo) {
653
+ var _topo$historyManager, _topo$historyManager2;
654
+
655
+ (_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '加载标注');
653
656
  htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
657
+ (_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
654
658
  }
655
659
  }
656
660
  /**
@@ -22,7 +22,7 @@ import topoFactory from "./topoFactory";
22
22
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
23
23
  import SelectionManager from "./SelectionManager"; // eslint-disable-next-line no-undef
24
24
 
25
- var version = typeof "6.0.0-alpha.30" === 'string' ? "6.0.0-alpha.30" : null;
25
+ var version = typeof "6.0.0-alpha.32" === 'string' ? "6.0.0-alpha.32" : null;
26
26
  console.info("\u62D3\u6251\u7248\u672C: " + version);
27
27
  /**
28
28
  * 拓扑显示和编辑
@@ -50,6 +50,9 @@ export function isGroup(element) {
50
50
  export function isLayer(element) {
51
51
  return element instanceof ht.Grid;
52
52
  }
53
+ export function isText(element) {
54
+ return element instanceof ht.Text && element.a('isText');
55
+ }
53
56
  export function getElements(dataModel) {
54
57
  // console.error(111, dataModel.getDatas().getArray())
55
58
  return dataModel.getDatas().getArray();
@@ -17,13 +17,15 @@ var _MultipleResourceSelectPlugin = _interopRequireDefault(require("./plugins/Mu
17
17
 
18
18
  var _GroupAddResourceDrawerPlugin = _interopRequireDefault(require("./GroupAddResourceDrawerPlugin"));
19
19
 
20
+ var _MetricPollingPlugin = _interopRequireDefault(require("../../viewer/components/plugins/MetricPollingPlugin"));
21
+
20
22
  function TopoEditorPlugin(props) {
21
23
  var topo = props.topo,
22
24
  topoContext = props.topoContext,
23
25
  topoEdit = props.topoEdit,
24
26
  editorProps = props.editorProps;
25
27
  var store = topo.store;
26
- var plugins = [_SaveLoading["default"], _GroupAddResourceDrawerPlugin["default"], _MultipleResourceSelectPlugin["default"], _CustomIconPlugin["default"]].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
28
+ var plugins = [_SaveLoading["default"], _GroupAddResourceDrawerPlugin["default"], _MultipleResourceSelectPlugin["default"], _CustomIconPlugin["default"], _MetricPollingPlugin["default"]].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
27
29
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, plugins.map(function (Plugin, index) {
28
30
  return /*#__PURE__*/_react["default"].createElement(Plugin, (0, _extends2["default"])({
29
31
  key: index,
@@ -42,7 +42,8 @@ function Sidebar(props) {
42
42
  resourceTabActiveKey: null
43
43
  });
44
44
  };
45
- }, []);
45
+ }, []); // 通过url参数打开对应面板
46
+
46
47
  (0, _react.useEffect)(function () {
47
48
  var _topo$viewProps$urlPa;
48
49
 
@@ -61,7 +61,7 @@ function CanvasPanel(props) {
61
61
  topo.historyManager.beginTransaction();
62
62
  displayConfigDispatchers.update({
63
63
  canvasTheme: theme
64
- }); // 设置资源标注
64
+ }); // 设置资源/链路标注样式
65
65
 
66
66
  var _topo$store$getModelS = topo.store.getModelState('displayConfig'),
67
67
  nodeLabelStyle = _topo$store$getModelS.nodeLabelStyle,
@@ -78,8 +78,7 @@ function CanvasPanel(props) {
78
78
  displayConfigDispatchers.update({
79
79
  nodeLabelStyle: globalNodeLabelStyle,
80
80
  defaultEdgeLabelStyle: globalEdgeTagStyle
81
- }); // 设置链路标注
82
-
81
+ });
83
82
  topo.historyManager.endTransaction();
84
83
  };
85
84
 
@@ -36,6 +36,7 @@ function HtImagePalette(props) {
36
36
  viewRef.current = htTopo.createImagePalette(container, {
37
37
  icons: icons
38
38
  });
39
+ console.error(viewRef.current);
39
40
  } catch (error) {
40
41
  _rlog["default"].error('初始化资源面板失败', error);
41
42
  } // 注销组件
@@ -51,13 +51,14 @@ function getButtons(isNetworkTopo) {
51
51
  _FontSizeWidget["default"], // 字号
52
52
  _FontStyleButton["default"], // 文字样式
53
53
  _FontColorButton["default"], // 文字颜色
54
- _Divider["default"], _BoxBackgroundButton["default"], // 框背景
55
- _Divider["default"], _EdgeColorButton["default"], // 线条颜色
54
+ _Divider["default"], // BoxBackgroundButton, // 框背景
55
+ // Divider,
56
+ _EdgeColorButton["default"], // 线条颜色
56
57
  _EdgeTypeButton["default"], // 线形
57
58
  _Divider["default"], _NodeImageButton["default"], // 替换图片
58
59
  _NodeSizeButton["default"], // 图片尺寸
59
60
  _Divider["default"], _Layout["default"], // 布局方式
60
- _NodeAlignWidget["default"], // 对齐方式
61
- _SearchWidget["default"] // 搜索
61
+ _NodeAlignWidget["default"] // 对齐方式
62
+ // SearchWidget, // 搜索
62
63
  ]);
63
64
  }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useValues = useValues;
5
+
6
+ function useValues(topo) {
7
+ return {
8
+ color: null,
9
+ fontFamily: null,
10
+ fontSize: null,
11
+ fontStyle: []
12
+ };
13
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useValues = useValues;
5
+
6
+ function useValues(topo) {
7
+ return {
8
+ color: null,
9
+ fontFamily: null,
10
+ fontSize: null,
11
+ fontStyle: []
12
+ };
13
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.setGlobalTagStyle = void 0;
7
+ exports.setStyle = setStyle;
8
+ exports.useValues = useValues;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var defaultStyle = {
13
+ color: '#AFB9C2',
14
+ fontFamily: '微软雅黑'
15
+ };
16
+
17
+ function useValues(topo) {
18
+ var displayConfigState = topo.store.useModelState('displayConfig');
19
+ var nodeLabelStyle = displayConfigState.nodeLabelStyle,
20
+ defaultEdgeLabelStyle = displayConfigState.defaultEdgeLabelStyle;
21
+ return {
22
+ color: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.color) || defaultStyle.color,
23
+ fontFamily: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontFamily) || defaultStyle.fontFamily,
24
+ fontSize: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontSize
25
+ };
26
+ }
27
+
28
+ var setGlobalTagStyle = function setGlobalTagStyle(topo, styleData) {
29
+ var _topo$store$getModel = topo.store.getModel('displayConfig'),
30
+ displayConfigState = _topo$store$getModel[0],
31
+ displayConfigDispatchers = _topo$store$getModel[1];
32
+
33
+ var nodeLabelStyle = displayConfigState.nodeLabelStyle,
34
+ defaultEdgeLabelStyle = displayConfigState.defaultEdgeLabelStyle;
35
+ var globalNodeLabelStyle = (0, _extends2["default"])({}, nodeLabelStyle, styleData);
36
+ topo.getHtTopo().setGlobalNodeLabelStyle(globalNodeLabelStyle);
37
+ var globalEdgeTagStyle = (0, _extends2["default"])({}, defaultEdgeLabelStyle, styleData);
38
+ topo.getHtTopo().setGlobalEdgeTagStyle(globalEdgeTagStyle);
39
+ displayConfigDispatchers.update({
40
+ nodeLabelStyle: globalNodeLabelStyle,
41
+ defaultEdgeLabelStyle: globalEdgeTagStyle
42
+ });
43
+ };
44
+
45
+ exports.setGlobalTagStyle = setGlobalTagStyle;
46
+
47
+ function setStyle() {}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useValues = useValues;
5
+
6
+ function useValues(topo) {
7
+ return {
8
+ color: null,
9
+ fontFamily: null,
10
+ fontSize: null,
11
+ fontStyle: []
12
+ };
13
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useValues = useValues;
5
+
6
+ function useValues(topo) {
7
+ return {
8
+ color: null,
9
+ fontFamily: null,
10
+ fontSize: null,
11
+ fontStyle: []
12
+ };
13
+ }
@@ -1,47 +1,87 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  exports.__esModule = true;
6
4
  exports["default"] = void 0;
7
5
 
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
-
10
6
  var _react = _interopRequireWildcard(require("react"));
11
7
 
12
8
  var _htElementDataUtil = require("../../../../../utils/htElementDataUtil");
13
9
 
14
10
  var _htElementUtils = require("../../../../../utils/htElementUtils");
15
11
 
12
+ var globalTagSetting = _interopRequireWildcard(require("./textStyleSetting/globalTag"));
13
+
14
+ var EmptySetting = _interopRequireWildcard(require("./textStyleSetting/EmptySetting"));
15
+
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
 
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
+ // 文本
21
+ function getElementType(element) {
22
+ if ((0, _htElementUtils.isNode)(element)) {
23
+ return 'nodeTag';
24
+ } else if ((0, _htElementUtils.isGroup)(element)) {
25
+ return 'group';
26
+ } else if ((0, _htElementDataUtil.isText)(element)) {
27
+ return 'text';
28
+ } else if ((0, _htElementUtils.isLayer)(element)) {
29
+ return 'layer';
30
+ }
31
+
32
+ return null;
33
+ }
34
+
35
+ function getType(selectionElements) {
36
+ if (!selectionElements.length) {
37
+ return 'globalTag';
38
+ } else if (selectionElements.length === 1) {
39
+ var element = selectionElements[0];
40
+ return getElementType(element);
41
+ }
42
+
43
+ return null;
44
+ }
45
+
46
+ var useValuesHookMap = {
47
+ globalTag: globalTagSetting.useValues,
48
+ empty: EmptySetting.useValues
49
+ };
50
+
51
+ function useValues(topo, selection) {
52
+ var type = getType(selection);
53
+ var useValuesHandle = useValuesHookMap[type] || useValuesHookMap.empty;
54
+ var values = useValuesHandle(topo, selection);
55
+ return values;
56
+ }
57
+
58
+ var elementSetStyleMap = {};
59
+
20
60
  function useFontStyleSetting(props) {
21
61
  var topo = props.topo;
22
- var selectionElements = topo.selectionManager.useHtSelection();
23
- var buttonEnabled = true; // 全局配置
62
+ var selection = topo.selectionManager.useHtSelection();
63
+ var buttonEnabled = true; // const values = useValues(topo, selection)
24
64
 
25
- var _topo$store$useModel = topo.store.useModel('displayConfig'),
26
- nodeLabelStyle = _topo$store$useModel[0].nodeLabelStyle,
27
- displayConfigDispatchers = _topo$store$useModel[1];
65
+ var values = {};
28
66
 
29
67
  var setStyle = function setStyle(styleData) {
30
- // 全局调整(资源和链路):无选择时,按钮亮起,即可修改全局资源和链路的标注,不影响“文本”、框名称、区域名称、分层名称的格式。
31
- if (!selectionElements.length) {
32
- topo.getHtTopo().setGlobalNodeLabelStyle(styleData);
33
- displayConfigDispatchers.update({
34
- nodeLabelStyle: (0, _extends2["default"])({}, nodeLabelStyle, styleData)
35
- });
68
+ topo.historyManager.beginTransaction(); // 全局调整(资源和链路):无选择时,按钮亮起,即可修改全局资源和链路的标注,不影响“文本”、框名称、区域名称、分层名称的格式。
69
+
70
+ if (!selection.length) {
71
+ globalTagSetting.setGlobalTagStyle(topo, styleData);
36
72
  } else {
37
- selectionElements.forEach(function (element) {
38
- if ((0, _htElementUtils.isNode)(element)) {} else if ((0, _htElementUtils.isGroup)(element)) {} else if ((0, _htElementDataUtil.isText)(element)) {} else if ((0, _htElementUtils.isLayer)(element)) {}
73
+ selection.forEach(function (element) {
74
+ var elementType = getElementType(element);
39
75
  });
40
76
  }
77
+
78
+ topo.historyManager.endTransaction();
41
79
  };
42
80
 
43
81
  return {
82
+ selection: selection,
44
83
  buttonEnabled: buttonEnabled,
84
+ values: values,
45
85
  setStyle: setStyle
46
86
  };
47
87
  }
@@ -5,6 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports["default"] = void 0;
7
7
 
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+
8
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
11
 
10
12
  var _react = _interopRequireWildcard(require("react"));
@@ -48,10 +50,16 @@ function EdgeColorButton(props) {
48
50
 
49
51
  var selection = topo.selectionManager.useHtSelection();
50
52
 
53
+ var loopEdges = function loopEdges(edges, operateEdgeFn) {
54
+ edges.forEach(function (edge) {
55
+ operateEdgeFn(edge);
56
+ });
57
+ };
58
+
51
59
  var getLines = function getLines(list) {
52
60
  // eslint-disable-next-line prefer-const
53
61
  var arr = [];
54
- (0, _edgeTypeStyleUtil.loopEdgesAndChildren)(topo, list, function (edge) {
62
+ loopEdges(list, function (edge) {
55
63
  // eslint-disable-next-line eqeqeq
56
64
  if (edge.getAttrObject().type == 'line') {
57
65
  arr.push(edge);
@@ -66,7 +74,7 @@ function EdgeColorButton(props) {
66
74
  var list = getLines(edges);
67
75
  setLineWidth(0); // eslint-disable-next-line eqeqeq
68
76
 
69
- if (selection.length == 1 && selection[0].getAttrObject().type == 'line') {
77
+ if (selection.length == 1 && selection[0].a('type') == 'line') {
70
78
  setLineWidth(list[0] && (list[0].a('styles') && list[0].a('styles').width || list[0].getStyleMap()['edge.width']) || 2);
71
79
  }
72
80
 
@@ -74,14 +82,20 @@ function EdgeColorButton(props) {
74
82
  }
75
83
  }, [selection, graphLoaded]);
76
84
 
77
- var colorOnChange = function colorOnChange(color, type) {
85
+ var colorOnChange = function colorOnChange(colors, type) {
78
86
  // eslint-disable-next-line eqeqeq
79
87
  if (type == 'select') topo.historyManager.beginTransaction();
80
88
  var edges = (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo);
81
- (0, _edgeTypeStyleUtil.loopEdgesAndChildren)(topo, edges, function (edge) {
89
+ loopEdges(edges, function (edge) {
82
90
  // eslint-disable-next-line eqeqeq
83
91
  if (edge.getAttrObject().type == 'line') {
84
- edge.s('edge.color', color.hex);
92
+ var color = colors.hex;
93
+ edge.s('edge.color', color);
94
+ edge.s('edge.dash.color', color);
95
+ var style = edge.a('styles') || {};
96
+ edge.a('styles', (0, _extends2["default"])({}, style, {
97
+ color: color
98
+ }));
85
99
  }
86
100
  }); // eslint-disable-next-line eqeqeq
87
101
 
@@ -97,14 +111,21 @@ function EdgeColorButton(props) {
97
111
  topo.historyManager.endTransaction();
98
112
  };
99
113
 
100
- var lineSizeChange = function lineSizeChange(value) {
114
+ var lineSizeChange = function lineSizeChange(width) {
101
115
  var edges = (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo);
102
- (0, _edgeTypeStyleUtil.setEdgesAndChildren)(topo, edges, function (edge) {
116
+ topo.historyManager.beginTransaction();
117
+ loopEdges(edges, function (edge) {
103
118
  // eslint-disable-next-line eqeqeq
104
119
  if (edge.getAttrObject().type == 'line') {
105
- edge.s('edge.width', value); // 设置
120
+ edge.s('edge.dash.width', width);
121
+ edge.s('edge.width', width);
122
+ var style = edge.a('styles') || {};
123
+ edge.a('styles', (0, _extends2["default"])({}, style, {
124
+ width: width
125
+ }));
106
126
  }
107
127
  });
128
+ topo.historyManager.endTransaction();
108
129
  };
109
130
 
110
131
  var icon = disabled ? /*#__PURE__*/_react["default"].createElement("img", {
@@ -86,8 +86,23 @@ function EdgeTypeButton(props) {
86
86
  edge.s('icons', (0, _extends2["default"])({}, edge.s('icons')));
87
87
  edge.addStyleIcon(value, _constants.EDGE_END_POINT_TYPE_MAP[value]);
88
88
  } else if (name === 'lineMold') {
89
+ // 修改实线虚线
89
90
  edge.a('lineMode', value);
90
91
  htTopo.setElementStyle(edge, _constants.LINE_MOLD_MAP[value]);
92
+
93
+ if (value !== 'solid') {
94
+ var edgeWidth = edge.s('edge.width');
95
+
96
+ if (edgeWidth) {
97
+ edge.s('edge.dash.width', edgeWidth);
98
+ }
99
+
100
+ var color = edge.s('edge.color');
101
+
102
+ if (edgeWidth) {
103
+ edge.s('edge.dash.color', color);
104
+ }
105
+ }
91
106
  }
92
107
  });
93
108
  };
@@ -17,6 +17,8 @@ var _FontColorRange = _interopRequireDefault(require("../../../../../components/
17
17
 
18
18
  var _FontColorButtonModule = _interopRequireDefault(require("./FontColorButton.module.scss"));
19
19
 
20
+ var _useFontStyleSetting = _interopRequireDefault(require("../hooks/useFontStyleSetting"));
21
+
20
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
23
 
22
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -31,6 +33,9 @@ function FontFamilySelect(props) {
31
33
  disabled = _useState[0],
32
34
  setDisabled = _useState[1];
33
35
 
36
+ var fontStyleSetting = (0, _useFontStyleSetting["default"])({
37
+ topo: topo
38
+ });
34
39
  console.log(topo, 'topo这里需要处理颜色改变的事情');
35
40
 
36
41
  var backOpacityChange = function backOpacityChange(value) {
@@ -7,10 +7,10 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
- var _useFontStyleSetting = _interopRequireDefault(require("../hooks/useFontStyleSetting"));
11
-
12
10
  var _DropdownMenu = _interopRequireDefault(require("./components/DropdownMenu"));
13
11
 
12
+ var _textStyleSettingRouter = _interopRequireDefault(require("./components/textStyleSetting/textStyleSettingRouter.js"));
13
+
14
14
  var _WidgetBox = _interopRequireDefault(require("./WidgetBox"));
15
15
 
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -22,7 +22,14 @@ function FontFamilySelect(props) {
22
22
  onChange = props.onChange;
23
23
  var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
24
24
  return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"], {
25
- value: value,
25
+ value: value || '',
26
+ valueRender: function valueRender(val) {
27
+ return /*#__PURE__*/_react["default"].createElement("div", {
28
+ style: {
29
+ width: 48
30
+ }
31
+ }, val || '微软雅黑');
32
+ },
26
33
  onChange: onChange
27
34
  }, items.map(function (item) {
28
35
  return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"].Item, {
@@ -37,29 +44,23 @@ function FontFamilySelect(props) {
37
44
 
38
45
  function FontFamilyWidget(props) {
39
46
  var topo = props.topo,
40
- showLabel = props.showLabel;
41
-
42
- var _useState = (0, _react.useState)('微软雅黑'),
43
- value = _useState[0],
44
- setValue = _useState[1];
45
-
46
- var fontStyleSetting = (0, _useFontStyleSetting["default"])({
47
- topo: topo
48
- });
47
+ showLabel = props.showLabel,
48
+ style = props.style,
49
+ setStyle = props.setStyle;
49
50
  return /*#__PURE__*/_react["default"].createElement(_WidgetBox["default"], {
50
51
  label: "\u5B57\u4F53",
51
52
  tooltip: "\u5B57\u4F53",
52
53
  showLabel: showLabel
53
54
  }, /*#__PURE__*/_react["default"].createElement(FontFamilySelect, {
54
- value: value,
55
+ value: style.fontFamily,
55
56
  onChange: function onChange(val) {
56
- setValue(val);
57
- fontStyleSetting.setStyle({
57
+ setStyle({
58
58
  fontFamily: val
59
59
  });
60
60
  }
61
61
  }));
62
62
  }
63
63
 
64
- var _default = FontFamilyWidget;
64
+ var _default = (0, _textStyleSettingRouter["default"])(FontFamilyWidget);
65
+
65
66
  exports["default"] = _default;
@@ -7,10 +7,10 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
- var _useFontStyleSetting = _interopRequireDefault(require("../hooks/useFontStyleSetting"));
11
-
12
10
  var _DropdownMenu = _interopRequireDefault(require("./components/DropdownMenu"));
13
11
 
12
+ var _textStyleSettingRouter = _interopRequireDefault(require("./components/textStyleSetting/textStyleSettingRouter.js"));
13
+
14
14
  var _WidgetBox = _interopRequireDefault(require("./WidgetBox"));
15
15
 
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -19,11 +19,20 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
19
19
 
20
20
  function FontSizeSelect(props) {
21
21
  var value = props.value,
22
- onChange = props.onChange;
22
+ _onChange = props.onChange;
23
23
  var items = [9, 10, 11, 12, 14, 16, 18, 20, 24, 30, 36];
24
24
  return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"], {
25
- value: value,
26
- onChange: onChange
25
+ value: "" + (value || ''),
26
+ valueRender: function valueRender(val) {
27
+ return /*#__PURE__*/_react["default"].createElement("div", {
28
+ style: {
29
+ width: 18
30
+ }
31
+ }, val || 12);
32
+ },
33
+ onChange: function onChange(val) {
34
+ return _onChange(parseInt(val, 10));
35
+ }
27
36
  }, items.map(function (item) {
28
37
  return /*#__PURE__*/_react["default"].createElement(_DropdownMenu["default"].Item, {
29
38
  key: item
@@ -33,28 +42,22 @@ function FontSizeSelect(props) {
33
42
 
34
43
  function FontSizeWidget(props) {
35
44
  var topo = props.topo,
36
- showLabel = props.showLabel;
37
- var fontStyleSetting = (0, _useFontStyleSetting["default"])({
38
- topo: topo
39
- });
40
-
41
- var _useState = (0, _react.useState)(12),
42
- fontSize = _useState[0],
43
- setFontSize = _useState[1];
44
-
45
+ showLabel = props.showLabel,
46
+ style = props.style,
47
+ setStyle = props.setStyle;
45
48
  return /*#__PURE__*/_react["default"].createElement(_WidgetBox["default"], {
46
49
  label: "\u5B57\u53F7",
47
50
  showLabel: showLabel
48
51
  }, /*#__PURE__*/_react["default"].createElement(FontSizeSelect, {
49
- value: fontSize,
52
+ value: style.fontSize,
50
53
  onChange: function onChange(val) {
51
- setFontSize(val);
52
- fontStyleSetting.setStyle({
54
+ setStyle({
53
55
  fontSize: val
54
56
  });
55
57
  }
56
58
  }));
57
59
  }
58
60
 
59
- var _default = FontSizeWidget;
61
+ var _default = (0, _textStyleSettingRouter["default"])(FontSizeWidget);
62
+
60
63
  exports["default"] = _default;