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,12 +0,0 @@
|
|
|
1
|
-
import { markRaw } from 'vue'
|
|
2
|
-
import type { XFormItem } from 'xkit-ui'
|
|
3
|
-
import OptionsEditor from '../components/options/options-editor.vue'
|
|
4
|
-
|
|
5
|
-
export const optionsConfigItem: XFormItem = {
|
|
6
|
-
title: '选项配置',
|
|
7
|
-
name: 'options',
|
|
8
|
-
type: 'custom',
|
|
9
|
-
component: markRaw(OptionsEditor),
|
|
10
|
-
titleClass: 'config-group-title',
|
|
11
|
-
label: false
|
|
12
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from './types'
|
|
2
|
-
import { commonProps, createComponentConfigTabs } from './common-props'
|
|
3
|
-
import { optionsConfigItem } from './options-config'
|
|
4
|
-
|
|
5
|
-
export const radioComponentConfig: ComponentConfig = {
|
|
6
|
-
label: '单选框',
|
|
7
|
-
value: 'x-radios',
|
|
8
|
-
icon: 'ri-radio-button-line',
|
|
9
|
-
scaffold: {
|
|
10
|
-
type: 'x-radios',
|
|
11
|
-
label: '单选框',
|
|
12
|
-
options: [
|
|
13
|
-
{ label: '选项一', value: '1' },
|
|
14
|
-
{ label: '选项二', value: '2' }
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
replace: {
|
|
18
|
-
groups: ['options']
|
|
19
|
-
},
|
|
20
|
-
configTabs: createComponentConfigTabs({
|
|
21
|
-
data: [optionsConfigItem]
|
|
22
|
-
}),
|
|
23
|
-
configSchema: {
|
|
24
|
-
body: [...commonProps, optionsConfigItem]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from './types'
|
|
2
|
-
import { commonProps, createComponentConfigTabs } from './common-props'
|
|
3
|
-
import { optionsConfigItem } from './options-config'
|
|
4
|
-
import type { XFormItem } from 'xkit-ui'
|
|
5
|
-
|
|
6
|
-
const selectBasicProps: XFormItem[] = [
|
|
7
|
-
{
|
|
8
|
-
title: '组件属性',
|
|
9
|
-
type: 'group',
|
|
10
|
-
titleClass: 'config-group-title',
|
|
11
|
-
label: false
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
label: '占位提示',
|
|
15
|
-
name: 'placeholder',
|
|
16
|
-
type: 'input'
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
export const selectComponentConfig: ComponentConfig = {
|
|
21
|
-
label: '下拉框',
|
|
22
|
-
value: 'select',
|
|
23
|
-
icon: 'ri-list-check',
|
|
24
|
-
scaffold: {
|
|
25
|
-
type: 'select',
|
|
26
|
-
label: '下拉框',
|
|
27
|
-
options: [
|
|
28
|
-
{ label: '选项一', value: '1' },
|
|
29
|
-
{ label: '选项二', value: '2' }
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
replace: {
|
|
33
|
-
groups: ['options', 'placeholder']
|
|
34
|
-
},
|
|
35
|
-
configTabs: createComponentConfigTabs({
|
|
36
|
-
basic: selectBasicProps,
|
|
37
|
-
data: [optionsConfigItem]
|
|
38
|
-
}),
|
|
39
|
-
configSchema: {
|
|
40
|
-
body: [...commonProps, ...selectBasicProps, optionsConfigItem]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from './types'
|
|
2
|
-
import { commonProps, createComponentConfigTabs } from './common-props'
|
|
3
|
-
|
|
4
|
-
export const switchComponentConfig: ComponentConfig = {
|
|
5
|
-
label: '开关',
|
|
6
|
-
value: 'switch',
|
|
7
|
-
icon: 'ri-toggle-line',
|
|
8
|
-
scaffold: {
|
|
9
|
-
type: 'switch',
|
|
10
|
-
label: '开关'
|
|
11
|
-
},
|
|
12
|
-
replace: {
|
|
13
|
-
groups: []
|
|
14
|
-
},
|
|
15
|
-
configTabs: createComponentConfigTabs({}),
|
|
16
|
-
configSchema: {
|
|
17
|
-
body: [...commonProps]
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,84 +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 textareaBasicProps: XFormItem[] = [
|
|
6
|
-
{
|
|
7
|
-
title: '组件属性',
|
|
8
|
-
type: 'group',
|
|
9
|
-
titleClass: 'config-group-title',
|
|
10
|
-
label: false
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
label: '占位提示',
|
|
14
|
-
name: 'placeholder',
|
|
15
|
-
type: 'input'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
label: '行数',
|
|
19
|
-
name: 'rows',
|
|
20
|
-
type: 'input-number',
|
|
21
|
-
min: 1,
|
|
22
|
-
step: 1,
|
|
23
|
-
controlsPosition: 'right'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
label: '最大长度',
|
|
27
|
-
name: 'maxlength',
|
|
28
|
-
type: 'input-number',
|
|
29
|
-
min: 0,
|
|
30
|
-
step: 1,
|
|
31
|
-
controlsPosition: 'right'
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: '显示字数',
|
|
35
|
-
name: 'showWordLimit',
|
|
36
|
-
type: 'switch'
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: '自适应高度',
|
|
40
|
-
name: 'autosize',
|
|
41
|
-
type: 'switch'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: '缩放方式',
|
|
45
|
-
name: 'resize',
|
|
46
|
-
type: 'x-radios',
|
|
47
|
-
mode: 'button',
|
|
48
|
-
size: 'small',
|
|
49
|
-
options: [
|
|
50
|
-
{ label: '默认', value: '' },
|
|
51
|
-
{ label: '禁止', value: 'none' },
|
|
52
|
-
{ label: '双向', value: 'both' },
|
|
53
|
-
{ label: '横向', value: 'horizontal' },
|
|
54
|
-
{ label: '纵向', value: 'vertical' }
|
|
55
|
-
],
|
|
56
|
-
pipeIn(value: string | undefined) {
|
|
57
|
-
return value ?? ''
|
|
58
|
-
},
|
|
59
|
-
pipeOut(value: string) {
|
|
60
|
-
return value || undefined
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
|
|
65
|
-
export const textareaComponentConfig: ComponentConfig = {
|
|
66
|
-
label: '多行文本输入框',
|
|
67
|
-
value: 'textarea',
|
|
68
|
-
icon: 'ri-align-left',
|
|
69
|
-
scaffold: {
|
|
70
|
-
type: 'textarea',
|
|
71
|
-
label: '多行文本',
|
|
72
|
-
placeholder: '请输入内容',
|
|
73
|
-
rows: 3
|
|
74
|
-
},
|
|
75
|
-
replace: {
|
|
76
|
-
groups: ['placeholder', 'lengthLimit']
|
|
77
|
-
},
|
|
78
|
-
configTabs: createComponentConfigTabs({
|
|
79
|
-
basic: textareaBasicProps
|
|
80
|
-
}),
|
|
81
|
-
configSchema: {
|
|
82
|
-
body: [...commonProps, ...textareaBasicProps]
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { XFormItem } from 'xkit-ui'
|
|
2
|
-
|
|
3
|
-
export type EditorConfigTabKey = 'basic' | 'layout' | 'data' | 'operation' | 'validation' | 'advanced'
|
|
4
|
-
export type ComponentReplaceGroup = 'placeholder' | 'lengthLimit' | 'options' | 'numeric' | 'date' | 'upload' | 'icon' | 'collection'
|
|
5
|
-
|
|
6
|
-
export interface EditorConfigTab {
|
|
7
|
-
key: EditorConfigTabKey
|
|
8
|
-
label?: string
|
|
9
|
-
body: XFormItem[]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ComponentReplaceContext {
|
|
13
|
-
source: Record<string, any>
|
|
14
|
-
targetScaffold: Record<string, any>
|
|
15
|
-
sourceConfig: ComponentConfig
|
|
16
|
-
targetConfig: ComponentConfig
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ComponentReplaceConfig {
|
|
20
|
-
groups?: ComponentReplaceGroup[]
|
|
21
|
-
keep?: string[]
|
|
22
|
-
drop?: string[]
|
|
23
|
-
migrate?: (ctx: ComponentReplaceContext) => Record<string, any>
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface ComponentConfig {
|
|
27
|
-
label: string
|
|
28
|
-
value: string
|
|
29
|
-
icon: string
|
|
30
|
-
editorKind?: 'leaf' | 'container'
|
|
31
|
-
scaffold: Record<string, unknown>
|
|
32
|
-
replace?: ComponentReplaceConfig
|
|
33
|
-
configTabs?: EditorConfigTab[]
|
|
34
|
-
configSchema: {
|
|
35
|
-
body: XFormItem[]
|
|
36
|
-
}
|
|
37
|
-
}
|