@riil-frontend/component-topology 6.0.0-alpha.4 → 6.0.0-alpha.41

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 (335) 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 +35 -35
  5. package/es/components/ColorPanel/components/ColorBlock/index.js +37 -0
  6. package/es/components/ColorPanel/components/ColorBlock/index.module.scss +9 -0
  7. package/es/components/ColorPanel/components/FontColorRange/index.js +35 -0
  8. package/es/components/ColorPanel/components/FontColorRange/index.module.scss +25 -0
  9. package/es/components/ColorPanel/index.js +237 -0
  10. package/es/components/ColorPanel/index.module.scss +35 -0
  11. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +5 -1
  12. package/es/components/collapse/Collapse.js +22 -3
  13. package/es/components/collapse/Collapse.module.scss +24 -0
  14. package/es/components/collapse/index.js +2 -0
  15. package/es/core/common/hooks/useHtElements.js +21 -0
  16. package/es/core/common/icons/icon.js +41 -0
  17. package/es/core/common/icons/useIcons.js +8 -16
  18. package/es/core/components/AlarmListPanel/components/AlarmListItem.js +14 -13
  19. package/es/core/components/AlarmListPanel/components/index.module.scss +5 -5
  20. package/es/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -1
  21. package/es/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +9 -3
  22. package/es/core/components/DisplaySettingDrawer/EditorDisplaySetting.js +122 -0
  23. package/es/core/components/DisplaySettingDrawer/LineExpandAllRadioGroup.js +0 -3
  24. package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +76 -19
  25. package/es/core/components/TopoView/GraphViewPanel.js +21 -0
  26. package/es/core/components/TopoView/editor.module.scss +1 -0
  27. package/es/core/components/TopoView/topoView.js +29 -49
  28. package/es/core/components/titlebar/TitleBar.module.scss +1 -1
  29. package/es/core/editor/components/EditorPlugin.js +2 -1
  30. package/es/core/editor/components/Sidebar/Sidebar.js +41 -50
  31. package/es/core/editor/components/Sidebar/panes.js +32 -0
  32. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +38 -0
  33. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +74 -0
  34. package/es/core/editor/components/Sidebar/views/CanvasPanel/index.js +1 -1
  35. package/es/core/editor/components/Sidebar/views/CanvasPanel/themes.js +63 -0
  36. package/es/core/editor/components/Sidebar/views/CanvasPanel/useCanvasThemeConfig.js +115 -0
  37. package/es/core/editor/components/Sidebar/views/ImagePanel/CiTypeImagePanel.js +3 -3
  38. package/es/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +14 -6
  39. package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +14 -5
  40. package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.module.scss +5 -0
  41. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +20 -7
  42. package/es/core/editor/components/Toolbar/EditorToolbar.js +23 -13
  43. package/es/core/editor/components/Toolbar/Toolbar.js +1 -1
  44. package/es/core/editor/components/Toolbar/Toolbar.module.scss +14 -3
  45. package/es/core/editor/components/Toolbar/buttons.js +20 -18
  46. package/es/core/editor/components/Toolbar/widgets/AddResourceButton.js +8 -7
  47. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +2 -2
  48. package/es/core/editor/components/Toolbar/widgets/CanvasMoveWidget.js +13 -2
  49. package/es/core/editor/components/Toolbar/widgets/CanvasSelectWidget.js +11 -2
  50. package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/Content.js +46 -2
  51. package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +98 -6
  52. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +184 -3
  53. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +44 -0
  54. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +53 -0
  55. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +31 -0
  56. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/constants.js +77 -0
  57. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +74 -6
  58. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +70 -16
  59. package/es/core/editor/components/Toolbar/widgets/FontColorButton.module.scss +43 -0
  60. package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +25 -11
  61. package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +29 -13
  62. package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +100 -39
  63. package/es/core/editor/components/Toolbar/widgets/HistoryRedoButton.js +3 -2
  64. package/es/core/editor/components/Toolbar/widgets/HistoryUndoButton.js +5 -4
  65. package/es/core/editor/components/Toolbar/widgets/IconSelect/IconSelect.js +109 -0
  66. package/es/core/editor/components/Toolbar/widgets/IconSelect/constant.js +64 -0
  67. package/es/core/editor/components/Toolbar/widgets/IconSelect/index.js +101 -0
  68. package/es/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +153 -0
  69. package/es/core/editor/components/Toolbar/widgets/IconSelect/popUpContent.js +49 -0
  70. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutSettings.js +99 -0
  71. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutSettings.module.scss +70 -0
  72. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagImageSelect/index.js +42 -0
  73. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagImageSelect/index.module.scss +7 -0
  74. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagSelect/index.js +75 -0
  75. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagSelect/index.scss +32 -0
  76. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/Icon.js +23 -0
  77. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/index.js +10 -0
  78. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_circular.svg +10 -0
  79. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_hierarchical.svg +10 -0
  80. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_rectangle.svg +12 -0
  81. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_toward.svg +16 -0
  82. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/index.js +31 -0
  83. package/es/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/index.module.scss +53 -0
  84. package/es/core/editor/components/Toolbar/widgets/Layout/index.js +128 -15
  85. package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +95 -23
  86. package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +33 -0
  87. package/es/core/editor/components/Toolbar/widgets/NodeImageButton/BoxBackgroundSetting.js +15 -5
  88. package/es/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +41 -7
  89. package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +98 -13
  90. package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.module.scss +28 -0
  91. package/es/core/editor/components/Toolbar/widgets/WidgetBox.js +15 -22
  92. package/es/core/editor/components/Toolbar/widgets/WidgetBox.module.scss +11 -1
  93. package/es/core/editor/components/Toolbar/widgets/components/ButtonBox.js +5 -3
  94. package/es/core/editor/components/Toolbar/widgets/components/ButtonBox.module.scss +3 -0
  95. package/es/core/editor/components/Toolbar/widgets/components/DropdownButton.js +21 -3
  96. package/es/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +16 -6
  97. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +49 -0
  98. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/colorUtil.js +59 -0
  99. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/box.js +30 -0
  100. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +25 -0
  101. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +41 -0
  102. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/index.js +14 -0
  103. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +49 -0
  104. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +36 -0
  105. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +32 -0
  106. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +71 -0
  107. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +25 -0
  108. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +52 -0
  109. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +20 -0
  110. package/es/core/editor/components/settings/CloseablePanel.js +33 -0
  111. package/es/core/editor/components/settings/CloseablePanel.module.scss +9 -0
  112. package/es/core/editor/components/settings/OpenPropertyPanelListener.js +33 -0
  113. package/es/core/editor/components/settings/PropertyView.js +29 -8
  114. package/es/core/editor/components/settings/Settings.js +4 -44
  115. package/es/core/editor/components/settings/Settings.module.scss +8 -4
  116. package/es/core/editor/components/settings/common/AlignSetting/AlignSetting.module.scss +2 -2
  117. package/es/core/editor/components/settings/common/AlignSetting/AlignTypeList.js +80 -0
  118. package/es/core/editor/components/settings/common/AlignSetting/index.js +20 -72
  119. package/es/core/editor/components/settings/common/LineType/index.js +12 -119
  120. package/es/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.js +3 -3
  121. package/es/core/editor/components/settings/common/SizeInput/NodeSizeInput.js +31 -21
  122. package/es/core/editor/components/settings/common/SizeInput/NodeSizeNumberPicker.js +7 -6
  123. package/es/core/editor/components/settings/common/text/fontStyleUtil.js +11 -19
  124. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
  125. package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +0 -8
  126. package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +8 -9
  127. package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +5 -42
  128. package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +2 -15
  129. package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +1 -1
  130. package/es/core/editor/components/settings/propertyViews/view/BatchSetNodeSize.js +9 -6
  131. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +8 -4
  132. package/es/core/editor/hooks/useKeyboardShortcut.js +42 -0
  133. package/es/core/{store/models → editor/store}/background.js +0 -0
  134. package/es/core/{store/models → editor/store}/historyManager.js +0 -0
  135. package/es/core/editor/store/topoEdit.js +49 -0
  136. package/es/core/editor/utils/edgeTypeStyleUtil.js +96 -0
  137. package/es/core/editor/utils/textStyleUtil.js +0 -0
  138. package/es/core/hooks/useCanvasTheme.js +61 -0
  139. package/es/core/hooks/usePolling.js +2 -5
  140. package/es/core/hooks/useTopoEdit.js +38 -58
  141. package/es/core/models/Alarm.js +2 -2
  142. package/es/core/models/AttributeMetricDisplay.js +4 -0
  143. package/es/core/models/HistoryManager.js +11 -3
  144. package/es/core/models/SelectionManager.js +28 -9
  145. package/es/core/models/TopoApp.js +1 -1
  146. package/es/core/models/TopoGraphView.js +8 -2
  147. package/es/core/models/selection/ignoreList.js +1 -0
  148. package/es/core/models/utils/linkUtils.js +5 -6
  149. package/es/core/store/coreModels.js +6 -7
  150. package/es/core/store/models/selection.js +2 -1
  151. package/es/core/store/models/topoBizMod.js +0 -3
  152. package/es/core/store/models/topoConfig.js +10 -12
  153. package/es/core/store/models/topoMod.js +26 -28
  154. package/es/core/utils/edgeUtil.js +6 -0
  155. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +3 -4
  156. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +19 -5
  157. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/WebConsoleForm.js +13 -29
  158. package/es/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +6 -5
  159. package/es/core/viewer/components/titlebar/widgets/SettingButton.js +3 -1
  160. package/es/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +4 -2
  161. package/es/networkTopo/createTopo.js +2 -0
  162. package/es/networkTopo/services/link.js +2 -2
  163. package/es/networkTopo/store/topoTreeMod.js +6 -7
  164. package/es/style.js +1 -0
  165. package/es/utils/htElementUtils.js +3 -0
  166. package/es/utils/topoData.js +1 -0
  167. package/lib/components/ColorPanel/components/ColorBlock/index.js +47 -0
  168. package/lib/components/ColorPanel/components/ColorBlock/index.module.scss +9 -0
  169. package/lib/components/ColorPanel/components/FontColorRange/index.js +49 -0
  170. package/lib/components/ColorPanel/components/FontColorRange/index.module.scss +25 -0
  171. package/lib/components/ColorPanel/index.js +255 -0
  172. package/lib/components/ColorPanel/index.module.scss +35 -0
  173. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +5 -1
  174. package/lib/components/collapse/Collapse.js +28 -3
  175. package/lib/components/collapse/Collapse.module.scss +24 -0
  176. package/lib/components/collapse/index.js +11 -0
  177. package/lib/core/common/hooks/useHtElements.js +27 -0
  178. package/lib/core/common/icons/icon.js +48 -0
  179. package/lib/core/common/icons/useIcons.js +10 -15
  180. package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +14 -13
  181. package/lib/core/components/AlarmListPanel/components/index.module.scss +5 -5
  182. package/lib/core/components/DisplaySettingDrawer/DisplaySetting.js +2 -1
  183. package/lib/core/components/DisplaySettingDrawer/DisplaySettingDrawer.js +10 -3
  184. package/lib/core/components/DisplaySettingDrawer/EditorDisplaySetting.js +147 -0
  185. package/lib/core/components/DisplaySettingDrawer/LineExpandAllRadioGroup.js +0 -3
  186. package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +76 -19
  187. package/lib/core/components/TopoView/GraphViewPanel.js +31 -0
  188. package/lib/core/components/TopoView/editor.module.scss +1 -0
  189. package/lib/core/components/TopoView/topoView.js +32 -50
  190. package/lib/core/components/titlebar/TitleBar.module.scss +1 -1
  191. package/lib/core/editor/components/EditorPlugin.js +3 -1
  192. package/lib/core/editor/components/Sidebar/Sidebar.js +40 -53
  193. package/lib/core/editor/components/Sidebar/panes.js +45 -0
  194. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +53 -0
  195. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.module.scss +74 -0
  196. package/lib/core/editor/components/Sidebar/views/CanvasPanel/index.js +2 -2
  197. package/lib/core/editor/components/Sidebar/views/CanvasPanel/themes.js +72 -0
  198. package/lib/core/editor/components/Sidebar/views/CanvasPanel/useCanvasThemeConfig.js +128 -0
  199. package/lib/core/editor/components/Sidebar/views/ImagePanel/CiTypeImagePanel.js +1 -1
  200. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +15 -6
  201. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +16 -5
  202. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.module.scss +5 -0
  203. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +29 -11
  204. package/lib/core/editor/components/Toolbar/EditorToolbar.js +22 -11
  205. package/lib/core/editor/components/Toolbar/Toolbar.js +1 -1
  206. package/lib/core/editor/components/Toolbar/Toolbar.module.scss +14 -3
  207. package/lib/core/editor/components/Toolbar/buttons.js +21 -20
  208. package/lib/core/editor/components/Toolbar/widgets/AddResourceButton.js +8 -7
  209. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +2 -2
  210. package/lib/core/editor/components/Toolbar/widgets/CanvasMoveWidget.js +13 -2
  211. package/lib/core/editor/components/Toolbar/widgets/CanvasSelectWidget.js +11 -2
  212. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/Content.js +48 -2
  213. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +100 -6
  214. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +194 -3
  215. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +44 -0
  216. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +71 -0
  217. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +31 -0
  218. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/constants.js +83 -0
  219. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +76 -5
  220. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +75 -16
  221. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.module.scss +43 -0
  222. package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +26 -10
  223. package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +30 -12
  224. package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +105 -39
  225. package/lib/core/editor/components/Toolbar/widgets/HistoryRedoButton.js +4 -2
  226. package/lib/core/editor/components/Toolbar/widgets/HistoryUndoButton.js +5 -3
  227. package/lib/core/editor/components/Toolbar/widgets/IconSelect/IconSelect.js +126 -0
  228. package/lib/core/editor/components/Toolbar/widgets/IconSelect/constant.js +69 -0
  229. package/lib/core/editor/components/Toolbar/widgets/IconSelect/index.js +117 -0
  230. package/lib/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +153 -0
  231. package/lib/core/editor/components/Toolbar/widgets/IconSelect/popUpContent.js +61 -0
  232. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutSettings.js +116 -0
  233. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutSettings.module.scss +70 -0
  234. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagImageSelect/index.js +55 -0
  235. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagImageSelect/index.module.scss +7 -0
  236. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagSelect/index.js +93 -0
  237. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTagSelect/index.scss +32 -0
  238. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/Icon.js +32 -0
  239. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/index.js +22 -0
  240. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_circular.svg +10 -0
  241. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_hierarchical.svg +10 -0
  242. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_rectangle.svg +12 -0
  243. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/assets/topo_layout_toward.svg +16 -0
  244. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/index.js +44 -0
  245. package/lib/core/editor/components/Toolbar/widgets/Layout/components/LayoutTemplateButton/index.module.scss +53 -0
  246. package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +133 -16
  247. package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +98 -23
  248. package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +33 -0
  249. package/lib/core/editor/components/Toolbar/widgets/NodeImageButton/BoxBackgroundSetting.js +21 -5
  250. package/lib/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +41 -6
  251. package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +99 -12
  252. package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.module.scss +28 -0
  253. package/lib/core/editor/components/Toolbar/widgets/WidgetBox.js +16 -22
  254. package/lib/core/editor/components/Toolbar/widgets/WidgetBox.module.scss +11 -1
  255. package/lib/core/editor/components/Toolbar/widgets/components/ButtonBox.js +5 -3
  256. package/lib/core/editor/components/Toolbar/widgets/components/ButtonBox.module.scss +3 -0
  257. package/lib/core/editor/components/Toolbar/widgets/components/DropdownButton.js +21 -3
  258. package/lib/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +17 -6
  259. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +63 -0
  260. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/colorUtil.js +72 -0
  261. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/box.js +45 -0
  262. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +40 -0
  263. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +57 -0
  264. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/index.js +28 -0
  265. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +64 -0
  266. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +52 -0
  267. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +47 -0
  268. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +83 -0
  269. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +39 -0
  270. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +65 -0
  271. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +31 -0
  272. package/lib/core/editor/components/settings/CloseablePanel.js +46 -0
  273. package/lib/core/editor/components/settings/CloseablePanel.module.scss +9 -0
  274. package/lib/core/editor/components/settings/OpenPropertyPanelListener.js +43 -0
  275. package/lib/core/editor/components/settings/PropertyView.js +32 -8
  276. package/lib/core/editor/components/settings/Settings.js +4 -44
  277. package/lib/core/editor/components/settings/Settings.module.scss +8 -4
  278. package/lib/core/editor/components/settings/common/AlignSetting/AlignSetting.module.scss +2 -2
  279. package/lib/core/editor/components/settings/common/AlignSetting/AlignTypeList.js +97 -0
  280. package/lib/core/editor/components/settings/common/AlignSetting/index.js +21 -80
  281. package/lib/core/editor/components/settings/common/LineType/index.js +13 -126
  282. package/lib/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.js +2 -2
  283. package/lib/core/editor/components/settings/common/SizeInput/NodeSizeInput.js +32 -23
  284. package/lib/core/editor/components/settings/common/SizeInput/NodeSizeNumberPicker.js +6 -6
  285. package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +12 -20
  286. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
  287. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +0 -8
  288. package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize.js +6 -8
  289. package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +5 -42
  290. package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +2 -15
  291. package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +1 -1
  292. package/lib/core/editor/components/settings/propertyViews/view/BatchSetNodeSize.js +7 -5
  293. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +9 -1
  294. package/lib/core/editor/hooks/useKeyboardShortcut.js +52 -0
  295. package/lib/core/{store/models → editor/store}/background.js +0 -0
  296. package/lib/core/{store/models → editor/store}/historyManager.js +0 -0
  297. package/lib/core/editor/store/topoEdit.js +59 -0
  298. package/lib/core/editor/utils/edgeTypeStyleUtil.js +109 -0
  299. package/lib/core/editor/utils/textStyleUtil.js +1 -0
  300. package/lib/core/hooks/useCanvasTheme.js +75 -0
  301. package/lib/core/hooks/usePolling.js +2 -5
  302. package/lib/core/hooks/useTopoEdit.js +39 -60
  303. package/lib/core/models/Alarm.js +2 -2
  304. package/lib/core/models/AttributeMetricDisplay.js +4 -0
  305. package/lib/core/models/HistoryManager.js +11 -3
  306. package/lib/core/models/SelectionManager.js +30 -9
  307. package/lib/core/models/TopoApp.js +1 -1
  308. package/lib/core/models/TopoGraphView.js +8 -2
  309. package/lib/core/models/selection/ignoreList.js +6 -0
  310. package/lib/core/models/utils/linkUtils.js +5 -6
  311. package/lib/core/store/coreModels.js +5 -7
  312. package/lib/core/store/models/selection.js +2 -1
  313. package/lib/core/store/models/topoBizMod.js +0 -3
  314. package/lib/core/store/models/topoConfig.js +9 -18
  315. package/lib/core/store/models/topoMod.js +27 -29
  316. package/lib/core/utils/edgeUtil.js +6 -0
  317. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/hooks/useMetricPolling.js +3 -4
  318. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/LinkTopo/services/index.js +19 -5
  319. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/WebConsoleForm.js +13 -29
  320. package/lib/core/viewer/components/plugins/ResourceDetail/components/WebConsole/WebConsoleForm/hooks/useWebConsole.js +6 -5
  321. package/lib/core/viewer/components/titlebar/widgets/SettingButton.js +3 -1
  322. package/lib/core/viewer/components/titlebar/widgets/SettingButtonWidget.js +4 -2
  323. package/lib/networkTopo/createTopo.js +3 -0
  324. package/lib/networkTopo/services/link.js +2 -2
  325. package/lib/networkTopo/store/topoTreeMod.js +6 -8
  326. package/lib/style.js +1 -0
  327. package/lib/utils/htElementUtils.js +5 -0
  328. package/lib/utils/topoData.js +1 -0
  329. package/package.json +5 -4
  330. package/es/core/editor/components/Sidebar/views/CanvasPanel/ImagePanel.js +0 -4
  331. package/es/core/store/models/topoEdit.js +0 -39
  332. package/es/core/store/models/topoView.js +0 -36
  333. package/lib/core/editor/components/Sidebar/views/CanvasPanel/ImagePanel.js +0 -12
  334. package/lib/core/store/models/topoEdit.js +0 -51
  335. package/lib/core/store/models/topoView.js +0 -47
