@tmagic/editor 1.3.0-alpha.0 → 1.3.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +46 -9
- package/dist/tmagic-editor.js +1764 -871
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1781 -882
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +19 -20
- package/src/Editor.vue +29 -3
- package/src/components/CodeDraftEditor.vue +5 -1
- package/src/components/ContentMenu.vue +30 -11
- package/src/components/FunctionEditor.vue +12 -5
- package/src/components/Icon.vue +5 -1
- package/src/components/Resizer.vue +45 -0
- package/src/components/ScrollBar.vue +5 -1
- package/src/components/ScrollViewer.vue +5 -1
- package/src/components/SearchInput.vue +4 -0
- package/src/components/{Layout.vue → SplitView.vue} +8 -4
- package/src/components/ToolButton.vue +5 -1
- package/src/editorProps.ts +5 -1
- package/src/fields/Code.vue +5 -1
- package/src/fields/CodeLink.vue +9 -3
- package/src/fields/CodeSelect.vue +8 -2
- package/src/fields/CodeSelectCol.vue +6 -2
- package/src/fields/DataSourceFields.vue +5 -1
- package/src/fields/DataSourceInput.vue +358 -0
- package/src/fields/DataSourceSelect.vue +75 -0
- package/src/fields/EventSelect.vue +9 -3
- package/src/fields/KeyValue.vue +4 -0
- package/src/fields/UISelect.vue +5 -1
- package/src/icons/AppManageIcon.vue +5 -1
- package/src/icons/CenterIcon.vue +13 -0
- package/src/icons/CodeIcon.vue +5 -1
- package/src/index.ts +13 -3
- package/src/initService.ts +73 -0
- package/src/layouts/AddPageBox.vue +5 -1
- package/src/layouts/CodeEditor.vue +34 -10
- package/src/layouts/Framework.vue +25 -25
- package/src/layouts/NavMenu.vue +5 -1
- package/src/layouts/PropsPanel.vue +14 -4
- package/src/layouts/sidebar/ComponentListPanel.vue +8 -5
- package/src/layouts/sidebar/LayerMenu.vue +13 -25
- package/src/layouts/sidebar/LayerNode.vue +40 -0
- package/src/layouts/sidebar/LayerPanel.vue +70 -27
- package/src/layouts/sidebar/Sidebar.vue +11 -7
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +8 -4
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +5 -1
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +4 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +22 -2
- package/src/layouts/workspace/Breadcrumb.vue +5 -1
- package/src/layouts/workspace/PageBar.vue +5 -1
- package/src/layouts/workspace/PageBarScrollContainer.vue +5 -1
- package/src/layouts/workspace/Stage.vue +29 -7
- package/src/layouts/workspace/ViewerMenu.vue +15 -36
- package/src/layouts/workspace/Workspace.vue +9 -134
- package/src/services/codeBlock.ts +3 -2
- package/src/services/dep.ts +4 -0
- package/src/services/keybinding.ts +185 -0
- package/src/services/storage.ts +3 -2
- package/src/theme/content-menu.scss +1 -1
- package/src/theme/data-source-input.scss +18 -0
- package/src/theme/framework.scss +0 -3
- package/src/theme/layer-panel.scss +6 -0
- package/src/theme/layout.scss +4 -0
- package/src/theme/resizer.scss +25 -10
- package/src/theme/stage.scss +4 -0
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +59 -1
- package/src/utils/config.ts +1 -1
- package/src/utils/content-menu.ts +92 -0
- package/src/utils/dep.ts +7 -1
- package/src/utils/keybinding-config.ts +120 -0
- package/src/utils/props.ts +34 -0
- package/types/Editor.vue.d.ts +7 -1
- package/types/components/CodeDraftEditor.vue.d.ts +6 -3
- package/types/components/ContentMenu.vue.d.ts +10 -5
- package/types/components/FunctionEditor.vue.d.ts +74 -51
- package/types/components/Icon.vue.d.ts +2 -2
- package/types/{layouts → components}/Resizer.vue.d.ts +2 -2
- package/types/components/ScrollBar.vue.d.ts +1 -1
- package/types/components/ScrollViewer.vue.d.ts +8 -5
- package/types/components/SearchInput.vue.d.ts +1 -1
- package/types/components/{Layout.vue.d.ts → SplitView.vue.d.ts} +9 -6
- package/types/components/ToolButton.vue.d.ts +8 -5
- package/types/editorProps.d.ts +4 -1
- package/types/fields/Code.vue.d.ts +1 -1
- package/types/fields/CodeLink.vue.d.ts +9 -9
- package/types/fields/CodeSelect.vue.d.ts +10 -7
- package/types/fields/CodeSelectCol.vue.d.ts +8 -5
- package/types/fields/DataSourceFields.vue.d.ts +8 -5
- package/types/fields/DataSourceInput.vue.d.ts +54 -0
- package/types/fields/DataSourceSelect.vue.d.ts +56 -0
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/KeyValue.vue.d.ts +8 -5
- package/types/fields/UISelect.vue.d.ts +1 -1
- package/types/icons/AppManageIcon.vue.d.ts +1 -1
- package/types/icons/CenterIcon.vue.d.ts +2 -0
- package/types/icons/CodeIcon.vue.d.ts +1 -1
- package/types/index.d.ts +7 -2
- package/types/initService.d.ts +1 -1
- package/types/layouts/AddPageBox.vue.d.ts +1 -1
- package/types/layouts/CodeEditor.vue.d.ts +16 -10
- package/types/layouts/Framework.vue.d.ts +11 -32
- package/types/layouts/NavMenu.vue.d.ts +7 -4
- package/types/layouts/PropsPanel.vue.d.ts +276 -4
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +4 -4
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerNode.vue.d.ts +16 -0
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +5 -5
- package/types/layouts/sidebar/Sidebar.vue.d.ts +18 -15
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +4 -4
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +7 -7
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +3 -3
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
- package/types/layouts/workspace/PageBar.vue.d.ts +5 -5
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +2 -2
- package/types/layouts/workspace/Stage.vue.d.ts +2 -2
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +7 -4
- package/types/layouts/workspace/Workspace.vue.d.ts +9 -9
- package/types/services/keybinding.d.ts +20 -0
- package/types/type.d.ts +56 -1
- package/types/utils/config.d.ts +1 -1
- package/types/utils/content-menu.d.ts +7 -0
- package/types/utils/keybinding-config.d.ts +3 -0
- package/src/layouts/Resizer.vue +0 -32
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, reactive, watch, createElementBlock, normalizeClass, createVNode, unref, withCtx, createElementVNode, resolveDynamicComponent, toRaw, inject, ref, createTextVNode, mergeProps, toDisplayString, Fragment, renderList, createCommentVNode, nextTick, watchEffect, withModifiers, onMounted, onUnmounted, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, provide, Teleport, onBeforeUnmount, toHandlers } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
3
|
import { isEmpty, map, has, throttle, cloneDeep, mergeWith, isObject, uniq, forIn, difference, union, pick, keys } from 'lodash-es';
|
|
4
|
-
import { TMagicCard, TMagicIcon, TMagicButton, tMagicMessageBox, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, TMagicDrawer, TMagicTree, TMagicCollapse, TMagicCollapseItem,
|
|
4
|
+
import { TMagicCard, TMagicIcon, TMagicButton, tMagicMessageBox, getConfig as getConfig$1, TMagicTag, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, TMagicDrawer, TMagicTree, TMagicCollapse, TMagicCollapseItem, TMagicPopover } from '@tmagic/design';
|
|
5
5
|
import { HookType, ActionType, NodeType } from '@tmagic/schema';
|
|
6
|
-
import { Edit, View, Delete, Plus, Close, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search,
|
|
7
|
-
import { createValues, MFormDialog, MForm } from '@tmagic/form';
|
|
6
|
+
import { Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, CopyDocument, DocumentCopy, Files, Hide, Goods, List, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons-vue';
|
|
7
|
+
import { createValues, MFormDialog, MSelect, MForm } from '@tmagic/form';
|
|
8
8
|
import { MagicTable } from '@tmagic/table';
|
|
9
9
|
import * as monaco from 'monaco-editor';
|
|
10
10
|
import Gesto from 'gesto';
|
|
11
|
-
import { isPop, getNodePath, isNumber, isPage, toLine, guid, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
|
|
12
|
-
import KeyController from 'keycon';
|
|
11
|
+
import { isPop, getNodePath, isNumber, isPage, toLine, guid, datetimeFormatter, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
13
12
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
14
13
|
import { EventEmitter } from 'events';
|
|
15
14
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
15
|
+
import KeyController from 'keycon';
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
18
|
+
...{
|
|
19
|
+
name: "MEditorCode"
|
|
20
|
+
},
|
|
21
|
+
__name: "Code",
|
|
22
22
|
props: {
|
|
23
|
-
model:
|
|
24
|
-
name:
|
|
25
|
-
config:
|
|
26
|
-
prop:
|
|
23
|
+
model: {},
|
|
24
|
+
name: {},
|
|
25
|
+
config: {},
|
|
26
|
+
prop: {}
|
|
27
27
|
},
|
|
28
28
|
emits: ["change"],
|
|
29
29
|
setup(__props, { emit }) {
|
|
@@ -37,26 +37,32 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
37
37
|
return (_ctx, _cache) => {
|
|
38
38
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
39
39
|
return openBlock(), createBlock(_component_magic_code_editor, {
|
|
40
|
-
style: normalizeStyle(`height: ${
|
|
41
|
-
"init-values":
|
|
42
|
-
language:
|
|
43
|
-
options:
|
|
40
|
+
style: normalizeStyle(`height: ${height.value}`),
|
|
41
|
+
"init-values": _ctx.model[_ctx.name],
|
|
42
|
+
language: language.value,
|
|
43
|
+
options: _ctx.config.options,
|
|
44
44
|
onSave: save
|
|
45
45
|
}, null, 8, ["style", "init-values", "language", "options"]);
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
let $TMAGIC_EDITOR = {};
|
|
51
|
+
const setConfig = (option) => {
|
|
52
|
+
$TMAGIC_EDITOR = option;
|
|
53
|
+
};
|
|
54
|
+
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
55
|
+
|
|
56
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
57
|
+
...{
|
|
58
|
+
name: "MEditorCodeLink"
|
|
59
|
+
},
|
|
60
|
+
__name: "CodeLink",
|
|
55
61
|
props: {
|
|
56
|
-
config:
|
|
57
|
-
model:
|
|
58
|
-
name:
|
|
59
|
-
prop:
|
|
62
|
+
config: {},
|
|
63
|
+
model: {},
|
|
64
|
+
name: {},
|
|
65
|
+
prop: {}
|
|
60
66
|
},
|
|
61
67
|
emits: ["change"],
|
|
62
68
|
setup(__props, { emit }) {
|
|
@@ -102,7 +108,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
102
108
|
if (!props.name || !props.model)
|
|
103
109
|
return;
|
|
104
110
|
try {
|
|
105
|
-
|
|
111
|
+
const parseDSL = getConfig("parseDSL");
|
|
112
|
+
props.model[props.name] = parseDSL(`(${v[props.name]})`);
|
|
106
113
|
emit("change", props.model[props.name]);
|
|
107
114
|
} catch (e) {
|
|
108
115
|
console.error(e);
|
|
@@ -111,7 +118,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
111
118
|
return (_ctx, _cache) => {
|
|
112
119
|
const _component_m_fields_link = resolveComponent("m-fields-link");
|
|
113
120
|
return openBlock(), createBlock(_component_m_fields_link, {
|
|
114
|
-
config:
|
|
121
|
+
config: formConfig.value,
|
|
115
122
|
model: modelValue,
|
|
116
123
|
name: "form",
|
|
117
124
|
onChange: changeHandler
|
|
@@ -120,17 +127,17 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
120
127
|
}
|
|
121
128
|
});
|
|
122
129
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
131
|
+
...{
|
|
132
|
+
name: "MEditorCodeSelect"
|
|
133
|
+
},
|
|
134
|
+
__name: "CodeSelect",
|
|
128
135
|
props: {
|
|
129
|
-
config:
|
|
130
|
-
model:
|
|
131
|
-
prop:
|
|
132
|
-
name:
|
|
133
|
-
size:
|
|
136
|
+
config: {},
|
|
137
|
+
model: {},
|
|
138
|
+
prop: {},
|
|
139
|
+
name: {},
|
|
140
|
+
size: {}
|
|
134
141
|
},
|
|
135
142
|
emits: ["change"],
|
|
136
143
|
setup(__props, { emit }) {
|
|
@@ -139,6 +146,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
139
146
|
type: "group-list",
|
|
140
147
|
name: "hookData",
|
|
141
148
|
enableToggleMode: false,
|
|
149
|
+
expandAll: true,
|
|
150
|
+
titleKey: "codeId",
|
|
142
151
|
items: [
|
|
143
152
|
{
|
|
144
153
|
type: "code-select-col",
|
|
@@ -166,13 +175,13 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
166
175
|
return (_ctx, _cache) => {
|
|
167
176
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
168
177
|
return openBlock(), createElementBlock("div", {
|
|
169
|
-
class: normalizeClass(["m-fields-code-select",
|
|
178
|
+
class: normalizeClass(["m-fields-code-select", _ctx.config.className])
|
|
170
179
|
}, [
|
|
171
180
|
createVNode(unref(TMagicCard), null, {
|
|
172
181
|
default: withCtx(() => [
|
|
173
182
|
createVNode(_component_m_form_container, {
|
|
174
|
-
config:
|
|
175
|
-
model:
|
|
183
|
+
config: codeConfig.value,
|
|
184
|
+
model: _ctx.model[_ctx.name],
|
|
176
185
|
onChange: changeHandler
|
|
177
186
|
}, null, 8, ["config", "model"])
|
|
178
187
|
]),
|
|
@@ -183,18 +192,18 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
183
192
|
}
|
|
184
193
|
});
|
|
185
194
|
|
|
186
|
-
const _hoisted_1$
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
195
|
+
const _hoisted_1$p = ["src"];
|
|
196
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
197
|
+
...{
|
|
198
|
+
name: "MEditorIcon"
|
|
199
|
+
},
|
|
200
|
+
__name: "Icon",
|
|
192
201
|
props: {
|
|
193
|
-
icon:
|
|
202
|
+
icon: {}
|
|
194
203
|
},
|
|
195
204
|
setup(__props) {
|
|
196
205
|
return (_ctx, _cache) => {
|
|
197
|
-
return !
|
|
206
|
+
return !_ctx.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
198
207
|
key: 0,
|
|
199
208
|
class: "magic-editor-icon"
|
|
200
209
|
}, {
|
|
@@ -202,23 +211,23 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
202
211
|
createVNode(unref(Edit))
|
|
203
212
|
]),
|
|
204
213
|
_: 1
|
|
205
|
-
})) : typeof
|
|
214
|
+
})) : typeof _ctx.icon === "string" && _ctx.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
206
215
|
key: 1,
|
|
207
216
|
class: "magic-editor-icon"
|
|
208
217
|
}, {
|
|
209
218
|
default: withCtx(() => [
|
|
210
|
-
createElementVNode("img", { src:
|
|
219
|
+
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$p)
|
|
211
220
|
]),
|
|
212
221
|
_: 1
|
|
213
|
-
})) : typeof
|
|
222
|
+
})) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
214
223
|
key: 2,
|
|
215
|
-
class: normalizeClass(["magic-editor-icon",
|
|
224
|
+
class: normalizeClass(["magic-editor-icon", _ctx.icon])
|
|
216
225
|
}, null, 2)) : (openBlock(), createBlock(unref(TMagicIcon), {
|
|
217
226
|
key: 3,
|
|
218
227
|
class: "magic-editor-icon"
|
|
219
228
|
}, {
|
|
220
229
|
default: withCtx(() => [
|
|
221
|
-
(openBlock(), createBlock(resolveDynamicComponent(toRaw(
|
|
230
|
+
(openBlock(), createBlock(resolveDynamicComponent(toRaw(_ctx.icon))))
|
|
222
231
|
]),
|
|
223
232
|
_: 1
|
|
224
233
|
}));
|
|
@@ -226,19 +235,19 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
226
235
|
}
|
|
227
236
|
});
|
|
228
237
|
|
|
229
|
-
const _hoisted_1$
|
|
230
|
-
const _hoisted_2$
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
const _hoisted_1$o = { class: "m-fields-code-select-col" };
|
|
239
|
+
const _hoisted_2$f = { class: "code-select-container" };
|
|
240
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
241
|
+
...{
|
|
242
|
+
name: "MEditorCodeSelectCol"
|
|
243
|
+
},
|
|
244
|
+
__name: "CodeSelectCol",
|
|
236
245
|
props: {
|
|
237
|
-
config:
|
|
238
|
-
model:
|
|
239
|
-
prop:
|
|
240
|
-
name:
|
|
241
|
-
size:
|
|
246
|
+
config: {},
|
|
247
|
+
model: {},
|
|
248
|
+
prop: {},
|
|
249
|
+
name: {},
|
|
250
|
+
size: {}
|
|
242
251
|
},
|
|
243
252
|
emits: ["change"],
|
|
244
253
|
setup(__props, { emit }) {
|
|
@@ -320,23 +329,23 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
320
329
|
};
|
|
321
330
|
return (_ctx, _cache) => {
|
|
322
331
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
323
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
324
|
-
createElementVNode("div", _hoisted_2$
|
|
332
|
+
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
333
|
+
createElementVNode("div", _hoisted_2$f, [
|
|
325
334
|
createVNode(_component_m_form_container, {
|
|
326
335
|
class: "select",
|
|
327
336
|
config: selectConfig,
|
|
328
|
-
model:
|
|
337
|
+
model: _ctx.model,
|
|
329
338
|
onChange: onParamsChangeHandler
|
|
330
339
|
}, null, 8, ["model"]),
|
|
331
|
-
createVNode(_sfc_main$
|
|
340
|
+
createVNode(_sfc_main$E, {
|
|
332
341
|
class: "icon",
|
|
333
|
-
icon:
|
|
342
|
+
icon: editable.value ? unref(Edit) : unref(View),
|
|
334
343
|
onClick: editCode
|
|
335
344
|
}, null, 8, ["icon"])
|
|
336
345
|
]),
|
|
337
346
|
createVNode(_component_m_form_container, {
|
|
338
347
|
config: codeParamsConfig.value,
|
|
339
|
-
model:
|
|
348
|
+
model: _ctx.model,
|
|
340
349
|
onChange: onParamsChangeHandler
|
|
341
350
|
}, null, 8, ["config", "model"])
|
|
342
351
|
]);
|
|
@@ -344,17 +353,19 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
344
353
|
}
|
|
345
354
|
});
|
|
346
355
|
|
|
347
|
-
const _hoisted_1$
|
|
348
|
-
const _hoisted_2$
|
|
349
|
-
const
|
|
350
|
-
|
|
356
|
+
const _hoisted_1$n = { class: "m-editor-data-source-fields" };
|
|
357
|
+
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
358
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
359
|
+
...{
|
|
360
|
+
name: "MEditorDataSourceFields"
|
|
361
|
+
},
|
|
351
362
|
__name: "DataSourceFields",
|
|
352
363
|
props: {
|
|
353
|
-
config:
|
|
354
|
-
model:
|
|
355
|
-
prop:
|
|
364
|
+
config: {},
|
|
365
|
+
model: {},
|
|
366
|
+
prop: {},
|
|
356
367
|
disabled: { type: Boolean, default: false },
|
|
357
|
-
name:
|
|
368
|
+
name: {}
|
|
358
369
|
},
|
|
359
370
|
emits: ["change"],
|
|
360
371
|
setup(__props, { emit }) {
|
|
@@ -450,7 +461,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
450
461
|
{
|
|
451
462
|
validator: ({ value, callback }, { model, parent }) => {
|
|
452
463
|
const index = parent.findIndex((item) => item.name === value);
|
|
453
|
-
if (model.index === -1 && index > -1 || model.index > -1 && index !== model.index) {
|
|
464
|
+
if (model.index === -1 && index > -1 || model.index > -1 && index > -1 && index !== model.index) {
|
|
454
465
|
return callback(`属性key(${value})已存在`);
|
|
455
466
|
}
|
|
456
467
|
callback();
|
|
@@ -490,21 +501,21 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
490
501
|
}
|
|
491
502
|
];
|
|
492
503
|
return (_ctx, _cache) => {
|
|
493
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
504
|
+
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
494
505
|
createVNode(unref(MagicTable), {
|
|
495
|
-
data:
|
|
506
|
+
data: _ctx.model[_ctx.name],
|
|
496
507
|
columns: filedColumns
|
|
497
508
|
}, null, 8, ["data"]),
|
|
498
|
-
createElementVNode("div", _hoisted_2$
|
|
509
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
499
510
|
createVNode(unref(TMagicButton), {
|
|
500
511
|
size: "small",
|
|
501
512
|
type: "primary",
|
|
502
|
-
disabled:
|
|
513
|
+
disabled: _ctx.disabled,
|
|
503
514
|
plain: "",
|
|
504
515
|
onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
|
|
505
516
|
}, {
|
|
506
517
|
default: withCtx(() => [
|
|
507
|
-
|
|
518
|
+
createTextVNode("添加")
|
|
508
519
|
]),
|
|
509
520
|
_: 1
|
|
510
521
|
}, 8, ["disabled"])
|
|
@@ -515,7 +526,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
515
526
|
title: filedTitle.value,
|
|
516
527
|
config: dataSourceFieldsConfig,
|
|
517
528
|
values: fieldValues.value,
|
|
518
|
-
parentValues:
|
|
529
|
+
parentValues: _ctx.model[_ctx.name],
|
|
519
530
|
onSubmit: fieldChange
|
|
520
531
|
}, null, 8, ["title", "values", "parentValues"])
|
|
521
532
|
]);
|
|
@@ -523,23 +534,343 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
523
534
|
}
|
|
524
535
|
});
|
|
525
536
|
|
|
526
|
-
const _hoisted_1$
|
|
537
|
+
const _hoisted_1$m = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
538
|
+
const _hoisted_2$d = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
539
|
+
const _hoisted_3$6 = { class: "el-input__inner" };
|
|
540
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
541
|
+
...{
|
|
542
|
+
name: "MEditorDataSourceInput"
|
|
543
|
+
},
|
|
544
|
+
__name: "DataSourceInput",
|
|
545
|
+
props: {
|
|
546
|
+
config: {},
|
|
547
|
+
model: {},
|
|
548
|
+
name: {},
|
|
549
|
+
prop: {},
|
|
550
|
+
disabled: { type: Boolean, default: false },
|
|
551
|
+
lastValues: {},
|
|
552
|
+
size: {}
|
|
553
|
+
},
|
|
554
|
+
emits: ["change"],
|
|
555
|
+
setup(__props, { emit }) {
|
|
556
|
+
const props = __props;
|
|
557
|
+
const { dataSourceService } = inject("services") || {};
|
|
558
|
+
const autocomplete = ref();
|
|
559
|
+
const isFocused = ref(false);
|
|
560
|
+
const state = ref("");
|
|
561
|
+
const displayState = ref([]);
|
|
562
|
+
const input = computed(() => autocomplete.value?.inputRef?.input);
|
|
563
|
+
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
564
|
+
const setDisplayState = () => {
|
|
565
|
+
displayState.value = [];
|
|
566
|
+
const matches = state.value.matchAll(/\$\{([\s\S]+?)\}/g);
|
|
567
|
+
let index = 0;
|
|
568
|
+
for (const match of matches) {
|
|
569
|
+
if (typeof match.index === "undefined")
|
|
570
|
+
break;
|
|
571
|
+
displayState.value.push({
|
|
572
|
+
type: "text",
|
|
573
|
+
value: state.value.substring(index, match.index)
|
|
574
|
+
});
|
|
575
|
+
let dsText = "";
|
|
576
|
+
let ds;
|
|
577
|
+
let fields;
|
|
578
|
+
match[1].split(".").forEach((item, index2) => {
|
|
579
|
+
if (index2 === 0) {
|
|
580
|
+
ds = dataSources.value.find((ds2) => ds2.id === item);
|
|
581
|
+
dsText += ds?.title || item;
|
|
582
|
+
fields = ds?.fields;
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
const field = fields?.find((field2) => field2.name === item);
|
|
586
|
+
fields = field?.fields;
|
|
587
|
+
dsText += `.${field?.title || item}`;
|
|
588
|
+
});
|
|
589
|
+
displayState.value.push({
|
|
590
|
+
type: "var",
|
|
591
|
+
value: dsText
|
|
592
|
+
});
|
|
593
|
+
index = match.index + match[0].length;
|
|
594
|
+
}
|
|
595
|
+
if (index < state.value.length) {
|
|
596
|
+
displayState.value.push({
|
|
597
|
+
type: "text",
|
|
598
|
+
value: state.value.substring(index)
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
watch(
|
|
603
|
+
() => props.model[props.name],
|
|
604
|
+
(value = "") => {
|
|
605
|
+
state.value = value;
|
|
606
|
+
setDisplayState();
|
|
607
|
+
},
|
|
608
|
+
{ immediate: true }
|
|
609
|
+
);
|
|
610
|
+
const mouseupHandler = async () => {
|
|
611
|
+
isFocused.value = true;
|
|
612
|
+
await nextTick();
|
|
613
|
+
autocomplete.value?.focus();
|
|
614
|
+
};
|
|
615
|
+
const blurHandler = () => {
|
|
616
|
+
isFocused.value = false;
|
|
617
|
+
setDisplayState();
|
|
618
|
+
};
|
|
619
|
+
const changeHandler = (v) => {
|
|
620
|
+
emit("change", v);
|
|
621
|
+
};
|
|
622
|
+
let inputText = "";
|
|
623
|
+
const inputHandler = (v) => {
|
|
624
|
+
if (!v) {
|
|
625
|
+
inputText = v;
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
const isRightCurlyBracket = (selectionStart = 0) => {
|
|
629
|
+
const lastChar = inputText.substring(selectionStart - 1, selectionStart);
|
|
630
|
+
return lastChar === "}";
|
|
631
|
+
};
|
|
632
|
+
const getSelectionStart = () => {
|
|
633
|
+
let selectionStart = input.value?.selectionStart || 0;
|
|
634
|
+
if (isRightCurlyBracket(selectionStart)) {
|
|
635
|
+
selectionStart -= 1;
|
|
636
|
+
}
|
|
637
|
+
return selectionStart;
|
|
638
|
+
};
|
|
639
|
+
const curCharIsLeftCurlyBracket = (leftCurlyBracketIndex) => leftCurlyBracketIndex > 0 && leftCurlyBracketIndex === getSelectionStart() - 1;
|
|
640
|
+
const curCharIsDot = (dotIndex) => dotIndex > -1 && dotIndex === getSelectionStart() - 1;
|
|
641
|
+
const dsQuerySearch = (queryString, leftCurlyBracketIndex, cb) => {
|
|
642
|
+
let result = [];
|
|
643
|
+
if (curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
644
|
+
result = dataSources.value;
|
|
645
|
+
} else if (leftCurlyBracketIndex > 0) {
|
|
646
|
+
const queryName = queryString.substring(leftCurlyBracketIndex + 1).toLowerCase();
|
|
647
|
+
result = dataSources.value.filter((ds) => ds.title?.toLowerCase().includes(queryName) || ds.id.includes(queryName));
|
|
648
|
+
}
|
|
649
|
+
cb(
|
|
650
|
+
result.map((ds) => ({
|
|
651
|
+
value: ds.id,
|
|
652
|
+
text: ds.title,
|
|
653
|
+
type: "dataSource"
|
|
654
|
+
}))
|
|
655
|
+
);
|
|
656
|
+
};
|
|
657
|
+
const fieldQuerySearch = (queryString, leftAngleIndex, dotIndex, cb) => {
|
|
658
|
+
let result = [];
|
|
659
|
+
const dsKey = queryString.substring(leftAngleIndex + 1, dotIndex);
|
|
660
|
+
const keys = dsKey.split(".");
|
|
661
|
+
const ds = dataSources.value.find((ds2) => ds2.id === keys.shift());
|
|
662
|
+
if (!ds) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
let fields = ds.fields || [];
|
|
666
|
+
let key = keys.shift();
|
|
667
|
+
while (key) {
|
|
668
|
+
for (const field of fields) {
|
|
669
|
+
if (field.name === key) {
|
|
670
|
+
fields = field.fields || [];
|
|
671
|
+
key = keys.shift();
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (curCharIsDot(dotIndex)) {
|
|
677
|
+
result = fields || [];
|
|
678
|
+
} else if (dotIndex > -1) {
|
|
679
|
+
const queryName = queryString.substring(dotIndex + 1).toLowerCase();
|
|
680
|
+
result = fields.filter(
|
|
681
|
+
(field) => field.name?.toLowerCase().includes(queryName) || field.title?.toLowerCase().includes(queryName)
|
|
682
|
+
) || [];
|
|
683
|
+
}
|
|
684
|
+
cb(
|
|
685
|
+
result.map((field) => ({
|
|
686
|
+
value: field.name,
|
|
687
|
+
text: field.title,
|
|
688
|
+
type: "field"
|
|
689
|
+
}))
|
|
690
|
+
);
|
|
691
|
+
};
|
|
692
|
+
const querySearch = (queryString, cb) => {
|
|
693
|
+
inputText = queryString;
|
|
694
|
+
const selectionStart = getSelectionStart();
|
|
695
|
+
const curQueryString = queryString.substring(0, selectionStart);
|
|
696
|
+
const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
|
|
697
|
+
const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
|
|
698
|
+
const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
|
|
699
|
+
if (isFieldTip) {
|
|
700
|
+
fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
|
|
701
|
+
} else {
|
|
702
|
+
dsQuerySearch(curQueryString, dsKeyStringLastIndex, cb);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
const selectHandler = async ({ value, type }) => {
|
|
706
|
+
const isDataSource = type === "dataSource";
|
|
707
|
+
const selectionStart = input.value?.selectionStart || 0;
|
|
708
|
+
let startText = inputText.substring(0, selectionStart);
|
|
709
|
+
const dotIndex = startText.lastIndexOf(".");
|
|
710
|
+
const leftCurlyBracketIndex = startText.lastIndexOf("${") + 1;
|
|
711
|
+
const endText = inputText.substring(selectionStart);
|
|
712
|
+
let suggestText = value;
|
|
713
|
+
if (isDataSource) {
|
|
714
|
+
if (!curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
|
|
715
|
+
startText = startText.substring(0, leftCurlyBracketIndex + 1);
|
|
716
|
+
}
|
|
717
|
+
if (!isRightCurlyBracket(selectionStart + 1)) {
|
|
718
|
+
suggestText = `${suggestText}}`;
|
|
719
|
+
}
|
|
720
|
+
} else if (!curCharIsDot(dotIndex)) {
|
|
721
|
+
startText = startText.substring(0, dotIndex + 1);
|
|
722
|
+
}
|
|
723
|
+
state.value = `${startText}${suggestText}${endText}`;
|
|
724
|
+
await nextTick();
|
|
725
|
+
let newSelectionStart = 0;
|
|
726
|
+
if (isDataSource) {
|
|
727
|
+
newSelectionStart = leftCurlyBracketIndex + suggestText.length;
|
|
728
|
+
} else {
|
|
729
|
+
newSelectionStart = dotIndex + suggestText.length + 1;
|
|
730
|
+
}
|
|
731
|
+
input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
|
|
732
|
+
};
|
|
733
|
+
return (_ctx, _cache) => {
|
|
734
|
+
return _ctx.disabled || isFocused.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(getConfig$1)("components")?.autocomplete.component || "el-autocomplete"), mergeProps(
|
|
735
|
+
{
|
|
736
|
+
key: 0,
|
|
737
|
+
class: "tmagic-design-auto-complete",
|
|
738
|
+
ref_key: "autocomplete",
|
|
739
|
+
ref: autocomplete,
|
|
740
|
+
modelValue: state.value,
|
|
741
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.value = $event)
|
|
742
|
+
},
|
|
743
|
+
unref(getConfig$1)("components")?.autocomplete.props({
|
|
744
|
+
disabled: _ctx.disabled,
|
|
745
|
+
size: _ctx.size,
|
|
746
|
+
fetchSuggestions: querySearch,
|
|
747
|
+
triggerOnFocus: false,
|
|
748
|
+
clearable: true
|
|
749
|
+
}) || {},
|
|
750
|
+
{
|
|
751
|
+
style: { "width": "100%" },
|
|
752
|
+
onBlur: blurHandler,
|
|
753
|
+
onChange: changeHandler,
|
|
754
|
+
onInput: inputHandler,
|
|
755
|
+
onSelect: selectHandler
|
|
756
|
+
}
|
|
757
|
+
), {
|
|
758
|
+
suffix: withCtx(() => [
|
|
759
|
+
createVNode(_sfc_main$E, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
760
|
+
]),
|
|
761
|
+
default: withCtx(({ item }) => [
|
|
762
|
+
createElementVNode("div", _hoisted_1$m, [
|
|
763
|
+
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
764
|
+
createElementVNode("span", _hoisted_2$d, toDisplayString(item.value), 1)
|
|
765
|
+
])
|
|
766
|
+
]),
|
|
767
|
+
_: 1
|
|
768
|
+
}, 16, ["modelValue"])) : (openBlock(), createElementBlock("div", {
|
|
769
|
+
key: 1,
|
|
770
|
+
class: normalizeClass(`tmagic-data-source-input-text el-input el-input--${_ctx.size}`),
|
|
771
|
+
onMouseup: mouseupHandler
|
|
772
|
+
}, [
|
|
773
|
+
createElementVNode("div", {
|
|
774
|
+
class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
775
|
+
}, [
|
|
776
|
+
createElementVNode("div", _hoisted_3$6, [
|
|
777
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
|
|
778
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
779
|
+
item.type === "text" ? (openBlock(), createElementBlock("span", {
|
|
780
|
+
key: index,
|
|
781
|
+
style: { "margin-right": "2px" }
|
|
782
|
+
}, toDisplayString(item.value), 1)) : createCommentVNode("", true),
|
|
783
|
+
item.type === "var" ? (openBlock(), createBlock(unref(TMagicTag), {
|
|
784
|
+
key: index,
|
|
785
|
+
size: _ctx.size
|
|
786
|
+
}, {
|
|
787
|
+
default: withCtx(() => [
|
|
788
|
+
createTextVNode(toDisplayString(item.value), 1)
|
|
789
|
+
]),
|
|
790
|
+
_: 2
|
|
791
|
+
}, 1032, ["size"])) : createCommentVNode("", true)
|
|
792
|
+
], 64);
|
|
793
|
+
}), 256)),
|
|
794
|
+
createVNode(_sfc_main$E, {
|
|
795
|
+
class: "tmagic-data-source-input-icon",
|
|
796
|
+
icon: unref(Coin)
|
|
797
|
+
}, null, 8, ["icon"])
|
|
798
|
+
])
|
|
799
|
+
], 2)
|
|
800
|
+
], 34));
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
806
|
+
...{
|
|
807
|
+
name: "MEditorDataSourceSelect"
|
|
808
|
+
},
|
|
809
|
+
__name: "DataSourceSelect",
|
|
810
|
+
props: {
|
|
811
|
+
config: {},
|
|
812
|
+
model: {},
|
|
813
|
+
name: {},
|
|
814
|
+
prop: {},
|
|
815
|
+
disabled: { type: Boolean, default: false },
|
|
816
|
+
lastValues: {},
|
|
817
|
+
size: {}
|
|
818
|
+
},
|
|
819
|
+
emits: ["change"],
|
|
820
|
+
setup(__props, { emit }) {
|
|
821
|
+
const props = __props;
|
|
822
|
+
const { dataSourceService } = inject("services") || {};
|
|
823
|
+
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
824
|
+
const selectConfig = computed(() => {
|
|
825
|
+
const { type, dataSourceType, ...config } = props.config;
|
|
826
|
+
return {
|
|
827
|
+
...config,
|
|
828
|
+
type: "select",
|
|
829
|
+
valueKey: "dataSourceId",
|
|
830
|
+
options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
|
|
831
|
+
value: {
|
|
832
|
+
isBindDataSource: true,
|
|
833
|
+
dataSourceType: ds.type,
|
|
834
|
+
dataSourceId: ds.id
|
|
835
|
+
},
|
|
836
|
+
text: ds.title || ds.id
|
|
837
|
+
}))
|
|
838
|
+
};
|
|
839
|
+
});
|
|
840
|
+
const changeHandler = (value) => {
|
|
841
|
+
emit("change", value);
|
|
842
|
+
};
|
|
843
|
+
return (_ctx, _cache) => {
|
|
844
|
+
return openBlock(), createBlock(unref(MSelect), {
|
|
845
|
+
model: _ctx.model,
|
|
846
|
+
name: _ctx.name,
|
|
847
|
+
size: _ctx.size,
|
|
848
|
+
prop: _ctx.prop,
|
|
849
|
+
disabled: _ctx.disabled,
|
|
850
|
+
config: selectConfig.value,
|
|
851
|
+
"last-values": _ctx.lastValues,
|
|
852
|
+
onChange: changeHandler
|
|
853
|
+
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
const _hoisted_1$l = { class: "m-fields-event-select" };
|
|
527
859
|
const _hoisted_2$c = {
|
|
528
860
|
key: 1,
|
|
529
861
|
class: "fullWidth"
|
|
530
862
|
};
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
...__default__$r,
|
|
863
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
864
|
+
...{
|
|
865
|
+
name: "MEditorEventSelect"
|
|
866
|
+
},
|
|
867
|
+
__name: "EventSelect",
|
|
537
868
|
props: {
|
|
538
|
-
config:
|
|
539
|
-
model:
|
|
540
|
-
prop:
|
|
541
|
-
name:
|
|
542
|
-
size:
|
|
869
|
+
config: {},
|
|
870
|
+
model: {},
|
|
871
|
+
prop: {},
|
|
872
|
+
name: {},
|
|
873
|
+
size: {}
|
|
543
874
|
},
|
|
544
875
|
emits: ["change"],
|
|
545
876
|
setup(__props, { emit }) {
|
|
@@ -656,6 +987,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
656
987
|
{
|
|
657
988
|
type: "group-list",
|
|
658
989
|
name: "actions",
|
|
990
|
+
expandAll: true,
|
|
659
991
|
enableToggleMode: false,
|
|
660
992
|
items: [actionTypeConfig.value, targetCompConfig.value, compActionConfig.value, codeActionConfig.value]
|
|
661
993
|
}
|
|
@@ -690,14 +1022,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
690
1022
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
691
1023
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
692
1024
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
693
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
694
|
-
|
|
1025
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
1026
|
+
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
695
1027
|
key: 0,
|
|
696
1028
|
ref: "eventForm",
|
|
697
1029
|
size: props.size,
|
|
698
|
-
model:
|
|
1030
|
+
model: _ctx.model,
|
|
699
1031
|
name: "events",
|
|
700
|
-
config:
|
|
1032
|
+
config: tableConfig.value,
|
|
701
1033
|
onChange: onChangeHandler
|
|
702
1034
|
}, null, 8, ["size", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$c, [
|
|
703
1035
|
createVNode(unref(TMagicButton), {
|
|
@@ -707,21 +1039,21 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
707
1039
|
onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
|
|
708
1040
|
}, {
|
|
709
1041
|
default: withCtx(() => [
|
|
710
|
-
|
|
1042
|
+
createTextVNode("添加事件")
|
|
711
1043
|
]),
|
|
712
1044
|
_: 1
|
|
713
1045
|
}),
|
|
714
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
1046
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model[_ctx.name], (cardItem, index) => {
|
|
715
1047
|
return openBlock(), createBlock(_component_m_form_panel, {
|
|
716
1048
|
key: index,
|
|
717
|
-
config:
|
|
1049
|
+
config: actionsConfig.value,
|
|
718
1050
|
model: cardItem,
|
|
719
1051
|
onChange: onChangeHandler
|
|
720
1052
|
}, {
|
|
721
1053
|
header: withCtx(() => [
|
|
722
1054
|
createVNode(_component_m_form_container, {
|
|
723
1055
|
class: "fullWidth",
|
|
724
|
-
config:
|
|
1056
|
+
config: eventNameConfig.value,
|
|
725
1057
|
model: cardItem,
|
|
726
1058
|
onChange: onChangeHandler
|
|
727
1059
|
}, null, 8, ["config", "model"]),
|
|
@@ -741,19 +1073,21 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
741
1073
|
}
|
|
742
1074
|
});
|
|
743
1075
|
|
|
744
|
-
const _hoisted_1$
|
|
1076
|
+
const _hoisted_1$k = { class: "m-fields-key-value" };
|
|
745
1077
|
const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
746
|
-
const
|
|
747
|
-
|
|
1078
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
1079
|
+
...{
|
|
1080
|
+
name: "MEditorKeyValue"
|
|
1081
|
+
},
|
|
748
1082
|
__name: "KeyValue",
|
|
749
1083
|
props: {
|
|
750
|
-
config:
|
|
751
|
-
model:
|
|
752
|
-
name:
|
|
753
|
-
prop:
|
|
1084
|
+
config: {},
|
|
1085
|
+
model: {},
|
|
1086
|
+
name: {},
|
|
1087
|
+
prop: {},
|
|
754
1088
|
disabled: { type: Boolean, default: false },
|
|
755
|
-
lastValues:
|
|
756
|
-
size:
|
|
1089
|
+
lastValues: {},
|
|
1090
|
+
size: {}
|
|
757
1091
|
},
|
|
758
1092
|
emits: ["change"],
|
|
759
1093
|
setup(__props, { emit }) {
|
|
@@ -784,7 +1118,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
784
1118
|
records.value.splice(index, 1);
|
|
785
1119
|
};
|
|
786
1120
|
return (_ctx, _cache) => {
|
|
787
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1121
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
788
1122
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
789
1123
|
return openBlock(), createElementBlock("div", {
|
|
790
1124
|
class: "m-fields-key-value-item",
|
|
@@ -794,8 +1128,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
794
1128
|
placeholder: "key",
|
|
795
1129
|
modelValue: records.value[index][0],
|
|
796
1130
|
"onUpdate:modelValue": ($event) => records.value[index][0] = $event,
|
|
797
|
-
disabled:
|
|
798
|
-
size:
|
|
1131
|
+
disabled: _ctx.disabled,
|
|
1132
|
+
size: _ctx.size,
|
|
799
1133
|
onChange: keyChangeHandler
|
|
800
1134
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
801
1135
|
_hoisted_2$b,
|
|
@@ -803,14 +1137,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
803
1137
|
placeholder: "value",
|
|
804
1138
|
modelValue: records.value[index][1],
|
|
805
1139
|
"onUpdate:modelValue": ($event) => records.value[index][1] = $event,
|
|
806
|
-
disabled:
|
|
807
|
-
size:
|
|
1140
|
+
disabled: _ctx.disabled,
|
|
1141
|
+
size: _ctx.size,
|
|
808
1142
|
onChange: valueChangeHandler
|
|
809
1143
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
810
1144
|
createVNode(unref(TMagicButton), {
|
|
811
1145
|
class: "m-fileds-key-value-delete",
|
|
812
1146
|
type: "danger",
|
|
813
|
-
size:
|
|
1147
|
+
size: _ctx.size,
|
|
814
1148
|
circle: "",
|
|
815
1149
|
plain: "",
|
|
816
1150
|
icon: unref(Delete),
|
|
@@ -820,13 +1154,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
820
1154
|
}), 128)),
|
|
821
1155
|
createVNode(unref(TMagicButton), {
|
|
822
1156
|
type: "primary",
|
|
823
|
-
size:
|
|
1157
|
+
size: _ctx.size,
|
|
824
1158
|
plain: "",
|
|
825
1159
|
icon: unref(Plus),
|
|
826
1160
|
onClick: addHandler
|
|
827
1161
|
}, {
|
|
828
1162
|
default: withCtx(() => [
|
|
829
|
-
|
|
1163
|
+
createTextVNode("添加")
|
|
830
1164
|
]),
|
|
831
1165
|
_: 1
|
|
832
1166
|
}, 8, ["size", "icon"])
|
|
@@ -835,17 +1169,16 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
835
1169
|
}
|
|
836
1170
|
});
|
|
837
1171
|
|
|
838
|
-
const
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
...__default__$q,
|
|
1172
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
1173
|
+
...{
|
|
1174
|
+
name: "MEditorUISelect"
|
|
1175
|
+
},
|
|
1176
|
+
__name: "UISelect",
|
|
844
1177
|
props: {
|
|
845
|
-
config:
|
|
846
|
-
model:
|
|
847
|
-
prop:
|
|
848
|
-
name:
|
|
1178
|
+
config: {},
|
|
1179
|
+
model: {},
|
|
1180
|
+
prop: {},
|
|
1181
|
+
name: {}
|
|
849
1182
|
},
|
|
850
1183
|
emits: ["change"],
|
|
851
1184
|
setup(__props, { emit }) {
|
|
@@ -902,7 +1235,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
902
1235
|
style: { "padding": "0" }
|
|
903
1236
|
}, {
|
|
904
1237
|
default: withCtx(() => [
|
|
905
|
-
|
|
1238
|
+
createTextVNode("取消")
|
|
906
1239
|
]),
|
|
907
1240
|
_: 1
|
|
908
1241
|
}, 8, ["icon"])
|
|
@@ -912,7 +1245,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
912
1245
|
onClick: startSelect,
|
|
913
1246
|
style: { "display": "flex" }
|
|
914
1247
|
}, [
|
|
915
|
-
|
|
1248
|
+
val.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
916
1249
|
key: 0,
|
|
917
1250
|
content: "清除"
|
|
918
1251
|
}, {
|
|
@@ -928,7 +1261,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
928
1261
|
_: 1
|
|
929
1262
|
})) : createCommentVNode("", true),
|
|
930
1263
|
createVNode(unref(TMagicTooltip), {
|
|
931
|
-
content:
|
|
1264
|
+
content: val.value ? toName.value + "_" + val.value : "点击此处选择"
|
|
932
1265
|
}, {
|
|
933
1266
|
default: withCtx(() => [
|
|
934
1267
|
createVNode(unref(TMagicButton), {
|
|
@@ -936,7 +1269,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
936
1269
|
style: { "padding": "0", "margin": "0" }
|
|
937
1270
|
}, {
|
|
938
1271
|
default: withCtx(() => [
|
|
939
|
-
createTextVNode(toDisplayString(
|
|
1272
|
+
createTextVNode(toDisplayString(val.value ? toName.value + "_" + val.value : "点击此处选择"), 1)
|
|
940
1273
|
]),
|
|
941
1274
|
_: 1
|
|
942
1275
|
})
|
|
@@ -950,15 +1283,15 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
950
1283
|
|
|
951
1284
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
952
1285
|
|
|
953
|
-
const
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1286
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
1287
|
+
...{
|
|
1288
|
+
name: "MEditorCodeEditor"
|
|
1289
|
+
},
|
|
1290
|
+
__name: "CodeEditor",
|
|
958
1291
|
props: {
|
|
959
|
-
initValues:
|
|
960
|
-
modifiedValues:
|
|
961
|
-
type:
|
|
1292
|
+
initValues: {},
|
|
1293
|
+
modifiedValues: {},
|
|
1294
|
+
type: {},
|
|
962
1295
|
language: { default: "javascript" },
|
|
963
1296
|
options: { default: () => ({
|
|
964
1297
|
tabSize: 2
|
|
@@ -966,15 +1299,19 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
966
1299
|
autoSave: { type: Boolean, default: true }
|
|
967
1300
|
},
|
|
968
1301
|
emits: ["initd", "save"],
|
|
969
|
-
setup(__props, { expose, emit }) {
|
|
1302
|
+
setup(__props, { expose: __expose, emit }) {
|
|
970
1303
|
const props = __props;
|
|
971
1304
|
const toString = (v, language) => {
|
|
972
1305
|
let value = "";
|
|
973
1306
|
if (typeof v !== "string") {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1307
|
+
if (props.language.toLocaleLowerCase() === "json") {
|
|
1308
|
+
value = JSON.stringify(v, null, 2);
|
|
1309
|
+
} else {
|
|
1310
|
+
value = serialize(v, {
|
|
1311
|
+
space: 2,
|
|
1312
|
+
unsafe: true
|
|
1313
|
+
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1314
|
+
}
|
|
978
1315
|
} else {
|
|
979
1316
|
value = v;
|
|
980
1317
|
}
|
|
@@ -1006,7 +1343,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1006
1343
|
}
|
|
1007
1344
|
return vsEditor?.setValue(values.value);
|
|
1008
1345
|
};
|
|
1009
|
-
const getEditorValue = () => props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue();
|
|
1346
|
+
const getEditorValue = () => (props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue()) || "";
|
|
1010
1347
|
const init = async () => {
|
|
1011
1348
|
if (!codeEditor.value)
|
|
1012
1349
|
return;
|
|
@@ -1028,12 +1365,18 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1028
1365
|
if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
|
|
1029
1366
|
e.preventDefault();
|
|
1030
1367
|
e.stopPropagation();
|
|
1031
|
-
|
|
1368
|
+
const newValue = getEditorValue();
|
|
1369
|
+
values.value = newValue;
|
|
1370
|
+
emit("save", newValue);
|
|
1032
1371
|
}
|
|
1033
1372
|
});
|
|
1034
1373
|
if (props.type !== "diff" && props.autoSave) {
|
|
1035
1374
|
vsEditor?.onDidBlurEditorWidget(() => {
|
|
1036
|
-
|
|
1375
|
+
const newValue = getEditorValue();
|
|
1376
|
+
if (values.value !== newValue) {
|
|
1377
|
+
values.value = newValue;
|
|
1378
|
+
emit("save", newValue);
|
|
1379
|
+
}
|
|
1037
1380
|
});
|
|
1038
1381
|
}
|
|
1039
1382
|
resizeObserver.observe(codeEditor.value);
|
|
@@ -1057,10 +1400,17 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1057
1400
|
onUnmounted(() => {
|
|
1058
1401
|
resizeObserver.disconnect();
|
|
1059
1402
|
});
|
|
1060
|
-
|
|
1403
|
+
__expose({
|
|
1404
|
+
values,
|
|
1061
1405
|
getEditor() {
|
|
1062
1406
|
return vsEditor || vsDiffEditor;
|
|
1063
1407
|
},
|
|
1408
|
+
getVsEditor() {
|
|
1409
|
+
return vsEditor;
|
|
1410
|
+
},
|
|
1411
|
+
getVsDiffEditor() {
|
|
1412
|
+
return vsDiffEditor;
|
|
1413
|
+
},
|
|
1064
1414
|
setEditorValue,
|
|
1065
1415
|
focus() {
|
|
1066
1416
|
vsEditor?.focus();
|
|
@@ -1077,20 +1427,15 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1077
1427
|
}
|
|
1078
1428
|
});
|
|
1079
1429
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
const __default__$o = defineComponent({
|
|
1087
|
-
name: "MEditorResizer"
|
|
1088
|
-
});
|
|
1089
|
-
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
1090
|
-
...__default__$o,
|
|
1430
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
1431
|
+
...{
|
|
1432
|
+
name: "MEditorResizer"
|
|
1433
|
+
},
|
|
1434
|
+
__name: "Resizer",
|
|
1091
1435
|
emits: ["change"],
|
|
1092
1436
|
setup(__props, { emit }) {
|
|
1093
1437
|
const target = ref();
|
|
1438
|
+
const isDraging = ref(false);
|
|
1094
1439
|
let getso;
|
|
1095
1440
|
onMounted(() => {
|
|
1096
1441
|
if (!target.value)
|
|
@@ -1102,37 +1447,42 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1102
1447
|
if (!target.value)
|
|
1103
1448
|
return;
|
|
1104
1449
|
emit("change", e.deltaX);
|
|
1450
|
+
}).on("dragStart", () => {
|
|
1451
|
+
isDraging.value = true;
|
|
1452
|
+
}).on("dragEnd", () => {
|
|
1453
|
+
isDraging.value = false;
|
|
1105
1454
|
});
|
|
1106
1455
|
});
|
|
1107
1456
|
onUnmounted(() => {
|
|
1108
1457
|
getso?.unset();
|
|
1458
|
+
isDraging.value = false;
|
|
1109
1459
|
});
|
|
1110
1460
|
return (_ctx, _cache) => {
|
|
1111
1461
|
return openBlock(), createElementBlock("span", {
|
|
1112
1462
|
ref_key: "target",
|
|
1113
1463
|
ref: target,
|
|
1114
|
-
class: "m-editor-resizer"
|
|
1464
|
+
class: normalizeClass(["m-editor-resizer", { "m-editor-resizer-draging": isDraging.value }])
|
|
1115
1465
|
}, [
|
|
1116
1466
|
renderSlot(_ctx.$slots, "default")
|
|
1117
|
-
],
|
|
1467
|
+
], 2);
|
|
1118
1468
|
};
|
|
1119
1469
|
}
|
|
1120
1470
|
});
|
|
1121
1471
|
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1472
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
1473
|
+
...{
|
|
1474
|
+
name: "MEditorLayout"
|
|
1475
|
+
},
|
|
1476
|
+
__name: "SplitView",
|
|
1127
1477
|
props: {
|
|
1128
|
-
left:
|
|
1129
|
-
right:
|
|
1478
|
+
left: {},
|
|
1479
|
+
right: {},
|
|
1130
1480
|
minLeft: { default: 46 },
|
|
1131
1481
|
minRight: { default: 1 },
|
|
1132
1482
|
minCenter: { default: 5 },
|
|
1133
|
-
leftClass:
|
|
1134
|
-
rightClass:
|
|
1135
|
-
centerClass:
|
|
1483
|
+
leftClass: {},
|
|
1484
|
+
rightClass: {},
|
|
1485
|
+
centerClass: {}
|
|
1136
1486
|
},
|
|
1137
1487
|
emits: ["update:left", "change", "update:right"],
|
|
1138
1488
|
setup(__props, { emit }) {
|
|
@@ -1224,26 +1574,26 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
1224
1574
|
ref: el,
|
|
1225
1575
|
class: "m-editor-layout"
|
|
1226
1576
|
}, [
|
|
1227
|
-
|
|
1577
|
+
hasLeft.value && _ctx.$slots.left ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1228
1578
|
createElementVNode("div", {
|
|
1229
|
-
class: normalizeClass(["m-editor-layout-left",
|
|
1230
|
-
style: normalizeStyle(`width: ${
|
|
1579
|
+
class: normalizeClass(["m-editor-layout-left", _ctx.leftClass]),
|
|
1580
|
+
style: normalizeStyle(`width: ${_ctx.left}px`)
|
|
1231
1581
|
}, [
|
|
1232
1582
|
renderSlot(_ctx.$slots, "left")
|
|
1233
1583
|
], 6),
|
|
1234
|
-
createVNode(_sfc_main$
|
|
1584
|
+
createVNode(_sfc_main$v, { onChange: changeLeft })
|
|
1235
1585
|
], 64)) : createCommentVNode("", true),
|
|
1236
1586
|
createElementVNode("div", {
|
|
1237
|
-
class: normalizeClass(["m-editor-layout-center",
|
|
1587
|
+
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
1238
1588
|
style: normalizeStyle(`width: ${center.value}px`)
|
|
1239
1589
|
}, [
|
|
1240
1590
|
renderSlot(_ctx.$slots, "center")
|
|
1241
1591
|
], 6),
|
|
1242
|
-
|
|
1243
|
-
createVNode(_sfc_main$
|
|
1592
|
+
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1593
|
+
createVNode(_sfc_main$v, { onChange: changeRight }),
|
|
1244
1594
|
createElementVNode("div", {
|
|
1245
|
-
class: normalizeClass(["m-editor-layout-right",
|
|
1246
|
-
style: normalizeStyle(`width: ${
|
|
1595
|
+
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
1596
|
+
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
1247
1597
|
}, [
|
|
1248
1598
|
renderSlot(_ctx.$slots, "right")
|
|
1249
1599
|
], 6)
|
|
@@ -1333,6 +1683,40 @@ const fillConfig$1 = (config = []) => [
|
|
|
1333
1683
|
}
|
|
1334
1684
|
]
|
|
1335
1685
|
},
|
|
1686
|
+
{
|
|
1687
|
+
type: "fieldset",
|
|
1688
|
+
legend: "边框",
|
|
1689
|
+
items: [
|
|
1690
|
+
{
|
|
1691
|
+
name: "borderWidth",
|
|
1692
|
+
text: "宽度",
|
|
1693
|
+
defaultValue: "0"
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
name: "borderColor",
|
|
1697
|
+
text: "颜色",
|
|
1698
|
+
type: "colorPicker"
|
|
1699
|
+
},
|
|
1700
|
+
{
|
|
1701
|
+
name: "borderStyle",
|
|
1702
|
+
text: "样式",
|
|
1703
|
+
type: "select",
|
|
1704
|
+
defaultValue: "none",
|
|
1705
|
+
options: [
|
|
1706
|
+
{ text: "none", value: "none" },
|
|
1707
|
+
{ text: "hidden", value: "hidden" },
|
|
1708
|
+
{ text: "dotted", value: "dotted" },
|
|
1709
|
+
{ text: "dashed", value: "dashed" },
|
|
1710
|
+
{ text: "solid", value: "solid" },
|
|
1711
|
+
{ text: "double", value: "double" },
|
|
1712
|
+
{ text: "groove", value: "groove" },
|
|
1713
|
+
{ text: "ridge", value: "ridge" },
|
|
1714
|
+
{ text: "inset", value: "inset" },
|
|
1715
|
+
{ text: "outset", value: "outset" }
|
|
1716
|
+
]
|
|
1717
|
+
}
|
|
1718
|
+
]
|
|
1719
|
+
},
|
|
1336
1720
|
{
|
|
1337
1721
|
type: "fieldset",
|
|
1338
1722
|
legend: "背景",
|
|
@@ -1492,6 +1876,28 @@ var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
|
1492
1876
|
return CodeDeleteErrorType2;
|
|
1493
1877
|
})(CodeDeleteErrorType || {});
|
|
1494
1878
|
const CODE_DRAFT_STORAGE_KEY = "magicCodeDraft";
|
|
1879
|
+
var KeyBindingCommand = /* @__PURE__ */ ((KeyBindingCommand2) => {
|
|
1880
|
+
KeyBindingCommand2["COPY_NODE"] = "tmagic-system-copy-node";
|
|
1881
|
+
KeyBindingCommand2["PASTE_NODE"] = "tmagic-system-paste-node";
|
|
1882
|
+
KeyBindingCommand2["DELETE_NODE"] = "tmagic-system-delete-node";
|
|
1883
|
+
KeyBindingCommand2["CUT_NODE"] = "tmagic-system-cut-node";
|
|
1884
|
+
KeyBindingCommand2["UNDO"] = "tmagic-system-undo";
|
|
1885
|
+
KeyBindingCommand2["REDO"] = "tmagic-system-redo";
|
|
1886
|
+
KeyBindingCommand2["ZOOM_IN"] = "tmagic-system-zoom-in";
|
|
1887
|
+
KeyBindingCommand2["ZOOM_OUT"] = "tmagic-system-zoom-out";
|
|
1888
|
+
KeyBindingCommand2["ZOOM_RESET"] = "tmagic-system-zoom-reset";
|
|
1889
|
+
KeyBindingCommand2["ZOOM_FIT"] = "tmagic-system-zoom-fit";
|
|
1890
|
+
KeyBindingCommand2["MOVE_UP_1"] = "tmagic-system-move-up-1";
|
|
1891
|
+
KeyBindingCommand2["MOVE_DOWN_1"] = "tmagic-system-move-down-1";
|
|
1892
|
+
KeyBindingCommand2["MOVE_LEFT_1"] = "tmagic-system-move-left-1";
|
|
1893
|
+
KeyBindingCommand2["MOVE_RIGHT_1"] = "tmagic-system-move-right-1";
|
|
1894
|
+
KeyBindingCommand2["MOVE_UP_10"] = "tmagic-system-move-up-10";
|
|
1895
|
+
KeyBindingCommand2["MOVE_DOWN_10"] = "tmagic-system-move-down-10";
|
|
1896
|
+
KeyBindingCommand2["MOVE_LEFT_10"] = "tmagic-system-move-left-10";
|
|
1897
|
+
KeyBindingCommand2["MOVE_RIGHT_10"] = "tmagic-system-move-right-10";
|
|
1898
|
+
KeyBindingCommand2["SWITCH_NODE"] = "tmagic-system-switch-node";
|
|
1899
|
+
return KeyBindingCommand2;
|
|
1900
|
+
})(KeyBindingCommand || {});
|
|
1495
1901
|
|
|
1496
1902
|
const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
1497
1903
|
const getPageList = (app) => {
|
|
@@ -1938,8 +2344,8 @@ class WebStorage extends BaseService {
|
|
|
1938
2344
|
* 清理,支持storageService.usePlugin
|
|
1939
2345
|
*/
|
|
1940
2346
|
async clear() {
|
|
1941
|
-
const
|
|
1942
|
-
|
|
2347
|
+
const storage = await this.getStorage();
|
|
2348
|
+
storage.clear();
|
|
1943
2349
|
}
|
|
1944
2350
|
/**
|
|
1945
2351
|
* 获取存储项,支持storageService.usePlugin
|
|
@@ -1953,7 +2359,7 @@ class WebStorage extends BaseService {
|
|
|
1953
2359
|
return null;
|
|
1954
2360
|
switch (protocol) {
|
|
1955
2361
|
case "object" /* OBJECT */:
|
|
1956
|
-
return
|
|
2362
|
+
return getConfig("parseDSL")(`(${item})`);
|
|
1957
2363
|
case "json" /* JSON */:
|
|
1958
2364
|
return JSON.parse(item);
|
|
1959
2365
|
case "number" /* NUMBER */:
|
|
@@ -1968,49 +2374,49 @@ class WebStorage extends BaseService {
|
|
|
1968
2374
|
* 获取指定索引位置的key
|
|
1969
2375
|
*/
|
|
1970
2376
|
async key(index) {
|
|
1971
|
-
const
|
|
1972
|
-
return
|
|
2377
|
+
const storage = await this.getStorage();
|
|
2378
|
+
return storage.key(index);
|
|
1973
2379
|
}
|
|
1974
2380
|
/**
|
|
1975
2381
|
* 移除存储项,支持storageService.usePlugin
|
|
1976
2382
|
*/
|
|
1977
|
-
async removeItem(
|
|
1978
|
-
const [
|
|
1979
|
-
|
|
2383
|
+
async removeItem(key, options = {}) {
|
|
2384
|
+
const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
2385
|
+
storage.removeItem(`${options.namespace || namespace}:${key}`);
|
|
1980
2386
|
}
|
|
1981
2387
|
/**
|
|
1982
2388
|
* 设置存储项,支持storageService.usePlugin
|
|
1983
2389
|
*/
|
|
1984
|
-
async setItem(
|
|
1985
|
-
const [
|
|
1986
|
-
let
|
|
1987
|
-
const
|
|
2390
|
+
async setItem(key, value, options = {}) {
|
|
2391
|
+
const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
2392
|
+
let item = value;
|
|
2393
|
+
const protocol = options.protocol ? `${options.protocol}:` : "";
|
|
1988
2394
|
if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
|
|
1989
|
-
|
|
2395
|
+
item = `${protocol}${value}`;
|
|
1990
2396
|
} else {
|
|
1991
|
-
|
|
2397
|
+
item = `${protocol}${serialize(value)}`;
|
|
1992
2398
|
}
|
|
1993
|
-
|
|
2399
|
+
storage.setItem(`${options.namespace || namespace}:${key}`, item);
|
|
1994
2400
|
}
|
|
1995
2401
|
destroy() {
|
|
1996
2402
|
this.removeAllListeners();
|
|
1997
2403
|
this.removeAllPlugins();
|
|
1998
2404
|
}
|
|
1999
2405
|
getValueAndProtocol(value) {
|
|
2000
|
-
let
|
|
2406
|
+
let protocol = "";
|
|
2001
2407
|
if (value === null) {
|
|
2002
2408
|
return {
|
|
2003
2409
|
item: value,
|
|
2004
|
-
protocol
|
|
2410
|
+
protocol
|
|
2005
2411
|
};
|
|
2006
2412
|
}
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2413
|
+
const item = value.replace(new RegExp(`^(${Object.values(Protocol).join("|")})(:)(.+)`), (_$0, $1, _$2, $3) => {
|
|
2414
|
+
protocol = $1;
|
|
2009
2415
|
return $3;
|
|
2010
2416
|
});
|
|
2011
2417
|
return {
|
|
2012
|
-
protocol
|
|
2013
|
-
item
|
|
2418
|
+
protocol,
|
|
2419
|
+
item
|
|
2014
2420
|
};
|
|
2015
2421
|
}
|
|
2016
2422
|
}
|
|
@@ -3107,14 +3513,14 @@ const useStage = (stageOptions) => {
|
|
|
3107
3513
|
return stage;
|
|
3108
3514
|
};
|
|
3109
3515
|
|
|
3110
|
-
const _hoisted_1$
|
|
3516
|
+
const _hoisted_1$j = { class: "m-editor-empty-panel" };
|
|
3111
3517
|
const _hoisted_2$a = { class: "m-editor-empty-content" };
|
|
3112
3518
|
const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
3113
|
-
const
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3519
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
3520
|
+
...{
|
|
3521
|
+
name: "MEditorAddPageBox"
|
|
3522
|
+
},
|
|
3523
|
+
__name: "AddPageBox",
|
|
3118
3524
|
setup(__props) {
|
|
3119
3525
|
const services = inject("services");
|
|
3120
3526
|
const clickHandler = () => {
|
|
@@ -3130,14 +3536,14 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
3130
3536
|
});
|
|
3131
3537
|
};
|
|
3132
3538
|
return (_ctx, _cache) => {
|
|
3133
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3539
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
3134
3540
|
createElementVNode("div", _hoisted_2$a, [
|
|
3135
3541
|
createElementVNode("div", {
|
|
3136
3542
|
class: "m-editor-empty-button",
|
|
3137
3543
|
onClick: clickHandler
|
|
3138
3544
|
}, [
|
|
3139
3545
|
createElementVNode("div", null, [
|
|
3140
|
-
createVNode(_sfc_main$
|
|
3546
|
+
createVNode(_sfc_main$E, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
3141
3547
|
]),
|
|
3142
3548
|
_hoisted_3$5
|
|
3143
3549
|
])
|
|
@@ -3147,25 +3553,22 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
3147
3553
|
}
|
|
3148
3554
|
});
|
|
3149
3555
|
|
|
3150
|
-
const _hoisted_1$
|
|
3151
|
-
const
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
const
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3556
|
+
const _hoisted_1$i = { class: "m-editor" };
|
|
3557
|
+
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
3558
|
+
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
3559
|
+
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
3560
|
+
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
3561
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
3562
|
+
...{
|
|
3563
|
+
name: "MEditorFramework"
|
|
3158
3564
|
},
|
|
3565
|
+
__name: "Framework",
|
|
3159
3566
|
setup(__props) {
|
|
3160
|
-
const
|
|
3161
|
-
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
3567
|
+
const codeOptions = inject("codeOptions", {});
|
|
3162
3568
|
const { editorService, uiService } = inject("services") || {};
|
|
3163
3569
|
const root = computed(() => editorService?.get("root"));
|
|
3164
|
-
const nodes = computed(() => editorService?.get("nodes") || []);
|
|
3165
3570
|
const pageLength = computed(() => editorService?.get("pageLength") || 0);
|
|
3166
3571
|
const showSrc = computed(() => uiService?.get("showSrc"));
|
|
3167
|
-
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
3168
|
-
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
3169
3572
|
const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY));
|
|
3170
3573
|
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY));
|
|
3171
3574
|
const columnWidth = ref({
|
|
@@ -3214,22 +3617,25 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
3214
3617
|
};
|
|
3215
3618
|
const saveCode = (value) => {
|
|
3216
3619
|
try {
|
|
3217
|
-
|
|
3620
|
+
const parseDSL = getConfig("parseDSL");
|
|
3621
|
+
editorService?.set("root", parseDSL(value));
|
|
3218
3622
|
} catch (e) {
|
|
3219
3623
|
console.error(e);
|
|
3220
3624
|
}
|
|
3221
3625
|
};
|
|
3222
3626
|
return (_ctx, _cache) => {
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
renderSlot(_ctx.$slots, "nav"
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3627
|
+
return openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
3628
|
+
renderSlot(_ctx.$slots, "header"),
|
|
3629
|
+
renderSlot(_ctx.$slots, "nav"),
|
|
3630
|
+
renderSlot(_ctx.$slots, "content-before"),
|
|
3631
|
+
showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
3632
|
+
createVNode(_sfc_main$w, {
|
|
3633
|
+
class: "m-editor-content",
|
|
3634
|
+
"init-values": root.value,
|
|
3635
|
+
options: unref(codeOptions),
|
|
3636
|
+
onSave: saveCode
|
|
3637
|
+
}, null, 8, ["init-values", "options"])
|
|
3638
|
+
]) : (openBlock(), createBlock(_sfc_main$u, {
|
|
3233
3639
|
key: 1,
|
|
3234
3640
|
class: "m-editor-content",
|
|
3235
3641
|
"left-class": "m-editor-framework-left",
|
|
@@ -3247,13 +3653,13 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
3247
3653
|
renderSlot(_ctx.$slots, "sidebar")
|
|
3248
3654
|
]),
|
|
3249
3655
|
center: withCtx(() => [
|
|
3250
|
-
|
|
3251
|
-
createVNode(_sfc_main$
|
|
3656
|
+
pageLength.value > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
3657
|
+
createVNode(_sfc_main$t)
|
|
3252
3658
|
])
|
|
3253
3659
|
]),
|
|
3254
3660
|
_: 2
|
|
3255
3661
|
}, [
|
|
3256
|
-
|
|
3662
|
+
pageLength.value > 0 ? {
|
|
3257
3663
|
name: "right",
|
|
3258
3664
|
fn: withCtx(() => [
|
|
3259
3665
|
createVNode(unref(TMagicScrollbar), null, {
|
|
@@ -3262,24 +3668,27 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
3262
3668
|
]),
|
|
3263
3669
|
_: 3
|
|
3264
3670
|
})
|
|
3265
|
-
])
|
|
3671
|
+
]),
|
|
3672
|
+
key: "0"
|
|
3266
3673
|
} : void 0
|
|
3267
|
-
]), 1032, ["left", "right"]))
|
|
3674
|
+
]), 1032, ["left", "right"])),
|
|
3675
|
+
renderSlot(_ctx.$slots, "content-after"),
|
|
3676
|
+
renderSlot(_ctx.$slots, "footer")
|
|
3268
3677
|
]);
|
|
3269
3678
|
};
|
|
3270
3679
|
}
|
|
3271
3680
|
});
|
|
3272
3681
|
|
|
3273
|
-
const _hoisted_1$
|
|
3682
|
+
const _hoisted_1$h = {
|
|
3274
3683
|
key: 1,
|
|
3275
3684
|
class: "menu-item-text"
|
|
3276
3685
|
};
|
|
3277
3686
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
3278
|
-
const
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3687
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
3688
|
+
...{
|
|
3689
|
+
name: "MEditorToolButton"
|
|
3690
|
+
},
|
|
3691
|
+
__name: "ToolButton",
|
|
3283
3692
|
props: {
|
|
3284
3693
|
data: { default: () => ({
|
|
3285
3694
|
type: "text",
|
|
@@ -3344,35 +3753,35 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
3344
3753
|
}
|
|
3345
3754
|
};
|
|
3346
3755
|
return (_ctx, _cache) => {
|
|
3347
|
-
return
|
|
3756
|
+
return display.value ? (openBlock(), createElementBlock("div", {
|
|
3348
3757
|
key: 0,
|
|
3349
|
-
class: normalizeClass(["menu-item", `${
|
|
3350
|
-
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(
|
|
3351
|
-
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(
|
|
3352
|
-
onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(
|
|
3758
|
+
class: normalizeClass(["menu-item", `${_ctx.data.type} ${_ctx.data.className || ""}`]),
|
|
3759
|
+
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(_ctx.data, $event)),
|
|
3760
|
+
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(_ctx.data, $event)),
|
|
3761
|
+
onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(_ctx.data, $event))
|
|
3353
3762
|
}, [
|
|
3354
|
-
|
|
3763
|
+
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
3355
3764
|
key: 0,
|
|
3356
|
-
direction:
|
|
3357
|
-
}, null, 8, ["direction"])) :
|
|
3358
|
-
|
|
3765
|
+
direction: _ctx.data.direction || "vertical"
|
|
3766
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$h, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
3767
|
+
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3359
3768
|
key: 0,
|
|
3360
3769
|
effect: "dark",
|
|
3361
3770
|
placement: "bottom-start",
|
|
3362
|
-
content:
|
|
3771
|
+
content: _ctx.data.tooltip
|
|
3363
3772
|
}, {
|
|
3364
3773
|
default: withCtx(() => [
|
|
3365
3774
|
createVNode(unref(TMagicButton), {
|
|
3366
3775
|
size: "small",
|
|
3367
3776
|
text: "",
|
|
3368
|
-
disabled:
|
|
3777
|
+
disabled: disabled.value
|
|
3369
3778
|
}, {
|
|
3370
3779
|
default: withCtx(() => [
|
|
3371
|
-
|
|
3780
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$E, {
|
|
3372
3781
|
key: 0,
|
|
3373
|
-
icon:
|
|
3782
|
+
icon: _ctx.data.icon
|
|
3374
3783
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
3375
|
-
createElementVNode("span", null, toDisplayString(
|
|
3784
|
+
createElementVNode("span", null, toDisplayString(_ctx.data.text), 1)
|
|
3376
3785
|
]),
|
|
3377
3786
|
_: 1
|
|
3378
3787
|
}, 8, ["disabled"])
|
|
@@ -3382,30 +3791,30 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
3382
3791
|
key: 1,
|
|
3383
3792
|
size: "small",
|
|
3384
3793
|
text: "",
|
|
3385
|
-
disabled:
|
|
3794
|
+
disabled: disabled.value
|
|
3386
3795
|
}, {
|
|
3387
3796
|
default: withCtx(() => [
|
|
3388
|
-
|
|
3797
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$E, {
|
|
3389
3798
|
key: 0,
|
|
3390
|
-
icon:
|
|
3799
|
+
icon: _ctx.data.icon
|
|
3391
3800
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
3392
|
-
createElementVNode("span", null, toDisplayString(
|
|
3801
|
+
createElementVNode("span", null, toDisplayString(_ctx.data.text), 1)
|
|
3393
3802
|
]),
|
|
3394
3803
|
_: 1
|
|
3395
3804
|
}, 8, ["disabled"]))
|
|
3396
|
-
], 64)) :
|
|
3805
|
+
], 64)) : _ctx.data.type === "dropdown" ? (openBlock(), createBlock(unref(TMagicDropdown), {
|
|
3397
3806
|
key: 3,
|
|
3398
3807
|
trigger: "click",
|
|
3399
|
-
disabled:
|
|
3808
|
+
disabled: disabled.value,
|
|
3400
3809
|
onCommand: dropdownHandler
|
|
3401
3810
|
}, {
|
|
3402
3811
|
dropdown: withCtx(() => [
|
|
3403
|
-
|
|
3812
|
+
_ctx.data.items && _ctx.data.items.length ? (openBlock(), createBlock(unref(TMagicDropdownMenu), { key: 0 }, {
|
|
3404
3813
|
default: withCtx(() => [
|
|
3405
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
3814
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (subItem, index) => {
|
|
3406
3815
|
return openBlock(), createBlock(unref(TMagicDropdownItem), {
|
|
3407
3816
|
key: index,
|
|
3408
|
-
command: { data:
|
|
3817
|
+
command: { data: _ctx.data, subItem }
|
|
3409
3818
|
}, {
|
|
3410
3819
|
default: withCtx(() => [
|
|
3411
3820
|
createTextVNode(toDisplayString(subItem.text), 1)
|
|
@@ -3419,7 +3828,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
3419
3828
|
]),
|
|
3420
3829
|
default: withCtx(() => [
|
|
3421
3830
|
createElementVNode("span", _hoisted_2$9, [
|
|
3422
|
-
createTextVNode(toDisplayString(
|
|
3831
|
+
createTextVNode(toDisplayString(_ctx.data.text), 1),
|
|
3423
3832
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
3424
3833
|
default: withCtx(() => [
|
|
3425
3834
|
createVNode(unref(ArrowDown))
|
|
@@ -3429,17 +3838,17 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
3429
3838
|
])
|
|
3430
3839
|
]),
|
|
3431
3840
|
_: 1
|
|
3432
|
-
}, 8, ["disabled"])) :
|
|
3841
|
+
}, 8, ["disabled"])) : _ctx.data.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.data.component), normalizeProps(mergeProps({ key: 4 }, _ctx.data.props || {})), null, 16)) : createCommentVNode("", true)
|
|
3433
3842
|
], 34)) : createCommentVNode("", true);
|
|
3434
3843
|
};
|
|
3435
3844
|
}
|
|
3436
3845
|
});
|
|
3437
3846
|
|
|
3438
|
-
const
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3847
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
3848
|
+
...{
|
|
3849
|
+
name: "MEditorNavMenu"
|
|
3850
|
+
},
|
|
3851
|
+
__name: "NavMenu",
|
|
3443
3852
|
props: {
|
|
3444
3853
|
data: { default: () => ({}) },
|
|
3445
3854
|
height: { default: 35 }
|
|
@@ -3588,16 +3997,16 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
3588
3997
|
return (_ctx, _cache) => {
|
|
3589
3998
|
return openBlock(), createElementBlock("div", {
|
|
3590
3999
|
class: "m-editor-nav-menu",
|
|
3591
|
-
style: normalizeStyle({ height: `${
|
|
4000
|
+
style: normalizeStyle({ height: `${_ctx.height}px` })
|
|
3592
4001
|
}, [
|
|
3593
4002
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(keys), (key) => {
|
|
3594
4003
|
return openBlock(), createElementBlock("div", {
|
|
3595
4004
|
class: normalizeClass(`menu-${key}`),
|
|
3596
4005
|
key,
|
|
3597
|
-
style: normalizeStyle(`width: ${
|
|
4006
|
+
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
3598
4007
|
}, [
|
|
3599
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
3600
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4008
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
4009
|
+
return openBlock(), createBlock(_sfc_main$r, {
|
|
3601
4010
|
data: item,
|
|
3602
4011
|
key: index
|
|
3603
4012
|
}, null, 8, ["data"]);
|
|
@@ -3609,20 +4018,24 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
3609
4018
|
}
|
|
3610
4019
|
});
|
|
3611
4020
|
|
|
3612
|
-
const _hoisted_1$
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
4021
|
+
const _hoisted_1$g = { class: "m-editor-props-panel" };
|
|
4022
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
4023
|
+
...{
|
|
4024
|
+
name: "MEditorPropsPanel"
|
|
4025
|
+
},
|
|
4026
|
+
__name: "PropsPanel",
|
|
4027
|
+
props: {
|
|
4028
|
+
extendState: { type: Function }
|
|
4029
|
+
},
|
|
3618
4030
|
emits: ["mounted"],
|
|
3619
|
-
setup(__props, { expose, emit }) {
|
|
4031
|
+
setup(__props, { expose: __expose, emit }) {
|
|
3620
4032
|
const internalInstance = getCurrentInstance();
|
|
3621
4033
|
const values = ref({});
|
|
3622
4034
|
const configForm = ref();
|
|
3623
4035
|
const curFormConfig = ref([]);
|
|
3624
4036
|
const services = inject("services");
|
|
3625
4037
|
const node = computed(() => services?.editorService.get("node"));
|
|
4038
|
+
const nodes = computed(() => services?.editorService.get("nodes") || []);
|
|
3626
4039
|
const propsPanelSize = computed(() => services?.uiService.get("propsPanelSize") || "small");
|
|
3627
4040
|
const stage = computed(() => services?.editorService.get("stage"));
|
|
3628
4041
|
const init = async () => {
|
|
@@ -3657,26 +4070,32 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
3657
4070
|
tMagicMessage.error(e.message);
|
|
3658
4071
|
}
|
|
3659
4072
|
};
|
|
3660
|
-
|
|
4073
|
+
__expose({ configForm, submit });
|
|
3661
4074
|
return (_ctx, _cache) => {
|
|
3662
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4075
|
+
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
3663
4076
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3664
4077
|
createVNode(unref(MForm), {
|
|
3665
4078
|
ref_key: "configForm",
|
|
3666
4079
|
ref: configForm,
|
|
3667
|
-
class: normalizeClass(`m-editor-props-panel ${
|
|
3668
|
-
"popper-class": `m-editor-props-panel-popper ${
|
|
3669
|
-
size:
|
|
4080
|
+
class: normalizeClass(`m-editor-props-panel ${propsPanelSize.value}`),
|
|
4081
|
+
"popper-class": `m-editor-props-panel-popper ${propsPanelSize.value}`,
|
|
4082
|
+
size: propsPanelSize.value,
|
|
3670
4083
|
"init-values": values.value,
|
|
3671
4084
|
config: curFormConfig.value,
|
|
4085
|
+
"extend-state": _ctx.extendState,
|
|
3672
4086
|
onChange: submit
|
|
3673
|
-
}, null, 8, ["class", "popper-class", "size", "init-values", "config"])
|
|
4087
|
+
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"])
|
|
4088
|
+
], 512)), [
|
|
4089
|
+
[vShow, nodes.value.length === 1]
|
|
3674
4090
|
]);
|
|
3675
4091
|
};
|
|
3676
4092
|
}
|
|
3677
4093
|
});
|
|
3678
4094
|
|
|
3679
|
-
const _sfc_main$
|
|
4095
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
4096
|
+
...{
|
|
4097
|
+
name: "MEditorSearchInput"
|
|
4098
|
+
},
|
|
3680
4099
|
__name: "SearchInput",
|
|
3681
4100
|
emits: ["search"],
|
|
3682
4101
|
setup(__props, { emit }) {
|
|
@@ -3708,80 +4127,77 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
3708
4127
|
}
|
|
3709
4128
|
});
|
|
3710
4129
|
|
|
3711
|
-
const
|
|
3712
|
-
|
|
3713
|
-
for (const [key, val] of props) {
|
|
3714
|
-
target[key] = val;
|
|
3715
|
-
}
|
|
3716
|
-
return target;
|
|
3717
|
-
};
|
|
3718
|
-
|
|
3719
|
-
const _sfc_main$l = {};
|
|
3720
|
-
|
|
3721
|
-
const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
|
|
3722
|
-
const _hoisted_2$8 = /*#__PURE__*/createElementVNode("g", {
|
|
4130
|
+
const _hoisted_1$f = { xmlns: "http://www.w3.org/2000/svg" };
|
|
4131
|
+
const _hoisted_2$8 = /* @__PURE__ */ createElementVNode("g", {
|
|
3723
4132
|
fill: "#7C878E",
|
|
3724
4133
|
"fill-rule": "evenodd"
|
|
3725
4134
|
}, [
|
|
3726
|
-
|
|
4135
|
+
/* @__PURE__ */ createElementVNode("path", {
|
|
3727
4136
|
d: "M15.3,5.5 L8,0 L0.7,5.5 L8,11 L15.3,5.5 Z M8,2.5 L12,5.5 L8,8.5 L4,5.5 L8,2.5 Z",
|
|
3728
4137
|
"fill-rule": "nonzero"
|
|
3729
4138
|
}),
|
|
3730
|
-
|
|
4139
|
+
/* @__PURE__ */ createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
3731
4140
|
], -1);
|
|
3732
4141
|
const _hoisted_3$4 = [
|
|
3733
4142
|
_hoisted_2$8
|
|
3734
4143
|
];
|
|
4144
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
4145
|
+
...{
|
|
4146
|
+
name: "MEditorAppManageIcon"
|
|
4147
|
+
},
|
|
4148
|
+
__name: "AppManageIcon",
|
|
4149
|
+
setup(__props) {
|
|
4150
|
+
return (_ctx, _cache) => {
|
|
4151
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$f, _hoisted_3$4);
|
|
4152
|
+
};
|
|
4153
|
+
}
|
|
4154
|
+
});
|
|
3735
4155
|
|
|
3736
|
-
|
|
3737
|
-
return (openBlock(), createElementBlock("svg", _hoisted_1$d, _hoisted_3$4))
|
|
3738
|
-
}
|
|
3739
|
-
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$l, [['render',_sfc_render$2]]);
|
|
3740
|
-
|
|
3741
|
-
const _sfc_main$k = {};
|
|
3742
|
-
|
|
3743
|
-
const _hoisted_1$c = {
|
|
4156
|
+
const _hoisted_1$e = {
|
|
3744
4157
|
viewBox: "0 0 32 32",
|
|
3745
4158
|
version: "1.1",
|
|
3746
4159
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3747
4160
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3748
4161
|
};
|
|
3749
|
-
const _hoisted_2$7 =
|
|
4162
|
+
const _hoisted_2$7 = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
|
|
3750
4163
|
const _hoisted_4$4 = [
|
|
3751
4164
|
_hoisted_2$7
|
|
3752
4165
|
];
|
|
4166
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
4167
|
+
...{
|
|
4168
|
+
name: "MEditorCodeIcon"
|
|
4169
|
+
},
|
|
4170
|
+
__name: "CodeIcon",
|
|
4171
|
+
setup(__props) {
|
|
4172
|
+
return (_ctx, _cache) => {
|
|
4173
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$e, _hoisted_4$4);
|
|
4174
|
+
};
|
|
4175
|
+
}
|
|
4176
|
+
});
|
|
3753
4177
|
|
|
3754
|
-
|
|
3755
|
-
return (openBlock(), createElementBlock("svg", _hoisted_1$c, _hoisted_4$4))
|
|
3756
|
-
}
|
|
3757
|
-
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$k, [['render',_sfc_render$1]]);
|
|
3758
|
-
|
|
3759
|
-
const _hoisted_1$b = {
|
|
4178
|
+
const _hoisted_1$d = {
|
|
3760
4179
|
key: 0,
|
|
3761
4180
|
class: "m-editor-content-bottom"
|
|
3762
4181
|
};
|
|
3763
|
-
const _hoisted_2$6 =
|
|
3764
|
-
const _hoisted_3$3 = /* @__PURE__ */ createTextVNode("关闭");
|
|
3765
|
-
const _hoisted_4$3 = {
|
|
4182
|
+
const _hoisted_2$6 = {
|
|
3766
4183
|
key: 1,
|
|
3767
4184
|
class: "m-editor-content-bottom"
|
|
3768
4185
|
};
|
|
3769
|
-
const
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
}
|
|
3773
|
-
|
|
3774
|
-
...__default__$h,
|
|
4186
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
4187
|
+
...{
|
|
4188
|
+
name: "MEditorCodeDraftEditor"
|
|
4189
|
+
},
|
|
4190
|
+
__name: "CodeDraftEditor",
|
|
3775
4191
|
props: {
|
|
3776
|
-
id:
|
|
3777
|
-
content:
|
|
4192
|
+
id: {},
|
|
4193
|
+
content: {},
|
|
3778
4194
|
editable: { type: Boolean, default: true },
|
|
3779
4195
|
autoSaveDraft: { type: Boolean, default: true },
|
|
3780
|
-
codeOptions:
|
|
3781
|
-
language:
|
|
4196
|
+
codeOptions: {},
|
|
4197
|
+
language: {}
|
|
3782
4198
|
},
|
|
3783
4199
|
emits: ["close", "saveAndClose"],
|
|
3784
|
-
setup(__props, { expose, emit }) {
|
|
4200
|
+
setup(__props, { expose: __expose, emit }) {
|
|
3785
4201
|
const props = __props;
|
|
3786
4202
|
const services = inject("services");
|
|
3787
4203
|
const codeContent = ref("");
|
|
@@ -3846,7 +4262,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3846
4262
|
codeEditor.value.focus();
|
|
3847
4263
|
}
|
|
3848
4264
|
};
|
|
3849
|
-
|
|
4265
|
+
__expose({
|
|
3850
4266
|
saveAndClose,
|
|
3851
4267
|
close
|
|
3852
4268
|
});
|
|
@@ -3854,16 +4270,16 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3854
4270
|
return openBlock(), createElementBlock("div", {
|
|
3855
4271
|
class: normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3856
4272
|
}, [
|
|
3857
|
-
createVNode(_sfc_main$
|
|
4273
|
+
createVNode(_sfc_main$w, {
|
|
3858
4274
|
ref_key: "codeEditor",
|
|
3859
4275
|
ref: codeEditor,
|
|
3860
4276
|
class: "m-editor-container",
|
|
3861
4277
|
"init-values": `${codeContent.value}`,
|
|
3862
4278
|
onSave: saveCodeDraft,
|
|
3863
|
-
language:
|
|
3864
|
-
options:
|
|
4279
|
+
language: _ctx.language,
|
|
4280
|
+
options: codeOptions.value
|
|
3865
4281
|
}, null, 8, ["init-values", "language", "options"]),
|
|
3866
|
-
|
|
4282
|
+
_ctx.editable ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
3867
4283
|
createVNode(unref(TMagicButton), {
|
|
3868
4284
|
type: "primary",
|
|
3869
4285
|
class: "button",
|
|
@@ -3880,7 +4296,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3880
4296
|
onClick: saveAndClose
|
|
3881
4297
|
}, {
|
|
3882
4298
|
default: withCtx(() => [
|
|
3883
|
-
|
|
4299
|
+
createTextVNode("确认")
|
|
3884
4300
|
]),
|
|
3885
4301
|
_: 1
|
|
3886
4302
|
}),
|
|
@@ -3889,11 +4305,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3889
4305
|
onClick: close
|
|
3890
4306
|
}, {
|
|
3891
4307
|
default: withCtx(() => [
|
|
3892
|
-
|
|
4308
|
+
createTextVNode("关闭")
|
|
3893
4309
|
]),
|
|
3894
4310
|
_: 1
|
|
3895
4311
|
})
|
|
3896
|
-
])) : (openBlock(), createElementBlock("div",
|
|
4312
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_2$6, [
|
|
3897
4313
|
createVNode(unref(TMagicButton), {
|
|
3898
4314
|
type: "primary",
|
|
3899
4315
|
class: "button",
|
|
@@ -3909,7 +4325,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3909
4325
|
onClick: close
|
|
3910
4326
|
}, {
|
|
3911
4327
|
default: withCtx(() => [
|
|
3912
|
-
|
|
4328
|
+
createTextVNode("关闭")
|
|
3913
4329
|
]),
|
|
3914
4330
|
_: 1
|
|
3915
4331
|
})
|
|
@@ -3919,26 +4335,27 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3919
4335
|
}
|
|
3920
4336
|
});
|
|
3921
4337
|
|
|
3922
|
-
const _hoisted_1$
|
|
4338
|
+
const _hoisted_1$c = { class: "code-name-wrapper" };
|
|
3923
4339
|
const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
3924
|
-
const _hoisted_3$
|
|
3925
|
-
const _hoisted_4$
|
|
3926
|
-
const
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
4340
|
+
const _hoisted_3$3 = { class: "code-name-wrapper" };
|
|
4341
|
+
const _hoisted_4$3 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
4342
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
4343
|
+
...{
|
|
4344
|
+
name: "MEditorFunctionEditor"
|
|
4345
|
+
},
|
|
4346
|
+
__name: "FunctionEditor",
|
|
3931
4347
|
props: {
|
|
3932
|
-
id:
|
|
3933
|
-
name:
|
|
3934
|
-
content:
|
|
4348
|
+
id: {},
|
|
4349
|
+
name: {},
|
|
4350
|
+
content: {},
|
|
3935
4351
|
editable: { type: Boolean, default: true },
|
|
3936
4352
|
autoSaveDraft: { type: Boolean, default: true },
|
|
3937
|
-
codeOptions:
|
|
3938
|
-
paramsColConfig:
|
|
4353
|
+
codeOptions: {},
|
|
4354
|
+
paramsColConfig: {}
|
|
3939
4355
|
},
|
|
3940
|
-
setup(__props, { expose }) {
|
|
4356
|
+
setup(__props, { expose: __expose }) {
|
|
3941
4357
|
const props = __props;
|
|
4358
|
+
provide("mForm", null);
|
|
3942
4359
|
const defaultParamColConfig = {
|
|
3943
4360
|
type: "row",
|
|
3944
4361
|
label: "参数类型",
|
|
@@ -4007,29 +4424,29 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
4007
4424
|
initTableModel();
|
|
4008
4425
|
const beforeSave = (codeValue) => {
|
|
4009
4426
|
try {
|
|
4010
|
-
|
|
4427
|
+
getConfig("parseDSL")(codeValue);
|
|
4011
4428
|
return true;
|
|
4012
4429
|
} catch (e) {
|
|
4013
4430
|
tMagicMessage.error(e.stack);
|
|
4014
4431
|
return false;
|
|
4015
4432
|
}
|
|
4016
4433
|
};
|
|
4017
|
-
const saveCode = async (
|
|
4434
|
+
const saveCode = async (codeValue) => {
|
|
4018
4435
|
if (!props.editable)
|
|
4019
4436
|
return;
|
|
4020
|
-
evalRes.value = beforeSave(
|
|
4437
|
+
evalRes.value = beforeSave(codeValue);
|
|
4021
4438
|
if (evalRes.value) {
|
|
4022
4439
|
await services?.codeBlockService.setCodeDslById(props.id, {
|
|
4023
4440
|
name: codeName.value,
|
|
4024
|
-
content:
|
|
4441
|
+
content: codeValue,
|
|
4025
4442
|
params: tableModel.value?.params || []
|
|
4026
4443
|
});
|
|
4027
4444
|
tMagicMessage.success("代码成功保存到本地");
|
|
4028
4445
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
4029
4446
|
}
|
|
4030
4447
|
};
|
|
4031
|
-
const saveAndClose = async (
|
|
4032
|
-
await saveCode(
|
|
4448
|
+
const saveAndClose = async (codeValue) => {
|
|
4449
|
+
await saveCode(codeValue);
|
|
4033
4450
|
if (evalRes.value) {
|
|
4034
4451
|
close();
|
|
4035
4452
|
}
|
|
@@ -4038,24 +4455,24 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
4038
4455
|
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
4039
4456
|
};
|
|
4040
4457
|
const codeDraftEditor = ref();
|
|
4041
|
-
|
|
4458
|
+
__expose({
|
|
4042
4459
|
codeDraftEditor
|
|
4043
4460
|
});
|
|
4044
4461
|
return (_ctx, _cache) => {
|
|
4045
4462
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
4046
4463
|
return openBlock(), createBlock(unref(TMagicCard), { shadow: "never" }, {
|
|
4047
4464
|
header: withCtx(() => [
|
|
4048
|
-
createElementVNode("div", _hoisted_1$
|
|
4465
|
+
createElementVNode("div", _hoisted_1$c, [
|
|
4049
4466
|
_hoisted_2$5,
|
|
4050
4467
|
createVNode(unref(TMagicInput), {
|
|
4051
4468
|
class: "code-name-input",
|
|
4052
4469
|
modelValue: codeName.value,
|
|
4053
4470
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeName.value = $event),
|
|
4054
|
-
disabled: !
|
|
4471
|
+
disabled: !_ctx.editable
|
|
4055
4472
|
}, null, 8, ["modelValue", "disabled"])
|
|
4056
4473
|
]),
|
|
4057
|
-
createElementVNode("div", _hoisted_3$
|
|
4058
|
-
_hoisted_4$
|
|
4474
|
+
createElementVNode("div", _hoisted_3$3, [
|
|
4475
|
+
_hoisted_4$3,
|
|
4059
4476
|
createVNode(_component_m_form_table, {
|
|
4060
4477
|
style: { "width": "800px" },
|
|
4061
4478
|
config: tableConfig,
|
|
@@ -4068,14 +4485,14 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
4068
4485
|
])
|
|
4069
4486
|
]),
|
|
4070
4487
|
default: withCtx(() => [
|
|
4071
|
-
createVNode(_sfc_main$
|
|
4488
|
+
createVNode(_sfc_main$l, {
|
|
4072
4489
|
ref_key: "codeDraftEditor",
|
|
4073
4490
|
ref: codeDraftEditor,
|
|
4074
|
-
id:
|
|
4491
|
+
id: _ctx.id,
|
|
4075
4492
|
content: codeContent.value,
|
|
4076
|
-
editable:
|
|
4077
|
-
autoSaveDraft:
|
|
4078
|
-
codeOptions:
|
|
4493
|
+
editable: _ctx.editable,
|
|
4494
|
+
autoSaveDraft: _ctx.autoSaveDraft,
|
|
4495
|
+
codeOptions: _ctx.codeOptions,
|
|
4079
4496
|
language: "javascript",
|
|
4080
4497
|
onSaveAndClose: saveAndClose,
|
|
4081
4498
|
onClose: close
|
|
@@ -4087,17 +4504,17 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
4087
4504
|
}
|
|
4088
4505
|
});
|
|
4089
4506
|
|
|
4090
|
-
const _hoisted_1$
|
|
4507
|
+
const _hoisted_1$b = {
|
|
4091
4508
|
key: 0,
|
|
4092
4509
|
class: "m-editor-code-block-editor-panel"
|
|
4093
4510
|
};
|
|
4094
|
-
const
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4511
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
4512
|
+
...{
|
|
4513
|
+
name: "MEditorCodeBlockEditor"
|
|
4514
|
+
},
|
|
4515
|
+
__name: "CodeBlockEditor",
|
|
4099
4516
|
props: {
|
|
4100
|
-
paramsColConfig:
|
|
4517
|
+
paramsColConfig: {}
|
|
4101
4518
|
},
|
|
4102
4519
|
setup(__props) {
|
|
4103
4520
|
const services = inject("services");
|
|
@@ -4144,28 +4561,28 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
4144
4561
|
"append-to-body": true,
|
|
4145
4562
|
"show-close": false,
|
|
4146
4563
|
"close-on-click-modal": true,
|
|
4147
|
-
size:
|
|
4564
|
+
size: size.value,
|
|
4148
4565
|
"before-close": handleClose
|
|
4149
4566
|
}, {
|
|
4150
4567
|
default: withCtx(() => [
|
|
4151
|
-
createVNode(_sfc_main$
|
|
4568
|
+
createVNode(_sfc_main$u, {
|
|
4152
4569
|
left: left.value,
|
|
4153
4570
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
4154
4571
|
"min-left": 45,
|
|
4155
4572
|
class: "code-editor-layout"
|
|
4156
4573
|
}, {
|
|
4157
4574
|
center: withCtx(() => [
|
|
4158
|
-
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
4159
|
-
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id:
|
|
4160
|
-
codeConfig.value ? (openBlock(), createBlock(_sfc_main$
|
|
4575
|
+
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
4576
|
+
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: id.value }),
|
|
4577
|
+
codeConfig.value ? (openBlock(), createBlock(_sfc_main$k, {
|
|
4161
4578
|
key: 0,
|
|
4162
4579
|
ref_key: "functionEditor",
|
|
4163
4580
|
ref: functionEditor,
|
|
4164
|
-
id:
|
|
4581
|
+
id: id.value,
|
|
4165
4582
|
name: codeConfig.value.name,
|
|
4166
4583
|
content: codeConfig.value.content,
|
|
4167
|
-
paramsColConfig:
|
|
4168
|
-
editable: !!
|
|
4584
|
+
paramsColConfig: _ctx.paramsColConfig,
|
|
4585
|
+
editable: !!editable.value,
|
|
4169
4586
|
autoSaveDraft: true,
|
|
4170
4587
|
codeOptions: unref(codeOptions)
|
|
4171
4588
|
}, null, 8, ["id", "name", "content", "paramsColConfig", "editable", "codeOptions"])) : createCommentVNode("", true)
|
|
@@ -4180,22 +4597,21 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
4180
4597
|
}
|
|
4181
4598
|
});
|
|
4182
4599
|
|
|
4183
|
-
const _hoisted_1$
|
|
4184
|
-
const _hoisted_2$4 =
|
|
4185
|
-
const _hoisted_3$
|
|
4186
|
-
const _hoisted_4$
|
|
4187
|
-
const _hoisted_5$1 = {
|
|
4600
|
+
const _hoisted_1$a = { class: "search-wrapper" };
|
|
4601
|
+
const _hoisted_2$4 = ["id"];
|
|
4602
|
+
const _hoisted_3$2 = { class: "list-item" };
|
|
4603
|
+
const _hoisted_4$2 = {
|
|
4188
4604
|
key: 2,
|
|
4189
4605
|
class: "right-tool"
|
|
4190
4606
|
};
|
|
4191
|
-
const
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4607
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
4608
|
+
...{
|
|
4609
|
+
name: "MEditorCodeBlockList"
|
|
4610
|
+
},
|
|
4611
|
+
__name: "CodeBlockList",
|
|
4196
4612
|
props: {
|
|
4197
|
-
customError:
|
|
4198
|
-
paramsColConfig:
|
|
4613
|
+
customError: { type: Function },
|
|
4614
|
+
paramsColConfig: {}
|
|
4199
4615
|
},
|
|
4200
4616
|
setup(__props) {
|
|
4201
4617
|
const props = __props;
|
|
@@ -4284,9 +4700,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
4284
4700
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
4285
4701
|
default: withCtx(() => [
|
|
4286
4702
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
4287
|
-
createElementVNode("div", _hoisted_1$
|
|
4288
|
-
createVNode(_sfc_main$
|
|
4289
|
-
|
|
4703
|
+
createElementVNode("div", _hoisted_1$a, [
|
|
4704
|
+
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
4705
|
+
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4290
4706
|
key: 0,
|
|
4291
4707
|
class: "create-code-button",
|
|
4292
4708
|
type: "primary",
|
|
@@ -4294,7 +4710,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
4294
4710
|
onClick: createCodeBlock
|
|
4295
4711
|
}, {
|
|
4296
4712
|
default: withCtx(() => [
|
|
4297
|
-
|
|
4713
|
+
createTextVNode("新增")
|
|
4298
4714
|
]),
|
|
4299
4715
|
_: 1
|
|
4300
4716
|
})) : createCommentVNode("", true)
|
|
@@ -4306,9 +4722,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
4306
4722
|
class: "magic-editor-layer-tree",
|
|
4307
4723
|
"node-key": "id",
|
|
4308
4724
|
"empty-text": "暂无代码块",
|
|
4309
|
-
"default-expanded-keys":
|
|
4725
|
+
"default-expanded-keys": expandedKeys.value,
|
|
4310
4726
|
"expand-on-click-node": false,
|
|
4311
|
-
data:
|
|
4727
|
+
data: codeList.value,
|
|
4312
4728
|
props: treeProps,
|
|
4313
4729
|
"highlight-current": true,
|
|
4314
4730
|
"filter-node-method": filterNode,
|
|
@@ -4319,41 +4735,41 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
4319
4735
|
id: data.id,
|
|
4320
4736
|
class: "list-container"
|
|
4321
4737
|
}, [
|
|
4322
|
-
createElementVNode("div",
|
|
4323
|
-
data.type === "code" ? (openBlock(), createBlock(
|
|
4738
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
4739
|
+
data.type === "code" ? (openBlock(), createBlock(_sfc_main$m, {
|
|
4324
4740
|
key: 0,
|
|
4325
4741
|
class: "codeIcon"
|
|
4326
4742
|
})) : createCommentVNode("", true),
|
|
4327
|
-
data.type === "node" ? (openBlock(), createBlock(
|
|
4743
|
+
data.type === "node" ? (openBlock(), createBlock(_sfc_main$n, {
|
|
4328
4744
|
key: 1,
|
|
4329
4745
|
class: "compIcon"
|
|
4330
4746
|
})) : createCommentVNode("", true),
|
|
4331
4747
|
createElementVNode("span", {
|
|
4332
4748
|
class: normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4333
4749
|
}, toDisplayString(data.name) + " (" + toDisplayString(data.id) + ")", 3),
|
|
4334
|
-
data.type === "code" ? (openBlock(), createElementBlock("div",
|
|
4750
|
+
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
|
|
4335
4751
|
createVNode(unref(TMagicTooltip), {
|
|
4336
4752
|
effect: "dark",
|
|
4337
|
-
content:
|
|
4753
|
+
content: editable.value ? "编辑" : "查看",
|
|
4338
4754
|
placement: "bottom"
|
|
4339
4755
|
}, {
|
|
4340
4756
|
default: withCtx(() => [
|
|
4341
|
-
createVNode(_sfc_main$
|
|
4342
|
-
icon:
|
|
4757
|
+
createVNode(_sfc_main$E, {
|
|
4758
|
+
icon: editable.value ? unref(Edit) : unref(View),
|
|
4343
4759
|
class: "edit-icon",
|
|
4344
4760
|
onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
4345
4761
|
}, null, 8, ["icon", "onClick"])
|
|
4346
4762
|
]),
|
|
4347
4763
|
_: 2
|
|
4348
4764
|
}, 1032, ["content"]),
|
|
4349
|
-
|
|
4765
|
+
editable.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
4350
4766
|
key: 0,
|
|
4351
4767
|
effect: "dark",
|
|
4352
4768
|
content: "删除",
|
|
4353
4769
|
placement: "bottom"
|
|
4354
4770
|
}, {
|
|
4355
4771
|
default: withCtx(() => [
|
|
4356
|
-
createVNode(_sfc_main$
|
|
4772
|
+
createVNode(_sfc_main$E, {
|
|
4357
4773
|
icon: unref(Close),
|
|
4358
4774
|
class: "edit-icon",
|
|
4359
4775
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -4367,13 +4783,13 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
4367
4783
|
})
|
|
4368
4784
|
])) : createCommentVNode("", true)
|
|
4369
4785
|
])
|
|
4370
|
-
], 8,
|
|
4786
|
+
], 8, _hoisted_2$4)
|
|
4371
4787
|
]),
|
|
4372
4788
|
_: 3
|
|
4373
4789
|
}, 8, ["default-expanded-keys", "data"]),
|
|
4374
|
-
|
|
4790
|
+
isShowCodeBlockEditor.value ? (openBlock(), createBlock(_sfc_main$j, {
|
|
4375
4791
|
key: 0,
|
|
4376
|
-
paramsColConfig:
|
|
4792
|
+
paramsColConfig: _ctx.paramsColConfig
|
|
4377
4793
|
}, {
|
|
4378
4794
|
"code-block-edit-panel-header": withCtx(({ id }) => [
|
|
4379
4795
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
@@ -4387,16 +4803,17 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
4387
4803
|
}
|
|
4388
4804
|
});
|
|
4389
4805
|
|
|
4390
|
-
const
|
|
4391
|
-
|
|
4392
|
-
|
|
4806
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
4807
|
+
...{
|
|
4808
|
+
name: "MEditorDataSourceConfigPanel"
|
|
4809
|
+
},
|
|
4393
4810
|
__name: "DataSourceConfigPanel",
|
|
4394
4811
|
props: {
|
|
4395
|
-
title:
|
|
4396
|
-
values:
|
|
4812
|
+
title: {},
|
|
4813
|
+
values: {}
|
|
4397
4814
|
},
|
|
4398
4815
|
emits: ["submit"],
|
|
4399
|
-
setup(__props, { expose, emit }) {
|
|
4816
|
+
setup(__props, { expose: __expose, emit }) {
|
|
4400
4817
|
const props = __props;
|
|
4401
4818
|
const type = ref("base");
|
|
4402
4819
|
const services = inject("services");
|
|
@@ -4427,7 +4844,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
4427
4844
|
const hide = () => {
|
|
4428
4845
|
visible.value = false;
|
|
4429
4846
|
};
|
|
4430
|
-
|
|
4847
|
+
__expose({
|
|
4431
4848
|
show() {
|
|
4432
4849
|
visible.value = true;
|
|
4433
4850
|
},
|
|
@@ -4437,12 +4854,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
4437
4854
|
return openBlock(), createBlock(unref(TMagicDrawer), {
|
|
4438
4855
|
modelValue: visible.value,
|
|
4439
4856
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
|
|
4440
|
-
title:
|
|
4857
|
+
title: _ctx.title,
|
|
4441
4858
|
"close-on-press-escape": true,
|
|
4442
4859
|
"append-to-body": true,
|
|
4443
4860
|
"show-close": true,
|
|
4444
4861
|
"close-on-click-modal": true,
|
|
4445
|
-
size:
|
|
4862
|
+
size: size.value
|
|
4446
4863
|
}, {
|
|
4447
4864
|
footer: withCtx(() => [
|
|
4448
4865
|
createElementVNode("div", null, [
|
|
@@ -4451,13 +4868,13 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
4451
4868
|
onClick: submitHandler
|
|
4452
4869
|
}, {
|
|
4453
4870
|
default: withCtx(() => [
|
|
4454
|
-
|
|
4871
|
+
createTextVNode("确定")
|
|
4455
4872
|
]),
|
|
4456
4873
|
_: 1
|
|
4457
4874
|
}),
|
|
4458
4875
|
createVNode(unref(TMagicButton), { onClick: hide }, {
|
|
4459
4876
|
default: withCtx(() => [
|
|
4460
|
-
|
|
4877
|
+
createTextVNode("关闭")
|
|
4461
4878
|
]),
|
|
4462
4879
|
_: 1
|
|
4463
4880
|
})
|
|
@@ -4467,7 +4884,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
4467
4884
|
createVNode(unref(MForm), {
|
|
4468
4885
|
ref_key: "form",
|
|
4469
4886
|
ref: form,
|
|
4470
|
-
config:
|
|
4887
|
+
config: dataSourceConfig.value,
|
|
4471
4888
|
"init-values": initValues.value,
|
|
4472
4889
|
onChange: changeHandler
|
|
4473
4890
|
}, null, 8, ["config", "init-values"])
|
|
@@ -4478,22 +4895,21 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
4478
4895
|
}
|
|
4479
4896
|
});
|
|
4480
4897
|
|
|
4481
|
-
const _hoisted_1$
|
|
4482
|
-
const _hoisted_2$
|
|
4483
|
-
const _hoisted_3 =
|
|
4484
|
-
const _hoisted_4 = {
|
|
4485
|
-
const _hoisted_5 = {
|
|
4898
|
+
const _hoisted_1$9 = { class: "search-wrapper" };
|
|
4899
|
+
const _hoisted_2$3 = ["id"];
|
|
4900
|
+
const _hoisted_3$1 = { class: "list-item" };
|
|
4901
|
+
const _hoisted_4$1 = {
|
|
4486
4902
|
key: 2,
|
|
4487
4903
|
class: "right-tool"
|
|
4488
4904
|
};
|
|
4489
|
-
const
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4905
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
4906
|
+
...{
|
|
4907
|
+
name: "MEditorDataSourceListPanel"
|
|
4908
|
+
},
|
|
4909
|
+
__name: "DataSourceListPanel",
|
|
4494
4910
|
setup(__props) {
|
|
4495
4911
|
const services = inject("services", {});
|
|
4496
|
-
const { dataSourceService, depService } = inject("services") || {};
|
|
4912
|
+
const { dataSourceService, depService, editorService } = inject("services") || {};
|
|
4497
4913
|
const list = computed(
|
|
4498
4914
|
() => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
|
|
4499
4915
|
id: target.id,
|
|
@@ -4545,18 +4961,30 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4545
4961
|
const filterTextChangeHandler = (val) => {
|
|
4546
4962
|
tree.value?.filter(val);
|
|
4547
4963
|
};
|
|
4964
|
+
const selectComp = (compId) => {
|
|
4965
|
+
const stage = editorService?.get("stage");
|
|
4966
|
+
editorService?.select(compId);
|
|
4967
|
+
stage?.select(compId);
|
|
4968
|
+
};
|
|
4969
|
+
const clickHandler = (data, node) => {
|
|
4970
|
+
if (data.type === "node") {
|
|
4971
|
+
selectComp(data.id);
|
|
4972
|
+
} else if (data.type === "key") {
|
|
4973
|
+
selectComp(node.parent.data.id);
|
|
4974
|
+
}
|
|
4975
|
+
};
|
|
4548
4976
|
return (_ctx, _cache) => {
|
|
4549
4977
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
4550
4978
|
default: withCtx(() => [
|
|
4551
|
-
createElementVNode("div", _hoisted_1$
|
|
4552
|
-
createVNode(_sfc_main$
|
|
4979
|
+
createElementVNode("div", _hoisted_1$9, [
|
|
4980
|
+
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
4553
4981
|
createVNode(unref(TMagicButton), {
|
|
4554
4982
|
type: "primary",
|
|
4555
4983
|
size: "small",
|
|
4556
4984
|
onClick: addHandler
|
|
4557
4985
|
}, {
|
|
4558
4986
|
default: withCtx(() => [
|
|
4559
|
-
|
|
4987
|
+
createTextVNode("新增")
|
|
4560
4988
|
]),
|
|
4561
4989
|
_: 1
|
|
4562
4990
|
})
|
|
@@ -4569,21 +4997,22 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4569
4997
|
"empty-text": "暂无代码块",
|
|
4570
4998
|
"default-expand-all": "",
|
|
4571
4999
|
"expand-on-click-node": false,
|
|
4572
|
-
data:
|
|
4573
|
-
"highlight-current": true
|
|
5000
|
+
data: list.value,
|
|
5001
|
+
"highlight-current": true,
|
|
5002
|
+
onNodeClick: clickHandler
|
|
4574
5003
|
}, {
|
|
4575
5004
|
default: withCtx(({ data }) => [
|
|
4576
5005
|
createElementVNode("div", {
|
|
4577
5006
|
id: data.id,
|
|
4578
5007
|
class: "list-container"
|
|
4579
5008
|
}, [
|
|
4580
|
-
createElementVNode("div",
|
|
4581
|
-
data.type === "code" ? (openBlock(), createBlock(_sfc_main$
|
|
5009
|
+
createElementVNode("div", _hoisted_3$1, [
|
|
5010
|
+
data.type === "code" ? (openBlock(), createBlock(_sfc_main$E, {
|
|
4582
5011
|
key: 0,
|
|
4583
5012
|
class: "codeIcon",
|
|
4584
5013
|
icon: unref(Coin)
|
|
4585
5014
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
4586
|
-
data.type === "node" ? (openBlock(), createBlock(_sfc_main$
|
|
5015
|
+
data.type === "node" ? (openBlock(), createBlock(_sfc_main$E, {
|
|
4587
5016
|
key: 1,
|
|
4588
5017
|
class: "compIcon",
|
|
4589
5018
|
icon: unref(Aim)
|
|
@@ -4591,14 +5020,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4591
5020
|
createElementVNode("span", {
|
|
4592
5021
|
class: normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4593
5022
|
}, toDisplayString(data.name) + "(" + toDisplayString(data.id) + ")", 3),
|
|
4594
|
-
data.type === "code" ? (openBlock(), createElementBlock("div",
|
|
5023
|
+
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
|
|
4595
5024
|
createVNode(unref(TMagicTooltip), {
|
|
4596
5025
|
effect: "dark",
|
|
4597
5026
|
content: "编辑",
|
|
4598
5027
|
placement: "bottom"
|
|
4599
5028
|
}, {
|
|
4600
5029
|
default: withCtx(() => [
|
|
4601
|
-
createVNode(_sfc_main$
|
|
5030
|
+
createVNode(_sfc_main$E, {
|
|
4602
5031
|
class: "edit-icon",
|
|
4603
5032
|
icon: unref(Edit),
|
|
4604
5033
|
onClick: withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
|
|
@@ -4612,7 +5041,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4612
5041
|
placement: "bottom"
|
|
4613
5042
|
}, {
|
|
4614
5043
|
default: withCtx(() => [
|
|
4615
|
-
createVNode(_sfc_main$
|
|
5044
|
+
createVNode(_sfc_main$E, {
|
|
4616
5045
|
icon: unref(Close),
|
|
4617
5046
|
class: "edit-icon",
|
|
4618
5047
|
onClick: withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
|
|
@@ -4626,11 +5055,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4626
5055
|
})
|
|
4627
5056
|
])) : createCommentVNode("", true)
|
|
4628
5057
|
])
|
|
4629
|
-
], 8,
|
|
5058
|
+
], 8, _hoisted_2$3)
|
|
4630
5059
|
]),
|
|
4631
5060
|
_: 3
|
|
4632
5061
|
}, 8, ["data"]),
|
|
4633
|
-
createVNode(_sfc_main$
|
|
5062
|
+
createVNode(_sfc_main$h, {
|
|
4634
5063
|
ref_key: "editDialog",
|
|
4635
5064
|
ref: editDialog,
|
|
4636
5065
|
values: dataSourceValues.value,
|
|
@@ -4644,12 +5073,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4644
5073
|
}
|
|
4645
5074
|
});
|
|
4646
5075
|
|
|
4647
|
-
const _hoisted_1$
|
|
4648
|
-
const
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
5076
|
+
const _hoisted_1$8 = ["onClick", "onDragstart"];
|
|
5077
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
5078
|
+
...{
|
|
5079
|
+
name: "MEditorComponentListPanel"
|
|
5080
|
+
},
|
|
5081
|
+
__name: "ComponentListPanel",
|
|
4653
5082
|
setup(__props) {
|
|
4654
5083
|
const searchText = ref("");
|
|
4655
5084
|
const filterTextChangeHandler = (v) => {
|
|
@@ -4679,14 +5108,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4679
5108
|
};
|
|
4680
5109
|
const dragstartHandler = ({ text, type, data = {} }, e) => {
|
|
4681
5110
|
if (e.dataTransfer) {
|
|
4682
|
-
e.dataTransfer.effectAllowed = "move";
|
|
4683
5111
|
e.dataTransfer.setData(
|
|
4684
|
-
"
|
|
5112
|
+
"text/html",
|
|
4685
5113
|
serialize({
|
|
4686
5114
|
name: text,
|
|
4687
5115
|
type,
|
|
4688
5116
|
...data
|
|
4689
|
-
})
|
|
5117
|
+
})
|
|
4690
5118
|
);
|
|
4691
5119
|
}
|
|
4692
5120
|
};
|
|
@@ -4714,7 +5142,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4714
5142
|
}
|
|
4715
5143
|
if (timeout || !stage.value)
|
|
4716
5144
|
return;
|
|
4717
|
-
timeout = stage.value.
|
|
5145
|
+
timeout = stage.value.delayedMarkContainer(e);
|
|
4718
5146
|
};
|
|
4719
5147
|
return (_ctx, _cache) => {
|
|
4720
5148
|
return openBlock(), createBlock(unref(TMagicScrollbar), null, {
|
|
@@ -4722,18 +5150,18 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4722
5150
|
renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
4723
5151
|
createVNode(unref(TMagicCollapse), {
|
|
4724
5152
|
class: "ui-component-panel",
|
|
4725
|
-
"model-value":
|
|
5153
|
+
"model-value": collapseValue.value
|
|
4726
5154
|
}, {
|
|
4727
5155
|
default: withCtx(() => [
|
|
4728
|
-
createVNode(_sfc_main$
|
|
4729
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
5156
|
+
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
5157
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
|
|
4730
5158
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
4731
5159
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
4732
5160
|
key: index,
|
|
4733
5161
|
name: `${index}`
|
|
4734
5162
|
}, {
|
|
4735
5163
|
title: withCtx(() => [
|
|
4736
|
-
createVNode(_sfc_main$
|
|
5164
|
+
createVNode(_sfc_main$E, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
4737
5165
|
createTextVNode(toDisplayString(group.title), 1)
|
|
4738
5166
|
]),
|
|
4739
5167
|
default: withCtx(() => [
|
|
@@ -4748,7 +5176,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4748
5176
|
onDrag: dragHandler
|
|
4749
5177
|
}, [
|
|
4750
5178
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4751
|
-
createVNode(_sfc_main$
|
|
5179
|
+
createVNode(_sfc_main$E, {
|
|
4752
5180
|
icon: item.icon
|
|
4753
5181
|
}, null, 8, ["icon"]),
|
|
4754
5182
|
createVNode(unref(TMagicTooltip), {
|
|
@@ -4762,7 +5190,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4762
5190
|
_: 2
|
|
4763
5191
|
}, 1032, ["content"])
|
|
4764
5192
|
])
|
|
4765
|
-
], 40, _hoisted_1$
|
|
5193
|
+
], 40, _hoisted_1$8);
|
|
4766
5194
|
}), 128))
|
|
4767
5195
|
]),
|
|
4768
5196
|
_: 2
|
|
@@ -4779,19 +5207,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4779
5207
|
}
|
|
4780
5208
|
});
|
|
4781
5209
|
|
|
4782
|
-
const
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
5210
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
5211
|
+
...{
|
|
5212
|
+
name: "MEditorContentMenu"
|
|
5213
|
+
},
|
|
5214
|
+
__name: "ContentMenu",
|
|
4787
5215
|
props: {
|
|
4788
5216
|
menuData: { default: () => [] },
|
|
4789
5217
|
isSubMenu: { type: Boolean, default: false }
|
|
4790
5218
|
},
|
|
4791
5219
|
emits: ["hide", "show"],
|
|
4792
|
-
setup(__props, { expose, emit }) {
|
|
5220
|
+
setup(__props, { expose: __expose, emit }) {
|
|
4793
5221
|
const props = __props;
|
|
4794
5222
|
const menu = ref();
|
|
5223
|
+
const buttons = ref();
|
|
4795
5224
|
const subMenu = ref();
|
|
4796
5225
|
const visible = ref(false);
|
|
4797
5226
|
const subMenuData = ref([]);
|
|
@@ -4799,6 +5228,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4799
5228
|
left: "0",
|
|
4800
5229
|
top: "0"
|
|
4801
5230
|
});
|
|
5231
|
+
const contains = (el) => menu.value?.contains(el) || subMenu.value?.contains(el);
|
|
4802
5232
|
const hide = () => {
|
|
4803
5233
|
if (!visible.value)
|
|
4804
5234
|
return;
|
|
@@ -4811,7 +5241,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4811
5241
|
if (!visible.value || !target) {
|
|
4812
5242
|
return;
|
|
4813
5243
|
}
|
|
4814
|
-
if (
|
|
5244
|
+
if (contains(target)) {
|
|
4815
5245
|
return;
|
|
4816
5246
|
}
|
|
4817
5247
|
hide();
|
|
@@ -4833,18 +5263,25 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4833
5263
|
});
|
|
4834
5264
|
}, 300);
|
|
4835
5265
|
};
|
|
4836
|
-
const showSubMenu = (item) => {
|
|
5266
|
+
const showSubMenu = (item, index) => {
|
|
4837
5267
|
const menuItem = item;
|
|
4838
5268
|
if (typeof item !== "object" || !menuItem.items?.length) {
|
|
4839
5269
|
return;
|
|
4840
5270
|
}
|
|
4841
|
-
subMenuData.value = menuItem.items;
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
5271
|
+
subMenuData.value = menuItem.items || [];
|
|
5272
|
+
setTimeout(() => {
|
|
5273
|
+
if (menu.value) {
|
|
5274
|
+
let y = menu.value.offsetTop;
|
|
5275
|
+
if (buttons.value?.[index].$el) {
|
|
5276
|
+
const rect = buttons.value?.[index].$el.getBoundingClientRect();
|
|
5277
|
+
y = rect.top;
|
|
5278
|
+
}
|
|
5279
|
+
subMenu.value?.show({
|
|
5280
|
+
clientX: menu.value.offsetLeft + menu.value.clientWidth,
|
|
5281
|
+
clientY: y
|
|
5282
|
+
});
|
|
5283
|
+
}
|
|
5284
|
+
}, 0);
|
|
4848
5285
|
};
|
|
4849
5286
|
onMounted(() => {
|
|
4850
5287
|
if (props.isSubMenu)
|
|
@@ -4856,13 +5293,15 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4856
5293
|
return;
|
|
4857
5294
|
globalThis.removeEventListener("mousedown", hideHandler, true);
|
|
4858
5295
|
});
|
|
4859
|
-
|
|
5296
|
+
__expose({
|
|
5297
|
+
menu,
|
|
4860
5298
|
hide,
|
|
4861
|
-
show
|
|
5299
|
+
show,
|
|
5300
|
+
contains
|
|
4862
5301
|
});
|
|
4863
5302
|
return (_ctx, _cache) => {
|
|
4864
5303
|
const _component_content_menu = resolveComponent("content-menu", true);
|
|
4865
|
-
return
|
|
5304
|
+
return _ctx.menuData.length ? withDirectives((openBlock(), createElementBlock("div", {
|
|
4866
5305
|
key: 0,
|
|
4867
5306
|
class: "magic-editor-content-menu",
|
|
4868
5307
|
ref_key: "menu",
|
|
@@ -4870,25 +5309,29 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4870
5309
|
style: normalizeStyle(menuStyle.value)
|
|
4871
5310
|
}, [
|
|
4872
5311
|
createElementVNode("div", null, [
|
|
4873
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
4874
|
-
return openBlock(), createBlock(_sfc_main$
|
|
5312
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
5313
|
+
return openBlock(), createBlock(_sfc_main$r, {
|
|
4875
5314
|
"event-type": "mouseup",
|
|
5315
|
+
ref_for: true,
|
|
5316
|
+
ref_key: "buttons",
|
|
5317
|
+
ref: buttons,
|
|
4876
5318
|
data: item,
|
|
4877
5319
|
key: index,
|
|
4878
5320
|
onMouseup: hide,
|
|
4879
|
-
onMouseenter: ($event) => showSubMenu(item)
|
|
5321
|
+
onMouseenter: ($event) => showSubMenu(item, index)
|
|
4880
5322
|
}, null, 8, ["data", "onMouseenter"]);
|
|
4881
5323
|
}), 128))
|
|
4882
5324
|
]),
|
|
4883
5325
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4884
|
-
|
|
5326
|
+
subMenuData.value.length ? (openBlock(), createBlock(_component_content_menu, {
|
|
5327
|
+
key: 0,
|
|
4885
5328
|
class: "sub-menu",
|
|
4886
5329
|
ref_key: "subMenu",
|
|
4887
5330
|
ref: subMenu,
|
|
4888
5331
|
"menu-data": subMenuData.value,
|
|
4889
5332
|
"is-sub-menu": true,
|
|
4890
5333
|
onHide: hide
|
|
4891
|
-
}, null, 8, ["menu-data"])
|
|
5334
|
+
}, null, 8, ["menu-data"])) : createCommentVNode("", true)
|
|
4892
5335
|
]))
|
|
4893
5336
|
], 4)), [
|
|
4894
5337
|
[vShow, visible.value]
|
|
@@ -4897,21 +5340,95 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4897
5340
|
}
|
|
4898
5341
|
});
|
|
4899
5342
|
|
|
4900
|
-
const
|
|
4901
|
-
|
|
5343
|
+
const useDeleteMenu = () => ({
|
|
5344
|
+
type: "button",
|
|
5345
|
+
text: "删除",
|
|
5346
|
+
icon: Delete,
|
|
5347
|
+
display: (services) => {
|
|
5348
|
+
const node = services?.editorService?.get("node");
|
|
5349
|
+
return node?.type !== NodeType.ROOT && !isPage(node);
|
|
5350
|
+
},
|
|
5351
|
+
handler: (services) => {
|
|
5352
|
+
const nodes = services?.editorService?.get("nodes");
|
|
5353
|
+
nodes && services?.editorService?.remove(nodes);
|
|
5354
|
+
}
|
|
4902
5355
|
});
|
|
4903
|
-
const
|
|
4904
|
-
|
|
5356
|
+
const canPaste = ref(false);
|
|
5357
|
+
const useCopyMenu = () => ({
|
|
5358
|
+
type: "button",
|
|
5359
|
+
text: "复制",
|
|
5360
|
+
icon: markRaw(CopyDocument),
|
|
5361
|
+
handler: (services) => {
|
|
5362
|
+
const nodes = services?.editorService?.get("nodes");
|
|
5363
|
+
nodes && services?.editorService?.copy(nodes);
|
|
5364
|
+
canPaste.value = true;
|
|
5365
|
+
}
|
|
5366
|
+
});
|
|
5367
|
+
const usePasteMenu = (menu) => ({
|
|
5368
|
+
type: "button",
|
|
5369
|
+
text: "粘贴",
|
|
5370
|
+
icon: markRaw(DocumentCopy),
|
|
5371
|
+
display: () => canPaste.value,
|
|
5372
|
+
handler: (services) => {
|
|
5373
|
+
const nodes = services?.editorService?.get("nodes");
|
|
5374
|
+
if (!nodes || nodes.length === 0)
|
|
5375
|
+
return;
|
|
5376
|
+
if (menu?.value?.$el) {
|
|
5377
|
+
const stage = services?.editorService?.get("stage");
|
|
5378
|
+
const rect = menu.value.$el.getBoundingClientRect();
|
|
5379
|
+
const parentRect = stage?.container?.getBoundingClientRect();
|
|
5380
|
+
const initialLeft = (rect.left || 0) - (parentRect?.left || 0);
|
|
5381
|
+
const initialTop = (rect.top || 0) - (parentRect?.top || 0);
|
|
5382
|
+
services?.editorService?.paste({ left: initialLeft, top: initialTop });
|
|
5383
|
+
} else {
|
|
5384
|
+
services?.editorService?.paste();
|
|
5385
|
+
}
|
|
5386
|
+
}
|
|
5387
|
+
});
|
|
5388
|
+
const moveTo = (id, services) => {
|
|
5389
|
+
if (!services?.editorService)
|
|
5390
|
+
return;
|
|
5391
|
+
const nodes = services.editorService.get("nodes") || [];
|
|
5392
|
+
const parent = services.editorService.getNodeById(id);
|
|
5393
|
+
if (!parent)
|
|
5394
|
+
return;
|
|
5395
|
+
services?.editorService.add(nodes, parent);
|
|
5396
|
+
services?.editorService.remove(nodes);
|
|
5397
|
+
};
|
|
5398
|
+
const useMoveToMenu = (services) => {
|
|
5399
|
+
const root = computed(() => services?.editorService?.get("root"));
|
|
5400
|
+
return {
|
|
5401
|
+
type: "button",
|
|
5402
|
+
text: "移动至",
|
|
5403
|
+
display: (services2) => {
|
|
5404
|
+
const node = services2?.editorService?.get("node");
|
|
5405
|
+
const pageLength = services2?.editorService?.get("pageLength") || 0;
|
|
5406
|
+
return !isPage(node) && pageLength > 1;
|
|
5407
|
+
},
|
|
5408
|
+
items: (root.value?.items || []).filter((page) => page.id !== services?.editorService?.get("page")?.id).map((page) => ({
|
|
5409
|
+
text: `${page.name}(${page.id})`,
|
|
5410
|
+
type: "button",
|
|
5411
|
+
handler: (services2) => {
|
|
5412
|
+
moveTo(page.id, services2);
|
|
5413
|
+
}
|
|
5414
|
+
}))
|
|
5415
|
+
};
|
|
5416
|
+
};
|
|
5417
|
+
|
|
5418
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
5419
|
+
...{
|
|
5420
|
+
name: "MEditorLayerMenu"
|
|
5421
|
+
},
|
|
5422
|
+
__name: "LayerMenu",
|
|
4905
5423
|
props: {
|
|
4906
|
-
layerContentMenu:
|
|
5424
|
+
layerContentMenu: {}
|
|
4907
5425
|
},
|
|
4908
|
-
setup(__props, { expose }) {
|
|
5426
|
+
setup(__props, { expose: __expose }) {
|
|
4909
5427
|
const props = __props;
|
|
4910
5428
|
const services = inject("services");
|
|
4911
5429
|
const menu = ref();
|
|
4912
5430
|
const node = computed(() => services?.editorService.get("node"));
|
|
4913
|
-
const
|
|
4914
|
-
const isPage = computed(() => node.value?.type === NodeType.PAGE);
|
|
5431
|
+
const nodes = computed(() => services?.editorService.get("nodes"));
|
|
4915
5432
|
const componentList = computed(() => services?.componentListService.getList() || []);
|
|
4916
5433
|
const createMenuItems = (group) => group.items.map((component) => ({
|
|
4917
5434
|
text: component.text,
|
|
@@ -4961,38 +5478,24 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
4961
5478
|
type: "button",
|
|
4962
5479
|
text: "新增",
|
|
4963
5480
|
icon: markRaw(Plus),
|
|
4964
|
-
display: () => node.value?.items,
|
|
5481
|
+
display: () => node.value?.items && nodes.value?.length === 1,
|
|
4965
5482
|
items: getSubMenuData.value
|
|
4966
5483
|
},
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
display: () => !isRoot.value,
|
|
4972
|
-
handler: () => {
|
|
4973
|
-
node.value && services?.editorService.copy(node.value);
|
|
4974
|
-
}
|
|
4975
|
-
},
|
|
4976
|
-
{
|
|
4977
|
-
type: "button",
|
|
4978
|
-
text: "删除",
|
|
4979
|
-
icon: markRaw(Delete),
|
|
4980
|
-
display: () => !isRoot.value && !isPage.value,
|
|
4981
|
-
handler: () => {
|
|
4982
|
-
node.value && services?.editorService.remove(node.value);
|
|
4983
|
-
}
|
|
4984
|
-
},
|
|
5484
|
+
useCopyMenu(),
|
|
5485
|
+
usePasteMenu(),
|
|
5486
|
+
useDeleteMenu(),
|
|
5487
|
+
useMoveToMenu(services),
|
|
4985
5488
|
...props.layerContentMenu
|
|
4986
5489
|
]);
|
|
4987
5490
|
const show = (e) => {
|
|
4988
5491
|
menu.value?.show(e);
|
|
4989
5492
|
};
|
|
4990
|
-
|
|
5493
|
+
__expose({
|
|
4991
5494
|
show
|
|
4992
5495
|
});
|
|
4993
5496
|
return (_ctx, _cache) => {
|
|
4994
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4995
|
-
"menu-data":
|
|
5497
|
+
return openBlock(), createBlock(_sfc_main$e, {
|
|
5498
|
+
"menu-data": menuData.value,
|
|
4996
5499
|
ref_key: "menu",
|
|
4997
5500
|
ref: menu,
|
|
4998
5501
|
style: { "overflow": "initial" }
|
|
@@ -5001,19 +5504,71 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
5001
5504
|
}
|
|
5002
5505
|
});
|
|
5003
5506
|
|
|
5004
|
-
const _hoisted_1$
|
|
5005
|
-
const
|
|
5006
|
-
|
|
5507
|
+
const _hoisted_1$7 = { class: "layer-node-tool" };
|
|
5508
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
5509
|
+
__name: "LayerNode",
|
|
5510
|
+
props: {
|
|
5511
|
+
data: {}
|
|
5512
|
+
},
|
|
5513
|
+
setup(__props) {
|
|
5514
|
+
const props = __props;
|
|
5515
|
+
const services = inject("services");
|
|
5516
|
+
const editorService = services?.editorService;
|
|
5517
|
+
const setNodeVisible = (visible) => {
|
|
5518
|
+
if (!editorService)
|
|
5519
|
+
return;
|
|
5520
|
+
editorService.update({
|
|
5521
|
+
id: props.data.id,
|
|
5522
|
+
visible
|
|
5523
|
+
});
|
|
5524
|
+
};
|
|
5525
|
+
return (_ctx, _cache) => {
|
|
5526
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
5527
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
5528
|
+
createElementVNode("div", null, toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
|
|
5529
|
+
createElementVNode("div", _hoisted_1$7, [
|
|
5530
|
+
_ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5531
|
+
_ctx.data.visible === false ? (openBlock(), createBlock(_component_el_icon, {
|
|
5532
|
+
key: 0,
|
|
5533
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
5534
|
+
title: "点击显示"
|
|
5535
|
+
}, {
|
|
5536
|
+
default: withCtx(() => [
|
|
5537
|
+
createVNode(unref(Hide))
|
|
5538
|
+
]),
|
|
5539
|
+
_: 1
|
|
5540
|
+
})) : (openBlock(), createBlock(_component_el_icon, {
|
|
5541
|
+
key: 1,
|
|
5542
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
5543
|
+
class: "node-lock",
|
|
5544
|
+
title: "点击隐藏"
|
|
5545
|
+
}, {
|
|
5546
|
+
default: withCtx(() => [
|
|
5547
|
+
createVNode(unref(View))
|
|
5548
|
+
]),
|
|
5549
|
+
_: 1
|
|
5550
|
+
}))
|
|
5551
|
+
], 64)) : createCommentVNode("", true)
|
|
5552
|
+
])
|
|
5553
|
+
], 64);
|
|
5554
|
+
};
|
|
5555
|
+
}
|
|
5007
5556
|
});
|
|
5008
|
-
|
|
5009
|
-
|
|
5557
|
+
|
|
5558
|
+
const _hoisted_1$6 = ["id", "onMouseenter"];
|
|
5559
|
+
const throttleTime = 150;
|
|
5560
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
5561
|
+
...{
|
|
5562
|
+
name: "MEditorLayerPanel"
|
|
5563
|
+
},
|
|
5564
|
+
__name: "LayerPanel",
|
|
5010
5565
|
props: {
|
|
5011
|
-
layerContentMenu:
|
|
5566
|
+
layerContentMenu: {}
|
|
5012
5567
|
},
|
|
5013
5568
|
setup(__props) {
|
|
5014
|
-
const throttleTime = 150;
|
|
5015
5569
|
const services = inject("services");
|
|
5016
5570
|
const editorService = services?.editorService;
|
|
5571
|
+
const keybindingService = services?.keybindingService;
|
|
5017
5572
|
const tree = ref();
|
|
5018
5573
|
const menu = ref();
|
|
5019
5574
|
const checkedKeys = ref([]);
|
|
@@ -5147,25 +5702,59 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5147
5702
|
const windowBlurHandler = () => {
|
|
5148
5703
|
isCtrlKeyDown.value = false;
|
|
5149
5704
|
};
|
|
5150
|
-
|
|
5705
|
+
keybindingService?.registeCommand("layer-panel-not-ctrl-keydown", (e) => {
|
|
5706
|
+
if (e.key !== keybindingService.ctrlKey) {
|
|
5707
|
+
isCtrlKeyDown.value = false;
|
|
5708
|
+
}
|
|
5709
|
+
});
|
|
5710
|
+
keybindingService?.registeCommand("layer-panel-ctrl-keydown", () => {
|
|
5711
|
+
isCtrlKeyDown.value = true;
|
|
5712
|
+
});
|
|
5713
|
+
keybindingService?.registeCommand("layer-panel-ctrl-keyup", () => {
|
|
5714
|
+
isCtrlKeyDown.value = false;
|
|
5715
|
+
});
|
|
5716
|
+
keybindingService?.registeCommand("layer-panel-global-keydwon", () => {
|
|
5717
|
+
if (!tree.value?.$el.contains(document.activeElement)) {
|
|
5718
|
+
isCtrlKeyDown.value = false;
|
|
5719
|
+
}
|
|
5720
|
+
});
|
|
5721
|
+
keybindingService?.registe([
|
|
5722
|
+
{
|
|
5723
|
+
command: "layer-panel-not-ctrl-keydown",
|
|
5724
|
+
when: [["layer-panel", "keydown"]]
|
|
5725
|
+
},
|
|
5726
|
+
{
|
|
5727
|
+
command: "layer-panel-ctrl-keydown",
|
|
5728
|
+
keybinding: "ctrl",
|
|
5729
|
+
when: [["layer-panel", "keydown"]]
|
|
5730
|
+
},
|
|
5731
|
+
{
|
|
5732
|
+
command: "layer-panel-ctrl-keyup",
|
|
5733
|
+
keybinding: "ctrl",
|
|
5734
|
+
when: [["layer-panel", "keyup"]]
|
|
5735
|
+
},
|
|
5736
|
+
{
|
|
5737
|
+
command: "layer-panel-global-keydwon",
|
|
5738
|
+
keybinding: "ctrl",
|
|
5739
|
+
when: [["global", "keydown"]]
|
|
5740
|
+
}
|
|
5741
|
+
]);
|
|
5742
|
+
watch(tree, () => {
|
|
5743
|
+
if (tree.value?.$el) {
|
|
5744
|
+
keybindingService?.registeEl("layer-panel", tree.value.$el);
|
|
5745
|
+
tree.value.$el.addEventListener("blur", windowBlurHandler);
|
|
5746
|
+
} else {
|
|
5747
|
+
keybindingService?.unregisteEl("layer-panel");
|
|
5748
|
+
}
|
|
5749
|
+
});
|
|
5151
5750
|
onMounted(() => {
|
|
5152
5751
|
editorService?.on("remove", editorServiceRemoveHandler);
|
|
5153
|
-
keycon = new KeyController();
|
|
5154
|
-
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
5155
|
-
const ctrl = isMac ? "meta" : "ctrl";
|
|
5156
|
-
keycon.keydown((e) => {
|
|
5157
|
-
if (e.key !== ctrl) {
|
|
5158
|
-
isCtrlKeyDown.value = false;
|
|
5159
|
-
}
|
|
5160
|
-
}).keydown(ctrl, () => {
|
|
5161
|
-
isCtrlKeyDown.value = true;
|
|
5162
|
-
}).keyup(ctrl, () => {
|
|
5163
|
-
isCtrlKeyDown.value = false;
|
|
5164
|
-
});
|
|
5165
5752
|
globalThis.addEventListener("blur", windowBlurHandler);
|
|
5166
5753
|
});
|
|
5754
|
+
onBeforeUnmount(() => {
|
|
5755
|
+
tree.value?.$el.removeEventListener("blur", windowBlurHandler);
|
|
5756
|
+
});
|
|
5167
5757
|
onUnmounted(() => {
|
|
5168
|
-
keycon.destroy();
|
|
5169
5758
|
editorService?.off("remove", editorServiceRemoveHandler);
|
|
5170
5759
|
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
5171
5760
|
});
|
|
@@ -5197,33 +5786,36 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5197
5786
|
};
|
|
5198
5787
|
const contextmenu = async (event, data) => {
|
|
5199
5788
|
event.preventDefault();
|
|
5200
|
-
|
|
5789
|
+
if (nodes.value.length < 2) {
|
|
5790
|
+
await select(data);
|
|
5791
|
+
}
|
|
5201
5792
|
menu.value?.show(event);
|
|
5202
5793
|
};
|
|
5203
5794
|
return (_ctx, _cache) => {
|
|
5204
5795
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
5205
5796
|
default: withCtx(() => [
|
|
5206
5797
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
5207
|
-
createVNode(_sfc_main$
|
|
5208
|
-
|
|
5798
|
+
createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
|
|
5799
|
+
values.value.length ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
5209
5800
|
key: 0,
|
|
5210
5801
|
class: "magic-editor-layer-tree",
|
|
5211
5802
|
ref_key: "tree",
|
|
5212
5803
|
ref: tree,
|
|
5213
5804
|
"node-key": "id",
|
|
5214
5805
|
"empty-text": "页面空荡荡的",
|
|
5806
|
+
tabindex: "-1",
|
|
5215
5807
|
draggable: "",
|
|
5216
5808
|
"default-expanded-keys": expandedKeys.value,
|
|
5217
5809
|
"default-checked-keys": checkedKeys.value,
|
|
5218
5810
|
"current-node-key": currentNodeKey.value,
|
|
5219
|
-
data:
|
|
5811
|
+
data: values.value,
|
|
5220
5812
|
"expand-on-click-node": false,
|
|
5221
|
-
"highlight-current": !
|
|
5813
|
+
"highlight-current": !isMultiSelect.value,
|
|
5222
5814
|
"check-on-click-node": true,
|
|
5223
5815
|
props: treeProps,
|
|
5224
5816
|
"filter-node-method": filterNode,
|
|
5225
5817
|
"allow-drop": allowDrop,
|
|
5226
|
-
"show-checkbox":
|
|
5818
|
+
"show-checkbox": isMultiSelect.value,
|
|
5227
5819
|
onNodeClick: clickHandler,
|
|
5228
5820
|
onNodeContextmenu: contextmenu,
|
|
5229
5821
|
onNodeDragEnd: handleDragEnd,
|
|
@@ -5243,17 +5835,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5243
5835
|
node,
|
|
5244
5836
|
data
|
|
5245
5837
|
}, () => [
|
|
5246
|
-
|
|
5838
|
+
createVNode(_sfc_main$c, { data }, null, 8, ["data"])
|
|
5247
5839
|
])
|
|
5248
|
-
], 40, _hoisted_1$
|
|
5840
|
+
], 40, _hoisted_1$6)
|
|
5249
5841
|
]),
|
|
5250
5842
|
_: 3
|
|
5251
5843
|
}, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : createCommentVNode("", true),
|
|
5252
5844
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
5253
|
-
createVNode(_sfc_main$
|
|
5845
|
+
createVNode(_sfc_main$d, {
|
|
5254
5846
|
ref_key: "menu",
|
|
5255
5847
|
ref: menu,
|
|
5256
|
-
"layer-content-menu":
|
|
5848
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
5257
5849
|
}, null, 8, ["layer-content-menu"])
|
|
5258
5850
|
]))
|
|
5259
5851
|
]),
|
|
@@ -5263,23 +5855,23 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5263
5855
|
}
|
|
5264
5856
|
});
|
|
5265
5857
|
|
|
5266
|
-
const _hoisted_1$
|
|
5858
|
+
const _hoisted_1$5 = {
|
|
5267
5859
|
key: 1,
|
|
5268
5860
|
class: "magic-editor-tab-panel-title"
|
|
5269
5861
|
};
|
|
5270
|
-
const
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5862
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
5863
|
+
...{
|
|
5864
|
+
name: "MEditorSidebar"
|
|
5865
|
+
},
|
|
5866
|
+
__name: "Sidebar",
|
|
5275
5867
|
props: {
|
|
5276
5868
|
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block", "data-source"] }) },
|
|
5277
|
-
layerContentMenu:
|
|
5869
|
+
layerContentMenu: {}
|
|
5278
5870
|
},
|
|
5279
|
-
setup(__props, { expose }) {
|
|
5871
|
+
setup(__props, { expose: __expose }) {
|
|
5280
5872
|
const props = __props;
|
|
5281
|
-
const tabPaneComponent = getConfig$1("components")
|
|
5282
|
-
const tabsComponent = getConfig$1("components")
|
|
5873
|
+
const tabPaneComponent = getConfig$1("components")?.tabPane;
|
|
5874
|
+
const tabsComponent = getConfig$1("components")?.tabs;
|
|
5283
5875
|
const activeTabName = ref(props.data?.status);
|
|
5284
5876
|
const getItemConfig = (data) => {
|
|
5285
5877
|
const map = {
|
|
@@ -5288,7 +5880,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5288
5880
|
type: "component",
|
|
5289
5881
|
icon: Goods,
|
|
5290
5882
|
text: "组件",
|
|
5291
|
-
component: _sfc_main$
|
|
5883
|
+
component: _sfc_main$f,
|
|
5292
5884
|
slots: {}
|
|
5293
5885
|
},
|
|
5294
5886
|
layer: {
|
|
@@ -5299,7 +5891,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5299
5891
|
props: {
|
|
5300
5892
|
layerContentMenu: props.layerContentMenu
|
|
5301
5893
|
},
|
|
5302
|
-
component: _sfc_main$
|
|
5894
|
+
component: _sfc_main$b,
|
|
5303
5895
|
slots: {}
|
|
5304
5896
|
},
|
|
5305
5897
|
"code-block": {
|
|
@@ -5307,7 +5899,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5307
5899
|
type: "component",
|
|
5308
5900
|
icon: EditPen,
|
|
5309
5901
|
text: "代码编辑",
|
|
5310
|
-
component: _sfc_main$
|
|
5902
|
+
component: _sfc_main$i,
|
|
5311
5903
|
slots: {}
|
|
5312
5904
|
},
|
|
5313
5905
|
"data-source": {
|
|
@@ -5315,7 +5907,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5315
5907
|
type: "component",
|
|
5316
5908
|
icon: Coin,
|
|
5317
5909
|
text: "数据源",
|
|
5318
|
-
component: _sfc_main$
|
|
5910
|
+
component: _sfc_main$g,
|
|
5319
5911
|
slots: {}
|
|
5320
5912
|
}
|
|
5321
5913
|
};
|
|
@@ -5328,30 +5920,30 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5328
5920
|
activeTabName.value = status || "0";
|
|
5329
5921
|
}
|
|
5330
5922
|
);
|
|
5331
|
-
|
|
5923
|
+
__expose({
|
|
5332
5924
|
activeTabName
|
|
5333
5925
|
});
|
|
5334
5926
|
return (_ctx, _cache) => {
|
|
5335
|
-
return
|
|
5927
|
+
return _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabsComponent)?.component || "el-tabs"), mergeProps({
|
|
5336
5928
|
key: 0,
|
|
5337
5929
|
modelValue: activeTabName.value,
|
|
5338
5930
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
|
|
5339
5931
|
class: "m-editor-sidebar tmagic-design-tabs"
|
|
5340
|
-
}, unref(tabsComponent)
|
|
5932
|
+
}, unref(tabsComponent)?.props({ type: "card", tabPosition: "left" }) || {}), {
|
|
5341
5933
|
default: withCtx(() => [
|
|
5342
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
5343
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)
|
|
5934
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
5935
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), mergeProps(unref(tabPaneComponent)?.props({ name: config.text, lazy: config.lazy }) || {}, {
|
|
5344
5936
|
key: config.$key || index
|
|
5345
5937
|
}), {
|
|
5346
5938
|
label: withCtx(() => [
|
|
5347
5939
|
(openBlock(), createElementBlock("div", {
|
|
5348
5940
|
key: config.text
|
|
5349
5941
|
}, [
|
|
5350
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
5942
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$E, {
|
|
5351
5943
|
key: 0,
|
|
5352
5944
|
icon: config.icon
|
|
5353
5945
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
5354
|
-
config.text ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5946
|
+
config.text ? (openBlock(), createElementBlock("div", _hoisted_1$5, toDisplayString(config.text), 1)) : createCommentVNode("", true)
|
|
5355
5947
|
]))
|
|
5356
5948
|
]),
|
|
5357
5949
|
default: withCtx(() => [
|
|
@@ -5360,7 +5952,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5360
5952
|
name: "component-list-panel-header",
|
|
5361
5953
|
fn: withCtx(() => [
|
|
5362
5954
|
config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
5363
|
-
])
|
|
5955
|
+
]),
|
|
5956
|
+
key: "0"
|
|
5364
5957
|
} : void 0,
|
|
5365
5958
|
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
5366
5959
|
name: "component-list-item",
|
|
@@ -5372,19 +5965,22 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5372
5965
|
key: 1,
|
|
5373
5966
|
component
|
|
5374
5967
|
}, null, 8, ["component"])) : createCommentVNode("", true)
|
|
5375
|
-
])
|
|
5968
|
+
]),
|
|
5969
|
+
key: "1"
|
|
5376
5970
|
} : void 0,
|
|
5377
5971
|
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
5378
5972
|
name: "layer-panel-header",
|
|
5379
5973
|
fn: withCtx(() => [
|
|
5380
5974
|
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
5381
|
-
])
|
|
5975
|
+
]),
|
|
5976
|
+
key: "2"
|
|
5382
5977
|
} : void 0,
|
|
5383
5978
|
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
5384
5979
|
name: "code-block-panel-header",
|
|
5385
5980
|
fn: withCtx(() => [
|
|
5386
5981
|
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
5387
|
-
])
|
|
5982
|
+
]),
|
|
5983
|
+
key: "3"
|
|
5388
5984
|
} : void 0,
|
|
5389
5985
|
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
5390
5986
|
name: "code-block-panel-tool",
|
|
@@ -5394,7 +5990,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5394
5990
|
id,
|
|
5395
5991
|
data
|
|
5396
5992
|
}) : config.slots?.codeBlockPanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
5397
|
-
])
|
|
5993
|
+
]),
|
|
5994
|
+
key: "4"
|
|
5398
5995
|
} : void 0,
|
|
5399
5996
|
config.$key === "code-block" || config.slots?.codeBlockEditPanelHeader ? {
|
|
5400
5997
|
name: "code-block-edit-panel-header",
|
|
@@ -5403,7 +6000,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5403
6000
|
key: 0,
|
|
5404
6001
|
id
|
|
5405
6002
|
}) : config.slots?.codeBlockEditPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockEditPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
5406
|
-
])
|
|
6003
|
+
]),
|
|
6004
|
+
key: "5"
|
|
5407
6005
|
} : void 0,
|
|
5408
6006
|
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
5409
6007
|
name: "layer-node-content",
|
|
@@ -5417,7 +6015,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5417
6015
|
data: nodeData,
|
|
5418
6016
|
node
|
|
5419
6017
|
}, null, 8, ["data", "node"])) : createCommentVNode("", true)
|
|
5420
|
-
])
|
|
6018
|
+
]),
|
|
6019
|
+
key: "6"
|
|
5421
6020
|
} : void 0
|
|
5422
6021
|
]), 1040)) : createCommentVNode("", true)
|
|
5423
6022
|
]),
|
|
@@ -5431,16 +6030,16 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5431
6030
|
}
|
|
5432
6031
|
});
|
|
5433
6032
|
|
|
5434
|
-
const _hoisted_1$
|
|
6033
|
+
const _hoisted_1$4 = {
|
|
5435
6034
|
key: 0,
|
|
5436
6035
|
class: "m-editor-breadcrumb"
|
|
5437
6036
|
};
|
|
5438
|
-
const _hoisted_2$
|
|
5439
|
-
const
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
6037
|
+
const _hoisted_2$2 = { key: 0 };
|
|
6038
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
6039
|
+
...{
|
|
6040
|
+
name: "MEditorBreadcrumb"
|
|
6041
|
+
},
|
|
6042
|
+
__name: "Breadcrumb",
|
|
5444
6043
|
setup(__props) {
|
|
5445
6044
|
const services = inject("services");
|
|
5446
6045
|
const editorService = services?.editorService;
|
|
@@ -5453,14 +6052,14 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
5453
6052
|
editorService?.get("stage")?.select(node2.id);
|
|
5454
6053
|
};
|
|
5455
6054
|
return (_ctx, _cache) => {
|
|
5456
|
-
return
|
|
5457
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
6055
|
+
return nodes.value.length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
6056
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(path.value, (item, index) => {
|
|
5458
6057
|
return openBlock(), createElementBlock(Fragment, {
|
|
5459
6058
|
key: item.id
|
|
5460
6059
|
}, [
|
|
5461
6060
|
createVNode(unref(TMagicButton), {
|
|
5462
6061
|
text: "",
|
|
5463
|
-
disabled: item.id ===
|
|
6062
|
+
disabled: item.id === node.value?.id,
|
|
5464
6063
|
onClick: ($event) => select(item)
|
|
5465
6064
|
}, {
|
|
5466
6065
|
default: withCtx(() => [
|
|
@@ -5468,7 +6067,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
5468
6067
|
]),
|
|
5469
6068
|
_: 2
|
|
5470
6069
|
}, 1032, ["disabled", "onClick"]),
|
|
5471
|
-
index <
|
|
6070
|
+
index < path.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_2$2, "/")) : createCommentVNode("", true)
|
|
5472
6071
|
], 64);
|
|
5473
6072
|
}), 128))
|
|
5474
6073
|
])) : createCommentVNode("", true);
|
|
@@ -5476,15 +6075,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
5476
6075
|
}
|
|
5477
6076
|
});
|
|
5478
6077
|
|
|
5479
|
-
const _hoisted_1$
|
|
6078
|
+
const _hoisted_1$3 = {
|
|
5480
6079
|
key: 1,
|
|
5481
6080
|
style: { "width": "21px" }
|
|
5482
6081
|
};
|
|
5483
|
-
const
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
6082
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
6083
|
+
...{
|
|
6084
|
+
name: "MEditorPageBarScrollContainer"
|
|
6085
|
+
},
|
|
6086
|
+
__name: "PageBarScrollContainer",
|
|
5488
6087
|
setup(__props) {
|
|
5489
6088
|
const services = inject("services");
|
|
5490
6089
|
const editorService = services?.editorService;
|
|
@@ -5562,22 +6161,22 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5562
6161
|
ref_key: "pageBar",
|
|
5563
6162
|
ref: pageBar
|
|
5564
6163
|
}, [
|
|
5565
|
-
|
|
6164
|
+
showAddPageButton.value ? (openBlock(), createElementBlock("div", {
|
|
5566
6165
|
key: 0,
|
|
5567
6166
|
id: "m-editor-page-bar-add-icon",
|
|
5568
6167
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5569
6168
|
onClick: addPage
|
|
5570
6169
|
}, [
|
|
5571
|
-
createVNode(_sfc_main$
|
|
5572
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6170
|
+
createVNode(_sfc_main$E, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
6171
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$3)),
|
|
5573
6172
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
5574
6173
|
key: 2,
|
|
5575
6174
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5576
6175
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
5577
6176
|
}, [
|
|
5578
|
-
createVNode(_sfc_main$
|
|
6177
|
+
createVNode(_sfc_main$E, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
5579
6178
|
])) : createCommentVNode("", true),
|
|
5580
|
-
|
|
6179
|
+
pageLength.value ? (openBlock(), createElementBlock("div", {
|
|
5581
6180
|
key: 3,
|
|
5582
6181
|
class: "m-editor-page-bar-items",
|
|
5583
6182
|
ref_key: "itemsContainer",
|
|
@@ -5591,20 +6190,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5591
6190
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5592
6191
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
5593
6192
|
}, [
|
|
5594
|
-
createVNode(_sfc_main$
|
|
6193
|
+
createVNode(_sfc_main$E, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
5595
6194
|
])) : createCommentVNode("", true)
|
|
5596
6195
|
], 512);
|
|
5597
6196
|
};
|
|
5598
6197
|
}
|
|
5599
6198
|
});
|
|
5600
6199
|
|
|
5601
|
-
const _hoisted_1 = ["onClick"];
|
|
5602
|
-
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
5603
|
-
const
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
6200
|
+
const _hoisted_1$2 = ["onClick"];
|
|
6201
|
+
const _hoisted_2$1 = { class: "m-editor-page-bar-title" };
|
|
6202
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
6203
|
+
...{
|
|
6204
|
+
name: "MEditorPageBar"
|
|
6205
|
+
},
|
|
6206
|
+
__name: "PageBar",
|
|
5608
6207
|
setup(__props) {
|
|
5609
6208
|
const services = inject("services");
|
|
5610
6209
|
const editorService = services?.editorService;
|
|
@@ -5624,15 +6223,15 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
5624
6223
|
editorService?.remove(node);
|
|
5625
6224
|
};
|
|
5626
6225
|
return (_ctx, _cache) => {
|
|
5627
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6226
|
+
return openBlock(), createBlock(_sfc_main$8, null, {
|
|
5628
6227
|
default: withCtx(() => [
|
|
5629
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
6228
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(root.value && root.value.items || [], (item) => {
|
|
5630
6229
|
return openBlock(), createElementBlock("div", {
|
|
5631
|
-
class: normalizeClass(["m-editor-page-bar-item", { active:
|
|
6230
|
+
class: normalizeClass(["m-editor-page-bar-item", { active: page.value?.id === item.id }]),
|
|
5632
6231
|
key: item.key,
|
|
5633
6232
|
onClick: ($event) => switchPage(item)
|
|
5634
6233
|
}, [
|
|
5635
|
-
createElementVNode("div", _hoisted_2, [
|
|
6234
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
5636
6235
|
renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
5637
6236
|
createVNode(unref(TMagicTooltip), {
|
|
5638
6237
|
effect: "dark",
|
|
@@ -5663,7 +6262,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
5663
6262
|
default: withCtx(() => [
|
|
5664
6263
|
createElementVNode("div", null, [
|
|
5665
6264
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
5666
|
-
createVNode(_sfc_main$
|
|
6265
|
+
createVNode(_sfc_main$r, {
|
|
5667
6266
|
data: {
|
|
5668
6267
|
type: "button",
|
|
5669
6268
|
text: "复制",
|
|
@@ -5671,7 +6270,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
5671
6270
|
handler: () => copy(item)
|
|
5672
6271
|
}
|
|
5673
6272
|
}, null, 8, ["data"]),
|
|
5674
|
-
createVNode(_sfc_main$
|
|
6273
|
+
createVNode(_sfc_main$r, {
|
|
5675
6274
|
data: {
|
|
5676
6275
|
type: "button",
|
|
5677
6276
|
text: "删除",
|
|
@@ -5684,7 +6283,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
5684
6283
|
]),
|
|
5685
6284
|
_: 2
|
|
5686
6285
|
}, 1024)
|
|
5687
|
-
], 10, _hoisted_1);
|
|
6286
|
+
], 10, _hoisted_1$2);
|
|
5688
6287
|
}), 128))
|
|
5689
6288
|
]),
|
|
5690
6289
|
_: 3
|
|
@@ -5821,16 +6420,16 @@ class ScrollViewer extends EventEmitter {
|
|
|
5821
6420
|
};
|
|
5822
6421
|
}
|
|
5823
6422
|
|
|
5824
|
-
const
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
6423
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
6424
|
+
...{
|
|
6425
|
+
name: "MEditorScrollBar"
|
|
6426
|
+
},
|
|
6427
|
+
__name: "ScrollBar",
|
|
5829
6428
|
props: {
|
|
5830
|
-
size:
|
|
5831
|
-
scrollSize:
|
|
6429
|
+
size: {},
|
|
6430
|
+
scrollSize: {},
|
|
5832
6431
|
isHorizontal: { type: Boolean },
|
|
5833
|
-
pos:
|
|
6432
|
+
pos: {}
|
|
5834
6433
|
},
|
|
5835
6434
|
emits: ["scroll"],
|
|
5836
6435
|
setup(__props, { emit }) {
|
|
@@ -5895,13 +6494,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
5895
6494
|
return openBlock(), createElementBlock("div", {
|
|
5896
6495
|
ref_key: "bar",
|
|
5897
6496
|
ref: bar,
|
|
5898
|
-
class: normalizeClass(["m-editor-scroll-bar",
|
|
6497
|
+
class: normalizeClass(["m-editor-scroll-bar", _ctx.isHorizontal ? "horizontal" : "vertical"])
|
|
5899
6498
|
}, [
|
|
5900
6499
|
createElementVNode("div", {
|
|
5901
6500
|
ref_key: "thumb",
|
|
5902
6501
|
ref: thumb,
|
|
5903
6502
|
class: "m-editor-scroll-bar-thumb",
|
|
5904
|
-
style: normalizeStyle(
|
|
6503
|
+
style: normalizeStyle(thumbStyle.value)
|
|
5905
6504
|
}, null, 4)
|
|
5906
6505
|
], 2);
|
|
5907
6506
|
};
|
|
@@ -5910,11 +6509,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
5910
6509
|
|
|
5911
6510
|
const ScrollBar_vue_vue_type_style_index_0_lang = '';
|
|
5912
6511
|
|
|
5913
|
-
const
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
6512
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
6513
|
+
...{
|
|
6514
|
+
name: "MEditorScrollViewer"
|
|
6515
|
+
},
|
|
6516
|
+
__name: "ScrollViewer",
|
|
5918
6517
|
props: {
|
|
5919
6518
|
width: { default: 0 },
|
|
5920
6519
|
height: { default: 0 },
|
|
@@ -5926,7 +6525,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
5926
6525
|
height: 0
|
|
5927
6526
|
}) }
|
|
5928
6527
|
},
|
|
5929
|
-
setup(__props, { expose }) {
|
|
6528
|
+
setup(__props, { expose: __expose }) {
|
|
5930
6529
|
const props = __props;
|
|
5931
6530
|
const container = ref();
|
|
5932
6531
|
const el = ref();
|
|
@@ -5980,7 +6579,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
5980
6579
|
left: hOffset.value
|
|
5981
6580
|
});
|
|
5982
6581
|
};
|
|
5983
|
-
|
|
6582
|
+
__expose({
|
|
5984
6583
|
container
|
|
5985
6584
|
});
|
|
5986
6585
|
return (_ctx, _cache) => {
|
|
@@ -5992,23 +6591,23 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
5992
6591
|
createElementVNode("div", {
|
|
5993
6592
|
ref_key: "el",
|
|
5994
6593
|
ref: el,
|
|
5995
|
-
style: normalizeStyle(
|
|
6594
|
+
style: normalizeStyle(style.value)
|
|
5996
6595
|
}, [
|
|
5997
6596
|
renderSlot(_ctx.$slots, "default")
|
|
5998
6597
|
], 4),
|
|
5999
|
-
scrollHeight.value >
|
|
6598
|
+
scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$6, {
|
|
6000
6599
|
key: 0,
|
|
6001
6600
|
"scroll-size": scrollHeight.value,
|
|
6002
|
-
size:
|
|
6601
|
+
size: _ctx.wrapHeight,
|
|
6003
6602
|
pos: vOffset.value,
|
|
6004
6603
|
onScroll: vScrollHandler
|
|
6005
6604
|
}, null, 8, ["scroll-size", "size", "pos"])) : createCommentVNode("", true),
|
|
6006
|
-
scrollWidth.value >
|
|
6605
|
+
scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$6, {
|
|
6007
6606
|
key: 1,
|
|
6008
6607
|
"is-horizontal": true,
|
|
6009
6608
|
"scroll-size": scrollWidth.value,
|
|
6010
6609
|
pos: hOffset.value,
|
|
6011
|
-
size:
|
|
6610
|
+
size: _ctx.wrapWidth,
|
|
6012
6611
|
onScroll: hScrollHandler
|
|
6013
6612
|
}, null, 8, ["scroll-size", "pos", "size"])) : createCommentVNode("", true)
|
|
6014
6613
|
], 512);
|
|
@@ -6016,16 +6615,59 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
6016
6615
|
}
|
|
6017
6616
|
});
|
|
6018
6617
|
|
|
6019
|
-
const
|
|
6020
|
-
|
|
6618
|
+
const _hoisted_1$1 = {
|
|
6619
|
+
viewBox: "0 0 24 24",
|
|
6620
|
+
fill: "none",
|
|
6621
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
6622
|
+
};
|
|
6623
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("path", {
|
|
6624
|
+
"fill-rule": "evenodd",
|
|
6625
|
+
"clip-rule": "evenodd",
|
|
6626
|
+
d: "M2 4H21V6H2V4Z",
|
|
6627
|
+
fill: "black",
|
|
6628
|
+
"fill-opacity": "0.9"
|
|
6629
|
+
}, null, -1);
|
|
6630
|
+
const _hoisted_3 = /* @__PURE__ */ createElementVNode("path", {
|
|
6631
|
+
"fill-rule": "evenodd",
|
|
6632
|
+
"clip-rule": "evenodd",
|
|
6633
|
+
d: "M5 11H18V13H5V11Z",
|
|
6634
|
+
fill: "black",
|
|
6635
|
+
"fill-opacity": "0.9"
|
|
6636
|
+
}, null, -1);
|
|
6637
|
+
const _hoisted_4 = /* @__PURE__ */ createElementVNode("path", {
|
|
6638
|
+
"fill-rule": "evenodd",
|
|
6639
|
+
"clip-rule": "evenodd",
|
|
6640
|
+
d: "M2 18H21V20H2V18Z",
|
|
6641
|
+
fill: "black",
|
|
6642
|
+
"fill-opacity": "0.9"
|
|
6643
|
+
}, null, -1);
|
|
6644
|
+
const _hoisted_5 = [
|
|
6645
|
+
_hoisted_2,
|
|
6646
|
+
_hoisted_3,
|
|
6647
|
+
_hoisted_4
|
|
6648
|
+
];
|
|
6649
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
6650
|
+
...{
|
|
6651
|
+
name: "MEditorCenterIcon"
|
|
6652
|
+
},
|
|
6653
|
+
__name: "CenterIcon",
|
|
6654
|
+
setup(__props) {
|
|
6655
|
+
return (_ctx, _cache) => {
|
|
6656
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_5);
|
|
6657
|
+
};
|
|
6658
|
+
}
|
|
6021
6659
|
});
|
|
6660
|
+
|
|
6022
6661
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
6023
|
-
...
|
|
6662
|
+
...{
|
|
6663
|
+
name: "MEditorViewerMenu"
|
|
6664
|
+
},
|
|
6665
|
+
__name: "ViewerMenu",
|
|
6024
6666
|
props: {
|
|
6025
6667
|
isMultiSelect: { type: Boolean, default: false },
|
|
6026
|
-
stageContentMenu:
|
|
6668
|
+
stageContentMenu: {}
|
|
6027
6669
|
},
|
|
6028
|
-
setup(__props, { expose }) {
|
|
6670
|
+
setup(__props, { expose: __expose }) {
|
|
6029
6671
|
const props = __props;
|
|
6030
6672
|
const services = inject("services");
|
|
6031
6673
|
const editorService = services?.editorService;
|
|
@@ -6035,11 +6677,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
6035
6677
|
const node = computed(() => editorService?.get("node"));
|
|
6036
6678
|
const nodes = computed(() => editorService?.get("nodes"));
|
|
6037
6679
|
const parent = computed(() => editorService?.get("parent"));
|
|
6038
|
-
const stage = computed(() => editorService?.get("stage"));
|
|
6039
6680
|
const menuData = computed(() => [
|
|
6040
6681
|
{
|
|
6041
6682
|
type: "button",
|
|
6042
6683
|
text: "水平居中",
|
|
6684
|
+
icon: markRaw(_sfc_main$4),
|
|
6043
6685
|
display: () => canCenter.value,
|
|
6044
6686
|
handler: () => {
|
|
6045
6687
|
if (!nodes.value)
|
|
@@ -6047,30 +6689,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
6047
6689
|
editorService?.alignCenter(nodes.value);
|
|
6048
6690
|
}
|
|
6049
6691
|
},
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
text: "复制",
|
|
6053
|
-
icon: markRaw(CopyDocument),
|
|
6054
|
-
handler: () => {
|
|
6055
|
-
nodes.value && editorService?.copy(nodes.value);
|
|
6056
|
-
canPaste.value = true;
|
|
6057
|
-
}
|
|
6058
|
-
},
|
|
6059
|
-
{
|
|
6060
|
-
type: "button",
|
|
6061
|
-
text: "粘贴",
|
|
6062
|
-
icon: markRaw(DocumentCopy),
|
|
6063
|
-
display: () => canPaste.value,
|
|
6064
|
-
handler: () => {
|
|
6065
|
-
const rect = menu.value?.$el.getBoundingClientRect();
|
|
6066
|
-
const parentRect = stage.value?.container?.getBoundingClientRect();
|
|
6067
|
-
const initialLeft = (rect?.left || 0) - (parentRect?.left || 0);
|
|
6068
|
-
const initialTop = (rect?.top || 0) - (parentRect?.top || 0);
|
|
6069
|
-
if (!nodes.value || nodes.value.length === 0)
|
|
6070
|
-
return;
|
|
6071
|
-
editorService?.paste({ left: initialLeft, top: initialTop });
|
|
6072
|
-
}
|
|
6073
|
-
},
|
|
6692
|
+
useCopyMenu(),
|
|
6693
|
+
usePasteMenu(menu),
|
|
6074
6694
|
{
|
|
6075
6695
|
type: "divider",
|
|
6076
6696
|
direction: "horizontal",
|
|
@@ -6101,6 +6721,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
6101
6721
|
{
|
|
6102
6722
|
type: "button",
|
|
6103
6723
|
text: "置顶",
|
|
6724
|
+
icon: markRaw(Top),
|
|
6104
6725
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
6105
6726
|
handler: () => {
|
|
6106
6727
|
editorService?.moveLayer(LayerOffset.TOP);
|
|
@@ -6109,25 +6730,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
6109
6730
|
{
|
|
6110
6731
|
type: "button",
|
|
6111
6732
|
text: "置底",
|
|
6733
|
+
icon: markRaw(Bottom),
|
|
6112
6734
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
6113
6735
|
handler: () => {
|
|
6114
6736
|
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
6115
6737
|
}
|
|
6116
6738
|
},
|
|
6739
|
+
useMoveToMenu(services),
|
|
6117
6740
|
{
|
|
6118
6741
|
type: "divider",
|
|
6119
6742
|
direction: "horizontal",
|
|
6120
6743
|
display: () => !isPage(node.value) && !props.isMultiSelect
|
|
6121
6744
|
},
|
|
6122
|
-
|
|
6123
|
-
type: "button",
|
|
6124
|
-
text: "删除",
|
|
6125
|
-
icon: Delete,
|
|
6126
|
-
display: () => !isPage(node.value),
|
|
6127
|
-
handler: () => {
|
|
6128
|
-
nodes.value && editorService?.remove(nodes.value);
|
|
6129
|
-
}
|
|
6130
|
-
},
|
|
6745
|
+
useDeleteMenu(),
|
|
6131
6746
|
{
|
|
6132
6747
|
type: "divider",
|
|
6133
6748
|
direction: "horizontal"
|
|
@@ -6160,10 +6775,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
6160
6775
|
const data = await storageService.getItem(COPY_STORAGE_KEY);
|
|
6161
6776
|
canPaste.value = data !== "undefined" && !!data;
|
|
6162
6777
|
};
|
|
6163
|
-
|
|
6778
|
+
__expose({ show });
|
|
6164
6779
|
return (_ctx, _cache) => {
|
|
6165
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6166
|
-
"menu-data":
|
|
6780
|
+
return openBlock(), createBlock(_sfc_main$e, {
|
|
6781
|
+
"menu-data": menuData.value,
|
|
6167
6782
|
ref_key: "menu",
|
|
6168
6783
|
ref: menu
|
|
6169
6784
|
}, null, 8, ["menu-data"]);
|
|
@@ -6171,13 +6786,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
6171
6786
|
}
|
|
6172
6787
|
});
|
|
6173
6788
|
|
|
6174
|
-
const __default__$1 = defineComponent({
|
|
6175
|
-
name: "MEditorStage"
|
|
6176
|
-
});
|
|
6177
6789
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
6178
|
-
...
|
|
6790
|
+
...{
|
|
6791
|
+
name: "MEditorStage"
|
|
6792
|
+
},
|
|
6793
|
+
__name: "Stage",
|
|
6179
6794
|
props: {
|
|
6180
|
-
stageContentMenu:
|
|
6795
|
+
stageContentMenu: {}
|
|
6181
6796
|
},
|
|
6182
6797
|
setup(__props) {
|
|
6183
6798
|
let stage = null;
|
|
@@ -6203,6 +6818,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6203
6818
|
if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value)
|
|
6204
6819
|
return;
|
|
6205
6820
|
stage = useStage(stageOptions);
|
|
6821
|
+
stage.on("select", () => {
|
|
6822
|
+
stageWrap.value?.container?.focus();
|
|
6823
|
+
});
|
|
6206
6824
|
services?.editorService.set("stage", markRaw(stage));
|
|
6207
6825
|
stage?.mount(stageContainer.value);
|
|
6208
6826
|
if (!node.value?.id)
|
|
@@ -6243,22 +6861,26 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6243
6861
|
}
|
|
6244
6862
|
});
|
|
6245
6863
|
onMounted(() => {
|
|
6246
|
-
|
|
6864
|
+
if (stageWrap.value?.container) {
|
|
6865
|
+
resizeObserver.observe(stageWrap.value.container);
|
|
6866
|
+
services?.keybindingService.registeEl("stage", stageWrap.value.container);
|
|
6867
|
+
}
|
|
6247
6868
|
});
|
|
6248
6869
|
onUnmounted(() => {
|
|
6249
6870
|
stage?.destroy();
|
|
6250
6871
|
resizeObserver.disconnect();
|
|
6251
6872
|
services?.editorService.set("stage", null);
|
|
6873
|
+
services?.keybindingService.unregisteEl("stage");
|
|
6252
6874
|
});
|
|
6253
|
-
const contextmenuHandler = (
|
|
6254
|
-
|
|
6255
|
-
menu.value?.show(
|
|
6875
|
+
const contextmenuHandler = (e) => {
|
|
6876
|
+
e.preventDefault();
|
|
6877
|
+
menu.value?.show(e);
|
|
6256
6878
|
};
|
|
6257
|
-
const dragoverHandler = (
|
|
6258
|
-
|
|
6259
|
-
if (
|
|
6260
|
-
|
|
6261
|
-
|
|
6879
|
+
const dragoverHandler = (e) => {
|
|
6880
|
+
e.preventDefault();
|
|
6881
|
+
if (!e.dataTransfer)
|
|
6882
|
+
return;
|
|
6883
|
+
e.dataTransfer.dropEffect = "move";
|
|
6262
6884
|
};
|
|
6263
6885
|
const dropHandler = async (e) => {
|
|
6264
6886
|
e.preventDefault();
|
|
@@ -6269,7 +6891,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6269
6891
|
parent = services?.editorService.getNodeById(parentEl.id, false);
|
|
6270
6892
|
}
|
|
6271
6893
|
if (e.dataTransfer && parent && stageContainer.value && stage) {
|
|
6272
|
-
const
|
|
6894
|
+
const parseDSL = getConfig("parseDSL");
|
|
6895
|
+
const data = e.dataTransfer.getData("text/html");
|
|
6896
|
+
if (!data)
|
|
6897
|
+
return;
|
|
6898
|
+
const config = parseDSL(`(${data})`);
|
|
6899
|
+
if (!config)
|
|
6900
|
+
return;
|
|
6273
6901
|
const layout = await services?.editorService.getLayout(parent);
|
|
6274
6902
|
const containerRect = stageContainer.value.getBoundingClientRect();
|
|
6275
6903
|
const { scrollTop, scrollLeft } = stage.mask;
|
|
@@ -6298,26 +6926,28 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6298
6926
|
}
|
|
6299
6927
|
};
|
|
6300
6928
|
return (_ctx, _cache) => {
|
|
6301
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6929
|
+
return openBlock(), createBlock(_sfc_main$5, {
|
|
6302
6930
|
class: "m-editor-stage",
|
|
6303
6931
|
ref_key: "stageWrap",
|
|
6304
6932
|
ref: stageWrap,
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
"wrap-
|
|
6309
|
-
|
|
6933
|
+
tabindex: "-1",
|
|
6934
|
+
width: stageRect.value?.width,
|
|
6935
|
+
height: stageRect.value?.height,
|
|
6936
|
+
"wrap-width": stageContainerRect.value?.width,
|
|
6937
|
+
"wrap-height": stageContainerRect.value?.height,
|
|
6938
|
+
zoom: zoom.value,
|
|
6310
6939
|
"correction-scroll-size": {
|
|
6311
6940
|
width: 60,
|
|
6312
6941
|
height: 50
|
|
6313
|
-
}
|
|
6942
|
+
},
|
|
6943
|
+
onClick: _cache[0] || (_cache[0] = ($event) => stageWrap.value?.container?.focus())
|
|
6314
6944
|
}, {
|
|
6315
6945
|
default: withCtx(() => [
|
|
6316
6946
|
createElementVNode("div", {
|
|
6317
6947
|
class: "m-editor-stage-container",
|
|
6318
6948
|
ref_key: "stageContainer",
|
|
6319
6949
|
ref: stageContainer,
|
|
6320
|
-
style: normalizeStyle(`transform: scale(${
|
|
6950
|
+
style: normalizeStyle(`transform: scale(${zoom.value});`),
|
|
6321
6951
|
onContextmenu: contextmenuHandler,
|
|
6322
6952
|
onDrop: dropHandler,
|
|
6323
6953
|
onDragover: dragoverHandler
|
|
@@ -6326,8 +6956,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6326
6956
|
createVNode(_sfc_main$3, {
|
|
6327
6957
|
ref_key: "menu",
|
|
6328
6958
|
ref: menu,
|
|
6329
|
-
"is-multi-select":
|
|
6330
|
-
"stage-content-menu":
|
|
6959
|
+
"is-multi-select": isMultiSelect.value,
|
|
6960
|
+
"stage-content-menu": _ctx.stageContentMenu
|
|
6331
6961
|
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
6332
6962
|
]))
|
|
6333
6963
|
]),
|
|
@@ -6337,131 +6967,29 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6337
6967
|
}
|
|
6338
6968
|
});
|
|
6339
6969
|
|
|
6340
|
-
const
|
|
6341
|
-
name: "MEditorWorkspace"
|
|
6342
|
-
});
|
|
6970
|
+
const _hoisted_1 = { class: "m-editor-workspace" };
|
|
6343
6971
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
6344
|
-
...
|
|
6972
|
+
...{
|
|
6973
|
+
name: "MEditorWorkspace"
|
|
6974
|
+
},
|
|
6975
|
+
__name: "Workspace",
|
|
6345
6976
|
props: {
|
|
6346
|
-
stageContentMenu:
|
|
6977
|
+
stageContentMenu: {}
|
|
6347
6978
|
},
|
|
6348
6979
|
setup(__props) {
|
|
6349
6980
|
const services = inject("services");
|
|
6350
|
-
const workspace = ref();
|
|
6351
|
-
const nodes = computed(() => services?.editorService.get("nodes"));
|
|
6352
6981
|
const page = computed(() => services?.editorService.get("page"));
|
|
6353
|
-
const mouseenterHandler = () => {
|
|
6354
|
-
workspace.value?.focus();
|
|
6355
|
-
};
|
|
6356
|
-
const mouseleaveHandler = () => {
|
|
6357
|
-
workspace.value?.blur();
|
|
6358
|
-
};
|
|
6359
|
-
let keycon;
|
|
6360
|
-
onMounted(() => {
|
|
6361
|
-
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
6362
|
-
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
6363
|
-
keycon = new KeyController(workspace.value);
|
|
6364
|
-
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
6365
|
-
const ctrl = isMac ? "meta" : "ctrl";
|
|
6366
|
-
keycon.keyup("delete", (e) => {
|
|
6367
|
-
e.inputEvent.preventDefault();
|
|
6368
|
-
if (!nodes.value || isPage(nodes.value[0]))
|
|
6369
|
-
return;
|
|
6370
|
-
services?.editorService.remove(nodes.value);
|
|
6371
|
-
}).keyup("backspace", (e) => {
|
|
6372
|
-
e.inputEvent.preventDefault();
|
|
6373
|
-
if (!nodes.value || isPage(nodes.value[0]))
|
|
6374
|
-
return;
|
|
6375
|
-
services?.editorService.remove(nodes.value);
|
|
6376
|
-
}).keydown([ctrl, "c"], (e) => {
|
|
6377
|
-
e.inputEvent.preventDefault();
|
|
6378
|
-
nodes.value && services?.editorService.copy(nodes.value);
|
|
6379
|
-
}).keydown([ctrl, "v"], (e) => {
|
|
6380
|
-
e.inputEvent.preventDefault();
|
|
6381
|
-
nodes.value && services?.editorService.paste({ offsetX: 10, offsetY: 10 });
|
|
6382
|
-
}).keydown([ctrl, "x"], (e) => {
|
|
6383
|
-
e.inputEvent.preventDefault();
|
|
6384
|
-
if (!nodes.value || isPage(nodes.value[0]))
|
|
6385
|
-
return;
|
|
6386
|
-
services?.editorService.copy(nodes.value);
|
|
6387
|
-
services?.editorService.remove(nodes.value);
|
|
6388
|
-
}).keydown([ctrl, "z"], (e) => {
|
|
6389
|
-
e.inputEvent.preventDefault();
|
|
6390
|
-
services?.editorService.undo();
|
|
6391
|
-
}).keydown([ctrl, "shift", "z"], (e) => {
|
|
6392
|
-
e.inputEvent.preventDefault();
|
|
6393
|
-
services?.editorService.redo();
|
|
6394
|
-
}).keydown("up", (e) => {
|
|
6395
|
-
e.inputEvent.preventDefault();
|
|
6396
|
-
services?.editorService.move(0, -1);
|
|
6397
|
-
}).keydown("down", (e) => {
|
|
6398
|
-
e.inputEvent.preventDefault();
|
|
6399
|
-
services?.editorService.move(0, 1);
|
|
6400
|
-
}).keydown("left", (e) => {
|
|
6401
|
-
e.inputEvent.preventDefault();
|
|
6402
|
-
services?.editorService.move(-1, 0);
|
|
6403
|
-
}).keydown("right", (e) => {
|
|
6404
|
-
e.inputEvent.preventDefault();
|
|
6405
|
-
services?.editorService.move(1, 0);
|
|
6406
|
-
}).keydown([ctrl, "up"], (e) => {
|
|
6407
|
-
e.inputEvent.preventDefault();
|
|
6408
|
-
services?.editorService.move(0, -10);
|
|
6409
|
-
}).keydown([ctrl, "down"], (e) => {
|
|
6410
|
-
e.inputEvent.preventDefault();
|
|
6411
|
-
services?.editorService.move(0, 10);
|
|
6412
|
-
}).keydown([ctrl, "left"], (e) => {
|
|
6413
|
-
e.inputEvent.preventDefault();
|
|
6414
|
-
services?.editorService.move(-10, 0);
|
|
6415
|
-
}).keydown([ctrl, "right"], (e) => {
|
|
6416
|
-
e.inputEvent.preventDefault();
|
|
6417
|
-
services?.editorService.move(10, 0);
|
|
6418
|
-
}).keydown("tab", (e) => {
|
|
6419
|
-
e.inputEvent.preventDefault();
|
|
6420
|
-
services?.editorService.selectNextNode();
|
|
6421
|
-
}).keydown([ctrl, "tab"], (e) => {
|
|
6422
|
-
e.inputEvent.preventDefault();
|
|
6423
|
-
services?.editorService.selectNextPage();
|
|
6424
|
-
}).keydown([ctrl, "="], (e) => {
|
|
6425
|
-
e.inputEvent.preventDefault();
|
|
6426
|
-
services?.uiService.zoom(0.1);
|
|
6427
|
-
}).keydown([ctrl, "numpadplus"], (e) => {
|
|
6428
|
-
e.inputEvent.preventDefault();
|
|
6429
|
-
services?.uiService.zoom(0.1);
|
|
6430
|
-
}).keydown([ctrl, "-"], (e) => {
|
|
6431
|
-
e.inputEvent.preventDefault();
|
|
6432
|
-
services?.uiService.zoom(-0.1);
|
|
6433
|
-
}).keydown([ctrl, "numpad-"], (e) => {
|
|
6434
|
-
e.inputEvent.preventDefault();
|
|
6435
|
-
services?.uiService.zoom(-0.1);
|
|
6436
|
-
}).keydown([ctrl, "0"], async (e) => {
|
|
6437
|
-
e.inputEvent.preventDefault();
|
|
6438
|
-
services?.uiService.set("zoom", await services.uiService.calcZoom());
|
|
6439
|
-
}).keydown([ctrl, "1"], (e) => {
|
|
6440
|
-
e.inputEvent.preventDefault();
|
|
6441
|
-
services?.uiService.set("zoom", 1);
|
|
6442
|
-
});
|
|
6443
|
-
});
|
|
6444
|
-
onUnmounted(() => {
|
|
6445
|
-
workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
6446
|
-
workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
6447
|
-
keycon.destroy();
|
|
6448
|
-
});
|
|
6449
6982
|
return (_ctx, _cache) => {
|
|
6450
|
-
return openBlock(), createElementBlock("div",
|
|
6451
|
-
|
|
6452
|
-
tabindex: "-1",
|
|
6453
|
-
ref_key: "workspace",
|
|
6454
|
-
ref: workspace
|
|
6455
|
-
}, [
|
|
6456
|
-
createVNode(_sfc_main$8),
|
|
6983
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
6984
|
+
createVNode(_sfc_main$9),
|
|
6457
6985
|
renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
6458
|
-
|
|
6986
|
+
page.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
6459
6987
|
key: 0,
|
|
6460
|
-
"stage-content-menu":
|
|
6988
|
+
"stage-content-menu": _ctx.stageContentMenu
|
|
6461
6989
|
}, null, 8, ["stage-content-menu"])) : createCommentVNode("", true)
|
|
6462
6990
|
]),
|
|
6463
6991
|
renderSlot(_ctx.$slots, "workspace-content"),
|
|
6464
|
-
createVNode(_sfc_main$
|
|
6992
|
+
createVNode(_sfc_main$7, null, {
|
|
6465
6993
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
6466
6994
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
6467
6995
|
]),
|
|
@@ -6470,7 +6998,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
6470
6998
|
]),
|
|
6471
6999
|
_: 3
|
|
6472
7000
|
})
|
|
6473
|
-
]
|
|
7001
|
+
]);
|
|
6474
7002
|
};
|
|
6475
7003
|
}
|
|
6476
7004
|
});
|
|
@@ -6499,8 +7027,8 @@ class CodeBlock extends BaseService {
|
|
|
6499
7027
|
* @param {CodeBlockDSL} codeDsl 代码DSL
|
|
6500
7028
|
* @returns {void}
|
|
6501
7029
|
*/
|
|
6502
|
-
async setCodeDsl(
|
|
6503
|
-
this.state.codeDsl =
|
|
7030
|
+
async setCodeDsl(codeDsl) {
|
|
7031
|
+
this.state.codeDsl = codeDsl;
|
|
6504
7032
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
6505
7033
|
}
|
|
6506
7034
|
/**
|
|
@@ -6517,13 +7045,13 @@ class CodeBlock extends BaseService {
|
|
|
6517
7045
|
* @param {Id} id 代码块id
|
|
6518
7046
|
* @returns {CodeBlockContent | null}
|
|
6519
7047
|
*/
|
|
6520
|
-
getCodeContentById(
|
|
6521
|
-
if (!
|
|
7048
|
+
getCodeContentById(id) {
|
|
7049
|
+
if (!id)
|
|
6522
7050
|
return null;
|
|
6523
7051
|
const totalCodeDsl = this.getCodeDsl();
|
|
6524
7052
|
if (!totalCodeDsl)
|
|
6525
7053
|
return null;
|
|
6526
|
-
return totalCodeDsl[
|
|
7054
|
+
return totalCodeDsl[id] ?? null;
|
|
6527
7055
|
}
|
|
6528
7056
|
/**
|
|
6529
7057
|
* 设置代码块ID和代码内容到源dsl
|
|
@@ -6538,7 +7066,8 @@ class CodeBlock extends BaseService {
|
|
|
6538
7066
|
}
|
|
6539
7067
|
const codeConfigProcessed = codeConfig;
|
|
6540
7068
|
if (codeConfig.content) {
|
|
6541
|
-
|
|
7069
|
+
const parseDSL = getConfig("parseDSL");
|
|
7070
|
+
codeConfigProcessed.content = parseDSL(codeConfig.content);
|
|
6542
7071
|
}
|
|
6543
7072
|
const existContent = codeDsl[id] || {};
|
|
6544
7073
|
codeDsl[id] = {
|
|
@@ -6553,8 +7082,8 @@ class CodeBlock extends BaseService {
|
|
|
6553
7082
|
* @returns {CodeBlockDSL}
|
|
6554
7083
|
*/
|
|
6555
7084
|
getCodeDslByIds(ids) {
|
|
6556
|
-
const
|
|
6557
|
-
return pick(
|
|
7085
|
+
const codeDsl = this.getCodeDsl();
|
|
7086
|
+
return pick(codeDsl, ids);
|
|
6558
7087
|
}
|
|
6559
7088
|
/**
|
|
6560
7089
|
* 设置代码编辑面板展示状态
|
|
@@ -6577,10 +7106,10 @@ class CodeBlock extends BaseService {
|
|
|
6577
7106
|
* @param {Id} id 代码块id
|
|
6578
7107
|
* @returns {void}
|
|
6579
7108
|
*/
|
|
6580
|
-
setCodeEditorContent(status,
|
|
6581
|
-
if (!
|
|
7109
|
+
setCodeEditorContent(status, id) {
|
|
7110
|
+
if (!id)
|
|
6582
7111
|
return;
|
|
6583
|
-
this.setId(
|
|
7112
|
+
this.setId(id);
|
|
6584
7113
|
this.state.isShowCodeEditor = status;
|
|
6585
7114
|
}
|
|
6586
7115
|
/**
|
|
@@ -6610,10 +7139,10 @@ class CodeBlock extends BaseService {
|
|
|
6610
7139
|
* @param {Id} id 代码块id
|
|
6611
7140
|
* @returns {void}
|
|
6612
7141
|
*/
|
|
6613
|
-
setId(
|
|
6614
|
-
if (!
|
|
7142
|
+
setId(id) {
|
|
7143
|
+
if (!id)
|
|
6615
7144
|
return;
|
|
6616
|
-
this.state.id =
|
|
7145
|
+
this.state.id = id;
|
|
6617
7146
|
}
|
|
6618
7147
|
/**
|
|
6619
7148
|
* 获取当前选中的代码块ID
|
|
@@ -6678,9 +7207,9 @@ class CodeBlock extends BaseService {
|
|
|
6678
7207
|
const currentDsl = await this.getCodeDsl();
|
|
6679
7208
|
if (!currentDsl)
|
|
6680
7209
|
return;
|
|
6681
|
-
codeIds.forEach((
|
|
6682
|
-
delete currentDsl[
|
|
6683
|
-
this.emit("remove",
|
|
7210
|
+
codeIds.forEach((id) => {
|
|
7211
|
+
delete currentDsl[id];
|
|
7212
|
+
this.emit("remove", id);
|
|
6684
7213
|
});
|
|
6685
7214
|
}
|
|
6686
7215
|
/**
|
|
@@ -7089,6 +7618,7 @@ class Watcher extends EventEmitter {
|
|
|
7089
7618
|
});
|
|
7090
7619
|
});
|
|
7091
7620
|
});
|
|
7621
|
+
this.emit("collected", nodes, deep);
|
|
7092
7622
|
}
|
|
7093
7623
|
/**
|
|
7094
7624
|
* 清除依赖
|
|
@@ -7117,6 +7647,7 @@ class Watcher extends EventEmitter {
|
|
|
7117
7647
|
const fullKey = prop ? `${prop}.${key}` : key;
|
|
7118
7648
|
if (target.isTarget(key, value)) {
|
|
7119
7649
|
target.updateDep(node, fullKey);
|
|
7650
|
+
this.emit("update-dep", node, fullKey);
|
|
7120
7651
|
} else if (!keyIsItems && Array.isArray(value)) {
|
|
7121
7652
|
value.forEach((item, index) => {
|
|
7122
7653
|
collectTarget(item, `${fullKey}.${index}`);
|
|
@@ -7192,6 +7723,275 @@ class Events extends BaseService {
|
|
|
7192
7723
|
}
|
|
7193
7724
|
const eventsService = new Events();
|
|
7194
7725
|
|
|
7726
|
+
class Keybinding extends BaseService {
|
|
7727
|
+
ctrlKey = /mac os x/.test(navigator.userAgent.toLowerCase()) ? "meta" : "ctrl";
|
|
7728
|
+
controllers = /* @__PURE__ */ new Map();
|
|
7729
|
+
bindingList = [];
|
|
7730
|
+
commands = {
|
|
7731
|
+
[KeyBindingCommand.DELETE_NODE]: () => {
|
|
7732
|
+
const nodes = editorService.get("nodes");
|
|
7733
|
+
if (!nodes || isPage(nodes[0]))
|
|
7734
|
+
return;
|
|
7735
|
+
editorService.remove(nodes);
|
|
7736
|
+
},
|
|
7737
|
+
[KeyBindingCommand.COPY_NODE]: () => {
|
|
7738
|
+
const nodes = editorService.get("nodes");
|
|
7739
|
+
nodes && editorService.copy(nodes);
|
|
7740
|
+
},
|
|
7741
|
+
[KeyBindingCommand.CUT_NODE]: () => {
|
|
7742
|
+
const nodes = editorService.get("nodes");
|
|
7743
|
+
if (!nodes || isPage(nodes[0]))
|
|
7744
|
+
return;
|
|
7745
|
+
editorService.copy(nodes);
|
|
7746
|
+
editorService.remove(nodes);
|
|
7747
|
+
},
|
|
7748
|
+
[KeyBindingCommand.PASTE_NODE]: () => {
|
|
7749
|
+
const nodes = editorService.get("nodes");
|
|
7750
|
+
nodes && editorService.paste({ offsetX: 10, offsetY: 10 });
|
|
7751
|
+
},
|
|
7752
|
+
[KeyBindingCommand.UNDO]: () => {
|
|
7753
|
+
editorService.undo();
|
|
7754
|
+
},
|
|
7755
|
+
[KeyBindingCommand.REDO]: () => {
|
|
7756
|
+
editorService.redo();
|
|
7757
|
+
},
|
|
7758
|
+
[KeyBindingCommand.ZOOM_IN]: () => {
|
|
7759
|
+
uiService.zoom(0.1);
|
|
7760
|
+
},
|
|
7761
|
+
[KeyBindingCommand.ZOOM_OUT]: () => {
|
|
7762
|
+
uiService.zoom(-0.1);
|
|
7763
|
+
},
|
|
7764
|
+
[KeyBindingCommand.ZOOM_RESET]: () => {
|
|
7765
|
+
uiService.set("zoom", 1);
|
|
7766
|
+
},
|
|
7767
|
+
[KeyBindingCommand.ZOOM_FIT]: async () => {
|
|
7768
|
+
uiService.set("zoom", await uiService.calcZoom());
|
|
7769
|
+
},
|
|
7770
|
+
[KeyBindingCommand.MOVE_UP_1]: () => {
|
|
7771
|
+
editorService.move(0, -1);
|
|
7772
|
+
},
|
|
7773
|
+
[KeyBindingCommand.MOVE_DOWN_1]: () => {
|
|
7774
|
+
editorService.move(0, 1);
|
|
7775
|
+
},
|
|
7776
|
+
[KeyBindingCommand.MOVE_LEFT_1]: () => {
|
|
7777
|
+
editorService.move(-1, 0);
|
|
7778
|
+
},
|
|
7779
|
+
[KeyBindingCommand.MOVE_RIGHT_1]: () => {
|
|
7780
|
+
editorService.move(1, 0);
|
|
7781
|
+
},
|
|
7782
|
+
[KeyBindingCommand.MOVE_UP_10]: () => {
|
|
7783
|
+
editorService.move(0, -10);
|
|
7784
|
+
},
|
|
7785
|
+
[KeyBindingCommand.MOVE_DOWN_10]: () => {
|
|
7786
|
+
editorService.move(0, 10);
|
|
7787
|
+
},
|
|
7788
|
+
[KeyBindingCommand.MOVE_LEFT_10]: () => {
|
|
7789
|
+
editorService.move(-10, 0);
|
|
7790
|
+
},
|
|
7791
|
+
[KeyBindingCommand.MOVE_RIGHT_10]: () => {
|
|
7792
|
+
editorService.move(10, 0);
|
|
7793
|
+
},
|
|
7794
|
+
[KeyBindingCommand.SWITCH_NODE]: () => {
|
|
7795
|
+
editorService.selectNextNode();
|
|
7796
|
+
}
|
|
7797
|
+
};
|
|
7798
|
+
registeCommand(command, handler) {
|
|
7799
|
+
this.commands[command] = handler;
|
|
7800
|
+
}
|
|
7801
|
+
unregisteCommand(command) {
|
|
7802
|
+
delete this.commands[command];
|
|
7803
|
+
}
|
|
7804
|
+
registeEl(name, el) {
|
|
7805
|
+
if (name !== "global" && !el) {
|
|
7806
|
+
throw new Error("只有name为global可以不传el");
|
|
7807
|
+
}
|
|
7808
|
+
const keycon = new KeyController(el);
|
|
7809
|
+
this.controllers.set(name, keycon);
|
|
7810
|
+
this.bind(name);
|
|
7811
|
+
}
|
|
7812
|
+
unregisteEl(name) {
|
|
7813
|
+
this.controllers.get(name)?.destroy();
|
|
7814
|
+
this.controllers.delete(name);
|
|
7815
|
+
this.bindingList.forEach((item) => {
|
|
7816
|
+
item.binded = false;
|
|
7817
|
+
});
|
|
7818
|
+
}
|
|
7819
|
+
registe(maps) {
|
|
7820
|
+
for (const keybindingItem of maps) {
|
|
7821
|
+
const { command, keybinding, when } = keybindingItem;
|
|
7822
|
+
for (const [type = "", eventType = "keydown"] of when) {
|
|
7823
|
+
const cacheItem = { type, command, keybinding, eventType, binded: false };
|
|
7824
|
+
this.bindingList.push(cacheItem);
|
|
7825
|
+
}
|
|
7826
|
+
}
|
|
7827
|
+
this.bind();
|
|
7828
|
+
}
|
|
7829
|
+
reset() {
|
|
7830
|
+
this.controllers.forEach((keycon) => {
|
|
7831
|
+
keycon.destroy();
|
|
7832
|
+
});
|
|
7833
|
+
this.controllers.clear();
|
|
7834
|
+
this.bindingList = [];
|
|
7835
|
+
}
|
|
7836
|
+
destroy() {
|
|
7837
|
+
this.reset();
|
|
7838
|
+
}
|
|
7839
|
+
bind(name) {
|
|
7840
|
+
for (const item of this.bindingList) {
|
|
7841
|
+
const { type, eventType, command, keybinding, binded } = item;
|
|
7842
|
+
if (name && name !== type) {
|
|
7843
|
+
continue;
|
|
7844
|
+
}
|
|
7845
|
+
if (binded) {
|
|
7846
|
+
continue;
|
|
7847
|
+
}
|
|
7848
|
+
const keycon = this.controllers.get(type);
|
|
7849
|
+
if (!keycon) {
|
|
7850
|
+
continue;
|
|
7851
|
+
}
|
|
7852
|
+
const handler = (e) => {
|
|
7853
|
+
e.inputEvent.preventDefault();
|
|
7854
|
+
this.commands[command]?.(e.inputEvent);
|
|
7855
|
+
};
|
|
7856
|
+
this.getKeyconKeys(keybinding).forEach((keys) => {
|
|
7857
|
+
if (keys[0]) {
|
|
7858
|
+
keycon[eventType](keys, handler);
|
|
7859
|
+
} else {
|
|
7860
|
+
keycon[eventType](handler);
|
|
7861
|
+
}
|
|
7862
|
+
});
|
|
7863
|
+
item.binded = true;
|
|
7864
|
+
}
|
|
7865
|
+
}
|
|
7866
|
+
getKeyconKeys(keybinding = "") {
|
|
7867
|
+
const splitKey = (key) => key.split("+").map((k) => k === "ctrl" ? this.ctrlKey : k);
|
|
7868
|
+
if (Array.isArray(keybinding)) {
|
|
7869
|
+
return keybinding.map((key) => splitKey(key));
|
|
7870
|
+
}
|
|
7871
|
+
return [splitKey(keybinding)];
|
|
7872
|
+
}
|
|
7873
|
+
}
|
|
7874
|
+
const keybindingService = new Keybinding();
|
|
7875
|
+
|
|
7876
|
+
const keybindingConfig = [
|
|
7877
|
+
{
|
|
7878
|
+
command: KeyBindingCommand.DELETE_NODE,
|
|
7879
|
+
keybinding: ["delete", "backspace"],
|
|
7880
|
+
when: [
|
|
7881
|
+
["stage", "keyup"],
|
|
7882
|
+
["layer-panel", "keydown"]
|
|
7883
|
+
]
|
|
7884
|
+
},
|
|
7885
|
+
{
|
|
7886
|
+
command: KeyBindingCommand.COPY_NODE,
|
|
7887
|
+
keybinding: "ctrl+c",
|
|
7888
|
+
when: [
|
|
7889
|
+
["stage", "keydown"],
|
|
7890
|
+
["layer-panel", "keydown"]
|
|
7891
|
+
]
|
|
7892
|
+
},
|
|
7893
|
+
{
|
|
7894
|
+
command: KeyBindingCommand.PASTE_NODE,
|
|
7895
|
+
keybinding: "ctrl+v",
|
|
7896
|
+
when: [
|
|
7897
|
+
["stage", "keydown"],
|
|
7898
|
+
["layer-panel", "keydown"]
|
|
7899
|
+
]
|
|
7900
|
+
},
|
|
7901
|
+
{
|
|
7902
|
+
command: KeyBindingCommand.CUT_NODE,
|
|
7903
|
+
keybinding: "ctrl+x",
|
|
7904
|
+
when: [
|
|
7905
|
+
["stage", "keydown"],
|
|
7906
|
+
["layer-panel", "keydown"]
|
|
7907
|
+
]
|
|
7908
|
+
},
|
|
7909
|
+
{
|
|
7910
|
+
command: KeyBindingCommand.UNDO,
|
|
7911
|
+
keybinding: "ctrl+z",
|
|
7912
|
+
when: [
|
|
7913
|
+
["stage", "keydown"],
|
|
7914
|
+
["layer-panel", "keydown"]
|
|
7915
|
+
]
|
|
7916
|
+
},
|
|
7917
|
+
{
|
|
7918
|
+
command: KeyBindingCommand.REDO,
|
|
7919
|
+
keybinding: "ctrl+shift+z",
|
|
7920
|
+
when: [
|
|
7921
|
+
["stage", "keydown"],
|
|
7922
|
+
["layer-panel", "keydown"]
|
|
7923
|
+
]
|
|
7924
|
+
},
|
|
7925
|
+
{
|
|
7926
|
+
command: KeyBindingCommand.MOVE_UP_1,
|
|
7927
|
+
keybinding: "up",
|
|
7928
|
+
when: [["stage", "keydown"]]
|
|
7929
|
+
},
|
|
7930
|
+
{
|
|
7931
|
+
command: KeyBindingCommand.MOVE_DOWN_1,
|
|
7932
|
+
keybinding: "down",
|
|
7933
|
+
when: [["stage", "keydown"]]
|
|
7934
|
+
},
|
|
7935
|
+
{
|
|
7936
|
+
command: KeyBindingCommand.MOVE_LEFT_1,
|
|
7937
|
+
keybinding: "left",
|
|
7938
|
+
when: [["stage", "keydown"]]
|
|
7939
|
+
},
|
|
7940
|
+
{
|
|
7941
|
+
command: KeyBindingCommand.MOVE_RIGHT_1,
|
|
7942
|
+
keybinding: "right",
|
|
7943
|
+
when: [["stage", "keydown"]]
|
|
7944
|
+
},
|
|
7945
|
+
{
|
|
7946
|
+
command: KeyBindingCommand.MOVE_UP_10,
|
|
7947
|
+
keybinding: "ctrl+up",
|
|
7948
|
+
when: [["stage", "keydown"]]
|
|
7949
|
+
},
|
|
7950
|
+
{
|
|
7951
|
+
command: KeyBindingCommand.MOVE_DOWN_10,
|
|
7952
|
+
keybinding: "ctrl+down",
|
|
7953
|
+
when: [["stage", "keydown"]]
|
|
7954
|
+
},
|
|
7955
|
+
{
|
|
7956
|
+
command: KeyBindingCommand.MOVE_LEFT_10,
|
|
7957
|
+
keybinding: "ctrl+left",
|
|
7958
|
+
when: [["stage", "keydown"]]
|
|
7959
|
+
},
|
|
7960
|
+
{
|
|
7961
|
+
command: KeyBindingCommand.MOVE_RIGHT_10,
|
|
7962
|
+
keybinding: "ctrl+right",
|
|
7963
|
+
when: [["stage", "keydown"]]
|
|
7964
|
+
},
|
|
7965
|
+
{
|
|
7966
|
+
command: KeyBindingCommand.SWITCH_NODE,
|
|
7967
|
+
keybinding: "tab",
|
|
7968
|
+
when: [
|
|
7969
|
+
["stage", "keydown"],
|
|
7970
|
+
["layer-panel", "keydown"]
|
|
7971
|
+
]
|
|
7972
|
+
},
|
|
7973
|
+
{
|
|
7974
|
+
command: KeyBindingCommand.ZOOM_IN,
|
|
7975
|
+
keybinding: ["ctrl+=", "ctrl+numpadplus"],
|
|
7976
|
+
when: [["stage", "keydown"]]
|
|
7977
|
+
},
|
|
7978
|
+
{
|
|
7979
|
+
command: KeyBindingCommand.ZOOM_OUT,
|
|
7980
|
+
keybinding: ["ctrl+-", "ctrl+numpad-"],
|
|
7981
|
+
when: [["stage", "keydown"]]
|
|
7982
|
+
},
|
|
7983
|
+
{
|
|
7984
|
+
command: KeyBindingCommand.ZOOM_FIT,
|
|
7985
|
+
keybinding: "ctrl+0",
|
|
7986
|
+
when: [["stage", "keydown"]]
|
|
7987
|
+
},
|
|
7988
|
+
{
|
|
7989
|
+
command: KeyBindingCommand.ZOOM_RESET,
|
|
7990
|
+
keybinding: "ctrl+1",
|
|
7991
|
+
when: [["stage", "keydown"]]
|
|
7992
|
+
}
|
|
7993
|
+
];
|
|
7994
|
+
|
|
7195
7995
|
const editorProps = {
|
|
7196
7996
|
/** 页面初始值 */
|
|
7197
7997
|
modelValue: {
|
|
@@ -7290,6 +8090,9 @@ const editorProps = {
|
|
|
7290
8090
|
},
|
|
7291
8091
|
disabledDragStart: {
|
|
7292
8092
|
type: Boolean
|
|
8093
|
+
},
|
|
8094
|
+
extendFormState: {
|
|
8095
|
+
type: Function
|
|
7293
8096
|
}
|
|
7294
8097
|
};
|
|
7295
8098
|
|
|
@@ -7298,6 +8101,9 @@ const createCodeBlockTarget = (id, codeBlock) => new Target({
|
|
|
7298
8101
|
id,
|
|
7299
8102
|
name: codeBlock.name,
|
|
7300
8103
|
isTarget: (key, value) => {
|
|
8104
|
+
if (id === value) {
|
|
8105
|
+
return true;
|
|
8106
|
+
}
|
|
7301
8107
|
if (value?.hookType === HookType.CODE && !isEmpty(value.hookData)) {
|
|
7302
8108
|
const index = value.hookData.findIndex((item) => item.codeId === id);
|
|
7303
8109
|
return Boolean(index > -1);
|
|
@@ -7309,7 +8115,10 @@ const createDataSourceTarget = (id, ds) => new Target({
|
|
|
7309
8115
|
type: "data-source",
|
|
7310
8116
|
id,
|
|
7311
8117
|
name: ds.title || `${id}`,
|
|
7312
|
-
isTarget: (key, value) =>
|
|
8118
|
+
isTarget: (key, value) => (
|
|
8119
|
+
// 关联数据源对象或者在模板在使用数据源
|
|
8120
|
+
value.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)
|
|
8121
|
+
)
|
|
7313
8122
|
});
|
|
7314
8123
|
|
|
7315
8124
|
const initServiceState = (props, {
|
|
@@ -7319,7 +8128,8 @@ const initServiceState = (props, {
|
|
|
7319
8128
|
propsService,
|
|
7320
8129
|
eventsService,
|
|
7321
8130
|
uiService,
|
|
7322
|
-
codeBlockService
|
|
8131
|
+
codeBlockService,
|
|
8132
|
+
keybindingService
|
|
7323
8133
|
}) => {
|
|
7324
8134
|
watch(
|
|
7325
8135
|
() => props.modelValue,
|
|
@@ -7388,9 +8198,46 @@ const initServiceState = (props, {
|
|
|
7388
8198
|
uiService.resetState();
|
|
7389
8199
|
componentListService.resetState();
|
|
7390
8200
|
codeBlockService.resetState();
|
|
8201
|
+
keybindingService.reset();
|
|
7391
8202
|
});
|
|
7392
8203
|
};
|
|
7393
8204
|
const initServiceEvents = (props, emit, { editorService, codeBlockService, dataSourceService, depService }) => {
|
|
8205
|
+
const getApp = () => {
|
|
8206
|
+
const stage = editorService.get("stage");
|
|
8207
|
+
return stage?.renderer.runtime?.getApp?.();
|
|
8208
|
+
};
|
|
8209
|
+
const updateDataSoucreSchema = () => {
|
|
8210
|
+
const root = editorService.get("root");
|
|
8211
|
+
if (root?.dataSources) {
|
|
8212
|
+
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
8213
|
+
}
|
|
8214
|
+
};
|
|
8215
|
+
const upateNodeWhenDataSourceChange = (nodes) => {
|
|
8216
|
+
const root = editorService.get("root");
|
|
8217
|
+
const stage = editorService.get("stage");
|
|
8218
|
+
if (!root || !stage)
|
|
8219
|
+
return;
|
|
8220
|
+
const app = getApp();
|
|
8221
|
+
if (!app)
|
|
8222
|
+
return;
|
|
8223
|
+
if (app.dsl) {
|
|
8224
|
+
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
8225
|
+
app.dsl.dataSources = root.dataSources;
|
|
8226
|
+
}
|
|
8227
|
+
updateDataSoucreSchema();
|
|
8228
|
+
nodes.forEach((node) => {
|
|
8229
|
+
const deps = Object.values(root.dataSourceDeps || {});
|
|
8230
|
+
deps.forEach((dep) => {
|
|
8231
|
+
if (dep[node.id]) {
|
|
8232
|
+
stage.update({
|
|
8233
|
+
config: cloneDeep(node),
|
|
8234
|
+
parentId: editorService.getParentById(node.id)?.id,
|
|
8235
|
+
root: cloneDeep(root)
|
|
8236
|
+
});
|
|
8237
|
+
}
|
|
8238
|
+
});
|
|
8239
|
+
});
|
|
8240
|
+
};
|
|
7394
8241
|
const targetAddHandler = (target) => {
|
|
7395
8242
|
if (target.type !== "data-source")
|
|
7396
8243
|
return;
|
|
@@ -7408,8 +8255,16 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
7408
8255
|
return;
|
|
7409
8256
|
delete root.dataSourceDeps[id];
|
|
7410
8257
|
};
|
|
8258
|
+
const depUpdateHandler = (node) => {
|
|
8259
|
+
upateNodeWhenDataSourceChange([node]);
|
|
8260
|
+
};
|
|
8261
|
+
const collectedHandler = (nodes) => {
|
|
8262
|
+
upateNodeWhenDataSourceChange(nodes);
|
|
8263
|
+
};
|
|
7411
8264
|
depService.on("add-target", targetAddHandler);
|
|
7412
8265
|
depService.on("remove-target", targetRemoveHandler);
|
|
8266
|
+
depService.on("dep-update", depUpdateHandler);
|
|
8267
|
+
depService.on("collected", collectedHandler);
|
|
7413
8268
|
const rootChangeHandler = async (value, preValue) => {
|
|
7414
8269
|
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
7415
8270
|
let node;
|
|
@@ -7477,14 +8332,20 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
7477
8332
|
codeBlockService.on("remove", codeBlockRemoveHandler);
|
|
7478
8333
|
const dataSourceAddHandler = (config) => {
|
|
7479
8334
|
depService.addTarget(createDataSourceTarget(config.id, config));
|
|
8335
|
+
getApp()?.dataSourceManager?.addDataSource(config);
|
|
7480
8336
|
};
|
|
7481
8337
|
const dataSourceUpdateHandler = (config) => {
|
|
7482
8338
|
if (config.title) {
|
|
7483
8339
|
depService.getTarget(config.id).name = config.title;
|
|
7484
8340
|
}
|
|
8341
|
+
const root = editorService.get("root");
|
|
8342
|
+
const targets = depService.getTargets("data-source");
|
|
8343
|
+
const nodes = getNodes(Object.keys(targets[config.id].deps), root?.items);
|
|
8344
|
+
upateNodeWhenDataSourceChange(nodes);
|
|
7485
8345
|
};
|
|
7486
8346
|
const dataSourceRemoveHandler = (id) => {
|
|
7487
8347
|
depService.removeTarget(id);
|
|
8348
|
+
getApp()?.dataSourceManager?.removeDataSource(id);
|
|
7488
8349
|
};
|
|
7489
8350
|
dataSourceService.on("add", dataSourceAddHandler);
|
|
7490
8351
|
dataSourceService.on("update", dataSourceUpdateHandler);
|
|
@@ -7492,6 +8353,8 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
7492
8353
|
onUnmounted(() => {
|
|
7493
8354
|
depService.off("add-target", targetAddHandler);
|
|
7494
8355
|
depService.off("remove-target", targetRemoveHandler);
|
|
8356
|
+
depService.off("dep-update", depUpdateHandler);
|
|
8357
|
+
depService.off("collected", collectedHandler);
|
|
7495
8358
|
editorService.off("history-change", historyChangeHandler);
|
|
7496
8359
|
editorService.off("root-change", rootChangeHandler);
|
|
7497
8360
|
editorService.off("add", nodeAddHandler);
|
|
@@ -7506,13 +8369,13 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
7506
8369
|
};
|
|
7507
8370
|
|
|
7508
8371
|
const _sfc_main = defineComponent({
|
|
7509
|
-
name: "
|
|
8372
|
+
name: "MEditor",
|
|
7510
8373
|
components: {
|
|
7511
|
-
TMagicNavMenu: _sfc_main$
|
|
7512
|
-
Sidebar: _sfc_main$
|
|
8374
|
+
TMagicNavMenu: _sfc_main$q,
|
|
8375
|
+
Sidebar: _sfc_main$a,
|
|
7513
8376
|
Workspace: _sfc_main$1,
|
|
7514
|
-
PropsPanel: _sfc_main$
|
|
7515
|
-
Framework: _sfc_main$
|
|
8377
|
+
PropsPanel: _sfc_main$p,
|
|
8378
|
+
Framework: _sfc_main$s
|
|
7516
8379
|
},
|
|
7517
8380
|
props: editorProps,
|
|
7518
8381
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -7527,10 +8390,13 @@ const _sfc_main = defineComponent({
|
|
|
7527
8390
|
storageService,
|
|
7528
8391
|
codeBlockService,
|
|
7529
8392
|
depService,
|
|
7530
|
-
dataSourceService
|
|
8393
|
+
dataSourceService,
|
|
8394
|
+
keybindingService
|
|
7531
8395
|
};
|
|
7532
8396
|
initServiceEvents(props, emit, services);
|
|
7533
8397
|
initServiceState(props, services);
|
|
8398
|
+
keybindingService.registe(keybindingConfig);
|
|
8399
|
+
keybindingService.registeEl("global");
|
|
7534
8400
|
provide("services", services);
|
|
7535
8401
|
provide("codeOptions", props.codeOptions);
|
|
7536
8402
|
provide(
|
|
@@ -7553,18 +8419,35 @@ const _sfc_main = defineComponent({
|
|
|
7553
8419
|
}
|
|
7554
8420
|
});
|
|
7555
8421
|
|
|
8422
|
+
const _export_sfc = (sfc, props) => {
|
|
8423
|
+
const target = sfc.__vccOpts || sfc;
|
|
8424
|
+
for (const [key, val] of props) {
|
|
8425
|
+
target[key] = val;
|
|
8426
|
+
}
|
|
8427
|
+
return target;
|
|
8428
|
+
};
|
|
8429
|
+
|
|
7556
8430
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
7557
8431
|
const _component_TMagicNavMenu = resolveComponent("TMagicNavMenu");
|
|
7558
8432
|
const _component_Sidebar = resolveComponent("Sidebar");
|
|
7559
8433
|
const _component_Workspace = resolveComponent("Workspace");
|
|
7560
8434
|
const _component_PropsPanel = resolveComponent("PropsPanel");
|
|
7561
8435
|
const _component_Framework = resolveComponent("Framework");
|
|
7562
|
-
return openBlock(), createBlock(_component_Framework,
|
|
8436
|
+
return openBlock(), createBlock(_component_Framework, null, {
|
|
8437
|
+
header: withCtx(() => [
|
|
8438
|
+
renderSlot(_ctx.$slots, "header")
|
|
8439
|
+
]),
|
|
7563
8440
|
nav: withCtx(() => [
|
|
7564
8441
|
renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
7565
8442
|
createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
7566
8443
|
])
|
|
7567
8444
|
]),
|
|
8445
|
+
"content-before": withCtx(() => [
|
|
8446
|
+
renderSlot(_ctx.$slots, "content-before")
|
|
8447
|
+
]),
|
|
8448
|
+
"src-code": withCtx(() => [
|
|
8449
|
+
renderSlot(_ctx.$slots, "src-code", { editorService: _ctx.editorService })
|
|
8450
|
+
]),
|
|
7568
8451
|
sidebar: withCtx(() => [
|
|
7569
8452
|
renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
7570
8453
|
createVNode(_component_Sidebar, {
|
|
@@ -7624,27 +8507,35 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
7624
8507
|
"props-panel": withCtx(() => [
|
|
7625
8508
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
7626
8509
|
createVNode(_component_PropsPanel, {
|
|
8510
|
+
"extend-state": _ctx.extendFormState,
|
|
7627
8511
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
7628
8512
|
}, {
|
|
7629
8513
|
"props-panel-header": withCtx(() => [
|
|
7630
8514
|
renderSlot(_ctx.$slots, "props-panel-header")
|
|
7631
8515
|
]),
|
|
7632
8516
|
_: 3
|
|
7633
|
-
})
|
|
8517
|
+
}, 8, ["extend-state"])
|
|
7634
8518
|
])
|
|
7635
8519
|
]),
|
|
7636
8520
|
empty: withCtx(() => [
|
|
7637
8521
|
renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
|
|
7638
8522
|
]),
|
|
8523
|
+
"content-after": withCtx(() => [
|
|
8524
|
+
renderSlot(_ctx.$slots, "content-after")
|
|
8525
|
+
]),
|
|
8526
|
+
footer: withCtx(() => [
|
|
8527
|
+
renderSlot(_ctx.$slots, "footer")
|
|
8528
|
+
]),
|
|
7639
8529
|
_: 3
|
|
7640
|
-
}
|
|
8530
|
+
});
|
|
7641
8531
|
}
|
|
7642
8532
|
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
7643
8533
|
|
|
7644
8534
|
const index$1 = '';
|
|
7645
8535
|
|
|
7646
8536
|
const defaultInstallOpt = {
|
|
7647
|
-
//
|
|
8537
|
+
// eslint-disable-next-line no-eval
|
|
8538
|
+
parseDSL: (dsl) => eval(dsl)
|
|
7648
8539
|
};
|
|
7649
8540
|
const index = {
|
|
7650
8541
|
install: (app, opt) => {
|
|
@@ -7652,17 +8543,19 @@ const index = {
|
|
|
7652
8543
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
7653
8544
|
setConfig(option);
|
|
7654
8545
|
app.component(Editor.name, Editor);
|
|
7655
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
7656
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
7657
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
7658
|
-
app.component("magic-code-editor", _sfc_main$
|
|
7659
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
7660
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
7661
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
7662
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
7663
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
8546
|
+
app.component("m-fields-ui-select", _sfc_main$x);
|
|
8547
|
+
app.component("m-fields-code-link", _sfc_main$G);
|
|
8548
|
+
app.component("m-fields-vs-code", _sfc_main$H);
|
|
8549
|
+
app.component("magic-code-editor", _sfc_main$w);
|
|
8550
|
+
app.component("m-fields-code-select", _sfc_main$F);
|
|
8551
|
+
app.component("m-fields-code-select-col", _sfc_main$D);
|
|
8552
|
+
app.component("m-fields-event-select", _sfc_main$z);
|
|
8553
|
+
app.component("m-fields-data-source-fields", _sfc_main$C);
|
|
8554
|
+
app.component("m-fields-key-value", _sfc_main$y);
|
|
8555
|
+
app.component("m-fields-data-source-input", _sfc_main$B);
|
|
8556
|
+
app.component("m-fields-data-source-select", _sfc_main$A);
|
|
7664
8557
|
}
|
|
7665
8558
|
};
|
|
7666
8559
|
|
|
7667
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
8560
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$i as CodeBlockList, CodeDeleteErrorType, _sfc_main$F as CodeSelect, _sfc_main$D as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$e as ContentMenu, _sfc_main$C as DataSourceFields, _sfc_main$B as DataSourceInput, _sfc_main$A as DataSourceSelect, _sfc_main$z as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$E as Icon, KeyBindingCommand, _sfc_main$y as KeyValue, Keys, LayerOffset, _sfc_main$b as LayerPanel, Layout, _sfc_main$u as LayoutContainer, _sfc_main$p as PropsPanel, _sfc_main$v as Resizer, _sfc_main$u as SplitView, _sfc_main$w as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$r as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, editorService, error, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
7668
8561
|
//# sourceMappingURL=tmagic-editor.js.map
|