@tmagic/editor 1.2.13 → 1.2.14
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 +37 -6
- package/dist/tmagic-editor.js +770 -394
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +789 -420
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +14 -13
- package/src/components/CodeDraftEditor.vue +20 -17
- package/src/components/ContentMenu.vue +1 -1
- package/src/components/FunctionEditor.vue +10 -10
- package/src/components/Layout.vue +1 -1
- package/src/components/ScrollViewer.vue +2 -2
- package/src/fields/CodeSelect.vue +18 -101
- package/src/fields/CodeSelectCol.vue +21 -3
- package/src/fields/EventSelect.vue +5 -3
- package/src/fields/UISelect.vue +1 -1
- package/src/icons/AppManageIcon.vue +11 -0
- package/src/icons/CodeIcon.vue +35 -0
- package/src/layouts/AddPageBox.vue +3 -3
- package/src/layouts/Framework.vue +4 -4
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +3 -3
- package/src/layouts/sidebar/LayerMenu.vue +2 -2
- package/src/layouts/sidebar/LayerPanel.vue +4 -4
- package/src/layouts/sidebar/Sidebar.vue +3 -3
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +15 -6
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +26 -13
- package/src/layouts/workspace/Breadcrumb.vue +1 -1
- package/src/layouts/workspace/PageBar.vue +2 -2
- package/src/layouts/workspace/PageBarScrollContainer.vue +3 -3
- package/src/layouts/workspace/Stage.vue +3 -3
- package/src/layouts/workspace/ViewerMenu.vue +4 -4
- package/src/layouts/workspace/Workspace.vue +1 -1
- package/src/services/BaseService.ts +1 -1
- package/src/services/codeBlock.ts +3 -3
- package/src/services/componentList.ts +1 -1
- package/src/services/editor.ts +6 -6
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +2 -2
- package/src/services/props.ts +2 -2
- package/src/services/ui.ts +2 -2
- package/src/theme/code-block.scss +28 -4
- package/src/theme/event.scss +12 -0
- package/src/utils/config.ts +1 -1
- package/src/utils/dep.ts +2 -2
- package/src/utils/editor.ts +1 -1
- package/src/utils/operator.ts +4 -4
- package/src/utils/stage.ts +3 -3
- package/tsconfig.build.json +4 -1
- package/types/components/CodeDraftEditor.vue.d.ts +7 -4
- package/types/components/ContentMenu.vue.d.ts +3 -3
- package/types/components/FunctionEditor.vue.d.ts +140 -8
- package/types/components/Icon.vue.d.ts +2 -2
- package/types/components/Layout.vue.d.ts +28 -113
- package/types/components/ScrollBar.vue.d.ts +2 -2
- package/types/components/ScrollViewer.vue.d.ts +32 -135
- package/types/components/ToolButton.vue.d.ts +3 -3
- package/types/fields/Code.vue.d.ts +2 -2
- package/types/fields/CodeLink.vue.d.ts +2 -2
- package/types/fields/CodeSelect.vue.d.ts +8 -27
- package/types/fields/CodeSelectCol.vue.d.ts +3 -3
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/UISelect.vue.d.ts +2 -2
- package/types/icons/AppManageIcon.vue.d.ts +2 -0
- package/types/icons/CodeIcon.vue.d.ts +2 -0
- package/types/layouts/CodeEditor.vue.d.ts +4 -4
- package/types/layouts/Framework.vue.d.ts +23 -74
- package/types/layouts/NavMenu.vue.d.ts +3 -3
- package/types/layouts/PropsPanel.vue.d.ts +11 -60
- package/types/layouts/Resizer.vue.d.ts +9 -54
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +11 -50
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +17 -60
- package/types/layouts/sidebar/Sidebar.vue.d.ts +39 -104
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +15 -58
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +21 -66
- package/types/layouts/workspace/PageBar.vue.d.ts +13 -52
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +8 -48
- package/types/layouts/workspace/Stage.vue.d.ts +2 -2
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +3 -3
- package/types/layouts/workspace/Workspace.vue.d.ts +20 -63
- package/types/services/codeBlock.d.ts +1 -1
- package/types/services/componentList.d.ts +1 -1
- package/types/services/dep.d.ts +2 -2
- package/types/services/editor.d.ts +1 -1
- package/types/services/events.d.ts +1 -1
- package/types/services/history.d.ts +2 -2
- package/types/services/props.d.ts +78 -1
- package/types/services/storage.d.ts +1 -1
- package/types/services/ui.d.ts +2 -2
- package/types/type.d.ts +8 -8
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +78 -1
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, createElementBlock, normalizeClass, createVNode, withCtx, createElementVNode, resolveDynamicComponent, toRaw, inject, ref, Fragment, renderList, createTextVNode, withModifiers, createCommentVNode, toDisplayString, onMounted, onUnmounted, renderSlot, createSlots, normalizeProps, mergeProps, markRaw, getCurrentInstance, watchEffect, createStaticVNode, withDirectives, Teleport, vShow, nextTick, toHandlers, provide } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
|
-
import { Edit, View, Delete, Close, Plus, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Files, CopyDocument, Coin, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
|
|
4
3
|
import { isEmpty, map, has, throttle, cloneDeep, mergeWith, isObject, uniq, forIn, difference, union, pick, keys } from 'lodash-es';
|
|
5
|
-
import {
|
|
4
|
+
import { TMagicCard, TMagicIcon, TMagicButton, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, TMagicInput, tMagicMessageBox, TMagicDrawer, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
|
|
6
5
|
import { HookType, ActionType, NodeType } from '@tmagic/schema';
|
|
7
|
-
import {
|
|
6
|
+
import { Edit, View, Delete, Close, Plus, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Files, CopyDocument, Coin, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
|
|
7
|
+
import { createValues, MForm } from '@tmagic/form';
|
|
8
8
|
import * as monaco from 'monaco-editor';
|
|
9
9
|
import Gesto from 'gesto';
|
|
10
10
|
import { isPop, getNodePath, isNumber, isPage, toLine, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
|
|
11
|
+
import KeyController from 'keycon';
|
|
11
12
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
12
13
|
import { EventEmitter } from 'events';
|
|
13
|
-
import KeyController from 'keycon';
|
|
14
14
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
15
15
|
|
|
16
16
|
const __default__$v = defineComponent({
|
|
17
17
|
name: "MEditorCode"
|
|
18
18
|
});
|
|
19
|
-
const _sfc_main$
|
|
19
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
20
20
|
...__default__$v,
|
|
21
21
|
props: {
|
|
22
22
|
model: null,
|
|
@@ -49,7 +49,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
49
49
|
const __default__$u = defineComponent({
|
|
50
50
|
name: "MEditorCodeLink"
|
|
51
51
|
});
|
|
52
|
-
const _sfc_main$
|
|
52
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
53
53
|
...__default__$u,
|
|
54
54
|
props: {
|
|
55
55
|
config: null,
|
|
@@ -119,58 +119,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
const _hoisted_1$h = ["src"];
|
|
123
122
|
const __default__$t = defineComponent({
|
|
124
|
-
name: "MEditorIcon"
|
|
125
|
-
});
|
|
126
|
-
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
127
|
-
...__default__$t,
|
|
128
|
-
props: {
|
|
129
|
-
icon: null
|
|
130
|
-
},
|
|
131
|
-
setup(__props) {
|
|
132
|
-
return (_ctx, _cache) => {
|
|
133
|
-
return !__props.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
134
|
-
key: 0,
|
|
135
|
-
class: "magic-editor-icon"
|
|
136
|
-
}, {
|
|
137
|
-
default: withCtx(() => [
|
|
138
|
-
createVNode(unref(Edit))
|
|
139
|
-
]),
|
|
140
|
-
_: 1
|
|
141
|
-
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
142
|
-
key: 1,
|
|
143
|
-
class: "magic-editor-icon"
|
|
144
|
-
}, {
|
|
145
|
-
default: withCtx(() => [
|
|
146
|
-
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$h)
|
|
147
|
-
]),
|
|
148
|
-
_: 1
|
|
149
|
-
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
150
|
-
key: 2,
|
|
151
|
-
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
152
|
-
}, null, 2)) : (openBlock(), createBlock(unref(TMagicIcon), {
|
|
153
|
-
key: 3,
|
|
154
|
-
class: "magic-editor-icon"
|
|
155
|
-
}, {
|
|
156
|
-
default: withCtx(() => [
|
|
157
|
-
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
158
|
-
]),
|
|
159
|
-
_: 1
|
|
160
|
-
}));
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
const __default__$s = defineComponent({
|
|
166
123
|
name: "MEditorCodeSelect"
|
|
167
124
|
});
|
|
168
|
-
const _sfc_main$
|
|
169
|
-
...__default__$
|
|
125
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
126
|
+
...__default__$t,
|
|
170
127
|
props: {
|
|
171
|
-
config:
|
|
172
|
-
editable: true
|
|
173
|
-
}) },
|
|
128
|
+
config: null,
|
|
174
129
|
model: null,
|
|
175
130
|
prop: null,
|
|
176
131
|
name: null,
|
|
@@ -179,55 +134,16 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
179
134
|
emits: ["change"],
|
|
180
135
|
setup(__props, { emit }) {
|
|
181
136
|
const props = __props;
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{
|
|
193
|
-
type: "select",
|
|
194
|
-
label: "\u4EE3\u7801\u5757",
|
|
195
|
-
name: "codeId",
|
|
196
|
-
width: "200px",
|
|
197
|
-
options: () => {
|
|
198
|
-
if (codeDsl.value) {
|
|
199
|
-
return map(codeDsl.value, (value, key) => ({
|
|
200
|
-
text: `${value.name}\uFF08${key}\uFF09`,
|
|
201
|
-
label: `${value.name}\uFF08${key}\uFF09`,
|
|
202
|
-
value: key
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
return [];
|
|
206
|
-
},
|
|
207
|
-
onChange: (formState, codeId, { model }) => {
|
|
208
|
-
model.params = {};
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: "params",
|
|
213
|
-
label: "\u53C2\u6570",
|
|
214
|
-
defaultValue: {},
|
|
215
|
-
itemsFunction: (row) => {
|
|
216
|
-
const paramsConfig = getParamsConfig(row.codeId);
|
|
217
|
-
if (!row.params || isEmpty(row.params)) {
|
|
218
|
-
createValues(mForm, paramsConfig, {}, row.params);
|
|
219
|
-
}
|
|
220
|
-
return paramsConfig;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
};
|
|
225
|
-
return {
|
|
226
|
-
...defaultConfig,
|
|
227
|
-
...props.config.tableConfig
|
|
228
|
-
};
|
|
229
|
-
});
|
|
230
|
-
const editable = computed(() => services?.codeBlockService.getEditStatus());
|
|
137
|
+
const codeConfig = computed(() => ({
|
|
138
|
+
type: "group-list",
|
|
139
|
+
name: "hookData",
|
|
140
|
+
enableToggleMode: false,
|
|
141
|
+
items: [
|
|
142
|
+
{
|
|
143
|
+
type: "code-select-col"
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}));
|
|
231
147
|
watch(
|
|
232
148
|
() => props.model[props.name],
|
|
233
149
|
(value) => {
|
|
@@ -245,56 +161,75 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
245
161
|
const changeHandler = async () => {
|
|
246
162
|
emit("change", props.model[props.name]);
|
|
247
163
|
};
|
|
248
|
-
const getParamsConfig = (codeId) => {
|
|
249
|
-
if (!codeDsl.value)
|
|
250
|
-
return [];
|
|
251
|
-
const paramStatements = codeDsl.value[codeId]?.params;
|
|
252
|
-
if (isEmpty(paramStatements))
|
|
253
|
-
return [];
|
|
254
|
-
return paramStatements.map((paramState) => ({
|
|
255
|
-
labelWidth: "100px",
|
|
256
|
-
text: paramState.name,
|
|
257
|
-
inline: true,
|
|
258
|
-
...paramState
|
|
259
|
-
}));
|
|
260
|
-
};
|
|
261
|
-
const editCode = (codeId) => {
|
|
262
|
-
services?.codeBlockService.setCodeEditorContent(true, codeId);
|
|
263
|
-
};
|
|
264
164
|
return (_ctx, _cache) => {
|
|
265
|
-
const
|
|
165
|
+
const _component_m_form_container = resolveComponent("m-form-container");
|
|
266
166
|
return openBlock(), createElementBlock("div", {
|
|
267
167
|
class: normalizeClass(["m-fields-code-select", __props.config.className])
|
|
268
168
|
}, [
|
|
269
|
-
createVNode(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
onChange: changeHandler
|
|
277
|
-
}, {
|
|
278
|
-
operateCol: withCtx(({ scope }) => [
|
|
279
|
-
scope.row.codeId && __props.config.editable ? (openBlock(), createBlock(_sfc_main$v, {
|
|
280
|
-
key: 0,
|
|
281
|
-
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
282
|
-
class: "edit-icon",
|
|
283
|
-
onClick: ($event) => editCode(scope.row.codeId)
|
|
284
|
-
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
169
|
+
createVNode(unref(TMagicCard), null, {
|
|
170
|
+
default: withCtx(() => [
|
|
171
|
+
createVNode(_component_m_form_container, {
|
|
172
|
+
config: unref(codeConfig),
|
|
173
|
+
model: __props.model[__props.name],
|
|
174
|
+
onChange: changeHandler
|
|
175
|
+
}, null, 8, ["config", "model"])
|
|
285
176
|
]),
|
|
286
177
|
_: 1
|
|
287
|
-
}
|
|
178
|
+
})
|
|
288
179
|
], 2);
|
|
289
180
|
};
|
|
290
181
|
}
|
|
291
182
|
});
|
|
292
183
|
|
|
293
|
-
const _hoisted_1$
|
|
184
|
+
const _hoisted_1$j = ["src"];
|
|
185
|
+
const __default__$s = defineComponent({
|
|
186
|
+
name: "MEditorIcon"
|
|
187
|
+
});
|
|
188
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
189
|
+
...__default__$s,
|
|
190
|
+
props: {
|
|
191
|
+
icon: null
|
|
192
|
+
},
|
|
193
|
+
setup(__props) {
|
|
194
|
+
return (_ctx, _cache) => {
|
|
195
|
+
return !__props.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
196
|
+
key: 0,
|
|
197
|
+
class: "magic-editor-icon"
|
|
198
|
+
}, {
|
|
199
|
+
default: withCtx(() => [
|
|
200
|
+
createVNode(unref(Edit))
|
|
201
|
+
]),
|
|
202
|
+
_: 1
|
|
203
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
204
|
+
key: 1,
|
|
205
|
+
class: "magic-editor-icon"
|
|
206
|
+
}, {
|
|
207
|
+
default: withCtx(() => [
|
|
208
|
+
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$j)
|
|
209
|
+
]),
|
|
210
|
+
_: 1
|
|
211
|
+
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
212
|
+
key: 2,
|
|
213
|
+
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
214
|
+
}, null, 2)) : (openBlock(), createBlock(unref(TMagicIcon), {
|
|
215
|
+
key: 3,
|
|
216
|
+
class: "magic-editor-icon"
|
|
217
|
+
}, {
|
|
218
|
+
default: withCtx(() => [
|
|
219
|
+
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
220
|
+
]),
|
|
221
|
+
_: 1
|
|
222
|
+
}));
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const _hoisted_1$i = { class: "m-fields-code-select-col" };
|
|
228
|
+
const _hoisted_2$a = { class: "code-select-container" };
|
|
294
229
|
const __default__$r = defineComponent({
|
|
295
230
|
name: "MEditorCodeSelectCol"
|
|
296
231
|
});
|
|
297
|
-
const _sfc_main$
|
|
232
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
298
233
|
...__default__$r,
|
|
299
234
|
props: {
|
|
300
235
|
config: null,
|
|
@@ -309,24 +244,25 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
309
244
|
const services = inject("services");
|
|
310
245
|
const mForm = inject("mForm");
|
|
311
246
|
const codeDsl = computed(() => services?.codeBlockService.getCodeDsl());
|
|
247
|
+
const editable = computed(() => services?.codeBlockService.getEditStatus());
|
|
312
248
|
const codeParamsConfig = ref({
|
|
313
249
|
type: "fieldset",
|
|
314
250
|
items: [],
|
|
315
|
-
legend: "
|
|
251
|
+
legend: "参数",
|
|
316
252
|
labelWidth: "70px",
|
|
317
253
|
name: "params",
|
|
318
254
|
display: false
|
|
319
255
|
});
|
|
320
256
|
const selectConfig = {
|
|
321
257
|
type: "select",
|
|
322
|
-
text: "
|
|
258
|
+
text: "代码块",
|
|
323
259
|
name: "codeId",
|
|
324
260
|
labelWidth: "70px",
|
|
325
261
|
options: () => {
|
|
326
262
|
if (codeDsl.value) {
|
|
327
263
|
return map(codeDsl.value, (value, key) => ({
|
|
328
|
-
text: `${value.name}
|
|
329
|
-
label: `${value.name}
|
|
264
|
+
text: `${value.name}(${key})`,
|
|
265
|
+
label: `${value.name}(${key})`,
|
|
330
266
|
value: key
|
|
331
267
|
}));
|
|
332
268
|
}
|
|
@@ -357,7 +293,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
357
293
|
codeParamsConfig.value = {
|
|
358
294
|
type: "fieldset",
|
|
359
295
|
items: paramsConfig,
|
|
360
|
-
legend: "
|
|
296
|
+
legend: "参数",
|
|
361
297
|
labelWidth: "70px",
|
|
362
298
|
name: "params",
|
|
363
299
|
display: !isEmpty(paramsConfig)
|
|
@@ -377,14 +313,25 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
377
313
|
immediate: true
|
|
378
314
|
}
|
|
379
315
|
);
|
|
316
|
+
const editCode = () => {
|
|
317
|
+
services?.codeBlockService.setCodeEditorContent(true, props.model.codeId);
|
|
318
|
+
};
|
|
380
319
|
return (_ctx, _cache) => {
|
|
381
320
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
382
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
321
|
+
return openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
322
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
323
|
+
createVNode(_component_m_form_container, {
|
|
324
|
+
class: "select",
|
|
325
|
+
config: selectConfig,
|
|
326
|
+
model: __props.model,
|
|
327
|
+
onChange: onParamsChangeHandler
|
|
328
|
+
}, null, 8, ["model"]),
|
|
329
|
+
createVNode(_sfc_main$w, {
|
|
330
|
+
class: "icon",
|
|
331
|
+
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
332
|
+
onClick: editCode
|
|
333
|
+
}, null, 8, ["icon"])
|
|
334
|
+
]),
|
|
388
335
|
createVNode(_component_m_form_container, {
|
|
389
336
|
config: codeParamsConfig.value,
|
|
390
337
|
model: __props.model,
|
|
@@ -395,16 +342,16 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
395
342
|
}
|
|
396
343
|
});
|
|
397
344
|
|
|
398
|
-
const _hoisted_1$
|
|
399
|
-
const _hoisted_2$
|
|
345
|
+
const _hoisted_1$h = { class: "m-fields-event-select" };
|
|
346
|
+
const _hoisted_2$9 = {
|
|
400
347
|
key: 1,
|
|
401
348
|
class: "fullWidth"
|
|
402
349
|
};
|
|
403
|
-
const _hoisted_3$
|
|
350
|
+
const _hoisted_3$5 = /* @__PURE__ */ createTextVNode("添加事件");
|
|
404
351
|
const __default__$q = defineComponent({
|
|
405
352
|
name: "MEditorEventSelect"
|
|
406
353
|
});
|
|
407
|
-
const _sfc_main$
|
|
354
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
408
355
|
...__default__$q,
|
|
409
356
|
props: {
|
|
410
357
|
config: null,
|
|
@@ -420,7 +367,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
420
367
|
const eventNameConfig = computed(() => {
|
|
421
368
|
const defaultEventNameConfig = {
|
|
422
369
|
name: "name",
|
|
423
|
-
text: "
|
|
370
|
+
text: "事件",
|
|
424
371
|
type: "select",
|
|
425
372
|
labelWidth: "40px",
|
|
426
373
|
options: (mForm, { formValue }) => services?.eventsService.getEvent(formValue.type).map((option) => ({
|
|
@@ -433,19 +380,19 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
433
380
|
const actionTypeConfig = computed(() => {
|
|
434
381
|
const defaultActionTypeConfig = {
|
|
435
382
|
name: "actionType",
|
|
436
|
-
text: "
|
|
383
|
+
text: "联动类型",
|
|
437
384
|
labelWidth: "70px",
|
|
438
385
|
type: "select",
|
|
439
386
|
defaultValue: ActionType.COMP,
|
|
440
387
|
options: () => [
|
|
441
388
|
{
|
|
442
|
-
text: "
|
|
443
|
-
label: "
|
|
389
|
+
text: "组件",
|
|
390
|
+
label: "组件",
|
|
444
391
|
value: ActionType.COMP
|
|
445
392
|
},
|
|
446
393
|
{
|
|
447
|
-
text: "
|
|
448
|
-
label: "
|
|
394
|
+
text: "代码",
|
|
395
|
+
label: "代码",
|
|
449
396
|
value: ActionType.CODE
|
|
450
397
|
}
|
|
451
398
|
]
|
|
@@ -455,7 +402,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
455
402
|
const targetCompConfig = computed(() => {
|
|
456
403
|
const defaultTargetCompConfig = {
|
|
457
404
|
name: "to",
|
|
458
|
-
text: "
|
|
405
|
+
text: "联动组件",
|
|
459
406
|
labelWidth: "70px",
|
|
460
407
|
type: "ui-select",
|
|
461
408
|
display: (mForm, { model }) => model.actionType === ActionType.COMP
|
|
@@ -465,7 +412,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
465
412
|
const compActionConfig = computed(() => {
|
|
466
413
|
const defaultCompActionConfig = {
|
|
467
414
|
name: "method",
|
|
468
|
-
text: "
|
|
415
|
+
text: "动作",
|
|
469
416
|
labelWidth: "70px",
|
|
470
417
|
type: "select",
|
|
471
418
|
display: (mForm, { model }) => model.actionType === ActionType.COMP,
|
|
@@ -494,7 +441,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
494
441
|
items: [
|
|
495
442
|
{
|
|
496
443
|
name: "name",
|
|
497
|
-
label: "
|
|
444
|
+
label: "事件名",
|
|
498
445
|
type: eventNameConfig.value.type,
|
|
499
446
|
options: (mForm, { formValue }) => services?.eventsService.getEvent(formValue.type).map((option) => ({
|
|
500
447
|
text: option.label,
|
|
@@ -503,12 +450,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
503
450
|
},
|
|
504
451
|
{
|
|
505
452
|
name: "to",
|
|
506
|
-
label: "
|
|
453
|
+
label: "联动组件",
|
|
507
454
|
type: "ui-select"
|
|
508
455
|
},
|
|
509
456
|
{
|
|
510
457
|
name: "method",
|
|
511
|
-
label: "
|
|
458
|
+
label: "动作",
|
|
512
459
|
type: compActionConfig.value.type,
|
|
513
460
|
options: (mForm, { model }) => {
|
|
514
461
|
const node = services?.editorService.getNodeById(model.to);
|
|
@@ -558,17 +505,19 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
558
505
|
emit("change", props.model);
|
|
559
506
|
};
|
|
560
507
|
return (_ctx, _cache) => {
|
|
508
|
+
const _component_m_form_table = resolveComponent("m-form-table");
|
|
561
509
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
562
510
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
563
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
564
|
-
unref(isOldVersion) ? (openBlock(), createBlock(
|
|
511
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
512
|
+
unref(isOldVersion) ? (openBlock(), createBlock(_component_m_form_table, {
|
|
565
513
|
key: 0,
|
|
566
514
|
ref: "eventForm",
|
|
567
515
|
size: props.size,
|
|
568
516
|
model: __props.model,
|
|
517
|
+
name: "events",
|
|
569
518
|
config: unref(tableConfig),
|
|
570
519
|
onChange: onChangeHandler
|
|
571
|
-
}, null, 8, ["size", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
520
|
+
}, null, 8, ["size", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$9, [
|
|
572
521
|
createVNode(unref(TMagicButton), {
|
|
573
522
|
class: "create-button",
|
|
574
523
|
type: "primary",
|
|
@@ -576,7 +525,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
576
525
|
onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
|
|
577
526
|
}, {
|
|
578
527
|
default: withCtx(() => [
|
|
579
|
-
_hoisted_3$
|
|
528
|
+
_hoisted_3$5
|
|
580
529
|
]),
|
|
581
530
|
_: 1
|
|
582
531
|
}),
|
|
@@ -610,11 +559,11 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
610
559
|
}
|
|
611
560
|
});
|
|
612
561
|
|
|
613
|
-
const _hoisted_1$
|
|
562
|
+
const _hoisted_1$g = /* @__PURE__ */ createTextVNode("取消");
|
|
614
563
|
const __default__$p = defineComponent({
|
|
615
564
|
name: "MEditorUISelect"
|
|
616
565
|
});
|
|
617
|
-
const _sfc_main$
|
|
566
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
618
567
|
...__default__$p,
|
|
619
568
|
props: {
|
|
620
569
|
config: null,
|
|
@@ -677,7 +626,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
677
626
|
style: { "padding": "0" }
|
|
678
627
|
}, {
|
|
679
628
|
default: withCtx(() => [
|
|
680
|
-
_hoisted_1$
|
|
629
|
+
_hoisted_1$g
|
|
681
630
|
]),
|
|
682
631
|
_: 1
|
|
683
632
|
}, 8, ["icon"])
|
|
@@ -689,7 +638,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
689
638
|
}, [
|
|
690
639
|
unref(val) ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
691
640
|
key: 0,
|
|
692
|
-
content: "
|
|
641
|
+
content: "清除"
|
|
693
642
|
}, {
|
|
694
643
|
default: withCtx(() => [
|
|
695
644
|
createVNode(unref(TMagicButton), {
|
|
@@ -703,7 +652,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
703
652
|
_: 1
|
|
704
653
|
})) : createCommentVNode("", true),
|
|
705
654
|
createVNode(unref(TMagicTooltip), {
|
|
706
|
-
content: unref(val) ? unref(toName) + "_" + unref(val) : "
|
|
655
|
+
content: unref(val) ? unref(toName) + "_" + unref(val) : "点击此处选择"
|
|
707
656
|
}, {
|
|
708
657
|
default: withCtx(() => [
|
|
709
658
|
createVNode(unref(TMagicButton), {
|
|
@@ -711,7 +660,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
711
660
|
style: { "padding": "0", "margin": "0" }
|
|
712
661
|
}, {
|
|
713
662
|
default: withCtx(() => [
|
|
714
|
-
createTextVNode(toDisplayString(unref(val) ? unref(toName) + "_" + unref(val) : "
|
|
663
|
+
createTextVNode(toDisplayString(unref(val) ? unref(toName) + "_" + unref(val) : "点击此处选择"), 1)
|
|
715
664
|
]),
|
|
716
665
|
_: 1
|
|
717
666
|
})
|
|
@@ -728,7 +677,7 @@ const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
|
728
677
|
const __default__$o = defineComponent({
|
|
729
678
|
name: "MEditorCodeEditor"
|
|
730
679
|
});
|
|
731
|
-
const _sfc_main$
|
|
680
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
732
681
|
...__default__$o,
|
|
733
682
|
props: {
|
|
734
683
|
initValues: null,
|
|
@@ -861,7 +810,7 @@ const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
|
861
810
|
const __default__$n = defineComponent({
|
|
862
811
|
name: "MEditorResizer"
|
|
863
812
|
});
|
|
864
|
-
const _sfc_main$
|
|
813
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
865
814
|
...__default__$n,
|
|
866
815
|
emits: ["change"],
|
|
867
816
|
setup(__props, { emit }) {
|
|
@@ -897,7 +846,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
897
846
|
const __default__$m = defineComponent({
|
|
898
847
|
name: "MEditorLayout"
|
|
899
848
|
});
|
|
900
|
-
const _sfc_main$
|
|
849
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
901
850
|
...__default__$m,
|
|
902
851
|
props: {
|
|
903
852
|
left: null,
|
|
@@ -1006,7 +955,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
1006
955
|
}, [
|
|
1007
956
|
renderSlot(_ctx.$slots, "left")
|
|
1008
957
|
], 6),
|
|
1009
|
-
createVNode(_sfc_main$
|
|
958
|
+
createVNode(_sfc_main$r, { onChange: changeLeft })
|
|
1010
959
|
], 64)) : createCommentVNode("", true),
|
|
1011
960
|
createElementVNode("div", {
|
|
1012
961
|
class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -1015,7 +964,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
1015
964
|
renderSlot(_ctx.$slots, "center")
|
|
1016
965
|
], 6),
|
|
1017
966
|
unref(hasRight) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1018
|
-
createVNode(_sfc_main$
|
|
967
|
+
createVNode(_sfc_main$r, { onChange: changeRight }),
|
|
1019
968
|
createElementVNode("div", {
|
|
1020
969
|
class: normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
1021
970
|
style: normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -1033,14 +982,16 @@ const fillConfig = (config = []) => [
|
|
|
1033
982
|
type: "tab",
|
|
1034
983
|
items: [
|
|
1035
984
|
{
|
|
1036
|
-
title: "
|
|
985
|
+
title: "属性",
|
|
1037
986
|
labelWidth: "80px",
|
|
1038
987
|
items: [
|
|
988
|
+
// 组件类型,必须要有
|
|
1039
989
|
{
|
|
1040
990
|
text: "type",
|
|
1041
991
|
name: "type",
|
|
1042
992
|
type: "hidden"
|
|
1043
993
|
},
|
|
994
|
+
// 组件id,必须要有
|
|
1044
995
|
{
|
|
1045
996
|
name: "id",
|
|
1046
997
|
type: "display",
|
|
@@ -1048,13 +999,13 @@ const fillConfig = (config = []) => [
|
|
|
1048
999
|
},
|
|
1049
1000
|
{
|
|
1050
1001
|
name: "name",
|
|
1051
|
-
text: "
|
|
1002
|
+
text: "组件名称"
|
|
1052
1003
|
},
|
|
1053
1004
|
...config
|
|
1054
1005
|
]
|
|
1055
1006
|
},
|
|
1056
1007
|
{
|
|
1057
|
-
title: "
|
|
1008
|
+
title: "样式",
|
|
1058
1009
|
labelWidth: "80px",
|
|
1059
1010
|
items: [
|
|
1060
1011
|
{
|
|
@@ -1062,7 +1013,7 @@ const fillConfig = (config = []) => [
|
|
|
1062
1013
|
items: [
|
|
1063
1014
|
{
|
|
1064
1015
|
type: "fieldset",
|
|
1065
|
-
legend: "
|
|
1016
|
+
legend: "位置",
|
|
1066
1017
|
items: [
|
|
1067
1018
|
{
|
|
1068
1019
|
name: "position",
|
|
@@ -1070,7 +1021,7 @@ const fillConfig = (config = []) => [
|
|
|
1070
1021
|
activeValue: "fixed",
|
|
1071
1022
|
inactiveValue: "absolute",
|
|
1072
1023
|
defaultValue: "absolute",
|
|
1073
|
-
text: "
|
|
1024
|
+
text: "固定定位"
|
|
1074
1025
|
},
|
|
1075
1026
|
{
|
|
1076
1027
|
name: "left",
|
|
@@ -1094,34 +1045,34 @@ const fillConfig = (config = []) => [
|
|
|
1094
1045
|
},
|
|
1095
1046
|
{
|
|
1096
1047
|
type: "fieldset",
|
|
1097
|
-
legend: "
|
|
1048
|
+
legend: "盒子",
|
|
1098
1049
|
items: [
|
|
1099
1050
|
{
|
|
1100
1051
|
name: "width",
|
|
1101
|
-
text: "
|
|
1052
|
+
text: "宽度"
|
|
1102
1053
|
},
|
|
1103
1054
|
{
|
|
1104
1055
|
name: "height",
|
|
1105
|
-
text: "
|
|
1056
|
+
text: "高度"
|
|
1106
1057
|
}
|
|
1107
1058
|
]
|
|
1108
1059
|
},
|
|
1109
1060
|
{
|
|
1110
1061
|
type: "fieldset",
|
|
1111
|
-
legend: "
|
|
1062
|
+
legend: "背景",
|
|
1112
1063
|
items: [
|
|
1113
1064
|
{
|
|
1114
1065
|
name: "backgroundImage",
|
|
1115
|
-
text: "
|
|
1066
|
+
text: "背景图"
|
|
1116
1067
|
},
|
|
1117
1068
|
{
|
|
1118
1069
|
name: "backgroundColor",
|
|
1119
|
-
text: "
|
|
1070
|
+
text: "背景颜色",
|
|
1120
1071
|
type: "colorPicker"
|
|
1121
1072
|
},
|
|
1122
1073
|
{
|
|
1123
1074
|
name: "backgroundRepeat",
|
|
1124
|
-
text: "
|
|
1075
|
+
text: "背景图重复",
|
|
1125
1076
|
type: "select",
|
|
1126
1077
|
defaultValue: "no-repeat",
|
|
1127
1078
|
options: [
|
|
@@ -1134,42 +1085,42 @@ const fillConfig = (config = []) => [
|
|
|
1134
1085
|
},
|
|
1135
1086
|
{
|
|
1136
1087
|
name: "backgroundSize",
|
|
1137
|
-
text: "
|
|
1088
|
+
text: "背景图大小",
|
|
1138
1089
|
defaultValue: "100% 100%"
|
|
1139
1090
|
}
|
|
1140
1091
|
]
|
|
1141
1092
|
},
|
|
1142
1093
|
{
|
|
1143
1094
|
type: "fieldset",
|
|
1144
|
-
legend: "
|
|
1095
|
+
legend: "字体",
|
|
1145
1096
|
items: [
|
|
1146
1097
|
{
|
|
1147
1098
|
name: "color",
|
|
1148
|
-
text: "
|
|
1099
|
+
text: "颜色",
|
|
1149
1100
|
type: "colorPicker"
|
|
1150
1101
|
},
|
|
1151
1102
|
{
|
|
1152
1103
|
name: "fontSize",
|
|
1153
|
-
text: "
|
|
1104
|
+
text: "大小"
|
|
1154
1105
|
},
|
|
1155
1106
|
{
|
|
1156
1107
|
name: "fontWeight",
|
|
1157
|
-
text: "
|
|
1108
|
+
text: "粗细"
|
|
1158
1109
|
}
|
|
1159
1110
|
]
|
|
1160
1111
|
},
|
|
1161
1112
|
{
|
|
1162
1113
|
type: "fieldset",
|
|
1163
|
-
legend: "
|
|
1114
|
+
legend: "变形",
|
|
1164
1115
|
name: "transform",
|
|
1165
1116
|
items: [
|
|
1166
1117
|
{
|
|
1167
1118
|
name: "rotate",
|
|
1168
|
-
text: "
|
|
1119
|
+
text: "旋转角度"
|
|
1169
1120
|
},
|
|
1170
1121
|
{
|
|
1171
1122
|
name: "scale",
|
|
1172
|
-
text: "
|
|
1123
|
+
text: "缩放"
|
|
1173
1124
|
}
|
|
1174
1125
|
]
|
|
1175
1126
|
}
|
|
@@ -1178,7 +1129,7 @@ const fillConfig = (config = []) => [
|
|
|
1178
1129
|
]
|
|
1179
1130
|
},
|
|
1180
1131
|
{
|
|
1181
|
-
title: "
|
|
1132
|
+
title: "事件",
|
|
1182
1133
|
items: [
|
|
1183
1134
|
{
|
|
1184
1135
|
name: "events",
|
|
@@ -1187,7 +1138,7 @@ const fillConfig = (config = []) => [
|
|
|
1187
1138
|
]
|
|
1188
1139
|
},
|
|
1189
1140
|
{
|
|
1190
|
-
title: "
|
|
1141
|
+
title: "高级",
|
|
1191
1142
|
lazy: true,
|
|
1192
1143
|
items: [
|
|
1193
1144
|
{
|
|
@@ -1446,6 +1397,7 @@ class UndoRedo {
|
|
|
1446
1397
|
canUndo() {
|
|
1447
1398
|
return this.listCursor > 1;
|
|
1448
1399
|
}
|
|
1400
|
+
// 返回undo后的当前元素
|
|
1449
1401
|
undo() {
|
|
1450
1402
|
if (!this.canUndo()) {
|
|
1451
1403
|
return null;
|
|
@@ -1456,6 +1408,7 @@ class UndoRedo {
|
|
|
1456
1408
|
canRedo() {
|
|
1457
1409
|
return this.elementList.length > this.listCursor;
|
|
1458
1410
|
}
|
|
1411
|
+
// 返回redo后的当前元素
|
|
1459
1412
|
redo() {
|
|
1460
1413
|
if (!this.canRedo()) {
|
|
1461
1414
|
return null;
|
|
@@ -1473,17 +1426,17 @@ class UndoRedo {
|
|
|
1473
1426
|
|
|
1474
1427
|
const compose = (middleware) => {
|
|
1475
1428
|
if (!Array.isArray(middleware))
|
|
1476
|
-
throw new TypeError("Middleware
|
|
1429
|
+
throw new TypeError("Middleware 必须是一个数组!");
|
|
1477
1430
|
for (const fn of middleware) {
|
|
1478
1431
|
if (typeof fn !== "function")
|
|
1479
|
-
throw new TypeError("Middleware
|
|
1432
|
+
throw new TypeError("Middleware 必须由函数组成!");
|
|
1480
1433
|
}
|
|
1481
1434
|
return (args, next) => {
|
|
1482
1435
|
let index = -1;
|
|
1483
1436
|
return dispatch(0);
|
|
1484
1437
|
function dispatch(i) {
|
|
1485
1438
|
if (i <= index)
|
|
1486
|
-
return Promise.reject(new Error("next()
|
|
1439
|
+
return Promise.reject(new Error("next() 被多次调用"));
|
|
1487
1440
|
index = i;
|
|
1488
1441
|
let fn = middleware[i];
|
|
1489
1442
|
if (i === middleware.length && next)
|
|
@@ -1688,16 +1641,32 @@ class WebStorage extends BaseService {
|
|
|
1688
1641
|
constructor() {
|
|
1689
1642
|
super(["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]);
|
|
1690
1643
|
}
|
|
1644
|
+
/**
|
|
1645
|
+
* 获取数据存储对象,可以通过
|
|
1646
|
+
* const storageService = new StorageService();
|
|
1647
|
+
* storageService.usePlugin({
|
|
1648
|
+
* // 替换存储对象为 sessionStorage
|
|
1649
|
+
* async afterGetStorage(): Promise<Storage> {
|
|
1650
|
+
* return window.sessionStorage;
|
|
1651
|
+
* },
|
|
1652
|
+
* });
|
|
1653
|
+
*/
|
|
1691
1654
|
async getStorage() {
|
|
1692
1655
|
return this.storage;
|
|
1693
1656
|
}
|
|
1694
1657
|
async getNamespace() {
|
|
1695
1658
|
return this.namespace;
|
|
1696
1659
|
}
|
|
1660
|
+
/**
|
|
1661
|
+
* 清理,支持storageService.usePlugin
|
|
1662
|
+
*/
|
|
1697
1663
|
async clear() {
|
|
1698
1664
|
const storage2 = await this.getStorage();
|
|
1699
1665
|
storage2.clear();
|
|
1700
1666
|
}
|
|
1667
|
+
/**
|
|
1668
|
+
* 获取存储项,支持storageService.usePlugin
|
|
1669
|
+
*/
|
|
1701
1670
|
async getItem(key, options = {}) {
|
|
1702
1671
|
const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
1703
1672
|
const { protocol = options.protocol, item } = this.getValueAndProtocol(
|
|
@@ -1718,14 +1687,23 @@ class WebStorage extends BaseService {
|
|
|
1718
1687
|
return item;
|
|
1719
1688
|
}
|
|
1720
1689
|
}
|
|
1690
|
+
/**
|
|
1691
|
+
* 获取指定索引位置的key
|
|
1692
|
+
*/
|
|
1721
1693
|
async key(index) {
|
|
1722
1694
|
const storage2 = await this.getStorage();
|
|
1723
1695
|
return storage2.key(index);
|
|
1724
1696
|
}
|
|
1697
|
+
/**
|
|
1698
|
+
* 移除存储项,支持storageService.usePlugin
|
|
1699
|
+
*/
|
|
1725
1700
|
async removeItem(key2, options2 = {}) {
|
|
1726
1701
|
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
1727
1702
|
storage2.removeItem(`${options2.namespace || namespace2}:${key2}`);
|
|
1728
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* 设置存储项,支持storageService.usePlugin
|
|
1706
|
+
*/
|
|
1729
1707
|
async setItem(key2, value, options2 = {}) {
|
|
1730
1708
|
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
1731
1709
|
let item2 = value;
|
|
@@ -1787,9 +1765,19 @@ class Props extends BaseService {
|
|
|
1787
1765
|
async fillConfig(config) {
|
|
1788
1766
|
return fillConfig(config);
|
|
1789
1767
|
}
|
|
1768
|
+
/**
|
|
1769
|
+
* 为指定类型组件设置组件属性表单配置
|
|
1770
|
+
* @param type 组件类型
|
|
1771
|
+
* @param config 组件属性表单配置
|
|
1772
|
+
*/
|
|
1790
1773
|
async setPropsConfig(type, config) {
|
|
1791
1774
|
this.state.propsConfigMap[type] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
1792
1775
|
}
|
|
1776
|
+
/**
|
|
1777
|
+
* 获取指点类型的组件属性表单配置
|
|
1778
|
+
* @param type 组件类型
|
|
1779
|
+
* @returns 组件属性表单配置
|
|
1780
|
+
*/
|
|
1793
1781
|
async getPropsConfig(type) {
|
|
1794
1782
|
if (type === "area") {
|
|
1795
1783
|
return await this.getPropsConfig("button");
|
|
@@ -1801,9 +1789,19 @@ class Props extends BaseService {
|
|
|
1801
1789
|
this.setPropsValue(toLine(type), values[type]);
|
|
1802
1790
|
});
|
|
1803
1791
|
}
|
|
1792
|
+
/**
|
|
1793
|
+
* 为指点类型组件设置组件初始值
|
|
1794
|
+
* @param type 组件类型
|
|
1795
|
+
* @param value 组件初始值
|
|
1796
|
+
*/
|
|
1804
1797
|
async setPropsValue(type, value) {
|
|
1805
1798
|
this.state.propsValueMap[type] = value;
|
|
1806
1799
|
}
|
|
1800
|
+
/**
|
|
1801
|
+
* 获取指定类型的组件初始值
|
|
1802
|
+
* @param type 组件类型
|
|
1803
|
+
* @returns 组件初始值
|
|
1804
|
+
*/
|
|
1807
1805
|
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
1808
1806
|
if (type === "area") {
|
|
1809
1807
|
const value = await this.getPropsValue("button");
|
|
@@ -1833,6 +1831,11 @@ class Props extends BaseService {
|
|
|
1833
1831
|
async createId(type) {
|
|
1834
1832
|
return `${type}_${this.guid()}`;
|
|
1835
1833
|
}
|
|
1834
|
+
/**
|
|
1835
|
+
* 将组件与组件的子元素配置中的id都设置成一个新的ID
|
|
1836
|
+
* @param {Object} config 组件配置
|
|
1837
|
+
*/
|
|
1838
|
+
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
1836
1839
|
async setNewItemId(config) {
|
|
1837
1840
|
config.id = await this.createId(config.type || "component");
|
|
1838
1841
|
if (config.items && Array.isArray(config.items)) {
|
|
@@ -1842,6 +1845,11 @@ class Props extends BaseService {
|
|
|
1842
1845
|
}
|
|
1843
1846
|
return config;
|
|
1844
1847
|
}
|
|
1848
|
+
/**
|
|
1849
|
+
* 获取默认属性配置
|
|
1850
|
+
* @param type 组件类型
|
|
1851
|
+
* @returns Object
|
|
1852
|
+
*/
|
|
1845
1853
|
async getDefaultPropsValue(type) {
|
|
1846
1854
|
return ["page", "container"].includes(type) ? {
|
|
1847
1855
|
type,
|
|
@@ -1864,6 +1872,11 @@ class Props extends BaseService {
|
|
|
1864
1872
|
this.removeAllListeners();
|
|
1865
1873
|
this.removeAllPlugins();
|
|
1866
1874
|
}
|
|
1875
|
+
/**
|
|
1876
|
+
* 生成指定位数的GUID,无【-】格式
|
|
1877
|
+
* @param digit 位数,默认值8
|
|
1878
|
+
* @returns
|
|
1879
|
+
*/
|
|
1867
1880
|
guid(digit = 8) {
|
|
1868
1881
|
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
1869
1882
|
const r = Math.random() * 16 | 0;
|
|
@@ -1946,7 +1959,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
|
|
|
1946
1959
|
return newNode;
|
|
1947
1960
|
};
|
|
1948
1961
|
|
|
1949
|
-
|
|
1962
|
+
let Editor$1 = class Editor extends BaseService {
|
|
1950
1963
|
state = reactive({
|
|
1951
1964
|
root: null,
|
|
1952
1965
|
page: null,
|
|
@@ -1983,9 +1996,15 @@ class Editor$1 extends BaseService {
|
|
|
1983
1996
|
"redo",
|
|
1984
1997
|
"highlight"
|
|
1985
1998
|
],
|
|
1999
|
+
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
1986
2000
|
["select", "update", "moveLayer"]
|
|
1987
2001
|
);
|
|
1988
2002
|
}
|
|
2003
|
+
/**
|
|
2004
|
+
* 设置当前指点节点配置
|
|
2005
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
2006
|
+
* @param value MNode
|
|
2007
|
+
*/
|
|
1989
2008
|
set(name, value) {
|
|
1990
2009
|
const preValue = this.state[name];
|
|
1991
2010
|
this.state[name] = value;
|
|
@@ -1994,7 +2013,7 @@ class Editor$1 extends BaseService {
|
|
|
1994
2013
|
}
|
|
1995
2014
|
if (name === "root") {
|
|
1996
2015
|
if (Array.isArray(value)) {
|
|
1997
|
-
throw new Error("root
|
|
2016
|
+
throw new Error("root 不能为数组");
|
|
1998
2017
|
}
|
|
1999
2018
|
if (value && isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
|
|
2000
2019
|
this.state.pageLength = value.items?.length || 0;
|
|
@@ -2004,9 +2023,20 @@ class Editor$1 extends BaseService {
|
|
|
2004
2023
|
this.emit("root-change", value, preValue);
|
|
2005
2024
|
}
|
|
2006
2025
|
}
|
|
2026
|
+
/**
|
|
2027
|
+
* 获取当前指点节点配置
|
|
2028
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
2029
|
+
* @returns MNode
|
|
2030
|
+
*/
|
|
2007
2031
|
get(name) {
|
|
2008
2032
|
return this.state[name];
|
|
2009
2033
|
}
|
|
2034
|
+
/**
|
|
2035
|
+
* 根据id获取组件、组件的父组件以及组件所属的页面节点
|
|
2036
|
+
* @param {number | string} id 组件id
|
|
2037
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2038
|
+
* @returns {EditorNodeInfo}
|
|
2039
|
+
*/
|
|
2010
2040
|
getNodeInfo(id, raw = true) {
|
|
2011
2041
|
let root = this.get("root");
|
|
2012
2042
|
if (raw) {
|
|
@@ -2037,14 +2067,29 @@ class Editor$1 extends BaseService {
|
|
|
2037
2067
|
});
|
|
2038
2068
|
return info;
|
|
2039
2069
|
}
|
|
2070
|
+
/**
|
|
2071
|
+
* 根据ID获取指点节点配置
|
|
2072
|
+
* @param id 组件ID
|
|
2073
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2074
|
+
* @returns 组件节点配置
|
|
2075
|
+
*/
|
|
2040
2076
|
getNodeById(id, raw = true) {
|
|
2041
2077
|
const { node } = this.getNodeInfo(id, raw);
|
|
2042
2078
|
return node;
|
|
2043
2079
|
}
|
|
2080
|
+
/**
|
|
2081
|
+
* 根据ID获取指点节点的父节点配置
|
|
2082
|
+
* @param id 组件ID
|
|
2083
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2084
|
+
* @returns 指点组件的父节点配置
|
|
2085
|
+
*/
|
|
2044
2086
|
getParentById(id, raw = true) {
|
|
2045
2087
|
const { parent } = this.getNodeInfo(id, raw);
|
|
2046
2088
|
return parent;
|
|
2047
2089
|
}
|
|
2090
|
+
/**
|
|
2091
|
+
* 只有容器拥有布局
|
|
2092
|
+
*/
|
|
2048
2093
|
async getLayout(parent, node) {
|
|
2049
2094
|
if (node && typeof node !== "function" && isFixed(node))
|
|
2050
2095
|
return Layout.FIXED;
|
|
@@ -2056,6 +2101,11 @@ class Editor$1 extends BaseService {
|
|
|
2056
2101
|
}
|
|
2057
2102
|
return Layout.ABSOLUTE;
|
|
2058
2103
|
}
|
|
2104
|
+
/**
|
|
2105
|
+
* 选中指定节点(将指定节点设置成当前选中状态)
|
|
2106
|
+
* @param config 指定节点配置或者ID
|
|
2107
|
+
* @returns 当前选中的节点配置
|
|
2108
|
+
*/
|
|
2059
2109
|
async select(config) {
|
|
2060
2110
|
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
2061
2111
|
this.set("nodes", node ? [node] : []);
|
|
@@ -2097,15 +2147,20 @@ class Editor$1 extends BaseService {
|
|
|
2097
2147
|
const root = toRaw(this.get("root"));
|
|
2098
2148
|
const page = toRaw(this.get("page"));
|
|
2099
2149
|
if (!page)
|
|
2100
|
-
throw new Error("page
|
|
2150
|
+
throw new Error("page不能为空");
|
|
2101
2151
|
if (!root)
|
|
2102
|
-
throw new Error("root
|
|
2152
|
+
throw new Error("root不能为空");
|
|
2103
2153
|
const index = getNodeIndex(page, root);
|
|
2104
2154
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
2105
2155
|
await this.select(nextPage);
|
|
2106
2156
|
this.get("stage")?.select(nextPage.id);
|
|
2107
2157
|
return nextPage;
|
|
2108
2158
|
}
|
|
2159
|
+
/**
|
|
2160
|
+
* 高亮指定节点
|
|
2161
|
+
* @param config 指定节点配置或者ID
|
|
2162
|
+
* @returns 当前高亮的节点配置
|
|
2163
|
+
*/
|
|
2109
2164
|
highlight(config) {
|
|
2110
2165
|
const { node } = this.selectedConfigExceptionHandler(config);
|
|
2111
2166
|
const currentHighlightNode = this.get("highlightNode");
|
|
@@ -2113,6 +2168,11 @@ class Editor$1 extends BaseService {
|
|
|
2113
2168
|
return;
|
|
2114
2169
|
this.set("highlightNode", node);
|
|
2115
2170
|
}
|
|
2171
|
+
/**
|
|
2172
|
+
* 多选
|
|
2173
|
+
* @param ids 指定节点ID
|
|
2174
|
+
* @returns 加入多选的节点配置
|
|
2175
|
+
*/
|
|
2116
2176
|
multiSelect(ids) {
|
|
2117
2177
|
const nodes = [];
|
|
2118
2178
|
const idsUnique = uniq(ids);
|
|
@@ -2127,13 +2187,13 @@ class Editor$1 extends BaseService {
|
|
|
2127
2187
|
async doAdd(node, parent) {
|
|
2128
2188
|
const root = this.get("root");
|
|
2129
2189
|
if (!root)
|
|
2130
|
-
throw new Error("root
|
|
2190
|
+
throw new Error("root为空");
|
|
2131
2191
|
const curNode = this.get("node");
|
|
2132
2192
|
const stage = this.get("stage");
|
|
2133
2193
|
if (!curNode)
|
|
2134
|
-
throw new Error("
|
|
2194
|
+
throw new Error("当前选中节点为空");
|
|
2135
2195
|
if ((parent.type === NodeType.ROOT || curNode?.type === NodeType.ROOT) && node.type !== NodeType.PAGE) {
|
|
2136
|
-
throw new Error("app
|
|
2196
|
+
throw new Error("app下不能添加组件");
|
|
2137
2197
|
}
|
|
2138
2198
|
if (parent.id !== curNode.id && node.type !== NodeType.PAGE) {
|
|
2139
2199
|
const index = parent.items.indexOf(curNode);
|
|
@@ -2157,13 +2217,19 @@ class Editor$1 extends BaseService {
|
|
|
2157
2217
|
this.addModifiedNodeId(node.id);
|
|
2158
2218
|
return node;
|
|
2159
2219
|
}
|
|
2220
|
+
/**
|
|
2221
|
+
* 向指点容器添加组件节点
|
|
2222
|
+
* @param addConfig 将要添加的组件节点配置
|
|
2223
|
+
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
2224
|
+
* @returns 添加后的节点
|
|
2225
|
+
*/
|
|
2160
2226
|
async add(addNode, parent) {
|
|
2161
2227
|
const stage = this.get("stage");
|
|
2162
2228
|
const addNodes = [];
|
|
2163
2229
|
if (!Array.isArray(addNode)) {
|
|
2164
2230
|
const { type, inputEvent, ...config } = addNode;
|
|
2165
2231
|
if (!type)
|
|
2166
|
-
throw new Error("
|
|
2232
|
+
throw new Error("组件类型不能为空");
|
|
2167
2233
|
addNodes.push({ ...toRaw(await propsService.getPropsValue(type, config)) });
|
|
2168
2234
|
} else {
|
|
2169
2235
|
addNodes.push(...addNode);
|
|
@@ -2176,7 +2242,7 @@ class Editor$1 extends BaseService {
|
|
|
2176
2242
|
}
|
|
2177
2243
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
2178
2244
|
if (!parentNode)
|
|
2179
|
-
throw new Error("
|
|
2245
|
+
throw new Error("未找到父元素");
|
|
2180
2246
|
return this.doAdd(node, parentNode);
|
|
2181
2247
|
})
|
|
2182
2248
|
);
|
|
@@ -2201,13 +2267,13 @@ class Editor$1 extends BaseService {
|
|
|
2201
2267
|
async doRemove(node) {
|
|
2202
2268
|
const root = this.get("root");
|
|
2203
2269
|
if (!root)
|
|
2204
|
-
throw new Error("root
|
|
2270
|
+
throw new Error("root不能为空");
|
|
2205
2271
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
2206
2272
|
if (!parent || !curNode)
|
|
2207
|
-
throw new Error("
|
|
2273
|
+
throw new Error("找不要删除的节点");
|
|
2208
2274
|
const index = getNodeIndex(curNode, parent);
|
|
2209
2275
|
if (typeof index !== "number" || index === -1)
|
|
2210
|
-
throw new Error("
|
|
2276
|
+
throw new Error("找不要删除的节点");
|
|
2211
2277
|
parent.items?.splice(index, 1);
|
|
2212
2278
|
const stage = this.get("stage");
|
|
2213
2279
|
stage?.remove({ id: node.id, parentId: parent.id, root: cloneDeep(root) });
|
|
@@ -2232,6 +2298,10 @@ class Editor$1 extends BaseService {
|
|
|
2232
2298
|
}
|
|
2233
2299
|
this.addModifiedNodeId(parent.id);
|
|
2234
2300
|
}
|
|
2301
|
+
/**
|
|
2302
|
+
* 删除组件
|
|
2303
|
+
* @param {Object} node
|
|
2304
|
+
*/
|
|
2235
2305
|
async remove(nodeOrNodeList) {
|
|
2236
2306
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
2237
2307
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
@@ -2243,12 +2313,12 @@ class Editor$1 extends BaseService {
|
|
|
2243
2313
|
async doUpdate(config) {
|
|
2244
2314
|
const root = this.get("root");
|
|
2245
2315
|
if (!root)
|
|
2246
|
-
throw new Error("root
|
|
2316
|
+
throw new Error("root为空");
|
|
2247
2317
|
if (!config?.id)
|
|
2248
|
-
throw new Error("
|
|
2318
|
+
throw new Error("没有配置或者配置缺少id值");
|
|
2249
2319
|
const info = this.getNodeInfo(config.id, false);
|
|
2250
2320
|
if (!info.node)
|
|
2251
|
-
throw new Error(
|
|
2321
|
+
throw new Error(`获取不到id为${config.id}的节点`);
|
|
2252
2322
|
const node = cloneDeep(toRaw(info.node));
|
|
2253
2323
|
let newConfig = await this.toggleFixedPosition(toRaw(config), node, root);
|
|
2254
2324
|
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
@@ -2260,18 +2330,18 @@ class Editor$1 extends BaseService {
|
|
|
2260
2330
|
}
|
|
2261
2331
|
});
|
|
2262
2332
|
if (!newConfig.type)
|
|
2263
|
-
throw new Error("
|
|
2333
|
+
throw new Error("配置缺少type值");
|
|
2264
2334
|
if (newConfig.type === NodeType.ROOT) {
|
|
2265
2335
|
this.set("root", newConfig);
|
|
2266
2336
|
return newConfig;
|
|
2267
2337
|
}
|
|
2268
2338
|
const { parent } = info;
|
|
2269
2339
|
if (!parent)
|
|
2270
|
-
throw new Error("
|
|
2340
|
+
throw new Error("获取不到父级节点");
|
|
2271
2341
|
const parentNodeItems = parent.items;
|
|
2272
2342
|
const index = getNodeIndex(newConfig, parent);
|
|
2273
2343
|
if (!parentNodeItems || typeof index === "undefined" || index === -1)
|
|
2274
|
-
throw new Error("
|
|
2344
|
+
throw new Error("更新的节点未找到");
|
|
2275
2345
|
const newLayout = await this.getLayout(newConfig);
|
|
2276
2346
|
const layout = await this.getLayout(node);
|
|
2277
2347
|
if (newLayout !== layout) {
|
|
@@ -2293,6 +2363,11 @@ class Editor$1 extends BaseService {
|
|
|
2293
2363
|
this.addModifiedNodeId(newConfig.id);
|
|
2294
2364
|
return newConfig;
|
|
2295
2365
|
}
|
|
2366
|
+
/**
|
|
2367
|
+
* 更新节点
|
|
2368
|
+
* @param config 新的节点配置,配置中需要有id信息
|
|
2369
|
+
* @returns 更新后的节点配置
|
|
2370
|
+
*/
|
|
2296
2371
|
async update(config) {
|
|
2297
2372
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2298
2373
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
@@ -2300,16 +2375,22 @@ class Editor$1 extends BaseService {
|
|
|
2300
2375
|
this.emit("update", newNodes);
|
|
2301
2376
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
2302
2377
|
}
|
|
2378
|
+
/**
|
|
2379
|
+
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
2380
|
+
* @param id1 组件ID
|
|
2381
|
+
* @param id2 组件ID
|
|
2382
|
+
* @returns void
|
|
2383
|
+
*/
|
|
2303
2384
|
async sort(id1, id2) {
|
|
2304
2385
|
const root = this.get("root");
|
|
2305
2386
|
if (!root)
|
|
2306
|
-
throw new Error("root
|
|
2387
|
+
throw new Error("root为空");
|
|
2307
2388
|
const node = this.get("node");
|
|
2308
2389
|
if (!node)
|
|
2309
|
-
throw new Error("
|
|
2390
|
+
throw new Error("当前节点为空");
|
|
2310
2391
|
const parent = cloneDeep(toRaw(this.get("parent")));
|
|
2311
2392
|
if (!parent)
|
|
2312
|
-
throw new Error("
|
|
2393
|
+
throw new Error("父节点为空");
|
|
2313
2394
|
const index2 = parent.items.findIndex((node2) => `${node2.id}` === `${id2}`);
|
|
2314
2395
|
if (index2 < 0)
|
|
2315
2396
|
return;
|
|
@@ -2325,11 +2406,21 @@ class Editor$1 extends BaseService {
|
|
|
2325
2406
|
this.addModifiedNodeId(parent.id);
|
|
2326
2407
|
this.pushHistoryState();
|
|
2327
2408
|
}
|
|
2409
|
+
/**
|
|
2410
|
+
* 将组将节点配置转化成string,然后存储到localStorage中
|
|
2411
|
+
* @param config 组件节点配置
|
|
2412
|
+
* @returns 组件节点配置
|
|
2413
|
+
*/
|
|
2328
2414
|
async copy(config) {
|
|
2329
2415
|
await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
|
|
2330
2416
|
protocol: Protocol.OBJECT
|
|
2331
2417
|
});
|
|
2332
2418
|
}
|
|
2419
|
+
/**
|
|
2420
|
+
* 从localStorage中获取节点,然后添加到当前容器中
|
|
2421
|
+
* @param position 粘贴的坐标
|
|
2422
|
+
* @returns 添加后的组件节点配置
|
|
2423
|
+
*/
|
|
2333
2424
|
async paste(position = {}) {
|
|
2334
2425
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
2335
2426
|
if (!Array.isArray(config))
|
|
@@ -2352,7 +2443,7 @@ class Editor$1 extends BaseService {
|
|
|
2352
2443
|
async doAlignCenter(config) {
|
|
2353
2444
|
const parent = this.getParentById(config.id);
|
|
2354
2445
|
if (!parent)
|
|
2355
|
-
throw new Error("
|
|
2446
|
+
throw new Error("找不到父节点");
|
|
2356
2447
|
const node = cloneDeep(toRaw(config));
|
|
2357
2448
|
const layout = await this.getLayout(parent, node);
|
|
2358
2449
|
if (layout === Layout.RELATIVE) {
|
|
@@ -2373,6 +2464,11 @@ class Editor$1 extends BaseService {
|
|
|
2373
2464
|
}
|
|
2374
2465
|
return node;
|
|
2375
2466
|
}
|
|
2467
|
+
/**
|
|
2468
|
+
* 将指点节点设置居中
|
|
2469
|
+
* @param config 组件节点配置
|
|
2470
|
+
* @returns 当前组件节点配置
|
|
2471
|
+
*/
|
|
2376
2472
|
async alignCenter(config) {
|
|
2377
2473
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2378
2474
|
const stage = this.get("stage");
|
|
@@ -2385,16 +2481,20 @@ class Editor$1 extends BaseService {
|
|
|
2385
2481
|
}
|
|
2386
2482
|
return newNode;
|
|
2387
2483
|
}
|
|
2484
|
+
/**
|
|
2485
|
+
* 移动当前选中节点位置
|
|
2486
|
+
* @param offset 偏移量
|
|
2487
|
+
*/
|
|
2388
2488
|
async moveLayer(offset) {
|
|
2389
2489
|
const root = this.get("root");
|
|
2390
2490
|
if (!root)
|
|
2391
|
-
throw new Error("root
|
|
2491
|
+
throw new Error("root为空");
|
|
2392
2492
|
const parent = this.get("parent");
|
|
2393
2493
|
if (!parent)
|
|
2394
|
-
throw new Error("
|
|
2494
|
+
throw new Error("父节点为空");
|
|
2395
2495
|
const node = this.get("node");
|
|
2396
2496
|
if (!node)
|
|
2397
|
-
throw new Error("
|
|
2497
|
+
throw new Error("当前节点为空");
|
|
2398
2498
|
const brothers = parent.items || [];
|
|
2399
2499
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2400
2500
|
const layout = await this.getLayout(parent, node);
|
|
@@ -2416,6 +2516,11 @@ class Editor$1 extends BaseService {
|
|
|
2416
2516
|
this.addModifiedNodeId(parent.id);
|
|
2417
2517
|
this.pushHistoryState();
|
|
2418
2518
|
}
|
|
2519
|
+
/**
|
|
2520
|
+
* 移动到指定容器中
|
|
2521
|
+
* @param config 需要移动的节点
|
|
2522
|
+
* @param targetId 容器ID
|
|
2523
|
+
*/
|
|
2419
2524
|
async moveToContainer(config, targetId) {
|
|
2420
2525
|
const root = cloneDeep(this.get("root"));
|
|
2421
2526
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
@@ -2444,11 +2549,19 @@ class Editor$1 extends BaseService {
|
|
|
2444
2549
|
return newConfig;
|
|
2445
2550
|
}
|
|
2446
2551
|
}
|
|
2552
|
+
/**
|
|
2553
|
+
* 撤销当前操作
|
|
2554
|
+
* @returns 上一次数据
|
|
2555
|
+
*/
|
|
2447
2556
|
async undo() {
|
|
2448
2557
|
const value = historyService.undo();
|
|
2449
2558
|
await this.changeHistoryState(value);
|
|
2450
2559
|
return value;
|
|
2451
2560
|
}
|
|
2561
|
+
/**
|
|
2562
|
+
* 恢复到下一步
|
|
2563
|
+
* @returns 下一步数据
|
|
2564
|
+
*/
|
|
2452
2565
|
async redo() {
|
|
2453
2566
|
const value = historyService.redo();
|
|
2454
2567
|
await this.changeHistoryState(value);
|
|
@@ -2544,13 +2657,13 @@ class Editor$1 extends BaseService {
|
|
|
2544
2657
|
id = config.id;
|
|
2545
2658
|
}
|
|
2546
2659
|
if (!id) {
|
|
2547
|
-
throw new Error("
|
|
2660
|
+
throw new Error("没有ID,无法选中");
|
|
2548
2661
|
}
|
|
2549
2662
|
const { node, parent, page } = this.getNodeInfo(id);
|
|
2550
2663
|
if (!node)
|
|
2551
|
-
throw new Error("
|
|
2664
|
+
throw new Error("获取不到组件信息");
|
|
2552
2665
|
if (node.id === this.state.root?.id) {
|
|
2553
|
-
throw new Error("
|
|
2666
|
+
throw new Error("不能选根节点");
|
|
2554
2667
|
}
|
|
2555
2668
|
return {
|
|
2556
2669
|
node,
|
|
@@ -2558,7 +2671,7 @@ class Editor$1 extends BaseService {
|
|
|
2558
2671
|
page
|
|
2559
2672
|
};
|
|
2560
2673
|
}
|
|
2561
|
-
}
|
|
2674
|
+
};
|
|
2562
2675
|
const editorService = new Editor$1();
|
|
2563
2676
|
|
|
2564
2677
|
const state = reactive({
|
|
@@ -2709,7 +2822,7 @@ const useStage = (stageOptions) => {
|
|
|
2709
2822
|
stage.on("select-parent", () => {
|
|
2710
2823
|
const parent = editorService.get("parent");
|
|
2711
2824
|
if (!parent)
|
|
2712
|
-
throw new Error("
|
|
2825
|
+
throw new Error("父节点为空");
|
|
2713
2826
|
editorService.select(parent);
|
|
2714
2827
|
editorService.get("stage")?.select(parent.id);
|
|
2715
2828
|
});
|
|
@@ -2729,13 +2842,13 @@ const useStage = (stageOptions) => {
|
|
|
2729
2842
|
return stage;
|
|
2730
2843
|
};
|
|
2731
2844
|
|
|
2732
|
-
const _hoisted_1$
|
|
2733
|
-
const _hoisted_2$
|
|
2734
|
-
const _hoisted_3$
|
|
2845
|
+
const _hoisted_1$f = { class: "m-editor-empty-panel" };
|
|
2846
|
+
const _hoisted_2$8 = { class: "m-editor-empty-content" };
|
|
2847
|
+
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
2735
2848
|
const __default__$l = defineComponent({
|
|
2736
2849
|
name: "MEditorAddPageBox"
|
|
2737
2850
|
});
|
|
2738
|
-
const _sfc_main$
|
|
2851
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
2739
2852
|
...__default__$l,
|
|
2740
2853
|
setup(__props) {
|
|
2741
2854
|
const services = inject("services");
|
|
@@ -2745,23 +2858,23 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2745
2858
|
return;
|
|
2746
2859
|
const root = toRaw(editorService.get("root"));
|
|
2747
2860
|
if (!root)
|
|
2748
|
-
throw new Error("root
|
|
2861
|
+
throw new Error("root 不能为空");
|
|
2749
2862
|
editorService.add({
|
|
2750
2863
|
type: NodeType.PAGE,
|
|
2751
2864
|
name: generatePageNameByApp(root)
|
|
2752
2865
|
});
|
|
2753
2866
|
};
|
|
2754
2867
|
return (_ctx, _cache) => {
|
|
2755
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2756
|
-
createElementVNode("div", _hoisted_2$
|
|
2868
|
+
return openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
2869
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
2757
2870
|
createElementVNode("div", {
|
|
2758
2871
|
class: "m-editor-empty-button",
|
|
2759
2872
|
onClick: clickHandler
|
|
2760
2873
|
}, [
|
|
2761
2874
|
createElementVNode("div", null, [
|
|
2762
|
-
createVNode(_sfc_main$
|
|
2875
|
+
createVNode(_sfc_main$w, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
2763
2876
|
]),
|
|
2764
|
-
_hoisted_3$
|
|
2877
|
+
_hoisted_3$4
|
|
2765
2878
|
])
|
|
2766
2879
|
])
|
|
2767
2880
|
]);
|
|
@@ -2769,11 +2882,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2769
2882
|
}
|
|
2770
2883
|
});
|
|
2771
2884
|
|
|
2772
|
-
const _hoisted_1$
|
|
2885
|
+
const _hoisted_1$e = { class: "m-editor" };
|
|
2773
2886
|
const __default__$k = defineComponent({
|
|
2774
2887
|
name: "MEditorFramework"
|
|
2775
2888
|
});
|
|
2776
|
-
const _sfc_main$
|
|
2889
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
2777
2890
|
...__default__$k,
|
|
2778
2891
|
props: {
|
|
2779
2892
|
codeOptions: { default: () => ({}) }
|
|
@@ -2843,7 +2956,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2843
2956
|
};
|
|
2844
2957
|
return (_ctx, _cache) => {
|
|
2845
2958
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
2846
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2959
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
2847
2960
|
renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2848
2961
|
unref(showSrc) ? (openBlock(), createBlock(_component_magic_code_editor, {
|
|
2849
2962
|
key: 0,
|
|
@@ -2851,7 +2964,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2851
2964
|
"init-values": unref(root),
|
|
2852
2965
|
options: __props.codeOptions,
|
|
2853
2966
|
onSave: saveCode
|
|
2854
|
-
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$
|
|
2967
|
+
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$q, {
|
|
2855
2968
|
key: 1,
|
|
2856
2969
|
class: "m-editor-content",
|
|
2857
2970
|
"left-class": "m-editor-framework-left",
|
|
@@ -2861,8 +2974,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2861
2974
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
|
|
2862
2975
|
right: columnWidth.value.right,
|
|
2863
2976
|
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
2864
|
-
"min-left":
|
|
2865
|
-
"min-right":
|
|
2977
|
+
"min-left": 65,
|
|
2978
|
+
"min-right": 20,
|
|
2866
2979
|
onChange: columnWidthChange
|
|
2867
2980
|
}, createSlots({
|
|
2868
2981
|
left: withCtx(() => [
|
|
@@ -2870,7 +2983,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2870
2983
|
]),
|
|
2871
2984
|
center: withCtx(() => [
|
|
2872
2985
|
unref(pageLength) > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2873
|
-
createVNode(_sfc_main$
|
|
2986
|
+
createVNode(_sfc_main$p)
|
|
2874
2987
|
])
|
|
2875
2988
|
]),
|
|
2876
2989
|
_: 2
|
|
@@ -2892,15 +3005,15 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2892
3005
|
}
|
|
2893
3006
|
});
|
|
2894
3007
|
|
|
2895
|
-
const _hoisted_1$
|
|
3008
|
+
const _hoisted_1$d = {
|
|
2896
3009
|
key: 1,
|
|
2897
3010
|
class: "menu-item-text"
|
|
2898
3011
|
};
|
|
2899
|
-
const _hoisted_2$
|
|
3012
|
+
const _hoisted_2$7 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2900
3013
|
const __default__$j = defineComponent({
|
|
2901
3014
|
name: "MEditorToolButton"
|
|
2902
3015
|
});
|
|
2903
|
-
const _sfc_main$
|
|
3016
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
2904
3017
|
...__default__$j,
|
|
2905
3018
|
props: {
|
|
2906
3019
|
data: { default: () => ({
|
|
@@ -2976,7 +3089,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2976
3089
|
__props.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
2977
3090
|
key: 0,
|
|
2978
3091
|
direction: __props.data.direction || "vertical"
|
|
2979
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
3092
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$d, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2980
3093
|
__props.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
2981
3094
|
key: 0,
|
|
2982
3095
|
effect: "dark",
|
|
@@ -2990,7 +3103,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2990
3103
|
disabled: unref(disabled)
|
|
2991
3104
|
}, {
|
|
2992
3105
|
default: withCtx(() => [
|
|
2993
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
3106
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$w, {
|
|
2994
3107
|
key: 0,
|
|
2995
3108
|
icon: __props.data.icon
|
|
2996
3109
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -3007,7 +3120,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3007
3120
|
disabled: unref(disabled)
|
|
3008
3121
|
}, {
|
|
3009
3122
|
default: withCtx(() => [
|
|
3010
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
3123
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$w, {
|
|
3011
3124
|
key: 0,
|
|
3012
3125
|
icon: __props.data.icon
|
|
3013
3126
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -3040,7 +3153,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3040
3153
|
})) : createCommentVNode("", true)
|
|
3041
3154
|
]),
|
|
3042
3155
|
default: withCtx(() => [
|
|
3043
|
-
createElementVNode("span", _hoisted_2$
|
|
3156
|
+
createElementVNode("span", _hoisted_2$7, [
|
|
3044
3157
|
createTextVNode(toDisplayString(__props.data.text), 1),
|
|
3045
3158
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
3046
3159
|
default: withCtx(() => [
|
|
@@ -3060,7 +3173,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3060
3173
|
const __default__$i = defineComponent({
|
|
3061
3174
|
name: "MEditorNavMenu"
|
|
3062
3175
|
});
|
|
3063
|
-
const _sfc_main$
|
|
3176
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
3064
3177
|
...__default__$i,
|
|
3065
3178
|
props: {
|
|
3066
3179
|
data: { default: () => ({}) },
|
|
@@ -3103,7 +3216,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3103
3216
|
type: "button",
|
|
3104
3217
|
className: "delete",
|
|
3105
3218
|
icon: markRaw(Delete),
|
|
3106
|
-
tooltip:
|
|
3219
|
+
tooltip: `刪除(Delete)`,
|
|
3107
3220
|
disabled: () => services?.editorService.get("node")?.type === NodeType.PAGE,
|
|
3108
3221
|
handler: () => {
|
|
3109
3222
|
const node = services?.editorService.get("node");
|
|
@@ -3116,7 +3229,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3116
3229
|
type: "button",
|
|
3117
3230
|
className: "undo",
|
|
3118
3231
|
icon: markRaw(Back),
|
|
3119
|
-
tooltip:
|
|
3232
|
+
tooltip: `后退(${ctrl}+z)`,
|
|
3120
3233
|
disabled: () => !services?.historyService.state.canUndo,
|
|
3121
3234
|
handler: () => services?.editorService.undo()
|
|
3122
3235
|
});
|
|
@@ -3126,7 +3239,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3126
3239
|
type: "button",
|
|
3127
3240
|
className: "redo",
|
|
3128
3241
|
icon: markRaw(Right),
|
|
3129
|
-
tooltip:
|
|
3242
|
+
tooltip: `前进(${ctrl}+Shift+z)`,
|
|
3130
3243
|
disabled: () => !services?.historyService.state.canRedo,
|
|
3131
3244
|
handler: () => services?.editorService.redo()
|
|
3132
3245
|
});
|
|
@@ -3136,7 +3249,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3136
3249
|
type: "button",
|
|
3137
3250
|
className: "zoom-in",
|
|
3138
3251
|
icon: markRaw(ZoomIn),
|
|
3139
|
-
tooltip:
|
|
3252
|
+
tooltip: `放大(${ctrl}+=)`,
|
|
3140
3253
|
handler: () => uiService?.zoom(0.1)
|
|
3141
3254
|
});
|
|
3142
3255
|
break;
|
|
@@ -3145,7 +3258,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3145
3258
|
type: "button",
|
|
3146
3259
|
className: "zoom-out",
|
|
3147
3260
|
icon: markRaw(ZoomOut),
|
|
3148
|
-
tooltip:
|
|
3261
|
+
tooltip: `縮小(${ctrl}+-)`,
|
|
3149
3262
|
handler: () => uiService?.zoom(-0.1)
|
|
3150
3263
|
});
|
|
3151
3264
|
break;
|
|
@@ -3154,7 +3267,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3154
3267
|
type: "button",
|
|
3155
3268
|
className: "scale-to-original",
|
|
3156
3269
|
icon: markRaw(ScaleToOriginal),
|
|
3157
|
-
tooltip:
|
|
3270
|
+
tooltip: `缩放到实际大小(${ctrl}+1)`,
|
|
3158
3271
|
handler: () => uiService?.set("zoom", 1)
|
|
3159
3272
|
});
|
|
3160
3273
|
break;
|
|
@@ -3163,7 +3276,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3163
3276
|
type: "button",
|
|
3164
3277
|
className: "scale-to-fit",
|
|
3165
3278
|
icon: markRaw(FullScreen),
|
|
3166
|
-
tooltip:
|
|
3279
|
+
tooltip: `缩放以适应(${ctrl}+0)`,
|
|
3167
3280
|
handler: async () => uiService?.set("zoom", await uiService.calcZoom())
|
|
3168
3281
|
});
|
|
3169
3282
|
break;
|
|
@@ -3172,7 +3285,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3172
3285
|
type: "button",
|
|
3173
3286
|
className: "rule",
|
|
3174
3287
|
icon: markRaw(Memo),
|
|
3175
|
-
tooltip: showRule.value ? "
|
|
3288
|
+
tooltip: showRule.value ? "隐藏标尺" : "显示标尺",
|
|
3176
3289
|
handler: () => uiService?.set("showRule", !showRule.value)
|
|
3177
3290
|
});
|
|
3178
3291
|
break;
|
|
@@ -3181,7 +3294,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3181
3294
|
type: "button",
|
|
3182
3295
|
className: "guides",
|
|
3183
3296
|
icon: markRaw(Grid),
|
|
3184
|
-
tooltip: showGuides.value ? "
|
|
3297
|
+
tooltip: showGuides.value ? "隐藏参考线" : "显示参考线",
|
|
3185
3298
|
handler: () => uiService?.set("showGuides", !showGuides.value)
|
|
3186
3299
|
});
|
|
3187
3300
|
break;
|
|
@@ -3219,7 +3332,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3219
3332
|
style: normalizeStyle(`width: ${unref(columnWidth)?.[key]}px`)
|
|
3220
3333
|
}, [
|
|
3221
3334
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttons)[key], (item, index) => {
|
|
3222
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3335
|
+
return openBlock(), createBlock(_sfc_main$n, {
|
|
3223
3336
|
data: item,
|
|
3224
3337
|
key: index
|
|
3225
3338
|
}, null, 8, ["data"]);
|
|
@@ -3231,11 +3344,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3231
3344
|
}
|
|
3232
3345
|
});
|
|
3233
3346
|
|
|
3234
|
-
const _hoisted_1$
|
|
3347
|
+
const _hoisted_1$c = { class: "m-editor-props-panel" };
|
|
3235
3348
|
const __default__$h = defineComponent({
|
|
3236
3349
|
name: "MEditorPropsPanel"
|
|
3237
3350
|
});
|
|
3238
|
-
const _sfc_main$
|
|
3351
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
3239
3352
|
...__default__$h,
|
|
3240
3353
|
emits: ["mounted"],
|
|
3241
3354
|
setup(__props, { expose, emit }) {
|
|
@@ -3281,7 +3394,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3281
3394
|
};
|
|
3282
3395
|
expose({ submit });
|
|
3283
3396
|
return (_ctx, _cache) => {
|
|
3284
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3397
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
3285
3398
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3286
3399
|
createVNode(unref(MForm), {
|
|
3287
3400
|
ref_key: "configForm",
|
|
@@ -3298,7 +3411,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3298
3411
|
}
|
|
3299
3412
|
});
|
|
3300
3413
|
|
|
3301
|
-
const _sfc_main$
|
|
3414
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
3302
3415
|
__name: "SearchInput",
|
|
3303
3416
|
emits: ["search"],
|
|
3304
3417
|
setup(__props, { emit }) {
|
|
@@ -3312,7 +3425,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
3312
3425
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3313
3426
|
class: "search-input",
|
|
3314
3427
|
size: "small",
|
|
3315
|
-
placeholder: "
|
|
3428
|
+
placeholder: "输入关键字进行过滤",
|
|
3316
3429
|
clearable: "",
|
|
3317
3430
|
"prefix-icon": unref(Search),
|
|
3318
3431
|
onInput: filterTextChangeHandler
|
|
@@ -3321,17 +3434,71 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
3321
3434
|
}
|
|
3322
3435
|
});
|
|
3323
3436
|
|
|
3437
|
+
const _export_sfc = (sfc, props) => {
|
|
3438
|
+
const target = sfc.__vccOpts || sfc;
|
|
3439
|
+
for (const [key, val] of props) {
|
|
3440
|
+
target[key] = val;
|
|
3441
|
+
}
|
|
3442
|
+
return target;
|
|
3443
|
+
};
|
|
3444
|
+
|
|
3445
|
+
const _sfc_main$j = {};
|
|
3446
|
+
|
|
3447
|
+
const _hoisted_1$b = {
|
|
3448
|
+
width: "16px",
|
|
3449
|
+
height: "16px",
|
|
3450
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3451
|
+
};
|
|
3452
|
+
const _hoisted_2$6 = /*#__PURE__*/createElementVNode("g", {
|
|
3453
|
+
fill: "#7C878E",
|
|
3454
|
+
"fill-rule": "evenodd"
|
|
3455
|
+
}, [
|
|
3456
|
+
/*#__PURE__*/createElementVNode("path", {
|
|
3457
|
+
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",
|
|
3458
|
+
"fill-rule": "nonzero"
|
|
3459
|
+
}),
|
|
3460
|
+
/*#__PURE__*/createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
3461
|
+
], -1);
|
|
3462
|
+
const _hoisted_3$3 = [
|
|
3463
|
+
_hoisted_2$6
|
|
3464
|
+
];
|
|
3465
|
+
|
|
3466
|
+
function _sfc_render$2(_ctx, _cache) {
|
|
3467
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1$b, _hoisted_3$3))
|
|
3468
|
+
}
|
|
3469
|
+
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$j, [['render',_sfc_render$2]]);
|
|
3470
|
+
|
|
3471
|
+
const _sfc_main$i = {};
|
|
3472
|
+
|
|
3473
|
+
const _hoisted_1$a = {
|
|
3474
|
+
width: "32px",
|
|
3475
|
+
height: "32px",
|
|
3476
|
+
viewBox: "0 0 32 32",
|
|
3477
|
+
version: "1.1",
|
|
3478
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3479
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3480
|
+
};
|
|
3481
|
+
const _hoisted_2$5 = /*#__PURE__*/createStaticVNode("<title>gsd-icon-line-Universal-code</title><desc>Created with Sketch.</desc><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>", 4);
|
|
3482
|
+
const _hoisted_6 = [
|
|
3483
|
+
_hoisted_2$5
|
|
3484
|
+
];
|
|
3485
|
+
|
|
3486
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
3487
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1$a, _hoisted_6))
|
|
3488
|
+
}
|
|
3489
|
+
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$i, [['render',_sfc_render$1]]);
|
|
3490
|
+
|
|
3324
3491
|
const _hoisted_1$9 = {
|
|
3325
3492
|
key: 0,
|
|
3326
3493
|
class: "m-editor-content-bottom"
|
|
3327
3494
|
};
|
|
3328
|
-
const _hoisted_2$4 = /* @__PURE__ */ createTextVNode("
|
|
3329
|
-
const _hoisted_3$2 = /* @__PURE__ */ createTextVNode("
|
|
3495
|
+
const _hoisted_2$4 = /* @__PURE__ */ createTextVNode("确认");
|
|
3496
|
+
const _hoisted_3$2 = /* @__PURE__ */ createTextVNode("关闭");
|
|
3330
3497
|
const _hoisted_4$2 = {
|
|
3331
3498
|
key: 1,
|
|
3332
3499
|
class: "m-editor-content-bottom"
|
|
3333
3500
|
};
|
|
3334
|
-
const _hoisted_5$1 = /* @__PURE__ */ createTextVNode("
|
|
3501
|
+
const _hoisted_5$1 = /* @__PURE__ */ createTextVNode("关闭");
|
|
3335
3502
|
const __default__$g = defineComponent({
|
|
3336
3503
|
name: "MEditorCodeDraftEditor"
|
|
3337
3504
|
});
|
|
@@ -3346,7 +3513,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3346
3513
|
language: null
|
|
3347
3514
|
},
|
|
3348
3515
|
emits: ["close", "saveAndClose"],
|
|
3349
|
-
setup(__props, { emit }) {
|
|
3516
|
+
setup(__props, { expose, emit }) {
|
|
3350
3517
|
const props = __props;
|
|
3351
3518
|
const services = inject("services");
|
|
3352
3519
|
const codeContent = ref("");
|
|
@@ -3376,7 +3543,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3376
3543
|
return;
|
|
3377
3544
|
}
|
|
3378
3545
|
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3379
|
-
tMagicMessage.success(
|
|
3546
|
+
tMagicMessage.success(`代码草稿成功保存到本地 ${datetimeFormatter( new Date())}`);
|
|
3380
3547
|
};
|
|
3381
3548
|
const saveAndClose = () => {
|
|
3382
3549
|
if (!codeEditor.value || !props.editable)
|
|
@@ -3387,19 +3554,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3387
3554
|
const close = async () => {
|
|
3388
3555
|
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3389
3556
|
if (codeDraft) {
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3557
|
+
try {
|
|
3558
|
+
await tMagicMessageBox.confirm("您有代码修改未保存,是否保存后再关闭?", "提示", {
|
|
3559
|
+
confirmButtonText: "保存并关闭",
|
|
3560
|
+
cancelButtonText: "直接关闭",
|
|
3561
|
+
type: "warning",
|
|
3562
|
+
distinguishCancelAndClose: true
|
|
3563
|
+
});
|
|
3396
3564
|
saveAndClose();
|
|
3397
|
-
}
|
|
3565
|
+
} catch (action) {
|
|
3398
3566
|
if (action === "cancel") {
|
|
3399
3567
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3400
3568
|
emit("close");
|
|
3401
3569
|
}
|
|
3402
|
-
}
|
|
3570
|
+
}
|
|
3403
3571
|
} else {
|
|
3404
3572
|
emit("close");
|
|
3405
3573
|
}
|
|
@@ -3410,11 +3578,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3410
3578
|
codeEditor.value.focus();
|
|
3411
3579
|
}
|
|
3412
3580
|
};
|
|
3581
|
+
expose({
|
|
3582
|
+
saveAndClose,
|
|
3583
|
+
close
|
|
3584
|
+
});
|
|
3413
3585
|
return (_ctx, _cache) => {
|
|
3414
3586
|
return openBlock(), createElementBlock("div", {
|
|
3415
3587
|
class: normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3416
3588
|
}, [
|
|
3417
|
-
createVNode(_sfc_main$
|
|
3589
|
+
createVNode(_sfc_main$s, {
|
|
3418
3590
|
ref_key: "codeEditor",
|
|
3419
3591
|
ref: codeEditor,
|
|
3420
3592
|
class: "m-editor-container",
|
|
@@ -3430,7 +3602,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3430
3602
|
onClick: toggleFullScreen
|
|
3431
3603
|
}, {
|
|
3432
3604
|
default: withCtx(() => [
|
|
3433
|
-
createTextVNode(toDisplayString(isFullScreen.value ? "
|
|
3605
|
+
createTextVNode(toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3434
3606
|
]),
|
|
3435
3607
|
_: 1
|
|
3436
3608
|
}),
|
|
@@ -3461,7 +3633,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3461
3633
|
onClick: toggleFullScreen
|
|
3462
3634
|
}, {
|
|
3463
3635
|
default: withCtx(() => [
|
|
3464
|
-
createTextVNode(toDisplayString(isFullScreen.value ? "
|
|
3636
|
+
createTextVNode(toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3465
3637
|
]),
|
|
3466
3638
|
_: 1
|
|
3467
3639
|
}),
|
|
@@ -3482,9 +3654,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3482
3654
|
});
|
|
3483
3655
|
|
|
3484
3656
|
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3485
|
-
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "
|
|
3657
|
+
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
3486
3658
|
const _hoisted_3$1 = { class: "code-name-wrapper" };
|
|
3487
|
-
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "
|
|
3659
|
+
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
3488
3660
|
const __default__$f = defineComponent({
|
|
3489
3661
|
name: "MEditorFunctionEditor"
|
|
3490
3662
|
});
|
|
@@ -3499,27 +3671,26 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3499
3671
|
codeOptions: null,
|
|
3500
3672
|
paramsColConfig: null
|
|
3501
3673
|
},
|
|
3502
|
-
|
|
3503
|
-
setup(__props, { emit }) {
|
|
3674
|
+
setup(__props, { expose }) {
|
|
3504
3675
|
const props = __props;
|
|
3505
3676
|
const defaultParamColConfig = {
|
|
3506
3677
|
type: "row",
|
|
3507
|
-
label: "
|
|
3678
|
+
label: "参数类型",
|
|
3508
3679
|
items: [
|
|
3509
3680
|
{
|
|
3510
|
-
text: "
|
|
3681
|
+
text: "参数类型",
|
|
3511
3682
|
labelWidth: "70px",
|
|
3512
3683
|
type: "select",
|
|
3513
3684
|
name: "type",
|
|
3514
3685
|
options: [
|
|
3515
3686
|
{
|
|
3516
|
-
text: "
|
|
3517
|
-
label: "
|
|
3687
|
+
text: "数字",
|
|
3688
|
+
label: "数字",
|
|
3518
3689
|
value: "number"
|
|
3519
3690
|
},
|
|
3520
3691
|
{
|
|
3521
|
-
text: "
|
|
3522
|
-
label: "
|
|
3692
|
+
text: "字符串",
|
|
3693
|
+
label: "字符串",
|
|
3523
3694
|
value: "text"
|
|
3524
3695
|
}
|
|
3525
3696
|
]
|
|
@@ -3537,13 +3708,13 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3537
3708
|
items: [
|
|
3538
3709
|
{
|
|
3539
3710
|
type: "text",
|
|
3540
|
-
label: "
|
|
3711
|
+
label: "参数名",
|
|
3541
3712
|
name: "name",
|
|
3542
3713
|
width: 200
|
|
3543
3714
|
},
|
|
3544
3715
|
{
|
|
3545
3716
|
type: "text",
|
|
3546
|
-
label: "
|
|
3717
|
+
label: "参数注释",
|
|
3547
3718
|
name: "tip",
|
|
3548
3719
|
width: 200
|
|
3549
3720
|
},
|
|
@@ -3554,11 +3725,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3554
3725
|
const codeName = ref("");
|
|
3555
3726
|
const codeContent = ref("");
|
|
3556
3727
|
const evalRes = ref(true);
|
|
3557
|
-
provide("mForm", {
|
|
3558
|
-
$emit: emit,
|
|
3559
|
-
setField: () => {
|
|
3560
|
-
}
|
|
3561
|
-
});
|
|
3562
3728
|
const tableModel = ref();
|
|
3563
3729
|
watchEffect(() => {
|
|
3564
3730
|
codeName.value = props.name;
|
|
@@ -3592,7 +3758,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3592
3758
|
content: codeValue2,
|
|
3593
3759
|
params: tableModel.value?.params || []
|
|
3594
3760
|
});
|
|
3595
|
-
tMagicMessage.success("
|
|
3761
|
+
tMagicMessage.success("代码成功保存到本地");
|
|
3596
3762
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3597
3763
|
}
|
|
3598
3764
|
};
|
|
@@ -3605,6 +3771,10 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3605
3771
|
const close = () => {
|
|
3606
3772
|
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3607
3773
|
};
|
|
3774
|
+
const codeDraftEditor = ref();
|
|
3775
|
+
expose({
|
|
3776
|
+
codeDraftEditor
|
|
3777
|
+
});
|
|
3608
3778
|
return (_ctx, _cache) => {
|
|
3609
3779
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
3610
3780
|
return openBlock(), createBlock(unref(TMagicCard), { shadow: "never" }, {
|
|
@@ -3633,6 +3803,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3633
3803
|
]),
|
|
3634
3804
|
default: withCtx(() => [
|
|
3635
3805
|
createVNode(_sfc_main$h, {
|
|
3806
|
+
ref_key: "codeDraftEditor",
|
|
3807
|
+
ref: codeDraftEditor,
|
|
3636
3808
|
id: __props.id,
|
|
3637
3809
|
content: codeContent.value,
|
|
3638
3810
|
editable: __props.editable,
|
|
@@ -3693,19 +3865,24 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3693
3865
|
});
|
|
3694
3866
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3695
3867
|
});
|
|
3868
|
+
const functionEditor = ref();
|
|
3869
|
+
const handleClose = async () => {
|
|
3870
|
+
await functionEditor.value?.codeDraftEditor?.close();
|
|
3871
|
+
};
|
|
3696
3872
|
return (_ctx, _cache) => {
|
|
3697
3873
|
return openBlock(), createBlock(unref(TMagicDrawer), {
|
|
3698
3874
|
class: "code-editor-dialog",
|
|
3699
3875
|
"model-value": true,
|
|
3700
3876
|
title: currentTitle.value,
|
|
3701
|
-
"close-on-press-escape":
|
|
3877
|
+
"close-on-press-escape": true,
|
|
3702
3878
|
"append-to-body": true,
|
|
3703
3879
|
"show-close": false,
|
|
3704
|
-
"close-on-click-modal":
|
|
3705
|
-
size: unref(size)
|
|
3880
|
+
"close-on-click-modal": true,
|
|
3881
|
+
size: unref(size),
|
|
3882
|
+
"before-close": handleClose
|
|
3706
3883
|
}, {
|
|
3707
3884
|
default: withCtx(() => [
|
|
3708
|
-
createVNode(_sfc_main$
|
|
3885
|
+
createVNode(_sfc_main$q, {
|
|
3709
3886
|
left: left.value,
|
|
3710
3887
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3711
3888
|
"min-left": 45,
|
|
@@ -3716,6 +3893,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3716
3893
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: unref(id) }),
|
|
3717
3894
|
codeConfig.value ? (openBlock(), createBlock(_sfc_main$g, {
|
|
3718
3895
|
key: 0,
|
|
3896
|
+
ref_key: "functionEditor",
|
|
3897
|
+
ref: functionEditor,
|
|
3719
3898
|
id: unref(id),
|
|
3720
3899
|
name: codeConfig.value.name,
|
|
3721
3900
|
content: codeConfig.value.content,
|
|
@@ -3736,12 +3915,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3736
3915
|
});
|
|
3737
3916
|
|
|
3738
3917
|
const _hoisted_1$6 = { class: "code-header-wrapper" };
|
|
3739
|
-
const _hoisted_2$2 = /* @__PURE__ */ createTextVNode("
|
|
3918
|
+
const _hoisted_2$2 = /* @__PURE__ */ createTextVNode("新增");
|
|
3740
3919
|
const _hoisted_3 = ["id"];
|
|
3741
3920
|
const _hoisted_4 = { class: "list-item" };
|
|
3742
|
-
const _hoisted_5 = {
|
|
3743
|
-
|
|
3744
|
-
key: 0,
|
|
3921
|
+
const _hoisted_5 = {
|
|
3922
|
+
key: 2,
|
|
3745
3923
|
class: "right-tool"
|
|
3746
3924
|
};
|
|
3747
3925
|
const __default__$d = defineComponent({
|
|
@@ -3757,28 +3935,32 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3757
3935
|
const props = __props;
|
|
3758
3936
|
const { codeBlockService, depService, editorService } = inject("services") || {};
|
|
3759
3937
|
const codeList = computed(
|
|
3760
|
-
() => Object.values(depService?.targets["code-block"] || {}).map((target) =>
|
|
3761
|
-
|
|
3762
|
-
name: target.name,
|
|
3763
|
-
type: "code",
|
|
3764
|
-
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
3765
|
-
children: Object.entries(target.deps).map(([id, dep]) => ({
|
|
3938
|
+
() => Object.values(depService?.targets["code-block"] || {}).map((target) => {
|
|
3939
|
+
const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
|
|
3766
3940
|
name: dep.name,
|
|
3767
3941
|
type: "node",
|
|
3768
3942
|
id,
|
|
3769
3943
|
children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
|
|
3770
|
-
}))
|
|
3771
|
-
|
|
3944
|
+
}));
|
|
3945
|
+
return {
|
|
3946
|
+
id: target.id,
|
|
3947
|
+
name: target.name,
|
|
3948
|
+
type: "code",
|
|
3949
|
+
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
3950
|
+
children: compNodes
|
|
3951
|
+
};
|
|
3952
|
+
})
|
|
3772
3953
|
);
|
|
3954
|
+
const expandedKeys = computed(() => codeList.value.map((item) => item.id));
|
|
3773
3955
|
const editable = computed(() => codeBlockService?.getEditStatus());
|
|
3774
3956
|
const isShowCodeBlockEditor = computed(() => codeBlockService?.getCodeEditorShowStatus() || false);
|
|
3775
3957
|
const createCodeBlock = async () => {
|
|
3776
3958
|
if (!codeBlockService) {
|
|
3777
|
-
tMagicMessage.error("
|
|
3959
|
+
tMagicMessage.error("新增代码块失败");
|
|
3778
3960
|
return;
|
|
3779
3961
|
}
|
|
3780
3962
|
const codeConfig = {
|
|
3781
|
-
name: "
|
|
3963
|
+
name: "代码块",
|
|
3782
3964
|
content: `({app, params}) => {
|
|
3783
3965
|
// place your code here
|
|
3784
3966
|
}`,
|
|
@@ -3801,7 +3983,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3801
3983
|
if (typeof props.customError === "function") {
|
|
3802
3984
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3803
3985
|
} else {
|
|
3804
|
-
tMagicMessage.error("
|
|
3986
|
+
tMagicMessage.error("代码块删除失败");
|
|
3805
3987
|
}
|
|
3806
3988
|
}
|
|
3807
3989
|
};
|
|
@@ -3832,7 +4014,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3832
4014
|
default: withCtx(() => [
|
|
3833
4015
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3834
4016
|
createElementVNode("div", _hoisted_1$6, [
|
|
3835
|
-
createVNode(_sfc_main$
|
|
4017
|
+
createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
3836
4018
|
unref(editable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
3837
4019
|
key: 0,
|
|
3838
4020
|
class: "create-code-button",
|
|
@@ -3852,8 +4034,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3852
4034
|
ref: tree,
|
|
3853
4035
|
class: "magic-editor-layer-tree",
|
|
3854
4036
|
"node-key": "id",
|
|
3855
|
-
"empty-text": "
|
|
3856
|
-
"default-
|
|
4037
|
+
"empty-text": "暂无代码块",
|
|
4038
|
+
"default-expanded-keys": unref(expandedKeys),
|
|
3857
4039
|
"expand-on-click-node": false,
|
|
3858
4040
|
data: unref(codeList),
|
|
3859
4041
|
"highlight-current": true,
|
|
@@ -3866,15 +4048,25 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3866
4048
|
class: "list-container"
|
|
3867
4049
|
}, [
|
|
3868
4050
|
createElementVNode("div", _hoisted_4, [
|
|
3869
|
-
|
|
3870
|
-
|
|
4051
|
+
data.type === "code" ? (openBlock(), createBlock(CodeIcon, {
|
|
4052
|
+
key: 0,
|
|
4053
|
+
class: "codeIcon"
|
|
4054
|
+
})) : createCommentVNode("", true),
|
|
4055
|
+
data.type === "node" ? (openBlock(), createBlock(AppManageIcon, {
|
|
4056
|
+
key: 1,
|
|
4057
|
+
class: "compIcon"
|
|
4058
|
+
})) : createCommentVNode("", true),
|
|
4059
|
+
createElementVNode("span", {
|
|
4060
|
+
class: normalizeClass(["code-name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4061
|
+
}, toDisplayString(data.name) + "(" + toDisplayString(data.id) + ")", 3),
|
|
4062
|
+
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
3871
4063
|
createVNode(unref(TMagicTooltip), {
|
|
3872
4064
|
effect: "dark",
|
|
3873
|
-
content: unref(editable) ? "
|
|
4065
|
+
content: unref(editable) ? "编辑" : "查看",
|
|
3874
4066
|
placement: "bottom"
|
|
3875
4067
|
}, {
|
|
3876
4068
|
default: withCtx(() => [
|
|
3877
|
-
createVNode(_sfc_main$
|
|
4069
|
+
createVNode(_sfc_main$w, {
|
|
3878
4070
|
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
3879
4071
|
class: "edit-icon",
|
|
3880
4072
|
onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3885,11 +4077,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3885
4077
|
unref(editable) ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3886
4078
|
key: 0,
|
|
3887
4079
|
effect: "dark",
|
|
3888
|
-
content: "
|
|
4080
|
+
content: "删除",
|
|
3889
4081
|
placement: "bottom"
|
|
3890
4082
|
}, {
|
|
3891
4083
|
default: withCtx(() => [
|
|
3892
|
-
createVNode(_sfc_main$
|
|
4084
|
+
createVNode(_sfc_main$w, {
|
|
3893
4085
|
icon: unref(Close),
|
|
3894
4086
|
class: "edit-icon",
|
|
3895
4087
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3906,7 +4098,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3906
4098
|
], 8, _hoisted_3)
|
|
3907
4099
|
]),
|
|
3908
4100
|
_: 3
|
|
3909
|
-
}, 8, ["data"]),
|
|
4101
|
+
}, 8, ["default-expanded-keys", "data"]),
|
|
3910
4102
|
unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$f, {
|
|
3911
4103
|
key: 0,
|
|
3912
4104
|
paramsColConfig: __props.paramsColConfig
|
|
@@ -4004,7 +4196,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4004
4196
|
"model-value": unref(collapseValue)
|
|
4005
4197
|
}, {
|
|
4006
4198
|
default: withCtx(() => [
|
|
4007
|
-
createVNode(_sfc_main$
|
|
4199
|
+
createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4008
4200
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (group, index) => {
|
|
4009
4201
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
4010
4202
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
@@ -4012,7 +4204,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4012
4204
|
name: `${index}`
|
|
4013
4205
|
}, {
|
|
4014
4206
|
title: withCtx(() => [
|
|
4015
|
-
createVNode(_sfc_main$
|
|
4207
|
+
createVNode(_sfc_main$w, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
4016
4208
|
createTextVNode(toDisplayString(group.title), 1)
|
|
4017
4209
|
]),
|
|
4018
4210
|
default: withCtx(() => [
|
|
@@ -4027,7 +4219,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4027
4219
|
onDrag: dragHandler
|
|
4028
4220
|
}, [
|
|
4029
4221
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4030
|
-
createVNode(_sfc_main$
|
|
4222
|
+
createVNode(_sfc_main$w, {
|
|
4031
4223
|
icon: item.icon
|
|
4032
4224
|
}, null, 8, ["icon"]),
|
|
4033
4225
|
createVNode(unref(TMagicTooltip), {
|
|
@@ -4150,7 +4342,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4150
4342
|
}, [
|
|
4151
4343
|
createElementVNode("div", null, [
|
|
4152
4344
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
|
|
4153
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4345
|
+
return openBlock(), createBlock(_sfc_main$n, {
|
|
4154
4346
|
"event-type": "mouseup",
|
|
4155
4347
|
data: item,
|
|
4156
4348
|
key: index,
|
|
@@ -4208,7 +4400,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
4208
4400
|
if (node.value?.type === "tabs") {
|
|
4209
4401
|
return [
|
|
4210
4402
|
{
|
|
4211
|
-
text: "
|
|
4403
|
+
text: "标签页",
|
|
4212
4404
|
type: "button",
|
|
4213
4405
|
icon: Files,
|
|
4214
4406
|
handler: () => {
|
|
@@ -4238,14 +4430,14 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
4238
4430
|
const menuData = computed(() => [
|
|
4239
4431
|
{
|
|
4240
4432
|
type: "button",
|
|
4241
|
-
text: "
|
|
4433
|
+
text: "新增",
|
|
4242
4434
|
icon: markRaw(Plus),
|
|
4243
4435
|
display: () => node.value?.items,
|
|
4244
4436
|
items: getSubMenuData.value
|
|
4245
4437
|
},
|
|
4246
4438
|
{
|
|
4247
4439
|
type: "button",
|
|
4248
|
-
text: "
|
|
4440
|
+
text: "复制",
|
|
4249
4441
|
icon: markRaw(CopyDocument),
|
|
4250
4442
|
display: () => !isRoot.value,
|
|
4251
4443
|
handler: () => {
|
|
@@ -4254,7 +4446,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
4254
4446
|
},
|
|
4255
4447
|
{
|
|
4256
4448
|
type: "button",
|
|
4257
|
-
text: "
|
|
4449
|
+
text: "删除",
|
|
4258
4450
|
icon: markRaw(Delete),
|
|
4259
4451
|
display: () => !isRoot.value && !isPage.value,
|
|
4260
4452
|
handler: () => {
|
|
@@ -4318,7 +4510,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4318
4510
|
const highlightNode = computed(() => editorService?.get("highlightNode"));
|
|
4319
4511
|
const select = async (data) => {
|
|
4320
4512
|
if (!data.id) {
|
|
4321
|
-
throw new Error("
|
|
4513
|
+
throw new Error("没有id");
|
|
4322
4514
|
}
|
|
4323
4515
|
await editorService?.select(data);
|
|
4324
4516
|
editorService?.get("stage")?.select(data.id);
|
|
@@ -4329,7 +4521,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4329
4521
|
};
|
|
4330
4522
|
const highlight = (data) => {
|
|
4331
4523
|
if (!data?.id) {
|
|
4332
|
-
throw new Error("
|
|
4524
|
+
throw new Error("没有id");
|
|
4333
4525
|
}
|
|
4334
4526
|
editorService?.highlight(data);
|
|
4335
4527
|
editorService?.get("stage")?.highlight(data.id);
|
|
@@ -4342,7 +4534,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4342
4534
|
return false;
|
|
4343
4535
|
if (ingType === NodeType.PAGE && data.type !== NodeType.PAGE)
|
|
4344
4536
|
return false;
|
|
4345
|
-
if (!data
|
|
4537
|
+
if (!data?.type)
|
|
4346
4538
|
return false;
|
|
4347
4539
|
if (["prev", "next"].includes(type))
|
|
4348
4540
|
return true;
|
|
@@ -4481,14 +4673,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4481
4673
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4482
4674
|
default: withCtx(() => [
|
|
4483
4675
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4484
|
-
createVNode(_sfc_main$
|
|
4676
|
+
createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4485
4677
|
unref(values).length ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
4486
4678
|
key: 0,
|
|
4487
4679
|
class: "magic-editor-layer-tree",
|
|
4488
4680
|
ref_key: "tree",
|
|
4489
4681
|
ref: tree,
|
|
4490
4682
|
"node-key": "id",
|
|
4491
|
-
"empty-text": "
|
|
4683
|
+
"empty-text": "页面空荡荡的",
|
|
4492
4684
|
draggable: "",
|
|
4493
4685
|
"default-expanded-keys": expandedKeys.value,
|
|
4494
4686
|
"default-checked-keys": checkedKeys.value,
|
|
@@ -4550,7 +4742,7 @@ const __default__$8 = defineComponent({
|
|
|
4550
4742
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
4551
4743
|
...__default__$8,
|
|
4552
4744
|
props: {
|
|
4553
|
-
data: { default: () => ({ type: "tabs", status: "
|
|
4745
|
+
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block"] }) },
|
|
4554
4746
|
layerContentMenu: null
|
|
4555
4747
|
},
|
|
4556
4748
|
setup(__props, { expose }) {
|
|
@@ -4563,7 +4755,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4563
4755
|
$key: "component-list",
|
|
4564
4756
|
type: "component",
|
|
4565
4757
|
icon: Coin,
|
|
4566
|
-
text: "
|
|
4758
|
+
text: "组件",
|
|
4567
4759
|
component: _sfc_main$d,
|
|
4568
4760
|
slots: {}
|
|
4569
4761
|
},
|
|
@@ -4571,7 +4763,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4571
4763
|
$key: "layer",
|
|
4572
4764
|
type: "component",
|
|
4573
4765
|
icon: Files,
|
|
4574
|
-
text: "
|
|
4766
|
+
text: "已选组件",
|
|
4575
4767
|
props: {
|
|
4576
4768
|
layerContentMenu: props.layerContentMenu
|
|
4577
4769
|
},
|
|
@@ -4582,7 +4774,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4582
4774
|
$key: "code-block",
|
|
4583
4775
|
type: "component",
|
|
4584
4776
|
icon: EditPen,
|
|
4585
|
-
text: "
|
|
4777
|
+
text: "代码编辑",
|
|
4586
4778
|
component: _sfc_main$e,
|
|
4587
4779
|
slots: {}
|
|
4588
4780
|
}
|
|
@@ -4618,7 +4810,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4618
4810
|
(openBlock(), createElementBlock("div", {
|
|
4619
4811
|
key: config.text
|
|
4620
4812
|
}, [
|
|
4621
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
4813
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$w, {
|
|
4622
4814
|
key: 0,
|
|
4623
4815
|
icon: config.icon
|
|
4624
4816
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -4820,7 +5012,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4820
5012
|
return;
|
|
4821
5013
|
const root = toRaw(editorService.get("root"));
|
|
4822
5014
|
if (!root)
|
|
4823
|
-
throw new Error("root
|
|
5015
|
+
throw new Error("root 不能为空");
|
|
4824
5016
|
const pageConfig = {
|
|
4825
5017
|
type: NodeType.PAGE,
|
|
4826
5018
|
name: generatePageNameByApp(root)
|
|
@@ -4839,14 +5031,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4839
5031
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4840
5032
|
onClick: addPage
|
|
4841
5033
|
}, [
|
|
4842
|
-
createVNode(_sfc_main$
|
|
5034
|
+
createVNode(_sfc_main$w, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
4843
5035
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
|
|
4844
5036
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
4845
5037
|
key: 2,
|
|
4846
5038
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4847
5039
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4848
5040
|
}, [
|
|
4849
|
-
createVNode(_sfc_main$
|
|
5041
|
+
createVNode(_sfc_main$w, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
4850
5042
|
])) : createCommentVNode("", true),
|
|
4851
5043
|
unref(pageLength) ? (openBlock(), createElementBlock("div", {
|
|
4852
5044
|
key: 3,
|
|
@@ -4862,7 +5054,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4862
5054
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4863
5055
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4864
5056
|
}, [
|
|
4865
|
-
createVNode(_sfc_main$
|
|
5057
|
+
createVNode(_sfc_main$w, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
4866
5058
|
])) : createCommentVNode("", true)
|
|
4867
5059
|
], 512);
|
|
4868
5060
|
};
|
|
@@ -4934,18 +5126,18 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4934
5126
|
default: withCtx(() => [
|
|
4935
5127
|
createElementVNode("div", null, [
|
|
4936
5128
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4937
|
-
createVNode(_sfc_main$
|
|
5129
|
+
createVNode(_sfc_main$n, {
|
|
4938
5130
|
data: {
|
|
4939
5131
|
type: "button",
|
|
4940
|
-
text: "
|
|
5132
|
+
text: "复制",
|
|
4941
5133
|
icon: unref(DocumentCopy),
|
|
4942
5134
|
handler: () => copy(item)
|
|
4943
5135
|
}
|
|
4944
5136
|
}, null, 8, ["data"]),
|
|
4945
|
-
createVNode(_sfc_main$
|
|
5137
|
+
createVNode(_sfc_main$n, {
|
|
4946
5138
|
data: {
|
|
4947
5139
|
type: "button",
|
|
4948
|
-
text: "
|
|
5140
|
+
text: "删除",
|
|
4949
5141
|
icon: unref(Delete),
|
|
4950
5142
|
handler: () => remove(item)
|
|
4951
5143
|
}
|
|
@@ -5310,7 +5502,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5310
5502
|
const menuData = computed(() => [
|
|
5311
5503
|
{
|
|
5312
5504
|
type: "button",
|
|
5313
|
-
text: "
|
|
5505
|
+
text: "水平居中",
|
|
5314
5506
|
display: () => canCenter.value,
|
|
5315
5507
|
handler: () => {
|
|
5316
5508
|
if (!nodes.value)
|
|
@@ -5320,7 +5512,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5320
5512
|
},
|
|
5321
5513
|
{
|
|
5322
5514
|
type: "button",
|
|
5323
|
-
text: "
|
|
5515
|
+
text: "复制",
|
|
5324
5516
|
icon: markRaw(CopyDocument),
|
|
5325
5517
|
handler: () => {
|
|
5326
5518
|
nodes.value && editorService?.copy(nodes.value);
|
|
@@ -5329,7 +5521,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5329
5521
|
},
|
|
5330
5522
|
{
|
|
5331
5523
|
type: "button",
|
|
5332
|
-
text: "
|
|
5524
|
+
text: "粘贴",
|
|
5333
5525
|
icon: markRaw(DocumentCopy),
|
|
5334
5526
|
display: () => canPaste.value,
|
|
5335
5527
|
handler: () => {
|
|
@@ -5353,7 +5545,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5353
5545
|
},
|
|
5354
5546
|
{
|
|
5355
5547
|
type: "button",
|
|
5356
|
-
text: "
|
|
5548
|
+
text: "上移一层",
|
|
5357
5549
|
icon: markRaw(Top),
|
|
5358
5550
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5359
5551
|
handler: () => {
|
|
@@ -5362,7 +5554,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5362
5554
|
},
|
|
5363
5555
|
{
|
|
5364
5556
|
type: "button",
|
|
5365
|
-
text: "
|
|
5557
|
+
text: "下移一层",
|
|
5366
5558
|
icon: markRaw(Bottom),
|
|
5367
5559
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5368
5560
|
handler: () => {
|
|
@@ -5371,7 +5563,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5371
5563
|
},
|
|
5372
5564
|
{
|
|
5373
5565
|
type: "button",
|
|
5374
|
-
text: "
|
|
5566
|
+
text: "置顶",
|
|
5375
5567
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5376
5568
|
handler: () => {
|
|
5377
5569
|
editorService?.moveLayer(LayerOffset.TOP);
|
|
@@ -5379,7 +5571,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5379
5571
|
},
|
|
5380
5572
|
{
|
|
5381
5573
|
type: "button",
|
|
5382
|
-
text: "
|
|
5574
|
+
text: "置底",
|
|
5383
5575
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5384
5576
|
handler: () => {
|
|
5385
5577
|
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
@@ -5392,7 +5584,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5392
5584
|
},
|
|
5393
5585
|
{
|
|
5394
5586
|
type: "button",
|
|
5395
|
-
text: "
|
|
5587
|
+
text: "删除",
|
|
5396
5588
|
icon: Delete,
|
|
5397
5589
|
display: () => !isPage(node.value),
|
|
5398
5590
|
handler: () => {
|
|
@@ -5405,7 +5597,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5405
5597
|
},
|
|
5406
5598
|
{
|
|
5407
5599
|
type: "button",
|
|
5408
|
-
text: "
|
|
5600
|
+
text: "清空参考线",
|
|
5409
5601
|
handler: () => {
|
|
5410
5602
|
editorService?.get("stage")?.clearGuides();
|
|
5411
5603
|
}
|
|
@@ -5765,14 +5957,30 @@ class CodeBlock extends BaseService {
|
|
|
5765
5957
|
"deleteCodeDslByIds"
|
|
5766
5958
|
]);
|
|
5767
5959
|
}
|
|
5960
|
+
/**
|
|
5961
|
+
* 设置活动的代码块dsl数据源
|
|
5962
|
+
* @param {CodeBlockDSL} codeDsl 代码DSL
|
|
5963
|
+
* @returns {void}
|
|
5964
|
+
*/
|
|
5768
5965
|
async setCodeDsl(codeDsl2) {
|
|
5769
5966
|
this.state.codeDsl = codeDsl2;
|
|
5770
5967
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
5771
5968
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
5772
5969
|
}
|
|
5970
|
+
/**
|
|
5971
|
+
* 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
|
|
5972
|
+
* 方法要支持钩子添加扩展,会被重写为异步方法,因此这里显示写为异步以提醒调用者需以异步形式调用
|
|
5973
|
+
* @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
|
|
5974
|
+
* @returns {CodeBlockDSL | null}
|
|
5975
|
+
*/
|
|
5773
5976
|
getCodeDsl() {
|
|
5774
5977
|
return this.state.codeDsl;
|
|
5775
5978
|
}
|
|
5979
|
+
/**
|
|
5980
|
+
* 根据代码块id获取代码块内容
|
|
5981
|
+
* @param {Id} id 代码块id
|
|
5982
|
+
* @returns {CodeBlockContent | null}
|
|
5983
|
+
*/
|
|
5776
5984
|
getCodeContentById(id2) {
|
|
5777
5985
|
if (!id2)
|
|
5778
5986
|
return null;
|
|
@@ -5781,10 +5989,16 @@ class CodeBlock extends BaseService {
|
|
|
5781
5989
|
return null;
|
|
5782
5990
|
return totalCodeDsl[id2] ?? null;
|
|
5783
5991
|
}
|
|
5992
|
+
/**
|
|
5993
|
+
* 设置代码块ID和代码内容到源dsl
|
|
5994
|
+
* @param {Id} id 代码块id
|
|
5995
|
+
* @param {CodeBlockContent} codeConfig 代码块内容配置信息
|
|
5996
|
+
* @returns {void}
|
|
5997
|
+
*/
|
|
5784
5998
|
async setCodeDslById(id, codeConfig) {
|
|
5785
5999
|
const codeDsl = this.getCodeDsl();
|
|
5786
6000
|
if (!codeDsl) {
|
|
5787
|
-
throw new Error("dsl
|
|
6001
|
+
throw new Error("dsl中没有codeBlocks");
|
|
5788
6002
|
}
|
|
5789
6003
|
const codeConfigProcessed = codeConfig;
|
|
5790
6004
|
if (codeConfig.content) {
|
|
@@ -5797,60 +6011,133 @@ class CodeBlock extends BaseService {
|
|
|
5797
6011
|
};
|
|
5798
6012
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
5799
6013
|
}
|
|
6014
|
+
/**
|
|
6015
|
+
* 根据代码块id数组获取代码dsl
|
|
6016
|
+
* @param {string[]} ids 代码块id数组
|
|
6017
|
+
* @returns {CodeBlockDSL}
|
|
6018
|
+
*/
|
|
5800
6019
|
getCodeDslByIds(ids) {
|
|
5801
6020
|
const codeDsl2 = this.getCodeDsl();
|
|
5802
6021
|
return pick(codeDsl2, ids);
|
|
5803
6022
|
}
|
|
6023
|
+
/**
|
|
6024
|
+
* 设置代码编辑面板展示状态
|
|
6025
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6026
|
+
* @returns {void}
|
|
6027
|
+
*/
|
|
5804
6028
|
async setCodeEditorShowStatus(status) {
|
|
5805
6029
|
this.state.isShowCodeEditor = status;
|
|
5806
6030
|
}
|
|
6031
|
+
/**
|
|
6032
|
+
* 获取代码编辑面板展示状态
|
|
6033
|
+
* @returns {boolean} 是否展示代码编辑面板
|
|
6034
|
+
*/
|
|
5807
6035
|
getCodeEditorShowStatus() {
|
|
5808
6036
|
return this.state.isShowCodeEditor;
|
|
5809
6037
|
}
|
|
6038
|
+
/**
|
|
6039
|
+
* 设置代码编辑面板展示状态及展示内容
|
|
6040
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6041
|
+
* @param {Id} id 代码块id
|
|
6042
|
+
* @returns {void}
|
|
6043
|
+
*/
|
|
5810
6044
|
setCodeEditorContent(status, id2) {
|
|
5811
6045
|
if (!id2)
|
|
5812
6046
|
return;
|
|
5813
6047
|
this.setId(id2);
|
|
5814
6048
|
this.state.isShowCodeEditor = status;
|
|
5815
6049
|
}
|
|
6050
|
+
/**
|
|
6051
|
+
* 获取当前选中的代码块内容
|
|
6052
|
+
* @returns {CodeBlockContent | null}
|
|
6053
|
+
*/
|
|
5816
6054
|
getCurrentDsl() {
|
|
5817
6055
|
return this.getCodeContentById(this.state.id);
|
|
5818
6056
|
}
|
|
6057
|
+
/**
|
|
6058
|
+
* 获取编辑状态
|
|
6059
|
+
* @returns {boolean} 是否可编辑
|
|
6060
|
+
*/
|
|
5819
6061
|
getEditStatus() {
|
|
5820
6062
|
return this.state.editable;
|
|
5821
6063
|
}
|
|
6064
|
+
/**
|
|
6065
|
+
* 设置编辑状态
|
|
6066
|
+
* @param {boolean} status 是否可编辑
|
|
6067
|
+
* @returns {void}
|
|
6068
|
+
*/
|
|
5822
6069
|
async setEditStatus(status) {
|
|
5823
6070
|
this.state.editable = status;
|
|
5824
6071
|
}
|
|
6072
|
+
/**
|
|
6073
|
+
* 设置当前选中的代码块ID
|
|
6074
|
+
* @param {Id} id 代码块id
|
|
6075
|
+
* @returns {void}
|
|
6076
|
+
*/
|
|
5825
6077
|
setId(id2) {
|
|
5826
6078
|
if (!id2)
|
|
5827
6079
|
return;
|
|
5828
6080
|
this.state.id = id2;
|
|
5829
6081
|
}
|
|
6082
|
+
/**
|
|
6083
|
+
* 获取当前选中的代码块ID
|
|
6084
|
+
* @returns {Id} id 代码块id
|
|
6085
|
+
*/
|
|
5830
6086
|
getId() {
|
|
5831
6087
|
return this.state.id;
|
|
5832
6088
|
}
|
|
6089
|
+
/**
|
|
6090
|
+
* 设置当前选中组件已关联绑定的代码块id数组
|
|
6091
|
+
* @param {string[]} ids 代码块id数组
|
|
6092
|
+
* @returns {void}
|
|
6093
|
+
*/
|
|
5833
6094
|
async setCombineIds(ids) {
|
|
5834
6095
|
this.state.combineIds = ids;
|
|
5835
6096
|
}
|
|
6097
|
+
/**
|
|
6098
|
+
* 获取当前选中组件已关联绑定的代码块id数组
|
|
6099
|
+
* @returns {string[]}
|
|
6100
|
+
*/
|
|
5836
6101
|
getCombineIds() {
|
|
5837
6102
|
return this.state.combineIds;
|
|
5838
6103
|
}
|
|
6104
|
+
/**
|
|
6105
|
+
* 获取不可删除列表
|
|
6106
|
+
* @returns {Id[]}
|
|
6107
|
+
*/
|
|
5839
6108
|
getUndeletableList() {
|
|
5840
6109
|
return this.state.undeletableList;
|
|
5841
6110
|
}
|
|
6111
|
+
/**
|
|
6112
|
+
* 设置不可删除列表:为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除)
|
|
6113
|
+
* @param {Id[]} codeIds 代码块id数组
|
|
6114
|
+
* @returns {void}
|
|
6115
|
+
*/
|
|
5842
6116
|
async setUndeleteableList(codeIds) {
|
|
5843
6117
|
this.state.undeletableList = codeIds;
|
|
5844
6118
|
}
|
|
6119
|
+
/**
|
|
6120
|
+
* 设置代码草稿
|
|
6121
|
+
*/
|
|
5845
6122
|
setCodeDraft(codeId, content) {
|
|
5846
6123
|
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
5847
6124
|
}
|
|
6125
|
+
/**
|
|
6126
|
+
* 获取代码草稿
|
|
6127
|
+
*/
|
|
5848
6128
|
getCodeDraft(codeId) {
|
|
5849
6129
|
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5850
6130
|
}
|
|
6131
|
+
/**
|
|
6132
|
+
* 删除代码草稿
|
|
6133
|
+
*/
|
|
5851
6134
|
removeCodeDraft(codeId) {
|
|
5852
6135
|
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5853
6136
|
}
|
|
6137
|
+
/**
|
|
6138
|
+
* 在dsl数据源中删除指定id的代码块
|
|
6139
|
+
* @param {Id[]} codeIds 需要删除的代码块id数组
|
|
6140
|
+
*/
|
|
5854
6141
|
async deleteCodeDslByIds(codeIds) {
|
|
5855
6142
|
const currentDsl = await this.getCodeDsl();
|
|
5856
6143
|
if (!currentDsl)
|
|
@@ -5860,6 +6147,10 @@ class CodeBlock extends BaseService {
|
|
|
5860
6147
|
this.emit("remove", id2);
|
|
5861
6148
|
});
|
|
5862
6149
|
}
|
|
6150
|
+
/**
|
|
6151
|
+
* 生成代码块唯一id
|
|
6152
|
+
* @returns {Id} 代码块唯一id
|
|
6153
|
+
*/
|
|
5863
6154
|
async getUniqueId() {
|
|
5864
6155
|
const newId = `code_${Math.random().toString(10).substring(2).substring(0, 4)}`;
|
|
5865
6156
|
const dsl = await this.getCodeDsl();
|
|
@@ -5891,6 +6182,9 @@ class ComponentList extends BaseService {
|
|
|
5891
6182
|
constructor() {
|
|
5892
6183
|
super([]);
|
|
5893
6184
|
}
|
|
6185
|
+
/**
|
|
6186
|
+
* @param componentGroupList 组件列表配置
|
|
6187
|
+
*/
|
|
5894
6188
|
setList(componentGroupList) {
|
|
5895
6189
|
this.state.list = componentGroupList;
|
|
5896
6190
|
}
|
|
@@ -5909,10 +6203,27 @@ class ComponentList extends BaseService {
|
|
|
5909
6203
|
const componentListService = new ComponentList();
|
|
5910
6204
|
|
|
5911
6205
|
class Target extends EventEmitter {
|
|
6206
|
+
/**
|
|
6207
|
+
* 如何识别目标
|
|
6208
|
+
*/
|
|
5912
6209
|
isTarget;
|
|
6210
|
+
/**
|
|
6211
|
+
* 目标id,不可重复
|
|
6212
|
+
* 例如目标是代码块,则为代码块id
|
|
6213
|
+
*/
|
|
5913
6214
|
id;
|
|
6215
|
+
/**
|
|
6216
|
+
* 目标名称,用于显示在依赖列表中
|
|
6217
|
+
*/
|
|
5914
6218
|
name;
|
|
6219
|
+
/**
|
|
6220
|
+
* 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type
|
|
6221
|
+
*/
|
|
5915
6222
|
type = "default";
|
|
6223
|
+
/**
|
|
6224
|
+
* 依赖详情
|
|
6225
|
+
* 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }
|
|
6226
|
+
*/
|
|
5916
6227
|
deps = reactive({});
|
|
5917
6228
|
constructor(options) {
|
|
5918
6229
|
super();
|
|
@@ -5923,6 +6234,11 @@ class Target extends EventEmitter {
|
|
|
5923
6234
|
this.type = options.type;
|
|
5924
6235
|
}
|
|
5925
6236
|
}
|
|
6237
|
+
/**
|
|
6238
|
+
* 更新依赖
|
|
6239
|
+
* @param node 节点配置
|
|
6240
|
+
* @param key 哪个key配置了这个目标的id
|
|
6241
|
+
*/
|
|
5926
6242
|
updateDep(node, key) {
|
|
5927
6243
|
const dep = this.deps[node.id] || {
|
|
5928
6244
|
name: node.name,
|
|
@@ -5937,6 +6253,12 @@ class Target extends EventEmitter {
|
|
|
5937
6253
|
}
|
|
5938
6254
|
this.emit("change");
|
|
5939
6255
|
}
|
|
6256
|
+
/**
|
|
6257
|
+
* 删除依赖
|
|
6258
|
+
* @param node 哪个节点的依赖需要移除,如果为空,则移除所有依赖
|
|
6259
|
+
* @param key 节点下哪个key需要移除,如果为空,则移除改节点下的所有依赖key
|
|
6260
|
+
* @returns void
|
|
6261
|
+
*/
|
|
5940
6262
|
removeDep(node, key) {
|
|
5941
6263
|
if (!node) {
|
|
5942
6264
|
Object.keys(this.deps).forEach((depKey) => {
|
|
@@ -5959,6 +6281,12 @@ class Target extends EventEmitter {
|
|
|
5959
6281
|
}
|
|
5960
6282
|
this.emit("change");
|
|
5961
6283
|
}
|
|
6284
|
+
/**
|
|
6285
|
+
* 判断指定节点下的指定key是否存在在依赖列表中
|
|
6286
|
+
* @param node 哪个节点
|
|
6287
|
+
* @param key 哪个key
|
|
6288
|
+
* @returns boolean
|
|
6289
|
+
*/
|
|
5962
6290
|
hasDep(node, key) {
|
|
5963
6291
|
const dep = this.deps[node.id];
|
|
5964
6292
|
return Boolean(dep?.keys.find((d) => d === key));
|
|
@@ -5969,15 +6297,29 @@ class Target extends EventEmitter {
|
|
|
5969
6297
|
}
|
|
5970
6298
|
class Watcher extends EventEmitter {
|
|
5971
6299
|
targets = reactive({});
|
|
6300
|
+
/**
|
|
6301
|
+
* 获取指定类型中的所有target
|
|
6302
|
+
* @param type 分类
|
|
6303
|
+
* @returns Target[]
|
|
6304
|
+
*/
|
|
5972
6305
|
getTargets(type = "default") {
|
|
5973
6306
|
return this.targets[type] || {};
|
|
5974
6307
|
}
|
|
6308
|
+
/**
|
|
6309
|
+
* 添加新的目标
|
|
6310
|
+
* @param target Target
|
|
6311
|
+
*/
|
|
5975
6312
|
addTarget(target) {
|
|
5976
6313
|
const targets = this.getTargets(target.type) || {};
|
|
5977
6314
|
this.targets[target.type] = targets;
|
|
5978
6315
|
targets[target.id] = target;
|
|
5979
6316
|
this.emit("add-target", target);
|
|
5980
6317
|
}
|
|
6318
|
+
/**
|
|
6319
|
+
* 获取指定id的target
|
|
6320
|
+
* @param id target id
|
|
6321
|
+
* @returns Target
|
|
6322
|
+
*/
|
|
5981
6323
|
getTarget(id) {
|
|
5982
6324
|
const allTargets = Object.values(this.targets);
|
|
5983
6325
|
for (const targets of allTargets) {
|
|
@@ -5986,6 +6328,11 @@ class Watcher extends EventEmitter {
|
|
|
5986
6328
|
}
|
|
5987
6329
|
}
|
|
5988
6330
|
}
|
|
6331
|
+
/**
|
|
6332
|
+
* 判断是否存在指定id的target
|
|
6333
|
+
* @param id target id
|
|
6334
|
+
* @returns boolean
|
|
6335
|
+
*/
|
|
5989
6336
|
hasTarget(id) {
|
|
5990
6337
|
const allTargets = Object.values(this.targets);
|
|
5991
6338
|
for (const targets of allTargets) {
|
|
@@ -5995,6 +6342,10 @@ class Watcher extends EventEmitter {
|
|
|
5995
6342
|
}
|
|
5996
6343
|
return false;
|
|
5997
6344
|
}
|
|
6345
|
+
/**
|
|
6346
|
+
* 删除指定id的target
|
|
6347
|
+
* @param id target id
|
|
6348
|
+
*/
|
|
5998
6349
|
removeTarget(id) {
|
|
5999
6350
|
const allTargets = Object.values(this.targets);
|
|
6000
6351
|
for (const targets of allTargets) {
|
|
@@ -6005,6 +6356,11 @@ class Watcher extends EventEmitter {
|
|
|
6005
6356
|
}
|
|
6006
6357
|
this.emit("remove-target");
|
|
6007
6358
|
}
|
|
6359
|
+
/**
|
|
6360
|
+
* 删除指定分类的所有target
|
|
6361
|
+
* @param type 分类
|
|
6362
|
+
* @returns void
|
|
6363
|
+
*/
|
|
6008
6364
|
removeTargets(type = "default") {
|
|
6009
6365
|
const targets = this.targets[type];
|
|
6010
6366
|
if (!targets)
|
|
@@ -6015,11 +6371,19 @@ class Watcher extends EventEmitter {
|
|
|
6015
6371
|
delete this.targets[type];
|
|
6016
6372
|
this.emit("remove-target");
|
|
6017
6373
|
}
|
|
6374
|
+
/**
|
|
6375
|
+
* 删除所有target
|
|
6376
|
+
*/
|
|
6018
6377
|
clearTargets() {
|
|
6019
6378
|
Object.keys(this.targets).forEach((key) => {
|
|
6020
6379
|
delete this.targets[key];
|
|
6021
6380
|
});
|
|
6022
6381
|
}
|
|
6382
|
+
/**
|
|
6383
|
+
* 收集依赖
|
|
6384
|
+
* @param nodes 需要收集的节点
|
|
6385
|
+
* @param deep 是否需要收集子节点
|
|
6386
|
+
*/
|
|
6023
6387
|
collect(nodes, deep = false) {
|
|
6024
6388
|
Object.values(this.targets).forEach((targets) => {
|
|
6025
6389
|
Object.values(targets).forEach((target) => {
|
|
@@ -6030,6 +6394,10 @@ class Watcher extends EventEmitter {
|
|
|
6030
6394
|
});
|
|
6031
6395
|
});
|
|
6032
6396
|
}
|
|
6397
|
+
/**
|
|
6398
|
+
* 清除依赖
|
|
6399
|
+
* @param nodes 需要清除依赖的节点
|
|
6400
|
+
*/
|
|
6033
6401
|
clear(nodes) {
|
|
6034
6402
|
Object.values(this.targets).forEach((targets) => {
|
|
6035
6403
|
Object.values(targets).forEach((target) => {
|
|
@@ -6129,50 +6497,64 @@ class Events extends BaseService {
|
|
|
6129
6497
|
const eventsService = new Events();
|
|
6130
6498
|
|
|
6131
6499
|
const editorProps = {
|
|
6500
|
+
/** 页面初始值 */
|
|
6132
6501
|
modelValue: {
|
|
6133
6502
|
type: Object,
|
|
6134
6503
|
default: () => ({}),
|
|
6135
6504
|
require: true
|
|
6136
6505
|
},
|
|
6506
|
+
/** 左侧面板中的组件列表 */
|
|
6137
6507
|
componentGroupList: {
|
|
6138
6508
|
type: Array,
|
|
6139
6509
|
default: () => []
|
|
6140
6510
|
},
|
|
6511
|
+
/** 左侧面板配置 */
|
|
6141
6512
|
sidebar: {
|
|
6142
6513
|
type: Object
|
|
6143
6514
|
},
|
|
6515
|
+
/** 顶部工具栏配置 */
|
|
6144
6516
|
menu: {
|
|
6145
6517
|
type: Object,
|
|
6146
6518
|
default: () => ({ left: [], right: [] })
|
|
6147
6519
|
},
|
|
6520
|
+
/** 组件树右键菜单 */
|
|
6148
6521
|
layerContentMenu: {
|
|
6149
6522
|
type: Array,
|
|
6150
6523
|
default: () => []
|
|
6151
6524
|
},
|
|
6525
|
+
/** 画布右键菜单 */
|
|
6152
6526
|
stageContentMenu: {
|
|
6153
6527
|
type: Array,
|
|
6154
6528
|
default: () => []
|
|
6155
6529
|
},
|
|
6530
|
+
/** 中间工作区域中画布渲染的内容 */
|
|
6156
6531
|
render: {
|
|
6157
6532
|
type: Function
|
|
6158
6533
|
},
|
|
6534
|
+
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
6159
6535
|
runtimeUrl: String,
|
|
6536
|
+
/** 选中时是否自动滚动到可视区域 */
|
|
6160
6537
|
autoScrollIntoView: Boolean,
|
|
6538
|
+
/** 组件的属性配置表单的dsl */
|
|
6161
6539
|
propsConfigs: {
|
|
6162
6540
|
type: Object,
|
|
6163
6541
|
default: () => ({})
|
|
6164
6542
|
},
|
|
6543
|
+
/** 添加组件时的默认值 */
|
|
6165
6544
|
propsValues: {
|
|
6166
6545
|
type: Object,
|
|
6167
6546
|
default: () => ({})
|
|
6168
6547
|
},
|
|
6548
|
+
/** 组件联动事件选项列表 */
|
|
6169
6549
|
eventMethodList: {
|
|
6170
6550
|
type: Object,
|
|
6171
6551
|
default: () => ({})
|
|
6172
6552
|
},
|
|
6553
|
+
/** 画布中组件选中框的移动范围 */
|
|
6173
6554
|
moveableOptions: {
|
|
6174
6555
|
type: [Object, Function]
|
|
6175
6556
|
},
|
|
6557
|
+
/** 编辑器初始化时默认选中的组件ID */
|
|
6176
6558
|
defaultSelected: {
|
|
6177
6559
|
type: [Number, String]
|
|
6178
6560
|
},
|
|
@@ -6376,11 +6758,11 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, depSe
|
|
|
6376
6758
|
const _sfc_main = defineComponent({
|
|
6377
6759
|
name: "m-editor",
|
|
6378
6760
|
components: {
|
|
6379
|
-
TMagicNavMenu: _sfc_main$
|
|
6761
|
+
TMagicNavMenu: _sfc_main$m,
|
|
6380
6762
|
Sidebar: _sfc_main$9,
|
|
6381
6763
|
Workspace: _sfc_main$1,
|
|
6382
|
-
PropsPanel: _sfc_main$
|
|
6383
|
-
Framework: _sfc_main$
|
|
6764
|
+
PropsPanel: _sfc_main$l,
|
|
6765
|
+
Framework: _sfc_main$o
|
|
6384
6766
|
},
|
|
6385
6767
|
props: editorProps,
|
|
6386
6768
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -6420,14 +6802,6 @@ const _sfc_main = defineComponent({
|
|
|
6420
6802
|
}
|
|
6421
6803
|
});
|
|
6422
6804
|
|
|
6423
|
-
const _export_sfc = (sfc, props) => {
|
|
6424
|
-
const target = sfc.__vccOpts || sfc;
|
|
6425
|
-
for (const [key, val] of props) {
|
|
6426
|
-
target[key] = val;
|
|
6427
|
-
}
|
|
6428
|
-
return target;
|
|
6429
|
-
};
|
|
6430
|
-
|
|
6431
6805
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6432
6806
|
const _component_TMagicNavMenu = resolveComponent("TMagicNavMenu");
|
|
6433
6807
|
const _component_Sidebar = resolveComponent("Sidebar");
|
|
@@ -6518,22 +6892,24 @@ const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]])
|
|
|
6518
6892
|
|
|
6519
6893
|
const index$1 = '';
|
|
6520
6894
|
|
|
6521
|
-
const defaultInstallOpt = {
|
|
6895
|
+
const defaultInstallOpt = {
|
|
6896
|
+
// @todo, 自定义图片上传方法等编辑器依赖的外部选项
|
|
6897
|
+
};
|
|
6522
6898
|
const index = {
|
|
6523
6899
|
install: (app, opt) => {
|
|
6524
6900
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
6525
6901
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6526
6902
|
setConfig(option);
|
|
6527
6903
|
app.component(Editor.name, Editor);
|
|
6528
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
6529
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
6530
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
6531
|
-
app.component("magic-code-editor", _sfc_main$
|
|
6532
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6533
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
6534
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
6904
|
+
app.component("m-fields-ui-select", _sfc_main$t);
|
|
6905
|
+
app.component("m-fields-code-link", _sfc_main$y);
|
|
6906
|
+
app.component("m-fields-vs-code", _sfc_main$z);
|
|
6907
|
+
app.component("magic-code-editor", _sfc_main$s);
|
|
6908
|
+
app.component("m-fields-code-select", _sfc_main$x);
|
|
6909
|
+
app.component("m-fields-code-select-col", _sfc_main$v);
|
|
6910
|
+
app.component("m-fields-event-select", _sfc_main$u);
|
|
6535
6911
|
}
|
|
6536
6912
|
};
|
|
6537
6913
|
|
|
6538
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, _sfc_main$
|
|
6914
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, _sfc_main$x as CodeSelect, _sfc_main$v as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, _sfc_main$u as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$w as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$q as LayoutContainer, _sfc_main$l as PropsPanel, _sfc_main$s as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$n as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, debug, index as default, depService, editorService, error, eventsService, 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 };
|
|
6539
6915
|
//# sourceMappingURL=tmagic-editor.js.map
|