@tmagic/editor 1.2.13 → 1.2.15
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 +161 -69
- package/dist/tmagic-editor.js +784 -419
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +802 -444
- 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/components/SearchInput.vue +6 -3
- 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 +26 -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 +13 -12
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +15 -6
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +28 -15
- 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 +4 -17
- package/src/services/ui.ts +2 -2
- package/src/theme/code-block.scss +11 -49
- package/src/theme/dep-list.scss +59 -0
- package/src/theme/event.scss +12 -0
- package/src/theme/sidebar.scss +26 -6
- package/src/theme/theme.scss +1 -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 +90 -7
- 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, 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
|
-
import { isPop, getNodePath, isNumber, isPage, toLine, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
|
|
10
|
+
import { isPop, getNodePath, isNumber, isPage, toLine, guid, 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");
|
|
@@ -1831,8 +1829,13 @@ class Props extends BaseService {
|
|
|
1831
1829
|
};
|
|
1832
1830
|
}
|
|
1833
1831
|
async createId(type) {
|
|
1834
|
-
return `${type}_${
|
|
1832
|
+
return `${type}_${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,13 +1872,6 @@ class Props extends BaseService {
|
|
|
1864
1872
|
this.removeAllListeners();
|
|
1865
1873
|
this.removeAllPlugins();
|
|
1866
1874
|
}
|
|
1867
|
-
guid(digit = 8) {
|
|
1868
|
-
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
1869
|
-
const r = Math.random() * 16 | 0;
|
|
1870
|
-
const v = c === "x" ? r : r & 3 | 8;
|
|
1871
|
-
return v.toString(16);
|
|
1872
|
-
});
|
|
1873
|
-
}
|
|
1874
1875
|
}
|
|
1875
1876
|
const propsService = new Props();
|
|
1876
1877
|
|
|
@@ -1946,7 +1947,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
|
|
|
1946
1947
|
return newNode;
|
|
1947
1948
|
};
|
|
1948
1949
|
|
|
1949
|
-
|
|
1950
|
+
let Editor$1 = class Editor extends BaseService {
|
|
1950
1951
|
state = reactive({
|
|
1951
1952
|
root: null,
|
|
1952
1953
|
page: null,
|
|
@@ -1983,9 +1984,15 @@ class Editor$1 extends BaseService {
|
|
|
1983
1984
|
"redo",
|
|
1984
1985
|
"highlight"
|
|
1985
1986
|
],
|
|
1987
|
+
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
1986
1988
|
["select", "update", "moveLayer"]
|
|
1987
1989
|
);
|
|
1988
1990
|
}
|
|
1991
|
+
/**
|
|
1992
|
+
* 设置当前指点节点配置
|
|
1993
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
1994
|
+
* @param value MNode
|
|
1995
|
+
*/
|
|
1989
1996
|
set(name, value) {
|
|
1990
1997
|
const preValue = this.state[name];
|
|
1991
1998
|
this.state[name] = value;
|
|
@@ -1994,7 +2001,7 @@ class Editor$1 extends BaseService {
|
|
|
1994
2001
|
}
|
|
1995
2002
|
if (name === "root") {
|
|
1996
2003
|
if (Array.isArray(value)) {
|
|
1997
|
-
throw new Error("root
|
|
2004
|
+
throw new Error("root 不能为数组");
|
|
1998
2005
|
}
|
|
1999
2006
|
if (value && isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
|
|
2000
2007
|
this.state.pageLength = value.items?.length || 0;
|
|
@@ -2004,9 +2011,20 @@ class Editor$1 extends BaseService {
|
|
|
2004
2011
|
this.emit("root-change", value, preValue);
|
|
2005
2012
|
}
|
|
2006
2013
|
}
|
|
2014
|
+
/**
|
|
2015
|
+
* 获取当前指点节点配置
|
|
2016
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
2017
|
+
* @returns MNode
|
|
2018
|
+
*/
|
|
2007
2019
|
get(name) {
|
|
2008
2020
|
return this.state[name];
|
|
2009
2021
|
}
|
|
2022
|
+
/**
|
|
2023
|
+
* 根据id获取组件、组件的父组件以及组件所属的页面节点
|
|
2024
|
+
* @param {number | string} id 组件id
|
|
2025
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2026
|
+
* @returns {EditorNodeInfo}
|
|
2027
|
+
*/
|
|
2010
2028
|
getNodeInfo(id, raw = true) {
|
|
2011
2029
|
let root = this.get("root");
|
|
2012
2030
|
if (raw) {
|
|
@@ -2037,14 +2055,29 @@ class Editor$1 extends BaseService {
|
|
|
2037
2055
|
});
|
|
2038
2056
|
return info;
|
|
2039
2057
|
}
|
|
2058
|
+
/**
|
|
2059
|
+
* 根据ID获取指点节点配置
|
|
2060
|
+
* @param id 组件ID
|
|
2061
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2062
|
+
* @returns 组件节点配置
|
|
2063
|
+
*/
|
|
2040
2064
|
getNodeById(id, raw = true) {
|
|
2041
2065
|
const { node } = this.getNodeInfo(id, raw);
|
|
2042
2066
|
return node;
|
|
2043
2067
|
}
|
|
2068
|
+
/**
|
|
2069
|
+
* 根据ID获取指点节点的父节点配置
|
|
2070
|
+
* @param id 组件ID
|
|
2071
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2072
|
+
* @returns 指点组件的父节点配置
|
|
2073
|
+
*/
|
|
2044
2074
|
getParentById(id, raw = true) {
|
|
2045
2075
|
const { parent } = this.getNodeInfo(id, raw);
|
|
2046
2076
|
return parent;
|
|
2047
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* 只有容器拥有布局
|
|
2080
|
+
*/
|
|
2048
2081
|
async getLayout(parent, node) {
|
|
2049
2082
|
if (node && typeof node !== "function" && isFixed(node))
|
|
2050
2083
|
return Layout.FIXED;
|
|
@@ -2056,6 +2089,11 @@ class Editor$1 extends BaseService {
|
|
|
2056
2089
|
}
|
|
2057
2090
|
return Layout.ABSOLUTE;
|
|
2058
2091
|
}
|
|
2092
|
+
/**
|
|
2093
|
+
* 选中指定节点(将指定节点设置成当前选中状态)
|
|
2094
|
+
* @param config 指定节点配置或者ID
|
|
2095
|
+
* @returns 当前选中的节点配置
|
|
2096
|
+
*/
|
|
2059
2097
|
async select(config) {
|
|
2060
2098
|
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
2061
2099
|
this.set("nodes", node ? [node] : []);
|
|
@@ -2097,15 +2135,20 @@ class Editor$1 extends BaseService {
|
|
|
2097
2135
|
const root = toRaw(this.get("root"));
|
|
2098
2136
|
const page = toRaw(this.get("page"));
|
|
2099
2137
|
if (!page)
|
|
2100
|
-
throw new Error("page
|
|
2138
|
+
throw new Error("page不能为空");
|
|
2101
2139
|
if (!root)
|
|
2102
|
-
throw new Error("root
|
|
2140
|
+
throw new Error("root不能为空");
|
|
2103
2141
|
const index = getNodeIndex(page, root);
|
|
2104
2142
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
2105
2143
|
await this.select(nextPage);
|
|
2106
2144
|
this.get("stage")?.select(nextPage.id);
|
|
2107
2145
|
return nextPage;
|
|
2108
2146
|
}
|
|
2147
|
+
/**
|
|
2148
|
+
* 高亮指定节点
|
|
2149
|
+
* @param config 指定节点配置或者ID
|
|
2150
|
+
* @returns 当前高亮的节点配置
|
|
2151
|
+
*/
|
|
2109
2152
|
highlight(config) {
|
|
2110
2153
|
const { node } = this.selectedConfigExceptionHandler(config);
|
|
2111
2154
|
const currentHighlightNode = this.get("highlightNode");
|
|
@@ -2113,6 +2156,11 @@ class Editor$1 extends BaseService {
|
|
|
2113
2156
|
return;
|
|
2114
2157
|
this.set("highlightNode", node);
|
|
2115
2158
|
}
|
|
2159
|
+
/**
|
|
2160
|
+
* 多选
|
|
2161
|
+
* @param ids 指定节点ID
|
|
2162
|
+
* @returns 加入多选的节点配置
|
|
2163
|
+
*/
|
|
2116
2164
|
multiSelect(ids) {
|
|
2117
2165
|
const nodes = [];
|
|
2118
2166
|
const idsUnique = uniq(ids);
|
|
@@ -2127,13 +2175,13 @@ class Editor$1 extends BaseService {
|
|
|
2127
2175
|
async doAdd(node, parent) {
|
|
2128
2176
|
const root = this.get("root");
|
|
2129
2177
|
if (!root)
|
|
2130
|
-
throw new Error("root
|
|
2178
|
+
throw new Error("root为空");
|
|
2131
2179
|
const curNode = this.get("node");
|
|
2132
2180
|
const stage = this.get("stage");
|
|
2133
2181
|
if (!curNode)
|
|
2134
|
-
throw new Error("
|
|
2182
|
+
throw new Error("当前选中节点为空");
|
|
2135
2183
|
if ((parent.type === NodeType.ROOT || curNode?.type === NodeType.ROOT) && node.type !== NodeType.PAGE) {
|
|
2136
|
-
throw new Error("app
|
|
2184
|
+
throw new Error("app下不能添加组件");
|
|
2137
2185
|
}
|
|
2138
2186
|
if (parent.id !== curNode.id && node.type !== NodeType.PAGE) {
|
|
2139
2187
|
const index = parent.items.indexOf(curNode);
|
|
@@ -2157,13 +2205,19 @@ class Editor$1 extends BaseService {
|
|
|
2157
2205
|
this.addModifiedNodeId(node.id);
|
|
2158
2206
|
return node;
|
|
2159
2207
|
}
|
|
2208
|
+
/**
|
|
2209
|
+
* 向指点容器添加组件节点
|
|
2210
|
+
* @param addConfig 将要添加的组件节点配置
|
|
2211
|
+
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
2212
|
+
* @returns 添加后的节点
|
|
2213
|
+
*/
|
|
2160
2214
|
async add(addNode, parent) {
|
|
2161
2215
|
const stage = this.get("stage");
|
|
2162
2216
|
const addNodes = [];
|
|
2163
2217
|
if (!Array.isArray(addNode)) {
|
|
2164
2218
|
const { type, inputEvent, ...config } = addNode;
|
|
2165
2219
|
if (!type)
|
|
2166
|
-
throw new Error("
|
|
2220
|
+
throw new Error("组件类型不能为空");
|
|
2167
2221
|
addNodes.push({ ...toRaw(await propsService.getPropsValue(type, config)) });
|
|
2168
2222
|
} else {
|
|
2169
2223
|
addNodes.push(...addNode);
|
|
@@ -2176,7 +2230,7 @@ class Editor$1 extends BaseService {
|
|
|
2176
2230
|
}
|
|
2177
2231
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
2178
2232
|
if (!parentNode)
|
|
2179
|
-
throw new Error("
|
|
2233
|
+
throw new Error("未找到父元素");
|
|
2180
2234
|
return this.doAdd(node, parentNode);
|
|
2181
2235
|
})
|
|
2182
2236
|
);
|
|
@@ -2201,13 +2255,13 @@ class Editor$1 extends BaseService {
|
|
|
2201
2255
|
async doRemove(node) {
|
|
2202
2256
|
const root = this.get("root");
|
|
2203
2257
|
if (!root)
|
|
2204
|
-
throw new Error("root
|
|
2258
|
+
throw new Error("root不能为空");
|
|
2205
2259
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
2206
2260
|
if (!parent || !curNode)
|
|
2207
|
-
throw new Error("
|
|
2261
|
+
throw new Error("找不要删除的节点");
|
|
2208
2262
|
const index = getNodeIndex(curNode, parent);
|
|
2209
2263
|
if (typeof index !== "number" || index === -1)
|
|
2210
|
-
throw new Error("
|
|
2264
|
+
throw new Error("找不要删除的节点");
|
|
2211
2265
|
parent.items?.splice(index, 1);
|
|
2212
2266
|
const stage = this.get("stage");
|
|
2213
2267
|
stage?.remove({ id: node.id, parentId: parent.id, root: cloneDeep(root) });
|
|
@@ -2232,6 +2286,10 @@ class Editor$1 extends BaseService {
|
|
|
2232
2286
|
}
|
|
2233
2287
|
this.addModifiedNodeId(parent.id);
|
|
2234
2288
|
}
|
|
2289
|
+
/**
|
|
2290
|
+
* 删除组件
|
|
2291
|
+
* @param {Object} node
|
|
2292
|
+
*/
|
|
2235
2293
|
async remove(nodeOrNodeList) {
|
|
2236
2294
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
2237
2295
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
@@ -2243,12 +2301,12 @@ class Editor$1 extends BaseService {
|
|
|
2243
2301
|
async doUpdate(config) {
|
|
2244
2302
|
const root = this.get("root");
|
|
2245
2303
|
if (!root)
|
|
2246
|
-
throw new Error("root
|
|
2304
|
+
throw new Error("root为空");
|
|
2247
2305
|
if (!config?.id)
|
|
2248
|
-
throw new Error("
|
|
2306
|
+
throw new Error("没有配置或者配置缺少id值");
|
|
2249
2307
|
const info = this.getNodeInfo(config.id, false);
|
|
2250
2308
|
if (!info.node)
|
|
2251
|
-
throw new Error(
|
|
2309
|
+
throw new Error(`获取不到id为${config.id}的节点`);
|
|
2252
2310
|
const node = cloneDeep(toRaw(info.node));
|
|
2253
2311
|
let newConfig = await this.toggleFixedPosition(toRaw(config), node, root);
|
|
2254
2312
|
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
@@ -2260,18 +2318,18 @@ class Editor$1 extends BaseService {
|
|
|
2260
2318
|
}
|
|
2261
2319
|
});
|
|
2262
2320
|
if (!newConfig.type)
|
|
2263
|
-
throw new Error("
|
|
2321
|
+
throw new Error("配置缺少type值");
|
|
2264
2322
|
if (newConfig.type === NodeType.ROOT) {
|
|
2265
2323
|
this.set("root", newConfig);
|
|
2266
2324
|
return newConfig;
|
|
2267
2325
|
}
|
|
2268
2326
|
const { parent } = info;
|
|
2269
2327
|
if (!parent)
|
|
2270
|
-
throw new Error("
|
|
2328
|
+
throw new Error("获取不到父级节点");
|
|
2271
2329
|
const parentNodeItems = parent.items;
|
|
2272
2330
|
const index = getNodeIndex(newConfig, parent);
|
|
2273
2331
|
if (!parentNodeItems || typeof index === "undefined" || index === -1)
|
|
2274
|
-
throw new Error("
|
|
2332
|
+
throw new Error("更新的节点未找到");
|
|
2275
2333
|
const newLayout = await this.getLayout(newConfig);
|
|
2276
2334
|
const layout = await this.getLayout(node);
|
|
2277
2335
|
if (newLayout !== layout) {
|
|
@@ -2293,6 +2351,11 @@ class Editor$1 extends BaseService {
|
|
|
2293
2351
|
this.addModifiedNodeId(newConfig.id);
|
|
2294
2352
|
return newConfig;
|
|
2295
2353
|
}
|
|
2354
|
+
/**
|
|
2355
|
+
* 更新节点
|
|
2356
|
+
* @param config 新的节点配置,配置中需要有id信息
|
|
2357
|
+
* @returns 更新后的节点配置
|
|
2358
|
+
*/
|
|
2296
2359
|
async update(config) {
|
|
2297
2360
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2298
2361
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
@@ -2300,16 +2363,22 @@ class Editor$1 extends BaseService {
|
|
|
2300
2363
|
this.emit("update", newNodes);
|
|
2301
2364
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
2302
2365
|
}
|
|
2366
|
+
/**
|
|
2367
|
+
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
2368
|
+
* @param id1 组件ID
|
|
2369
|
+
* @param id2 组件ID
|
|
2370
|
+
* @returns void
|
|
2371
|
+
*/
|
|
2303
2372
|
async sort(id1, id2) {
|
|
2304
2373
|
const root = this.get("root");
|
|
2305
2374
|
if (!root)
|
|
2306
|
-
throw new Error("root
|
|
2375
|
+
throw new Error("root为空");
|
|
2307
2376
|
const node = this.get("node");
|
|
2308
2377
|
if (!node)
|
|
2309
|
-
throw new Error("
|
|
2378
|
+
throw new Error("当前节点为空");
|
|
2310
2379
|
const parent = cloneDeep(toRaw(this.get("parent")));
|
|
2311
2380
|
if (!parent)
|
|
2312
|
-
throw new Error("
|
|
2381
|
+
throw new Error("父节点为空");
|
|
2313
2382
|
const index2 = parent.items.findIndex((node2) => `${node2.id}` === `${id2}`);
|
|
2314
2383
|
if (index2 < 0)
|
|
2315
2384
|
return;
|
|
@@ -2325,11 +2394,21 @@ class Editor$1 extends BaseService {
|
|
|
2325
2394
|
this.addModifiedNodeId(parent.id);
|
|
2326
2395
|
this.pushHistoryState();
|
|
2327
2396
|
}
|
|
2397
|
+
/**
|
|
2398
|
+
* 将组将节点配置转化成string,然后存储到localStorage中
|
|
2399
|
+
* @param config 组件节点配置
|
|
2400
|
+
* @returns 组件节点配置
|
|
2401
|
+
*/
|
|
2328
2402
|
async copy(config) {
|
|
2329
2403
|
await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
|
|
2330
2404
|
protocol: Protocol.OBJECT
|
|
2331
2405
|
});
|
|
2332
2406
|
}
|
|
2407
|
+
/**
|
|
2408
|
+
* 从localStorage中获取节点,然后添加到当前容器中
|
|
2409
|
+
* @param position 粘贴的坐标
|
|
2410
|
+
* @returns 添加后的组件节点配置
|
|
2411
|
+
*/
|
|
2333
2412
|
async paste(position = {}) {
|
|
2334
2413
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
2335
2414
|
if (!Array.isArray(config))
|
|
@@ -2352,7 +2431,7 @@ class Editor$1 extends BaseService {
|
|
|
2352
2431
|
async doAlignCenter(config) {
|
|
2353
2432
|
const parent = this.getParentById(config.id);
|
|
2354
2433
|
if (!parent)
|
|
2355
|
-
throw new Error("
|
|
2434
|
+
throw new Error("找不到父节点");
|
|
2356
2435
|
const node = cloneDeep(toRaw(config));
|
|
2357
2436
|
const layout = await this.getLayout(parent, node);
|
|
2358
2437
|
if (layout === Layout.RELATIVE) {
|
|
@@ -2373,6 +2452,11 @@ class Editor$1 extends BaseService {
|
|
|
2373
2452
|
}
|
|
2374
2453
|
return node;
|
|
2375
2454
|
}
|
|
2455
|
+
/**
|
|
2456
|
+
* 将指点节点设置居中
|
|
2457
|
+
* @param config 组件节点配置
|
|
2458
|
+
* @returns 当前组件节点配置
|
|
2459
|
+
*/
|
|
2376
2460
|
async alignCenter(config) {
|
|
2377
2461
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2378
2462
|
const stage = this.get("stage");
|
|
@@ -2385,16 +2469,20 @@ class Editor$1 extends BaseService {
|
|
|
2385
2469
|
}
|
|
2386
2470
|
return newNode;
|
|
2387
2471
|
}
|
|
2472
|
+
/**
|
|
2473
|
+
* 移动当前选中节点位置
|
|
2474
|
+
* @param offset 偏移量
|
|
2475
|
+
*/
|
|
2388
2476
|
async moveLayer(offset) {
|
|
2389
2477
|
const root = this.get("root");
|
|
2390
2478
|
if (!root)
|
|
2391
|
-
throw new Error("root
|
|
2479
|
+
throw new Error("root为空");
|
|
2392
2480
|
const parent = this.get("parent");
|
|
2393
2481
|
if (!parent)
|
|
2394
|
-
throw new Error("
|
|
2482
|
+
throw new Error("父节点为空");
|
|
2395
2483
|
const node = this.get("node");
|
|
2396
2484
|
if (!node)
|
|
2397
|
-
throw new Error("
|
|
2485
|
+
throw new Error("当前节点为空");
|
|
2398
2486
|
const brothers = parent.items || [];
|
|
2399
2487
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2400
2488
|
const layout = await this.getLayout(parent, node);
|
|
@@ -2416,6 +2504,11 @@ class Editor$1 extends BaseService {
|
|
|
2416
2504
|
this.addModifiedNodeId(parent.id);
|
|
2417
2505
|
this.pushHistoryState();
|
|
2418
2506
|
}
|
|
2507
|
+
/**
|
|
2508
|
+
* 移动到指定容器中
|
|
2509
|
+
* @param config 需要移动的节点
|
|
2510
|
+
* @param targetId 容器ID
|
|
2511
|
+
*/
|
|
2419
2512
|
async moveToContainer(config, targetId) {
|
|
2420
2513
|
const root = cloneDeep(this.get("root"));
|
|
2421
2514
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
@@ -2444,11 +2537,19 @@ class Editor$1 extends BaseService {
|
|
|
2444
2537
|
return newConfig;
|
|
2445
2538
|
}
|
|
2446
2539
|
}
|
|
2540
|
+
/**
|
|
2541
|
+
* 撤销当前操作
|
|
2542
|
+
* @returns 上一次数据
|
|
2543
|
+
*/
|
|
2447
2544
|
async undo() {
|
|
2448
2545
|
const value = historyService.undo();
|
|
2449
2546
|
await this.changeHistoryState(value);
|
|
2450
2547
|
return value;
|
|
2451
2548
|
}
|
|
2549
|
+
/**
|
|
2550
|
+
* 恢复到下一步
|
|
2551
|
+
* @returns 下一步数据
|
|
2552
|
+
*/
|
|
2452
2553
|
async redo() {
|
|
2453
2554
|
const value = historyService.redo();
|
|
2454
2555
|
await this.changeHistoryState(value);
|
|
@@ -2544,13 +2645,13 @@ class Editor$1 extends BaseService {
|
|
|
2544
2645
|
id = config.id;
|
|
2545
2646
|
}
|
|
2546
2647
|
if (!id) {
|
|
2547
|
-
throw new Error("
|
|
2648
|
+
throw new Error("没有ID,无法选中");
|
|
2548
2649
|
}
|
|
2549
2650
|
const { node, parent, page } = this.getNodeInfo(id);
|
|
2550
2651
|
if (!node)
|
|
2551
|
-
throw new Error("
|
|
2652
|
+
throw new Error("获取不到组件信息");
|
|
2552
2653
|
if (node.id === this.state.root?.id) {
|
|
2553
|
-
throw new Error("
|
|
2654
|
+
throw new Error("不能选根节点");
|
|
2554
2655
|
}
|
|
2555
2656
|
return {
|
|
2556
2657
|
node,
|
|
@@ -2558,7 +2659,7 @@ class Editor$1 extends BaseService {
|
|
|
2558
2659
|
page
|
|
2559
2660
|
};
|
|
2560
2661
|
}
|
|
2561
|
-
}
|
|
2662
|
+
};
|
|
2562
2663
|
const editorService = new Editor$1();
|
|
2563
2664
|
|
|
2564
2665
|
const state = reactive({
|
|
@@ -2709,7 +2810,7 @@ const useStage = (stageOptions) => {
|
|
|
2709
2810
|
stage.on("select-parent", () => {
|
|
2710
2811
|
const parent = editorService.get("parent");
|
|
2711
2812
|
if (!parent)
|
|
2712
|
-
throw new Error("
|
|
2813
|
+
throw new Error("父节点为空");
|
|
2713
2814
|
editorService.select(parent);
|
|
2714
2815
|
editorService.get("stage")?.select(parent.id);
|
|
2715
2816
|
});
|
|
@@ -2729,13 +2830,13 @@ const useStage = (stageOptions) => {
|
|
|
2729
2830
|
return stage;
|
|
2730
2831
|
};
|
|
2731
2832
|
|
|
2732
|
-
const _hoisted_1$
|
|
2733
|
-
const _hoisted_2$
|
|
2734
|
-
const _hoisted_3$
|
|
2833
|
+
const _hoisted_1$f = { class: "m-editor-empty-panel" };
|
|
2834
|
+
const _hoisted_2$8 = { class: "m-editor-empty-content" };
|
|
2835
|
+
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
2735
2836
|
const __default__$l = defineComponent({
|
|
2736
2837
|
name: "MEditorAddPageBox"
|
|
2737
2838
|
});
|
|
2738
|
-
const _sfc_main$
|
|
2839
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
2739
2840
|
...__default__$l,
|
|
2740
2841
|
setup(__props) {
|
|
2741
2842
|
const services = inject("services");
|
|
@@ -2745,23 +2846,23 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2745
2846
|
return;
|
|
2746
2847
|
const root = toRaw(editorService.get("root"));
|
|
2747
2848
|
if (!root)
|
|
2748
|
-
throw new Error("root
|
|
2849
|
+
throw new Error("root 不能为空");
|
|
2749
2850
|
editorService.add({
|
|
2750
2851
|
type: NodeType.PAGE,
|
|
2751
2852
|
name: generatePageNameByApp(root)
|
|
2752
2853
|
});
|
|
2753
2854
|
};
|
|
2754
2855
|
return (_ctx, _cache) => {
|
|
2755
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2756
|
-
createElementVNode("div", _hoisted_2$
|
|
2856
|
+
return openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
2857
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
2757
2858
|
createElementVNode("div", {
|
|
2758
2859
|
class: "m-editor-empty-button",
|
|
2759
2860
|
onClick: clickHandler
|
|
2760
2861
|
}, [
|
|
2761
2862
|
createElementVNode("div", null, [
|
|
2762
|
-
createVNode(_sfc_main$
|
|
2863
|
+
createVNode(_sfc_main$w, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
2763
2864
|
]),
|
|
2764
|
-
_hoisted_3$
|
|
2865
|
+
_hoisted_3$4
|
|
2765
2866
|
])
|
|
2766
2867
|
])
|
|
2767
2868
|
]);
|
|
@@ -2769,11 +2870,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2769
2870
|
}
|
|
2770
2871
|
});
|
|
2771
2872
|
|
|
2772
|
-
const _hoisted_1$
|
|
2873
|
+
const _hoisted_1$e = { class: "m-editor" };
|
|
2773
2874
|
const __default__$k = defineComponent({
|
|
2774
2875
|
name: "MEditorFramework"
|
|
2775
2876
|
});
|
|
2776
|
-
const _sfc_main$
|
|
2877
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
2777
2878
|
...__default__$k,
|
|
2778
2879
|
props: {
|
|
2779
2880
|
codeOptions: { default: () => ({}) }
|
|
@@ -2843,7 +2944,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2843
2944
|
};
|
|
2844
2945
|
return (_ctx, _cache) => {
|
|
2845
2946
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
2846
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2947
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
2847
2948
|
renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2848
2949
|
unref(showSrc) ? (openBlock(), createBlock(_component_magic_code_editor, {
|
|
2849
2950
|
key: 0,
|
|
@@ -2851,7 +2952,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2851
2952
|
"init-values": unref(root),
|
|
2852
2953
|
options: __props.codeOptions,
|
|
2853
2954
|
onSave: saveCode
|
|
2854
|
-
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$
|
|
2955
|
+
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$q, {
|
|
2855
2956
|
key: 1,
|
|
2856
2957
|
class: "m-editor-content",
|
|
2857
2958
|
"left-class": "m-editor-framework-left",
|
|
@@ -2861,8 +2962,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2861
2962
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
|
|
2862
2963
|
right: columnWidth.value.right,
|
|
2863
2964
|
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
2864
|
-
"min-left":
|
|
2865
|
-
"min-right":
|
|
2965
|
+
"min-left": 65,
|
|
2966
|
+
"min-right": 20,
|
|
2866
2967
|
onChange: columnWidthChange
|
|
2867
2968
|
}, createSlots({
|
|
2868
2969
|
left: withCtx(() => [
|
|
@@ -2870,7 +2971,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2870
2971
|
]),
|
|
2871
2972
|
center: withCtx(() => [
|
|
2872
2973
|
unref(pageLength) > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2873
|
-
createVNode(_sfc_main$
|
|
2974
|
+
createVNode(_sfc_main$p)
|
|
2874
2975
|
])
|
|
2875
2976
|
]),
|
|
2876
2977
|
_: 2
|
|
@@ -2892,15 +2993,15 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2892
2993
|
}
|
|
2893
2994
|
});
|
|
2894
2995
|
|
|
2895
|
-
const _hoisted_1$
|
|
2996
|
+
const _hoisted_1$d = {
|
|
2896
2997
|
key: 1,
|
|
2897
2998
|
class: "menu-item-text"
|
|
2898
2999
|
};
|
|
2899
|
-
const _hoisted_2$
|
|
3000
|
+
const _hoisted_2$7 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2900
3001
|
const __default__$j = defineComponent({
|
|
2901
3002
|
name: "MEditorToolButton"
|
|
2902
3003
|
});
|
|
2903
|
-
const _sfc_main$
|
|
3004
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
2904
3005
|
...__default__$j,
|
|
2905
3006
|
props: {
|
|
2906
3007
|
data: { default: () => ({
|
|
@@ -2976,7 +3077,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2976
3077
|
__props.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
2977
3078
|
key: 0,
|
|
2978
3079
|
direction: __props.data.direction || "vertical"
|
|
2979
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
3080
|
+
}, 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
3081
|
__props.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
2981
3082
|
key: 0,
|
|
2982
3083
|
effect: "dark",
|
|
@@ -2990,7 +3091,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2990
3091
|
disabled: unref(disabled)
|
|
2991
3092
|
}, {
|
|
2992
3093
|
default: withCtx(() => [
|
|
2993
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
3094
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$w, {
|
|
2994
3095
|
key: 0,
|
|
2995
3096
|
icon: __props.data.icon
|
|
2996
3097
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -3007,7 +3108,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3007
3108
|
disabled: unref(disabled)
|
|
3008
3109
|
}, {
|
|
3009
3110
|
default: withCtx(() => [
|
|
3010
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
3111
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$w, {
|
|
3011
3112
|
key: 0,
|
|
3012
3113
|
icon: __props.data.icon
|
|
3013
3114
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -3040,7 +3141,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3040
3141
|
})) : createCommentVNode("", true)
|
|
3041
3142
|
]),
|
|
3042
3143
|
default: withCtx(() => [
|
|
3043
|
-
createElementVNode("span", _hoisted_2$
|
|
3144
|
+
createElementVNode("span", _hoisted_2$7, [
|
|
3044
3145
|
createTextVNode(toDisplayString(__props.data.text), 1),
|
|
3045
3146
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
3046
3147
|
default: withCtx(() => [
|
|
@@ -3060,7 +3161,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3060
3161
|
const __default__$i = defineComponent({
|
|
3061
3162
|
name: "MEditorNavMenu"
|
|
3062
3163
|
});
|
|
3063
|
-
const _sfc_main$
|
|
3164
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
3064
3165
|
...__default__$i,
|
|
3065
3166
|
props: {
|
|
3066
3167
|
data: { default: () => ({}) },
|
|
@@ -3103,7 +3204,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3103
3204
|
type: "button",
|
|
3104
3205
|
className: "delete",
|
|
3105
3206
|
icon: markRaw(Delete),
|
|
3106
|
-
tooltip:
|
|
3207
|
+
tooltip: `刪除(Delete)`,
|
|
3107
3208
|
disabled: () => services?.editorService.get("node")?.type === NodeType.PAGE,
|
|
3108
3209
|
handler: () => {
|
|
3109
3210
|
const node = services?.editorService.get("node");
|
|
@@ -3116,7 +3217,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3116
3217
|
type: "button",
|
|
3117
3218
|
className: "undo",
|
|
3118
3219
|
icon: markRaw(Back),
|
|
3119
|
-
tooltip:
|
|
3220
|
+
tooltip: `后退(${ctrl}+z)`,
|
|
3120
3221
|
disabled: () => !services?.historyService.state.canUndo,
|
|
3121
3222
|
handler: () => services?.editorService.undo()
|
|
3122
3223
|
});
|
|
@@ -3126,7 +3227,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3126
3227
|
type: "button",
|
|
3127
3228
|
className: "redo",
|
|
3128
3229
|
icon: markRaw(Right),
|
|
3129
|
-
tooltip:
|
|
3230
|
+
tooltip: `前进(${ctrl}+Shift+z)`,
|
|
3130
3231
|
disabled: () => !services?.historyService.state.canRedo,
|
|
3131
3232
|
handler: () => services?.editorService.redo()
|
|
3132
3233
|
});
|
|
@@ -3136,7 +3237,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3136
3237
|
type: "button",
|
|
3137
3238
|
className: "zoom-in",
|
|
3138
3239
|
icon: markRaw(ZoomIn),
|
|
3139
|
-
tooltip:
|
|
3240
|
+
tooltip: `放大(${ctrl}+=)`,
|
|
3140
3241
|
handler: () => uiService?.zoom(0.1)
|
|
3141
3242
|
});
|
|
3142
3243
|
break;
|
|
@@ -3145,7 +3246,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3145
3246
|
type: "button",
|
|
3146
3247
|
className: "zoom-out",
|
|
3147
3248
|
icon: markRaw(ZoomOut),
|
|
3148
|
-
tooltip:
|
|
3249
|
+
tooltip: `縮小(${ctrl}+-)`,
|
|
3149
3250
|
handler: () => uiService?.zoom(-0.1)
|
|
3150
3251
|
});
|
|
3151
3252
|
break;
|
|
@@ -3154,7 +3255,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3154
3255
|
type: "button",
|
|
3155
3256
|
className: "scale-to-original",
|
|
3156
3257
|
icon: markRaw(ScaleToOriginal),
|
|
3157
|
-
tooltip:
|
|
3258
|
+
tooltip: `缩放到实际大小(${ctrl}+1)`,
|
|
3158
3259
|
handler: () => uiService?.set("zoom", 1)
|
|
3159
3260
|
});
|
|
3160
3261
|
break;
|
|
@@ -3163,7 +3264,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3163
3264
|
type: "button",
|
|
3164
3265
|
className: "scale-to-fit",
|
|
3165
3266
|
icon: markRaw(FullScreen),
|
|
3166
|
-
tooltip:
|
|
3267
|
+
tooltip: `缩放以适应(${ctrl}+0)`,
|
|
3167
3268
|
handler: async () => uiService?.set("zoom", await uiService.calcZoom())
|
|
3168
3269
|
});
|
|
3169
3270
|
break;
|
|
@@ -3172,7 +3273,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3172
3273
|
type: "button",
|
|
3173
3274
|
className: "rule",
|
|
3174
3275
|
icon: markRaw(Memo),
|
|
3175
|
-
tooltip: showRule.value ? "
|
|
3276
|
+
tooltip: showRule.value ? "隐藏标尺" : "显示标尺",
|
|
3176
3277
|
handler: () => uiService?.set("showRule", !showRule.value)
|
|
3177
3278
|
});
|
|
3178
3279
|
break;
|
|
@@ -3181,7 +3282,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3181
3282
|
type: "button",
|
|
3182
3283
|
className: "guides",
|
|
3183
3284
|
icon: markRaw(Grid),
|
|
3184
|
-
tooltip: showGuides.value ? "
|
|
3285
|
+
tooltip: showGuides.value ? "隐藏参考线" : "显示参考线",
|
|
3185
3286
|
handler: () => uiService?.set("showGuides", !showGuides.value)
|
|
3186
3287
|
});
|
|
3187
3288
|
break;
|
|
@@ -3219,7 +3320,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3219
3320
|
style: normalizeStyle(`width: ${unref(columnWidth)?.[key]}px`)
|
|
3220
3321
|
}, [
|
|
3221
3322
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttons)[key], (item, index) => {
|
|
3222
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3323
|
+
return openBlock(), createBlock(_sfc_main$n, {
|
|
3223
3324
|
data: item,
|
|
3224
3325
|
key: index
|
|
3225
3326
|
}, null, 8, ["data"]);
|
|
@@ -3231,11 +3332,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
3231
3332
|
}
|
|
3232
3333
|
});
|
|
3233
3334
|
|
|
3234
|
-
const _hoisted_1$
|
|
3335
|
+
const _hoisted_1$c = { class: "m-editor-props-panel" };
|
|
3235
3336
|
const __default__$h = defineComponent({
|
|
3236
3337
|
name: "MEditorPropsPanel"
|
|
3237
3338
|
});
|
|
3238
|
-
const _sfc_main$
|
|
3339
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
3239
3340
|
...__default__$h,
|
|
3240
3341
|
emits: ["mounted"],
|
|
3241
3342
|
setup(__props, { expose, emit }) {
|
|
@@ -3281,7 +3382,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3281
3382
|
};
|
|
3282
3383
|
expose({ submit });
|
|
3283
3384
|
return (_ctx, _cache) => {
|
|
3284
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3385
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
3285
3386
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3286
3387
|
createVNode(unref(MForm), {
|
|
3287
3388
|
ref_key: "configForm",
|
|
@@ -3298,7 +3399,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3298
3399
|
}
|
|
3299
3400
|
});
|
|
3300
3401
|
|
|
3301
|
-
const _sfc_main$
|
|
3402
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
3302
3403
|
__name: "SearchInput",
|
|
3303
3404
|
emits: ["search"],
|
|
3304
3405
|
setup(__props, { emit }) {
|
|
@@ -3312,26 +3413,83 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
3312
3413
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3313
3414
|
class: "search-input",
|
|
3314
3415
|
size: "small",
|
|
3315
|
-
placeholder: "
|
|
3416
|
+
placeholder: "输入关键字进行过滤",
|
|
3316
3417
|
clearable: "",
|
|
3317
|
-
"prefix-icon": unref(Search),
|
|
3318
3418
|
onInput: filterTextChangeHandler
|
|
3319
|
-
},
|
|
3419
|
+
}, {
|
|
3420
|
+
prefix: withCtx(() => [
|
|
3421
|
+
createVNode(unref(TMagicIcon), null, {
|
|
3422
|
+
default: withCtx(() => [
|
|
3423
|
+
createVNode(unref(Search))
|
|
3424
|
+
]),
|
|
3425
|
+
_: 1
|
|
3426
|
+
})
|
|
3427
|
+
]),
|
|
3428
|
+
_: 1
|
|
3429
|
+
}, 8, ["modelValue"]);
|
|
3320
3430
|
};
|
|
3321
3431
|
}
|
|
3322
3432
|
});
|
|
3323
3433
|
|
|
3434
|
+
const _export_sfc = (sfc, props) => {
|
|
3435
|
+
const target = sfc.__vccOpts || sfc;
|
|
3436
|
+
for (const [key, val] of props) {
|
|
3437
|
+
target[key] = val;
|
|
3438
|
+
}
|
|
3439
|
+
return target;
|
|
3440
|
+
};
|
|
3441
|
+
|
|
3442
|
+
const _sfc_main$j = {};
|
|
3443
|
+
|
|
3444
|
+
const _hoisted_1$b = { xmlns: "http://www.w3.org/2000/svg" };
|
|
3445
|
+
const _hoisted_2$6 = /*#__PURE__*/createElementVNode("g", {
|
|
3446
|
+
fill: "#7C878E",
|
|
3447
|
+
"fill-rule": "evenodd"
|
|
3448
|
+
}, [
|
|
3449
|
+
/*#__PURE__*/createElementVNode("path", {
|
|
3450
|
+
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",
|
|
3451
|
+
"fill-rule": "nonzero"
|
|
3452
|
+
}),
|
|
3453
|
+
/*#__PURE__*/createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
3454
|
+
], -1);
|
|
3455
|
+
const _hoisted_3$3 = [
|
|
3456
|
+
_hoisted_2$6
|
|
3457
|
+
];
|
|
3458
|
+
|
|
3459
|
+
function _sfc_render$2(_ctx, _cache) {
|
|
3460
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1$b, _hoisted_3$3))
|
|
3461
|
+
}
|
|
3462
|
+
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$j, [['render',_sfc_render$2]]);
|
|
3463
|
+
|
|
3464
|
+
const _sfc_main$i = {};
|
|
3465
|
+
|
|
3466
|
+
const _hoisted_1$a = {
|
|
3467
|
+
viewBox: "0 0 32 32",
|
|
3468
|
+
version: "1.1",
|
|
3469
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3470
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3471
|
+
};
|
|
3472
|
+
const _hoisted_2$5 = /*#__PURE__*/createStaticVNode("<defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 2);
|
|
3473
|
+
const _hoisted_4$3 = [
|
|
3474
|
+
_hoisted_2$5
|
|
3475
|
+
];
|
|
3476
|
+
|
|
3477
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
3478
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1$a, _hoisted_4$3))
|
|
3479
|
+
}
|
|
3480
|
+
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$i, [['render',_sfc_render$1]]);
|
|
3481
|
+
|
|
3324
3482
|
const _hoisted_1$9 = {
|
|
3325
3483
|
key: 0,
|
|
3326
3484
|
class: "m-editor-content-bottom"
|
|
3327
3485
|
};
|
|
3328
|
-
const _hoisted_2$4 = /* @__PURE__ */ createTextVNode("
|
|
3329
|
-
const _hoisted_3$2 = /* @__PURE__ */ createTextVNode("
|
|
3486
|
+
const _hoisted_2$4 = /* @__PURE__ */ createTextVNode("确认");
|
|
3487
|
+
const _hoisted_3$2 = /* @__PURE__ */ createTextVNode("关闭");
|
|
3330
3488
|
const _hoisted_4$2 = {
|
|
3331
3489
|
key: 1,
|
|
3332
3490
|
class: "m-editor-content-bottom"
|
|
3333
3491
|
};
|
|
3334
|
-
const _hoisted_5$1 = /* @__PURE__ */ createTextVNode("
|
|
3492
|
+
const _hoisted_5$1 = /* @__PURE__ */ createTextVNode("关闭");
|
|
3335
3493
|
const __default__$g = defineComponent({
|
|
3336
3494
|
name: "MEditorCodeDraftEditor"
|
|
3337
3495
|
});
|
|
@@ -3346,7 +3504,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3346
3504
|
language: null
|
|
3347
3505
|
},
|
|
3348
3506
|
emits: ["close", "saveAndClose"],
|
|
3349
|
-
setup(__props, { emit }) {
|
|
3507
|
+
setup(__props, { expose, emit }) {
|
|
3350
3508
|
const props = __props;
|
|
3351
3509
|
const services = inject("services");
|
|
3352
3510
|
const codeContent = ref("");
|
|
@@ -3376,7 +3534,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3376
3534
|
return;
|
|
3377
3535
|
}
|
|
3378
3536
|
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3379
|
-
tMagicMessage.success(
|
|
3537
|
+
tMagicMessage.success(`代码草稿成功保存到本地 ${datetimeFormatter( new Date())}`);
|
|
3380
3538
|
};
|
|
3381
3539
|
const saveAndClose = () => {
|
|
3382
3540
|
if (!codeEditor.value || !props.editable)
|
|
@@ -3387,19 +3545,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3387
3545
|
const close = async () => {
|
|
3388
3546
|
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3389
3547
|
if (codeDraft) {
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3548
|
+
try {
|
|
3549
|
+
await tMagicMessageBox.confirm("您有代码修改未保存,是否保存后再关闭?", "提示", {
|
|
3550
|
+
confirmButtonText: "保存并关闭",
|
|
3551
|
+
cancelButtonText: "直接关闭",
|
|
3552
|
+
type: "warning",
|
|
3553
|
+
distinguishCancelAndClose: true
|
|
3554
|
+
});
|
|
3396
3555
|
saveAndClose();
|
|
3397
|
-
}
|
|
3556
|
+
} catch (action) {
|
|
3398
3557
|
if (action === "cancel") {
|
|
3399
3558
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3400
3559
|
emit("close");
|
|
3401
3560
|
}
|
|
3402
|
-
}
|
|
3561
|
+
}
|
|
3403
3562
|
} else {
|
|
3404
3563
|
emit("close");
|
|
3405
3564
|
}
|
|
@@ -3410,11 +3569,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3410
3569
|
codeEditor.value.focus();
|
|
3411
3570
|
}
|
|
3412
3571
|
};
|
|
3572
|
+
expose({
|
|
3573
|
+
saveAndClose,
|
|
3574
|
+
close
|
|
3575
|
+
});
|
|
3413
3576
|
return (_ctx, _cache) => {
|
|
3414
3577
|
return openBlock(), createElementBlock("div", {
|
|
3415
3578
|
class: normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3416
3579
|
}, [
|
|
3417
|
-
createVNode(_sfc_main$
|
|
3580
|
+
createVNode(_sfc_main$s, {
|
|
3418
3581
|
ref_key: "codeEditor",
|
|
3419
3582
|
ref: codeEditor,
|
|
3420
3583
|
class: "m-editor-container",
|
|
@@ -3430,7 +3593,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3430
3593
|
onClick: toggleFullScreen
|
|
3431
3594
|
}, {
|
|
3432
3595
|
default: withCtx(() => [
|
|
3433
|
-
createTextVNode(toDisplayString(isFullScreen.value ? "
|
|
3596
|
+
createTextVNode(toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3434
3597
|
]),
|
|
3435
3598
|
_: 1
|
|
3436
3599
|
}),
|
|
@@ -3461,7 +3624,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3461
3624
|
onClick: toggleFullScreen
|
|
3462
3625
|
}, {
|
|
3463
3626
|
default: withCtx(() => [
|
|
3464
|
-
createTextVNode(toDisplayString(isFullScreen.value ? "
|
|
3627
|
+
createTextVNode(toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3465
3628
|
]),
|
|
3466
3629
|
_: 1
|
|
3467
3630
|
}),
|
|
@@ -3482,9 +3645,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3482
3645
|
});
|
|
3483
3646
|
|
|
3484
3647
|
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3485
|
-
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "
|
|
3648
|
+
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
3486
3649
|
const _hoisted_3$1 = { class: "code-name-wrapper" };
|
|
3487
|
-
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "
|
|
3650
|
+
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
3488
3651
|
const __default__$f = defineComponent({
|
|
3489
3652
|
name: "MEditorFunctionEditor"
|
|
3490
3653
|
});
|
|
@@ -3499,27 +3662,26 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3499
3662
|
codeOptions: null,
|
|
3500
3663
|
paramsColConfig: null
|
|
3501
3664
|
},
|
|
3502
|
-
|
|
3503
|
-
setup(__props, { emit }) {
|
|
3665
|
+
setup(__props, { expose }) {
|
|
3504
3666
|
const props = __props;
|
|
3505
3667
|
const defaultParamColConfig = {
|
|
3506
3668
|
type: "row",
|
|
3507
|
-
label: "
|
|
3669
|
+
label: "参数类型",
|
|
3508
3670
|
items: [
|
|
3509
3671
|
{
|
|
3510
|
-
text: "
|
|
3672
|
+
text: "参数类型",
|
|
3511
3673
|
labelWidth: "70px",
|
|
3512
3674
|
type: "select",
|
|
3513
3675
|
name: "type",
|
|
3514
3676
|
options: [
|
|
3515
3677
|
{
|
|
3516
|
-
text: "
|
|
3517
|
-
label: "
|
|
3678
|
+
text: "数字",
|
|
3679
|
+
label: "数字",
|
|
3518
3680
|
value: "number"
|
|
3519
3681
|
},
|
|
3520
3682
|
{
|
|
3521
|
-
text: "
|
|
3522
|
-
label: "
|
|
3683
|
+
text: "字符串",
|
|
3684
|
+
label: "字符串",
|
|
3523
3685
|
value: "text"
|
|
3524
3686
|
}
|
|
3525
3687
|
]
|
|
@@ -3537,13 +3699,13 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3537
3699
|
items: [
|
|
3538
3700
|
{
|
|
3539
3701
|
type: "text",
|
|
3540
|
-
label: "
|
|
3702
|
+
label: "参数名",
|
|
3541
3703
|
name: "name",
|
|
3542
3704
|
width: 200
|
|
3543
3705
|
},
|
|
3544
3706
|
{
|
|
3545
3707
|
type: "text",
|
|
3546
|
-
label: "
|
|
3708
|
+
label: "参数注释",
|
|
3547
3709
|
name: "tip",
|
|
3548
3710
|
width: 200
|
|
3549
3711
|
},
|
|
@@ -3554,11 +3716,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3554
3716
|
const codeName = ref("");
|
|
3555
3717
|
const codeContent = ref("");
|
|
3556
3718
|
const evalRes = ref(true);
|
|
3557
|
-
provide("mForm", {
|
|
3558
|
-
$emit: emit,
|
|
3559
|
-
setField: () => {
|
|
3560
|
-
}
|
|
3561
|
-
});
|
|
3562
3719
|
const tableModel = ref();
|
|
3563
3720
|
watchEffect(() => {
|
|
3564
3721
|
codeName.value = props.name;
|
|
@@ -3592,7 +3749,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3592
3749
|
content: codeValue2,
|
|
3593
3750
|
params: tableModel.value?.params || []
|
|
3594
3751
|
});
|
|
3595
|
-
tMagicMessage.success("
|
|
3752
|
+
tMagicMessage.success("代码成功保存到本地");
|
|
3596
3753
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3597
3754
|
}
|
|
3598
3755
|
};
|
|
@@ -3605,6 +3762,10 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3605
3762
|
const close = () => {
|
|
3606
3763
|
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3607
3764
|
};
|
|
3765
|
+
const codeDraftEditor = ref();
|
|
3766
|
+
expose({
|
|
3767
|
+
codeDraftEditor
|
|
3768
|
+
});
|
|
3608
3769
|
return (_ctx, _cache) => {
|
|
3609
3770
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
3610
3771
|
return openBlock(), createBlock(unref(TMagicCard), { shadow: "never" }, {
|
|
@@ -3633,6 +3794,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3633
3794
|
]),
|
|
3634
3795
|
default: withCtx(() => [
|
|
3635
3796
|
createVNode(_sfc_main$h, {
|
|
3797
|
+
ref_key: "codeDraftEditor",
|
|
3798
|
+
ref: codeDraftEditor,
|
|
3636
3799
|
id: __props.id,
|
|
3637
3800
|
content: codeContent.value,
|
|
3638
3801
|
editable: __props.editable,
|
|
@@ -3693,19 +3856,24 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3693
3856
|
});
|
|
3694
3857
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3695
3858
|
});
|
|
3859
|
+
const functionEditor = ref();
|
|
3860
|
+
const handleClose = async () => {
|
|
3861
|
+
await functionEditor.value?.codeDraftEditor?.close();
|
|
3862
|
+
};
|
|
3696
3863
|
return (_ctx, _cache) => {
|
|
3697
3864
|
return openBlock(), createBlock(unref(TMagicDrawer), {
|
|
3698
3865
|
class: "code-editor-dialog",
|
|
3699
3866
|
"model-value": true,
|
|
3700
3867
|
title: currentTitle.value,
|
|
3701
|
-
"close-on-press-escape":
|
|
3868
|
+
"close-on-press-escape": true,
|
|
3702
3869
|
"append-to-body": true,
|
|
3703
3870
|
"show-close": false,
|
|
3704
|
-
"close-on-click-modal":
|
|
3705
|
-
size: unref(size)
|
|
3871
|
+
"close-on-click-modal": true,
|
|
3872
|
+
size: unref(size),
|
|
3873
|
+
"before-close": handleClose
|
|
3706
3874
|
}, {
|
|
3707
3875
|
default: withCtx(() => [
|
|
3708
|
-
createVNode(_sfc_main$
|
|
3876
|
+
createVNode(_sfc_main$q, {
|
|
3709
3877
|
left: left.value,
|
|
3710
3878
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3711
3879
|
"min-left": 45,
|
|
@@ -3716,6 +3884,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3716
3884
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: unref(id) }),
|
|
3717
3885
|
codeConfig.value ? (openBlock(), createBlock(_sfc_main$g, {
|
|
3718
3886
|
key: 0,
|
|
3887
|
+
ref_key: "functionEditor",
|
|
3888
|
+
ref: functionEditor,
|
|
3719
3889
|
id: unref(id),
|
|
3720
3890
|
name: codeConfig.value.name,
|
|
3721
3891
|
content: codeConfig.value.content,
|
|
@@ -3735,13 +3905,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3735
3905
|
}
|
|
3736
3906
|
});
|
|
3737
3907
|
|
|
3738
|
-
const _hoisted_1$6 = { class: "
|
|
3739
|
-
const _hoisted_2$2 = /* @__PURE__ */ createTextVNode("
|
|
3908
|
+
const _hoisted_1$6 = { class: "search-wrapper" };
|
|
3909
|
+
const _hoisted_2$2 = /* @__PURE__ */ createTextVNode("新增");
|
|
3740
3910
|
const _hoisted_3 = ["id"];
|
|
3741
3911
|
const _hoisted_4 = { class: "list-item" };
|
|
3742
|
-
const _hoisted_5 = {
|
|
3743
|
-
|
|
3744
|
-
key: 0,
|
|
3912
|
+
const _hoisted_5 = {
|
|
3913
|
+
key: 2,
|
|
3745
3914
|
class: "right-tool"
|
|
3746
3915
|
};
|
|
3747
3916
|
const __default__$d = defineComponent({
|
|
@@ -3757,28 +3926,32 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3757
3926
|
const props = __props;
|
|
3758
3927
|
const { codeBlockService, depService, editorService } = inject("services") || {};
|
|
3759
3928
|
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]) => ({
|
|
3929
|
+
() => Object.values(depService?.targets["code-block"] || {}).map((target) => {
|
|
3930
|
+
const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
|
|
3766
3931
|
name: dep.name,
|
|
3767
3932
|
type: "node",
|
|
3768
3933
|
id,
|
|
3769
3934
|
children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
|
|
3770
|
-
}))
|
|
3771
|
-
|
|
3935
|
+
}));
|
|
3936
|
+
return {
|
|
3937
|
+
id: target.id,
|
|
3938
|
+
name: target.name,
|
|
3939
|
+
type: "code",
|
|
3940
|
+
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
3941
|
+
children: compNodes
|
|
3942
|
+
};
|
|
3943
|
+
})
|
|
3772
3944
|
);
|
|
3945
|
+
const expandedKeys = computed(() => codeList.value.map((item) => item.id));
|
|
3773
3946
|
const editable = computed(() => codeBlockService?.getEditStatus());
|
|
3774
3947
|
const isShowCodeBlockEditor = computed(() => codeBlockService?.getCodeEditorShowStatus() || false);
|
|
3775
3948
|
const createCodeBlock = async () => {
|
|
3776
3949
|
if (!codeBlockService) {
|
|
3777
|
-
tMagicMessage.error("
|
|
3950
|
+
tMagicMessage.error("新增代码块失败");
|
|
3778
3951
|
return;
|
|
3779
3952
|
}
|
|
3780
3953
|
const codeConfig = {
|
|
3781
|
-
name: "
|
|
3954
|
+
name: "代码块",
|
|
3782
3955
|
content: `({app, params}) => {
|
|
3783
3956
|
// place your code here
|
|
3784
3957
|
}`,
|
|
@@ -3801,7 +3974,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3801
3974
|
if (typeof props.customError === "function") {
|
|
3802
3975
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3803
3976
|
} else {
|
|
3804
|
-
tMagicMessage.error("
|
|
3977
|
+
tMagicMessage.error("代码块删除失败");
|
|
3805
3978
|
}
|
|
3806
3979
|
}
|
|
3807
3980
|
};
|
|
@@ -3828,11 +4001,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3828
4001
|
}
|
|
3829
4002
|
};
|
|
3830
4003
|
return (_ctx, _cache) => {
|
|
3831
|
-
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list" }, {
|
|
4004
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
3832
4005
|
default: withCtx(() => [
|
|
3833
4006
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3834
4007
|
createElementVNode("div", _hoisted_1$6, [
|
|
3835
|
-
createVNode(_sfc_main$
|
|
4008
|
+
createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
3836
4009
|
unref(editable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
3837
4010
|
key: 0,
|
|
3838
4011
|
class: "create-code-button",
|
|
@@ -3852,8 +4025,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3852
4025
|
ref: tree,
|
|
3853
4026
|
class: "magic-editor-layer-tree",
|
|
3854
4027
|
"node-key": "id",
|
|
3855
|
-
"empty-text": "
|
|
3856
|
-
"default-
|
|
4028
|
+
"empty-text": "暂无代码块",
|
|
4029
|
+
"default-expanded-keys": unref(expandedKeys),
|
|
3857
4030
|
"expand-on-click-node": false,
|
|
3858
4031
|
data: unref(codeList),
|
|
3859
4032
|
"highlight-current": true,
|
|
@@ -3866,15 +4039,25 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3866
4039
|
class: "list-container"
|
|
3867
4040
|
}, [
|
|
3868
4041
|
createElementVNode("div", _hoisted_4, [
|
|
3869
|
-
|
|
3870
|
-
|
|
4042
|
+
data.type === "code" ? (openBlock(), createBlock(CodeIcon, {
|
|
4043
|
+
key: 0,
|
|
4044
|
+
class: "codeIcon"
|
|
4045
|
+
})) : createCommentVNode("", true),
|
|
4046
|
+
data.type === "node" ? (openBlock(), createBlock(AppManageIcon, {
|
|
4047
|
+
key: 1,
|
|
4048
|
+
class: "compIcon"
|
|
4049
|
+
})) : createCommentVNode("", true),
|
|
4050
|
+
createElementVNode("span", {
|
|
4051
|
+
class: normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4052
|
+
}, toDisplayString(data.name) + " (" + toDisplayString(data.id) + ")", 3),
|
|
4053
|
+
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
3871
4054
|
createVNode(unref(TMagicTooltip), {
|
|
3872
4055
|
effect: "dark",
|
|
3873
|
-
content: unref(editable) ? "
|
|
4056
|
+
content: unref(editable) ? "编辑" : "查看",
|
|
3874
4057
|
placement: "bottom"
|
|
3875
4058
|
}, {
|
|
3876
4059
|
default: withCtx(() => [
|
|
3877
|
-
createVNode(_sfc_main$
|
|
4060
|
+
createVNode(_sfc_main$w, {
|
|
3878
4061
|
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
3879
4062
|
class: "edit-icon",
|
|
3880
4063
|
onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3885,11 +4068,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3885
4068
|
unref(editable) ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3886
4069
|
key: 0,
|
|
3887
4070
|
effect: "dark",
|
|
3888
|
-
content: "
|
|
4071
|
+
content: "删除",
|
|
3889
4072
|
placement: "bottom"
|
|
3890
4073
|
}, {
|
|
3891
4074
|
default: withCtx(() => [
|
|
3892
|
-
createVNode(_sfc_main$
|
|
4075
|
+
createVNode(_sfc_main$w, {
|
|
3893
4076
|
icon: unref(Close),
|
|
3894
4077
|
class: "edit-icon",
|
|
3895
4078
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3906,7 +4089,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3906
4089
|
], 8, _hoisted_3)
|
|
3907
4090
|
]),
|
|
3908
4091
|
_: 3
|
|
3909
|
-
}, 8, ["data"]),
|
|
4092
|
+
}, 8, ["default-expanded-keys", "data"]),
|
|
3910
4093
|
unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$f, {
|
|
3911
4094
|
key: 0,
|
|
3912
4095
|
paramsColConfig: __props.paramsColConfig
|
|
@@ -4004,7 +4187,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4004
4187
|
"model-value": unref(collapseValue)
|
|
4005
4188
|
}, {
|
|
4006
4189
|
default: withCtx(() => [
|
|
4007
|
-
createVNode(_sfc_main$
|
|
4190
|
+
createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4008
4191
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (group, index) => {
|
|
4009
4192
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
4010
4193
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
@@ -4012,7 +4195,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4012
4195
|
name: `${index}`
|
|
4013
4196
|
}, {
|
|
4014
4197
|
title: withCtx(() => [
|
|
4015
|
-
createVNode(_sfc_main$
|
|
4198
|
+
createVNode(_sfc_main$w, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
4016
4199
|
createTextVNode(toDisplayString(group.title), 1)
|
|
4017
4200
|
]),
|
|
4018
4201
|
default: withCtx(() => [
|
|
@@ -4027,7 +4210,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4027
4210
|
onDrag: dragHandler
|
|
4028
4211
|
}, [
|
|
4029
4212
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4030
|
-
createVNode(_sfc_main$
|
|
4213
|
+
createVNode(_sfc_main$w, {
|
|
4031
4214
|
icon: item.icon
|
|
4032
4215
|
}, null, 8, ["icon"]),
|
|
4033
4216
|
createVNode(unref(TMagicTooltip), {
|
|
@@ -4150,7 +4333,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4150
4333
|
}, [
|
|
4151
4334
|
createElementVNode("div", null, [
|
|
4152
4335
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
|
|
4153
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4336
|
+
return openBlock(), createBlock(_sfc_main$n, {
|
|
4154
4337
|
"event-type": "mouseup",
|
|
4155
4338
|
data: item,
|
|
4156
4339
|
key: index,
|
|
@@ -4208,7 +4391,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
4208
4391
|
if (node.value?.type === "tabs") {
|
|
4209
4392
|
return [
|
|
4210
4393
|
{
|
|
4211
|
-
text: "
|
|
4394
|
+
text: "标签页",
|
|
4212
4395
|
type: "button",
|
|
4213
4396
|
icon: Files,
|
|
4214
4397
|
handler: () => {
|
|
@@ -4238,14 +4421,14 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
4238
4421
|
const menuData = computed(() => [
|
|
4239
4422
|
{
|
|
4240
4423
|
type: "button",
|
|
4241
|
-
text: "
|
|
4424
|
+
text: "新增",
|
|
4242
4425
|
icon: markRaw(Plus),
|
|
4243
4426
|
display: () => node.value?.items,
|
|
4244
4427
|
items: getSubMenuData.value
|
|
4245
4428
|
},
|
|
4246
4429
|
{
|
|
4247
4430
|
type: "button",
|
|
4248
|
-
text: "
|
|
4431
|
+
text: "复制",
|
|
4249
4432
|
icon: markRaw(CopyDocument),
|
|
4250
4433
|
display: () => !isRoot.value,
|
|
4251
4434
|
handler: () => {
|
|
@@ -4254,7 +4437,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
4254
4437
|
},
|
|
4255
4438
|
{
|
|
4256
4439
|
type: "button",
|
|
4257
|
-
text: "
|
|
4440
|
+
text: "删除",
|
|
4258
4441
|
icon: markRaw(Delete),
|
|
4259
4442
|
display: () => !isRoot.value && !isPage.value,
|
|
4260
4443
|
handler: () => {
|
|
@@ -4318,7 +4501,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4318
4501
|
const highlightNode = computed(() => editorService?.get("highlightNode"));
|
|
4319
4502
|
const select = async (data) => {
|
|
4320
4503
|
if (!data.id) {
|
|
4321
|
-
throw new Error("
|
|
4504
|
+
throw new Error("没有id");
|
|
4322
4505
|
}
|
|
4323
4506
|
await editorService?.select(data);
|
|
4324
4507
|
editorService?.get("stage")?.select(data.id);
|
|
@@ -4329,7 +4512,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4329
4512
|
};
|
|
4330
4513
|
const highlight = (data) => {
|
|
4331
4514
|
if (!data?.id) {
|
|
4332
|
-
throw new Error("
|
|
4515
|
+
throw new Error("没有id");
|
|
4333
4516
|
}
|
|
4334
4517
|
editorService?.highlight(data);
|
|
4335
4518
|
editorService?.get("stage")?.highlight(data.id);
|
|
@@ -4342,7 +4525,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4342
4525
|
return false;
|
|
4343
4526
|
if (ingType === NodeType.PAGE && data.type !== NodeType.PAGE)
|
|
4344
4527
|
return false;
|
|
4345
|
-
if (!data
|
|
4528
|
+
if (!data?.type)
|
|
4346
4529
|
return false;
|
|
4347
4530
|
if (["prev", "next"].includes(type))
|
|
4348
4531
|
return true;
|
|
@@ -4481,14 +4664,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4481
4664
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4482
4665
|
default: withCtx(() => [
|
|
4483
4666
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4484
|
-
createVNode(_sfc_main$
|
|
4667
|
+
createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4485
4668
|
unref(values).length ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
4486
4669
|
key: 0,
|
|
4487
4670
|
class: "magic-editor-layer-tree",
|
|
4488
4671
|
ref_key: "tree",
|
|
4489
4672
|
ref: tree,
|
|
4490
4673
|
"node-key": "id",
|
|
4491
|
-
"empty-text": "
|
|
4674
|
+
"empty-text": "页面空荡荡的",
|
|
4492
4675
|
draggable: "",
|
|
4493
4676
|
"default-expanded-keys": expandedKeys.value,
|
|
4494
4677
|
"default-checked-keys": checkedKeys.value,
|
|
@@ -4550,12 +4733,13 @@ const __default__$8 = defineComponent({
|
|
|
4550
4733
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
4551
4734
|
...__default__$8,
|
|
4552
4735
|
props: {
|
|
4553
|
-
data: { default: () => ({ type: "tabs", status: "
|
|
4736
|
+
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block"] }) },
|
|
4554
4737
|
layerContentMenu: null
|
|
4555
4738
|
},
|
|
4556
4739
|
setup(__props, { expose }) {
|
|
4557
4740
|
const props = __props;
|
|
4558
|
-
const
|
|
4741
|
+
const tabPaneComponent = getConfig$1("components").tabPane;
|
|
4742
|
+
const tabsComponent = getConfig$1("components").tabs;
|
|
4559
4743
|
const activeTabName = ref(props.data?.status);
|
|
4560
4744
|
const getItemConfig = (data) => {
|
|
4561
4745
|
const map = {
|
|
@@ -4563,7 +4747,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4563
4747
|
$key: "component-list",
|
|
4564
4748
|
type: "component",
|
|
4565
4749
|
icon: Coin,
|
|
4566
|
-
text: "
|
|
4750
|
+
text: "组件",
|
|
4567
4751
|
component: _sfc_main$d,
|
|
4568
4752
|
slots: {}
|
|
4569
4753
|
},
|
|
@@ -4571,7 +4755,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4571
4755
|
$key: "layer",
|
|
4572
4756
|
type: "component",
|
|
4573
4757
|
icon: Files,
|
|
4574
|
-
text: "
|
|
4758
|
+
text: "已选组件",
|
|
4575
4759
|
props: {
|
|
4576
4760
|
layerContentMenu: props.layerContentMenu
|
|
4577
4761
|
},
|
|
@@ -4582,7 +4766,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4582
4766
|
$key: "code-block",
|
|
4583
4767
|
type: "component",
|
|
4584
4768
|
icon: EditPen,
|
|
4585
|
-
text: "
|
|
4769
|
+
text: "代码编辑",
|
|
4586
4770
|
component: _sfc_main$e,
|
|
4587
4771
|
slots: {}
|
|
4588
4772
|
}
|
|
@@ -4600,25 +4784,22 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4600
4784
|
activeTabName
|
|
4601
4785
|
});
|
|
4602
4786
|
return (_ctx, _cache) => {
|
|
4603
|
-
return __props.data.type === "tabs" && __props.data.items.length ? (openBlock(), createBlock(unref(
|
|
4787
|
+
return __props.data.type === "tabs" && __props.data.items.length ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabsComponent).component), mergeProps({
|
|
4604
4788
|
key: 0,
|
|
4605
|
-
class: "m-editor-sidebar",
|
|
4606
4789
|
modelValue: activeTabName.value,
|
|
4607
4790
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
}, {
|
|
4791
|
+
class: "m-editor-sidebar tmagic-design-tabs"
|
|
4792
|
+
}, unref(tabsComponent).props({ type: "card", tabPosition: "left" })), {
|
|
4611
4793
|
default: withCtx(() => [
|
|
4612
4794
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(sideBarItems), (config, index) => {
|
|
4613
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(
|
|
4614
|
-
key: config.$key || index
|
|
4615
|
-
|
|
4616
|
-
}, {
|
|
4795
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent).component), mergeProps(unref(tabPaneComponent).props({ name: config.text }), {
|
|
4796
|
+
key: config.$key || index
|
|
4797
|
+
}), {
|
|
4617
4798
|
label: withCtx(() => [
|
|
4618
4799
|
(openBlock(), createElementBlock("div", {
|
|
4619
4800
|
key: config.text
|
|
4620
4801
|
}, [
|
|
4621
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
4802
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$w, {
|
|
4622
4803
|
key: 0,
|
|
4623
4804
|
icon: config.icon
|
|
4624
4805
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -4693,11 +4874,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4693
4874
|
]), 1040)) : createCommentVNode("", true)
|
|
4694
4875
|
]),
|
|
4695
4876
|
_: 2
|
|
4696
|
-
},
|
|
4877
|
+
}, 1040);
|
|
4697
4878
|
}), 128))
|
|
4698
4879
|
]),
|
|
4699
4880
|
_: 3
|
|
4700
|
-
},
|
|
4881
|
+
}, 16, ["modelValue"])) : createCommentVNode("", true);
|
|
4701
4882
|
};
|
|
4702
4883
|
}
|
|
4703
4884
|
});
|
|
@@ -4820,7 +5001,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4820
5001
|
return;
|
|
4821
5002
|
const root = toRaw(editorService.get("root"));
|
|
4822
5003
|
if (!root)
|
|
4823
|
-
throw new Error("root
|
|
5004
|
+
throw new Error("root 不能为空");
|
|
4824
5005
|
const pageConfig = {
|
|
4825
5006
|
type: NodeType.PAGE,
|
|
4826
5007
|
name: generatePageNameByApp(root)
|
|
@@ -4839,14 +5020,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4839
5020
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4840
5021
|
onClick: addPage
|
|
4841
5022
|
}, [
|
|
4842
|
-
createVNode(_sfc_main$
|
|
5023
|
+
createVNode(_sfc_main$w, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
4843
5024
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
|
|
4844
5025
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
4845
5026
|
key: 2,
|
|
4846
5027
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4847
5028
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4848
5029
|
}, [
|
|
4849
|
-
createVNode(_sfc_main$
|
|
5030
|
+
createVNode(_sfc_main$w, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
4850
5031
|
])) : createCommentVNode("", true),
|
|
4851
5032
|
unref(pageLength) ? (openBlock(), createElementBlock("div", {
|
|
4852
5033
|
key: 3,
|
|
@@ -4862,7 +5043,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4862
5043
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4863
5044
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4864
5045
|
}, [
|
|
4865
|
-
createVNode(_sfc_main$
|
|
5046
|
+
createVNode(_sfc_main$w, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
4866
5047
|
])) : createCommentVNode("", true)
|
|
4867
5048
|
], 512);
|
|
4868
5049
|
};
|
|
@@ -4934,18 +5115,18 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4934
5115
|
default: withCtx(() => [
|
|
4935
5116
|
createElementVNode("div", null, [
|
|
4936
5117
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4937
|
-
createVNode(_sfc_main$
|
|
5118
|
+
createVNode(_sfc_main$n, {
|
|
4938
5119
|
data: {
|
|
4939
5120
|
type: "button",
|
|
4940
|
-
text: "
|
|
5121
|
+
text: "复制",
|
|
4941
5122
|
icon: unref(DocumentCopy),
|
|
4942
5123
|
handler: () => copy(item)
|
|
4943
5124
|
}
|
|
4944
5125
|
}, null, 8, ["data"]),
|
|
4945
|
-
createVNode(_sfc_main$
|
|
5126
|
+
createVNode(_sfc_main$n, {
|
|
4946
5127
|
data: {
|
|
4947
5128
|
type: "button",
|
|
4948
|
-
text: "
|
|
5129
|
+
text: "删除",
|
|
4949
5130
|
icon: unref(Delete),
|
|
4950
5131
|
handler: () => remove(item)
|
|
4951
5132
|
}
|
|
@@ -5310,7 +5491,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5310
5491
|
const menuData = computed(() => [
|
|
5311
5492
|
{
|
|
5312
5493
|
type: "button",
|
|
5313
|
-
text: "
|
|
5494
|
+
text: "水平居中",
|
|
5314
5495
|
display: () => canCenter.value,
|
|
5315
5496
|
handler: () => {
|
|
5316
5497
|
if (!nodes.value)
|
|
@@ -5320,7 +5501,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5320
5501
|
},
|
|
5321
5502
|
{
|
|
5322
5503
|
type: "button",
|
|
5323
|
-
text: "
|
|
5504
|
+
text: "复制",
|
|
5324
5505
|
icon: markRaw(CopyDocument),
|
|
5325
5506
|
handler: () => {
|
|
5326
5507
|
nodes.value && editorService?.copy(nodes.value);
|
|
@@ -5329,7 +5510,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5329
5510
|
},
|
|
5330
5511
|
{
|
|
5331
5512
|
type: "button",
|
|
5332
|
-
text: "
|
|
5513
|
+
text: "粘贴",
|
|
5333
5514
|
icon: markRaw(DocumentCopy),
|
|
5334
5515
|
display: () => canPaste.value,
|
|
5335
5516
|
handler: () => {
|
|
@@ -5353,7 +5534,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5353
5534
|
},
|
|
5354
5535
|
{
|
|
5355
5536
|
type: "button",
|
|
5356
|
-
text: "
|
|
5537
|
+
text: "上移一层",
|
|
5357
5538
|
icon: markRaw(Top),
|
|
5358
5539
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5359
5540
|
handler: () => {
|
|
@@ -5362,7 +5543,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5362
5543
|
},
|
|
5363
5544
|
{
|
|
5364
5545
|
type: "button",
|
|
5365
|
-
text: "
|
|
5546
|
+
text: "下移一层",
|
|
5366
5547
|
icon: markRaw(Bottom),
|
|
5367
5548
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5368
5549
|
handler: () => {
|
|
@@ -5371,7 +5552,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5371
5552
|
},
|
|
5372
5553
|
{
|
|
5373
5554
|
type: "button",
|
|
5374
|
-
text: "
|
|
5555
|
+
text: "置顶",
|
|
5375
5556
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5376
5557
|
handler: () => {
|
|
5377
5558
|
editorService?.moveLayer(LayerOffset.TOP);
|
|
@@ -5379,7 +5560,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5379
5560
|
},
|
|
5380
5561
|
{
|
|
5381
5562
|
type: "button",
|
|
5382
|
-
text: "
|
|
5563
|
+
text: "置底",
|
|
5383
5564
|
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
5384
5565
|
handler: () => {
|
|
5385
5566
|
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
@@ -5392,7 +5573,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5392
5573
|
},
|
|
5393
5574
|
{
|
|
5394
5575
|
type: "button",
|
|
5395
|
-
text: "
|
|
5576
|
+
text: "删除",
|
|
5396
5577
|
icon: Delete,
|
|
5397
5578
|
display: () => !isPage(node.value),
|
|
5398
5579
|
handler: () => {
|
|
@@ -5405,7 +5586,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5405
5586
|
},
|
|
5406
5587
|
{
|
|
5407
5588
|
type: "button",
|
|
5408
|
-
text: "
|
|
5589
|
+
text: "清空参考线",
|
|
5409
5590
|
handler: () => {
|
|
5410
5591
|
editorService?.get("stage")?.clearGuides();
|
|
5411
5592
|
}
|
|
@@ -5765,14 +5946,30 @@ class CodeBlock extends BaseService {
|
|
|
5765
5946
|
"deleteCodeDslByIds"
|
|
5766
5947
|
]);
|
|
5767
5948
|
}
|
|
5949
|
+
/**
|
|
5950
|
+
* 设置活动的代码块dsl数据源
|
|
5951
|
+
* @param {CodeBlockDSL} codeDsl 代码DSL
|
|
5952
|
+
* @returns {void}
|
|
5953
|
+
*/
|
|
5768
5954
|
async setCodeDsl(codeDsl2) {
|
|
5769
5955
|
this.state.codeDsl = codeDsl2;
|
|
5770
5956
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
5771
5957
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
5772
5958
|
}
|
|
5959
|
+
/**
|
|
5960
|
+
* 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
|
|
5961
|
+
* 方法要支持钩子添加扩展,会被重写为异步方法,因此这里显示写为异步以提醒调用者需以异步形式调用
|
|
5962
|
+
* @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
|
|
5963
|
+
* @returns {CodeBlockDSL | null}
|
|
5964
|
+
*/
|
|
5773
5965
|
getCodeDsl() {
|
|
5774
5966
|
return this.state.codeDsl;
|
|
5775
5967
|
}
|
|
5968
|
+
/**
|
|
5969
|
+
* 根据代码块id获取代码块内容
|
|
5970
|
+
* @param {Id} id 代码块id
|
|
5971
|
+
* @returns {CodeBlockContent | null}
|
|
5972
|
+
*/
|
|
5776
5973
|
getCodeContentById(id2) {
|
|
5777
5974
|
if (!id2)
|
|
5778
5975
|
return null;
|
|
@@ -5781,10 +5978,16 @@ class CodeBlock extends BaseService {
|
|
|
5781
5978
|
return null;
|
|
5782
5979
|
return totalCodeDsl[id2] ?? null;
|
|
5783
5980
|
}
|
|
5981
|
+
/**
|
|
5982
|
+
* 设置代码块ID和代码内容到源dsl
|
|
5983
|
+
* @param {Id} id 代码块id
|
|
5984
|
+
* @param {CodeBlockContent} codeConfig 代码块内容配置信息
|
|
5985
|
+
* @returns {void}
|
|
5986
|
+
*/
|
|
5784
5987
|
async setCodeDslById(id, codeConfig) {
|
|
5785
5988
|
const codeDsl = this.getCodeDsl();
|
|
5786
5989
|
if (!codeDsl) {
|
|
5787
|
-
throw new Error("dsl
|
|
5990
|
+
throw new Error("dsl中没有codeBlocks");
|
|
5788
5991
|
}
|
|
5789
5992
|
const codeConfigProcessed = codeConfig;
|
|
5790
5993
|
if (codeConfig.content) {
|
|
@@ -5797,60 +6000,133 @@ class CodeBlock extends BaseService {
|
|
|
5797
6000
|
};
|
|
5798
6001
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
5799
6002
|
}
|
|
6003
|
+
/**
|
|
6004
|
+
* 根据代码块id数组获取代码dsl
|
|
6005
|
+
* @param {string[]} ids 代码块id数组
|
|
6006
|
+
* @returns {CodeBlockDSL}
|
|
6007
|
+
*/
|
|
5800
6008
|
getCodeDslByIds(ids) {
|
|
5801
6009
|
const codeDsl2 = this.getCodeDsl();
|
|
5802
6010
|
return pick(codeDsl2, ids);
|
|
5803
6011
|
}
|
|
6012
|
+
/**
|
|
6013
|
+
* 设置代码编辑面板展示状态
|
|
6014
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6015
|
+
* @returns {void}
|
|
6016
|
+
*/
|
|
5804
6017
|
async setCodeEditorShowStatus(status) {
|
|
5805
6018
|
this.state.isShowCodeEditor = status;
|
|
5806
6019
|
}
|
|
6020
|
+
/**
|
|
6021
|
+
* 获取代码编辑面板展示状态
|
|
6022
|
+
* @returns {boolean} 是否展示代码编辑面板
|
|
6023
|
+
*/
|
|
5807
6024
|
getCodeEditorShowStatus() {
|
|
5808
6025
|
return this.state.isShowCodeEditor;
|
|
5809
6026
|
}
|
|
6027
|
+
/**
|
|
6028
|
+
* 设置代码编辑面板展示状态及展示内容
|
|
6029
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6030
|
+
* @param {Id} id 代码块id
|
|
6031
|
+
* @returns {void}
|
|
6032
|
+
*/
|
|
5810
6033
|
setCodeEditorContent(status, id2) {
|
|
5811
6034
|
if (!id2)
|
|
5812
6035
|
return;
|
|
5813
6036
|
this.setId(id2);
|
|
5814
6037
|
this.state.isShowCodeEditor = status;
|
|
5815
6038
|
}
|
|
6039
|
+
/**
|
|
6040
|
+
* 获取当前选中的代码块内容
|
|
6041
|
+
* @returns {CodeBlockContent | null}
|
|
6042
|
+
*/
|
|
5816
6043
|
getCurrentDsl() {
|
|
5817
6044
|
return this.getCodeContentById(this.state.id);
|
|
5818
6045
|
}
|
|
6046
|
+
/**
|
|
6047
|
+
* 获取编辑状态
|
|
6048
|
+
* @returns {boolean} 是否可编辑
|
|
6049
|
+
*/
|
|
5819
6050
|
getEditStatus() {
|
|
5820
6051
|
return this.state.editable;
|
|
5821
6052
|
}
|
|
6053
|
+
/**
|
|
6054
|
+
* 设置编辑状态
|
|
6055
|
+
* @param {boolean} status 是否可编辑
|
|
6056
|
+
* @returns {void}
|
|
6057
|
+
*/
|
|
5822
6058
|
async setEditStatus(status) {
|
|
5823
6059
|
this.state.editable = status;
|
|
5824
6060
|
}
|
|
6061
|
+
/**
|
|
6062
|
+
* 设置当前选中的代码块ID
|
|
6063
|
+
* @param {Id} id 代码块id
|
|
6064
|
+
* @returns {void}
|
|
6065
|
+
*/
|
|
5825
6066
|
setId(id2) {
|
|
5826
6067
|
if (!id2)
|
|
5827
6068
|
return;
|
|
5828
6069
|
this.state.id = id2;
|
|
5829
6070
|
}
|
|
6071
|
+
/**
|
|
6072
|
+
* 获取当前选中的代码块ID
|
|
6073
|
+
* @returns {Id} id 代码块id
|
|
6074
|
+
*/
|
|
5830
6075
|
getId() {
|
|
5831
6076
|
return this.state.id;
|
|
5832
6077
|
}
|
|
6078
|
+
/**
|
|
6079
|
+
* 设置当前选中组件已关联绑定的代码块id数组
|
|
6080
|
+
* @param {string[]} ids 代码块id数组
|
|
6081
|
+
* @returns {void}
|
|
6082
|
+
*/
|
|
5833
6083
|
async setCombineIds(ids) {
|
|
5834
6084
|
this.state.combineIds = ids;
|
|
5835
6085
|
}
|
|
6086
|
+
/**
|
|
6087
|
+
* 获取当前选中组件已关联绑定的代码块id数组
|
|
6088
|
+
* @returns {string[]}
|
|
6089
|
+
*/
|
|
5836
6090
|
getCombineIds() {
|
|
5837
6091
|
return this.state.combineIds;
|
|
5838
6092
|
}
|
|
6093
|
+
/**
|
|
6094
|
+
* 获取不可删除列表
|
|
6095
|
+
* @returns {Id[]}
|
|
6096
|
+
*/
|
|
5839
6097
|
getUndeletableList() {
|
|
5840
6098
|
return this.state.undeletableList;
|
|
5841
6099
|
}
|
|
6100
|
+
/**
|
|
6101
|
+
* 设置不可删除列表:为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除)
|
|
6102
|
+
* @param {Id[]} codeIds 代码块id数组
|
|
6103
|
+
* @returns {void}
|
|
6104
|
+
*/
|
|
5842
6105
|
async setUndeleteableList(codeIds) {
|
|
5843
6106
|
this.state.undeletableList = codeIds;
|
|
5844
6107
|
}
|
|
6108
|
+
/**
|
|
6109
|
+
* 设置代码草稿
|
|
6110
|
+
*/
|
|
5845
6111
|
setCodeDraft(codeId, content) {
|
|
5846
6112
|
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
5847
6113
|
}
|
|
6114
|
+
/**
|
|
6115
|
+
* 获取代码草稿
|
|
6116
|
+
*/
|
|
5848
6117
|
getCodeDraft(codeId) {
|
|
5849
6118
|
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5850
6119
|
}
|
|
6120
|
+
/**
|
|
6121
|
+
* 删除代码草稿
|
|
6122
|
+
*/
|
|
5851
6123
|
removeCodeDraft(codeId) {
|
|
5852
6124
|
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5853
6125
|
}
|
|
6126
|
+
/**
|
|
6127
|
+
* 在dsl数据源中删除指定id的代码块
|
|
6128
|
+
* @param {Id[]} codeIds 需要删除的代码块id数组
|
|
6129
|
+
*/
|
|
5854
6130
|
async deleteCodeDslByIds(codeIds) {
|
|
5855
6131
|
const currentDsl = await this.getCodeDsl();
|
|
5856
6132
|
if (!currentDsl)
|
|
@@ -5860,6 +6136,10 @@ class CodeBlock extends BaseService {
|
|
|
5860
6136
|
this.emit("remove", id2);
|
|
5861
6137
|
});
|
|
5862
6138
|
}
|
|
6139
|
+
/**
|
|
6140
|
+
* 生成代码块唯一id
|
|
6141
|
+
* @returns {Id} 代码块唯一id
|
|
6142
|
+
*/
|
|
5863
6143
|
async getUniqueId() {
|
|
5864
6144
|
const newId = `code_${Math.random().toString(10).substring(2).substring(0, 4)}`;
|
|
5865
6145
|
const dsl = await this.getCodeDsl();
|
|
@@ -5891,6 +6171,9 @@ class ComponentList extends BaseService {
|
|
|
5891
6171
|
constructor() {
|
|
5892
6172
|
super([]);
|
|
5893
6173
|
}
|
|
6174
|
+
/**
|
|
6175
|
+
* @param componentGroupList 组件列表配置
|
|
6176
|
+
*/
|
|
5894
6177
|
setList(componentGroupList) {
|
|
5895
6178
|
this.state.list = componentGroupList;
|
|
5896
6179
|
}
|
|
@@ -5909,10 +6192,27 @@ class ComponentList extends BaseService {
|
|
|
5909
6192
|
const componentListService = new ComponentList();
|
|
5910
6193
|
|
|
5911
6194
|
class Target extends EventEmitter {
|
|
6195
|
+
/**
|
|
6196
|
+
* 如何识别目标
|
|
6197
|
+
*/
|
|
5912
6198
|
isTarget;
|
|
6199
|
+
/**
|
|
6200
|
+
* 目标id,不可重复
|
|
6201
|
+
* 例如目标是代码块,则为代码块id
|
|
6202
|
+
*/
|
|
5913
6203
|
id;
|
|
6204
|
+
/**
|
|
6205
|
+
* 目标名称,用于显示在依赖列表中
|
|
6206
|
+
*/
|
|
5914
6207
|
name;
|
|
6208
|
+
/**
|
|
6209
|
+
* 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type
|
|
6210
|
+
*/
|
|
5915
6211
|
type = "default";
|
|
6212
|
+
/**
|
|
6213
|
+
* 依赖详情
|
|
6214
|
+
* 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }
|
|
6215
|
+
*/
|
|
5916
6216
|
deps = reactive({});
|
|
5917
6217
|
constructor(options) {
|
|
5918
6218
|
super();
|
|
@@ -5923,6 +6223,11 @@ class Target extends EventEmitter {
|
|
|
5923
6223
|
this.type = options.type;
|
|
5924
6224
|
}
|
|
5925
6225
|
}
|
|
6226
|
+
/**
|
|
6227
|
+
* 更新依赖
|
|
6228
|
+
* @param node 节点配置
|
|
6229
|
+
* @param key 哪个key配置了这个目标的id
|
|
6230
|
+
*/
|
|
5926
6231
|
updateDep(node, key) {
|
|
5927
6232
|
const dep = this.deps[node.id] || {
|
|
5928
6233
|
name: node.name,
|
|
@@ -5937,6 +6242,12 @@ class Target extends EventEmitter {
|
|
|
5937
6242
|
}
|
|
5938
6243
|
this.emit("change");
|
|
5939
6244
|
}
|
|
6245
|
+
/**
|
|
6246
|
+
* 删除依赖
|
|
6247
|
+
* @param node 哪个节点的依赖需要移除,如果为空,则移除所有依赖
|
|
6248
|
+
* @param key 节点下哪个key需要移除,如果为空,则移除改节点下的所有依赖key
|
|
6249
|
+
* @returns void
|
|
6250
|
+
*/
|
|
5940
6251
|
removeDep(node, key) {
|
|
5941
6252
|
if (!node) {
|
|
5942
6253
|
Object.keys(this.deps).forEach((depKey) => {
|
|
@@ -5959,6 +6270,12 @@ class Target extends EventEmitter {
|
|
|
5959
6270
|
}
|
|
5960
6271
|
this.emit("change");
|
|
5961
6272
|
}
|
|
6273
|
+
/**
|
|
6274
|
+
* 判断指定节点下的指定key是否存在在依赖列表中
|
|
6275
|
+
* @param node 哪个节点
|
|
6276
|
+
* @param key 哪个key
|
|
6277
|
+
* @returns boolean
|
|
6278
|
+
*/
|
|
5962
6279
|
hasDep(node, key) {
|
|
5963
6280
|
const dep = this.deps[node.id];
|
|
5964
6281
|
return Boolean(dep?.keys.find((d) => d === key));
|
|
@@ -5969,15 +6286,29 @@ class Target extends EventEmitter {
|
|
|
5969
6286
|
}
|
|
5970
6287
|
class Watcher extends EventEmitter {
|
|
5971
6288
|
targets = reactive({});
|
|
6289
|
+
/**
|
|
6290
|
+
* 获取指定类型中的所有target
|
|
6291
|
+
* @param type 分类
|
|
6292
|
+
* @returns Target[]
|
|
6293
|
+
*/
|
|
5972
6294
|
getTargets(type = "default") {
|
|
5973
6295
|
return this.targets[type] || {};
|
|
5974
6296
|
}
|
|
6297
|
+
/**
|
|
6298
|
+
* 添加新的目标
|
|
6299
|
+
* @param target Target
|
|
6300
|
+
*/
|
|
5975
6301
|
addTarget(target) {
|
|
5976
6302
|
const targets = this.getTargets(target.type) || {};
|
|
5977
6303
|
this.targets[target.type] = targets;
|
|
5978
6304
|
targets[target.id] = target;
|
|
5979
6305
|
this.emit("add-target", target);
|
|
5980
6306
|
}
|
|
6307
|
+
/**
|
|
6308
|
+
* 获取指定id的target
|
|
6309
|
+
* @param id target id
|
|
6310
|
+
* @returns Target
|
|
6311
|
+
*/
|
|
5981
6312
|
getTarget(id) {
|
|
5982
6313
|
const allTargets = Object.values(this.targets);
|
|
5983
6314
|
for (const targets of allTargets) {
|
|
@@ -5986,6 +6317,11 @@ class Watcher extends EventEmitter {
|
|
|
5986
6317
|
}
|
|
5987
6318
|
}
|
|
5988
6319
|
}
|
|
6320
|
+
/**
|
|
6321
|
+
* 判断是否存在指定id的target
|
|
6322
|
+
* @param id target id
|
|
6323
|
+
* @returns boolean
|
|
6324
|
+
*/
|
|
5989
6325
|
hasTarget(id) {
|
|
5990
6326
|
const allTargets = Object.values(this.targets);
|
|
5991
6327
|
for (const targets of allTargets) {
|
|
@@ -5995,6 +6331,10 @@ class Watcher extends EventEmitter {
|
|
|
5995
6331
|
}
|
|
5996
6332
|
return false;
|
|
5997
6333
|
}
|
|
6334
|
+
/**
|
|
6335
|
+
* 删除指定id的target
|
|
6336
|
+
* @param id target id
|
|
6337
|
+
*/
|
|
5998
6338
|
removeTarget(id) {
|
|
5999
6339
|
const allTargets = Object.values(this.targets);
|
|
6000
6340
|
for (const targets of allTargets) {
|
|
@@ -6005,6 +6345,11 @@ class Watcher extends EventEmitter {
|
|
|
6005
6345
|
}
|
|
6006
6346
|
this.emit("remove-target");
|
|
6007
6347
|
}
|
|
6348
|
+
/**
|
|
6349
|
+
* 删除指定分类的所有target
|
|
6350
|
+
* @param type 分类
|
|
6351
|
+
* @returns void
|
|
6352
|
+
*/
|
|
6008
6353
|
removeTargets(type = "default") {
|
|
6009
6354
|
const targets = this.targets[type];
|
|
6010
6355
|
if (!targets)
|
|
@@ -6015,11 +6360,19 @@ class Watcher extends EventEmitter {
|
|
|
6015
6360
|
delete this.targets[type];
|
|
6016
6361
|
this.emit("remove-target");
|
|
6017
6362
|
}
|
|
6363
|
+
/**
|
|
6364
|
+
* 删除所有target
|
|
6365
|
+
*/
|
|
6018
6366
|
clearTargets() {
|
|
6019
6367
|
Object.keys(this.targets).forEach((key) => {
|
|
6020
6368
|
delete this.targets[key];
|
|
6021
6369
|
});
|
|
6022
6370
|
}
|
|
6371
|
+
/**
|
|
6372
|
+
* 收集依赖
|
|
6373
|
+
* @param nodes 需要收集的节点
|
|
6374
|
+
* @param deep 是否需要收集子节点
|
|
6375
|
+
*/
|
|
6023
6376
|
collect(nodes, deep = false) {
|
|
6024
6377
|
Object.values(this.targets).forEach((targets) => {
|
|
6025
6378
|
Object.values(targets).forEach((target) => {
|
|
@@ -6030,6 +6383,10 @@ class Watcher extends EventEmitter {
|
|
|
6030
6383
|
});
|
|
6031
6384
|
});
|
|
6032
6385
|
}
|
|
6386
|
+
/**
|
|
6387
|
+
* 清除依赖
|
|
6388
|
+
* @param nodes 需要清除依赖的节点
|
|
6389
|
+
*/
|
|
6033
6390
|
clear(nodes) {
|
|
6034
6391
|
Object.values(this.targets).forEach((targets) => {
|
|
6035
6392
|
Object.values(targets).forEach((target) => {
|
|
@@ -6129,50 +6486,64 @@ class Events extends BaseService {
|
|
|
6129
6486
|
const eventsService = new Events();
|
|
6130
6487
|
|
|
6131
6488
|
const editorProps = {
|
|
6489
|
+
/** 页面初始值 */
|
|
6132
6490
|
modelValue: {
|
|
6133
6491
|
type: Object,
|
|
6134
6492
|
default: () => ({}),
|
|
6135
6493
|
require: true
|
|
6136
6494
|
},
|
|
6495
|
+
/** 左侧面板中的组件列表 */
|
|
6137
6496
|
componentGroupList: {
|
|
6138
6497
|
type: Array,
|
|
6139
6498
|
default: () => []
|
|
6140
6499
|
},
|
|
6500
|
+
/** 左侧面板配置 */
|
|
6141
6501
|
sidebar: {
|
|
6142
6502
|
type: Object
|
|
6143
6503
|
},
|
|
6504
|
+
/** 顶部工具栏配置 */
|
|
6144
6505
|
menu: {
|
|
6145
6506
|
type: Object,
|
|
6146
6507
|
default: () => ({ left: [], right: [] })
|
|
6147
6508
|
},
|
|
6509
|
+
/** 组件树右键菜单 */
|
|
6148
6510
|
layerContentMenu: {
|
|
6149
6511
|
type: Array,
|
|
6150
6512
|
default: () => []
|
|
6151
6513
|
},
|
|
6514
|
+
/** 画布右键菜单 */
|
|
6152
6515
|
stageContentMenu: {
|
|
6153
6516
|
type: Array,
|
|
6154
6517
|
default: () => []
|
|
6155
6518
|
},
|
|
6519
|
+
/** 中间工作区域中画布渲染的内容 */
|
|
6156
6520
|
render: {
|
|
6157
6521
|
type: Function
|
|
6158
6522
|
},
|
|
6523
|
+
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
6159
6524
|
runtimeUrl: String,
|
|
6525
|
+
/** 选中时是否自动滚动到可视区域 */
|
|
6160
6526
|
autoScrollIntoView: Boolean,
|
|
6527
|
+
/** 组件的属性配置表单的dsl */
|
|
6161
6528
|
propsConfigs: {
|
|
6162
6529
|
type: Object,
|
|
6163
6530
|
default: () => ({})
|
|
6164
6531
|
},
|
|
6532
|
+
/** 添加组件时的默认值 */
|
|
6165
6533
|
propsValues: {
|
|
6166
6534
|
type: Object,
|
|
6167
6535
|
default: () => ({})
|
|
6168
6536
|
},
|
|
6537
|
+
/** 组件联动事件选项列表 */
|
|
6169
6538
|
eventMethodList: {
|
|
6170
6539
|
type: Object,
|
|
6171
6540
|
default: () => ({})
|
|
6172
6541
|
},
|
|
6542
|
+
/** 画布中组件选中框的移动范围 */
|
|
6173
6543
|
moveableOptions: {
|
|
6174
6544
|
type: [Object, Function]
|
|
6175
6545
|
},
|
|
6546
|
+
/** 编辑器初始化时默认选中的组件ID */
|
|
6176
6547
|
defaultSelected: {
|
|
6177
6548
|
type: [Number, String]
|
|
6178
6549
|
},
|
|
@@ -6376,11 +6747,11 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, depSe
|
|
|
6376
6747
|
const _sfc_main = defineComponent({
|
|
6377
6748
|
name: "m-editor",
|
|
6378
6749
|
components: {
|
|
6379
|
-
TMagicNavMenu: _sfc_main$
|
|
6750
|
+
TMagicNavMenu: _sfc_main$m,
|
|
6380
6751
|
Sidebar: _sfc_main$9,
|
|
6381
6752
|
Workspace: _sfc_main$1,
|
|
6382
|
-
PropsPanel: _sfc_main$
|
|
6383
|
-
Framework: _sfc_main$
|
|
6753
|
+
PropsPanel: _sfc_main$l,
|
|
6754
|
+
Framework: _sfc_main$o
|
|
6384
6755
|
},
|
|
6385
6756
|
props: editorProps,
|
|
6386
6757
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -6420,14 +6791,6 @@ const _sfc_main = defineComponent({
|
|
|
6420
6791
|
}
|
|
6421
6792
|
});
|
|
6422
6793
|
|
|
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
6794
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6432
6795
|
const _component_TMagicNavMenu = resolveComponent("TMagicNavMenu");
|
|
6433
6796
|
const _component_Sidebar = resolveComponent("Sidebar");
|
|
@@ -6518,22 +6881,24 @@ const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]])
|
|
|
6518
6881
|
|
|
6519
6882
|
const index$1 = '';
|
|
6520
6883
|
|
|
6521
|
-
const defaultInstallOpt = {
|
|
6884
|
+
const defaultInstallOpt = {
|
|
6885
|
+
// @todo, 自定义图片上传方法等编辑器依赖的外部选项
|
|
6886
|
+
};
|
|
6522
6887
|
const index = {
|
|
6523
6888
|
install: (app, opt) => {
|
|
6524
6889
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
6525
6890
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6526
6891
|
setConfig(option);
|
|
6527
6892
|
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$
|
|
6893
|
+
app.component("m-fields-ui-select", _sfc_main$t);
|
|
6894
|
+
app.component("m-fields-code-link", _sfc_main$y);
|
|
6895
|
+
app.component("m-fields-vs-code", _sfc_main$z);
|
|
6896
|
+
app.component("magic-code-editor", _sfc_main$s);
|
|
6897
|
+
app.component("m-fields-code-select", _sfc_main$x);
|
|
6898
|
+
app.component("m-fields-code-select-col", _sfc_main$v);
|
|
6899
|
+
app.component("m-fields-event-select", _sfc_main$u);
|
|
6535
6900
|
}
|
|
6536
6901
|
};
|
|
6537
6902
|
|
|
6538
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, _sfc_main$
|
|
6903
|
+
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
6904
|
//# sourceMappingURL=tmagic-editor.js.map
|