@tmagic/editor 1.7.6 → 1.7.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +235 -164
- package/dist/es/Editor.js +5 -0
- package/dist/es/Editor.vue_vue_type_script_setup_true_lang.js +214 -0
- package/dist/es/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/es/components/CodeBlockEditor.js +5 -0
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/es/components/CodeParams.js +5 -0
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/es/components/ContentMenu.js +5 -0
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/es/components/FloatingBox.js +5 -0
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/es/components/Icon.js +5 -0
- package/dist/es/components/Icon.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/es/components/Resizer.js +5 -0
- package/dist/es/components/Resizer.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/es/components/ScrollBar.js +6 -0
- package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/es/components/ScrollViewer.js +5 -0
- package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/es/components/SearchInput.js +5 -0
- package/dist/es/components/SearchInput.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/es/components/SplitView.js +5 -0
- package/dist/es/components/SplitView.vue_vue_type_script_setup_true_lang.js +135 -0
- package/dist/es/components/ToolButton.js +5 -0
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/es/components/Tree.js +5 -0
- package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/es/components/TreeNode.js +5 -0
- package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/es/editorProps.js +34 -0
- package/dist/es/fields/Code.js +5 -0
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/es/fields/CodeLink.js +5 -0
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/es/fields/CodeSelect.js +5 -0
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/es/fields/CodeSelectCol.js +5 -0
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +145 -0
- package/dist/es/fields/CondOpSelect.js +5 -0
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.js +5 -0
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +158 -0
- package/dist/es/fields/DataSourceFieldSelect/Index.js +5 -0
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +155 -0
- package/dist/es/fields/DataSourceFields.js +5 -0
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +390 -0
- package/dist/es/fields/DataSourceInput.js +5 -0
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +268 -0
- package/dist/es/fields/DataSourceMethodSelect.js +5 -0
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +144 -0
- package/dist/es/fields/DataSourceMethods.js +5 -0
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +148 -0
- package/dist/es/fields/DataSourceMocks.js +5 -0
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +259 -0
- package/dist/es/fields/DataSourceSelect.js +5 -0
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +101 -0
- package/dist/es/fields/DisplayConds.js +5 -0
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +156 -0
- package/dist/es/fields/EventSelect.js +5 -0
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +338 -0
- package/dist/es/fields/KeyValue.js +5 -0
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +158 -0
- package/dist/es/fields/PageFragmentSelect.js +5 -0
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/es/fields/StyleSetter/Index.js +5 -0
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.js +5 -0
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/es/fields/StyleSetter/components/Border.js +5 -0
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/es/fields/StyleSetter/components/Box.js +5 -0
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +17 -0
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +14 -0
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +17 -0
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +17 -0
- package/dist/es/fields/StyleSetter/icons/display/Block.js +14 -0
- package/dist/es/fields/StyleSetter/icons/display/Flex.js +14 -0
- package/dist/es/fields/StyleSetter/icons/display/Inline.js +14 -0
- package/dist/es/fields/StyleSetter/icons/display/InlineBlock.js +14 -0
- package/dist/es/fields/StyleSetter/icons/display/None.js +14 -0
- package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +14 -0
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +14 -0
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +14 -0
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +14 -0
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +14 -0
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +14 -0
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +14 -0
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +14 -0
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +14 -0
- package/dist/es/fields/StyleSetter/icons/text-align/Center.js +14 -0
- package/dist/es/fields/StyleSetter/icons/text-align/Left.js +14 -0
- package/dist/es/fields/StyleSetter/icons/text-align/Right.js +14 -0
- package/dist/es/fields/StyleSetter/pro/Background.js +5 -0
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/es/fields/StyleSetter/pro/Border.js +5 -0
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/es/fields/StyleSetter/pro/Font.js +5 -0
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/es/fields/StyleSetter/pro/Layout.js +5 -0
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +287 -0
- package/dist/es/fields/StyleSetter/pro/Position.js +5 -0
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +95 -0
- package/dist/es/fields/UISelect.js +6 -0
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/es/hooks/use-code-block-edit.js +54 -0
- package/dist/es/hooks/use-data-source-edit.js +29 -0
- package/dist/es/hooks/use-editor-content-height.js +17 -0
- package/dist/es/hooks/use-filter.js +35 -0
- package/dist/es/hooks/use-float-box.js +76 -0
- package/dist/es/hooks/use-getso.js +28 -0
- package/dist/es/hooks/use-next-float-box-position.js +27 -0
- package/dist/es/hooks/use-node-status.js +28 -0
- package/dist/es/hooks/use-services.js +9 -0
- package/dist/es/hooks/use-stage.js +107 -0
- package/dist/es/hooks/use-window-rect.js +19 -0
- package/dist/es/icons/CenterIcon.js +5 -0
- package/dist/es/icons/CenterIcon.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/es/icons/CodeIcon.js +5 -0
- package/dist/es/icons/CodeIcon.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/es/icons/FolderMinusIcon.js +5 -0
- package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +27 -0
- package/dist/es/index.js +79 -0
- package/dist/es/initService.js +392 -0
- package/dist/es/layouts/AddPageBox.js +5 -0
- package/dist/es/layouts/AddPageBox.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/es/layouts/CodeEditor.js +5 -0
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +270 -0
- package/dist/es/layouts/Framework.js +5 -0
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +134 -0
- package/dist/es/layouts/NavMenu.js +5 -0
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +181 -0
- package/dist/es/layouts/page-bar/AddButton.js +5 -0
- package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/es/layouts/page-bar/PageBar.js +5 -0
- package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +135 -0
- package/dist/es/layouts/page-bar/PageBarScrollContainer.js +5 -0
- package/dist/es/layouts/page-bar/PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/es/layouts/page-bar/PageList.js +5 -0
- package/dist/es/layouts/page-bar/PageList.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/es/layouts/page-bar/Search.js +5 -0
- package/dist/es/layouts/page-bar/Search.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/es/layouts/props-panel/FormPanel.js +5 -0
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/es/layouts/props-panel/PropsPanel.js +5 -0
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +179 -0
- package/dist/es/layouts/props-panel/use-style-panel.js +40 -0
- package/dist/es/layouts/sidebar/ComponentListPanel.js +5 -0
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/es/layouts/sidebar/Sidebar.js +5 -0
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +314 -0
- package/dist/es/layouts/sidebar/code-block/CodeBlockList.js +5 -0
- package/dist/es/layouts/sidebar/code-block/CodeBlockList.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.js +5 -0
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +113 -0
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +60 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.js +5 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.js +5 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceList.js +5 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js +162 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.js +5 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +133 -0
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +59 -0
- package/dist/es/layouts/sidebar/layer/LayerMenu.js +5 -0
- package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +90 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeTool.js +5 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeTool.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/es/layouts/sidebar/layer/LayerPanel.js +5 -0
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/es/layouts/sidebar/layer/use-click.js +68 -0
- package/dist/es/layouts/sidebar/layer/use-drag.js +118 -0
- package/dist/es/layouts/sidebar/layer/use-keybinding.js +36 -0
- package/dist/es/layouts/sidebar/layer/use-node-status.js +75 -0
- package/dist/es/layouts/workspace/Breadcrumb.js +5 -0
- package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/es/layouts/workspace/Workspace.js +5 -0
- package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/es/layouts/workspace/viewer/NodeListMenu.js +5 -0
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/es/layouts/workspace/viewer/Stage.js +5 -0
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +206 -0
- package/dist/es/layouts/workspace/viewer/StageOverlay.js +5 -0
- package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +89 -0
- package/dist/es/layouts/workspace/viewer/ViewerMenu.js +5 -0
- package/dist/es/layouts/workspace/viewer/ViewerMenu.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/es/plugin.js +61 -0
- package/dist/es/services/BaseService.js +148 -0
- package/dist/es/services/codeBlock.js +251 -0
- package/dist/es/services/componentList.js +29 -0
- package/dist/es/services/dataSource.js +157 -0
- package/dist/es/services/dep.js +173 -0
- package/dist/es/services/editor.js +752 -0
- package/dist/es/services/events.js +64 -0
- package/dist/es/services/history.js +84 -0
- package/dist/es/services/keybinding.js +182 -0
- package/dist/es/services/props.js +215 -0
- package/dist/es/services/stageOverlay.js +161 -0
- package/dist/es/services/storage.js +127 -0
- package/dist/es/services/ui.js +112 -0
- package/dist/es/style.css +1937 -0
- package/dist/es/type.js +90 -0
- package/dist/es/utils/compose.js +44 -0
- package/dist/es/utils/config.js +8 -0
- package/dist/es/utils/const.js +15 -0
- package/dist/es/utils/content-menu.js +76 -0
- package/dist/es/utils/data-source/formConfigs/base.js +28 -0
- package/dist/es/utils/data-source/formConfigs/http.js +74 -0
- package/dist/es/utils/data-source/index.js +201 -0
- package/dist/es/utils/dep/idle-task.js +76 -0
- package/dist/es/utils/dep/worker.js +19 -0
- package/dist/es/utils/editor.js +261 -0
- package/dist/es/utils/keybinding-config.js +106 -0
- package/dist/es/utils/logger.js +18 -0
- package/dist/es/utils/monaco-editor.js +13 -0
- package/dist/es/utils/operator.js +73 -0
- package/dist/es/utils/props.js +232 -0
- package/dist/es/utils/scroll-viewer.js +115 -0
- package/dist/es/utils/tree.js +11 -0
- package/dist/es/utils/undo-redo.js +43 -0
- package/dist/style.css +10 -10
- package/dist/tmagic-editor.umd.cjs +18427 -21980
- package/package.json +17 -13
- package/src/fields/CodeLink.vue +2 -2
- package/src/fields/DataSourceFieldSelect/Index.vue +10 -2
- package/src/fields/EventSelect.vue +6 -5
- package/src/index.ts +1 -73
- package/src/layouts/CodeEditor.vue +15 -8
- package/src/layouts/Framework.vue +1 -1
- package/src/plugin.ts +92 -0
- package/src/type.ts +6 -7
- package/src/utils/index.ts +1 -0
- package/src/utils/monaco-editor.ts +13 -6
- package/src/utils/props.ts +2 -0
- package/types/index.d.ts +3388 -3342
- package/dist/tmagic-editor.js +0 -17037
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.
|
|
2
|
+
"version": "1.7.8-beta.1",
|
|
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/
|
|
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/
|
|
17
|
+
"import": "./dist/es/index.js",
|
|
17
18
|
"require": "./dist/tmagic-editor.umd.cjs"
|
|
18
19
|
},
|
|
19
20
|
"./dist/style.css": {
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"@element-plus/icons-vue": "^2.3.2",
|
|
50
51
|
"buffer": "^6.0.3",
|
|
51
52
|
"deep-object-diff": "^1.1.9",
|
|
52
|
-
"emmet-monaco-es": "^5.
|
|
53
|
+
"emmet-monaco-es": "^5.7.0",
|
|
53
54
|
"events": "^3.3.0",
|
|
54
55
|
"gesto": "^1.19.4",
|
|
55
56
|
"keycon": "^1.4.0",
|
|
@@ -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.
|
|
61
|
-
"@tmagic/form": "1.7.
|
|
62
|
-
"@tmagic/utils": "1.7.
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/
|
|
61
|
+
"@tmagic/design": "1.7.8-beta.1",
|
|
62
|
+
"@tmagic/form": "1.7.8-beta.1",
|
|
63
|
+
"@tmagic/utils": "1.7.8-beta.1",
|
|
64
|
+
"@tmagic/table": "1.7.8-beta.1",
|
|
65
|
+
"@tmagic/stage": "1.7.8-beta.1"
|
|
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.
|
|
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.
|
|
79
|
+
"@tmagic/core": "1.7.8-beta.1"
|
|
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
|
}
|
package/src/fields/CodeLink.vue
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
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
|
|
|
@@ -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
|
|
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';
|
|
@@ -104,7 +110,9 @@ const type = computed((): string => {
|
|
|
104
110
|
});
|
|
105
111
|
|
|
106
112
|
const tagName = computed(() => {
|
|
107
|
-
const component =
|
|
113
|
+
const component =
|
|
114
|
+
getFormField(type.value || 'container') ||
|
|
115
|
+
resolveComponent(`m-${props.config.items ? 'form' : 'fields'}-${type.value}`);
|
|
108
116
|
if (typeof component !== 'string') return component;
|
|
109
117
|
return 'm-fields-text';
|
|
110
118
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="m-fields-event-select">
|
|
3
|
-
<
|
|
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
|
-
></
|
|
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>
|
|
@@ -68,8 +68,9 @@ import type {
|
|
|
68
68
|
FormState,
|
|
69
69
|
OnChangeHandlerData,
|
|
70
70
|
PanelConfig,
|
|
71
|
+
TableConfig,
|
|
71
72
|
} from '@tmagic/form';
|
|
72
|
-
import { MContainer as MFormContainer, MPanel } from '@tmagic/form';
|
|
73
|
+
import { MContainer as MFormContainer, MPanel, MTable } from '@tmagic/form';
|
|
73
74
|
import { DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, traverseNode } from '@tmagic/utils';
|
|
74
75
|
|
|
75
76
|
import { useServices } from '@editor/hooks/use-services';
|
|
@@ -304,7 +305,7 @@ const dataSourceActionConfig = computed(() => {
|
|
|
304
305
|
});
|
|
305
306
|
|
|
306
307
|
// 兼容旧的数据格式
|
|
307
|
-
const tableConfig = computed(() => ({
|
|
308
|
+
const tableConfig = computed<TableConfig>(() => ({
|
|
308
309
|
type: 'table',
|
|
309
310
|
name: 'events',
|
|
310
311
|
items: [
|
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
|
-
|
|
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';
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
import { computed, nextTick, onBeforeUnmount, onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
|
|
21
21
|
import { FullScreen } from '@element-plus/icons-vue';
|
|
22
22
|
import { throttle } from 'lodash-es';
|
|
23
|
+
import type * as Monaco from 'monaco-editor';
|
|
23
24
|
import serialize from 'serialize-javascript';
|
|
24
25
|
|
|
25
26
|
import { TMagicButton } from '@tmagic/design';
|
|
26
27
|
|
|
27
28
|
import MIcon from '@editor/components/Icon.vue';
|
|
28
29
|
import { getEditorConfig } from '@editor/utils/config';
|
|
29
|
-
import
|
|
30
|
+
import loadMonaco from '@editor/utils/monaco-editor';
|
|
30
31
|
|
|
31
32
|
defineOptions({
|
|
32
33
|
name: 'MEditorCodeEditor',
|
|
@@ -38,7 +39,7 @@ const props = withDefaults(
|
|
|
38
39
|
modifiedValues?: any;
|
|
39
40
|
type?: 'diff';
|
|
40
41
|
language?: string;
|
|
41
|
-
options?:
|
|
42
|
+
options?: Monaco.editor.IStandaloneEditorConstructionOptions;
|
|
42
43
|
height?: string;
|
|
43
44
|
autoSave?: boolean;
|
|
44
45
|
parse?: boolean;
|
|
@@ -99,7 +100,7 @@ const calculateExtraHeight = (): number => {
|
|
|
99
100
|
extraHeight = Math.max(editorRect.height - scrollableRect.height, 0);
|
|
100
101
|
|
|
101
102
|
// 如果无法获取到有效的差值,使用编辑器配置中的相关选项
|
|
102
|
-
if (extraHeight === 0) {
|
|
103
|
+
if (extraHeight === 0 && monaco) {
|
|
103
104
|
const editorOptions = vsEditor.getOptions();
|
|
104
105
|
const scrollBeyondLastLine = editorOptions.get(monaco.editor.EditorOption.scrollBeyondLastLine);
|
|
105
106
|
const padding = editorOptions.get(monaco.editor.EditorOption.padding);
|
|
@@ -127,7 +128,7 @@ const setAutoHeight = (v = '') => {
|
|
|
127
128
|
|
|
128
129
|
// 获取编辑器实际行高,如果编辑器还未初始化则使用默认值
|
|
129
130
|
let lineHeight = 20;
|
|
130
|
-
if (vsEditor) {
|
|
131
|
+
if (vsEditor && monaco) {
|
|
131
132
|
const editorOptions = vsEditor.getOptions();
|
|
132
133
|
lineHeight = editorOptions.get(monaco.editor.EditorOption.lineHeight) || 20;
|
|
133
134
|
}
|
|
@@ -188,8 +189,9 @@ const parseCode = (v: string | any, language: string): any => {
|
|
|
188
189
|
return getEditorConfig('parseDSL')(v);
|
|
189
190
|
};
|
|
190
191
|
|
|
191
|
-
let
|
|
192
|
-
let
|
|
192
|
+
let monaco: typeof import('monaco-editor') | null = null;
|
|
193
|
+
let vsEditor: Monaco.editor.IStandaloneCodeEditor | null = null;
|
|
194
|
+
let vsDiffEditor: Monaco.editor.IStandaloneDiffEditor | null = null;
|
|
193
195
|
|
|
194
196
|
const values = ref('');
|
|
195
197
|
const loading = ref(false);
|
|
@@ -207,6 +209,8 @@ const setEditorValue = (v: string | any, m: string | any) => {
|
|
|
207
209
|
|
|
208
210
|
setAutoHeight(values.value);
|
|
209
211
|
|
|
212
|
+
if (!monaco) return;
|
|
213
|
+
|
|
210
214
|
if (props.type === 'diff') {
|
|
211
215
|
const originalModel = monaco.editor.createModel(values.value, 'text/javascript');
|
|
212
216
|
const modifiedModel = monaco.editor.createModel(toString(m, props.language), 'text/javascript');
|
|
@@ -255,6 +259,8 @@ const init = async () => {
|
|
|
255
259
|
// 重置缓存的额外高度,因为编辑器重新初始化
|
|
256
260
|
cachedExtraHeight = null;
|
|
257
261
|
|
|
262
|
+
monaco = await loadMonaco();
|
|
263
|
+
|
|
258
264
|
const options = {
|
|
259
265
|
value: values.value,
|
|
260
266
|
language: props.language,
|
|
@@ -264,7 +270,7 @@ const init = async () => {
|
|
|
264
270
|
};
|
|
265
271
|
|
|
266
272
|
if (props.type === 'diff') {
|
|
267
|
-
vsDiffEditor = getEditorConfig('customCreateMonacoDiffEditor')(monaco
|
|
273
|
+
vsDiffEditor = await getEditorConfig('customCreateMonacoDiffEditor')(monaco!, codeEditorEl.value, options);
|
|
268
274
|
|
|
269
275
|
// 监听diff编辑器内容变化
|
|
270
276
|
vsDiffEditor.getModifiedEditor().onDidChangeModelContent(() => {
|
|
@@ -274,7 +280,7 @@ const init = async () => {
|
|
|
274
280
|
}
|
|
275
281
|
});
|
|
276
282
|
} else {
|
|
277
|
-
vsEditor = getEditorConfig('customCreateMonacoEditor')(monaco
|
|
283
|
+
vsEditor = await getEditorConfig('customCreateMonacoEditor')(monaco!, codeEditorEl.value, options);
|
|
278
284
|
|
|
279
285
|
// 监听编辑器内容变化
|
|
280
286
|
vsEditor.onDidChangeModelContent(() => {
|
|
@@ -343,6 +349,7 @@ onBeforeUnmount(() => {
|
|
|
343
349
|
|
|
344
350
|
vsEditor = null;
|
|
345
351
|
vsDiffEditor = null;
|
|
352
|
+
monaco = null;
|
|
346
353
|
|
|
347
354
|
// 重置缓存
|
|
348
355
|
cachedExtraHeight = null;
|
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
|
+
};
|
package/src/type.ts
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
import type { Component } from 'vue';
|
|
20
20
|
import type EventEmitter from 'events';
|
|
21
|
-
import
|
|
21
|
+
import type * as Monaco from 'monaco-editor';
|
|
22
|
+
import type { default as Sortable, Options, SortableEvent } from 'sortablejs';
|
|
22
23
|
import type { PascalCasedProperties } from 'type-fest';
|
|
23
24
|
|
|
24
25
|
import type { CodeBlockContent, CodeBlockDSL, Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/core';
|
|
@@ -32,8 +33,6 @@ import type {
|
|
|
32
33
|
UpdateDragEl,
|
|
33
34
|
} from '@tmagic/stage';
|
|
34
35
|
|
|
35
|
-
import Monaco from '@editor/utils/monaco-editor';
|
|
36
|
-
|
|
37
36
|
import type { CodeBlockService } from './services/codeBlock';
|
|
38
37
|
import type { ComponentListService } from './services/componentList';
|
|
39
38
|
import type { DataSourceService } from './services/dataSource';
|
|
@@ -121,15 +120,15 @@ export type GetConfig = (config: FormConfig) => Promise<FormConfig> | FormConfig
|
|
|
121
120
|
export interface EditorInstallOptions {
|
|
122
121
|
parseDSL: <T = any>(dsl: string) => T;
|
|
123
122
|
customCreateMonacoEditor: (
|
|
124
|
-
monaco: typeof
|
|
123
|
+
monaco: typeof import('monaco-editor'),
|
|
125
124
|
codeEditorEl: HTMLElement,
|
|
126
125
|
options: Monaco.editor.IStandaloneEditorConstructionOptions & { editorCustomType?: string },
|
|
127
|
-
) => Monaco.editor.IStandaloneCodeEditor;
|
|
126
|
+
) => Promise<Monaco.editor.IStandaloneCodeEditor> | Monaco.editor.IStandaloneCodeEditor;
|
|
128
127
|
customCreateMonacoDiffEditor: (
|
|
129
|
-
monaco: typeof
|
|
128
|
+
monaco: typeof import('monaco-editor'),
|
|
130
129
|
codeEditorEl: HTMLElement,
|
|
131
130
|
options: Monaco.editor.IStandaloneEditorConstructionOptions & { editorCustomType?: string },
|
|
132
|
-
) => Monaco.editor.IStandaloneDiffEditor;
|
|
131
|
+
) => Promise<Monaco.editor.IStandaloneDiffEditor> | Monaco.editor.IStandaloneDiffEditor;
|
|
133
132
|
[key: string]: any;
|
|
134
133
|
}
|
|
135
134
|
|
package/src/utils/index.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import * as monaco from 'monaco-editor';
|
|
1
|
+
let cached: Promise<typeof import('monaco-editor')> | undefined;
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export default () => {
|
|
4
|
+
if (!cached) {
|
|
5
|
+
cached = Promise.all([import('emmet-monaco-es'), import('monaco-editor')]).then(([emmet, monaco]) => {
|
|
6
|
+
const { emmetHTML, emmetCSS } = emmet;
|
|
7
|
+
emmetHTML(monaco);
|
|
8
|
+
emmetCSS(monaco, ['css', 'scss']);
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
return monaco;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return cached;
|
|
15
|
+
};
|
package/src/utils/props.ts
CHANGED
|
@@ -47,6 +47,7 @@ export const numberOptions = [
|
|
|
47
47
|
|
|
48
48
|
export const styleTabConfig: TabPaneConfig = {
|
|
49
49
|
title: '样式',
|
|
50
|
+
lazy: true,
|
|
50
51
|
display: ({ services }: any) => !(services.uiService.get('showStylePanel') ?? true),
|
|
51
52
|
items: [
|
|
52
53
|
{
|
|
@@ -114,6 +115,7 @@ export const styleTabConfig: TabPaneConfig = {
|
|
|
114
115
|
|
|
115
116
|
export const eventTabConfig: TabPaneConfig = {
|
|
116
117
|
title: '事件',
|
|
118
|
+
lazy: true,
|
|
117
119
|
items: [
|
|
118
120
|
{
|
|
119
121
|
name: 'events',
|