@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
package/dist/style.css
CHANGED
|
@@ -901,6 +901,11 @@
|
|
|
901
901
|
.m-editor-tree .m-editor-tree-node .tree-node .tree-node-tool .tmagic-design-icon {
|
|
902
902
|
margin-right: 10px;
|
|
903
903
|
}
|
|
904
|
+
.m-editor-tree .m-editor-tree-empty {
|
|
905
|
+
text-align: center;
|
|
906
|
+
color: #909399;
|
|
907
|
+
font-size: 14px;
|
|
908
|
+
}
|
|
904
909
|
.m-editor-float-box {
|
|
905
910
|
position: absolute;
|
|
906
911
|
background-color: #fff;
|
|
@@ -928,6 +933,20 @@
|
|
|
928
933
|
.m-editor-floating-box-moveable {
|
|
929
934
|
opacity: 0;
|
|
930
935
|
}
|
|
936
|
+
.m-fields-page-fragment-select {
|
|
937
|
+
width: 100%;
|
|
938
|
+
}
|
|
939
|
+
.m-fields-page-fragment-select .page-fragment-select-container {
|
|
940
|
+
width: 100%;
|
|
941
|
+
display: flex;
|
|
942
|
+
align-items: center;
|
|
943
|
+
}
|
|
944
|
+
.m-fields-page-fragment-select .page-fragment-select-container .select {
|
|
945
|
+
flex: 1;
|
|
946
|
+
}
|
|
947
|
+
.m-fields-page-fragment-select .page-fragment-select-container .icon {
|
|
948
|
+
margin-left: 10px;
|
|
949
|
+
}
|
|
931
950
|
.fade-enter-active,
|
|
932
951
|
.fade-leave-active {
|
|
933
952
|
transition: opacity 0.5s;
|
package/dist/tmagic-editor.js
CHANGED
|
@@ -1133,6 +1133,22 @@ class DataSource extends BaseService {
|
|
|
1133
1133
|
events: {},
|
|
1134
1134
|
methods: {}
|
|
1135
1135
|
});
|
|
1136
|
+
constructor() {
|
|
1137
|
+
super([
|
|
1138
|
+
{ name: "getFormConfig", isAsync: false },
|
|
1139
|
+
{ name: "setFormConfig", isAsync: false },
|
|
1140
|
+
{ name: "getFormValue", isAsync: false },
|
|
1141
|
+
{ name: "setFormValue", isAsync: false },
|
|
1142
|
+
{ name: "getFormEvent", isAsync: false },
|
|
1143
|
+
{ name: "setFormEvent", isAsync: false },
|
|
1144
|
+
{ name: "getFormMethod", isAsync: false },
|
|
1145
|
+
{ name: "setFormMethod", isAsync: false },
|
|
1146
|
+
{ name: "add", isAsync: false },
|
|
1147
|
+
{ name: "update", isAsync: false },
|
|
1148
|
+
{ name: "remove", isAsync: false },
|
|
1149
|
+
{ name: "createId", isAsync: false }
|
|
1150
|
+
]);
|
|
1151
|
+
}
|
|
1136
1152
|
set(name, value) {
|
|
1137
1153
|
this.state[name] = value;
|
|
1138
1154
|
}
|
|
@@ -1818,6 +1834,9 @@ class Dep extends BaseService {
|
|
|
1818
1834
|
clear(nodes) {
|
|
1819
1835
|
return this.watcher.clear(nodes);
|
|
1820
1836
|
}
|
|
1837
|
+
clearByType(type, nodes) {
|
|
1838
|
+
return this.watcher.clearByType(type, nodes);
|
|
1839
|
+
}
|
|
1821
1840
|
hasTarget(id, type = DepTargetType.DEFAULT) {
|
|
1822
1841
|
return this.watcher.hasTarget(id, type);
|
|
1823
1842
|
}
|
|
@@ -2764,7 +2783,7 @@ class Editor extends BaseService {
|
|
|
2764
2783
|
*/
|
|
2765
2784
|
copyWithRelated(config) {
|
|
2766
2785
|
const copyNodes = Array.isArray(config) ? config : [config];
|
|
2767
|
-
depService.
|
|
2786
|
+
depService.clearByType(DepTargetType.RELATED_COMP_WHEN_COPY);
|
|
2768
2787
|
depService.collect(copyNodes, true, DepTargetType.RELATED_COMP_WHEN_COPY);
|
|
2769
2788
|
const customTarget = depService.getTarget(
|
|
2770
2789
|
DepTargetType.RELATED_COMP_WHEN_COPY,
|
|
@@ -5085,8 +5104,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5085
5104
|
options: () => {
|
|
5086
5105
|
if (pageList.value) {
|
|
5087
5106
|
return pageList.value.map((item) => ({
|
|
5088
|
-
text: `${item.name}(${item.id})`,
|
|
5089
|
-
label: `${item.name}(${item.id})`,
|
|
5107
|
+
text: `${item.devconfig?.tabName || item.title || item.name}(${item.id})`,
|
|
5108
|
+
label: `${item.devconfig?.tabName || item.title || item.name}(${item.id})`,
|
|
5090
5109
|
value: item.id
|
|
5091
5110
|
}));
|
|
5092
5111
|
}
|
|
@@ -5096,6 +5115,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5096
5115
|
const changeHandler = async () => {
|
|
5097
5116
|
emit("change", props.model[props.name]);
|
|
5098
5117
|
};
|
|
5118
|
+
const editPageFragment = (id) => {
|
|
5119
|
+
services?.editorService.select(id);
|
|
5120
|
+
};
|
|
5099
5121
|
return (_ctx, _cache) => {
|
|
5100
5122
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
5101
5123
|
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
@@ -5106,7 +5128,13 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5106
5128
|
model: _ctx.model,
|
|
5107
5129
|
size: _ctx.size,
|
|
5108
5130
|
onChange: changeHandler
|
|
5109
|
-
}, null, 8, ["model", "size"])
|
|
5131
|
+
}, null, 8, ["model", "size"]),
|
|
5132
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
|
|
5133
|
+
key: 0,
|
|
5134
|
+
class: "icon",
|
|
5135
|
+
icon: unref(Edit),
|
|
5136
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editPageFragment(_ctx.model[_ctx.name]))
|
|
5137
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
5110
5138
|
])
|
|
5111
5139
|
]);
|
|
5112
5140
|
};
|
|
@@ -6182,15 +6210,17 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
6182
6210
|
page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
6183
6211
|
createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
|
|
6184
6212
|
]),
|
|
6185
|
-
|
|
6186
|
-
"page-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6213
|
+
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
6214
|
+
createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
|
|
6215
|
+
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
6216
|
+
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
6217
|
+
]),
|
|
6218
|
+
"page-bar-popover": withCtx(({ page: page2 }) => [
|
|
6219
|
+
renderSlot(_ctx.$slots, "page-bar-popover", { page: page2 })
|
|
6220
|
+
]),
|
|
6221
|
+
_: 3
|
|
6222
|
+
}, 8, ["disabled-page-fragment"])
|
|
6223
|
+
])
|
|
6194
6224
|
]),
|
|
6195
6225
|
_: 2
|
|
6196
6226
|
}, [
|
|
@@ -6399,7 +6429,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6399
6429
|
props: {
|
|
6400
6430
|
extendState: { type: Function }
|
|
6401
6431
|
},
|
|
6402
|
-
emits: ["mounted"],
|
|
6432
|
+
emits: ["mounted", "submit-error", "form-error"],
|
|
6403
6433
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6404
6434
|
const emit = __emit;
|
|
6405
6435
|
const internalInstance = getCurrentInstance();
|
|
@@ -6438,11 +6468,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6438
6468
|
const values2 = await configForm.value?.submitForm();
|
|
6439
6469
|
services?.editorService.update(values2);
|
|
6440
6470
|
} catch (e) {
|
|
6441
|
-
|
|
6442
|
-
tMagicMessage.closeAll();
|
|
6443
|
-
tMagicMessage.error(e.message);
|
|
6471
|
+
emit("submit-error", e);
|
|
6444
6472
|
}
|
|
6445
6473
|
};
|
|
6474
|
+
const errorHandler = (e) => {
|
|
6475
|
+
emit("form-error", e);
|
|
6476
|
+
};
|
|
6446
6477
|
__expose({ configForm, submit });
|
|
6447
6478
|
return (_ctx, _cache) => {
|
|
6448
6479
|
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
@@ -6456,7 +6487,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6456
6487
|
"init-values": values.value,
|
|
6457
6488
|
config: curFormConfig.value,
|
|
6458
6489
|
"extend-state": _ctx.extendState,
|
|
6459
|
-
onChange: submit
|
|
6490
|
+
onChange: submit,
|
|
6491
|
+
onError: errorHandler
|
|
6460
6492
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "extend-state"])
|
|
6461
6493
|
], 512)), [
|
|
6462
6494
|
[vShow, nodes.value.length === 1]
|
|
@@ -6771,7 +6803,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6771
6803
|
}
|
|
6772
6804
|
});
|
|
6773
6805
|
|
|
6774
|
-
const _hoisted_1$9 = {
|
|
6806
|
+
const _hoisted_1$9 = {
|
|
6807
|
+
key: 1,
|
|
6808
|
+
class: "m-editor-tree-empty"
|
|
6809
|
+
};
|
|
6775
6810
|
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
6776
6811
|
...{
|
|
6777
6812
|
name: "MEditorTree"
|
|
@@ -10812,7 +10847,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10812
10847
|
disabledPageFragment: { type: Boolean },
|
|
10813
10848
|
customContentMenu: { type: Function }
|
|
10814
10849
|
}, defaultEditorProps),
|
|
10815
|
-
emits: ["props-panel-mounted", "update:modelValue"],
|
|
10850
|
+
emits: ["props-panel-mounted", "update:modelValue", "props-form-error", "props-submit-error"],
|
|
10816
10851
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
10817
10852
|
const emit = __emit;
|
|
10818
10853
|
const props = __props;
|
|
@@ -10932,7 +10967,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10932
10967
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
10933
10968
|
createVNode(_sfc_main$p, {
|
|
10934
10969
|
"extend-state": _ctx.extendFormState,
|
|
10935
|
-
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
10970
|
+
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance)),
|
|
10971
|
+
onFormError: _cache[1] || (_cache[1] = (e) => _ctx.$emit("props-form-error", e)),
|
|
10972
|
+
onSubmitError: _cache[2] || (_cache[2] = (e) => _ctx.$emit("props-submit-error", e))
|
|
10936
10973
|
}, {
|
|
10937
10974
|
"props-panel-header": withCtx(() => [
|
|
10938
10975
|
renderSlot(_ctx.$slots, "props-panel-header")
|
|
@@ -10950,6 +10987,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10950
10987
|
footer: withCtx(() => [
|
|
10951
10988
|
renderSlot(_ctx.$slots, "footer")
|
|
10952
10989
|
]),
|
|
10990
|
+
"page-bar": withCtx(() => [
|
|
10991
|
+
renderSlot(_ctx.$slots, "page-bar")
|
|
10992
|
+
]),
|
|
10953
10993
|
"page-bar-title": withCtx(({ page }) => [
|
|
10954
10994
|
renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
10955
10995
|
]),
|