@tmagic/editor 1.4.0 → 1.4.2
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/tmagic-editor.js +236 -182
- package/dist/tmagic-editor.umd.cjs +255 -201
- package/package.json +11 -11
- package/src/components/SplitView.vue +5 -0
- package/src/fields/CodeSelect.vue +11 -2
- package/src/fields/DataSourceFieldSelect.vue +34 -3
- package/src/hooks/use-data-source-edit.ts +46 -0
- package/src/layouts/Framework.vue +4 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +4 -30
- package/src/services/editor.ts +5 -1
- package/types/hooks/use-data-source-edit.d.ts +81 -0
package/dist/tmagic-editor.js
CHANGED
|
@@ -5,8 +5,8 @@ import serialize from 'serialize-javascript';
|
|
|
5
5
|
import { TMagicIcon, TMagicButton, TMagicCard, useZIndex, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
6
6
|
import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
|
|
7
7
|
import * as monaco from 'monaco-editor';
|
|
8
|
+
import { MContainer, MFormBox, MForm, filterFunction, createValues, MCascader, MSelect } from '@tmagic/form';
|
|
8
9
|
import { HookCodeType, HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
9
|
-
import { MFormBox, MForm, filterFunction, createValues, MCascader, MSelect } from '@tmagic/form';
|
|
10
10
|
import VanillaMoveable from 'moveable';
|
|
11
11
|
import { MagicTable } from '@tmagic/table';
|
|
12
12
|
import { toLine, guid, isPage, isPageFragment, isPop, getNodePath, isNumber, getValueByKeyPath, setValueByKeyPath, convertToNumber, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
@@ -483,17 +483,20 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
483
483
|
emit("change", props.model[props.name]);
|
|
484
484
|
};
|
|
485
485
|
return (_ctx, _cache) => {
|
|
486
|
-
const _component_m_form_container = resolveComponent("m-form-container");
|
|
487
486
|
return openBlock(), createElementBlock("div", {
|
|
488
487
|
class: normalizeClass(["m-fields-code-select", _ctx.config.className])
|
|
489
488
|
}, [
|
|
490
489
|
createVNode(unref(TMagicCard), null, {
|
|
491
490
|
default: withCtx(() => [
|
|
492
|
-
createVNode(
|
|
491
|
+
createVNode(unref(MContainer), {
|
|
493
492
|
config: codeConfig.value,
|
|
493
|
+
size: _ctx.size,
|
|
494
|
+
prop: _ctx.prop,
|
|
495
|
+
disabled: _ctx.disabled,
|
|
496
|
+
lastValues: _ctx.lastValues,
|
|
494
497
|
model: _ctx.model[_ctx.name],
|
|
495
498
|
onChange: changeHandler
|
|
496
|
-
}, null, 8, ["config", "model"])
|
|
499
|
+
}, null, 8, ["config", "size", "prop", "disabled", "lastValues", "model"])
|
|
497
500
|
]),
|
|
498
501
|
_: 1
|
|
499
502
|
})
|
|
@@ -3165,7 +3168,10 @@ class Editor extends BaseService {
|
|
|
3165
3168
|
throw new Error(`获取不到id为${config.id}的节点`);
|
|
3166
3169
|
const node = cloneDeep(toRaw(info.node));
|
|
3167
3170
|
let newConfig = await this.toggleFixedPosition(toRaw(config), node, root);
|
|
3168
|
-
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
3171
|
+
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue, key) => {
|
|
3172
|
+
if (typeof srcValue === "undefined" && Object.hasOwn(newConfig, key)) {
|
|
3173
|
+
return "";
|
|
3174
|
+
}
|
|
3169
3175
|
if (isObject(srcValue) && Array.isArray(objValue)) {
|
|
3170
3176
|
return srcValue;
|
|
3171
3177
|
}
|
|
@@ -4593,8 +4599,115 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
4593
4599
|
}
|
|
4594
4600
|
});
|
|
4595
4601
|
|
|
4596
|
-
const
|
|
4602
|
+
const useDataSourceEdit = (dataSourceService) => {
|
|
4603
|
+
const dialogTitle = ref("");
|
|
4604
|
+
const editDialog = ref();
|
|
4605
|
+
const dataSourceValues = ref({});
|
|
4606
|
+
const editable = computed(() => dataSourceService?.get("editable") ?? true);
|
|
4607
|
+
const editHandler = (id) => {
|
|
4608
|
+
if (!editDialog.value)
|
|
4609
|
+
return;
|
|
4610
|
+
dataSourceValues.value = {
|
|
4611
|
+
...dataSourceService?.getDataSourceById(id)
|
|
4612
|
+
};
|
|
4613
|
+
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
4614
|
+
editDialog.value.show();
|
|
4615
|
+
};
|
|
4616
|
+
const submitDataSourceHandler = (value) => {
|
|
4617
|
+
if (value.id) {
|
|
4618
|
+
dataSourceService?.update(value);
|
|
4619
|
+
} else {
|
|
4620
|
+
dataSourceService?.add(value);
|
|
4621
|
+
}
|
|
4622
|
+
editDialog.value?.hide();
|
|
4623
|
+
};
|
|
4624
|
+
return {
|
|
4625
|
+
dialogTitle,
|
|
4626
|
+
editDialog,
|
|
4627
|
+
dataSourceValues,
|
|
4628
|
+
editable,
|
|
4629
|
+
editHandler,
|
|
4630
|
+
submitDataSourceHandler
|
|
4631
|
+
};
|
|
4632
|
+
};
|
|
4633
|
+
|
|
4597
4634
|
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
4635
|
+
...{
|
|
4636
|
+
name: "MEditorDataSourceConfigPanel"
|
|
4637
|
+
},
|
|
4638
|
+
__name: "DataSourceConfigPanel",
|
|
4639
|
+
props: /* @__PURE__ */ mergeModels({
|
|
4640
|
+
title: {},
|
|
4641
|
+
values: {},
|
|
4642
|
+
disabled: { type: Boolean }
|
|
4643
|
+
}, {
|
|
4644
|
+
"visible": { type: Boolean, ...{ default: false } },
|
|
4645
|
+
"visibleModifiers": {},
|
|
4646
|
+
"width": { default: 670 },
|
|
4647
|
+
"widthModifiers": {}
|
|
4648
|
+
}),
|
|
4649
|
+
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:visible", "update:width"]),
|
|
4650
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4651
|
+
const props = __props;
|
|
4652
|
+
const boxVisible = useModel(__props, "visible");
|
|
4653
|
+
const width = useModel(__props, "width");
|
|
4654
|
+
const emit = __emit;
|
|
4655
|
+
const services = inject("services");
|
|
4656
|
+
const initValues = ref({});
|
|
4657
|
+
const dataSourceConfig = ref([]);
|
|
4658
|
+
const { height: editorHeight } = useEditorContentHeight();
|
|
4659
|
+
const parentFloating = inject("parentFloating", ref(null));
|
|
4660
|
+
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4661
|
+
watchEffect(() => {
|
|
4662
|
+
initValues.value = props.values;
|
|
4663
|
+
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
4664
|
+
});
|
|
4665
|
+
const submitHandler = (values) => {
|
|
4666
|
+
emit("submit", values);
|
|
4667
|
+
};
|
|
4668
|
+
const errorHandler = (error) => {
|
|
4669
|
+
tMagicMessage.error(error.message);
|
|
4670
|
+
};
|
|
4671
|
+
__expose({
|
|
4672
|
+
show() {
|
|
4673
|
+
calcBoxPosition();
|
|
4674
|
+
boxVisible.value = true;
|
|
4675
|
+
},
|
|
4676
|
+
hide() {
|
|
4677
|
+
boxVisible.value = false;
|
|
4678
|
+
}
|
|
4679
|
+
});
|
|
4680
|
+
return (_ctx, _cache) => {
|
|
4681
|
+
return openBlock(), createBlock(_sfc_main$P, {
|
|
4682
|
+
visible: boxVisible.value,
|
|
4683
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
4684
|
+
width: width.value,
|
|
4685
|
+
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
4686
|
+
height: unref(editorHeight),
|
|
4687
|
+
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => isRef(editorHeight) ? editorHeight.value = $event : null),
|
|
4688
|
+
title: _ctx.title,
|
|
4689
|
+
position: unref(boxPosition)
|
|
4690
|
+
}, {
|
|
4691
|
+
body: withCtx(() => [
|
|
4692
|
+
createVNode(unref(MFormBox), {
|
|
4693
|
+
"label-width": "80px",
|
|
4694
|
+
title: _ctx.title,
|
|
4695
|
+
config: dataSourceConfig.value,
|
|
4696
|
+
values: initValues.value,
|
|
4697
|
+
disabled: _ctx.disabled,
|
|
4698
|
+
style: { "height": "100%" },
|
|
4699
|
+
onSubmit: submitHandler,
|
|
4700
|
+
onError: errorHandler
|
|
4701
|
+
}, null, 8, ["title", "config", "values", "disabled"])
|
|
4702
|
+
]),
|
|
4703
|
+
_: 1
|
|
4704
|
+
}, 8, ["visible", "width", "height", "title", "position"]);
|
|
4705
|
+
};
|
|
4706
|
+
}
|
|
4707
|
+
});
|
|
4708
|
+
|
|
4709
|
+
const _hoisted_1$o = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
4710
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
4598
4711
|
...{
|
|
4599
4712
|
name: "MFieldsDataSourceFieldSelect"
|
|
4600
4713
|
},
|
|
@@ -4615,6 +4728,13 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4615
4728
|
const services = inject("services");
|
|
4616
4729
|
const emit = __emit;
|
|
4617
4730
|
const props = __props;
|
|
4731
|
+
const selectedDataSourceId = computed(() => {
|
|
4732
|
+
const value = props.model[props.name];
|
|
4733
|
+
if (!Array.isArray(value) || !value.length) {
|
|
4734
|
+
return "";
|
|
4735
|
+
}
|
|
4736
|
+
return value[0].replace(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, "");
|
|
4737
|
+
});
|
|
4618
4738
|
const dataSources = computed(() => services?.dataSourceService.get("dataSources"));
|
|
4619
4739
|
const getOptionChildren = (fields = [], dataSourceFieldType = ["any"]) => {
|
|
4620
4740
|
const child = [];
|
|
@@ -4633,7 +4753,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4633
4753
|
child.push(item);
|
|
4634
4754
|
return;
|
|
4635
4755
|
}
|
|
4636
|
-
if (!dataSourceFieldType.includes(fieldType) &&
|
|
4756
|
+
if (!dataSourceFieldType.includes(fieldType) && !["array", "object", "any"].includes(fieldType)) {
|
|
4637
4757
|
return;
|
|
4638
4758
|
}
|
|
4639
4759
|
if (!children.length && ["object", "array", "any"].includes(field.type || "")) {
|
|
@@ -4663,7 +4783,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4663
4783
|
onMounted(() => {
|
|
4664
4784
|
const value = props.model[props.name];
|
|
4665
4785
|
if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
|
4666
|
-
|
|
4786
|
+
showDataSourceFieldSelect.value = true;
|
|
4667
4787
|
}
|
|
4668
4788
|
});
|
|
4669
4789
|
const mForm = inject("mForm");
|
|
@@ -4692,6 +4812,9 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4692
4812
|
const onChangeHandler = (value) => {
|
|
4693
4813
|
emit("change", value);
|
|
4694
4814
|
};
|
|
4815
|
+
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(
|
|
4816
|
+
services?.dataSourceService
|
|
4817
|
+
);
|
|
4695
4818
|
return (_ctx, _cache) => {
|
|
4696
4819
|
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
4697
4820
|
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
@@ -4707,19 +4830,39 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4707
4830
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4708
4831
|
onChange: onChangeHandler
|
|
4709
4832
|
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4710
|
-
_ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4833
|
+
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4711
4834
|
key: 0,
|
|
4712
4835
|
style: { "margin-left": "5px" },
|
|
4713
4836
|
link: "",
|
|
4837
|
+
size: _ctx.size,
|
|
4838
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(editHandler)(selectedDataSourceId.value))
|
|
4839
|
+
}, {
|
|
4840
|
+
default: withCtx(() => [
|
|
4841
|
+
createVNode(_sfc_main$U, { icon: unref(Edit) }, null, 8, ["icon"])
|
|
4842
|
+
]),
|
|
4843
|
+
_: 1
|
|
4844
|
+
}, 8, ["size"])) : createCommentVNode("", true),
|
|
4845
|
+
_ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4846
|
+
key: 1,
|
|
4847
|
+
style: { "margin-left": "5px" },
|
|
4848
|
+
link: "",
|
|
4714
4849
|
type: showDataSourceFieldSelect.value ? "primary" : "default",
|
|
4715
4850
|
size: _ctx.size,
|
|
4716
|
-
onClick: _cache[
|
|
4851
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4717
4852
|
}, {
|
|
4718
4853
|
default: withCtx(() => [
|
|
4719
4854
|
createVNode(_sfc_main$U, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
4720
4855
|
]),
|
|
4721
4856
|
_: 1
|
|
4722
|
-
}, 8, ["type", "size"])) : createCommentVNode("", true)
|
|
4857
|
+
}, 8, ["type", "size"])) : createCommentVNode("", true),
|
|
4858
|
+
createVNode(_sfc_main$K, {
|
|
4859
|
+
ref_key: "editDialog",
|
|
4860
|
+
ref: editDialog,
|
|
4861
|
+
disabled: !unref(editable),
|
|
4862
|
+
values: unref(dataSourceValues),
|
|
4863
|
+
title: unref(dialogTitle),
|
|
4864
|
+
onSubmit: unref(submitDataSourceHandler)
|
|
4865
|
+
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
4723
4866
|
]);
|
|
4724
4867
|
};
|
|
4725
4868
|
}
|
|
@@ -4728,7 +4871,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4728
4871
|
const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4729
4872
|
const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4730
4873
|
const _hoisted_3$7 = { class: "el-input__inner t-input__inner" };
|
|
4731
|
-
const _sfc_main$
|
|
4874
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
4732
4875
|
...{
|
|
4733
4876
|
name: "MFieldsDataSourceInput"
|
|
4734
4877
|
},
|
|
@@ -4966,7 +5109,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4966
5109
|
|
|
4967
5110
|
const _hoisted_1$m = { class: "m-editor-data-source-methods" };
|
|
4968
5111
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
4969
|
-
const _sfc_main$
|
|
5112
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
4970
5113
|
...{
|
|
4971
5114
|
name: "MFieldsDataSourceMethods"
|
|
4972
5115
|
},
|
|
@@ -5072,7 +5215,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5072
5215
|
|
|
5073
5216
|
const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
|
|
5074
5217
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
5075
|
-
const _sfc_main$
|
|
5218
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
5076
5219
|
...{
|
|
5077
5220
|
name: "MFieldsDataSourceMethodSelect"
|
|
5078
5221
|
},
|
|
@@ -5202,7 +5345,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5202
5345
|
|
|
5203
5346
|
const _hoisted_1$k = { class: "m-editor-data-source-fields" };
|
|
5204
5347
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
5205
|
-
const _sfc_main$
|
|
5348
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
5206
5349
|
...{
|
|
5207
5350
|
name: "MFieldsDataSourceMocks"
|
|
5208
5351
|
},
|
|
@@ -5455,7 +5598,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5455
5598
|
}
|
|
5456
5599
|
});
|
|
5457
5600
|
|
|
5458
|
-
const _sfc_main$
|
|
5601
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
5459
5602
|
...{
|
|
5460
5603
|
name: "MFieldsDataSourceSelect"
|
|
5461
5604
|
},
|
|
@@ -5517,7 +5660,7 @@ const _hoisted_2$d = {
|
|
|
5517
5660
|
key: 1,
|
|
5518
5661
|
class: "fullWidth"
|
|
5519
5662
|
};
|
|
5520
|
-
const _sfc_main$
|
|
5663
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
5521
5664
|
...{
|
|
5522
5665
|
name: "MFieldsEventSelect"
|
|
5523
5666
|
},
|
|
@@ -5791,7 +5934,7 @@ const _hoisted_2$c = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1"
|
|
|
5791
5934
|
const _hoisted_4$6 = [
|
|
5792
5935
|
_hoisted_2$c
|
|
5793
5936
|
];
|
|
5794
|
-
const _sfc_main$
|
|
5937
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
5795
5938
|
...{
|
|
5796
5939
|
name: "MEditorCodeIcon"
|
|
5797
5940
|
},
|
|
@@ -5806,7 +5949,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5806
5949
|
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5807
5950
|
const _hoisted_2$b = { key: 0 };
|
|
5808
5951
|
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5809
|
-
const _sfc_main$
|
|
5952
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
5810
5953
|
...{
|
|
5811
5954
|
name: "MFieldsKeyValue"
|
|
5812
5955
|
},
|
|
@@ -5930,7 +6073,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5930
6073
|
size: "default",
|
|
5931
6074
|
disabled: _ctx.disabled,
|
|
5932
6075
|
link: "",
|
|
5933
|
-
icon: _sfc_main$
|
|
6076
|
+
icon: _sfc_main$C,
|
|
5934
6077
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
5935
6078
|
}, null, 8, ["disabled"])) : createCommentVNode("", true)
|
|
5936
6079
|
]);
|
|
@@ -5940,7 +6083,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5940
6083
|
|
|
5941
6084
|
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
5942
6085
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
5943
|
-
const _sfc_main$
|
|
6086
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
5944
6087
|
...{
|
|
5945
6088
|
name: "MFieldsPageFragmentSelect"
|
|
5946
6089
|
},
|
|
@@ -6012,7 +6155,7 @@ const _hoisted_1$f = {
|
|
|
6012
6155
|
class: "m-fields-ui-select",
|
|
6013
6156
|
style: { "display": "flex" }
|
|
6014
6157
|
};
|
|
6015
|
-
const _sfc_main$
|
|
6158
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
6016
6159
|
...{
|
|
6017
6160
|
name: "MFieldsUISelect"
|
|
6018
6161
|
},
|
|
@@ -6200,7 +6343,7 @@ const useGetSo = (target, emit) => {
|
|
|
6200
6343
|
};
|
|
6201
6344
|
};
|
|
6202
6345
|
|
|
6203
|
-
const _sfc_main$
|
|
6346
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
6204
6347
|
...{
|
|
6205
6348
|
name: "MEditorResizer"
|
|
6206
6349
|
},
|
|
@@ -6222,7 +6365,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6222
6365
|
}
|
|
6223
6366
|
});
|
|
6224
6367
|
|
|
6225
|
-
const _sfc_main$
|
|
6368
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
6226
6369
|
...{
|
|
6227
6370
|
name: "MEditorSplitView"
|
|
6228
6371
|
},
|
|
@@ -6338,6 +6481,9 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6338
6481
|
__expose({
|
|
6339
6482
|
updateWidth() {
|
|
6340
6483
|
clientWidth = props.width ?? el.value?.clientWidth ?? clientWidth;
|
|
6484
|
+
if (clientWidth <= 0) {
|
|
6485
|
+
return;
|
|
6486
|
+
}
|
|
6341
6487
|
const columnWidth = getCenterWidth(props.left, props.right);
|
|
6342
6488
|
emit("change", {
|
|
6343
6489
|
left: columnWidth.left,
|
|
@@ -6360,7 +6506,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6360
6506
|
}, [
|
|
6361
6507
|
renderSlot(_ctx.$slots, "left")
|
|
6362
6508
|
], 6),
|
|
6363
|
-
createVNode(_sfc_main$
|
|
6509
|
+
createVNode(_sfc_main$y, { onChange: changeLeft })
|
|
6364
6510
|
], 64)) : createCommentVNode("", true),
|
|
6365
6511
|
createElementVNode("div", {
|
|
6366
6512
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -6369,7 +6515,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6369
6515
|
renderSlot(_ctx.$slots, "center")
|
|
6370
6516
|
], 6),
|
|
6371
6517
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6372
|
-
createVNode(_sfc_main$
|
|
6518
|
+
createVNode(_sfc_main$y, { onChange: changeRight }),
|
|
6373
6519
|
createElementVNode("div", {
|
|
6374
6520
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
6375
6521
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -6387,7 +6533,7 @@ const _hoisted_1$e = {
|
|
|
6387
6533
|
class: "menu-item-text"
|
|
6388
6534
|
};
|
|
6389
6535
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
6390
|
-
const _sfc_main$
|
|
6536
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
6391
6537
|
...{
|
|
6392
6538
|
name: "MEditorToolButton"
|
|
6393
6539
|
},
|
|
@@ -6552,7 +6698,7 @@ const _hoisted_1$d = {
|
|
|
6552
6698
|
key: 1,
|
|
6553
6699
|
style: { "width": "21px" }
|
|
6554
6700
|
};
|
|
6555
|
-
const _sfc_main$
|
|
6701
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
6556
6702
|
...{
|
|
6557
6703
|
name: "MEditorPageBarAddButton"
|
|
6558
6704
|
},
|
|
@@ -6592,7 +6738,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
6592
6738
|
}
|
|
6593
6739
|
});
|
|
6594
6740
|
|
|
6595
|
-
const _sfc_main$
|
|
6741
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
6596
6742
|
...{
|
|
6597
6743
|
name: "MEditorPageBarScrollContainer"
|
|
6598
6744
|
},
|
|
@@ -6721,7 +6867,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
6721
6867
|
}
|
|
6722
6868
|
});
|
|
6723
6869
|
|
|
6724
|
-
const _sfc_main$
|
|
6870
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
6725
6871
|
...{
|
|
6726
6872
|
name: "MEditorPageBarSwitchTypeButton"
|
|
6727
6873
|
},
|
|
@@ -6769,7 +6915,7 @@ const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
|
|
|
6769
6915
|
const _hoisted_2$8 = ["onClick"];
|
|
6770
6916
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
6771
6917
|
const _hoisted_4$5 = ["title"];
|
|
6772
|
-
const _sfc_main$
|
|
6918
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
6773
6919
|
...{
|
|
6774
6920
|
name: "MEditorPageBar"
|
|
6775
6921
|
},
|
|
@@ -6848,14 +6994,14 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6848
6994
|
};
|
|
6849
6995
|
return (_ctx, _cache) => {
|
|
6850
6996
|
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
6851
|
-
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$
|
|
6997
|
+
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$t, {
|
|
6852
6998
|
key: 0,
|
|
6853
6999
|
modelValue: active.value,
|
|
6854
7000
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
6855
7001
|
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
6856
|
-
createVNode(_sfc_main$
|
|
7002
|
+
createVNode(_sfc_main$u, { type: active.value }, {
|
|
6857
7003
|
prepend: withCtx(() => [
|
|
6858
|
-
createVNode(_sfc_main$
|
|
7004
|
+
createVNode(_sfc_main$v, { type: active.value }, null, 8, ["type"])
|
|
6859
7005
|
]),
|
|
6860
7006
|
default: withCtx(() => [
|
|
6861
7007
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (item) => {
|
|
@@ -6888,7 +7034,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6888
7034
|
default: withCtx(() => [
|
|
6889
7035
|
createElementVNode("div", null, [
|
|
6890
7036
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
6891
|
-
createVNode(_sfc_main$
|
|
7037
|
+
createVNode(_sfc_main$w, {
|
|
6892
7038
|
data: {
|
|
6893
7039
|
type: "button",
|
|
6894
7040
|
text: "复制",
|
|
@@ -6896,7 +7042,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6896
7042
|
handler: () => copy(item)
|
|
6897
7043
|
}
|
|
6898
7044
|
}, null, 8, ["data"]),
|
|
6899
|
-
createVNode(_sfc_main$
|
|
7045
|
+
createVNode(_sfc_main$w, {
|
|
6900
7046
|
data: {
|
|
6901
7047
|
type: "button",
|
|
6902
7048
|
text: "删除",
|
|
@@ -6923,7 +7069,7 @@ const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
|
6923
7069
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
6924
7070
|
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
6925
7071
|
const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
|
|
6926
|
-
const _sfc_main$
|
|
7072
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
6927
7073
|
...{
|
|
6928
7074
|
name: "MEditorAddPageBox"
|
|
6929
7075
|
},
|
|
@@ -6978,7 +7124,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
6978
7124
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
6979
7125
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
6980
7126
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
6981
|
-
const _sfc_main$
|
|
7127
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
6982
7128
|
...{
|
|
6983
7129
|
name: "MEditorFramework"
|
|
6984
7130
|
},
|
|
@@ -6997,10 +7143,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6997
7143
|
const stageLoading = computed(() => editorService?.get("stageLoading") || false);
|
|
6998
7144
|
const showSrc = computed(() => uiService?.get("showSrc"));
|
|
6999
7145
|
const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
7146
|
+
const getRightColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
7000
7147
|
const columnWidth = ref({
|
|
7001
7148
|
left: getLeftColumnWidthCacheData(),
|
|
7002
7149
|
center: 0,
|
|
7003
|
-
right:
|
|
7150
|
+
right: getRightColumnWidthCacheData()
|
|
7004
7151
|
});
|
|
7005
7152
|
watch(pageLength, () => {
|
|
7006
7153
|
splitView.value?.updateWidth();
|
|
@@ -7061,7 +7208,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7061
7208
|
options: unref(codeOptions),
|
|
7062
7209
|
onSave: saveCode
|
|
7063
7210
|
}, null, 8, ["init-values", "options"])
|
|
7064
|
-
]) : withDirectives((openBlock(), createBlock(_sfc_main$
|
|
7211
|
+
]) : withDirectives((openBlock(), createBlock(_sfc_main$x, {
|
|
7065
7212
|
key: 1,
|
|
7066
7213
|
"element-loading-text": "Runtime 加载中...",
|
|
7067
7214
|
ref_key: "splitView",
|
|
@@ -7085,10 +7232,10 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7085
7232
|
]),
|
|
7086
7233
|
center: withCtx(() => [
|
|
7087
7234
|
page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
7088
|
-
createVNode(_sfc_main$
|
|
7235
|
+
createVNode(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
7089
7236
|
]),
|
|
7090
7237
|
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7091
|
-
createVNode(_sfc_main$
|
|
7238
|
+
createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
7092
7239
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
7093
7240
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7094
7241
|
]),
|
|
@@ -7123,7 +7270,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7123
7270
|
}
|
|
7124
7271
|
});
|
|
7125
7272
|
|
|
7126
|
-
const _sfc_main$
|
|
7273
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
7127
7274
|
...{
|
|
7128
7275
|
name: "MEditorNavMenu"
|
|
7129
7276
|
},
|
|
@@ -7305,7 +7452,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7305
7452
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
7306
7453
|
}, [
|
|
7307
7454
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
7308
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7455
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
7309
7456
|
data: item,
|
|
7310
7457
|
key: index
|
|
7311
7458
|
}, null, 8, ["data"]);
|
|
@@ -7318,7 +7465,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7318
7465
|
});
|
|
7319
7466
|
|
|
7320
7467
|
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
7321
|
-
const _sfc_main$
|
|
7468
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
7322
7469
|
...{
|
|
7323
7470
|
name: "MEditorPropsPanel"
|
|
7324
7471
|
},
|
|
@@ -7421,7 +7568,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
7421
7568
|
}
|
|
7422
7569
|
});
|
|
7423
7570
|
|
|
7424
|
-
const _sfc_main$
|
|
7571
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
7425
7572
|
...{
|
|
7426
7573
|
name: "MEditorSearchInput"
|
|
7427
7574
|
},
|
|
@@ -7479,7 +7626,7 @@ const _hoisted_4$3 = {
|
|
|
7479
7626
|
key: 0,
|
|
7480
7627
|
class: "m-editor-tree-node-children"
|
|
7481
7628
|
};
|
|
7482
|
-
const _sfc_main$
|
|
7629
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
7483
7630
|
...{
|
|
7484
7631
|
name: "MEditorTreeNode"
|
|
7485
7632
|
},
|
|
@@ -7600,7 +7747,7 @@ const _hoisted_1$8 = {
|
|
|
7600
7747
|
key: 1,
|
|
7601
7748
|
class: "m-editor-tree-empty"
|
|
7602
7749
|
};
|
|
7603
|
-
const _sfc_main$
|
|
7750
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
7604
7751
|
...{
|
|
7605
7752
|
name: "MEditorTree"
|
|
7606
7753
|
},
|
|
@@ -7624,7 +7771,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
7624
7771
|
onDragover: handleDragOver
|
|
7625
7772
|
}, [
|
|
7626
7773
|
_ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
|
|
7627
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7774
|
+
return openBlock(), createBlock(_sfc_main$m, {
|
|
7628
7775
|
key: item.id,
|
|
7629
7776
|
data: item,
|
|
7630
7777
|
indent: _ctx.indent,
|
|
@@ -7721,7 +7868,7 @@ const useNodeStatus$1 = (nodeData) => {
|
|
|
7721
7868
|
};
|
|
7722
7869
|
};
|
|
7723
7870
|
|
|
7724
|
-
const _sfc_main$
|
|
7871
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
7725
7872
|
...{
|
|
7726
7873
|
name: "MEditorCodeBlockList"
|
|
7727
7874
|
},
|
|
@@ -7803,7 +7950,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7803
7950
|
filter: filterTextChangeHandler
|
|
7804
7951
|
});
|
|
7805
7952
|
return (_ctx, _cache) => {
|
|
7806
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7953
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
7807
7954
|
data: codeList.value,
|
|
7808
7955
|
"node-status-map": unref(nodeStatusMap),
|
|
7809
7956
|
onNodeClick: clickHandler
|
|
@@ -7860,7 +8007,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7860
8007
|
});
|
|
7861
8008
|
|
|
7862
8009
|
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
7863
|
-
const _sfc_main$
|
|
8010
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
7864
8011
|
...{
|
|
7865
8012
|
name: "MEditorCodeBlockListPanel"
|
|
7866
8013
|
},
|
|
@@ -7882,7 +8029,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7882
8029
|
default: withCtx(() => [
|
|
7883
8030
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
7884
8031
|
createElementVNode("div", _hoisted_1$7, [
|
|
7885
|
-
createVNode(_sfc_main$
|
|
8032
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
7886
8033
|
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
7887
8034
|
key: 0,
|
|
7888
8035
|
class: "create-code-button",
|
|
@@ -7898,7 +8045,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7898
8045
|
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
7899
8046
|
])
|
|
7900
8047
|
]),
|
|
7901
|
-
createVNode(_sfc_main$
|
|
8048
|
+
createVNode(_sfc_main$k, {
|
|
7902
8049
|
ref_key: "codeBlockList",
|
|
7903
8050
|
ref: codeBlockList,
|
|
7904
8051
|
"custom-error": _ctx.customError,
|
|
@@ -7929,81 +8076,6 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7929
8076
|
}
|
|
7930
8077
|
});
|
|
7931
8078
|
|
|
7932
|
-
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
7933
|
-
...{
|
|
7934
|
-
name: "MEditorDataSourceConfigPanel"
|
|
7935
|
-
},
|
|
7936
|
-
__name: "DataSourceConfigPanel",
|
|
7937
|
-
props: /* @__PURE__ */ mergeModels({
|
|
7938
|
-
title: {},
|
|
7939
|
-
values: {},
|
|
7940
|
-
disabled: { type: Boolean }
|
|
7941
|
-
}, {
|
|
7942
|
-
"visible": { type: Boolean, ...{ default: false } },
|
|
7943
|
-
"visibleModifiers": {},
|
|
7944
|
-
"width": { default: 670 },
|
|
7945
|
-
"widthModifiers": {}
|
|
7946
|
-
}),
|
|
7947
|
-
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:visible", "update:width"]),
|
|
7948
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
7949
|
-
const props = __props;
|
|
7950
|
-
const boxVisible = useModel(__props, "visible");
|
|
7951
|
-
const width = useModel(__props, "width");
|
|
7952
|
-
const emit = __emit;
|
|
7953
|
-
const services = inject("services");
|
|
7954
|
-
const initValues = ref({});
|
|
7955
|
-
const dataSourceConfig = ref([]);
|
|
7956
|
-
const { height: editorHeight } = useEditorContentHeight();
|
|
7957
|
-
const parentFloating = inject("parentFloating", ref(null));
|
|
7958
|
-
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
7959
|
-
watchEffect(() => {
|
|
7960
|
-
initValues.value = props.values;
|
|
7961
|
-
dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
|
|
7962
|
-
});
|
|
7963
|
-
const submitHandler = (values) => {
|
|
7964
|
-
emit("submit", values);
|
|
7965
|
-
};
|
|
7966
|
-
const errorHandler = (error) => {
|
|
7967
|
-
tMagicMessage.error(error.message);
|
|
7968
|
-
};
|
|
7969
|
-
__expose({
|
|
7970
|
-
show() {
|
|
7971
|
-
calcBoxPosition();
|
|
7972
|
-
boxVisible.value = true;
|
|
7973
|
-
},
|
|
7974
|
-
hide() {
|
|
7975
|
-
boxVisible.value = false;
|
|
7976
|
-
}
|
|
7977
|
-
});
|
|
7978
|
-
return (_ctx, _cache) => {
|
|
7979
|
-
return openBlock(), createBlock(_sfc_main$P, {
|
|
7980
|
-
visible: boxVisible.value,
|
|
7981
|
-
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => boxVisible.value = $event),
|
|
7982
|
-
width: width.value,
|
|
7983
|
-
"onUpdate:width": _cache[1] || (_cache[1] = ($event) => width.value = $event),
|
|
7984
|
-
height: unref(editorHeight),
|
|
7985
|
-
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => isRef(editorHeight) ? editorHeight.value = $event : null),
|
|
7986
|
-
title: _ctx.title,
|
|
7987
|
-
position: unref(boxPosition)
|
|
7988
|
-
}, {
|
|
7989
|
-
body: withCtx(() => [
|
|
7990
|
-
createVNode(unref(MFormBox), {
|
|
7991
|
-
"label-width": "80px",
|
|
7992
|
-
title: _ctx.title,
|
|
7993
|
-
config: dataSourceConfig.value,
|
|
7994
|
-
values: initValues.value,
|
|
7995
|
-
disabled: _ctx.disabled,
|
|
7996
|
-
style: { "height": "100%" },
|
|
7997
|
-
onSubmit: submitHandler,
|
|
7998
|
-
onError: errorHandler
|
|
7999
|
-
}, null, 8, ["title", "config", "values", "disabled"])
|
|
8000
|
-
]),
|
|
8001
|
-
_: 1
|
|
8002
|
-
}, 8, ["visible", "width", "height", "title", "position"]);
|
|
8003
|
-
};
|
|
8004
|
-
}
|
|
8005
|
-
});
|
|
8006
|
-
|
|
8007
8079
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
8008
8080
|
...{
|
|
8009
8081
|
name: "MEditorDataSourceList"
|
|
@@ -8093,7 +8165,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8093
8165
|
filter: filterTextChangeHandler
|
|
8094
8166
|
});
|
|
8095
8167
|
return (_ctx, _cache) => {
|
|
8096
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8168
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
8097
8169
|
data: list.value,
|
|
8098
8170
|
"node-status-map": unref(nodeStatusMap),
|
|
8099
8171
|
onNodeClick: clickHandler
|
|
@@ -8155,10 +8227,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8155
8227
|
__name: "DataSourceListPanel",
|
|
8156
8228
|
setup(__props) {
|
|
8157
8229
|
const { dataSourceService } = inject("services") || {};
|
|
8158
|
-
const editDialog =
|
|
8159
|
-
const dataSourceValues = ref({});
|
|
8160
|
-
const dialogTitle = ref("");
|
|
8161
|
-
const editable = computed(() => dataSourceService?.get("editable") ?? true);
|
|
8230
|
+
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
8162
8231
|
const datasourceTypeList = computed(
|
|
8163
8232
|
() => [
|
|
8164
8233
|
{ text: "基础", type: "base" },
|
|
@@ -8181,26 +8250,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8181
8250
|
dialogTitle.value = `新增${datasourceType?.text || ""}`;
|
|
8182
8251
|
editDialog.value.show();
|
|
8183
8252
|
};
|
|
8184
|
-
const editHandler = (id) => {
|
|
8185
|
-
if (!editDialog.value)
|
|
8186
|
-
return;
|
|
8187
|
-
dataSourceValues.value = {
|
|
8188
|
-
...dataSourceService?.getDataSourceById(id)
|
|
8189
|
-
};
|
|
8190
|
-
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
8191
|
-
editDialog.value.show();
|
|
8192
|
-
};
|
|
8193
8253
|
const removeHandler = (id) => {
|
|
8194
8254
|
dataSourceService?.remove(id);
|
|
8195
8255
|
};
|
|
8196
|
-
const submitDataSourceHandler = (value) => {
|
|
8197
|
-
if (value.id) {
|
|
8198
|
-
dataSourceService?.update(value);
|
|
8199
|
-
} else {
|
|
8200
|
-
dataSourceService?.add(value);
|
|
8201
|
-
}
|
|
8202
|
-
editDialog.value?.hide();
|
|
8203
|
-
};
|
|
8204
8256
|
const dataSourceList = ref();
|
|
8205
8257
|
const filterTextChangeHandler = (val) => {
|
|
8206
8258
|
dataSourceList.value?.filter(val);
|
|
@@ -8210,8 +8262,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8210
8262
|
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
8211
8263
|
default: withCtx(() => [
|
|
8212
8264
|
createElementVNode("div", _hoisted_1$6, [
|
|
8213
|
-
createVNode(_sfc_main$
|
|
8214
|
-
editable
|
|
8265
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
8266
|
+
unref(editable) ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
8215
8267
|
key: 0,
|
|
8216
8268
|
placement: "right"
|
|
8217
8269
|
}, {
|
|
@@ -8229,7 +8281,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8229
8281
|
default: withCtx(() => [
|
|
8230
8282
|
createElementVNode("div", _hoisted_2$5, [
|
|
8231
8283
|
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
8232
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8284
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
8233
8285
|
data: {
|
|
8234
8286
|
type: "button",
|
|
8235
8287
|
text: item.text,
|
|
@@ -8247,20 +8299,22 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8247
8299
|
renderSlot(_ctx.$slots, "data-source-panel-search")
|
|
8248
8300
|
]),
|
|
8249
8301
|
createVNode(_sfc_main$i, {
|
|
8250
|
-
|
|
8302
|
+
ref_key: "dataSourceList",
|
|
8303
|
+
ref: dataSourceList,
|
|
8304
|
+
onEdit: unref(editHandler),
|
|
8251
8305
|
onRemove: removeHandler
|
|
8252
|
-
})
|
|
8306
|
+
}, null, 8, ["onEdit"])
|
|
8253
8307
|
]),
|
|
8254
8308
|
_: 3
|
|
8255
8309
|
}),
|
|
8256
|
-
createVNode(_sfc_main$
|
|
8310
|
+
createVNode(_sfc_main$K, {
|
|
8257
8311
|
ref_key: "editDialog",
|
|
8258
8312
|
ref: editDialog,
|
|
8259
|
-
disabled: !editable
|
|
8260
|
-
values: dataSourceValues
|
|
8261
|
-
title: dialogTitle
|
|
8262
|
-
onSubmit: submitDataSourceHandler
|
|
8263
|
-
}, null, 8, ["disabled", "values", "title"])
|
|
8313
|
+
disabled: !unref(editable),
|
|
8314
|
+
values: unref(dataSourceValues),
|
|
8315
|
+
title: unref(dialogTitle),
|
|
8316
|
+
onSubmit: unref(submitDataSourceHandler)
|
|
8317
|
+
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
8264
8318
|
], 64);
|
|
8265
8319
|
};
|
|
8266
8320
|
}
|
|
@@ -8397,7 +8451,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
8397
8451
|
renderSlot(_ctx.$slots, "title"),
|
|
8398
8452
|
createElementVNode("div", null, [
|
|
8399
8453
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
8400
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8454
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
8401
8455
|
"event-type": "mouseup",
|
|
8402
8456
|
ref_for: true,
|
|
8403
8457
|
ref_key: "buttons",
|
|
@@ -9173,8 +9227,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
9173
9227
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
9174
9228
|
default: withCtx(() => [
|
|
9175
9229
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
9176
|
-
createVNode(_sfc_main$
|
|
9177
|
-
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$
|
|
9230
|
+
createVNode(_sfc_main$n, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
9231
|
+
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$l, {
|
|
9178
9232
|
key: 0,
|
|
9179
9233
|
tabindex: "-1",
|
|
9180
9234
|
ref_key: "tree",
|
|
@@ -9300,7 +9354,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
9300
9354
|
"model-value": collapseValue.value
|
|
9301
9355
|
}, {
|
|
9302
9356
|
default: withCtx(() => [
|
|
9303
|
-
createVNode(_sfc_main$
|
|
9357
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
9304
9358
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
|
|
9305
9359
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
9306
9360
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
@@ -9410,7 +9464,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9410
9464
|
type: "component",
|
|
9411
9465
|
icon: EditPen,
|
|
9412
9466
|
text: "代码编辑",
|
|
9413
|
-
component: _sfc_main$
|
|
9467
|
+
component: _sfc_main$j,
|
|
9414
9468
|
slots: {}
|
|
9415
9469
|
},
|
|
9416
9470
|
"data-source": {
|
|
@@ -10044,7 +10098,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10044
10098
|
position: menuPosition.value
|
|
10045
10099
|
}, {
|
|
10046
10100
|
body: withCtx(() => [
|
|
10047
|
-
createVNode(_sfc_main$
|
|
10101
|
+
createVNode(_sfc_main$l, {
|
|
10048
10102
|
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
10049
10103
|
data: nodeData.value,
|
|
10050
10104
|
"node-status-map": unref(nodeStatusMap),
|
|
@@ -11626,13 +11680,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11626
11680
|
provide("stageOptions", stageOptions);
|
|
11627
11681
|
__expose(services);
|
|
11628
11682
|
return (_ctx, _cache) => {
|
|
11629
|
-
return openBlock(), createBlock(_sfc_main$
|
|
11683
|
+
return openBlock(), createBlock(_sfc_main$q, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11630
11684
|
header: withCtx(() => [
|
|
11631
11685
|
renderSlot(_ctx.$slots, "header")
|
|
11632
11686
|
]),
|
|
11633
11687
|
nav: withCtx(() => [
|
|
11634
11688
|
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
11635
|
-
createVNode(_sfc_main$
|
|
11689
|
+
createVNode(_sfc_main$p, { data: _ctx.menu }, null, 8, ["data"])
|
|
11636
11690
|
])
|
|
11637
11691
|
]),
|
|
11638
11692
|
"content-before": withCtx(() => [
|
|
@@ -11707,7 +11761,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11707
11761
|
]),
|
|
11708
11762
|
"props-panel": withCtx(() => [
|
|
11709
11763
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11710
|
-
createVNode(_sfc_main$
|
|
11764
|
+
createVNode(_sfc_main$o, {
|
|
11711
11765
|
"extend-state": _ctx.extendFormState,
|
|
11712
11766
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11713
11767
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
@@ -11755,22 +11809,22 @@ const index = {
|
|
|
11755
11809
|
setConfig(option);
|
|
11756
11810
|
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11757
11811
|
app.component("magic-code-editor", _sfc_main$T);
|
|
11758
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
11812
|
+
app.component("m-fields-ui-select", _sfc_main$z);
|
|
11759
11813
|
app.component("m-fields-code-link", _sfc_main$R);
|
|
11760
11814
|
app.component("m-fields-vs-code", _sfc_main$S);
|
|
11761
11815
|
app.component("m-fields-code-select", _sfc_main$Q);
|
|
11762
11816
|
app.component("m-fields-code-select-col", _sfc_main$M);
|
|
11763
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
11817
|
+
app.component("m-fields-event-select", _sfc_main$D);
|
|
11764
11818
|
app.component("m-fields-data-source-fields", _sfc_main$L);
|
|
11765
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
11766
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
11767
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
11768
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
11769
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
11770
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
11771
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
11772
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
11819
|
+
app.component("m-fields-data-source-mocks", _sfc_main$F);
|
|
11820
|
+
app.component("m-fields-key-value", _sfc_main$B);
|
|
11821
|
+
app.component("m-fields-data-source-input", _sfc_main$I);
|
|
11822
|
+
app.component("m-fields-data-source-select", _sfc_main$E);
|
|
11823
|
+
app.component("m-fields-data-source-methods", _sfc_main$H);
|
|
11824
|
+
app.component("m-fields-data-source-method-select", _sfc_main$G);
|
|
11825
|
+
app.component("m-fields-data-source-field-select", _sfc_main$J);
|
|
11826
|
+
app.component("m-fields-page-fragment-select", _sfc_main$A);
|
|
11773
11827
|
}
|
|
11774
11828
|
};
|
|
11775
11829
|
|
|
11776
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$O as CodeBlockEditor, _sfc_main$
|
|
11830
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$O as CodeBlockEditor, _sfc_main$k as CodeBlockList, _sfc_main$j as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$K as DataSourceConfigPanel, _sfc_main$J as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$I as DataSourceInput, _sfc_main$G as DataSourceMethodSelect, _sfc_main$H as DataSourceMethods, _sfc_main$F as DataSourceMocks, _sfc_main$E as DataSourceSelect, DragType, _sfc_main$D as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$U as Icon, KeyBindingCommand, _sfc_main$B as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$x as LayoutContainer, _sfc_main$A as PageFragmentSelect, _sfc_main$o as PropsPanel, _sfc_main$y as Resizer, _sfc_main$x as SplitView, _sfc_main$T as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$w as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useEditorContentHeight, useFloatBox, useStage, useWindowRect, warn };
|