@tmagic/editor 1.7.7 → 1.7.8-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/LICENSE +235 -164
  2. package/dist/es/Editor.js +5 -0
  3. package/dist/es/Editor.vue_vue_type_script_setup_true_lang.js +214 -0
  4. package/dist/es/_virtual/_plugin-vue_export-helper.js +8 -0
  5. package/dist/es/components/CodeBlockEditor.js +5 -0
  6. package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +337 -0
  7. package/dist/es/components/CodeParams.js +5 -0
  8. package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +63 -0
  9. package/dist/es/components/ContentMenu.js +5 -0
  10. package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +160 -0
  11. package/dist/es/components/FloatingBox.js +5 -0
  12. package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +161 -0
  13. package/dist/es/components/Icon.js +5 -0
  14. package/dist/es/components/Icon.vue_vue_type_script_setup_true_lang.js +39 -0
  15. package/dist/es/components/Resizer.js +5 -0
  16. package/dist/es/components/Resizer.vue_vue_type_script_setup_true_lang.js +20 -0
  17. package/dist/es/components/ScrollBar.js +6 -0
  18. package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +72 -0
  19. package/dist/es/components/ScrollViewer.js +5 -0
  20. package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +104 -0
  21. package/dist/es/components/SearchInput.js +5 -0
  22. package/dist/es/components/SearchInput.vue_vue_type_script_setup_true_lang.js +40 -0
  23. package/dist/es/components/SplitView.js +5 -0
  24. package/dist/es/components/SplitView.vue_vue_type_script_setup_true_lang.js +135 -0
  25. package/dist/es/components/ToolButton.js +5 -0
  26. package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +131 -0
  27. package/dist/es/components/Tree.js +5 -0
  28. package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +60 -0
  29. package/dist/es/components/TreeNode.js +5 -0
  30. package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +126 -0
  31. package/dist/es/editorProps.js +34 -0
  32. package/dist/es/fields/Code.js +5 -0
  33. package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +54 -0
  34. package/dist/es/fields/CodeLink.js +5 -0
  35. package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +69 -0
  36. package/dist/es/fields/CodeSelect.js +5 -0
  37. package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +116 -0
  38. package/dist/es/fields/CodeSelectCol.js +5 -0
  39. package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +145 -0
  40. package/dist/es/fields/CondOpSelect.js +5 -0
  41. package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +81 -0
  42. package/dist/es/fields/DataSourceFieldSelect/FieldSelect.js +5 -0
  43. package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +158 -0
  44. package/dist/es/fields/DataSourceFieldSelect/Index.js +5 -0
  45. package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +155 -0
  46. package/dist/es/fields/DataSourceFields.js +5 -0
  47. package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +390 -0
  48. package/dist/es/fields/DataSourceInput.js +5 -0
  49. package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +268 -0
  50. package/dist/es/fields/DataSourceMethodSelect.js +5 -0
  51. package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +144 -0
  52. package/dist/es/fields/DataSourceMethods.js +5 -0
  53. package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +148 -0
  54. package/dist/es/fields/DataSourceMocks.js +5 -0
  55. package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +259 -0
  56. package/dist/es/fields/DataSourceSelect.js +5 -0
  57. package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +101 -0
  58. package/dist/es/fields/DisplayConds.js +5 -0
  59. package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +156 -0
  60. package/dist/es/fields/EventSelect.js +5 -0
  61. package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +338 -0
  62. package/dist/es/fields/KeyValue.js +5 -0
  63. package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +158 -0
  64. package/dist/es/fields/PageFragmentSelect.js +5 -0
  65. package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +81 -0
  66. package/dist/es/fields/StyleSetter/Index.js +5 -0
  67. package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +92 -0
  68. package/dist/es/fields/StyleSetter/components/BackgroundPosition.js +5 -0
  69. package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +96 -0
  70. package/dist/es/fields/StyleSetter/components/Border.js +5 -0
  71. package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +100 -0
  72. package/dist/es/fields/StyleSetter/components/Box.js +5 -0
  73. package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +81 -0
  74. package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +17 -0
  75. package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +14 -0
  76. package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +17 -0
  77. package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +17 -0
  78. package/dist/es/fields/StyleSetter/icons/display/Block.js +14 -0
  79. package/dist/es/fields/StyleSetter/icons/display/Flex.js +14 -0
  80. package/dist/es/fields/StyleSetter/icons/display/Inline.js +14 -0
  81. package/dist/es/fields/StyleSetter/icons/display/InlineBlock.js +14 -0
  82. package/dist/es/fields/StyleSetter/icons/display/None.js +14 -0
  83. package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +14 -0
  84. package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +14 -0
  85. package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +14 -0
  86. package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +14 -0
  87. package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +14 -0
  88. package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +14 -0
  89. package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +14 -0
  90. package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +14 -0
  91. package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +14 -0
  92. package/dist/es/fields/StyleSetter/icons/text-align/Center.js +14 -0
  93. package/dist/es/fields/StyleSetter/icons/text-align/Left.js +14 -0
  94. package/dist/es/fields/StyleSetter/icons/text-align/Right.js +14 -0
  95. package/dist/es/fields/StyleSetter/pro/Background.js +5 -0
  96. package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +114 -0
  97. package/dist/es/fields/StyleSetter/pro/Border.js +5 -0
  98. package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +50 -0
  99. package/dist/es/fields/StyleSetter/pro/Font.js +5 -0
  100. package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +98 -0
  101. package/dist/es/fields/StyleSetter/pro/Layout.js +5 -0
  102. package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +288 -0
  103. package/dist/es/fields/StyleSetter/pro/Position.js +5 -0
  104. package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +95 -0
  105. package/dist/es/fields/UISelect.js +6 -0
  106. package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +161 -0
  107. package/dist/es/hooks/use-code-block-edit.js +54 -0
  108. package/dist/es/hooks/use-data-source-edit.js +29 -0
  109. package/dist/es/hooks/use-editor-content-height.js +17 -0
  110. package/dist/es/hooks/use-filter.js +35 -0
  111. package/dist/es/hooks/use-float-box.js +76 -0
  112. package/dist/es/hooks/use-getso.js +28 -0
  113. package/dist/es/hooks/use-next-float-box-position.js +27 -0
  114. package/dist/es/hooks/use-node-status.js +28 -0
  115. package/dist/es/hooks/use-services.js +9 -0
  116. package/dist/es/hooks/use-stage.js +107 -0
  117. package/dist/es/hooks/use-window-rect.js +19 -0
  118. package/dist/es/icons/CenterIcon.js +5 -0
  119. package/dist/es/icons/CenterIcon.vue_vue_type_script_setup_true_lang.js +40 -0
  120. package/dist/es/icons/CodeIcon.js +5 -0
  121. package/dist/es/icons/CodeIcon.vue_vue_type_script_setup_true_lang.js +19 -0
  122. package/dist/es/icons/FolderMinusIcon.js +5 -0
  123. package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +27 -0
  124. package/dist/es/index.js +79 -0
  125. package/dist/es/initService.js +392 -0
  126. package/dist/es/layouts/AddPageBox.js +5 -0
  127. package/dist/es/layouts/AddPageBox.vue_vue_type_script_setup_true_lang.js +38 -0
  128. package/dist/es/layouts/CodeEditor.js +5 -0
  129. package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +270 -0
  130. package/dist/es/layouts/Framework.js +5 -0
  131. package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +134 -0
  132. package/dist/es/layouts/NavMenu.js +5 -0
  133. package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +181 -0
  134. package/dist/es/layouts/page-bar/AddButton.js +5 -0
  135. package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +57 -0
  136. package/dist/es/layouts/page-bar/PageBar.js +5 -0
  137. package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +135 -0
  138. package/dist/es/layouts/page-bar/PageBarScrollContainer.js +5 -0
  139. package/dist/es/layouts/page-bar/PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js +119 -0
  140. package/dist/es/layouts/page-bar/PageList.js +5 -0
  141. package/dist/es/layouts/page-bar/PageList.vue_vue_type_script_setup_true_lang.js +54 -0
  142. package/dist/es/layouts/page-bar/Search.js +5 -0
  143. package/dist/es/layouts/page-bar/Search.vue_vue_type_script_setup_true_lang.js +60 -0
  144. package/dist/es/layouts/props-panel/FormPanel.js +5 -0
  145. package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +129 -0
  146. package/dist/es/layouts/props-panel/PropsPanel.js +5 -0
  147. package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +179 -0
  148. package/dist/es/layouts/props-panel/use-style-panel.js +40 -0
  149. package/dist/es/layouts/sidebar/ComponentListPanel.js +5 -0
  150. package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +121 -0
  151. package/dist/es/layouts/sidebar/Sidebar.js +5 -0
  152. package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +314 -0
  153. package/dist/es/layouts/sidebar/code-block/CodeBlockList.js +5 -0
  154. package/dist/es/layouts/sidebar/code-block/CodeBlockList.vue_vue_type_script_setup_true_lang.js +161 -0
  155. package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.js +5 -0
  156. package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +113 -0
  157. package/dist/es/layouts/sidebar/code-block/useContentMenu.js +60 -0
  158. package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.js +5 -0
  159. package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.vue_vue_type_script_setup_true_lang.js +44 -0
  160. package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.js +5 -0
  161. package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +103 -0
  162. package/dist/es/layouts/sidebar/data-source/DataSourceList.js +5 -0
  163. package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js +162 -0
  164. package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.js +5 -0
  165. package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +133 -0
  166. package/dist/es/layouts/sidebar/data-source/useContentMenu.js +59 -0
  167. package/dist/es/layouts/sidebar/layer/LayerMenu.js +5 -0
  168. package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +90 -0
  169. package/dist/es/layouts/sidebar/layer/LayerNodeTool.js +5 -0
  170. package/dist/es/layouts/sidebar/layer/LayerNodeTool.vue_vue_type_script_setup_true_lang.js +35 -0
  171. package/dist/es/layouts/sidebar/layer/LayerPanel.js +5 -0
  172. package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +99 -0
  173. package/dist/es/layouts/sidebar/layer/use-click.js +68 -0
  174. package/dist/es/layouts/sidebar/layer/use-drag.js +118 -0
  175. package/dist/es/layouts/sidebar/layer/use-keybinding.js +36 -0
  176. package/dist/es/layouts/sidebar/layer/use-node-status.js +75 -0
  177. package/dist/es/layouts/workspace/Breadcrumb.js +5 -0
  178. package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +39 -0
  179. package/dist/es/layouts/workspace/Workspace.js +5 -0
  180. package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +43 -0
  181. package/dist/es/layouts/workspace/viewer/NodeListMenu.js +5 -0
  182. package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +88 -0
  183. package/dist/es/layouts/workspace/viewer/Stage.js +5 -0
  184. package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +206 -0
  185. package/dist/es/layouts/workspace/viewer/StageOverlay.js +5 -0
  186. package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +89 -0
  187. package/dist/es/layouts/workspace/viewer/ViewerMenu.js +5 -0
  188. package/dist/es/layouts/workspace/viewer/ViewerMenu.vue_vue_type_script_setup_true_lang.js +132 -0
  189. package/dist/es/plugin.js +61 -0
  190. package/dist/es/services/BaseService.js +148 -0
  191. package/dist/es/services/codeBlock.js +251 -0
  192. package/dist/es/services/componentList.js +29 -0
  193. package/dist/es/services/dataSource.js +157 -0
  194. package/dist/es/services/dep.js +173 -0
  195. package/dist/es/services/editor.js +752 -0
  196. package/dist/es/services/events.js +64 -0
  197. package/dist/es/services/history.js +84 -0
  198. package/dist/es/services/keybinding.js +182 -0
  199. package/dist/es/services/props.js +216 -0
  200. package/dist/es/services/stageOverlay.js +161 -0
  201. package/dist/es/services/storage.js +127 -0
  202. package/dist/es/services/ui.js +112 -0
  203. package/dist/es/style.css +1937 -0
  204. package/dist/es/type.js +90 -0
  205. package/dist/es/utils/compose.js +44 -0
  206. package/dist/es/utils/config.js +8 -0
  207. package/dist/es/utils/const.js +15 -0
  208. package/dist/es/utils/content-menu.js +76 -0
  209. package/dist/es/utils/data-source/formConfigs/base.js +28 -0
  210. package/dist/es/utils/data-source/formConfigs/http.js +74 -0
  211. package/dist/es/utils/data-source/index.js +202 -0
  212. package/dist/es/utils/dep/idle-task.js +76 -0
  213. package/dist/es/utils/dep/worker.js +19 -0
  214. package/dist/es/utils/editor.js +261 -0
  215. package/dist/es/utils/keybinding-config.js +106 -0
  216. package/dist/es/utils/logger.js +18 -0
  217. package/dist/es/utils/monaco-editor.js +13 -0
  218. package/dist/es/utils/operator.js +73 -0
  219. package/dist/es/utils/props.js +232 -0
  220. package/dist/es/utils/scroll-viewer.js +115 -0
  221. package/dist/es/utils/tree.js +11 -0
  222. package/dist/es/utils/undo-redo.js +43 -0
  223. package/dist/style.css +10 -10
  224. package/dist/tmagic-editor.umd.cjs +18430 -21979
  225. package/package.json +16 -12
  226. package/src/components/CodeBlockEditor.vue +2 -8
  227. package/src/fields/CodeLink.vue +2 -2
  228. package/src/fields/CodeSelectCol.vue +1 -1
  229. package/src/fields/DataSourceFieldSelect/Index.vue +16 -3
  230. package/src/fields/DataSourceFields.vue +4 -1
  231. package/src/fields/EventSelect.vue +11 -11
  232. package/src/fields/StyleSetter/components/BackgroundPosition.vue +2 -2
  233. package/src/fields/StyleSetter/pro/Layout.vue +8 -8
  234. package/src/index.ts +1 -73
  235. package/src/plugin.ts +92 -0
  236. package/src/services/props.ts +3 -1
  237. package/src/type.ts +1 -1
  238. package/src/utils/data-source/index.ts +71 -73
  239. package/src/utils/index.ts +1 -0
  240. package/src/utils/props.ts +9 -7
  241. package/types/index.d.ts +3369 -3319
  242. package/dist/tmagic-editor.js +0 -17053
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
- "version": "1.7.7",
2
+ "version": "1.7.8-beta.2",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "dist/style.css",
7
+ "dist/es/style.css",
7
8
  "src/theme/*"