@@ -0,0 +1,31 @@
1
+ .lineType{
2
+ display:flex;
3
+ .redioBtn {
4
+ width: 24px;
5
+ height: 24px;
6
+ border-radius: 4px;
7
+ border: none !important;
8
+ color: #4D6277;
9
+ padding: 0;
10
+ margin-right: 16px;
11
+ text-align: center;
12
+
13
+ .iconImg {
14
+ vertical-align: middle;
15
+ }
16
+
17
+ &:active {
18
+ background: #F2F7FD !important;
19
+ }
20
+
21
+ &:hover {
22
+ background: #F2F7FD !important;
23
+ }
24
+ }
25
+ .redioBtn:last-child{
26
+ margin-right: 0;
27
+ }
28
+ }
29
+ .iconImg {
30
+ vertical-align: middle;
31
+ }
@@ -0,0 +1,77 @@
1
+ export var EDGE_END_POINT_TYPE_MAP = {
2
+ // 起点箭头
3
+ sourceArrow: {
4
+ names: ['sourceArrow'],
5
+ position: 15,
6
+ height: 15,
7
+ width: 37.5,
8
+ offsetX: -2,
9
+ keepOrien: true
10
+ },
11
+ // 起点实心圆
12
+ sourceSolidCircle: {
13
+ names: ['sourceSolidCircle'],
14
+ position: 15,
15
+ height: 12.5,
16
+ width: 25,
17
+ offsetX: 3,
18
+ keepOrien: true
19
+ },
20
+ // 起点空心圆
21
+ sourceNoneCircle: {
22
+ names: ['sourceNoneCircle'],
23
+ position: 15,
24
+ height: 12.5,
25
+ width: 25,
26
+ offsetX: 2.5,
27
+ keepOrien: true
28
+ },
29
+ // 终点箭头
30
+ targetArrow: {
31
+ names: ['targetArrow'],
32
+ position: 19,
33
+ height: 15,
34
+ width: 37.5,
35
+ offsetX: 3,
36
+ keepOrien: true
37
+ },
38
+ // 终点实心圆
39
+ targetSolidCircle: {
40
+ names: ['targetSolidCircle'],
41
+ position: 19,
42
+ height: 12.5,
43
+ width: 25,
44
+ offsetX: 0.5,
45
+ keepOrien: true
46
+ },
47
+ // 终点空心圆
48
+ targetNoneCircle: {
49
+ names: ['targetNoneCircle'],
50
+ position: 19,
51
+ height: 12.5,
52
+ width: 25,
53
+ offsetX: -0.5,
54
+ keepOrien: true
55
+ }
56
+ };
57
+ export var LINE_MOLD_MAP = {
58
+ solidLine: {
59
+ lineType: 'solid',
60
+ dashPattern: null
61
+ },
62
+ dottedLine: {
63
+ lineType: 'dash',
64
+ dashPattern: 1 // lineType为dash生效。为空默认为1。值:1/2/3
65
+
66
+ },
67
+ dottedLine1: {
68
+ lineType: 'dash',
69
+ dashPattern: 3 // lineType为dash生效。为空默认为1。值:1/2/3
70
+
71
+ },
72
+ dottedLine2: {
73
+ lineType: 'dash',
74
+ dashPattern: 2 // lineType为dash生效。为空默认为1。值:1/2/3
75
+
76
+ }
77
+ };
@@ -1,8 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
3
  var _excluded = ["topo", "showLabel"];
