@tmagic/editor 1.2.15 → 1.3.0-alpha.0
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 +959 -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 +6 -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 +2 -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
|
@@ -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/design'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/form'), require('monaco-editor'), require('gesto'), require('@tmagic/utils'), require('keycon'), require('@tmagic/stage'), require('events'), require('@tmagic/core')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/form', 'monaco-editor', 'gesto', '@tmagic/utils', 'keycon', '@tmagic/stage', 'events', '@tmagic/core'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.schema, global.iconsVue, global.form, global.monaco, global.Gesto, global.utils, global.KeyController, global.StageCore, global.events, global.core));
|
|
5
|
-
})(this, (function (exports, vue, serialize, lodashEs, design, schema, iconsVue, form, monaco, Gesto, utils, KeyController, StageCore, events, core) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/form'), require('@tmagic/table'), require('monaco-editor'), require('gesto'), require('@tmagic/utils'), require('keycon'), require('@tmagic/stage'), require('events'), require('@tmagic/core')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/form', '@tmagic/table', 'monaco-editor', 'gesto', '@tmagic/utils', 'keycon', '@tmagic/stage', 'events', '@tmagic/core'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.schema, global.iconsVue, global.form, global.table, global.monaco, global.Gesto, global.utils, global.KeyController, global.StageCore, global.events, global.core));
|
|
5
|
+
})(this, (function (exports, vue, serialize, lodashEs, design, schema, iconsVue, form, table, monaco, Gesto, utils, KeyController, StageCore, events, core) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
|
|
25
25
|
|
|
26
|
-
const __default__$
|
|
26
|
+
const __default__$w = vue.defineComponent({
|
|
27
27
|
name: "MEditorCode"
|
|
28
28
|
});
|
|
29
|
-
const _sfc_main$
|
|
30
|
-
...__default__$
|
|
29
|
+
const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
30
|
+
...__default__$w,
|
|
31
31
|
props: {
|
|
32
32
|
model: null,
|
|
33
33
|
name: null,
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
const __default__$
|
|
59
|
+
const __default__$v = vue.defineComponent({
|
|
60
60
|
name: "MEditorCodeLink"
|
|
61
61
|
});
|
|
62
|
-
const _sfc_main$
|
|
63
|
-
...__default__$
|
|
62
|
+
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
63
|
+
...__default__$v,
|
|
64
64
|
props: {
|
|
65
65
|
config: null,
|
|
66
66
|
model: null,
|
|
@@ -129,11 +129,11 @@
|
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
|
|
132
|
-
const __default__$
|
|
132
|
+
const __default__$u = vue.defineComponent({
|
|
133
133
|
name: "MEditorCodeSelect"
|
|
134
134
|
});
|
|
135
|
-
const _sfc_main$
|
|
136
|
-
...__default__$
|
|
135
|
+
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
136
|
+
...__default__$u,
|
|
137
137
|
props: {
|
|
138
138
|
config: null,
|
|
139
139
|
model: null,
|
|
@@ -150,7 +150,8 @@
|
|
|
150
150
|
enableToggleMode: false,
|
|
151
151
|
items: [
|
|
152
152
|
{
|
|
153
|
-
type: "code-select-col"
|
|
153
|
+
type: "code-select-col",
|
|
154
|
+
labelWidth: 0
|
|
154
155
|
}
|
|
155
156
|
]
|
|
156
157
|
}));
|
|
@@ -191,12 +192,12 @@
|
|
|
191
192
|
}
|
|
192
193
|
});
|
|
193
194
|
|
|
194
|
-
const _hoisted_1$
|
|
195
|
-
const __default__$
|
|
195
|
+
const _hoisted_1$n = ["src"];
|
|
196
|
+
const __default__$t = vue.defineComponent({
|
|
196
197
|
name: "MEditorIcon"
|
|
197
198
|
});
|
|
198
|
-
const _sfc_main$
|
|
199
|
-
...__default__$
|
|
199
|
+
const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
|
|
200
|
+
...__default__$t,
|
|
200
201
|
props: {
|
|
201
202
|
icon: null
|
|
202
203
|
},
|
|
@@ -215,7 +216,7 @@
|
|
|
215
216
|
class: "magic-editor-icon"
|
|
216
217
|
}, {
|
|
217
218
|
default: vue.withCtx(() => [
|
|
218
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
219
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$n)
|
|
219
220
|
]),
|
|
220
221
|
_: 1
|
|
221
222
|
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -234,13 +235,13 @@
|
|
|
234
235
|
}
|
|
235
236
|
});
|
|
236
237
|
|
|
237
|
-
const _hoisted_1$
|
|
238
|
-
const _hoisted_2$
|
|
239
|
-
const __default__$
|
|
238
|
+
const _hoisted_1$m = { class: "m-fields-code-select-col" };
|
|
239
|
+
const _hoisted_2$e = { class: "code-select-container" };
|
|
240
|
+
const __default__$s = vue.defineComponent({
|
|
240
241
|
name: "MEditorCodeSelectCol"
|
|
241
242
|
});
|
|
242
|
-
const _sfc_main$
|
|
243
|
-
...__default__$
|
|
243
|
+
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
244
|
+
...__default__$s,
|
|
244
245
|
props: {
|
|
245
246
|
config: null,
|
|
246
247
|
model: null,
|
|
@@ -328,15 +329,15 @@
|
|
|
328
329
|
};
|
|
329
330
|
return (_ctx, _cache) => {
|
|
330
331
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
331
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
332
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
332
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
|
|
333
|
+
vue.createElementVNode("div", _hoisted_2$e, [
|
|
333
334
|
vue.createVNode(_component_m_form_container, {
|
|
334
335
|
class: "select",
|
|
335
336
|
config: selectConfig,
|
|
336
337
|
model: __props.model,
|
|
337
338
|
onChange: onParamsChangeHandler
|
|
338
339
|
}, null, 8, ["model"]),
|
|
339
|
-
vue.createVNode(_sfc_main$
|
|
340
|
+
vue.createVNode(_sfc_main$A, {
|
|
340
341
|
class: "icon",
|
|
341
342
|
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
342
343
|
onClick: editCode
|
|
@@ -352,17 +353,196 @@
|
|
|
352
353
|
}
|
|
353
354
|
});
|
|
354
355
|
|
|
355
|
-
const _hoisted_1$
|
|
356
|
-
const _hoisted_2$
|
|
356
|
+
const _hoisted_1$l = { class: "m-editor-data-source-fields" };
|
|
357
|
+
const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
|
|
358
|
+
const _hoisted_3$8 = /* @__PURE__ */ vue.createTextVNode("添加");
|
|
359
|
+
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
360
|
+
__name: "DataSourceFields",
|
|
361
|
+
props: {
|
|
362
|
+
config: null,
|
|
363
|
+
model: null,
|
|
364
|
+
prop: null,
|
|
365
|
+
disabled: { type: Boolean, default: false },
|
|
366
|
+
name: null
|
|
367
|
+
},
|
|
368
|
+
emits: ["change"],
|
|
369
|
+
setup(__props, { emit }) {
|
|
370
|
+
const props = __props;
|
|
371
|
+
const addDialog = vue.ref();
|
|
372
|
+
const fieldValues = vue.ref({});
|
|
373
|
+
const filedTitle = vue.ref("");
|
|
374
|
+
const newHandler = () => {
|
|
375
|
+
if (!addDialog.value)
|
|
376
|
+
return;
|
|
377
|
+
fieldValues.value = {};
|
|
378
|
+
filedTitle.value = "新增属性";
|
|
379
|
+
addDialog.value.dialogVisible = true;
|
|
380
|
+
};
|
|
381
|
+
const fieldChange = ({ index, ...value }) => {
|
|
382
|
+
if (!addDialog.value)
|
|
383
|
+
return;
|
|
384
|
+
if (index > -1) {
|
|
385
|
+
props.model[props.name][index] = value;
|
|
386
|
+
} else {
|
|
387
|
+
props.model[props.name].push(value);
|
|
388
|
+
}
|
|
389
|
+
addDialog.value.dialogVisible = false;
|
|
390
|
+
emit("change", props.model[props.name]);
|
|
391
|
+
};
|
|
392
|
+
const filedColumns = [
|
|
393
|
+
{
|
|
394
|
+
label: "属性名称",
|
|
395
|
+
prop: "title"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
label: "属性key",
|
|
399
|
+
prop: "name"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
label: "属性描述",
|
|
403
|
+
prop: "desc"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
label: "操作",
|
|
407
|
+
fixed: "right",
|
|
408
|
+
actions: [
|
|
409
|
+
{
|
|
410
|
+
text: "编辑",
|
|
411
|
+
handler: (row, index) => {
|
|
412
|
+
if (!addDialog.value)
|
|
413
|
+
return;
|
|
414
|
+
fieldValues.value = {
|
|
415
|
+
...row,
|
|
416
|
+
index
|
|
417
|
+
};
|
|
418
|
+
filedTitle.value = `编辑${row.title}`;
|
|
419
|
+
addDialog.value.dialogVisible = true;
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
text: "删除",
|
|
424
|
+
buttonType: "danger",
|
|
425
|
+
handler: async (row, index) => {
|
|
426
|
+
await design.tMagicMessageBox.confirm(`确定删除${row.title}(${row.name})?`, "提示");
|
|
427
|
+
props.model[props.name].splice(index, 1);
|
|
428
|
+
emit("change", props.model[props.name]);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
}
|
|
433
|
+
];
|
|
434
|
+
const dataSourceFieldsConfig = [
|
|
435
|
+
{ name: "index", type: "hidden", filter: "number", defaultValue: -1 },
|
|
436
|
+
{
|
|
437
|
+
name: "type",
|
|
438
|
+
text: "数据类型",
|
|
439
|
+
type: "select",
|
|
440
|
+
defaultValue: "string",
|
|
441
|
+
options: [
|
|
442
|
+
{ text: "字符串", value: "string" },
|
|
443
|
+
{ text: "数字", value: "number" },
|
|
444
|
+
{ text: "布尔值", value: "boolean" },
|
|
445
|
+
{ text: "对象", value: "object" },
|
|
446
|
+
{ text: "数组", value: "array" },
|
|
447
|
+
{ text: "null", value: "null" },
|
|
448
|
+
{ text: "any", value: "any" }
|
|
449
|
+
]
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: "name",
|
|
453
|
+
text: "字段名称",
|
|
454
|
+
rules: [
|
|
455
|
+
{
|
|
456
|
+
required: true,
|
|
457
|
+
message: "请输入字段名称"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
validator: ({ value, callback }, { model, parent }) => {
|
|
461
|
+
const index = parent.findIndex((item) => item.name === value);
|
|
462
|
+
if (model.index === -1 && index > -1 || model.index > -1 && index !== model.index) {
|
|
463
|
+
return callback(`属性key(${value})已存在`);
|
|
464
|
+
}
|
|
465
|
+
callback();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
name: "title",
|
|
472
|
+
text: "展示名称",
|
|
473
|
+
rules: [
|
|
474
|
+
{
|
|
475
|
+
required: true,
|
|
476
|
+
message: "请输入展示名称"
|
|
477
|
+
}
|
|
478
|
+
]
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: "description",
|
|
482
|
+
text: "描述"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "defaultValue",
|
|
486
|
+
text: "默认值"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: "enable",
|
|
490
|
+
text: "是否可用",
|
|
491
|
+
type: "switch",
|
|
492
|
+
defaultValue: true
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: "fields",
|
|
496
|
+
type: "data-source-fields",
|
|
497
|
+
defaultValue: [],
|
|
498
|
+
display: (formState, { model }) => model.type === "object"
|
|
499
|
+
}
|
|
500
|
+
];
|
|
501
|
+
return (_ctx, _cache) => {
|
|
502
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
503
|
+
vue.createVNode(vue.unref(table.MagicTable), {
|
|
504
|
+
data: __props.model[__props.name],
|
|
505
|
+
columns: filedColumns
|
|
506
|
+
}, null, 8, ["data"]),
|
|
507
|
+
vue.createElementVNode("div", _hoisted_2$d, [
|
|
508
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
509
|
+
size: "small",
|
|
510
|
+
type: "primary",
|
|
511
|
+
disabled: __props.disabled,
|
|
512
|
+
plain: "",
|
|
513
|
+
onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
|
|
514
|
+
}, {
|
|
515
|
+
default: vue.withCtx(() => [
|
|
516
|
+
_hoisted_3$8
|
|
517
|
+
]),
|
|
518
|
+
_: 1
|
|
519
|
+
}, 8, ["disabled"])
|
|
520
|
+
]),
|
|
521
|
+
vue.createVNode(vue.unref(form.MFormDialog), {
|
|
522
|
+
ref_key: "addDialog",
|
|
523
|
+
ref: addDialog,
|
|
524
|
+
title: filedTitle.value,
|
|
525
|
+
config: dataSourceFieldsConfig,
|
|
526
|
+
values: fieldValues.value,
|
|
527
|
+
parentValues: __props.model[__props.name],
|
|
528
|
+
onSubmit: fieldChange
|
|
529
|
+
}, null, 8, ["title", "values", "parentValues"])
|
|
530
|
+
]);
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
const _hoisted_1$k = { class: "m-fields-event-select" };
|
|
536
|
+
const _hoisted_2$c = {
|
|
357
537
|
key: 1,
|
|
358
538
|
class: "fullWidth"
|
|
359
539
|
};
|
|
360
|
-
const _hoisted_3$
|
|
361
|
-
const __default__$
|
|
540
|
+
const _hoisted_3$7 = /* @__PURE__ */ vue.createTextVNode("添加事件");
|
|
541
|
+
const __default__$r = vue.defineComponent({
|
|
362
542
|
name: "MEditorEventSelect"
|
|
363
543
|
});
|
|
364
|
-
const _sfc_main$
|
|
365
|
-
...__default__$
|
|
544
|
+
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
545
|
+
...__default__$r,
|
|
366
546
|
props: {
|
|
367
547
|
config: null,
|
|
368
548
|
model: null,
|
|
@@ -441,6 +621,7 @@
|
|
|
441
621
|
const codeActionConfig = vue.computed(() => {
|
|
442
622
|
const defaultCodeActionConfig = {
|
|
443
623
|
type: "code-select-col",
|
|
624
|
+
labelWidth: 0,
|
|
444
625
|
display: (mForm, { model }) => model.actionType === schema.ActionType.CODE
|
|
445
626
|
};
|
|
446
627
|
return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
|
|
@@ -518,7 +699,7 @@
|
|
|
518
699
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
519
700
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
520
701
|
const _component_m_form_panel = vue.resolveComponent("m-form-panel");
|
|
521
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
702
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
|
|
522
703
|
vue.unref(isOldVersion) ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
523
704
|
key: 0,
|
|
524
705
|
ref: "eventForm",
|
|
@@ -527,7 +708,7 @@
|
|
|
527
708
|
name: "events",
|
|
528
709
|
config: vue.unref(tableConfig),
|
|
529
710
|
onChange: onChangeHandler
|
|
530
|
-
}, null, 8, ["size", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
711
|
+
}, null, 8, ["size", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
|
|
531
712
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
532
713
|
class: "create-button",
|
|
533
714
|
type: "primary",
|
|
@@ -535,7 +716,7 @@
|
|
|
535
716
|
onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
|
|
536
717
|
}, {
|
|
537
718
|
default: vue.withCtx(() => [
|
|
538
|
-
_hoisted_3$
|
|
719
|
+
_hoisted_3$7
|
|
539
720
|
]),
|
|
540
721
|
_: 1
|
|
541
722
|
}),
|
|
@@ -569,12 +750,106 @@
|
|
|
569
750
|
}
|
|
570
751
|
});
|
|
571
752
|
|
|
572
|
-
const _hoisted_1$
|
|
573
|
-
const
|
|
753
|
+
const _hoisted_1$j = { class: "m-fields-key-value" };
|
|
754
|
+
const _hoisted_2$b = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
755
|
+
const _hoisted_3$6 = /* @__PURE__ */ vue.createTextVNode("添加");
|
|
756
|
+
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
757
|
+
__name: "KeyValue",
|
|
758
|
+
props: {
|
|
759
|
+
config: null,
|
|
760
|
+
model: null,
|
|
761
|
+
name: null,
|
|
762
|
+
prop: null,
|
|
763
|
+
disabled: { type: Boolean, default: false },
|
|
764
|
+
lastValues: null,
|
|
765
|
+
size: null
|
|
766
|
+
},
|
|
767
|
+
emits: ["change"],
|
|
768
|
+
setup(__props, { emit }) {
|
|
769
|
+
const props = __props;
|
|
770
|
+
const records = vue.ref([]);
|
|
771
|
+
vue.watchEffect(() => {
|
|
772
|
+
records.value = Object.entries(props.model[props.name] || {});
|
|
773
|
+
});
|
|
774
|
+
const getValue = () => {
|
|
775
|
+
const record = {};
|
|
776
|
+
records.value.forEach(([key, value]) => {
|
|
777
|
+
if (key) {
|
|
778
|
+
record[key] = value;
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
return record;
|
|
782
|
+
};
|
|
783
|
+
const keyChangeHandler = () => {
|
|
784
|
+
emit("change", getValue());
|
|
785
|
+
};
|
|
786
|
+
const valueChangeHandler = () => {
|
|
787
|
+
emit("change", getValue());
|
|
788
|
+
};
|
|
789
|
+
const addHandler = () => {
|
|
790
|
+
records.value.push(["", ""]);
|
|
791
|
+
};
|
|
792
|
+
const deleteHandler = (index) => {
|
|
793
|
+
records.value.splice(index, 1);
|
|
794
|
+
};
|
|
795
|
+
return (_ctx, _cache) => {
|
|
796
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
|
|
797
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
|
|
798
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
799
|
+
class: "m-fields-key-value-item",
|
|
800
|
+
key: index
|
|
801
|
+
}, [
|
|
802
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
803
|
+
placeholder: "key",
|
|
804
|
+
modelValue: records.value[index][0],
|
|
805
|
+
"onUpdate:modelValue": ($event) => records.value[index][0] = $event,
|
|
806
|
+
disabled: __props.disabled,
|
|
807
|
+
size: __props.size,
|
|
808
|
+
onChange: keyChangeHandler
|
|
809
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
810
|
+
_hoisted_2$b,
|
|
811
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
812
|
+
placeholder: "value",
|
|
813
|
+
modelValue: records.value[index][1],
|
|
814
|
+
"onUpdate:modelValue": ($event) => records.value[index][1] = $event,
|
|
815
|
+
disabled: __props.disabled,
|
|
816
|
+
size: __props.size,
|
|
817
|
+
onChange: valueChangeHandler
|
|
818
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
819
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
820
|
+
class: "m-fileds-key-value-delete",
|
|
821
|
+
type: "danger",
|
|
822
|
+
size: __props.size,
|
|
823
|
+
circle: "",
|
|
824
|
+
plain: "",
|
|
825
|
+
icon: vue.unref(iconsVue.Delete),
|
|
826
|
+
onClick: ($event) => deleteHandler(index)
|
|
827
|
+
}, null, 8, ["size", "icon", "onClick"])
|
|
828
|
+
]);
|
|
829
|
+
}), 128)),
|
|
830
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
831
|
+
type: "primary",
|
|
832
|
+
size: __props.size,
|
|
833
|
+
plain: "",
|
|
834
|
+
icon: vue.unref(iconsVue.Plus),
|
|
835
|
+
onClick: addHandler
|
|
836
|
+
}, {
|
|
837
|
+
default: vue.withCtx(() => [
|
|
838
|
+
_hoisted_3$6
|
|
839
|
+
]),
|
|
840
|
+
_: 1
|
|
841
|
+
}, 8, ["size", "icon"])
|
|
842
|
+
]);
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
const _hoisted_1$i = /* @__PURE__ */ vue.createTextVNode("取消");
|
|
848
|
+
const __default__$q = vue.defineComponent({
|
|
574
849
|
name: "MEditorUISelect"
|
|
575
850
|
});
|
|
576
|
-
const _sfc_main$
|
|
577
|
-
...__default__$
|
|
851
|
+
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
852
|
+
...__default__$q,
|
|
578
853
|
props: {
|
|
579
854
|
config: null,
|
|
580
855
|
model: null,
|
|
@@ -636,7 +911,7 @@
|
|
|
636
911
|
style: { "padding": "0" }
|
|
637
912
|
}, {
|
|
638
913
|
default: vue.withCtx(() => [
|
|
639
|
-
_hoisted_1$
|
|
914
|
+
_hoisted_1$i
|
|
640
915
|
]),
|
|
641
916
|
_: 1
|
|
642
917
|
}, 8, ["icon"])
|
|
@@ -684,11 +959,11 @@
|
|
|
684
959
|
|
|
685
960
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
686
961
|
|
|
687
|
-
const __default__$
|
|
962
|
+
const __default__$p = vue.defineComponent({
|
|
688
963
|
name: "MEditorCodeEditor"
|
|
689
964
|
});
|
|
690
|
-
const _sfc_main$
|
|
691
|
-
...__default__$
|
|
965
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
966
|
+
...__default__$p,
|
|
692
967
|
props: {
|
|
693
968
|
initValues: null,
|
|
694
969
|
modifiedValues: null,
|
|
@@ -817,11 +1092,11 @@
|
|
|
817
1092
|
};
|
|
818
1093
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
819
1094
|
|
|
820
|
-
const __default__$
|
|
1095
|
+
const __default__$o = vue.defineComponent({
|
|
821
1096
|
name: "MEditorResizer"
|
|
822
1097
|
});
|
|
823
|
-
const _sfc_main$
|
|
824
|
-
...__default__$
|
|
1098
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
1099
|
+
...__default__$o,
|
|
825
1100
|
emits: ["change"],
|
|
826
1101
|
setup(__props, { emit }) {
|
|
827
1102
|
const target = vue.ref();
|
|
@@ -853,11 +1128,11 @@
|
|
|
853
1128
|
}
|
|
854
1129
|
});
|
|
855
1130
|
|
|
856
|
-
const __default__$
|
|
1131
|
+
const __default__$n = vue.defineComponent({
|
|
857
1132
|
name: "MEditorLayout"
|
|
858
1133
|
});
|
|
859
|
-
const _sfc_main$
|
|
860
|
-
...__default__$
|
|
1134
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
1135
|
+
...__default__$n,
|
|
861
1136
|
props: {
|
|
862
1137
|
left: null,
|
|
863
1138
|
right: null,
|
|
@@ -965,7 +1240,7 @@
|
|
|
965
1240
|
}, [
|
|
966
1241
|
vue.renderSlot(_ctx.$slots, "left")
|
|
967
1242
|
], 6),
|
|
968
|
-
vue.createVNode(_sfc_main$
|
|
1243
|
+
vue.createVNode(_sfc_main$t, { onChange: changeLeft })
|
|
969
1244
|
], 64)) : vue.createCommentVNode("", true),
|
|
970
1245
|
vue.createElementVNode("div", {
|
|
971
1246
|
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -974,7 +1249,7 @@
|
|
|
974
1249
|
vue.renderSlot(_ctx.$slots, "center")
|
|
975
1250
|
], 6),
|
|
976
1251
|
vue.unref(hasRight) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
977
|
-
vue.createVNode(_sfc_main$
|
|
1252
|
+
vue.createVNode(_sfc_main$t, { onChange: changeRight }),
|
|
978
1253
|
vue.createElementVNode("div", {
|
|
979
1254
|
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
980
1255
|
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -987,7 +1262,7 @@
|
|
|
987
1262
|
}
|
|
988
1263
|
});
|
|
989
1264
|
|
|
990
|
-
const fillConfig = (config = []) => [
|
|
1265
|
+
const fillConfig$1 = (config = []) => [
|
|
991
1266
|
{
|
|
992
1267
|
type: "tab",
|
|
993
1268
|
items: [
|
|
@@ -1143,7 +1418,8 @@
|
|
|
1143
1418
|
items: [
|
|
1144
1419
|
{
|
|
1145
1420
|
name: "events",
|
|
1146
|
-
type: "event-select"
|
|
1421
|
+
type: "event-select",
|
|
1422
|
+
labelWidth: 0
|
|
1147
1423
|
}
|
|
1148
1424
|
]
|
|
1149
1425
|
},
|
|
@@ -1773,7 +2049,7 @@
|
|
|
1773
2049
|
this.emit("props-configs-change");
|
|
1774
2050
|
}
|
|
1775
2051
|
async fillConfig(config) {
|
|
1776
|
-
return fillConfig(config);
|
|
2052
|
+
return fillConfig$1(config);
|
|
1777
2053
|
}
|
|
1778
2054
|
/**
|
|
1779
2055
|
* 为指定类型组件设置组件属性表单配置
|
|
@@ -2840,14 +3116,14 @@
|
|
|
2840
3116
|
return stage;
|
|
2841
3117
|
};
|
|
2842
3118
|
|
|
2843
|
-
const _hoisted_1$
|
|
2844
|
-
const _hoisted_2$
|
|
2845
|
-
const _hoisted_3$
|
|
2846
|
-
const __default__$
|
|
3119
|
+
const _hoisted_1$h = { class: "m-editor-empty-panel" };
|
|
3120
|
+
const _hoisted_2$a = { class: "m-editor-empty-content" };
|
|
3121
|
+
const _hoisted_3$5 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
3122
|
+
const __default__$m = vue.defineComponent({
|
|
2847
3123
|
name: "MEditorAddPageBox"
|
|
2848
3124
|
});
|
|
2849
|
-
const _sfc_main$
|
|
2850
|
-
...__default__$
|
|
3125
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
3126
|
+
...__default__$m,
|
|
2851
3127
|
setup(__props) {
|
|
2852
3128
|
const services = vue.inject("services");
|
|
2853
3129
|
const clickHandler = () => {
|
|
@@ -2863,16 +3139,16 @@
|
|
|
2863
3139
|
});
|
|
2864
3140
|
};
|
|
2865
3141
|
return (_ctx, _cache) => {
|
|
2866
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2867
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
3142
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
|
|
3143
|
+
vue.createElementVNode("div", _hoisted_2$a, [
|
|
2868
3144
|
vue.createElementVNode("div", {
|
|
2869
3145
|
class: "m-editor-empty-button",
|
|
2870
3146
|
onClick: clickHandler
|
|
2871
3147
|
}, [
|
|
2872
3148
|
vue.createElementVNode("div", null, [
|
|
2873
|
-
vue.createVNode(_sfc_main$
|
|
3149
|
+
vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2874
3150
|
]),
|
|
2875
|
-
_hoisted_3$
|
|
3151
|
+
_hoisted_3$5
|
|
2876
3152
|
])
|
|
2877
3153
|
])
|
|
2878
3154
|
]);
|
|
@@ -2880,12 +3156,12 @@
|
|
|
2880
3156
|
}
|
|
2881
3157
|
});
|
|
2882
3158
|
|
|
2883
|
-
const _hoisted_1$
|
|
2884
|
-
const __default__$
|
|
3159
|
+
const _hoisted_1$g = { class: "m-editor" };
|
|
3160
|
+
const __default__$l = vue.defineComponent({
|
|
2885
3161
|
name: "MEditorFramework"
|
|
2886
3162
|
});
|
|
2887
|
-
const _sfc_main$
|
|
2888
|
-
...__default__$
|
|
3163
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
3164
|
+
...__default__$l,
|
|
2889
3165
|
props: {
|
|
2890
3166
|
codeOptions: { default: () => ({}) }
|
|
2891
3167
|
},
|
|
@@ -2954,7 +3230,7 @@
|
|
|
2954
3230
|
};
|
|
2955
3231
|
return (_ctx, _cache) => {
|
|
2956
3232
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2957
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3233
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
2958
3234
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2959
3235
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2960
3236
|
key: 0,
|
|
@@ -2962,7 +3238,7 @@
|
|
|
2962
3238
|
"init-values": vue.unref(root),
|
|
2963
3239
|
options: __props.codeOptions,
|
|
2964
3240
|
onSave: saveCode
|
|
2965
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3241
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
2966
3242
|
key: 1,
|
|
2967
3243
|
class: "m-editor-content",
|
|
2968
3244
|
"left-class": "m-editor-framework-left",
|
|
@@ -2981,7 +3257,7 @@
|
|
|
2981
3257
|
]),
|
|
2982
3258
|
center: vue.withCtx(() => [
|
|
2983
3259
|
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2984
|
-
vue.createVNode(_sfc_main$
|
|
3260
|
+
vue.createVNode(_sfc_main$r)
|
|
2985
3261
|
])
|
|
2986
3262
|
]),
|
|
2987
3263
|
_: 2
|
|
@@ -3003,16 +3279,16 @@
|
|
|
3003
3279
|
}
|
|
3004
3280
|
});
|
|
3005
3281
|
|
|
3006
|
-
const _hoisted_1$
|
|
3282
|
+
const _hoisted_1$f = {
|
|
3007
3283
|
key: 1,
|
|
3008
3284
|
class: "menu-item-text"
|
|
3009
3285
|
};
|
|
3010
|
-
const _hoisted_2$
|
|
3011
|
-
const __default__$
|
|
3286
|
+
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
3287
|
+
const __default__$k = vue.defineComponent({
|
|
3012
3288
|
name: "MEditorToolButton"
|
|
3013
3289
|
});
|
|
3014
|
-
const _sfc_main$
|
|
3015
|
-
...__default__$
|
|
3290
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
3291
|
+
...__default__$k,
|
|
3016
3292
|
props: {
|
|
3017
3293
|
data: { default: () => ({
|
|
3018
3294
|
type: "text",
|
|
@@ -3087,7 +3363,7 @@
|
|
|
3087
3363
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
3088
3364
|
key: 0,
|
|
3089
3365
|
direction: __props.data.direction || "vertical"
|
|
3090
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3366
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
3091
3367
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3092
3368
|
key: 0,
|
|
3093
3369
|
effect: "dark",
|
|
@@ -3101,7 +3377,7 @@
|
|
|
3101
3377
|
disabled: vue.unref(disabled)
|
|
3102
3378
|
}, {
|
|
3103
3379
|
default: vue.withCtx(() => [
|
|
3104
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3380
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
|
|
3105
3381
|
key: 0,
|
|
3106
3382
|
icon: __props.data.icon
|
|
3107
3383
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -3118,7 +3394,7 @@
|
|
|
3118
3394
|
disabled: vue.unref(disabled)
|
|
3119
3395
|
}, {
|
|
3120
3396
|
default: vue.withCtx(() => [
|
|
3121
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3397
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
|
|
3122
3398
|
key: 0,
|
|
3123
3399
|
icon: __props.data.icon
|
|
3124
3400
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -3151,7 +3427,7 @@
|
|
|
3151
3427
|
})) : vue.createCommentVNode("", true)
|
|
3152
3428
|
]),
|
|
3153
3429
|
default: vue.withCtx(() => [
|
|
3154
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
3430
|
+
vue.createElementVNode("span", _hoisted_2$9, [
|
|
3155
3431
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
3156
3432
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
3157
3433
|
default: vue.withCtx(() => [
|
|
@@ -3168,11 +3444,11 @@
|
|
|
3168
3444
|
}
|
|
3169
3445
|
});
|
|
3170
3446
|
|
|
3171
|
-
const __default__$
|
|
3447
|
+
const __default__$j = vue.defineComponent({
|
|
3172
3448
|
name: "MEditorNavMenu"
|
|
3173
3449
|
});
|
|
3174
|
-
const _sfc_main$
|
|
3175
|
-
...__default__$
|
|
3450
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
3451
|
+
...__default__$j,
|
|
3176
3452
|
props: {
|
|
3177
3453
|
data: { default: () => ({}) },
|
|
3178
3454
|
height: { default: 35 }
|
|
@@ -3330,7 +3606,7 @@
|
|
|
3330
3606
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3331
3607
|
}, [
|
|
3332
3608
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3333
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3609
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
3334
3610
|
data: item,
|
|
3335
3611
|
key: index
|
|
3336
3612
|
}, null, 8, ["data"]);
|
|
@@ -3342,12 +3618,12 @@
|
|
|
3342
3618
|
}
|
|
3343
3619
|
});
|
|
3344
3620
|
|
|
3345
|
-
const _hoisted_1$
|
|
3346
|
-
const __default__$
|
|
3621
|
+
const _hoisted_1$e = { class: "m-editor-props-panel" };
|
|
3622
|
+
const __default__$i = vue.defineComponent({
|
|
3347
3623
|
name: "MEditorPropsPanel"
|
|
3348
3624
|
});
|
|
3349
|
-
const _sfc_main$
|
|
3350
|
-
...__default__$
|
|
3625
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
3626
|
+
...__default__$i,
|
|
3351
3627
|
emits: ["mounted"],
|
|
3352
3628
|
setup(__props, { expose, emit }) {
|
|
3353
3629
|
const internalInstance = vue.getCurrentInstance();
|
|
@@ -3392,7 +3668,7 @@
|
|
|
3392
3668
|
};
|
|
3393
3669
|
expose({ submit });
|
|
3394
3670
|
return (_ctx, _cache) => {
|
|
3395
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3671
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
3396
3672
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3397
3673
|
vue.createVNode(vue.unref(form.MForm), {
|
|
3398
3674
|
ref_key: "configForm",
|
|
@@ -3409,7 +3685,7 @@
|
|
|
3409
3685
|
}
|
|
3410
3686
|
});
|
|
3411
3687
|
|
|
3412
|
-
const _sfc_main$
|
|
3688
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
3413
3689
|
__name: "SearchInput",
|
|
3414
3690
|
emits: ["search"],
|
|
3415
3691
|
setup(__props, { emit }) {
|
|
@@ -3449,10 +3725,10 @@
|
|
|
3449
3725
|
return target;
|
|
3450
3726
|
};
|
|
3451
3727
|
|
|
3452
|
-
const _sfc_main$
|
|
3728
|
+
const _sfc_main$l = {};
|
|
3453
3729
|
|
|
3454
|
-
const _hoisted_1$
|
|
3455
|
-
const _hoisted_2$
|
|
3730
|
+
const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
|
|
3731
|
+
const _hoisted_2$8 = /*#__PURE__*/vue.createElementVNode("g", {
|
|
3456
3732
|
fill: "#7C878E",
|
|
3457
3733
|
"fill-rule": "evenodd"
|
|
3458
3734
|
}, [
|
|
@@ -3462,49 +3738,49 @@
|
|
|
3462
3738
|
}),
|
|
3463
3739
|
/*#__PURE__*/vue.createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
3464
3740
|
], -1);
|
|
3465
|
-
const _hoisted_3$
|
|
3466
|
-
_hoisted_2$
|
|
3741
|
+
const _hoisted_3$4 = [
|
|
3742
|
+
_hoisted_2$8
|
|
3467
3743
|
];
|
|
3468
3744
|
|
|
3469
3745
|
function _sfc_render$2(_ctx, _cache) {
|
|
3470
|
-
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
3746
|
+
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_3$4))
|
|
3471
3747
|
}
|
|
3472
|
-
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$
|
|
3748
|
+
const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$l, [['render',_sfc_render$2]]);
|
|
3473
3749
|
|
|
3474
|
-
const _sfc_main$
|
|
3750
|
+
const _sfc_main$k = {};
|
|
3475
3751
|
|
|
3476
|
-
const _hoisted_1$
|
|
3752
|
+
const _hoisted_1$c = {
|
|
3477
3753
|
viewBox: "0 0 32 32",
|
|
3478
3754
|
version: "1.1",
|
|
3479
3755
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3480
3756
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3481
3757
|
};
|
|
3482
|
-
const _hoisted_2$
|
|
3483
|
-
const _hoisted_4$
|
|
3484
|
-
_hoisted_2$
|
|
3758
|
+
const _hoisted_2$7 = /*#__PURE__*/vue.createStaticVNode("<defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 2);
|
|
3759
|
+
const _hoisted_4$4 = [
|
|
3760
|
+
_hoisted_2$7
|
|
3485
3761
|
];
|
|
3486
3762
|
|
|
3487
3763
|
function _sfc_render$1(_ctx, _cache) {
|
|
3488
|
-
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
3764
|
+
return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$c, _hoisted_4$4))
|
|
3489
3765
|
}
|
|
3490
|
-
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$
|
|
3766
|
+
const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$k, [['render',_sfc_render$1]]);
|
|
3491
3767
|
|
|
3492
|
-
const _hoisted_1$
|
|
3768
|
+
const _hoisted_1$b = {
|
|
3493
3769
|
key: 0,
|
|
3494
3770
|
class: "m-editor-content-bottom"
|
|
3495
3771
|
};
|
|
3496
|
-
const _hoisted_2$
|
|
3497
|
-
const _hoisted_3$
|
|
3498
|
-
const _hoisted_4$
|
|
3772
|
+
const _hoisted_2$6 = /* @__PURE__ */ vue.createTextVNode("确认");
|
|
3773
|
+
const _hoisted_3$3 = /* @__PURE__ */ vue.createTextVNode("关闭");
|
|
3774
|
+
const _hoisted_4$3 = {
|
|
3499
3775
|
key: 1,
|
|
3500
3776
|
class: "m-editor-content-bottom"
|
|
3501
3777
|
};
|
|
3502
|
-
const _hoisted_5$
|
|
3503
|
-
const __default__$
|
|
3778
|
+
const _hoisted_5$2 = /* @__PURE__ */ vue.createTextVNode("关闭");
|
|
3779
|
+
const __default__$h = vue.defineComponent({
|
|
3504
3780
|
name: "MEditorCodeDraftEditor"
|
|
3505
3781
|
});
|
|
3506
|
-
const _sfc_main$
|
|
3507
|
-
...__default__$
|
|
3782
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
3783
|
+
...__default__$h,
|
|
3508
3784
|
props: {
|
|
3509
3785
|
id: null,
|
|
3510
3786
|
content: null,
|
|
@@ -3587,7 +3863,7 @@
|
|
|
3587
3863
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3588
3864
|
class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3589
3865
|
}, [
|
|
3590
|
-
vue.createVNode(_sfc_main$
|
|
3866
|
+
vue.createVNode(_sfc_main$u, {
|
|
3591
3867
|
ref_key: "codeEditor",
|
|
3592
3868
|
ref: codeEditor,
|
|
3593
3869
|
class: "m-editor-container",
|
|
@@ -3596,7 +3872,7 @@
|
|
|
3596
3872
|
language: __props.language,
|
|
3597
3873
|
options: vue.unref(codeOptions)
|
|
3598
3874
|
}, null, 8, ["init-values", "language", "options"]),
|
|
3599
|
-
__props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3875
|
+
__props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
3600
3876
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3601
3877
|
type: "primary",
|
|
3602
3878
|
class: "button",
|
|
@@ -3613,21 +3889,20 @@
|
|
|
3613
3889
|
onClick: saveAndClose
|
|
3614
3890
|
}, {
|
|
3615
3891
|
default: vue.withCtx(() => [
|
|
3616
|
-
_hoisted_2$
|
|
3892
|
+
_hoisted_2$6
|
|
3617
3893
|
]),
|
|
3618
3894
|
_: 1
|
|
3619
3895
|
}),
|
|
3620
3896
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3621
|
-
type: "primary",
|
|
3622
3897
|
class: "button",
|
|
3623
3898
|
onClick: close
|
|
3624
3899
|
}, {
|
|
3625
3900
|
default: vue.withCtx(() => [
|
|
3626
|
-
_hoisted_3$
|
|
3901
|
+
_hoisted_3$3
|
|
3627
3902
|
]),
|
|
3628
3903
|
_: 1
|
|
3629
3904
|
})
|
|
3630
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$
|
|
3905
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$3, [
|
|
3631
3906
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3632
3907
|
type: "primary",
|
|
3633
3908
|
class: "button",
|
|
@@ -3639,12 +3914,11 @@
|
|
|
3639
3914
|
_: 1
|
|
3640
3915
|
}),
|
|
3641
3916
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3642
|
-
type: "primary",
|
|
3643
3917
|
class: "button",
|
|
3644
3918
|
onClick: close
|
|
3645
3919
|
}, {
|
|
3646
3920
|
default: vue.withCtx(() => [
|
|
3647
|
-
_hoisted_5$
|
|
3921
|
+
_hoisted_5$2
|
|
3648
3922
|
]),
|
|
3649
3923
|
_: 1
|
|
3650
3924
|
})
|
|
@@ -3654,15 +3928,15 @@
|
|
|
3654
3928
|
}
|
|
3655
3929
|
});
|
|
3656
3930
|
|
|
3657
|
-
const _hoisted_1$
|
|
3658
|
-
const _hoisted_2$
|
|
3659
|
-
const _hoisted_3$
|
|
3660
|
-
const _hoisted_4$
|
|
3661
|
-
const __default__$
|
|
3931
|
+
const _hoisted_1$a = { class: "code-name-wrapper" };
|
|
3932
|
+
const _hoisted_2$5 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
3933
|
+
const _hoisted_3$2 = { class: "code-name-wrapper" };
|
|
3934
|
+
const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
3935
|
+
const __default__$g = vue.defineComponent({
|
|
3662
3936
|
name: "MEditorFunctionEditor"
|
|
3663
3937
|
});
|
|
3664
|
-
const _sfc_main$
|
|
3665
|
-
...__default__$
|
|
3938
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
3939
|
+
...__default__$g,
|
|
3666
3940
|
props: {
|
|
3667
3941
|
id: null,
|
|
3668
3942
|
name: null,
|
|
@@ -3780,8 +4054,8 @@
|
|
|
3780
4054
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
3781
4055
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
3782
4056
|
header: vue.withCtx(() => [
|
|
3783
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
3784
|
-
_hoisted_2$
|
|
4057
|
+
vue.createElementVNode("div", _hoisted_1$a, [
|
|
4058
|
+
_hoisted_2$5,
|
|
3785
4059
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3786
4060
|
class: "code-name-input",
|
|
3787
4061
|
modelValue: codeName.value,
|
|
@@ -3789,8 +4063,8 @@
|
|
|
3789
4063
|
disabled: !__props.editable
|
|
3790
4064
|
}, null, 8, ["modelValue", "disabled"])
|
|
3791
4065
|
]),
|
|
3792
|
-
vue.createElementVNode("div", _hoisted_3$
|
|
3793
|
-
_hoisted_4$
|
|
4066
|
+
vue.createElementVNode("div", _hoisted_3$2, [
|
|
4067
|
+
_hoisted_4$2,
|
|
3794
4068
|
vue.createVNode(_component_m_form_table, {
|
|
3795
4069
|
style: { "width": "800px" },
|
|
3796
4070
|
config: tableConfig,
|
|
@@ -3803,7 +4077,7 @@
|
|
|
3803
4077
|
])
|
|
3804
4078
|
]),
|
|
3805
4079
|
default: vue.withCtx(() => [
|
|
3806
|
-
vue.createVNode(_sfc_main$
|
|
4080
|
+
vue.createVNode(_sfc_main$j, {
|
|
3807
4081
|
ref_key: "codeDraftEditor",
|
|
3808
4082
|
ref: codeDraftEditor,
|
|
3809
4083
|
id: __props.id,
|
|
@@ -3822,15 +4096,15 @@
|
|
|
3822
4096
|
}
|
|
3823
4097
|
});
|
|
3824
4098
|
|
|
3825
|
-
const _hoisted_1$
|
|
4099
|
+
const _hoisted_1$9 = {
|
|
3826
4100
|
key: 0,
|
|
3827
4101
|
class: "m-editor-code-block-editor-panel"
|
|
3828
4102
|
};
|
|
3829
|
-
const __default__$
|
|
4103
|
+
const __default__$f = vue.defineComponent({
|
|
3830
4104
|
name: "MEditorCodeBlockEditor"
|
|
3831
4105
|
});
|
|
3832
|
-
const _sfc_main$
|
|
3833
|
-
...__default__$
|
|
4106
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
4107
|
+
...__default__$f,
|
|
3834
4108
|
props: {
|
|
3835
4109
|
paramsColConfig: null
|
|
3836
4110
|
},
|
|
@@ -3883,16 +4157,16 @@
|
|
|
3883
4157
|
"before-close": handleClose
|
|
3884
4158
|
}, {
|
|
3885
4159
|
default: vue.withCtx(() => [
|
|
3886
|
-
vue.createVNode(_sfc_main$
|
|
4160
|
+
vue.createVNode(_sfc_main$s, {
|
|
3887
4161
|
left: left.value,
|
|
3888
4162
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3889
4163
|
"min-left": 45,
|
|
3890
4164
|
class: "code-editor-layout"
|
|
3891
4165
|
}, {
|
|
3892
4166
|
center: vue.withCtx(() => [
|
|
3893
|
-
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4167
|
+
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
|
|
3894
4168
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3895
|
-
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4169
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
|
|
3896
4170
|
key: 0,
|
|
3897
4171
|
ref_key: "functionEditor",
|
|
3898
4172
|
ref: functionEditor,
|
|
@@ -3915,25 +4189,30 @@
|
|
|
3915
4189
|
}
|
|
3916
4190
|
});
|
|
3917
4191
|
|
|
3918
|
-
const _hoisted_1$
|
|
3919
|
-
const _hoisted_2$
|
|
3920
|
-
const _hoisted_3 = ["id"];
|
|
3921
|
-
const _hoisted_4 = { class: "list-item" };
|
|
3922
|
-
const _hoisted_5 = {
|
|
4192
|
+
const _hoisted_1$8 = { class: "search-wrapper" };
|
|
4193
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("新增");
|
|
4194
|
+
const _hoisted_3$1 = ["id"];
|
|
4195
|
+
const _hoisted_4$1 = { class: "list-item" };
|
|
4196
|
+
const _hoisted_5$1 = {
|
|
3923
4197
|
key: 2,
|
|
3924
4198
|
class: "right-tool"
|
|
3925
4199
|
};
|
|
3926
|
-
const __default__$
|
|
4200
|
+
const __default__$e = vue.defineComponent({
|
|
3927
4201
|
name: "MEditorCodeBlockList"
|
|
3928
4202
|
});
|
|
3929
|
-
const _sfc_main$
|
|
3930
|
-
...__default__$
|
|
4203
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
4204
|
+
...__default__$e,
|
|
3931
4205
|
props: {
|
|
3932
4206
|
customError: null,
|
|
3933
4207
|
paramsColConfig: null
|
|
3934
4208
|
},
|
|
3935
4209
|
setup(__props) {
|
|
3936
4210
|
const props = __props;
|
|
4211
|
+
const treeProps = {
|
|
4212
|
+
children: "children",
|
|
4213
|
+
label: "name",
|
|
4214
|
+
value: "id"
|
|
4215
|
+
};
|
|
3937
4216
|
const { codeBlockService, depService, editorService } = vue.inject("services") || {};
|
|
3938
4217
|
const codeList = vue.computed(
|
|
3939
4218
|
() => Object.values(depService?.targets["code-block"] || {}).map((target) => {
|
|
@@ -4014,8 +4293,8 @@
|
|
|
4014
4293
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
4015
4294
|
default: vue.withCtx(() => [
|
|
4016
4295
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
4017
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4018
|
-
vue.createVNode(_sfc_main$
|
|
4296
|
+
vue.createElementVNode("div", _hoisted_1$8, [
|
|
4297
|
+
vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4019
4298
|
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4020
4299
|
key: 0,
|
|
4021
4300
|
class: "create-code-button",
|
|
@@ -4024,7 +4303,7 @@
|
|
|
4024
4303
|
onClick: createCodeBlock
|
|
4025
4304
|
}, {
|
|
4026
4305
|
default: vue.withCtx(() => [
|
|
4027
|
-
_hoisted_2$
|
|
4306
|
+
_hoisted_2$4
|
|
4028
4307
|
]),
|
|
4029
4308
|
_: 1
|
|
4030
4309
|
})) : vue.createCommentVNode("", true)
|
|
@@ -4039,6 +4318,7 @@
|
|
|
4039
4318
|
"default-expanded-keys": vue.unref(expandedKeys),
|
|
4040
4319
|
"expand-on-click-node": false,
|
|
4041
4320
|
data: vue.unref(codeList),
|
|
4321
|
+
props: treeProps,
|
|
4042
4322
|
"highlight-current": true,
|
|
4043
4323
|
"filter-node-method": filterNode,
|
|
4044
4324
|
onNodeClick: clickHandler
|
|
@@ -4048,7 +4328,7 @@
|
|
|
4048
4328
|
id: data.id,
|
|
4049
4329
|
class: "list-container"
|
|
4050
4330
|
}, [
|
|
4051
|
-
vue.createElementVNode("div", _hoisted_4, [
|
|
4331
|
+
vue.createElementVNode("div", _hoisted_4$1, [
|
|
4052
4332
|
data.type === "code" ? (vue.openBlock(), vue.createBlock(CodeIcon, {
|
|
4053
4333
|
key: 0,
|
|
4054
4334
|
class: "codeIcon"
|
|
@@ -4060,14 +4340,14 @@
|
|
|
4060
4340
|
vue.createElementVNode("span", {
|
|
4061
4341
|
class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4062
4342
|
}, vue.toDisplayString(data.name) + " (" + vue.toDisplayString(data.id) + ")", 3),
|
|
4063
|
-
data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
4343
|
+
data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
|
|
4064
4344
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
4065
4345
|
effect: "dark",
|
|
4066
4346
|
content: vue.unref(editable) ? "编辑" : "查看",
|
|
4067
4347
|
placement: "bottom"
|
|
4068
4348
|
}, {
|
|
4069
4349
|
default: vue.withCtx(() => [
|
|
4070
|
-
vue.createVNode(_sfc_main$
|
|
4350
|
+
vue.createVNode(_sfc_main$A, {
|
|
4071
4351
|
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
4072
4352
|
class: "edit-icon",
|
|
4073
4353
|
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -4082,7 +4362,7 @@
|
|
|
4082
4362
|
placement: "bottom"
|
|
4083
4363
|
}, {
|
|
4084
4364
|
default: vue.withCtx(() => [
|
|
4085
|
-
vue.createVNode(_sfc_main$
|
|
4365
|
+
vue.createVNode(_sfc_main$A, {
|
|
4086
4366
|
icon: vue.unref(iconsVue.Close),
|
|
4087
4367
|
class: "edit-icon",
|
|
4088
4368
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -4096,11 +4376,11 @@
|
|
|
4096
4376
|
})
|
|
4097
4377
|
])) : vue.createCommentVNode("", true)
|
|
4098
4378
|
])
|
|
4099
|
-
], 8, _hoisted_3)
|
|
4379
|
+
], 8, _hoisted_3$1)
|
|
4100
4380
|
]),
|
|
4101
4381
|
_: 3
|
|
4102
4382
|
}, 8, ["default-expanded-keys", "data"]),
|
|
4103
|
-
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4383
|
+
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
|
|
4104
4384
|
key: 0,
|
|
4105
4385
|
paramsColConfig: __props.paramsColConfig
|
|
4106
4386
|
}, {
|
|
@@ -4116,6 +4396,263 @@
|
|
|
4116
4396
|
}
|
|
4117
4397
|
});
|
|
4118
4398
|
|
|
4399
|
+
const _hoisted_1$7 = /* @__PURE__ */ vue.createTextVNode("确定");
|
|
4400
|
+
const _hoisted_2$3 = /* @__PURE__ */ vue.createTextVNode("关闭");
|
|
4401
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
4402
|
+
__name: "DataSourceConfigPanel",
|
|
4403
|
+
props: {
|
|
4404
|
+
title: null,
|
|
4405
|
+
values: null
|
|
4406
|
+
},
|
|
4407
|
+
emits: ["submit"],
|
|
4408
|
+
setup(__props, { expose, emit }) {
|
|
4409
|
+
const props = __props;
|
|
4410
|
+
const type = vue.ref("base");
|
|
4411
|
+
const services = vue.inject("services");
|
|
4412
|
+
const size = vue.computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
4413
|
+
const dataSourceConfig = vue.computed(() => services?.dataSourceService.getFormConfig(type.value) || []);
|
|
4414
|
+
const form$1 = vue.ref();
|
|
4415
|
+
const initValues = vue.ref({});
|
|
4416
|
+
vue.watchEffect(() => {
|
|
4417
|
+
initValues.value = props.values;
|
|
4418
|
+
type.value = props.values.type || "base";
|
|
4419
|
+
});
|
|
4420
|
+
const changeHandler = (value) => {
|
|
4421
|
+
if (value.type === type.value) {
|
|
4422
|
+
return;
|
|
4423
|
+
}
|
|
4424
|
+
type.value = value.type || "base";
|
|
4425
|
+
initValues.value = value;
|
|
4426
|
+
};
|
|
4427
|
+
const submitHandler = async () => {
|
|
4428
|
+
try {
|
|
4429
|
+
const values = await form$1.value?.submitForm();
|
|
4430
|
+
emit("submit", values);
|
|
4431
|
+
} catch (error) {
|
|
4432
|
+
design.tMagicMessage.error(error.message);
|
|
4433
|
+
}
|
|
4434
|
+
};
|
|
4435
|
+
const visible = vue.ref(false);
|
|
4436
|
+
const hide = () => {
|
|
4437
|
+
visible.value = false;
|
|
4438
|
+
};
|
|
4439
|
+
expose({
|
|
4440
|
+
show() {
|
|
4441
|
+
visible.value = true;
|
|
4442
|
+
},
|
|
4443
|
+
hide
|
|
4444
|
+
});
|
|
4445
|
+
return (_ctx, _cache) => {
|
|
4446
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDrawer), {
|
|
4447
|
+
modelValue: visible.value,
|
|
4448
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
|
|
4449
|
+
title: __props.title,
|
|
4450
|
+
"close-on-press-escape": true,
|
|
4451
|
+
"append-to-body": true,
|
|
4452
|
+
"show-close": true,
|
|
4453
|
+
"close-on-click-modal": true,
|
|
4454
|
+
size: vue.unref(size)
|
|
4455
|
+
}, {
|
|
4456
|
+
footer: vue.withCtx(() => [
|
|
4457
|
+
vue.createElementVNode("div", null, [
|
|
4458
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4459
|
+
type: "primary",
|
|
4460
|
+
onClick: submitHandler
|
|
4461
|
+
}, {
|
|
4462
|
+
default: vue.withCtx(() => [
|
|
4463
|
+
_hoisted_1$7
|
|
4464
|
+
]),
|
|
4465
|
+
_: 1
|
|
4466
|
+
}),
|
|
4467
|
+
vue.createVNode(vue.unref(design.TMagicButton), { onClick: hide }, {
|
|
4468
|
+
default: vue.withCtx(() => [
|
|
4469
|
+
_hoisted_2$3
|
|
4470
|
+
]),
|
|
4471
|
+
_: 1
|
|
4472
|
+
})
|
|
4473
|
+
])
|
|
4474
|
+
]),
|
|
4475
|
+
default: vue.withCtx(() => [
|
|
4476
|
+
vue.createVNode(vue.unref(form.MForm), {
|
|
4477
|
+
ref_key: "form",
|
|
4478
|
+
ref: form$1,
|
|
4479
|
+
config: vue.unref(dataSourceConfig),
|
|
4480
|
+
"init-values": initValues.value,
|
|
4481
|
+
onChange: changeHandler
|
|
4482
|
+
}, null, 8, ["config", "init-values"])
|
|
4483
|
+
]),
|
|
4484
|
+
_: 1
|
|
4485
|
+
}, 8, ["modelValue", "title", "size"]);
|
|
4486
|
+
};
|
|
4487
|
+
}
|
|
4488
|
+
});
|
|
4489
|
+
|
|
4490
|
+
const _hoisted_1$6 = { class: "search-wrapper" };
|
|
4491
|
+
const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("新增");
|
|
4492
|
+
const _hoisted_3 = ["id"];
|
|
4493
|
+
const _hoisted_4 = { class: "list-item" };
|
|
4494
|
+
const _hoisted_5 = {
|
|
4495
|
+
key: 2,
|
|
4496
|
+
class: "right-tool"
|
|
4497
|
+
};
|
|
4498
|
+
const __default__$d = vue.defineComponent({
|
|
4499
|
+
name: "MEditorDataSourceListPanel"
|
|
4500
|
+
});
|
|
4501
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
4502
|
+
...__default__$d,
|
|
4503
|
+
setup(__props) {
|
|
4504
|
+
const services = vue.inject("services", {});
|
|
4505
|
+
const { dataSourceService, depService } = vue.inject("services") || {};
|
|
4506
|
+
const list = vue.computed(
|
|
4507
|
+
() => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
|
|
4508
|
+
id: target.id,
|
|
4509
|
+
name: target.name,
|
|
4510
|
+
type: "code",
|
|
4511
|
+
children: Object.entries(target.deps).map(([id, dep]) => ({
|
|
4512
|
+
name: dep.name,
|
|
4513
|
+
type: "node",
|
|
4514
|
+
id,
|
|
4515
|
+
children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
|
|
4516
|
+
}))
|
|
4517
|
+
}))
|
|
4518
|
+
);
|
|
4519
|
+
const editDialog = vue.ref();
|
|
4520
|
+
const dataSourceValues = vue.ref({});
|
|
4521
|
+
const addHandler = () => {
|
|
4522
|
+
if (!editDialog.value)
|
|
4523
|
+
return;
|
|
4524
|
+
dataSourceValues.value = {};
|
|
4525
|
+
editDialog.value.show();
|
|
4526
|
+
};
|
|
4527
|
+
const editHandler = (id) => {
|
|
4528
|
+
if (!editDialog.value || !services)
|
|
4529
|
+
return;
|
|
4530
|
+
dataSourceValues.value = {
|
|
4531
|
+
...dataSourceService?.getDataSourceById(id)
|
|
4532
|
+
};
|
|
4533
|
+
editDialog.value.show();
|
|
4534
|
+
};
|
|
4535
|
+
const removeHandler = async (id) => {
|
|
4536
|
+
await design.tMagicMessageBox.confirm("确定删除?", "提示", {
|
|
4537
|
+
confirmButtonText: "确定",
|
|
4538
|
+
cancelButtonText: "取消",
|
|
4539
|
+
type: "warning"
|
|
4540
|
+
});
|
|
4541
|
+
dataSourceService?.remove(id);
|
|
4542
|
+
};
|
|
4543
|
+
const submitDataSourceHandler = (value) => {
|
|
4544
|
+
if (!services)
|
|
4545
|
+
return;
|
|
4546
|
+
if (value.id) {
|
|
4547
|
+
dataSourceService?.update(value);
|
|
4548
|
+
} else {
|
|
4549
|
+
dataSourceService?.add(value);
|
|
4550
|
+
}
|
|
4551
|
+
editDialog.value?.hide();
|
|
4552
|
+
};
|
|
4553
|
+
const tree = vue.ref();
|
|
4554
|
+
const filterTextChangeHandler = (val) => {
|
|
4555
|
+
tree.value?.filter(val);
|
|
4556
|
+
};
|
|
4557
|
+
return (_ctx, _cache) => {
|
|
4558
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
4559
|
+
default: vue.withCtx(() => [
|
|
4560
|
+
vue.createElementVNode("div", _hoisted_1$6, [
|
|
4561
|
+
vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4562
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4563
|
+
type: "primary",
|
|
4564
|
+
size: "small",
|
|
4565
|
+
onClick: addHandler
|
|
4566
|
+
}, {
|
|
4567
|
+
default: vue.withCtx(() => [
|
|
4568
|
+
_hoisted_2$2
|
|
4569
|
+
]),
|
|
4570
|
+
_: 1
|
|
4571
|
+
})
|
|
4572
|
+
]),
|
|
4573
|
+
vue.createVNode(vue.unref(design.TMagicTree), {
|
|
4574
|
+
ref_key: "tree",
|
|
4575
|
+
ref: tree,
|
|
4576
|
+
class: "magic-editor-layer-tree",
|
|
4577
|
+
"node-key": "id",
|
|
4578
|
+
"empty-text": "暂无代码块",
|
|
4579
|
+
"default-expand-all": "",
|
|
4580
|
+
"expand-on-click-node": false,
|
|
4581
|
+
data: vue.unref(list),
|
|
4582
|
+
"highlight-current": true
|
|
4583
|
+
}, {
|
|
4584
|
+
default: vue.withCtx(({ data }) => [
|
|
4585
|
+
vue.createElementVNode("div", {
|
|
4586
|
+
id: data.id,
|
|
4587
|
+
class: "list-container"
|
|
4588
|
+
}, [
|
|
4589
|
+
vue.createElementVNode("div", _hoisted_4, [
|
|
4590
|
+
data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
|
|
4591
|
+
key: 0,
|
|
4592
|
+
class: "codeIcon",
|
|
4593
|
+
icon: vue.unref(iconsVue.Coin)
|
|
4594
|
+
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4595
|
+
data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
|
|
4596
|
+
key: 1,
|
|
4597
|
+
class: "compIcon",
|
|
4598
|
+
icon: vue.unref(iconsVue.Aim)
|
|
4599
|
+
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4600
|
+
vue.createElementVNode("span", {
|
|
4601
|
+
class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
4602
|
+
}, vue.toDisplayString(data.name) + "(" + vue.toDisplayString(data.id) + ")", 3),
|
|
4603
|
+
data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
4604
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
4605
|
+
effect: "dark",
|
|
4606
|
+
content: "编辑",
|
|
4607
|
+
placement: "bottom"
|
|
4608
|
+
}, {
|
|
4609
|
+
default: vue.withCtx(() => [
|
|
4610
|
+
vue.createVNode(_sfc_main$A, {
|
|
4611
|
+
class: "edit-icon",
|
|
4612
|
+
icon: vue.unref(iconsVue.Edit),
|
|
4613
|
+
onClick: vue.withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
|
|
4614
|
+
}, null, 8, ["icon", "onClick"])
|
|
4615
|
+
]),
|
|
4616
|
+
_: 2
|
|
4617
|
+
}, 1024),
|
|
4618
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
4619
|
+
effect: "dark",
|
|
4620
|
+
content: "删除",
|
|
4621
|
+
placement: "bottom"
|
|
4622
|
+
}, {
|
|
4623
|
+
default: vue.withCtx(() => [
|
|
4624
|
+
vue.createVNode(_sfc_main$A, {
|
|
4625
|
+
icon: vue.unref(iconsVue.Close),
|
|
4626
|
+
class: "edit-icon",
|
|
4627
|
+
onClick: vue.withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
|
|
4628
|
+
}, null, 8, ["icon", "onClick"])
|
|
4629
|
+
]),
|
|
4630
|
+
_: 2
|
|
4631
|
+
}, 1024),
|
|
4632
|
+
vue.renderSlot(_ctx.$slots, "data-source-panel-tool", {
|
|
4633
|
+
id: data.id,
|
|
4634
|
+
data: data.codeBlockContent
|
|
4635
|
+
})
|
|
4636
|
+
])) : vue.createCommentVNode("", true)
|
|
4637
|
+
])
|
|
4638
|
+
], 8, _hoisted_3)
|
|
4639
|
+
]),
|
|
4640
|
+
_: 3
|
|
4641
|
+
}, 8, ["data"]),
|
|
4642
|
+
vue.createVNode(_sfc_main$f, {
|
|
4643
|
+
ref_key: "editDialog",
|
|
4644
|
+
ref: editDialog,
|
|
4645
|
+
values: dataSourceValues.value,
|
|
4646
|
+
title: typeof dataSourceValues.value.id !== "undefined" ? `编辑${dataSourceValues.value.title}` : "新增",
|
|
4647
|
+
onSubmit: submitDataSourceHandler
|
|
4648
|
+
}, null, 8, ["values", "title"])
|
|
4649
|
+
]),
|
|
4650
|
+
_: 3
|
|
4651
|
+
});
|
|
4652
|
+
};
|
|
4653
|
+
}
|
|
4654
|
+
});
|
|
4655
|
+
|
|
4119
4656
|
const _hoisted_1$5 = ["onClick", "onDragstart"];
|
|
4120
4657
|
const __default__$c = vue.defineComponent({
|
|
4121
4658
|
name: "MEditorComponentListPanel"
|
|
@@ -4197,7 +4734,7 @@
|
|
|
4197
4734
|
"model-value": vue.unref(collapseValue)
|
|
4198
4735
|
}, {
|
|
4199
4736
|
default: vue.withCtx(() => [
|
|
4200
|
-
vue.createVNode(_sfc_main$
|
|
4737
|
+
vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4201
4738
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
|
|
4202
4739
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
4203
4740
|
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
@@ -4205,7 +4742,7 @@
|
|
|
4205
4742
|
name: `${index}`
|
|
4206
4743
|
}, {
|
|
4207
4744
|
title: vue.withCtx(() => [
|
|
4208
|
-
vue.createVNode(_sfc_main$
|
|
4745
|
+
vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
4209
4746
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
4210
4747
|
]),
|
|
4211
4748
|
default: vue.withCtx(() => [
|
|
@@ -4220,7 +4757,7 @@
|
|
|
4220
4757
|
onDrag: dragHandler
|
|
4221
4758
|
}, [
|
|
4222
4759
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4223
|
-
vue.createVNode(_sfc_main$
|
|
4760
|
+
vue.createVNode(_sfc_main$A, {
|
|
4224
4761
|
icon: item.icon
|
|
4225
4762
|
}, null, 8, ["icon"]),
|
|
4226
4763
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -4343,7 +4880,7 @@
|
|
|
4343
4880
|
}, [
|
|
4344
4881
|
vue.createElementVNode("div", null, [
|
|
4345
4882
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
4346
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4883
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
4347
4884
|
"event-type": "mouseup",
|
|
4348
4885
|
data: item,
|
|
4349
4886
|
key: index,
|
|
@@ -4495,6 +5032,8 @@
|
|
|
4495
5032
|
const clicked = vue.ref(false);
|
|
4496
5033
|
const treeProps = {
|
|
4497
5034
|
children: "items",
|
|
5035
|
+
label: "name",
|
|
5036
|
+
value: "id",
|
|
4498
5037
|
disabled: (data) => Boolean(data.items?.length),
|
|
4499
5038
|
class: (data) => {
|
|
4500
5039
|
if (clicked.value || utils.isPage(data))
|
|
@@ -4674,7 +5213,7 @@
|
|
|
4674
5213
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4675
5214
|
default: vue.withCtx(() => [
|
|
4676
5215
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4677
|
-
vue.createVNode(_sfc_main$
|
|
5216
|
+
vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4678
5217
|
vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
4679
5218
|
key: 0,
|
|
4680
5219
|
class: "magic-editor-layer-tree",
|
|
@@ -4743,7 +5282,7 @@
|
|
|
4743
5282
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4744
5283
|
...__default__$8,
|
|
4745
5284
|
props: {
|
|
4746
|
-
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block"] }) },
|
|
5285
|
+
data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block", "data-source"] }) },
|
|
4747
5286
|
layerContentMenu: null
|
|
4748
5287
|
},
|
|
4749
5288
|
setup(__props, { expose }) {
|
|
@@ -4756,7 +5295,7 @@
|
|
|
4756
5295
|
"component-list": {
|
|
4757
5296
|
$key: "component-list",
|
|
4758
5297
|
type: "component",
|
|
4759
|
-
icon: iconsVue.
|
|
5298
|
+
icon: iconsVue.Goods,
|
|
4760
5299
|
text: "组件",
|
|
4761
5300
|
component: _sfc_main$d,
|
|
4762
5301
|
slots: {}
|
|
@@ -4764,7 +5303,7 @@
|
|
|
4764
5303
|
layer: {
|
|
4765
5304
|
$key: "layer",
|
|
4766
5305
|
type: "component",
|
|
4767
|
-
icon: iconsVue.
|
|
5306
|
+
icon: iconsVue.List,
|
|
4768
5307
|
text: "已选组件",
|
|
4769
5308
|
props: {
|
|
4770
5309
|
layerContentMenu: props.layerContentMenu
|
|
@@ -4777,6 +5316,14 @@
|
|
|
4777
5316
|
type: "component",
|
|
4778
5317
|
icon: iconsVue.EditPen,
|
|
4779
5318
|
text: "代码编辑",
|
|
5319
|
+
component: _sfc_main$g,
|
|
5320
|
+
slots: {}
|
|
5321
|
+
},
|
|
5322
|
+
"data-source": {
|
|
5323
|
+
$key: "data-source",
|
|
5324
|
+
type: "component",
|
|
5325
|
+
icon: iconsVue.Coin,
|
|
5326
|
+
text: "数据源",
|
|
4780
5327
|
component: _sfc_main$e,
|
|
4781
5328
|
slots: {}
|
|
4782
5329
|
}
|
|
@@ -4809,7 +5356,7 @@
|
|
|
4809
5356
|
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4810
5357
|
key: config.text
|
|
4811
5358
|
}, [
|
|
4812
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5359
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
|
|
4813
5360
|
key: 0,
|
|
4814
5361
|
icon: config.icon
|
|
4815
5362
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -5030,14 +5577,14 @@
|
|
|
5030
5577
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5031
5578
|
onClick: addPage
|
|
5032
5579
|
}, [
|
|
5033
|
-
vue.createVNode(_sfc_main$
|
|
5580
|
+
vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
5034
5581
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
5035
5582
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
5036
5583
|
key: 2,
|
|
5037
5584
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5038
5585
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
5039
5586
|
}, [
|
|
5040
|
-
vue.createVNode(_sfc_main$
|
|
5587
|
+
vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
5041
5588
|
])) : vue.createCommentVNode("", true),
|
|
5042
5589
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
5043
5590
|
key: 3,
|
|
@@ -5053,7 +5600,7 @@
|
|
|
5053
5600
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
5054
5601
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
5055
5602
|
}, [
|
|
5056
|
-
vue.createVNode(_sfc_main$
|
|
5603
|
+
vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
5057
5604
|
])) : vue.createCommentVNode("", true)
|
|
5058
5605
|
], 512);
|
|
5059
5606
|
};
|
|
@@ -5125,7 +5672,7 @@
|
|
|
5125
5672
|
default: vue.withCtx(() => [
|
|
5126
5673
|
vue.createElementVNode("div", null, [
|
|
5127
5674
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
5128
|
-
vue.createVNode(_sfc_main$
|
|
5675
|
+
vue.createVNode(_sfc_main$p, {
|
|
5129
5676
|
data: {
|
|
5130
5677
|
type: "button",
|
|
5131
5678
|
text: "复制",
|
|
@@ -5133,7 +5680,7 @@
|
|
|
5133
5680
|
handler: () => copy(item)
|
|
5134
5681
|
}
|
|
5135
5682
|
}, null, 8, ["data"]),
|
|
5136
|
-
vue.createVNode(_sfc_main$
|
|
5683
|
+
vue.createVNode(_sfc_main$p, {
|
|
5137
5684
|
data: {
|
|
5138
5685
|
type: "button",
|
|
5139
5686
|
text: "删除",
|
|
@@ -5963,7 +6510,6 @@
|
|
|
5963
6510
|
*/
|
|
5964
6511
|
async setCodeDsl(codeDsl2) {
|
|
5965
6512
|
this.state.codeDsl = codeDsl2;
|
|
5966
|
-
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
5967
6513
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
5968
6514
|
}
|
|
5969
6515
|
/**
|
|
@@ -6201,6 +6747,166 @@
|
|
|
6201
6747
|
}
|
|
6202
6748
|
const componentListService = new ComponentList();
|
|
6203
6749
|
|
|
6750
|
+
const BaseFormConfig = [
|
|
6751
|
+
{
|
|
6752
|
+
name: "id",
|
|
6753
|
+
type: "hidden"
|
|
6754
|
+
},
|
|
6755
|
+
{
|
|
6756
|
+
name: "type",
|
|
6757
|
+
text: "类型",
|
|
6758
|
+
type: "select",
|
|
6759
|
+
options: [
|
|
6760
|
+
{ text: "基础", value: "base" },
|
|
6761
|
+
{ text: "HTTP", value: "http" }
|
|
6762
|
+
],
|
|
6763
|
+
defaultValue: "base"
|
|
6764
|
+
},
|
|
6765
|
+
{
|
|
6766
|
+
name: "title",
|
|
6767
|
+
text: "名称",
|
|
6768
|
+
rules: [
|
|
6769
|
+
{
|
|
6770
|
+
required: true,
|
|
6771
|
+
message: "请输入名称"
|
|
6772
|
+
}
|
|
6773
|
+
]
|
|
6774
|
+
},
|
|
6775
|
+
{
|
|
6776
|
+
name: "description",
|
|
6777
|
+
text: "描述"
|
|
6778
|
+
}
|
|
6779
|
+
];
|
|
6780
|
+
|
|
6781
|
+
const HttpFormConfig = [
|
|
6782
|
+
{
|
|
6783
|
+
name: "autoFetch",
|
|
6784
|
+
text: "自动请求",
|
|
6785
|
+
type: "switch",
|
|
6786
|
+
defaultValue: true
|
|
6787
|
+
},
|
|
6788
|
+
{
|
|
6789
|
+
type: "fieldset",
|
|
6790
|
+
name: "options",
|
|
6791
|
+
legend: "HTTP 配置",
|
|
6792
|
+
items: [
|
|
6793
|
+
{
|
|
6794
|
+
name: "url",
|
|
6795
|
+
text: "URL"
|
|
6796
|
+
},
|
|
6797
|
+
{
|
|
6798
|
+
name: "method",
|
|
6799
|
+
text: "Method",
|
|
6800
|
+
type: "select",
|
|
6801
|
+
options: [
|
|
6802
|
+
{ text: "GET", value: "GET" },
|
|
6803
|
+
{ text: "POST", value: "POST" },
|
|
6804
|
+
{ text: "PUT", value: "PUT" },
|
|
6805
|
+
{ text: "DELETE", value: "DELETE" }
|
|
6806
|
+
]
|
|
6807
|
+
},
|
|
6808
|
+
{
|
|
6809
|
+
name: "params",
|
|
6810
|
+
type: "key-value",
|
|
6811
|
+
defaultValue: {},
|
|
6812
|
+
text: "参数"
|
|
6813
|
+
},
|
|
6814
|
+
{
|
|
6815
|
+
name: "data",
|
|
6816
|
+
type: "key-value",
|
|
6817
|
+
defaultValue: {},
|
|
6818
|
+
text: "请求体"
|
|
6819
|
+
},
|
|
6820
|
+
{
|
|
6821
|
+
name: "headers",
|
|
6822
|
+
type: "key-value",
|
|
6823
|
+
defaultValue: {},
|
|
6824
|
+
text: "请求头"
|
|
6825
|
+
}
|
|
6826
|
+
]
|
|
6827
|
+
}
|
|
6828
|
+
];
|
|
6829
|
+
|
|
6830
|
+
const fillConfig = (config) => [
|
|
6831
|
+
...BaseFormConfig,
|
|
6832
|
+
...config,
|
|
6833
|
+
{
|
|
6834
|
+
type: "panel",
|
|
6835
|
+
title: "数据定义",
|
|
6836
|
+
items: [
|
|
6837
|
+
{
|
|
6838
|
+
name: "fields",
|
|
6839
|
+
type: "data-source-fields",
|
|
6840
|
+
defaultValue: []
|
|
6841
|
+
}
|
|
6842
|
+
]
|
|
6843
|
+
}
|
|
6844
|
+
];
|
|
6845
|
+
const getFormConfig = (type, configs) => {
|
|
6846
|
+
switch (type) {
|
|
6847
|
+
case "base":
|
|
6848
|
+
return fillConfig([]);
|
|
6849
|
+
case "http":
|
|
6850
|
+
return fillConfig(HttpFormConfig);
|
|
6851
|
+
default:
|
|
6852
|
+
return fillConfig(configs[type] || []);
|
|
6853
|
+
}
|
|
6854
|
+
};
|
|
6855
|
+
|
|
6856
|
+
class DataSource extends BaseService {
|
|
6857
|
+
state = vue.reactive({
|
|
6858
|
+
dataSources: [],
|
|
6859
|
+
configs: {}
|
|
6860
|
+
});
|
|
6861
|
+
set(name, value) {
|
|
6862
|
+
this.state[name] = value;
|
|
6863
|
+
}
|
|
6864
|
+
get(name) {
|
|
6865
|
+
return this.state[name];
|
|
6866
|
+
}
|
|
6867
|
+
getFormConfig(type = "base") {
|
|
6868
|
+
return getFormConfig(type, this.get("configs"));
|
|
6869
|
+
}
|
|
6870
|
+
setFormConfig(type, config) {
|
|
6871
|
+
this.get("configs")[type] = config;
|
|
6872
|
+
}
|
|
6873
|
+
add(config) {
|
|
6874
|
+
const newConfig = {
|
|
6875
|
+
...config,
|
|
6876
|
+
id: this.createId()
|
|
6877
|
+
};
|
|
6878
|
+
this.get("dataSources").push(newConfig);
|
|
6879
|
+
this.emit("add", newConfig);
|
|
6880
|
+
}
|
|
6881
|
+
update(config) {
|
|
6882
|
+
const dataSources = this.get("dataSources");
|
|
6883
|
+
const index = dataSources.findIndex((ds) => ds.id === config.id);
|
|
6884
|
+
dataSources[index] = lodashEs.cloneDeep(config);
|
|
6885
|
+
this.emit("update", config);
|
|
6886
|
+
}
|
|
6887
|
+
remove(id) {
|
|
6888
|
+
const dataSources = this.get("dataSources");
|
|
6889
|
+
const index = dataSources.findIndex((ds) => ds.id === id);
|
|
6890
|
+
dataSources.splice(index, 1);
|
|
6891
|
+
this.emit("remove", id);
|
|
6892
|
+
}
|
|
6893
|
+
getDataSourceById(id) {
|
|
6894
|
+
return this.get("dataSources").find((ds) => ds.id === id);
|
|
6895
|
+
}
|
|
6896
|
+
resetState() {
|
|
6897
|
+
this.set("dataSources", []);
|
|
6898
|
+
}
|
|
6899
|
+
destroy() {
|
|
6900
|
+
this.removeAllListeners();
|
|
6901
|
+
this.resetState();
|
|
6902
|
+
this.removeAllPlugins();
|
|
6903
|
+
}
|
|
6904
|
+
createId() {
|
|
6905
|
+
return `ds_${utils.guid()}`;
|
|
6906
|
+
}
|
|
6907
|
+
}
|
|
6908
|
+
const dataSourceService = new DataSource();
|
|
6909
|
+
|
|
6204
6910
|
class Target extends events.EventEmitter {
|
|
6205
6911
|
/**
|
|
6206
6912
|
* 如何识别目标
|
|
@@ -6549,6 +7255,10 @@
|
|
|
6549
7255
|
type: Object,
|
|
6550
7256
|
default: () => ({})
|
|
6551
7257
|
},
|
|
7258
|
+
dataScourceConfigs: {
|
|
7259
|
+
type: Object,
|
|
7260
|
+
default: () => ({})
|
|
7261
|
+
},
|
|
6552
7262
|
/** 画布中组件选中框的移动范围 */
|
|
6553
7263
|
moveableOptions: {
|
|
6554
7264
|
type: [Object, Function]
|
|
@@ -6604,6 +7314,12 @@
|
|
|
6604
7314
|
return false;
|
|
6605
7315
|
}
|
|
6606
7316
|
});
|
|
7317
|
+
const createDataSourceTarget = (id, ds) => new Target({
|
|
7318
|
+
type: "data-source",
|
|
7319
|
+
id,
|
|
7320
|
+
name: ds.title || `${id}`,
|
|
7321
|
+
isTarget: (key, value) => typeof value === "string" && value.includes(`${id}`)
|
|
7322
|
+
});
|
|
6607
7323
|
|
|
6608
7324
|
const initServiceState = (props, {
|
|
6609
7325
|
editorService,
|
|
@@ -6683,7 +7399,26 @@
|
|
|
6683
7399
|
codeBlockService.resetState();
|
|
6684
7400
|
});
|
|
6685
7401
|
};
|
|
6686
|
-
const initServiceEvents = (props, emit, { editorService, codeBlockService, depService }) => {
|
|
7402
|
+
const initServiceEvents = (props, emit, { editorService, codeBlockService, dataSourceService, depService }) => {
|
|
7403
|
+
const targetAddHandler = (target) => {
|
|
7404
|
+
if (target.type !== "data-source")
|
|
7405
|
+
return;
|
|
7406
|
+
const root = editorService.get("root");
|
|
7407
|
+
if (!root)
|
|
7408
|
+
return;
|
|
7409
|
+
if (!root.dataSourceDeps) {
|
|
7410
|
+
root.dataSourceDeps = {};
|
|
7411
|
+
}
|
|
7412
|
+
root.dataSourceDeps[target.id] = target.deps;
|
|
7413
|
+
};
|
|
7414
|
+
const targetRemoveHandler = (id) => {
|
|
7415
|
+
const root = editorService.get("root");
|
|
7416
|
+
if (!root?.dataSourceDeps)
|
|
7417
|
+
return;
|
|
7418
|
+
delete root.dataSourceDeps[id];
|
|
7419
|
+
};
|
|
7420
|
+
depService.on("add-target", targetAddHandler);
|
|
7421
|
+
depService.on("remove-target", targetRemoveHandler);
|
|
6687
7422
|
const rootChangeHandler = async (value, preValue) => {
|
|
6688
7423
|
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
6689
7424
|
let node;
|
|
@@ -6703,15 +7438,21 @@
|
|
|
6703
7438
|
emit("update:modelValue", value);
|
|
6704
7439
|
}
|
|
6705
7440
|
value.codeBlocks = value.codeBlocks || {};
|
|
7441
|
+
value.dataSources = value.dataSources || [];
|
|
6706
7442
|
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
7443
|
+
dataSourceService.set("dataSources", value.dataSources);
|
|
6707
7444
|
depService.removeTargets("code-block");
|
|
6708
7445
|
Object.entries(value.codeBlocks).forEach(([id, code]) => {
|
|
6709
7446
|
depService.addTarget(createCodeBlockTarget(id, code));
|
|
6710
7447
|
});
|
|
7448
|
+
value.dataSources.forEach((ds) => {
|
|
7449
|
+
depService.addTarget(createDataSourceTarget(ds.id, ds));
|
|
7450
|
+
});
|
|
6711
7451
|
if (value && Array.isArray(value.items)) {
|
|
6712
7452
|
depService.collect(value.items, true);
|
|
6713
7453
|
} else {
|
|
6714
7454
|
depService.clear();
|
|
7455
|
+
delete value.dataSourceDeps;
|
|
6715
7456
|
}
|
|
6716
7457
|
};
|
|
6717
7458
|
const nodeAddHandler = (nodes) => {
|
|
@@ -6743,7 +7484,23 @@
|
|
|
6743
7484
|
};
|
|
6744
7485
|
codeBlockService.on("addOrUpdate", codeBlockAddOrUpdateHandler);
|
|
6745
7486
|
codeBlockService.on("remove", codeBlockRemoveHandler);
|
|
7487
|
+
const dataSourceAddHandler = (config) => {
|
|
7488
|
+
depService.addTarget(createDataSourceTarget(config.id, config));
|
|
7489
|
+
};
|
|
7490
|
+
const dataSourceUpdateHandler = (config) => {
|
|
7491
|
+
if (config.title) {
|
|
7492
|
+
depService.getTarget(config.id).name = config.title;
|
|
7493
|
+
}
|
|
7494
|
+
};
|
|
7495
|
+
const dataSourceRemoveHandler = (id) => {
|
|
7496
|
+
depService.removeTarget(id);
|
|
7497
|
+
};
|
|
7498
|
+
dataSourceService.on("add", dataSourceAddHandler);
|
|
7499
|
+
dataSourceService.on("update", dataSourceUpdateHandler);
|
|
7500
|
+
dataSourceService.on("remove", dataSourceRemoveHandler);
|
|
6746
7501
|
vue.onUnmounted(() => {
|
|
7502
|
+
depService.off("add-target", targetAddHandler);
|
|
7503
|
+
depService.off("remove-target", targetRemoveHandler);
|
|
6747
7504
|
editorService.off("history-change", historyChangeHandler);
|
|
6748
7505
|
editorService.off("root-change", rootChangeHandler);
|
|
6749
7506
|
editorService.off("add", nodeAddHandler);
|
|
@@ -6751,17 +7508,20 @@
|
|
|
6751
7508
|
editorService.off("update", nodeUpdateHandler);
|
|
6752
7509
|
codeBlockService.off("addOrUpdate", codeBlockAddOrUpdateHandler);
|
|
6753
7510
|
codeBlockService.off("remove", codeBlockRemoveHandler);
|
|
7511
|
+
dataSourceService.off("add", dataSourceAddHandler);
|
|
7512
|
+
dataSourceService.off("update", dataSourceUpdateHandler);
|
|
7513
|
+
dataSourceService.off("remove", dataSourceRemoveHandler);
|
|
6754
7514
|
});
|
|
6755
7515
|
};
|
|
6756
7516
|
|
|
6757
7517
|
const _sfc_main = vue.defineComponent({
|
|
6758
7518
|
name: "m-editor",
|
|
6759
7519
|
components: {
|
|
6760
|
-
TMagicNavMenu: _sfc_main$
|
|
7520
|
+
TMagicNavMenu: _sfc_main$o,
|
|
6761
7521
|
Sidebar: _sfc_main$9,
|
|
6762
7522
|
Workspace: _sfc_main$1,
|
|
6763
|
-
PropsPanel: _sfc_main$
|
|
6764
|
-
Framework: _sfc_main$
|
|
7523
|
+
PropsPanel: _sfc_main$n,
|
|
7524
|
+
Framework: _sfc_main$q
|
|
6765
7525
|
},
|
|
6766
7526
|
props: editorProps,
|
|
6767
7527
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
@@ -6775,7 +7535,8 @@
|
|
|
6775
7535
|
uiService,
|
|
6776
7536
|
storageService,
|
|
6777
7537
|
codeBlockService,
|
|
6778
|
-
depService
|
|
7538
|
+
depService,
|
|
7539
|
+
dataSourceService
|
|
6779
7540
|
};
|
|
6780
7541
|
initServiceEvents(props, emit, services);
|
|
6781
7542
|
initServiceState(props, services);
|
|
@@ -6900,38 +7661,42 @@
|
|
|
6900
7661
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6901
7662
|
setConfig(option);
|
|
6902
7663
|
app.component(Editor.name, Editor);
|
|
6903
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
6904
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
6905
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
6906
|
-
app.component("magic-code-editor", _sfc_main$
|
|
6907
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6908
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
6909
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
7664
|
+
app.component("m-fields-ui-select", _sfc_main$v);
|
|
7665
|
+
app.component("m-fields-code-link", _sfc_main$C);
|
|
7666
|
+
app.component("m-fields-vs-code", _sfc_main$D);
|
|
7667
|
+
app.component("magic-code-editor", _sfc_main$u);
|
|
7668
|
+
app.component("m-fields-code-select", _sfc_main$B);
|
|
7669
|
+
app.component("m-fields-code-select-col", _sfc_main$z);
|
|
7670
|
+
app.component("m-fields-event-select", _sfc_main$x);
|
|
7671
|
+
app.component("m-fields-data-source-fields", _sfc_main$y);
|
|
7672
|
+
app.component("m-fields-key-value", _sfc_main$w);
|
|
6910
7673
|
}
|
|
6911
7674
|
};
|
|
6912
7675
|
|
|
6913
7676
|
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
6914
7677
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
6915
|
-
exports.CodeBlockList = _sfc_main$
|
|
7678
|
+
exports.CodeBlockList = _sfc_main$g;
|
|
6916
7679
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
6917
|
-
exports.CodeSelect = _sfc_main$
|
|
6918
|
-
exports.CodeSelectCol = _sfc_main$
|
|
7680
|
+
exports.CodeSelect = _sfc_main$B;
|
|
7681
|
+
exports.CodeSelectCol = _sfc_main$z;
|
|
6919
7682
|
exports.ColumnLayout = ColumnLayout;
|
|
6920
7683
|
exports.ComponentListPanel = _sfc_main$d;
|
|
6921
7684
|
exports.ContentMenu = _sfc_main$c;
|
|
6922
|
-
exports.
|
|
7685
|
+
exports.DataSourceFields = _sfc_main$y;
|
|
7686
|
+
exports.EventSelect = _sfc_main$x;
|
|
6923
7687
|
exports.Fixed2Other = Fixed2Other;
|
|
6924
7688
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
6925
|
-
exports.Icon = _sfc_main$
|
|
7689
|
+
exports.Icon = _sfc_main$A;
|
|
7690
|
+
exports.KeyValue = _sfc_main$w;
|
|
6926
7691
|
exports.Keys = Keys;
|
|
6927
7692
|
exports.LayerOffset = LayerOffset;
|
|
6928
7693
|
exports.LayerPanel = _sfc_main$a;
|
|
6929
7694
|
exports.Layout = Layout;
|
|
6930
|
-
exports.LayoutContainer = _sfc_main$
|
|
6931
|
-
exports.PropsPanel = _sfc_main$
|
|
6932
|
-
exports.TMagicCodeEditor = _sfc_main$
|
|
7695
|
+
exports.LayoutContainer = _sfc_main$s;
|
|
7696
|
+
exports.PropsPanel = _sfc_main$n;
|
|
7697
|
+
exports.TMagicCodeEditor = _sfc_main$u;
|
|
6933
7698
|
exports.TMagicEditor = Editor;
|
|
6934
|
-
exports.ToolButton = _sfc_main$
|
|
7699
|
+
exports.ToolButton = _sfc_main$p;
|
|
6935
7700
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
6936
7701
|
exports.beforePaste = beforePaste;
|
|
6937
7702
|
exports.change2Fixed = change2Fixed;
|
|
@@ -6942,7 +7707,7 @@
|
|
|
6942
7707
|
exports.editorService = editorService;
|
|
6943
7708
|
exports.error = error;
|
|
6944
7709
|
exports.eventsService = eventsService;
|
|
6945
|
-
exports.fillConfig = fillConfig;
|
|
7710
|
+
exports.fillConfig = fillConfig$1;
|
|
6946
7711
|
exports.fixNodeLeft = fixNodeLeft;
|
|
6947
7712
|
exports.fixNodePosition = fixNodePosition;
|
|
6948
7713
|
exports.generatePageName = generatePageName;
|