@king-one/form-design 0.0.28 → 0.0.30
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/CHANGELOG.md +12 -0
- package/dist/es/index.mjs +10 -8
- package/dist/es/src/components/form-material.vue.mjs +44 -49
- package/dist/es/src/components/panel/widget/grid.vue2.mjs +1 -1
- package/dist/es/src/components/props/widget/GridProps.vue2.mjs +15 -20
- package/dist/es/src/config/index.mjs +225 -149
- package/dist/es/src/core/FormSchema.mjs +37 -58
- package/dist/es/src/index.mjs +15 -14
- package/dist/es/src/plugins/modules/drag-add.mjs +1 -1
- package/dist/es/src/utils/index.mjs +15 -13
- package/dist/es/src/utils/schema.mjs +29 -0
- package/dist/lib/index.js +1 -1
- package/dist/lib/src/components/form-material.vue.js +1 -1
- package/dist/lib/src/components/panel/widget/grid.vue2.js +1 -1
- package/dist/lib/src/components/props/widget/GridProps.vue2.js +1 -1
- package/dist/lib/src/config/index.js +14 -14
- package/dist/lib/src/core/FormSchema.js +1 -1
- package/dist/lib/src/index.js +1 -1
- package/dist/lib/src/plugins/modules/drag-add.js +1 -1
- package/dist/lib/src/utils/index.js +1 -1
- package/dist/lib/src/utils/schema.js +1 -0
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/types/src/core/Design.d.ts +546 -186
- package/dist/types/src/core/FormSchema.d.ts +176 -62
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/types.d.ts +41 -30
- package/dist/types/src/utils/index.d.ts +1 -0
- package/dist/types/src/utils/schema.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,128 +4,248 @@ import { Ref, VNode } from 'vue';
|
|
|
4
4
|
export declare class FormSchema {
|
|
5
5
|
private version;
|
|
6
6
|
fields: Ref<{
|
|
7
|
-
title
|
|
8
|
-
key
|
|
7
|
+
title?: string | undefined;
|
|
8
|
+
key?: string | undefined;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
children?: any[] | undefined;
|
|
11
|
+
icon?: (string | VNode) | undefined;
|
|
9
12
|
type: valueType;
|
|
10
|
-
'x-component'?: string | undefined;
|
|
11
|
-
enum?: any[] | undefined;
|
|
12
13
|
format?: string | undefined;
|
|
14
|
+
name?: string | undefined;
|
|
15
|
+
enum?: any[] | undefined;
|
|
16
|
+
required?: boolean | undefined;
|
|
17
|
+
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
13
18
|
items?: {
|
|
14
19
|
type: valueType;
|
|
15
20
|
format?: string | undefined;
|
|
16
|
-
title?: string | undefined;
|
|
17
21
|
name?: string | undefined;
|
|
22
|
+
enum?: any[] | undefined;
|
|
23
|
+
required?: boolean | undefined;
|
|
24
|
+
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
25
|
+
items?: any | any[] | undefined;
|
|
18
26
|
'x-component'?: string | undefined;
|
|
19
27
|
'x-component-props'?: Record<string, any> | undefined;
|
|
20
28
|
'x-decorator'?: string | undefined;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
'x-decorator-props'?: {
|
|
30
|
+
[x: string]: any;
|
|
31
|
+
} | undefined;
|
|
24
32
|
'x-reactions'?: {
|
|
25
|
-
dependencies?:
|
|
33
|
+
dependencies?: {
|
|
34
|
+
property: string;
|
|
35
|
+
type?: string | undefined;
|
|
36
|
+
source: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}[] | undefined;
|
|
26
39
|
fulfill?: {
|
|
27
40
|
state?: Record<string, any> | undefined;
|
|
28
41
|
} | undefined;
|
|
29
42
|
} | undefined;
|
|
43
|
+
'x-validator'?: string | {
|
|
44
|
+
[x: string]: any;
|
|
45
|
+
validator?: string | undefined;
|
|
46
|
+
required?: boolean | undefined;
|
|
47
|
+
message?: string | undefined;
|
|
48
|
+
pattern?: (string | RegExp) | undefined;
|
|
49
|
+
}[] | undefined;
|
|
50
|
+
'x-design-props'?: {
|
|
51
|
+
[x: string]: any;
|
|
52
|
+
validate?: {
|
|
53
|
+
status: "success" | "error" | "warning" | "";
|
|
54
|
+
message: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
} | undefined;
|
|
30
57
|
} | {
|
|
31
58
|
type: valueType;
|
|
32
59
|
format?: string | undefined;
|
|
33
|
-
title?: string | undefined;
|
|
34
60
|
name?: string | undefined;
|
|
61
|
+
enum?: any[] | undefined;
|
|
62
|
+
required?: boolean | undefined;
|
|
63
|
+
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
64
|
+
items?: any | any[] | undefined;
|
|
35
65
|
'x-component'?: string | undefined;
|
|
36
66
|
'x-component-props'?: Record<string, any> | undefined;
|
|
37
67
|
'x-decorator'?: string | undefined;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
68
|
+
'x-decorator-props'?: {
|
|
69
|
+
[x: string]: any;
|
|
70
|
+
} | undefined;
|
|
41
71
|
'x-reactions'?: {
|
|
42
|
-
dependencies?:
|
|
72
|
+
dependencies?: {
|
|
73
|
+
property: string;
|
|
74
|
+
type?: string | undefined;
|
|
75
|
+
source: string;
|
|
76
|
+
name: string;
|
|
77
|
+
}[] | undefined;
|
|
43
78
|
fulfill?: {
|
|
44
79
|
state?: Record<string, any> | undefined;
|
|
45
80
|
} | undefined;
|
|
46
81
|
} | undefined;
|
|
82
|
+
'x-validator'?: string | {
|
|
83
|
+
[x: string]: any;
|
|
84
|
+
validator?: string | undefined;
|
|
85
|
+
required?: boolean | undefined;
|
|
86
|
+
message?: string | undefined;
|
|
87
|
+
pattern?: (string | RegExp) | undefined;
|
|
88
|
+
}[] | undefined;
|
|
89
|
+
'x-design-props'?: {
|
|
90
|
+
[x: string]: any;
|
|
91
|
+
validate?: {
|
|
92
|
+
status: "success" | "error" | "warning" | "";
|
|
93
|
+
message: string;
|
|
94
|
+
} | undefined;
|
|
95
|
+
} | undefined;
|
|
96
|
+
}[] | undefined;
|
|
97
|
+
'x-component'?: string | undefined;
|
|
98
|
+
'x-component-props'?: Record<string, any> | undefined;
|
|
99
|
+
'x-decorator'?: string | undefined;
|
|
100
|
+
'x-decorator-props'?: {
|
|
101
|
+
[x: string]: any;
|
|
102
|
+
} | undefined;
|
|
103
|
+
'x-reactions'?: {
|
|
104
|
+
dependencies?: {
|
|
105
|
+
property: string;
|
|
106
|
+
type?: string | undefined;
|
|
107
|
+
source: string;
|
|
108
|
+
name: string;
|
|
109
|
+
}[] | undefined;
|
|
110
|
+
fulfill?: {
|
|
111
|
+
state?: Record<string, any> | undefined;
|
|
112
|
+
} | undefined;
|
|
113
|
+
} | undefined;
|
|
114
|
+
'x-validator'?: string | {
|
|
115
|
+
[x: string]: any;
|
|
116
|
+
validator?: string | undefined;
|
|
117
|
+
required?: boolean | undefined;
|
|
118
|
+
message?: string | undefined;
|
|
119
|
+
pattern?: (string | RegExp) | undefined;
|
|
47
120
|
}[] | undefined;
|
|
48
|
-
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
49
|
-
children?: any[] | undefined;
|
|
50
|
-
required?: boolean | undefined;
|
|
51
|
-
id?: string | undefined;
|
|
52
|
-
name?: string | undefined;
|
|
53
|
-
icon?: (string | VNode) | undefined;
|
|
54
121
|
'x-design-props'?: {
|
|
55
122
|
[x: string]: any;
|
|
56
123
|
validate?: {
|
|
57
124
|
status: "success" | "error" | "warning" | "";
|
|
58
125
|
message: string;
|
|
59
126
|
} | undefined;
|
|
60
|
-
'convert-key'?: ("items" | "properties") | undefined;
|
|
61
|
-
'convert-type'?: ("base" | "object" | "array") | undefined;
|
|
62
|
-
} | undefined;
|
|
63
|
-
'x-component-props'?: Record<string, any> | undefined;
|
|
64
|
-
'x-decorator'?: string | undefined;
|
|
65
|
-
'x-decorator-props'?: {
|
|
66
|
-
[x: string]: any;
|
|
67
127
|
} | undefined;
|
|
68
128
|
}[], FieldSchema[] | {
|
|
69
|
-
title
|
|
70
|
-
key
|
|
129
|
+
title?: string | undefined;
|
|
130
|
+
key?: string | undefined;
|
|
131
|
+
id?: string | undefined;
|
|
132
|
+
children?: any[] | undefined;
|
|
133
|
+
icon?: (string | VNode) | undefined;
|
|
71
134
|
type: valueType;
|
|
72
|
-
'x-component'?: string | undefined;
|
|
73
|
-
enum?: any[] | undefined;
|
|
74
135
|
format?: string | undefined;
|
|
136
|
+
name?: string | undefined;
|
|
137
|
+
enum?: any[] | undefined;
|
|
138
|
+
required?: boolean | undefined;
|
|
139
|
+
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
75
140
|
items?: {
|
|
76
141
|
type: valueType;
|
|
77
142
|
format?: string | undefined;
|
|
78
|
-
title?: string | undefined;
|
|
79
143
|
name?: string | undefined;
|
|
144
|
+
enum?: any[] | undefined;
|
|
145
|
+
required?: boolean | undefined;
|
|
146
|
+
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
147
|
+
items?: any | any[] | undefined;
|
|
80
148
|
'x-component'?: string | undefined;
|
|
81
149
|
'x-component-props'?: Record<string, any> | undefined;
|
|
82
150
|
'x-decorator'?: string | undefined;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
151
|
+
'x-decorator-props'?: {
|
|
152
|
+
[x: string]: any;
|
|
153
|
+
} | undefined;
|
|
86
154
|
'x-reactions'?: {
|
|
87
|
-
dependencies?:
|
|
155
|
+
dependencies?: {
|
|
156
|
+
property: string;
|
|
157
|
+
type?: string | undefined;
|
|
158
|
+
source: string;
|
|
159
|
+
name: string;
|
|
160
|
+
}[] | undefined;
|
|
88
161
|
fulfill?: {
|
|
89
162
|
state?: Record<string, any> | undefined;
|
|
90
163
|
} | undefined;
|
|
91
164
|
} | undefined;
|
|
165
|
+
'x-validator'?: string | {
|
|
166
|
+
[x: string]: any;
|
|
167
|
+
validator?: string | undefined;
|
|
168
|
+
required?: boolean | undefined;
|
|
169
|
+
message?: string | undefined;
|
|
170
|
+
pattern?: (string | RegExp) | undefined;
|
|
171
|
+
}[] | undefined;
|
|
172
|
+
'x-design-props'?: {
|
|
173
|
+
[x: string]: any;
|
|
174
|
+
validate?: {
|
|
175
|
+
status: "success" | "error" | "warning" | "";
|
|
176
|
+
message: string;
|
|
177
|
+
} | undefined;
|
|
178
|
+
} | undefined;
|
|
92
179
|
} | {
|
|
93
180
|
type: valueType;
|
|
94
181
|
format?: string | undefined;
|
|
95
|
-
title?: string | undefined;
|
|
96
182
|
name?: string | undefined;
|
|
183
|
+
enum?: any[] | undefined;
|
|
184
|
+
required?: boolean | undefined;
|
|
185
|
+
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
186
|
+
items?: any | any[] | undefined;
|
|
97
187
|
'x-component'?: string | undefined;
|
|
98
188
|
'x-component-props'?: Record<string, any> | undefined;
|
|
99
189
|
'x-decorator'?: string | undefined;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
190
|
+
'x-decorator-props'?: {
|
|
191
|
+
[x: string]: any;
|
|
192
|
+
} | undefined;
|
|
103
193
|
'x-reactions'?: {
|
|
104
|
-
dependencies?:
|
|
194
|
+
dependencies?: {
|
|
195
|
+
property: string;
|
|
196
|
+
type?: string | undefined;
|
|
197
|
+
source: string;
|
|
198
|
+
name: string;
|
|
199
|
+
}[] | undefined;
|
|
105
200
|
fulfill?: {
|
|
106
201
|
state?: Record<string, any> | undefined;
|
|
107
202
|
} | undefined;
|
|
108
203
|
} | undefined;
|
|
204
|
+
'x-validator'?: string | {
|
|
205
|
+
[x: string]: any;
|
|
206
|
+
validator?: string | undefined;
|
|
207
|
+
required?: boolean | undefined;
|
|
208
|
+
message?: string | undefined;
|
|
209
|
+
pattern?: (string | RegExp) | undefined;
|
|
210
|
+
}[] | undefined;
|
|
211
|
+
'x-design-props'?: {
|
|
212
|
+
[x: string]: any;
|
|
213
|
+
validate?: {
|
|
214
|
+
status: "success" | "error" | "warning" | "";
|
|
215
|
+
message: string;
|
|
216
|
+
} | undefined;
|
|
217
|
+
} | undefined;
|
|
218
|
+
}[] | undefined;
|
|
219
|
+
'x-component'?: string | undefined;
|
|
220
|
+
'x-component-props'?: Record<string, any> | undefined;
|
|
221
|
+
'x-decorator'?: string | undefined;
|
|
222
|
+
'x-decorator-props'?: {
|
|
223
|
+
[x: string]: any;
|
|
224
|
+
} | undefined;
|
|
225
|
+
'x-reactions'?: {
|
|
226
|
+
dependencies?: {
|
|
227
|
+
property: string;
|
|
228
|
+
type?: string | undefined;
|
|
229
|
+
source: string;
|
|
230
|
+
name: string;
|
|
231
|
+
}[] | undefined;
|
|
232
|
+
fulfill?: {
|
|
233
|
+
state?: Record<string, any> | undefined;
|
|
234
|
+
} | undefined;
|
|
235
|
+
} | undefined;
|
|
236
|
+
'x-validator'?: string | {
|
|
237
|
+
[x: string]: any;
|
|
238
|
+
validator?: string | undefined;
|
|
239
|
+
required?: boolean | undefined;
|
|
240
|
+
message?: string | undefined;
|
|
241
|
+
pattern?: (string | RegExp) | undefined;
|
|
109
242
|
}[] | undefined;
|
|
110
|
-
properties?: Record<string, BaseFieldSchema> | undefined;
|
|
111
|
-
children?: any[] | undefined;
|
|
112
|
-
required?: boolean | undefined;
|
|
113
|
-
id?: string | undefined;
|
|
114
|
-
name?: string | undefined;
|
|
115
|
-
icon?: (string | VNode) | undefined;
|
|
116
243
|
'x-design-props'?: {
|
|
117
244
|
[x: string]: any;
|
|
118
245
|
validate?: {
|
|
119
246
|
status: "success" | "error" | "warning" | "";
|
|
120
247
|
message: string;
|
|
121
248
|
} | undefined;
|
|
122
|
-
'convert-key'?: ("items" | "properties") | undefined;
|
|
123
|
-
'convert-type'?: ("base" | "object" | "array") | undefined;
|
|
124
|
-
} | undefined;
|
|
125
|
-
'x-component-props'?: Record<string, any> | undefined;
|
|
126
|
-
'x-decorator'?: string | undefined;
|
|
127
|
-
'x-decorator-props'?: {
|
|
128
|
-
[x: string]: any;
|
|
129
249
|
} | undefined;
|
|
130
250
|
}[]>;
|
|
131
251
|
getSchema(): {
|
|
@@ -136,13 +256,7 @@ export declare class FormSchema {
|
|
|
136
256
|
};
|
|
137
257
|
getFieldList(): Field[];
|
|
138
258
|
clearFields(): never[];
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
* 将 schema 对象格式还原为数组格式
|
|
142
|
-
* @param schema schema 对象
|
|
143
|
-
* @returns FieldSchema[] 数组格式
|
|
144
|
-
*/
|
|
145
|
-
private schemaToJson;
|
|
146
|
-
setFields(schema: Record<string, any>): void;
|
|
259
|
+
setFields(schema: FieldSchema[]): void;
|
|
260
|
+
private jsonToSchema;
|
|
147
261
|
private omit;
|
|
148
262
|
}
|
|
@@ -4,7 +4,14 @@ import { LifeCycleInstance } from './effects/types';
|
|
|
4
4
|
import { Plugin } from './plugins';
|
|
5
5
|
export type { ExpandPropsType } from './components/types';
|
|
6
6
|
export type PluginInterface = InstanceType<typeof Plugin>;
|
|
7
|
-
export declare const valueTypeMap:
|
|
7
|
+
export declare const valueTypeMap: {
|
|
8
|
+
readonly string: "string";
|
|
9
|
+
readonly number: "number";
|
|
10
|
+
readonly boolean: "boolean";
|
|
11
|
+
readonly object: "object";
|
|
12
|
+
readonly array: "array";
|
|
13
|
+
readonly void: "void";
|
|
14
|
+
};
|
|
8
15
|
export type valueType = keyof typeof valueTypeMap;
|
|
9
16
|
export interface FormProps {
|
|
10
17
|
layout: 'horizontal' | 'vertical';
|
|
@@ -13,51 +20,51 @@ export interface FormProps {
|
|
|
13
20
|
}
|
|
14
21
|
export interface BaseFieldSchema {
|
|
15
22
|
'type': valueType;
|
|
16
|
-
'format'?:
|
|
17
|
-
'title'?: string;
|
|
23
|
+
'format'?: JSONSchemaFormat;
|
|
18
24
|
'name'?: string;
|
|
25
|
+
'enum'?: any[];
|
|
26
|
+
'required'?: boolean;
|
|
27
|
+
'properties'?: Record<string, BaseFieldSchema>;
|
|
28
|
+
'items'?: BaseFieldSchema | BaseFieldSchema[];
|
|
19
29
|
'x-component'?: string;
|
|
20
30
|
'x-component-props'?: Record<string, any>;
|
|
21
31
|
'x-decorator'?: string;
|
|
22
|
-
'
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
'x-decorator-props'?: {
|
|
33
|
+
[x: string]: any;
|
|
34
|
+
};
|
|
25
35
|
'x-reactions'?: {
|
|
26
|
-
dependencies?:
|
|
36
|
+
dependencies?: Array<{
|
|
37
|
+
property: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
source: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}>;
|
|
27
42
|
fulfill?: {
|
|
28
43
|
state?: Record<string, any>;
|
|
29
44
|
};
|
|
30
45
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'format'?: string;
|
|
39
|
-
'items'?: BaseFieldSchema | BaseFieldSchema[];
|
|
40
|
-
'properties'?: Record<string, BaseFieldSchema>;
|
|
41
|
-
'children'?: FieldSchema[];
|
|
42
|
-
'required'?: boolean;
|
|
43
|
-
'id'?: string;
|
|
44
|
-
'name'?: string;
|
|
45
|
-
'icon'?: string | VNode;
|
|
46
|
+
'x-validator'?: Array<{
|
|
47
|
+
validator?: string;
|
|
48
|
+
required?: boolean;
|
|
49
|
+
message?: string;
|
|
50
|
+
pattern?: string | RegExp;
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
}> | string;
|
|
46
53
|
'x-design-props'?: {
|
|
47
|
-
|
|
54
|
+
validate?: {
|
|
48
55
|
status: 'success' | 'error' | 'warning' | '';
|
|
49
56
|
message: string;
|
|
50
57
|
};
|
|
51
|
-
'convert-key'?: 'items' | 'properties';
|
|
52
|
-
'convert-type'?: 'base' | 'object' | 'array';
|
|
53
|
-
[x: string]: any;
|
|
54
|
-
};
|
|
55
|
-
'x-component-props'?: Record<string, any>;
|
|
56
|
-
'x-decorator'?: string;
|
|
57
|
-
'x-decorator-props'?: {
|
|
58
58
|
[x: string]: any;
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
export interface FieldSchema extends BaseFieldSchema {
|
|
62
|
+
title?: string;
|
|
63
|
+
key?: string;
|
|
64
|
+
id?: string;
|
|
65
|
+
children?: FieldSchema[];
|
|
66
|
+
icon?: string | VNode;
|
|
67
|
+
}
|
|
61
68
|
export interface TemplateSchema {
|
|
62
69
|
name: string;
|
|
63
70
|
key: string;
|
|
@@ -110,3 +117,7 @@ export interface DragPutType {
|
|
|
110
117
|
traget: FieldSchema[];
|
|
111
118
|
region: 'form-panel' | 'k-array-card' | 'k-object' | 'k-table' | 'k-grid';
|
|
112
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* JSON Schema 预定义的格式
|
|
122
|
+
*/
|
|
123
|
+
type JSONSchemaFormat = 'date-time' | 'date' | 'time' | 'duration' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'iri-reference' | 'uri-template' | 'uuid' | 'json-pointer' | 'relative-json-pointer' | 'regex' | string;
|