3
- import React, { useEffect, useState } from 'react';
4
+ import React, { useEffect, useMemo, useState } from 'react';
5
+ import { getEdgesBySelection, setEdgesAndChildren, setEdgesType } from "../../../../utils/edgeTypeStyleUtil";
4
6
  import DropdownButton from "../components/DropdownButton";
5
7
  import WidgetBox from "../WidgetBox";
8
+ import { EDGE_END_POINT_TYPE_MAP, LINE_MOLD_MAP } from "./constants";
6
9
  import EdgeType from "./EdgeType";
7
10
  /**
8
11
  * 线形设置
@@ -17,13 +20,74 @@ function EdgeTypeButton(props) {
17
20
 
18
21
  var _useState = useState(true),
19
22
  disabled = _useState[0],
20
- setDisabled = _useState[1]; // 选中的元素
23
+ setDisabled = _useState[1]; // 拓扑图是否加载
21
24
 
22
25
 
23
- var selection = topo.selectionManager.useSelection();
26
+ var _topo$store$useModelS = topo.store.useModelState('topoMod'),
27
+ graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
28
+
29
+
30
+ var selection = topo.selectionManager.useHtSelection();
24
31
  useEffect(function () {
25
- setDisabled(false);
26
- }, [selection]);
32
+ if (graphLoaded) {
33
+ var edges = getEdgesBySelection(topo);
34
+ setDisabled(!edges.length);
35
+ }
36
+ }, [selection, graphLoaded]);
37
+
38
+ var handleChange = function handleChange(name, value) {
39
+ var edges = getEdgesBySelection(topo);
40
+ var htTopo = topo.getHtTopo();
41
+
42
+ if (name === 'lineButton') {
43
+ setEdgesType(edges, value, topo);
44
+ return;
45
+ }
46
+
47
+ setEdgesAndChildren(topo, edges, function (edge) {
48
+ if (name === 'startPoint') {
49
+ // 删除设置
50
+ ['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].forEach(function (iconName) {
51
+ return edge.removeStyleIcon(iconName);
52
+ }); // 设置
53
+
54
+ var scolor = edge.a('styles') && edge.a('styles').color || edge.getStyleMap()['edge.color'];
55
+ edge.a('arrow.color', scolor || '#00B779');
56
+ edge.s('icons', _extends({}, edge.s('icons')));
57
+ edge.addStyleIcon(value, EDGE_END_POINT_TYPE_MAP[value]);
58
+ } else if (name === 'endPoint') {
59
+ // 删除设置
60
+ ['targetArrow', 'targetSolidCircle', 'targetNoneCircle'].forEach(function (iconName) {
61
+ return edge.removeStyleIcon(iconName);
62
+ }); // 设置
63
+
64
+ var _scolor = edge.a('styles') && edge.a('styles').color || edge.getStyleMap()['edge.color'];
65
+
66
+ edge.a('arrow.color', _scolor || '#00B779');
67
+ edge.s('icons', _extends({}, edge.s('icons')));
68
+ edge.addStyleIcon(value, EDGE_END_POINT_TYPE_MAP[value]);
69
+ } else if (name === 'lineMold') {
70
+ // 修改实线虚线
71
+ edge.a('lineMode', value);
72
+ htTopo.setElementStyle(edge, LINE_MOLD_MAP[value]);
73
+
74
+ if (value !== 'solid') {
75
+ var edgeWidth = edge.s('edge.width');
76
+
77
+ if (edgeWidth) {
78
+ edge.s('edge.dash.width', edgeWidth);
79
+ }
80
+
81
+ var color = edge.s('edge.color');
82
+
83
+ if (edgeWidth) {
84
+ edge.s('edge.dash.color', color);
85
+ }
86
+ }
87
+ }
88
+ });
89
+ };
90
+
27
91
  var icon = disabled ? /*#__PURE__*/React.createElement("img", {
28
92
  src: "/img/topo/editor/toolbar/\u7EBF\u5F62/Disable.svg",
29
93
  alt: ""
@@ -34,11 +98,15 @@ function EdgeTypeButton(props) {
34
98
  return /*#__PURE__*/React.createElement(WidgetBox, {
35
99
  label: "\u7EBF\u5F62",
36
100
  tooltip: "\u7EBF\u5F62",
101
+ disabled: disabled,
37
102
  showLabel: showLabel
38
103
  }, /*#__PURE__*/React.createElement(DropdownButton, {
39
104
  disabled: disabled,
40
105
  trigger: icon
41
- }, /*#__PURE__*/React.createElement(EdgeType, null)));
106
+ }, !disabled && /*#__PURE__*/React.createElement(EdgeType, {
107
+ selection: selection,
108
+ onChange: handleChange
109
+ })));
42
110
  }