8
9
  ],
9
10
  "main": "dist/tmagic-editor.umd.cjs",
10
- "module": "dist/tmagic-editor.js",
11
+ "module": "dist/es/index.js",
11
12
  "style": "dist/style.css",
12
13
  "types": "types/index.d.ts",
13
14
  "exports": {
14
15
  ".": {
15
16
  "types": "./types/index.d.ts",
16
- "import": "./dist/tmagic-editor.js",
17
+ "import": "./dist/es/index.js",
17
18
  "require": "./dist/tmagic-editor.umd.cjs"
18
19
  },
19
20
  "./dist/style.css": {
@@ -57,29 +58,32 @@
57
58
  "moveable": "^0.53.0",
58
59
  "serialize-javascript": "^7.0.0",
59
60
  "sortablejs": "^1.15.6",
60
- "@tmagic/design": "1.7.7",
61
- "@tmagic/table": "1.7.7",
62
- "@tmagic/stage": "1.7.7",
63
- "@tmagic/form": "1.7.7",
64
- "@tmagic/utils": "1.7.7"
61
+ "@tmagic/design": "1.7.8-beta.2",
62
+ "@tmagic/form": "1.7.8-beta.2",
63
+ "@tmagic/utils": "1.7.8-beta.2",
64
+ "@tmagic/stage": "1.7.8-beta.2",
65
+ "@tmagic/table": "1.7.8-beta.2"
65
66
  },
66
67
  "devDependencies": {
67
68
  "@types/events": "^3.0.3",
68
69
  "@types/lodash-es": "^4.17.4",
69
70
  "@types/serialize-javascript": "^5.0.4",
70
71
  "@types/sortablejs": "^1.15.9",
71
- "@vue/test-utils": "^2.4.6",
72
- "type-fest": "^5.2.0"
72
+ "@vue/test-utils": "^2.4.6"
73
73
  },
74
74
  "peerDependencies": {
75
- "monaco-editor": "^0.48.0",
75
+ "monaco-editor": "^0.55.1 ",
76
+ "type-fest": "^5.2.0",
76
77
  "typescript": "^5.9.3",
77
78
  "vue": "^3.5.24",
78
- "@tmagic/core": "1.7.7"
79
+ "@tmagic/core": "1.7.8-beta.2"
79
80
  },
80
81
  "peerDependenciesMeta": {
81
82
  "typescript": {
82
83
  "optional": true
84
+ },
85
+ "type-fest": {
86
+ "optional": true
83
87
  }
84
88
  }
85
89
  }
