@faasjs/ant-design 0.0.3-development → 0.0.4-beta.1

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