43
111
 
44
112
  export default EdgeTypeButton;
@@ -1,15 +1,41 @@
1
+ /* eslint-disable jsx-a11y/alt-text */
1
2
  import React, { useState } from 'react';
2
3
  import DropdownButton from "./components/DropdownButton";
3
4
  import WidgetBox from "./WidgetBox";
5
+ import ColorPanel from "../../../../../components/ColorPanel";
6
+ import FontColorRange from "../../../../../components/ColorPanel/components/FontColorRange";
7
+ import styles from "./FontColorButton.module.scss";
8
+ import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
4
9
 
5
- function FontFamilySelect(props) {
6
- var value = props.value,
7
- onChange = props.onChange;
10
+ function FontColorDropdown(props) {
11
+ var onChange = props.onChange,
12
+ topo = props.topo,
13
+ color = props.color,
14
+ background = props.background,
15
+ opacity = props.opacity;
8
16
 
9
17
  var _useState = useState(false),
10
18
  disabled = _useState[0],
11
19
  setDisabled = _useState[1];
12
20
 
21
+ var backOpacityChange = function backOpacityChange(value) {
22
+ onChange({
23
+ opacity: value / 100
24
+ });
25
+ };
26
+
27
+ var colorChang = function colorChang(value) {
28
+ onChange({
29
+ color: value
30
+ });
31
+ };
32
+
33
+ var backgroundChang = function backgroundChang(value) {
34
+ onChange({
35
+ background: value
36
+ });
37
+ };
38
+
13
39
  var icon = disabled ? /*#__PURE__*/React.createElement("img", {
14
40
  src: "/img/topo/editor/toolbar/\u6587\u5B57\u989C\u8272\u53CA\u586B\u5145/Disable.svg",
15
41
  alt: ""
@@ -19,26 +45,54 @@ function FontFamilySelect(props) {
19
45
  });
20
46
  return /*#__PURE__*/React.createElement(DropdownButton, {
21
47
  disabled: disabled,
22
- trigger: icon,
23
- onChange: onChange
24
- }, "xxxx");
48
+ trigger: icon
49
+ }, /*#__PURE__*/React.createElement("div", {
50
+ className: styles.content
51
+ }, /*#__PURE__*/React.createElement("div", {
52
+ className: styles.fontColor
53
+ }, /*#__PURE__*/React.createElement("span", null, "\u5B57\u4F53\u989C\u8272"), /*#__PURE__*/React.createElement(ColorPanel, {
54
+ onChange: colorChang
55
+ })), /*#__PURE__*/React.createElement("div", {
56
+ className: styles.backgroundColor
57
+ }, /*#__PURE__*/React.createElement("span", null, "\u80CC\u666F\u586B\u5145"), /*#__PURE__*/React.createElement("div", {
58
+ className: styles.backOpacity
59
+ }, /*#__PURE__*/React.createElement("img", {
60
+ src: "/img/topo/editor/toolbar/\u6587\u5B57\u989C\u8272\u53CA\u586B\u5145/\u80CC\u666F\u586B\u5145.svg"
61
+ }), /*#__PURE__*/React.createElement(FontColorRange, {
62
+ max: 100,
63
+ min: 0,
64
+ unit: "%",
65
+ list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
66
+ onChange: backOpacityChange,
67
+ defaultValue: opacity
68
+ })), /*#__PURE__*/React.createElement(ColorPanel, {
69
+ showClear: true,
70
+ onChange: backgroundChang
71
+ }))));
25
72
  }
