@tmagic/editor 1.3.16 → 1.4.0-beta.2
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 +25 -9
- package/dist/tmagic-editor.js +1048 -632
- package/dist/tmagic-editor.umd.cjs +1065 -647
- package/package.json +23 -21
- package/src/components/CodeBlockEditor.vue +82 -59
- package/src/components/FloatingBox.vue +71 -25
- package/src/components/SplitView.vue +46 -35
- package/src/fields/Code.vue +12 -10
- package/src/fields/CodeLink.vue +9 -9
- package/src/fields/CodeSelect.vue +7 -5
- package/src/fields/CodeSelectCol.vue +1 -1
- package/src/fields/DataSourceFieldSelect.vue +118 -27
- package/src/fields/DataSourceFields.vue +10 -3
- package/src/fields/DataSourceInput.vue +7 -7
- package/src/fields/DataSourceMethodSelect.vue +1 -1
- package/src/fields/DataSourceMethods.vue +3 -3
- package/src/fields/DataSourceMocks.vue +3 -3
- package/src/fields/DataSourceSelect.vue +6 -18
- package/src/fields/EventSelect.vue +1 -1
- package/src/fields/KeyValue.vue +8 -8
- package/src/fields/PageFragmentSelect.vue +1 -1
- package/src/fields/UISelect.vue +5 -5
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-code-block-edit.ts +1 -2
- package/src/hooks/use-editor-content-height.ts +20 -0
- package/src/hooks/use-float-box.ts +8 -8
- package/src/hooks/use-window-rect.ts +20 -0
- package/src/index.ts +2 -2
- package/src/layouts/Framework.vue +33 -34
- package/src/layouts/NavMenu.vue +21 -2
- package/src/layouts/PropsPanel.vue +35 -0
- package/src/layouts/sidebar/Sidebar.vue +18 -8
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +0 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -0
- package/src/services/BaseService.ts +5 -2
- package/src/services/codeBlock.ts +14 -8
- package/src/services/dataSource.ts +39 -26
- package/src/services/editor.ts +46 -25
- package/src/services/events.ts +4 -4
- package/src/services/props.ts +44 -35
- package/src/services/stageOverlay.ts +16 -9
- package/src/services/storage.ts +14 -8
- package/src/services/ui.ts +26 -19
- package/src/theme/code-block.scss +0 -5
- package/src/theme/code-editor.scss +6 -0
- package/src/theme/floating-box.scss +4 -2
- package/src/theme/props-panel.scss +14 -0
- package/src/theme/sidebar.scss +6 -3
- package/src/type.ts +87 -37
- package/src/utils/operator.ts +37 -39
- package/src/utils/props.ts +174 -37
- package/types/components/CodeBlockEditor.vue.d.ts +46 -25
- package/types/components/CodeParams.vue.d.ts +5 -5
- package/types/components/ContentMenu.vue.d.ts +12 -12
- package/types/components/FloatingBox.vue.d.ts +42 -55
- package/types/components/Icon.vue.d.ts +3 -3
- package/types/components/Resizer.vue.d.ts +3 -3
- package/types/components/ScrollBar.vue.d.ts +3 -3
- package/types/components/ScrollViewer.vue.d.ts +12 -12
- package/types/components/SearchInput.vue.d.ts +1 -1
- package/types/components/SplitView.vue.d.ts +13 -11
- package/types/components/ToolButton.vue.d.ts +13 -13
- package/types/components/Tree.vue.d.ts +24 -14
- package/types/components/TreeNode.vue.d.ts +22 -12
- package/types/fields/Code.vue.d.ts +14 -14
- package/types/fields/CodeLink.vue.d.ts +6 -10
- package/types/fields/CodeSelect.vue.d.ts +14 -14
- package/types/fields/CodeSelectCol.vue.d.ts +11 -11
- package/types/fields/DataSourceFieldSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceFields.vue.d.ts +11 -11
- package/types/fields/DataSourceInput.vue.d.ts +14 -18
- package/types/fields/DataSourceMethodSelect.vue.d.ts +11 -11
- package/types/fields/DataSourceMethods.vue.d.ts +11 -11
- package/types/fields/DataSourceMocks.vue.d.ts +11 -11
- package/types/fields/DataSourceSelect.vue.d.ts +13 -26
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/KeyValue.vue.d.ts +14 -18
- package/types/fields/PageFragmentSelect.vue.d.ts +11 -11
- package/types/fields/UISelect.vue.d.ts +8 -4
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/use-code-block-edit.d.ts +66 -90
- package/types/hooks/use-data-source-method.d.ts +66 -90
- package/types/hooks/use-editor-content-height.d.ts +3 -0
- package/types/hooks/use-node-status.d.ts +6 -1
- package/types/hooks/use-window-rect.d.ts +6 -0
- package/types/icons/AppManageIcon.vue.d.ts +1 -1
- package/types/icons/CenterIcon.vue.d.ts +1 -1
- package/types/icons/CodeIcon.vue.d.ts +1 -1
- package/types/icons/FolderMinusIcon.vue.d.ts +1 -1
- package/types/icons/PinIcon.vue.d.ts +1 -1
- package/types/icons/PinnedIcon.vue.d.ts +1 -1
- package/types/layouts/AddPageBox.vue.d.ts +3 -3
- package/types/layouts/CodeEditor.vue.d.ts +12 -12
- package/types/layouts/Framework.vue.d.ts +9 -9
- package/types/layouts/NavMenu.vue.d.ts +11 -11
- package/types/layouts/PropsPanel.vue.d.ts +193 -243
- package/types/layouts/page-bar/AddButton.vue.d.ts +3 -3
- package/types/layouts/page-bar/PageBar.vue.d.ts +8 -8
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +8 -8
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +3 -3
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +13 -13
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +10 -10
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +3 -3
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +11 -11
- package/types/layouts/sidebar/layer/LayerNodeTool.vue.d.ts +3 -3
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +9 -9
- package/types/layouts/sidebar/layer/use-click.d.ts +42 -76
- package/types/layouts/sidebar/layer/use-node-status.d.ts +6 -1
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
- package/types/layouts/workspace/Workspace.vue.d.ts +12 -12
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +11 -11
- package/types/layouts/workspace/viewer/StageOverlay.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +12 -12
- package/types/services/BaseService.d.ts +5 -2
- package/types/services/codeBlock.d.ts +8 -0
- package/types/services/dataSource.d.ts +9 -2
- package/types/services/editor.d.ts +8 -1
- package/types/services/props.d.ts +15 -22
- package/types/services/stageOverlay.d.ts +9 -2
- package/types/services/storage.d.ts +8 -0
- package/types/services/ui.d.ts +20 -8
- package/types/type.d.ts +56 -32
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +2 -13
package/src/utils/operator.ts
CHANGED
|
@@ -15,55 +15,53 @@ import { generatePageNameByApp, getInitPositionStyle } from '@editor/utils/edito
|
|
|
15
15
|
* @param config 待粘贴的元素配置(复制时保存的那份配置)
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
|
-
export const beforePaste =
|
|
18
|
+
export const beforePaste = (position: PastePosition, config: MNode[]): MNode[] => {
|
|
19
19
|
if (!config[0]?.style) return config;
|
|
20
20
|
const curNode = editorService.get('node');
|
|
21
21
|
// 将数组中第一个元素的坐标作为参照点
|
|
22
22
|
const { left: referenceLeft, top: referenceTop } = config[0].style;
|
|
23
23
|
// 坐标校准后的粘贴数据
|
|
24
|
-
const pasteConfigs: MNode[] =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let pastePosition = positionClone;
|
|
24
|
+
const pasteConfigs: MNode[] = config.map((configItem: MNode): MNode => {
|
|
25
|
+
// 解构 position 对象,从 position 删除 offsetX、offsetY字段
|
|
26
|
+
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
27
|
+
let pastePosition = positionClone;
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
if (!isEmpty(pastePosition) && curNode?.items) {
|
|
30
|
+
// 如果没有传入粘贴坐标则可能为键盘操作,不再转换
|
|
31
|
+
// 如果粘贴时选中了容器,则将元素粘贴到容器内,坐标需要转换为相对于容器的坐标
|
|
32
|
+
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
33
|
+
}
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
// 将所有待粘贴元素坐标相对于多选第一个元素坐标重新计算,以保证多选粘贴后元素间距不变
|
|
36
|
+
if (pastePosition.left && configItem.style?.left) {
|
|
37
|
+
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
38
|
+
}
|
|
39
|
+
if (pastePosition.top && configItem.style?.top) {
|
|
40
|
+
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
41
|
+
}
|
|
42
|
+
const pasteConfig = propsService.setNewItemId(configItem, false);
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (typeof top === 'number' || (!!top && !isNaN(Number(top)))) {
|
|
52
|
-
pasteConfig.style.top = Number(top) + offsetY;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
pasteConfig.style = {
|
|
56
|
-
...pasteConfig.style,
|
|
57
|
-
...pastePosition,
|
|
58
|
-
};
|
|
44
|
+
if (pasteConfig.style) {
|
|
45
|
+
const { left, top } = pasteConfig.style;
|
|
46
|
+
// 判断能转换为数字时,做粘贴偏移量计算
|
|
47
|
+
if (typeof left === 'number' || (!!left && !isNaN(Number(left)))) {
|
|
48
|
+
pasteConfig.style.left = Number(left) + offsetX;
|
|
59
49
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
pasteConfig.name = generatePageNameByApp(root, isPage(pasteConfig) ? NodeType.PAGE : NodeType.PAGE_FRAGMENT);
|
|
50
|
+
if (typeof top === 'number' || (!!top && !isNaN(Number(top)))) {
|
|
51
|
+
pasteConfig.style.top = Number(top) + offsetY;
|
|
63
52
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
|
|
54
|
+
pasteConfig.style = {
|
|
55
|
+
...pasteConfig.style,
|
|
56
|
+
...pastePosition,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const root = editorService.get('root');
|
|
60
|
+
if ((isPage(pasteConfig) || isPageFragment(pasteConfig)) && root) {
|
|
61
|
+
pasteConfig.name = generatePageNameByApp(root, isPage(pasteConfig) ? NodeType.PAGE : NodeType.PAGE_FRAGMENT);
|
|
62
|
+
}
|
|
63
|
+
return pasteConfig as MNode;
|
|
64
|
+
});
|
|
67
65
|
return pasteConfigs;
|
|
68
66
|
};
|
|
69
67
|
|
package/src/utils/props.ts
CHANGED
|
@@ -41,7 +41,6 @@ const numberOptions = [
|
|
|
41
41
|
|
|
42
42
|
export const styleTabConfig: TabPaneConfig = {
|
|
43
43
|
title: '样式',
|
|
44
|
-
labelWidth: '80px',
|
|
45
44
|
items: [
|
|
46
45
|
{
|
|
47
46
|
name: 'style',
|
|
@@ -51,30 +50,59 @@ export const styleTabConfig: TabPaneConfig = {
|
|
|
51
50
|
legend: '位置',
|
|
52
51
|
items: [
|
|
53
52
|
{
|
|
53
|
+
type: 'data-source-field-select',
|
|
54
54
|
name: 'position',
|
|
55
|
-
type: 'checkbox',
|
|
56
|
-
activeValue: 'fixed',
|
|
57
|
-
inactiveValue: 'absolute',
|
|
58
|
-
defaultValue: 'absolute',
|
|
59
55
|
text: '固定定位',
|
|
56
|
+
checkStrictly: false,
|
|
57
|
+
dataSourceFieldType: ['string'],
|
|
58
|
+
fieldConfig: {
|
|
59
|
+
type: 'checkbox',
|
|
60
|
+
activeValue: 'fixed',
|
|
61
|
+
inactiveValue: 'absolute',
|
|
62
|
+
defaultValue: 'absolute',
|
|
63
|
+
},
|
|
60
64
|
},
|
|
61
65
|
{
|
|
66
|
+
type: 'data-source-field-select',
|
|
62
67
|
name: 'left',
|
|
63
68
|
text: 'left',
|
|
69
|
+
checkStrictly: false,
|
|
70
|
+
dataSourceFieldType: ['string', 'number'],
|
|
71
|
+
fieldConfig: {
|
|
72
|
+
type: 'text',
|
|
73
|
+
},
|
|
64
74
|
},
|
|
65
75
|
{
|
|
76
|
+
type: 'data-source-field-select',
|
|
66
77
|
name: 'top',
|
|
67
78
|
text: 'top',
|
|
79
|
+
checkStrictly: false,
|
|
80
|
+
dataSourceFieldType: ['string', 'number'],
|
|
81
|
+
fieldConfig: {
|
|
82
|
+
type: 'text',
|
|
83
|
+
},
|
|
68
84
|
disabled: (vm: FormState, { model }: any) =>
|
|
69
85
|
model.position === 'fixed' && model._magic_position === 'fixedBottom',
|
|
70
86
|
},
|
|
71
87
|
{
|
|
88
|
+
type: 'data-source-field-select',
|
|
72
89
|
name: 'right',
|
|
73
90
|
text: 'right',
|
|
91
|
+
checkStrictly: false,
|
|
92
|
+
dataSourceFieldType: ['string', 'number'],
|
|
93
|
+
fieldConfig: {
|
|
94
|
+
type: 'text',
|
|
95
|
+
},
|
|
74
96
|
},
|
|
75
97
|
{
|
|
98
|
+
type: 'data-source-field-select',
|
|
76
99
|
name: 'bottom',
|
|
77
100
|
text: 'bottom',
|
|
101
|
+
checkStrictly: false,
|
|
102
|
+
dataSourceFieldType: ['string', 'number'],
|
|
103
|
+
fieldConfig: {
|
|
104
|
+
type: 'text',
|
|
105
|
+
},
|
|
78
106
|
disabled: (vm: FormState, { model }: any) =>
|
|
79
107
|
model.position === 'fixed' && model._magic_position === 'fixedTop',
|
|
80
108
|
},
|
|
@@ -85,12 +113,42 @@ export const styleTabConfig: TabPaneConfig = {
|
|
|
85
113
|
legend: '盒子',
|
|
86
114
|
items: [
|
|
87
115
|
{
|
|
116
|
+
type: 'data-source-field-select',
|
|
88
117
|
name: 'width',
|
|
89
118
|
text: '宽度',
|
|
119
|
+
checkStrictly: false,
|
|
120
|
+
dataSourceFieldType: ['string', 'number'],
|
|
121
|
+
fieldConfig: {
|
|
122
|
+
type: 'text',
|
|
123
|
+
},
|
|
90
124
|
},
|
|
91
125
|
{
|
|
126
|
+
type: 'data-source-field-select',
|
|
92
127
|
name: 'height',
|
|
93
128
|
text: '高度',
|
|
129
|
+
checkStrictly: false,
|
|
130
|
+
dataSourceFieldType: ['string', 'number'],
|
|
131
|
+
fieldConfig: {
|
|
132
|
+
type: 'text',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'data-source-field-select',
|
|
137
|
+
text: 'overflow',
|
|
138
|
+
name: 'overflow',
|
|
139
|
+
checkStrictly: false,
|
|
140
|
+
dataSourceFieldType: ['string'],
|
|
141
|
+
fieldConfig: {
|
|
142
|
+
type: 'select',
|
|
143
|
+
options: [
|
|
144
|
+
{ text: 'visible', value: 'visible' },
|
|
145
|
+
{ text: 'hidden', value: 'hidden' },
|
|
146
|
+
{ text: 'clip', value: 'clip' },
|
|
147
|
+
{ text: 'scroll', value: 'scroll' },
|
|
148
|
+
{ text: 'auto', value: 'auto' },
|
|
149
|
+
{ text: 'overlay', value: 'overlay' },
|
|
150
|
+
],
|
|
151
|
+
},
|
|
94
152
|
},
|
|
95
153
|
],
|
|
96
154
|
},
|
|
@@ -99,32 +157,48 @@ export const styleTabConfig: TabPaneConfig = {
|
|
|
99
157
|
legend: '边框',
|
|
100
158
|
items: [
|
|
101
159
|
{
|
|
160
|
+
type: 'data-source-field-select',
|
|
102
161
|
name: 'borderWidth',
|
|
103
162
|
text: '宽度',
|
|
104
163
|
defaultValue: '0',
|
|
164
|
+
checkStrictly: false,
|
|
165
|
+
dataSourceFieldType: ['string', 'number'],
|
|
166
|
+
fieldConfig: {
|
|
167
|
+
type: 'text',
|
|
168
|
+
},
|
|
105
169
|
},
|
|
106
170
|
{
|
|
171
|
+
type: 'data-source-field-select',
|
|
107
172
|
name: 'borderColor',
|
|
108
173
|
text: '颜色',
|
|
109
|
-
|
|
174
|
+
checkStrictly: false,
|
|
175
|
+
dataSourceFieldType: ['string'],
|
|
176
|
+
fieldConfig: {
|
|
177
|
+
type: 'text',
|
|
178
|
+
},
|
|
110
179
|
},
|
|
111
180
|
{
|
|
181
|
+
type: 'data-source-field-select',
|
|
112
182
|
name: 'borderStyle',
|
|
113
183
|
text: '样式',
|
|
114
|
-
type: 'select',
|
|
115
184
|
defaultValue: 'none',
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
185
|
+
checkStrictly: false,
|
|
186
|
+
dataSourceFieldType: ['string'],
|
|
187
|
+
fieldConfig: {
|
|
188
|
+
type: 'select',
|
|
189
|
+
options: [
|
|
190
|
+
{ text: 'none', value: 'none' },
|
|
191
|
+
{ text: 'hidden', value: 'hidden' },
|
|
192
|
+
{ text: 'dotted', value: 'dotted' },
|
|
193
|
+
{ text: 'dashed', value: 'dashed' },
|
|
194
|
+
{ text: 'solid', value: 'solid' },
|
|
195
|
+
{ text: 'double', value: 'double' },
|
|
196
|
+
{ text: 'groove', value: 'groove' },
|
|
197
|
+
{ text: 'ridge', value: 'ridge' },
|
|
198
|
+
{ text: 'inset', value: 'inset' },
|
|
199
|
+
{ text: 'outset', value: 'outset' },
|
|
200
|
+
],
|
|
201
|
+
},
|
|
128
202
|
},
|
|
129
203
|
],
|
|
130
204
|
},
|
|
@@ -133,31 +207,53 @@ export const styleTabConfig: TabPaneConfig = {
|
|
|
133
207
|
legend: '背景',
|
|
134
208
|
items: [
|
|
135
209
|
{
|
|
210
|
+
type: 'data-source-field-select',
|
|
136
211
|
name: 'backgroundImage',
|
|
137
212
|
text: '背景图',
|
|
213
|
+
checkStrictly: false,
|
|
214
|
+
dataSourceFieldType: ['string'],
|
|
215
|
+
fieldConfig: {
|
|
216
|
+
type: 'text',
|
|
217
|
+
},
|
|
138
218
|
},
|
|
139
219
|
{
|
|
220
|
+
type: 'data-source-field-select',
|
|
140
221
|
name: 'backgroundColor',
|
|
141
222
|
text: '背景颜色',
|
|
142
|
-
|
|
223
|
+
checkStrictly: false,
|
|
224
|
+
dataSourceFieldType: ['string'],
|
|
225
|
+
fieldConfig: {
|
|
226
|
+
type: 'colorPicker',
|
|
227
|
+
},
|
|
143
228
|
},
|
|
144
229
|
{
|
|
230
|
+
type: 'data-source-field-select',
|
|
145
231
|
name: 'backgroundRepeat',
|
|
146
232
|
text: '背景图重复',
|
|
147
|
-
type: 'select',
|
|
148
233
|
defaultValue: 'no-repeat',
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
234
|
+
checkStrictly: false,
|
|
235
|
+
dataSourceFieldType: ['string'],
|
|
236
|
+
fieldConfig: {
|
|
237
|
+
type: 'select',
|
|
238
|
+
options: [
|
|
239
|
+
{ text: 'repeat', value: 'repeat' },
|
|
240
|
+
{ text: 'repeat-x', value: 'repeat-x' },
|
|
241
|
+
{ text: 'repeat-y', value: 'repeat-y' },
|
|
242
|
+
{ text: 'no-repeat', value: 'no-repeat' },
|
|
243
|
+
{ text: 'inherit', value: 'inherit' },
|
|
244
|
+
],
|
|
245
|
+
},
|
|
156
246
|
},
|
|
157
247
|
{
|
|
248
|
+
type: 'data-source-field-select',
|
|
158
249
|
name: 'backgroundSize',
|
|
159
250
|
text: '背景图大小',
|
|
160
251
|
defaultValue: '100% 100%',
|
|
252
|
+
checkStrictly: false,
|
|
253
|
+
dataSourceFieldType: ['string'],
|
|
254
|
+
fieldConfig: {
|
|
255
|
+
type: 'text',
|
|
256
|
+
},
|
|
161
257
|
},
|
|
162
258
|
],
|
|
163
259
|
},
|
|
@@ -166,17 +262,34 @@ export const styleTabConfig: TabPaneConfig = {
|
|
|
166
262
|
legend: '字体',
|
|
167
263
|
items: [
|
|
168
264
|
{
|
|
265
|
+
type: 'data-source-field-select',
|
|
169
266
|
name: 'color',
|
|
170
267
|
text: '颜色',
|
|
171
|
-
|
|
268
|
+
checkStrictly: false,
|
|
269
|
+
dataSourceFieldType: ['string'],
|
|
270
|
+
fieldConfig: {
|
|
271
|
+
type: 'colorPicker',
|
|
272
|
+
},
|
|
172
273
|
},
|
|
173
274
|
{
|
|
275
|
+
type: 'data-source-field-select',
|
|
174
276
|
name: 'fontSize',
|
|
175
277
|
text: '大小',
|
|
278
|
+
checkStrictly: false,
|
|
279
|
+
dataSourceFieldType: ['string', 'number'],
|
|
280
|
+
fieldConfig: {
|
|
281
|
+
type: 'text',
|
|
282
|
+
},
|
|
176
283
|
},
|
|
177
284
|
{
|
|
285
|
+
type: 'data-source-field-select',
|
|
178
286
|
name: 'fontWeight',
|
|
179
287
|
text: '粗细',
|
|
288
|
+
checkStrictly: false,
|
|
289
|
+
dataSourceFieldType: ['string', 'number'],
|
|
290
|
+
fieldConfig: {
|
|
291
|
+
type: 'text',
|
|
292
|
+
},
|
|
180
293
|
},
|
|
181
294
|
],
|
|
182
295
|
},
|
|
@@ -186,12 +299,24 @@ export const styleTabConfig: TabPaneConfig = {
|
|
|
186
299
|
name: 'transform',
|
|
187
300
|
items: [
|
|
188
301
|
{
|
|
302
|
+
type: 'data-source-field-select',
|
|
189
303
|
name: 'rotate',
|
|
190
304
|
text: '旋转角度',
|
|
305
|
+
checkStrictly: false,
|
|
306
|
+
dataSourceFieldType: ['string'],
|
|
307
|
+
fieldConfig: {
|
|
308
|
+
type: 'text',
|
|
309
|
+
},
|
|
191
310
|
},
|
|
192
311
|
{
|
|
312
|
+
type: 'data-source-field-select',
|
|
193
313
|
name: 'scale',
|
|
194
314
|
text: '缩放',
|
|
315
|
+
checkStrictly: false,
|
|
316
|
+
dataSourceFieldType: ['number', 'string'],
|
|
317
|
+
fieldConfig: {
|
|
318
|
+
type: 'text',
|
|
319
|
+
},
|
|
195
320
|
},
|
|
196
321
|
],
|
|
197
322
|
},
|
|
@@ -219,13 +344,11 @@ export const advancedTabConfig: TabPaneConfig = {
|
|
|
219
344
|
{
|
|
220
345
|
name: 'created',
|
|
221
346
|
text: 'created',
|
|
222
|
-
labelWidth: '100px',
|
|
223
347
|
type: 'code-select',
|
|
224
348
|
},
|
|
225
349
|
{
|
|
226
350
|
name: 'mounted',
|
|
227
351
|
text: 'mounted',
|
|
228
|
-
labelWidth: '100px',
|
|
229
352
|
type: 'code-select',
|
|
230
353
|
},
|
|
231
354
|
],
|
|
@@ -250,15 +373,23 @@ export const displayTabConfig: TabPaneConfig = {
|
|
|
250
373
|
name: 'field',
|
|
251
374
|
value: 'key',
|
|
252
375
|
label: '字段',
|
|
376
|
+
checkStrictly: false,
|
|
377
|
+
dataSourceFieldType: ['string', 'number', 'boolean', 'any'],
|
|
253
378
|
},
|
|
254
379
|
{
|
|
255
380
|
type: 'select',
|
|
256
381
|
options: (mForm, { model }) => {
|
|
257
|
-
const [id,
|
|
382
|
+
const [id, ...fieldNames] = model.field;
|
|
258
383
|
|
|
259
384
|
const ds = dataSourceService.getDataSourceById(id);
|
|
260
385
|
|
|
261
|
-
|
|
386
|
+
let fields = ds?.fields || [];
|
|
387
|
+
let type = '';
|
|
388
|
+
(fieldNames || []).forEach((fieldName: string) => {
|
|
389
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
390
|
+
fields = field?.fields || [];
|
|
391
|
+
type = field?.type || '';
|
|
392
|
+
});
|
|
262
393
|
|
|
263
394
|
if (type === 'array') {
|
|
264
395
|
return arrayOptions;
|
|
@@ -290,11 +421,17 @@ export const displayTabConfig: TabPaneConfig = {
|
|
|
290
421
|
{
|
|
291
422
|
name: 'value',
|
|
292
423
|
type: (mForm, { model }) => {
|
|
293
|
-
const [id,
|
|
424
|
+
const [id, ...fieldNames] = model.field;
|
|
294
425
|
|
|
295
426
|
const ds = dataSourceService.getDataSourceById(id);
|
|
296
427
|
|
|
297
|
-
|
|
428
|
+
let fields = ds?.fields || [];
|
|
429
|
+
let type = '';
|
|
430
|
+
(fieldNames || []).forEach((fieldName: string) => {
|
|
431
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
432
|
+
fields = field?.fields || [];
|
|
433
|
+
type = field?.type || '';
|
|
434
|
+
});
|
|
298
435
|
|
|
299
436
|
if (type === 'number') {
|
|
300
437
|
return 'number';
|
|
@@ -331,13 +468,13 @@ export const displayTabConfig: TabPaneConfig = {
|
|
|
331
468
|
* @param config 组件属性配置
|
|
332
469
|
* @returns Object
|
|
333
470
|
*/
|
|
334
|
-
export const fillConfig = (config: FormConfig = []) => [
|
|
471
|
+
export const fillConfig = (config: FormConfig = [], labelWidth = '80px'): FormConfig => [
|
|
335
472
|
{
|
|
336
473
|
type: 'tab',
|
|
474
|
+
labelWidth,
|
|
337
475
|
items: [
|
|
338
476
|
{
|
|
339
477
|
title: '属性',
|
|
340
|
-
labelWidth: '80px',
|
|
341
478
|
items: [
|
|
342
479
|
// 组件类型,必须要有
|
|
343
480
|
{
|
|
@@ -1,32 +1,53 @@
|
|
|
1
1
|
import type { CodeBlockContent } from '@tmagic/schema';
|
|
2
2
|
import type { SlideType } from '../type';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
width: import("vue").PropType<number>;
|
|
5
|
+
visible: import("vue").PropType<boolean>;
|
|
6
|
+
content: {
|
|
7
|
+
type: import("vue").PropType<CodeBlockContent>;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
disabled: {
|
|
11
|
+
type: import("vue").PropType<boolean>;
|
|
12
|
+
};
|
|
13
|
+
isDataSource: {
|
|
14
|
+
type: import("vue").PropType<boolean>;
|
|
15
|
+
};
|
|
16
|
+
dataSourceType: {
|
|
17
|
+
type: import("vue").PropType<string>;
|
|
18
|
+
};
|
|
19
|
+
slideType: {
|
|
20
|
+
type: import("vue").PropType<SlideType>;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
show(): Promise<void>;
|
|
24
|
+
hide(): Promise<void>;
|
|
12
25
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
"update:width": (width: number) => void;
|
|
27
|
+
"update:visible": (visible: boolean) => void;
|
|
13
28
|
submit: (values: CodeBlockContent) => void;
|
|
14
|
-
}, string, import("vue").
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
29
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
|
+
width: import("vue").PropType<number>;
|
|
31
|
+
visible: import("vue").PropType<boolean>;
|
|
32
|
+
content: {
|
|
33
|
+
type: import("vue").PropType<CodeBlockContent>;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
disabled: {
|
|
37
|
+
type: import("vue").PropType<boolean>;
|
|
38
|
+
};
|
|
39
|
+
isDataSource: {
|
|
40
|
+
type: import("vue").PropType<boolean>;
|
|
41
|
+
};
|
|
42
|
+
dataSourceType: {
|
|
43
|
+
type: import("vue").PropType<string>;
|
|
44
|
+
};
|
|
45
|
+
slideType: {
|
|
46
|
+
type: import("vue").PropType<SlideType>;
|
|
47
|
+
};
|
|
48
|
+
}>> & {
|
|
21
49
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
50
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
51
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
22
52
|
}, {}, {}>;
|
|
23
53
|
export default _default;
|
|
24
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
25
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
26
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
27
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
28
|
-
} : {
|
|
29
|
-
type: import('vue').PropType<T[K]>;
|
|
30
|
-
required: true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { CodeParamStatement } from '../type';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
3
3
|
model: any;
|
|
4
|
-
size?: "
|
|
4
|
+
size?: "small" | "large" | "default" | undefined;
|
|
5
5
|
disabled?: boolean | undefined;
|
|
6
6
|
name: string;
|
|
7
7
|
paramsConfig: CodeParamStatement[];
|
|
8
8
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
9
|
change: (...args: any[]) => void;
|
|
10
|
-
}, string, import("vue").
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
11
11
|
model: any;
|
|
12
|
-
size?: "
|
|
12
|
+
size?: "small" | "large" | "default" | undefined;
|
|
13
13
|
disabled?: boolean | undefined;
|
|
14
14
|
name: string;
|
|
15
15
|
paramsConfig: CodeParamStatement[];
|
|
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimePr
|
|
|
18
18
|
}, {}, {}>;
|
|
19
19
|
export default _default;
|
|
20
20
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
-
type
|
|
21
|
+
type __VLS_TypePropsToOption<T> = {
|
|
22
22
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
23
|
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
24
|
} : {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MenuButton, MenuComponent } from '../type';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
3
3
|
menuData?: (MenuButton | MenuComponent)[] | undefined;
|
|
4
4
|
isSubMenu?: boolean | undefined;
|
|
5
5
|
active?: string | number | undefined;
|
|
@@ -25,10 +25,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
25
25
|
clientX: number;
|
|
26
26
|
}) => void;
|
|
27
27
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
-
mouseenter: () => void;
|
|
29
28
|
show: () => void;
|
|
30
29
|
hide: () => void;
|
|
31
|
-
|
|
30
|
+
mouseenter: () => void;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
32
32
|
menuData?: (MenuButton | MenuComponent)[] | undefined;
|
|
33
33
|
isSubMenu?: boolean | undefined;
|
|
34
34
|
active?: string | number | undefined;
|
|
@@ -49,15 +49,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
49
49
|
title?(_: {}): any;
|
|
50
50
|
}>;
|
|
51
51
|
export default _default;
|
|
52
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
53
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
54
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
55
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
56
|
-
} : {
|
|
57
|
-
type: import('vue').PropType<T[K]>;
|
|
58
|
-
required: true;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
52
|
type __VLS_WithDefaults<P, D> = {
|
|
62
53
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
63
54
|
default: D[K];
|
|
@@ -71,3 +62,12 @@ type __VLS_WithTemplateSlots<T, S> = T & {
|
|
|
71
62
|
$slots: S;
|
|
72
63
|
};
|
|
73
64
|
};
|
|
65
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
66
|
+
type __VLS_TypePropsToOption<T> = {
|
|
67
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
68
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
69
|
+
} : {
|
|
70
|
+
type: import('vue').PropType<T[K]>;
|
|
71
|
+
required: true;
|
|
72
|
+
};
|
|
73
|
+
};
|