@tmagic/editor 1.0.0-beta.4 → 1.0.0-beta.5
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 +4 -3
- package/dist/tmagic-editor.es.js +20 -30
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +18 -29
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/layouts/NavMenu.vue.d.ts +2 -1
- package/dist/types/src/utils/editor.d.ts +0 -1
- package/package.json +6 -6
- package/src/components/ScrollViewer.vue +1 -0
- package/src/layouts/NavMenu.vue +7 -3
- package/src/layouts/PropsPanel.vue +5 -10
- package/src/services/editor.ts +6 -3
- package/src/theme/nav-menu.scss +3 -3
- package/src/theme/stage.scss +1 -0
- package/src/utils/editor.ts +1 -20
- package/src/utils/scroll-viewer.ts +2 -1
|
@@ -761,22 +761,6 @@
|
|
|
761
761
|
}
|
|
762
762
|
return toRelative(node);
|
|
763
763
|
};
|
|
764
|
-
const defaults = (object, source) => {
|
|
765
|
-
let o = source;
|
|
766
|
-
if (Array.isArray(object)) {
|
|
767
|
-
o = object;
|
|
768
|
-
}
|
|
769
|
-
Object.entries(o).forEach(([key, value]) => {
|
|
770
|
-
if (typeof object[key] === "undefined") {
|
|
771
|
-
object[key] = value;
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
if (value && typeof value !== "string" && Object.keys(value).length) {
|
|
775
|
-
object[key] = defaults(lodashEs.cloneDeep(object[key]), value);
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
return object;
|
|
779
|
-
};
|
|
780
764
|
|
|
781
765
|
const log = (...args) => {
|
|
782
766
|
};
|
|
@@ -945,7 +929,11 @@
|
|
|
945
929
|
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config2.id}\u7684\u8282\u70B9`);
|
|
946
930
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
947
931
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config2), node, this.get("root"));
|
|
948
|
-
|
|
932
|
+
newConfig = lodashEs.mergeWith(node, newConfig, (objValue, srcValue) => {
|
|
933
|
+
if (Array.isArray(srcValue)) {
|
|
934
|
+
return srcValue;
|
|
935
|
+
}
|
|
936
|
+
});
|
|
949
937
|
if (!newConfig.type)
|
|
950
938
|
throw new Error("\u914D\u7F6E\u7F3A\u5C11type\u503C");
|
|
951
939
|
if (newConfig.type === "app") {
|
|
@@ -2948,8 +2936,10 @@
|
|
|
2948
2936
|
}
|
|
2949
2937
|
},
|
|
2950
2938
|
setup(props) {
|
|
2939
|
+
const services = vue.inject("services");
|
|
2951
2940
|
return {
|
|
2952
|
-
keys: vue.computed(() => Object.keys(props.data))
|
|
2941
|
+
keys: vue.computed(() => Object.keys(props.data)),
|
|
2942
|
+
columnWidth: vue.computed(() => services?.uiService.get("columnWidth"))
|
|
2953
2943
|
};
|
|
2954
2944
|
}
|
|
2955
2945
|
});
|
|
@@ -2962,7 +2952,8 @@
|
|
|
2962
2952
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.keys, (key) => {
|
|
2963
2953
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2964
2954
|
class: vue.normalizeClass(`menu-${key}`),
|
|
2965
|
-
key
|
|
2955
|
+
key,
|
|
2956
|
+
style: vue.normalizeStyle(`width: ${_ctx.columnWidth?.[key]}px`)
|
|
2966
2957
|
}, [
|
|
2967
2958
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.data[key], (item, index) => {
|
|
2968
2959
|
return vue.openBlock(), vue.createBlock(_component_tool_button, {
|
|
@@ -2970,7 +2961,7 @@
|
|
|
2970
2961
|
key: index
|
|
2971
2962
|
}, null, 8, ["data"]);
|
|
2972
2963
|
}), 128))
|
|
2973
|
-
],
|
|
2964
|
+
], 6);
|
|
2974
2965
|
}), 128))
|
|
2975
2966
|
], 4);
|
|
2976
2967
|
}
|
|
@@ -2985,17 +2976,14 @@
|
|
|
2985
2976
|
const configForm = vue.ref();
|
|
2986
2977
|
const curFormConfig = vue.ref([]);
|
|
2987
2978
|
const services = vue.inject("services");
|
|
2979
|
+
const node = vue.computed(() => services?.editorService.get("node"));
|
|
2988
2980
|
const init = async () => {
|
|
2989
|
-
|
|
2990
|
-
if (!node) {
|
|
2981
|
+
if (!node.value) {
|
|
2991
2982
|
curFormConfig.value = [];
|
|
2992
2983
|
return;
|
|
2993
2984
|
}
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
}
|
|
2997
|
-
values.value = node;
|
|
2998
|
-
const type = node.type || (node.items ? "container" : "text");
|
|
2985
|
+
values.value = node.value;
|
|
2986
|
+
const type = node.value.type || (node.value.items ? "container" : "text");
|
|
2999
2987
|
curFormConfig.value = await services?.propsService.getPropsConfig(type) || [];
|
|
3000
2988
|
};
|
|
3001
2989
|
vue.watchEffect(init);
|
|
@@ -3642,7 +3630,8 @@
|
|
|
3642
3630
|
const { width, height } = contentRect;
|
|
3643
3631
|
const targetRect = this.target.getBoundingClientRect();
|
|
3644
3632
|
const targetWidth = targetRect.width * this.zoom;
|
|
3645
|
-
const
|
|
3633
|
+
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
3634
|
+
const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
|
|
3646
3635
|
if (targetWidth < width) {
|
|
3647
3636
|
this.target._left = 0;
|
|
3648
3637
|
}
|
|
@@ -3822,6 +3811,7 @@
|
|
|
3822
3811
|
width: ${props.width}px;
|
|
3823
3812
|
height: ${props.height}px;
|
|
3824
3813
|
position: absolute;
|
|
3814
|
+
margin-top: 30px;
|
|
3825
3815
|
`)
|
|
3826
3816
|
};
|
|
3827
3817
|
}
|
|
@@ -4498,7 +4488,6 @@
|
|
|
4498
4488
|
exports.change2Fixed = change2Fixed;
|
|
4499
4489
|
exports.debug = debug;
|
|
4500
4490
|
exports["default"] = index;
|
|
4501
|
-
exports.defaults = defaults;
|
|
4502
4491
|
exports.editorService = editorService;
|
|
4503
4492
|
exports.error = error;
|
|
4504
4493
|
exports.eventsService = eventsService;
|