@tmagic/editor 1.2.0-beta.11 → 1.2.0-beta.13
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 +14 -17
- package/dist/tmagic-editor.mjs +709 -562
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +715 -567
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/Editor.vue +1 -0
- package/src/components/CodeDraftEditor.vue +130 -0
- package/src/components/FunctionEditor.vue +144 -0
- package/src/fields/CodeSelect.vue +80 -101
- package/src/layouts/CodeEditor.vue +1 -2
- package/src/layouts/sidebar/LayerPanel.vue +99 -86
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +23 -79
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +37 -71
- package/src/services/codeBlock.ts +111 -120
- package/src/services/editor.ts +19 -5
- package/src/theme/code-block.scss +14 -17
- package/src/type.ts +36 -38
- package/src/utils/editor.ts +9 -1
- package/src/utils/props.ts +2 -2
- package/types/components/CodeDraftEditor.vue.d.ts +148 -0
- package/types/components/FunctionEditor.vue.d.ts +120 -0
- package/types/fields/CodeSelect.vue.d.ts +9 -9
- package/types/layouts/CodeEditor.vue.d.ts +5 -12
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +1 -1
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +6 -5
- package/types/services/codeBlock.d.ts +55 -35
- package/types/services/editor.d.ts +1 -0
- package/types/services/props.d.ts +1 -1
- package/types/type.d.ts +32 -35
- package/types/utils/editor.d.ts +1 -0
- package/types/utils/props.d.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.
|
|
5
|
-
})(this, (function (exports, vue, serialize, lodashEs,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/design'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/design', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/utils', 'events', '@tmagic/core', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.schema, global.iconsVue, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, serialize, lodashEs, schema, iconsVue, design, monaco, StageCore, Gesto, utils, events, core, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
|
8
8
|
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
|
|
31
31
|
const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
|
|
32
32
|
|
|
33
|
-
const __default__$
|
|
33
|
+
const __default__$t = vue.defineComponent({
|
|
34
34
|
name: "MEditorCode"
|
|
35
35
|
});
|
|
36
|
-
const _sfc_main$
|
|
37
|
-
...__default__$
|
|
36
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
37
|
+
...__default__$t,
|
|
38
38
|
props: {
|
|
39
39
|
model: null,
|
|
40
40
|
name: null,
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
const __default__$
|
|
66
|
+
const __default__$s = vue.defineComponent({
|
|
67
67
|
name: "MEditorCodeLink"
|
|
68
68
|
});
|
|
69
|
-
const _sfc_main$
|
|
70
|
-
...__default__$
|
|
69
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
70
|
+
...__default__$s,
|
|
71
71
|
props: {
|
|
72
72
|
config: null,
|
|
73
73
|
model: null,
|
|
@@ -136,60 +136,12 @@
|
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
ColumnLayout2["CENTER"] = "center";
|
|
142
|
-
ColumnLayout2["RIGHT"] = "right";
|
|
143
|
-
return ColumnLayout2;
|
|
144
|
-
})(ColumnLayout || {});
|
|
145
|
-
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
146
|
-
LayerOffset2["TOP"] = "top";
|
|
147
|
-
LayerOffset2["BOTTOM"] = "bottom";
|
|
148
|
-
return LayerOffset2;
|
|
149
|
-
})(LayerOffset || {});
|
|
150
|
-
var Layout = /* @__PURE__ */ ((Layout2) => {
|
|
151
|
-
Layout2["FLEX"] = "flex";
|
|
152
|
-
Layout2["FIXED"] = "fixed";
|
|
153
|
-
Layout2["RELATIVE"] = "relative";
|
|
154
|
-
Layout2["ABSOLUTE"] = "absolute";
|
|
155
|
-
return Layout2;
|
|
156
|
-
})(Layout || {});
|
|
157
|
-
var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
158
|
-
Keys2["ESCAPE"] = "Space";
|
|
159
|
-
return Keys2;
|
|
160
|
-
})(Keys || {});
|
|
161
|
-
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
162
|
-
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
163
|
-
var CodeEditorMode = /* @__PURE__ */ ((CodeEditorMode2) => {
|
|
164
|
-
CodeEditorMode2["LIST"] = "list";
|
|
165
|
-
CodeEditorMode2["EDITOR"] = "editor";
|
|
166
|
-
return CodeEditorMode2;
|
|
167
|
-
})(CodeEditorMode || {});
|
|
168
|
-
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
169
|
-
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
170
|
-
CodeDeleteErrorType2["BIND"] = "bind";
|
|
171
|
-
return CodeDeleteErrorType2;
|
|
172
|
-
})(CodeDeleteErrorType || {});
|
|
173
|
-
var CodeSelectOp = /* @__PURE__ */ ((CodeSelectOp2) => {
|
|
174
|
-
CodeSelectOp2["ADD"] = "add";
|
|
175
|
-
CodeSelectOp2["DELETE"] = "delete";
|
|
176
|
-
CodeSelectOp2["CHANGE"] = "change";
|
|
177
|
-
return CodeSelectOp2;
|
|
178
|
-
})(CodeSelectOp || {});
|
|
179
|
-
|
|
180
|
-
const _hoisted_1$e = { class: "tool-bar" };
|
|
181
|
-
const _hoisted_2$6 = /* @__PURE__ */ vue.createElementVNode("path", {
|
|
182
|
-
fill: "currentColor",
|
|
183
|
-
d: "m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414L23 12zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414L3.828 12z"
|
|
184
|
-
}, null, -1);
|
|
185
|
-
const _hoisted_3$3 = [
|
|
186
|
-
_hoisted_2$6
|
|
187
|
-
];
|
|
188
|
-
const __default__$p = vue.defineComponent({
|
|
139
|
+
const _hoisted_1$g = { class: "m-fields-code-select" };
|
|
140
|
+
const __default__$r = vue.defineComponent({
|
|
189
141
|
name: "MEditorCodeSelect"
|
|
190
142
|
});
|
|
191
|
-
const _sfc_main$
|
|
192
|
-
...__default__$
|
|
143
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
144
|
+
...__default__$r,
|
|
193
145
|
props: {
|
|
194
146
|
config: null,
|
|
195
147
|
model: null,
|
|
@@ -201,122 +153,98 @@
|
|
|
201
153
|
setup(__props, { emit }) {
|
|
202
154
|
const props = __props;
|
|
203
155
|
const services = vue.inject("services");
|
|
204
|
-
const
|
|
205
|
-
const
|
|
156
|
+
const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDslSync());
|
|
157
|
+
const tableConfig = vue.computed(() => {
|
|
206
158
|
const defaultConfig = {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
159
|
+
dropSort: true,
|
|
160
|
+
enableFullscreen: false,
|
|
161
|
+
border: true,
|
|
162
|
+
items: [
|
|
163
|
+
{
|
|
164
|
+
type: "select",
|
|
165
|
+
label: "\u4EE3\u7801\u5757",
|
|
166
|
+
name: "codeId",
|
|
167
|
+
width: "200px",
|
|
168
|
+
options: () => {
|
|
169
|
+
if (codeDsl.value) {
|
|
170
|
+
return lodashEs.map(codeDsl.value, (value, key) => ({
|
|
171
|
+
text: `${value.name}\uFF08${key}\uFF09`,
|
|
172
|
+
label: `${value.name}\uFF08${key}\uFF09`,
|
|
173
|
+
value: key
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
return [];
|
|
177
|
+
},
|
|
178
|
+
onChange: (formState, codeId, { model }) => {
|
|
179
|
+
model.params = {};
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "params",
|
|
184
|
+
label: "\u53C2\u6570",
|
|
185
|
+
defaultValue: {},
|
|
186
|
+
itemsFunction: (row) => getParamsConfig(row.codeId)
|
|
216
187
|
}
|
|
217
|
-
|
|
218
|
-
}
|
|
188
|
+
]
|
|
219
189
|
};
|
|
220
190
|
return {
|
|
221
191
|
...defaultConfig,
|
|
222
|
-
...props.config.
|
|
192
|
+
...props.config.tableConfig
|
|
223
193
|
};
|
|
224
194
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
fieldKey.value = combineNames.join("-");
|
|
238
|
-
});
|
|
239
|
-
const changeHandler = async (value) => {
|
|
240
|
-
let codeIds = value;
|
|
241
|
-
if (typeof value === "string") {
|
|
242
|
-
multiple.value = false;
|
|
243
|
-
codeIds = value ? [value] : [];
|
|
244
|
-
}
|
|
245
|
-
await setCombineRelation(codeIds);
|
|
246
|
-
emit("change", value);
|
|
247
|
-
};
|
|
248
|
-
const setCombineRelation = async (codeIds) => {
|
|
249
|
-
const { id = "" } = services?.editorService.get("node") || {};
|
|
250
|
-
let opFlag = CodeSelectOp.CHANGE;
|
|
251
|
-
let diffValues = codeIds;
|
|
252
|
-
if (multiple.value) {
|
|
253
|
-
lastTagSnapshot.value = form?.initValues[props.name] || [];
|
|
254
|
-
opFlag = codeIds.length < lastTagSnapshot.value.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
|
|
255
|
-
diffValues = lodashEs.xor(codeIds, lastTagSnapshot.value);
|
|
195
|
+
vue.watch(
|
|
196
|
+
() => props.model[props.name],
|
|
197
|
+
(value) => {
|
|
198
|
+
if (lodashEs.isEmpty(value)) {
|
|
199
|
+
props.model[props.name] = {
|
|
200
|
+
hookType: schema.HookType.CODE,
|
|
201
|
+
hookData: []
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
immediate: true
|
|
256
207
|
}
|
|
257
|
-
|
|
208
|
+
);
|
|
209
|
+
const changeHandler = async () => {
|
|
210
|
+
emit("change", props.model[props.name]);
|
|
258
211
|
};
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
212
|
+
const getParamsConfig = (codeId) => {
|
|
213
|
+
if (!codeDsl.value)
|
|
214
|
+
return [];
|
|
215
|
+
const paramStatements = codeDsl.value[codeId]?.params;
|
|
216
|
+
if (lodashEs.isEmpty(paramStatements))
|
|
217
|
+
return [];
|
|
218
|
+
return paramStatements.map((paramState) => ({
|
|
219
|
+
name: paramState.name,
|
|
220
|
+
text: paramState.name,
|
|
221
|
+
labelWidth: "100px",
|
|
222
|
+
type: "text"
|
|
223
|
+
}));
|
|
267
224
|
};
|
|
268
225
|
return (_ctx, _cache) => {
|
|
269
|
-
const
|
|
270
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
name: __props.name,
|
|
281
|
-
size: __props.size,
|
|
282
|
-
onChange: changeHandler
|
|
283
|
-
}, null, 8, ["config", "model", "prop", "name", "size"])
|
|
284
|
-
]),
|
|
285
|
-
default: vue.withCtx(() => [
|
|
286
|
-
vue.createElementVNode("div", _hoisted_1$e, [
|
|
287
|
-
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
288
|
-
class: "tool-item",
|
|
289
|
-
effect: "dark",
|
|
290
|
-
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
291
|
-
placement: "top"
|
|
292
|
-
}, {
|
|
293
|
-
default: vue.withCtx(() => [
|
|
294
|
-
(vue.openBlock(), vue.createElementBlock("svg", {
|
|
295
|
-
onClick: viewHandler,
|
|
296
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
297
|
-
viewBox: "0 0 24 24",
|
|
298
|
-
width: "15px",
|
|
299
|
-
height: "15px",
|
|
300
|
-
"data-v-65a7fb6c": ""
|
|
301
|
-
}, _hoisted_3$3))
|
|
302
|
-
]),
|
|
303
|
-
_: 1
|
|
304
|
-
})
|
|
305
|
-
])
|
|
306
|
-
]),
|
|
307
|
-
_: 1
|
|
308
|
-
})
|
|
226
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
227
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
228
|
+
vue.createVNode(_component_m_form_table, {
|
|
229
|
+
config: vue.unref(tableConfig),
|
|
230
|
+
model: __props.model[__props.name],
|
|
231
|
+
name: "hookData",
|
|
232
|
+
enableToggleMode: false,
|
|
233
|
+
prop: __props.prop,
|
|
234
|
+
size: __props.size,
|
|
235
|
+
onChange: changeHandler
|
|
236
|
+
}, null, 8, ["config", "model", "prop", "size"])
|
|
309
237
|
]);
|
|
310
238
|
};
|
|
311
239
|
}
|
|
312
240
|
});
|
|
313
241
|
|
|
314
|
-
const _hoisted_1$
|
|
315
|
-
const __default__$
|
|
242
|
+
const _hoisted_1$f = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
243
|
+
const __default__$q = vue.defineComponent({
|
|
316
244
|
name: "MEditorUISelect"
|
|
317
245
|
});
|
|
318
|
-
const _sfc_main$
|
|
319
|
-
...__default__$
|
|
246
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
247
|
+
...__default__$q,
|
|
320
248
|
props: {
|
|
321
249
|
config: null,
|
|
322
250
|
model: null,
|
|
@@ -378,7 +306,7 @@
|
|
|
378
306
|
style: { "padding": "0" }
|
|
379
307
|
}, {
|
|
380
308
|
default: vue.withCtx(() => [
|
|
381
|
-
_hoisted_1$
|
|
309
|
+
_hoisted_1$f
|
|
382
310
|
]),
|
|
383
311
|
_: 1
|
|
384
312
|
}, 8, ["icon"])
|
|
@@ -426,15 +354,15 @@
|
|
|
426
354
|
|
|
427
355
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
428
356
|
|
|
429
|
-
const __default__$
|
|
357
|
+
const __default__$p = vue.defineComponent({
|
|
430
358
|
name: "MEditorCodeEditor"
|
|
431
359
|
});
|
|
432
|
-
const _sfc_main$
|
|
433
|
-
...__default__$
|
|
360
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
361
|
+
...__default__$p,
|
|
434
362
|
props: {
|
|
435
363
|
initValues: null,
|
|
436
364
|
modifiedValues: null,
|
|
437
|
-
type:
|
|
365
|
+
type: null,
|
|
438
366
|
language: { default: "javascript" },
|
|
439
367
|
options: { default: () => ({
|
|
440
368
|
tabSize: 2
|
|
@@ -559,11 +487,11 @@
|
|
|
559
487
|
};
|
|
560
488
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
561
489
|
|
|
562
|
-
const __default__$
|
|
490
|
+
const __default__$o = vue.defineComponent({
|
|
563
491
|
name: "MEditorResizer"
|
|
564
492
|
});
|
|
565
|
-
const _sfc_main$
|
|
566
|
-
...__default__$
|
|
493
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
494
|
+
...__default__$o,
|
|
567
495
|
emits: ["change"],
|
|
568
496
|
setup(__props, { emit }) {
|
|
569
497
|
const target = vue.ref();
|
|
@@ -595,11 +523,11 @@
|
|
|
595
523
|
}
|
|
596
524
|
});
|
|
597
525
|
|
|
598
|
-
const __default__$
|
|
526
|
+
const __default__$n = vue.defineComponent({
|
|
599
527
|
name: "MEditorLayout"
|
|
600
528
|
});
|
|
601
|
-
const _sfc_main$
|
|
602
|
-
...__default__$
|
|
529
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
530
|
+
...__default__$n,
|
|
603
531
|
props: {
|
|
604
532
|
left: null,
|
|
605
533
|
right: null,
|
|
@@ -677,7 +605,7 @@
|
|
|
677
605
|
}, [
|
|
678
606
|
vue.renderSlot(_ctx.$slots, "left")
|
|
679
607
|
], 6),
|
|
680
|
-
vue.createVNode(_sfc_main$
|
|
608
|
+
vue.createVNode(_sfc_main$p, { onChange: changeLeft })
|
|
681
609
|
], 64)) : vue.createCommentVNode("", true),
|
|
682
610
|
vue.createElementVNode("div", {
|
|
683
611
|
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -686,7 +614,7 @@
|
|
|
686
614
|
vue.renderSlot(_ctx.$slots, "center")
|
|
687
615
|
], 6),
|
|
688
616
|
typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
689
|
-
vue.createVNode(_sfc_main$
|
|
617
|
+
vue.createVNode(_sfc_main$p, { onChange: changeRight }),
|
|
690
618
|
vue.createElementVNode("div", {
|
|
691
619
|
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
692
620
|
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -699,12 +627,12 @@
|
|
|
699
627
|
}
|
|
700
628
|
});
|
|
701
629
|
|
|
702
|
-
const _hoisted_1$
|
|
703
|
-
const __default__$
|
|
630
|
+
const _hoisted_1$e = ["src"];
|
|
631
|
+
const __default__$m = vue.defineComponent({
|
|
704
632
|
name: "MEditorIcon"
|
|
705
633
|
});
|
|
706
|
-
const _sfc_main$
|
|
707
|
-
...__default__$
|
|
634
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
635
|
+
...__default__$m,
|
|
708
636
|
props: {
|
|
709
637
|
icon: null
|
|
710
638
|
},
|
|
@@ -723,7 +651,7 @@
|
|
|
723
651
|
class: "magic-editor-icon"
|
|
724
652
|
}, {
|
|
725
653
|
default: vue.withCtx(() => [
|
|
726
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
654
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$e)
|
|
727
655
|
]),
|
|
728
656
|
_: 1
|
|
729
657
|
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -742,6 +670,42 @@
|
|
|
742
670
|
}
|
|
743
671
|
});
|
|
744
672
|
|
|
673
|
+
var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
674
|
+
ColumnLayout2["LEFT"] = "left";
|
|
675
|
+
ColumnLayout2["CENTER"] = "center";
|
|
676
|
+
ColumnLayout2["RIGHT"] = "right";
|
|
677
|
+
return ColumnLayout2;
|
|
678
|
+
})(ColumnLayout || {});
|
|
679
|
+
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
680
|
+
LayerOffset2["TOP"] = "top";
|
|
681
|
+
LayerOffset2["BOTTOM"] = "bottom";
|
|
682
|
+
return LayerOffset2;
|
|
683
|
+
})(LayerOffset || {});
|
|
684
|
+
var Layout = /* @__PURE__ */ ((Layout2) => {
|
|
685
|
+
Layout2["FLEX"] = "flex";
|
|
686
|
+
Layout2["FIXED"] = "fixed";
|
|
687
|
+
Layout2["RELATIVE"] = "relative";
|
|
688
|
+
Layout2["ABSOLUTE"] = "absolute";
|
|
689
|
+
return Layout2;
|
|
690
|
+
})(Layout || {});
|
|
691
|
+
var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
692
|
+
Keys2["ESCAPE"] = "Space";
|
|
693
|
+
return Keys2;
|
|
694
|
+
})(Keys || {});
|
|
695
|
+
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
696
|
+
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
697
|
+
var CodeEditorMode = /* @__PURE__ */ ((CodeEditorMode2) => {
|
|
698
|
+
CodeEditorMode2["LIST"] = "list";
|
|
699
|
+
CodeEditorMode2["EDITOR"] = "editor";
|
|
700
|
+
return CodeEditorMode2;
|
|
701
|
+
})(CodeEditorMode || {});
|
|
702
|
+
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
703
|
+
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
704
|
+
CodeDeleteErrorType2["BIND"] = "bind";
|
|
705
|
+
return CodeDeleteErrorType2;
|
|
706
|
+
})(CodeDeleteErrorType || {});
|
|
707
|
+
const CODE_DRAFT_STORAGE_KEY = "magicCodeDraft";
|
|
708
|
+
|
|
745
709
|
const log = (...args) => {
|
|
746
710
|
if (process.env.NODE_ENV === "development") {
|
|
747
711
|
console.log("magic editor: ", ...args);
|
|
@@ -890,7 +854,8 @@
|
|
|
890
854
|
editable: true,
|
|
891
855
|
mode: CodeEditorMode.EDITOR,
|
|
892
856
|
combineIds: [],
|
|
893
|
-
undeletableList: []
|
|
857
|
+
undeletableList: [],
|
|
858
|
+
relations: {}
|
|
894
859
|
});
|
|
895
860
|
constructor() {
|
|
896
861
|
super([
|
|
@@ -908,31 +873,37 @@
|
|
|
908
873
|
"deleteCodeDslByIds"
|
|
909
874
|
]);
|
|
910
875
|
}
|
|
911
|
-
async setCodeDsl(
|
|
912
|
-
this.state.codeDsl =
|
|
876
|
+
async setCodeDsl(codeDsl2) {
|
|
877
|
+
this.state.codeDsl = codeDsl2;
|
|
913
878
|
await editorService.setCodeDsl(this.state.codeDsl);
|
|
914
879
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
915
880
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
916
881
|
}
|
|
917
882
|
async getCodeDsl(forceRefresh = false) {
|
|
883
|
+
return this.getCodeDslSync(forceRefresh);
|
|
884
|
+
}
|
|
885
|
+
getCodeDslSync(forceRefresh = false) {
|
|
918
886
|
if (!this.state.codeDsl || forceRefresh) {
|
|
919
|
-
this.state.codeDsl =
|
|
887
|
+
this.state.codeDsl = editorService.getCodeDslSync();
|
|
920
888
|
}
|
|
921
889
|
return this.state.codeDsl;
|
|
922
890
|
}
|
|
923
|
-
async getCodeContentById(
|
|
924
|
-
if (!
|
|
891
|
+
async getCodeContentById(id2) {
|
|
892
|
+
if (!id2)
|
|
925
893
|
return null;
|
|
926
894
|
const totalCodeDsl = await this.getCodeDsl();
|
|
927
895
|
if (!totalCodeDsl)
|
|
928
896
|
return null;
|
|
929
|
-
return totalCodeDsl[
|
|
897
|
+
return totalCodeDsl[id2] ?? null;
|
|
930
898
|
}
|
|
931
899
|
async setCodeDslById(id, codeConfig) {
|
|
932
900
|
let codeDsl = await this.getCodeDsl();
|
|
933
901
|
if (!codeDsl) {
|
|
934
902
|
codeDsl = {
|
|
935
|
-
[id]:
|
|
903
|
+
[id]: {
|
|
904
|
+
...codeConfig,
|
|
905
|
+
content: eval(codeConfig.content)
|
|
906
|
+
}
|
|
936
907
|
};
|
|
937
908
|
} else {
|
|
938
909
|
const existContent = codeDsl[id] || {};
|
|
@@ -940,15 +911,16 @@
|
|
|
940
911
|
...codeDsl,
|
|
941
912
|
[id]: {
|
|
942
913
|
...existContent,
|
|
943
|
-
...codeConfig
|
|
914
|
+
...codeConfig,
|
|
915
|
+
content: eval(codeConfig.content)
|
|
944
916
|
}
|
|
945
917
|
};
|
|
946
918
|
}
|
|
947
919
|
await this.setCodeDsl(codeDsl);
|
|
948
920
|
}
|
|
949
921
|
async getCodeDslByIds(ids) {
|
|
950
|
-
const
|
|
951
|
-
return lodashEs.pick(
|
|
922
|
+
const codeDsl2 = await this.getCodeDsl();
|
|
923
|
+
return lodashEs.pick(codeDsl2, ids);
|
|
952
924
|
}
|
|
953
925
|
async setCodeEditorShowStatus(status) {
|
|
954
926
|
this.state.isShowCodeEditor = status;
|
|
@@ -956,10 +928,10 @@
|
|
|
956
928
|
getCodeEditorShowStatus() {
|
|
957
929
|
return this.state.isShowCodeEditor;
|
|
958
930
|
}
|
|
959
|
-
setCodeEditorContent(status,
|
|
960
|
-
if (!
|
|
931
|
+
setCodeEditorContent(status, id2) {
|
|
932
|
+
if (!id2)
|
|
961
933
|
return;
|
|
962
|
-
this.setId(
|
|
934
|
+
this.setId(id2);
|
|
963
935
|
this.state.isShowCodeEditor = status;
|
|
964
936
|
}
|
|
965
937
|
async getCurrentDsl() {
|
|
@@ -971,10 +943,10 @@
|
|
|
971
943
|
async setEditStatus(status) {
|
|
972
944
|
this.state.editable = status;
|
|
973
945
|
}
|
|
974
|
-
setId(
|
|
975
|
-
if (!
|
|
946
|
+
setId(id2) {
|
|
947
|
+
if (!id2)
|
|
976
948
|
return;
|
|
977
|
-
this.state.id =
|
|
949
|
+
this.state.id = id2;
|
|
978
950
|
}
|
|
979
951
|
getId() {
|
|
980
952
|
return this.state.id;
|
|
@@ -991,61 +963,17 @@
|
|
|
991
963
|
getCombineIds() {
|
|
992
964
|
return this.state.combineIds;
|
|
993
965
|
}
|
|
994
|
-
|
|
995
|
-
const
|
|
996
|
-
if (!
|
|
997
|
-
return;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
}
|
|
1006
|
-
});
|
|
1007
|
-
} catch (e) {
|
|
1008
|
-
error(e);
|
|
1009
|
-
throw new Error("\u89E3\u7ED1\u4EE3\u7801\u5757\u5931\u8D25");
|
|
1010
|
-
}
|
|
1011
|
-
} else if (opFlag === CodeSelectOp.ADD) {
|
|
1012
|
-
try {
|
|
1013
|
-
diffCodeIds.forEach((codeId) => {
|
|
1014
|
-
const compsContent = codeDsl[codeId].comps;
|
|
1015
|
-
const existHooks = compsContent?.[compId];
|
|
1016
|
-
if (lodashEs.isEmpty(existHooks)) {
|
|
1017
|
-
codeDsl[codeId].comps = {
|
|
1018
|
-
...codeDsl[codeId].comps || {},
|
|
1019
|
-
[compId]: [hook]
|
|
1020
|
-
};
|
|
1021
|
-
} else {
|
|
1022
|
-
existHooks?.push(hook);
|
|
1023
|
-
}
|
|
1024
|
-
});
|
|
1025
|
-
} catch (e) {
|
|
1026
|
-
error(e);
|
|
1027
|
-
throw new Error("\u7ED1\u5B9A\u4EE3\u7801\u5757\u5931\u8D25");
|
|
1028
|
-
}
|
|
1029
|
-
} else if (opFlag === CodeSelectOp.CHANGE) {
|
|
1030
|
-
lodashEs.forIn(codeDsl, (codeBlockContent, codeId) => {
|
|
1031
|
-
if (codeId === diffCodeIds[0]) {
|
|
1032
|
-
codeBlockContent.comps = {
|
|
1033
|
-
...codeBlockContent?.comps || {},
|
|
1034
|
-
[compId]: [hook]
|
|
1035
|
-
};
|
|
1036
|
-
} else if (lodashEs.isEmpty(diffCodeIds) || codeId !== diffCodeIds[0]) {
|
|
1037
|
-
const compHooks = codeBlockContent?.comps?.[compId];
|
|
1038
|
-
if (!compHooks)
|
|
1039
|
-
return true;
|
|
1040
|
-
const index = compHooks.findIndex((hookName) => hookName === hook);
|
|
1041
|
-
if (index !== -1) {
|
|
1042
|
-
compHooks.splice(index, 1);
|
|
1043
|
-
return false;
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
this.setCodeDsl(codeDsl);
|
|
966
|
+
refreshCombineInfo() {
|
|
967
|
+
const root = editorService.get("root");
|
|
968
|
+
if (!root)
|
|
969
|
+
return null;
|
|
970
|
+
const relations = {};
|
|
971
|
+
this.recurseMNode(root, relations);
|
|
972
|
+
this.state.relations = relations;
|
|
973
|
+
return this.state.relations;
|
|
974
|
+
}
|
|
975
|
+
getCombineInfo() {
|
|
976
|
+
return this.state.relations;
|
|
1049
977
|
}
|
|
1050
978
|
getUndeletableList() {
|
|
1051
979
|
return this.state.undeletableList;
|
|
@@ -1053,6 +981,15 @@
|
|
|
1053
981
|
async setUndeleteableList(codeIds) {
|
|
1054
982
|
this.state.undeletableList = codeIds;
|
|
1055
983
|
}
|
|
984
|
+
setCodeDraft(codeId, content) {
|
|
985
|
+
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
986
|
+
}
|
|
987
|
+
getCodeDraft(codeId) {
|
|
988
|
+
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
989
|
+
}
|
|
990
|
+
removeCodeDraft(codeId) {
|
|
991
|
+
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
992
|
+
}
|
|
1056
993
|
async deleteCodeDslByIds(codeIds) {
|
|
1057
994
|
const currentDsl = await this.getCodeDsl();
|
|
1058
995
|
const newDsl = lodashEs.omit(currentDsl, codeIds);
|
|
@@ -1068,11 +1005,11 @@
|
|
|
1068
1005
|
return await this.getUniqueId();
|
|
1069
1006
|
}
|
|
1070
1007
|
async deleteCompsInRelation(node) {
|
|
1071
|
-
const
|
|
1072
|
-
if (!
|
|
1008
|
+
const codeDsl2 = lodashEs.cloneDeep(await this.getCodeDsl());
|
|
1009
|
+
if (!codeDsl2)
|
|
1073
1010
|
return;
|
|
1074
|
-
this.
|
|
1075
|
-
this.setCodeDsl(
|
|
1011
|
+
this.refreshRelationDeep(node, codeDsl2);
|
|
1012
|
+
this.setCodeDsl(codeDsl2);
|
|
1076
1013
|
}
|
|
1077
1014
|
destroy() {
|
|
1078
1015
|
this.state.isShowCodeEditor = false;
|
|
@@ -1083,16 +1020,39 @@
|
|
|
1083
1020
|
this.state.combineIds = [];
|
|
1084
1021
|
this.state.undeletableList = [];
|
|
1085
1022
|
}
|
|
1086
|
-
|
|
1023
|
+
refreshRelationDeep(node, codeDsl2) {
|
|
1087
1024
|
if (!node.id)
|
|
1088
1025
|
return;
|
|
1089
|
-
lodashEs.forIn(
|
|
1026
|
+
lodashEs.forIn(codeDsl2, (codeBlockContent) => {
|
|
1090
1027
|
const compsContent = codeBlockContent.comps || {};
|
|
1091
1028
|
codeBlockContent.comps = lodashEs.omit(compsContent, node.id);
|
|
1092
1029
|
});
|
|
1093
1030
|
if (!lodashEs.isEmpty(node.items)) {
|
|
1094
1031
|
node.items.forEach((item) => {
|
|
1095
|
-
this.
|
|
1032
|
+
this.refreshRelationDeep(item, codeDsl2);
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
recurseMNode(node, relations) {
|
|
1037
|
+
lodashEs.forIn(node, (value, key) => {
|
|
1038
|
+
if (value?.hookType === schema.HookType.CODE && !lodashEs.isEmpty(value.hookData)) {
|
|
1039
|
+
value.hookData.forEach((relationItem) => {
|
|
1040
|
+
if (!relationItem.codeId)
|
|
1041
|
+
return;
|
|
1042
|
+
if (!relations[relationItem.codeId]) {
|
|
1043
|
+
relations[relationItem.codeId] = {};
|
|
1044
|
+
}
|
|
1045
|
+
const codeItem = relations[relationItem.codeId];
|
|
1046
|
+
if (lodashEs.isEmpty(codeItem[node.id])) {
|
|
1047
|
+
codeItem[node.id] = [];
|
|
1048
|
+
}
|
|
1049
|
+
codeItem[node.id].push(key);
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
if (!lodashEs.isEmpty(node.items)) {
|
|
1054
|
+
node.items.forEach((item) => {
|
|
1055
|
+
this.recurseMNode(item, relations);
|
|
1096
1056
|
});
|
|
1097
1057
|
}
|
|
1098
1058
|
}
|
|
@@ -1461,6 +1421,10 @@
|
|
|
1461
1421
|
left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
|
|
1462
1422
|
};
|
|
1463
1423
|
};
|
|
1424
|
+
const serializeConfig = (config) => serialize__default.default(config, {
|
|
1425
|
+
space: 2,
|
|
1426
|
+
unsafe: true
|
|
1427
|
+
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1464
1428
|
|
|
1465
1429
|
class Props extends BaseService {
|
|
1466
1430
|
state = vue.reactive({
|
|
@@ -1860,7 +1824,9 @@
|
|
|
1860
1824
|
stage?.select(newNodes[0].id);
|
|
1861
1825
|
}
|
|
1862
1826
|
}
|
|
1863
|
-
|
|
1827
|
+
if (!utils.isPage(newNodes[0])) {
|
|
1828
|
+
this.pushHistoryState();
|
|
1829
|
+
}
|
|
1864
1830
|
this.emit("add", newNodes);
|
|
1865
1831
|
return Array.isArray(addNode) ? newNodes : newNodes[0];
|
|
1866
1832
|
}
|
|
@@ -1902,7 +1868,9 @@
|
|
|
1902
1868
|
async remove(nodeOrNodeList) {
|
|
1903
1869
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
1904
1870
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
1905
|
-
|
|
1871
|
+
if (!utils.isPage(nodes[0])) {
|
|
1872
|
+
this.pushHistoryState();
|
|
1873
|
+
}
|
|
1906
1874
|
this.emit("remove", nodes);
|
|
1907
1875
|
}
|
|
1908
1876
|
async doUpdate(config) {
|
|
@@ -1914,6 +1882,9 @@
|
|
|
1914
1882
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
1915
1883
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, this.get("root"));
|
|
1916
1884
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1885
|
+
if (lodashEs.isObject(srcValue) && Array.isArray(objValue)) {
|
|
1886
|
+
return srcValue;
|
|
1887
|
+
}
|
|
1917
1888
|
if (Array.isArray(srcValue)) {
|
|
1918
1889
|
return srcValue;
|
|
1919
1890
|
}
|
|
@@ -1957,6 +1928,7 @@
|
|
|
1957
1928
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
1958
1929
|
this.pushHistoryState();
|
|
1959
1930
|
this.emit("update", newNodes);
|
|
1931
|
+
codeBlockService.refreshCombineInfo();
|
|
1960
1932
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
1961
1933
|
}
|
|
1962
1934
|
async sort(id1, id2) {
|
|
@@ -2133,6 +2105,12 @@
|
|
|
2133
2105
|
return null;
|
|
2134
2106
|
return root.codeBlocks || null;
|
|
2135
2107
|
}
|
|
2108
|
+
getCodeDslSync() {
|
|
2109
|
+
const root = this.get("root");
|
|
2110
|
+
if (!root)
|
|
2111
|
+
return null;
|
|
2112
|
+
return root.codeBlocks || null;
|
|
2113
|
+
}
|
|
2136
2114
|
async setCodeDsl(codeDsl) {
|
|
2137
2115
|
if (!this.state.root)
|
|
2138
2116
|
return;
|
|
@@ -2447,14 +2425,14 @@
|
|
|
2447
2425
|
{
|
|
2448
2426
|
name: "created",
|
|
2449
2427
|
text: "created",
|
|
2450
|
-
|
|
2451
|
-
|
|
2428
|
+
labelWidth: "100px",
|
|
2429
|
+
type: "code-select"
|
|
2452
2430
|
},
|
|
2453
2431
|
{
|
|
2454
2432
|
name: "mounted",
|
|
2455
2433
|
text: "mounted",
|
|
2456
|
-
|
|
2457
|
-
|
|
2434
|
+
labelWidth: "100px",
|
|
2435
|
+
type: "code-select"
|
|
2458
2436
|
}
|
|
2459
2437
|
]
|
|
2460
2438
|
}
|
|
@@ -2609,14 +2587,14 @@
|
|
|
2609
2587
|
return stage;
|
|
2610
2588
|
};
|
|
2611
2589
|
|
|
2612
|
-
const _hoisted_1$
|
|
2613
|
-
const _hoisted_2$
|
|
2614
|
-
const _hoisted_3$
|
|
2615
|
-
const __default__$
|
|
2590
|
+
const _hoisted_1$d = { class: "m-editor-empty-panel" };
|
|
2591
|
+
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
2592
|
+
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2593
|
+
const __default__$l = vue.defineComponent({
|
|
2616
2594
|
name: "MEditorAddPageBox"
|
|
2617
2595
|
});
|
|
2618
|
-
const _sfc_main$
|
|
2619
|
-
...__default__$
|
|
2596
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2597
|
+
...__default__$l,
|
|
2620
2598
|
setup(__props) {
|
|
2621
2599
|
const services = vue.inject("services");
|
|
2622
2600
|
const clickHandler = () => {
|
|
@@ -2629,16 +2607,16 @@
|
|
|
2629
2607
|
});
|
|
2630
2608
|
};
|
|
2631
2609
|
return (_ctx, _cache) => {
|
|
2632
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2633
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
2610
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
2611
|
+
vue.createElementVNode("div", _hoisted_2$7, [
|
|
2634
2612
|
vue.createElementVNode("div", {
|
|
2635
2613
|
class: "m-editor-empty-button",
|
|
2636
2614
|
onClick: clickHandler
|
|
2637
2615
|
}, [
|
|
2638
2616
|
vue.createElementVNode("div", null, [
|
|
2639
|
-
vue.createVNode(_sfc_main$
|
|
2617
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2640
2618
|
]),
|
|
2641
|
-
_hoisted_3$
|
|
2619
|
+
_hoisted_3$4
|
|
2642
2620
|
])
|
|
2643
2621
|
])
|
|
2644
2622
|
]);
|
|
@@ -2646,12 +2624,12 @@
|
|
|
2646
2624
|
}
|
|
2647
2625
|
});
|
|
2648
2626
|
|
|
2649
|
-
const _hoisted_1$
|
|
2650
|
-
const __default__$
|
|
2627
|
+
const _hoisted_1$c = { class: "m-editor" };
|
|
2628
|
+
const __default__$k = vue.defineComponent({
|
|
2651
2629
|
name: "MEditorFramework"
|
|
2652
2630
|
});
|
|
2653
|
-
const _sfc_main$
|
|
2654
|
-
...__default__$
|
|
2631
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2632
|
+
...__default__$k,
|
|
2655
2633
|
props: {
|
|
2656
2634
|
codeOptions: { default: () => ({}) }
|
|
2657
2635
|
},
|
|
@@ -2717,7 +2695,7 @@
|
|
|
2717
2695
|
};
|
|
2718
2696
|
return (_ctx, _cache) => {
|
|
2719
2697
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2720
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2698
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
2721
2699
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2722
2700
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2723
2701
|
key: 0,
|
|
@@ -2725,7 +2703,7 @@
|
|
|
2725
2703
|
"init-values": vue.unref(root),
|
|
2726
2704
|
options: __props.codeOptions,
|
|
2727
2705
|
onSave: saveCode
|
|
2728
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2706
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
2729
2707
|
key: 1,
|
|
2730
2708
|
class: "m-editor-content",
|
|
2731
2709
|
"left-class": "m-editor-framework-left",
|
|
@@ -2744,7 +2722,7 @@
|
|
|
2744
2722
|
]),
|
|
2745
2723
|
center: vue.withCtx(() => [
|
|
2746
2724
|
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2747
|
-
vue.createVNode(_sfc_main$
|
|
2725
|
+
vue.createVNode(_sfc_main$m)
|
|
2748
2726
|
])
|
|
2749
2727
|
]),
|
|
2750
2728
|
_: 2
|
|
@@ -2766,16 +2744,16 @@
|
|
|
2766
2744
|
}
|
|
2767
2745
|
});
|
|
2768
2746
|
|
|
2769
|
-
const _hoisted_1$
|
|
2747
|
+
const _hoisted_1$b = {
|
|
2770
2748
|
key: 1,
|
|
2771
2749
|
class: "menu-item-text"
|
|
2772
2750
|
};
|
|
2773
|
-
const _hoisted_2$
|
|
2774
|
-
const __default__$
|
|
2751
|
+
const _hoisted_2$6 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2752
|
+
const __default__$j = vue.defineComponent({
|
|
2775
2753
|
name: "MEditorToolButton"
|
|
2776
2754
|
});
|
|
2777
|
-
const _sfc_main$
|
|
2778
|
-
...__default__$
|
|
2755
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
2756
|
+
...__default__$j,
|
|
2779
2757
|
props: {
|
|
2780
2758
|
data: { default: () => ({
|
|
2781
2759
|
type: "text",
|
|
@@ -2850,7 +2828,7 @@
|
|
|
2850
2828
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
2851
2829
|
key: 0,
|
|
2852
2830
|
direction: __props.data.direction || "vertical"
|
|
2853
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2831
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
2854
2832
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
2855
2833
|
key: 0,
|
|
2856
2834
|
effect: "dark",
|
|
@@ -2864,7 +2842,7 @@
|
|
|
2864
2842
|
disabled: vue.unref(disabled)
|
|
2865
2843
|
}, {
|
|
2866
2844
|
default: vue.withCtx(() => [
|
|
2867
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2845
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2868
2846
|
key: 0,
|
|
2869
2847
|
icon: __props.data.icon
|
|
2870
2848
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2881,7 +2859,7 @@
|
|
|
2881
2859
|
disabled: vue.unref(disabled)
|
|
2882
2860
|
}, {
|
|
2883
2861
|
default: vue.withCtx(() => [
|
|
2884
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2862
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2885
2863
|
key: 0,
|
|
2886
2864
|
icon: __props.data.icon
|
|
2887
2865
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2914,7 +2892,7 @@
|
|
|
2914
2892
|
})) : vue.createCommentVNode("", true)
|
|
2915
2893
|
]),
|
|
2916
2894
|
default: vue.withCtx(() => [
|
|
2917
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
2895
|
+
vue.createElementVNode("span", _hoisted_2$6, [
|
|
2918
2896
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
2919
2897
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
2920
2898
|
default: vue.withCtx(() => [
|
|
@@ -2931,11 +2909,11 @@
|
|
|
2931
2909
|
}
|
|
2932
2910
|
});
|
|
2933
2911
|
|
|
2934
|
-
const __default__$
|
|
2912
|
+
const __default__$i = vue.defineComponent({
|
|
2935
2913
|
name: "MEditorNavMenu"
|
|
2936
2914
|
});
|
|
2937
|
-
const _sfc_main$
|
|
2938
|
-
...__default__$
|
|
2915
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
2916
|
+
...__default__$i,
|
|
2939
2917
|
props: {
|
|
2940
2918
|
data: { default: () => ({}) },
|
|
2941
2919
|
height: { default: 35 }
|
|
@@ -3090,7 +3068,7 @@
|
|
|
3090
3068
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3091
3069
|
}, [
|
|
3092
3070
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3093
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3071
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3094
3072
|
data: item,
|
|
3095
3073
|
key: index
|
|
3096
3074
|
}, null, 8, ["data"]);
|
|
@@ -3102,12 +3080,12 @@
|
|
|
3102
3080
|
}
|
|
3103
3081
|
});
|
|
3104
3082
|
|
|
3105
|
-
const _hoisted_1$
|
|
3106
|
-
const __default__$
|
|
3083
|
+
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
3084
|
+
const __default__$h = vue.defineComponent({
|
|
3107
3085
|
name: "MEditorPropsPanel"
|
|
3108
3086
|
});
|
|
3109
|
-
const _sfc_main$
|
|
3110
|
-
...__default__$
|
|
3087
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
3088
|
+
...__default__$h,
|
|
3111
3089
|
emits: ["mounted"],
|
|
3112
3090
|
setup(__props, { expose, emit }) {
|
|
3113
3091
|
const internalInstance = vue.getCurrentInstance();
|
|
@@ -3150,7 +3128,7 @@
|
|
|
3150
3128
|
expose({ submit });
|
|
3151
3129
|
return (_ctx, _cache) => {
|
|
3152
3130
|
const _component_m_form = vue.resolveComponent("m-form");
|
|
3153
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3131
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
3154
3132
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3155
3133
|
vue.createVNode(_component_m_form, {
|
|
3156
3134
|
ref_key: "configForm",
|
|
@@ -3167,23 +3145,276 @@
|
|
|
3167
3145
|
}
|
|
3168
3146
|
});
|
|
3169
3147
|
|
|
3170
|
-
const _hoisted_1$
|
|
3171
|
-
const _hoisted_2$
|
|
3172
|
-
|
|
3173
|
-
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
3174
|
-
const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3175
|
-
const _hoisted_6$1 = { class: "m-editor-wrapper" };
|
|
3176
|
-
const _hoisted_7$1 = {
|
|
3177
|
-
key: 1,
|
|
3148
|
+
const _hoisted_1$9 = { class: "m-editor-wrapper" };
|
|
3149
|
+
const _hoisted_2$5 = {
|
|
3150
|
+
key: 0,
|
|
3178
3151
|
class: "m-editor-content-bottom"
|
|
3179
3152
|
};
|
|
3180
|
-
const
|
|
3181
|
-
const
|
|
3182
|
-
const
|
|
3183
|
-
key:
|
|
3153
|
+
const _hoisted_3$3 = /* @__PURE__ */ vue.createTextVNode("\u4FDD\u5B58");
|
|
3154
|
+
const _hoisted_4$2 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3155
|
+
const _hoisted_5$1 = {
|
|
3156
|
+
key: 1,
|
|
3184
3157
|
class: "m-editor-content-bottom"
|
|
3185
3158
|
};
|
|
3186
|
-
const
|
|
3159
|
+
const _hoisted_6$1 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3160
|
+
const __default__$g = vue.defineComponent({
|
|
3161
|
+
name: "MEditorCodeDraftEditor"
|
|
3162
|
+
});
|
|
3163
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
3164
|
+
...__default__$g,
|
|
3165
|
+
props: {
|
|
3166
|
+
id: null,
|
|
3167
|
+
content: null,
|
|
3168
|
+
editable: { type: Boolean, default: true },
|
|
3169
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3170
|
+
codeOptions: null,
|
|
3171
|
+
language: null
|
|
3172
|
+
},
|
|
3173
|
+
emits: ["save", "close", "saveAndClose"],
|
|
3174
|
+
setup(__props, { emit }) {
|
|
3175
|
+
const props = __props;
|
|
3176
|
+
const services = vue.inject("services");
|
|
3177
|
+
const codeContent = vue.ref("");
|
|
3178
|
+
const editorContent = vue.ref("");
|
|
3179
|
+
const codeEditor = vue.ref();
|
|
3180
|
+
const originCodeContent = vue.ref("");
|
|
3181
|
+
const codeOptions = vue.computed(() => ({
|
|
3182
|
+
...props.codeOptions,
|
|
3183
|
+
readOnly: !props.editable
|
|
3184
|
+
}));
|
|
3185
|
+
vue.watchEffect(() => {
|
|
3186
|
+
codeContent.value = props.content;
|
|
3187
|
+
if (!originCodeContent.value) {
|
|
3188
|
+
originCodeContent.value = codeContent.value;
|
|
3189
|
+
}
|
|
3190
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3191
|
+
if (codeDraft) {
|
|
3192
|
+
codeContent.value = codeDraft;
|
|
3193
|
+
}
|
|
3194
|
+
});
|
|
3195
|
+
const saveCodeDraft = async (codeValue) => {
|
|
3196
|
+
if (!props.autoSaveDraft)
|
|
3197
|
+
return;
|
|
3198
|
+
if (originCodeContent.value === codeValue) {
|
|
3199
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3200
|
+
return;
|
|
3201
|
+
}
|
|
3202
|
+
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3203
|
+
design.tMagicMessage.success(`\u4EE3\u7801\u8349\u7A3F\u4FDD\u5B58\u6210\u529F ${utils.datetimeFormatter(new Date())}`);
|
|
3204
|
+
};
|
|
3205
|
+
const saveCode = () => {
|
|
3206
|
+
if (!codeEditor.value || !props.editable)
|
|
3207
|
+
return;
|
|
3208
|
+
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3209
|
+
emit("save", editorContent.value);
|
|
3210
|
+
};
|
|
3211
|
+
const saveAndClose = () => {
|
|
3212
|
+
if (!codeEditor.value || !props.editable)
|
|
3213
|
+
return;
|
|
3214
|
+
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3215
|
+
emit("saveAndClose", editorContent.value);
|
|
3216
|
+
};
|
|
3217
|
+
const close = async () => {
|
|
3218
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3219
|
+
if (codeDraft) {
|
|
3220
|
+
design.tMagicMessageBox.confirm("\u60A8\u6709\u4EE3\u7801\u4FEE\u6539\u672A\u4FDD\u5B58\uFF0C\u662F\u5426\u4FDD\u5B58\u540E\u518D\u5173\u95ED\uFF1F", "\u63D0\u793A", {
|
|
3221
|
+
confirmButtonText: "\u786E\u8BA4",
|
|
3222
|
+
cancelButtonText: "\u53D6\u6D88",
|
|
3223
|
+
type: "warning"
|
|
3224
|
+
}).then(async () => {
|
|
3225
|
+
saveAndClose();
|
|
3226
|
+
}).catch(() => {
|
|
3227
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3228
|
+
emit("close");
|
|
3229
|
+
});
|
|
3230
|
+
} else {
|
|
3231
|
+
emit("close");
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3234
|
+
return (_ctx, _cache) => {
|
|
3235
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
|
|
3236
|
+
vue.createVNode(_sfc_main$q, {
|
|
3237
|
+
ref_key: "codeEditor",
|
|
3238
|
+
ref: codeEditor,
|
|
3239
|
+
class: "m-editor-container",
|
|
3240
|
+
"init-values": `${codeContent.value}`,
|
|
3241
|
+
onSave: saveCodeDraft,
|
|
3242
|
+
language: __props.language,
|
|
3243
|
+
options: vue.unref(codeOptions)
|
|
3244
|
+
}, null, 8, ["init-values", "language", "options"]),
|
|
3245
|
+
__props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$5, [
|
|
3246
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3247
|
+
type: "primary",
|
|
3248
|
+
class: "button",
|
|
3249
|
+
onClick: saveCode
|
|
3250
|
+
}, {
|
|
3251
|
+
default: vue.withCtx(() => [
|
|
3252
|
+
_hoisted_3$3
|
|
3253
|
+
]),
|
|
3254
|
+
_: 1
|
|
3255
|
+
}),
|
|
3256
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3257
|
+
type: "primary",
|
|
3258
|
+
class: "button",
|
|
3259
|
+
onClick: close
|
|
3260
|
+
}, {
|
|
3261
|
+
default: vue.withCtx(() => [
|
|
3262
|
+
_hoisted_4$2
|
|
3263
|
+
]),
|
|
3264
|
+
_: 1
|
|
3265
|
+
})
|
|
3266
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
|
|
3267
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3268
|
+
type: "primary",
|
|
3269
|
+
class: "button",
|
|
3270
|
+
onClick: close
|
|
3271
|
+
}, {
|
|
3272
|
+
default: vue.withCtx(() => [
|
|
3273
|
+
_hoisted_6$1
|
|
3274
|
+
]),
|
|
3275
|
+
_: 1
|
|
3276
|
+
})
|
|
3277
|
+
]))
|
|
3278
|
+
]);
|
|
3279
|
+
};
|
|
3280
|
+
}
|
|
3281
|
+
});
|
|
3282
|
+
|
|
3283
|
+
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3284
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3285
|
+
const _hoisted_3$2 = { class: "code-name-wrapper" };
|
|
3286
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570\u5B9A\u4E49", -1);
|
|
3287
|
+
const __default__$f = vue.defineComponent({
|
|
3288
|
+
name: "MEditorFunctionEditor"
|
|
3289
|
+
});
|
|
3290
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
3291
|
+
...__default__$f,
|
|
3292
|
+
props: {
|
|
3293
|
+
id: null,
|
|
3294
|
+
name: null,
|
|
3295
|
+
content: null,
|
|
3296
|
+
editable: { type: Boolean, default: true },
|
|
3297
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3298
|
+
codeOptions: null
|
|
3299
|
+
},
|
|
3300
|
+
emits: ["change", "field-input"],
|
|
3301
|
+
setup(__props, { emit }) {
|
|
3302
|
+
const props = __props;
|
|
3303
|
+
const tableConfig = {
|
|
3304
|
+
border: true,
|
|
3305
|
+
enableFullscreen: false,
|
|
3306
|
+
name: "params",
|
|
3307
|
+
items: [
|
|
3308
|
+
{
|
|
3309
|
+
type: "text",
|
|
3310
|
+
label: "\u53C2\u6570\u540D",
|
|
3311
|
+
name: "name"
|
|
3312
|
+
}
|
|
3313
|
+
]
|
|
3314
|
+
};
|
|
3315
|
+
const services = vue.inject("services");
|
|
3316
|
+
const codeName = vue.ref("");
|
|
3317
|
+
const codeContent = vue.ref("");
|
|
3318
|
+
const evalRes = vue.ref(true);
|
|
3319
|
+
vue.provide("mForm", {
|
|
3320
|
+
$emit: emit,
|
|
3321
|
+
setField: () => {
|
|
3322
|
+
}
|
|
3323
|
+
});
|
|
3324
|
+
const tableModel = vue.ref();
|
|
3325
|
+
vue.watchEffect(() => {
|
|
3326
|
+
codeName.value = props.name;
|
|
3327
|
+
codeContent.value = props.content;
|
|
3328
|
+
});
|
|
3329
|
+
const initTableModel = () => {
|
|
3330
|
+
const codeDsl = services?.codeBlockService.getCodeDslSync();
|
|
3331
|
+
if (!codeDsl)
|
|
3332
|
+
return;
|
|
3333
|
+
tableModel.value = {
|
|
3334
|
+
params: codeDsl[props.id]?.params || []
|
|
3335
|
+
};
|
|
3336
|
+
};
|
|
3337
|
+
initTableModel();
|
|
3338
|
+
const beforeSave = (codeValue) => {
|
|
3339
|
+
try {
|
|
3340
|
+
eval(codeValue);
|
|
3341
|
+
return true;
|
|
3342
|
+
} catch (e) {
|
|
3343
|
+
design.tMagicMessage.error(e.stack);
|
|
3344
|
+
return false;
|
|
3345
|
+
}
|
|
3346
|
+
};
|
|
3347
|
+
const saveCode = async (codeValue2) => {
|
|
3348
|
+
if (!props.editable)
|
|
3349
|
+
return;
|
|
3350
|
+
evalRes.value = beforeSave(codeValue2);
|
|
3351
|
+
if (evalRes.value) {
|
|
3352
|
+
await services?.codeBlockService.setCodeDslById(props.id, {
|
|
3353
|
+
name: codeName.value,
|
|
3354
|
+
content: codeValue2,
|
|
3355
|
+
params: tableModel.value?.params || []
|
|
3356
|
+
});
|
|
3357
|
+
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3358
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3359
|
+
}
|
|
3360
|
+
};
|
|
3361
|
+
const saveAndClose = async (codeValue2) => {
|
|
3362
|
+
await saveCode(codeValue2);
|
|
3363
|
+
if (evalRes.value) {
|
|
3364
|
+
close();
|
|
3365
|
+
}
|
|
3366
|
+
};
|
|
3367
|
+
const close = () => {
|
|
3368
|
+
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3369
|
+
};
|
|
3370
|
+
return (_ctx, _cache) => {
|
|
3371
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
3372
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
3373
|
+
header: vue.withCtx(() => [
|
|
3374
|
+
vue.createElementVNode("div", _hoisted_1$8, [
|
|
3375
|
+
_hoisted_2$4,
|
|
3376
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3377
|
+
class: "code-name-input",
|
|
3378
|
+
modelValue: codeName.value,
|
|
3379
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeName.value = $event),
|
|
3380
|
+
disabled: !__props.editable
|
|
3381
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
3382
|
+
]),
|
|
3383
|
+
vue.createElementVNode("div", _hoisted_3$2, [
|
|
3384
|
+
_hoisted_4$1,
|
|
3385
|
+
vue.createVNode(_component_m_form_table, {
|
|
3386
|
+
style: { "width": "320px" },
|
|
3387
|
+
config: tableConfig,
|
|
3388
|
+
model: tableModel.value,
|
|
3389
|
+
enableToggleMode: false,
|
|
3390
|
+
name: "params",
|
|
3391
|
+
prop: "params",
|
|
3392
|
+
size: "small"
|
|
3393
|
+
}, null, 8, ["model"])
|
|
3394
|
+
])
|
|
3395
|
+
]),
|
|
3396
|
+
default: vue.withCtx(() => [
|
|
3397
|
+
vue.createVNode(_sfc_main$h, {
|
|
3398
|
+
id: __props.id,
|
|
3399
|
+
content: codeContent.value,
|
|
3400
|
+
editable: __props.editable,
|
|
3401
|
+
autoSaveDraft: __props.autoSaveDraft,
|
|
3402
|
+
codeOptions: __props.codeOptions,
|
|
3403
|
+
language: "javascript",
|
|
3404
|
+
onSave: saveCode,
|
|
3405
|
+
onSaveAndClose: saveAndClose,
|
|
3406
|
+
onClose: close
|
|
3407
|
+
}, null, 8, ["id", "content", "editable", "autoSaveDraft", "codeOptions"])
|
|
3408
|
+
]),
|
|
3409
|
+
_: 1
|
|
3410
|
+
});
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3414
|
+
|
|
3415
|
+
const _hoisted_1$7 = ["id"];
|
|
3416
|
+
const _hoisted_2$3 = { class: "list-item" };
|
|
3417
|
+
const _hoisted_3$1 = { class: "code-name" };
|
|
3187
3418
|
const __default__$e = vue.defineComponent({
|
|
3188
3419
|
name: "MEditorCodeBlockEditor"
|
|
3189
3420
|
});
|
|
@@ -3191,22 +3422,22 @@
|
|
|
3191
3422
|
...__default__$e,
|
|
3192
3423
|
setup(__props) {
|
|
3193
3424
|
const services = vue.inject("services");
|
|
3194
|
-
const
|
|
3425
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
3195
3426
|
const left = vue.ref(200);
|
|
3196
3427
|
const currentTitle = vue.ref("");
|
|
3197
3428
|
const codeConfig = vue.ref(null);
|
|
3198
3429
|
const state = vue.reactive({
|
|
3199
3430
|
codeList: []
|
|
3200
3431
|
});
|
|
3201
|
-
const isShowCodeBlockEditor = vue.computed(
|
|
3202
|
-
() => codeConfig.value && services?.codeBlockService.getCodeEditorShowStatus() || false
|
|
3203
|
-
);
|
|
3204
3432
|
const mode = vue.computed(() => services?.codeBlockService.getMode());
|
|
3205
3433
|
const id = vue.computed(() => services?.codeBlockService.getId() || "");
|
|
3206
3434
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3207
3435
|
const selectedIds = vue.computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
3208
3436
|
vue.watchEffect(async () => {
|
|
3209
|
-
codeConfig.value = await services?.codeBlockService.getCodeContentById(id.value) || null;
|
|
3437
|
+
codeConfig.value = lodashEs.cloneDeep(await services?.codeBlockService.getCodeContentById(id.value)) || null;
|
|
3438
|
+
if (!codeConfig.value)
|
|
3439
|
+
return;
|
|
3440
|
+
codeConfig.value.content = serializeConfig(codeConfig.value.content);
|
|
3210
3441
|
});
|
|
3211
3442
|
vue.watchEffect(async () => {
|
|
3212
3443
|
const codeDsl = await services?.codeBlockService.getCodeDslByIds(selectedIds.value) || null;
|
|
@@ -3221,47 +3452,24 @@
|
|
|
3221
3452
|
});
|
|
3222
3453
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3223
3454
|
});
|
|
3224
|
-
const saveCode = async () => {
|
|
3225
|
-
if (!codeEditor.value || !codeConfig.value || !editable.value)
|
|
3226
|
-
return true;
|
|
3227
|
-
try {
|
|
3228
|
-
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3229
|
-
codeConfig.value.content = eval(codeContent);
|
|
3230
|
-
} catch (e) {
|
|
3231
|
-
design.tMagicMessage.error(e.stack);
|
|
3232
|
-
return false;
|
|
3233
|
-
}
|
|
3234
|
-
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3235
|
-
name: codeConfig.value.name,
|
|
3236
|
-
content: codeConfig.value.content
|
|
3237
|
-
});
|
|
3238
|
-
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3239
|
-
return true;
|
|
3240
|
-
};
|
|
3241
|
-
const saveAndClose = async () => {
|
|
3242
|
-
const saveRes = await saveCode();
|
|
3243
|
-
if (saveRes) {
|
|
3244
|
-
await services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3245
|
-
}
|
|
3246
|
-
};
|
|
3247
3455
|
const selectHandler = (data) => {
|
|
3248
3456
|
services?.codeBlockService.setId(data.id);
|
|
3249
3457
|
currentTitle.value = data.name;
|
|
3250
3458
|
};
|
|
3251
3459
|
return (_ctx, _cache) => {
|
|
3252
3460
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
|
|
3253
|
-
|
|
3254
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3461
|
+
"model-value": true,
|
|
3255
3462
|
class: "code-editor-dialog",
|
|
3256
3463
|
title: currentTitle.value,
|
|
3257
3464
|
fullscreen: true,
|
|
3258
|
-
"
|
|
3259
|
-
"append-to-body": true
|
|
3465
|
+
"close-on-press-escape": false,
|
|
3466
|
+
"append-to-body": true,
|
|
3467
|
+
"show-close": false
|
|
3260
3468
|
}, {
|
|
3261
3469
|
default: vue.withCtx(() => [
|
|
3262
|
-
vue.createVNode(_sfc_main$
|
|
3470
|
+
vue.createVNode(_sfc_main$o, {
|
|
3263
3471
|
left: left.value,
|
|
3264
|
-
"onUpdate:left": _cache[
|
|
3472
|
+
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3265
3473
|
"min-left": 45,
|
|
3266
3474
|
class: "code-editor-layout"
|
|
3267
3475
|
}, vue.createSlots({
|
|
@@ -3273,72 +3481,15 @@
|
|
|
3273
3481
|
])
|
|
3274
3482
|
}, [
|
|
3275
3483
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
disabled: !vue.unref(editable)
|
|
3286
|
-
}, null, 8, ["modelValue", "disabled"])) : vue.createCommentVNode("", true)
|
|
3287
|
-
])
|
|
3288
|
-
]),
|
|
3289
|
-
default: vue.withCtx(() => [
|
|
3290
|
-
vue.createElementVNode("div", _hoisted_6$1, [
|
|
3291
|
-
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
3292
|
-
key: 0,
|
|
3293
|
-
ref_key: "codeEditor",
|
|
3294
|
-
ref: codeEditor,
|
|
3295
|
-
class: "m-editor-container",
|
|
3296
|
-
"init-values": `${codeConfig.value.content}`,
|
|
3297
|
-
onSave: saveCode,
|
|
3298
|
-
options: {
|
|
3299
|
-
tabSize: 2,
|
|
3300
|
-
fontSize: 16,
|
|
3301
|
-
formatOnPaste: true,
|
|
3302
|
-
readOnly: !vue.unref(editable)
|
|
3303
|
-
}
|
|
3304
|
-
}, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
|
|
3305
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
|
|
3306
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3307
|
-
type: "primary",
|
|
3308
|
-
class: "button",
|
|
3309
|
-
onClick: saveCode
|
|
3310
|
-
}, {
|
|
3311
|
-
default: vue.withCtx(() => [
|
|
3312
|
-
_hoisted_8$1
|
|
3313
|
-
]),
|
|
3314
|
-
_: 1
|
|
3315
|
-
}),
|
|
3316
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3317
|
-
type: "primary",
|
|
3318
|
-
class: "button",
|
|
3319
|
-
onClick: saveAndClose
|
|
3320
|
-
}, {
|
|
3321
|
-
default: vue.withCtx(() => [
|
|
3322
|
-
_hoisted_9$1
|
|
3323
|
-
]),
|
|
3324
|
-
_: 1
|
|
3325
|
-
})
|
|
3326
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
3327
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3328
|
-
type: "primary",
|
|
3329
|
-
class: "button",
|
|
3330
|
-
onClick: saveAndClose
|
|
3331
|
-
}, {
|
|
3332
|
-
default: vue.withCtx(() => [
|
|
3333
|
-
_hoisted_11
|
|
3334
|
-
]),
|
|
3335
|
-
_: 1
|
|
3336
|
-
})
|
|
3337
|
-
]))
|
|
3338
|
-
])
|
|
3339
|
-
]),
|
|
3340
|
-
_: 1
|
|
3341
|
-
})
|
|
3484
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
|
|
3485
|
+
key: 0,
|
|
3486
|
+
id: vue.unref(id),
|
|
3487
|
+
name: codeConfig.value.name,
|
|
3488
|
+
content: codeConfig.value.content,
|
|
3489
|
+
editable: !!vue.unref(editable),
|
|
3490
|
+
autoSaveDraft: vue.unref(mode) === vue.unref(CodeEditorMode).EDITOR,
|
|
3491
|
+
codeOptions: vue.unref(codeOptions)
|
|
3492
|
+
}, null, 8, ["id", "name", "content", "editable", "autoSaveDraft", "codeOptions"])) : vue.createCommentVNode("", true)
|
|
3342
3493
|
], 2)) : vue.createCommentVNode("", true)
|
|
3343
3494
|
]),
|
|
3344
3495
|
_: 2
|
|
@@ -3373,7 +3524,7 @@
|
|
|
3373
3524
|
]), 1032, ["left"])
|
|
3374
3525
|
]),
|
|
3375
3526
|
_: 3
|
|
3376
|
-
}, 8, ["
|
|
3527
|
+
}, 8, ["title"]);
|
|
3377
3528
|
};
|
|
3378
3529
|
}
|
|
3379
3530
|
});
|
|
@@ -3412,41 +3563,38 @@
|
|
|
3412
3563
|
const props = __props;
|
|
3413
3564
|
const services = vue.inject("services");
|
|
3414
3565
|
const state = vue.reactive({
|
|
3415
|
-
codeList: []
|
|
3416
|
-
bindComps: {}
|
|
3566
|
+
codeList: []
|
|
3417
3567
|
});
|
|
3418
3568
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3419
|
-
const
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
const
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
id: compId,
|
|
3429
|
-
name: getCompName(compId)
|
|
3569
|
+
const isShowCodeBlockEditor = vue.computed(() => services?.codeBlockService.getCodeEditorShowStatus() || false);
|
|
3570
|
+
const codeCombineInfo = vue.ref(null);
|
|
3571
|
+
const getBindCompsByCodeId = (codeId) => {
|
|
3572
|
+
if (!codeCombineInfo.value || !codeCombineInfo.value[codeId])
|
|
3573
|
+
return [];
|
|
3574
|
+
const bindCompsId = Object.keys(codeCombineInfo.value[codeId]);
|
|
3575
|
+
return bindCompsId.map((compId) => ({
|
|
3576
|
+
compId,
|
|
3577
|
+
compName: getCompName(compId)
|
|
3430
3578
|
}));
|
|
3431
|
-
state.bindComps[codeId] = compsInfo;
|
|
3432
3579
|
};
|
|
3433
3580
|
const initList = async () => {
|
|
3434
|
-
const codeDsl = await services?.codeBlockService.getCodeDsl() || null;
|
|
3435
|
-
|
|
3581
|
+
const codeDsl = lodashEs.cloneDeep(await services?.codeBlockService.getCodeDsl()) || null;
|
|
3582
|
+
codeCombineInfo.value = lodashEs.cloneDeep(services?.codeBlockService.getCombineInfo()) || null;
|
|
3583
|
+
if (!codeDsl || !codeCombineInfo.value)
|
|
3436
3584
|
return;
|
|
3437
3585
|
state.codeList = [];
|
|
3438
3586
|
lodashEs.forIn(codeDsl, (value, codeId) => {
|
|
3439
|
-
getBindCompsByCodeId(codeId, value);
|
|
3440
3587
|
state.codeList.push({
|
|
3441
3588
|
id: codeId,
|
|
3442
3589
|
name: value.name,
|
|
3443
3590
|
codeBlockContent: value,
|
|
3444
|
-
showRelation: true
|
|
3591
|
+
showRelation: true,
|
|
3592
|
+
combineInfo: getBindCompsByCodeId(codeId)
|
|
3445
3593
|
});
|
|
3446
3594
|
});
|
|
3447
3595
|
};
|
|
3448
3596
|
vue.watch(
|
|
3449
|
-
() => services?.codeBlockService.
|
|
3597
|
+
[() => services?.codeBlockService.getCodeDslSync(), () => services?.codeBlockService.refreshCombineInfo()],
|
|
3450
3598
|
() => {
|
|
3451
3599
|
initList();
|
|
3452
3600
|
},
|
|
@@ -3455,20 +3603,6 @@
|
|
|
3455
3603
|
deep: true
|
|
3456
3604
|
}
|
|
3457
3605
|
);
|
|
3458
|
-
vue.watch(
|
|
3459
|
-
() => services?.editorService.get("node"),
|
|
3460
|
-
(curNode) => {
|
|
3461
|
-
if (!curNode?.id)
|
|
3462
|
-
return;
|
|
3463
|
-
lodashEs.forIn(state.bindComps, (bindCompInfo) => {
|
|
3464
|
-
bindCompInfo.forEach((comp) => {
|
|
3465
|
-
if (comp.id === curNode.id) {
|
|
3466
|
-
comp.name = curNode.name;
|
|
3467
|
-
}
|
|
3468
|
-
});
|
|
3469
|
-
});
|
|
3470
|
-
}
|
|
3471
|
-
);
|
|
3472
3606
|
const createCodeBlock = async () => {
|
|
3473
3607
|
const { codeBlockService } = services || {};
|
|
3474
3608
|
if (!codeBlockService) {
|
|
@@ -3479,7 +3613,8 @@
|
|
|
3479
3613
|
name: "\u4EE3\u7801\u5757",
|
|
3480
3614
|
content: `() => {
|
|
3481
3615
|
// place your code here
|
|
3482
|
-
}
|
|
3616
|
+
}`,
|
|
3617
|
+
params: []
|
|
3483
3618
|
};
|
|
3484
3619
|
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3485
3620
|
const id = await codeBlockService.getUniqueId();
|
|
@@ -3491,7 +3626,8 @@
|
|
|
3491
3626
|
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3492
3627
|
};
|
|
3493
3628
|
const deleteCode = (key) => {
|
|
3494
|
-
const
|
|
3629
|
+
const currentCode = state.codeList.find((codeItem) => codeItem.id === key);
|
|
3630
|
+
const existBinds = !lodashEs.isEmpty(currentCode?.combineInfo);
|
|
3495
3631
|
const undeleteableList = services?.codeBlockService.getUndeletableList() || [];
|
|
3496
3632
|
if (!existBinds && !undeleteableList.includes(key)) {
|
|
3497
3633
|
services?.codeBlockService.deleteCodeDslByIds([key]);
|
|
@@ -3574,7 +3710,7 @@
|
|
|
3574
3710
|
class: "list-container"
|
|
3575
3711
|
}, [
|
|
3576
3712
|
vue.createElementVNode("div", _hoisted_5, [
|
|
3577
|
-
vue.createElementVNode("
|
|
3713
|
+
vue.createElementVNode("span", _hoisted_6, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1),
|
|
3578
3714
|
vue.createElementVNode("div", _hoisted_7, [
|
|
3579
3715
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
3580
3716
|
effect: "dark",
|
|
@@ -3582,7 +3718,7 @@
|
|
|
3582
3718
|
placement: "bottom"
|
|
3583
3719
|
}, {
|
|
3584
3720
|
default: vue.withCtx(() => [
|
|
3585
|
-
vue.createVNode(_sfc_main$
|
|
3721
|
+
vue.createVNode(_sfc_main$n, {
|
|
3586
3722
|
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3587
3723
|
class: "edit-icon",
|
|
3588
3724
|
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3590,14 +3726,14 @@
|
|
|
3590
3726
|
]),
|
|
3591
3727
|
_: 2
|
|
3592
3728
|
}, 1032, ["content"]),
|
|
3593
|
-
|
|
3729
|
+
data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3594
3730
|
key: 0,
|
|
3595
3731
|
effect: "dark",
|
|
3596
3732
|
content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
|
|
3597
3733
|
placement: "bottom"
|
|
3598
3734
|
}, {
|
|
3599
3735
|
default: vue.withCtx(() => [
|
|
3600
|
-
vue.createVNode(_sfc_main$
|
|
3736
|
+
vue.createVNode(_sfc_main$n, {
|
|
3601
3737
|
icon: vue.unref(iconsVue.Link),
|
|
3602
3738
|
class: "edit-icon",
|
|
3603
3739
|
onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
@@ -3612,7 +3748,7 @@
|
|
|
3612
3748
|
placement: "bottom"
|
|
3613
3749
|
}, {
|
|
3614
3750
|
default: vue.withCtx(() => [
|
|
3615
|
-
vue.createVNode(_sfc_main$
|
|
3751
|
+
vue.createVNode(_sfc_main$n, {
|
|
3616
3752
|
icon: vue.unref(iconsVue.Close),
|
|
3617
3753
|
class: "edit-icon",
|
|
3618
3754
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3626,18 +3762,18 @@
|
|
|
3626
3762
|
})
|
|
3627
3763
|
])
|
|
3628
3764
|
]),
|
|
3629
|
-
data.showRelation &&
|
|
3765
|
+
data.showRelation && data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
3630
3766
|
_hoisted_9,
|
|
3631
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
3767
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.combineInfo, (comp, index) => {
|
|
3632
3768
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3633
3769
|
key: index,
|
|
3634
3770
|
class: "code-comp",
|
|
3635
3771
|
size: "small",
|
|
3636
3772
|
plain: true,
|
|
3637
|
-
onClick: vue.withModifiers(($event) => selectComp(comp.
|
|
3773
|
+
onClick: vue.withModifiers(($event) => selectComp(comp.compId), ["stop"])
|
|
3638
3774
|
}, {
|
|
3639
3775
|
default: vue.withCtx(() => [
|
|
3640
|
-
vue.createTextVNode(vue.toDisplayString(comp.
|
|
3776
|
+
vue.createTextVNode(vue.toDisplayString(comp.compName), 1)
|
|
3641
3777
|
]),
|
|
3642
3778
|
_: 2
|
|
3643
3779
|
}, 1032, ["onClick"]);
|
|
@@ -3647,12 +3783,12 @@
|
|
|
3647
3783
|
]),
|
|
3648
3784
|
_: 3
|
|
3649
3785
|
}, 8, ["data"])) : vue.createCommentVNode("", true),
|
|
3650
|
-
vue.
|
|
3786
|
+
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, { key: 1 }, {
|
|
3651
3787
|
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
3652
3788
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3653
3789
|
]),
|
|
3654
3790
|
_: 3
|
|
3655
|
-
})
|
|
3791
|
+
})) : vue.createCommentVNode("", true)
|
|
3656
3792
|
]);
|
|
3657
3793
|
};
|
|
3658
3794
|
}
|
|
@@ -3752,7 +3888,7 @@
|
|
|
3752
3888
|
name: `${index}`
|
|
3753
3889
|
}, {
|
|
3754
3890
|
title: vue.withCtx(() => [
|
|
3755
|
-
vue.createVNode(_sfc_main$
|
|
3891
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
3756
3892
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
3757
3893
|
]),
|
|
3758
3894
|
default: vue.withCtx(() => [
|
|
@@ -3767,7 +3903,7 @@
|
|
|
3767
3903
|
onDrag: dragHandler
|
|
3768
3904
|
}, [
|
|
3769
3905
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
3770
|
-
vue.createVNode(_sfc_main$
|
|
3906
|
+
vue.createVNode(_sfc_main$n, {
|
|
3771
3907
|
icon: item.icon
|
|
3772
3908
|
}, null, 8, ["icon"]),
|
|
3773
3909
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -3890,7 +4026,7 @@
|
|
|
3890
4026
|
}, [
|
|
3891
4027
|
vue.createElementVNode("div", null, [
|
|
3892
4028
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
3893
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4029
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3894
4030
|
"event-type": "mouseup",
|
|
3895
4031
|
data: item,
|
|
3896
4032
|
key: index,
|
|
@@ -4177,28 +4313,37 @@
|
|
|
4177
4313
|
await expandNodes();
|
|
4178
4314
|
setTreeKeyStatus();
|
|
4179
4315
|
});
|
|
4180
|
-
const
|
|
4181
|
-
const
|
|
4316
|
+
const layerPanel = vue.ref();
|
|
4317
|
+
const mouseenterHandler = () => {
|
|
4318
|
+
layerPanel.value?.focus();
|
|
4319
|
+
};
|
|
4320
|
+
const mouseleaveHandler = () => {
|
|
4321
|
+
layerPanel.value?.blur();
|
|
4322
|
+
if (selectedIds.value.length === 1)
|
|
4323
|
+
isMultiSelectStatus.value = false;
|
|
4324
|
+
};
|
|
4325
|
+
let keycon;
|
|
4326
|
+
vue.onMounted(() => {
|
|
4327
|
+
layerPanel.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
4328
|
+
layerPanel.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
4329
|
+
keycon = new KeyController__default.default(layerPanel.value);
|
|
4182
4330
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4183
4331
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4184
|
-
keycon.
|
|
4185
|
-
keycon.value.keydown(ctrl, (e) => {
|
|
4332
|
+
keycon.keydown(ctrl, (e) => {
|
|
4186
4333
|
e.inputEvent.preventDefault();
|
|
4187
4334
|
isMultiSelectStatus.value = true;
|
|
4188
|
-
})
|
|
4189
|
-
keycon.value.on("blur", () => {
|
|
4335
|
+
}).on("blur", () => {
|
|
4190
4336
|
isMultiSelectStatus.value = false;
|
|
4191
|
-
})
|
|
4192
|
-
keycon.value.keyup(ctrl, (e) => {
|
|
4337
|
+
}).keyup(ctrl, (e) => {
|
|
4193
4338
|
e.inputEvent.preventDefault();
|
|
4194
4339
|
isMultiSelectStatus.value = false;
|
|
4195
4340
|
});
|
|
4196
|
-
};
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
};
|
|
4341
|
+
});
|
|
4342
|
+
vue.onUnmounted(() => {
|
|
4343
|
+
layerPanel.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
4344
|
+
layerPanel.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
4345
|
+
keycon.destroy();
|
|
4346
|
+
});
|
|
4202
4347
|
const clicked = vue.ref(false);
|
|
4203
4348
|
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
4204
4349
|
const highlightHandler = lodashEs.throttle((data) => {
|
|
@@ -4253,77 +4398,78 @@
|
|
|
4253
4398
|
menu.value?.show(event);
|
|
4254
4399
|
};
|
|
4255
4400
|
return (_ctx, _cache) => {
|
|
4256
|
-
return vue.openBlock(), vue.
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4401
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4402
|
+
ref_key: "layerPanel",
|
|
4403
|
+
ref: layerPanel
|
|
4404
|
+
}, [
|
|
4405
|
+
vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4406
|
+
default: vue.withCtx(() => [
|
|
4407
|
+
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4408
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
4409
|
+
modelValue: filterText.value,
|
|
4410
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
4411
|
+
class: "search-input",
|
|
4412
|
+
size: "small",
|
|
4413
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4414
|
+
clearable: "",
|
|
4415
|
+
"prefix-icon": vue.unref(iconsVue.Search),
|
|
4416
|
+
onChange: filterTextChangeHandler
|
|
4417
|
+
}, null, 8, ["modelValue", "prefix-icon"]),
|
|
4418
|
+
vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
4419
|
+
key: 0,
|
|
4420
|
+
class: "magic-editor-layer-tree",
|
|
4421
|
+
ref_key: "tree",
|
|
4422
|
+
ref: tree,
|
|
4423
|
+
"node-key": "id",
|
|
4424
|
+
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4425
|
+
draggable: "",
|
|
4426
|
+
"default-expanded-keys": vue.unref(defaultExpandedKeys),
|
|
4427
|
+
load: loadItems,
|
|
4428
|
+
data: vue.unref(values),
|
|
4429
|
+
"expand-on-click-node": false,
|
|
4430
|
+
"highlight-current": true,
|
|
4431
|
+
props: {
|
|
4432
|
+
children: "items"
|
|
4433
|
+
},
|
|
4434
|
+
"filter-node-method": filterNode,
|
|
4435
|
+
"allow-drop": allowDrop,
|
|
4436
|
+
"show-checkbox": isMultiSelectStatus.value || vue.unref(selectedIds).length > 1,
|
|
4437
|
+
onNodeClick: clickHandler,
|
|
4438
|
+
onNodeContextmenu: contextmenu,
|
|
4439
|
+
onNodeDragEnd: handleDragEnd,
|
|
4440
|
+
onNodeCollapse: handleCollapse,
|
|
4441
|
+
onNodeExpand: handleExpand,
|
|
4442
|
+
onCheck: multiClickHandler,
|
|
4443
|
+
onMousedown: toggleClickFlag,
|
|
4444
|
+
onMouseup: toggleClickFlag
|
|
4445
|
+
}, {
|
|
4446
|
+
default: vue.withCtx(({ node, data }) => [
|
|
4447
|
+
vue.createElementVNode("div", {
|
|
4448
|
+
id: data.id,
|
|
4449
|
+
class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4450
|
+
onMouseenter: ($event) => vue.unref(highlightHandler)(data)
|
|
4451
|
+
}, [
|
|
4452
|
+
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4453
|
+
node,
|
|
4454
|
+
data
|
|
4455
|
+
}, () => [
|
|
4456
|
+
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4457
|
+
])
|
|
4458
|
+
], 42, _hoisted_1$4)
|
|
4459
|
+
]),
|
|
4460
|
+
_: 3
|
|
4461
|
+
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
4462
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4463
|
+
vue.createVNode(_sfc_main$b, {
|
|
4464
|
+
ref_key: "menu",
|
|
4465
|
+
ref: menu,
|
|
4466
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4467
|
+
}, null, 8, ["layer-content-menu"])
|
|
4468
|
+
]))
|
|
4469
|
+
]),
|
|
4470
|
+
_: 3
|
|
4471
|
+
})
|
|
4472
|
+
], 512);
|
|
4327
4473
|
};
|
|
4328
4474
|
}
|
|
4329
4475
|
});
|
|
@@ -4406,7 +4552,7 @@
|
|
|
4406
4552
|
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4407
4553
|
key: config.text
|
|
4408
4554
|
}, [
|
|
4409
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4555
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
4410
4556
|
key: 0,
|
|
4411
4557
|
icon: config.icon
|
|
4412
4558
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -4624,14 +4770,14 @@
|
|
|
4624
4770
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4625
4771
|
onClick: addPage
|
|
4626
4772
|
}, [
|
|
4627
|
-
vue.createVNode(_sfc_main$
|
|
4773
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4628
4774
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4629
4775
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4630
4776
|
key: 2,
|
|
4631
4777
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4632
4778
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4633
4779
|
}, [
|
|
4634
|
-
vue.createVNode(_sfc_main$
|
|
4780
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4635
4781
|
])) : vue.createCommentVNode("", true),
|
|
4636
4782
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4637
4783
|
key: 3,
|
|
@@ -4647,7 +4793,7 @@
|
|
|
4647
4793
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4648
4794
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4649
4795
|
}, [
|
|
4650
|
-
vue.createVNode(_sfc_main$
|
|
4796
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4651
4797
|
])) : vue.createCommentVNode("", true)
|
|
4652
4798
|
], 512);
|
|
4653
4799
|
};
|
|
@@ -4719,7 +4865,7 @@
|
|
|
4719
4865
|
default: vue.withCtx(() => [
|
|
4720
4866
|
vue.createElementVNode("div", null, [
|
|
4721
4867
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4722
|
-
vue.createVNode(_sfc_main$
|
|
4868
|
+
vue.createVNode(_sfc_main$k, {
|
|
4723
4869
|
data: {
|
|
4724
4870
|
type: "button",
|
|
4725
4871
|
text: "\u590D\u5236",
|
|
@@ -4727,7 +4873,7 @@
|
|
|
4727
4873
|
handler: () => copy(item)
|
|
4728
4874
|
}
|
|
4729
4875
|
}, null, 8, ["data"]),
|
|
4730
|
-
vue.createVNode(_sfc_main$
|
|
4876
|
+
vue.createVNode(_sfc_main$k, {
|
|
4731
4877
|
data: {
|
|
4732
4878
|
type: "button",
|
|
4733
4879
|
text: "\u5220\u9664",
|
|
@@ -5544,11 +5690,11 @@
|
|
|
5544
5690
|
const _sfc_main = vue.defineComponent({
|
|
5545
5691
|
name: "m-editor",
|
|
5546
5692
|
components: {
|
|
5547
|
-
NavMenu: _sfc_main$
|
|
5693
|
+
NavMenu: _sfc_main$j,
|
|
5548
5694
|
Sidebar: _sfc_main$9,
|
|
5549
5695
|
Workspace: _sfc_main$1,
|
|
5550
|
-
PropsPanel: _sfc_main$
|
|
5551
|
-
Framework: _sfc_main$
|
|
5696
|
+
PropsPanel: _sfc_main$i,
|
|
5697
|
+
Framework: _sfc_main$l
|
|
5552
5698
|
},
|
|
5553
5699
|
props: {
|
|
5554
5700
|
modelValue: {
|
|
@@ -5721,6 +5867,7 @@
|
|
|
5721
5867
|
codeBlockService
|
|
5722
5868
|
};
|
|
5723
5869
|
vue.provide("services", services);
|
|
5870
|
+
vue.provide("codeOptions", props.codeOptions);
|
|
5724
5871
|
vue.provide(
|
|
5725
5872
|
"stageOptions",
|
|
5726
5873
|
vue.reactive({
|
|
@@ -5845,35 +5992,35 @@
|
|
|
5845
5992
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
5846
5993
|
setConfig(option);
|
|
5847
5994
|
app.component(Editor.name, Editor);
|
|
5848
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
5849
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
5850
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
5851
|
-
app.component("magic-code-editor", _sfc_main$
|
|
5852
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
5995
|
+
app.component("m-fields-ui-select", _sfc_main$r);
|
|
5996
|
+
app.component("m-fields-code-link", _sfc_main$t);
|
|
5997
|
+
app.component("m-fields-vs-code", _sfc_main$u);
|
|
5998
|
+
app.component("magic-code-editor", _sfc_main$q);
|
|
5999
|
+
app.component("m-fields-code-select", _sfc_main$s);
|
|
5853
6000
|
}
|
|
5854
6001
|
};
|
|
5855
6002
|
|
|
6003
|
+
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
5856
6004
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
5857
6005
|
exports.CodeBlockList = _sfc_main$e;
|
|
5858
6006
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
5859
6007
|
exports.CodeEditorMode = CodeEditorMode;
|
|
5860
|
-
exports.CodeSelect = _sfc_main$
|
|
5861
|
-
exports.CodeSelectOp = CodeSelectOp;
|
|
6008
|
+
exports.CodeSelect = _sfc_main$s;
|
|
5862
6009
|
exports.ColumnLayout = ColumnLayout;
|
|
5863
6010
|
exports.ComponentListPanel = _sfc_main$d;
|
|
5864
6011
|
exports.ContentMenu = _sfc_main$c;
|
|
5865
6012
|
exports.Fixed2Other = Fixed2Other;
|
|
5866
6013
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
5867
|
-
exports.Icon = _sfc_main$
|
|
6014
|
+
exports.Icon = _sfc_main$n;
|
|
5868
6015
|
exports.Keys = Keys;
|
|
5869
6016
|
exports.LayerOffset = LayerOffset;
|
|
5870
6017
|
exports.LayerPanel = _sfc_main$a;
|
|
5871
6018
|
exports.Layout = Layout;
|
|
5872
|
-
exports.LayoutContainer = _sfc_main$
|
|
5873
|
-
exports.PropsPanel = _sfc_main$
|
|
5874
|
-
exports.TMagicCodeEditor = _sfc_main$
|
|
6019
|
+
exports.LayoutContainer = _sfc_main$o;
|
|
6020
|
+
exports.PropsPanel = _sfc_main$i;
|
|
6021
|
+
exports.TMagicCodeEditor = _sfc_main$q;
|
|
5875
6022
|
exports.TMagicEditor = Editor;
|
|
5876
|
-
exports.ToolButton = _sfc_main$
|
|
6023
|
+
exports.ToolButton = _sfc_main$k;
|
|
5877
6024
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
5878
6025
|
exports.change2Fixed = change2Fixed;
|
|
5879
6026
|
exports.codeBlockService = codeBlockService;
|
|
@@ -5899,6 +6046,7 @@
|
|
|
5899
6046
|
exports.isFixed = isFixed;
|
|
5900
6047
|
exports.log = log;
|
|
5901
6048
|
exports.propsService = propsService;
|
|
6049
|
+
exports.serializeConfig = serializeConfig;
|
|
5902
6050
|
exports.setConfig = setConfig;
|
|
5903
6051
|
exports.setLayout = setLayout;
|
|
5904
6052
|
exports.storageService = storageService;
|