@tmagic/editor 1.8.0-beta.25 → 1.8.0-beta.26
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/es/Editor.vue_vue_type_script_setup_true_lang.js +10 -16
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +5 -8
- package/dist/es/components/ViewForm.vue_vue_type_script_setup_true_lang.js +3 -5
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +3 -11
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +29 -124
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +5 -6
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +4 -5
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +6 -10
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +5 -7
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +1 -4
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +4 -6
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +9 -142
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +51 -326
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +2 -4
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +3 -34
- package/dist/es/fields/StyleSetter/configs.js +663 -0
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +5 -108
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +3 -9
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +5 -102
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +5 -265
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +5 -85
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +3 -22
- package/dist/es/fields/configs/codeSelect.js +98 -0
- package/dist/es/fields/configs/displayConds.js +158 -0
- package/dist/es/fields/configs/eventSelect.js +225 -0
- package/dist/es/fields/configs/stickyAddButton.js +20 -0
- package/dist/es/fields/headless-validation.js +139 -0
- package/dist/es/headless.js +2 -0
- package/dist/es/hooks/use-compare-form.js +6 -23
- package/dist/es/hooks/use-form-context.js +19 -0
- package/dist/es/index.js +2 -1
- package/dist/es/initService.js +17 -1
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +1 -7
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +1 -11
- package/dist/es/layouts/history-list/useHistoryRevert.js +3 -11
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +10 -23
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +3 -13
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +1 -1
- package/dist/es/plugin.js +33 -32
- package/dist/es/style.css +116 -60
- package/dist/es/utils/data-source/index.js +2 -1
- package/dist/es/utils/props.js +1 -4
- package/dist/es/utils/type-match-rules.js +2 -2
- package/dist/style.css +116 -60
- package/dist/themes/magic-admin.css +128 -67
- package/dist/tmagic-editor-headless.umd.cjs +10867 -0
- package/dist/tmagic-editor.umd.cjs +2123 -2015
- package/package.json +12 -7
- package/src/Editor.vue +12 -16
- package/src/components/CodeParams.vue +10 -4
- package/src/components/CompareForm.vue +4 -5
- package/src/components/ViewForm.vue +2 -3
- package/src/editorProps.ts +1 -2
- package/src/fields/Code.vue +2 -10
- package/src/fields/CodeSelect.vue +20 -116
- package/src/fields/CodeSelectCol.vue +3 -5
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +1 -1
- package/src/fields/DataSourceFieldSelect/Index.vue +3 -5
- package/src/fields/DataSourceFields.vue +0 -7
- package/src/fields/DataSourceMethodSelect.vue +2 -5
- package/src/fields/DataSourceMethods.vue +1 -6
- package/src/fields/DataSourceMocks.vue +1 -10
- package/src/fields/DataSourceSelect.vue +1 -1
- package/src/fields/DisplayConds.vue +17 -157
- package/src/fields/EventSelect.vue +28 -375
- package/src/fields/KeyValue.vue +3 -4
- package/src/fields/StyleSetter/components/Border.vue +4 -38
- package/src/fields/StyleSetter/configs.ts +690 -0
- package/src/fields/StyleSetter/pro/Background.vue +4 -104
- package/src/fields/StyleSetter/pro/Border.vue +3 -12
- package/src/fields/StyleSetter/pro/Font.vue +4 -123
- package/src/fields/StyleSetter/pro/Layout.vue +4 -219
- package/src/fields/StyleSetter/pro/Position.vue +6 -110
- package/src/fields/StyleSetter/pro/Transform.vue +4 -30
- package/src/fields/configs/codeSelect.ts +127 -0
- package/src/fields/configs/displayConds.ts +184 -0
- package/src/fields/configs/eventSelect.ts +309 -0
- package/src/fields/configs/stickyAddButton.ts +31 -0
- package/src/fields/headless-validation.ts +177 -0
- package/src/headless.ts +33 -0
- package/src/hooks/use-compare-form.ts +7 -25
- package/src/hooks/use-form-context.ts +40 -0
- package/src/index.ts +2 -0
- package/src/initService.ts +23 -1
- package/src/layouts/history-list/HistoryDiffDialog.vue +0 -10
- package/src/layouts/history-list/HistoryListPanel.vue +1 -13
- package/src/layouts/history-list/useHistoryRevert.ts +7 -13
- package/src/layouts/props-panel/FormPanel.vue +17 -28
- package/src/layouts/props-panel/PropsPanel.vue +1 -4
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +1 -1
- package/src/layouts/sidebar/code-block/useContentMenu.ts +1 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +1 -1
- package/src/layouts/sidebar/data-source/useContentMenu.ts +1 -1
- package/src/plugin.ts +32 -33
- package/src/theme/code-block.scss +0 -37
- package/src/theme/display-conds.scss +4 -0
- package/src/theme/event.scss +22 -45
- package/src/theme/props-panel.scss +17 -3
- package/src/theme/themes/magic-admin/index.scss +12 -1
- package/src/type.ts +10 -29
- package/src/utils/data-source/index.ts +1 -0
- package/src/utils/props.ts +1 -4
- package/src/utils/type-match-rules.ts +8 -3
- package/types/headless.d.ts +18 -0
- package/types/index.d.ts +154 -179
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import RepeatY_default from "../icons/background-repeat/RepeatY.js";
|
|
5
|
-
import NoRepeat_default from "../icons/background-repeat/NoRepeat.js";
|
|
6
|
-
import { MContainer, defineFormConfig } from "@tmagic/form";
|
|
7
|
-
import { appendValidateSuggestion } from "@tmagic/design";
|
|
8
|
-
import { Fragment, createBlock, createElementBlock, defineComponent, markRaw, openBlock, renderList, unref } from "vue";
|
|
1
|
+
import { createBackgroundConfig } from "../configs.js";
|
|
2
|
+
import { MContainer } from "@tmagic/form";
|
|
3
|
+
import { Fragment, computed, createBlock, createElementBlock, defineComponent, openBlock, renderList, unref } from "vue";
|
|
9
4
|
//#region packages/editor/src/fields/StyleSetter/pro/Background.vue?vue&type=script&setup=true&lang.ts
|
|
10
5
|
var Background_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
11
6
|
__name: "Background",
|
|
@@ -21,111 +16,13 @@ var Background_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
21
16
|
emits: ["change", "addDiffCount"],
|
|
22
17
|
setup(__props, { emit: __emit }) {
|
|
23
18
|
const emit = __emit;
|
|
24
|
-
const formConfig =
|
|
25
|
-
{
|
|
26
|
-
name: "backgroundColor",
|
|
27
|
-
text: "背景色",
|
|
28
|
-
labelWidth: "68px",
|
|
29
|
-
type: "data-source-field-select",
|
|
30
|
-
fieldConfig: { type: "colorPicker" },
|
|
31
|
-
rules: [{
|
|
32
|
-
typeMatch: true,
|
|
33
|
-
message: appendValidateSuggestion("背景色应为字符串", "请参考以下示例值:\"#000000\"")
|
|
34
|
-
}]
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "backgroundImage",
|
|
38
|
-
text: "背景图",
|
|
39
|
-
labelWidth: "68px",
|
|
40
|
-
type: "data-source-field-select",
|
|
41
|
-
fieldConfig: { type: "img-upload" }
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "backgroundSize",
|
|
45
|
-
text: "背景尺寸",
|
|
46
|
-
type: "radioGroup",
|
|
47
|
-
childType: "button",
|
|
48
|
-
labelWidth: "68px",
|
|
49
|
-
options: [
|
|
50
|
-
{
|
|
51
|
-
value: "auto",
|
|
52
|
-
text: "默认",
|
|
53
|
-
tooltip: "默认 auto"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
value: "contain",
|
|
57
|
-
text: "等比填充",
|
|
58
|
-
tooltip: "等比填充 contain"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
value: "cover",
|
|
62
|
-
text: "等比覆盖",
|
|
63
|
-
tooltip: "等比覆盖 cover"
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
rules: [{ typeMatch: false }, { validator: ({ value, callback }) => {
|
|
67
|
-
if (value === "" || value === null || value === void 0) return callback();
|
|
68
|
-
const keywords = [
|
|
69
|
-
"auto",
|
|
70
|
-
"cover",
|
|
71
|
-
"contain",
|
|
72
|
-
"inherit",
|
|
73
|
-
"initial",
|
|
74
|
-
"revert",
|
|
75
|
-
"unset"
|
|
76
|
-
];
|
|
77
|
-
const lengthPercent = /^-?\d+(\.\d+)?(px|em|rem|ex|ch|vw|vh|vmin|vmax|cm|mm|in|pt|pc|%)$/;
|
|
78
|
-
const singleValue = (v) => keywords.includes(v) || lengthPercent.test(v);
|
|
79
|
-
const parts = String(value).trim().split(/\s+/);
|
|
80
|
-
if (parts.length > 1 && (parts.includes("cover") || parts.includes("contain"))) return callback("cover/contain 不能与其他值组合");
|
|
81
|
-
if (parts.length > 2) return callback("backgroundSize 最多支持两个值");
|
|
82
|
-
if (parts.every((part) => singleValue(part))) return callback();
|
|
83
|
-
return callback("backgroundSize 值不合法");
|
|
84
|
-
} }]
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "backgroundRepeat",
|
|
88
|
-
text: "重复显示",
|
|
89
|
-
type: "radioGroup",
|
|
90
|
-
childType: "button",
|
|
91
|
-
labelWidth: "68px",
|
|
92
|
-
options: [
|
|
93
|
-
{
|
|
94
|
-
value: "no-repeat",
|
|
95
|
-
icon: markRaw(NoRepeat_default),
|
|
96
|
-
tooltip: "不重复 no-repeat"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
value: "repeat-x",
|
|
100
|
-
icon: markRaw(RepeatX_default),
|
|
101
|
-
tooltip: "水平方向重复 repeat-x"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
value: "repeat-y",
|
|
105
|
-
icon: markRaw(RepeatY_default),
|
|
106
|
-
tooltip: "垂直方向重复 repeat-y"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
value: "repeat",
|
|
110
|
-
icon: markRaw(Repeat_default),
|
|
111
|
-
tooltip: "垂直和水平方向重复 repeat"
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: "backgroundPosition",
|
|
117
|
-
text: "背景定位",
|
|
118
|
-
type: "component",
|
|
119
|
-
component: BackgroundPosition_default,
|
|
120
|
-
labelWidth: "68px"
|
|
121
|
-
}
|
|
122
|
-
]);
|
|
19
|
+
const formConfig = computed(() => createBackgroundConfig());
|
|
123
20
|
const change = (value, eventData) => {
|
|
124
21
|
emit("change", value, eventData);
|
|
125
22
|
};
|
|
126
23
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
127
24
|
return (_ctx, _cache) => {
|
|
128
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
25
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(formConfig.value, (item) => {
|
|
129
26
|
return openBlock(), createBlock(unref(MContainer), {
|
|
130
27
|
prop: __props.prop,
|
|
131
28
|
key: item.name,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { borderRadiusConfig } from "../configs.js";
|
|
1
2
|
import Border_default from "../components/Border.js";
|
|
2
|
-
import { MContainer
|
|
3
|
+
import { MContainer } from "@tmagic/form";
|
|
3
4
|
import { Fragment, createElementBlock, createVNode, defineComponent, openBlock, unref } from "vue";
|
|
4
5
|
//#region packages/editor/src/fields/StyleSetter/pro/Border.vue?vue&type=script&setup=true&lang.ts
|
|
5
6
|
var Border_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
@@ -15,13 +16,6 @@ var Border_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
15
16
|
emits: ["change", "addDiffCount"],
|
|
16
17
|
setup(__props, { emit: __emit }) {
|
|
17
18
|
const emit = __emit;
|
|
18
|
-
const config = defineFormItem({
|
|
19
|
-
labelWidth: "68px",
|
|
20
|
-
name: "borderRadius",
|
|
21
|
-
text: "圆角",
|
|
22
|
-
type: "data-source-field-select",
|
|
23
|
-
fieldConfig: { type: "text" }
|
|
24
|
-
});
|
|
25
19
|
const change = (value, eventData) => {
|
|
26
20
|
emit("change", value, eventData);
|
|
27
21
|
};
|
|
@@ -29,7 +23,7 @@ var Border_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
29
23
|
return (_ctx, _cache) => {
|
|
30
24
|
return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(MContainer), {
|
|
31
25
|
prop: __props.prop,
|
|
32
|
-
config: unref(
|
|
26
|
+
config: unref(borderRadiusConfig),
|
|
33
27
|
model: __props.values,
|
|
34
28
|
"last-values": __props.lastValues,
|
|
35
29
|
"is-compare": __props.isCompare,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { validateDataSourceFieldSelect } from "../../../utils/type-match-rules.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { MContainer, defineFormConfig } from "@tmagic/form";
|
|
6
|
-
import { appendValidateSuggestion } from "@tmagic/design";
|
|
7
|
-
import { Fragment, createBlock, createElementBlock, defineComponent, markRaw, openBlock, renderList, unref } from "vue";
|
|
2
|
+
import { createFontConfig } from "../configs.js";
|
|
3
|
+
import { MContainer } from "@tmagic/form";
|
|
4
|
+
import { Fragment, computed, createBlock, createElementBlock, defineComponent, openBlock, renderList, unref } from "vue";
|
|
8
5
|
//#region packages/editor/src/fields/StyleSetter/pro/Font.vue?vue&type=script&setup=true&lang.ts
|
|
9
6
|
var Font_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
10
7
|
__name: "Font",
|
|
@@ -19,107 +16,13 @@ var Font_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
19
16
|
emits: ["change", "addDiffCount"],
|
|
20
17
|
setup(__props, { emit: __emit }) {
|
|
21
18
|
const emit = __emit;
|
|
22
|
-
const formConfig =
|
|
23
|
-
{
|
|
24
|
-
type: "row",
|
|
25
|
-
items: [{
|
|
26
|
-
labelWidth: "68px",
|
|
27
|
-
name: "fontSize",
|
|
28
|
-
text: "字号",
|
|
29
|
-
type: "data-source-field-select",
|
|
30
|
-
fieldConfig: { type: "text" },
|
|
31
|
-
rules: [{
|
|
32
|
-
typeMatch: true,
|
|
33
|
-
message: appendValidateSuggestion("字号应为字符串或数字", "请参考以下示例值:24 或 \"24\"")
|
|
34
|
-
}]
|
|
35
|
-
}, {
|
|
36
|
-
labelWidth: "68px",
|
|
37
|
-
name: "lineHeight",
|
|
38
|
-
text: "行高",
|
|
39
|
-
type: "data-source-field-select",
|
|
40
|
-
fieldConfig: { type: "text" }
|
|
41
|
-
}]
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "fontWeight",
|
|
45
|
-
text: "字重",
|
|
46
|
-
labelWidth: "68px",
|
|
47
|
-
type: "data-source-field-select",
|
|
48
|
-
dataSourceFieldType: ["string", "number"],
|
|
49
|
-
fieldConfig: {
|
|
50
|
-
type: "select",
|
|
51
|
-
allowCreate: true,
|
|
52
|
-
options: ["normal", "bold"].concat(Array(7).fill(1).map((x, i) => `${i + 1}00`)).map((item) => ({
|
|
53
|
-
value: item,
|
|
54
|
-
text: item
|
|
55
|
-
}))
|
|
56
|
-
},
|
|
57
|
-
rules: [{ typeMatch: false }, { validator: ({ value, callback }, { config, model, prop }, mForm) => {
|
|
58
|
-
if (value === "" || value === null || value === void 0) return callback();
|
|
59
|
-
const result = validateDataSourceFieldSelect(value, {
|
|
60
|
-
fieldType: "data-source-field-select",
|
|
61
|
-
mForm,
|
|
62
|
-
props: {
|
|
63
|
-
config,
|
|
64
|
-
model,
|
|
65
|
-
prop
|
|
66
|
-
}
|
|
67
|
-
}, { validatePlainValue: (plainValue) => {
|
|
68
|
-
if (typeof plainValue === "string" || typeof plainValue === "number" && !Number.isNaN(plainValue)) return;
|
|
69
|
-
return "字重应为字符串或数字";
|
|
70
|
-
} });
|
|
71
|
-
if (result && typeof result.then === "function") {
|
|
72
|
-
result.then((error) => callback(error), (error) => callback(error));
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
return callback(result);
|
|
76
|
-
} }]
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
labelWidth: "68px",
|
|
80
|
-
name: "color",
|
|
81
|
-
text: "颜色",
|
|
82
|
-
type: "data-source-field-select",
|
|
83
|
-
fieldConfig: { type: "colorPicker" },
|
|
84
|
-
rules: [{
|
|
85
|
-
typeMatch: true,
|
|
86
|
-
message: appendValidateSuggestion("颜色应为字符串", "请参考以下示例值:\"#000000\"")
|
|
87
|
-
}]
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "textAlign",
|
|
91
|
-
text: "对齐",
|
|
92
|
-
type: "radioGroup",
|
|
93
|
-
childType: "button",
|
|
94
|
-
labelWidth: "68px",
|
|
95
|
-
options: [
|
|
96
|
-
{
|
|
97
|
-
value: "left",
|
|
98
|
-
icon: markRaw(Left_default),
|
|
99
|
-
tooltip: "左对齐 row",
|
|
100
|
-
text: "左对齐"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
value: "center",
|
|
104
|
-
icon: markRaw(Center_default),
|
|
105
|
-
tooltip: "居中对齐 center",
|
|
106
|
-
text: "居中对齐"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
value: "right",
|
|
110
|
-
icon: markRaw(Right_default),
|
|
111
|
-
tooltip: "右对齐 right",
|
|
112
|
-
text: "右对齐"
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
]);
|
|
19
|
+
const formConfig = computed(() => createFontConfig(validateDataSourceFieldSelect));
|
|
117
20
|
const change = (value, eventData) => {
|
|
118
21
|
emit("change", value, eventData);
|
|
119
22
|
};
|
|
120
23
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
121
24
|
return (_ctx, _cache) => {
|
|
122
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
25
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(formConfig.value, (item, index) => {
|
|
123
26
|
return openBlock(), createBlock(unref(MContainer), {
|
|
124
27
|
prop: __props.prop,
|
|
125
28
|
key: index,
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
+
import { createLayoutConfig } from "../configs.js";
|
|
1
2
|
import Box_default from "../components/Box.js";
|
|
2
|
-
import
|
|
3
|
-
import FlexEnd_default from "../icons/align-items/FlexEnd.js";
|
|
4
|
-
import FlexStart_default from "../icons/align-items/FlexStart.js";
|
|
5
|
-
import SpaceAround_default from "../icons/align-items/SpaceAround.js";
|
|
6
|
-
import SpaceBetween_default from "../icons/align-items/SpaceBetween.js";
|
|
7
|
-
import Block_default from "../icons/display/Block.js";
|
|
8
|
-
import Flex_default from "../icons/display/Flex.js";
|
|
9
|
-
import Inline_default from "../icons/display/Inline.js";
|
|
10
|
-
import InlineBlock_default from "../icons/display/InlineBlock.js";
|
|
11
|
-
import None_default from "../icons/display/None.js";
|
|
12
|
-
import Column_default from "../icons/flex-direction/Column.js";
|
|
13
|
-
import ColumnReverse_default from "../icons/flex-direction/ColumnReverse.js";
|
|
14
|
-
import Row_default from "../icons/flex-direction/Row.js";
|
|
15
|
-
import RowReverse_default from "../icons/flex-direction/RowReverse.js";
|
|
16
|
-
import Center_default$1 from "../icons/justify-content/Center.js";
|
|
17
|
-
import FlexEnd_default$1 from "../icons/justify-content/FlexEnd.js";
|
|
18
|
-
import FlexStart_default$1 from "../icons/justify-content/FlexStart.js";
|
|
19
|
-
import SpaceAround_default$1 from "../icons/justify-content/SpaceAround.js";
|
|
20
|
-
import SpaceBetween_default$1 from "../icons/justify-content/SpaceBetween.js";
|
|
21
|
-
import { MContainer, defineFormConfig } from "@tmagic/form";
|
|
3
|
+
import { MContainer } from "@tmagic/form";
|
|
22
4
|
import { useTheme } from "@tmagic/design";
|
|
23
|
-
import { Fragment, createBlock, createElementBlock, createVNode, defineComponent,
|
|
5
|
+
import { Fragment, computed, createBlock, createElementBlock, createVNode, defineComponent, openBlock, renderList, unref, vShow, withDirectives } from "vue";
|
|
24
6
|
//#region packages/editor/src/fields/StyleSetter/pro/Layout.vue?vue&type=script&setup=true&lang.ts
|
|
25
7
|
var Layout_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
26
8
|
__name: "Layout",
|
|
@@ -38,255 +20,13 @@ var Layout_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
38
20
|
const props = __props;
|
|
39
21
|
const emit = __emit;
|
|
40
22
|
const displayTheme = useTheme(props);
|
|
41
|
-
const formConfig =
|
|
42
|
-
{
|
|
43
|
-
name: "display",
|
|
44
|
-
text: "模式",
|
|
45
|
-
type: "radioGroup",
|
|
46
|
-
childType: "button",
|
|
47
|
-
labelWidth: "90px",
|
|
48
|
-
iconSize: "24px",
|
|
49
|
-
options: [
|
|
50
|
-
{
|
|
51
|
-
value: "inline",
|
|
52
|
-
icon: markRaw(Inline_default),
|
|
53
|
-
tooltip: "内联布局 inline"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
value: "flex",
|
|
57
|
-
icon: markRaw(Flex_default),
|
|
58
|
-
tooltip: "弹性布局 flex"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
value: "block",
|
|
62
|
-
icon: markRaw(Block_default),
|
|
63
|
-
tooltip: "块级布局 block"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
value: "inline-block",
|
|
67
|
-
icon: markRaw(InlineBlock_default),
|
|
68
|
-
tooltip: "内联块布局 inline-block"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
value: "none",
|
|
72
|
-
icon: markRaw(None_default),
|
|
73
|
-
tooltip: "隐藏 none"
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "flexDirection",
|
|
79
|
-
text: "主轴方向",
|
|
80
|
-
type: "radioGroup",
|
|
81
|
-
childType: "button",
|
|
82
|
-
labelWidth: "90px",
|
|
83
|
-
iconSize: "24px",
|
|
84
|
-
options: [
|
|
85
|
-
{
|
|
86
|
-
value: "row",
|
|
87
|
-
icon: markRaw(Row_default),
|
|
88
|
-
tooltip: "水平方向 起点在左侧 row"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
value: "row-reverse",
|
|
92
|
-
icon: markRaw(RowReverse_default),
|
|
93
|
-
tooltip: "水平方向 起点在右侧 row-reverse"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
value: "column",
|
|
97
|
-
icon: markRaw(Column_default),
|
|
98
|
-
tooltip: "垂直方向 起点在上沿 column"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
value: "column-reverse",
|
|
102
|
-
icon: markRaw(ColumnReverse_default),
|
|
103
|
-
tooltip: "垂直方向 起点在下沿 column-reverse"
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
display: (_mForm, { model }) => model.display === "flex"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "justifyContent",
|
|
110
|
-
text: "主轴对齐",
|
|
111
|
-
type: "radioGroup",
|
|
112
|
-
childType: "button",
|
|
113
|
-
labelWidth: "90px",
|
|
114
|
-
iconSize: "24px",
|
|
115
|
-
options: [
|
|
116
|
-
{
|
|
117
|
-
value: "flex-start",
|
|
118
|
-
icon: markRaw(FlexStart_default$1),
|
|
119
|
-
tooltip: "左对齐 flex-start"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
value: "flex-end",
|
|
123
|
-
icon: markRaw(FlexEnd_default$1),
|
|
124
|
-
tooltip: "右对齐 flex-end"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
value: "center",
|
|
128
|
-
icon: markRaw(Center_default$1),
|
|
129
|
-
tooltip: "居中 center"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
value: "space-between",
|
|
133
|
-
icon: markRaw(SpaceBetween_default$1),
|
|
134
|
-
tooltip: "两端对齐 space-between"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
value: "space-around",
|
|
138
|
-
icon: markRaw(SpaceAround_default$1),
|
|
139
|
-
tooltip: "横向平分 space-around"
|
|
140
|
-
}
|
|
141
|
-
],
|
|
142
|
-
display: (_mForm, { model }) => model.display === "flex"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "alignItems",
|
|
146
|
-
text: "辅轴对齐",
|
|
147
|
-
type: "radioGroup",
|
|
148
|
-
childType: "button",
|
|
149
|
-
labelWidth: "90px",
|
|
150
|
-
iconSize: "24px",
|
|
151
|
-
options: [
|
|
152
|
-
{
|
|
153
|
-
value: "flex-start",
|
|
154
|
-
icon: markRaw(FlexStart_default),
|
|
155
|
-
tooltip: "左对齐 flex-start"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
value: "flex-end",
|
|
159
|
-
icon: markRaw(FlexEnd_default),
|
|
160
|
-
tooltip: "右对齐 flex-end"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
value: "center",
|
|
164
|
-
icon: markRaw(Center_default),
|
|
165
|
-
tooltip: "居中 center"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
value: "space-between",
|
|
169
|
-
icon: markRaw(SpaceBetween_default),
|
|
170
|
-
tooltip: "两端对齐 space-between"
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
value: "space-around",
|
|
174
|
-
icon: markRaw(SpaceAround_default),
|
|
175
|
-
tooltip: "横向平分 space-around"
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
display: (_mForm, { model }) => model.display === "flex"
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: "flexWrap",
|
|
182
|
-
text: "换行",
|
|
183
|
-
type: "radioGroup",
|
|
184
|
-
childType: displayTheme.value !== "magic-admin" ? "button" : "default",
|
|
185
|
-
labelWidth: "90px",
|
|
186
|
-
iconSize: "24px",
|
|
187
|
-
options: [
|
|
188
|
-
{
|
|
189
|
-
value: "nowrap",
|
|
190
|
-
text: "不换行",
|
|
191
|
-
tooltip: "不换行 nowrap"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
value: "wrap",
|
|
195
|
-
text: "正换行",
|
|
196
|
-
tooltip: "第一行在上方 wrap"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
value: "wrap-reverse",
|
|
200
|
-
text: "逆换行",
|
|
201
|
-
tooltip: "第一行在下方 wrap-reverse"
|
|
202
|
-
}
|
|
203
|
-
],
|
|
204
|
-
display: (_mForm, { model }) => model.display === "flex"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
type: "row",
|
|
208
|
-
items: [{
|
|
209
|
-
name: "width",
|
|
210
|
-
text: "宽度(px)",
|
|
211
|
-
labelWidth: "90px",
|
|
212
|
-
type: "data-source-field-select",
|
|
213
|
-
fieldConfig: { type: "text" }
|
|
214
|
-
}]
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
type: "row",
|
|
218
|
-
items: [{
|
|
219
|
-
name: "height",
|
|
220
|
-
text: "高度(px)",
|
|
221
|
-
labelWidth: "90px",
|
|
222
|
-
type: "data-source-field-select",
|
|
223
|
-
fieldConfig: { type: "text" }
|
|
224
|
-
}]
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
type: "row",
|
|
228
|
-
items: [{
|
|
229
|
-
type: "data-source-field-select",
|
|
230
|
-
text: "overflow",
|
|
231
|
-
name: "overflow",
|
|
232
|
-
labelWidth: "90px",
|
|
233
|
-
checkStrictly: false,
|
|
234
|
-
dataSourceFieldType: ["string"],
|
|
235
|
-
fieldConfig: {
|
|
236
|
-
type: "select",
|
|
237
|
-
clearable: true,
|
|
238
|
-
allowCreate: true,
|
|
239
|
-
options: [
|
|
240
|
-
{
|
|
241
|
-
text: "visible",
|
|
242
|
-
value: "visible"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
text: "hidden",
|
|
246
|
-
value: "hidden"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
text: "clip",
|
|
250
|
-
value: "clip"
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
text: "scroll",
|
|
254
|
-
value: "scroll"
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
text: "auto",
|
|
258
|
-
value: "auto"
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
text: "overlay",
|
|
262
|
-
value: "overlay"
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
text: "initial",
|
|
266
|
-
value: "initial"
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
}]
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
type: "row",
|
|
274
|
-
items: [{
|
|
275
|
-
type: "data-source-field-select",
|
|
276
|
-
text: "透明度(%)",
|
|
277
|
-
name: "opacity",
|
|
278
|
-
labelWidth: "90px",
|
|
279
|
-
dataSourceFieldType: ["string", "number"],
|
|
280
|
-
fieldConfig: { type: "text" }
|
|
281
|
-
}]
|
|
282
|
-
}
|
|
283
|
-
]);
|
|
23
|
+
const formConfig = computed(() => createLayoutConfig(displayTheme.value));
|
|
284
24
|
const change = (value, eventData) => {
|
|
285
25
|
emit("change", value, eventData);
|
|
286
26
|
};
|
|
287
27
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
288
28
|
return (_ctx, _cache) => {
|
|
289
|
-
return openBlock(), createElementBlock(Fragment, null, [(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
29
|
+
return openBlock(), createElementBlock(Fragment, null, [(openBlock(true), createElementBlock(Fragment, null, renderList(formConfig.value, (item) => {
|
|
290
30
|
return openBlock(), createBlock(unref(MContainer), {
|
|
291
31
|
prop: __props.prop,
|
|
292
32
|
key: item.name,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Fragment, createBlock, createElementBlock, defineComponent, openBlock, renderList, unref } from "vue";
|
|
1
|
+
import { createPositionConfig } from "../configs.js";
|
|
2
|
+
import { MContainer } from "@tmagic/form";
|
|
3
|
+
import { Fragment, computed, createBlock, createElementBlock, defineComponent, openBlock, renderList, unref } from "vue";
|
|
4
4
|
//#region packages/editor/src/fields/StyleSetter/pro/Position.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var Position_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
6
6
|
__name: "Position",
|
|
@@ -16,93 +16,13 @@ var Position_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
|
|
|
16
16
|
setup(__props, { emit: __emit }) {
|
|
17
17
|
const props = __props;
|
|
18
18
|
const emit = __emit;
|
|
19
|
-
const
|
|
20
|
-
static: "不定位",
|
|
21
|
-
relative: "相对定位",
|
|
22
|
-
absolute: "绝对定位",
|
|
23
|
-
fixed: "固定定位",
|
|
24
|
-
sticky: "粘性定位"
|
|
25
|
-
};
|
|
26
|
-
const formConfig = defineFormConfig([
|
|
27
|
-
{
|
|
28
|
-
name: "position",
|
|
29
|
-
text: "定位",
|
|
30
|
-
labelWidth: "68px",
|
|
31
|
-
type: "data-source-field-select",
|
|
32
|
-
fieldConfig: {
|
|
33
|
-
type: "select",
|
|
34
|
-
options: Object.keys(positionText).map((item) => ({
|
|
35
|
-
value: item,
|
|
36
|
-
text: `${item}(${positionText[item]})`
|
|
37
|
-
}))
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: "row",
|
|
42
|
-
labelWidth: "68px",
|
|
43
|
-
display: () => props.values.position !== "static",
|
|
44
|
-
items: [{
|
|
45
|
-
name: "left",
|
|
46
|
-
type: "data-source-field-select",
|
|
47
|
-
text: "left",
|
|
48
|
-
fieldConfig: { type: "text" },
|
|
49
|
-
rules: [{
|
|
50
|
-
typeMatch: true,
|
|
51
|
-
message: appendValidateSuggestion("left 应为字符串", "请参考以下示例值:\"10\"")
|
|
52
|
-
}]
|
|
53
|
-
}, {
|
|
54
|
-
name: "top",
|
|
55
|
-
type: "data-source-field-select",
|
|
56
|
-
text: "top",
|
|
57
|
-
fieldConfig: { type: "text" },
|
|
58
|
-
rules: [{
|
|
59
|
-
typeMatch: true,
|
|
60
|
-
message: appendValidateSuggestion("top 应为字符串", "请参考以下示例值:\"10\"")
|
|
61
|
-
}]
|
|
62
|
-
}]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: "row",
|
|
66
|
-
labelWidth: "68px",
|
|
67
|
-
display: () => props.values.position !== "static",
|
|
68
|
-
items: [{
|
|
69
|
-
name: "right",
|
|
70
|
-
type: "data-source-field-select",
|
|
71
|
-
text: "right",
|
|
72
|
-
fieldConfig: { type: "text" },
|
|
73
|
-
rules: [{
|
|
74
|
-
typeMatch: true,
|
|
75
|
-
message: appendValidateSuggestion("right 应为字符串", "请参考以下示例值:\"10\"")
|
|
76
|
-
}]
|
|
77
|
-
}, {
|
|
78
|
-
name: "bottom",
|
|
79
|
-
type: "data-source-field-select",
|
|
80
|
-
text: "bottom",
|
|
81
|
-
fieldConfig: { type: "text" },
|
|
82
|
-
rules: [{
|
|
83
|
-
typeMatch: true,
|
|
84
|
-
message: appendValidateSuggestion("bottom 应为字符串", "请参考以下示例值:\"10\"")
|
|
85
|
-
}]
|
|
86
|
-
}]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
labelWidth: "68px",
|
|
90
|
-
name: "zIndex",
|
|
91
|
-
text: "zIndex",
|
|
92
|
-
type: "data-source-field-select",
|
|
93
|
-
fieldConfig: { type: "text" },
|
|
94
|
-
rules: [{
|
|
95
|
-
typeMatch: true,
|
|
96
|
-
message: appendValidateSuggestion("zIndex 应为数字", "请参考以下示例值:10")
|
|
97
|
-
}]
|
|
98
|
-
}
|
|
99
|
-
]);
|
|
19
|
+
const formConfig = computed(() => createPositionConfig(props.values));
|
|
100
20
|
const change = (value, eventData) => {
|
|
101
21
|
emit("change", value, eventData);
|
|
102
22
|
};
|
|
103
23
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
104
24
|
return (_ctx, _cache) => {
|
|
105
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
25
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(formConfig.value, (item, index) => {
|
|
106
26
|
return openBlock(), createBlock(unref(MContainer), {
|
|
107
27
|
prop: __props.prop,
|
|
108
28
|
key: index,
|