@tmagic/editor 1.2.13 → 1.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +161 -69
- package/dist/tmagic-editor.js +784 -419
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +802 -444
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +14 -13
- package/src/components/CodeDraftEditor.vue +20 -17
- package/src/components/ContentMenu.vue +1 -1
- package/src/components/FunctionEditor.vue +10 -10
- package/src/components/Layout.vue +1 -1
- package/src/components/ScrollViewer.vue +2 -2
- package/src/components/SearchInput.vue +6 -3
- package/src/fields/CodeSelect.vue +18 -101
- package/src/fields/CodeSelectCol.vue +21 -3
- package/src/fields/EventSelect.vue +5 -3
- package/src/fields/UISelect.vue +1 -1
- package/src/icons/AppManageIcon.vue +11 -0
- package/src/icons/CodeIcon.vue +26 -0
- package/src/layouts/AddPageBox.vue +3 -3
- package/src/layouts/Framework.vue +4 -4
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +3 -3
- package/src/layouts/sidebar/LayerMenu.vue +2 -2
- package/src/layouts/sidebar/LayerPanel.vue +4 -4
- package/src/layouts/sidebar/Sidebar.vue +13 -12
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +15 -6
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +28 -15
- package/src/layouts/workspace/Breadcrumb.vue +1 -1
- package/src/layouts/workspace/PageBar.vue +2 -2
- package/src/layouts/workspace/PageBarScrollContainer.vue +3 -3
- package/src/layouts/workspace/Stage.vue +3 -3
- package/src/layouts/workspace/ViewerMenu.vue +4 -4
- package/src/layouts/workspace/Workspace.vue +1 -1
- package/src/services/BaseService.ts +1 -1
- package/src/services/codeBlock.ts +3 -3
- package/src/services/componentList.ts +1 -1
- package/src/services/editor.ts +6 -6
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +2 -2
- package/src/services/props.ts +4 -17
- package/src/services/ui.ts +2 -2
- package/src/theme/code-block.scss +11 -49
- package/src/theme/dep-list.scss +59 -0
- package/src/theme/event.scss +12 -0
- package/src/theme/sidebar.scss +26 -6
- package/src/theme/theme.scss +1 -0
- package/src/utils/config.ts +1 -1
- package/src/utils/dep.ts +2 -2
- package/src/utils/editor.ts +1 -1
- package/src/utils/operator.ts +4 -4
- package/src/utils/stage.ts +3 -3
- package/tsconfig.build.json +4 -1
- package/types/components/CodeDraftEditor.vue.d.ts +7 -4
- package/types/components/ContentMenu.vue.d.ts +3 -3
- package/types/components/FunctionEditor.vue.d.ts +140 -8
- package/types/components/Icon.vue.d.ts +2 -2
- package/types/components/Layout.vue.d.ts +28 -113
- package/types/components/ScrollBar.vue.d.ts +2 -2
- package/types/components/ScrollViewer.vue.d.ts +32 -135
- package/types/components/ToolButton.vue.d.ts +3 -3
- package/types/fields/Code.vue.d.ts +2 -2
- package/types/fields/CodeLink.vue.d.ts +2 -2
- package/types/fields/CodeSelect.vue.d.ts +8 -27
- package/types/fields/CodeSelectCol.vue.d.ts +3 -3
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/UISelect.vue.d.ts +2 -2
- package/types/icons/AppManageIcon.vue.d.ts +2 -0
- package/types/icons/CodeIcon.vue.d.ts +2 -0
- package/types/layouts/CodeEditor.vue.d.ts +4 -4
- package/types/layouts/Framework.vue.d.ts +23 -74
- package/types/layouts/NavMenu.vue.d.ts +3 -3
- package/types/layouts/PropsPanel.vue.d.ts +11 -60
- package/types/layouts/Resizer.vue.d.ts +9 -54
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +11 -50
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +17 -60
- package/types/layouts/sidebar/Sidebar.vue.d.ts +39 -104
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +15 -58
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +21 -66
- package/types/layouts/workspace/PageBar.vue.d.ts +13 -52
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +8 -48
- package/types/layouts/workspace/Stage.vue.d.ts +2 -2
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +3 -3
- package/types/layouts/workspace/Workspace.vue.d.ts +20 -63
- package/types/services/codeBlock.d.ts +1 -1
- package/types/services/componentList.d.ts +1 -1
- package/types/services/dep.d.ts +2 -2
- package/types/services/editor.d.ts +1 -1
- package/types/services/events.d.ts +1 -1
- package/types/services/history.d.ts +2 -2
- package/types/services/props.d.ts +90 -7
- package/types/services/storage.d.ts +1 -1
- package/types/services/ui.d.ts +2 -2
- package/types/type.d.ts +8 -8
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +78 -1
|
@@ -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");
|
|
@@ -1848,8 +1839,13 @@
|
|
|
1848
1839
|
};
|
|
1849
1840
|
}
|
|
1850
1841
|
async createId(type) {
|
|
1851
|
-
return `${type}_${
|
|
1842
|
+
return `${type}_${utils.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,13 +1882,6 @@
|
|
|
1881
1882
|
this.removeAllListeners();
|
|
1882
1883
|
this.removeAllPlugins();
|
|
1883
1884
|
}
|
|
1884
|
-
guid(digit = 8) {
|
|
1885
|
-
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
1886
|
-
const r = Math.random() * 16 | 0;
|
|
1887
|
-
const v = c === "x" ? r : r & 3 | 8;
|
|
1888
|
-
return v.toString(16);
|
|
1889
|
-
});
|
|
1890
|
-
}
|
|
1891
1885
|
}
|
|
1892
1886
|
const propsService = new Props();
|
|
1893
1887
|
|
|
@@ -1963,7 +1957,7 @@
|
|
|
1963
1957
|
return newNode;
|
|
1964
1958
|
};
|
|
1965
1959
|
|
|
1966
|
-
|
|
1960
|
+
let Editor$1 = class Editor extends BaseService {
|
|
1967
1961
|
state = vue.reactive({
|
|
1968
1962
|
root: null,
|
|
1969
1963
|
page: null,
|
|
@@ -2000,9 +1994,15 @@
|
|
|
2000
1994
|
"redo",
|
|
2001
1995
|
"highlight"
|
|
2002
1996
|
],
|
|
1997
|
+
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2003
1998
|
["select", "update", "moveLayer"]
|
|
2004
1999
|
);
|
|
2005
2000
|
}
|
|
2001
|
+
/**
|
|
2002
|
+
* 设置当前指点节点配置
|
|
2003
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
2004
|
+
* @param value MNode
|
|
2005
|
+
*/
|
|
2006
2006
|
set(name, value) {
|
|
2007
2007
|
const preValue = this.state[name];
|
|
2008
2008
|
this.state[name] = value;
|
|
@@ -2011,9 +2011,9 @@
|
|
|
2011
2011
|
}
|
|
2012
2012
|
if (name === "root") {
|
|
2013
2013
|
if (Array.isArray(value)) {
|
|
2014
|
-
throw new Error("root
|
|
2014
|
+
throw new Error("root 不能为数组");
|
|
2015
2015
|
}
|
|
2016
|
-
if (value && lodashEs.isObject(value) && !(value instanceof
|
|
2016
|
+
if (value && lodashEs.isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
|
|
2017
2017
|
this.state.pageLength = value.items?.length || 0;
|
|
2018
2018
|
} else {
|
|
2019
2019
|
this.state.pageLength = 0;
|
|
@@ -2021,9 +2021,20 @@
|
|
|
2021
2021
|
this.emit("root-change", value, preValue);
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
|
+
/**
|
|
2025
|
+
* 获取当前指点节点配置
|
|
2026
|
+
* @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
|
|
2027
|
+
* @returns MNode
|
|
2028
|
+
*/
|
|
2024
2029
|
get(name) {
|
|
2025
2030
|
return this.state[name];
|
|
2026
2031
|
}
|
|
2032
|
+
/**
|
|
2033
|
+
* 根据id获取组件、组件的父组件以及组件所属的页面节点
|
|
2034
|
+
* @param {number | string} id 组件id
|
|
2035
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2036
|
+
* @returns {EditorNodeInfo}
|
|
2037
|
+
*/
|
|
2027
2038
|
getNodeInfo(id, raw = true) {
|
|
2028
2039
|
let root = this.get("root");
|
|
2029
2040
|
if (raw) {
|
|
@@ -2054,14 +2065,29 @@
|
|
|
2054
2065
|
});
|
|
2055
2066
|
return info;
|
|
2056
2067
|
}
|
|
2068
|
+
/**
|
|
2069
|
+
* 根据ID获取指点节点配置
|
|
2070
|
+
* @param id 组件ID
|
|
2071
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2072
|
+
* @returns 组件节点配置
|
|
2073
|
+
*/
|
|
2057
2074
|
getNodeById(id, raw = true) {
|
|
2058
2075
|
const { node } = this.getNodeInfo(id, raw);
|
|
2059
2076
|
return node;
|
|
2060
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* 根据ID获取指点节点的父节点配置
|
|
2080
|
+
* @param id 组件ID
|
|
2081
|
+
* @param {boolean} raw 是否使用toRaw
|
|
2082
|
+
* @returns 指点组件的父节点配置
|
|
2083
|
+
*/
|
|
2061
2084
|
getParentById(id, raw = true) {
|
|
2062
2085
|
const { parent } = this.getNodeInfo(id, raw);
|
|
2063
2086
|
return parent;
|
|
2064
2087
|
}
|
|
2088
|
+
/**
|
|
2089
|
+
* 只有容器拥有布局
|
|
2090
|
+
*/
|
|
2065
2091
|
async getLayout(parent, node) {
|
|
2066
2092
|
if (node && typeof node !== "function" && isFixed(node))
|
|
2067
2093
|
return Layout.FIXED;
|
|
@@ -2073,6 +2099,11 @@
|
|
|
2073
2099
|
}
|
|
2074
2100
|
return Layout.ABSOLUTE;
|
|
2075
2101
|
}
|
|
2102
|
+
/**
|
|
2103
|
+
* 选中指定节点(将指定节点设置成当前选中状态)
|
|
2104
|
+
* @param config 指定节点配置或者ID
|
|
2105
|
+
* @returns 当前选中的节点配置
|
|
2106
|
+
*/
|
|
2076
2107
|
async select(config) {
|
|
2077
2108
|
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
2078
2109
|
this.set("nodes", node ? [node] : []);
|
|
@@ -2114,15 +2145,20 @@
|
|
|
2114
2145
|
const root = vue.toRaw(this.get("root"));
|
|
2115
2146
|
const page = vue.toRaw(this.get("page"));
|
|
2116
2147
|
if (!page)
|
|
2117
|
-
throw new Error("page
|
|
2148
|
+
throw new Error("page不能为空");
|
|
2118
2149
|
if (!root)
|
|
2119
|
-
throw new Error("root
|
|
2150
|
+
throw new Error("root不能为空");
|
|
2120
2151
|
const index = getNodeIndex(page, root);
|
|
2121
2152
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
2122
2153
|
await this.select(nextPage);
|
|
2123
2154
|
this.get("stage")?.select(nextPage.id);
|
|
2124
2155
|
return nextPage;
|
|
2125
2156
|
}
|
|
2157
|
+
/**
|
|
2158
|
+
* 高亮指定节点
|
|
2159
|
+
* @param config 指定节点配置或者ID
|
|
2160
|
+
* @returns 当前高亮的节点配置
|
|
2161
|
+
*/
|
|
2126
2162
|
highlight(config) {
|
|
2127
2163
|
const { node } = this.selectedConfigExceptionHandler(config);
|
|
2128
2164
|
const currentHighlightNode = this.get("highlightNode");
|
|
@@ -2130,6 +2166,11 @@
|
|
|
2130
2166
|
return;
|
|
2131
2167
|
this.set("highlightNode", node);
|
|
2132
2168
|
}
|
|
2169
|
+
/**
|
|
2170
|
+
* 多选
|
|
2171
|
+
* @param ids 指定节点ID
|
|
2172
|
+
* @returns 加入多选的节点配置
|
|
2173
|
+
*/
|
|
2133
2174
|
multiSelect(ids) {
|
|
2134
2175
|
const nodes = [];
|
|
2135
2176
|
const idsUnique = lodashEs.uniq(ids);
|
|
@@ -2144,13 +2185,13 @@
|
|
|
2144
2185
|
async doAdd(node, parent) {
|
|
2145
2186
|
const root = this.get("root");
|
|
2146
2187
|
if (!root)
|
|
2147
|
-
throw new Error("root
|
|
2188
|
+
throw new Error("root为空");
|
|
2148
2189
|
const curNode = this.get("node");
|
|
2149
2190
|
const stage = this.get("stage");
|
|
2150
2191
|
if (!curNode)
|
|
2151
|
-
throw new Error("
|
|
2192
|
+
throw new Error("当前选中节点为空");
|
|
2152
2193
|
if ((parent.type === schema.NodeType.ROOT || curNode?.type === schema.NodeType.ROOT) && node.type !== schema.NodeType.PAGE) {
|
|
2153
|
-
throw new Error("app
|
|
2194
|
+
throw new Error("app下不能添加组件");
|
|
2154
2195
|
}
|
|
2155
2196
|
if (parent.id !== curNode.id && node.type !== schema.NodeType.PAGE) {
|
|
2156
2197
|
const index = parent.items.indexOf(curNode);
|
|
@@ -2174,13 +2215,19 @@
|
|
|
2174
2215
|
this.addModifiedNodeId(node.id);
|
|
2175
2216
|
return node;
|
|
2176
2217
|
}
|
|
2218
|
+
/**
|
|
2219
|
+
* 向指点容器添加组件节点
|
|
2220
|
+
* @param addConfig 将要添加的组件节点配置
|
|
2221
|
+
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
2222
|
+
* @returns 添加后的节点
|
|
2223
|
+
*/
|
|
2177
2224
|
async add(addNode, parent) {
|
|
2178
2225
|
const stage = this.get("stage");
|
|
2179
2226
|
const addNodes = [];
|
|
2180
2227
|
if (!Array.isArray(addNode)) {
|
|
2181
2228
|
const { type, inputEvent, ...config } = addNode;
|
|
2182
2229
|
if (!type)
|
|
2183
|
-
throw new Error("
|
|
2230
|
+
throw new Error("组件类型不能为空");
|
|
2184
2231
|
addNodes.push({ ...vue.toRaw(await propsService.getPropsValue(type, config)) });
|
|
2185
2232
|
} else {
|
|
2186
2233
|
addNodes.push(...addNode);
|
|
@@ -2193,7 +2240,7 @@
|
|
|
2193
2240
|
}
|
|
2194
2241
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
2195
2242
|
if (!parentNode)
|
|
2196
|
-
throw new Error("
|
|
2243
|
+
throw new Error("未找到父元素");
|
|
2197
2244
|
return this.doAdd(node, parentNode);
|
|
2198
2245
|
})
|
|
2199
2246
|
);
|
|
@@ -2218,13 +2265,13 @@
|
|
|
2218
2265
|
async doRemove(node) {
|
|
2219
2266
|
const root = this.get("root");
|
|
2220
2267
|
if (!root)
|
|
2221
|
-
throw new Error("root
|
|
2268
|
+
throw new Error("root不能为空");
|
|
2222
2269
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
2223
2270
|
if (!parent || !curNode)
|
|
2224
|
-
throw new Error("
|
|
2271
|
+
throw new Error("找不要删除的节点");
|
|
2225
2272
|
const index = getNodeIndex(curNode, parent);
|
|
2226
2273
|
if (typeof index !== "number" || index === -1)
|
|
2227
|
-
throw new Error("
|
|
2274
|
+
throw new Error("找不要删除的节点");
|
|
2228
2275
|
parent.items?.splice(index, 1);
|
|
2229
2276
|
const stage = this.get("stage");
|
|
2230
2277
|
stage?.remove({ id: node.id, parentId: parent.id, root: lodashEs.cloneDeep(root) });
|
|
@@ -2249,6 +2296,10 @@
|
|
|
2249
2296
|
}
|
|
2250
2297
|
this.addModifiedNodeId(parent.id);
|
|
2251
2298
|
}
|
|
2299
|
+
/**
|
|
2300
|
+
* 删除组件
|
|
2301
|
+
* @param {Object} node
|
|
2302
|
+
*/
|
|
2252
2303
|
async remove(nodeOrNodeList) {
|
|
2253
2304
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
2254
2305
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
@@ -2260,12 +2311,12 @@
|
|
|
2260
2311
|
async doUpdate(config) {
|
|
2261
2312
|
const root = this.get("root");
|
|
2262
2313
|
if (!root)
|
|
2263
|
-
throw new Error("root
|
|
2314
|
+
throw new Error("root为空");
|
|
2264
2315
|
if (!config?.id)
|
|
2265
|
-
throw new Error("
|
|
2316
|
+
throw new Error("没有配置或者配置缺少id值");
|
|
2266
2317
|
const info = this.getNodeInfo(config.id, false);
|
|
2267
2318
|
if (!info.node)
|
|
2268
|
-
throw new Error(
|
|
2319
|
+
throw new Error(`获取不到id为${config.id}的节点`);
|
|
2269
2320
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
2270
2321
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, root);
|
|
2271
2322
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
@@ -2277,18 +2328,18 @@
|
|
|
2277
2328
|
}
|
|
2278
2329
|
});
|
|
2279
2330
|
if (!newConfig.type)
|
|
2280
|
-
throw new Error("
|
|
2331
|
+
throw new Error("配置缺少type值");
|
|
2281
2332
|
if (newConfig.type === schema.NodeType.ROOT) {
|
|
2282
2333
|
this.set("root", newConfig);
|
|
2283
2334
|
return newConfig;
|
|
2284
2335
|
}
|
|
2285
2336
|
const { parent } = info;
|
|
2286
2337
|
if (!parent)
|
|
2287
|
-
throw new Error("
|
|
2338
|
+
throw new Error("获取不到父级节点");
|
|
2288
2339
|
const parentNodeItems = parent.items;
|
|
2289
2340
|
const index = getNodeIndex(newConfig, parent);
|
|
2290
2341
|
if (!parentNodeItems || typeof index === "undefined" || index === -1)
|
|
2291
|
-
throw new Error("
|
|
2342
|
+
throw new Error("更新的节点未找到");
|
|
2292
2343
|
const newLayout = await this.getLayout(newConfig);
|
|
2293
2344
|
const layout = await this.getLayout(node);
|
|
2294
2345
|
if (newLayout !== layout) {
|
|
@@ -2310,6 +2361,11 @@
|
|
|
2310
2361
|
this.addModifiedNodeId(newConfig.id);
|
|
2311
2362
|
return newConfig;
|
|
2312
2363
|
}
|
|
2364
|
+
/**
|
|
2365
|
+
* 更新节点
|
|
2366
|
+
* @param config 新的节点配置,配置中需要有id信息
|
|
2367
|
+
* @returns 更新后的节点配置
|
|
2368
|
+
*/
|
|
2313
2369
|
async update(config) {
|
|
2314
2370
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2315
2371
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
@@ -2317,16 +2373,22 @@
|
|
|
2317
2373
|
this.emit("update", newNodes);
|
|
2318
2374
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
2319
2375
|
}
|
|
2376
|
+
/**
|
|
2377
|
+
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
2378
|
+
* @param id1 组件ID
|
|
2379
|
+
* @param id2 组件ID
|
|
2380
|
+
* @returns void
|
|
2381
|
+
*/
|
|
2320
2382
|
async sort(id1, id2) {
|
|
2321
2383
|
const root = this.get("root");
|
|
2322
2384
|
if (!root)
|
|
2323
|
-
throw new Error("root
|
|
2385
|
+
throw new Error("root为空");
|
|
2324
2386
|
const node = this.get("node");
|
|
2325
2387
|
if (!node)
|
|
2326
|
-
throw new Error("
|
|
2388
|
+
throw new Error("当前节点为空");
|
|
2327
2389
|
const parent = lodashEs.cloneDeep(vue.toRaw(this.get("parent")));
|
|
2328
2390
|
if (!parent)
|
|
2329
|
-
throw new Error("
|
|
2391
|
+
throw new Error("父节点为空");
|
|
2330
2392
|
const index2 = parent.items.findIndex((node2) => `${node2.id}` === `${id2}`);
|
|
2331
2393
|
if (index2 < 0)
|
|
2332
2394
|
return;
|
|
@@ -2342,11 +2404,21 @@
|
|
|
2342
2404
|
this.addModifiedNodeId(parent.id);
|
|
2343
2405
|
this.pushHistoryState();
|
|
2344
2406
|
}
|
|
2407
|
+
/**
|
|
2408
|
+
* 将组将节点配置转化成string,然后存储到localStorage中
|
|
2409
|
+
* @param config 组件节点配置
|
|
2410
|
+
* @returns 组件节点配置
|
|
2411
|
+
*/
|
|
2345
2412
|
async copy(config) {
|
|
2346
2413
|
await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
|
|
2347
2414
|
protocol: Protocol.OBJECT
|
|
2348
2415
|
});
|
|
2349
2416
|
}
|
|
2417
|
+
/**
|
|
2418
|
+
* 从localStorage中获取节点,然后添加到当前容器中
|
|
2419
|
+
* @param position 粘贴的坐标
|
|
2420
|
+
* @returns 添加后的组件节点配置
|
|
2421
|
+
*/
|
|
2350
2422
|
async paste(position = {}) {
|
|
2351
2423
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
2352
2424
|
if (!Array.isArray(config))
|
|
@@ -2369,7 +2441,7 @@
|
|
|
2369
2441
|
async doAlignCenter(config) {
|
|
2370
2442
|
const parent = this.getParentById(config.id);
|
|
2371
2443
|
if (!parent)
|
|
2372
|
-
throw new Error("
|
|
2444
|
+
throw new Error("找不到父节点");
|
|
2373
2445
|
const node = lodashEs.cloneDeep(vue.toRaw(config));
|
|
2374
2446
|
const layout = await this.getLayout(parent, node);
|
|
2375
2447
|
if (layout === Layout.RELATIVE) {
|
|
@@ -2390,6 +2462,11 @@
|
|
|
2390
2462
|
}
|
|
2391
2463
|
return node;
|
|
2392
2464
|
}
|
|
2465
|
+
/**
|
|
2466
|
+
* 将指点节点设置居中
|
|
2467
|
+
* @param config 组件节点配置
|
|
2468
|
+
* @returns 当前组件节点配置
|
|
2469
|
+
*/
|
|
2393
2470
|
async alignCenter(config) {
|
|
2394
2471
|
const nodes = Array.isArray(config) ? config : [config];
|
|
2395
2472
|
const stage = this.get("stage");
|
|
@@ -2402,16 +2479,20 @@
|
|
|
2402
2479
|
}
|
|
2403
2480
|
return newNode;
|
|
2404
2481
|
}
|
|
2482
|
+
/**
|
|
2483
|
+
* 移动当前选中节点位置
|
|
2484
|
+
* @param offset 偏移量
|
|
2485
|
+
*/
|
|
2405
2486
|
async moveLayer(offset) {
|
|
2406
2487
|
const root = this.get("root");
|
|
2407
2488
|
if (!root)
|
|
2408
|
-
throw new Error("root
|
|
2489
|
+
throw new Error("root为空");
|
|
2409
2490
|
const parent = this.get("parent");
|
|
2410
2491
|
if (!parent)
|
|
2411
|
-
throw new Error("
|
|
2492
|
+
throw new Error("父节点为空");
|
|
2412
2493
|
const node = this.get("node");
|
|
2413
2494
|
if (!node)
|
|
2414
|
-
throw new Error("
|
|
2495
|
+
throw new Error("当前节点为空");
|
|
2415
2496
|
const brothers = parent.items || [];
|
|
2416
2497
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2417
2498
|
const layout = await this.getLayout(parent, node);
|
|
@@ -2433,6 +2514,11 @@
|
|
|
2433
2514
|
this.addModifiedNodeId(parent.id);
|
|
2434
2515
|
this.pushHistoryState();
|
|
2435
2516
|
}
|
|
2517
|
+
/**
|
|
2518
|
+
* 移动到指定容器中
|
|
2519
|
+
* @param config 需要移动的节点
|
|
2520
|
+
* @param targetId 容器ID
|
|
2521
|
+
*/
|
|
2436
2522
|
async moveToContainer(config, targetId) {
|
|
2437
2523
|
const root = lodashEs.cloneDeep(this.get("root"));
|
|
2438
2524
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
@@ -2461,11 +2547,19 @@
|
|
|
2461
2547
|
return newConfig;
|
|
2462
2548
|
}
|
|
2463
2549
|
}
|
|
2550
|
+
/**
|
|
2551
|
+
* 撤销当前操作
|
|
2552
|
+
* @returns 上一次数据
|
|
2553
|
+
*/
|
|
2464
2554
|
async undo() {
|
|
2465
2555
|
const value = historyService.undo();
|
|
2466
2556
|
await this.changeHistoryState(value);
|
|
2467
2557
|
return value;
|
|
2468
2558
|
}
|
|
2559
|
+
/**
|
|
2560
|
+
* 恢复到下一步
|
|
2561
|
+
* @returns 下一步数据
|
|
2562
|
+
*/
|
|
2469
2563
|
async redo() {
|
|
2470
2564
|
const value = historyService.redo();
|
|
2471
2565
|
await this.changeHistoryState(value);
|
|
@@ -2561,13 +2655,13 @@
|
|
|
2561
2655
|
id = config.id;
|
|
2562
2656
|
}
|
|
2563
2657
|
if (!id) {
|
|
2564
|
-
throw new Error("
|
|
2658
|
+
throw new Error("没有ID,无法选中");
|
|
2565
2659
|
}
|
|
2566
2660
|
const { node, parent, page } = this.getNodeInfo(id);
|
|
2567
2661
|
if (!node)
|
|
2568
|
-
throw new Error("
|
|
2662
|
+
throw new Error("获取不到组件信息");
|
|
2569
2663
|
if (node.id === this.state.root?.id) {
|
|
2570
|
-
throw new Error("
|
|
2664
|
+
throw new Error("不能选根节点");
|
|
2571
2665
|
}
|
|
2572
2666
|
return {
|
|
2573
2667
|
node,
|
|
@@ -2575,7 +2669,7 @@
|
|
|
2575
2669
|
page
|
|
2576
2670
|
};
|
|
2577
2671
|
}
|
|
2578
|
-
}
|
|
2672
|
+
};
|
|
2579
2673
|
const editorService = new Editor$1();
|
|
2580
2674
|
|
|
2581
2675
|
const state = vue.reactive({
|
|
@@ -2668,7 +2762,7 @@
|
|
|
2668
2762
|
const uiSelectMode = vue.computed(() => uiService.get("uiSelectMode"));
|
|
2669
2763
|
const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
|
|
2670
2764
|
const useStage = (stageOptions) => {
|
|
2671
|
-
const stage = new
|
|
2765
|
+
const stage = new StageCore({
|
|
2672
2766
|
render: stageOptions.render,
|
|
2673
2767
|
runtimeUrl: stageOptions.runtimeUrl,
|
|
2674
2768
|
zoom: zoom.value,
|
|
@@ -2726,7 +2820,7 @@
|
|
|
2726
2820
|
stage.on("select-parent", () => {
|
|
2727
2821
|
const parent = editorService.get("parent");
|
|
2728
2822
|
if (!parent)
|
|
2729
|
-
throw new Error("
|
|
2823
|
+
throw new Error("父节点为空");
|
|
2730
2824
|
editorService.select(parent);
|
|
2731
2825
|
editorService.get("stage")?.select(parent.id);
|
|
2732
2826
|
});
|
|
@@ -2746,13 +2840,13 @@
|
|
|
2746
2840
|
return stage;
|
|
2747
2841
|
};
|
|
2748
2842
|
|
|
2749
|
-
const _hoisted_1$
|
|
2750
|
-
const _hoisted_2$
|
|
2751
|
-
const _hoisted_3$
|
|
2843
|
+
const _hoisted_1$f = { class: "m-editor-empty-panel" };
|
|
2844
|
+
const _hoisted_2$8 = { class: "m-editor-empty-content" };
|
|
2845
|
+
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
2752
2846
|
const __default__$l = vue.defineComponent({
|
|
2753
2847
|
name: "MEditorAddPageBox"
|
|
2754
2848
|
});
|
|
2755
|
-
const _sfc_main$
|
|
2849
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
2756
2850
|
...__default__$l,
|
|
2757
2851
|
setup(__props) {
|
|
2758
2852
|
const services = vue.inject("services");
|
|
@@ -2762,23 +2856,23 @@
|
|
|
2762
2856
|
return;
|
|
2763
2857
|
const root = vue.toRaw(editorService.get("root"));
|
|
2764
2858
|
if (!root)
|
|
2765
|
-
throw new Error("root
|
|
2859
|
+
throw new Error("root 不能为空");
|
|
2766
2860
|
editorService.add({
|
|
2767
2861
|
type: schema.NodeType.PAGE,
|
|
2768
2862
|
name: generatePageNameByApp(root)
|
|
2769
2863
|
});
|
|
2770
2864
|
};
|
|
2771
2865
|
return (_ctx, _cache) => {
|
|
2772
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2773
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
2866
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
2867
|
+
vue.createElementVNode("div", _hoisted_2$8, [
|
|
2774
2868
|
vue.createElementVNode("div", {
|
|
2775
2869
|
class: "m-editor-empty-button",
|
|
2776
2870
|
onClick: clickHandler
|
|
2777
2871
|
}, [
|
|
2778
2872
|
vue.createElementVNode("div", null, [
|
|
2779
|
-
vue.createVNode(_sfc_main$
|
|
2873
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2780
2874
|
]),
|
|
2781
|
-
_hoisted_3$
|
|
2875
|
+
_hoisted_3$4
|
|
2782
2876
|
])
|
|
2783
2877
|
])
|
|
2784
2878
|
]);
|
|
@@ -2786,11 +2880,11 @@
|
|
|
2786
2880
|
}
|
|
2787
2881
|
});
|
|
2788
2882
|
|
|
2789
|
-
const _hoisted_1$
|
|
2883
|
+
const _hoisted_1$e = { class: "m-editor" };
|
|
2790
2884
|
const __default__$k = vue.defineComponent({
|
|
2791
2885
|
name: "MEditorFramework"
|
|
2792
2886
|
});
|
|
2793
|
-
const _sfc_main$
|
|
2887
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
2794
2888
|
...__default__$k,
|
|
2795
2889
|
props: {
|
|
2796
2890
|
codeOptions: { default: () => ({}) }
|
|
@@ -2860,7 +2954,7 @@
|
|
|
2860
2954
|
};
|
|
2861
2955
|
return (_ctx, _cache) => {
|
|
2862
2956
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2863
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2957
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
2864
2958
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2865
2959
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2866
2960
|
key: 0,
|
|
@@ -2868,7 +2962,7 @@
|
|
|
2868
2962
|
"init-values": vue.unref(root),
|
|
2869
2963
|
options: __props.codeOptions,
|
|
2870
2964
|
onSave: saveCode
|
|
2871
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2965
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$q, {
|
|
2872
2966
|
key: 1,
|
|
2873
2967
|
class: "m-editor-content",
|
|
2874
2968
|
"left-class": "m-editor-framework-left",
|
|
@@ -2878,8 +2972,8 @@
|
|
|
2878
2972
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
|
|
2879
2973
|
right: columnWidth.value.right,
|
|
2880
2974
|
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
2881
|
-
"min-left":
|
|
2882
|
-
"min-right":
|
|
2975
|
+
"min-left": 65,
|
|
2976
|
+
"min-right": 20,
|
|
2883
2977
|
onChange: columnWidthChange
|
|
2884
2978
|
}, vue.createSlots({
|
|
2885
2979
|
left: vue.withCtx(() => [
|
|
@@ -2887,7 +2981,7 @@
|
|
|
2887
2981
|
]),
|
|
2888
2982
|
center: vue.withCtx(() => [
|
|
2889
2983
|
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2890
|
-
vue.createVNode(_sfc_main$
|
|
2984
|
+
vue.createVNode(_sfc_main$p)
|
|
2891
2985
|
])
|
|
2892
2986
|
]),
|
|
2893
2987
|
_: 2
|
|
@@ -2909,15 +3003,15 @@
|
|
|
2909
3003
|
}
|
|
2910
3004
|
});
|
|
2911
3005
|
|
|
2912
|
-
const _hoisted_1$
|
|
3006
|
+
const _hoisted_1$d = {
|
|
2913
3007
|
key: 1,
|
|
2914
3008
|
class: "menu-item-text"
|
|
2915
3009
|
};
|
|
2916
|
-
const _hoisted_2$
|
|
3010
|
+
const _hoisted_2$7 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2917
3011
|
const __default__$j = vue.defineComponent({
|
|
2918
3012
|
name: "MEditorToolButton"
|
|
2919
3013
|
});
|
|
2920
|
-
const _sfc_main$
|
|
3014
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
2921
3015
|
...__default__$j,
|
|
2922
3016
|
props: {
|
|
2923
3017
|
data: { default: () => ({
|
|
@@ -2993,7 +3087,7 @@
|
|
|
2993
3087
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
2994
3088
|
key: 0,
|
|
2995
3089
|
direction: __props.data.direction || "vertical"
|
|
2996
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3090
|
+
}, 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
3091
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
2998
3092
|
key: 0,
|
|
2999
3093
|
effect: "dark",
|
|
@@ -3007,7 +3101,7 @@
|
|
|
3007
3101
|
disabled: vue.unref(disabled)
|
|
3008
3102
|
}, {
|
|
3009
3103
|
default: vue.withCtx(() => [
|
|
3010
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3104
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
3011
3105
|
key: 0,
|
|
3012
3106
|
icon: __props.data.icon
|
|
3013
3107
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -3024,7 +3118,7 @@
|
|
|
3024
3118
|
disabled: vue.unref(disabled)
|
|
3025
3119
|
}, {
|
|
3026
3120
|
default: vue.withCtx(() => [
|
|
3027
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3121
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
3028
3122
|
key: 0,
|
|
3029
3123
|
icon: __props.data.icon
|
|
3030
3124
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -3057,7 +3151,7 @@
|
|
|
3057
3151
|
})) : vue.createCommentVNode("", true)
|
|
3058
3152
|
]),
|
|
3059
3153
|
default: vue.withCtx(() => [
|
|
3060
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
3154
|
+
vue.createElementVNode("span", _hoisted_2$7, [
|
|
3061
3155
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
3062
3156
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
3063
3157
|
default: vue.withCtx(() => [
|
|
@@ -3077,7 +3171,7 @@
|
|
|
3077
3171
|
const __default__$i = vue.defineComponent({
|
|
3078
3172
|
name: "MEditorNavMenu"
|
|
3079
3173
|
});
|
|
3080
|
-
const _sfc_main$
|
|
3174
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
3081
3175
|
...__default__$i,
|
|
3082
3176
|
props: {
|
|
3083
3177
|
data: { default: () => ({}) },
|
|
@@ -3120,7 +3214,7 @@
|
|
|
3120
3214
|
type: "button",
|
|
3121
3215
|
className: "delete",
|
|
3122
3216
|
icon: vue.markRaw(iconsVue.Delete),
|
|
3123
|
-
tooltip:
|
|
3217
|
+
tooltip: `刪除(Delete)`,
|
|
3124
3218
|
disabled: () => services?.editorService.get("node")?.type === schema.NodeType.PAGE,
|
|
3125
3219
|
handler: () => {
|
|
3126
3220
|
const node = services?.editorService.get("node");
|
|
@@ -3133,7 +3227,7 @@
|
|
|
3133
3227
|
type: "button",
|
|
3134
3228
|
className: "undo",
|
|
3135
3229
|
icon: vue.markRaw(iconsVue.Back),
|
|
3136
|
-
tooltip:
|
|
3230
|
+
tooltip: `后退(${ctrl}+z)`,
|
|
3137
3231
|
disabled: () => !services?.historyService.state.canUndo,
|
|
3138
3232
|
handler: () => services?.editorService.undo()
|
|
3139
3233
|
});
|
|
@@ -3143,7 +3237,7 @@
|
|
|
3143
3237
|
type: "button",
|
|
3144
3238
|
className: "redo",
|
|
3145
3239
|
icon: vue.markRaw(iconsVue.Right),
|
|
3146
|
-
tooltip:
|
|
3240
|
+
tooltip: `前进(${ctrl}+Shift+z)`,
|
|
3147
3241
|
disabled: () => !services?.historyService.state.canRedo,
|
|
3148
3242
|
handler: () => services?.editorService.redo()
|
|
3149
3243
|
});
|
|
@@ -3153,7 +3247,7 @@
|
|
|
3153
3247
|
type: "button",
|
|
3154
3248
|
className: "zoom-in",
|
|
3155
3249
|
icon: vue.markRaw(iconsVue.ZoomIn),
|
|
3156
|
-
tooltip:
|
|
3250
|
+
tooltip: `放大(${ctrl}+=)`,
|
|
3157
3251
|
handler: () => uiService?.zoom(0.1)
|
|
3158
3252
|
});
|
|
3159
3253
|
break;
|
|
@@ -3162,7 +3256,7 @@
|
|
|
3162
3256
|
type: "button",
|
|
3163
3257
|
className: "zoom-out",
|
|
3164
3258
|
icon: vue.markRaw(iconsVue.ZoomOut),
|
|
3165
|
-
tooltip:
|
|
3259
|
+
tooltip: `縮小(${ctrl}+-)`,
|
|
3166
3260
|
handler: () => uiService?.zoom(-0.1)
|
|
3167
3261
|
});
|
|
3168
3262
|
break;
|
|
@@ -3171,7 +3265,7 @@
|
|
|
3171
3265
|
type: "button",
|
|
3172
3266
|
className: "scale-to-original",
|
|
3173
3267
|
icon: vue.markRaw(iconsVue.ScaleToOriginal),
|
|
3174
|
-
tooltip:
|
|
3268
|
+
tooltip: `缩放到实际大小(${ctrl}+1)`,
|
|
3175
3269
|
handler: () => uiService?.set("zoom", 1)
|
|
3176
3270
|
});
|
|
3177
3271
|
break;
|
|
@@ -3180,7 +3274,7 @@
|
|
|
3180
3274
|
type: "button",
|
|
3181
3275
|
className: "scale-to-fit",
|
|
3182
3276
|
icon: vue.markRaw(iconsVue.FullScreen),
|
|
3183
|
-
tooltip:
|
|
3277
|
+
tooltip: `缩放以适应(${ctrl}+0)`,
|
|
3184
3278
|
handler: async () => uiService?.set("zoom", await uiService.calcZoom())
|
|
3185
3279
|
});
|
|
3186
3280
|
break;
|
|
@@ -3189,7 +3283,7 @@
|
|
|
3189
3283
|
type: "button",
|
|
3190
3284
|
className: "rule",
|
|
3191
3285
|
icon: vue.markRaw(iconsVue.Memo),
|
|
3192
|
-
tooltip: showRule.value ? "
|
|
3286
|
+
tooltip: showRule.value ? "隐藏标尺" : "显示标尺",
|
|
3193
3287
|
handler: () => uiService?.set("showRule", !showRule.value)
|
|
3194
3288
|
});
|
|
3195
3289
|
break;
|
|
@@ -3198,7 +3292,7 @@
|
|
|
3198
3292
|
type: "button",
|
|
3199
3293
|
className: "guides",
|
|
3200
3294
|
icon: vue.markRaw(iconsVue.Grid),
|
|
3201
|
-
tooltip: showGuides.value ? "
|
|
3295
|
+
tooltip: showGuides.value ? "隐藏参考线" : "显示参考线",
|
|
3202
3296
|
handler: () => uiService?.set("showGuides", !showGuides.value)
|
|
3203
3297
|
});
|
|
3204
3298
|
break;
|
|
@@ -3236,7 +3330,7 @@
|
|
|
3236
3330
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3237
3331
|
}, [
|
|
3238
3332
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3239
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3333
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
3240
3334
|
data: item,
|
|
3241
3335
|
key: index
|
|
3242
3336
|
}, null, 8, ["data"]);
|
|
@@ -3248,11 +3342,11 @@
|
|
|
3248
3342
|
}
|
|
3249
3343
|
});
|
|
3250
3344
|
|
|
3251
|
-
const _hoisted_1$
|
|
3345
|
+
const _hoisted_1$c = { class: "m-editor-props-panel" };
|
|
3252
3346
|
const __default__$h = vue.defineComponent({
|
|
3253
3347
|
name: "MEditorPropsPanel"
|
|
3254
3348
|
});
|
|
3255
|
-
const _sfc_main$
|
|
3349
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
3256
3350
|
...__default__$h,
|
|
3257
3351
|
emits: ["mounted"],
|
|
3258
3352
|
setup(__props, { expose, emit }) {
|
|
@@ -3298,7 +3392,7 @@
|
|
|
3298
3392
|
};
|
|
3299
3393
|
expose({ submit });
|
|
3300
3394
|
return (_ctx, _cache) => {
|
|
3301
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3395
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
3302
3396
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3303
3397
|
vue.createVNode(vue.unref(form.MForm), {
|
|
3304
3398
|
ref_key: "configForm",
|
|
@@ -3315,7 +3409,7 @@
|
|
|
3315
3409
|
}
|
|
3316
3410
|
});
|
|
3317
3411
|
|
|
3318
|
-
const _sfc_main$
|
|
3412
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
3319
3413
|
__name: "SearchInput",
|
|
3320
3414
|
emits: ["search"],
|
|
3321
3415
|
setup(__props, { emit }) {
|
|
@@ -3329,26 +3423,83 @@
|
|
|
3329
3423
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3330
3424
|
class: "search-input",
|
|
3331
3425
|
size: "small",
|
|
3332
|
-
placeholder: "
|
|
3426
|
+
placeholder: "输入关键字进行过滤",
|
|
3333
3427
|
clearable: "",
|
|
3334
|
-
"prefix-icon": vue.unref(iconsVue.Search),
|
|
3335
3428
|
onInput: filterTextChangeHandler
|
|
3336
|
-
},
|
|
3429
|
+
}, {
|
|
3430
|
+
prefix: vue.withCtx(() => [
|
|
3431
|
+
vue.createVNode(vue.unref(design.TMagicIcon), null, {
|
|
3432
|
+
default: vue.withCtx(() => [
|
|
3433
|
+
vue.createVNode(vue.unref(iconsVue.Search))
|
|
3434
|
+
]),
|
|
3435
|
+
_: 1
|
|
3436
|
+
})
|
|
3437
|
+
]),
|
|
3438
|
+
_: 1
|
|
3439
|
+
}, 8, ["modelValue"]);
|
|
3337
3440
|
};
|
|
3338
3441
|
}
|
|
3339
3442
|
});
|
|
3340
3443
|
|
|
3444
|
+
const _export_sfc = (sfc, props) => {
|
|
3445
|
+
const target = sfc.__vccOpts || sfc;
|
|
3446
|
+
for (const [key, val] of props) {
|
|
3447
|
+
target[key] = val;
|
|
3448
|
+
}
|
|
3449
|
+
return target;
|
|
3450
|
+
};
|
|
3451
|
+
|
|
3452
|
+
const _sfc_main$j = {};
|
|
3453
|
+
|
|
3454
|
+
const _hoisted_1$b = { xmlns: "http://www.w3.org/2000/svg" };
|
|
3455
|
+
const _hoisted_2$6 = /*#__PURE__*/vue.createElementVNode("g", {
|
|
3456
|
+
fill: "#7C878E",
|
|
3457
|
+
"fill-rule": "evenodd"
|
|
3458
|
+
}, [
|
|
3459
|
+
/*#__PURE__*/vue.createElementVNode("path", {
|
|
3460
|
+
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",
|
|
3461
|
+
"fill-rule": "nonzero"
|
|
3462
|
+
}),
|
|
3463
|
+
/*#__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" })
|
|
3464
|
+
], -1);
|
|
3465
|
+
const _hoisted_3$3 = [
|
|
3466
|
+
_hoisted_2$6
|
|
3467
|
+
];
|
|
3468
|
+
|
|
3469
|
+
function _sfc_render$2(_ctx, _cache) {
|
|
3470
|
+
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$b, _hoisted_3$3))
|
|
3471
|
+
}
|
|
3472
|
+
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$j, [['render',_sfc_render$2]]);
|
|
3473
|
+
|
|
3474
|
+
const _sfc_main$i = {};
|
|
3475
|
+
|
|
3476
|
+
const _hoisted_1$a = {
|
|
3477
|
+
viewBox: "0 0 32 32",
|
|
3478
|
+
version: "1.1",
|
|
3479
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3480
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3481
|
+
};
|
|
3482
|
+
const _hoisted_2$5 = /*#__PURE__*/vue.createStaticVNode("<defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 2);
|
|
3483
|
+
const _hoisted_4$3 = [
|
|
3484
|
+
_hoisted_2$5
|
|
3485
|
+
];
|
|
3486
|
+
|
|
3487
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
3488
|
+
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$a, _hoisted_4$3))
|
|
3489
|
+
}
|
|
3490
|
+
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$i, [['render',_sfc_render$1]]);
|
|
3491
|
+
|
|
3341
3492
|
const _hoisted_1$9 = {
|
|
3342
3493
|
key: 0,
|
|
3343
3494
|
class: "m-editor-content-bottom"
|
|
3344
3495
|
};
|
|
3345
|
-
const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("
|
|
3346
|
-
const _hoisted_3$2 = /* @__PURE__ */ vue.createTextVNode("
|
|
3496
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("确认");
|
|
3497
|
+
const _hoisted_3$2 = /* @__PURE__ */ vue.createTextVNode("关闭");
|
|
3347
3498
|
const _hoisted_4$2 = {
|
|
3348
3499
|
key: 1,
|
|
3349
3500
|
class: "m-editor-content-bottom"
|
|
3350
3501
|
};
|
|
3351
|
-
const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("
|
|
3502
|
+
const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("关闭");
|
|
3352
3503
|
const __default__$g = vue.defineComponent({
|
|
3353
3504
|
name: "MEditorCodeDraftEditor"
|
|
3354
3505
|
});
|
|
@@ -3363,7 +3514,7 @@
|
|
|
3363
3514
|
language: null
|
|
3364
3515
|
},
|
|
3365
3516
|
emits: ["close", "saveAndClose"],
|
|
3366
|
-
setup(__props, { emit }) {
|
|
3517
|
+
setup(__props, { expose, emit }) {
|
|
3367
3518
|
const props = __props;
|
|
3368
3519
|
const services = vue.inject("services");
|
|
3369
3520
|
const codeContent = vue.ref("");
|
|
@@ -3393,7 +3544,7 @@
|
|
|
3393
3544
|
return;
|
|
3394
3545
|
}
|
|
3395
3546
|
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3396
|
-
design.tMagicMessage.success(
|
|
3547
|
+
design.tMagicMessage.success(`代码草稿成功保存到本地 ${utils.datetimeFormatter( new Date())}`);
|
|
3397
3548
|
};
|
|
3398
3549
|
const saveAndClose = () => {
|
|
3399
3550
|
if (!codeEditor.value || !props.editable)
|
|
@@ -3404,19 +3555,20 @@
|
|
|
3404
3555
|
const close = async () => {
|
|
3405
3556
|
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3406
3557
|
if (codeDraft) {
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3558
|
+
try {
|
|
3559
|
+
await design.tMagicMessageBox.confirm("您有代码修改未保存,是否保存后再关闭?", "提示", {
|
|
3560
|
+
confirmButtonText: "保存并关闭",
|
|
3561
|
+
cancelButtonText: "直接关闭",
|
|
3562
|
+
type: "warning",
|
|
3563
|
+
distinguishCancelAndClose: true
|
|
3564
|
+
});
|
|
3413
3565
|
saveAndClose();
|
|
3414
|
-
}
|
|
3566
|
+
} catch (action) {
|
|
3415
3567
|
if (action === "cancel") {
|
|
3416
3568
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3417
3569
|
emit("close");
|
|
3418
3570
|
}
|
|
3419
|
-
}
|
|
3571
|
+
}
|
|
3420
3572
|
} else {
|
|
3421
3573
|
emit("close");
|
|
3422
3574
|
}
|
|
@@ -3427,11 +3579,15 @@
|
|
|
3427
3579
|
codeEditor.value.focus();
|
|
3428
3580
|
}
|
|
3429
3581
|
};
|
|
3582
|
+
expose({
|
|
3583
|
+
saveAndClose,
|
|
3584
|
+
close
|
|
3585
|
+
});
|
|
3430
3586
|
return (_ctx, _cache) => {
|
|
3431
3587
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3432
3588
|
class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3433
3589
|
}, [
|
|
3434
|
-
vue.createVNode(_sfc_main$
|
|
3590
|
+
vue.createVNode(_sfc_main$s, {
|
|
3435
3591
|
ref_key: "codeEditor",
|
|
3436
3592
|
ref: codeEditor,
|
|
3437
3593
|
class: "m-editor-container",
|
|
@@ -3447,7 +3603,7 @@
|
|
|
3447
3603
|
onClick: toggleFullScreen
|
|
3448
3604
|
}, {
|
|
3449
3605
|
default: vue.withCtx(() => [
|
|
3450
|
-
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "
|
|
3606
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3451
3607
|
]),
|
|
3452
3608
|
_: 1
|
|
3453
3609
|
}),
|
|
@@ -3478,7 +3634,7 @@
|
|
|
3478
3634
|
onClick: toggleFullScreen
|
|
3479
3635
|
}, {
|
|
3480
3636
|
default: vue.withCtx(() => [
|
|
3481
|
-
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "
|
|
3637
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "退出全屏" : "全屏"), 1)
|
|
3482
3638
|
]),
|
|
3483
3639
|
_: 1
|
|
3484
3640
|
}),
|
|
@@ -3499,9 +3655,9 @@
|
|
|
3499
3655
|
});
|
|
3500
3656
|
|
|
3501
3657
|
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3502
|
-
const _hoisted_2$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "
|
|
3658
|
+
const _hoisted_2$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
3503
3659
|
const _hoisted_3$1 = { class: "code-name-wrapper" };
|
|
3504
|
-
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "
|
|
3660
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
3505
3661
|
const __default__$f = vue.defineComponent({
|
|
3506
3662
|
name: "MEditorFunctionEditor"
|
|
3507
3663
|
});
|
|
@@ -3516,27 +3672,26 @@
|
|
|
3516
3672
|
codeOptions: null,
|
|
3517
3673
|
paramsColConfig: null
|
|
3518
3674
|
},
|
|
3519
|
-
|
|
3520
|
-
setup(__props, { emit }) {
|
|
3675
|
+
setup(__props, { expose }) {
|
|
3521
3676
|
const props = __props;
|
|
3522
3677
|
const defaultParamColConfig = {
|
|
3523
3678
|
type: "row",
|
|
3524
|
-
label: "
|
|
3679
|
+
label: "参数类型",
|
|
3525
3680
|
items: [
|
|
3526
3681
|
{
|
|
3527
|
-
text: "
|
|
3682
|
+
text: "参数类型",
|
|
3528
3683
|
labelWidth: "70px",
|
|
3529
3684
|
type: "select",
|
|
3530
3685
|
name: "type",
|
|
3531
3686
|
options: [
|
|
3532
3687
|
{
|
|
3533
|
-
text: "
|
|
3534
|
-
label: "
|
|
3688
|
+
text: "数字",
|
|
3689
|
+
label: "数字",
|
|
3535
3690
|
value: "number"
|
|
3536
3691
|
},
|
|
3537
3692
|
{
|
|
3538
|
-
text: "
|
|
3539
|
-
label: "
|
|
3693
|
+
text: "字符串",
|
|
3694
|
+
label: "字符串",
|
|
3540
3695
|
value: "text"
|
|
3541
3696
|
}
|
|
3542
3697
|
]
|
|
@@ -3554,13 +3709,13 @@
|
|
|
3554
3709
|
items: [
|
|
3555
3710
|
{
|
|
3556
3711
|
type: "text",
|
|
3557
|
-
label: "
|
|
3712
|
+
label: "参数名",
|
|
3558
3713
|
name: "name",
|
|
3559
3714
|
width: 200
|
|
3560
3715
|
},
|
|
3561
3716
|
{
|
|
3562
3717
|
type: "text",
|
|
3563
|
-
label: "
|
|
3718
|
+
label: "参数注释",
|
|
3564
3719
|
name: "tip",
|
|
3565
3720
|
width: 200
|
|
3566
3721
|
},
|
|
@@ -3571,11 +3726,6 @@
|
|
|
3571
3726
|
const codeName = vue.ref("");
|
|
3572
3727
|
const codeContent = vue.ref("");
|
|
3573
3728
|
const evalRes = vue.ref(true);
|
|
3574
|
-
vue.provide("mForm", {
|
|
3575
|
-
$emit: emit,
|
|
3576
|
-
setField: () => {
|
|
3577
|
-
}
|
|
3578
|
-
});
|
|
3579
3729
|
const tableModel = vue.ref();
|
|
3580
3730
|
vue.watchEffect(() => {
|
|
3581
3731
|
codeName.value = props.name;
|
|
@@ -3609,7 +3759,7 @@
|
|
|
3609
3759
|
content: codeValue2,
|
|
3610
3760
|
params: tableModel.value?.params || []
|
|
3611
3761
|
});
|
|
3612
|
-
design.tMagicMessage.success("
|
|
3762
|
+
design.tMagicMessage.success("代码成功保存到本地");
|
|
3613
3763
|
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3614
3764
|
}
|
|
3615
3765
|
};
|
|
@@ -3622,6 +3772,10 @@
|
|
|
3622
3772
|
const close = () => {
|
|
3623
3773
|
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3624
3774
|
};
|
|
3775
|
+
const codeDraftEditor = vue.ref();
|
|
3776
|
+
expose({
|
|
3777
|
+
codeDraftEditor
|
|
3778
|
+
});
|
|
3625
3779
|
return (_ctx, _cache) => {
|
|
3626
3780
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
3627
3781
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
@@ -3650,6 +3804,8 @@
|
|
|
3650
3804
|
]),
|
|
3651
3805
|
default: vue.withCtx(() => [
|
|
3652
3806
|
vue.createVNode(_sfc_main$h, {
|
|
3807
|
+
ref_key: "codeDraftEditor",
|
|
3808
|
+
ref: codeDraftEditor,
|
|
3653
3809
|
id: __props.id,
|
|
3654
3810
|
content: codeContent.value,
|
|
3655
3811
|
editable: __props.editable,
|
|
@@ -3710,19 +3866,24 @@
|
|
|
3710
3866
|
});
|
|
3711
3867
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3712
3868
|
});
|
|
3869
|
+
const functionEditor = vue.ref();
|
|
3870
|
+
const handleClose = async () => {
|
|
3871
|
+
await functionEditor.value?.codeDraftEditor?.close();
|
|
3872
|
+
};
|
|
3713
3873
|
return (_ctx, _cache) => {
|
|
3714
3874
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDrawer), {
|
|
3715
3875
|
class: "code-editor-dialog",
|
|
3716
3876
|
"model-value": true,
|
|
3717
3877
|
title: currentTitle.value,
|
|
3718
|
-
"close-on-press-escape":
|
|
3878
|
+
"close-on-press-escape": true,
|
|
3719
3879
|
"append-to-body": true,
|
|
3720
3880
|
"show-close": false,
|
|
3721
|
-
"close-on-click-modal":
|
|
3722
|
-
size: vue.unref(size)
|
|
3881
|
+
"close-on-click-modal": true,
|
|
3882
|
+
size: vue.unref(size),
|
|
3883
|
+
"before-close": handleClose
|
|
3723
3884
|
}, {
|
|
3724
3885
|
default: vue.withCtx(() => [
|
|
3725
|
-
vue.createVNode(_sfc_main$
|
|
3886
|
+
vue.createVNode(_sfc_main$q, {
|
|
3726
3887
|
left: left.value,
|
|
3727
3888
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3728
3889
|
"min-left": 45,
|
|
@@ -3733,6 +3894,8 @@
|
|
|
3733
3894
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3734
3895
|
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
|
|
3735
3896
|
key: 0,
|
|
3897
|
+
ref_key: "functionEditor",
|
|
3898
|
+
ref: functionEditor,
|
|
3736
3899
|
id: vue.unref(id),
|
|
3737
3900
|
name: codeConfig.value.name,
|
|
3738
3901
|
content: codeConfig.value.content,
|
|
@@ -3752,13 +3915,12 @@
|
|
|
3752
3915
|
}
|
|
3753
3916
|
});
|
|
3754
3917
|
|
|
3755
|
-
const _hoisted_1$6 = { class: "
|
|
3756
|
-
const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("
|
|
3918
|
+
const _hoisted_1$6 = { class: "search-wrapper" };
|
|
3919
|
+
const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("新增");
|
|
3757
3920
|
const _hoisted_3 = ["id"];
|
|
3758
3921
|
const _hoisted_4 = { class: "list-item" };
|
|
3759
|
-
const _hoisted_5 = {
|
|
3760
|
-
|
|
3761
|
-
key: 0,
|
|
3922
|
+
const _hoisted_5 = {
|
|
3923
|
+
key: 2,
|
|
3762
3924
|
class: "right-tool"
|
|
3763
3925
|
};
|
|
3764
3926
|
const __default__$d = vue.defineComponent({
|
|
@@ -3774,28 +3936,32 @@
|
|
|
3774
3936
|
const props = __props;
|
|
3775
3937
|
const { codeBlockService, depService, editorService } = vue.inject("services") || {};
|
|
3776
3938
|
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]) => ({
|
|
3939
|
+
() => Object.values(depService?.targets["code-block"] || {}).map((target) => {
|
|
3940
|
+
const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
|
|
3783
3941
|
name: dep.name,
|
|
3784
3942
|
type: "node",
|
|
3785
3943
|
id,
|
|
3786
3944
|
children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
|
|
3787
|
-
}))
|
|
3788
|
-
|
|
3945
|
+
}));
|
|
3946
|
+
return {
|
|
3947
|
+
id: target.id,
|
|
3948
|
+
name: target.name,
|
|
3949
|
+
type: "code",
|
|
3950
|
+
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
3951
|
+
children: compNodes
|
|
3952
|
+
};
|
|
3953
|
+
})
|
|
3789
3954
|
);
|
|
3955
|
+
const expandedKeys = vue.computed(() => codeList.value.map((item) => item.id));
|
|
3790
3956
|
const editable = vue.computed(() => codeBlockService?.getEditStatus());
|
|
3791
3957
|
const isShowCodeBlockEditor = vue.computed(() => codeBlockService?.getCodeEditorShowStatus() || false);
|
|
3792
3958
|
const createCodeBlock = async () => {
|
|
3793
3959
|
if (!codeBlockService) {
|
|
3794
|
-
design.tMagicMessage.error("
|
|
3960
|
+
design.tMagicMessage.error("新增代码块失败");
|
|
3795
3961
|
return;
|
|
3796
3962
|
}
|
|
3797
3963
|
const codeConfig = {
|
|
3798
|
-
name: "
|
|
3964
|
+
name: "代码块",
|
|
3799
3965
|
content: `({app, params}) => {
|
|
3800
3966
|
// place your code here
|
|
3801
3967
|
}`,
|
|
@@ -3818,7 +3984,7 @@
|
|
|
3818
3984
|
if (typeof props.customError === "function") {
|
|
3819
3985
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3820
3986
|
} else {
|
|
3821
|
-
design.tMagicMessage.error("
|
|
3987
|
+
design.tMagicMessage.error("代码块删除失败");
|
|
3822
3988
|
}
|
|
3823
3989
|
}
|
|
3824
3990
|
};
|
|
@@ -3845,11 +4011,11 @@
|
|
|
3845
4011
|
}
|
|
3846
4012
|
};
|
|
3847
4013
|
return (_ctx, _cache) => {
|
|
3848
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list" }, {
|
|
4014
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
3849
4015
|
default: vue.withCtx(() => [
|
|
3850
4016
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3851
4017
|
vue.createElementVNode("div", _hoisted_1$6, [
|
|
3852
|
-
vue.createVNode(_sfc_main$
|
|
4018
|
+
vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
3853
4019
|
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3854
4020
|
key: 0,
|
|
3855
4021
|
class: "create-code-button",
|
|
@@ -3869,8 +4035,8 @@
|
|
|
3869
4035
|
ref: tree,
|
|
3870
4036
|
class: "magic-editor-layer-tree",
|
|
3871
4037
|
"node-key": "id",
|
|
3872
|
-
"empty-text": "
|
|
3873
|
-
"default-
|
|
4038
|
+
"empty-text": "暂无代码块",
|
|
4039
|
+
"default-expanded-keys": vue.unref(expandedKeys),
|
|
3874
4040
|
"expand-on-click-node": false,
|
|
3875
4041
|
data: vue.unref(codeList),
|
|
3876
4042
|
"highlight-current": true,
|
|
@@ -3883,15 +4049,25 @@
|
|
|
3883
4049
|
class: "list-container"
|
|
3884
4050
|
}, [
|
|
3885
4051
|
vue.createElementVNode("div", _hoisted_4, [
|
|
3886
|
-
|
|
3887
|
-
|
|
4052
|
+
data.type === "code" ? (vue.openBlock(), vue.createBlock(CodeIcon, {
|
|
4053
|
+
key: 0,
|
|
4054
|
+
class: "codeIcon"
|
|
4055
|
+
})) : vue.createCommentVNode("", true),
|
|
4056
|
+
data.type === "node" ? (vue.openBlock(), vue.createBlock(AppManageIcon, {
|
|
4057
|
+
key: 1,
|
|
4058
|
+
class: "compIcon"
|
|
4059
|
+
})) : vue.createCommentVNode("", true),
|
|
4060
|
+
vue.createElementVNode("span", {
|
|
4061
|
+
class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4062
|
+
}, vue.toDisplayString(data.name) + " (" + vue.toDisplayString(data.id) + ")", 3),
|
|
4063
|
+
data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
3888
4064
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
3889
4065
|
effect: "dark",
|
|
3890
|
-
content: vue.unref(editable) ? "
|
|
4066
|
+
content: vue.unref(editable) ? "编辑" : "查看",
|
|
3891
4067
|
placement: "bottom"
|
|
3892
4068
|
}, {
|
|
3893
4069
|
default: vue.withCtx(() => [
|
|
3894
|
-
vue.createVNode(_sfc_main$
|
|
4070
|
+
vue.createVNode(_sfc_main$w, {
|
|
3895
4071
|
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3896
4072
|
class: "edit-icon",
|
|
3897
4073
|
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3902,11 +4078,11 @@
|
|
|
3902
4078
|
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3903
4079
|
key: 0,
|
|
3904
4080
|
effect: "dark",
|
|
3905
|
-
content: "
|
|
4081
|
+
content: "删除",
|
|
3906
4082
|
placement: "bottom"
|
|
3907
4083
|
}, {
|
|
3908
4084
|
default: vue.withCtx(() => [
|
|
3909
|
-
vue.createVNode(_sfc_main$
|
|
4085
|
+
vue.createVNode(_sfc_main$w, {
|
|
3910
4086
|
icon: vue.unref(iconsVue.Close),
|
|
3911
4087
|
class: "edit-icon",
|
|
3912
4088
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3923,7 +4099,7 @@
|
|
|
3923
4099
|
], 8, _hoisted_3)
|
|
3924
4100
|
]),
|
|
3925
4101
|
_: 3
|
|
3926
|
-
}, 8, ["data"]),
|
|
4102
|
+
}, 8, ["default-expanded-keys", "data"]),
|
|
3927
4103
|
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
|
|
3928
4104
|
key: 0,
|
|
3929
4105
|
paramsColConfig: __props.paramsColConfig
|
|
@@ -3978,7 +4154,7 @@
|
|
|
3978
4154
|
e.dataTransfer.effectAllowed = "move";
|
|
3979
4155
|
e.dataTransfer.setData(
|
|
3980
4156
|
"data",
|
|
3981
|
-
|
|
4157
|
+
serialize({
|
|
3982
4158
|
name: text,
|
|
3983
4159
|
type,
|
|
3984
4160
|
...data
|
|
@@ -4021,7 +4197,7 @@
|
|
|
4021
4197
|
"model-value": vue.unref(collapseValue)
|
|
4022
4198
|
}, {
|
|
4023
4199
|
default: vue.withCtx(() => [
|
|
4024
|
-
vue.createVNode(_sfc_main$
|
|
4200
|
+
vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4025
4201
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
|
|
4026
4202
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
4027
4203
|
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
@@ -4029,7 +4205,7 @@
|
|
|
4029
4205
|
name: `${index}`
|
|
4030
4206
|
}, {
|
|
4031
4207
|
title: vue.withCtx(() => [
|
|
4032
|
-
vue.createVNode(_sfc_main$
|
|
4208
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
4033
4209
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
4034
4210
|
]),
|
|
4035
4211
|
default: vue.withCtx(() => [
|
|
@@ -4044,7 +4220,7 @@
|
|
|
4044
4220
|
onDrag: dragHandler
|
|
4045
4221
|
}, [
|
|
4046
4222
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4047
|
-
vue.createVNode(_sfc_main$
|
|
4223
|
+
vue.createVNode(_sfc_main$w, {
|
|
4048
4224
|
icon: item.icon
|
|
4049
4225
|
}, null, 8, ["icon"]),
|
|
4050
4226
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -4167,7 +4343,7 @@
|
|
|
4167
4343
|
}, [
|
|
4168
4344
|
vue.createElementVNode("div", null, [
|
|
4169
4345
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
4170
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4346
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
4171
4347
|
"event-type": "mouseup",
|
|
4172
4348
|
data: item,
|
|
4173
4349
|
key: index,
|
|
@@ -4225,7 +4401,7 @@
|
|
|
4225
4401
|
if (node.value?.type === "tabs") {
|
|
4226
4402
|
return [
|
|
4227
4403
|
{
|
|
4228
|
-
text: "
|
|
4404
|
+
text: "标签页",
|
|
4229
4405
|
type: "button",
|
|
4230
4406
|
icon: iconsVue.Files,
|
|
4231
4407
|
handler: () => {
|
|
@@ -4255,14 +4431,14 @@
|
|
|
4255
4431
|
const menuData = vue.computed(() => [
|
|
4256
4432
|
{
|
|
4257
4433
|
type: "button",
|
|
4258
|
-
text: "
|
|
4434
|
+
text: "新增",
|
|
4259
4435
|
icon: vue.markRaw(iconsVue.Plus),
|
|
4260
4436
|
display: () => node.value?.items,
|
|
4261
4437
|
items: getSubMenuData.value
|
|
4262
4438
|
},
|
|
4263
4439
|
{
|
|
4264
4440
|
type: "button",
|
|
4265
|
-
text: "
|
|
4441
|
+
text: "复制",
|
|
4266
4442
|
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
4267
4443
|
display: () => !isRoot.value,
|
|
4268
4444
|
handler: () => {
|
|
@@ -4271,7 +4447,7 @@
|
|
|
4271
4447
|
},
|
|
4272
4448
|
{
|
|
4273
4449
|
type: "button",
|
|
4274
|
-
text: "
|
|
4450
|
+
text: "删除",
|
|
4275
4451
|
icon: vue.markRaw(iconsVue.Delete),
|
|
4276
4452
|
display: () => !isRoot.value && !isPage.value,
|
|
4277
4453
|
handler: () => {
|
|
@@ -4335,7 +4511,7 @@
|
|
|
4335
4511
|
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
4336
4512
|
const select = async (data) => {
|
|
4337
4513
|
if (!data.id) {
|
|
4338
|
-
throw new Error("
|
|
4514
|
+
throw new Error("没有id");
|
|
4339
4515
|
}
|
|
4340
4516
|
await editorService?.select(data);
|
|
4341
4517
|
editorService?.get("stage")?.select(data.id);
|
|
@@ -4346,7 +4522,7 @@
|
|
|
4346
4522
|
};
|
|
4347
4523
|
const highlight = (data) => {
|
|
4348
4524
|
if (!data?.id) {
|
|
4349
|
-
throw new Error("
|
|
4525
|
+
throw new Error("没有id");
|
|
4350
4526
|
}
|
|
4351
4527
|
editorService?.highlight(data);
|
|
4352
4528
|
editorService?.get("stage")?.highlight(data.id);
|
|
@@ -4359,7 +4535,7 @@
|
|
|
4359
4535
|
return false;
|
|
4360
4536
|
if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
|
|
4361
4537
|
return false;
|
|
4362
|
-
if (!data
|
|
4538
|
+
if (!data?.type)
|
|
4363
4539
|
return false;
|
|
4364
4540
|
if (["prev", "next"].includes(type))
|
|
4365
4541
|
return true;
|
|
@@ -4444,7 +4620,7 @@
|
|
|
4444
4620
|
let keycon;
|
|
4445
4621
|
vue.onMounted(() => {
|
|
4446
4622
|
editorService?.on("remove", editorServiceRemoveHandler);
|
|
4447
|
-
keycon = new
|
|
4623
|
+
keycon = new KeyController();
|
|
4448
4624
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4449
4625
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4450
4626
|
keycon.keydown((e) => {
|
|
@@ -4498,14 +4674,14 @@
|
|
|
4498
4674
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4499
4675
|
default: vue.withCtx(() => [
|
|
4500
4676
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4501
|
-
vue.createVNode(_sfc_main$
|
|
4677
|
+
vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
|
|
4502
4678
|
vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
4503
4679
|
key: 0,
|
|
4504
4680
|
class: "magic-editor-layer-tree",
|
|
4505
4681
|
ref_key: "tree",
|
|
4506
4682
|
ref: tree,
|
|
4507
4683
|
"node-key": "id",
|
|
4508
|
-
"empty-text": "
|
|
4684
|
+
"empty-text": "页面空荡荡的",
|
|
4509
4685
|
draggable: "",
|
|
4510
4686
|
"default-expanded-keys": expandedKeys.value,
|
|
4511
4687
|
"default-checked-keys": checkedKeys.value,
|
|
@@ -4567,12 +4743,13 @@
|
|
|
4567
4743
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4568
4744
|
...__default__$8,
|
|
4569
4745
|
props: {
|
|
4570
|
-
data: { default: () => ({ type: "tabs", status: "
|
|
4746
|
+
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block"] }) },
|
|
4571
4747
|
layerContentMenu: null
|
|
4572
4748
|
},
|
|
4573
4749
|
setup(__props, { expose }) {
|
|
4574
4750
|
const props = __props;
|
|
4575
|
-
const
|
|
4751
|
+
const tabPaneComponent = design.getConfig("components").tabPane;
|
|
4752
|
+
const tabsComponent = design.getConfig("components").tabs;
|
|
4576
4753
|
const activeTabName = vue.ref(props.data?.status);
|
|
4577
4754
|
const getItemConfig = (data) => {
|
|
4578
4755
|
const map = {
|
|
@@ -4580,7 +4757,7 @@
|
|
|
4580
4757
|
$key: "component-list",
|
|
4581
4758
|
type: "component",
|
|
4582
4759
|
icon: iconsVue.Coin,
|
|
4583
|
-
text: "
|
|
4760
|
+
text: "组件",
|
|
4584
4761
|
component: _sfc_main$d,
|
|
4585
4762
|
slots: {}
|
|
4586
4763
|
},
|
|
@@ -4588,7 +4765,7 @@
|
|
|
4588
4765
|
$key: "layer",
|
|
4589
4766
|
type: "component",
|
|
4590
4767
|
icon: iconsVue.Files,
|
|
4591
|
-
text: "
|
|
4768
|
+
text: "已选组件",
|
|
4592
4769
|
props: {
|
|
4593
4770
|
layerContentMenu: props.layerContentMenu
|
|
4594
4771
|
},
|
|
@@ -4599,7 +4776,7 @@
|
|
|
4599
4776
|
$key: "code-block",
|
|
4600
4777
|
type: "component",
|
|
4601
4778
|
icon: iconsVue.EditPen,
|
|
4602
|
-
text: "
|
|
4779
|
+
text: "代码编辑",
|
|
4603
4780
|
component: _sfc_main$e,
|
|
4604
4781
|
slots: {}
|
|
4605
4782
|
}
|
|
@@ -4617,25 +4794,22 @@
|
|
|
4617
4794
|
activeTabName
|
|
4618
4795
|
});
|
|
4619
4796
|
return (_ctx, _cache) => {
|
|
4620
|
-
return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(
|
|
4797
|
+
return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabsComponent).component), vue.mergeProps({
|
|
4621
4798
|
key: 0,
|
|
4622
|
-
class: "m-editor-sidebar",
|
|
4623
4799
|
modelValue: activeTabName.value,
|
|
4624
4800
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
}, {
|
|
4801
|
+
class: "m-editor-sidebar tmagic-design-tabs"
|
|
4802
|
+
}, vue.unref(tabsComponent).props({ type: "card", tabPosition: "left" })), {
|
|
4628
4803
|
default: vue.withCtx(() => [
|
|
4629
4804
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(sideBarItems), (config, index) => {
|
|
4630
|
-
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(
|
|
4631
|
-
key: config.$key || index
|
|
4632
|
-
|
|
4633
|
-
}, {
|
|
4805
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabPaneComponent).component), vue.mergeProps(vue.unref(tabPaneComponent).props({ name: config.text }), {
|
|
4806
|
+
key: config.$key || index
|
|
4807
|
+
}), {
|
|
4634
4808
|
label: vue.withCtx(() => [
|
|
4635
4809
|
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4636
4810
|
key: config.text
|
|
4637
4811
|
}, [
|
|
4638
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4812
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
4639
4813
|
key: 0,
|
|
4640
4814
|
icon: config.icon
|
|
4641
4815
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -4710,11 +4884,11 @@
|
|
|
4710
4884
|
]), 1040)) : vue.createCommentVNode("", true)
|
|
4711
4885
|
]),
|
|
4712
4886
|
_: 2
|
|
4713
|
-
},
|
|
4887
|
+
}, 1040);
|
|
4714
4888
|
}), 128))
|
|
4715
4889
|
]),
|
|
4716
4890
|
_: 3
|
|
4717
|
-
},
|
|
4891
|
+
}, 16, ["modelValue"])) : vue.createCommentVNode("", true);
|
|
4718
4892
|
};
|
|
4719
4893
|
}
|
|
4720
4894
|
});
|
|
@@ -4837,7 +5011,7 @@
|
|
|
4837
5011
|
return;
|
|
4838
5012
|
const root = vue.toRaw(editorService.get("root"));
|
|
4839
5013
|
if (!root)
|
|
4840
|
-
throw new Error("root
|
|
5014
|
+
throw new Error("root 不能为空");
|
|
4841
5015
|
const pageConfig = {
|
|
4842
5016
|
type: schema.NodeType.PAGE,
|
|
4843
5017
|
name: generatePageNameByApp(root)
|
|
@@ -4856,14 +5030,14 @@
|
|
|
4856
5030
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4857
5031
|
onClick: addPage
|
|
4858
5032
|
}, [
|
|
4859
|
-
vue.createVNode(_sfc_main$
|
|
5033
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4860
5034
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4861
5035
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4862
5036
|
key: 2,
|
|
4863
5037
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4864
5038
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4865
5039
|
}, [
|
|
4866
|
-
vue.createVNode(_sfc_main$
|
|
5040
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4867
5041
|
])) : vue.createCommentVNode("", true),
|
|
4868
5042
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4869
5043
|
key: 3,
|
|
@@ -4879,7 +5053,7 @@
|
|
|
4879
5053
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4880
5054
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4881
5055
|
}, [
|
|
4882
|
-
vue.createVNode(_sfc_main$
|
|
5056
|
+
vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4883
5057
|
])) : vue.createCommentVNode("", true)
|
|
4884
5058
|
], 512);
|
|
4885
5059
|
};
|
|
@@ -4951,18 +5125,18 @@
|
|
|
4951
5125
|
default: vue.withCtx(() => [
|
|
4952
5126
|
vue.createElementVNode("div", null, [
|
|
4953
5127
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4954
|
-
vue.createVNode(_sfc_main$
|
|
5128
|
+
vue.createVNode(_sfc_main$n, {
|
|
4955
5129
|
data: {
|
|
4956
5130
|
type: "button",
|
|
4957
|
-
text: "
|
|
5131
|
+
text: "复制",
|
|
4958
5132
|
icon: vue.unref(iconsVue.DocumentCopy),
|
|
4959
5133
|
handler: () => copy(item)
|
|
4960
5134
|
}
|
|
4961
5135
|
}, null, 8, ["data"]),
|
|
4962
|
-
vue.createVNode(_sfc_main$
|
|
5136
|
+
vue.createVNode(_sfc_main$n, {
|
|
4963
5137
|
data: {
|
|
4964
5138
|
type: "button",
|
|
4965
|
-
text: "
|
|
5139
|
+
text: "删除",
|
|
4966
5140
|
icon: vue.unref(iconsVue.Delete),
|
|
4967
5141
|
handler: () => remove(item)
|
|
4968
5142
|
}
|
|
@@ -5136,7 +5310,7 @@
|
|
|
5136
5310
|
if (!thumb.value)
|
|
5137
5311
|
return;
|
|
5138
5312
|
const thumbEl = thumb.value;
|
|
5139
|
-
gesto = new
|
|
5313
|
+
gesto = new Gesto(thumbEl, {
|
|
5140
5314
|
container: window
|
|
5141
5315
|
});
|
|
5142
5316
|
gesto.on("dragStart", (e) => {
|
|
@@ -5327,7 +5501,7 @@
|
|
|
5327
5501
|
const menuData = vue.computed(() => [
|
|
5328
5502
|
{
|
|
5329
5503
|
type: "button",
|
|
5330
|
-
text: "
|
|
5504
|
+
text: "水平居中",
|
|
5331
5505
|
display: () => canCenter.value,
|
|
5332
5506
|
handler: () => {
|
|
5333
5507
|
if (!nodes.value)
|
|
@@ -5337,7 +5511,7 @@
|
|
|
5337
5511
|
},
|
|
5338
5512
|
{
|
|
5339
5513
|
type: "button",
|
|
5340
|
-
text: "
|
|
5514
|
+
text: "复制",
|
|
5341
5515
|
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
5342
5516
|
handler: () => {
|
|
5343
5517
|
nodes.value && editorService?.copy(nodes.value);
|
|
@@ -5346,7 +5520,7 @@
|
|
|
5346
5520
|
},
|
|
5347
5521
|
{
|
|
5348
5522
|
type: "button",
|
|
5349
|
-
text: "
|
|
5523
|
+
text: "粘贴",
|
|
5350
5524
|
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
5351
5525
|
display: () => canPaste.value,
|
|
5352
5526
|
handler: () => {
|
|
@@ -5370,7 +5544,7 @@
|
|
|
5370
5544
|
},
|
|
5371
5545
|
{
|
|
5372
5546
|
type: "button",
|
|
5373
|
-
text: "
|
|
5547
|
+
text: "上移一层",
|
|
5374
5548
|
icon: vue.markRaw(iconsVue.Top),
|
|
5375
5549
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5376
5550
|
handler: () => {
|
|
@@ -5379,7 +5553,7 @@
|
|
|
5379
5553
|
},
|
|
5380
5554
|
{
|
|
5381
5555
|
type: "button",
|
|
5382
|
-
text: "
|
|
5556
|
+
text: "下移一层",
|
|
5383
5557
|
icon: vue.markRaw(iconsVue.Bottom),
|
|
5384
5558
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5385
5559
|
handler: () => {
|
|
@@ -5388,7 +5562,7 @@
|
|
|
5388
5562
|
},
|
|
5389
5563
|
{
|
|
5390
5564
|
type: "button",
|
|
5391
|
-
text: "
|
|
5565
|
+
text: "置顶",
|
|
5392
5566
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5393
5567
|
handler: () => {
|
|
5394
5568
|
editorService?.moveLayer(LayerOffset.TOP);
|
|
@@ -5396,7 +5570,7 @@
|
|
|
5396
5570
|
},
|
|
5397
5571
|
{
|
|
5398
5572
|
type: "button",
|
|
5399
|
-
text: "
|
|
5573
|
+
text: "置底",
|
|
5400
5574
|
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
5401
5575
|
handler: () => {
|
|
5402
5576
|
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
@@ -5409,7 +5583,7 @@
|
|
|
5409
5583
|
},
|
|
5410
5584
|
{
|
|
5411
5585
|
type: "button",
|
|
5412
|
-
text: "
|
|
5586
|
+
text: "删除",
|
|
5413
5587
|
icon: iconsVue.Delete,
|
|
5414
5588
|
display: () => !utils.isPage(node.value),
|
|
5415
5589
|
handler: () => {
|
|
@@ -5422,7 +5596,7 @@
|
|
|
5422
5596
|
},
|
|
5423
5597
|
{
|
|
5424
5598
|
type: "button",
|
|
5425
|
-
text: "
|
|
5599
|
+
text: "清空参考线",
|
|
5426
5600
|
handler: () => {
|
|
5427
5601
|
editorService?.get("stage")?.clearGuides();
|
|
5428
5602
|
}
|
|
@@ -5648,7 +5822,7 @@
|
|
|
5648
5822
|
vue.onMounted(() => {
|
|
5649
5823
|
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
5650
5824
|
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
5651
|
-
keycon = new
|
|
5825
|
+
keycon = new KeyController(workspace.value);
|
|
5652
5826
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
5653
5827
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
5654
5828
|
keycon.keyup("delete", (e) => {
|
|
@@ -5782,14 +5956,30 @@
|
|
|
5782
5956
|
"deleteCodeDslByIds"
|
|
5783
5957
|
]);
|
|
5784
5958
|
}
|
|
5959
|
+
/**
|
|
5960
|
+
* 设置活动的代码块dsl数据源
|
|
5961
|
+
* @param {CodeBlockDSL} codeDsl 代码DSL
|
|
5962
|
+
* @returns {void}
|
|
5963
|
+
*/
|
|
5785
5964
|
async setCodeDsl(codeDsl2) {
|
|
5786
5965
|
this.state.codeDsl = codeDsl2;
|
|
5787
5966
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
5788
5967
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
5789
5968
|
}
|
|
5969
|
+
/**
|
|
5970
|
+
* 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
|
|
5971
|
+
* 方法要支持钩子添加扩展,会被重写为异步方法,因此这里显示写为异步以提醒调用者需以异步形式调用
|
|
5972
|
+
* @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新
|
|
5973
|
+
* @returns {CodeBlockDSL | null}
|
|
5974
|
+
*/
|
|
5790
5975
|
getCodeDsl() {
|
|
5791
5976
|
return this.state.codeDsl;
|
|
5792
5977
|
}
|
|
5978
|
+
/**
|
|
5979
|
+
* 根据代码块id获取代码块内容
|
|
5980
|
+
* @param {Id} id 代码块id
|
|
5981
|
+
* @returns {CodeBlockContent | null}
|
|
5982
|
+
*/
|
|
5793
5983
|
getCodeContentById(id2) {
|
|
5794
5984
|
if (!id2)
|
|
5795
5985
|
return null;
|
|
@@ -5798,10 +5988,16 @@
|
|
|
5798
5988
|
return null;
|
|
5799
5989
|
return totalCodeDsl[id2] ?? null;
|
|
5800
5990
|
}
|
|
5991
|
+
/**
|
|
5992
|
+
* 设置代码块ID和代码内容到源dsl
|
|
5993
|
+
* @param {Id} id 代码块id
|
|
5994
|
+
* @param {CodeBlockContent} codeConfig 代码块内容配置信息
|
|
5995
|
+
* @returns {void}
|
|
5996
|
+
*/
|
|
5801
5997
|
async setCodeDslById(id, codeConfig) {
|
|
5802
5998
|
const codeDsl = this.getCodeDsl();
|
|
5803
5999
|
if (!codeDsl) {
|
|
5804
|
-
throw new Error("dsl
|
|
6000
|
+
throw new Error("dsl中没有codeBlocks");
|
|
5805
6001
|
}
|
|
5806
6002
|
const codeConfigProcessed = codeConfig;
|
|
5807
6003
|
if (codeConfig.content) {
|
|
@@ -5814,60 +6010,133 @@
|
|
|
5814
6010
|
};
|
|
5815
6011
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
5816
6012
|
}
|
|
6013
|
+
/**
|
|
6014
|
+
* 根据代码块id数组获取代码dsl
|
|
6015
|
+
* @param {string[]} ids 代码块id数组
|
|
6016
|
+
* @returns {CodeBlockDSL}
|
|
6017
|
+
*/
|
|
5817
6018
|
getCodeDslByIds(ids) {
|
|
5818
6019
|
const codeDsl2 = this.getCodeDsl();
|
|
5819
6020
|
return lodashEs.pick(codeDsl2, ids);
|
|
5820
6021
|
}
|
|
6022
|
+
/**
|
|
6023
|
+
* 设置代码编辑面板展示状态
|
|
6024
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6025
|
+
* @returns {void}
|
|
6026
|
+
*/
|
|
5821
6027
|
async setCodeEditorShowStatus(status) {
|
|
5822
6028
|
this.state.isShowCodeEditor = status;
|
|
5823
6029
|
}
|
|
6030
|
+
/**
|
|
6031
|
+
* 获取代码编辑面板展示状态
|
|
6032
|
+
* @returns {boolean} 是否展示代码编辑面板
|
|
6033
|
+
*/
|
|
5824
6034
|
getCodeEditorShowStatus() {
|
|
5825
6035
|
return this.state.isShowCodeEditor;
|
|
5826
6036
|
}
|
|
6037
|
+
/**
|
|
6038
|
+
* 设置代码编辑面板展示状态及展示内容
|
|
6039
|
+
* @param {boolean} status 是否展示代码编辑面板
|
|
6040
|
+
* @param {Id} id 代码块id
|
|
6041
|
+
* @returns {void}
|
|
6042
|
+
*/
|
|
5827
6043
|
setCodeEditorContent(status, id2) {
|
|
5828
6044
|
if (!id2)
|
|
5829
6045
|
return;
|
|
5830
6046
|
this.setId(id2);
|
|
5831
6047
|
this.state.isShowCodeEditor = status;
|
|
5832
6048
|
}
|
|
6049
|
+
/**
|
|
6050
|
+
* 获取当前选中的代码块内容
|
|
6051
|
+
* @returns {CodeBlockContent | null}
|
|
6052
|
+
*/
|
|
5833
6053
|
getCurrentDsl() {
|
|
5834
6054
|
return this.getCodeContentById(this.state.id);
|
|
5835
6055
|
}
|
|
6056
|
+
/**
|
|
6057
|
+
* 获取编辑状态
|
|
6058
|
+
* @returns {boolean} 是否可编辑
|
|
6059
|
+
*/
|
|
5836
6060
|
getEditStatus() {
|
|
5837
6061
|
return this.state.editable;
|
|
5838
6062
|
}
|
|
6063
|
+
/**
|
|
6064
|
+
* 设置编辑状态
|
|
6065
|
+
* @param {boolean} status 是否可编辑
|
|
6066
|
+
* @returns {void}
|
|
6067
|
+
*/
|
|
5839
6068
|
async setEditStatus(status) {
|
|
5840
6069
|
this.state.editable = status;
|
|
5841
6070
|
}
|
|
6071
|
+
/**
|
|
6072
|
+
* 设置当前选中的代码块ID
|
|
6073
|
+
* @param {Id} id 代码块id
|
|
6074
|
+
* @returns {void}
|
|
6075
|
+
*/
|
|
5842
6076
|
setId(id2) {
|
|
5843
6077
|
if (!id2)
|
|
5844
6078
|
return;
|
|
5845
6079
|
this.state.id = id2;
|
|
5846
6080
|
}
|
|
6081
|
+
/**
|
|
6082
|
+
* 获取当前选中的代码块ID
|
|
6083
|
+
* @returns {Id} id 代码块id
|
|
6084
|
+
*/
|
|
5847
6085
|
getId() {
|
|
5848
6086
|
return this.state.id;
|
|
5849
6087
|
}
|
|
6088
|
+
/**
|
|
6089
|
+
* 设置当前选中组件已关联绑定的代码块id数组
|
|
6090
|
+
* @param {string[]} ids 代码块id数组
|
|
6091
|
+
* @returns {void}
|
|
6092
|
+
*/
|
|
5850
6093
|
async setCombineIds(ids) {
|
|
5851
6094
|
this.state.combineIds = ids;
|
|
5852
6095
|
}
|
|
6096
|
+
/**
|
|
6097
|
+
* 获取当前选中组件已关联绑定的代码块id数组
|
|
6098
|
+
* @returns {string[]}
|
|
6099
|
+
*/
|
|
5853
6100
|
getCombineIds() {
|
|
5854
6101
|
return this.state.combineIds;
|
|
5855
6102
|
}
|
|
6103
|
+
/**
|
|
6104
|
+
* 获取不可删除列表
|
|
6105
|
+
* @returns {Id[]}
|
|
6106
|
+
*/
|
|
5856
6107
|
getUndeletableList() {
|
|
5857
6108
|
return this.state.undeletableList;
|
|
5858
6109
|
}
|
|
6110
|
+
/**
|
|
6111
|
+
* 设置不可删除列表:为业务逻辑预留的不可删除的代码块列表,由业务逻辑维护(如代码块上线后不可删除)
|
|
6112
|
+
* @param {Id[]} codeIds 代码块id数组
|
|
6113
|
+
* @returns {void}
|
|
6114
|
+
*/
|
|
5859
6115
|
async setUndeleteableList(codeIds) {
|
|
5860
6116
|
this.state.undeletableList = codeIds;
|
|
5861
6117
|
}
|
|
6118
|
+
/**
|
|
6119
|
+
* 设置代码草稿
|
|
6120
|
+
*/
|
|
5862
6121
|
setCodeDraft(codeId, content) {
|
|
5863
6122
|
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
5864
6123
|
}
|
|
6124
|
+
/**
|
|
6125
|
+
* 获取代码草稿
|
|
6126
|
+
*/
|
|
5865
6127
|
getCodeDraft(codeId) {
|
|
5866
6128
|
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5867
6129
|
}
|
|
6130
|
+
/**
|
|
6131
|
+
* 删除代码草稿
|
|
6132
|
+
*/
|
|
5868
6133
|
removeCodeDraft(codeId) {
|
|
5869
6134
|
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
5870
6135
|
}
|
|
6136
|
+
/**
|
|
6137
|
+
* 在dsl数据源中删除指定id的代码块
|
|
6138
|
+
* @param {Id[]} codeIds 需要删除的代码块id数组
|
|
6139
|
+
*/
|
|
5871
6140
|
async deleteCodeDslByIds(codeIds) {
|
|
5872
6141
|
const currentDsl = await this.getCodeDsl();
|
|
5873
6142
|
if (!currentDsl)
|
|
@@ -5877,6 +6146,10 @@
|
|
|
5877
6146
|
this.emit("remove", id2);
|
|
5878
6147
|
});
|
|
5879
6148
|
}
|
|
6149
|
+
/**
|
|
6150
|
+
* 生成代码块唯一id
|
|
6151
|
+
* @returns {Id} 代码块唯一id
|
|
6152
|
+
*/
|
|
5880
6153
|
async getUniqueId() {
|
|
5881
6154
|
const newId = `code_${Math.random().toString(10).substring(2).substring(0, 4)}`;
|
|
5882
6155
|
const dsl = await this.getCodeDsl();
|
|
@@ -5908,6 +6181,9 @@
|
|
|
5908
6181
|
constructor() {
|
|
5909
6182
|
super([]);
|
|
5910
6183
|
}
|
|
6184
|
+
/**
|
|
6185
|
+
* @param componentGroupList 组件列表配置
|
|
6186
|
+
*/
|
|
5911
6187
|
setList(componentGroupList) {
|
|
5912
6188
|
this.state.list = componentGroupList;
|
|
5913
6189
|
}
|
|
@@ -5926,10 +6202,27 @@
|
|
|
5926
6202
|
const componentListService = new ComponentList();
|
|
5927
6203
|
|
|
5928
6204
|
class Target extends events.EventEmitter {
|
|
6205
|
+
/**
|
|
6206
|
+
* 如何识别目标
|
|
6207
|
+
*/
|
|
5929
6208
|
isTarget;
|
|
6209
|
+
/**
|
|
6210
|
+
* 目标id,不可重复
|
|
6211
|
+
* 例如目标是代码块,则为代码块id
|
|
6212
|
+
*/
|
|
5930
6213
|
id;
|
|
6214
|
+
/**
|
|
6215
|
+
* 目标名称,用于显示在依赖列表中
|
|
6216
|
+
*/
|
|
5931
6217
|
name;
|
|
6218
|
+
/**
|
|
6219
|
+
* 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type
|
|
6220
|
+
*/
|
|
5932
6221
|
type = "default";
|
|
6222
|
+
/**
|
|
6223
|
+
* 依赖详情
|
|
6224
|
+
* 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }
|
|
6225
|
+
*/
|
|
5933
6226
|
deps = vue.reactive({});
|
|
5934
6227
|
constructor(options) {
|
|
5935
6228
|
super();
|
|
@@ -5940,6 +6233,11 @@
|
|
|
5940
6233
|
this.type = options.type;
|
|
5941
6234
|
}
|
|
5942
6235
|
}
|
|
6236
|
+
/**
|
|
6237
|
+
* 更新依赖
|
|
6238
|
+
* @param node 节点配置
|
|
6239
|
+
* @param key 哪个key配置了这个目标的id
|
|
6240
|
+
*/
|
|
5943
6241
|
updateDep(node, key) {
|
|
5944
6242
|
const dep = this.deps[node.id] || {
|
|
5945
6243
|
name: node.name,
|
|
@@ -5954,6 +6252,12 @@
|
|
|
5954
6252
|
}
|
|
5955
6253
|
this.emit("change");
|
|
5956
6254
|
}
|
|
6255
|
+
/**
|
|
6256
|
+
* 删除依赖
|
|
6257
|
+
* @param node 哪个节点的依赖需要移除,如果为空,则移除所有依赖
|
|
6258
|
+
* @param key 节点下哪个key需要移除,如果为空,则移除改节点下的所有依赖key
|
|
6259
|
+
* @returns void
|
|
6260
|
+
*/
|
|
5957
6261
|
removeDep(node, key) {
|
|
5958
6262
|
if (!node) {
|
|
5959
6263
|
Object.keys(this.deps).forEach((depKey) => {
|
|
@@ -5976,6 +6280,12 @@
|
|
|
5976
6280
|
}
|
|
5977
6281
|
this.emit("change");
|
|
5978
6282
|
}
|
|
6283
|
+
/**
|
|
6284
|
+
* 判断指定节点下的指定key是否存在在依赖列表中
|
|
6285
|
+
* @param node 哪个节点
|
|
6286
|
+
* @param key 哪个key
|
|
6287
|
+
* @returns boolean
|
|
6288
|
+
*/
|
|
5979
6289
|
hasDep(node, key) {
|
|
5980
6290
|
const dep = this.deps[node.id];
|
|
5981
6291
|
return Boolean(dep?.keys.find((d) => d === key));
|
|
@@ -5986,15 +6296,29 @@
|
|
|
5986
6296
|
}
|
|
5987
6297
|
class Watcher extends events.EventEmitter {
|
|
5988
6298
|
targets = vue.reactive({});
|
|
6299
|
+
/**
|
|
6300
|
+
* 获取指定类型中的所有target
|
|
6301
|
+
* @param type 分类
|
|
6302
|
+
* @returns Target[]
|
|
6303
|
+
*/
|
|
5989
6304
|
getTargets(type = "default") {
|
|
5990
6305
|
return this.targets[type] || {};
|
|
5991
6306
|
}
|
|
6307
|
+
/**
|
|
6308
|
+
* 添加新的目标
|
|
6309
|
+
* @param target Target
|
|
6310
|
+
*/
|
|
5992
6311
|
addTarget(target) {
|
|
5993
6312
|
const targets = this.getTargets(target.type) || {};
|
|
5994
6313
|
this.targets[target.type] = targets;
|
|
5995
6314
|
targets[target.id] = target;
|
|
5996
6315
|
this.emit("add-target", target);
|
|
5997
6316
|
}
|
|
6317
|
+
/**
|
|
6318
|
+
* 获取指定id的target
|
|
6319
|
+
* @param id target id
|
|
6320
|
+
* @returns Target
|
|
6321
|
+
*/
|
|
5998
6322
|
getTarget(id) {
|
|
5999
6323
|
const allTargets = Object.values(this.targets);
|
|
6000
6324
|
for (const targets of allTargets) {
|
|
@@ -6003,6 +6327,11 @@
|
|
|
6003
6327
|
}
|
|
6004
6328
|
}
|
|
6005
6329
|
}
|
|
6330
|
+
/**
|
|
6331
|
+
* 判断是否存在指定id的target
|
|
6332
|
+
* @param id target id
|
|
6333
|
+
* @returns boolean
|
|
6334
|
+
*/
|
|
6006
6335
|
hasTarget(id) {
|
|
6007
6336
|
const allTargets = Object.values(this.targets);
|
|
6008
6337
|
for (const targets of allTargets) {
|
|
@@ -6012,6 +6341,10 @@
|
|
|
6012
6341
|
}
|
|
6013
6342
|
return false;
|
|
6014
6343
|
}
|
|
6344
|
+
/**
|
|
6345
|
+
* 删除指定id的target
|
|
6346
|
+
* @param id target id
|
|
6347
|
+
*/
|
|
6015
6348
|
removeTarget(id) {
|
|
6016
6349
|
const allTargets = Object.values(this.targets);
|
|
6017
6350
|
for (const targets of allTargets) {
|
|
@@ -6022,6 +6355,11 @@
|
|
|
6022
6355
|
}
|
|
6023
6356
|
this.emit("remove-target");
|
|
6024
6357
|
}
|
|
6358
|
+
/**
|
|
6359
|
+
* 删除指定分类的所有target
|
|
6360
|
+
* @param type 分类
|
|
6361
|
+
* @returns void
|
|
6362
|
+
*/
|
|
6025
6363
|
removeTargets(type = "default") {
|
|
6026
6364
|
const targets = this.targets[type];
|
|
6027
6365
|
if (!targets)
|
|
@@ -6032,11 +6370,19 @@
|
|
|
6032
6370
|
delete this.targets[type];
|
|
6033
6371
|
this.emit("remove-target");
|
|
6034
6372
|
}
|
|
6373
|
+
/**
|
|
6374
|
+
* 删除所有target
|
|
6375
|
+
*/
|
|
6035
6376
|
clearTargets() {
|
|
6036
6377
|
Object.keys(this.targets).forEach((key) => {
|
|
6037
6378
|
delete this.targets[key];
|
|
6038
6379
|
});
|
|
6039
6380
|
}
|
|
6381
|
+
/**
|
|
6382
|
+
* 收集依赖
|
|
6383
|
+
* @param nodes 需要收集的节点
|
|
6384
|
+
* @param deep 是否需要收集子节点
|
|
6385
|
+
*/
|
|
6040
6386
|
collect(nodes, deep = false) {
|
|
6041
6387
|
Object.values(this.targets).forEach((targets) => {
|
|
6042
6388
|
Object.values(targets).forEach((target) => {
|
|
@@ -6047,6 +6393,10 @@
|
|
|
6047
6393
|
});
|
|
6048
6394
|
});
|
|
6049
6395
|
}
|
|
6396
|
+
/**
|
|
6397
|
+
* 清除依赖
|
|
6398
|
+
* @param nodes 需要清除依赖的节点
|
|
6399
|
+
*/
|
|
6050
6400
|
clear(nodes) {
|
|
6051
6401
|
Object.values(this.targets).forEach((targets) => {
|
|
6052
6402
|
Object.values(targets).forEach((target) => {
|
|
@@ -6146,50 +6496,64 @@
|
|
|
6146
6496
|
const eventsService = new Events();
|
|
6147
6497
|
|
|
6148
6498
|
const editorProps = {
|
|
6499
|
+
/** 页面初始值 */
|
|
6149
6500
|
modelValue: {
|
|
6150
6501
|
type: Object,
|
|
6151
6502
|
default: () => ({}),
|
|
6152
6503
|
require: true
|
|
6153
6504
|
},
|
|
6505
|
+
/** 左侧面板中的组件列表 */
|
|
6154
6506
|
componentGroupList: {
|
|
6155
6507
|
type: Array,
|
|
6156
6508
|
default: () => []
|
|
6157
6509
|
},
|
|
6510
|
+
/** 左侧面板配置 */
|
|
6158
6511
|
sidebar: {
|
|
6159
6512
|
type: Object
|
|
6160
6513
|
},
|
|
6514
|
+
/** 顶部工具栏配置 */
|
|
6161
6515
|
menu: {
|
|
6162
6516
|
type: Object,
|
|
6163
6517
|
default: () => ({ left: [], right: [] })
|
|
6164
6518
|
},
|
|
6519
|
+
/** 组件树右键菜单 */
|
|
6165
6520
|
layerContentMenu: {
|
|
6166
6521
|
type: Array,
|
|
6167
6522
|
default: () => []
|
|
6168
6523
|
},
|
|
6524
|
+
/** 画布右键菜单 */
|
|
6169
6525
|
stageContentMenu: {
|
|
6170
6526
|
type: Array,
|
|
6171
6527
|
default: () => []
|
|
6172
6528
|
},
|
|
6529
|
+
/** 中间工作区域中画布渲染的内容 */
|
|
6173
6530
|
render: {
|
|
6174
6531
|
type: Function
|
|
6175
6532
|
},
|
|
6533
|
+
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
6176
6534
|
runtimeUrl: String,
|
|
6535
|
+
/** 选中时是否自动滚动到可视区域 */
|
|
6177
6536
|
autoScrollIntoView: Boolean,
|
|
6537
|
+
/** 组件的属性配置表单的dsl */
|
|
6178
6538
|
propsConfigs: {
|
|
6179
6539
|
type: Object,
|
|
6180
6540
|
default: () => ({})
|
|
6181
6541
|
},
|
|
6542
|
+
/** 添加组件时的默认值 */
|
|
6182
6543
|
propsValues: {
|
|
6183
6544
|
type: Object,
|
|
6184
6545
|
default: () => ({})
|
|
6185
6546
|
},
|
|
6547
|
+
/** 组件联动事件选项列表 */
|
|
6186
6548
|
eventMethodList: {
|
|
6187
6549
|
type: Object,
|
|
6188
6550
|
default: () => ({})
|
|
6189
6551
|
},
|
|
6552
|
+
/** 画布中组件选中框的移动范围 */
|
|
6190
6553
|
moveableOptions: {
|
|
6191
6554
|
type: [Object, Function]
|
|
6192
6555
|
},
|
|
6556
|
+
/** 编辑器初始化时默认选中的组件ID */
|
|
6193
6557
|
defaultSelected: {
|
|
6194
6558
|
type: [Number, String]
|
|
6195
6559
|
},
|
|
@@ -6393,11 +6757,11 @@
|
|
|
6393
6757
|
const _sfc_main = vue.defineComponent({
|
|
6394
6758
|
name: "m-editor",
|
|
6395
6759
|
components: {
|
|
6396
|
-
TMagicNavMenu: _sfc_main$
|
|
6760
|
+
TMagicNavMenu: _sfc_main$m,
|
|
6397
6761
|
Sidebar: _sfc_main$9,
|
|
6398
6762
|
Workspace: _sfc_main$1,
|
|
6399
|
-
PropsPanel: _sfc_main$
|
|
6400
|
-
Framework: _sfc_main$
|
|
6763
|
+
PropsPanel: _sfc_main$l,
|
|
6764
|
+
Framework: _sfc_main$o
|
|
6401
6765
|
},
|
|
6402
6766
|
props: editorProps,
|
|
6403
6767
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -6437,14 +6801,6 @@
|
|
|
6437
6801
|
}
|
|
6438
6802
|
});
|
|
6439
6803
|
|
|
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
6804
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6449
6805
|
const _component_TMagicNavMenu = vue.resolveComponent("TMagicNavMenu");
|
|
6450
6806
|
const _component_Sidebar = vue.resolveComponent("Sidebar");
|
|
@@ -6535,20 +6891,22 @@
|
|
|
6535
6891
|
|
|
6536
6892
|
const index$1 = '';
|
|
6537
6893
|
|
|
6538
|
-
const defaultInstallOpt = {
|
|
6894
|
+
const defaultInstallOpt = {
|
|
6895
|
+
// @todo, 自定义图片上传方法等编辑器依赖的外部选项
|
|
6896
|
+
};
|
|
6539
6897
|
const index = {
|
|
6540
6898
|
install: (app, opt) => {
|
|
6541
6899
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
6542
6900
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6543
6901
|
setConfig(option);
|
|
6544
6902
|
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$
|
|
6903
|
+
app.component("m-fields-ui-select", _sfc_main$t);
|
|
6904
|
+
app.component("m-fields-code-link", _sfc_main$y);
|
|
6905
|
+
app.component("m-fields-vs-code", _sfc_main$z);
|
|
6906
|
+
app.component("magic-code-editor", _sfc_main$s);
|
|
6907
|
+
app.component("m-fields-code-select", _sfc_main$x);
|
|
6908
|
+
app.component("m-fields-code-select-col", _sfc_main$v);
|
|
6909
|
+
app.component("m-fields-event-select", _sfc_main$u);
|
|
6552
6910
|
}
|
|
6553
6911
|
};
|
|
6554
6912
|
|
|
@@ -6556,24 +6914,24 @@
|
|
|
6556
6914
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
6557
6915
|
exports.CodeBlockList = _sfc_main$e;
|
|
6558
6916
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
6559
|
-
exports.CodeSelect = _sfc_main$
|
|
6560
|
-
exports.CodeSelectCol = _sfc_main$
|
|
6917
|
+
exports.CodeSelect = _sfc_main$x;
|
|
6918
|
+
exports.CodeSelectCol = _sfc_main$v;
|
|
6561
6919
|
exports.ColumnLayout = ColumnLayout;
|
|
6562
6920
|
exports.ComponentListPanel = _sfc_main$d;
|
|
6563
6921
|
exports.ContentMenu = _sfc_main$c;
|
|
6564
|
-
exports.EventSelect = _sfc_main$
|
|
6922
|
+
exports.EventSelect = _sfc_main$u;
|
|
6565
6923
|
exports.Fixed2Other = Fixed2Other;
|
|
6566
6924
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
6567
|
-
exports.Icon = _sfc_main$
|
|
6925
|
+
exports.Icon = _sfc_main$w;
|
|
6568
6926
|
exports.Keys = Keys;
|
|
6569
6927
|
exports.LayerOffset = LayerOffset;
|
|
6570
6928
|
exports.LayerPanel = _sfc_main$a;
|
|
6571
6929
|
exports.Layout = Layout;
|
|
6572
|
-
exports.LayoutContainer = _sfc_main$
|
|
6573
|
-
exports.PropsPanel = _sfc_main$
|
|
6574
|
-
exports.TMagicCodeEditor = _sfc_main$
|
|
6930
|
+
exports.LayoutContainer = _sfc_main$q;
|
|
6931
|
+
exports.PropsPanel = _sfc_main$l;
|
|
6932
|
+
exports.TMagicCodeEditor = _sfc_main$s;
|
|
6575
6933
|
exports.TMagicEditor = Editor;
|
|
6576
|
-
exports.ToolButton = _sfc_main$
|
|
6934
|
+
exports.ToolButton = _sfc_main$n;
|
|
6577
6935
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
6578
6936
|
exports.beforePaste = beforePaste;
|
|
6579
6937
|
exports.change2Fixed = change2Fixed;
|