@faasjs/ant-design 1.4.2 → 1.6.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.
package/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # @faasjs/ant-design
2
2
 
3
- [![License: MIT](https://img.shields.io/npm/l/@faasjs/browser.svg)](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/browser/LICENSE)
4
- [![NPM Stable Version](https://img.shields.io/npm/v/@faasjs/browser/stable.svg)](https://www.npmjs.com/package/@faasjs/browser)
5
- [![NPM Beta Version](https://img.shields.io/npm/v/@faasjs/browser/beta.svg)](https://www.npmjs.com/package/@faasjs/browser)
6
-
7
3
  UI components based on [FaasJS](https://faasjs.com), [Ant Design](https://ant.design) and [React Router](https://reactrouter.com).
8
4
 
5
+ [![License: MIT](https://img.shields.io/npm/l/@faasjs/ant-design.svg)](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/ant-design/LICENSE)
6
+ [![NPM Version](https://img.shields.io/npm/v/@faasjs/ant-design.svg)](https://www.npmjs.com/package/@faasjs/ant-design)
7
+
9
8
  ## Install
10
9
 
11
10
  ```sh
@@ -31,17 +30,7 @@ type FaasItemProps = {
31
30
  }
32
31
  ```
33
32
 
34
- ### Form
35
-
36
- Form are based on [Ant Design's Form component](https://ant.design/components/form/#Form).
37
-
38
- ### FormItem
39
-
40
- Form are based on [Ant Design's Form.Item component](https://ant.design/components/form/#Form.Item).
41
-
42
- ## Modules
43
-
44
- ### Interfaces
33
+ ## Interfaces
45
34
 
46
35
  - [AppProps](interfaces/AppProps.md)
47
36
  - [BaseItemProps](interfaces/BaseItemProps.md)
@@ -67,1007 +56,56 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
67
56
  - [UnionFaasItemProps](interfaces/UnionFaasItemProps.md)
68
57
  - [useAppProps](interfaces/useAppProps.md)
69
58
 
70
- ### Type Aliases
71
-
72
- - [BaseOption](#baseoption)
73
- - [ExtendDescriptionItemProps](#extenddescriptionitemprops)
74
- - [ExtendFormItemProps](#extendformitemprops)
75
- - [ExtendFormTypeProps](#extendformtypeprops)
76
- - [ExtendTableItemProps](#extendtableitemprops)
77
- - [ExtendTableTypeProps](#extendtabletypeprops)
78
- - [ExtendTypes](#extendtypes)
79
- - [FaasDataInjection](#faasdatainjection)
80
- - [FaasItemType](#faasitemtype)
81
- - [FaasItemTypeValue](#faasitemtypevalue)
82
- - [FormSubmitProps](#formsubmitprops)
83
- - [LoadingProps](#loadingprops)
84
- - [TableProps](#tableprops)
85
- - [UnionFaasItemElement](#unionfaasitemelement)
86
- - [UnionFaasItemInjection](#unionfaasiteminjection)
87
- - [UnionFaasItemRender](#unionfaasitemrender)
88
- - [UnionScene](#unionscene)
89
- - [setDrawerProps](#setdrawerprops)
90
- - [setModalProps](#setmodalprops)
91
-
92
- ### Variables
93
-
94
- - [ConfigContext](#configcontext)
95
-
96
- ### Functions
97
-
98
- - [App](#app)
99
- - [Blank](#blank)
100
- - [ConfigProvider](#configprovider)
101
- - [Description](#description)
102
- - [ErrorBoundary](#errorboundary)
103
- - [FaasDataWrapper](#faasdatawrapper)
104
- - [Form](#form)
105
- - [FormItem](#formitem)
106
- - [Link](#link)
107
- - [Loading](#loading)
108
- - [PageNotFound](#pagenotfound)
109
- - [Routes](#routes)
110
- - [Table](#table)
111
- - [Tabs](#tabs)
112
- - [Title](#title)
113
- - [faas](#faas)
114
- - [transferOptions](#transferoptions)
115
- - [transferValue](#transfervalue)
116
- - [useApp](#useapp)
117
- - [useConfigContext](#useconfigcontext)
118
- - [useDrawer](#usedrawer)
119
- - [useFaas](#usefaas)
120
- - [useModal](#usemodal)
121
-
122
59
  ## Type Aliases
123
60
 
124
- ### BaseOption
125
-
126
- Ƭ **BaseOption**: `string` \| `number` \| \{ `label`: `string` ; `value?`: `any` }
127
-
128
- ___
129
-
130
- ### ExtendDescriptionItemProps
131
-
132
- Ƭ **ExtendDescriptionItemProps**: [`BaseItemProps`](interfaces/BaseItemProps.md)
133
-
134
- ___
135
-
136
- ### ExtendFormItemProps
137
-
138
- Ƭ **ExtendFormItemProps**: [`BaseItemProps`](interfaces/BaseItemProps.md) & `AntdFormItemProps`
139
-
140
- ___
141
-
142
- ### ExtendFormTypeProps
143
-
144
- Ƭ **ExtendFormTypeProps**\<`T`\>: `Object`
145
-
146
- #### Type parameters
147
-
148
- | Name | Type |
149
- | :------ | :------ |
150
- | `T` | `any` |
151
-
152
- #### Type declaration
153
-
154
- | Name | Type |
155
- | :------ | :------ |
156
- | `children?` | [`UnionFaasItemElement`](#unionfaasitemelement)\<`T`\> |
157
-
158
- ___
159
-
160
- ### ExtendTableItemProps
161
-
162
- Ƭ **ExtendTableItemProps**\<`T`\>: [`BaseItemProps`](interfaces/BaseItemProps.md) & `Omit`\<`AntdTableColumnProps`\<`T`\>, ``"children"``\>
163
-
164
- #### Type parameters
165
-
166
- | Name | Type |
167
- | :------ | :------ |
168
- | `T` | `any` |
169
-
170
- ___
171
-
172
- ### ExtendTableTypeProps
173
-
174
- Ƭ **ExtendTableTypeProps**\<`T`\>: `Object`
175
-
176
- #### Type parameters
177
-
178
- | Name | Type |
179
- | :------ | :------ |
180
- | `T` | `any` |
181
-
182
- #### Type declaration
183
-
184
- | Name | Type |
185
- | :------ | :------ |
186
- | `children?` | `JSX.Element` |
187
- | `render?` | [`UnionFaasItemRender`](#unionfaasitemrender)\<`T`\> |
188
-
189
- ___
190
-
191
- ### ExtendTypes
192
-
193
- Ƭ **ExtendTypes**: `Object`
194
-
195
- #### Index signature
196
-
197
- ▪ [type: `string`]: [`ExtendFormTypeProps`](#extendformtypeprops)
198
-
199
- ___
200
-
201
- ### FaasDataInjection
202
-
203
- Ƭ **FaasDataInjection**\<`T`\>: `Partial`\<`OriginFaasDataInjection`\<`T`\>\>
204
-
205
- #### Type parameters
206
-
207
- | Name | Type |
208
- | :------ | :------ |
209
- | `T` | `any` |
210
-
211
- ___
212
-
213
- ### FaasItemType
214
-
215
- Ƭ **FaasItemType**: ``"string"`` \| ``"string[]"`` \| ``"number"`` \| ``"number[]"`` \| ``"boolean"`` \| ``"date"`` \| ``"time"`` \| ``"object"`` \| ``"object[]"``
216
-
217
- ___
218
-
219
- ### FaasItemTypeValue
220
-
221
- Ƭ **FaasItemTypeValue**: `Object`
222
-
223
- FaasItemType's value type
224
-
225
- #### Type declaration
226
-
227
- | Name | Type |
228
- | :------ | :------ |
229
- | `boolean` | `boolean` |
230
- | `date` | `Dayjs` |
231
- | `number` | `number` |
232
- | `number[]` | `number`[] |
233
- | `object` | `any` |
234
- | `object[]` | `any`[] |
235
- | `string` | `string` |
236
- | `string[]` | `string`[] |
237
- | `time` | `Dayjs` |
238
-
239
- ___
240
-
241
- ### FormSubmitProps
242
-
243
- Ƭ **FormSubmitProps**: `Object`
244
-
245
- #### Type declaration
246
-
247
- | Name | Type | Description |
248
- | :------ | :------ | :------ |
249
- | `text?` | `string` | Default: Submit |
250
- | `to?` | \{ `action`: `string` ; `catch?`: (`error`: `any`) => `void` ; `finally?`: () => `void` ; `params?`: `Record`\<`string`, `any`\> ; `then?`: (`result`: `any`) => `void` } | Submit to FaasJS server. If use onFinish, you should call submit manually. ```ts { submit: { to: { action: 'action_name' } }, onFinish: (values, submit) => { // do something before submit // submit await submit({ ...values, extraProps: 'some extra props' }) // do something after submit } } ``` |
251
- | `to.action` | `string` | - |
252
- | `to.catch?` | (`error`: `any`) => `void` | - |
253
- | `to.finally?` | () => `void` | - |
254
- | `to.params?` | `Record`\<`string`, `any`\> | params will overwrite form values before submit |
255
- | `to.then?` | (`result`: `any`) => `void` | - |
256
-
257
- ___
258
-
259
- ### LoadingProps
260
-
261
- Ƭ **LoadingProps**: `Object`
262
-
263
- #### Type declaration
264
-
265
- | Name | Type |
266
- | :------ | :------ |
267
- | `children?` | `React.ReactNode` |
268
- | `loading?` | `boolean` |
269
- | `size?` | ``"small"`` \| ``"default"`` \| ``"large"`` |
270
- | `style?` | `React.CSSProperties` |
271
-
272
- ___
273
-
274
- ### TableProps
275
-
276
- Ƭ **TableProps**\<`T`, `ExtendTypes`\>: \{ `extendTypes?`: \{ `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)\<`T`\> ; `items`: ([`TableItemProps`](interfaces/TableItemProps.md) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`\<`string`, `FilterValue` \| ``null``\>, `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`\>
277
-
278
- #### Type parameters
279
-
280
- | Name | Type |
281
- | :------ | :------ |
282
- | `T` | `any` |
283
- | `ExtendTypes` | `any` |
284
-
285
- ___
286
-
287
- ### UnionFaasItemElement
288
-
289
- Ƭ **UnionFaasItemElement**\<`Value`, `Values`\>: `ReactElement`\<[`UnionFaasItemInjection`](#unionfaasiteminjection)\<`Value`, `Values`\>\> \| ``null``
290
-
291
- #### Type parameters
292
-
293
- | Name | Type |
294
- | :------ | :------ |
295
- | `Value` | `any` |
296
- | `Values` | `any` |
297
-
298
- ___
299
-
300
- ### UnionFaasItemInjection
301
-
302
- Ƭ **UnionFaasItemInjection**\<`Value`, `Values`\>: `Object`
303
-
304
- #### Type parameters
305
-
306
- | Name | Type |
307
- | :------ | :------ |
308
- | `Value` | `any` |
309
- | `Values` | `any` |
310
-
311
- #### Type declaration
312
-
313
- | Name | Type |
314
- | :------ | :------ |
315
- | `index?` | `number` |
316
- | `scene?` | [`UnionScene`](#unionscene) |
317
- | `value?` | `Value` |
318
- | `values?` | `Values` |
319
-
320
- ___
321
-
322
- ### UnionFaasItemRender
323
-
324
- Ƭ **UnionFaasItemRender**\<`Value`, `Values`\>: (`value`: `Value`, `values`: `Values`, `index`: `number`, `scene`: [`UnionScene`](#unionscene)) => `React.ReactNode`
325
-
326
- #### Type parameters
327
-
328
- | Name | Type |
329
- | :------ | :------ |
330
- | `Value` | `any` |
331
- | `Values` | `any` |
332
-
333
- #### Type declaration
334
-
335
- ▸ (`value`, `values`, `index`, `scene`): `React.ReactNode`
336
-
337
- ##### Parameters
338
-
339
- | Name | Type |
340
- | :------ | :------ |
341
- | `value` | `Value` |
342
- | `values` | `Values` |
343
- | `index` | `number` |
344
- | `scene` | [`UnionScene`](#unionscene) |
345
-
346
- ##### Returns
347
-
348
- `React.ReactNode`
349
-
350
- ___
351
-
352
- ### UnionScene
353
-
354
- Ƭ **UnionScene**: ``"form"`` \| ``"description"`` \| ``"table"``
355
-
356
- ___
357
-
358
- ### setDrawerProps
359
-
360
- Ƭ **setDrawerProps**: (`changes`: `Partial`\<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void`
361
-
362
- #### Type declaration
363
-
364
- ▸ (`changes`): `void`
365
-
366
- ##### Parameters
367
-
368
- | Name | Type |
369
- | :------ | :------ |
370
- | `changes` | `Partial`\<[`DrawerProps`](interfaces/DrawerProps.md)\> |
371
-
372
- ##### Returns
373
-
374
- `void`
375
-
376
- ___
377
-
378
- ### setModalProps
379
-
380
- Ƭ **setModalProps**: (`changes`: `Partial`\<[`ModalProps`](interfaces/ModalProps.md)\>) => `void`
381
-
382
- #### Type declaration
383
-
384
- ▸ (`changes`): `void`
385
-
386
- ##### Parameters
387
-
388
- | Name | Type |
389
- | :------ | :------ |
390
- | `changes` | `Partial`\<[`ModalProps`](interfaces/ModalProps.md)\> |
391
-
392
- ##### Returns
393
-
394
- `void`
61
+ - [BaseOption](type-aliases/BaseOption.md)
62
+ - [ExtendDescriptionItemProps](type-aliases/ExtendDescriptionItemProps.md)
63
+ - [ExtendFormItemProps](type-aliases/ExtendFormItemProps.md)
64
+ - [ExtendFormTypeProps](type-aliases/ExtendFormTypeProps.md)
65
+ - [ExtendTableItemProps](type-aliases/ExtendTableItemProps.md)
66
+ - [ExtendTableTypeProps](type-aliases/ExtendTableTypeProps.md)
67
+ - [ExtendTypes](type-aliases/ExtendTypes.md)
68
+ - [FaasDataInjection](type-aliases/FaasDataInjection.md)
69
+ - [FaasItemType](type-aliases/FaasItemType.md)
70
+ - [FaasItemTypeValue](type-aliases/FaasItemTypeValue.md)
71
+ - [FormSubmitProps](type-aliases/FormSubmitProps.md)
72
+ - [LoadingProps](type-aliases/LoadingProps.md)
73
+ - [TableProps](type-aliases/TableProps.md)
74
+ - [UnionFaasItemElement](type-aliases/UnionFaasItemElement.md)
75
+ - [UnionFaasItemInjection](type-aliases/UnionFaasItemInjection.md)
76
+ - [UnionFaasItemRender](type-aliases/UnionFaasItemRender.md)
77
+ - [UnionScene](type-aliases/UnionScene.md)
78
+ - [setDrawerProps](type-aliases/setDrawerProps.md)
79
+ - [setModalProps](type-aliases/setModalProps.md)
395
80
 
396
81
  ## Variables
397
82
 
398
- ### ConfigContext
399
-
400
- • `Const` **ConfigContext**: `Context`\<`Partial`\<[`ConfigProviderProps`](interfaces/ConfigProviderProps.md)\>\>
83
+ - [ConfigContext](variables/ConfigContext.md)
401
84
 
402
85
  ## Functions
403
86
 
404
- ### App
405
-
406
- **App**(`props`): `Element`
407
-
408
- App component with Ant Design & FaasJS
409
-
410
- - Based on Ant Design's [ConfigProvider](https://ant.design/components/config-provider/) and [StyleProvider](https://ant.design/components/style-provider/).
411
- - Integrated Ant Design's [Message](https://ant.design/components/message/) and [Notification](https://ant.design/components/notification/).
412
- - Based on FaasJS's [ConfigProvider](https://faasjs.com/doc/ant-design/#configprovider).
413
- - Integrated FaasJS's [Modal](https://faasjs.com/doc/ant-design/#usemodal), [Drawer](https://faasjs.com/doc/ant-design/#usedrawer) and [ErrorBoundary](https://faasjs.com/doc/ant-design/#errorboundary).
414
- - Integrated React Router's [BrowserRouter](https://reactrouter.com/en/router-components/browser-router).
415
-
416
- #### Parameters
417
-
418
- | Name | Type |
419
- | :------ | :------ |
420
- | `props` | [`AppProps`](interfaces/AppProps.md) |
421
-
422
- #### Returns
423
-
424
- `Element`
425
-
426
- **`Example`**
427
-
428
- ```tsx
429
- import { App } from '@faasjs/ant-design'
430
-
431
- export default function () {
432
- return (
433
- <App
434
- styleProviderProps={{}} // https://ant.design/docs/react/compatible-style#styleprovider
435
- configProviderProps={{}} // https://ant.design/components/config-provider/#API
436
- browserRouterProps={{}} // https://reactrouter.com/en/router-components/browser-router
437
- errorBoundaryProps={{}} // https://faasjs.com/doc/ant-design/#errorboundary
438
- faasConfigProviderProps={{}} // https://faasjs.com/doc/ant-design/#configprovider
439
- >
440
- <div>content</div>
441
- </App>
442
- )
443
- ```
444
-
445
- ___
446
-
447
- ### Blank
448
-
449
- ▸ **Blank**(`options?`): `JSX.Element`
450
-
451
- Blank component.
452
-
453
- If value is undefined or null, return text, otherwise return value.
454
-
455
- #### Parameters
456
-
457
- | Name | Type |
458
- | :------ | :------ |
459
- | `options?` | [`BlankProps`](interfaces/BlankProps.md) |
460
-
461
- #### Returns
462
-
463
- `JSX.Element`
464
-
465
- **`Example`**
466
-
467
- ```tsx
468
- import { Blank } from '@faasjs/ant-design'
469
-
470
- <Blank value={undefined} text="Empty" />
471
- ```
472
-
473
- ___
474
-
475
- ### ConfigProvider
476
-
477
- ▸ **ConfigProvider**(`props`): `Element`
478
-
479
- Config for `@faasjs/ant-design` components.
480
-
481
- #### Parameters
482
-
483
- | Name | Type |
484
- | :------ | :------ |
485
- | `props` | [`ConfigProviderProps`](interfaces/ConfigProviderProps.md) |
486
-
487
- #### Returns
488
-
489
- `Element`
490
-
491
- **`Example`**
492
-
493
- ```tsx
494
- import { ConfigProvider } from '@faasjs/ant-design'
495
-
496
- <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
497
- <Blank />
498
- </ConfigProvider>
499
- ```
500
-
501
- ___
502
-
503
- ### Description
504
-
505
- ▸ **Description**\<`T`\>(`props`): `Element`
506
-
507
- Description component
508
-
509
- - Based on [Ant Design Descriptions](https://ant.design/components/descriptions/).
510
-
511
- #### Type parameters
512
-
513
- | Name | Type |
514
- | :------ | :------ |
515
- | `T` | `any` |
516
-
517
- #### Parameters
518
-
519
- | Name | Type |
520
- | :------ | :------ |
521
- | `props` | [`DescriptionProps`](interfaces/DescriptionProps.md)\<`T`, `any`\> |
522
-
523
- #### Returns
524
-
525
- `Element`
526
-
527
- **`Example`**
528
-
529
- ```tsx
530
- import { Description } from '@faasjs/ant-design'
531
-
532
- <Description
533
- title="Title"
534
- items={[
535
- {
536
- id: 'id',
537
- title: 'Title',
538
- type: 'string',
539
- },
540
- ]}
541
- dataSource={{ id: 'value' }}
542
- />
543
- ```
544
-
545
- ___
546
-
547
- ### ErrorBoundary
548
-
549
- ▸ **ErrorBoundary**(`props`): `Element`
550
-
551
- Styled error boundary.
552
-
553
- #### Parameters
554
-
555
- | Name | Type |
556
- | :------ | :------ |
557
- | `props` | [`ErrorBoundaryProps`](interfaces/ErrorBoundaryProps.md) |
558
-
559
- #### Returns
560
-
561
- `Element`
562
-
563
- ___
564
-
565
- ### FaasDataWrapper
566
-
567
- ▸ **FaasDataWrapper**\<`T`\>(`props`): `JSX.Element`
568
-
569
- FaasDataWrapper component with Loading
570
-
571
- #### Type parameters
572
-
573
- | Name | Type |
574
- | :------ | :------ |
575
- | `T` | `any` |
576
-
577
- #### Parameters
578
-
579
- | Name | Type |
580
- | :------ | :------ |
581
- | `props` | [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)\<`T`\> |
582
-
583
- #### Returns
584
-
585
- `JSX.Element`
586
-
587
- **`Example`**
588
-
589
- ```tsx
590
- function MyComponent (props: FaasDataInjection) {
591
- return <div>{ props.data }</div>
592
- }
593
-
594
- function MyPage () {
595
- return <FaasDataWrapper action="test" params={{ a: 1 }}>
596
- <MyComponent />
597
- </FaasDataWrapper>
598
- }
599
- ```
600
-
601
- ___
602
-
603
- ### Form
604
-
605
- ▸ **Form**\<`Values`\>(`props`): `Element`
606
-
607
- Form component with Ant Design & FaasJS
608
-
609
- - Based on [Ant Design Form](https://ant.design/components/form/).
610
-
611
- #### Type parameters
612
-
613
- | Name | Type |
614
- | :------ | :------ |
615
- | `Values` | `any` |
616
-
617
- #### Parameters
618
-
619
- | Name | Type |
620
- | :------ | :------ |
621
- | `props` | [`FormProps`](interfaces/FormProps.md)\<`Values`, `any`\> |
622
-
623
- #### Returns
624
-
625
- `Element`
626
-
627
- ___
628
-
629
- ### FormItem
630
-
631
- ▸ **FormItem**\<`T`\>(`props`): `Element`
632
-
633
- FormItem
634
-
635
- - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
636
- - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
637
-
638
- #### Type parameters
639
-
640
- | Name | Type |
641
- | :------ | :------ |
642
- | `T` | `any` |
643
-
644
- #### Parameters
645
-
646
- | Name | Type |
647
- | :------ | :------ |
648
- | `props` | [`FormItemProps`](interfaces/FormItemProps.md)\<`T`\> |
649
-
650
- #### Returns
651
-
652
- `Element`
653
-
654
- **`Example`**
655
-
656
- ```tsx
657
- // use inline type
658
- <FormItem type='string' id='name' />
659
-
660
- // use custom type
661
- <FormItem id='password'>
662
- <Input.Password />
663
- </>
664
- ```
665
-
666
- ___
667
-
668
- ### Link
669
-
670
- ▸ **Link**(`props`): `Element`
671
-
672
- Link component with button
673
-
674
- #### Parameters
675
-
676
- | Name | Type |
677
- | :------ | :------ |
678
- | `props` | [`LinkProps`](interfaces/LinkProps.md) |
679
-
680
- #### Returns
681
-
682
- `Element`
683
-
684
- **`Example`**
685
-
686
- ```tsx
687
- // pure link
688
- <Link href="/">Home</Link>
689
-
690
- // link with button
691
- <Link href="/" button={{ type:'primary' }}>Home</Link>
692
- ```
693
-
694
- ___
695
-
696
- ### Loading
697
-
698
- ▸ **Loading**(`props`): `Element`
699
-
700
- Loading component based on Spin
701
-
702
- #### Parameters
703
-
704
- | Name | Type |
705
- | :------ | :------ |
706
- | `props` | [`LoadingProps`](#loadingprops) |
707
-
708
- #### Returns
709
-
710
- `Element`
711
-
712
- **`Example`**
713
-
714
- ```tsx
715
- <Loading /> // display loading
716
-
717
- <Loading loading={ !remoteData }>
718
- <div>{remoteData}</div>
719
- </Loading>
720
- ```
721
-
722
- ___
723
-
724
- ### PageNotFound
725
-
726
- ▸ **PageNotFound**(): `Element`
727
-
728
- #### Returns
729
-
730
- `Element`
731
-
732
- ___
733
-
734
- ### Routes
735
-
736
- ▸ **Routes**(`props`): `Element`
737
-
738
- Routes with lazy loading and 404 page.
739
-
740
- #### Parameters
741
-
742
- | Name | Type |
743
- | :------ | :------ |
744
- | `props` | [`RoutesProps`](interfaces/RoutesProps.md) |
745
-
746
- #### Returns
747
-
748
- `Element`
749
-
750
- **`Example`**
751
-
752
- ```tsx
753
- import { Routes, lazy } from '@faasjs/ant-design'
754
- import { BrowserRouter } from 'react-router-dom'
755
-
756
- export function App () {
757
- return <BrowserRouter>
758
- <Routes routes={[
759
- {
760
- path: '/',
761
- page: lazy(() => import('./pages/home'))
762
- }
763
- ]} />
764
- </BrowserRouter>
765
- }
766
- ```
767
-
768
- ___
769
-
770
- ### Table
771
-
772
- ▸ **Table**\<`T`, `ExtendTypes`\>(`props`): `Element`
773
-
774
- Table component with Ant Design & FaasJS
775
-
776
- - Based on [Ant Design Table](https://ant.design/components/table/).
777
- - Support FaasJS injection.
778
- - Auto generate filter dropdown (disable with `filterDropdown: false`).
779
- - Auto generate sorter (disable with `sorter: false`).
780
-
781
- #### Type parameters
782
-
783
- | Name | Type |
784
- | :------ | :------ |
785
- | `T` | extends `Record`\<`string`, `any`\> |
786
- | `ExtendTypes` | `any` |
787
-
788
- #### Parameters
789
-
790
- | Name | Type |
791
- | :------ | :------ |
792
- | `props` | [`TableProps`](#tableprops)\<`T`, `ExtendTypes`\> |
793
-
794
- #### Returns
795
-
796
- `Element`
797
-
798
- ___
799
-
800
- ### Tabs
801
-
802
- ▸ **Tabs**(`props`): `Element`
803
-
804
- Tabs component with Ant Design & FaasJS
805
-
806
- - Based on [Ant Design Tabs](https://ant.design/components/tabs/).
807
- - Support auto skip null/false tab item.
808
- - Support `id` as key and label.
809
-
810
- #### Parameters
811
-
812
- | Name | Type |
813
- | :------ | :------ |
814
- | `props` | [`TabsProps`](interfaces/TabsProps.md) |
815
-
816
- #### Returns
817
-
818
- `Element`
819
-
820
- **`Example`**
821
-
822
- ```tsx
823
- import { Tabs } from '@faasjs/ant-design'
824
-
825
- <Tabs
826
- items={[
827
- {
828
- id: 'id',
829
- children: 'content',
830
- },
831
- 1 === 0 && {
832
- id: 'hidden',
833
- children: 'content',
834
- },
835
- ]}
836
- />
837
- ```
838
-
839
- ___
840
-
841
- ### Title
842
-
843
- ▸ **Title**(`props`): `JSX.Element`
844
-
845
- Title is used to change the title of the page
846
-
847
- Return null by default.
848
-
849
- ```tsx
850
- // return null
851
- <Title title='hi' /> // => change the document.title to 'hi'
852
- <Title title={['a', 'b']} /> // => change the document.title to 'a - b'
853
-
854
- // return h1
855
- <Title title='hi' h1 /> // => <h1>hi</h1>
856
- <Title title={['a', 'b']} h1 /> // => <h1>a</h1>
857
-
858
- // return children
859
- <Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
860
- ```
861
-
862
- #### Parameters
863
-
864
- | Name | Type |
865
- | :------ | :------ |
866
- | `props` | [`TitleProps`](interfaces/TitleProps.md) |
867
-
868
- #### Returns
869
-
870
- `JSX.Element`
871
-
872
- ___
873
-
874
- ### faas
875
-
876
- ▸ **faas**\<`PathOrData`\>(`action`, `params`): `Promise`\<`Response`\<`FaasData`\<`PathOrData`\>\>\>
877
-
878
- Request faas server
879
-
880
- #### Type parameters
881
-
882
- | Name | Type |
883
- | :------ | :------ |
884
- | `PathOrData` | extends `Record`\<`string`, `any`\> |
885
-
886
- #### Parameters
887
-
888
- | Name | Type | Description |
889
- | :------ | :------ | :------ |
890
- | `action` | `string` \| `PathOrData` | {string} action name |
891
- | `params` | `FaasParams`\<`PathOrData`\> | {object} action params |
892
-
893
- #### Returns
894
-
895
- `Promise`\<`Response`\<`FaasData`\<`PathOrData`\>\>\>
896
-
897
- **`Example`**
898
-
899
- ```ts
900
- faas<{ title: string }>('post/get', { id: 1 }).then(res => {
901
- console.log(res.data.title)
902
- })
903
- ```
904
-
905
- ___
906
-
907
- ### transferOptions
908
-
909
- ▸ **transferOptions**(`options`): \{ `label`: `string` ; `value?`: `string` \| `number` }[]
910
-
911
- convert string[] or number[] to { label, value }[]
912
-
913
- #### Parameters
914
-
915
- | Name | Type |
916
- | :------ | :------ |
917
- | `options` | [`BaseOption`](#baseoption)[] |
918
-
919
- #### Returns
920
-
921
- \{ `label`: `string` ; `value?`: `string` \| `number` }[]
922
-
923
- ___
924
-
925
- ### transferValue
926
-
927
- ▸ **transferValue**(`type`, `value`): `any`
928
-
929
- #### Parameters
930
-
931
- | Name | Type |
932
- | :------ | :------ |
933
- | `type` | [`FaasItemType`](#faasitemtype) |
934
- | `value` | `any` |
935
-
936
- #### Returns
937
-
938
- `any`
939
-
940
- ___
941
-
942
- ### useApp
943
-
944
- ▸ **useApp**(): [`useAppProps`](interfaces/useAppProps.md)
945
-
946
- Get app context.
947
-
948
- ```ts
949
- import { useApp } from '@faasjs/ant-design'
950
-
951
- const { message, notification, setModalProps, setDrawerProps } = useApp()
952
- ```
953
-
954
- #### Returns
955
-
956
- [`useAppProps`](interfaces/useAppProps.md)
957
-
958
- ___
959
-
960
- ### useConfigContext
961
-
962
- ▸ **useConfigContext**(): `Partial`\<[`ConfigProviderProps`](interfaces/ConfigProviderProps.md)\>
963
-
964
- #### Returns
965
-
966
- `Partial`\<[`ConfigProviderProps`](interfaces/ConfigProviderProps.md)\>
967
-
968
- ___
969
-
970
- ### useDrawer
971
-
972
- ▸ **useDrawer**(`init?`): `Object`
973
-
974
- Hook style drawer
975
-
976
- ```tsx
977
- function Example() {
978
- const { drawer, setDrawerProps } = useDrawer()
979
-
980
- return <>
981
- <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }>
982
- Toggle
983
- </Button>
984
- {drawer}
985
- </>
986
- }
987
- ```
988
-
989
- #### Parameters
990
-
991
- | Name | Type |
992
- | :------ | :------ |
993
- | `init?` | [`DrawerProps`](interfaces/DrawerProps.md) |
994
-
995
- #### Returns
996
-
997
- `Object`
998
-
999
- | Name | Type |
1000
- | :------ | :------ |
1001
- | `drawer` | `Element` |
1002
- | `drawerProps` | [`DrawerProps`](interfaces/DrawerProps.md) |
1003
- | `setDrawerProps` | (`changes`: `Partial`\<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void` |
1004
-
1005
- ___
1006
-
1007
- ### useFaas
1008
-
1009
- ▸ **useFaas**\<`PathOrData`\>(`action`, `defaultParams`, `options?`): `FaasDataInjection`\<`FaasData`\<`PathOrData`\>\>
1010
-
1011
- Request faas server with React hook
1012
-
1013
- #### Type parameters
1014
-
1015
- | Name | Type |
1016
- | :------ | :------ |
1017
- | `PathOrData` | extends `Record`\<`string`, `any`\> |
1018
-
1019
- #### Parameters
1020
-
1021
- | Name | Type | Description |
1022
- | :------ | :------ | :------ |
1023
- | `action` | `string` \| `PathOrData` | {string} action name |
1024
- | `defaultParams` | `FaasParams`\<`PathOrData`\> | {object} initial action params |
1025
- | `options?` | `useFaasOptions`\<`PathOrData`\> | - |
1026
-
1027
- #### Returns
1028
-
1029
- `FaasDataInjection`\<`FaasData`\<`PathOrData`\>\>
1030
-
1031
- **`Example`**
1032
-
1033
- ```tsx
1034
- function Post ({ id }) {
1035
- const { data } = useFaas<{ title: string }>('post/get', { id })
1036
- return <h1>{data.title}</h1>
1037
- }
1038
- ```
1039
-
1040
- ___
1041
-
1042
- ### useModal
1043
-
1044
- ▸ **useModal**(`init?`): `Object`
1045
-
1046
- Hook style modal
1047
-
1048
- ```tsx
1049
- function Example() {
1050
- const { modal, setModalProps } = useModal()
1051
-
1052
- return <>
1053
- <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
1054
- {modal}
1055
- </>
1056
- }
1057
- ```
1058
-
1059
- #### Parameters
1060
-
1061
- | Name | Type |
1062
- | :------ | :------ |
1063
- | `init?` | [`ModalProps`](interfaces/ModalProps.md) |
1064
-
1065
- #### Returns
1066
-
1067
- `Object`
1068
-
1069
- | Name | Type |
1070
- | :------ | :------ |
1071
- | `modal` | `Element` |
1072
- | `modalProps` | [`ModalProps`](interfaces/ModalProps.md) |
1073
- | `setModalProps` | (`changes`: `Partial`\<[`ModalProps`](interfaces/ModalProps.md)\>) => `void` |
87
+ - [App](functions/App.md)
88
+ - [Blank](functions/Blank.md)
89
+ - [ConfigProvider](functions/ConfigProvider.md)
90
+ - [Description](functions/Description.md)
91
+ - [Drawer](functions/Drawer.md)
92
+ - [ErrorBoundary](functions/ErrorBoundary.md)
93
+ - [FaasDataWrapper](functions/FaasDataWrapper.md)
94
+ - [Form](functions/Form.md)
95
+ - [FormItem](functions/FormItem.md)
96
+ - [Link](functions/Link.md)
97
+ - [Loading](functions/Loading.md)
98
+ - [Modal](functions/Modal.md)
99
+ - [PageNotFound](functions/PageNotFound.md)
100
+ - [Routes](functions/Routes.md)
101
+ - [Table](functions/Table.md)
102
+ - [Tabs](functions/Tabs.md)
103
+ - [Title](functions/Title.md)
104
+ - [faas](functions/faas.md)
105
+ - [transferOptions](functions/transferOptions.md)
106
+ - [transferValue](functions/transferValue.md)
107
+ - [useApp](functions/useApp.md)
108
+ - [useConfigContext](functions/useConfigContext.md)
109
+ - [useDrawer](functions/useDrawer.md)
110
+ - [useFaas](functions/useFaas.md)
111
+ - [useModal](functions/useModal.md)