@tmagic/editor 1.8.0-beta.11 → 1.8.0-beta.13
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 +7 -4
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +18 -123
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +60 -14
- package/dist/es/components/ScrollBar.js +0 -1
- package/dist/es/components/ViewForm.js +5 -0
- package/dist/es/components/ViewForm.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/es/editorProps.js +6 -1
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +15 -3
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +2 -17
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +7 -0
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +5 -17
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +29 -3
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +50 -88
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +2 -5
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +48 -23
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +28 -22
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +28 -22
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +28 -22
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/es/fields/UISelect.js +0 -1
- package/dist/es/hooks/use-compare-form.js +119 -0
- package/dist/es/index.js +13 -8
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +21 -6
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +9 -6
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/layouts/history-list/composables.js +1 -1
- package/dist/es/layouts/history-list/useHistoryRevert.js +7 -3
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +44 -5
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +15 -8
- package/dist/es/layouts/props-panel/use-style-panel.js +3 -2
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +15 -31
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +18 -3
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +18 -3
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.js +5 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/plugin.js +3 -1
- package/dist/es/services/codeBlock.js +1 -1
- package/dist/es/services/editor.js +104 -5
- package/dist/es/services/history.js +1 -1
- package/dist/es/services/props.js +3 -2
- package/dist/es/services/storage.js +2 -2
- package/dist/es/services/ui.js +3 -0
- package/dist/es/style.css +104 -55
- package/dist/es/utils/data-source/index.js +30 -11
- package/dist/es/utils/event.js +123 -0
- package/dist/es/utils/monaco-editor.js +22 -6
- package/dist/es/utils/props.js +119 -8
- package/dist/es/utils/type-match-rules.js +360 -0
- package/dist/style.css +104 -55
- package/dist/tmagic-editor.umd.cjs +16996 -15806
- package/package.json +8 -8
- package/src/Editor.vue +3 -1
- package/src/components/CodeBlockEditor.vue +3 -0
- package/src/components/CompareForm.vue +16 -196
- package/src/components/FloatingBox.vue +77 -8
- package/src/components/ScrollBar.vue +0 -67
- package/src/components/ViewForm.vue +55 -0
- package/src/editorProps.ts +13 -0
- package/src/fields/CodeSelect.vue +4 -1
- package/src/fields/CondOpSelect.vue +2 -24
- package/src/fields/DataSourceFields.vue +5 -0
- package/src/fields/DataSourceInput.vue +7 -25
- package/src/fields/DataSourceMocks.vue +3 -0
- package/src/fields/DisplayConds.vue +14 -0
- package/src/fields/EventSelect.vue +84 -129
- package/src/fields/StyleSetter/Index.vue +2 -8
- package/src/fields/StyleSetter/pro/Background.vue +94 -55
- package/src/fields/StyleSetter/pro/Border.vue +9 -11
- package/src/fields/StyleSetter/pro/Font.vue +66 -64
- package/src/fields/StyleSetter/pro/Layout.vue +140 -138
- package/src/fields/StyleSetter/pro/Position.vue +69 -67
- package/src/fields/StyleSetter/pro/Transform.vue +23 -25
- package/src/fields/UISelect.vue +0 -12
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-compare-form.ts +187 -0
- package/src/index.ts +2 -0
- package/src/layouts/CodeEditor.vue +32 -6
- package/src/layouts/Framework.vue +7 -6
- package/src/layouts/history-list/HistoryDiffDialog.vue +11 -1
- package/src/layouts/history-list/useHistoryRevert.ts +4 -0
- package/src/layouts/props-panel/FormPanel.vue +66 -5
- package/src/layouts/props-panel/PropsPanel.vue +20 -6
- package/src/layouts/props-panel/use-style-panel.ts +4 -3
- package/src/layouts/sidebar/Sidebar.vue +2 -0
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +4 -1
- package/src/layouts/sidebar/code-block/useContentMenu.ts +13 -1
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +3 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +2 -2
- package/src/layouts/sidebar/data-source/useContentMenu.ts +13 -1
- package/src/layouts/sidebar/layer/LayerNodeContent.vue +57 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +4 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +4 -1
- package/src/plugin.ts +3 -1
- package/src/services/editor.ts +168 -3
- package/src/services/ui.ts +6 -0
- package/src/theme/event.scss +8 -0
- package/src/theme/floating-box.scss +9 -1
- package/src/theme/layer-node-content.scss +14 -0
- package/src/theme/scroll-bar.scss +64 -0
- package/src/theme/theme.scss +3 -0
- package/src/theme/ui-select.scss +9 -0
- package/src/type.ts +105 -2
- package/src/utils/data-source/index.ts +30 -12
- package/src/utils/event.ts +224 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/monaco-editor.ts +27 -0
- package/src/utils/props.ts +189 -2
- package/src/utils/type-match-rules.ts +678 -0
- package/types/index.d.ts +558 -213
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<MContainer
|
|
3
|
+
:prop="prop"
|
|
3
4
|
:config="config"
|
|
4
5
|
:model="values"
|
|
5
6
|
:last-values="lastValues"
|
|
@@ -32,6 +33,7 @@ defineProps<{
|
|
|
32
33
|
isCompare?: boolean;
|
|
33
34
|
disabled?: boolean;
|
|
34
35
|
size?: 'large' | 'default' | 'small';
|
|
36
|
+
prop?: string;
|
|
35
37
|
}>();
|
|
36
38
|
|
|
37
39
|
const emit = defineEmits<{
|
|
@@ -40,17 +42,13 @@ const emit = defineEmits<{
|
|
|
40
42
|
}>();
|
|
41
43
|
|
|
42
44
|
const config = defineFormItem({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
type: 'text',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
],
|
|
45
|
+
labelWidth: '68px',
|
|
46
|
+
name: 'borderRadius',
|
|
47
|
+
text: '圆角',
|
|
48
|
+
type: 'data-source-field-select',
|
|
49
|
+
fieldConfig: {
|
|
50
|
+
type: 'text',
|
|
51
|
+
},
|
|
54
52
|
});
|
|
55
53
|
|
|
56
54
|
const change = (value: StyleSchema, eventData: ContainerChangeEventData) => {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<MContainer
|
|
3
|
-
|
|
3
|
+
v-for="(item, index) in formConfig"
|
|
4
|
+
:prop="prop"
|
|
5
|
+
:key="index"
|
|
6
|
+
:config="item"
|
|
4
7
|
:model="values"
|
|
5
8
|
:last-values="lastValues"
|
|
6
9
|
:is-compare="isCompare"
|
|
@@ -14,7 +17,7 @@
|
|
|
14
17
|
<script lang="ts" setup>
|
|
15
18
|
import { markRaw } from 'vue';
|
|
16
19
|
|
|
17
|
-
import { type ContainerChangeEventData,
|
|
20
|
+
import { type ContainerChangeEventData, defineFormConfig, MContainer } from '@tmagic/form';
|
|
18
21
|
import type { StyleSchema } from '@tmagic/schema';
|
|
19
22
|
|
|
20
23
|
import { AlignCenter, AlignLeft, AlignRight } from '../icons/text-align';
|
|
@@ -25,6 +28,7 @@ defineProps<{
|
|
|
25
28
|
isCompare?: boolean;
|
|
26
29
|
disabled?: boolean;
|
|
27
30
|
size?: 'large' | 'default' | 'small';
|
|
31
|
+
prop?: string;
|
|
28
32
|
}>();
|
|
29
33
|
|
|
30
34
|
const emit = defineEmits<{
|
|
@@ -32,73 +36,71 @@ const emit = defineEmits<{
|
|
|
32
36
|
addDiffCount: [];
|
|
33
37
|
}>();
|
|
34
38
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type: 'text',
|
|
47
|
-
},
|
|
39
|
+
const formConfig = defineFormConfig([
|
|
40
|
+
{
|
|
41
|
+
type: 'row',
|
|
42
|
+
items: [
|
|
43
|
+
{
|
|
44
|
+
labelWidth: '68px',
|
|
45
|
+
name: 'fontSize',
|
|
46
|
+
text: '字号',
|
|
47
|
+
type: 'data-source-field-select',
|
|
48
|
+
fieldConfig: {
|
|
49
|
+
type: 'text',
|
|
48
50
|
},
|
|
49
|
-
{
|
|
50
|
-
labelWidth: '68px',
|
|
51
|
-
name: 'lineHeight',
|
|
52
|
-
text: '行高',
|
|
53
|
-
type: 'data-source-field-select',
|
|
54
|
-
fieldConfig: {
|
|
55
|
-
type: 'text',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'fontWeight',
|
|
62
|
-
text: '字重',
|
|
63
|
-
labelWidth: '68px',
|
|
64
|
-
type: 'data-source-field-select',
|
|
65
|
-
fieldConfig: {
|
|
66
|
-
type: 'select',
|
|
67
|
-
options: ['normal', 'bold']
|
|
68
|
-
.concat(
|
|
69
|
-
Array(7)
|
|
70
|
-
.fill(1)
|
|
71
|
-
.map((x, i) => `${i + 1}00`),
|
|
72
|
-
)
|
|
73
|
-
.map((item) => ({
|
|
74
|
-
value: item,
|
|
75
|
-
text: item,
|
|
76
|
-
})),
|
|
77
51
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
52
|
+
{
|
|
53
|
+
labelWidth: '68px',
|
|
54
|
+
name: 'lineHeight',
|
|
55
|
+
text: '行高',
|
|
56
|
+
type: 'data-source-field-select',
|
|
57
|
+
fieldConfig: {
|
|
58
|
+
type: 'text',
|
|
59
|
+
},
|
|
86
60
|
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'fontWeight',
|
|
65
|
+
text: '字重',
|
|
66
|
+
labelWidth: '68px',
|
|
67
|
+
type: 'data-source-field-select',
|
|
68
|
+
fieldConfig: {
|
|
69
|
+
type: 'select',
|
|
70
|
+
options: ['normal', 'bold']
|
|
71
|
+
.concat(
|
|
72
|
+
Array(7)
|
|
73
|
+
.fill(1)
|
|
74
|
+
.map((x, i) => `${i + 1}00`),
|
|
75
|
+
)
|
|
76
|
+
.map((item) => ({
|
|
77
|
+
value: item,
|
|
78
|
+
text: item,
|
|
79
|
+
})),
|
|
87
80
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
{ value: 'center', icon: markRaw(AlignCenter), tooltip: '居中对齐 center' },
|
|
97
|
-
{ value: 'right', icon: markRaw(AlignRight), tooltip: '右对齐 right' },
|
|
98
|
-
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
labelWidth: '68px',
|
|
84
|
+
name: 'color',
|
|
85
|
+
text: '颜色',
|
|
86
|
+
type: 'data-source-field-select',
|
|
87
|
+
fieldConfig: {
|
|
88
|
+
type: 'colorPicker',
|
|
99
89
|
},
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'textAlign',
|
|
93
|
+
text: '对齐',
|
|
94
|
+
type: 'radioGroup',
|
|
95
|
+
childType: 'button',
|
|
96
|
+
labelWidth: '68px',
|
|
97
|
+
options: [
|
|
98
|
+
{ value: 'left', icon: markRaw(AlignLeft), tooltip: '左对齐 row' },
|
|
99
|
+
{ value: 'center', icon: markRaw(AlignCenter), tooltip: '居中对齐 center' },
|
|
100
|
+
{ value: 'right', icon: markRaw(AlignRight), tooltip: '右对齐 right' },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
]);
|
|
102
104
|
|
|
103
105
|
const change = (value: StyleSchema, eventData: ContainerChangeEventData) => {
|
|
104
106
|
emit('change', value, eventData);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<MContainer
|
|
3
|
-
|
|
3
|
+
v-for="item in formConfig"
|
|
4
|
+
:prop="prop"
|
|
5
|
+
:key="item.name"
|
|
6
|
+
:config="item"
|
|
4
7
|
:model="values"
|
|
5
8
|
:last-values="lastValues"
|
|
6
9
|
:is-compare="isCompare"
|
|
@@ -23,8 +26,8 @@
|
|
|
23
26
|
<script lang="ts" setup>
|
|
24
27
|
import { markRaw } from 'vue';
|
|
25
28
|
|
|
26
|
-
import type {
|
|
27
|
-
import {
|
|
29
|
+
import type { ContainerChangeEventData } from '@tmagic/form';
|
|
30
|
+
import { defineFormConfig, MContainer } from '@tmagic/form';
|
|
28
31
|
import type { StyleSchema } from '@tmagic/schema';
|
|
29
32
|
|
|
30
33
|
import Box from '../components/Box.vue';
|
|
@@ -49,6 +52,7 @@ defineProps<{
|
|
|
49
52
|
isCompare?: boolean;
|
|
50
53
|
disabled?: boolean;
|
|
51
54
|
size?: 'large' | 'default' | 'small';
|
|
55
|
+
prop?: string;
|
|
52
56
|
}>();
|
|
53
57
|
|
|
54
58
|
const emit = defineEmits<{
|
|
@@ -56,145 +60,143 @@ const emit = defineEmits<{
|
|
|
56
60
|
addDiffCount: [];
|
|
57
61
|
}>();
|
|
58
62
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
const formConfig = defineFormConfig([
|
|
64
|
+
{
|
|
65
|
+
name: 'display',
|
|
66
|
+
text: '模式',
|
|
67
|
+
type: 'radioGroup',
|
|
68
|
+
childType: 'button',
|
|
69
|
+
labelWidth: '68px',
|
|
70
|
+
options: [
|
|
71
|
+
{ value: 'inline', icon: markRaw(DisplayInline), tooltip: '内联布局 inline' },
|
|
72
|
+
{ value: 'flex', icon: markRaw(DisplayFlex), tooltip: '弹性布局 flex' },
|
|
73
|
+
{ value: 'block', icon: markRaw(DisplayBlock), tooltip: '块级布局 block' },
|
|
74
|
+
{ value: 'inline-block', icon: markRaw(DisplayInlineBlock), tooltip: '内联块布局 inline-block' },
|
|
75
|
+
{ value: 'none', icon: markRaw(DisplayNone), tooltip: '隐藏 none' },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'flexDirection',
|
|
80
|
+
text: '主轴方向',
|
|
81
|
+
type: 'radioGroup',
|
|
82
|
+
childType: 'button',
|
|
83
|
+
labelWidth: '68px',
|
|
84
|
+
options: [
|
|
85
|
+
{ value: 'row', icon: markRaw(FlexDirectionRow), tooltip: '水平方向 起点在左侧 row' },
|
|
86
|
+
{ value: 'row-reverse', icon: markRaw(FlexDirectionRowReverse), tooltip: '水平方向 起点在右侧 row-reverse' },
|
|
87
|
+
{ value: 'column', icon: markRaw(FlexDirectionColumn), tooltip: '垂直方向 起点在上沿 column' },
|
|
88
|
+
{
|
|
89
|
+
value: 'column-reverse',
|
|
90
|
+
icon: markRaw(FlexDirectionColumnReverse),
|
|
91
|
+
tooltip: '垂直方向 起点在下沿 column-reverse',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'justifyContent',
|
|
98
|
+
text: '主轴对齐',
|
|
99
|
+
type: 'radioGroup',
|
|
100
|
+
childType: 'button',
|
|
101
|
+
labelWidth: '68px',
|
|
102
|
+
options: [
|
|
103
|
+
{ value: 'flex-start', icon: markRaw(JustifyContentFlexStart), tooltip: '左对齐 flex-start' },
|
|
104
|
+
{ value: 'flex-end', icon: markRaw(JustifyContentFlexEnd), tooltip: '右对齐 flex-end' },
|
|
105
|
+
{ value: 'center', icon: markRaw(JustifyContentCenter), tooltip: '居中 center' },
|
|
106
|
+
{ value: 'space-between', icon: markRaw(JustifyContentSpaceBetween), tooltip: '两端对齐 space-between' },
|
|
107
|
+
{ value: 'space-around', icon: markRaw(JustifyContentSpaceAround), tooltip: '横向平分 space-around' },
|
|
108
|
+
],
|
|
109
|
+
display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'alignItems',
|
|
113
|
+
text: '辅轴对齐',
|
|
114
|
+
type: 'radioGroup',
|
|
115
|
+
childType: 'button',
|
|
116
|
+
labelWidth: '68px',
|
|
117
|
+
options: [
|
|
118
|
+
{ value: 'flex-start', icon: markRaw(JustifyContentFlexStart), tooltip: '左对齐 flex-start' },
|
|
119
|
+
{ value: 'flex-end', icon: markRaw(JustifyContentFlexEnd), tooltip: '右对齐 flex-end' },
|
|
120
|
+
{ value: 'center', icon: markRaw(JustifyContentCenter), tooltip: '居中 center' },
|
|
121
|
+
{ value: 'space-between', icon: markRaw(JustifyContentSpaceBetween), tooltip: '两端对齐 space-between' },
|
|
122
|
+
{ value: 'space-around', icon: markRaw(JustifyContentSpaceAround), tooltip: '横向平分 space-around' },
|
|
123
|
+
],
|
|
124
|
+
display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'flexWrap',
|
|
128
|
+
text: '换行',
|
|
129
|
+
type: 'radioGroup',
|
|
130
|
+
childType: 'button',
|
|
131
|
+
labelWidth: '68px',
|
|
132
|
+
options: [
|
|
133
|
+
{ value: 'nowrap', text: '不换行', tooltip: '不换行 nowrap' },
|
|
134
|
+
{ value: 'wrap', text: '正换行', tooltip: '第一行在上方 wrap' },
|
|
135
|
+
{ value: 'wrap-reverse', text: '逆换行', tooltip: '第一行在下方 wrap-reverse' },
|
|
136
|
+
],
|
|
137
|
+
display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
type: 'row',
|
|
141
|
+
items: [
|
|
142
|
+
{
|
|
143
|
+
name: 'width',
|
|
144
|
+
text: '宽度',
|
|
145
|
+
labelWidth: '68px',
|
|
146
|
+
type: 'data-source-field-select',
|
|
147
|
+
fieldConfig: {
|
|
148
|
+
type: 'text',
|
|
89
149
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
labelWidth: '68px',
|
|
99
|
-
options: [
|
|
100
|
-
{ value: 'flex-start', icon: markRaw(JustifyContentFlexStart), tooltip: '左对齐 flex-start' },
|
|
101
|
-
{ value: 'flex-end', icon: markRaw(JustifyContentFlexEnd), tooltip: '右对齐 flex-end' },
|
|
102
|
-
{ value: 'center', icon: markRaw(JustifyContentCenter), tooltip: '居中 center' },
|
|
103
|
-
{ value: 'space-between', icon: markRaw(JustifyContentSpaceBetween), tooltip: '两端对齐 space-between' },
|
|
104
|
-
{ value: 'space-around', icon: markRaw(JustifyContentSpaceAround), tooltip: '横向平分 space-around' },
|
|
105
|
-
],
|
|
106
|
-
display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'alignItems',
|
|
110
|
-
text: '辅轴对齐',
|
|
111
|
-
type: 'radioGroup',
|
|
112
|
-
childType: 'button',
|
|
113
|
-
labelWidth: '68px',
|
|
114
|
-
options: [
|
|
115
|
-
{ value: 'flex-start', icon: markRaw(JustifyContentFlexStart), tooltip: '左对齐 flex-start' },
|
|
116
|
-
{ value: 'flex-end', icon: markRaw(JustifyContentFlexEnd), tooltip: '右对齐 flex-end' },
|
|
117
|
-
{ value: 'center', icon: markRaw(JustifyContentCenter), tooltip: '居中 center' },
|
|
118
|
-
{ value: 'space-between', icon: markRaw(JustifyContentSpaceBetween), tooltip: '两端对齐 space-between' },
|
|
119
|
-
{ value: 'space-around', icon: markRaw(JustifyContentSpaceAround), tooltip: '横向平分 space-around' },
|
|
120
|
-
],
|
|
121
|
-
display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: 'flexWrap',
|
|
125
|
-
text: '换行',
|
|
126
|
-
type: 'radioGroup',
|
|
127
|
-
childType: 'button',
|
|
128
|
-
labelWidth: '68px',
|
|
129
|
-
options: [
|
|
130
|
-
{ value: 'nowrap', text: '不换行', tooltip: '不换行 nowrap' },
|
|
131
|
-
{ value: 'wrap', text: '正换行', tooltip: '第一行在上方 wrap' },
|
|
132
|
-
{ value: 'wrap-reverse', text: '逆换行', tooltip: '第一行在下方 wrap-reverse' },
|
|
133
|
-
],
|
|
134
|
-
display: (_mForm, { model }: { model: Record<any, any> }) => model.display === 'flex',
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
type: 'row',
|
|
138
|
-
items: [
|
|
139
|
-
{
|
|
140
|
-
name: 'width',
|
|
141
|
-
text: '宽度',
|
|
142
|
-
labelWidth: '68px',
|
|
143
|
-
type: 'data-source-field-select',
|
|
144
|
-
fieldConfig: {
|
|
145
|
-
type: 'text',
|
|
146
|
-
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'height',
|
|
153
|
+
text: '高度',
|
|
154
|
+
labelWidth: '68px',
|
|
155
|
+
type: 'data-source-field-select',
|
|
156
|
+
fieldConfig: {
|
|
157
|
+
type: 'text',
|
|
147
158
|
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: 'row',
|
|
164
|
+
items: [
|
|
165
|
+
{
|
|
166
|
+
type: 'data-source-field-select',
|
|
167
|
+
text: 'overflow',
|
|
168
|
+
name: 'overflow',
|
|
169
|
+
labelWidth: '68px',
|
|
170
|
+
checkStrictly: false,
|
|
171
|
+
dataSourceFieldType: ['string'],
|
|
172
|
+
fieldConfig: {
|
|
173
|
+
type: 'select',
|
|
174
|
+
clearable: true,
|
|
175
|
+
allowCreate: true,
|
|
176
|
+
options: [
|
|
177
|
+
{ text: 'visible', value: 'visible' },
|
|
178
|
+
{ text: 'hidden', value: 'hidden' },
|
|
179
|
+
{ text: 'clip', value: 'clip' },
|
|
180
|
+
{ text: 'scroll', value: 'scroll' },
|
|
181
|
+
{ text: 'auto', value: 'auto' },
|
|
182
|
+
{ text: 'overlay', value: 'overlay' },
|
|
183
|
+
{ text: 'initial', value: 'initial' },
|
|
184
|
+
],
|
|
156
185
|
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
labelWidth: '68px',
|
|
167
|
-
checkStrictly: false,
|
|
168
|
-
dataSourceFieldType: ['string'],
|
|
169
|
-
fieldConfig: {
|
|
170
|
-
type: 'select',
|
|
171
|
-
clearable: true,
|
|
172
|
-
allowCreate: true,
|
|
173
|
-
options: [
|
|
174
|
-
{ text: 'visible', value: 'visible' },
|
|
175
|
-
{ text: 'hidden', value: 'hidden' },
|
|
176
|
-
{ text: 'clip', value: 'clip' },
|
|
177
|
-
{ text: 'scroll', value: 'scroll' },
|
|
178
|
-
{ text: 'auto', value: 'auto' },
|
|
179
|
-
{ text: 'overlay', value: 'overlay' },
|
|
180
|
-
{ text: 'initial', value: 'initial' },
|
|
181
|
-
],
|
|
182
|
-
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'data-source-field-select',
|
|
189
|
+
text: '透明度',
|
|
190
|
+
name: 'opacity',
|
|
191
|
+
labelWidth: '68px',
|
|
192
|
+
dataSourceFieldType: ['string', 'number'],
|
|
193
|
+
fieldConfig: {
|
|
194
|
+
type: 'text',
|
|
183
195
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
labelWidth: '68px',
|
|
189
|
-
dataSourceFieldType: ['string', 'number'],
|
|
190
|
-
fieldConfig: {
|
|
191
|
-
type: 'text',
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
}) as ChildConfig;
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
]);
|
|
198
200
|
|
|
199
201
|
const change = (value: string | StyleSchema, eventData: ContainerChangeEventData) => {
|
|
200
202
|
emit('change', value, eventData);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<MContainer
|
|
3
|
-
|
|
3
|
+
v-for="(item, index) in formConfig"
|
|
4
|
+
:prop="prop"
|
|
5
|
+
:key="index"
|
|
6
|
+
:config="item"
|
|
4
7
|
:model="values"
|
|
5
8
|
:last-values="lastValues"
|
|
6
9
|
:is-compare="isCompare"
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
</template>
|
|
13
16
|
|
|
14
17
|
<script lang="ts" setup>
|
|
15
|
-
import { type ContainerChangeEventData,
|
|
18
|
+
import { type ContainerChangeEventData, defineFormConfig, MContainer } from '@tmagic/form';
|
|
16
19
|
import type { StyleSchema } from '@tmagic/schema';
|
|
17
20
|
|
|
18
21
|
const props = defineProps<{
|
|
@@ -21,6 +24,7 @@ const props = defineProps<{
|
|
|
21
24
|
isCompare?: boolean;
|
|
22
25
|
disabled?: boolean;
|
|
23
26
|
size?: 'large' | 'default' | 'small';
|
|
27
|
+
prop?: string;
|
|
24
28
|
}>();
|
|
25
29
|
|
|
26
30
|
const emit = defineEmits<{
|
|
@@ -36,78 +40,76 @@ const positionText: Record<string, string> = {
|
|
|
36
40
|
sticky: '粘性定位',
|
|
37
41
|
};
|
|
38
42
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})),
|
|
52
|
-
},
|
|
43
|
+
const formConfig = defineFormConfig([
|
|
44
|
+
{
|
|
45
|
+
name: 'position',
|
|
46
|
+
text: '定位',
|
|
47
|
+
labelWidth: '68px',
|
|
48
|
+
type: 'data-source-field-select',
|
|
49
|
+
fieldConfig: {
|
|
50
|
+
type: 'select',
|
|
51
|
+
options: Object.keys(positionText).map((item) => ({
|
|
52
|
+
value: item,
|
|
53
|
+
text: `${item}(${positionText[item]})`,
|
|
54
|
+
})),
|
|
53
55
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'row',
|
|
59
|
+
labelWidth: '68px',
|
|
60
|
+
display: () => props.values.position !== 'static',
|
|
61
|
+
items: [
|
|
62
|
+
{
|
|
63
|
+
name: 'left',
|
|
64
|
+
type: 'data-source-field-select',
|
|
65
|
+
text: 'left',
|
|
66
|
+
fieldConfig: {
|
|
67
|
+
type: 'text',
|
|
66
68
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'top',
|
|
72
|
+
type: 'data-source-field-select',
|
|
73
|
+
text: 'top',
|
|
74
|
+
fieldConfig: {
|
|
75
|
+
type: 'text',
|
|
74
76
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'row',
|
|
82
|
+
labelWidth: '68px',
|
|
83
|
+
display: () => props.values.position !== 'static',
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
name: 'right',
|
|
87
|
+
type: 'data-source-field-select',
|
|
88
|
+
text: 'right',
|
|
89
|
+
fieldConfig: {
|
|
90
|
+
type: 'text',
|
|
89
91
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'bottom',
|
|
95
|
+
type: 'data-source-field-select',
|
|
96
|
+
text: 'bottom',
|
|
97
|
+
fieldConfig: {
|
|
98
|
+
type: 'text',
|
|
97
99
|
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
labelWidth: '68px',
|
|
102
|
-
name: 'zIndex',
|
|
103
|
-
text: 'zIndex',
|
|
104
|
-
type: 'data-source-field-select',
|
|
105
|
-
fieldConfig: {
|
|
106
|
-
type: 'text',
|
|
107
100
|
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
labelWidth: '68px',
|
|
105
|
+
name: 'zIndex',
|
|
106
|
+
text: 'zIndex',
|
|
107
|
+
type: 'data-source-field-select',
|
|
108
|
+
fieldConfig: {
|
|
109
|
+
type: 'text',
|
|
108
110
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
},
|
|
112
|
+
]);
|
|
111
113
|
|
|
112
114
|
const change = (value: string | StyleSchema, eventData: ContainerChangeEventData) => {
|
|
113
115
|
emit('change', value, eventData);
|