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