xkit-editor 2.0.0-alpha.0 → 2.0.0-alpha.1
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/README.md +26 -0
- package/lib/packages/editor/src/components/json-code-editor.vue.d.ts +2 -0
- package/lib/packages/editor/src/components/json-code-editor.vue.d.ts.map +1 -1
- package/lib/packages/editor/src/x-editor.vue.d.ts +8 -0
- package/lib/packages/editor/src/x-editor.vue.d.ts.map +1 -1
- package/lib/packages/ui/src/components/radios/type.d.ts +2 -2
- package/lib/xkit-editor.css +1 -1
- package/lib/xkit-editor.js +64 -52
- package/lib/xkit-editor.umd.cjs +2 -2
- package/package.json +3 -4
- package/src/component-configs/__tests__/config.test.ts +0 -288
- package/src/component-configs/__tests__/group.test.ts +0 -104
- package/src/component-configs/cascader.ts +0 -20
- package/src/component-configs/checkbox.ts +0 -43
- package/src/component-configs/common-props.ts +0 -130
- package/src/component-configs/date-picker.ts +0 -153
- package/src/component-configs/date-range-picker.ts +0 -185
- package/src/component-configs/group.ts +0 -196
- package/src/component-configs/icon-select.ts +0 -56
- package/src/component-configs/input-array.ts +0 -184
- package/src/component-configs/input-number-range.ts +0 -143
- package/src/component-configs/input-number.ts +0 -111
- package/src/component-configs/input-table.ts +0 -191
- package/src/component-configs/input-upload.ts +0 -123
- package/src/component-configs/input.ts +0 -48
- package/src/component-configs/layout-sections.ts +0 -546
- package/src/component-configs/options-config.ts +0 -12
- package/src/component-configs/radio.ts +0 -26
- package/src/component-configs/select.ts +0 -42
- package/src/component-configs/switch.ts +0 -19
- package/src/component-configs/textarea.ts +0 -84
- package/src/component-configs/types.ts +0 -37
- package/src/components/condition-editor.vue +0 -641
- package/src/components/design-renderers/input-array-design.vue +0 -283
- package/src/components/design-renderers/input-table-design.vue +0 -311
- package/src/components/form-item-layout-editor.vue +0 -291
- package/src/components/form-item-span-editor.vue +0 -328
- package/src/components/form-layout-editor.vue +0 -263
- package/src/components/group-title-color-select.vue +0 -75
- package/src/components/group-title-style-picker.vue +0 -125
- package/src/components/input-number-range-binding-editor.vue +0 -226
- package/src/components/input-table-default-rows-editor.vue +0 -147
- package/src/components/input-table-operation-editor.vue +0 -168
- package/src/components/json-code-editor.vue +0 -219
- package/src/components/object-section-editor.vue +0 -342
- package/src/components/options/default-dict-options-panel.vue +0 -197
- package/src/components/options/options-editor.vue +0 -161
- package/src/components/table-columns-editor.vue +0 -353
- package/src/components/validation-rules-editor.vue +0 -321
- package/src/config.ts +0 -51
- package/src/editor-item-wrapper.vue +0 -254
- package/src/group-title-styles.ts +0 -82
- package/src/index.ts +0 -6
- package/src/option-sources.ts +0 -45
- package/src/root-configs.ts +0 -278
- package/src/shims-vue.d.ts +0 -5
- package/src/utils/__tests__/component-replace.test.ts +0 -129
- package/src/utils/__tests__/editor-schema.test.ts +0 -429
- package/src/utils/__tests__/form-item-width.test.ts +0 -53
- package/src/utils/__tests__/group-drag-path.test.ts +0 -84
- package/src/utils/__tests__/record-field.test.ts +0 -34
- package/src/utils/component-replace.ts +0 -67
- package/src/utils/editor-schema.ts +0 -374
- package/src/utils/form-item-width.ts +0 -40
- package/src/utils/local-dict-center.ts +0 -81
- package/src/utils/record-field.ts +0 -30
- package/src/validation-rules.ts +0 -104
- package/src/x-editor.vue +0 -1300
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from './types'
|
|
2
|
-
import { commonProps, createComponentConfigTabs } from './common-props'
|
|
3
|
-
import type { XFormItem } from 'xkit-ui'
|
|
4
|
-
|
|
5
|
-
const getDefaultDateValueFormat = (type?: string) => {
|
|
6
|
-
const pickerType = String(type || 'date')
|
|
7
|
-
if (['year', 'years', 'yearrange'].includes(pickerType)) return 'YYYY'
|
|
8
|
-
if (['month', 'months', 'monthrange'].includes(pickerType)) return 'YYYY-MM'
|
|
9
|
-
if (['datetime', 'datetimerange'].includes(pickerType)) return 'YYYY-MM-DD HH:mm:ss'
|
|
10
|
-
return 'YYYY-MM-DD'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const defaultDateValueFormats = new Set([
|
|
14
|
-
'YYYY',
|
|
15
|
-
'YYYY-MM',
|
|
16
|
-
'YYYY-MM-DD',
|
|
17
|
-
'YYYY-MM-DD HH:mm:ss'
|
|
18
|
-
])
|
|
19
|
-
|
|
20
|
-
const datePickerBasicProps: XFormItem[] = [
|
|
21
|
-
{
|
|
22
|
-
title: '组件属性',
|
|
23
|
-
type: 'group',
|
|
24
|
-
titleClass: 'config-group-title',
|
|
25
|
-
label: false
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: '占位提示',
|
|
29
|
-
name: 'placeholder',
|
|
30
|
-
type: 'input',
|
|
31
|
-
visible(row: any) {
|
|
32
|
-
return !String(row._type || 'date').includes('range')
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: '开始占位',
|
|
37
|
-
name: 'startPlaceholder',
|
|
38
|
-
type: 'input',
|
|
39
|
-
visible(row: any) {
|
|
40
|
-
return String(row._type || '').includes('range')
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: '结束占位',
|
|
45
|
-
name: 'endPlaceholder',
|
|
46
|
-
type: 'input',
|
|
47
|
-
visible(row: any) {
|
|
48
|
-
return String(row._type || '').includes('range')
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
label: '允许清空',
|
|
53
|
-
name: 'clearable',
|
|
54
|
-
type: 'switch',
|
|
55
|
-
defaultValue: true
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: '允许输入',
|
|
59
|
-
name: 'editable',
|
|
60
|
-
type: 'switch',
|
|
61
|
-
defaultValue: true
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: '取消面板联动',
|
|
65
|
-
name: 'unlinkPanels',
|
|
66
|
-
type: 'switch',
|
|
67
|
-
visible(row: any) {
|
|
68
|
-
return String(row._type || '').includes('range')
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
|
|
73
|
-
const datePickerDataProps: XFormItem[] = [
|
|
74
|
-
{
|
|
75
|
-
title: '日期数据',
|
|
76
|
-
type: 'group',
|
|
77
|
-
titleClass: 'config-group-title',
|
|
78
|
-
label: false
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
label: '选择类型',
|
|
82
|
-
name: '_type',
|
|
83
|
-
type: 'select',
|
|
84
|
-
options: [
|
|
85
|
-
{ label: '日期', value: 'date' },
|
|
86
|
-
{ label: '日期时间', value: 'datetime' },
|
|
87
|
-
{ label: '年份', value: 'year' },
|
|
88
|
-
{ label: '月份', value: 'month' },
|
|
89
|
-
{ label: '周', value: 'week' },
|
|
90
|
-
{ label: '多个日期', value: 'dates' },
|
|
91
|
-
{ label: '日期范围', value: 'daterange' },
|
|
92
|
-
{ label: '日期时间范围', value: 'datetimerange' },
|
|
93
|
-
{ label: '月份范围', value: 'monthrange' },
|
|
94
|
-
{ label: '年份范围', value: 'yearrange' }
|
|
95
|
-
],
|
|
96
|
-
defaultValue: 'date',
|
|
97
|
-
pipeOut(value: string, row: any) {
|
|
98
|
-
if (!row.valueFormat || defaultDateValueFormats.has(row.valueFormat)) {
|
|
99
|
-
row.valueFormat = getDefaultDateValueFormat(value)
|
|
100
|
-
}
|
|
101
|
-
return value
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: '展示格式',
|
|
106
|
-
name: 'format',
|
|
107
|
-
type: 'input',
|
|
108
|
-
placeholder: '例如 YYYY-MM-DD'
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
label: '值格式',
|
|
112
|
-
name: 'valueFormat',
|
|
113
|
-
type: 'input',
|
|
114
|
-
placeholder: '例如 YYYY-MM-DD',
|
|
115
|
-
pipeIn(value: string | undefined, row: any) {
|
|
116
|
-
return value || getDefaultDateValueFormat(row._type)
|
|
117
|
-
},
|
|
118
|
-
pipeOut(value: string, row: any) {
|
|
119
|
-
return value || getDefaultDateValueFormat(row._type)
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
label: '范围分隔符',
|
|
124
|
-
name: 'rangeSeparator',
|
|
125
|
-
type: 'input',
|
|
126
|
-
visible(row: any) {
|
|
127
|
-
return String(row._type || '').includes('range')
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
|
|
132
|
-
export const datePickerComponentConfig: ComponentConfig = {
|
|
133
|
-
label: '日期选择器',
|
|
134
|
-
value: 'date-picker',
|
|
135
|
-
icon: 'ri-calendar-line',
|
|
136
|
-
scaffold: {
|
|
137
|
-
type: 'date-picker',
|
|
138
|
-
label: '日期选择',
|
|
139
|
-
placeholder: '请选择日期',
|
|
140
|
-
_type: 'date',
|
|
141
|
-
valueFormat: 'YYYY-MM-DD'
|
|
142
|
-
},
|
|
143
|
-
replace: {
|
|
144
|
-
groups: ['placeholder', 'date']
|
|
145
|
-
},
|
|
146
|
-
configTabs: createComponentConfigTabs({
|
|
147
|
-
basic: datePickerBasicProps,
|
|
148
|
-
data: datePickerDataProps
|
|
149
|
-
}),
|
|
150
|
-
configSchema: {
|
|
151
|
-
body: [...commonProps, ...datePickerBasicProps, ...datePickerDataProps]
|
|
152
|
-
}
|
|
153
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from './types'
|
|
2
|
-
import { commonAdvancedProps, commonBasicProps, commonLayoutProps, commonValidationProps } from './common-props'
|
|
3
|
-
import type { XFormItem } from 'xkit-ui'
|
|
4
|
-
import { markRaw } from 'vue'
|
|
5
|
-
import InputNumberRangeBindingEditor from '../components/input-number-range-binding-editor.vue'
|
|
6
|
-
|
|
7
|
-
const [basicInfoGroupProp, labelProp, , labelPositionProp] = commonBasicProps
|
|
8
|
-
|
|
9
|
-
const dateRangeBindingProp: XFormItem = {
|
|
10
|
-
label: false,
|
|
11
|
-
name: 'sync',
|
|
12
|
-
type: 'custom',
|
|
13
|
-
component: markRaw(InputNumberRangeBindingEditor),
|
|
14
|
-
allowTuple: false,
|
|
15
|
-
defaultBaseName: 'dateRange',
|
|
16
|
-
startFieldLabel: '开始字段',
|
|
17
|
-
endFieldLabel: '结束字段',
|
|
18
|
-
startSyncName: 'startDate',
|
|
19
|
-
endSyncName: 'endDate',
|
|
20
|
-
sync: [{ name: 'name', syncName: 'name' }]
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const dateRangeBasicProps: XFormItem[] = [
|
|
24
|
-
{
|
|
25
|
-
title: '组件属性',
|
|
26
|
-
type: 'group',
|
|
27
|
-
titleClass: 'config-group-title',
|
|
28
|
-
label: false
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: '开始占位',
|
|
32
|
-
name: 'startPlaceholder',
|
|
33
|
-
type: 'input'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: '结束占位',
|
|
37
|
-
name: 'endPlaceholder',
|
|
38
|
-
type: 'input'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: '范围分隔符',
|
|
42
|
-
name: 'rangeSeperator',
|
|
43
|
-
type: 'input'
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
const legacyDateRangeBasicProps: XFormItem[] = [
|
|
48
|
-
...dateRangeBasicProps,
|
|
49
|
-
{
|
|
50
|
-
label: '允许输入',
|
|
51
|
-
name: 'editable',
|
|
52
|
-
type: 'switch',
|
|
53
|
-
defaultValue: true
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
label: '取消面板联动',
|
|
57
|
-
name: 'unlinkPanels',
|
|
58
|
-
type: 'switch'
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
const legacyDateRangeDataProps: XFormItem[] = [
|
|
63
|
-
{
|
|
64
|
-
title: '日期数据',
|
|
65
|
-
type: 'group',
|
|
66
|
-
titleClass: 'config-group-title',
|
|
67
|
-
label: false
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: '选择类型',
|
|
71
|
-
name: '_type',
|
|
72
|
-
type: 'select',
|
|
73
|
-
options: [
|
|
74
|
-
{ label: '日期范围', value: 'daterange' },
|
|
75
|
-
{ label: '日期时间范围', value: 'datetimerange' },
|
|
76
|
-
{ label: '月份范围', value: 'monthrange' },
|
|
77
|
-
{ label: '年份范围', value: 'yearrange' }
|
|
78
|
-
],
|
|
79
|
-
defaultValue: 'daterange',
|
|
80
|
-
pipeOut(value: string, row: any) {
|
|
81
|
-
if (value === 'datetimerange' && (!row.valueFormat || row.valueFormat === 'YYYY-MM-DD')) {
|
|
82
|
-
row.valueFormat = 'YYYY-MM-DD HH:mm:ss'
|
|
83
|
-
}
|
|
84
|
-
return value
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
label: '展示格式',
|
|
89
|
-
name: 'format',
|
|
90
|
-
type: 'input',
|
|
91
|
-
placeholder: '例如 YYYY-MM-DD'
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
label: '值格式',
|
|
95
|
-
name: 'valueFormat',
|
|
96
|
-
type: 'input',
|
|
97
|
-
placeholder: '例如 YYYY-MM-DD'
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
|
|
101
|
-
const dateRangeV2DataProps: XFormItem[] = [
|
|
102
|
-
{
|
|
103
|
-
title: '日期数据',
|
|
104
|
-
type: 'group',
|
|
105
|
-
titleClass: 'config-group-title',
|
|
106
|
-
label: false
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: '展示格式',
|
|
110
|
-
name: 'format',
|
|
111
|
-
type: 'input',
|
|
112
|
-
placeholder: '例如 YYYY-MM-DD'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
label: '值格式',
|
|
116
|
-
name: 'valueFormat',
|
|
117
|
-
type: 'input',
|
|
118
|
-
placeholder: '例如 YYYY-MM-DD'
|
|
119
|
-
}
|
|
120
|
-
]
|
|
121
|
-
|
|
122
|
-
const createDateRangeConfigTabs = (basicProps: XFormItem[], dataProps: XFormItem[]) => [
|
|
123
|
-
{
|
|
124
|
-
key: 'basic' as const,
|
|
125
|
-
body: [basicInfoGroupProp, labelProp, dateRangeBindingProp, labelPositionProp, ...basicProps]
|
|
126
|
-
},
|
|
127
|
-
{ key: 'layout' as const, body: commonLayoutProps },
|
|
128
|
-
{ key: 'data' as const, body: dataProps },
|
|
129
|
-
{ key: 'validation' as const, body: commonValidationProps },
|
|
130
|
-
{ key: 'advanced' as const, body: commonAdvancedProps }
|
|
131
|
-
]
|
|
132
|
-
|
|
133
|
-
export const dateRangePickerComponentConfig: ComponentConfig = {
|
|
134
|
-
label: '日期范围选择器',
|
|
135
|
-
value: 'x-date-range-picker',
|
|
136
|
-
icon: 'ri-calendar-event-line',
|
|
137
|
-
scaffold: {
|
|
138
|
-
type: 'x-date-range-picker',
|
|
139
|
-
label: '日期范围',
|
|
140
|
-
startPlaceholder: '开始日期',
|
|
141
|
-
endPlaceholder: '结束日期',
|
|
142
|
-
rangeSeperator: '至',
|
|
143
|
-
_type: 'daterange',
|
|
144
|
-
valueFormat: 'YYYY-MM-DD',
|
|
145
|
-
sync: [
|
|
146
|
-
{ name: 'startDate', syncName: 'startDate' },
|
|
147
|
-
{ name: 'endDate', syncName: 'endDate' }
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
replace: {
|
|
151
|
-
groups: ['placeholder', 'date'],
|
|
152
|
-
keep: ['sync', 'rangeSeperator']
|
|
153
|
-
},
|
|
154
|
-
configTabs: createDateRangeConfigTabs(legacyDateRangeBasicProps, legacyDateRangeDataProps),
|
|
155
|
-
configSchema: {
|
|
156
|
-
body: [basicInfoGroupProp, labelProp, dateRangeBindingProp, labelPositionProp, ...legacyDateRangeBasicProps, ...commonLayoutProps, ...legacyDateRangeDataProps, ...commonValidationProps, ...commonAdvancedProps]
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export const dateRangePickerV2ComponentConfig: ComponentConfig = {
|
|
161
|
-
label: '日期范围选择器2',
|
|
162
|
-
value: 'x-date-range-picker-v2',
|
|
163
|
-
icon: 'ri-calendar-schedule-line',
|
|
164
|
-
scaffold: {
|
|
165
|
-
type: 'x-date-range-picker-v2',
|
|
166
|
-
label: '日期范围',
|
|
167
|
-
startPlaceholder: '开始日期',
|
|
168
|
-
endPlaceholder: '结束日期',
|
|
169
|
-
rangeSeperator: '至',
|
|
170
|
-
valueFormat: 'YYYY-MM-DD',
|
|
171
|
-
format: 'YYYY-MM-DD',
|
|
172
|
-
sync: [
|
|
173
|
-
{ name: 'startDate', syncName: 'startDate' },
|
|
174
|
-
{ name: 'endDate', syncName: 'endDate' }
|
|
175
|
-
]
|
|
176
|
-
},
|
|
177
|
-
replace: {
|
|
178
|
-
groups: ['placeholder', 'date'],
|
|
179
|
-
keep: ['sync', 'rangeSeperator']
|
|
180
|
-
},
|
|
181
|
-
configTabs: createDateRangeConfigTabs(dateRangeBasicProps, dateRangeV2DataProps),
|
|
182
|
-
configSchema: {
|
|
183
|
-
body: [basicInfoGroupProp, labelProp, dateRangeBindingProp, labelPositionProp, ...dateRangeBasicProps, ...commonLayoutProps, ...dateRangeV2DataProps, ...commonValidationProps, ...commonAdvancedProps]
|
|
184
|
-
}
|
|
185
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { markRaw } from 'vue'
|
|
2
|
-
import type { ComponentConfig } from './types'
|
|
3
|
-
import { commonAdvancedProps, commonValidationProps } from './common-props'
|
|
4
|
-
import ObjectSectionEditor from '../components/object-section-editor.vue'
|
|
5
|
-
import GroupTitleStylePicker from '../components/group-title-style-picker.vue'
|
|
6
|
-
import GroupTitleColorSelect from '../components/group-title-color-select.vue'
|
|
7
|
-
import FormItemLayoutEditor from '../components/form-item-layout-editor.vue'
|
|
8
|
-
import { containerLayoutSections } from './layout-sections'
|
|
9
|
-
import type { XFormItem } from 'xkit-ui'
|
|
10
|
-
|
|
11
|
-
const groupBasicProps: XFormItem[] = [
|
|
12
|
-
{
|
|
13
|
-
title: '分组属性',
|
|
14
|
-
type: 'group',
|
|
15
|
-
titleClass: 'config-group-title',
|
|
16
|
-
label: false
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: '显示表单标签',
|
|
20
|
-
name: 'label',
|
|
21
|
-
type: 'switch',
|
|
22
|
-
pipeIn(value: string | false | undefined) {
|
|
23
|
-
return value !== false
|
|
24
|
-
},
|
|
25
|
-
pipeOut(value: boolean, row: any) {
|
|
26
|
-
return value ? row.label || row.title || '分组' : false
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: '分组标题',
|
|
31
|
-
name: 'title',
|
|
32
|
-
type: 'input',
|
|
33
|
-
placeholder: '请输入分组标题'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: '字段名',
|
|
37
|
-
name: 'name',
|
|
38
|
-
type: 'input',
|
|
39
|
-
placeholder: '请输入字段名'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: '标签位置',
|
|
43
|
-
name: 'labelPosition',
|
|
44
|
-
type: 'select',
|
|
45
|
-
options: [
|
|
46
|
-
{ label: '继承', value: '' },
|
|
47
|
-
{ label: '左', value: 'left' },
|
|
48
|
-
{ label: '上', value: 'top' },
|
|
49
|
-
{ label: '右', value: 'right' }
|
|
50
|
-
],
|
|
51
|
-
visible(row: any) {
|
|
52
|
-
return row.label !== false
|
|
53
|
-
},
|
|
54
|
-
pipeIn(value: string | undefined) {
|
|
55
|
-
return value ?? ''
|
|
56
|
-
},
|
|
57
|
-
pipeOut(value: string) {
|
|
58
|
-
return value || undefined
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
label: '显示模式',
|
|
63
|
-
name: 'mode',
|
|
64
|
-
type: 'x-radios',
|
|
65
|
-
mode: 'button',
|
|
66
|
-
size: 'small',
|
|
67
|
-
options: [
|
|
68
|
-
{ label: '默认', value: 'default' },
|
|
69
|
-
{ label: '行内', value: 'inline' },
|
|
70
|
-
{ label: '嵌套', value: 'nest' }
|
|
71
|
-
],
|
|
72
|
-
defaultValue: 'default'
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
label: '显示切换',
|
|
76
|
-
name: 'showToggleButton',
|
|
77
|
-
type: 'switch'
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
|
|
81
|
-
const groupLayoutProps: XFormItem[] = [
|
|
82
|
-
{
|
|
83
|
-
title: '作为表单项的布局',
|
|
84
|
-
type: 'group',
|
|
85
|
-
titleClass: 'config-group-title',
|
|
86
|
-
label: false
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: 'span',
|
|
90
|
-
type: 'custom',
|
|
91
|
-
component: markRaw(FormItemLayoutEditor),
|
|
92
|
-
label: false,
|
|
93
|
-
sync: [{ name: 'offsetRight', syncName: 'offsetRight' }]
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
title: '容器本身布局配置',
|
|
97
|
-
type: 'group',
|
|
98
|
-
titleClass: 'config-group-title',
|
|
99
|
-
label: false
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: 'layout',
|
|
103
|
-
type: 'custom',
|
|
104
|
-
component: markRaw(ObjectSectionEditor),
|
|
105
|
-
label: false,
|
|
106
|
-
rootKey: 'layout',
|
|
107
|
-
sectionMode: 'plain',
|
|
108
|
-
sections: containerLayoutSections
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
|
|
112
|
-
const groupAdvancedProps: XFormItem[] = [
|
|
113
|
-
{
|
|
114
|
-
title: '样式配置',
|
|
115
|
-
type: 'group',
|
|
116
|
-
titleClass: 'config-group-title',
|
|
117
|
-
label: false
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
label: '标题样式',
|
|
121
|
-
name: 'titleClass',
|
|
122
|
-
type: 'custom',
|
|
123
|
-
component: markRaw(GroupTitleStylePicker)
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
label: '标题图标',
|
|
127
|
-
name: 'titleIcon',
|
|
128
|
-
type: 'x-icon-select',
|
|
129
|
-
clearable: true
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
label: '标题对齐',
|
|
133
|
-
name: 'titleAlign',
|
|
134
|
-
type: 'x-radios',
|
|
135
|
-
mode: 'button',
|
|
136
|
-
size: 'small',
|
|
137
|
-
options: [
|
|
138
|
-
{ label: '左', value: 'left' },
|
|
139
|
-
{ label: '中', value: 'center' },
|
|
140
|
-
{ label: '右', value: 'right' }
|
|
141
|
-
],
|
|
142
|
-
pipeIn(value: string | undefined) {
|
|
143
|
-
return value ?? 'left'
|
|
144
|
-
},
|
|
145
|
-
pipeOut(value: string) {
|
|
146
|
-
return value === 'left' ? undefined : value
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
label: '标题字号',
|
|
151
|
-
name: 'titleSize',
|
|
152
|
-
type: 'x-radios',
|
|
153
|
-
mode: 'button',
|
|
154
|
-
size: 'small',
|
|
155
|
-
options: [
|
|
156
|
-
{ label: '小', value: 'small' },
|
|
157
|
-
{ label: '中', value: 'medium' },
|
|
158
|
-
{ label: '大', value: 'large' }
|
|
159
|
-
],
|
|
160
|
-
pipeIn(value: string | undefined) {
|
|
161
|
-
return value ?? 'medium'
|
|
162
|
-
},
|
|
163
|
-
pipeOut(value: string) {
|
|
164
|
-
return value === 'medium' ? undefined : value
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
label: '标题颜色',
|
|
169
|
-
name: 'titleColor',
|
|
170
|
-
type: 'custom',
|
|
171
|
-
component: markRaw(GroupTitleColorSelect)
|
|
172
|
-
}
|
|
173
|
-
]
|
|
174
|
-
|
|
175
|
-
export const groupComponentConfig: ComponentConfig = {
|
|
176
|
-
label: '分组',
|
|
177
|
-
value: 'group',
|
|
178
|
-
icon: 'ri-layout-grid-line',
|
|
179
|
-
editorKind: 'container',
|
|
180
|
-
scaffold: {
|
|
181
|
-
type: 'group',
|
|
182
|
-
title: '分组',
|
|
183
|
-
label: false,
|
|
184
|
-
span: 24,
|
|
185
|
-
body: []
|
|
186
|
-
},
|
|
187
|
-
configTabs: [
|
|
188
|
-
{ key: 'basic', body: groupBasicProps },
|
|
189
|
-
{ key: 'layout', body: groupLayoutProps },
|
|
190
|
-
{ key: 'validation', body: commonValidationProps },
|
|
191
|
-
{ key: 'advanced', body: [...commonAdvancedProps, ...groupAdvancedProps] }
|
|
192
|
-
],
|
|
193
|
-
configSchema: {
|
|
194
|
-
body: [...groupBasicProps, ...groupLayoutProps, ...commonValidationProps, ...commonAdvancedProps, ...groupAdvancedProps]
|
|
195
|
-
}
|
|
196
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from './types'
|
|
2
|
-
import { commonProps, createComponentConfigTabs } from './common-props'
|
|
3
|
-
import { getIconSourceOptions, type XFormItem } from 'xkit-ui'
|
|
4
|
-
|
|
5
|
-
const iconSelectBasicProps: XFormItem[] = [
|
|
6
|
-
{
|
|
7
|
-
title: '组件属性',
|
|
8
|
-
type: 'group',
|
|
9
|
-
titleClass: 'config-group-title',
|
|
10
|
-
label: false
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
label: '允许清空',
|
|
14
|
-
name: 'clearable',
|
|
15
|
-
type: 'switch',
|
|
16
|
-
defaultValue: true
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
const iconSelectDataProps: XFormItem[] = [
|
|
21
|
-
{
|
|
22
|
-
title: '图标资源',
|
|
23
|
-
type: 'group',
|
|
24
|
-
titleClass: 'config-group-title',
|
|
25
|
-
label: false
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: '可用图标库',
|
|
29
|
-
name: 'iconSources',
|
|
30
|
-
type: 'x-checkboxes',
|
|
31
|
-
options: getIconSourceOptions,
|
|
32
|
-
showLoading: false
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
export const iconSelectComponentConfig: ComponentConfig = {
|
|
37
|
-
label: '图标选择器',
|
|
38
|
-
value: 'x-icon-select',
|
|
39
|
-
icon: 'ri-remixicon-line',
|
|
40
|
-
scaffold: {
|
|
41
|
-
type: 'x-icon-select',
|
|
42
|
-
label: '图标选择器',
|
|
43
|
-
clearable: true,
|
|
44
|
-
iconSources: []
|
|
45
|
-
},
|
|
46
|
-
replace: {
|
|
47
|
-
groups: ['icon']
|
|
48
|
-
},
|
|
49
|
-
configTabs: createComponentConfigTabs({
|
|
50
|
-
basic: iconSelectBasicProps,
|
|
51
|
-
data: iconSelectDataProps
|
|
52
|
-
}),
|
|
53
|
-
configSchema: {
|
|
54
|
-
body: [...commonProps, ...iconSelectBasicProps, ...iconSelectDataProps]
|
|
55
|
-
}
|
|
56
|
-
}
|