@innoways/utils 3.0.0

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.
@@ -0,0 +1,360 @@
1
+ /**
2
+ * 测试数据
3
+ */
4
+ export const unitedSchema = {
5
+ theme: 'antd',
6
+ validateTime: 'change',
7
+ requiredMode: 'default',
8
+ ui: {
9
+ mode: 'edit',
10
+ title: {
11
+ placement: 'left',
12
+ },
13
+ },
14
+ type: 'object',
15
+ schema: [
16
+ {
17
+ type: 'array',
18
+ fieldKey: 'addSameList',
19
+ title: "列表添加 ['a', 'b', ...]",
20
+ ui: {
21
+ type: 'array',
22
+ },
23
+ items: {
24
+ type: 'string',
25
+ title: '姓名',
26
+ minLength: 2,
27
+ maxLength: 4,
28
+ ui: {
29
+ type: 'input',
30
+ theme: 'custom',
31
+ placeholder: '请输入2-4个字的姓名',
32
+ },
33
+ },
34
+ },
35
+ {
36
+ type: 'array',
37
+ fieldKey: 'tupleItem',
38
+ title: "元组 ['drip', 18]",
39
+ ui: {
40
+ type: 'array',
41
+ },
42
+ items: [
43
+ { type: 'string', title: 'ERP', default: null, ui: { type: 'input' } },
44
+ { type: 'number', title: '年龄', ui: { type: 'number' } },
45
+ ],
46
+ },
47
+ {
48
+ type: 'object',
49
+ fieldKey: 'objectItem',
50
+ title: "普通对象 { erp: 'drip', age: 1,c:{a:1} }",
51
+ ui: {
52
+ type: 'object',
53
+ },
54
+ schema: [
55
+ {
56
+ type: 'string',
57
+ fieldKey: 'erp',
58
+ title: 'ERP',
59
+ ui: { type: 'text' },
60
+ },
61
+ {
62
+ type: 'number',
63
+ fieldKey: 'age',
64
+ title: '年龄',
65
+ ui: { type: 'number' },
66
+ },
67
+ {
68
+ type: 'object',
69
+ fieldKey: 'c',
70
+ title: '二级嵌套{a:1}',
71
+ min: 1,
72
+ ui: { type: 'object' },
73
+ schema: [
74
+ {
75
+ type: 'string',
76
+ fieldKey: 'a',
77
+ title: '二级嵌套a',
78
+ ui: {
79
+ type: 'text',
80
+ },
81
+ },
82
+ ],
83
+ },
84
+ ],
85
+ },
86
+ {
87
+ type: 'array',
88
+ fieldKey: 'nestArray',
89
+ title: "嵌套数组 [{erp: 'drip', age: 1}, {erp: 'jmfe', age: 6}]",
90
+ ui: {
91
+ type: 'array',
92
+ },
93
+ items: {
94
+ type: 'object',
95
+ title: '',
96
+ ui: {
97
+ type: 'object',
98
+ },
99
+ schema: [
100
+ {
101
+ type: 'string',
102
+ fieldKey: 'erp',
103
+ title: 'ERP',
104
+ ui: { type: 'input' },
105
+ },
106
+ {
107
+ type: 'number',
108
+ fieldKey: 'age',
109
+ title: '年龄',
110
+ ui: { type: 'number' },
111
+ maximum: 100,
112
+ minimum: 0,
113
+ },
114
+ ],
115
+ },
116
+ },
117
+ ],
118
+ }
119
+
120
+ /**
121
+ * 验证数据
122
+ */
123
+ export const parsedSchema = {
124
+ uiSchema: {
125
+ mode: 'edit',
126
+ theme: 'antd',
127
+ title: {
128
+ placement: 'left',
129
+ },
130
+ order: ['addSameList', 'tupleItem', 'objectItem', 'nestArray'],
131
+ properties: {
132
+ addSameList: {
133
+ type: 'array',
134
+ order: ['$container'],
135
+ properties: {
136
+ $container: {
137
+ type: 'input',
138
+ placeholder: '请输入2-4个字的姓名',
139
+ theme: 'custom',
140
+ },
141
+ },
142
+ },
143
+ tupleItem: {
144
+ type: 'array',
145
+ order: ['0', '1'],
146
+ properties: {
147
+ 0: {
148
+ type: 'input',
149
+ },
150
+ 1: {
151
+ type: 'number',
152
+ },
153
+ },
154
+ },
155
+ objectItem: {
156
+ type: 'object',
157
+ order: ['erp', 'age', 'c'],
158
+ properties: {
159
+ erp: {
160
+ type: 'text',
161
+ },
162
+ age: {
163
+ type: 'number',
164
+ },
165
+ c: {
166
+ type: 'object',
167
+ order: ['a'],
168
+ properties: {
169
+ a: {
170
+ type: 'text',
171
+ },
172
+ },
173
+ },
174
+ },
175
+ },
176
+ nestArray: {
177
+ type: 'array',
178
+ order: ['$container'],
179
+ properties: {
180
+ $container: {
181
+ type: 'object',
182
+ order: ['erp', 'age'],
183
+ properties: {
184
+ erp: {
185
+ type: 'input',
186
+ },
187
+ age: {
188
+ type: 'number',
189
+ },
190
+ },
191
+ },
192
+ },
193
+ },
194
+ },
195
+ },
196
+ dataSchema: {
197
+ validateTime: 'change',
198
+ type: 'object',
199
+ requiredMode: 'default',
200
+ properties: {
201
+ addSameList: {
202
+ type: 'array',
203
+ title: "列表添加 ['a', 'b', ...]",
204
+ items: {
205
+ type: 'string',
206
+ title: '姓名',
207
+ minLength: 2,
208
+ maxLength: 4,
209
+ },
210
+ },
211
+ tupleItem: {
212
+ type: 'array',
213
+ title: "元组 ['drip', 18]",
214
+ items: [
215
+ {
216
+ type: 'string',
217
+ title: 'ERP',
218
+ default: null,
219
+ },
220
+ {
221
+ type: 'number',
222
+ title: '年龄',
223
+ },
224
+ ],
225
+ },
226
+ objectItem: {
227
+ type: 'object',
228
+ title: "普通对象 { erp: 'drip', age: 1,c:{a:1} }",
229
+ properties: {
230
+ erp: {
231
+ type: 'string',
232
+ title: 'ERP',
233
+ },
234
+ age: {
235
+ type: 'number',
236
+ title: '年龄',
237
+ },
238
+ c: {
239
+ type: 'object',
240
+ title: '二级嵌套{a:1}',
241
+ min: 1,
242
+ properties: {
243
+ a: {
244
+ type: 'string',
245
+ title: '二级嵌套a',
246
+ },
247
+ },
248
+ },
249
+ },
250
+ },
251
+ nestArray: {
252
+ type: 'array',
253
+ title: "嵌套数组 [{erp: 'drip', age: 1}, {erp: 'jmfe', age: 6}]",
254
+ items: {
255
+ type: 'object',
256
+ title: '',
257
+ properties: {
258
+ erp: {
259
+ type: 'string',
260
+ title: 'ERP',
261
+ },
262
+ age: {
263
+ type: 'number',
264
+ title: '年龄',
265
+ maximum: 100,
266
+ minimum: 0,
267
+ },
268
+ },
269
+ },
270
+ },
271
+ },
272
+ },
273
+ typePath: {
274
+ addSameList: {
275
+ fatherKey: '',
276
+ title: "列表添加 ['a', 'b', ...]",
277
+ type: 'array',
278
+ unitedSchemaKey: 'schema.0',
279
+ },
280
+ 'addSameList.$container': {
281
+ fatherKey: 'addSameList',
282
+ title: '姓名',
283
+ type: 'string',
284
+ unitedSchemaKey: 'schema.0.items',
285
+ },
286
+ tupleItem: {
287
+ title: "元组 ['drip', 18]",
288
+ fatherKey: '',
289
+ type: 'array',
290
+ unitedSchemaKey: 'schema.1',
291
+ },
292
+ 'tupleItem.0': {
293
+ fatherKey: 'tupleItem',
294
+ title: 'ERP',
295
+ type: 'string',
296
+ unitedSchemaKey: 'schema.1.items.0',
297
+ },
298
+ 'tupleItem.1': {
299
+ fatherKey: 'tupleItem',
300
+ title: '年龄',
301
+ type: 'number',
302
+ unitedSchemaKey: 'schema.1.items.1',
303
+ },
304
+ objectItem: {
305
+ fatherKey: '',
306
+ title: "普通对象 { erp: 'drip', age: 1,c:{a:1} }",
307
+ type: 'object',
308
+ unitedSchemaKey: 'schema.2',
309
+ },
310
+ 'objectItem.erp': {
311
+ fatherKey: 'objectItem',
312
+ title: 'ERP',
313
+ type: 'string',
314
+ unitedSchemaKey: 'schema.2.schema.0',
315
+ },
316
+ 'objectItem.age': {
317
+ fatherKey: 'objectItem',
318
+ type: 'number',
319
+ title: '年龄',
320
+ unitedSchemaKey: 'schema.2.schema.1',
321
+ },
322
+ 'objectItem.c': {
323
+ fatherKey: 'objectItem',
324
+ title: '二级嵌套{a:1}',
325
+ type: 'object',
326
+ unitedSchemaKey: 'schema.2.schema.2',
327
+ },
328
+ 'objectItem.c.a': {
329
+ title: '二级嵌套a',
330
+ fatherKey: 'objectItem.c',
331
+ type: 'string',
332
+ unitedSchemaKey: 'schema.2.schema.2.schema.0',
333
+ },
334
+ nestArray: {
335
+ fatherKey: '',
336
+ title: "嵌套数组 [{erp: 'drip', age: 1}, {erp: 'jmfe', age: 6}]",
337
+ type: 'array',
338
+ unitedSchemaKey: 'schema.3',
339
+ },
340
+ 'nestArray.$container': {
341
+ fatherKey: 'nestArray',
342
+ title: '',
343
+ type: 'object',
344
+ unitedSchemaKey: 'schema.3.items',
345
+ },
346
+ 'nestArray.$container.erp': {
347
+ fatherKey: 'nestArray.$container',
348
+ type: 'string',
349
+ title: 'ERP',
350
+ unitedSchemaKey: 'schema.3.items.schema.0',
351
+ },
352
+ 'nestArray.$container.age': {
353
+ fatherKey: 'nestArray.$container',
354
+ title: '年龄',
355
+ type: 'number',
356
+ unitedSchemaKey: 'schema.3.items.schema.1',
357
+ },
358
+ },
359
+ customProps: [],
360
+ }
@@ -0,0 +1,88 @@
1
+ export const unitedSchema = {
2
+ theme: 'antd',
3
+ validateTime: 'submit',
4
+ requiredMode: 'default',
5
+ type: 'object',
6
+ ui: {
7
+ mode: 'edit',
8
+ '$:type': 'drip',
9
+ },
10
+ schema: [
11
+ {
12
+ fieldKey: 'name',
13
+ title: '名字',
14
+ type: 'string',
15
+ requiredMsg: '该项必填',
16
+ ui: {
17
+ type: 'text',
18
+ placeholder: '请输入name,当name1有值时,该表单隐藏',
19
+ description: {
20
+ type: 'icon',
21
+ title: 'hover触发提示',
22
+ trigger: 'hover',
23
+ },
24
+ },
25
+ },
26
+ {
27
+ fieldKey: 'name',
28
+ title: '名字',
29
+ type: 'string',
30
+ requiredMsg: '该项必填',
31
+ ui: {
32
+ type: 'text',
33
+ placeholder: '请输入name,当name1有值时,该表单隐藏',
34
+ description: {
35
+ type: 'icon',
36
+ title: 'hover触发提示',
37
+ trigger: 'hover',
38
+ },
39
+ },
40
+ },
41
+ ],
42
+ }
43
+
44
+ export const parsedSchema = {
45
+ dataSchema: {
46
+ validateTime: 'submit',
47
+ requiredMode: 'default',
48
+ type: 'object',
49
+ properties: {
50
+ name: {
51
+ title: '名字',
52
+ type: 'string',
53
+ },
54
+ },
55
+ required: ['name'],
56
+ errorMessage: {
57
+ required: {
58
+ name: '该项必填',
59
+ },
60
+ },
61
+ },
62
+ uiSchema: {
63
+ theme: 'antd',
64
+ mode: 'edit',
65
+ order: ['name'],
66
+ '$:type': 'drip',
67
+ properties: {
68
+ name: {
69
+ type: 'text',
70
+ placeholder: '请输入name,当name1有值时,该表单隐藏',
71
+ description: {
72
+ type: 'icon',
73
+ title: 'hover触发提示',
74
+ trigger: 'hover',
75
+ },
76
+ },
77
+ },
78
+ },
79
+ typePath: {
80
+ name: {
81
+ fatherKey: '',
82
+ title: '名字',
83
+ type: 'string',
84
+ unitedSchemaKey: 'schema.1',
85
+ },
86
+ },
87
+ customProps: [],
88
+ }
@@ -0,0 +1,35 @@
1
+ export const unitedSchema = {
2
+ type: 'string',
3
+ title: 'Input Box',
4
+ minLength: 1,
5
+ // fieldKey:'a',
6
+ errMsg: {
7
+ minLength: '最小1',
8
+ },
9
+ ui: {
10
+ type: 'text',
11
+ style: { width: '100%' },
12
+ },
13
+ }
14
+
15
+ export const parsedSchema = {
16
+ dataSchema: {
17
+ type: 'string',
18
+ title: 'Input Box',
19
+ minLength: 1,
20
+ errorMessage: {
21
+ minLength: '最小1',
22
+ },
23
+ },
24
+ uiSchema: {
25
+ type: 'text',
26
+ // fieldKey:'a',
27
+ style: { width: '100%' },
28
+ },
29
+ typePath: {
30
+ // type:'string',
31
+ // unitedSchemaKey:'',
32
+ // fatherKey:''
33
+ },
34
+ customProps: [],
35
+ }