@@ -63,13 +63,7 @@ import { computed, inject, nextTick, Ref, ref, useTemplateRef, watch } from 'vue
63
63
 
64
64
  import type { CodeBlockContent } from '@tmagic/core';
65
65
  import { TMagicButton, TMagicDialog, tMagicMessage, tMagicMessageBox, TMagicTag } from '@tmagic/design';
66
- import {
67
- type ContainerChangeEventData,
68
- type FormConfig,
69
- type FormState,
70
- MFormBox,
71
- type TableColumnConfig,
72
- } from '@tmagic/form';
66
+ import { type ContainerChangeEventData, type FormConfig, type FormState, MFormBox } from '@tmagic/form';
73
67
 
74
68
  import FloatingBox from '@editor/components/FloatingBox.vue';
75
69
  import { useEditorContentHeight } from '@editor/hooks/use-editor-content-height';
@@ -118,7 +112,7 @@ const diffChange = () => {
118
112
  difVisible.value = false;
119
113
  };
120
114
 
121
- const defaultParamColConfig: TableColumnConfig = {
115
+ const defaultParamColConfig = {
122
116
  type: 'row',
123
117
  label: '参数类型',
124
118
  items: [
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <m-fields-link :config="formConfig" :model="modelValue" name="form" @change="changeHandler"></m-fields-link>
2
+ <MLink :config="formConfig" :model="modelValue" name="form" @change="changeHandler"></MLink>
3
3
  </template>
4
4
 
5
5
  <script lang="ts" setup>
6
6
  import { computed, reactive, watch } from 'vue';
7
7
  import serialize from 'serialize-javascript';
8
8
 
9
- import type { CodeLinkConfig, FieldProps } from '@tmagic/form';
9
+ import type { CodeLinkConfig, FieldProps, MLink } from '@tmagic/form';
10
10
 
11
11
  import { getEditorConfig } from '@editor/utils/config';
12
12
 
@@ -115,7 +115,7 @@ watch(
115
115
  const selectConfig: SelectConfig = {
116
116
  type: 'select',
117
117
  name: props.name,
118
- disable: props.disabled,
118
+ disabled: props.disabled,
119
119
  options: () => {
120
120
  if (codeDsl.value) {
121
121
  return map(codeDsl.value, (value, key) => ({
@@ -47,7 +47,13 @@ import { Coin } from '@element-plus/icons-vue';
47
47
 
48
48
  import { DataSchema } from '@tmagic/core';
49
49
  import { TMagicButton, tMagicMessage, TMagicTooltip } from '@tmagic/design';
50
- import type { ContainerChangeEventData, DataSourceFieldSelectConfig, FieldProps, FormState } from '@tmagic/form';
50
+ import {
51
+ type ContainerChangeEventData,
52
+ type DataSourceFieldSelectConfig,
53
+ type FieldProps,
54
+ type FormState,
55
+ getFormField,
56
+ } from '@tmagic/form';
51
57
  import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, removeDataSourceFieldPrefix } from '@tmagic/utils';
52
58
 
53
59
  import MIcon from '@editor/components/Icon.vue';
@@ -100,11 +106,18 @@ const type = computed((): string => {
100
106
  }
101
107
  if (type === 'form') return '';
102
108
  if (type === 'container') return '';
103
- return type?.replace(/([A-Z])/g, '-$1').toLowerCase() || (props.config.items ? '' : 'text');
109
+ return (
110
+ type?.replace(/([A-Z])/g, '-$1').toLowerCase() ||
111
+ (props.config.fieldConfig && 'items' in props.config.fieldConfig ? '' : 'text')
112
+ );
104
113
  });
105
114
 
106
115
  const tagName = computed(() => {
107
- const component = resolveComponent(`m-${props.config.items ? 'form' : 'fields'}-${type.value}`);
116
+ const component =
117
+ getFormField(type.value || 'container') ||
118
+ resolveComponent(
119
+ `m-${props.config.fieldConfig && 'items' in props.config.fieldConfig ? 'form' : 'fields'}-${type.value}`,
120
+ );
108
121
  if (typeof component !== 'string') return component;
109
122
  return 'm-fields-text';
110
123
  });
@@ -52,12 +52,15 @@ import { inject, Ref, ref } from 'vue';
52
52
  import type { DataSchema } from '@tmagic/core';
53
53
  import { TMagicButton, tMagicMessage, tMagicMessageBox } from '@tmagic/design';
54
54
  import {
55
+ type CodeConfig,
55
56
  type ContainerChangeEventData,
56
57
  type DataSourceFieldsConfig,
57
58
  type FieldProps,
58
59
  type FormConfig,
59
60
  type FormState,
60
61
  MFormBox,
62
+ type NumberConfig,
63
+ type TextConfig,
61
64
  } from '@tmagic/form';
62
65
  import { type ColumnConfig, MagicTable } from '@tmagic/table';
63
66
  import { getDefaultValueFromFields } from '@tmagic/utils';
@@ -247,7 +250,7 @@ const dataSourceFieldsConfig: FormConfig = [
247
250
  { text: 'true', value: true },
248
251
  { text: 'false', value: false },
249
252
  ],
250
- },
253
+ } as unknown as CodeConfig | NumberConfig | TextConfig,
251
254
  {
252
255
  name: 'enable',
253
256
  text: '是否可用',
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="m-fields-event-select">
3
- <m-form-table
3
+ <MTable
4
4
  v-if="isOldVersion"
5
5
  name="events"
6
6
  :size="size"
@@ -8,7 +8,7 @@
8
8
  :model="model"
9
9
  :config="tableConfig"
10
10
  @change="onChangeHandler"
11
- ></m-form-table>
11
+ ></MTable>
12
12
 
13
13
  <div v-else class="fullWidth">
14
14
  <TMagicButton class="create-button" type="primary" :size="size" :disabled="disabled" @click="addEvent()"
@@ -41,7 +41,7 @@
41
41
  :icon="Delete"
42
42
  :disabled="disabled"
43
43
  :size="size"
44
- @click="removeEvent(index)"
44
+ @click="removeEvent(Number(index))"
45
45
  ></TMagicButton>
46
46
  </template>
47
47
  </MPanel>
@@ -59,7 +59,6 @@ import { ActionType } from '@tmagic/core';
59
59
  import { TMagicButton } from '@tmagic/design';
60
60
  import type {
61
61
  CascaderOption,
62
- ChildConfig,
63
62
  CodeSelectColConfig,
64
63
  ContainerChangeEventData,
65
64
  DataSourceMethodSelectConfig,
@@ -68,8 +67,9 @@ import type {
68
67
  FormState,
69
68
  OnChangeHandlerData,
70
69
  PanelConfig,
70
+ TableConfig,
71
71
  } from '@tmagic/form';
72
- import { MContainer as MFormContainer, MPanel } from '@tmagic/form';
72
+ import { MContainer as MFormContainer, MPanel, MTable } from '@tmagic/form';
73
73
  import { DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, traverseNode } from '@tmagic/utils';
74
74
 
75
75
  import { useServices } from '@editor/hooks/use-services';
@@ -89,10 +89,10 @@ const { editorService, dataSourceService, eventsService, codeBlockService, props
89
89
 
90
90
  // 事件名称下拉框表单配置
91
91
  const eventNameConfig = computed(() => {
92
- const defaultEventNameConfig: ChildConfig = {
92
+ const defaultEventNameConfig = {
93
93
  name: 'name',
94
94
  text: '事件',
95
- type: (mForm, { formValue }: any) => {
95
+ type: (mForm: FormState | undefined, { formValue }: any) => {
96
96
  if (
97
97
  props.config.src !== 'component' ||
98
98
  (formValue.type === 'page-fragment-container' && formValue.pageFragmentId)
@@ -226,10 +226,10 @@ const targetCompConfig = computed(() => {
226
226
 
227
227
  // 联动组件动作配置
228
228
  const compActionConfig = computed(() => {
229
- const defaultCompActionConfig: ChildConfig = {
229
+ const defaultCompActionConfig = {
230
230
  name: 'method',
231
231
  text: '动作',
232
- type: (mForm, { model }: any) => {
232
+ type: (mForm: FormState | undefined, { model }: any) => {
233
233
  const to = editorService.getNodeById(model.to);
234
234
 
235
235
  if (to && to.type === 'page-fragment-container' && to.pageFragmentId) {
@@ -239,7 +239,7 @@ const compActionConfig = computed(() => {
239
239
  return 'select';
240
240
  },
241
241
  checkStrictly: () => props.config.src !== 'component',
242
- display: (mForm, { model }: any) => model.actionType === ActionType.COMP,
242
+ display: (mForm: FormState | undefined, { model }: any) => model.actionType === ActionType.COMP,
243
243
  options: (mForm: FormState, { model }: any) => {
244
244
  const node = editorService.getNodeById(model.to);
245
245
  if (!node?.type) return [];
@@ -304,7 +304,7 @@ const dataSourceActionConfig = computed(() => {
304
304
  });
305
305
 
306
306
  // 兼容旧的数据格式
307
- const tableConfig = computed(() => ({
307
+ const tableConfig = computed<TableConfig>(() => ({
308
308
  type: 'table',
309
309
  name: 'events',
310
310
  items: [
@@ -28,10 +28,10 @@
28
28
 
29
29
  <script lang="ts" setup>
30
30
  import { TMagicButton, TMagicInput } from '@tmagic/design';
31
- import type { FieldProps, FormItem } from '@tmagic/form';
31
+ import type { FieldProps, StyleSetterConfig } from '@tmagic/form';
32
32
 
33
33
  const emit = defineEmits(['change']);
34
- defineProps<FieldProps<{ type: 'style-setter' } & FormItem>>();
34
+ defineProps<FieldProps<StyleSetterConfig>>();
35
35
 
36
36
  const horizontalList = [
37
37
  {
@@ -12,8 +12,8 @@
12
12
  <script lang="ts" setup>
13
13
  import { markRaw } from 'vue';
14
14
 
15
- import type { ContainerChangeEventData, FormState } from '@tmagic/form';
16
- import { MContainer } from '@tmagic/form';
15
+ import type { ContainerChangeEventData } from '@tmagic/form';
16
+ import { defineFormItem, MContainer } from '@tmagic/form';
17
17
  import type { StyleSchema } from '@tmagic/schema';
18
18
 
19
19
  import Box from '../components/Box.vue';
@@ -42,7 +42,7 @@ const emit = defineEmits<{
42
42
  change: [v: string | StyleSchema, eventData: ContainerChangeEventData];
43
43
  }>();
44
44
 
45
- const config = {
45
+ const config = defineFormItem({
46
46
  items: [
47
47
  {
48
48
  name: 'display',
@@ -74,7 +74,7 @@ const config = {
74
74
  tooltip: '垂直方向 起点在下沿 column-reverse',
75
75
  },
76
76
  ],
77
- display: (mForm: FormState, { model }: { model: Record<any, any> }) => model.display === 'flex',
77
+ display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
78
78
  },
79
79
  {
80
80
  name: 'justifyContent',
@@ -89,7 +89,7 @@ const config = {
89
89
  { value: 'space-between', icon: markRaw(JustifyContentSpaceBetween), tooltip: '两端对齐 space-between' },
90
90
  { value: 'space-around', icon: markRaw(JustifyContentSpaceAround), tooltip: '横向平分 space-around' },
91
91
  ],
92
- display: (mForm: FormState, { model }: { model: Record<any, any> }) => model.display === 'flex',
92
+ display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
93
93
  },
94
94
  {
95
95
  name: 'alignItems',
@@ -104,7 +104,7 @@ const config = {
104
104
  { value: 'space-between', icon: markRaw(JustifyContentSpaceBetween), tooltip: '两端对齐 space-between' },
105
105
  { value: 'space-around', icon: markRaw(JustifyContentSpaceAround), tooltip: '横向平分 space-around' },
106
106
  ],
107
- display: (mForm: FormState, { model }: { model: Record<any, any> }) => model.display === 'flex',
107
+ display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
108
108
  },
109
109
  {
110
110
  name: 'flexWrap',
@@ -117,7 +117,7 @@ const config = {
117
117
  { value: 'wrap', text: '正换行', tooltip: '第一行在上方 wrap' },
118
118
  { value: 'wrap-reverse', text: '逆换行', tooltip: '第一行在下方 wrap-reverse' },
119
119
  ],
120
- display: (mForm: FormState, { model }: { model: Record<any, any> }) => model.display === 'flex',
120
+ display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
121
121
  },
122
122
  {
123
123
  type: 'row',
@@ -180,7 +180,7 @@ const config = {
180
180
  ],
181
181
  },
182
182
  ],
183
- };
183
+ });
184
184
 
185
185
  const change = (value: string | StyleSchema, eventData: ContainerChangeEventData) => {
186
186
  emit('change', value, eventData);
package/src/index.ts CHANGED
@@ -15,38 +15,6 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- import type { App } from 'vue';
19
-
20
- import type { DesignPluginOptions } from '@tmagic/design';
21
- import designPlugin from '@tmagic/design';
22
- import type { FormInstallOptions } from '@tmagic/form';
23
- import formPlugin from '@tmagic/form';
24
- import tablePlugin from '@tmagic/table';
25
-
26
- import Code from './fields/Code.vue';
27
- import CodeLink from './fields/CodeLink.vue';
28
- import CodeSelect from './fields/CodeSelect.vue';
29
- import CodeSelectCol from './fields/CodeSelectCol.vue';
30
- import CondOpSelect from './fields/CondOpSelect.vue';
31
- import DataSourceFields from './fields/DataSourceFields.vue';
32
- import DataSourceFieldSelect from './fields/DataSourceFieldSelect/Index.vue';
33
- import DataSourceInput from './fields/DataSourceInput.vue';
34
- import DataSourceMethods from './fields/DataSourceMethods.vue';
35
- import DataSourceMethodSelect from './fields/DataSourceMethodSelect.vue';
36
- import DataSourceMocks from './fields/DataSourceMocks.vue';
37
- import DataSourceSelect from './fields/DataSourceSelect.vue';
38
- import DisplayConds from './fields/DisplayConds.vue';
39
- import EventSelect from './fields/EventSelect.vue';
40
- import KeyValue from './fields/KeyValue.vue';
41
- import PageFragmentSelect from './fields/PageFragmentSelect.vue';
42
- import StyleSetter from './fields/StyleSetter/Index.vue';
43
- import uiSelect from './fields/UISelect.vue';
44
- import CodeEditor from './layouts/CodeEditor.vue';
45
- import { setEditorConfig } from './utils/config';
46
- import Editor from './Editor.vue';
47
- import type { EditorInstallOptions } from './type';
48
-
49
- import './theme/index.scss';
50
18
 
51
19
  export * from '@tmagic/form';
52
20
  export { default as formPlugin } from '@tmagic/form';
@@ -110,44 +78,4 @@ export { default as DisplayConds } from './fields/DisplayConds.vue';
110
78
  export { default as CondOpSelect } from './fields/CondOpSelect.vue';
111
79
  export { default as StyleSetter } from './fields/StyleSetter/Index.vue';
112
80
 
113
- const defaultInstallOpt: EditorInstallOptions = {
114
- // eslint-disable-next-line no-eval
115
- parseDSL: (dsl: string) => eval(dsl),
116
- customCreateMonacoEditor: (monaco, codeEditorEl, options) => monaco.editor.create(codeEditorEl, options),
117
- customCreateMonacoDiffEditor: (monaco, codeEditorEl, options) =>
118
- monaco.editor.createDiffEditor(codeEditorEl, options),
119
- };
120
-
121
- export default {
122
- install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>): void => {
123
- const option = Object.assign(defaultInstallOpt, opt || {});
124
-
125
- app.use(designPlugin, opt || {});
126
- app.use(formPlugin, opt || {});
127
- app.use(tablePlugin);
128
-
129
- app.config.globalProperties.$TMAGIC_EDITOR = option;
130
- setEditorConfig(option);
131
-
132
- app.component(`${Editor.name || 'MEditor'}`, Editor);
133
- app.component('magic-code-editor', CodeEditor);
134
- app.component('m-fields-ui-select', uiSelect);
135
- app.component('m-fields-code-link', CodeLink);
136
- app.component('m-fields-vs-code', Code);
137
- app.component('m-fields-code-select', CodeSelect);
138
- app.component('m-fields-code-select-col', CodeSelectCol);
139
- app.component('m-fields-event-select', EventSelect);
140
- app.component('m-fields-data-source-fields', DataSourceFields);
141
- app.component('m-fields-data-source-mocks', DataSourceMocks);
142
- app.component('m-fields-key-value', KeyValue);
143
- app.component('m-fields-data-source-input', DataSourceInput);
144
- app.component('m-fields-data-source-select', DataSourceSelect);
145
- app.component('m-fields-data-source-methods', DataSourceMethods);
146
- app.component('m-fields-data-source-method-select', DataSourceMethodSelect);
147
- app.component('m-fields-data-source-field-select', DataSourceFieldSelect);
148
- app.component('m-fields-page-fragment-select', PageFragmentSelect);
149
- app.component('m-fields-display-conds', DisplayConds);
150
- app.component('m-fields-cond-op-select', CondOpSelect);
151
- app.component('m-form-style-setter', StyleSetter);
152
- },
153
- };
81
+ export { default } from './plugin';
package/src/plugin.ts ADDED
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Tencent is pleased to support the open source community by making TMagicEditor available.
3
+ *
4
+ * Copyright (C) 2025 Tencent. All rights reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import type { App } from 'vue';
20
+
21
+ import type { DesignPluginOptions } from '@tmagic/design';
22
+ import designPlugin from '@tmagic/design';
23
+ import type { FormInstallOptions } from '@tmagic/form';
24
+ import formPlugin from '@tmagic/form';
25
+ import tablePlugin from '@tmagic/table';
26
+
27
+ import Code from './fields/Code.vue';
28
+ import CodeLink from './fields/CodeLink.vue';
29
+ import CodeSelect from './fields/CodeSelect.vue';
30
+ import CodeSelectCol from './fields/CodeSelectCol.vue';
31
+ import CondOpSelect from './fields/CondOpSelect.vue';
32
+ import DataSourceFields from './fields/DataSourceFields.vue';
33
+ import DataSourceFieldSelect from './fields/DataSourceFieldSelect/Index.vue';
34
+ import DataSourceInput from './fields/DataSourceInput.vue';
35
+ import DataSourceMethods from './fields/DataSourceMethods.vue';
36
+ import DataSourceMethodSelect from './fields/DataSourceMethodSelect.vue';
37
+ import DataSourceMocks from './fields/DataSourceMocks.vue';
38
+ import DataSourceSelect from './fields/DataSourceSelect.vue';
39
+ import DisplayConds from './fields/DisplayConds.vue';
40
+ import EventSelect from './fields/EventSelect.vue';
41
+ import KeyValue from './fields/KeyValue.vue';
42
+ import PageFragmentSelect from './fields/PageFragmentSelect.vue';
43
+ import StyleSetter from './fields/StyleSetter/Index.vue';
44
+ import uiSelect from './fields/UISelect.vue';
45
+ import CodeEditor from './layouts/CodeEditor.vue';
46
+ import { setEditorConfig } from './utils/config';
47
+ import Editor from './Editor.vue';
48
+ import type { EditorInstallOptions } from './type';
49
+
50
+ import './theme/index.scss';
51
+
52
+ const defaultInstallOpt: EditorInstallOptions = {
53
+ // eslint-disable-next-line no-eval
54
+ parseDSL: (dsl: string) => eval(dsl),
55
+ customCreateMonacoEditor: (monaco, codeEditorEl, options) => monaco.editor.create(codeEditorEl, options),
56
+ customCreateMonacoDiffEditor: (monaco, codeEditorEl, options) =>
57
+ monaco.editor.createDiffEditor(codeEditorEl, options),
58
+ };
59
+
60
+ export default {
61
+ install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>): void => {
62
+ const option = Object.assign(defaultInstallOpt, opt || {});
63
+
64
+ app.use(designPlugin, opt || {});
65
+ app.use(formPlugin, opt || {});
66
+ app.use(tablePlugin);
67
+
68
+ app.config.globalProperties.$TMAGIC_EDITOR = option;
69
+ setEditorConfig(option);
70
+
71
+ app.component(`${Editor.name || 'MEditor'}`, Editor);
72
+ app.component('magic-code-editor', CodeEditor);
73
+ app.component('m-fields-ui-select', uiSelect);
74
+ app.component('m-fields-code-link', CodeLink);
75
+ app.component('m-fields-vs-code', Code);
76
+ app.component('m-fields-code-select', CodeSelect);
77
+ app.component('m-fields-code-select-col', CodeSelectCol);
78
+ app.component('m-fields-event-select', EventSelect);
79
+ app.component('m-fields-data-source-fields', DataSourceFields);
80
+ app.component('m-fields-data-source-mocks', DataSourceMocks);
81
+ app.component('m-fields-key-value', KeyValue);
82
+ app.component('m-fields-data-source-input', DataSourceInput);
83
+ app.component('m-fields-data-source-select', DataSourceSelect);
84
+ app.component('m-fields-data-source-methods', DataSourceMethods);
85
+ app.component('m-fields-data-source-method-select', DataSourceMethodSelect);
86
+ app.component('m-fields-data-source-field-select', DataSourceFieldSelect);
87
+ app.component('m-fields-page-fragment-select', PageFragmentSelect);
88
+ app.component('m-fields-display-conds', DisplayConds);
89
+ app.component('m-fields-cond-op-select', CondOpSelect);
90
+ app.component('m-form-style-setter', StyleSetter);
91
+ },
92
+ };
@@ -102,9 +102,11 @@ class Props extends BaseService {
102
102
  }
103
103
 
104
104
  public async setPropsConfig(type: string, config: FormConfig | PropsFormConfigFunction) {
105
- let c = config;
105
+ let c: FormConfig;
106
106
  if (typeof config === 'function') {
107
107
  c = config({ editorService });
108
+ } else {
109
+ c = config;
108
110
  }
109
111
 
110
112
  this.state.propsConfigMap[toLine(type)] = await this.fillConfig(Array.isArray(c) ? c : [c]);
package/src/type.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  import type { Component } from 'vue';
20
20
  import type EventEmitter from 'events';
21
21
  import type * as Monaco from 'monaco-editor';
22
- import Sortable, { type Options, type SortableEvent } from 'sortablejs';
22
+ import type { default as Sortable, Options, SortableEvent } from 'sortablejs';
23
23
  import type { PascalCasedProperties } from 'type-fest';
24
24
 
25
25
  import type { CodeBlockContent, CodeBlockDSL, Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/core';