@tmagic/editor 1.2.13 → 1.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +37 -6
- package/dist/tmagic-editor.js +770 -394
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +789 -420
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +14 -13
- package/src/components/CodeDraftEditor.vue +20 -17
- package/src/components/ContentMenu.vue +1 -1
- package/src/components/FunctionEditor.vue +10 -10
- package/src/components/Layout.vue +1 -1
- package/src/components/ScrollViewer.vue +2 -2
- package/src/fields/CodeSelect.vue +18 -101
- package/src/fields/CodeSelectCol.vue +21 -3
- package/src/fields/EventSelect.vue +5 -3
- package/src/fields/UISelect.vue +1 -1
- package/src/icons/AppManageIcon.vue +11 -0
- package/src/icons/CodeIcon.vue +35 -0
- package/src/layouts/AddPageBox.vue +3 -3
- package/src/layouts/Framework.vue +4 -4
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +3 -3
- package/src/layouts/sidebar/LayerMenu.vue +2 -2
- package/src/layouts/sidebar/LayerPanel.vue +4 -4
- package/src/layouts/sidebar/Sidebar.vue +3 -3
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +15 -6
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +26 -13
- package/src/layouts/workspace/Breadcrumb.vue +1 -1
- package/src/layouts/workspace/PageBar.vue +2 -2
- package/src/layouts/workspace/PageBarScrollContainer.vue +3 -3
- package/src/layouts/workspace/Stage.vue +3 -3
- package/src/layouts/workspace/ViewerMenu.vue +4 -4
- package/src/layouts/workspace/Workspace.vue +1 -1
- package/src/services/BaseService.ts +1 -1
- package/src/services/codeBlock.ts +3 -3
- package/src/services/componentList.ts +1 -1
- package/src/services/editor.ts +6 -6
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +2 -2
- package/src/services/props.ts +2 -2
- package/src/services/ui.ts +2 -2
- package/src/theme/code-block.scss +28 -4
- package/src/theme/event.scss +12 -0
- package/src/utils/config.ts +1 -1
- package/src/utils/dep.ts +2 -2
- package/src/utils/editor.ts +1 -1
- package/src/utils/operator.ts +4 -4
- package/src/utils/stage.ts +3 -3
- package/tsconfig.build.json +4 -1
- package/types/components/CodeDraftEditor.vue.d.ts +7 -4
- package/types/components/ContentMenu.vue.d.ts +3 -3
- package/types/components/FunctionEditor.vue.d.ts +140 -8
- package/types/components/Icon.vue.d.ts +2 -2
- package/types/components/Layout.vue.d.ts +28 -113
- package/types/components/ScrollBar.vue.d.ts +2 -2
- package/types/components/ScrollViewer.vue.d.ts +32 -135
- package/types/components/ToolButton.vue.d.ts +3 -3
- package/types/fields/Code.vue.d.ts +2 -2
- package/types/fields/CodeLink.vue.d.ts +2 -2
- package/types/fields/CodeSelect.vue.d.ts +8 -27
- package/types/fields/CodeSelectCol.vue.d.ts +3 -3
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/UISelect.vue.d.ts +2 -2
- package/types/icons/AppManageIcon.vue.d.ts +2 -0
- package/types/icons/CodeIcon.vue.d.ts +2 -0
- package/types/layouts/CodeEditor.vue.d.ts +4 -4
- package/types/layouts/Framework.vue.d.ts +23 -74
- package/types/layouts/NavMenu.vue.d.ts +3 -3
- package/types/layouts/PropsPanel.vue.d.ts +11 -60
- package/types/layouts/Resizer.vue.d.ts +9 -54
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +11 -50
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +17 -60
- package/types/layouts/sidebar/Sidebar.vue.d.ts +39 -104
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +15 -58
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +21 -66
- package/types/layouts/workspace/PageBar.vue.d.ts +13 -52
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +8 -48
- package/types/layouts/workspace/Stage.vue.d.ts +2 -2
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +3 -3
- package/types/layouts/workspace/Workspace.vue.d.ts +20 -63
- package/types/services/codeBlock.d.ts +1 -1
- package/types/services/componentList.d.ts +1 -1
- package/types/services/dep.d.ts +2 -2
- package/types/services/editor.d.ts +1 -1
- package/types/services/events.d.ts +1 -1
- package/types/services/history.d.ts +2 -2
- package/types/services/props.d.ts +78 -1
- package/types/services/storage.d.ts +1 -1
- package/types/services/ui.d.ts +2 -2
- package/types/type.d.ts +8 -8
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +78 -1
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.
|
|
5
|
-
})(this, (function (exports, vue, serialize,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/form'), require('monaco-editor'), require('gesto'), require('@tmagic/utils'), require('keycon'), require('@tmagic/stage'), require('events'), require('@tmagic/core')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/form', 'monaco-editor', 'gesto', '@tmagic/utils', 'keycon', '@tmagic/stage', 'events', '@tmagic/core'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.schema, global.iconsVue, global.form, global.monaco, global.Gesto, global.utils, global.KeyController, global.StageCore, global.events, global.core));
|
|
5
|
+
})(this, (function (exports, vue, serialize, lodashEs, design, schema, iconsVue, form, monaco, Gesto, utils, KeyController, StageCore, events, core) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
11
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
12
9
|
if (e) {
|
|
13
10
|
for (const k in e) {
|
|
@@ -24,16 +21,12 @@
|
|
|
24
21
|
return Object.freeze(n);
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
const
|
|
28
|
-
const monaco__namespace = /*#__PURE__*/_interopNamespace(monaco);
|
|
29
|
-
const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
|
|
30
|
-
const StageCore__default = /*#__PURE__*/_interopDefaultLegacy(StageCore);
|
|
31
|
-
const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
|
|
24
|
+
const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
|
|
32
25
|
|
|
33
26
|
const __default__$v = vue.defineComponent({
|
|
34
27
|
name: "MEditorCode"
|
|
35
28
|
});
|
|
36
|
-
const _sfc_main$
|
|
29
|
+
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
37
30
|
...__default__$v,
|
|
38
31
|
props: {
|
|
39
32
|
model: null,
|
|
@@ -66,7 +59,7 @@
|
|
|
66
59
|
const __default__$u = vue.defineComponent({
|
|
67
60
|
name: "MEditorCodeLink"
|
|
68
61
|
});
|
|
69
|
-
const _sfc_main$
|
|
62
|
+
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
70
63
|
...__default__$u,
|
|
71
64
|
props: {
|
|
72
65
|
config: null,
|
|
@@ -104,7 +97,7 @@
|
|
|
104
97
|
() => props.model[props.name],
|
|
105
98
|
(value) => {
|
|
106
99
|
modelValue.form = {
|
|
107
|
-
[props.name]:
|
|
100
|
+
[props.name]: serialize(value, {
|
|
108
101
|
space: 2,
|
|
109
102
|
unsafe: true
|
|
110
103
|
}).replace(/"(\w+)":\s/g, "$1: ")
|
|
@@ -136,58 +129,13 @@
|
|
|
136
129
|
}
|
|
137
130
|
});
|
|
138
131
|
|
|
139
|
-
const _hoisted_1$h = ["src"];
|
|
140
132
|
const __default__$t = vue.defineComponent({
|
|
141
|
-
name: "MEditorIcon"
|
|
142
|
-
});
|
|
143
|
-
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
144
|
-
...__default__$t,
|
|
145
|
-
props: {
|
|
146
|
-
icon: null
|
|
147
|
-
},
|
|
148
|
-
setup(__props) {
|
|
149
|
-
return (_ctx, _cache) => {
|
|
150
|
-
return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
151
|
-
key: 0,
|
|
152
|
-
class: "magic-editor-icon"
|
|
153
|
-
}, {
|
|
154
|
-
default: vue.withCtx(() => [
|
|
155
|
-
vue.createVNode(vue.unref(iconsVue.Edit))
|
|
156
|
-
]),
|
|
157
|
-
_: 1
|
|
158
|
-
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
159
|
-
key: 1,
|
|
160
|
-
class: "magic-editor-icon"
|
|
161
|
-
}, {
|
|
162
|
-
default: vue.withCtx(() => [
|
|
163
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$h)
|
|
164
|
-
]),
|
|
165
|
-
_: 1
|
|
166
|
-
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
167
|
-
key: 2,
|
|
168
|
-
class: vue.normalizeClass(["magic-editor-icon", __props.icon])
|
|
169
|
-
}, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
170
|
-
key: 3,
|
|
171
|
-
class: "magic-editor-icon"
|
|
172
|
-
}, {
|
|
173
|
-
default: vue.withCtx(() => [
|
|
174
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
|
|
175
|
-
]),
|
|
176
|
-
_: 1
|
|
177
|
-
}));
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
const __default__$s = vue.defineComponent({
|
|
183
133
|
name: "MEditorCodeSelect"
|
|
184
134
|
});
|
|
185
|
-
const _sfc_main$
|
|
186
|
-
...__default__$
|
|
135
|
+
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
136
|
+
...__default__$t,
|
|
187
137
|
props: {
|
|
188
|
-
config:
|
|
189
|
-
editable: true
|
|
190
|
-
}) },
|
|
138
|
+
config: null,
|
|
191
139
|
model: null,
|
|
192
140
|
prop: null,
|
|
193
141
|
name: null,
|
|
@@ -196,55 +144,16 @@
|
|
|
196
144
|
emits: ["change"],
|
|
197
145
|
setup(__props, { emit }) {
|
|
198
146
|
const props = __props;
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
{
|
|
210
|
-
type: "select",
|
|
211
|
-
label: "\u4EE3\u7801\u5757",
|
|
212
|
-
name: "codeId",
|
|
213
|
-
width: "200px",
|
|
214
|
-
options: () => {
|
|
215
|
-
if (codeDsl.value) {
|
|
216
|
-
return lodashEs.map(codeDsl.value, (value, key) => ({
|
|
217
|
-
text: `${value.name}\uFF08${key}\uFF09`,
|
|
218
|
-
label: `${value.name}\uFF08${key}\uFF09`,
|
|
219
|
-
value: key
|
|
220
|
-
}));
|
|
221
|
-
}
|
|
222
|
-
return [];
|
|
223
|
-
},
|
|
224
|
-
onChange: (formState, codeId, { model }) => {
|
|
225
|
-
model.params = {};
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
name: "params",
|
|
230
|
-
label: "\u53C2\u6570",
|
|
231
|
-
defaultValue: {},
|
|
232
|
-
itemsFunction: (row) => {
|
|
233
|
-
const paramsConfig = getParamsConfig(row.codeId);
|
|
234
|
-
if (!row.params || lodashEs.isEmpty(row.params)) {
|
|
235
|
-
form.createValues(mForm, paramsConfig, {}, row.params);
|
|
236
|
-
}
|
|
237
|
-
return paramsConfig;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
};
|
|
242
|
-
return {
|
|
243
|
-
...defaultConfig,
|
|
244
|
-
...props.config.tableConfig
|
|
245
|
-
};
|
|
246
|
-
});
|
|
247
|
-
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
147
|
+
const codeConfig = vue.computed(() => ({
|
|
148
|
+
type: "group-list",
|
|
149
|
+
name: "hookData",
|
|
150
|
+
enableToggleMode: false,
|
|
151
|
+
items: [
|
|
152
|
+
{
|
|
153
|
+
type: "code-select-col"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}));
|
|
248
157
|
vue.watch(
|
|
249
158
|
() => props.model[props.name],
|
|
250
159
|
(value) => {
|
|
@@ -262,56 +171,75 @@
|
|
|
262
171
|
const changeHandler = async () => {
|
|
263
172
|
emit("change", props.model[props.name]);
|
|
264
173
|
};
|
|
265
|
-
const getParamsConfig = (codeId) => {
|
|
266
|
-
if (!codeDsl.value)
|
|
267
|
-
return [];
|
|
268
|
-
const paramStatements = codeDsl.value[codeId]?.params;
|
|
269
|
-
if (lodashEs.isEmpty(paramStatements))
|
|
270
|
-
return [];
|
|
271
|
-
return paramStatements.map((paramState) => ({
|
|
272
|
-
labelWidth: "100px",
|
|
273
|
-
text: paramState.name,
|
|
274
|
-
inline: true,
|
|
275
|
-
...paramState
|
|
276
|
-
}));
|
|
277
|
-
};
|
|
278
|
-
const editCode = (codeId) => {
|
|
279
|
-
services?.codeBlockService.setCodeEditorContent(true, codeId);
|
|
280
|
-
};
|
|
281
174
|
return (_ctx, _cache) => {
|
|
282
|
-
const
|
|
175
|
+
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
283
176
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
284
177
|
class: vue.normalizeClass(["m-fields-code-select", __props.config.className])
|
|
285
178
|
}, [
|
|
286
|
-
vue.createVNode(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
onChange: changeHandler
|
|
294
|
-
}, {
|
|
295
|
-
operateCol: vue.withCtx(({ scope }) => [
|
|
296
|
-
scope.row.codeId && __props.config.editable ? (vue.openBlock(), vue.createBlock(_sfc_main$v, {
|
|
297
|
-
key: 0,
|
|
298
|
-
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
299
|
-
class: "edit-icon",
|
|
300
|
-
onClick: ($event) => editCode(scope.row.codeId)
|
|
301
|
-
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
179
|
+
vue.createVNode(vue.unref(design.TMagicCard), null, {
|
|
180
|
+
default: vue.withCtx(() => [
|
|
181
|
+
vue.createVNode(_component_m_form_container, {
|
|
182
|
+
config: vue.unref(codeConfig),
|
|
183
|
+
model: __props.model[__props.name],
|
|
184
|
+
onChange: changeHandler
|
|
185
|
+
}, null, 8, ["config", "model"])
|
|
302
186
|
]),
|
|
303
187
|
_: 1
|
|
304
|
-
}
|
|
188
|
+
})
|
|
305
189
|
], 2);
|
|
306
190
|
};
|
|
307
191
|
}
|
|
308
192
|
});
|
|
309
193
|
|
|
310
|
-
const _hoisted_1$
|
|
194
|
+
const _hoisted_1$j = ["src"];
|
|
195
|
+
const __default__$s = vue.defineComponent({
|
|
196
|
+
name: "MEditorIcon"
|
|
197
|
+
});
|
|
198
|
+
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
199
|
+
...__default__$s,
|
|
200
|
+
props: {
|
|
201
|
+
icon: null
|
|
202
|
+
},
|
|
203
|
+
setup(__props) {
|
|
204
|
+
return (_ctx, _cache) => {
|
|
205
|
+
return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
206
|
+
key: 0,
|
|
207
|
+
class: "magic-editor-icon"
|
|
208
|
+
}, {
|
|
209
|
+
default: vue.withCtx(() => [
|
|
210
|
+
vue.createVNode(vue.unref(iconsVue.Edit))
|
|
211
|
+
]),
|
|
212
|
+
_: 1
|
|
213
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
214
|
+
key: 1,
|
|
215
|
+
class: "magic-editor-icon"
|
|
216
|
+
}, {
|
|
217
|
+
default: vue.withCtx(() => [
|
|
218
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$j)
|
|
219
|
+
]),
|
|
220
|
+
_: 1
|
|
221
|
+
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
222
|
+
key: 2,
|
|
223
|
+
class: vue.normalizeClass(["magic-editor-icon", __props.icon])
|
|
224
|
+
}, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
225
|
+
key: 3,
|
|
226
|
+
class: "magic-editor-icon"
|
|
227
|
+
}, {
|
|
228
|
+
default: vue.withCtx(() => [
|
|
229
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
|
|
230
|
+
]),
|
|
231
|
+
_: 1
|
|
232
|
+
}));
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
const _hoisted_1$i = { class: "m-fields-code-select-col" };
|
|
238
|
+
const _hoisted_2$a = { class: "code-select-container" };
|
|
311
239
|
const __default__$r = vue.defineComponent({
|
|
312
240
|
name: "MEditorCodeSelectCol"
|
|
313
241
|
});
|
|
314
|
-
const _sfc_main$
|
|
242
|
+
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
315
243
|
...__default__$r,
|
|
316
244
|
props: {
|
|
317
245
|
config: null,
|
|
@@ -326,24 +254,25 @@
|
|
|
326
254
|
const services = vue.inject("services");
|
|
327
255
|
const mForm = vue.inject("mForm");
|
|
328
256
|
const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDsl());
|
|
257
|
+
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
329
258
|
const codeParamsConfig = vue.ref({
|
|
330
259
|
type: "fieldset",
|
|
331
260
|
items: [],
|
|
332
|
-
legend: "
|
|
261
|
+
legend: "参数",
|
|
333
262
|
labelWidth: "70px",
|
|
334
263
|
name: "params",
|
|
335
264
|
display: false
|
|
336
265
|
});
|
|
337
266
|
const selectConfig = {
|
|
338
267
|
type: "select",
|
|
339
|
-
text: "
|
|
268
|
+
text: "代码块",
|
|
340
269
|
name: "codeId",
|
|
341
270
|
labelWidth: "70px",
|
|
342
271
|
options: () => {
|
|
343
272
|
if (codeDsl.value) {
|
|
344
273
|
return lodashEs.map(codeDsl.value, (value, key) => ({
|
|
345
|
-
text: `${value.name}
|
|
346
|
-
label: `${value.name}
|
|
274
|
+
text: `${value.name}(${key})`,
|
|
275
|
+
label: `${value.name}(${key})`,
|
|
347
276
|
value: key
|
|
348
277
|
}));
|
|
349
278
|
}
|
|
@@ -374,7 +303,7 @@
|
|
|
374
303
|
codeParamsConfig.value = {
|
|
375
304
|
type: "fieldset",
|
|
376
305
|
items: paramsConfig,
|
|
377
|
-
legend: "
|
|
306
|
+
legend: "参数",
|
|
378
307
|
labelWidth: "70px",
|
|
379
308
|
name: "params",
|
|
380
309
|
display: !lodashEs.isEmpty(paramsConfig)
|
|
@@ -394,14 +323,25 @@
|
|
|
394
323
|
immediate: true
|
|
395
324
|
}
|
|
396
325
|
);
|
|
326
|
+
const editCode = () => {
|
|
327
|
+
services?.codeBlockService.setCodeEditorContent(true, props.model.codeId);
|
|
328
|
+
};
|
|
397
329
|
return (_ctx, _cache) => {
|
|
398
330
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
399
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
400
|
-
vue.
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
331
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
|
|
332
|
+
vue.createElementVNode("div", _hoisted_2$a, [
|
|
333
|
+
vue.createVNode(_component_m_form_container, {
|
|
334
|
+
class: "select",
|
|
335
|
+
config: selectConfig,
|
|
336
|
+
model: __props.model,
|
|
337
|
+
onChange: onParamsChangeHandler
|
|
338
|
+
}, null, 8, ["model"]),
|
|
339
|
+
vue.createVNode(_sfc_main$w, {
|
|
340
|
+
class: "icon",
|
|
341
|
+
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
342
|
+
onClick: editCode
|
|
343
|
+
}, null, 8, ["icon"])
|
|
344
|
+
]),
|
|
405
345
|
vue.createVNode(_component_m_form_container, {
|
|
406
346
|
config: codeParamsConfig.value,
|
|
407
347
|
model: __props.model,
|
|
@@ -412,16 +352,16 @@
|
|
|
412
352
|
}
|
|
413
353
|
});
|
|
414
354
|
|
|
415
|
-
const _hoisted_1$
|
|
416
|
-
const _hoisted_2$
|
|
355
|
+
const _hoisted_1$h = { class: "m-fields-event-select" };
|
|
356
|
+
const _hoisted_2$9 = {
|
|
417
357
|
key: 1,
|
|
418
358
|
class: "fullWidth"
|
|
419
359
|
};
|
|
420
|
-
const _hoisted_3$
|
|
360
|
+
const _hoisted_3$5 = /* @__PURE__ */ vue.createTextVNode("添加事件");
|
|
421
361
|
const __default__$q = vue.defineComponent({
|
|
422
362
|
name: "MEditorEventSelect"
|
|
423
363
|
});
|
|
424
|
-
const _sfc_main$
|
|
364
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
425
365
|
...__default__$q,
|
|
426
366
|
props: {
|
|
427
367
|
config: null,
|
|
@@ -437,7 +377,7 @@
|
|
|
437
377
|
const eventNameConfig = vue.computed(() => {
|
|
438
378
|
const defaultEventNameConfig = {
|
|
439
379
|
name: "name",
|
|
440
|
-
text: "
|
|
380
|
+
text: "事件",
|
|
441
381
|
type: "select",
|
|
442
382
|
labelWidth: "40px",
|
|
443
383
|
options: (mForm, { formValue }) => services?.eventsService.getEvent(formValue.type).map((option) => ({
|
|
@@ -450,19 +390,19 @@
|
|
|
450
390
|
const actionTypeConfig = vue.computed(() => {
|
|
451
391
|
const defaultActionTypeConfig = {
|
|
452
392
|
name: "actionType",
|
|
453
|
-
text: "
|
|
393
|
+
text: "联动类型",
|
|
454
394
|
labelWidth: "70px",
|
|
455
395
|
type: "select",
|
|
456
396
|
defaultValue: schema.ActionType.COMP,
|
|
457
397
|
options: () => [
|
|
458
398
|
{
|
|
459
|
-
text: "
|
|
460
|
-
label: "
|
|
399
|
+
text: "组件",
|
|
400
|
+
label: "组件",
|
|
461
401
|
value: schema.ActionType.COMP
|
|
462
402
|
},
|
|
463
403
|
{
|
|
464
|
-
text: "
|
|
465
|
-
label: "
|
|
404
|
+
text: "代码",
|
|
405
|
+
label: "代码",
|
|
466
406
|
value: schema.ActionType.CODE
|
|
467
407
|
}
|
|
468
408
|
]
|
|
@@ -472,7 +412,7 @@
|
|
|
472
412
|
const targetCompConfig = vue.computed(() => {
|
|
473
413
|
const defaultTargetCompConfig = {
|
|
474
414
|
name: "to",
|
|
475
|
-
text: "
|
|
415
|
+
text: "联动组件",
|
|
476
416
|
labelWidth: "70px",
|
|
477
417
|
type: "ui-select",
|
|
478
418
|
display: (mForm, { model }) => model.actionType === schema.ActionType.COMP
|
|
@@ -482,7 +422,7 @@
|
|
|
482
422
|
const compActionConfig = vue.computed(() => {
|
|
483
423
|
const defaultCompActionConfig = {
|
|
484
424
|
name: "method",
|
|
485
|
-
text: "
|
|
425
|
+
text: "动作",
|
|
486
426
|
labelWidth: "70px",
|
|
487
427
|
type: "select",
|
|
488
428
|
display: (mForm, { model }) => model.actionType === schema.ActionType.COMP,
|
|
@@ -511,7 +451,7 @@
|
|
|
511
451
|
items: [
|
|
512
452
|
{
|
|
513
453
|
name: "name",
|
|
514
|
-
label: "
|
|
454
|
+
label: "事件名",
|
|
515
455
|
type: eventNameConfig.value.type,
|
|
516
456
|
options: (mForm, { formValue }) => services?.eventsService.getEvent(formValue.type).map((option) => ({
|
|
517
457
|
text: option.label,
|
|
@@ -520,12 +460,12 @@
|
|
|
520
460
|
},
|
|
521
461
|
{
|
|
522
462
|
name: "to",
|
|
523
|
-
label: "
|
|
463
|
+
label: "联动组件",
|
|
524
464
|
type: "ui-select"
|
|
525
465
|
},
|
|
526
466
|
{
|
|
527
467
|
name: "method",
|
|
528
|
-
label: "
|
|
468
|
+
label: "动作",
|
|
529
469
|
type: compActionConfig.value.type,
|
|
530
470
|
options: (mForm, { model }) => {
|
|
531
471
|
const node = services?.editorService.getNodeById(model.to);
|
|
@@ -575,17 +515,19 @@
|
|
|
575
515
|
emit("change", props.model);
|
|
576
516
|
};
|
|
577
517
|
return (_ctx, _cache) => {
|
|
518
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
578
519
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
579
520
|
const _component_m_form_panel = vue.resolveComponent("m-form-panel");
|
|
580
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
581
|
-
vue.unref(isOldVersion) ? (vue.openBlock(), vue.createBlock(
|
|
521
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
|
|
522
|
+
vue.unref(isOldVersion) ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
582
523
|
key: 0,
|
|
583
524
|
ref: "eventForm",
|
|
584
525
|
size: props.size,
|
|
585
526
|
model: __props.model,
|
|
527
|
+
name: "events",
|
|
586
528
|
config: vue.unref(tableConfig),
|
|
587
529
|
onChange: onChangeHandler
|
|
588
|
-
}, null, 8, ["size", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
530
|
+
}, null, 8, ["size", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$9, [
|
|
589
531
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
590
532
|
class: "create-button",
|
|
591
533
|
type: "primary",
|
|
@@ -593,7 +535,7 @@
|
|
|
593
535
|
onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
|
|
594
536
|
}, {
|
|
595
537
|
default: vue.withCtx(() => [
|
|
596
|
-
_hoisted_3$
|
|
538
|
+
_hoisted_3$5
|
|
597
539
|
]),
|
|
598
540
|
_: 1
|
|
599
541
|
}),
|
|
@@ -627,11 +569,11 @@
|
|
|
627
569
|
}
|
|
628
570
|
});
|
|
629
571
|
|
|
630
|
-
const _hoisted_1$
|
|
572
|
+
const _hoisted_1$g = /* @__PURE__ */ vue.createTextVNode("取消");
|
|
631
573
|
const __default__$p = vue.defineComponent({
|
|
632
574
|
name: "MEditorUISelect"
|
|
633
575
|
});
|
|
634
|
-
const _sfc_main$
|
|
576
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
635
577
|
...__default__$p,
|
|
636
578
|
props: {
|
|
637
579
|
config: null,
|
|
@@ -694,7 +636,7 @@
|
|
|
694
636
|
style: { "padding": "0" }
|
|
695
637
|
}, {
|
|
696
638
|
default: vue.withCtx(() => [
|
|
697
|
-
_hoisted_1$
|
|
639
|
+
_hoisted_1$g
|
|
698
640
|
]),
|
|
699
641
|
_: 1
|
|
700
642
|
}, 8, ["icon"])
|
|
@@ -706,7 +648,7 @@
|
|
|
706
648
|
}, [
|
|
707
649
|
vue.unref(val) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
708
650
|
key: 0,
|
|
709
|
-
content: "
|
|
651
|
+
content: "清除"
|
|
710
652
|
}, {
|
|
711
653
|
default: vue.withCtx(() => [
|
|
712
654
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
@@ -720,7 +662,7 @@
|
|
|
720
662
|
_: 1
|
|
721
663
|
})) : vue.createCommentVNode("", true),
|
|
722
664
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
723
|
-
content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "
|
|
665
|
+
content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "点击此处选择"
|
|
724
666
|
}, {
|
|
725
667
|
default: vue.withCtx(() => [
|
|
726
668
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
@@ -728,7 +670,7 @@
|
|
|
728
670
|
style: { "padding": "0", "margin": "0" }
|
|
729
671
|
}, {
|
|
730
672
|
default: vue.withCtx(() => [
|
|
731
|
-
vue.createTextVNode(vue.toDisplayString(vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "
|
|
673
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "点击此处选择"), 1)
|
|
732
674
|
]),
|
|
733
675
|
_: 1
|
|
734
676
|
})
|
|
@@ -745,7 +687,7 @@
|
|
|
745
687
|
const __default__$o = vue.defineComponent({
|
|
746
688
|
name: "MEditorCodeEditor"
|
|
747
689
|
});
|
|
748
|
-
const _sfc_main$
|
|
690
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
749
691
|
...__default__$o,
|
|
750
692
|
props: {
|
|
751
693
|
initValues: null,
|
|
@@ -763,7 +705,7 @@
|
|
|
763
705
|
const toString = (v, language) => {
|
|
764
706
|
let value = "";
|
|
765
707
|
if (typeof v !== "string") {
|
|
766
|
-
value =
|
|
708
|
+
value = serialize(v, {
|
|
767
709
|
space: 2,
|
|
768
710
|
unsafe: true
|
|
769
711
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
@@ -878,7 +820,7 @@
|
|
|
878
820
|
const __default__$n = vue.defineComponent({
|
|
879
821
|
name: "MEditorResizer"
|
|
880
822
|
});
|
|
881
|
-
const _sfc_main$
|
|
823
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
882
824
|
...__default__$n,
|
|
883
825
|
emits: ["change"],
|
|
884
826
|
setup(__props, { emit }) {
|
|
@@ -887,7 +829,7 @@
|
|
|
887
829
|
vue.onMounted(() => {
|
|
888
830
|
if (!target.value)
|
|
889
831
|
return;
|
|
890
|
-
getso = new
|
|
832
|
+
getso = new Gesto(target.value, {
|
|
891
833
|
container: window,
|
|
892
834
|
pinchOutside: true
|
|
893
835
|
}).on("drag", (e) => {
|
|
@@ -914,7 +856,7 @@
|
|
|
914
856
|
const __default__$m = vue.defineComponent({
|
|
915
857
|
name: "MEditorLayout"
|
|
916
858
|
});
|
|
917
|
-
const _sfc_main$
|
|
859
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
918
860
|
...__default__$m,
|
|
919
861
|
props: {
|
|
920
862
|
left: null,
|
|
@@ -1023,7 +965,7 @@
|
|
|
1023
965
|
}, [
|
|
1024
966
|
vue.renderSlot(_ctx.$slots, "left")
|
|
1025
967
|
], 6),
|
|
1026
|
-
vue.createVNode(_sfc_main$
|
|
968
|
+
vue.createVNode(_sfc_main$r, { onChange: changeLeft })
|
|
1027
969
|
], 64)) : vue.createCommentVNode("", true),
|
|
1028
970
|
vue.createElementVNode("div", {
|
|
1029
971
|
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -1032,7 +974,7 @@
|
|
|
1032
974
|
vue.renderSlot(_ctx.$slots, "center")
|
|
1033
975
|
], 6),
|
|
1034
976
|
vue.unref(hasRight) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
1035
|
-
vue.createVNode(_sfc_main$
|
|
977
|
+
vue.createVNode(_sfc_main$r, { onChange: changeRight }),
|
|
1036
978
|
vue.createElementVNode("div", {
|
|
1037
979
|
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
1038
980
|
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -1050,14 +992,16 @@
|
|
|
1050
992
|
type: "tab",
|
|
1051
993
|
items: [
|
|
1052
994
|
{
|
|
1053
|
-
title: "
|
|
995
|
+
title: "属性",
|
|
1054
996
|
labelWidth: "80px",
|
|
1055
997
|
items: [
|
|
998
|
+
// 组件类型,必须要有
|
|
1056
999
|
{
|
|
1057
1000
|
text: "type",
|
|
1058
1001
|
name: "type",
|
|
1059
1002
|
type: "hidden"
|
|
1060
1003
|
},
|
|
1004
|
+
// 组件id,必须要有
|
|
1061
1005
|
{
|
|
1062
1006
|
name: "id",
|
|
1063
1007
|
type: "display",
|
|
@@ -1065,13 +1009,13 @@
|
|
|
1065
1009
|
},
|
|
1066
1010
|
{
|
|
1067
1011
|
name: "name",
|
|
1068
|
-
text: "
|
|
1012
|
+
text: "组件名称"
|
|
1069
1013
|
},
|
|
1070
1014
|
...config
|
|
1071
1015
|
]
|
|
1072
1016
|
},
|
|
1073
1017
|
{
|
|
1074
|
-
title: "
|
|
1018
|
+
title: "样式",
|
|
1075
1019
|
labelWidth: "80px",
|
|
1076
1020
|
items: [
|
|
1077
1021
|
{
|
|
@@ -1079,7 +1023,7 @@
|
|
|
1079
1023
|
items: [
|
|
1080
1024
|
{
|
|
1081
1025
|
type: "fieldset",
|
|
1082
|
-
legend: "
|
|
1026
|
+
legend: "位置",
|
|
1083
1027
|
items: [
|
|
1084
1028
|
{
|
|
1085
1029
|
name: "position",
|
|
@@ -1087,7 +1031,7 @@
|
|
|
1087
1031
|
activeValue: "fixed",
|
|
1088
1032
|
inactiveValue: "absolute",
|
|
1089
1033
|
defaultValue: "absolute",
|
|
1090
|
-
text: "
|
|
1034
|
+
text: "固定定位"
|
|
1091
1035
|
},
|
|
1092
1036
|
{
|
|
1093
1037
|
name: "left",
|
|
@@ -1111,34 +1055,34 @@
|
|
|
1111
1055
|
},
|
|
1112
1056
|
{
|
|
1113
1057
|
type: "fieldset",
|
|
1114
|
-
legend: "
|
|
1058
|
+
legend: "盒子",
|
|
1115
1059
|
items: [
|
|
1116
1060
|
{
|
|
1117
1061
|
name: "width",
|
|
1118
|
-
text: "
|
|
1062
|
+
text: "宽度"
|
|
1119
1063
|
},
|
|
1120
1064
|
{
|
|
1121
1065
|
name: "height",
|
|
1122
|
-
text: "
|
|
1066
|
+
text: "高度"
|
|
1123
1067
|
}
|
|
1124
1068
|
]
|
|
1125
1069
|
},
|
|
1126
1070
|
{
|
|
1127
1071
|
type: "fieldset",
|
|
1128
|
-
legend: "
|
|
1072
|
+
legend: "背景",
|
|
1129
1073
|
items: [
|
|
1130
1074
|
{
|
|
1131
1075
|
name: "backgroundImage",
|
|
1132
|
-
text: "
|
|
1076
|
+
text: "背景图"
|
|
1133
1077
|
},
|
|
1134
1078
|
{
|
|
1135
1079
|
name: "backgroundColor",
|
|
1136
|
-
text: "
|
|
1080
|
+
text: "背景颜色",
|
|
1137
1081
|
type: "colorPicker"
|
|
1138
1082
|
},
|
|
1139
1083
|
{
|
|
1140
1084
|
name: "backgroundRepeat",
|
|
1141
|
-
text: "
|
|
1085
|
+
text: "背景图重复",
|
|
1142
1086
|
type: "select",
|
|
1143
1087
|
defaultValue: "no-repeat",
|
|
1144
1088
|
options: [
|
|
@@ -1151,42 +1095,42 @@
|
|
|
1151
1095
|
},
|
|
1152
1096
|
{
|
|
1153
1097
|
name: "backgroundSize",
|
|
1154
|
-
text: "
|
|
1098
|
+
text: "背景图大小",
|
|
1155
1099
|
defaultValue: "100% 100%"
|
|
1156
1100
|
}
|
|
1157
1101
|
]
|
|
1158
1102
|
},
|
|
1159
1103
|
{
|
|
1160
1104
|
type: "fieldset",
|
|
1161
|
-
legend: "
|
|
1105
|
+
legend: "字体",
|
|
1162
1106
|
items: [
|
|
1163
1107
|
{
|
|
1164
1108
|
name: "color",
|
|
1165
|
-
text: "
|
|
1109
|
+
text: "颜色",
|
|
1166
1110
|
type: "colorPicker"
|
|
1167
1111
|
},
|
|
1168
1112
|
{
|
|
1169
1113
|
name: "fontSize",
|
|
1170
|
-
text: "
|
|
1114
|
+
text: "大小"
|
|
1171
1115
|
},
|
|
1172
1116
|
{
|
|
1173
1117
|
name: "fontWeight",
|
|
1174
|
-
text: "
|
|
1118
|
+
text: "粗细"
|
|
1175
1119
|
}
|
|
1176
1120
|
]
|
|
1177
1121
|
},
|
|
1178
1122
|
{
|
|
1179
1123
|
type: "fieldset",
|
|
1180
|
-
legend: "
|
|
1124
|
+
legend: "变形",
|
|
1181
1125
|
name: "transform",
|
|
1182
1126
|
items: [
|
|
1183
1127
|
{
|
|
1184
1128
|
name: "rotate",
|
|
1185
|
-
text: "
|
|
1129
|
+
text: "旋转角度"
|
|
1186
1130
|
},
|
|
1187
1131
|
{
|
|
1188
1132
|
name: "scale",
|
|
1189
|
-
text: "
|
|
1133
|
+
text: "缩放"
|
|
1190
1134
|
}
|
|
1191
1135
|
]
|
|
1192
1136
|
}
|
|
@@ -1195,7 +1139,7 @@
|
|
|
1195
1139
|
]
|
|
1196
1140
|
},
|
|
1197
1141
|
{
|
|
1198
|
-
title: "
|
|
1142
|
+
title: "事件",
|
|
1199
1143
|
items: [
|
|
1200
1144
|
{
|
|
1201
1145
|
name: "events",
|
|
@@ -1204,7 +1148,7 @@
|
|
|
1204
1148
|
]
|
|
1205
1149
|
},
|
|
1206
1150
|
{
|
|
1207
|
-
title: "
|
|
1151
|
+
title: "高级",
|
|
1208
1152
|
lazy: true,
|
|
1209
1153
|
items: [
|
|
1210
1154
|
{
|
|
@@ -1437,7 +1381,7 @@
|
|
|
1437
1381
|
left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
|
|
1438
1382
|
};
|
|
1439
1383
|
};
|
|
1440
|
-
const serializeConfig = (config) =>
|
|
1384
|
+
const serializeConfig = (config) => serialize(config, {
|
|
1441
1385
|
space: 2,
|
|
1442
1386
|
unsafe: true
|
|
1443
1387
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
@@ -1463,6 +1407,7 @@
|
|
|
1463
1407
|
canUndo() {
|
|
1464
1408
|
return this.listCursor > 1;
|
|
1465
1409
|
}
|
|
1410
|
+
// 返回undo后的当前元素
|
|
1466
1411
|
undo() {
|
|
1467
1412
|
if (!this.canUndo()) {
|
|
1468
1413
|
return null;
|
|
@@ -1473,6 +1418,7 @@
|
|
|
1473
1418
|
canRedo() {
|
|
1474
1419
|
return this.elementList.length > this.listCursor;
|
|
1475
1420
|
}
|
|
1421
|
+
// 返回redo后的当前元素
|
|
1476
1422
|
redo() {
|
|
1477
1423
|
if (!this.canRedo()) {
|
|
1478
1424
|
return null;
|
|
@@ -1490,17 +1436,17 @@
|
|
|
1490
1436
|
|
|
1491
1437
|
const compose = (middleware) => {
|
|
1492
1438
|
if (!Array.isArray(middleware))
|
|
1493
|
-
throw new TypeError("Middleware
|
|
1439
|
+
throw new TypeError("Middleware 必须是一个数组!");
|
|
1494
1440
|
for (const fn of middleware) {
|
|
1495
1441
|
if (typeof fn !== "function")
|
|
1496
|
-
throw new TypeError("Middleware
|
|
1442
|
+
throw new TypeError("Middleware 必须由函数组成!");
|
|
1497
1443
|
}
|
|
1498
1444
|
return (args, next) => {
|
|
1499
1445
|
let index = -1;
|
|
1500
1446
|
return dispatch(0);
|
|
1501
1447
|
function dispatch(i) {
|
|
1502
1448
|
if (i <= index)
|
|
1503
|
-
return Promise.reject(new Error("next()
|
|
1449
|
+
return Promise.reject(new Error("next() 被多次调用"));
|
|
1504
1450
|
index = i;
|
|
1505
1451
|
let fn = middleware[i];
|
|
1506
1452
|
if (i === middleware.length && next)
|
|
@@ -1705,16 +1651,32 @@
|
|
|
1705
1651
|
constructor() {
|
|
1706
1652
|
super(["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]);
|
|
1707
1653
|
}
|
|
1654
|
+
/**
|
|
1655
|
+
* 获取数据存储对象,可以通过
|
|
1656
|
+
* const storageService = new StorageService();
|
|
1657
|
+
* storageService.usePlugin({
|
|
1658
|
+
* // 替换存储对象为 sessionStorage
|
|
1659
|
+
* async afterGetStorage(): Promise<Storage> {
|
|
1660
|
+
* return window.sessionStorage;
|
|
1661
|
+
* },
|
|
1662
|
+
* });
|
|
1663
|
+
*/
|
|
1708
1664
|
async getStorage() {
|
|
1709
1665
|
return this.storage;
|
|
1710
1666
|
}
|
|
1711
1667
|
async getNamespace() {
|
|
1712
1668
|
return this.namespace;
|
|
1713
1669
|
}
|
|
1670
|
+
/**
|
|
1671
|
+
* 清理,支持storageService.usePlugin
|
|
1672
|
+
*/
|
|
1714
1673
|
async clear() {
|
|
1715
1674
|
const storage2 = await this.getStorage();
|
|
1716
1675
|
storage2.clear();
|
|
1717
1676
|
}
|
|
1677
|
+
/**
|
|
1678
|
+
* 获取存储项,支持storageService.usePlugin
|
|
1679
|
+
*/
|
|
1718
1680
|
async getItem(key, options = {}) {
|
|
1719
1681
|
const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
1720
1682
|
const { protocol = options.protocol, item } = this.getValueAndProtocol(
|
|
@@ -1735,14 +1697,23 @@
|
|
|
1735
1697
|
return item;
|
|
1736
1698
|
}
|
|
1737
1699
|
}
|
|
1700
|
+
/**
|
|
1701
|
+
* 获取指定索引位置的key
|
|
1702
|
+
*/
|
|
1738
1703
|
async key(index) {
|
|
1739
1704
|
const storage2 = await this.getStorage();
|
|
1740
1705
|
return storage2.key(index);
|
|
1741
1706
|
}
|
|
1707
|
+
/**
|
|
1708
|
+
* 移除存储项,支持storageService.usePlugin
|
|
1709
|
+
*/
|
|
1742
1710
|
async removeItem(key2, options2 = {}) {
|
|
1743
1711
|
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
1744
1712
|
storage2.removeItem(`${options2.namespace || namespace2}:${key2}`);
|
|
1745
1713
|
}
|
|
1714
|
+
/**
|
|
1715
|
+
* 设置存储项,支持storageService.usePlugin
|
|
1716
|
+
*/
|
|
1746
1717
|
async setItem(key2, value, options2 = {}) {
|
|
1747
1718
|
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
1748
1719
|
let item2 = value;
|
|
@@ -1750,7 +1721,7 @@
|
|
|
1750
1721
|
if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
|
|
1751
1722
|
item2 = `${protocol2}${value}`;
|
|
1752
1723
|
} else {
|
|
1753
|
-
item2 = `${protocol2}${
|
|
1724
|
+
item2 = `${protocol2}${serialize(value)}`;
|
|
1754
1725
|
}
|
|
1755
1726
|
storage2.setItem(`${options2.namespace || namespace2}:${key2}`, item2);
|
|
1756
1727
|
}
|
|
@@ -1804,9 +1775,19 @@
|
|
|
1804
1775
|
async fillConfig(config) {
|
|
1805
1776
|
return fillConfig(config);
|
|
1806
1777
|
}
|
|
1778
|
+
/**
|
|
1779
|
+
* 为指定类型组件设置组件属性表单配置
|
|
1780
|
+
* @param type 组件类型
|
|
1781
|
+
* @param config 组件属性表单配置
|
|
1782
|
+
*/
|
|
1807
1783
|
async setPropsConfig(type, config) {
|
|
1808
1784
|
this.state.propsConfigMap[type] = await this.fillConfig(Array.isArray(config) ? config : [config]);
|
|
1809
1785
|
}
|
|
1786
|
+
/**
|
|
1787
|
+
* 获取指点类型的组件属性表单配置
|
|
1788
|
+
* @param type 组件类型
|
|
1789
|
+
* @returns 组件属性表单配置
|
|
1790
|
+
*/
|
|
1810
1791
|
async getPropsConfig(type) {
|
|
1811
1792
|
if (type === "area") {
|
|
1812
1793
|
return await this.getPropsConfig("button");
|
|
@@ -1818,9 +1799,19 @@
|
|
|
1818
1799
|
this.setPropsValue(utils.toLine(type), values[type]);
|
|
1819
1800
|
});
|
|
1820
1801
|
}
|
|
1802
|
+
/**
|
|
1803
|
+
* 为指点类型组件设置组件初始值
|
|
1804
|
+
* @param type 组件类型
|
|
1805
|
+
* @param value 组件初始值
|
|
1806
|
+
*/
|
|
1821
1807
|
async setPropsValue(type, value) {
|
|
1822
1808
|
this.state.propsValueMap[type] = value;
|
|
1823
1809
|
}
|
|
1810
|
+
/**
|
|
1811
|
+
* 获取指定类型的组件初始值
|
|
1812
|
+
* @param type 组件类型
|
|
1813
|
+
* @returns 组件初始值
|
|
1814
|
+
*/
|
|
1824
1815
|
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
1825
1816
|
if (type === "area") {
|
|
1826
1817
|
const value = await this.getPropsValue("button");
|
|
@@ -1850,6 +1841,11 @@
|
|
|
1850
1841
|
async createId(type) {
|
|
1851
1842
|
return `${type}_${this.guid()}`;
|
|
1852
1843
|
}
|
|
1844
|
+
/**
|
|
1845
|
+
* 将组件与组件的子元素配置中的id都设置成一个新的ID
|
|
1846
|
+
* @param {Object} config 组件配置
|
|
1847
|
+
*/
|
|
1848
|
+
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
1853
1849
|
async setNewItemId(config) {
|
|
1854
1850
|
config.id = await this.createId(config.type || "component");
|
|
1855
1851
|
if (config.items && Array.isArray(config.items)) {
|
|
@@ -1859,6 +1855,11 @@
|
|
|
1859
1855
|
}
|
|
1860
1856
|
return config;
|
|
1861
1857
|
}
|
|
1858
|
+
/**
|
|
1859
|
+
* 获取默认属性配置
|
|
1860
|
+
* @param type 组件类型
|
|
1861
|
+
* @returns Object
|
|
1862
|
+
*/
|
|
1862
1863
|
async getDefaultPropsValue(type) {
|
|
1863
1864
|
return ["page", "container"].includes(type) ? {
|
|
1864
1865
|
type,
|
|
@@ -1881,6 +1882,11 @@
|
|
|
1881
1882
|
this.removeAllListeners();
|
|
1882
1883
|
this.removeAllPlugins();
|
|
1883
1884
|
}
|
|
1885
|
+
/**
|
|
1886
|
+
* 生成指定位数的GUID,无【-】格式
|
|
1887
|
+
* @param digit 位数,默认值8
|
|
1888
|
+
* @returns
|
|
1889
|
+
*/
|
|
1884
1890
|
guid(digit = 8) {
|
|
1885
1891
|
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
1886
1892
|
const r = Math.random() * 16 | 0;
|
|
@@ -1963,7 +1969,7 @@
|
|
|
1963
1969
|
return newNode;
|
|
1964
1970
|
};
|
|
1965
1971
|
|
|
1966
|
-
|
|
1972
|
+
let Editor$1 = class Editor extends BaseService {
|
|
1967
1973
|
state = vue.reactive({
|
|
1968
1974
|
root: null,
|
|
1969
1975
|
page: null,
|
|
@@ -2000,9 +2006,15 @@
|
|
|
2000
2006
|
"redo",
|
|
2001
2007
|
"highlight"
|
|
2002
2008
|
],
|
|
2009
|
+
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2003
2010
|
["select", "update", "moveLayer"]
|
|
2004
2011
|
);
|
|
2005
2012
|
}
|
|
2013
|
+
/**
|
|
2014
|
+
* 设置当前指点节点配置
|
|
2015
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
2016
|
+
* @param value MNode
|
|
2017
|
+
*/
|
|
2006
2018
|
set(name, value) {
|
|
2007
2019
|
const preValue = this.state[name];
|
|
2008
2020
|
this.state[name] = value;
|
|
@@ -2011,9 +2023,9 @@
|
|
|
2011
2023
|
}
|
|
2012
2024
|
if (name === "root") {
|
|
2013
2025
|
if (Array.isArray(value)) {
|
|
2014
|
-
throw new Error("root
|
|
2026
|
+
throw new Error("root 不能为数组");
|
|
2015
2027
|
}
|
|
2016
|
-
if (value && lodashEs.isObject(value) && !(value instanceof
|
|
2028
|
+
if (value && lodashEs.isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
|
|
2017
2029
|
this.state.pageLength = value.items?.length || 0;
|
|
2018
2030
|
} else {
|
|
2019
2031
|
this.state.pageLength = 0;
|
|
@@ -2021,9 +2033,20 @@
|
|
|
2021
2033
|
this.emit("root-change", value, preValue);
|
|
2022
2034
|
}
|
|
2023
2035
|
}
|
|
2036
|
+
/**
|
|
2037
|
+
* 获取当前指点节点配置
|
|
2038
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
2039
|
+
* @returns MNode
|
|
2040
|
+
*/
|
|
2024
2041
|
get(name) {
|
|
2025
2042
|
return this.state[name];
|
|
2026
2043
|
}
|
|
2044
|
+
/**
|
|
2045
|
+
* 根据id获取组件、组件的父组件以及组件所属的页面节点
|
|
2046
|
+
* @param {number | string} id 组件id
|
|
2047
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2048
|
+
* @returns {EditorNodeInfo}
|
|
2049
|
+
*/
|
|
2027
2050
|
getNodeInfo(id, raw = true) {
|
|
2028
2051
|
let root = this.get("root");
|
|
2029
2052
|
if (raw) {
|
|
@@ -2054,14 +2077,29 @@
|
|
|
2054
2077
|
});
|
|
2055
2078
|
return info;
|
|
2056
2079
|
}
|
|
2080
|
+
/**
|
|
2081
|
+
* 根据ID获取指点节点配置
|
|
2082
|
+
* @param id 组件ID
|
|
2083
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2084
|
+
* @returns 组件节点配置
|
|
2085
|
+
*/
|
|
2057
2086
|
getNodeById(id, raw = true) {
|
|
2058
2087
|
const { node } = this.getNodeInfo(id, raw);
|
|
2059
2088
|
return node;
|
|
2060
2089
|
}
|
|
2090
|
+
/**
|
|
2091
|
+
* 根据ID获取指点节点的父节点配置
|
|
2092
|
+
* @param id 组件ID
|
|
2093
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2094
|
+
* @returns 指点组件的父节点配置
|
|
2095
|
+
*/
|
|
2061
2096
|
getParentById(id, raw = true) {
|
|
2062
2097
|
const { parent } = this.getNodeInfo(id, raw);
|
|
2063
2098
|
return parent;
|
|
2064
2099
|
}
|
|
2100
|
+
/**
|
|
2101
|
+
* 只有容器拥有布局
|
|
2102
|
+
*/
|
|
2065
2103
|
async getLayout(parent, node) {
|
|
2066
2104
|
if (node && typeof node !== "function" && isFixed(node))
|
|
2067
2105
|
return Layout.FIXED;
|
|
@@ -2073,6 +2111,11 @@
|
|
|
2073
2111
|
}
|
|
2074
2112
|
return Layout.ABSOLUTE;
|
|
2075
2113
|
}
|
|
2114
|
+
/**
|
|
2115
|
+
* 选中指定节点(将指定节点设置成当前选中状态)
|
|
2116
|
+
* @param config 指定节点配置或者ID
|
|
2117
|
+
* @returns 当前选中的节点配置
|
|
2118
|
+
*/
|
|
2076
2119
|
async select(config) {
|
|
2077
2120
|
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
2078
2121
|
this.set("nodes", node ? [node] : []);
|
|
@@ -2114,15 +2157,20 @@
|
|
|
2114
2157
|
const root = vue.toRaw(this.get("root"));
|
|
2115
2158
|
const page = vue.toRaw(this.get("page"));
|
|
2116
2159
|
if (!page)
|
|
2117
|
-
throw new Error("page
|
|
2160
|
+
throw new Error("page不能为空");
|
|
2118
2161
|
if (!root)
|
|
2119
|
-
throw new Error("root
|
|
2162
|
+
throw new Error("root不能为空");
|
|
2120
2163
|
const index = getNodeIndex(page, root);
|
|
2121
2164
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
2122
2165
|
await this.select(nextPage);
|
|
2123
2166
|
this.get("stage")?.select(nextPage.id);
|
|
2124
2167
|
return nextPage;
|
|
2125
2168
|
}
|
|
2169
|
+
/**
|
|
2170
|
+
* 高亮指定节点
|
|
2171
|
+
* @param config 指定节点配置或者ID
|
|
2172
|
+
* @returns 当前高亮的节点配置
|
|
2173
|
+
*/
|
|
2126
2174
|
highlight(config) {
|
|
2127
2175
|
const { node } = this.selectedConfigExceptionHandler(config);
|
|
2128
2176
|
const currentHighlightNode = this.get("highlightNode");
|
|
@@ -2130,6 +2178,11 @@
|
|
|
2130
2178
|
return;
|
|
2131
2179
|
this.set("highlightNode", node);
|
|
2132
2180
|
}
|
|
2181
|
+
/**
|
|
2182
|
+
* 多选
|
|
2183
|
+
* @param ids 指定节点ID
|
|
2184
|
+
* @returns 加入多选的节点配置
|
|
2185
|
+
*/
|
|
2133
2186
|
multiSelect(ids) {
|
|
2134
2187
|
const nodes = [];
|
|
2135
2188
|
const idsUnique = lodashEs.uniq(ids);
|
|
@@ -2144,13 +2197,13 @@
|
|
|
2144
2197
|
async doAdd(node, parent) {
|
|
2145
2198
|
const root = this.get("root");
|
|
2146
2199
|
if (!root)
|
|
2147
|
-
throw new Error("root
|
|
2200
|
+
throw new Error("root为空");
|
|
2148
2201
|
const curNode = this.get("node");
|
|
2149
2202
|
const stage = this.get("stage");
|
|
2150
2203
|
if (!curNode)
|
|
2151
|
-
throw new Error("
|
|
2204
|
+
throw new Error("当前选中节点为空");
|
|
2152
2205
|
if ((parent.type === schema.NodeType.ROOT || curNode?.type === schema.NodeType.ROOT) && node.type !== schema.NodeType.PAGE) {
|
|
2153
|
-
throw new Error("app
|
|
2206
|
+
throw new Error("app下不能添加组件");
|
|
2154
2207
|
}
|
|
2155
2208
|
if (parent.id !== curNode.id && node.type !== schema.NodeType.PAGE) {
|
|
2156
2209
|
const index = parent.items.indexOf(curNode);
|
|
@@ -2174,13 +2227,19 @@
|
|
|
2174
2227
|
this.addModifiedNodeId(node.id);
|
|
2175
2228
|
return node;
|
|
2176
2229
|
}
|
|
2230
|
+
/**
|
|
2231
|
+
* 向指点容器添加组件节点
|
|
2232
|
+
* @param addConfig 将要添加的组件节点配置
|
|
2233
|
+
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
2234
|
+
* @returns 添加后的节点
|
|
2235
|
+
*/
|
|
2177
2236
|
async add(addNode, parent) {
|
|
2178
2237
|
const stage = this.get("stage");
|
|
2179
2238
|
const addNodes = [];
|
|
2180
2239
|
if (!Array.isArray(addNode)) {
|
|
2181
2240
|
const { type, inputEvent, ...config } = addNode;
|
|
2182
2241
|
if (!type)
|
|
2183
|
-
throw new Error("
|
|
2242
|
+
throw new Error("组件类型不能为空");
|
|
2184
2243
|
addNodes.push({ ...vue.toRaw(await propsService.getPropsValue(type, config)) });
|
|
2185
2244
|
} else {
|
|
2186
2245
|
addNodes.push(...addNode);
|
|
@@ -2193,7 +2252,7 @@
|
|
|
2193
2252
|
}
|
|
2194
2253
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
2195
2254
|
if (!parentNode)
|
|
2196
|
-
throw new Error("
|
|
2255
|
+
throw new Error("未找到父元素");
|
|
2197
2256
|
return this.doAdd(node, parentNode);
|
|
2198
2257
|
})
|
|
2199
2258
|
);
|
|
@@ -2218,13 +2277,13 @@
|
|
|
2218
2277
|
async doRemove(node) {
|
|
2219
2278
|
const root = this.get("root");
|
|
2220
2279
|
if (!root)
|
|
2221
|
-
throw new Error("root
|
|
2280
|
+
throw new Error("root不能为空");
|
|
2222
2281
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
2223
2282
|
if (!parent || !curNode)
|
|
2224
|
-
throw new Error("
|
|
2283
|
+
throw new Error("找不要删除的节点");
|
|
2225
2284
|
const index = getNodeIndex(curNode, parent);
|
|
2226
2285
|
if (typeof index !== "number" || index === -1)
|
|
2227
|
-
throw new Error("
|
|
2286
|
+
throw new Error("找不要删除的节点");
|
|
2228
2287
|
parent.items?.splice(index, 1);
|
|
2229
2288
|
const stage = this.get("stage");
|
|
2230
2289
|
stage?.remove({ id: node.id, parentId: parent.id, root: lodashEs.cloneDeep(root) });
|
|
@@ -2249,6 +2308,10 @@
|
|
|
2249
2308
|
}
|
|
2250
2309
|
this.addModifiedNodeId(parent.id);
|
|
2251
2310
|
}
|
|
2311
|
+
/**
|
|
2312
|
+
* 删除组件
|
|
2313
|
+
* @param {Object} node
|
|
2314
|
+
*/
|
|
2252
2315
|
async remove(nodeOrNodeList) {
|
|
2253
2316
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
2254
2317
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
@@ -2260,12 +2323,12 @@
|
|
|
2260
2323
|
async doUpdate(config) {
|
|
2261
2324
|
const root = this.get("root");
|
|
2262
2325
|
if (!root)
|
|
2263
|
-
throw new Error("root
|
|
2326
|
+
throw new Error("root为空");
|
|
2264
2327
|
if (!config?.id)
|
|
2265
|
-
throw new Error("
|
|
2328
|
+
throw new Error("没有配置或者配置缺少id值");
|
|
2266
2329
|
const info = this.getNodeInfo(config.id, false);
|
|
2267
2330
|
if (!info.node)
|
|
2268
|
-
throw new Error(
|
|
2331
|
+
throw new Error(`获取不到id为${config.id}的节点`);
|
|
2269
2332
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
2270
2333
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, root);
|
|
2271
2334
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
@@ -2277,18 +2340,18 @@
|
|
|
2277
2340
|
}
|
|
2278
2341
|
});
|
|
2279
2342
|
if (!newConfig.type)
|
|
2280
|
-
throw new Error("
|
|
2343
|
+
throw new Error("配置缺少type值");
|
|
2281
2344
|
if (newConfig.type === schema.NodeType.ROOT) {
|
|
2282
2345
|
this.set("root", newConfig);
|
|
2283
2346
|
return newConfig;
|
|
2284
2347
|
}
|
|
2285
2348
|
const { parent } = info;
|
|
2286
2349
|
if (!parent)
|
|
2287
|
-
throw new Error("
|
|
2350
|
+
throw new Error("获取不到父级节点");
|
|
2288
2351
|
const parentNodeItems = parent.items;
|
|
2289
2352
|
const index = getNodeIndex(newConfig, parent);
|
|
2290
2353
|
if (!parentNodeItems || typeof index === "undefined" || index === -1)
|
|
2291
|
-
throw new Error("
|
|
2354
|
+
throw new Error("更新的节点未找到");
|
|
2292
2355
|
const newLayout = await this.getLayout(newConfig);
|
|
2293
2356
|
const layout = await this.getLayout(node);
|
|
2294
2357
|
if (newLayout !== layout) {
|
|
@@ -2310,6 +2373,11 @@
|
|
|
2310
2373
|
this.addModifiedNodeId(newConfig.id);
|
|
2311
2374
|
return newConfig;
|
|
2312
2375
|
}
|
|
2376
|
+
/**
|
|
2377
|
+
* 更新节点
|
|
2378
|
+
* @param config 新的节点配置,配置中需要有id信息
|
|
2379
|
+
* @returns 更新后的节点配置
|
|
2380
|
+
*/
|
|
2313
2381
|
async update(config) {
|
|
2314
2382
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2315
2383
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
@@ -2317,16 +2385,22 @@
|
|
|
2317
2385
|
this.emit("update", newNodes);
|
|
2318
2386
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
2319
2387
|
}
|
|
2388
|
+
/**
|
|
2389
|
+
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
2390
|
+
* @param id1 组件ID
|
|
2391
|
+
* @param id2 组件ID
|
|
2392
|
+
* @returns void
|
|
2393
|
+
*/
|
|
2320
2394
|
async sort(id1, id2) {
|
|
2321
2395
|
const root = this.get("root");
|
|
2322
2396
|
if (!root)
|
|
2323
|
-
throw new Error("root
|
|
2397
|
+
throw new Error("root为空");
|
|
2324
2398
|
const node = this.get("node");
|
|
2325
2399
|
if (!node)
|
|
2326
|
-
throw new Error("
|
|
2400
|
+
throw new Error("当前节点为空");
|
|
2327
2401
|
const parent = lodashEs.cloneDeep(vue.toRaw(this.get("parent")));
|
|
2328
2402
|
if (!parent)
|
|
2329
|
-
throw new Error("
|
|
2403
|
+
throw new Error("父节点为空");
|
|
2330
2404
|
const index2 = parent.items.findIndex((node2) => `${node2.id}` === `${id2}`);
|
|
2331
2405
|
if (index2 < 0)
|
|
2332
2406
|
return;
|
|
@@ -2342,11 +2416,21 @@
|
|
|
2342
2416
|
this.addModifiedNodeId(parent.id);
|
|
2343
2417
|
this.pushHistoryState();
|
|
2344
2418
|
}
|
|
2419
|
+
/**
|
|
2420
|
+
* 将组将节点配置转化成string,然后存储到localStorage中
|
|
2421
|
+
* @param config 组件节点配置
|
|
2422
|
+
* @returns 组件节点配置
|
|
2423
|
+
*/
|
|
2345
2424
|
async copy(config) {
|
|
2346
2425
|
await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
|
|
2347
2426
|
protocol: Protocol.OBJECT
|
|
2348
2427
|
});
|
|
2349
2428
|
}
|
|
2429
|
+
/**
|
|
2430
|
+
* 从localStorage中获取节点,然后添加到当前容器中
|
|
2431
|
+
* @param position 粘贴的坐标
|
|
2432
|
+
* @returns 添加后的组件节点配置
|
|
2433
|
+
*/
|
|
2350
2434
|
async paste(position = {}) {
|
|
2351
2435
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
2352
2436
|
if (!Array.isArray(config))
|
|
@@ -2369,7 +2453,7 @@
|
|
|
2369
2453
|
async doAlignCenter(config) {
|
|
2370
2454
|
const parent = this.getParentById(config.id);
|
|
2371
2455
|
if (!parent)
|
|
2372
|
-
throw new Error("
|
|
2456
|
+
throw new Error("找不到父节点");
|
|
2373
2457
|
const node = lodashEs.cloneDeep(vue.toRaw(config));
|
|
2374
2458
|
const layout = await this.getLayout(parent, node);
|
|
2375
2459
|
if (layout === Layout.RELATIVE) {
|
|
@@ -2390,6 +2474,11 @@
|
|
|
2390
2474
|
}
|
|
2391
2475
|
return node;
|
|
2392
2476
|
}
|
|
2477
|
+
/**
|
|
2478
|
+
* 将指点节点设置居中
|
|
2479
|
+
* @param config 组件节点配置
|
|
2480
|
+
* @returns 当前组件节点配置
|
|
2481
|
+
*/
|
|
2393
2482
|
async alignCenter(config) {
|
|
2394
2483
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2395
2484
|
const stage = this.get("stage");
|
|
@@ -2402,16 +2491,20 @@
|
|
|
2402
2491
|
}
|
|
2403
2492
|
return newNode;
|
|
2404
2493
|
}
|
|
2494
|
+
/**
|
|
2495
|
+
* 移动当前选中节点位置
|
|
2496
|
+
* @param offset 偏移量
|
|
2497
|
+
*/
|
|
2405
2498
|
async moveLayer(offset) {
|
|
2406
2499
|
const root = this.get("root");
|
|
2407
2500
|
if (!root)
|
|
2408
|
-
throw new Error("root
|
|
2501
|
+
throw new Error("root为空");
|
|
2409
2502
|
const parent = this.get("parent");
|
|
2410
2503
|
if (!parent)
|
|
2411
|
-
throw new Error("
|
|
2504
|
+
throw new Error("父节点为空");
|
|
2412
2505
|
const node = this.get("node");
|
|
2413
2506
|
if (!node)
|
|
2414
|
-
throw new Error("
|
|
2507
|
+
throw new Error("当前节点为空");
|
|
2415
2508
|
const brothers = parent.items || [];
|
|
2416
2509
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2417
2510
|
const layout = await this.getLayout(parent, node);
|
|
@@ -2433,6 +2526,11 @@
|
|
|
2433
2526
|
this.addModifiedNodeId(parent.id);
|
|
2434
2527
|
this.pushHistoryState();
|
|
2435
2528
|
}
|
|
2529
|
+
/**
|
|
2530
|
+
* 移动到指定容器中
|
|
2531
|
+
* @param config 需要移动的节点
|
|
2532
|
+
* @param targetId 容器ID
|
|
2533
|
+
*/
|
|
2436
2534
|
async moveToContainer(config, targetId) {
|
|
2437
2535
|
const root = lodashEs.cloneDeep(this.get("root"));
|
|
2438
2536
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
@@ -2461,11 +2559,19 @@
|
|
|
2461
2559
|
return newConfig;
|
|
2462
2560
|
}
|
|
2463
2561
|
}
|
|
2562
|
+
/**
|
|
2563
|
+
* 撤销当前操作
|
|
2564
|
+
* @returns 上一次数据
|
|
2565
|
+
*/
|
|
2464
2566
|
async undo() {
|
|
2465
2567
|
const value = historyService.undo();
|
|
2466
2568
|
await this.changeHistoryState(value);
|
|
2467
2569
|
return value;
|
|
2468
2570
|
}
|
|
2571
|
+
/**
|
|
2572
|
+
* 恢复到下一步
|
|
2573
|
+
* @returns 下一步数据
|
|
2574
|
+
*/
|
|
2469
2575
|
async redo() {
|
|
2470
2576
|
const value = historyService.redo();
|
|
2471
2577
|
await this.changeHistoryState(value);
|
|
@@ -2561,13 +2667,13 @@
|
|
|
2561
2667
|
id = config.id;
|
|
2562
2668
|
}
|
|
2563
2669
|
if (!id) {
|
|
2564
|
-
throw new Error("
|
|
2670
|
+
throw new Error("没有ID,无法选中");
|
|
2565
2671
|
}
|
|
2566
2672
|
const { node, parent, page } = this.getNodeInfo(id);
|
|
2567
2673
|
if (!node)
|
|
2568
|
-
throw new Error("
|
|
2674
|
+
throw new Error("获取不到组件信息");
|
|
2569
2675
|
if (node.id === this.state.root?.id) {
|
|
2570
|
-
throw new Error("
|
|
2676
|
+
throw new Error("不能选根节点");
|
|
2571
2677
|
}
|
|
2572
2678
|
return {
|
|
2573
2679
|
node,
|
|
@@ -2575,7 +2681,7 @@
|
|
|
2575
2681
|
page
|
|
2576
2682
|
};
|
|
2577
2683
|
}
|
|
2578
|
-
}
|
|
2684
|
+
};
|
|
2579
2685
|
const editorService = new Editor$1();
|
|
2580
2686
|
|
|
2581
2687
|
const state = vue.reactive({
|
|
@@ -2668,7 +2774,7 @@
|
|
|
2668
2774
|
const uiSelectMode = vue.computed(() => uiService.get("uiSelectMode"));
|
|
2669
2775
|
const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
|
|
2670
2776
|
const useStage = (stageOptions) => {
|
|
2671
|
-
const stage = new
|
|
2777
|
+
const stage = new StageCore({
|
|
2672
2778
|
render: stageOptions.render,
|
|
2673
2779
|
runtimeUrl: stageOptions.runtimeUrl,
|
|
2674
2780
|
zoom: zoom.value,
|
|
@@ -2726,7 +2832,7 @@
|
|
|
2726
2832
|
stage.on("select-parent", () => {
|
|
2727
2833
|
const parent = editorService.get("parent");
|
|
2728
2834
|
if (!parent)
|
|
2729
|
-
throw new Error("
|
|
2835
|
+
throw new Error("父节点为空");
|
|
2730
2836
|
editorService.select(parent);
|
|
2731
2837
|
editorService.get("stage")?.select(parent.id);
|
|
2732
2838
|
});
|
|
@@ -2746,13 +2852,13 @@
|
|
|
2746
2852
|
return stage;
|
|
2747
2853
|
};
|
|
2748
2854
|
|
|
2749
|
-
const _hoisted_1$
|
|
2750
|
-
const _hoisted_2$
|
|
2751
|
-
const _hoisted_3$
|
|
2855
|
+
const _hoisted_1$f = { class: "m-editor-empty-panel" };
|
|
2856
|
+
const _hoisted_2$8 = { class: "m-editor-empty-content" };
|
|
2857
|
+
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
2752
2858
|
const __default__$l = vue.defineComponent({
|
|
2753
2859
|
name: "MEditorAddPageBox"
|
|
2754
2860
|
});
|
|
2755
|
-
const _sfc_main$
|
|
2861
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
2756
2862
|
...__default__$l,
|
|
2757
2863
|
setup(__props) {
|
|
2758
2864
|
const services = vue.inject("services");
|
|
@@ -2762,23 +2868,23 @@
|
|
|
2762
2868
|
return;
|
|
2763
2869
|
const root = vue.toRaw(editorService.get("root"));
|
|
2764
2870
|
if (!root)
|
|
2765
|
-
throw new Error("root
|
|
2871
|
+
throw new Error("root 不能为空");
|
|
2766
2872
|
editorService.add({
|
|
2767
2873
|
type: schema.NodeType.PAGE,
|
|
2768
2874
|
name: generatePageNameByApp(root)
|
|
2769
2875
|
});
|
|
2770
2876
|
};
|
|
2771
2877
|
return (_ctx, _cache) => {
|
|
2772
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2773
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
2878
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
2879
|
+
vue.createElementVNode("div", _hoisted_2$8, [
|
|
2774
2880
|
vue.createElementVNode("div", {
|
|
2775
2881
|
class: "m-editor-empty-button",
|
|
2776
2882
|
onClick: clickHandler
|
|
2777
2883
|
}, [
|
|
2778
2884
|
vue.createElementVNode("div", null, [
|
|
2779
|
-
vue.createVNode(_sfc_main$
|
|
2885
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2780
2886
|
]),
|
|
2781
|
-
_hoisted_3$
|
|
2887
|
+
_hoisted_3$4
|
|
2782
2888
|
])
|
|
2783
2889
|
])
|
|
2784
2890
|
]);
|
|
@@ -2786,11 +2892,11 @@
|
|
|
2786
2892
|
}
|
|
2787
2893
|
});
|
|
2788
2894
|
|
|
2789
|
-
const _hoisted_1$
|
|
2895
|
+
const _hoisted_1$e = { class: "m-editor" };
|
|
2790
2896
|
const __default__$k = vue.defineComponent({
|
|
2791
2897
|
name: "MEditorFramework"
|
|
2792
2898
|
});
|
|
2793
|
-
const _sfc_main$
|
|
2899
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
2794
2900
|
...__default__$k,
|
|
2795
2901
|
props: {
|
|
2796
2902
|
codeOptions: { default: () => ({}) }
|
|
@@ -2860,7 +2966,7 @@
|
|
|
2860
2966
|
};
|
|
2861
2967
|
return (_ctx, _cache) => {
|
|
2862
2968
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2863
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2969
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
2864
2970
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2865
2971
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2866
2972
|
key: 0,
|
|
@@ -2868,7 +2974,7 @@
|
|
|
2868
2974
|
"init-values": vue.unref(root),
|
|
2869
2975
|
options: __props.codeOptions,
|
|
2870
2976
|
onSave: saveCode
|
|
2871
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2977
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$q, {
|
|
2872
2978
|
key: 1,
|
|
2873
2979
|
class: "m-editor-content",
|
|
2874
2980
|
"left-class": "m-editor-framework-left",
|
|
@@ -2878,8 +2984,8 @@
|
|
|
2878
2984
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
|
|
2879
2985
|
right: columnWidth.value.right,
|
|
2880
2986
|
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
2881
|
-
"min-left":
|
|
2882
|
-
"min-right":
|
|
2987
|
+
"min-left": 65,
|
|
2988
|
+
"min-right": 20,
|
|
2883
2989
|
onChange: columnWidthChange
|
|
2884
2990
|
}, vue.createSlots({
|
|
2885
2991
|
left: vue.withCtx(() => [
|
|
@@ -2887,7 +2993,7 @@
|
|
|
2887
2993
|
]),
|
|
2888
2994
|
center: vue.withCtx(() => [
|
|
2889
2995
|
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2890
|
-
vue.createVNode(_sfc_main$
|
|
2996
|
+
vue.createVNode(_sfc_main$p)
|
|
2891
2997
|
])
|
|
2892
2998
|
]),
|
|
2893
2999
|
_: 2
|
|
@@ -2909,15 +3015,15 @@
|
|
|
2909
3015
|
}
|
|
2910
3016
|
});
|
|
2911
3017
|
|
|
2912
|
-
const _hoisted_1$
|
|
3018
|
+
const _hoisted_1$d = {
|
|
2913
3019
|
key: 1,
|
|
2914
3020
|
class: "menu-item-text"
|
|
2915
3021
|
};
|
|
2916
|
-
const _hoisted_2$
|
|
3022
|
+
const _hoisted_2$7 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2917
3023
|
const __default__$j = vue.defineComponent({
|
|
2918
3024
|
name: "MEditorToolButton"
|
|
2919
3025
|
});
|
|
2920
|
-
const _sfc_main$
|
|
3026
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
2921
3027
|
...__default__$j,
|
|
2922
3028
|
props: {
|
|
2923
3029
|
data: { default: () => ({
|
|
@@ -2993,7 +3099,7 @@
|
|
|
2993
3099
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
2994
3100
|
key: 0,
|
|
2995
3101
|
direction: __props.data.direction || "vertical"
|
|
2996
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3102
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
2997
3103
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
2998
3104
|
key: 0,
|
|
2999
3105
|
effect: "dark",
|
|
@@ -3007,7 +3113,7 @@
|
|
|
3007
3113
|
disabled: vue.unref(disabled)
|
|
3008
3114
|
}, {
|
|
3009
3115
|
default: vue.withCtx(() => [
|
|
3010
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3116
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
3011
3117
|
key: 0,
|
|
3012
3118
|
icon: __props.data.icon
|
|
3013
3119
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -3024,7 +3130,7 @@
|
|
|
3024
3130
|
disabled: vue.unref(disabled)
|
|
3025
3131
|
}, {
|
|
3026
3132
|
default: vue.withCtx(() => [
|
|
3027
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3133
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
3028
3134
|
key: 0,
|
|
3029
3135
|
icon: __props.data.icon
|
|
3030
3136
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -3057,7 +3163,7 @@
|
|
|
3057
3163
|
})) : vue.createCommentVNode("", true)
|
|
3058
3164
|
]),
|
|
3059
3165
|
default: vue.withCtx(() => [
|
|
3060
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
3166
|
+
vue.createElementVNode("span", _hoisted_2$7, [
|
|
3061
3167
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
3062
3168
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
3063
3169
|
default: vue.withCtx(() => [
|
|
@@ -3077,7 +3183,7 @@
|
|
|
3077
3183
|
const __default__$i = vue.defineComponent({
|
|
3078
3184
|
name: "MEditorNavMenu"
|
|
3079
3185
|
});
|
|
3080
|
-
const _sfc_main$
|
|
3186
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
3081
3187
|
...__default__$i,
|
|
3082
3188
|
props: {
|
|
3083
3189
|
data: { default: () => ({}) },
|
|
@@ -3120,7 +3226,7 @@
|
|
|
3120
3226
|
type: "button",
|
|
3121
3227
|
className: "delete",
|
|
3122
3228
|
icon: vue.markRaw(iconsVue.Delete),
|
|
3123
|
-
tooltip:
|
|
3229
|
+
tooltip: `刪除(Delete)`,
|
|
3124
3230
|
disabled: () => services?.editorService.get("node")?.type === schema.NodeType.PAGE,
|
|
3125
3231
|
handler: () => {
|
|
3126
3232
|
const node = services?.editorService.get("node");
|
|
@@ -3133,7 +3239,7 @@
|
|
|
3133
3239
|
type: "button",
|
|
3134
3240
|
className: "undo",
|
|
3135
3241
|
icon: vue.markRaw(iconsVue.Back),
|
|
3136
|
-
tooltip:
|
|
3242
|
+
tooltip: `后退(${ctrl}+z)`,
|
|
3137
3243
|
disabled: () => !services?.historyService.state.canUndo,
|
|
3138
3244
|
handler: () => services?.editorService.undo()
|
|
3139
3245
|
});
|
|
@@ -3143,7 +3249,7 @@
|
|
|
3143
3249
|
type: "button",
|
|
3144
3250
|
className: "redo",
|
|
3145
3251
|
icon: vue.markRaw(iconsVue.Right),
|
|
3146
|
-
tooltip:
|
|
3252
|
+
tooltip: `前进(${ctrl}+Shift+z)`,
|
|
3147
3253
|
disabled: () => !services?.historyService.state.canRedo,
|
|
3148
3254
|
handler: () => services?.editorService.redo()
|
|
3149
3255
|
});
|
|
@@ -3153,7 +3259,7 @@
|
|
|
3153
3259
|
type: "button",
|
|
3154
3260
|
className: "zoom-in",
|
|
3155
3261
|
icon: vue.markRaw(iconsVue.ZoomIn),
|
|
3156
|
-
tooltip:
|
|
3262
|
+
tooltip: `放大(${ctrl}+=)`,
|
|
3157
3263
|
handler: () => uiService?.zoom(0.1)
|
|
3158
3264
|
});
|
|
3159
3265
|
break;
|
|
@@ -3162,7 +3268,7 @@
|
|
|
3162
3268
|
type: "button",
|
|
3163
3269
|
className: "zoom-out",
|
|
3164
3270
|
icon: vue.markRaw(iconsVue.ZoomOut),
|
|
3165
|
-
tooltip:
|
|
3271
|
+
tooltip: `縮小(${ctrl}+-)`,
|
|
3166
3272
|
handler: () => uiService?.zoom(-0.1)
|
|
3167
3273
|
});
|
|
3168
3274
|
break;
|
|
@@ -3171,7 +3277,7 @@
|
|
|
3171
3277
|
type: "button",
|
|
3172
3278
|
className: "scale-to-original",
|
|
3173
3279
|
icon: vue.markRaw(iconsVue.ScaleToOriginal),
|
|
3174
|
-
tooltip:
|
|
3280
|
+
tooltip: `缩放到实际大小(${ctrl}+1)`,
|
|
3175
3281
|
handler: () => uiService?.set("zoom", 1)
|
|
3176
3282
|
});
|
|
3177
3283
|
break;
|
|
@@ -3180,7 +3286,7 @@
|
|
|
3180
3286
|
type: "button",
|
|
3181
3287
|
className: "scale-to-fit",
|
|
3182
3288
|
icon: vue.markRaw(iconsVue.FullScreen),
|
|
3183
|
-
tooltip:
|
|
3289
|
+
tooltip: `缩放以适应(${ctrl}+0)`,
|
|
3184
3290
|
handler: async () => uiService?.set("zoom", await uiService.calcZoom())
|
|
3185
3291
|
});
|
|
3186
3292
|
break;
|
|
@@ -3189,7 +3295,7 @@
|
|
|
3189
3295
|
type: "button",
|
|
3190
3296
|
className: "rule",
|
|
3191
3297
|
icon: vue.markRaw(iconsVue.Memo),
|
|
3192
|
-
tooltip: showRule.value ? "
|
|
3298
|
+
tooltip: showRule.value ? "隐藏标尺" : "显示标尺",
|
|
3193
3299
|
handler: () => uiService?.set("showRule", !showRule.value)
|
|
3194
3300
|
});
|
|
3195
3301
|
break;
|
|
@@ -3198,7 +3304,7 @@
|
|
|
3198
3304
|
type: "button",
|
|
3199
3305
|
className: "guides",
|
|
3200
3306
|
icon: vue.markRaw(iconsVue.Grid),
|
|
3201
|
-
tooltip: showGuides.value ? "
|
|
3307
|
+
tooltip: showGuides.value ? "隐藏参考线" : "显示参考线",
|
|
3202
3308
|
handler: () => uiService?.set("showGuides", !showGuides.value)
|
|
3203
3309
|
});
|
|
3204
3310
|
break;
|
|
@@ -3236,7 +3342,7 @@
|
|
|
3236
3342
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3237
3343
|
}, [
|
|
3238
3344
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3239
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3345
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
3240
3346
|
data: item,
|
|
3241
3347
|
key: index
|
|
3242
3348
|
}, null, 8, ["data"]);
|
|
@@ -3248,11 +3354,11 @@
|
|
|
3248
3354
|
}
|
|
3249
3355
|
});
|
|
3250
3356
|
|
|
3251
|
-
const _hoisted_1$
|
|
3357
|
+
const _hoisted_1$c = { class: "m-editor-props-panel" };
|
|
3252
3358
|
const __default__$h = vue.defineComponent({
|
|
3253
3359
|
name: "MEditorPropsPanel"
|
|
3254
3360
|
});
|
|
3255
|
-
const _sfc_main$
|
|
3361
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
3256
3362
|
...__default__$h,
|
|
3257
3363
|
emits: ["mounted"],
|
|
3258
3364
|
setup(__props, { expose, emit }) {
|
|
@@ -3298,7 +3404,7 @@
|
|
|
3298
3404
|
};
|
|
3299
3405
|
expose({ submit });
|
|
3300
3406
|
return (_ctx, _cache) => {
|
|
3301
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3407
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
3302
3408
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3303
3409
|
vue.createVNode(vue.unref(form.MForm), {
|
|
3304
3410
|
ref_key: "configForm",
|
|
@@ -3315,7 +3421,7 @@
|
|
|
3315
3421
|
}
|
|
3316
3422
|
});
|
|
3317
3423
|
|
|
3318
|
-
const _sfc_main$
|
|
3424
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
3319
3425
|
__name: "SearchInput",
|
|
3320
3426
|
emits: ["search"],
|
|
3321
3427
|
setup(__props, { emit }) {
|
|
@@ -3329,7 +3435,7 @@
|
|
|
3329
3435
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3330
3436
|
class: "search-input",
|
|
3331
3437
|
size: "small",
|
|
3332
|
-
placeholder: "
|
|
3438
|
+
placeholder: "输入关键字进行过滤",
|
|
3333
3439
|
clearable: "",
|
|
3334
3440
|
"prefix-icon": vue.unref(iconsVue.Search),
|
|
3335
3441
|
onInput: filterTextChangeHandler
|
|
@@ -3338,17 +3444,71 @@
|
|
|
3338
3444
|
}
|
|
3339
3445
|
});
|
|
3340
3446
|
|
|
3447
|
+
const _export_sfc = (sfc, props) => {
|
|
3448
|
+
const target = sfc.__vccOpts || sfc;
|
|
3449
|
+
for (const [key, val] of props) {
|
|
3450
|
+
target[key] = val;
|
|
3451
|
+
}
|
|
3452
|
+
return target;
|
|
3453
|
+
};
|
|
3454
|
+
|
|
3455
|
+
const _sfc_main$j = {};
|
|
3456
|
+
|
|
3457
|
+
const _hoisted_1$b = {
|
|
3458
|
+
width: "16px",
|
|
3459
|
+
height: "16px",
|
|
3460
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3461
|
+
};
|
|
3462
|
+
const _hoisted_2$6 = /*#__PURE__*/vue.createElementVNode("g", {
|
|
3463
|
+
fill: "#7C878E",
|
|
3464
|
+
"fill-rule": "evenodd"
|
|
3465
|
+
}, [
|
|
3466
|
+
/*#__PURE__*/vue.createElementVNode("path", {
|
|
3467
|
+
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",
|
|
3468
|
+
"fill-rule": "nonzero"
|
|
3469
|
+
}),
|
|
3470
|
+
/*#__PURE__*/vue.createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
3471
|
+
], -1);
|
|
3472
|
+
const _hoisted_3$3 = [
|
|
3473
|
+
_hoisted_2$6
|
|
3474
|
+
];
|
|
3475
|
+
|
|
3476
|
+
function _sfc_render$2(_ctx, _cache) {
|
|
3477
|
+
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$b, _hoisted_3$3))
|
|
3478
|
+
}
|
|
3479
|
+
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$j, [['render',_sfc_render$2]]);
|
|
3480
|
+
|
|
3481
|
+
const _sfc_main$i = {};
|
|
3482
|
+
|
|
3483
|
+
const _hoisted_1$a = {
|
|
3484
|
+
width: "32px",
|
|
3485
|
+
height: "32px",
|
|
3486
|
+
viewBox: "0 0 32 32",
|
|
3487
|
+
version: "1.1",
|
|
3488
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3489
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3490
|
+
};
|
|
3491
|
+
const _hoisted_2$5 = /*#__PURE__*/vue.createStaticVNode("<title>gsd-icon-line-Universal-code</title><desc>Created with Sketch.</desc><defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 4);
|
|
3492
|
+
const _hoisted_6 = [
|
|
3493
|
+
_hoisted_2$5
|
|
3494
|
+
];
|
|
3495
|
+
|
|
3496
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
3497
|
+
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$a, _hoisted_6))
|
|
3498
|
+
}
|
|
3499
|
+
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$i, [['render',_sfc_render$1]]);
|
|
3500
|
+
|
|
3341
3501
|
const _hoisted_1$9 = {
|
|
3342
3502
|
key: 0,
|
|
3343
3503
|
class: "m-editor-content-bottom"
|
|
3344
3504
|
};
|
|
3345
|
-
const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("
|
|
3346
|
-
const _hoisted_3$2 = /* @__PURE__ */ vue.createTextVNode("
|
|
3505
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("确认");
|
|
3506
|
+
const _hoisted_3$2 = /* @__PURE__ */ vue.createTextVNode("关闭");
|
|
3347
3507
|
const _hoisted_4$2 = {
|
|
3348
3508
|
key: 1,
|
|
3349
3509
|
class: "m-editor-content-bottom"
|
|
3350
3510
|
};
|
|
3351
|
-
const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("
|
|
3511
|
+
const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("关闭");
|
|
3352
3512
|
const __default__$g = vue.defineComponent({
|
|
3353
3513
|
name: "MEditorCodeDraftEditor"
|
|
3354
3514
|
});
|
|
@@ -3363,7 +3523,7 @@
|
|
|
3363
3523
|
language: null
|
|
3364
3524
|
},
|
|
3365
3525
|
emits: ["close", "saveAndClose"],
|
|
3366
|
-
setup(__props, { emit }) {
|
|
3526
|
+
setup(__props, { expose, emit }) {
|
|
3367
3527
|
const props = __props;
|
|
3368
3528
|
const services = vue.inject("services");
|
|
3369
3529
|
const codeContent = vue.ref("");
|
|
@@ -3393,7 +3553,7 @@
|
|
|
3393
3553
|
return;
|
|
3394
3554
|
}
|
|
3395
3555
|
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3396
|
-
design.tMagicMessage.success(
|
|
3556
|
+
design.tMagicMessage.success(`代码草稿成功保存到本地 ${utils.datetimeFormatter( new Date())}`);
|
|
3397
3557
|
};
|
|
3398
3558
|
const saveAndClose = () => {
|
|
3399
3559
|
if (!codeEditor.value || !props.editable)
|
|
@@ -3404,19 +3564,20 @@
|
|
|
3404
3564
|
const close = async () => {
|
|
3405
3565
|
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3406
3566
|
if (codeDraft) {
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3567
|
+
try {
|
|
3568
|
+
await design.tMagicMessageBox.confirm("您有代码修改未保存,是否保存后再关闭?", "提示", {
|
|
3569
|
+
confirmButtonText: "保存并关闭",
|
|
3570
|
+
cancelButtonText: "直接关闭",
|
|
3571
|
+
type: "warning",
|
|
3572
|
+
distinguishCancelAndClose: true
|
|
3573
|
+
});
|
|
3413
3574
|
saveAndClose();
|
|
3414
|
-
}
|
|
3575
|
+
} catch (action) {
|
|
3415
3576
|
if (action === "cancel") {
|
|
3416
3577
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3417
3578
|
emit("close");
|
|
3418
3579
|
}
|
|
3419
|
-
}
|
|
3580
|
+
}
|
|
3420
3581
|
} else {
|
|
3421
3582
|
emit("close");
|
|
3422
3583
|
}
|
|
@@ -3427,11 +3588,15 @@
|
|
|
3427
3588
|
codeEditor.value.focus();
|
|
3428
3589
|
}
|
|
3429
3590
|
};
|
|
3591
|
+
expose({
|
|
3592
|
+
saveAndClose,
|
|
3593
|
+
close
|
|
3594
|
+
});
|
|
3430
3595
|
return (_ctx, _cache) => {
|
|
3431
3596
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3432
3597
|
class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3433
3598
|
}, [
|
|
3434
|
-
vue.createVNode(_sfc_main$
|
|
3599
|
+
vue.createVNode(_sfc_main$s, {
|
|
3435
3600
|
ref_key: "codeEditor",
|
|
3436
3601
|
ref: codeEditor,
|
|
3437
3602
|
class: "m-editor-container",
|
|
@@ -3447,7 +3612,7 @@
|
|
|
3447
3612
|
onClick: toggleFullScreen
|
|
3448
3613
|
}, {
|
|
3449
3614
|
default: vue.withCtx(() => [
|
|
3450
|
-
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "
|
|
3615
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3451
3616
|
]),
|
|
3452
3617
|
_: 1
|
|
3453
3618
|
}),
|
|
@@ -3478,7 +3643,7 @@
|
|
|
3478
3643
|
onClick: toggleFullScreen
|
|
3479
3644
|
}, {
|
|
3480
3645
|
default: vue.withCtx(() => [
|
|
3481
|
-
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "
|
|
3646
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3482
3647
|
]),
|
|
3483
3648
|
_: 1
|
|
3484
3649
|
}),
|
|
@@ -3499,9 +3664,9 @@
|
|
|
3499
3664
|
});
|
|
3500
3665
|
|
|
3501
3666
|
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3502
|
-
const _hoisted_2$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "
|
|
3667
|
+
const _hoisted_2$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
3503
3668
|
const _hoisted_3$1 = { class: "code-name-wrapper" };
|
|
3504
|
-
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "
|
|
3669
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
3505
3670
|
const __default__$f = vue.defineComponent({
|
|
3506
3671
|
name: "MEditorFunctionEditor"
|
|
3507
3672
|
});
|
|
@@ -3516,27 +3681,26 @@
|
|
|
3516
3681
|
codeOptions: null,
|
|
3517
3682
|
paramsColConfig: null
|
|
3518
3683
|
},
|
|
3519
|
-
|
|
3520
|
-
setup(__props, { emit }) {
|
|
3684
|
+
setup(__props, { expose }) {
|
|
3521
3685
|
const props = __props;
|
|
3522
3686
|
const defaultParamColConfig = {
|
|
3523
3687
|
type: "row",
|
|
3524
|
-
label: "
|
|
3688
|
+
label: "参数类型",
|
|
3525
3689
|
items: [
|
|
3526
3690
|
{
|
|
3527
|
-
text: "
|
|
3691
|
+
text: "参数类型",
|
|
3528
3692
|
labelWidth: "70px",
|
|
3529
3693
|
type: "select",
|
|
3530
3694
|
name: "type",
|
|
3531
3695
|
options: [
|
|
3532
3696
|
{
|
|
3533
|
-
text: "
|
|
3534
|
-
label: "
|
|
3697
|
+
text: "数字",
|
|
3698
|
+
label: "数字",
|
|
3535
3699
|
value: "number"
|
|
3536
3700
|
},
|
|
3537
3701
|
{
|
|
3538
|
-
text: "
|
|
3539
|
-
label: "
|
|
3702
|
+
text: "字符串",
|
|
3703
|
+
label: "字符串",
|
|
3540
3704
|
value: "text"
|
|
3541
3705
|
}
|
|
3542
3706
|
]
|
|
@@ -3554,13 +3718,13 @@
|
|
|
3554
3718
|
items: [
|
|
3555
3719
|
{
|
|
3556
3720
|
type: "text",
|
|
3557
|
-
label: "
|
|
3721
|
+
label: "参数名",
|
|
3558
3722
|
name: "name",
|
|
3559
3723
|
width: 200
|
|
3560
3724
|
},
|
|
3561
3725
|
{
|
|
3562
3726
|
type: "text",
|
|
3563
|
-
label: "
|
|
3727
|
+
label: "参数注释",
|
|
3564
3728
|
name: "tip",
|
|
3565
3729
|
width: 200
|
|
3566
3730
|
},
|
|
@@ -3571,11 +3735,6 @@
|
|
|
3571
3735
|
const codeName = vue.ref("");
|
|
3572
3736
|
const codeContent = vue.ref("");
|
|
3573
3737
|
const evalRes = vue.ref(true);
|
|
3574
|
-
vue.provide("mForm", {
|
|
3575
|
-
$emit: emit,
|
|
3576
|
-
setField: () => {
|
|
3577
|
-
}
|
|
3578
|
-
});
|
|
3579
3738
|
const tableModel = vue.ref();
|
|
3580
3739
|
vue.watchEffect(() => {
|
|
3581
3740
|
codeName.value = props.name;
|
|
@@ -3609,7 +3768,7 @@
|
|
|
3609
3768
|
content: codeValue2,
|
|
3610
3769
|
params: tableModel.value?.params || []
|
|
3611
3770
|
});
|
|
3612
|
-
design.tMagicMessage.success("
|
|
3771
|
+
design.tMagicMessage.success("代码成功保存到本地");
|
|
3613
3772
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3614
3773
|
}
|
|
3615
3774
|
};
|
|
@@ -3622,6 +3781,10 @@
|
|
|
3622
3781
|
const close = () => {
|
|
3623
3782
|
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3624
3783
|
};
|
|
3784
|
+
const codeDraftEditor = vue.ref();
|
|
3785
|
+
expose({
|
|
3786
|
+
codeDraftEditor
|
|
3787
|
+
});
|
|
3625
3788
|
return (_ctx, _cache) => {
|
|
3626
3789
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
3627
3790
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
@@ -3650,6 +3813,8 @@
|
|
|
3650
3813
|
]),
|
|
3651
3814
|
default: vue.withCtx(() => [
|
|
3652
3815
|
vue.createVNode(_sfc_main$h, {
|
|
3816
|
+
ref_key: "codeDraftEditor",
|
|
3817
|
+
ref: codeDraftEditor,
|
|
3653
3818
|
id: __props.id,
|
|
3654
3819
|
content: codeContent.value,
|
|
3655
3820
|
editable: __props.editable,
|
|
@@ -3710,19 +3875,24 @@
|
|
|
3710
3875
|
});
|
|
3711
3876
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3712
3877
|
});
|
|
3878
|
+
const functionEditor = vue.ref();
|
|
3879
|
+
const handleClose = async () => {
|
|
3880
|
+
await functionEditor.value?.codeDraftEditor?.close();
|
|
3881
|
+
};
|
|
3713
3882
|
return (_ctx, _cache) => {
|
|
3714
3883
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDrawer), {
|
|
3715
3884
|
class: "code-editor-dialog",
|
|
3716
3885
|
"model-value": true,
|
|
3717
3886
|
title: currentTitle.value,
|
|
3718
|
-
"close-on-press-escape":
|
|
3887
|
+
"close-on-press-escape": true,
|
|
3719
3888
|
"append-to-body": true,
|
|
3720
3889
|
"show-close": false,
|
|
3721
|
-
"close-on-click-modal":
|
|
3722
|
-
size: vue.unref(size)
|
|
3890
|
+
"close-on-click-modal": true,
|
|
3891
|
+
size: vue.unref(size),
|
|
3892
|
+
"before-close": handleClose
|
|
3723
3893
|
}, {
|
|
3724
3894
|
default: vue.withCtx(() => [
|
|
3725
|
-
vue.createVNode(_sfc_main$
|
|
3895
|
+
vue.createVNode(_sfc_main$q, {
|
|
3726
3896
|
left: left.value,
|
|
3727
3897
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3728
3898
|
"min-left": 45,
|
|
@@ -3733,6 +3903,8 @@
|
|
|
3733
3903
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3734
3904
|
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
|
|
3735
3905
|
key: 0,
|
|
3906
|
+
ref_key: "functionEditor",
|
|
3907
|
+
ref: functionEditor,
|
|
3736
3908
|
id: vue.unref(id),
|
|
3737
3909
|
name: codeConfig.value.name,
|
|
3738
3910
|
content: codeConfig.value.content,
|
|
@@ -3753,12 +3925,11 @@
|
|
|
3753
3925
|
});
|
|
3754
3926
|
|
|
3755
3927
|
const _hoisted_1$6 = { class: "code-header-wrapper" };
|
|
3756
|
-
const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("
|
|
3928
|
+
const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("新增");
|
|
3757
3929
|
const _hoisted_3 = ["id"];
|
|
3758
3930
|
const _hoisted_4 = { class: "list-item" };
|
|
3759
|
-
const _hoisted_5 = {
|
|
3760
|
-
|
|
3761
|
-
key: 0,
|
|
3931
|
+
const _hoisted_5 = {
|
|
3932
|
+
key: 2,
|
|
3762
3933
|
class: "right-tool"
|
|
3763
3934
|
};
|
|
3764
3935
|
const __default__$d = vue.defineComponent({
|
|
@@ -3774,28 +3945,32 @@
|
|
|
3774
3945
|
const props = __props;
|
|
3775
3946
|
const { codeBlockService, depService, editorService } = vue.inject("services") || {};
|
|
3776
3947
|
const codeList = vue.computed(
|
|
3777
|
-
() => Object.values(depService?.targets["code-block"] || {}).map((target) =>
|
|
3778
|
-
|
|
3779
|
-
name: target.name,
|
|
3780
|
-
type: "code",
|
|
3781
|
-
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
3782
|
-
children: Object.entries(target.deps).map(([id, dep]) => ({
|
|
3948
|
+
() => Object.values(depService?.targets["code-block"] || {}).map((target) => {
|
|
3949
|
+
const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
|
|
3783
3950
|
name: dep.name,
|
|
3784
3951
|
type: "node",
|
|
3785
3952
|
id,
|
|
3786
3953
|
children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
|
|
3787
|
-
}))
|
|
3788
|
-
|
|
3954
|
+
}));
|
|
3955
|
+
return {
|
|
3956
|
+
id: target.id,
|
|
3957
|
+
name: target.name,
|
|
3958
|
+
type: "code",
|
|
3959
|
+
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
3960
|
+
children: compNodes
|
|
3961
|
+
};
|
|
3962
|
+
})
|
|
3789
3963
|
);
|
|
3964
|
+
const expandedKeys = vue.computed(() => codeList.value.map((item) => item.id));
|
|
3790
3965
|
const editable = vue.computed(() => codeBlockService?.getEditStatus());
|
|
3791
3966
|
const isShowCodeBlockEditor = vue.computed(() => codeBlockService?.getCodeEditorShowStatus() || false);
|
|
3792
3967
|
const createCodeBlock = async () => {
|
|
3793
3968
|
if (!codeBlockService) {
|
|
3794
|
-
design.tMagicMessage.error("
|
|
3969
|
+
design.tMagicMessage.error("新增代码块失败");
|
|
3795
3970
|
return;
|
|
3796
3971
|
}
|
|
3797
3972
|
const codeConfig = {
|
|
3798
|
-
name: "
|
|
3973
|
+
name: "代码块",
|
|
3799
3974
|
content: `({app, params}) => {
|
|
3800
3975
|
// place your code here
|
|
3801
3976
|
}`,
|
|
@@ -3818,7 +3993,7 @@
|
|
|
3818
3993
|
if (typeof props.customError === "function") {
|
|
3819
3994
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3820
3995
|
} else {
|
|
3821
|
-
design.tMagicMessage.error("
|
|
3996
|
+
design.tMagicMessage.error("代码块删除失败");
|
|
3822
3997
|
}
|
|
3823
3998
|
}
|
|
3824
3999
|
};
|
|
@@ -3849,7 +4024,7 @@
|
|
|
3849
4024
|
default: vue.withCtx(() => [
|
|
3850
4025
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3851
4026
|
vue.createElementVNode("div", _hoisted_1$6, [
|
|
3852
|
-
vue.createVNode(_sfc_main$
|
|
4027
|
+
vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
3853
4028
|
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3854
4029
|
key: 0,
|
|
3855
4030
|
class: "create-code-button",
|
|
@@ -3869,8 +4044,8 @@
|
|
|
3869
4044
|
ref: tree,
|
|
3870
4045
|
class: "magic-editor-layer-tree",
|
|
3871
4046
|
"node-key": "id",
|
|
3872
|
-
"empty-text": "
|
|
3873
|
-
"default-
|
|
4047
|
+
"empty-text": "暂无代码块",
|
|
4048
|
+
"default-expanded-keys": vue.unref(expandedKeys),
|
|
3874
4049
|
"expand-on-click-node": false,
|
|
3875
4050
|
data: vue.unref(codeList),
|
|
3876
4051
|
"highlight-current": true,
|
|
@@ -3883,15 +4058,25 @@
|
|
|
3883
4058
|
class: "list-container"
|
|
3884
4059
|
}, [
|
|
3885
4060
|
vue.createElementVNode("div", _hoisted_4, [
|
|
3886
|
-
|
|
3887
|
-
|
|
4061
|
+
data.type === "code" ? (vue.openBlock(), vue.createBlock(CodeIcon, {
|
|
4062
|
+
key: 0,
|
|
4063
|
+
class: "codeIcon"
|
|
4064
|
+
})) : vue.createCommentVNode("", true),
|
|
4065
|
+
data.type === "node" ? (vue.openBlock(), vue.createBlock(AppManageIcon, {
|
|
4066
|
+
key: 1,
|
|
4067
|
+
class: "compIcon"
|
|
4068
|
+
})) : vue.createCommentVNode("", true),
|
|
4069
|
+
vue.createElementVNode("span", {
|
|
4070
|
+
class: vue.normalizeClass(["code-name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4071
|
+
}, vue.toDisplayString(data.name) + "(" + vue.toDisplayString(data.id) + ")", 3),
|
|
4072
|
+
data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
3888
4073
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
3889
4074
|
effect: "dark",
|
|
3890
|
-
content: vue.unref(editable) ? "
|
|
4075
|
+
content: vue.unref(editable) ? "编辑" : "查看",
|
|
3891
4076
|
placement: "bottom"
|
|
3892
4077
|
}, {
|
|
3893
4078
|
default: vue.withCtx(() => [
|
|
3894
|
-
vue.createVNode(_sfc_main$
|
|
4079
|
+
vue.createVNode(_sfc_main$w, {
|
|
3895
4080
|
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3896
4081
|
class: "edit-icon",
|
|
3897
4082
|
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3902,11 +4087,11 @@
|
|
|
3902
4087
|
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3903
4088
|
key: 0,
|
|
3904
4089
|
effect: "dark",
|
|
3905
|
-
content: "
|
|
4090
|
+
content: "删除",
|
|
3906
4091
|
placement: "bottom"
|
|
3907
4092
|
}, {
|
|
3908
4093
|
default: vue.withCtx(() => [
|
|
3909
|
-
vue.createVNode(_sfc_main$
|
|
4094
|
+
vue.createVNode(_sfc_main$w, {
|
|
3910
4095
|
icon: vue.unref(iconsVue.Close),
|
|
3911
4096
|
class: "edit-icon",
|
|
3912
4097
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3923,7 +4108,7 @@
|
|
|
3923
4108
|
], 8, _hoisted_3)
|
|
3924
4109
|
]),
|
|
3925
4110
|
_: 3
|
|
3926
|
-
}, 8, ["data"]),
|
|
4111
|
+
}, 8, ["default-expanded-keys", "data"]),
|
|
3927
4112
|
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
|
|
3928
4113
|
key: 0,
|
|
3929
4114
|
paramsColConfig: __props.paramsColConfig
|
|
@@ -3978,7 +4163,7 @@
|
|
|
3978
4163
|
e.dataTransfer.effectAllowed = "move";
|
|
3979
4164
|
e.dataTransfer.setData(
|
|
3980
4165
|
"data",
|
|
3981
|
-
|
|
4166
|
+
serialize({
|
|
3982
4167
|
name: text,
|
|
3983
4168
|
type,
|
|
3984
4169
|
...data
|
|
@@ -4021,7 +4206,7 @@
|
|
|
4021
4206
|
"model-value": vue.unref(collapseValue)
|
|
4022
4207
|
}, {
|
|
4023
4208
|
default: vue.withCtx(() => [
|
|
4024
|
-
vue.createVNode(_sfc_main$
|
|
4209
|
+
vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4025
4210
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
|
|
4026
4211
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
4027
4212
|
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
@@ -4029,7 +4214,7 @@
|
|
|
4029
4214
|
name: `${index}`
|
|
4030
4215
|
}, {
|
|
4031
4216
|
title: vue.withCtx(() => [
|
|
4032
|
-
vue.createVNode(_sfc_main$
|
|
4217
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
4033
4218
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
4034
4219
|
]),
|
|
4035
4220
|
default: vue.withCtx(() => [
|
|
@@ -4044,7 +4229,7 @@
|
|
|
4044
4229
|
onDrag: dragHandler
|
|
4045
4230
|
}, [
|
|
4046
4231
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4047
|
-
vue.createVNode(_sfc_main$
|
|
4232
|
+
vue.createVNode(_sfc_main$w, {
|
|
4048
4233
|
icon: item.icon
|
|
4049
4234
|
}, null, 8, ["icon"]),
|
|
4050
4235
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -4167,7 +4352,7 @@
|
|
|
4167
4352
|
}, [
|
|
4168
4353
|
vue.createElementVNode("div", null, [
|
|
4169
4354
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
4170
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4355
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
4171
4356
|
"event-type": "mouseup",
|
|
4172
4357
|
data: item,
|
|
4173
4358
|
key: index,
|
|
@@ -4225,7 +4410,7 @@
|
|
|
4225
4410
|
if (node.value?.type === "tabs") {
|
|
4226
4411
|
return [
|
|
4227
4412
|
{
|
|
4228
|
-
text: "
|
|
4413
|
+
text: "标签页",
|
|
4229
4414
|
type: "button",
|
|
4230
4415
|
icon: iconsVue.Files,
|
|
4231
4416
|
handler: () => {
|
|
@@ -4255,14 +4440,14 @@
|
|
|
4255
4440
|
const menuData = vue.computed(() => [
|
|
4256
4441
|
{
|
|
4257
4442
|
type: "button",
|
|
4258
|
-
text: "
|
|
4443
|
+
text: "新增",
|
|
4259
4444
|
icon: vue.markRaw(iconsVue.Plus),
|
|
4260
4445
|
display: () => node.value?.items,
|
|
4261
4446
|
items: getSubMenuData.value
|
|
4262
4447
|
},
|
|
4263
4448
|
{
|
|
4264
4449
|
type: "button",
|
|
4265
|
-
text: "
|
|
4450
|
+
text: "复制",
|
|
4266
4451
|
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
4267
4452
|
display: () => !isRoot.value,
|
|
4268
4453
|
handler: () => {
|
|
@@ -4271,7 +4456,7 @@
|
|
|
4271
4456
|
},
|
|
4272
4457
|
{
|
|
4273
4458
|
type: "button",
|
|
4274
|
-
text: "
|
|
4459
|
+
text: "删除",
|
|
4275
4460
|
icon: vue.markRaw(iconsVue.Delete),
|
|
4276
4461
|
display: () => !isRoot.value && !isPage.value,
|
|
4277
4462
|
handler: () => {
|
|
@@ -4335,7 +4520,7 @@
|
|
|
4335
4520
|
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
4336
4521
|
const select = async (data) => {
|
|
4337
4522
|
if (!data.id) {
|
|
4338
|
-
throw new Error("
|
|
4523
|
+
throw new Error("没有id");
|
|
4339
4524
|
}
|
|
4340
4525
|
await editorService?.select(data);
|
|
4341
4526
|
editorService?.get("stage")?.select(data.id);
|
|
@@ -4346,7 +4531,7 @@
|
|
|
4346
4531
|
};
|
|
4347
4532
|
const highlight = (data) => {
|
|
4348
4533
|
if (!data?.id) {
|
|
4349
|
-
throw new Error("
|
|
4534
|
+
throw new Error("没有id");
|
|
4350
4535
|
}
|
|
4351
4536
|
editorService?.highlight(data);
|
|
4352
4537
|
editorService?.get("stage")?.highlight(data.id);
|
|
@@ -4359,7 +4544,7 @@
|
|
|
4359
4544
|
return false;
|
|
4360
4545
|
if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
|
|
4361
4546
|
return false;
|
|
4362
|
-
if (!data
|
|
4547
|
+
if (!data?.type)
|
|
4363
4548
|
return false;
|
|
4364
4549
|
if (["prev", "next"].includes(type))
|
|
4365
4550
|
return true;
|
|
@@ -4444,7 +4629,7 @@
|
|
|
4444
4629
|
let keycon;
|
|
4445
4630
|
vue.onMounted(() => {
|
|
4446
4631
|
editorService?.on("remove", editorServiceRemoveHandler);
|
|
4447
|
-
keycon = new
|
|
4632
|
+
keycon = new KeyController();
|
|
4448
4633
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4449
4634
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4450
4635
|
keycon.keydown((e) => {
|
|
@@ -4498,14 +4683,14 @@
|
|
|
4498
4683
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4499
4684
|
default: vue.withCtx(() => [
|
|
4500
4685
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4501
|
-
vue.createVNode(_sfc_main$
|
|
4686
|
+
vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4502
4687
|
vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
4503
4688
|
key: 0,
|
|
4504
4689
|
class: "magic-editor-layer-tree",
|
|
4505
4690
|
ref_key: "tree",
|
|
4506
4691
|
ref: tree,
|
|
4507
4692
|
"node-key": "id",
|
|
4508
|
-
"empty-text": "
|
|
4693
|
+
"empty-text": "页面空荡荡的",
|
|
4509
4694
|
draggable: "",
|
|
4510
4695
|
"default-expanded-keys": expandedKeys.value,
|
|
4511
4696
|
"default-checked-keys": checkedKeys.value,
|
|
@@ -4567,7 +4752,7 @@
|
|
|
4567
4752
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4568
4753
|
...__default__$8,
|
|
4569
4754
|
props: {
|
|
4570
|
-
data: { default: () => ({ type: "tabs", status: "
|
|
4755
|
+
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block"] }) },
|
|
4571
4756
|
layerContentMenu: null
|
|
4572
4757
|
},
|
|
4573
4758
|
setup(__props, { expose }) {
|
|
@@ -4580,7 +4765,7 @@
|
|
|
4580
4765
|
$key: "component-list",
|
|
4581
4766
|
type: "component",
|
|
4582
4767
|
icon: iconsVue.Coin,
|
|
4583
|
-
text: "
|
|
4768
|
+
text: "组件",
|
|
4584
4769
|
component: _sfc_main$d,
|
|
4585
4770
|
slots: {}
|
|
4586
4771
|
},
|
|
@@ -4588,7 +4773,7 @@
|
|
|
4588
4773
|
$key: "layer",
|
|
4589
4774
|
type: "component",
|
|
4590
4775
|
icon: iconsVue.Files,
|
|
4591
|
-
text: "
|
|
4776
|
+
text: "已选组件",
|
|
4592
4777
|
props: {
|
|
4593
4778
|
layerContentMenu: props.layerContentMenu
|
|
4594
4779
|
},
|
|
@@ -4599,7 +4784,7 @@
|
|
|
4599
4784
|
$key: "code-block",
|
|
4600
4785
|
type: "component",
|
|
4601
4786
|
icon: iconsVue.EditPen,
|
|
4602
|
-
text: "
|
|
4787
|
+
text: "代码编辑",
|
|
4603
4788
|
component: _sfc_main$e,
|
|
4604
4789
|
slots: {}
|
|
4605
4790
|
}
|
|
@@ -4635,7 +4820,7 @@
|
|
|
4635
4820
|
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4636
4821
|
key: config.text
|
|
4637
4822
|
}, [
|
|
4638
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4823
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
4639
4824
|
key: 0,
|
|
4640
4825
|
icon: config.icon
|
|
4641
4826
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -4837,7 +5022,7 @@
|
|
|
4837
5022
|
return;
|
|
4838
5023
|
const root = vue.toRaw(editorService.get("root"));
|
|
4839
5024
|
if (!root)
|
|
4840
|
-
throw new Error("root
|
|
5025
|
+
throw new Error("root 不能为空");
|
|
4841
5026
|
const pageConfig = {
|
|
4842
5027
|
type: schema.NodeType.PAGE,
|
|
4843
5028
|
name: generatePageNameByApp(root)
|
|
@@ -4856,14 +5041,14 @@
|
|
|
4856
5041
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4857
5042
|
onClick: addPage
|
|
4858
5043
|
}, [
|
|
4859
|
-
vue.createVNode(_sfc_main$
|
|
5044
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4860
5045
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4861
5046
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4862
5047
|
key: 2,
|
|
4863
5048
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4864
5049
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4865
5050
|
}, [
|
|
4866
|
-
vue.createVNode(_sfc_main$
|
|
5051
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4867
5052
|
])) : vue.createCommentVNode("", true),
|
|
4868
5053
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4869
5054
|
key: 3,
|
|
@@ -4879,7 +5064,7 @@
|
|
|
4879
5064
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4880
5065
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4881
5066
|
}, [
|
|
4882
|
-
vue.createVNode(_sfc_main$
|
|
5067
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4883
5068
|
])) : vue.createCommentVNode("", true)
|
|
4884
5069
|
], 512);
|
|
4885
5070
|
};
|
|
@@ -4951,18 +5136,18 @@
|
|
|
4951
5136
|
default: vue.withCtx(() => [
|
|
4952
5137
|
vue.createElementVNode("div", null, [
|
|
4953
5138
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4954
|
-
vue.createVNode(_sfc_main$
|
|
5139
|
+
vue.createVNode(_sfc_main$n, {
|
|
4955
5140
|
data: {
|
|
4956
5141
|
type: "button",
|
|
4957
|
-
text: "
|
|
5142
|
+
text: "复制",
|
|
4958
5143
|
icon: vue.unref(iconsVue.DocumentCopy),
|
|
4959
5144
|
handler: () => copy(item)
|
|
4960
5145
|
}
|
|
4961
5146
|
}, null, 8, ["data"]),
|
|
4962
|
-
vue.createVNode(_sfc_main$
|
|
5147
|
+
vue.createVNode(_sfc_main$n, {
|
|
4963
5148
|
data: {
|
|
4964
5149
|
type: "button",
|
|
4965
|
-
text: "
|
|
5150
|
+
text: "删除",
|
|
4966
5151
|
icon: vue.unref(iconsVue.Delete),
|
|
4967
5152
|
handler: () => remove(item)
|
|
4968
5153
|
}
|
|
@@ -5136,7 +5321,7 @@
|
|
|
5136
5321
|
if (!thumb.value)
|
|
5137
5322
|
return;
|
|
5138
5323
|
const thumbEl = thumb.value;
|
|
5139
|
-
gesto = new
|
|
5324
|
+
gesto = new Gesto(thumbEl, {
|
|
5140
5325
|
container: window
|
|
5141
5326
|
});
|
|
5142
5327
|
gesto.on("dragStart", (e) => {
|
|
@@ -5327,7 +5512,7 @@
|
|
|
5327
5512
|
const menuData = vue.computed(() => [
|
|
5328
5513
|
{
|
|
5329
5514
|
type: "button",
|
|
5330
|
-
text: "
|
|
5515
|
+
text: "水平居中",
|
|
5331
5516
|
display: () => canCenter.value,
|
|
5332
5517
|
handler: () => {
|
|
5333
5518
|
if (!nodes.value)
|
|
@@ -5337,7 +5522,7 @@
|
|
|
5337
5522
|
},
|
|
5338
5523
|
{
|
|
5339
5524
|
type: "button",
|
|
5340
|
-
text: "
|
|
5525
|
+
text: "复制",
|
|
5341
5526
|
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
5342
5527
|
handler: () => {
|
|
5343
5528
|
nodes.value && editorService?.copy(nodes.value);
|
|
@@ -5346,7 +5531,7 @@
|
|
|
5346
5531
|
},
|
|
5347
5532
|
{
|
|
5348
5533
|
type: "button",
|
|
5349
|
-
text: "
|
|
5534
|
+
text: "粘贴",
|
|
5350
5535
|
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
5351
5536
|
display: () => canPaste.value,
|
|
5352
5537
|
handler: () => {
|
|
@@ -5370,7 +5555,7 @@
|
|
|
5370
5555
|
},
|
|
5371
5556
|
{
|
|
5372
5557
|
type: "button",
|
|
5373
|
-
text: "
|
|
5558
|
+
text: "上移一层",
|
|
5374
5559
|
icon: vue.markRaw(iconsVue.Top),
|
|
5375
5560
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5376
5561
|
handler: () => {
|
|
@@ -5379,7 +5564,7 @@
|
|
|
5379
5564
|
},
|
|
5380
5565
|
{
|
|
5381
5566
|
type: "button",
|
|
5382
|
-
text: "
|
|
5567
|
+
text: "下移一层",
|
|
5383
5568
|
icon: vue.markRaw(iconsVue.Bottom),
|
|
5384
5569
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5385
5570
|
handler: () => {
|
|
@@ -5388,7 +5573,7 @@
|
|
|
5388
5573
|
},
|
|
5389
5574
|
{
|
|
5390
5575
|
type: "button",
|
|
5391
|
-
text: "
|
|
5576
|
+
text: "置顶",
|
|
5392
5577
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5393
5578
|
handler: () => {
|
|
5394
5579
|
editorService?.moveLayer(LayerOffset.TOP);
|
|
@@ -5396,7 +5581,7 @@
|
|
|
5396
5581
|
},
|
|
5397
5582
|
{
|
|
5398
5583
|
type: "button",
|
|
5399
|
-
text: "
|
|
5584
|
+
text: "置底",
|
|
5400
5585
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5401
5586
|
handler: () => {
|
|
5402
5587
|
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
@@ -5409,7 +5594,7 @@
|
|
|
5409
5594
|
},
|
|
5410
5595
|
{
|
|
5411
5596
|
type: "button",
|
|
5412
|
-
text: "
|
|
5597
|
+
text: "删除",
|
|
5413
5598
|
icon: iconsVue.Delete,
|
|
5414
5599
|
display: () => !utils.isPage(node.value),
|
|
5415
5600
|
handler: () => {
|
|
@@ -5422,7 +5607,7 @@
|
|
|
5422
5607
|
},
|
|
5423
5608
|
{
|
|
5424
5609
|
type: "button",
|
|
5425
|
-
text: "
|
|
5610
|
+
text: "清空参考线",
|
|
5426
5611
|
handler: () => {
|
|
5427
5612
|
editorService?.get("stage")?.clearGuides();
|
|
5428
5613
|
}
|
|
@@ -5648,7 +5833,7 @@
|
|
|
5648
5833
|
vue.onMounted(() => {
|
|
5649
5834
|
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
5650
5835
|
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
5651
|
-
keycon = new
|
|
5836
|
+
keycon = new KeyController(workspace.value);
|
|
5652
5837
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
5653
5838
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
5654
5839
|
keycon.keyup("delete", (e) => {
|
|
@@ -5782,14 +5967,30 @@
|
|
|
5782
5967
|
"deleteCodeDslByIds"
|
|
5783
5968
|
]);
|
|
5784
5969
|
}
|
|
5970
|
+
/**
|
|
5971
|
+
* 设置活动的代码块dsl数据源
|
|
5972
|
+
* @param {CodeBlockDSL} codeDsl 代码DSL
|
|
5973
|
+
* @returns {void}
|
|
5974
|
+
*/
|
|
5785
5975
|
async setCodeDsl(codeDsl2) {
|
|
5786
5976
|
this.state.codeDsl = codeDsl2;
|
|
5787
5977
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
5788
5978
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
5789
5979
|
}
|
|
5980
|
+
/**
|
|
5981
|
+
* 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
|
|
5982
|
+
* 方法要支持钩子添加扩展,会被重写为异步方法,因此这里显示写为异步以提醒调用者需以异步形式调用
|
|
5983
|
+
* @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
|
|
5984
|
+
* @returns {CodeBlockDSL | null}
|
|
5985
|
+
*/
|
|
5790
5986
|
getCodeDsl() {
|
|
5791
5987
|
return this.state.codeDsl;
|
|
5792
5988
|
}
|
|
5989
|
+
/**
|
|
5990
|
+
* 根据代码块id获取代码块内容
|
|
5991
|
+
* @param {Id} id 代码块id
|
|
5992
|
+
* @returns {CodeBlockContent | null}
|
|
5993
|
+
*/
|
|
5793
5994
|
getCodeContentById(id2) {
|
|
5794
5995
|
if (!id2)
|
|
5795
5996
|
return null;
|
|
@@ -5798,10 +5999,16 @@
|
|
|
5798
5999
|
return null;
|
|
5799
6000
|
return totalCodeDsl[id2] ?? null;
|
|
5800
6001
|
}
|
|
6002
|
+
/**
|
|
6003
|
+
* 设置代码块ID和代码内容到源dsl
|
|
6004
|
+
* @param {Id} id 代码块id
|
|
6005
|
+
* @param {CodeBlockContent} codeConfig 代码块内容配置信息
|
|
6006
|
+
* @returns {void}
|
|
6007
|
+
*/
|
|
5801
6008
|
async setCodeDslById(id, codeConfig) {
|
|
5802
6009
|
const codeDsl = this.getCodeDsl();
|
|
5803
6010
|
if (!codeDsl) {
|
|
5804
|
-
throw new Error("dsl
|
|
6011
|
+
throw new Error("dsl中没有codeBlocks");
|
|
5805
6012
|
}
|
|
5806
6013
|
const codeConfigProcessed = codeConfig;
|
|
5807
6014
|
if (codeConfig.content) {
|
|
@@ -5814,60 +6021,133 @@
|
|
|
5814
6021
|
};
|
|
5815
6022
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
5816
6023
|
}
|
|
6024
|
+
/**
|
|
6025
|
+
* 根据代码块id数组获取代码dsl
|
|
6026
|
+
* @param {string[]} ids 代码块id数组
|
|
6027
|
+
* @returns {CodeBlockDSL}
|
|
6028
|
+
*/
|
|
5817
6029
|
getCodeDslByIds(ids) {
|
|
5818
6030
|
const codeDsl2 = this.getCodeDsl();
|
|
5819
6031
|
return lodashEs.pick(codeDsl2, ids);
|
|
5820
6032
|
}
|
|
6033
|
+
/**
|
|
6034
|
+
* 设置代码编辑面板展示状态
|
|
6035
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6036
|
+
* @returns {void}
|
|
6037
|
+
*/
|
|
5821
6038
|
async setCodeEditorShowStatus(status) {
|
|
5822
6039
|
this.state.isShowCodeEditor = status;
|
|
5823
6040
|
}
|
|
6041
|
+
/**
|
|
6042
|
+
* 获取代码编辑面板展示状态
|
|
6043
|
+
* @returns {boolean} 是否展示代码编辑面板
|
|
6044
|
+
*/
|
|
5824
6045
|
getCodeEditorShowStatus() {
|
|
5825
6046
|
return this.state.isShowCodeEditor;
|
|
5826
6047
|
}
|
|
6048
|
+
/**
|
|
6049
|
+
* 设置代码编辑面板展示状态及展示内容
|
|
6050
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6051
|
+
* @param {Id} id 代码块id
|
|
6052
|
+
* @returns {void}
|
|
6053
|
+
*/
|
|
5827
6054
|
setCodeEditorContent(status, id2) {
|
|
5828
6055
|
if (!id2)
|
|
5829
6056
|
return;
|
|
5830
6057
|
this.setId(id2);
|
|
5831
6058
|
this.state.isShowCodeEditor = status;
|
|
5832
6059
|
}
|
|
6060
|
+
/**
|
|
6061
|
+
* 获取当前选中的代码块内容
|
|
6062
|
+
* @returns {CodeBlockContent | null}
|
|
6063
|
+
*/
|
|
5833
6064
|
getCurrentDsl() {
|
|
5834
6065
|
return this.getCodeContentById(this.state.id);
|
|
5835
6066
|
}
|
|
6067
|
+
/**
|
|
6068
|
+
* 获取编辑状态
|
|
6069
|
+
* @returns {boolean} 是否可编辑
|
|
6070
|
+
*/
|
|
5836
6071
|
getEditStatus() {
|
|
5837
6072
|
return this.state.editable;
|
|
5838
6073
|
}
|
|
6074
|
+
/**
|
|
6075
|
+
* 设置编辑状态
|
|
6076
|
+
* @param {boolean} status 是否可编辑
|
|
6077
|
+
* @returns {void}
|
|
6078
|
+
*/
|
|
5839
6079
|
async setEditStatus(status) {
|
|
5840
6080
|
this.state.editable = status;
|
|
5841
6081
|
}
|
|
6082
|
+
/**
|
|
6083
|
+
* 设置当前选中的代码块ID
|
|
6084
|
+
* @param {Id} id 代码块id
|
|
6085
|
+
* @returns {void}
|
|
6086
|
+
*/
|
|
5842
6087
|
setId(id2) {
|
|
5843
6088
|
if (!id2)
|
|
5844
6089
|
return;
|
|
5845
6090
|
this.state.id = id2;
|
|
5846
6091
|
}
|
|
6092
|
+
/**
|
|
6093
|
+
* 获取当前选中的代码块ID
|
|
6094
|
+
* @returns {Id} id 代码块id
|
|
6095
|
+
*/
|
|
5847
6096
|
getId() {
|
|
5848
6097
|
return this.state.id;
|
|
5849
6098
|
}
|
|
6099
|
+
/**
|
|
6100
|
+
* 设置当前选中组件已关联绑定的代码块id数组
|
|
6101
|
+
* @param {string[]} ids 代码块id数组
|
|
6102
|
+
* @returns {void}
|
|
6103
|
+
*/
|
|
5850
6104
|
async setCombineIds(ids) {
|
|
5851
6105
|
this.state.combineIds = ids;
|
|
5852
6106
|
}
|
|
6107
|
+
/**
|
|
6108
|
+
* 获取当前选中组件已关联绑定的代码块id数组
|
|
6109
|
+
* @returns {string[]}
|
|
6110
|
+
*/
|
|
5853
6111
|
getCombineIds() {
|
|
5854
6112
|
return this.state.combineIds;
|
|
5855
6113
|
}
|
|
6114
|
+
/**
|
|
6115
|
+
* 获取不可删除列表
|
|
6116
|
+
* @returns {Id[]}
|
|
6117
|
+
*/
|
|
5856
6118
|
getUndeletableList() {
|
|
5857
6119
|
return this.state.undeletableList;
|
|
5858
6120
|
}
|
|
6121
|
+
/**
|
|
6122
|
+
* 设置不可删除列表:为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除)
|
|
6123
|
+
* @param {Id[]} codeIds 代码块id数组
|
|
6124
|
+
* @returns {void}
|
|
6125
|
+
*/
|
|
5859
6126
|
async setUndeleteableList(codeIds) {
|
|
5860
6127
|
this.state.undeletableList = codeIds;
|
|
5861
6128
|
}
|
|
6129
|
+
/**
|
|
6130
|
+
* 设置代码草稿
|
|
6131
|
+
*/
|
|
5862
6132
|
setCodeDraft(codeId, content) {
|
|
5863
6133
|
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
5864
6134
|
}
|
|
6135
|
+
/**
|
|
6136
|
+
* 获取代码草稿
|
|
6137
|
+
*/
|
|
5865
6138
|
getCodeDraft(codeId) {
|
|
5866
6139
|
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5867
6140
|
}
|
|
6141
|
+
/**
|
|
6142
|
+
* 删除代码草稿
|
|
6143
|
+
*/
|
|
5868
6144
|
removeCodeDraft(codeId) {
|
|
5869
6145
|
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5870
6146
|
}
|
|
6147
|
+
/**
|
|
6148
|
+
* 在dsl数据源中删除指定id的代码块
|
|
6149
|
+
* @param {Id[]} codeIds 需要删除的代码块id数组
|
|
6150
|
+
*/
|
|
5871
6151
|
async deleteCodeDslByIds(codeIds) {
|
|
5872
6152
|
const currentDsl = await this.getCodeDsl();
|
|
5873
6153
|
if (!currentDsl)
|
|
@@ -5877,6 +6157,10 @@
|
|
|
5877
6157
|
this.emit("remove", id2);
|
|
5878
6158
|
});
|
|
5879
6159
|
}
|
|
6160
|
+
/**
|
|
6161
|
+
* 生成代码块唯一id
|
|
6162
|
+
* @returns {Id} 代码块唯一id
|
|
6163
|
+
*/
|
|
5880
6164
|
async getUniqueId() {
|
|
5881
6165
|
const newId = `code_${Math.random().toString(10).substring(2).substring(0, 4)}`;
|
|
5882
6166
|
const dsl = await this.getCodeDsl();
|
|
@@ -5908,6 +6192,9 @@
|
|
|
5908
6192
|
constructor() {
|
|
5909
6193
|
super([]);
|
|
5910
6194
|
}
|
|
6195
|
+
/**
|
|
6196
|
+
* @param componentGroupList 组件列表配置
|
|
6197
|
+
*/
|
|
5911
6198
|
setList(componentGroupList) {
|
|
5912
6199
|
this.state.list = componentGroupList;
|
|
5913
6200
|
}
|
|
@@ -5926,10 +6213,27 @@
|
|
|
5926
6213
|
const componentListService = new ComponentList();
|
|
5927
6214
|
|
|
5928
6215
|
class Target extends events.EventEmitter {
|
|
6216
|
+
/**
|
|
6217
|
+
* 如何识别目标
|
|
6218
|
+
*/
|
|
5929
6219
|
isTarget;
|
|
6220
|
+
/**
|
|
6221
|
+
* 目标id,不可重复
|
|
6222
|
+
* 例如目标是代码块,则为代码块id
|
|
6223
|
+
*/
|
|
5930
6224
|
id;
|
|
6225
|
+
/**
|
|
6226
|
+
* 目标名称,用于显示在依赖列表中
|
|
6227
|
+
*/
|
|
5931
6228
|
name;
|
|
6229
|
+
/**
|
|
6230
|
+
* 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type
|
|
6231
|
+
*/
|
|
5932
6232
|
type = "default";
|
|
6233
|
+
/**
|
|
6234
|
+
* 依赖详情
|
|
6235
|
+
* 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }
|
|
6236
|
+
*/
|
|
5933
6237
|
deps = vue.reactive({});
|
|
5934
6238
|
constructor(options) {
|
|
5935
6239
|
super();
|
|
@@ -5940,6 +6244,11 @@
|
|
|
5940
6244
|
this.type = options.type;
|
|
5941
6245
|
}
|
|
5942
6246
|
}
|
|
6247
|
+
/**
|
|
6248
|
+
* 更新依赖
|
|
6249
|
+
* @param node 节点配置
|
|
6250
|
+
* @param key 哪个key配置了这个目标的id
|
|
6251
|
+
*/
|
|
5943
6252
|
updateDep(node, key) {
|
|
5944
6253
|
const dep = this.deps[node.id] || {
|
|
5945
6254
|
name: node.name,
|
|
@@ -5954,6 +6263,12 @@
|
|
|
5954
6263
|
}
|
|
5955
6264
|
this.emit("change");
|
|
5956
6265
|
}
|
|
6266
|
+
/**
|
|
6267
|
+
* 删除依赖
|
|
6268
|
+
* @param node 哪个节点的依赖需要移除,如果为空,则移除所有依赖
|
|
6269
|
+
* @param key 节点下哪个key需要移除,如果为空,则移除改节点下的所有依赖key
|
|
6270
|
+
* @returns void
|
|
6271
|
+
*/
|
|
5957
6272
|
removeDep(node, key) {
|
|
5958
6273
|
if (!node) {
|
|
5959
6274
|
Object.keys(this.deps).forEach((depKey) => {
|
|
@@ -5976,6 +6291,12 @@
|
|
|
5976
6291
|
}
|
|
5977
6292
|
this.emit("change");
|
|
5978
6293
|
}
|
|
6294
|
+
/**
|
|
6295
|
+
* 判断指定节点下的指定key是否存在在依赖列表中
|
|
6296
|
+
* @param node 哪个节点
|
|
6297
|
+
* @param key 哪个key
|
|
6298
|
+
* @returns boolean
|
|
6299
|
+
*/
|
|
5979
6300
|
hasDep(node, key) {
|
|
5980
6301
|
const dep = this.deps[node.id];
|
|
5981
6302
|
return Boolean(dep?.keys.find((d) => d === key));
|
|
@@ -5986,15 +6307,29 @@
|
|
|
5986
6307
|
}
|
|
5987
6308
|
class Watcher extends events.EventEmitter {
|
|
5988
6309
|
targets = vue.reactive({});
|
|
6310
|
+
/**
|
|
6311
|
+
* 获取指定类型中的所有target
|
|
6312
|
+
* @param type 分类
|
|
6313
|
+
* @returns Target[]
|
|
6314
|
+
*/
|
|
5989
6315
|
getTargets(type = "default") {
|
|
5990
6316
|
return this.targets[type] || {};
|
|
5991
6317
|
}
|
|
6318
|
+
/**
|
|
6319
|
+
* 添加新的目标
|
|
6320
|
+
* @param target Target
|
|
6321
|
+
*/
|
|
5992
6322
|
addTarget(target) {
|
|
5993
6323
|
const targets = this.getTargets(target.type) || {};
|
|
5994
6324
|
this.targets[target.type] = targets;
|
|
5995
6325
|
targets[target.id] = target;
|
|
5996
6326
|
this.emit("add-target", target);
|
|
5997
6327
|
}
|
|
6328
|
+
/**
|
|
6329
|
+
* 获取指定id的target
|
|
6330
|
+
* @param id target id
|
|
6331
|
+
* @returns Target
|
|
6332
|
+
*/
|
|
5998
6333
|
getTarget(id) {
|
|
5999
6334
|
const allTargets = Object.values(this.targets);
|
|
6000
6335
|
for (const targets of allTargets) {
|
|
@@ -6003,6 +6338,11 @@
|
|
|
6003
6338
|
}
|
|
6004
6339
|
}
|
|
6005
6340
|
}
|
|
6341
|
+
/**
|
|
6342
|
+
* 判断是否存在指定id的target
|
|
6343
|
+
* @param id target id
|
|
6344
|
+
* @returns boolean
|
|
6345
|
+
*/
|
|
6006
6346
|
hasTarget(id) {
|
|
6007
6347
|
const allTargets = Object.values(this.targets);
|
|
6008
6348
|
for (const targets of allTargets) {
|
|
@@ -6012,6 +6352,10 @@
|
|
|
6012
6352
|
}
|
|
6013
6353
|
return false;
|
|
6014
6354
|
}
|
|
6355
|
+
/**
|
|
6356
|
+
* 删除指定id的target
|
|
6357
|
+
* @param id target id
|
|
6358
|
+
*/
|
|
6015
6359
|
removeTarget(id) {
|
|
6016
6360
|
const allTargets = Object.values(this.targets);
|
|
6017
6361
|
for (const targets of allTargets) {
|
|
@@ -6022,6 +6366,11 @@
|
|
|
6022
6366
|
}
|
|
6023
6367
|
this.emit("remove-target");
|
|
6024
6368
|
}
|
|
6369
|
+
/**
|
|
6370
|
+
* 删除指定分类的所有target
|
|
6371
|
+
* @param type 分类
|
|
6372
|
+
* @returns void
|
|
6373
|
+
*/
|
|
6025
6374
|
removeTargets(type = "default") {
|
|
6026
6375
|
const targets = this.targets[type];
|
|
6027
6376
|
if (!targets)
|
|
@@ -6032,11 +6381,19 @@
|
|
|
6032
6381
|
delete this.targets[type];
|
|
6033
6382
|
this.emit("remove-target");
|
|
6034
6383
|
}
|
|
6384
|
+
/**
|
|
6385
|
+
* 删除所有target
|
|
6386
|
+
*/
|
|
6035
6387
|
clearTargets() {
|
|
6036
6388
|
Object.keys(this.targets).forEach((key) => {
|
|
6037
6389
|
delete this.targets[key];
|
|
6038
6390
|
});
|
|
6039
6391
|
}
|
|
6392
|
+
/**
|
|
6393
|
+
* 收集依赖
|
|
6394
|
+
* @param nodes 需要收集的节点
|
|
6395
|
+
* @param deep 是否需要收集子节点
|
|
6396
|
+
*/
|
|
6040
6397
|
collect(nodes, deep = false) {
|
|
6041
6398
|
Object.values(this.targets).forEach((targets) => {
|
|
6042
6399
|
Object.values(targets).forEach((target) => {
|
|
@@ -6047,6 +6404,10 @@
|
|
|
6047
6404
|
});
|
|
6048
6405
|
});
|
|
6049
6406
|
}
|
|
6407
|
+
/**
|
|
6408
|
+
* 清除依赖
|
|
6409
|
+
* @param nodes 需要清除依赖的节点
|
|
6410
|
+
*/
|
|
6050
6411
|
clear(nodes) {
|
|
6051
6412
|
Object.values(this.targets).forEach((targets) => {
|
|
6052
6413
|
Object.values(targets).forEach((target) => {
|
|
@@ -6146,50 +6507,64 @@
|
|
|
6146
6507
|
const eventsService = new Events();
|
|
6147
6508
|
|
|
6148
6509
|
const editorProps = {
|
|
6510
|
+
/** 页面初始值 */
|
|
6149
6511
|
modelValue: {
|
|
6150
6512
|
type: Object,
|
|
6151
6513
|
default: () => ({}),
|
|
6152
6514
|
require: true
|
|
6153
6515
|
},
|
|
6516
|
+
/** 左侧面板中的组件列表 */
|
|
6154
6517
|
componentGroupList: {
|
|
6155
6518
|
type: Array,
|
|
6156
6519
|
default: () => []
|
|
6157
6520
|
},
|
|
6521
|
+
/** 左侧面板配置 */
|
|
6158
6522
|
sidebar: {
|
|
6159
6523
|
type: Object
|
|
6160
6524
|
},
|
|
6525
|
+
/** 顶部工具栏配置 */
|
|
6161
6526
|
menu: {
|
|
6162
6527
|
type: Object,
|
|
6163
6528
|
default: () => ({ left: [], right: [] })
|
|
6164
6529
|
},
|
|
6530
|
+
/** 组件树右键菜单 */
|
|
6165
6531
|
layerContentMenu: {
|
|
6166
6532
|
type: Array,
|
|
6167
6533
|
default: () => []
|
|
6168
6534
|
},
|
|
6535
|
+
/** 画布右键菜单 */
|
|
6169
6536
|
stageContentMenu: {
|
|
6170
6537
|
type: Array,
|
|
6171
6538
|
default: () => []
|
|
6172
6539
|
},
|
|
6540
|
+
/** 中间工作区域中画布渲染的内容 */
|
|
6173
6541
|
render: {
|
|
6174
6542
|
type: Function
|
|
6175
6543
|
},
|
|
6544
|
+
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
6176
6545
|
runtimeUrl: String,
|
|
6546
|
+
/** 选中时是否自动滚动到可视区域 */
|
|
6177
6547
|
autoScrollIntoView: Boolean,
|
|
6548
|
+
/** 组件的属性配置表单的dsl */
|
|
6178
6549
|
propsConfigs: {
|
|
6179
6550
|
type: Object,
|
|
6180
6551
|
default: () => ({})
|
|
6181
6552
|
},
|
|
6553
|
+
/** 添加组件时的默认值 */
|
|
6182
6554
|
propsValues: {
|
|
6183
6555
|
type: Object,
|
|
6184
6556
|
default: () => ({})
|
|
6185
6557
|
},
|
|
6558
|
+
/** 组件联动事件选项列表 */
|
|
6186
6559
|
eventMethodList: {
|
|
6187
6560
|
type: Object,
|
|
6188
6561
|
default: () => ({})
|
|
6189
6562
|
},
|
|
6563
|
+
/** 画布中组件选中框的移动范围 */
|
|
6190
6564
|
moveableOptions: {
|
|
6191
6565
|
type: [Object, Function]
|
|
6192
6566
|
},
|
|
6567
|
+
/** 编辑器初始化时默认选中的组件ID */
|
|
6193
6568
|
defaultSelected: {
|
|
6194
6569
|
type: [Number, String]
|
|
6195
6570
|
},
|
|
@@ -6393,11 +6768,11 @@
|
|
|
6393
6768
|
const _sfc_main = vue.defineComponent({
|
|
6394
6769
|
name: "m-editor",
|
|
6395
6770
|
components: {
|
|
6396
|
-
TMagicNavMenu: _sfc_main$
|
|
6771
|
+
TMagicNavMenu: _sfc_main$m,
|
|
6397
6772
|
Sidebar: _sfc_main$9,
|
|
6398
6773
|
Workspace: _sfc_main$1,
|
|
6399
|
-
PropsPanel: _sfc_main$
|
|
6400
|
-
Framework: _sfc_main$
|
|
6774
|
+
PropsPanel: _sfc_main$l,
|
|
6775
|
+
Framework: _sfc_main$o
|
|
6401
6776
|
},
|
|
6402
6777
|
props: editorProps,
|
|
6403
6778
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -6437,14 +6812,6 @@
|
|
|
6437
6812
|
}
|
|
6438
6813
|
});
|
|
6439
6814
|
|
|
6440
|
-
const _export_sfc = (sfc, props) => {
|
|
6441
|
-
const target = sfc.__vccOpts || sfc;
|
|
6442
|
-
for (const [key, val] of props) {
|
|
6443
|
-
target[key] = val;
|
|
6444
|
-
}
|
|
6445
|
-
return target;
|
|
6446
|
-
};
|
|
6447
|
-
|
|
6448
6815
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6449
6816
|
const _component_TMagicNavMenu = vue.resolveComponent("TMagicNavMenu");
|
|
6450
6817
|
const _component_Sidebar = vue.resolveComponent("Sidebar");
|
|
@@ -6535,20 +6902,22 @@
|
|
|
6535
6902
|
|
|
6536
6903
|
const index$1 = '';
|
|
6537
6904
|
|
|
6538
|
-
const defaultInstallOpt = {
|
|
6905
|
+
const defaultInstallOpt = {
|
|
6906
|
+
// @todo, 自定义图片上传方法等编辑器依赖的外部选项
|
|
6907
|
+
};
|
|
6539
6908
|
const index = {
|
|
6540
6909
|
install: (app, opt) => {
|
|
6541
6910
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
6542
6911
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6543
6912
|
setConfig(option);
|
|
6544
6913
|
app.component(Editor.name, Editor);
|
|
6545
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
6546
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
6547
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
6548
|
-
app.component("magic-code-editor", _sfc_main$
|
|
6549
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6550
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
6551
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
6914
|
+
app.component("m-fields-ui-select", _sfc_main$t);
|
|
6915
|
+
app.component("m-fields-code-link", _sfc_main$y);
|
|
6916
|
+
app.component("m-fields-vs-code", _sfc_main$z);
|
|
6917
|
+
app.component("magic-code-editor", _sfc_main$s);
|
|
6918
|
+
app.component("m-fields-code-select", _sfc_main$x);
|
|
6919
|
+
app.component("m-fields-code-select-col", _sfc_main$v);
|
|
6920
|
+
app.component("m-fields-event-select", _sfc_main$u);
|
|
6552
6921
|
}
|
|
6553
6922
|
};
|
|
6554
6923
|
|
|
@@ -6556,24 +6925,24 @@
|
|
|
6556
6925
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
6557
6926
|
exports.CodeBlockList = _sfc_main$e;
|
|
6558
6927
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
6559
|
-
exports.CodeSelect = _sfc_main$
|
|
6560
|
-
exports.CodeSelectCol = _sfc_main$
|
|
6928
|
+
exports.CodeSelect = _sfc_main$x;
|
|
6929
|
+
exports.CodeSelectCol = _sfc_main$v;
|
|
6561
6930
|
exports.ColumnLayout = ColumnLayout;
|
|
6562
6931
|
exports.ComponentListPanel = _sfc_main$d;
|
|
6563
6932
|
exports.ContentMenu = _sfc_main$c;
|
|
6564
|
-
exports.EventSelect = _sfc_main$
|
|
6933
|
+
exports.EventSelect = _sfc_main$u;
|
|
6565
6934
|
exports.Fixed2Other = Fixed2Other;
|
|
6566
6935
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
6567
|
-
exports.Icon = _sfc_main$
|
|
6936
|
+
exports.Icon = _sfc_main$w;
|
|
6568
6937
|
exports.Keys = Keys;
|
|
6569
6938
|
exports.LayerOffset = LayerOffset;
|
|
6570
6939
|
exports.LayerPanel = _sfc_main$a;
|
|
6571
6940
|
exports.Layout = Layout;
|
|
6572
|
-
exports.LayoutContainer = _sfc_main$
|
|
6573
|
-
exports.PropsPanel = _sfc_main$
|
|
6574
|
-
exports.TMagicCodeEditor = _sfc_main$
|
|
6941
|
+
exports.LayoutContainer = _sfc_main$q;
|
|
6942
|
+
exports.PropsPanel = _sfc_main$l;
|
|
6943
|
+
exports.TMagicCodeEditor = _sfc_main$s;
|
|
6575
6944
|
exports.TMagicEditor = Editor;
|
|
6576
|
-
exports.ToolButton = _sfc_main$
|
|
6945
|
+
exports.ToolButton = _sfc_main$n;
|
|
6577
6946
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
6578
6947
|
exports.beforePaste = beforePaste;
|
|
6579
6948
|
exports.change2Fixed = change2Fixed;
|