@faasjs/ant-design 0.0.2-beta.359 → 0.0.2-beta.363
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 +519 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +19 -4
- package/dist/index.mjs +27 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -38,3 +38,522 @@ Form are based on [Ant Design's Form component](https://ant.design/components/fo
|
|
|
38
38
|
Form are based on [Ant Design's Form.Item component](https://ant.design/components/form/#Form.Item).
|
|
39
39
|
|
|
40
40
|
<iframe src="https://codesandbox.io/embed/faasjs-ant-design-formitem-olqg5" style="width:100%;height:500px;border:0;overflow:hidden;" title="faasjs-ant-design-formitem" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
|
|
41
|
+
|
|
42
|
+
## Modules
|
|
43
|
+
|
|
44
|
+
### Namespaces
|
|
45
|
+
|
|
46
|
+
- [Form](modules/Form.md)
|
|
47
|
+
|
|
48
|
+
### Type aliases
|
|
49
|
+
|
|
50
|
+
- [BaseItemProps](#baseitemprops)
|
|
51
|
+
- [BaseOption](#baseoption)
|
|
52
|
+
- [BlankProps](#blankprops)
|
|
53
|
+
- [DescriptionItemProps](#descriptionitemprops)
|
|
54
|
+
- [DescriptionProps](#descriptionprops)
|
|
55
|
+
- [DrawerProps](#drawerprops)
|
|
56
|
+
- [ExtendDescriptionItemProps](#extenddescriptionitemprops)
|
|
57
|
+
- [ExtendDescriptionTypeProps](#extenddescriptiontypeprops)
|
|
58
|
+
- [ExtendFormItemProps](#extendformitemprops)
|
|
59
|
+
- [ExtendFormTypeProps](#extendformtypeprops)
|
|
60
|
+
- [ExtendTableItemProps](#extendtableitemprops)
|
|
61
|
+
- [ExtendTableTypeProps](#extendtabletypeprops)
|
|
62
|
+
- [FaasItemProps](#faasitemprops)
|
|
63
|
+
- [FaasItemType](#faasitemtype)
|
|
64
|
+
- [FaasItemTypeValue](#faasitemtypevalue)
|
|
65
|
+
- [FaasState](#faasstate)
|
|
66
|
+
- [FormItemProps](#formitemprops)
|
|
67
|
+
- [FormProps](#formprops)
|
|
68
|
+
- [RoutesProps](#routesprops)
|
|
69
|
+
- [TableItemProps](#tableitemprops)
|
|
70
|
+
- [TableProps](#tableprops)
|
|
71
|
+
- [TitleProps](#titleprops)
|
|
72
|
+
|
|
73
|
+
### Functions
|
|
74
|
+
|
|
75
|
+
- [Blank](#blank)
|
|
76
|
+
- [Config](#config)
|
|
77
|
+
- [Description](#description)
|
|
78
|
+
- [Form](#form)
|
|
79
|
+
- [FormItem](#formitem)
|
|
80
|
+
- [Routes](#routes)
|
|
81
|
+
- [Table](#table)
|
|
82
|
+
- [Title](#title)
|
|
83
|
+
- [transferOptions](#transferoptions)
|
|
84
|
+
- [useDrawer](#usedrawer)
|
|
85
|
+
- [useFaasState](#usefaasstate)
|
|
86
|
+
|
|
87
|
+
## Type aliases
|
|
88
|
+
|
|
89
|
+
### BaseItemProps
|
|
90
|
+
|
|
91
|
+
Ƭ **BaseItemProps**: `Object`
|
|
92
|
+
|
|
93
|
+
#### Type declaration
|
|
94
|
+
|
|
95
|
+
| Name | Type |
|
|
96
|
+
| :------ | :------ |
|
|
97
|
+
| `id` | `string` |
|
|
98
|
+
| `options?` | [`BaseOption`](#baseoption)[] |
|
|
99
|
+
| `title?` | `string` |
|
|
100
|
+
|
|
101
|
+
___
|
|
102
|
+
|
|
103
|
+
### BaseOption
|
|
104
|
+
|
|
105
|
+
Ƭ **BaseOption**: `string` \| `number` \| { `label`: `string` ; `value?`: `string` \| `number` }
|
|
106
|
+
|
|
107
|
+
___
|
|
108
|
+
|
|
109
|
+
### BlankProps
|
|
110
|
+
|
|
111
|
+
Ƭ **BlankProps**: `Object`
|
|
112
|
+
|
|
113
|
+
#### Type declaration
|
|
114
|
+
|
|
115
|
+
| Name | Type |
|
|
116
|
+
| :------ | :------ |
|
|
117
|
+
| `text?` | `string` |
|
|
118
|
+
| `value?` | `any` |
|
|
119
|
+
|
|
120
|
+
___
|
|
121
|
+
|
|
122
|
+
### DescriptionItemProps
|
|
123
|
+
|
|
124
|
+
Ƭ **DescriptionItemProps**<`T`\>: { `children?`: `JSX.Element` ; `render?`: (`value`: `T`, `values`: `any`) => `string` \| `number` \| `boolean` \| `Element` } & [`FaasItemProps`](#faasitemprops)
|
|
125
|
+
|
|
126
|
+
#### Type parameters
|
|
127
|
+
|
|
128
|
+
| Name | Type |
|
|
129
|
+
| :------ | :------ |
|
|
130
|
+
| `T` | `any` |
|
|
131
|
+
|
|
132
|
+
___
|
|
133
|
+
|
|
134
|
+
### DescriptionProps
|
|
135
|
+
|
|
136
|
+
Ƭ **DescriptionProps**<`T`, `ExtendItemProps`\>: { `dataSource?`: `T` ; `extendTypes?`: { [key: string]: [`ExtendDescriptionTypeProps`](#extenddescriptiontypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`DescriptionItemProps`](#descriptionitemprops) \| `ExtendItemProps`)[] } & `DescriptionsProps`
|
|
137
|
+
|
|
138
|
+
#### Type parameters
|
|
139
|
+
|
|
140
|
+
| Name | Type |
|
|
141
|
+
| :------ | :------ |
|
|
142
|
+
| `T` | `any` |
|
|
143
|
+
| `ExtendItemProps` | `any` |
|
|
144
|
+
|
|
145
|
+
___
|
|
146
|
+
|
|
147
|
+
### DrawerProps
|
|
148
|
+
|
|
149
|
+
Ƭ **DrawerProps**: `AntdDrawerProps` & { `children?`: `JSX.Element` \| `JSX.Element`[] }
|
|
150
|
+
|
|
151
|
+
___
|
|
152
|
+
|
|
153
|
+
### ExtendDescriptionItemProps
|
|
154
|
+
|
|
155
|
+
Ƭ **ExtendDescriptionItemProps**: [`BaseItemProps`](#baseitemprops)
|
|
156
|
+
|
|
157
|
+
___
|
|
158
|
+
|
|
159
|
+
### ExtendDescriptionTypeProps
|
|
160
|
+
|
|
161
|
+
Ƭ **ExtendDescriptionTypeProps**: `Object`
|
|
162
|
+
|
|
163
|
+
#### Type declaration
|
|
164
|
+
|
|
165
|
+
| Name | Type |
|
|
166
|
+
| :------ | :------ |
|
|
167
|
+
| `children?` | `JSX.Element` \| ``null`` |
|
|
168
|
+
| `render?` | (`value`: `any`, `values`: `any`) => `string` \| `number` \| `boolean` \| `Element` |
|
|
169
|
+
|
|
170
|
+
___
|
|
171
|
+
|
|
172
|
+
### ExtendFormItemProps
|
|
173
|
+
|
|
174
|
+
Ƭ **ExtendFormItemProps**: [`BaseItemProps`](#baseitemprops) & `AntdFormItemProps`
|
|
175
|
+
|
|
176
|
+
___
|
|
177
|
+
|
|
178
|
+
### ExtendFormTypeProps
|
|
179
|
+
|
|
180
|
+
Ƭ **ExtendFormTypeProps**: `Object`
|
|
181
|
+
|
|
182
|
+
#### Type declaration
|
|
183
|
+
|
|
184
|
+
| Name | Type |
|
|
185
|
+
| :------ | :------ |
|
|
186
|
+
| `children?` | `JSX.Element` \| ``null`` |
|
|
187
|
+
|
|
188
|
+
___
|
|
189
|
+
|
|
190
|
+
### ExtendTableItemProps
|
|
191
|
+
|
|
192
|
+
Ƭ **ExtendTableItemProps**<`T`\>: [`BaseItemProps`](#baseitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
|
|
193
|
+
|
|
194
|
+
#### Type parameters
|
|
195
|
+
|
|
196
|
+
| Name | Type |
|
|
197
|
+
| :------ | :------ |
|
|
198
|
+
| `T` | `any` |
|
|
199
|
+
|
|
200
|
+
___
|
|
201
|
+
|
|
202
|
+
### ExtendTableTypeProps
|
|
203
|
+
|
|
204
|
+
Ƭ **ExtendTableTypeProps**: `Object`
|
|
205
|
+
|
|
206
|
+
#### Type declaration
|
|
207
|
+
|
|
208
|
+
| Name | Type |
|
|
209
|
+
| :------ | :------ |
|
|
210
|
+
| `children?` | `JSX.Element` \| ``null`` |
|
|
211
|
+
| `render?` | (`value`: `any`, `values`: `any`, `index`: `number`) => `string` \| `number` \| `boolean` \| `Element` |
|
|
212
|
+
|
|
213
|
+
___
|
|
214
|
+
|
|
215
|
+
### FaasItemProps
|
|
216
|
+
|
|
217
|
+
Ƭ **FaasItemProps**: [`BaseItemProps`](#baseitemprops) & { `type?`: [`FaasItemType`](#faasitemtype) }
|
|
218
|
+
|
|
219
|
+
___
|
|
220
|
+
|
|
221
|
+
### FaasItemType
|
|
222
|
+
|
|
223
|
+
Ƭ **FaasItemType**: ``"string"`` \| ``"string[]"`` \| ``"number"`` \| ``"number[]"`` \| ``"boolean"``
|
|
224
|
+
|
|
225
|
+
___
|
|
226
|
+
|
|
227
|
+
### FaasItemTypeValue
|
|
228
|
+
|
|
229
|
+
Ƭ **FaasItemTypeValue**: `Object`
|
|
230
|
+
|
|
231
|
+
#### Type declaration
|
|
232
|
+
|
|
233
|
+
| Name | Type |
|
|
234
|
+
| :------ | :------ |
|
|
235
|
+
| `boolean` | `boolean` |
|
|
236
|
+
| `number` | `number` |
|
|
237
|
+
| `number[]` | `number`[] |
|
|
238
|
+
| `string` | `string` |
|
|
239
|
+
| `string[]` | `string`[] |
|
|
240
|
+
|
|
241
|
+
___
|
|
242
|
+
|
|
243
|
+
### FaasState
|
|
244
|
+
|
|
245
|
+
Ƭ **FaasState**: `Object`
|
|
246
|
+
|
|
247
|
+
#### Type declaration
|
|
248
|
+
|
|
249
|
+
| Name | Type |
|
|
250
|
+
| :------ | :------ |
|
|
251
|
+
| `Blank` | `Object` |
|
|
252
|
+
| `Blank.text` | `string` |
|
|
253
|
+
| `Form` | `Object` |
|
|
254
|
+
| `Form.submit` | `Object` |
|
|
255
|
+
| `Form.submit.text` | `string` |
|
|
256
|
+
| `Title` | `Object` |
|
|
257
|
+
| `Title.separator` | `string` |
|
|
258
|
+
| `Title.suffix` | `string` |
|
|
259
|
+
| `common` | `Object` |
|
|
260
|
+
| `common.all` | `string` |
|
|
261
|
+
| `common.blank` | `string` |
|
|
262
|
+
| `common.pageNotFound` | `string` |
|
|
263
|
+
| `common.submit` | `string` |
|
|
264
|
+
|
|
265
|
+
___
|
|
266
|
+
|
|
267
|
+
### FormItemProps
|
|
268
|
+
|
|
269
|
+
Ƭ **FormItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `extendTypes?`: { [type: string]: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `label?`: `string` \| ``false`` ; `rules?`: `RuleObject`[] ; `render?`: () => `Element` } & `FormItemInputProps`<`T`\> & [`FaasItemProps`](#faasitemprops) & `AntdFormItemProps`<`T`\>
|
|
270
|
+
|
|
271
|
+
#### Type parameters
|
|
272
|
+
|
|
273
|
+
| Name | Type |
|
|
274
|
+
| :------ | :------ |
|
|
275
|
+
| `T` | `any` |
|
|
276
|
+
|
|
277
|
+
___
|
|
278
|
+
|
|
279
|
+
### FormProps
|
|
280
|
+
|
|
281
|
+
Ƭ **FormProps**<`Values`, `ExtendItemProps`\>: { `extendTypes?`: { [type: string]: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `items?`: ([`FormItemProps`](#formitemprops) \| `ExtendItemProps`)[] ; `submit?`: ``false`` \| { `text?`: `string` } } & `AntdFormProps`<`Values`\>
|
|
282
|
+
|
|
283
|
+
#### Type parameters
|
|
284
|
+
|
|
285
|
+
| Name | Type |
|
|
286
|
+
| :------ | :------ |
|
|
287
|
+
| `Values` | `any` |
|
|
288
|
+
| `ExtendItemProps` | `any` |
|
|
289
|
+
|
|
290
|
+
___
|
|
291
|
+
|
|
292
|
+
### RoutesProps
|
|
293
|
+
|
|
294
|
+
Ƭ **RoutesProps**: `Object`
|
|
295
|
+
|
|
296
|
+
#### Type declaration
|
|
297
|
+
|
|
298
|
+
| Name | Type |
|
|
299
|
+
| :------ | :------ |
|
|
300
|
+
| `fallback?` | `JSX.Element` |
|
|
301
|
+
| `notFound?` | `JSX.Element` |
|
|
302
|
+
| `routes` | `RouteProps` & { `page?`: `LazyExoticComponent`<`ComponentType`<`any`\>\> }[] |
|
|
303
|
+
|
|
304
|
+
___
|
|
305
|
+
|
|
306
|
+
### TableItemProps
|
|
307
|
+
|
|
308
|
+
Ƭ **TableItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` } & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
|
|
309
|
+
|
|
310
|
+
#### Type parameters
|
|
311
|
+
|
|
312
|
+
| Name | Type |
|
|
313
|
+
| :------ | :------ |
|
|
314
|
+
| `T` | `any` |
|
|
315
|
+
|
|
316
|
+
___
|
|
317
|
+
|
|
318
|
+
### TableProps
|
|
319
|
+
|
|
320
|
+
Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { [key: string]: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`TableItemProps`](#tableitemprops) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`<`string`, `FilterValue`\>, `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[], `extra`: `TableCurrentDataSource`<`T`\>) => { `extra`: `TableCurrentDataSource`<`T`\> ; `filters`: `Record`<`string`, `FilterValue` \| ``null``\> ; `pagination`: `TablePaginationConfig` ; `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[] } } & `AntdTableProps`<`T`\>
|
|
321
|
+
|
|
322
|
+
#### Type parameters
|
|
323
|
+
|
|
324
|
+
| Name | Type |
|
|
325
|
+
| :------ | :------ |
|
|
326
|
+
| `T` | `any` |
|
|
327
|
+
| `ExtendTypes` | `any` |
|
|
328
|
+
|
|
329
|
+
___
|
|
330
|
+
|
|
331
|
+
### TitleProps
|
|
332
|
+
|
|
333
|
+
Ƭ **TitleProps**: `Object`
|
|
334
|
+
|
|
335
|
+
#### Type declaration
|
|
336
|
+
|
|
337
|
+
| Name | Type | Description |
|
|
338
|
+
| :------ | :------ | :------ |
|
|
339
|
+
| `separator?` | `string` | ` - ` as default |
|
|
340
|
+
| `suffix?` | `string` | - |
|
|
341
|
+
| `title` | `string` \| `string`[] | - |
|
|
342
|
+
|
|
343
|
+
## Functions
|
|
344
|
+
|
|
345
|
+
### Blank
|
|
346
|
+
|
|
347
|
+
▸ **Blank**(`options?`): `any`
|
|
348
|
+
|
|
349
|
+
If value is undefined or null, return text, otherwise return value.
|
|
350
|
+
|
|
351
|
+
#### Parameters
|
|
352
|
+
|
|
353
|
+
| Name | Type |
|
|
354
|
+
| :------ | :------ |
|
|
355
|
+
| `options?` | [`BlankProps`](#blankprops) |
|
|
356
|
+
|
|
357
|
+
#### Returns
|
|
358
|
+
|
|
359
|
+
`any`
|
|
360
|
+
|
|
361
|
+
```ts
|
|
362
|
+
<Blank value={undefined} text="Empty" />
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
___
|
|
366
|
+
|
|
367
|
+
### Config
|
|
368
|
+
|
|
369
|
+
▸ **Config**(`props`): `JSX.Element`
|
|
370
|
+
|
|
371
|
+
Config for all @faasjs/ant-design components.
|
|
372
|
+
|
|
373
|
+
#### Parameters
|
|
374
|
+
|
|
375
|
+
| Name | Type |
|
|
376
|
+
| :------ | :------ |
|
|
377
|
+
| `props` | `Object` |
|
|
378
|
+
| `props.config` | `Partial`<[`FaasState`](#faasstate)\> |
|
|
379
|
+
|
|
380
|
+
#### Returns
|
|
381
|
+
|
|
382
|
+
`JSX.Element`
|
|
383
|
+
|
|
384
|
+
```ts
|
|
385
|
+
<Config config={{
|
|
386
|
+
common: {
|
|
387
|
+
blank: '空',
|
|
388
|
+
},
|
|
389
|
+
}} />
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
___
|
|
393
|
+
|
|
394
|
+
### Description
|
|
395
|
+
|
|
396
|
+
▸ **Description**<`T`\>(`props`): `Element`
|
|
397
|
+
|
|
398
|
+
#### Type parameters
|
|
399
|
+
|
|
400
|
+
| Name | Type |
|
|
401
|
+
| :------ | :------ |
|
|
402
|
+
| `T` | `any` |
|
|
403
|
+
|
|
404
|
+
#### Parameters
|
|
405
|
+
|
|
406
|
+
| Name | Type |
|
|
407
|
+
| :------ | :------ |
|
|
408
|
+
| `props` | [`DescriptionProps`](#descriptionprops)<`T`, `any`\> |
|
|
409
|
+
|
|
410
|
+
#### Returns
|
|
411
|
+
|
|
412
|
+
`Element`
|
|
413
|
+
|
|
414
|
+
___
|
|
415
|
+
|
|
416
|
+
### Form
|
|
417
|
+
|
|
418
|
+
▸ **Form**<`Values`\>(`props`): `Element`
|
|
419
|
+
|
|
420
|
+
#### Type parameters
|
|
421
|
+
|
|
422
|
+
| Name | Type |
|
|
423
|
+
| :------ | :------ |
|
|
424
|
+
| `Values` | `any` |
|
|
425
|
+
|
|
426
|
+
#### Parameters
|
|
427
|
+
|
|
428
|
+
| Name | Type |
|
|
429
|
+
| :------ | :------ |
|
|
430
|
+
| `props` | [`FormProps`](#formprops)<`Values`, `any`\> |
|
|
431
|
+
|
|
432
|
+
#### Returns
|
|
433
|
+
|
|
434
|
+
`Element`
|
|
435
|
+
|
|
436
|
+
___
|
|
437
|
+
|
|
438
|
+
### FormItem
|
|
439
|
+
|
|
440
|
+
▸ **FormItem**<`T`\>(`props`): `Element`
|
|
441
|
+
|
|
442
|
+
#### Type parameters
|
|
443
|
+
|
|
444
|
+
| Name | Type |
|
|
445
|
+
| :------ | :------ |
|
|
446
|
+
| `T` | `any` |
|
|
447
|
+
|
|
448
|
+
#### Parameters
|
|
449
|
+
|
|
450
|
+
| Name | Type |
|
|
451
|
+
| :------ | :------ |
|
|
452
|
+
| `props` | [`FormItemProps`](#formitemprops)<`T`\> |
|
|
453
|
+
|
|
454
|
+
#### Returns
|
|
455
|
+
|
|
456
|
+
`Element`
|
|
457
|
+
|
|
458
|
+
___
|
|
459
|
+
|
|
460
|
+
### Routes
|
|
461
|
+
|
|
462
|
+
▸ **Routes**(`props`): `Element`
|
|
463
|
+
|
|
464
|
+
#### Parameters
|
|
465
|
+
|
|
466
|
+
| Name | Type |
|
|
467
|
+
| :------ | :------ |
|
|
468
|
+
| `props` | [`RoutesProps`](#routesprops) |
|
|
469
|
+
|
|
470
|
+
#### Returns
|
|
471
|
+
|
|
472
|
+
`Element`
|
|
473
|
+
|
|
474
|
+
___
|
|
475
|
+
|
|
476
|
+
### Table
|
|
477
|
+
|
|
478
|
+
▸ **Table**<`T`, `ExtendTypes`\>(`props`): `Element`
|
|
479
|
+
|
|
480
|
+
#### Type parameters
|
|
481
|
+
|
|
482
|
+
| Name | Type |
|
|
483
|
+
| :------ | :------ |
|
|
484
|
+
| `T` | `any` |
|
|
485
|
+
| `ExtendTypes` | `any` |
|
|
486
|
+
|
|
487
|
+
#### Parameters
|
|
488
|
+
|
|
489
|
+
| Name | Type |
|
|
490
|
+
| :------ | :------ |
|
|
491
|
+
| `props` | [`TableProps`](#tableprops)<`T`, `ExtendTypes`\> |
|
|
492
|
+
|
|
493
|
+
#### Returns
|
|
494
|
+
|
|
495
|
+
`Element`
|
|
496
|
+
|
|
497
|
+
___
|
|
498
|
+
|
|
499
|
+
### Title
|
|
500
|
+
|
|
501
|
+
▸ **Title**(`props`): `JSX.Element`
|
|
502
|
+
|
|
503
|
+
#### Parameters
|
|
504
|
+
|
|
505
|
+
| Name | Type |
|
|
506
|
+
| :------ | :------ |
|
|
507
|
+
| `props` | [`TitleProps`](#titleprops) |
|
|
508
|
+
|
|
509
|
+
#### Returns
|
|
510
|
+
|
|
511
|
+
`JSX.Element`
|
|
512
|
+
|
|
513
|
+
___
|
|
514
|
+
|
|
515
|
+
### transferOptions
|
|
516
|
+
|
|
517
|
+
▸ **transferOptions**(`options`): { `label`: `string` ; `value?`: `string` \| `number` }[]
|
|
518
|
+
|
|
519
|
+
#### Parameters
|
|
520
|
+
|
|
521
|
+
| Name | Type |
|
|
522
|
+
| :------ | :------ |
|
|
523
|
+
| `options` | [`BaseOption`](#baseoption)[] |
|
|
524
|
+
|
|
525
|
+
#### Returns
|
|
526
|
+
|
|
527
|
+
{ `label`: `string` ; `value?`: `string` \| `number` }[]
|
|
528
|
+
|
|
529
|
+
___
|
|
530
|
+
|
|
531
|
+
### useDrawer
|
|
532
|
+
|
|
533
|
+
▸ **useDrawer**(`init?`): `Object`
|
|
534
|
+
|
|
535
|
+
#### Parameters
|
|
536
|
+
|
|
537
|
+
| Name | Type |
|
|
538
|
+
| :------ | :------ |
|
|
539
|
+
| `init?` | [`DrawerProps`](#drawerprops) |
|
|
540
|
+
|
|
541
|
+
#### Returns
|
|
542
|
+
|
|
543
|
+
`Object`
|
|
544
|
+
|
|
545
|
+
| Name | Type |
|
|
546
|
+
| :------ | :------ |
|
|
547
|
+
| `drawer` | `Element` |
|
|
548
|
+
| `drawerProps` | [`DrawerProps`](#drawerprops) |
|
|
549
|
+
| `setDrawerProps` | (`changes`: `Partial`<[`DrawerProps`](#drawerprops)\>) => `void` |
|
|
550
|
+
|
|
551
|
+
___
|
|
552
|
+
|
|
553
|
+
### useFaasState
|
|
554
|
+
|
|
555
|
+
▸ `Const` **useFaasState**(): [[`FaasState`](#faasstate), (`state`: `IHookStateSetAction`<[`FaasState`](#faasstate)\>) => `void`]
|
|
556
|
+
|
|
557
|
+
#### Returns
|
|
558
|
+
|
|
559
|
+
[[`FaasState`](#faasstate), (`state`: `IHookStateSetAction`<[`FaasState`](#faasstate)\>) => `void`]
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import * as react_use_lib_misc_hookState from 'react-use/lib/misc/hookState';
|
|
2
|
-
import { DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, FormProps as FormProps$1, TableColumnProps, TableProps as TableProps$1 } from 'antd';
|
|
2
|
+
import { DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, FormProps as FormProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
|
|
3
3
|
export { Drawer } from 'antd';
|
|
4
4
|
import { FaasDataWrapperProps } from '@faasjs/react';
|
|
5
5
|
import * as antd_lib_form_Form from 'antd/lib/form/Form';
|
|
6
6
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
7
7
|
import { LazyExoticComponent, ComponentType } from 'react';
|
|
8
8
|
import { RouteProps } from 'react-router-dom';
|
|
9
|
+
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/lib/table/interface';
|
|
9
10
|
|
|
10
11
|
declare type BlankProps = {
|
|
11
12
|
value?: any;
|
|
12
13
|
text?: string;
|
|
13
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* If value is undefined or null, return text, otherwise return value.
|
|
17
|
+
*
|
|
18
|
+
* @param options {object}
|
|
19
|
+
* @param options.value {any}
|
|
20
|
+
* @param options.text {string} Default is 'Empty'
|
|
21
|
+
* @returns {JSX.Element}
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* <Blank value={undefined} text="Empty" />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
14
27
|
declare function Blank(options?: BlankProps): any;
|
|
15
28
|
|
|
16
29
|
declare type FaasState = {
|
|
@@ -34,6 +47,20 @@ declare type FaasState = {
|
|
|
34
47
|
};
|
|
35
48
|
};
|
|
36
49
|
declare const useFaasState: () => [FaasState, (state: react_use_lib_misc_hookState.IHookStateSetAction<FaasState>) => void];
|
|
50
|
+
/**
|
|
51
|
+
* Config for all @faasjs/ant-design components.
|
|
52
|
+
* @param props {object}
|
|
53
|
+
* @param props.config {Partial<FaasState>}
|
|
54
|
+
* @returns {null}
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* <Config config={{
|
|
58
|
+
* common: {
|
|
59
|
+
* blank: '空',
|
|
60
|
+
* },
|
|
61
|
+
* }} />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
37
64
|
declare function Config(props: {
|
|
38
65
|
config: Partial<FaasState>;
|
|
39
66
|
}): JSX.Element;
|
|
@@ -118,7 +145,7 @@ declare type BooleanProps = {
|
|
|
118
145
|
input?: SwitchProps;
|
|
119
146
|
};
|
|
120
147
|
declare type OptionsProps = {
|
|
121
|
-
options
|
|
148
|
+
options?: BaseOption[];
|
|
122
149
|
type?: 'string' | 'string[]' | 'number' | 'number[]';
|
|
123
150
|
input?: SelectProps<any>;
|
|
124
151
|
};
|
|
@@ -179,6 +206,12 @@ declare type TableProps<T = any, ExtendTypes = any> = {
|
|
|
179
206
|
[key: string]: ExtendTableTypeProps;
|
|
180
207
|
};
|
|
181
208
|
faasData?: FaasDataWrapperProps<T>;
|
|
209
|
+
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
|
|
210
|
+
pagination: TablePaginationConfig;
|
|
211
|
+
filters: Record<string, FilterValue | null>;
|
|
212
|
+
sorter: SorterResult<T> | SorterResult<T>[];
|
|
213
|
+
extra: TableCurrentDataSource<T>;
|
|
214
|
+
};
|
|
182
215
|
} & TableProps$1<T>;
|
|
183
216
|
declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
|
|
184
217
|
|
package/dist/index.js
CHANGED
|
@@ -200,6 +200,9 @@ function Description(props) {
|
|
|
200
200
|
extendTypes: props.extendTypes
|
|
201
201
|
}))));
|
|
202
202
|
return /* @__PURE__ */ import_react.default.createElement(import_react4.FaasDataWrapper, __spreadValues({
|
|
203
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement(import_antd2.Skeleton, {
|
|
204
|
+
active: true
|
|
205
|
+
}),
|
|
203
206
|
render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
|
|
204
207
|
key: item.id,
|
|
205
208
|
label: item.title || (0, import_lodash3.upperFirst)(item.id)
|
|
@@ -306,7 +309,8 @@ function FormItem(props) {
|
|
|
306
309
|
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
|
|
307
310
|
key: field.key
|
|
308
311
|
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
|
|
309
|
-
gutter: 24
|
|
312
|
+
gutter: 24,
|
|
313
|
+
style: { flexFlow: "row nowrap" }
|
|
310
314
|
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
|
|
311
315
|
span: 23
|
|
312
316
|
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
|
|
@@ -348,7 +352,8 @@ function FormItem(props) {
|
|
|
348
352
|
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
|
|
349
353
|
key: field.key
|
|
350
354
|
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
|
|
351
|
-
gutter: 24
|
|
355
|
+
gutter: 24,
|
|
356
|
+
style: { flexFlow: "row nowrap" }
|
|
352
357
|
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
|
|
353
358
|
span: 23
|
|
354
359
|
}, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
|
|
@@ -592,6 +597,9 @@ function Table(props) {
|
|
|
592
597
|
dataSource: props.dataSource
|
|
593
598
|
}));
|
|
594
599
|
return /* @__PURE__ */ import_react.default.createElement(import_react10.FaasDataWrapper, __spreadValues({
|
|
600
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement(import_antd7.Skeleton, {
|
|
601
|
+
active: true
|
|
602
|
+
}),
|
|
595
603
|
render: ({
|
|
596
604
|
data,
|
|
597
605
|
params,
|
|
@@ -615,8 +623,15 @@ function Table(props) {
|
|
|
615
623
|
dataSource: data.rows,
|
|
616
624
|
pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
|
|
617
625
|
onChange: (pagination, filters, sorter, extra) => {
|
|
618
|
-
if (props.onChange)
|
|
619
|
-
props.onChange(pagination, filters, sorter, extra);
|
|
626
|
+
if (props.onChange) {
|
|
627
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
628
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
629
|
+
pagination: processed.pagination,
|
|
630
|
+
filters: processed.filters,
|
|
631
|
+
sorter: processed.sorter
|
|
632
|
+
}));
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
620
635
|
reload(__spreadProps(__spreadValues({}, params), {
|
|
621
636
|
pagination,
|
|
622
637
|
filters,
|
package/dist/index.mjs
CHANGED
|
@@ -78,7 +78,10 @@ function transferOptions(options) {
|
|
|
78
78
|
|
|
79
79
|
// src/Description.tsx
|
|
80
80
|
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
|
|
81
|
-
import {
|
|
81
|
+
import {
|
|
82
|
+
Descriptions,
|
|
83
|
+
Skeleton
|
|
84
|
+
} from "antd";
|
|
82
85
|
import { upperFirst as upperFirst2 } from "lodash";
|
|
83
86
|
import {
|
|
84
87
|
cloneElement,
|
|
@@ -162,6 +165,9 @@ function Description(props) {
|
|
|
162
165
|
extendTypes: props.extendTypes
|
|
163
166
|
}))));
|
|
164
167
|
return /* @__PURE__ */ React.createElement(FaasDataWrapper, __spreadValues({
|
|
168
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement(Skeleton, {
|
|
169
|
+
active: true
|
|
170
|
+
}),
|
|
165
171
|
render: ({ data }) => /* @__PURE__ */ React.createElement(Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
|
|
166
172
|
key: item.id,
|
|
167
173
|
label: item.title || upperFirst2(item.id)
|
|
@@ -280,7 +286,8 @@ function FormItem(props) {
|
|
|
280
286
|
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
|
|
281
287
|
key: field.key
|
|
282
288
|
}, /* @__PURE__ */ React.createElement(Row, {
|
|
283
|
-
gutter: 24
|
|
289
|
+
gutter: 24,
|
|
290
|
+
style: { flexFlow: "row nowrap" }
|
|
284
291
|
}, /* @__PURE__ */ React.createElement(Col, {
|
|
285
292
|
span: 23
|
|
286
293
|
}, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
|
|
@@ -322,7 +329,8 @@ function FormItem(props) {
|
|
|
322
329
|
}, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
|
|
323
330
|
key: field.key
|
|
324
331
|
}, /* @__PURE__ */ React.createElement(Row, {
|
|
325
|
-
gutter: 24
|
|
332
|
+
gutter: 24,
|
|
333
|
+
style: { flexFlow: "row nowrap" }
|
|
326
334
|
}, /* @__PURE__ */ React.createElement(Col, {
|
|
327
335
|
span: 23
|
|
328
336
|
}, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
|
|
@@ -390,7 +398,7 @@ Form.useForm = AntdForm2.useForm;
|
|
|
390
398
|
Form.Item = FormItem;
|
|
391
399
|
|
|
392
400
|
// src/Routers.tsx
|
|
393
|
-
import { Result, Skeleton } from "antd";
|
|
401
|
+
import { Result, Skeleton as Skeleton2 } from "antd";
|
|
394
402
|
import {
|
|
395
403
|
Suspense
|
|
396
404
|
} from "react";
|
|
@@ -412,7 +420,7 @@ function Routes(props) {
|
|
|
412
420
|
element: r.element || /* @__PURE__ */ React.createElement(Suspense, {
|
|
413
421
|
fallback: props.fallback || /* @__PURE__ */ React.createElement("div", {
|
|
414
422
|
style: { padding: "24px" }
|
|
415
|
-
}, /* @__PURE__ */ React.createElement(
|
|
423
|
+
}, /* @__PURE__ */ React.createElement(Skeleton2, {
|
|
416
424
|
active: true
|
|
417
425
|
}))
|
|
418
426
|
}, /* @__PURE__ */ React.createElement(r.page, null))
|
|
@@ -431,7 +439,8 @@ import {
|
|
|
431
439
|
} from "react";
|
|
432
440
|
import {
|
|
433
441
|
Table as AntdTable,
|
|
434
|
-
Radio
|
|
442
|
+
Radio,
|
|
443
|
+
Skeleton as Skeleton3
|
|
435
444
|
} from "antd";
|
|
436
445
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
437
446
|
import { isNil as isNil2, upperFirst as upperFirst4 } from "lodash";
|
|
@@ -578,6 +587,9 @@ function Table(props) {
|
|
|
578
587
|
dataSource: props.dataSource
|
|
579
588
|
}));
|
|
580
589
|
return /* @__PURE__ */ React.createElement(FaasDataWrapper2, __spreadValues({
|
|
590
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement(Skeleton3, {
|
|
591
|
+
active: true
|
|
592
|
+
}),
|
|
581
593
|
render: ({
|
|
582
594
|
data,
|
|
583
595
|
params,
|
|
@@ -601,8 +613,15 @@ function Table(props) {
|
|
|
601
613
|
dataSource: data.rows,
|
|
602
614
|
pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
|
|
603
615
|
onChange: (pagination, filters, sorter, extra) => {
|
|
604
|
-
if (props.onChange)
|
|
605
|
-
props.onChange(pagination, filters, sorter, extra);
|
|
616
|
+
if (props.onChange) {
|
|
617
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
618
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
619
|
+
pagination: processed.pagination,
|
|
620
|
+
filters: processed.filters,
|
|
621
|
+
sorter: processed.sorter
|
|
622
|
+
}));
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
606
625
|
reload(__spreadProps(__spreadValues({}, params), {
|
|
607
626
|
pagination,
|
|
608
627
|
filters,
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.363",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"homepage": "https://faasjs.com/doc/ant-design
|
|
8
|
+
"homepage": "https://faasjs.com/doc/ant-design",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/faasjs/faasjs.git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lodash": "*",
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-dom": "*",
|
|
31
|
-
"@faasjs/react": "^0.0.2-beta.
|
|
31
|
+
"@faasjs/react": "^0.0.2-beta.363",
|
|
32
32
|
"react-use": "*",
|
|
33
33
|
"react-router-dom": "*"
|
|
34
34
|
},
|