@tmagic/editor 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +19 -0
- package/dist/tmagic-editor.js +61 -21
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +61 -21
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +11 -11
- package/src/Editor.vue +5 -0
- package/src/components/Tree.vue +1 -1
- package/src/fields/PageFragmentSelect.vue +11 -3
- package/src/layouts/Framework.vue +6 -4
- package/src/layouts/PropsPanel.vue +7 -5
- package/src/services/dataSource.ts +17 -0
- package/src/services/dep.ts +4 -0
- package/src/services/editor.ts +1 -1
- package/src/theme/page-fragment-select.scss +14 -0
- package/src/theme/theme.scss +1 -0
- package/src/theme/tree.scss +6 -0
- package/src/type.ts +1 -0
- package/types/layouts/PropsPanel.vue.d.ts +10 -1
- package/types/services/dataSource.d.ts +1 -0
- package/types/services/dep.d.ts +1 -0
- package/types/type.d.ts +1 -0
|
@@ -1139,6 +1139,22 @@
|
|
|
1139
1139
|
events: {},
|
|
1140
1140
|
methods: {}
|
|
1141
1141
|
});
|
|
1142
|
+
constructor() {
|
|
1143
|
+
super([
|
|
1144
|
+
{ name: "getFormConfig", isAsync: false },
|
|
1145
|
+
{ name: "setFormConfig", isAsync: false },
|
|
1146
|
+
{ name: "getFormValue", isAsync: false },
|
|
1147
|
+
{ name: "setFormValue", isAsync: false },
|
|
1148
|
+
{ name: "getFormEvent", isAsync: false },
|
|
1149
|
+
{ name: "setFormEvent", isAsync: false },
|
|
1150
|
+
{ name: "getFormMethod", isAsync: false },
|
|
1151
|
+
{ name: "setFormMethod", isAsync: false },
|
|
1152
|
+
{ name: "add", isAsync: false },
|
|
1153
|
+
{ name: "update", isAsync: false },
|
|
1154
|
+
{ name: "remove", isAsync: false },
|
|
1155
|
+
{ name: "createId", isAsync: false }
|
|
1156
|
+
]);
|
|
1157
|
+
}
|
|
1142
1158
|
set(name, value) {
|
|
1143
1159
|
this.state[name] = value;
|
|
1144
1160
|
}
|
|
@@ -1824,6 +1840,9 @@
|
|
|
1824
1840
|
clear(nodes) {
|
|
1825
1841
|
return this.watcher.clear(nodes);
|
|
1826
1842
|
}
|
|
1843
|
+
clearByType(type, nodes) {
|
|
1844
|
+
return this.watcher.clearByType(type, nodes);
|
|
1845
|
+
}
|
|
1827
1846
|
hasTarget(id, type = dep.DepTargetType.DEFAULT) {
|
|
1828
1847
|
return this.watcher.hasTarget(id, type);
|
|
1829
1848
|
}
|
|
@@ -2770,7 +2789,7 @@
|
|
|
2770
2789
|
*/
|
|
2771
2790
|
copyWithRelated(config) {
|
|
2772
2791
|
const copyNodes = Array.isArray(config) ? config : [config];
|
|
2773
|
-
depService.
|
|
2792
|
+
depService.clearByType(dep.DepTargetType.RELATED_COMP_WHEN_COPY);
|
|
2774
2793
|
depService.collect(copyNodes, true, dep.DepTargetType.RELATED_COMP_WHEN_COPY);
|
|
2775
2794
|
const customTarget = depService.getTarget(
|
|
2776
2795
|
dep.DepTargetType.RELATED_COMP_WHEN_COPY,
|
|
@@ -5091,8 +5110,8 @@
|
|
|
5091
5110
|
options: () => {
|
|
5092
5111
|
if (pageList.value) {
|
|
5093
5112
|
return pageList.value.map((item) => ({
|
|
5094
|
-
text: `${item.name}(${item.id})`,
|
|
5095
|
-
label: `${item.name}(${item.id})`,
|
|
5113
|
+
text: `${item.devconfig?.tabName || item.title || item.name}(${item.id})`,
|
|
5114
|
+
label: `${item.devconfig?.tabName || item.title || item.name}(${item.id})`,
|
|
5096
5115
|
value: item.id
|
|
5097
5116
|
}));
|
|
5098
5117
|
}
|
|
@@ -5102,6 +5121,9 @@
|
|
|
5102
5121
|
const changeHandler = async () => {
|
|
5103
5122
|
emit("change", props.model[props.name]);
|
|
5104
5123
|
};
|
|
5124
|
+
const editPageFragment = (id) => {
|
|
5125
|
+
services?.editorService.select(id);
|
|
5126
|
+
};
|
|
5105
5127
|
return (_ctx, _cache) => {
|
|
5106
5128
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
5107
5129
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
|
|
@@ -5112,7 +5134,13 @@
|
|
|
5112
5134
|
model: _ctx.model,
|
|
5113
5135
|
size: _ctx.size,
|
|
5114
5136
|
onChange: changeHandler
|
|
5115
|
-
}, null, 8, ["model", "size"])
|
|
5137
|
+
}, null, 8, ["model", "size"]),
|
|
5138
|
+
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
5139
|
+
key: 0,
|
|
5140
|
+
class: "icon",
|
|
5141
|
+
icon: vue.unref(iconsVue.Edit),
|
|
5142
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editPageFragment(_ctx.model[_ctx.name]))
|
|
5143
|
+
}, null, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
5116
5144
|
])
|
|
5117
5145
|
]);
|
|
5118
5146
|
};
|
|
@@ -6188,15 +6216,17 @@
|
|
|
6188
6216
|
page.value ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
6189
6217
|
vue.createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
6190
6218
|
]),
|
|
6191
|
-
vue.
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6219
|
+
vue.renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
6220
|
+
vue.createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
6221
|
+
"page-bar-title": vue.withCtx(({ page: page2 }) => [
|
|
6222
|
+
vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
6223
|
+
]),
|
|
6224
|
+
"page-bar-popover": vue.withCtx(({ page: page2 }) => [
|
|
6225
|
+
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: page2 })
|
|
6226
|
+
]),
|
|
6227
|
+
_: 3
|
|
6228
|
+
}, 8, ["disabled-page-fragment"])
|
|
6229
|
+
])
|
|
6200
6230
|
]),
|
|
6201
6231
|
_: 2
|
|
6202
6232
|
}, [
|
|
@@ -6405,7 +6435,7 @@
|
|
|
6405
6435
|
props: {
|
|
6406
6436
|
extendState: { type: Function }
|
|
6407
6437
|
},
|
|
6408
|
-
emits: ["mounted"],
|
|
6438
|
+
emits: ["mounted", "submit-error", "form-error"],
|
|
6409
6439
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6410
6440
|
const emit = __emit;
|
|
6411
6441
|
const internalInstance = vue.getCurrentInstance();
|
|
@@ -6444,11 +6474,12 @@
|
|
|
6444
6474
|
const values2 = await configForm.value?.submitForm();
|
|
6445
6475
|
services?.editorService.update(values2);
|
|
6446
6476
|
} catch (e) {
|
|
6447
|
-
|
|
6448
|
-
design.tMagicMessage.closeAll();
|
|
6449
|
-
design.tMagicMessage.error(e.message);
|
|
6477
|
+
emit("submit-error", e);
|
|
6450
6478
|
}
|
|
6451
6479
|
};
|
|
6480
|
+
const errorHandler = (e) => {
|
|
6481
|
+
emit("form-error", e);
|
|
6482
|
+
};
|
|
6452
6483
|
__expose({ configForm, submit });
|
|
6453
6484
|
return (_ctx, _cache) => {
|
|
6454
6485
|
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
@@ -6462,7 +6493,8 @@
|
|
|
6462
6493
|
"init-values": values.value,
|
|
6463
6494
|
config: curFormConfig.value,
|
|
6464
6495
|
"extend-state": _ctx.extendState,
|
|
6465
|
-
onChange: submit
|
|
6496
|
+
onChange: submit,
|
|
6497
|
+
onError: errorHandler
|
|
6466
6498
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"])
|
|
6467
6499
|
], 512)), [
|
|
6468
6500
|
[vue.vShow, nodes.value.length === 1]
|
|
@@ -6777,7 +6809,10 @@
|
|
|
6777
6809
|
}
|
|
6778
6810
|
});
|
|
6779
6811
|
|
|
6780
|
-
const _hoisted_1$9 = {
|
|
6812
|
+
const _hoisted_1$9 = {
|
|
6813
|
+
key: 1,
|
|
6814
|
+
class: "m-editor-tree-empty"
|
|
6815
|
+
};
|
|
6781
6816
|
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
6782
6817
|
...{
|
|
6783
6818
|
name: "MEditorTree"
|
|
@@ -10818,7 +10853,7 @@
|
|
|
10818
10853
|
disabledPageFragment: { type: Boolean },
|
|
10819
10854
|
customContentMenu: { type: Function }
|
|
10820
10855
|
}, defaultEditorProps),
|
|
10821
|
-
emits: ["props-panel-mounted", "update:modelValue"],
|
|
10856
|
+
emits: ["props-panel-mounted", "update:modelValue", "props-form-error", "props-submit-error"],
|
|
10822
10857
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
10823
10858
|
const emit = __emit;
|
|
10824
10859
|
const props = __props;
|
|
@@ -10938,7 +10973,9 @@
|
|
|
10938
10973
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
10939
10974
|
vue.createVNode(_sfc_main$p, {
|
|
10940
10975
|
"extend-state": _ctx.extendFormState,
|
|
10941
|
-
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
10976
|
+
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
10977
|
+
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
10978
|
+
onSubmitError: _cache[2] || (_cache[2] = (e) => _ctx.$emit("props-submit-error", e))
|
|
10942
10979
|
}, {
|
|
10943
10980
|
"props-panel-header": vue.withCtx(() => [
|
|
10944
10981
|
vue.renderSlot(_ctx.$slots, "props-panel-header")
|
|
@@ -10956,6 +10993,9 @@
|
|
|
10956
10993
|
footer: vue.withCtx(() => [
|
|
10957
10994
|
vue.renderSlot(_ctx.$slots, "footer")
|
|
10958
10995
|
]),
|
|
10996
|
+
"page-bar": vue.withCtx(() => [
|
|
10997
|
+
vue.renderSlot(_ctx.$slots, "page-bar")
|
|
10998
|
+
]),
|
|
10959
10999
|
"page-bar-title": vue.withCtx(({ page }) => [
|
|
10960
11000
|
vue.renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
10961
11001
|
]),
|