26
73
 
27
74
  function FontColorButton(props) {
28
- var showLabel = props.showLabel;
29
-
30
- var _useState2 = useState('微软雅黑'),
31
- value = _useState2[0],
32
- setValue = _useState2[1];
33
-
75
+ var showLabel = props.showLabel,
76
+ topo = props.topo,
77
+ style = props.style,
78
+ setStyle = props.setStyle;
34
79
  return /*#__PURE__*/React.createElement(WidgetBox, {
35
80
  label: "\u6587\u5B57\u989C\u8272",
36
81
  tooltip: "\u6587\u5B57\u989C\u8272",
37
82
  showLabel: showLabel
38
- }, /*#__PURE__*/React.createElement(FontFamilySelect, {
39
- value: value,
40
- onChange: setValue
83
+ }, /*#__PURE__*/React.createElement(FontColorDropdown, {
84
+ color: style.color,
85
+ background: style.background,
86
+ opacity: style.opacity,
87
+ onChange: function onChange(val) {
88
+ topo.historyManager.beginTransaction();
89
+ setStyle(val);
90
+ topo.historyManager.endTransaction();
91
+ },
92
+ topo: topo
41
93
  }));
42
94
  }
43
95
 
44
- export default FontColorButton;
96
+ export default textStyleSettingRouter(FontColorButton, {
97
+ names: ['color', 'background', 'opacity']
98
+ });
@@ -0,0 +1,43 @@
1
+ .content {
2
+ height: 296px;
3
+ .fontColor{
4
+ width: 100%;
5
+ height: 143px;//159px
6
+ .colorPanelBox{
7
+ padding: 9px;
8
+ padding-top: 8px;
9
+ }
10
+ &>span{
11
+ font-size: 12px;
12
+ color: black;
13
+ font-family: PingFangSC-Regular, PingFang SC;
14
+ font-weight: 400;
15
+ color: #4D6277;
16
+ line-height: 17px;
17
+ }
18
+ }
19
+ .backgroundColor{
20
+ width: 100%;
21
+ height: 159px;
22
+ .colorPanelBox{
23
+ padding: 9px;
24
+ padding-top: 0px;
25
+ }
26
+ &>span{
27
+ font-size: 12px;
28
+ color: black;
29
+ font-family: PingFangSC-Regular, PingFang SC;
30
+ font-weight: 400;
31
+ color: #4D6277;
32
+ line-height: 17px;
33
+ }
34
+ .backOpacity{
35
+ margin-top: 2px;
36
+ margin-bottom: 5px;
37
+ margin-left: 11px;
38
+ line-height: 8px;
39
+ display: flex;
40
+ flex-direction: row;
41
+ }
42
+ }
43
+ }
@@ -1,5 +1,6 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import DropdownMenu from "./components/DropdownMenu";
3
+ import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
3
4
  import WidgetBox from "./WidgetBox";
4
5
 
5
6
  function FontFamilySelect(props) {
@@ -7,7 +8,14 @@ function FontFamilySelect(props) {
7
8
  onChange = props.onChange;
8
9
  var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
9
10
  return /*#__PURE__*/React.createElement(DropdownMenu, {
10
- value: value,
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
+ },
11
19
  onChange: onChange
12
20
  }, items.map(function (item) {
13
21
  return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
@@ -21,20 +29,26 @@ function FontFamilySelect(props) {
21
29
  }
22
30
 
23
31
  function FontFamilyWidget(props) {
24
- var showLabel = props.showLabel;
25
-
26
- var _useState = useState('微软雅黑'),
27
- value = _useState[0],
28
- setValue = _useState[1];
29
-
32
+ var topo = props.topo,
33
+ showLabel = props.showLabel,
34
+ style = props.style,
35
+ setStyle = props.setStyle;
30
36
  return /*#__PURE__*/React.createElement(WidgetBox, {
31
37
  label: "\u5B57\u4F53",
32
38
  tooltip: "\u5B57\u4F53",
33
39
  showLabel: showLabel
34
40
  }, /*#__PURE__*/React.createElement(FontFamilySelect, {
35
- value: value,
36
- onChange: setValue
41
+ value: style.fontFamily,
42
+ onChange: function onChange(val) {
43
+ topo.historyManager.beginTransaction();
44
+ setStyle({
45
+ fontFamily: val
46
+ });
47
+ topo.historyManager.endTransaction();
48
+ }
37
49
  }));
38
50
  }
39
51
 
40
- export default FontFamilyWidget;
52
+ export default textStyleSettingRouter(FontFamilyWidget, {
53
+ names: ['fontFamily']
54
+ });
@@ -1,14 +1,24 @@
1
- import React, { useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import DropdownMenu from "./components/DropdownMenu";
3
+ import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
3
4
  import WidgetBox from "./WidgetBox";
4
5
 
5
6
  function FontSizeSelect(props) {
6
7
  var value = props.value,
7
- onChange = props.onChange;
8
+ _onChange = props.onChange;
8
9
  var items = [9, 10, 11, 12, 14, 16, 18, 20, 24, 30, 36];
9
10
  return /*#__PURE__*/React.createElement(DropdownMenu, {
10
- value: value,
11
- onChange: onChange
11
+ value: "" + (value || ''),
12
+ valueRender: function valueRender(val) {
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ style: {
15
+ width: 18
16
+ }
17
+ }, val || 12);
18
+ },
19
+ onChange: function onChange(val) {
20
+ return _onChange(parseInt(val, 10));
21
+ }
12
22
  }, items.map(function (item) {
13
23
  return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
14
24
  key: item
@@ -17,19 +27,25 @@ function FontSizeSelect(props) {
17
27
  }
18
28
 
19
29
  function FontSizeWidget(props) {
20
- var showLabel = props.showLabel;
21
-
22
- var _useState = useState(12),
23
- fontSize = _useState[0],
24
- setFontSize = _useState[1];
25
-
30
+ var topo = props.topo,
31
+ showLabel = props.showLabel,
32
+ style = props.style,
33
+ setStyle = props.setStyle;
26
34
  return /*#__PURE__*/React.createElement(WidgetBox, {
27
35
  label: "\u5B57\u53F7",
28
36
  showLabel: showLabel
29
37
  }, /*#__PURE__*/React.createElement(FontSizeSelect, {
30
- value: fontSize,
31
- onChange: setFontSize
38
+ value: style.fontSize,
39
+ onChange: function onChange(val) {
40
+ topo.historyManager.beginTransaction();
41
+ setStyle({
42
+ fontSize: val
43
+ });
44
+ topo.historyManager.endTransaction();
45
+ }
32
46
  }));
33
47
  }
34
48
 
35
- export default FontSizeWidget;
49
+ export default textStyleSettingRouter(FontSizeWidget, {
50
+ names: ['fontSize']
51
+ });
@@ -1,62 +1,123 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React, { useState, useEffect } from 'react';
3
+ import { isText } from "../../../../../utils/htElementUtils";
2
4
  import DropdownMenu from "./components/DropdownMenu";
5
+ import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
3
6
  import WidgetBox from "./WidgetBox";
7
+ var items = [{
8
+ key: 'bold',
9
+ label: '加粗',
10
+ icon: 'bold'
11
+ }, {
12
+ key: 'italic',
13
+ label: '斜体',
14
+ icon: 'Italics'
15
+ }, {
16
+ key: 'underline',
17
+ label: '下划线',
18
+ icon: 'Underline'
19
+ }];
4
20
 
5
- function FontFamilySelect(props) {
6
- var value = props.value,
7
- disabled = props.disabled,
8
- onChange = props.onChange;
9
- var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
10
- var icon = disabled ? /*#__PURE__*/React.createElement("img", {
11
- src: "/img/topo/editor/toolbar/bold/Disable.svg",
12
- alt: ""
13
- }) : /*#__PURE__*/React.createElement("img", {
14
- src: "/img/topo/editor/toolbar/bold/Normal.svg",
15
- alt: ""
21
+ function buildValue(obj) {
22
+ return Object.keys(obj).filter(function (key) {
23
+ return !!obj[key];
16
24
  });
17
- return /*#__PURE__*/React.createElement(DropdownMenu, {
18
- value: value,
19
- valueRender: function valueRender() {
20
- return icon;
21
- },
22
- onChange: onChange
23
- }, items.map(function (item) {
24
- return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
25
- key: item
26
- }, /*#__PURE__*/React.createElement("div", {
27
- style: {
28
- fontFamily: item
29
- }
30
- }, item));
31
- }));
25
+ }
26
+
27
+ function formatStyle(arr) {
28
+ return items.map(function (item) {
29
+ return item.key;
30
+ }).reduce(function (map, name) {
31
+ var _extends2;
32
+
33
+ return _extends({}, map, (_extends2 = {}, _extends2[name] = arr.includes(name), _extends2));
34
+ }, {});
32
35
  }
33
36
 
34
37
  function FontStyleButton(props) {
35
38
  var topo = props.topo,
36
- showLabel = props.showLabel;
39
+ showLabel = props.showLabel,
40
+ style = props.style,
41
+ setStyle = props.setStyle;
42
+
43
+ var _useState = useState(true),
44
+ disabled = _useState[0],
45
+ setDisabled = _useState[1];
37
46
 
38
- var _useState = useState('微软雅黑'),
39
- value = _useState[0],
40
- setValue = _useState[1];
47
+ var bold = style.bold,
48
+ italic = style.italic,
49
+ underline = style.underline;
41
50
 
42
- var _useState2 = useState(true),
43
- disabled = _useState2[0],
44
- setDisabled = _useState2[1]; // 选中的元素
51
+ var _useState2 = useState(buildValue({
52
+ bold: bold,
53
+ italic: italic,
54
+ underline: underline
55
+ })),
56
+ value = _useState2[0],
57
+ setValue = _useState2[1]; // 选中的元素
45
58
 
46
59
 
47
- var selection = topo.selectionManager.useSelection();
60
+ var selection = topo.selectionManager.useHtSelection();
48
61
  useEffect(function () {
49
- setDisabled(false);
62
+ var isAllText = !selection.filter(function (ele) {
63
+ return !isText(ele);
64
+ }).length;
65
+
66
+ if (selection.length && isAllText) {
67
+ setDisabled(false);
68
+ } else {
69
+ setDisabled(true);
70
+ }
50
71
  }, [selection]);
72
+ useEffect(function () {
73
+ setValue(buildValue({
74
+ bold: bold,
75
+ italic: italic,
76
+ underline: underline
77
+ }));
78
+ }, [bold, italic, underline]);
79
+ /**
80
+ *
81
+ * @param {Array} selectedKeys
82
+ */
83
+
84
+ var handleChange = function handleChange(selectedKeys) {
85
+ topo.historyManager.beginTransaction();
86
+ setStyle(formatStyle(selectedKeys));
87
+ topo.historyManager.endTransaction();
88
+ };
89
+
51
90
  return /*#__PURE__*/React.createElement(WidgetBox, {
52
91
  label: "\u6587\u5B57\u6837\u5F0F",
53
92
  tooltip: "\u6587\u5B57\u6837\u5F0F",
93
+ disabled: disabled,
54
94
  showLabel: showLabel
55
- }, /*#__PURE__*/React.createElement(FontFamilySelect, {
95
+ }, /*#__PURE__*/React.createElement(DropdownMenu, {
56
96
  value: value,
97
+ valueRender: function valueRender() {
98
+ return /*#__PURE__*/React.createElement("img", {
99
+ src: "/img/topo/editor/toolbar/bold/" + (disabled ? 'Disable' : 'Normal') + ".svg",
100
+ alt: ""
101
+ });
102
+ },
103
+ multiple: true,
57
104
  disabled: disabled,
58
- onChange: setValue
59
- }));
105
+ onChange: handleChange
106
+ }, items.map(function (item) {
107
+ return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
108
+ key: item.key
109
+ }, /*#__PURE__*/React.createElement("div", {
110
+ style: {
111
+ display: 'flex',
112
+ alignItems: 'center'
113
+ }
114
+ }, /*#__PURE__*/React.createElement("img", {
115
+ src: "/img/topo/editor/toolbar/" + item.icon + "/Normal.svg",
116
+ alt: ""
117
+ }), /*#__PURE__*/React.createElement("span", null, item.label)));
118
+ })));
60
119
  }
61
120
 
62
- export default FontStyleButton;
121
+ export default textStyleSettingRouter(FontStyleButton, {
122
+ names: ['bold', 'italic', 'underline']
123
+ });
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import WidgetBox from "./WidgetBox";
3
+ import ButtonBox from "./components/ButtonBox";
3
4
 
4
5
  function HistoryRedoButton(props) {
5
6
  var topo = props.topo,
@@ -13,8 +14,8 @@ function HistoryRedoButton(props) {
13
14
  label: "\u6062\u590D",
14
15
  tooltip: "\u6062\u590D",
15
16
  showLabel: showLabel
16
- }, /*#__PURE__*/React.createElement(WidgetBox.ButtonBox, null, /*#__PURE__*/React.createElement("img", {
17
- src: "/img/topo/editor/toolbar/redo/" + (disabled ? 'Disable' : 'Normal') + ".svg",
17
+ }, /*#__PURE__*/React.createElement(ButtonBox, null, /*#__PURE__*/React.createElement("img", {
18
+ src: "/img/topo/editor/toolbar/undo/" + (disabled ? 'Disable' : 'Normal') + ".svg",
18
19
  alt: ""
19
20
  })));
20
21
  }