@tmagic/editor 1.2.15 → 1.3.0-alpha.1
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 +32 -0
- package/dist/tmagic-editor.js +949 -185
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +960 -194
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -9
- package/src/Editor.vue +2 -0
- package/src/components/CodeDraftEditor.vue +2 -2
- package/src/editorProps.ts +5 -0
- package/src/fields/CodeSelect.vue +1 -0
- package/src/fields/DataSourceFields.vue +178 -0
- package/src/fields/EventSelect.vue +1 -0
- package/src/fields/KeyValue.vue +93 -0
- package/src/index.ts +7 -0
- package/src/initService.ts +59 -3
- package/src/layouts/sidebar/LayerPanel.vue +2 -0
- package/src/layouts/sidebar/Sidebar.vue +14 -5
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +7 -0
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +84 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +130 -0
- package/src/services/codeBlock.ts +0 -2
- package/src/services/dataSource.ts +90 -0
- package/src/theme/data-source-fields.scss +13 -0
- package/src/theme/data-source.scss +17 -0
- package/src/theme/key-value.scss +13 -0
- package/src/theme/theme.scss +3 -0
- package/src/type.ts +3 -1
- package/src/utils/data-source/formConfigs/base.ts +32 -0
- package/src/utils/data-source/formConfigs/http.ts +50 -0
- package/src/utils/data-source/index.ts +31 -0
- package/src/utils/dep.ts +9 -1
- package/src/utils/props.ts +1 -0
- package/types/Editor.vue.d.ts +9 -0
- package/types/components/ContentMenu.vue.d.ts +2 -2
- package/types/components/ScrollViewer.vue.d.ts +1 -1
- package/types/editorProps.d.ts +4 -0
- package/types/fields/DataSourceFields.vue.d.ts +40 -0
- package/types/fields/KeyValue.vue.d.ts +50 -0
- package/types/index.d.ts +3 -0
- package/types/initService.d.ts +1 -1
- package/types/layouts/CodeEditor.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -2
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +22 -0
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +12 -0
- package/types/services/dataSource.d.ts +25 -0
- package/types/services/props.d.ts +2 -3
- package/types/type.d.ts +3 -1
- package/types/utils/data-source/formConfigs/base.d.ts +3 -0
- package/types/utils/data-source/formConfigs/http.d.ts +3 -0
- package/types/utils/data-source/index.d.ts +2 -0
- package/types/utils/dep.d.ts +2 -1
- package/types/utils/props.d.ts +2 -3
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, createElementBlock, normalizeClass, createVNode, withCtx, createElementVNode, resolveDynamicComponent, toRaw, inject, ref, Fragment, renderList,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, createElementBlock, normalizeClass, createVNode, withCtx, createElementVNode, resolveDynamicComponent, toRaw, inject, ref, createTextVNode, Fragment, renderList, watchEffect, withModifiers, createCommentVNode, toDisplayString, onMounted, onUnmounted, renderSlot, createSlots, normalizeProps, mergeProps, markRaw, getCurrentInstance, createStaticVNode, withDirectives, Teleport, vShow, nextTick, toHandlers, provide } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
3
|
import { isEmpty, map, has, throttle, cloneDeep, mergeWith, isObject, uniq, forIn, difference, union, pick, keys } from 'lodash-es';
|
|
4
|
-
import { TMagicCard, TMagicIcon, TMagicButton, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage,
|
|
4
|
+
import { TMagicCard, TMagicIcon, TMagicButton, tMagicMessageBox, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, TMagicDrawer, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicPopover } from '@tmagic/design';
|
|
5
5
|
import { HookType, ActionType, NodeType } from '@tmagic/schema';
|
|
6
|
-
import { Edit, View, Delete,
|
|
7
|
-
import { createValues, MForm } from '@tmagic/form';
|
|
6
|
+
import { Edit, View, Delete, Plus, Close, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Coin, Aim, Files, CopyDocument, Goods, List, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
|
|
7
|
+
import { createValues, MFormDialog, MForm } from '@tmagic/form';
|
|
8
|
+
import { MagicTable } from '@tmagic/table';
|
|
8
9
|
import * as monaco from 'monaco-editor';
|
|
9
10
|
import Gesto from 'gesto';
|
|
10
11
|
import { isPop, getNodePath, isNumber, isPage, toLine, guid, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
|
|
@@ -13,11 +14,11 @@ import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLI
|
|
|
13
14
|
import { EventEmitter } from 'events';
|
|
14
15
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
15
16
|
|
|
16
|
-
const __default__$
|
|
17
|
+
const __default__$w = defineComponent({
|
|
17
18
|
name: "MEditorCode"
|
|
18
19
|
});
|
|
19
|
-
const _sfc_main$
|
|
20
|
-
...__default__$
|
|
20
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
21
|
+
...__default__$w,
|
|
21
22
|
props: {
|
|
22
23
|
model: null,
|
|
23
24
|
name: null,
|
|
@@ -46,11 +47,11 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
|
|
49
|
-
const __default__$
|
|
50
|
+
const __default__$v = defineComponent({
|
|
50
51
|
name: "MEditorCodeLink"
|
|
51
52
|
});
|
|
52
|
-
const _sfc_main$
|
|
53
|
-
...__default__$
|
|
53
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
54
|
+
...__default__$v,
|
|
54
55
|
props: {
|
|
55
56
|
config: null,
|
|
56
57
|
model: null,
|
|
@@ -119,11 +120,11 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
119
120
|
}
|
|
120
121
|
});
|
|
121
122
|
|
|
122
|
-
const __default__$
|
|
123
|
+
const __default__$u = defineComponent({
|
|
123
124
|
name: "MEditorCodeSelect"
|
|
124
125
|
});
|
|
125
|
-
const _sfc_main$
|
|
126
|
-
...__default__$
|
|
126
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
127
|
+
...__default__$u,
|
|
127
128
|
props: {
|
|
128
129
|
config: null,
|
|
129
130
|
model: null,
|
|
@@ -140,7 +141,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
140
141
|
enableToggleMode: false,
|
|
141
142
|
items: [
|
|
142
143
|
{
|
|
143
|
-
type: "code-select-col"
|
|
144
|
+
type: "code-select-col",
|
|
145
|
+
labelWidth: 0
|
|
144
146
|
}
|
|
145
147
|
]
|
|
146
148
|
}));
|
|
@@ -181,12 +183,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
181
183
|
}
|
|
182
184
|
});
|
|
183
185
|
|
|
184
|
-
const _hoisted_1$
|
|
185
|
-
const __default__$
|
|
186
|
+
const _hoisted_1$n = ["src"];
|
|
187
|
+
const __default__$t = defineComponent({
|
|
186
188
|
name: "MEditorIcon"
|
|
187
189
|
});
|
|
188
|
-
const _sfc_main$
|
|
189
|
-
...__default__$
|
|
190
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
191
|
+
...__default__$t,
|
|
190
192
|
props: {
|
|
191
193
|
icon: null
|
|
192
194
|
},
|
|
@@ -205,7 +207,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
205
207
|
class: "magic-editor-icon"
|
|
206
208
|
}, {
|
|
207
209
|
default: withCtx(() => [
|
|
208
|
-
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
210
|
+
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$n)
|
|
209
211
|
]),
|
|
210
212
|
_: 1
|
|
211
213
|
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
@@ -224,13 +226,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
224
226
|
}
|
|
225
227
|
});
|
|
226
228
|
|
|
227
|
-
const _hoisted_1$
|
|
228
|
-
const _hoisted_2$
|
|
229
|
-
const __default__$
|
|
229
|
+
const _hoisted_1$m = { class: "m-fields-code-select-col" };
|
|
230
|
+
const _hoisted_2$e = { class: "code-select-container" };
|
|
231
|
+
const __default__$s = defineComponent({
|
|
230
232
|
name: "MEditorCodeSelectCol"
|
|
231
233
|
});
|
|
232
|
-
const _sfc_main$
|
|
233
|
-
...__default__$
|
|
234
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
235
|
+
...__default__$s,
|
|
234
236
|
props: {
|
|
235
237
|
config: null,
|
|
236
238
|
model: null,
|
|
@@ -318,15 +320,15 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
318
320
|
};
|
|
319
321
|
return (_ctx, _cache) => {
|
|
320
322
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
321
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
322
|
-
createElementVNode("div", _hoisted_2$
|
|
323
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
324
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
323
325
|
createVNode(_component_m_form_container, {
|
|
324
326
|
class: "select",
|
|
325
327
|
config: selectConfig,
|
|
326
328
|
model: __props.model,
|
|
327
329
|
onChange: onParamsChangeHandler
|
|
328
330
|
}, null, 8, ["model"]),
|
|
329
|
-
createVNode(_sfc_main$
|
|
331
|
+
createVNode(_sfc_main$A, {
|
|
330
332
|
class: "icon",
|
|
331
333
|
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
332
334
|
onClick: editCode
|
|
@@ -342,17 +344,196 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
342
344
|
}
|
|
343
345
|
});
|
|
344
346
|
|
|
345
|
-
const _hoisted_1$
|
|
346
|
-
const _hoisted_2$
|
|
347
|
+
const _hoisted_1$l = { class: "m-editor-data-source-fields" };
|
|
348
|
+
const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
|
|
349
|
+
const _hoisted_3$8 = /* @__PURE__ */ createTextVNode("添加");
|
|
350
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
351
|
+
__name: "DataSourceFields",
|
|
352
|
+
props: {
|
|
353
|
+
config: null,
|
|
354
|
+
model: null,
|
|
355
|
+
prop: null,
|
|
356
|
+
disabled: { type: Boolean, default: false },
|
|
357
|
+
name: null
|
|
358
|
+
},
|
|
359
|
+
emits: ["change"],
|
|
360
|
+
setup(__props, { emit }) {
|
|
361
|
+
const props = __props;
|
|
362
|
+
const addDialog = ref();
|
|
363
|
+
const fieldValues = ref({});
|
|
364
|
+
const filedTitle = ref("");
|
|
365
|
+
const newHandler = () => {
|
|
366
|
+
if (!addDialog.value)
|
|
367
|
+
return;
|
|
368
|
+
fieldValues.value = {};
|
|
369
|
+
filedTitle.value = "新增属性";
|
|
370
|
+
addDialog.value.dialogVisible = true;
|
|
371
|
+
};
|
|
372
|
+
const fieldChange = ({ index, ...value }) => {
|
|
373
|
+
if (!addDialog.value)
|
|
374
|
+
return;
|
|
375
|
+
if (index > -1) {
|
|
376
|
+
props.model[props.name][index] = value;
|
|
377
|
+
} else {
|
|
378
|
+
props.model[props.name].push(value);
|
|
379
|
+
}
|
|
380
|
+
addDialog.value.dialogVisible = false;
|
|
381
|
+
emit("change", props.model[props.name]);
|
|
382
|
+
};
|
|
383
|
+
const filedColumns = [
|
|
384
|
+
{
|
|
385
|
+
label: "属性名称",
|
|
386
|
+
prop: "title"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
label: "属性key",
|
|
390
|
+
prop: "name"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
label: "属性描述",
|
|
394
|
+
prop: "desc"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
label: "操作",
|
|
398
|
+
fixed: "right",
|
|
399
|
+
actions: [
|
|
400
|
+
{
|
|
401
|
+
text: "编辑",
|
|
402
|
+
handler: (row, index) => {
|
|
403
|
+
if (!addDialog.value)
|
|
404
|
+
return;
|
|
405
|
+
fieldValues.value = {
|
|
406
|
+
...row,
|
|
407
|
+
index
|
|
408
|
+
};
|
|
409
|
+
filedTitle.value = `编辑${row.title}`;
|
|
410
|
+
addDialog.value.dialogVisible = true;
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
text: "删除",
|
|
415
|
+
buttonType: "danger",
|
|
416
|
+
handler: async (row, index) => {
|
|
417
|
+
await tMagicMessageBox.confirm(`确定删除${row.title}(${row.name})?`, "提示");
|
|
418
|
+
props.model[props.name].splice(index, 1);
|
|
419
|
+
emit("change", props.model[props.name]);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
];
|
|
425
|
+
const dataSourceFieldsConfig = [
|
|
426
|
+
{ name: "index", type: "hidden", filter: "number", defaultValue: -1 },
|
|
427
|
+
{
|
|
428
|
+
name: "type",
|
|
429
|
+
text: "数据类型",
|
|
430
|
+
type: "select",
|
|
431
|
+
defaultValue: "string",
|
|
432
|
+
options: [
|
|
433
|
+
{ text: "字符串", value: "string" },
|
|
434
|
+
{ text: "数字", value: "number" },
|
|
435
|
+
{ text: "布尔值", value: "boolean" },
|
|
436
|
+
{ text: "对象", value: "object" },
|
|
437
|
+
{ text: "数组", value: "array" },
|
|
438
|
+
{ text: "null", value: "null" },
|
|
439
|
+
{ text: "any", value: "any" }
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: "name",
|
|
444
|
+
text: "字段名称",
|
|
445
|
+
rules: [
|
|
446
|
+
{
|
|
447
|
+
required: true,
|
|
448
|
+
message: "请输入字段名称"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
validator: ({ value, callback }, { model, parent }) => {
|
|
452
|
+
const index = parent.findIndex((item) => item.name === value);
|
|
453
|
+
if (model.index === -1 && index > -1 || model.index > -1 && index !== model.index) {
|
|
454
|
+
return callback(`属性key(${value})已存在`);
|
|
455
|
+
}
|
|
456
|
+
callback();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
]
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
name: "title",
|
|
463
|
+
text: "展示名称",
|
|
464
|
+
rules: [
|
|
465
|
+
{
|
|
466
|
+
required: true,
|
|
467
|
+
message: "请输入展示名称"
|
|
468
|
+
}
|
|
469
|
+
]
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: "description",
|
|
473
|
+
text: "描述"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
name: "defaultValue",
|
|
477
|
+
text: "默认值"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
name: "enable",
|
|
481
|
+
text: "是否可用",
|
|
482
|
+
type: "switch",
|
|
483
|
+
defaultValue: true
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
name: "fields",
|
|
487
|
+
type: "data-source-fields",
|
|
488
|
+
defaultValue: [],
|
|
489
|
+
display: (formState, { model }) => model.type === "object"
|
|
490
|
+
}
|
|
491
|
+
];
|
|
492
|
+
return (_ctx, _cache) => {
|
|
493
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
494
|
+
createVNode(unref(MagicTable), {
|
|
495
|
+
data: __props.model[__props.name],
|
|
496
|
+
columns: filedColumns
|
|
497
|
+
}, null, 8, ["data"]),
|
|
498
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
499
|
+
createVNode(unref(TMagicButton), {
|
|
500
|
+
size: "small",
|
|
501
|
+
type: "primary",
|
|
502
|
+
disabled: __props.disabled,
|
|
503
|
+
plain: "",
|
|
504
|
+
onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
|
|
505
|
+
}, {
|
|
506
|
+
default: withCtx(() => [
|
|
507
|
+
_hoisted_3$8
|
|
508
|
+
]),
|
|
509
|
+
_: 1
|
|
510
|
+
}, 8, ["disabled"])
|
|
511
|
+
]),
|
|
512
|
+
createVNode(unref(MFormDialog), {
|
|
513
|
+
ref_key: "addDialog",
|
|
514
|
+
ref: addDialog,
|
|
515
|
+
title: filedTitle.value,
|
|
516
|
+
config: dataSourceFieldsConfig,
|
|
517
|
+
values: fieldValues.value,
|
|
518
|
+
parentValues: __props.model[__props.name],
|
|
519
|
+
onSubmit: fieldChange
|
|
520
|
+
}, null, 8, ["title", "values", "parentValues"])
|
|
521
|
+
]);
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
const _hoisted_1$k = { class: "m-fields-event-select" };
|
|
527
|
+
const _hoisted_2$c = {
|
|
347
528
|
key: 1,
|
|
348
529
|
class: "fullWidth"
|
|
349
530
|
};
|
|
350
|
-
const _hoisted_3$
|
|
351
|
-
const __default__$
|
|
531
|
+
const _hoisted_3$7 = /* @__PURE__ */ createTextVNode("添加事件");
|
|
532
|
+
const __default__$r = defineComponent({
|
|
352
533
|
name: "MEditorEventSelect"
|
|
353
534
|
});
|
|
354
|
-
const _sfc_main$
|
|
355
|
-
...__default__$
|
|
535
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
536
|
+
...__default__$r,
|
|
356
537
|
props: {
|
|
357
538
|
config: null,
|
|
358
539
|
model: null,
|
|
@@ -431,6 +612,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
431
612
|
const codeActionConfig = computed(() => {
|
|
432
613
|
const defaultCodeActionConfig = {
|
|
433
614
|
type: "code-select-col",
|
|
615
|
+
labelWidth: 0,
|
|
434
616
|
display: (mForm, { model }) => model.actionType === ActionType.CODE
|
|
435
617
|
};
|
|
436
618
|
return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
|
|
@@ -508,7 +690,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
508
690
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
509
691
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
510
692
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
511
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
693
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
512
694
|
unref(isOldVersion) ? (openBlock(), createBlock(_component_m_form_table, {
|
|
513
695
|
key: 0,
|
|
514
696
|
ref: "eventForm",
|
|
@@ -517,7 +699,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
517
699
|
name: "events",
|
|
518
700
|
config: unref(tableConfig),
|
|
519
701
|
onChange: onChangeHandler
|
|
520
|
-
}, null, 8, ["size", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
702
|
+
}, null, 8, ["size", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$c, [
|
|
521
703
|
createVNode(unref(TMagicButton), {
|
|
522
704
|
class: "create-button",
|
|
523
705
|
type: "primary",
|
|
@@ -525,7 +707,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
525
707
|
onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
|
|
526
708
|
}, {
|
|
527
709
|
default: withCtx(() => [
|
|
528
|
-
_hoisted_3$
|
|
710
|
+
_hoisted_3$7
|
|
529
711
|
]),
|
|
530
712
|
_: 1
|
|
531
713
|
}),
|
|
@@ -559,12 +741,106 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
559
741
|
}
|
|
560
742
|
});
|
|
561
743
|
|
|
562
|
-
const _hoisted_1$
|
|
563
|
-
const
|
|
744
|
+
const _hoisted_1$j = { class: "m-fields-key-value" };
|
|
745
|
+
const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
746
|
+
const _hoisted_3$6 = /* @__PURE__ */ createTextVNode("添加");
|
|
747
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
748
|
+
__name: "KeyValue",
|
|
749
|
+
props: {
|
|
750
|
+
config: null,
|
|
751
|
+
model: null,
|
|
752
|
+
name: null,
|
|
753
|
+
prop: null,
|
|
754
|
+
disabled: { type: Boolean, default: false },
|
|
755
|
+
lastValues: null,
|
|
756
|
+
size: null
|
|
757
|
+
},
|
|
758
|
+
emits: ["change"],
|
|
759
|
+
setup(__props, { emit }) {
|
|
760
|
+
const props = __props;
|
|
761
|
+
const records = ref([]);
|
|
762
|
+
watchEffect(() => {
|
|
763
|
+
records.value = Object.entries(props.model[props.name] || {});
|
|
764
|
+
});
|
|
765
|
+
const getValue = () => {
|
|
766
|
+
const record = {};
|
|
767
|
+
records.value.forEach(([key, value]) => {
|
|
768
|
+
if (key) {
|
|
769
|
+
record[key] = value;
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
return record;
|
|
773
|
+
};
|
|
774
|
+
const keyChangeHandler = () => {
|
|
775
|
+
emit("change", getValue());
|
|
776
|
+
};
|
|
777
|
+
const valueChangeHandler = () => {
|
|
778
|
+
emit("change", getValue());
|
|
779
|
+
};
|
|
780
|
+
const addHandler = () => {
|
|
781
|
+
records.value.push(["", ""]);
|
|
782
|
+
};
|
|
783
|
+
const deleteHandler = (index) => {
|
|
784
|
+
records.value.splice(index, 1);
|
|
785
|
+
};
|
|
786
|
+
return (_ctx, _cache) => {
|
|
787
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
788
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
789
|
+
return openBlock(), createElementBlock("div", {
|
|
790
|
+
class: "m-fields-key-value-item",
|
|
791
|
+
key: index
|
|
792
|
+
}, [
|
|
793
|
+
createVNode(unref(TMagicInput), {
|
|
794
|
+
placeholder: "key",
|
|
795
|
+
modelValue: records.value[index][0],
|
|
796
|
+
"onUpdate:modelValue": ($event) => records.value[index][0] = $event,
|
|
797
|
+
disabled: __props.disabled,
|
|
798
|
+
size: __props.size,
|
|
799
|
+
onChange: keyChangeHandler
|
|
800
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
801
|
+
_hoisted_2$b,
|
|
802
|
+
createVNode(unref(TMagicInput), {
|
|
803
|
+
placeholder: "value",
|
|
804
|
+
modelValue: records.value[index][1],
|
|
805
|
+
"onUpdate:modelValue": ($event) => records.value[index][1] = $event,
|
|
806
|
+
disabled: __props.disabled,
|
|
807
|
+
size: __props.size,
|
|
808
|
+
onChange: valueChangeHandler
|
|
809
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
810
|
+
createVNode(unref(TMagicButton), {
|
|
811
|
+
class: "m-fileds-key-value-delete",
|
|
812
|
+
type: "danger",
|
|
813
|
+
size: __props.size,
|
|
814
|
+
circle: "",
|
|
815
|
+
plain: "",
|
|
816
|
+
icon: unref(Delete),
|
|
817
|
+
onClick: ($event) => deleteHandler(index)
|
|
818
|
+
}, null, 8, ["size", "icon", "onClick"])
|
|
819
|
+
]);
|
|
820
|
+
}), 128)),
|
|
821
|
+
createVNode(unref(TMagicButton), {
|
|
822
|
+
type: "primary",
|
|
823
|
+
size: __props.size,
|
|
824
|
+
plain: "",
|
|
825
|
+
icon: unref(Plus),
|
|
826
|
+
onClick: addHandler
|
|
827
|
+
}, {
|
|
828
|
+
default: withCtx(() => [
|
|
829
|
+
_hoisted_3$6
|
|
830
|
+
]),
|
|
831
|
+
_: 1
|
|
832
|
+
}, 8, ["size", "icon"])
|
|
833
|
+
]);
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
const _hoisted_1$i = /* @__PURE__ */ createTextVNode("取消");
|
|
839
|
+
const __default__$q = defineComponent({
|
|
564
840
|
name: "MEditorUISelect"
|
|
565
841
|
});
|
|
566
|
-
const _sfc_main$
|
|
567
|
-
...__default__$
|
|
842
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
843
|
+
...__default__$q,
|
|
568
844
|
props: {
|
|
569
845
|
config: null,
|
|
570
846
|
model: null,
|
|
@@ -626,7 +902,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
626
902
|
style: { "padding": "0" }
|
|
627
903
|
}, {
|
|
628
904
|
default: withCtx(() => [
|
|
629
|
-
_hoisted_1$
|
|
905
|
+
_hoisted_1$i
|
|
630
906
|
]),
|
|
631
907
|
_: 1
|
|
632
908
|
}, 8, ["icon"])
|
|
@@ -674,11 +950,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
674
950
|
|
|
675
951
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
676
952
|
|
|
677
|
-
const __default__$
|
|
953
|
+
const __default__$p = defineComponent({
|
|
678
954
|
name: "MEditorCodeEditor"
|
|
679
955
|
});
|
|
680
|
-
const _sfc_main$
|
|
681
|
-
...__default__$
|
|
956
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
957
|
+
...__default__$p,
|
|
682
958
|
props: {
|
|
683
959
|
initValues: null,
|
|
684
960
|
modifiedValues: null,
|
|
@@ -807,11 +1083,11 @@ const setConfig = (option) => {
|
|
|
807
1083
|
};
|
|
808
1084
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
809
1085
|
|
|
810
|
-
const __default__$
|
|
1086
|
+
const __default__$o = defineComponent({
|
|
811
1087
|
name: "MEditorResizer"
|
|
812
1088
|
});
|
|
813
|
-
const _sfc_main$
|
|
814
|
-
...__default__$
|
|
1089
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
1090
|
+
...__default__$o,
|
|
815
1091
|
emits: ["change"],
|
|
816
1092
|
setup(__props, { emit }) {
|
|
817
1093
|
const target = ref();
|
|
@@ -843,11 +1119,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
843
1119
|
}
|
|
844
1120
|
});
|
|
845
1121
|
|
|
846
|
-
const __default__$
|
|
1122
|
+
const __default__$n = defineComponent({
|
|
847
1123
|
name: "MEditorLayout"
|
|
848
1124
|
});
|
|
849
|
-
const _sfc_main$
|
|
850
|
-
...__default__$
|
|
1125
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
1126
|
+
...__default__$n,
|
|
851
1127
|
props: {
|
|
852
1128
|
left: null,
|
|
853
1129
|
right: null,
|
|
@@ -955,7 +1231,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
955
1231
|
}, [
|
|
956
1232
|
renderSlot(_ctx.$slots, "left")
|
|
957
1233
|
], 6),
|
|
958
|
-
createVNode(_sfc_main$
|
|
1234
|
+
createVNode(_sfc_main$t, { onChange: changeLeft })
|
|
959
1235
|
], 64)) : createCommentVNode("", true),
|
|
960
1236
|
createElementVNode("div", {
|
|
961
1237
|
class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -964,7 +1240,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
964
1240
|
renderSlot(_ctx.$slots, "center")
|
|
965
1241
|
], 6),
|
|
966
1242
|
unref(hasRight) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
967
|
-
createVNode(_sfc_main$
|
|
1243
|
+
createVNode(_sfc_main$t, { onChange: changeRight }),
|
|
968
1244
|
createElementVNode("div", {
|
|
969
1245
|
class: normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
970
1246
|
style: normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -977,7 +1253,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
977
1253
|
}
|
|
978
1254
|
});
|
|
979
1255
|
|
|
980
|
-
const fillConfig = (config = []) => [
|
|
1256
|
+
const fillConfig$1 = (config = []) => [
|
|
981
1257
|
{
|
|
982
1258
|
type: "tab",
|
|
983
1259
|
items: [
|
|
@@ -1133,7 +1409,8 @@ const fillConfig = (config = []) => [
|
|
|
1133
1409
|
items: [
|
|
1134
1410
|
{
|
|
1135
1411
|
name: "events",
|
|
1136
|
-
type: "event-select"
|
|
1412
|
+
type: "event-select",
|
|
1413
|
+
labelWidth: 0
|
|
1137
1414
|
}
|
|
1138
1415
|
]
|
|
1139
1416
|
},
|
|
@@ -1763,7 +2040,7 @@ class Props extends BaseService {
|
|
|
1763
2040
|
this.emit("props-configs-change");
|
|
1764
2041
|
}
|
|
1765
2042
|
async fillConfig(config) {
|
|
1766
|
-
return fillConfig(config);
|
|
2043
|
+
return fillConfig$1(config);
|
|
1767
2044
|
}
|
|
1768
2045
|
/**
|
|
1769
2046
|
* 为指定类型组件设置组件属性表单配置
|
|
@@ -2830,14 +3107,14 @@ const useStage = (stageOptions) => {
|
|
|
2830
3107
|
return stage;
|
|
2831
3108
|
};
|
|
2832
3109
|
|
|
2833
|
-
const _hoisted_1$
|
|
2834
|
-
const _hoisted_2$
|
|
2835
|
-
const _hoisted_3$
|
|
2836
|
-
const __default__$
|
|
3110
|
+
const _hoisted_1$h = { class: "m-editor-empty-panel" };
|
|
3111
|
+
const _hoisted_2$a = { class: "m-editor-empty-content" };
|
|
3112
|
+
const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
3113
|
+
const __default__$m = defineComponent({
|
|
2837
3114
|
name: "MEditorAddPageBox"
|
|
2838
3115
|
});
|
|
2839
|
-
const _sfc_main$
|
|
2840
|
-
...__default__$
|
|
3116
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
3117
|
+
...__default__$m,
|
|
2841
3118
|
setup(__props) {
|
|
2842
3119
|
const services = inject("services");
|
|
2843
3120
|
const clickHandler = () => {
|
|
@@ -2853,16 +3130,16 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
2853
3130
|
});
|
|
2854
3131
|
};
|
|
2855
3132
|
return (_ctx, _cache) => {
|
|
2856
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2857
|
-
createElementVNode("div", _hoisted_2$
|
|
3133
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
3134
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
2858
3135
|
createElementVNode("div", {
|
|
2859
3136
|
class: "m-editor-empty-button",
|
|
2860
3137
|
onClick: clickHandler
|
|
2861
3138
|
}, [
|
|
2862
3139
|
createElementVNode("div", null, [
|
|
2863
|
-
createVNode(_sfc_main$
|
|
3140
|
+
createVNode(_sfc_main$A, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
2864
3141
|
]),
|
|
2865
|
-
_hoisted_3$
|
|
3142
|
+
_hoisted_3$5
|
|
2866
3143
|
])
|
|
2867
3144
|
])
|
|
2868
3145
|
]);
|
|
@@ -2870,12 +3147,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
2870
3147
|
}
|
|
2871
3148
|
});
|
|
2872
3149
|
|
|
2873
|
-
const _hoisted_1$
|
|
2874
|
-
const __default__$
|
|
3150
|
+
const _hoisted_1$g = { class: "m-editor" };
|
|
3151
|
+
const __default__$l = defineComponent({
|
|
2875
3152
|
name: "MEditorFramework"
|
|
2876
3153
|
});
|
|
2877
|
-
const _sfc_main$
|
|
2878
|
-
...__default__$
|
|
3154
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
3155
|
+
...__default__$l,
|
|
2879
3156
|
props: {
|
|
2880
3157
|
codeOptions: { default: () => ({}) }
|
|
2881
3158
|
},
|
|
@@ -2944,7 +3221,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2944
3221
|
};
|
|
2945
3222
|
return (_ctx, _cache) => {
|
|
2946
3223
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
2947
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3224
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
2948
3225
|
renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2949
3226
|
unref(showSrc) ? (openBlock(), createBlock(_component_magic_code_editor, {
|
|
2950
3227
|
key: 0,
|
|
@@ -2952,7 +3229,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2952
3229
|
"init-values": unref(root),
|
|
2953
3230
|
options: __props.codeOptions,
|
|
2954
3231
|
onSave: saveCode
|
|
2955
|
-
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$
|
|
3232
|
+
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$s, {
|
|
2956
3233
|
key: 1,
|
|
2957
3234
|
class: "m-editor-content",
|
|
2958
3235
|
"left-class": "m-editor-framework-left",
|
|
@@ -2971,7 +3248,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2971
3248
|
]),
|
|
2972
3249
|
center: withCtx(() => [
|
|
2973
3250
|
unref(pageLength) > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2974
|
-
createVNode(_sfc_main$
|
|
3251
|
+
createVNode(_sfc_main$r)
|
|
2975
3252
|
])
|
|
2976
3253
|
]),
|
|
2977
3254
|
_: 2
|
|
@@ -2993,16 +3270,16 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2993
3270
|
}
|
|
2994
3271
|
});
|
|
2995
3272
|
|
|
2996
|
-
const _hoisted_1$
|
|
3273
|
+
const _hoisted_1$f = {
|
|
2997
3274
|
key: 1,
|
|
2998
3275
|
class: "menu-item-text"
|
|
2999
3276
|
};
|
|
3000
|
-
const _hoisted_2$
|
|
3001
|
-
const __default__$
|
|
3277
|
+
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
3278
|
+
const __default__$k = defineComponent({
|
|
3002
3279
|
name: "MEditorToolButton"
|
|
3003
3280
|
});
|
|
3004
|
-
const _sfc_main$
|
|
3005
|
-
...__default__$
|
|
3281
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
3282
|
+
...__default__$k,
|
|
3006
3283
|
props: {
|
|
3007
3284
|
data: { default: () => ({
|
|
3008
3285
|
type: "text",
|
|
@@ -3077,7 +3354,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
3077
3354
|
__props.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
3078
3355
|
key: 0,
|
|
3079
3356
|
direction: __props.data.direction || "vertical"
|
|
3080
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
3357
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$f, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
3081
3358
|
__props.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3082
3359
|
key: 0,
|
|
3083
3360
|
effect: "dark",
|
|
@@ -3091,7 +3368,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
3091
3368
|
disabled: unref(disabled)
|
|
3092
3369
|
}, {
|
|
3093
3370
|
default: withCtx(() => [
|
|
3094
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
3371
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$A, {
|
|
3095
3372
|
key: 0,
|
|
3096
3373
|
icon: __props.data.icon
|
|
3097
3374
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -3108,7 +3385,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
3108
3385
|
disabled: unref(disabled)
|
|
3109
3386
|
}, {
|
|
3110
3387
|
default: withCtx(() => [
|
|
3111
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
3388
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$A, {
|
|
3112
3389
|
key: 0,
|
|
3113
3390
|
icon: __props.data.icon
|
|
3114
3391
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -3141,7 +3418,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
3141
3418
|
})) : createCommentVNode("", true)
|
|
3142
3419
|
]),
|
|
3143
3420
|
default: withCtx(() => [
|
|
3144
|
-
createElementVNode("span", _hoisted_2$
|
|
3421
|
+
createElementVNode("span", _hoisted_2$9, [
|
|
3145
3422
|
createTextVNode(toDisplayString(__props.data.text), 1),
|
|
3146
3423
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
3147
3424
|
default: withCtx(() => [
|
|
@@ -3158,11 +3435,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
3158
3435
|
}
|
|
3159
3436
|
});
|
|
3160
3437
|
|
|
3161
|
-
const __default__$
|
|
3438
|
+
const __default__$j = defineComponent({
|
|
3162
3439
|
name: "MEditorNavMenu"
|
|
3163
3440
|
});
|
|
3164
|
-
const _sfc_main$
|
|
3165
|
-
...__default__$
|
|
3441
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
3442
|
+
...__default__$j,
|
|
3166
3443
|
props: {
|
|
3167
3444
|
data: { default: () => ({}) },
|
|
3168
3445
|
height: { default: 35 }
|
|
@@ -3320,7 +3597,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
3320
3597
|
style: normalizeStyle(`width: ${unref(columnWidth)?.[key]}px`)
|
|
3321
3598
|
}, [
|
|
3322
3599
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttons)[key], (item, index) => {
|
|
3323
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3600
|
+
return openBlock(), createBlock(_sfc_main$p, {
|
|
3324
3601
|
data: item,
|
|
3325
3602
|
key: index
|
|
3326
3603
|
}, null, 8, ["data"]);
|
|
@@ -3332,12 +3609,12 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
3332
3609
|
}
|
|
3333
3610
|
});
|
|
3334
3611
|
|
|
3335
|
-
const _hoisted_1$
|
|
3336
|
-
const __default__$
|
|
3612
|
+
const _hoisted_1$e = { class: "m-editor-props-panel" };
|
|
3613
|
+
const __default__$i = defineComponent({
|
|
3337
3614
|
name: "MEditorPropsPanel"
|
|
3338
3615
|
});
|
|
3339
|
-
const _sfc_main$
|
|
3340
|
-
...__default__$
|
|
3616
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
3617
|
+
...__default__$i,
|
|
3341
3618
|
emits: ["mounted"],
|
|
3342
3619
|
setup(__props, { expose, emit }) {
|
|
3343
3620
|
const internalInstance = getCurrentInstance();
|
|
@@ -3382,7 +3659,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3382
3659
|
};
|
|
3383
3660
|
expose({ submit });
|
|
3384
3661
|
return (_ctx, _cache) => {
|
|
3385
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3662
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
3386
3663
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3387
3664
|
createVNode(unref(MForm), {
|
|
3388
3665
|
ref_key: "configForm",
|
|
@@ -3399,7 +3676,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
3399
3676
|
}
|
|
3400
3677
|
});
|
|
3401
3678
|
|
|
3402
|
-
const _sfc_main$
|
|
3679
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
3403
3680
|
__name: "SearchInput",
|
|
3404
3681
|
emits: ["search"],
|
|
3405
3682
|
setup(__props, { emit }) {
|
|
@@ -3439,10 +3716,10 @@ const _export_sfc = (sfc, props) => {
|
|
|
3439
3716
|
return target;
|
|
3440
3717
|
};
|
|
3441
3718
|
|
|
3442
|
-
const _sfc_main$
|
|
3719
|
+
const _sfc_main$l = {};
|
|
3443
3720
|
|
|
3444
|
-
const _hoisted_1$
|
|
3445
|
-
const _hoisted_2$
|
|
3721
|
+
const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
|
|
3722
|
+
const _hoisted_2$8 = /*#__PURE__*/createElementVNode("g", {
|
|
3446
3723
|
fill: "#7C878E",
|
|
3447
3724
|
"fill-rule": "evenodd"
|
|
3448
3725
|
}, [
|
|
@@ -3452,49 +3729,49 @@ const _hoisted_2$6 = /*#__PURE__*/createElementVNode("g", {
|
|
|
3452
3729
|
}),
|
|
3453
3730
|
/*#__PURE__*/createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
3454
3731
|
], -1);
|
|
3455
|
-
const _hoisted_3$
|
|
3456
|
-
_hoisted_2$
|
|
3732
|
+
const _hoisted_3$4 = [
|
|
3733
|
+
_hoisted_2$8
|
|
3457
3734
|
];
|
|
3458
3735
|
|
|
3459
3736
|
function _sfc_render$2(_ctx, _cache) {
|
|
3460
|
-
return (openBlock(), createElementBlock("svg", _hoisted_1$
|
|
3737
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1$d, _hoisted_3$4))
|
|
3461
3738
|
}
|
|
3462
|
-
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$
|
|
3739
|
+
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$l, [['render',_sfc_render$2]]);
|
|
3463
3740
|
|
|
3464
|
-
const _sfc_main$
|
|
3741
|
+
const _sfc_main$k = {};
|
|
3465
3742
|
|
|
3466
|
-
const _hoisted_1$
|
|
3743
|
+
const _hoisted_1$c = {
|
|
3467
3744
|
viewBox: "0 0 32 32",
|
|
3468
3745
|
version: "1.1",
|
|
3469
3746
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3470
3747
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3471
3748
|
};
|
|
3472
|
-
const _hoisted_2$
|
|
3473
|
-
const _hoisted_4$
|
|
3474
|
-
_hoisted_2$
|
|
3749
|
+
const _hoisted_2$7 = /*#__PURE__*/createStaticVNode("<defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 2);
|
|
3750
|
+
const _hoisted_4$4 = [
|
|
3751
|
+
_hoisted_2$7
|
|
3475
3752
|
];
|
|
3476
3753
|
|
|
3477
3754
|
function _sfc_render$1(_ctx, _cache) {
|
|
3478
|
-
return (openBlock(), createElementBlock("svg", _hoisted_1$
|
|
3755
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1$c, _hoisted_4$4))
|
|
3479
3756
|
}
|
|
3480
|
-
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$
|
|
3757
|
+
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$k, [['render',_sfc_render$1]]);
|
|
3481
3758
|
|
|
3482
|
-
const _hoisted_1$
|
|
3759
|
+
const _hoisted_1$b = {
|
|
3483
3760
|
key: 0,
|
|
3484
3761
|
class: "m-editor-content-bottom"
|
|
3485
3762
|
};
|
|
3486
|
-
const _hoisted_2$
|
|
3487
|
-
const _hoisted_3$
|
|
3488
|
-
const _hoisted_4$
|
|
3763
|
+
const _hoisted_2$6 = /* @__PURE__ */ createTextVNode("确认");
|
|
3764
|
+
const _hoisted_3$3 = /* @__PURE__ */ createTextVNode("关闭");
|
|
3765
|
+
const _hoisted_4$3 = {
|
|
3489
3766
|
key: 1,
|
|
3490
3767
|
class: "m-editor-content-bottom"
|
|
3491
3768
|
};
|
|
3492
|
-
const _hoisted_5$
|
|
3493
|
-
const __default__$
|
|
3769
|
+
const _hoisted_5$2 = /* @__PURE__ */ createTextVNode("关闭");
|
|
3770
|
+
const __default__$h = defineComponent({
|
|
3494
3771
|
name: "MEditorCodeDraftEditor"
|
|
3495
3772
|
});
|
|
3496
|
-
const _sfc_main$
|
|
3497
|
-
...__default__$
|
|
3773
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
3774
|
+
...__default__$h,
|
|
3498
3775
|
props: {
|
|
3499
3776
|
id: null,
|
|
3500
3777
|
content: null,
|
|
@@ -3577,7 +3854,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3577
3854
|
return openBlock(), createElementBlock("div", {
|
|
3578
3855
|
class: normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3579
3856
|
}, [
|
|
3580
|
-
createVNode(_sfc_main$
|
|
3857
|
+
createVNode(_sfc_main$u, {
|
|
3581
3858
|
ref_key: "codeEditor",
|
|
3582
3859
|
ref: codeEditor,
|
|
3583
3860
|
class: "m-editor-container",
|
|
@@ -3586,7 +3863,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3586
3863
|
language: __props.language,
|
|
3587
3864
|
options: unref(codeOptions)
|
|
3588
3865
|
}, null, 8, ["init-values", "language", "options"]),
|
|
3589
|
-
__props.editable ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
3866
|
+
__props.editable ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
3590
3867
|
createVNode(unref(TMagicButton), {
|
|
3591
3868
|
type: "primary",
|
|
3592
3869
|
class: "button",
|
|
@@ -3603,21 +3880,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3603
3880
|
onClick: saveAndClose
|
|
3604
3881
|
}, {
|
|
3605
3882
|
default: withCtx(() => [
|
|
3606
|
-
_hoisted_2$
|
|
3883
|
+
_hoisted_2$6
|
|
3607
3884
|
]),
|
|
3608
3885
|
_: 1
|
|
3609
3886
|
}),
|
|
3610
3887
|
createVNode(unref(TMagicButton), {
|
|
3611
|
-
type: "primary",
|
|
3612
3888
|
class: "button",
|
|
3613
3889
|
onClick: close
|
|
3614
3890
|
}, {
|
|
3615
3891
|
default: withCtx(() => [
|
|
3616
|
-
_hoisted_3$
|
|
3892
|
+
_hoisted_3$3
|
|
3617
3893
|
]),
|
|
3618
3894
|
_: 1
|
|
3619
3895
|
})
|
|
3620
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_4$
|
|
3896
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_4$3, [
|
|
3621
3897
|
createVNode(unref(TMagicButton), {
|
|
3622
3898
|
type: "primary",
|
|
3623
3899
|
class: "button",
|
|
@@ -3629,12 +3905,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3629
3905
|
_: 1
|
|
3630
3906
|
}),
|
|
3631
3907
|
createVNode(unref(TMagicButton), {
|
|
3632
|
-
type: "primary",
|
|
3633
3908
|
class: "button",
|
|
3634
3909
|
onClick: close
|
|
3635
3910
|
}, {
|
|
3636
3911
|
default: withCtx(() => [
|
|
3637
|
-
_hoisted_5$
|
|
3912
|
+
_hoisted_5$2
|
|
3638
3913
|
]),
|
|
3639
3914
|
_: 1
|
|
3640
3915
|
})
|
|
@@ -3644,15 +3919,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3644
3919
|
}
|
|
3645
3920
|
});
|
|
3646
3921
|
|
|
3647
|
-
const _hoisted_1$
|
|
3648
|
-
const _hoisted_2$
|
|
3649
|
-
const _hoisted_3$
|
|
3650
|
-
const _hoisted_4$
|
|
3651
|
-
const __default__$
|
|
3922
|
+
const _hoisted_1$a = { class: "code-name-wrapper" };
|
|
3923
|
+
const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
3924
|
+
const _hoisted_3$2 = { class: "code-name-wrapper" };
|
|
3925
|
+
const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
3926
|
+
const __default__$g = defineComponent({
|
|
3652
3927
|
name: "MEditorFunctionEditor"
|
|
3653
3928
|
});
|
|
3654
|
-
const _sfc_main$
|
|
3655
|
-
...__default__$
|
|
3929
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
3930
|
+
...__default__$g,
|
|
3656
3931
|
props: {
|
|
3657
3932
|
id: null,
|
|
3658
3933
|
name: null,
|
|
@@ -3770,8 +4045,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3770
4045
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
3771
4046
|
return openBlock(), createBlock(unref(TMagicCard), { shadow: "never" }, {
|
|
3772
4047
|
header: withCtx(() => [
|
|
3773
|
-
createElementVNode("div", _hoisted_1$
|
|
3774
|
-
_hoisted_2$
|
|
4048
|
+
createElementVNode("div", _hoisted_1$a, [
|
|
4049
|
+
_hoisted_2$5,
|
|
3775
4050
|
createVNode(unref(TMagicInput), {
|
|
3776
4051
|
class: "code-name-input",
|
|
3777
4052
|
modelValue: codeName.value,
|
|
@@ -3779,8 +4054,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3779
4054
|
disabled: !__props.editable
|
|
3780
4055
|
}, null, 8, ["modelValue", "disabled"])
|
|
3781
4056
|
]),
|
|
3782
|
-
createElementVNode("div", _hoisted_3$
|
|
3783
|
-
_hoisted_4$
|
|
4057
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
4058
|
+
_hoisted_4$2,
|
|
3784
4059
|
createVNode(_component_m_form_table, {
|
|
3785
4060
|
style: { "width": "800px" },
|
|
3786
4061
|
config: tableConfig,
|
|
@@ -3793,7 +4068,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3793
4068
|
])
|
|
3794
4069
|
]),
|
|
3795
4070
|
default: withCtx(() => [
|
|
3796
|
-
createVNode(_sfc_main$
|
|
4071
|
+
createVNode(_sfc_main$j, {
|
|
3797
4072
|
ref_key: "codeDraftEditor",
|
|
3798
4073
|
ref: codeDraftEditor,
|
|
3799
4074
|
id: __props.id,
|
|
@@ -3812,15 +4087,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3812
4087
|
}
|
|
3813
4088
|
});
|
|
3814
4089
|
|
|
3815
|
-
const _hoisted_1$
|
|
4090
|
+
const _hoisted_1$9 = {
|
|
3816
4091
|
key: 0,
|
|
3817
4092
|
class: "m-editor-code-block-editor-panel"
|
|
3818
4093
|
};
|
|
3819
|
-
const __default__$
|
|
4094
|
+
const __default__$f = defineComponent({
|
|
3820
4095
|
name: "MEditorCodeBlockEditor"
|
|
3821
4096
|
});
|
|
3822
|
-
const _sfc_main$
|
|
3823
|
-
...__default__$
|
|
4097
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
4098
|
+
...__default__$f,
|
|
3824
4099
|
props: {
|
|
3825
4100
|
paramsColConfig: null
|
|
3826
4101
|
},
|
|
@@ -3873,16 +4148,16 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3873
4148
|
"before-close": handleClose
|
|
3874
4149
|
}, {
|
|
3875
4150
|
default: withCtx(() => [
|
|
3876
|
-
createVNode(_sfc_main$
|
|
4151
|
+
createVNode(_sfc_main$s, {
|
|
3877
4152
|
left: left.value,
|
|
3878
4153
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3879
4154
|
"min-left": 45,
|
|
3880
4155
|
class: "code-editor-layout"
|
|
3881
4156
|
}, {
|
|
3882
4157
|
center: withCtx(() => [
|
|
3883
|
-
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
4158
|
+
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
3884
4159
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: unref(id) }),
|
|
3885
|
-
codeConfig.value ? (openBlock(), createBlock(_sfc_main$
|
|
4160
|
+
codeConfig.value ? (openBlock(), createBlock(_sfc_main$i, {
|
|
3886
4161
|
key: 0,
|
|
3887
4162
|
ref_key: "functionEditor",
|
|
3888
4163
|
ref: functionEditor,
|
|
@@ -3905,25 +4180,30 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3905
4180
|
}
|
|
3906
4181
|
});
|
|
3907
4182
|
|
|
3908
|
-
const _hoisted_1$
|
|
3909
|
-
const _hoisted_2$
|
|
3910
|
-
const _hoisted_3 = ["id"];
|
|
3911
|
-
const _hoisted_4 = { class: "list-item" };
|
|
3912
|
-
const _hoisted_5 = {
|
|
4183
|
+
const _hoisted_1$8 = { class: "search-wrapper" };
|
|
4184
|
+
const _hoisted_2$4 = /* @__PURE__ */ createTextVNode("新增");
|
|
4185
|
+
const _hoisted_3$1 = ["id"];
|
|
4186
|
+
const _hoisted_4$1 = { class: "list-item" };
|
|
4187
|
+
const _hoisted_5$1 = {
|
|
3913
4188
|
key: 2,
|
|
3914
4189
|
class: "right-tool"
|
|
3915
4190
|
};
|
|
3916
|
-
const __default__$
|
|
4191
|
+
const __default__$e = defineComponent({
|
|
3917
4192
|
name: "MEditorCodeBlockList"
|
|
3918
4193
|
});
|
|
3919
|
-
const _sfc_main$
|
|
3920
|
-
...__default__$
|
|
4194
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
4195
|
+
...__default__$e,
|
|
3921
4196
|
props: {
|
|
3922
4197
|
customError: null,
|
|
3923
4198
|
paramsColConfig: null
|
|
3924
4199
|
},
|
|
3925
4200
|
setup(__props) {
|
|
3926
4201
|
const props = __props;
|
|
4202
|
+
const treeProps = {
|
|
4203
|
+
children: "children",
|
|
4204
|
+
label: "name",
|
|
4205
|
+
value: "id"
|
|
4206
|
+
};
|
|
3927
4207
|
const { codeBlockService, depService, editorService } = inject("services") || {};
|
|
3928
4208
|
const codeList = computed(
|
|
3929
4209
|
() => Object.values(depService?.targets["code-block"] || {}).map((target) => {
|
|
@@ -4004,8 +4284,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4004
4284
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
4005
4285
|
default: withCtx(() => [
|
|
4006
4286
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
4007
|
-
createElementVNode("div", _hoisted_1$
|
|
4008
|
-
createVNode(_sfc_main$
|
|
4287
|
+
createElementVNode("div", _hoisted_1$8, [
|
|
4288
|
+
createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4009
4289
|
unref(editable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4010
4290
|
key: 0,
|
|
4011
4291
|
class: "create-code-button",
|
|
@@ -4014,7 +4294,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4014
4294
|
onClick: createCodeBlock
|
|
4015
4295
|
}, {
|
|
4016
4296
|
default: withCtx(() => [
|
|
4017
|
-
_hoisted_2$
|
|
4297
|
+
_hoisted_2$4
|
|
4018
4298
|
]),
|
|
4019
4299
|
_: 1
|
|
4020
4300
|
})) : createCommentVNode("", true)
|
|
@@ -4029,6 +4309,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4029
4309
|
"default-expanded-keys": unref(expandedKeys),
|
|
4030
4310
|
"expand-on-click-node": false,
|
|
4031
4311
|
data: unref(codeList),
|
|
4312
|
+
props: treeProps,
|
|
4032
4313
|
"highlight-current": true,
|
|
4033
4314
|
"filter-node-method": filterNode,
|
|
4034
4315
|
onNodeClick: clickHandler
|
|
@@ -4038,7 +4319,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4038
4319
|
id: data.id,
|
|
4039
4320
|
class: "list-container"
|
|
4040
4321
|
}, [
|
|
4041
|
-
createElementVNode("div", _hoisted_4, [
|
|
4322
|
+
createElementVNode("div", _hoisted_4$1, [
|
|
4042
4323
|
data.type === "code" ? (openBlock(), createBlock(CodeIcon, {
|
|
4043
4324
|
key: 0,
|
|
4044
4325
|
class: "codeIcon"
|
|
@@ -4050,14 +4331,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4050
4331
|
createElementVNode("span", {
|
|
4051
4332
|
class: normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4052
4333
|
}, toDisplayString(data.name) + " (" + toDisplayString(data.id) + ")", 3),
|
|
4053
|
-
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
4334
|
+
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
|
4054
4335
|
createVNode(unref(TMagicTooltip), {
|
|
4055
4336
|
effect: "dark",
|
|
4056
4337
|
content: unref(editable) ? "编辑" : "查看",
|
|
4057
4338
|
placement: "bottom"
|
|
4058
4339
|
}, {
|
|
4059
4340
|
default: withCtx(() => [
|
|
4060
|
-
createVNode(_sfc_main$
|
|
4341
|
+
createVNode(_sfc_main$A, {
|
|
4061
4342
|
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
4062
4343
|
class: "edit-icon",
|
|
4063
4344
|
onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -4072,7 +4353,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4072
4353
|
placement: "bottom"
|
|
4073
4354
|
}, {
|
|
4074
4355
|
default: withCtx(() => [
|
|
4075
|
-
createVNode(_sfc_main$
|
|
4356
|
+
createVNode(_sfc_main$A, {
|
|
4076
4357
|
icon: unref(Close),
|
|
4077
4358
|
class: "edit-icon",
|
|
4078
4359
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -4086,11 +4367,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4086
4367
|
})
|
|
4087
4368
|
])) : createCommentVNode("", true)
|
|
4088
4369
|
])
|
|
4089
|
-
], 8, _hoisted_3)
|
|
4370
|
+
], 8, _hoisted_3$1)
|
|
4090
4371
|
]),
|
|
4091
4372
|
_: 3
|
|
4092
4373
|
}, 8, ["default-expanded-keys", "data"]),
|
|
4093
|
-
unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$
|
|
4374
|
+
unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$h, {
|
|
4094
4375
|
key: 0,
|
|
4095
4376
|
paramsColConfig: __props.paramsColConfig
|
|
4096
4377
|
}, {
|
|
@@ -4106,6 +4387,263 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4106
4387
|
}
|
|
4107
4388
|
});
|
|
4108
4389
|
|
|
4390
|
+
const _hoisted_1$7 = /* @__PURE__ */ createTextVNode("确定");
|
|
4391
|
+
const _hoisted_2$3 = /* @__PURE__ */ createTextVNode("关闭");
|
|
4392
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
4393
|
+
__name: "DataSourceConfigPanel",
|
|
4394
|
+
props: {
|
|
4395
|
+
title: null,
|
|
4396
|
+
values: null
|
|
4397
|
+
},
|
|
4398
|
+
emits: ["submit"],
|
|
4399
|
+
setup(__props, { expose, emit }) {
|
|
4400
|
+
const props = __props;
|
|
4401
|
+
const type = ref("base");
|
|
4402
|
+
const services = inject("services");
|
|
4403
|
+
const size = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
4404
|
+
const dataSourceConfig = computed(() => services?.dataSourceService.getFormConfig(type.value) || []);
|
|
4405
|
+
const form = ref();
|
|
4406
|
+
const initValues = ref({});
|
|
4407
|
+
watchEffect(() => {
|
|
4408
|
+
initValues.value = props.values;
|
|
4409
|
+
type.value = props.values.type || "base";
|
|
4410
|
+
});
|
|
4411
|
+
const changeHandler = (value) => {
|
|
4412
|
+
if (value.type === type.value) {
|
|
4413
|
+
return;
|
|
4414
|
+
}
|
|
4415
|
+
type.value = value.type || "base";
|
|
4416
|
+
initValues.value = value;
|
|
4417
|
+
};
|
|
4418
|
+
const submitHandler = async () => {
|
|
4419
|
+
try {
|
|
4420
|
+
const values = await form.value?.submitForm();
|
|
4421
|
+
emit("submit", values);
|
|
4422
|
+
} catch (error) {
|
|
4423
|
+
tMagicMessage.error(error.message);
|
|
4424
|
+
}
|
|
4425
|
+
};
|
|
4426
|
+
const visible = ref(false);
|
|
4427
|
+
const hide = () => {
|
|
4428
|
+
visible.value = false;
|
|
4429
|
+
};
|
|
4430
|
+
expose({
|
|
4431
|
+
show() {
|
|
4432
|
+
visible.value = true;
|
|
4433
|
+
},
|
|
4434
|
+
hide
|
|
4435
|
+
});
|
|
4436
|
+
return (_ctx, _cache) => {
|
|
4437
|
+
return openBlock(), createBlock(unref(TMagicDrawer), {
|
|
4438
|
+
modelValue: visible.value,
|
|
4439
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
|
|
4440
|
+
title: __props.title,
|
|
4441
|
+
"close-on-press-escape": true,
|
|
4442
|
+
"append-to-body": true,
|
|
4443
|
+
"show-close": true,
|
|
4444
|
+
"close-on-click-modal": true,
|
|
4445
|
+
size: unref(size)
|
|
4446
|
+
}, {
|
|
4447
|
+
footer: withCtx(() => [
|
|
4448
|
+
createElementVNode("div", null, [
|
|
4449
|
+
createVNode(unref(TMagicButton), {
|
|
4450
|
+
type: "primary",
|
|
4451
|
+
onClick: submitHandler
|
|
4452
|
+
}, {
|
|
4453
|
+
default: withCtx(() => [
|
|
4454
|
+
_hoisted_1$7
|
|
4455
|
+
]),
|
|
4456
|
+
_: 1
|
|
4457
|
+
}),
|
|
4458
|
+
createVNode(unref(TMagicButton), { onClick: hide }, {
|
|
4459
|
+
default: withCtx(() => [
|
|
4460
|
+
_hoisted_2$3
|
|
4461
|
+
]),
|
|
4462
|
+
_: 1
|
|
4463
|
+
})
|
|
4464
|
+
])
|
|
4465
|
+
]),
|
|
4466
|
+
default: withCtx(() => [
|
|
4467
|
+
createVNode(unref(MForm), {
|
|
4468
|
+
ref_key: "form",
|
|
4469
|
+
ref: form,
|
|
4470
|
+
config: unref(dataSourceConfig),
|
|
4471
|
+
"init-values": initValues.value,
|
|
4472
|
+
onChange: changeHandler
|
|
4473
|
+
}, null, 8, ["config", "init-values"])
|
|
4474
|
+
]),
|
|
4475
|
+
_: 1
|
|
4476
|
+
}, 8, ["modelValue", "title", "size"]);
|
|
4477
|
+
};
|
|
4478
|
+
}
|
|
4479
|
+
});
|
|
4480
|
+
|
|
4481
|
+
const _hoisted_1$6 = { class: "search-wrapper" };
|
|
4482
|
+
const _hoisted_2$2 = /* @__PURE__ */ createTextVNode("新增");
|
|
4483
|
+
const _hoisted_3 = ["id"];
|
|
4484
|
+
const _hoisted_4 = { class: "list-item" };
|
|
4485
|
+
const _hoisted_5 = {
|
|
4486
|
+
key: 2,
|
|
4487
|
+
class: "right-tool"
|
|
4488
|
+
};
|
|
4489
|
+
const __default__$d = defineComponent({
|
|
4490
|
+
name: "MEditorDataSourceListPanel"
|
|
4491
|
+
});
|
|
4492
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
4493
|
+
...__default__$d,
|
|
4494
|
+
setup(__props) {
|
|
4495
|
+
const services = inject("services", {});
|
|
4496
|
+
const { dataSourceService, depService } = inject("services") || {};
|
|
4497
|
+
const list = computed(
|
|
4498
|
+
() => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
|
|
4499
|
+
id: target.id,
|
|
4500
|
+
name: target.name,
|
|
4501
|
+
type: "code",
|
|
4502
|
+
children: Object.entries(target.deps).map(([id, dep]) => ({
|
|
4503
|
+
name: dep.name,
|
|
4504
|
+
type: "node",
|
|
4505
|
+
id,
|
|
4506
|
+
children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
|
|
4507
|
+
}))
|
|
4508
|
+
}))
|
|
4509
|
+
);
|
|
4510
|
+
const editDialog = ref();
|
|
4511
|
+
const dataSourceValues = ref({});
|
|
4512
|
+
const addHandler = () => {
|
|
4513
|
+
if (!editDialog.value)
|
|
4514
|
+
return;
|
|
4515
|
+
dataSourceValues.value = {};
|
|
4516
|
+
editDialog.value.show();
|
|
4517
|
+
};
|
|
4518
|
+
const editHandler = (id) => {
|
|
4519
|
+
if (!editDialog.value || !services)
|
|
4520
|
+
return;
|
|
4521
|
+
dataSourceValues.value = {
|
|
4522
|
+
...dataSourceService?.getDataSourceById(id)
|
|
4523
|
+
};
|
|
4524
|
+
editDialog.value.show();
|
|
4525
|
+
};
|
|
4526
|
+
const removeHandler = async (id) => {
|
|
4527
|
+
await tMagicMessageBox.confirm("确定删除?", "提示", {
|
|
4528
|
+
confirmButtonText: "确定",
|
|
4529
|
+
cancelButtonText: "取消",
|
|
4530
|
+
type: "warning"
|
|
4531
|
+
});
|
|
4532
|
+
dataSourceService?.remove(id);
|
|
4533
|
+
};
|
|
4534
|
+
const submitDataSourceHandler = (value) => {
|
|
4535
|
+
if (!services)
|
|
4536
|
+
return;
|
|
4537
|
+
if (value.id) {
|
|
4538
|
+
dataSourceService?.update(value);
|
|
4539
|
+
} else {
|
|
4540
|
+
dataSourceService?.add(value);
|
|
4541
|
+
}
|
|
4542
|
+
editDialog.value?.hide();
|
|
4543
|
+
};
|
|
4544
|
+
const tree = ref();
|
|
4545
|
+
const filterTextChangeHandler = (val) => {
|
|
4546
|
+
tree.value?.filter(val);
|
|
4547
|
+
};
|
|
4548
|
+
return (_ctx, _cache) => {
|
|
4549
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
4550
|
+
default: withCtx(() => [
|
|
4551
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
4552
|
+
createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4553
|
+
createVNode(unref(TMagicButton), {
|
|
4554
|
+
type: "primary",
|
|
4555
|
+
size: "small",
|
|
4556
|
+
onClick: addHandler
|
|
4557
|
+
}, {
|
|
4558
|
+
default: withCtx(() => [
|
|
4559
|
+
_hoisted_2$2
|
|
4560
|
+
]),
|
|
4561
|
+
_: 1
|
|
4562
|
+
})
|
|
4563
|
+
]),
|
|
4564
|
+
createVNode(unref(TMagicTree), {
|
|
4565
|
+
ref_key: "tree",
|
|
4566
|
+
ref: tree,
|
|
4567
|
+
class: "magic-editor-layer-tree",
|
|
4568
|
+
"node-key": "id",
|
|
4569
|
+
"empty-text": "暂无代码块",
|
|
4570
|
+
"default-expand-all": "",
|
|
4571
|
+
"expand-on-click-node": false,
|
|
4572
|
+
data: unref(list),
|
|
4573
|
+
"highlight-current": true
|
|
4574
|
+
}, {
|
|
4575
|
+
default: withCtx(({ data }) => [
|
|
4576
|
+
createElementVNode("div", {
|
|
4577
|
+
id: data.id,
|
|
4578
|
+
class: "list-container"
|
|
4579
|
+
}, [
|
|
4580
|
+
createElementVNode("div", _hoisted_4, [
|
|
4581
|
+
data.type === "code" ? (openBlock(), createBlock(_sfc_main$A, {
|
|
4582
|
+
key: 0,
|
|
4583
|
+
class: "codeIcon",
|
|
4584
|
+
icon: unref(Coin)
|
|
4585
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
4586
|
+
data.type === "node" ? (openBlock(), createBlock(_sfc_main$A, {
|
|
4587
|
+
key: 1,
|
|
4588
|
+
class: "compIcon",
|
|
4589
|
+
icon: unref(Aim)
|
|
4590
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
4591
|
+
createElementVNode("span", {
|
|
4592
|
+
class: normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4593
|
+
}, toDisplayString(data.name) + "(" + toDisplayString(data.id) + ")", 3),
|
|
4594
|
+
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
4595
|
+
createVNode(unref(TMagicTooltip), {
|
|
4596
|
+
effect: "dark",
|
|
4597
|
+
content: "编辑",
|
|
4598
|
+
placement: "bottom"
|
|
4599
|
+
}, {
|
|
4600
|
+
default: withCtx(() => [
|
|
4601
|
+
createVNode(_sfc_main$A, {
|
|
4602
|
+
class: "edit-icon",
|
|
4603
|
+
icon: unref(Edit),
|
|
4604
|
+
onClick: withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
|
|
4605
|
+
}, null, 8, ["icon", "onClick"])
|
|
4606
|
+
]),
|
|
4607
|
+
_: 2
|
|
4608
|
+
}, 1024),
|
|
4609
|
+
createVNode(unref(TMagicTooltip), {
|
|
4610
|
+
effect: "dark",
|
|
4611
|
+
content: "删除",
|
|
4612
|
+
placement: "bottom"
|
|
4613
|
+
}, {
|
|
4614
|
+
default: withCtx(() => [
|
|
4615
|
+
createVNode(_sfc_main$A, {
|
|
4616
|
+
icon: unref(Close),
|
|
4617
|
+
class: "edit-icon",
|
|
4618
|
+
onClick: withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
|
|
4619
|
+
}, null, 8, ["icon", "onClick"])
|
|
4620
|
+
]),
|
|
4621
|
+
_: 2
|
|
4622
|
+
}, 1024),
|
|
4623
|
+
renderSlot(_ctx.$slots, "data-source-panel-tool", {
|
|
4624
|
+
id: data.id,
|
|
4625
|
+
data: data.codeBlockContent
|
|
4626
|
+
})
|
|
4627
|
+
])) : createCommentVNode("", true)
|
|
4628
|
+
])
|
|
4629
|
+
], 8, _hoisted_3)
|
|
4630
|
+
]),
|
|
4631
|
+
_: 3
|
|
4632
|
+
}, 8, ["data"]),
|
|
4633
|
+
createVNode(_sfc_main$f, {
|
|
4634
|
+
ref_key: "editDialog",
|
|
4635
|
+
ref: editDialog,
|
|
4636
|
+
values: dataSourceValues.value,
|
|
4637
|
+
title: typeof dataSourceValues.value.id !== "undefined" ? `编辑${dataSourceValues.value.title}` : "新增",
|
|
4638
|
+
onSubmit: submitDataSourceHandler
|
|
4639
|
+
}, null, 8, ["values", "title"])
|
|
4640
|
+
]),
|
|
4641
|
+
_: 3
|
|
4642
|
+
});
|
|
4643
|
+
};
|
|
4644
|
+
}
|
|
4645
|
+
});
|
|
4646
|
+
|
|
4109
4647
|
const _hoisted_1$5 = ["onClick", "onDragstart"];
|
|
4110
4648
|
const __default__$c = defineComponent({
|
|
4111
4649
|
name: "MEditorComponentListPanel"
|
|
@@ -4187,7 +4725,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4187
4725
|
"model-value": unref(collapseValue)
|
|
4188
4726
|
}, {
|
|
4189
4727
|
default: withCtx(() => [
|
|
4190
|
-
createVNode(_sfc_main$
|
|
4728
|
+
createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4191
4729
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (group, index) => {
|
|
4192
4730
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
4193
4731
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
@@ -4195,7 +4733,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4195
4733
|
name: `${index}`
|
|
4196
4734
|
}, {
|
|
4197
4735
|
title: withCtx(() => [
|
|
4198
|
-
createVNode(_sfc_main$
|
|
4736
|
+
createVNode(_sfc_main$A, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
4199
4737
|
createTextVNode(toDisplayString(group.title), 1)
|
|
4200
4738
|
]),
|
|
4201
4739
|
default: withCtx(() => [
|
|
@@ -4210,7 +4748,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4210
4748
|
onDrag: dragHandler
|
|
4211
4749
|
}, [
|
|
4212
4750
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4213
|
-
createVNode(_sfc_main$
|
|
4751
|
+
createVNode(_sfc_main$A, {
|
|
4214
4752
|
icon: item.icon
|
|
4215
4753
|
}, null, 8, ["icon"]),
|
|
4216
4754
|
createVNode(unref(TMagicTooltip), {
|
|
@@ -4333,7 +4871,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
4333
4871
|
}, [
|
|
4334
4872
|
createElementVNode("div", null, [
|
|
4335
4873
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
|
|
4336
|
-
return openBlock(), createBlock(_sfc_main$
|
|
4874
|
+
return openBlock(), createBlock(_sfc_main$p, {
|
|
4337
4875
|
"event-type": "mouseup",
|
|
4338
4876
|
data: item,
|
|
4339
4877
|
key: index,
|
|
@@ -4485,6 +5023,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4485
5023
|
const clicked = ref(false);
|
|
4486
5024
|
const treeProps = {
|
|
4487
5025
|
children: "items",
|
|
5026
|
+
label: "name",
|
|
5027
|
+
value: "id",
|
|
4488
5028
|
disabled: (data) => Boolean(data.items?.length),
|
|
4489
5029
|
class: (data) => {
|
|
4490
5030
|
if (clicked.value || isPage(data))
|
|
@@ -4664,7 +5204,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4664
5204
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4665
5205
|
default: withCtx(() => [
|
|
4666
5206
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4667
|
-
createVNode(_sfc_main$
|
|
5207
|
+
createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4668
5208
|
unref(values).length ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
4669
5209
|
key: 0,
|
|
4670
5210
|
class: "magic-editor-layer-tree",
|
|
@@ -4733,7 +5273,7 @@ const __default__$8 = defineComponent({
|
|
|
4733
5273
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
4734
5274
|
...__default__$8,
|
|
4735
5275
|
props: {
|
|
4736
|
-
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block"] }) },
|
|
5276
|
+
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block", "data-source"] }) },
|
|
4737
5277
|
layerContentMenu: null
|
|
4738
5278
|
},
|
|
4739
5279
|
setup(__props, { expose }) {
|
|
@@ -4746,7 +5286,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4746
5286
|
"component-list": {
|
|
4747
5287
|
$key: "component-list",
|
|
4748
5288
|
type: "component",
|
|
4749
|
-
icon:
|
|
5289
|
+
icon: Goods,
|
|
4750
5290
|
text: "组件",
|
|
4751
5291
|
component: _sfc_main$d,
|
|
4752
5292
|
slots: {}
|
|
@@ -4754,7 +5294,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4754
5294
|
layer: {
|
|
4755
5295
|
$key: "layer",
|
|
4756
5296
|
type: "component",
|
|
4757
|
-
icon:
|
|
5297
|
+
icon: List,
|
|
4758
5298
|
text: "已选组件",
|
|
4759
5299
|
props: {
|
|
4760
5300
|
layerContentMenu: props.layerContentMenu
|
|
@@ -4767,6 +5307,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4767
5307
|
type: "component",
|
|
4768
5308
|
icon: EditPen,
|
|
4769
5309
|
text: "代码编辑",
|
|
5310
|
+
component: _sfc_main$g,
|
|
5311
|
+
slots: {}
|
|
5312
|
+
},
|
|
5313
|
+
"data-source": {
|
|
5314
|
+
$key: "data-source",
|
|
5315
|
+
type: "component",
|
|
5316
|
+
icon: Coin,
|
|
5317
|
+
text: "数据源",
|
|
4770
5318
|
component: _sfc_main$e,
|
|
4771
5319
|
slots: {}
|
|
4772
5320
|
}
|
|
@@ -4799,7 +5347,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4799
5347
|
(openBlock(), createElementBlock("div", {
|
|
4800
5348
|
key: config.text
|
|
4801
5349
|
}, [
|
|
4802
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
5350
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$A, {
|
|
4803
5351
|
key: 0,
|
|
4804
5352
|
icon: config.icon
|
|
4805
5353
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -5020,14 +5568,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5020
5568
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5021
5569
|
onClick: addPage
|
|
5022
5570
|
}, [
|
|
5023
|
-
createVNode(_sfc_main$
|
|
5571
|
+
createVNode(_sfc_main$A, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
5024
5572
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
|
|
5025
5573
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
5026
5574
|
key: 2,
|
|
5027
5575
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5028
5576
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
5029
5577
|
}, [
|
|
5030
|
-
createVNode(_sfc_main$
|
|
5578
|
+
createVNode(_sfc_main$A, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
5031
5579
|
])) : createCommentVNode("", true),
|
|
5032
5580
|
unref(pageLength) ? (openBlock(), createElementBlock("div", {
|
|
5033
5581
|
key: 3,
|
|
@@ -5043,7 +5591,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5043
5591
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5044
5592
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
5045
5593
|
}, [
|
|
5046
|
-
createVNode(_sfc_main$
|
|
5594
|
+
createVNode(_sfc_main$A, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
5047
5595
|
])) : createCommentVNode("", true)
|
|
5048
5596
|
], 512);
|
|
5049
5597
|
};
|
|
@@ -5115,7 +5663,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
5115
5663
|
default: withCtx(() => [
|
|
5116
5664
|
createElementVNode("div", null, [
|
|
5117
5665
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
5118
|
-
createVNode(_sfc_main$
|
|
5666
|
+
createVNode(_sfc_main$p, {
|
|
5119
5667
|
data: {
|
|
5120
5668
|
type: "button",
|
|
5121
5669
|
text: "复制",
|
|
@@ -5123,7 +5671,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
5123
5671
|
handler: () => copy(item)
|
|
5124
5672
|
}
|
|
5125
5673
|
}, null, 8, ["data"]),
|
|
5126
|
-
createVNode(_sfc_main$
|
|
5674
|
+
createVNode(_sfc_main$p, {
|
|
5127
5675
|
data: {
|
|
5128
5676
|
type: "button",
|
|
5129
5677
|
text: "删除",
|
|
@@ -5953,7 +6501,6 @@ class CodeBlock extends BaseService {
|
|
|
5953
6501
|
*/
|
|
5954
6502
|
async setCodeDsl(codeDsl2) {
|
|
5955
6503
|
this.state.codeDsl = codeDsl2;
|
|
5956
|
-
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
5957
6504
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
5958
6505
|
}
|
|
5959
6506
|
/**
|
|
@@ -6191,6 +6738,166 @@ class ComponentList extends BaseService {
|
|
|
6191
6738
|
}
|
|
6192
6739
|
const componentListService = new ComponentList();
|
|
6193
6740
|
|
|
6741
|
+
const BaseFormConfig = [
|
|
6742
|
+
{
|
|
6743
|
+
name: "id",
|
|
6744
|
+
type: "hidden"
|
|
6745
|
+
},
|
|
6746
|
+
{
|
|
6747
|
+
name: "type",
|
|
6748
|
+
text: "类型",
|
|
6749
|
+
type: "select",
|
|
6750
|
+
options: [
|
|
6751
|
+
{ text: "基础", value: "base" },
|
|
6752
|
+
{ text: "HTTP", value: "http" }
|
|
6753
|
+
],
|
|
6754
|
+
defaultValue: "base"
|
|
6755
|
+
},
|
|
6756
|
+
{
|
|
6757
|
+
name: "title",
|
|
6758
|
+
text: "名称",
|
|
6759
|
+
rules: [
|
|
6760
|
+
{
|
|
6761
|
+
required: true,
|
|
6762
|
+
message: "请输入名称"
|
|
6763
|
+
}
|
|
6764
|
+
]
|
|
6765
|
+
},
|
|
6766
|
+
{
|
|
6767
|
+
name: "description",
|
|
6768
|
+
text: "描述"
|
|
6769
|
+
}
|
|
6770
|
+
];
|
|
6771
|
+
|
|
6772
|
+
const HttpFormConfig = [
|
|
6773
|
+
{
|
|
6774
|
+
name: "autoFetch",
|
|
6775
|
+
text: "自动请求",
|
|
6776
|
+
type: "switch",
|
|
6777
|
+
defaultValue: true
|
|
6778
|
+
},
|
|
6779
|
+
{
|
|
6780
|
+
type: "fieldset",
|
|
6781
|
+
name: "options",
|
|
6782
|
+
legend: "HTTP 配置",
|
|
6783
|
+
items: [
|
|
6784
|
+
{
|
|
6785
|
+
name: "url",
|
|
6786
|
+
text: "URL"
|
|
6787
|
+
},
|
|
6788
|
+
{
|
|
6789
|
+
name: "method",
|
|
6790
|
+
text: "Method",
|
|
6791
|
+
type: "select",
|
|
6792
|
+
options: [
|
|
6793
|
+
{ text: "GET", value: "GET" },
|
|
6794
|
+
{ text: "POST", value: "POST" },
|
|
6795
|
+
{ text: "PUT", value: "PUT" },
|
|
6796
|
+
{ text: "DELETE", value: "DELETE" }
|
|
6797
|
+
]
|
|
6798
|
+
},
|
|
6799
|
+
{
|
|
6800
|
+
name: "params",
|
|
6801
|
+
type: "key-value",
|
|
6802
|
+
defaultValue: {},
|
|
6803
|
+
text: "参数"
|
|
6804
|
+
},
|
|
6805
|
+
{
|
|
6806
|
+
name: "data",
|
|
6807
|
+
type: "key-value",
|
|
6808
|
+
defaultValue: {},
|
|
6809
|
+
text: "请求体"
|
|
6810
|
+
},
|
|
6811
|
+
{
|
|
6812
|
+
name: "headers",
|
|
6813
|
+
type: "key-value",
|
|
6814
|
+
defaultValue: {},
|
|
6815
|
+
text: "请求头"
|
|
6816
|
+
}
|
|
6817
|
+
]
|
|
6818
|
+
}
|
|
6819
|
+
];
|
|
6820
|
+
|
|
6821
|
+
const fillConfig = (config) => [
|
|
6822
|
+
...BaseFormConfig,
|
|
6823
|
+
...config,
|
|
6824
|
+
{
|
|
6825
|
+
type: "panel",
|
|
6826
|
+
title: "数据定义",
|
|
6827
|
+
items: [
|
|
6828
|
+
{
|
|
6829
|
+
name: "fields",
|
|
6830
|
+
type: "data-source-fields",
|
|
6831
|
+
defaultValue: []
|
|
6832
|
+
}
|
|
6833
|
+
]
|
|
6834
|
+
}
|
|
6835
|
+
];
|
|
6836
|
+
const getFormConfig = (type, configs) => {
|
|
6837
|
+
switch (type) {
|
|
6838
|
+
case "base":
|
|
6839
|
+
return fillConfig([]);
|
|
6840
|
+
case "http":
|
|
6841
|
+
return fillConfig(HttpFormConfig);
|
|
6842
|
+
default:
|
|
6843
|
+
return fillConfig(configs[type] || []);
|
|
6844
|
+
}
|
|
6845
|
+
};
|
|
6846
|
+
|
|
6847
|
+
class DataSource extends BaseService {
|
|
6848
|
+
state = reactive({
|
|
6849
|
+
dataSources: [],
|
|
6850
|
+
configs: {}
|
|
6851
|
+
});
|
|
6852
|
+
set(name, value) {
|
|
6853
|
+
this.state[name] = value;
|
|
6854
|
+
}
|
|
6855
|
+
get(name) {
|
|
6856
|
+
return this.state[name];
|
|
6857
|
+
}
|
|
6858
|
+
getFormConfig(type = "base") {
|
|
6859
|
+
return getFormConfig(type, this.get("configs"));
|
|
6860
|
+
}
|
|
6861
|
+
setFormConfig(type, config) {
|
|
6862
|
+
this.get("configs")[type] = config;
|
|
6863
|
+
}
|
|
6864
|
+
add(config) {
|
|
6865
|
+
const newConfig = {
|
|
6866
|
+
...config,
|
|
6867
|
+
id: this.createId()
|
|
6868
|
+
};
|
|
6869
|
+
this.get("dataSources").push(newConfig);
|
|
6870
|
+
this.emit("add", newConfig);
|
|
6871
|
+
}
|
|
6872
|
+
update(config) {
|
|
6873
|
+
const dataSources = this.get("dataSources");
|
|
6874
|
+
const index = dataSources.findIndex((ds) => ds.id === config.id);
|
|
6875
|
+
dataSources[index] = cloneDeep(config);
|
|
6876
|
+
this.emit("update", config);
|
|
6877
|
+
}
|
|
6878
|
+
remove(id) {
|
|
6879
|
+
const dataSources = this.get("dataSources");
|
|
6880
|
+
const index = dataSources.findIndex((ds) => ds.id === id);
|
|
6881
|
+
dataSources.splice(index, 1);
|
|
6882
|
+
this.emit("remove", id);
|
|
6883
|
+
}
|
|
6884
|
+
getDataSourceById(id) {
|
|
6885
|
+
return this.get("dataSources").find((ds) => ds.id === id);
|
|
6886
|
+
}
|
|
6887
|
+
resetState() {
|
|
6888
|
+
this.set("dataSources", []);
|
|
6889
|
+
}
|
|
6890
|
+
destroy() {
|
|
6891
|
+
this.removeAllListeners();
|
|
6892
|
+
this.resetState();
|
|
6893
|
+
this.removeAllPlugins();
|
|
6894
|
+
}
|
|
6895
|
+
createId() {
|
|
6896
|
+
return `ds_${guid()}`;
|
|
6897
|
+
}
|
|
6898
|
+
}
|
|
6899
|
+
const dataSourceService = new DataSource();
|
|
6900
|
+
|
|
6194
6901
|
class Target extends EventEmitter {
|
|
6195
6902
|
/**
|
|
6196
6903
|
* 如何识别目标
|
|
@@ -6539,6 +7246,10 @@ const editorProps = {
|
|
|
6539
7246
|
type: Object,
|
|
6540
7247
|
default: () => ({})
|
|
6541
7248
|
},
|
|
7249
|
+
dataScourceConfigs: {
|
|
7250
|
+
type: Object,
|
|
7251
|
+
default: () => ({})
|
|
7252
|
+
},
|
|
6542
7253
|
/** 画布中组件选中框的移动范围 */
|
|
6543
7254
|
moveableOptions: {
|
|
6544
7255
|
type: [Object, Function]
|
|
@@ -6594,6 +7305,12 @@ const createCodeBlockTarget = (id, codeBlock) => new Target({
|
|
|
6594
7305
|
return false;
|
|
6595
7306
|
}
|
|
6596
7307
|
});
|
|
7308
|
+
const createDataSourceTarget = (id, ds) => new Target({
|
|
7309
|
+
type: "data-source",
|
|
7310
|
+
id,
|
|
7311
|
+
name: ds.title || `${id}`,
|
|
7312
|
+
isTarget: (key, value) => typeof value === "string" && value.includes(`${id}`)
|
|
7313
|
+
});
|
|
6597
7314
|
|
|
6598
7315
|
const initServiceState = (props, {
|
|
6599
7316
|
editorService,
|
|
@@ -6673,7 +7390,26 @@ const initServiceState = (props, {
|
|
|
6673
7390
|
codeBlockService.resetState();
|
|
6674
7391
|
});
|
|
6675
7392
|
};
|
|
6676
|
-
const initServiceEvents = (props, emit, { editorService, codeBlockService, depService }) => {
|
|
7393
|
+
const initServiceEvents = (props, emit, { editorService, codeBlockService, dataSourceService, depService }) => {
|
|
7394
|
+
const targetAddHandler = (target) => {
|
|
7395
|
+
if (target.type !== "data-source")
|
|
7396
|
+
return;
|
|
7397
|
+
const root = editorService.get("root");
|
|
7398
|
+
if (!root)
|
|
7399
|
+
return;
|
|
7400
|
+
if (!root.dataSourceDeps) {
|
|
7401
|
+
root.dataSourceDeps = {};
|
|
7402
|
+
}
|
|
7403
|
+
root.dataSourceDeps[target.id] = target.deps;
|
|
7404
|
+
};
|
|
7405
|
+
const targetRemoveHandler = (id) => {
|
|
7406
|
+
const root = editorService.get("root");
|
|
7407
|
+
if (!root?.dataSourceDeps)
|
|
7408
|
+
return;
|
|
7409
|
+
delete root.dataSourceDeps[id];
|
|
7410
|
+
};
|
|
7411
|
+
depService.on("add-target", targetAddHandler);
|
|
7412
|
+
depService.on("remove-target", targetRemoveHandler);
|
|
6677
7413
|
const rootChangeHandler = async (value, preValue) => {
|
|
6678
7414
|
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
6679
7415
|
let node;
|
|
@@ -6693,15 +7429,21 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, depSe
|
|
|
6693
7429
|
emit("update:modelValue", value);
|
|
6694
7430
|
}
|
|
6695
7431
|
value.codeBlocks = value.codeBlocks || {};
|
|
7432
|
+
value.dataSources = value.dataSources || [];
|
|
6696
7433
|
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
7434
|
+
dataSourceService.set("dataSources", value.dataSources);
|
|
6697
7435
|
depService.removeTargets("code-block");
|
|
6698
7436
|
Object.entries(value.codeBlocks).forEach(([id, code]) => {
|
|
6699
7437
|
depService.addTarget(createCodeBlockTarget(id, code));
|
|
6700
7438
|
});
|
|
7439
|
+
value.dataSources.forEach((ds) => {
|
|
7440
|
+
depService.addTarget(createDataSourceTarget(ds.id, ds));
|
|
7441
|
+
});
|
|
6701
7442
|
if (value && Array.isArray(value.items)) {
|
|
6702
7443
|
depService.collect(value.items, true);
|
|
6703
7444
|
} else {
|
|
6704
7445
|
depService.clear();
|
|
7446
|
+
delete value.dataSourceDeps;
|
|
6705
7447
|
}
|
|
6706
7448
|
};
|
|
6707
7449
|
const nodeAddHandler = (nodes) => {
|
|
@@ -6733,7 +7475,23 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, depSe
|
|
|
6733
7475
|
};
|
|
6734
7476
|
codeBlockService.on("addOrUpdate", codeBlockAddOrUpdateHandler);
|
|
6735
7477
|
codeBlockService.on("remove", codeBlockRemoveHandler);
|
|
7478
|
+
const dataSourceAddHandler = (config) => {
|
|
7479
|
+
depService.addTarget(createDataSourceTarget(config.id, config));
|
|
7480
|
+
};
|
|
7481
|
+
const dataSourceUpdateHandler = (config) => {
|
|
7482
|
+
if (config.title) {
|
|
7483
|
+
depService.getTarget(config.id).name = config.title;
|
|
7484
|
+
}
|
|
7485
|
+
};
|
|
7486
|
+
const dataSourceRemoveHandler = (id) => {
|
|
7487
|
+
depService.removeTarget(id);
|
|
7488
|
+
};
|
|
7489
|
+
dataSourceService.on("add", dataSourceAddHandler);
|
|
7490
|
+
dataSourceService.on("update", dataSourceUpdateHandler);
|
|
7491
|
+
dataSourceService.on("remove", dataSourceRemoveHandler);
|
|
6736
7492
|
onUnmounted(() => {
|
|
7493
|
+
depService.off("add-target", targetAddHandler);
|
|
7494
|
+
depService.off("remove-target", targetRemoveHandler);
|
|
6737
7495
|
editorService.off("history-change", historyChangeHandler);
|
|
6738
7496
|
editorService.off("root-change", rootChangeHandler);
|
|
6739
7497
|
editorService.off("add", nodeAddHandler);
|
|
@@ -6741,17 +7499,20 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, depSe
|
|
|
6741
7499
|
editorService.off("update", nodeUpdateHandler);
|
|
6742
7500
|
codeBlockService.off("addOrUpdate", codeBlockAddOrUpdateHandler);
|
|
6743
7501
|
codeBlockService.off("remove", codeBlockRemoveHandler);
|
|
7502
|
+
dataSourceService.off("add", dataSourceAddHandler);
|
|
7503
|
+
dataSourceService.off("update", dataSourceUpdateHandler);
|
|
7504
|
+
dataSourceService.off("remove", dataSourceRemoveHandler);
|
|
6744
7505
|
});
|
|
6745
7506
|
};
|
|
6746
7507
|
|
|
6747
7508
|
const _sfc_main = defineComponent({
|
|
6748
7509
|
name: "m-editor",
|
|
6749
7510
|
components: {
|
|
6750
|
-
TMagicNavMenu: _sfc_main$
|
|
7511
|
+
TMagicNavMenu: _sfc_main$o,
|
|
6751
7512
|
Sidebar: _sfc_main$9,
|
|
6752
7513
|
Workspace: _sfc_main$1,
|
|
6753
|
-
PropsPanel: _sfc_main$
|
|
6754
|
-
Framework: _sfc_main$
|
|
7514
|
+
PropsPanel: _sfc_main$n,
|
|
7515
|
+
Framework: _sfc_main$q
|
|
6755
7516
|
},
|
|
6756
7517
|
props: editorProps,
|
|
6757
7518
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -6765,7 +7526,8 @@ const _sfc_main = defineComponent({
|
|
|
6765
7526
|
uiService,
|
|
6766
7527
|
storageService,
|
|
6767
7528
|
codeBlockService,
|
|
6768
|
-
depService
|
|
7529
|
+
depService,
|
|
7530
|
+
dataSourceService
|
|
6769
7531
|
};
|
|
6770
7532
|
initServiceEvents(props, emit, services);
|
|
6771
7533
|
initServiceState(props, services);
|
|
@@ -6890,15 +7652,17 @@ const index = {
|
|
|
6890
7652
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6891
7653
|
setConfig(option);
|
|
6892
7654
|
app.component(Editor.name, Editor);
|
|
6893
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
6894
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
6895
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
6896
|
-
app.component("magic-code-editor", _sfc_main$
|
|
6897
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6898
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
6899
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
7655
|
+
app.component("m-fields-ui-select", _sfc_main$v);
|
|
7656
|
+
app.component("m-fields-code-link", _sfc_main$C);
|
|
7657
|
+
app.component("m-fields-vs-code", _sfc_main$D);
|
|
7658
|
+
app.component("magic-code-editor", _sfc_main$u);
|
|
7659
|
+
app.component("m-fields-code-select", _sfc_main$B);
|
|
7660
|
+
app.component("m-fields-code-select-col", _sfc_main$z);
|
|
7661
|
+
app.component("m-fields-event-select", _sfc_main$x);
|
|
7662
|
+
app.component("m-fields-data-source-fields", _sfc_main$y);
|
|
7663
|
+
app.component("m-fields-key-value", _sfc_main$w);
|
|
6900
7664
|
}
|
|
6901
7665
|
};
|
|
6902
7666
|
|
|
6903
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
7667
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$g as CodeBlockList, CodeDeleteErrorType, _sfc_main$B as CodeSelect, _sfc_main$z as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, _sfc_main$y as DataSourceFields, _sfc_main$x as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$A as Icon, _sfc_main$w as KeyValue, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$s as LayoutContainer, _sfc_main$n as PropsPanel, _sfc_main$u as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$p as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, editorService, error, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
6904
7668
|
//# sourceMappingURL=tmagic-editor.js.map
|