@tmagic/editor 1.4.1 → 1.4.3
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 +244 -187
- package/dist/tmagic-editor.umd.cjs +263 -206
- package/package.json +11 -11
- package/src/components/SplitView.vue +5 -0
- package/src/fields/CodeSelect.vue +11 -2
- package/src/fields/DataSourceFieldSelect.vue +50 -14
- 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 +3 -29
- 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 || "")) {
|
|
@@ -4660,12 +4780,19 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4660
4780
|
};
|
|
4661
4781
|
});
|
|
4662
4782
|
const showDataSourceFieldSelect = ref(false);
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4783
|
+
watch(
|
|
4784
|
+
() => props.model[props.name],
|
|
4785
|
+
(value) => {
|
|
4786
|
+
if (Array.isArray(value) && typeof value[0] === "string" && value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
|
|
4787
|
+
showDataSourceFieldSelect.value = true;
|
|
4788
|
+
} else {
|
|
4789
|
+
showDataSourceFieldSelect.value = false;
|
|
4790
|
+
}
|
|
4791
|
+
},
|
|
4792
|
+
{
|
|
4793
|
+
immediate: true
|
|
4667
4794
|
}
|
|
4668
|
-
|
|
4795
|
+
);
|
|
4669
4796
|
const mForm = inject("mForm");
|
|
4670
4797
|
const type = computed(() => {
|
|
4671
4798
|
let type2 = props.config.fieldConfig?.type;
|
|
@@ -4692,6 +4819,9 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4692
4819
|
const onChangeHandler = (value) => {
|
|
4693
4820
|
emit("change", value);
|
|
4694
4821
|
};
|
|
4822
|
+
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(
|
|
4823
|
+
services?.dataSourceService
|
|
4824
|
+
);
|
|
4695
4825
|
return (_ctx, _cache) => {
|
|
4696
4826
|
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
4697
4827
|
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
@@ -4707,19 +4837,37 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4707
4837
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
|
|
4708
4838
|
onChange: onChangeHandler
|
|
4709
4839
|
}, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
|
|
4710
|
-
_ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4840
|
+
(showDataSourceFieldSelect.value || !_ctx.config.fieldConfig) && selectedDataSourceId.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4711
4841
|
key: 0,
|
|
4712
4842
|
style: { "margin-left": "5px" },
|
|
4713
|
-
|
|
4843
|
+
size: _ctx.size,
|
|
4844
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(editHandler)(selectedDataSourceId.value))
|
|
4845
|
+
}, {
|
|
4846
|
+
default: withCtx(() => [
|
|
4847
|
+
createVNode(_sfc_main$U, { icon: unref(Edit) }, null, 8, ["icon"])
|
|
4848
|
+
]),
|
|
4849
|
+
_: 1
|
|
4850
|
+
}, 8, ["size"])) : createCommentVNode("", true),
|
|
4851
|
+
_ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4852
|
+
key: 1,
|
|
4853
|
+
style: { "margin-left": "5px" },
|
|
4714
4854
|
type: showDataSourceFieldSelect.value ? "primary" : "default",
|
|
4715
4855
|
size: _ctx.size,
|
|
4716
|
-
onClick: _cache[
|
|
4856
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showDataSourceFieldSelect.value = !showDataSourceFieldSelect.value)
|
|
4717
4857
|
}, {
|
|
4718
4858
|
default: withCtx(() => [
|
|
4719
4859
|
createVNode(_sfc_main$U, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
4720
4860
|
]),
|
|
4721
4861
|
_: 1
|
|
4722
|
-
}, 8, ["type", "size"])) : createCommentVNode("", true)
|
|
4862
|
+
}, 8, ["type", "size"])) : createCommentVNode("", true),
|
|
4863
|
+
createVNode(_sfc_main$K, {
|
|
4864
|
+
ref_key: "editDialog",
|
|
4865
|
+
ref: editDialog,
|
|
4866
|
+
disabled: !unref(editable),
|
|
4867
|
+
values: unref(dataSourceValues),
|
|
4868
|
+
title: unref(dialogTitle),
|
|
4869
|
+
onSubmit: unref(submitDataSourceHandler)
|
|
4870
|
+
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
4723
4871
|
]);
|
|
4724
4872
|
};
|
|
4725
4873
|
}
|
|
@@ -4728,7 +4876,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
4728
4876
|
const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4729
4877
|
const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4730
4878
|
const _hoisted_3$7 = { class: "el-input__inner t-input__inner" };
|
|
4731
|
-
const _sfc_main$
|
|
4879
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
4732
4880
|
...{
|
|
4733
4881
|
name: "MFieldsDataSourceInput"
|
|
4734
4882
|
},
|
|
@@ -4966,7 +5114,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4966
5114
|
|
|
4967
5115
|
const _hoisted_1$m = { class: "m-editor-data-source-methods" };
|
|
4968
5116
|
const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
|
|
4969
|
-
const _sfc_main$
|
|
5117
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
4970
5118
|
...{
|
|
4971
5119
|
name: "MFieldsDataSourceMethods"
|
|
4972
5120
|
},
|
|
@@ -5072,7 +5220,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5072
5220
|
|
|
5073
5221
|
const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
|
|
5074
5222
|
const _hoisted_2$f = { class: "data-source-method-select-container" };
|
|
5075
|
-
const _sfc_main$
|
|
5223
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
5076
5224
|
...{
|
|
5077
5225
|
name: "MFieldsDataSourceMethodSelect"
|
|
5078
5226
|
},
|
|
@@ -5202,7 +5350,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5202
5350
|
|
|
5203
5351
|
const _hoisted_1$k = { class: "m-editor-data-source-fields" };
|
|
5204
5352
|
const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
|
|
5205
|
-
const _sfc_main$
|
|
5353
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
5206
5354
|
...{
|
|
5207
5355
|
name: "MFieldsDataSourceMocks"
|
|
5208
5356
|
},
|
|
@@ -5455,7 +5603,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5455
5603
|
}
|
|
5456
5604
|
});
|
|
5457
5605
|
|
|
5458
|
-
const _sfc_main$
|
|
5606
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
5459
5607
|
...{
|
|
5460
5608
|
name: "MFieldsDataSourceSelect"
|
|
5461
5609
|
},
|
|
@@ -5517,7 +5665,7 @@ const _hoisted_2$d = {
|
|
|
5517
5665
|
key: 1,
|
|
5518
5666
|
class: "fullWidth"
|
|
5519
5667
|
};
|
|
5520
|
-
const _sfc_main$
|
|
5668
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
5521
5669
|
...{
|
|
5522
5670
|
name: "MFieldsEventSelect"
|
|
5523
5671
|
},
|
|
@@ -5791,7 +5939,7 @@ const _hoisted_2$c = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1"
|
|
|
5791
5939
|
const _hoisted_4$6 = [
|
|
5792
5940
|
_hoisted_2$c
|
|
5793
5941
|
];
|
|
5794
|
-
const _sfc_main$
|
|
5942
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
5795
5943
|
...{
|
|
5796
5944
|
name: "MEditorCodeIcon"
|
|
5797
5945
|
},
|
|
@@ -5806,7 +5954,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
5806
5954
|
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
5807
5955
|
const _hoisted_2$b = { key: 0 };
|
|
5808
5956
|
const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
5809
|
-
const _sfc_main$
|
|
5957
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
5810
5958
|
...{
|
|
5811
5959
|
name: "MFieldsKeyValue"
|
|
5812
5960
|
},
|
|
@@ -5930,7 +6078,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5930
6078
|
size: "default",
|
|
5931
6079
|
disabled: _ctx.disabled,
|
|
5932
6080
|
link: "",
|
|
5933
|
-
icon: _sfc_main$
|
|
6081
|
+
icon: _sfc_main$C,
|
|
5934
6082
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
5935
6083
|
}, null, 8, ["disabled"])) : createCommentVNode("", true)
|
|
5936
6084
|
]);
|
|
@@ -5940,7 +6088,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
5940
6088
|
|
|
5941
6089
|
const _hoisted_1$g = { class: "m-fields-page-fragment-select" };
|
|
5942
6090
|
const _hoisted_2$a = { class: "page-fragment-select-container" };
|
|
5943
|
-
const _sfc_main$
|
|
6091
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
5944
6092
|
...{
|
|
5945
6093
|
name: "MFieldsPageFragmentSelect"
|
|
5946
6094
|
},
|
|
@@ -6012,7 +6160,7 @@ const _hoisted_1$f = {
|
|
|
6012
6160
|
class: "m-fields-ui-select",
|
|
6013
6161
|
style: { "display": "flex" }
|
|
6014
6162
|
};
|
|
6015
|
-
const _sfc_main$
|
|
6163
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
6016
6164
|
...{
|
|
6017
6165
|
name: "MFieldsUISelect"
|
|
6018
6166
|
},
|
|
@@ -6200,7 +6348,7 @@ const useGetSo = (target, emit) => {
|
|
|
6200
6348
|
};
|
|
6201
6349
|
};
|
|
6202
6350
|
|
|
6203
|
-
const _sfc_main$
|
|
6351
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
6204
6352
|
...{
|
|
6205
6353
|
name: "MEditorResizer"
|
|
6206
6354
|
},
|
|
@@ -6222,7 +6370,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6222
6370
|
}
|
|
6223
6371
|
});
|
|
6224
6372
|
|
|
6225
|
-
const _sfc_main$
|
|
6373
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
6226
6374
|
...{
|
|
6227
6375
|
name: "MEditorSplitView"
|
|
6228
6376
|
},
|
|
@@ -6338,6 +6486,9 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6338
6486
|
__expose({
|
|
6339
6487
|
updateWidth() {
|
|
6340
6488
|
clientWidth = props.width ?? el.value?.clientWidth ?? clientWidth;
|
|
6489
|
+
if (clientWidth <= 0) {
|
|
6490
|
+
return;
|
|
6491
|
+
}
|
|
6341
6492
|
const columnWidth = getCenterWidth(props.left, props.right);
|
|
6342
6493
|
emit("change", {
|
|
6343
6494
|
left: columnWidth.left,
|
|
@@ -6360,7 +6511,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6360
6511
|
}, [
|
|
6361
6512
|
renderSlot(_ctx.$slots, "left")
|
|
6362
6513
|
], 6),
|
|
6363
|
-
createVNode(_sfc_main$
|
|
6514
|
+
createVNode(_sfc_main$y, { onChange: changeLeft })
|
|
6364
6515
|
], 64)) : createCommentVNode("", true),
|
|
6365
6516
|
createElementVNode("div", {
|
|
6366
6517
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -6369,7 +6520,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
6369
6520
|
renderSlot(_ctx.$slots, "center")
|
|
6370
6521
|
], 6),
|
|
6371
6522
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
6372
|
-
createVNode(_sfc_main$
|
|
6523
|
+
createVNode(_sfc_main$y, { onChange: changeRight }),
|
|
6373
6524
|
createElementVNode("div", {
|
|
6374
6525
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
6375
6526
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -6387,7 +6538,7 @@ const _hoisted_1$e = {
|
|
|
6387
6538
|
class: "menu-item-text"
|
|
6388
6539
|
};
|
|
6389
6540
|
const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
|
|
6390
|
-
const _sfc_main$
|
|
6541
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
6391
6542
|
...{
|
|
6392
6543
|
name: "MEditorToolButton"
|
|
6393
6544
|
},
|
|
@@ -6552,7 +6703,7 @@ const _hoisted_1$d = {
|
|
|
6552
6703
|
key: 1,
|
|
6553
6704
|
style: { "width": "21px" }
|
|
6554
6705
|
};
|
|
6555
|
-
const _sfc_main$
|
|
6706
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
6556
6707
|
...{
|
|
6557
6708
|
name: "MEditorPageBarAddButton"
|
|
6558
6709
|
},
|
|
@@ -6592,7 +6743,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
6592
6743
|
}
|
|
6593
6744
|
});
|
|
6594
6745
|
|
|
6595
|
-
const _sfc_main$
|
|
6746
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
6596
6747
|
...{
|
|
6597
6748
|
name: "MEditorPageBarScrollContainer"
|
|
6598
6749
|
},
|
|
@@ -6721,7 +6872,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
6721
6872
|
}
|
|
6722
6873
|
});
|
|
6723
6874
|
|
|
6724
|
-
const _sfc_main$
|
|
6875
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
6725
6876
|
...{
|
|
6726
6877
|
name: "MEditorPageBarSwitchTypeButton"
|
|
6727
6878
|
},
|
|
@@ -6769,7 +6920,7 @@ const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
|
|
|
6769
6920
|
const _hoisted_2$8 = ["onClick"];
|
|
6770
6921
|
const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
|
|
6771
6922
|
const _hoisted_4$5 = ["title"];
|
|
6772
|
-
const _sfc_main$
|
|
6923
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
6773
6924
|
...{
|
|
6774
6925
|
name: "MEditorPageBar"
|
|
6775
6926
|
},
|
|
@@ -6848,14 +6999,14 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6848
6999
|
};
|
|
6849
7000
|
return (_ctx, _cache) => {
|
|
6850
7001
|
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
6851
|
-
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$
|
|
7002
|
+
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$t, {
|
|
6852
7003
|
key: 0,
|
|
6853
7004
|
modelValue: active.value,
|
|
6854
7005
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
6855
7006
|
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
6856
|
-
createVNode(_sfc_main$
|
|
7007
|
+
createVNode(_sfc_main$u, { type: active.value }, {
|
|
6857
7008
|
prepend: withCtx(() => [
|
|
6858
|
-
createVNode(_sfc_main$
|
|
7009
|
+
createVNode(_sfc_main$v, { type: active.value }, null, 8, ["type"])
|
|
6859
7010
|
]),
|
|
6860
7011
|
default: withCtx(() => [
|
|
6861
7012
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (item) => {
|
|
@@ -6888,7 +7039,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6888
7039
|
default: withCtx(() => [
|
|
6889
7040
|
createElementVNode("div", null, [
|
|
6890
7041
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
6891
|
-
createVNode(_sfc_main$
|
|
7042
|
+
createVNode(_sfc_main$w, {
|
|
6892
7043
|
data: {
|
|
6893
7044
|
type: "button",
|
|
6894
7045
|
text: "复制",
|
|
@@ -6896,7 +7047,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6896
7047
|
handler: () => copy(item)
|
|
6897
7048
|
}
|
|
6898
7049
|
}, null, 8, ["data"]),
|
|
6899
|
-
createVNode(_sfc_main$
|
|
7050
|
+
createVNode(_sfc_main$w, {
|
|
6900
7051
|
data: {
|
|
6901
7052
|
type: "button",
|
|
6902
7053
|
text: "删除",
|
|
@@ -6923,7 +7074,7 @@ const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
|
6923
7074
|
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
6924
7075
|
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
6925
7076
|
const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
|
|
6926
|
-
const _sfc_main$
|
|
7077
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
6927
7078
|
...{
|
|
6928
7079
|
name: "MEditorAddPageBox"
|
|
6929
7080
|
},
|
|
@@ -6978,7 +7129,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
6978
7129
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
6979
7130
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
6980
7131
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
6981
|
-
const _sfc_main$
|
|
7132
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
6982
7133
|
...{
|
|
6983
7134
|
name: "MEditorFramework"
|
|
6984
7135
|
},
|
|
@@ -6997,10 +7148,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6997
7148
|
const stageLoading = computed(() => editorService?.get("stageLoading") || false);
|
|
6998
7149
|
const showSrc = computed(() => uiService?.get("showSrc"));
|
|
6999
7150
|
const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
7151
|
+
const getRightColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
7000
7152
|
const columnWidth = ref({
|
|
7001
7153
|
left: getLeftColumnWidthCacheData(),
|
|
7002
7154
|
center: 0,
|
|
7003
|
-
right:
|
|
7155
|
+
right: getRightColumnWidthCacheData()
|
|
7004
7156
|
});
|
|
7005
7157
|
watch(pageLength, () => {
|
|
7006
7158
|
splitView.value?.updateWidth();
|
|
@@ -7061,7 +7213,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7061
7213
|
options: unref(codeOptions),
|
|
7062
7214
|
onSave: saveCode
|
|
7063
7215
|
}, null, 8, ["init-values", "options"])
|
|
7064
|
-
]) : withDirectives((openBlock(), createBlock(_sfc_main$
|
|
7216
|
+
]) : withDirectives((openBlock(), createBlock(_sfc_main$x, {
|
|
7065
7217
|
key: 1,
|
|
7066
7218
|
"element-loading-text": "Runtime 加载中...",
|
|
7067
7219
|
ref_key: "splitView",
|
|
@@ -7085,10 +7237,10 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7085
7237
|
]),
|
|
7086
7238
|
center: withCtx(() => [
|
|
7087
7239
|
page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
7088
|
-
createVNode(_sfc_main$
|
|
7240
|
+
createVNode(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
7089
7241
|
]),
|
|
7090
7242
|
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7091
|
-
createVNode(_sfc_main$
|
|
7243
|
+
createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
7092
7244
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
7093
7245
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7094
7246
|
]),
|
|
@@ -7123,7 +7275,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7123
7275
|
}
|
|
7124
7276
|
});
|
|
7125
7277
|
|
|
7126
|
-
const _sfc_main$
|
|
7278
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
7127
7279
|
...{
|
|
7128
7280
|
name: "MEditorNavMenu"
|
|
7129
7281
|
},
|
|
@@ -7305,7 +7457,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7305
7457
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
7306
7458
|
}, [
|
|
7307
7459
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
7308
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7460
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
7309
7461
|
data: item,
|
|
7310
7462
|
key: index
|
|
7311
7463
|
}, null, 8, ["data"]);
|
|
@@ -7318,7 +7470,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7318
7470
|
});
|
|
7319
7471
|
|
|
7320
7472
|
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
7321
|
-
const _sfc_main$
|
|
7473
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
7322
7474
|
...{
|
|
7323
7475
|
name: "MEditorPropsPanel"
|
|
7324
7476
|
},
|
|
@@ -7421,7 +7573,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
7421
7573
|
}
|
|
7422
7574
|
});
|
|
7423
7575
|
|
|
7424
|
-
const _sfc_main$
|
|
7576
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
7425
7577
|
...{
|
|
7426
7578
|
name: "MEditorSearchInput"
|
|
7427
7579
|
},
|
|
@@ -7479,7 +7631,7 @@ const _hoisted_4$3 = {
|
|
|
7479
7631
|
key: 0,
|
|
7480
7632
|
class: "m-editor-tree-node-children"
|
|
7481
7633
|
};
|
|
7482
|
-
const _sfc_main$
|
|
7634
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
7483
7635
|
...{
|
|
7484
7636
|
name: "MEditorTreeNode"
|
|
7485
7637
|
},
|
|
@@ -7600,7 +7752,7 @@ const _hoisted_1$8 = {
|
|
|
7600
7752
|
key: 1,
|
|
7601
7753
|
class: "m-editor-tree-empty"
|
|
7602
7754
|
};
|
|
7603
|
-
const _sfc_main$
|
|
7755
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
7604
7756
|
...{
|
|
7605
7757
|
name: "MEditorTree"
|
|
7606
7758
|
},
|
|
@@ -7624,7 +7776,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
7624
7776
|
onDragover: handleDragOver
|
|
7625
7777
|
}, [
|
|
7626
7778
|
_ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
|
|
7627
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7779
|
+
return openBlock(), createBlock(_sfc_main$m, {
|
|
7628
7780
|
key: item.id,
|
|
7629
7781
|
data: item,
|
|
7630
7782
|
indent: _ctx.indent,
|
|
@@ -7721,7 +7873,7 @@ const useNodeStatus$1 = (nodeData) => {
|
|
|
7721
7873
|
};
|
|
7722
7874
|
};
|
|
7723
7875
|
|
|
7724
|
-
const _sfc_main$
|
|
7876
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
7725
7877
|
...{
|
|
7726
7878
|
name: "MEditorCodeBlockList"
|
|
7727
7879
|
},
|
|
@@ -7803,7 +7955,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7803
7955
|
filter: filterTextChangeHandler
|
|
7804
7956
|
});
|
|
7805
7957
|
return (_ctx, _cache) => {
|
|
7806
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7958
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
7807
7959
|
data: codeList.value,
|
|
7808
7960
|
"node-status-map": unref(nodeStatusMap),
|
|
7809
7961
|
onNodeClick: clickHandler
|
|
@@ -7860,7 +8012,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
7860
8012
|
});
|
|
7861
8013
|
|
|
7862
8014
|
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
7863
|
-
const _sfc_main$
|
|
8015
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
7864
8016
|
...{
|
|
7865
8017
|
name: "MEditorCodeBlockListPanel"
|
|
7866
8018
|
},
|
|
@@ -7882,7 +8034,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7882
8034
|
default: withCtx(() => [
|
|
7883
8035
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
7884
8036
|
createElementVNode("div", _hoisted_1$7, [
|
|
7885
|
-
createVNode(_sfc_main$
|
|
8037
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
7886
8038
|
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
7887
8039
|
key: 0,
|
|
7888
8040
|
class: "create-code-button",
|
|
@@ -7898,7 +8050,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7898
8050
|
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
7899
8051
|
])
|
|
7900
8052
|
]),
|
|
7901
|
-
createVNode(_sfc_main$
|
|
8053
|
+
createVNode(_sfc_main$k, {
|
|
7902
8054
|
ref_key: "codeBlockList",
|
|
7903
8055
|
ref: codeBlockList,
|
|
7904
8056
|
"custom-error": _ctx.customError,
|
|
@@ -7929,81 +8081,6 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
7929
8081
|
}
|
|
7930
8082
|
});
|
|
7931
8083
|
|
|
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
8084
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
8008
8085
|
...{
|
|
8009
8086
|
name: "MEditorDataSourceList"
|
|
@@ -8093,7 +8170,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
8093
8170
|
filter: filterTextChangeHandler
|
|
8094
8171
|
});
|
|
8095
8172
|
return (_ctx, _cache) => {
|
|
8096
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8173
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
8097
8174
|
data: list.value,
|
|
8098
8175
|
"node-status-map": unref(nodeStatusMap),
|
|
8099
8176
|
onNodeClick: clickHandler
|
|
@@ -8155,10 +8232,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8155
8232
|
__name: "DataSourceListPanel",
|
|
8156
8233
|
setup(__props) {
|
|
8157
8234
|
const { dataSourceService } = inject("services") || {};
|
|
8158
|
-
const editDialog =
|
|
8159
|
-
const dataSourceValues = ref({});
|
|
8160
|
-
const dialogTitle = ref("");
|
|
8161
|
-
const editable = computed(() => dataSourceService?.get("editable") ?? true);
|
|
8235
|
+
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
8162
8236
|
const datasourceTypeList = computed(
|
|
8163
8237
|
() => [
|
|
8164
8238
|
{ text: "基础", type: "base" },
|
|
@@ -8181,26 +8255,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8181
8255
|
dialogTitle.value = `新增${datasourceType?.text || ""}`;
|
|
8182
8256
|
editDialog.value.show();
|
|
8183
8257
|
};
|
|
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
8258
|
const removeHandler = (id) => {
|
|
8194
8259
|
dataSourceService?.remove(id);
|
|
8195
8260
|
};
|
|
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
8261
|
const dataSourceList = ref();
|
|
8205
8262
|
const filterTextChangeHandler = (val) => {
|
|
8206
8263
|
dataSourceList.value?.filter(val);
|
|
@@ -8210,8 +8267,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8210
8267
|
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
8211
8268
|
default: withCtx(() => [
|
|
8212
8269
|
createElementVNode("div", _hoisted_1$6, [
|
|
8213
|
-
createVNode(_sfc_main$
|
|
8214
|
-
editable
|
|
8270
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
8271
|
+
unref(editable) ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
8215
8272
|
key: 0,
|
|
8216
8273
|
placement: "right"
|
|
8217
8274
|
}, {
|
|
@@ -8229,7 +8286,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8229
8286
|
default: withCtx(() => [
|
|
8230
8287
|
createElementVNode("div", _hoisted_2$5, [
|
|
8231
8288
|
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
8232
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8289
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
8233
8290
|
data: {
|
|
8234
8291
|
type: "button",
|
|
8235
8292
|
text: item.text,
|
|
@@ -8249,20 +8306,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
8249
8306
|
createVNode(_sfc_main$i, {
|
|
8250
8307
|
ref_key: "dataSourceList",
|
|
8251
8308
|
ref: dataSourceList,
|
|
8252
|
-
onEdit: editHandler,
|
|
8309
|
+
onEdit: unref(editHandler),
|
|
8253
8310
|
onRemove: removeHandler
|
|
8254
|
-
}, null,
|
|
8311
|
+
}, null, 8, ["onEdit"])
|
|
8255
8312
|
]),
|
|
8256
8313
|
_: 3
|
|
8257
8314
|
}),
|
|
8258
|
-
createVNode(_sfc_main$
|
|
8315
|
+
createVNode(_sfc_main$K, {
|
|
8259
8316
|
ref_key: "editDialog",
|
|
8260
8317
|
ref: editDialog,
|
|
8261
|
-
disabled: !editable
|
|
8262
|
-
values: dataSourceValues
|
|
8263
|
-
title: dialogTitle
|
|
8264
|
-
onSubmit: submitDataSourceHandler
|
|
8265
|
-
}, null, 8, ["disabled", "values", "title"])
|
|
8318
|
+
disabled: !unref(editable),
|
|
8319
|
+
values: unref(dataSourceValues),
|
|
8320
|
+
title: unref(dialogTitle),
|
|
8321
|
+
onSubmit: unref(submitDataSourceHandler)
|
|
8322
|
+
}, null, 8, ["disabled", "values", "title", "onSubmit"])
|
|
8266
8323
|
], 64);
|
|
8267
8324
|
};
|
|
8268
8325
|
}
|
|
@@ -8399,7 +8456,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
8399
8456
|
renderSlot(_ctx.$slots, "title"),
|
|
8400
8457
|
createElementVNode("div", null, [
|
|
8401
8458
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
8402
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8459
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
8403
8460
|
"event-type": "mouseup",
|
|
8404
8461
|
ref_for: true,
|
|
8405
8462
|
ref_key: "buttons",
|
|
@@ -9175,8 +9232,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
9175
9232
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
9176
9233
|
default: withCtx(() => [
|
|
9177
9234
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
9178
|
-
createVNode(_sfc_main$
|
|
9179
|
-
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$
|
|
9235
|
+
createVNode(_sfc_main$n, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
9236
|
+
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$l, {
|
|
9180
9237
|
key: 0,
|
|
9181
9238
|
tabindex: "-1",
|
|
9182
9239
|
ref_key: "tree",
|
|
@@ -9302,7 +9359,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
9302
9359
|
"model-value": collapseValue.value
|
|
9303
9360
|
}, {
|
|
9304
9361
|
default: withCtx(() => [
|
|
9305
|
-
createVNode(_sfc_main$
|
|
9362
|
+
createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
|
|
9306
9363
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
|
|
9307
9364
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
9308
9365
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
@@ -9412,7 +9469,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
9412
9469
|
type: "component",
|
|
9413
9470
|
icon: EditPen,
|
|
9414
9471
|
text: "代码编辑",
|
|
9415
|
-
component: _sfc_main$
|
|
9472
|
+
component: _sfc_main$j,
|
|
9416
9473
|
slots: {}
|
|
9417
9474
|
},
|
|
9418
9475
|
"data-source": {
|
|
@@ -10046,7 +10103,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
10046
10103
|
position: menuPosition.value
|
|
10047
10104
|
}, {
|
|
10048
10105
|
body: withCtx(() => [
|
|
10049
|
-
createVNode(_sfc_main$
|
|
10106
|
+
createVNode(_sfc_main$l, {
|
|
10050
10107
|
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
10051
10108
|
data: nodeData.value,
|
|
10052
10109
|
"node-status-map": unref(nodeStatusMap),
|
|
@@ -11628,13 +11685,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11628
11685
|
provide("stageOptions", stageOptions);
|
|
11629
11686
|
__expose(services);
|
|
11630
11687
|
return (_ctx, _cache) => {
|
|
11631
|
-
return openBlock(), createBlock(_sfc_main$
|
|
11688
|
+
return openBlock(), createBlock(_sfc_main$q, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
11632
11689
|
header: withCtx(() => [
|
|
11633
11690
|
renderSlot(_ctx.$slots, "header")
|
|
11634
11691
|
]),
|
|
11635
11692
|
nav: withCtx(() => [
|
|
11636
11693
|
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
11637
|
-
createVNode(_sfc_main$
|
|
11694
|
+
createVNode(_sfc_main$p, { data: _ctx.menu }, null, 8, ["data"])
|
|
11638
11695
|
])
|
|
11639
11696
|
]),
|
|
11640
11697
|
"content-before": withCtx(() => [
|
|
@@ -11709,7 +11766,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11709
11766
|
]),
|
|
11710
11767
|
"props-panel": withCtx(() => [
|
|
11711
11768
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
11712
|
-
createVNode(_sfc_main$
|
|
11769
|
+
createVNode(_sfc_main$o, {
|
|
11713
11770
|
"extend-state": _ctx.extendFormState,
|
|
11714
11771
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
11715
11772
|
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
@@ -11757,22 +11814,22 @@ const index = {
|
|
|
11757
11814
|
setConfig(option);
|
|
11758
11815
|
app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
|
|
11759
11816
|
app.component("magic-code-editor", _sfc_main$T);
|
|
11760
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
11817
|
+
app.component("m-fields-ui-select", _sfc_main$z);
|
|
11761
11818
|
app.component("m-fields-code-link", _sfc_main$R);
|
|
11762
11819
|
app.component("m-fields-vs-code", _sfc_main$S);
|
|
11763
11820
|
app.component("m-fields-code-select", _sfc_main$Q);
|
|
11764
11821
|
app.component("m-fields-code-select-col", _sfc_main$M);
|
|
11765
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
11822
|
+
app.component("m-fields-event-select", _sfc_main$D);
|
|
11766
11823
|
app.component("m-fields-data-source-fields", _sfc_main$L);
|
|
11767
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
11768
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
11769
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
11770
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
11771
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
11772
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
11773
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
11774
|
-
app.component("m-fields-page-fragment-select", _sfc_main$
|
|
11824
|
+
app.component("m-fields-data-source-mocks", _sfc_main$F);
|
|
11825
|
+
app.component("m-fields-key-value", _sfc_main$B);
|
|
11826
|
+
app.component("m-fields-data-source-input", _sfc_main$I);
|
|
11827
|
+
app.component("m-fields-data-source-select", _sfc_main$E);
|
|
11828
|
+
app.component("m-fields-data-source-methods", _sfc_main$H);
|
|
11829
|
+
app.component("m-fields-data-source-method-select", _sfc_main$G);
|
|
11830
|
+
app.component("m-fields-data-source-field-select", _sfc_main$J);
|
|
11831
|
+
app.component("m-fields-page-fragment-select", _sfc_main$A);
|
|
11775
11832
|
}
|
|
11776
11833
|
};
|
|
11777
11834
|
|
|
11778
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$O as CodeBlockEditor, _sfc_main$
|
|
11835
|
+
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 };
|