@faasjs/ant-design 1.2.0 → 1.3.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 +190 -88
- package/dist/index.d.mts +109 -29
- package/dist/index.d.ts +109 -29
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -41,12 +41,6 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
|
|
|
41
41
|
|
|
42
42
|
## Modules
|
|
43
43
|
|
|
44
|
-
### Namespaces
|
|
45
|
-
|
|
46
|
-
- [App](modules/App.md)
|
|
47
|
-
- [Form](modules/Form.md)
|
|
48
|
-
- [FormItem](modules/FormItem.md)
|
|
49
|
-
|
|
50
44
|
### Interfaces
|
|
51
45
|
|
|
52
46
|
- [AppProps](interfaces/AppProps.md)
|
|
@@ -411,6 +405,14 @@ ___
|
|
|
411
405
|
|
|
412
406
|
▸ **App**(`props`): `Element`
|
|
413
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
|
+
|
|
414
416
|
#### Parameters
|
|
415
417
|
|
|
416
418
|
| Name | Type |
|
|
@@ -421,6 +423,25 @@ ___
|
|
|
421
423
|
|
|
422
424
|
`Element`
|
|
423
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
|
+
|
|
424
445
|
___
|
|
425
446
|
|
|
426
447
|
### Blank
|
|
@@ -433,15 +454,19 @@ If value is undefined or null, return text, otherwise return value.
|
|
|
433
454
|
|
|
434
455
|
#### Parameters
|
|
435
456
|
|
|
436
|
-
| Name | Type |
|
|
437
|
-
| :------ | :------ |
|
|
438
|
-
| `options?` | [`BlankProps`](interfaces/BlankProps.md) |
|
|
457
|
+
| Name | Type |
|
|
458
|
+
| :------ | :------ |
|
|
459
|
+
| `options?` | [`BlankProps`](interfaces/BlankProps.md) |
|
|
439
460
|
|
|
440
461
|
#### Returns
|
|
441
462
|
|
|
442
463
|
`JSX.Element`
|
|
443
464
|
|
|
444
|
-
|
|
465
|
+
**`Example`**
|
|
466
|
+
|
|
467
|
+
```tsx
|
|
468
|
+
import { Blank } from '@faasjs/ant-design'
|
|
469
|
+
|
|
445
470
|
<Blank value={undefined} text="Empty" />
|
|
446
471
|
```
|
|
447
472
|
|
|
@@ -451,13 +476,7 @@ ___
|
|
|
451
476
|
|
|
452
477
|
▸ **ConfigProvider**(`props`): `Element`
|
|
453
478
|
|
|
454
|
-
Config for
|
|
455
|
-
|
|
456
|
-
```ts
|
|
457
|
-
<ConfigProvider theme={{ common: { blank: 'Empty' } }}>
|
|
458
|
-
<Blank />
|
|
459
|
-
</ConfigProvider>
|
|
460
|
-
```
|
|
479
|
+
Config for `@faasjs/ant-design` components.
|
|
461
480
|
|
|
462
481
|
#### Parameters
|
|
463
482
|
|
|
@@ -469,13 +488,25 @@ Config for @faasjs/ant-design components.
|
|
|
469
488
|
|
|
470
489
|
`Element`
|
|
471
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
|
+
|
|
472
501
|
___
|
|
473
502
|
|
|
474
503
|
### Description
|
|
475
504
|
|
|
476
505
|
▸ **Description**\<`T`\>(`props`): `Element`
|
|
477
506
|
|
|
478
|
-
Description component
|
|
507
|
+
Description component
|
|
508
|
+
|
|
509
|
+
- Based on [Ant Design Descriptions](https://ant.design/components/descriptions/).
|
|
479
510
|
|
|
480
511
|
#### Type parameters
|
|
481
512
|
|
|
@@ -493,12 +524,32 @@ Description component.
|
|
|
493
524
|
|
|
494
525
|
`Element`
|
|
495
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
|
+
|
|
496
545
|
___
|
|
497
546
|
|
|
498
547
|
### ErrorBoundary
|
|
499
548
|
|
|
500
549
|
▸ **ErrorBoundary**(`props`): `Element`
|
|
501
550
|
|
|
551
|
+
Styled error boundary.
|
|
552
|
+
|
|
502
553
|
#### Parameters
|
|
503
554
|
|
|
504
555
|
| Name | Type |
|
|
@@ -517,18 +568,6 @@ ___
|
|
|
517
568
|
|
|
518
569
|
FaasDataWrapper component with Loading
|
|
519
570
|
|
|
520
|
-
```tsx
|
|
521
|
-
function MyComponent (props: FaasDataInjection) {
|
|
522
|
-
return <div>{ props.data }</div>
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
function MyPage () {
|
|
526
|
-
return <FaasDataWrapper action="test" params={{ a: 1 }}>
|
|
527
|
-
<MyComponent />
|
|
528
|
-
</FaasDataWrapper>
|
|
529
|
-
}
|
|
530
|
-
```
|
|
531
|
-
|
|
532
571
|
#### Type parameters
|
|
533
572
|
|
|
534
573
|
| Name | Type |
|
|
@@ -545,6 +584,20 @@ function MyPage () {
|
|
|
545
584
|
|
|
546
585
|
`JSX.Element`
|
|
547
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
|
+
|
|
548
601
|
___
|
|
549
602
|
|
|
550
603
|
### Form
|
|
@@ -553,6 +606,8 @@ ___
|
|
|
553
606
|
|
|
554
607
|
Form component with Ant Design & FaasJS
|
|
555
608
|
|
|
609
|
+
- Based on [Ant Design Form](https://ant.design/components/form/).
|
|
610
|
+
|
|
556
611
|
#### Type parameters
|
|
557
612
|
|
|
558
613
|
| Name | Type |
|
|
@@ -569,27 +624,16 @@ Form component with Ant Design & FaasJS
|
|
|
569
624
|
|
|
570
625
|
`Element`
|
|
571
626
|
|
|
572
|
-
**`Ref`**
|
|
573
|
-
|
|
574
|
-
https://ant.design/components/form/
|
|
575
|
-
|
|
576
627
|
___
|
|
577
628
|
|
|
578
629
|
### FormItem
|
|
579
630
|
|
|
580
631
|
▸ **FormItem**\<`T`\>(`props`): `Element`
|
|
581
632
|
|
|
582
|
-
FormItem
|
|
633
|
+
FormItem
|
|
583
634
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
<FormItem type='string' id='name' />
|
|
587
|
-
|
|
588
|
-
// use custom type
|
|
589
|
-
<FormItem id='password'>
|
|
590
|
-
<Input.Password />
|
|
591
|
-
</>
|
|
592
|
-
```
|
|
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).
|
|
593
637
|
|
|
594
638
|
#### Type parameters
|
|
595
639
|
|
|
@@ -607,21 +651,25 @@ FormItem, can be used without Form.
|
|
|
607
651
|
|
|
608
652
|
`Element`
|
|
609
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
|
+
|
|
610
666
|
___
|
|
611
667
|
|
|
612
668
|
### Link
|
|
613
669
|
|
|
614
670
|
▸ **Link**(`props`): `Element`
|
|
615
671
|
|
|
616
|
-
Link component with button
|
|
617
|
-
|
|
618
|
-
```ts
|
|
619
|
-
// pure link
|
|
620
|
-
<Link href="/">Home</Link>
|
|
621
|
-
|
|
622
|
-
// link with button
|
|
623
|
-
<Link href="/" button={{ type:'primary' }}>Home</Link>
|
|
624
|
-
```
|
|
672
|
+
Link component with button
|
|
625
673
|
|
|
626
674
|
#### Parameters
|
|
627
675
|
|
|
@@ -633,6 +681,16 @@ Link component with button.
|
|
|
633
681
|
|
|
634
682
|
`Element`
|
|
635
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
|
+
|
|
636
694
|
___
|
|
637
695
|
|
|
638
696
|
### Loading
|
|
@@ -641,14 +699,6 @@ ___
|
|
|
641
699
|
|
|
642
700
|
Loading component based on Spin
|
|
643
701
|
|
|
644
|
-
```tsx
|
|
645
|
-
<Loading /> // display loading
|
|
646
|
-
|
|
647
|
-
<Loading loading={ !remoteData }>
|
|
648
|
-
<div>{remoteData}</div>
|
|
649
|
-
</Loading>
|
|
650
|
-
```
|
|
651
|
-
|
|
652
702
|
#### Parameters
|
|
653
703
|
|
|
654
704
|
| Name | Type |
|
|
@@ -659,6 +709,16 @@ Loading component based on Spin
|
|
|
659
709
|
|
|
660
710
|
`Element`
|
|
661
711
|
|
|
712
|
+
**`Example`**
|
|
713
|
+
|
|
714
|
+
```tsx
|
|
715
|
+
<Loading /> // display loading
|
|
716
|
+
|
|
717
|
+
<Loading loading={ !remoteData }>
|
|
718
|
+
<div>{remoteData}</div>
|
|
719
|
+
</Loading>
|
|
720
|
+
```
|
|
721
|
+
|
|
662
722
|
___
|
|
663
723
|
|
|
664
724
|
### PageNotFound
|
|
@@ -677,6 +737,18 @@ ___
|
|
|
677
737
|
|
|
678
738
|
Routes with lazy loading and 404 page.
|
|
679
739
|
|
|
740
|
+
#### Parameters
|
|
741
|
+
|
|
742
|
+
| Name | Type |
|
|
743
|
+
| :------ | :------ |
|
|
744
|
+
| `props` | [`RoutesProps`](interfaces/RoutesProps.md) |
|
|
745
|
+
|
|
746
|
+
#### Returns
|
|
747
|
+
|
|
748
|
+
`Element`
|
|
749
|
+
|
|
750
|
+
**`Example`**
|
|
751
|
+
|
|
680
752
|
```tsx
|
|
681
753
|
import { Routes, lazy } from '@faasjs/ant-design'
|
|
682
754
|
import { BrowserRouter } from 'react-router-dom'
|
|
@@ -693,16 +765,6 @@ export function App () {
|
|
|
693
765
|
}
|
|
694
766
|
```
|
|
695
767
|
|
|
696
|
-
#### Parameters
|
|
697
|
-
|
|
698
|
-
| Name | Type |
|
|
699
|
-
| :------ | :------ |
|
|
700
|
-
| `props` | [`RoutesProps`](interfaces/RoutesProps.md) |
|
|
701
|
-
|
|
702
|
-
#### Returns
|
|
703
|
-
|
|
704
|
-
`Element`
|
|
705
|
-
|
|
706
768
|
___
|
|
707
769
|
|
|
708
770
|
### Table
|
|
@@ -711,7 +773,7 @@ ___
|
|
|
711
773
|
|
|
712
774
|
Table component with Ant Design & FaasJS
|
|
713
775
|
|
|
714
|
-
-
|
|
776
|
+
- Based on [Ant Design Table](https://ant.design/components/table/).
|
|
715
777
|
- Support FaasJS injection.
|
|
716
778
|
- Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
717
779
|
- Auto generate sorter (disable with `sorter: false`).
|
|
@@ -733,10 +795,6 @@ Table component with Ant Design & FaasJS
|
|
|
733
795
|
|
|
734
796
|
`Element`
|
|
735
797
|
|
|
736
|
-
**`Ref`**
|
|
737
|
-
|
|
738
|
-
https://ant.design/components/table/
|
|
739
|
-
|
|
740
798
|
___
|
|
741
799
|
|
|
742
800
|
### Tabs
|
|
@@ -745,6 +803,10 @@ ___
|
|
|
745
803
|
|
|
746
804
|
Tabs component with Ant Design & FaasJS
|
|
747
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
|
+
|
|
748
810
|
#### Parameters
|
|
749
811
|
|
|
750
812
|
| Name | Type |
|
|
@@ -755,9 +817,24 @@ Tabs component with Ant Design & FaasJS
|
|
|
755
817
|
|
|
756
818
|
`Element`
|
|
757
819
|
|
|
758
|
-
**`
|
|
820
|
+
**`Example`**
|
|
759
821
|
|
|
760
|
-
|
|
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
|
+
```
|
|
761
838
|
|
|
762
839
|
___
|
|
763
840
|
|
|
@@ -765,10 +842,11 @@ ___
|
|
|
765
842
|
|
|
766
843
|
▸ **Title**(`props`): `JSX.Element`
|
|
767
844
|
|
|
768
|
-
Title is used to change the title of the page
|
|
845
|
+
Title is used to change the title of the page
|
|
846
|
+
|
|
769
847
|
Return null by default.
|
|
770
848
|
|
|
771
|
-
```
|
|
849
|
+
```tsx
|
|
772
850
|
// return null
|
|
773
851
|
<Title title='hi' /> // => change the document.title to 'hi'
|
|
774
852
|
<Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
|
@@ -893,13 +971,26 @@ ___
|
|
|
893
971
|
|
|
894
972
|
▸ **useDrawer**(`init?`): `Object`
|
|
895
973
|
|
|
896
|
-
Hook style drawer
|
|
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
|
+
```
|
|
897
988
|
|
|
898
989
|
#### Parameters
|
|
899
990
|
|
|
900
|
-
| Name | Type |
|
|
901
|
-
| :------ | :------ |
|
|
902
|
-
| `init?` | [`DrawerProps`](interfaces/DrawerProps.md) |
|
|
991
|
+
| Name | Type |
|
|
992
|
+
| :------ | :------ |
|
|
993
|
+
| `init?` | [`DrawerProps`](interfaces/DrawerProps.md) |
|
|
903
994
|
|
|
904
995
|
#### Returns
|
|
905
996
|
|
|
@@ -952,13 +1043,24 @@ ___
|
|
|
952
1043
|
|
|
953
1044
|
▸ **useModal**(`init?`): `Object`
|
|
954
1045
|
|
|
955
|
-
Hook style modal
|
|
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
|
+
```
|
|
956
1058
|
|
|
957
1059
|
#### Parameters
|
|
958
1060
|
|
|
959
|
-
| Name | Type |
|
|
960
|
-
| :------ | :------ |
|
|
961
|
-
| `init?` | [`ModalProps`](interfaces/ModalProps.md) |
|
|
1061
|
+
| Name | Type |
|
|
1062
|
+
| :------ | :------ |
|
|
1063
|
+
| `init?` | [`ModalProps`](interfaces/ModalProps.md) |
|
|
962
1064
|
|
|
963
1065
|
#### Returns
|
|
964
1066
|
|
package/dist/index.d.mts
CHANGED
|
@@ -26,16 +26,16 @@ interface ModalProps extends ModalProps$1 {
|
|
|
26
26
|
}
|
|
27
27
|
type setModalProps = (changes: Partial<ModalProps>) => void;
|
|
28
28
|
/**
|
|
29
|
-
* Hook style modal
|
|
30
|
-
* @param init initial props
|
|
29
|
+
* Hook style modal
|
|
31
30
|
*
|
|
32
|
-
* ```
|
|
31
|
+
* ```tsx
|
|
33
32
|
* function Example() {
|
|
34
33
|
* const { modal, setModalProps } = useModal()
|
|
35
34
|
*
|
|
36
35
|
* return <>
|
|
37
36
|
* <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
|
|
38
|
-
* {modal}
|
|
37
|
+
* {modal}
|
|
38
|
+
* </>
|
|
39
39
|
* }
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
@@ -50,11 +50,9 @@ interface DrawerProps extends DrawerProps$1 {
|
|
|
50
50
|
}
|
|
51
51
|
type setDrawerProps = (changes: Partial<DrawerProps>) => void;
|
|
52
52
|
/**
|
|
53
|
-
* Hook style drawer
|
|
53
|
+
* Hook style drawer
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* ```ts
|
|
55
|
+
* ```tsx
|
|
58
56
|
* function Example() {
|
|
59
57
|
* const { drawer, setDrawerProps } = useDrawer()
|
|
60
58
|
*
|
|
@@ -73,6 +71,9 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
73
71
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
74
72
|
};
|
|
75
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Styled error boundary.
|
|
76
|
+
*/
|
|
76
77
|
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
77
78
|
|
|
78
79
|
interface ConfigProviderProps {
|
|
@@ -113,9 +114,12 @@ interface ConfigProviderProps {
|
|
|
113
114
|
}
|
|
114
115
|
declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
|
|
115
116
|
/**
|
|
116
|
-
* Config for
|
|
117
|
+
* Config for `@faasjs/ant-design` components.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* import { ConfigProvider } from '@faasjs/ant-design'
|
|
117
122
|
*
|
|
118
|
-
* ```ts
|
|
119
123
|
* <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
|
|
120
124
|
* <Blank />
|
|
121
125
|
* </ConfigProvider>
|
|
@@ -126,10 +130,15 @@ declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
|
126
130
|
|
|
127
131
|
interface AppProps {
|
|
128
132
|
children: React.ReactNode;
|
|
133
|
+
/** https://ant.design/docs/react/compatible-style#styleprovider */
|
|
129
134
|
styleProviderProps?: StyleProviderProps;
|
|
135
|
+
/** https://ant.design/components/config-provider/#API */
|
|
130
136
|
configProviderProps?: ConfigProviderProps$1;
|
|
137
|
+
/** https://reactrouter.com/en/router-components/browser-router */
|
|
131
138
|
browserRouterProps?: BrowserRouterProps;
|
|
139
|
+
/** https://faasjs.com/doc/ant-design/#errorboundary */
|
|
132
140
|
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
141
|
+
/** https://faasjs.com/doc/ant-design/#configprovider */
|
|
133
142
|
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'>;
|
|
134
143
|
}
|
|
135
144
|
interface useAppProps {
|
|
@@ -138,6 +147,33 @@ interface useAppProps {
|
|
|
138
147
|
setModalProps: (changes: Partial<ModalProps>) => void;
|
|
139
148
|
setDrawerProps: (changes: Partial<DrawerProps>) => void;
|
|
140
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* App component with Ant Design & FaasJS
|
|
152
|
+
*
|
|
153
|
+
* - Based on Ant Design's [ConfigProvider](https://ant.design/components/config-provider/) and [StyleProvider](https://ant.design/components/style-provider/).
|
|
154
|
+
* - Integrated Ant Design's [Message](https://ant.design/components/message/) and [Notification](https://ant.design/components/notification/).
|
|
155
|
+
* - Based on FaasJS's [ConfigProvider](https://faasjs.com/doc/ant-design/#configprovider).
|
|
156
|
+
* - 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).
|
|
157
|
+
* - Integrated React Router's [BrowserRouter](https://reactrouter.com/en/router-components/browser-router).
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```tsx
|
|
161
|
+
* import { App } from '@faasjs/ant-design'
|
|
162
|
+
*
|
|
163
|
+
* export default function () {
|
|
164
|
+
* return (
|
|
165
|
+
* <App
|
|
166
|
+
* styleProviderProps={{}} // https://ant.design/docs/react/compatible-style#styleprovider
|
|
167
|
+
* configProviderProps={{}} // https://ant.design/components/config-provider/#API
|
|
168
|
+
* browserRouterProps={{}} // https://reactrouter.com/en/router-components/browser-router
|
|
169
|
+
* errorBoundaryProps={{}} // https://faasjs.com/doc/ant-design/#errorboundary
|
|
170
|
+
* faasConfigProviderProps={{}} // https://faasjs.com/doc/ant-design/#configprovider
|
|
171
|
+
* >
|
|
172
|
+
* <div>content</div>
|
|
173
|
+
* </App>
|
|
174
|
+
* )
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
141
177
|
declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
|
|
142
178
|
declare namespace App {
|
|
143
179
|
var useApp: typeof useApp;
|
|
@@ -162,12 +198,10 @@ interface BlankProps {
|
|
|
162
198
|
*
|
|
163
199
|
* If value is undefined or null, return text, otherwise return value.
|
|
164
200
|
*
|
|
165
|
-
* @
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @returns {JSX.Element}
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* import { Blank } from '@faasjs/ant-design'
|
|
169
204
|
*
|
|
170
|
-
* ```ts
|
|
171
205
|
* <Blank value={undefined} text="Empty" />
|
|
172
206
|
* ```
|
|
173
207
|
*/
|
|
@@ -200,9 +234,13 @@ interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>,
|
|
|
200
234
|
if?: (values: Record<string, any>) => boolean;
|
|
201
235
|
}
|
|
202
236
|
/**
|
|
203
|
-
* FormItem
|
|
237
|
+
* FormItem
|
|
204
238
|
*
|
|
205
|
-
*
|
|
239
|
+
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
240
|
+
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```tsx
|
|
206
244
|
* // use inline type
|
|
207
245
|
* <FormItem type='string' id='name' />
|
|
208
246
|
*
|
|
@@ -230,11 +268,12 @@ type LoadingProps = {
|
|
|
230
268
|
/**
|
|
231
269
|
* Loading component based on Spin
|
|
232
270
|
*
|
|
271
|
+
* @example
|
|
233
272
|
* ```tsx
|
|
234
273
|
* <Loading /> // display loading
|
|
235
274
|
*
|
|
236
275
|
* <Loading loading={ !remoteData }>
|
|
237
|
-
*
|
|
276
|
+
* <div>{remoteData}</div>
|
|
238
277
|
* </Loading>
|
|
239
278
|
* ```
|
|
240
279
|
*/
|
|
@@ -248,6 +287,7 @@ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
|
248
287
|
/**
|
|
249
288
|
* FaasDataWrapper component with Loading
|
|
250
289
|
*
|
|
290
|
+
* @example
|
|
251
291
|
* ```tsx
|
|
252
292
|
* function MyComponent (props: FaasDataInjection) {
|
|
253
293
|
* return <div>{ props.data }</div>
|
|
@@ -293,7 +333,26 @@ interface DescriptionItemContentProps<T = any> {
|
|
|
293
333
|
};
|
|
294
334
|
}
|
|
295
335
|
/**
|
|
296
|
-
* Description component
|
|
336
|
+
* Description component
|
|
337
|
+
*
|
|
338
|
+
* - Based on [Ant Design Descriptions](https://ant.design/components/descriptions/).
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```tsx
|
|
342
|
+
* import { Description } from '@faasjs/ant-design'
|
|
343
|
+
*
|
|
344
|
+
* <Description
|
|
345
|
+
* title="Title"
|
|
346
|
+
* items={[
|
|
347
|
+
* {
|
|
348
|
+
* id: 'id',
|
|
349
|
+
* title: 'Title',
|
|
350
|
+
* type: 'string',
|
|
351
|
+
* },
|
|
352
|
+
* ]}
|
|
353
|
+
* dataSource={{ id: 'value' }}
|
|
354
|
+
* />
|
|
355
|
+
* ```
|
|
297
356
|
*/
|
|
298
357
|
declare function Description<T = any>(props: DescriptionProps<T>): react_jsx_runtime.JSX.Element;
|
|
299
358
|
|
|
@@ -326,12 +385,10 @@ type TableProps<T = any, ExtendTypes = any> = {
|
|
|
326
385
|
/**
|
|
327
386
|
* Table component with Ant Design & FaasJS
|
|
328
387
|
*
|
|
329
|
-
* -
|
|
388
|
+
* - Based on [Ant Design Table](https://ant.design/components/table/).
|
|
330
389
|
* - Support FaasJS injection.
|
|
331
390
|
* - Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
332
391
|
* - Auto generate sorter (disable with `sorter: false`).
|
|
333
|
-
*
|
|
334
|
-
* @ref https://ant.design/components/table/
|
|
335
392
|
*/
|
|
336
393
|
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
|
|
337
394
|
|
|
@@ -438,7 +495,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps =
|
|
|
438
495
|
/**
|
|
439
496
|
* Form component with Ant Design & FaasJS
|
|
440
497
|
*
|
|
441
|
-
*
|
|
498
|
+
* - Based on [Ant Design Form](https://ant.design/components/form/).
|
|
442
499
|
*/
|
|
443
500
|
declare function Form<Values = any>(props: FormProps<Values>): react_jsx_runtime.JSX.Element;
|
|
444
501
|
declare namespace Form {
|
|
@@ -464,9 +521,10 @@ interface LinkProps {
|
|
|
464
521
|
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
465
522
|
}
|
|
466
523
|
/**
|
|
467
|
-
* Link component with button
|
|
524
|
+
* Link component with button
|
|
468
525
|
*
|
|
469
|
-
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```tsx
|
|
470
528
|
* // pure link
|
|
471
529
|
* <Link href="/">Home</Link>
|
|
472
530
|
*
|
|
@@ -487,6 +545,7 @@ interface RoutesProps {
|
|
|
487
545
|
/**
|
|
488
546
|
* Routes with lazy loading and 404 page.
|
|
489
547
|
*
|
|
548
|
+
* @example
|
|
490
549
|
* ```tsx
|
|
491
550
|
* import { Routes, lazy } from '@faasjs/ant-design'
|
|
492
551
|
* import { BrowserRouter } from 'react-router-dom'
|
|
@@ -512,12 +571,32 @@ interface TabProps extends Partial<Tab> {
|
|
|
512
571
|
}
|
|
513
572
|
interface TabsProps extends Omit<TabsProps$1, 'items'> {
|
|
514
573
|
/** auto skip null tab */
|
|
515
|
-
items: (TabProps | null)[];
|
|
574
|
+
items: (TabProps | null | false)[];
|
|
516
575
|
}
|
|
517
576
|
/**
|
|
518
577
|
* Tabs component with Ant Design & FaasJS
|
|
519
578
|
*
|
|
520
|
-
*
|
|
579
|
+
* - Based on [Ant Design Tabs](https://ant.design/components/tabs/).
|
|
580
|
+
* - Support auto skip null/false tab item.
|
|
581
|
+
* - Support `id` as key and label.
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```tsx
|
|
585
|
+
* import { Tabs } from '@faasjs/ant-design'
|
|
586
|
+
*
|
|
587
|
+
* <Tabs
|
|
588
|
+
* items={[
|
|
589
|
+
* {
|
|
590
|
+
* id: 'id',
|
|
591
|
+
* children: 'content',
|
|
592
|
+
* },
|
|
593
|
+
* 1 === 0 && {
|
|
594
|
+
* id: 'hidden',
|
|
595
|
+
* children: 'content',
|
|
596
|
+
* },
|
|
597
|
+
* ]}
|
|
598
|
+
* />
|
|
599
|
+
* ```
|
|
521
600
|
*/
|
|
522
601
|
declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
|
|
523
602
|
|
|
@@ -537,10 +616,11 @@ interface TitleProps {
|
|
|
537
616
|
children?: JSX.Element;
|
|
538
617
|
}
|
|
539
618
|
/**
|
|
540
|
-
* Title is used to change the title of the page
|
|
619
|
+
* Title is used to change the title of the page
|
|
620
|
+
*
|
|
541
621
|
* Return null by default.
|
|
542
622
|
*
|
|
543
|
-
* ```
|
|
623
|
+
* ```tsx
|
|
544
624
|
* // return null
|
|
545
625
|
* <Title title='hi' /> // => change the document.title to 'hi'
|
|
546
626
|
* <Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
package/dist/index.d.ts
CHANGED
|
@@ -26,16 +26,16 @@ interface ModalProps extends ModalProps$1 {
|
|
|
26
26
|
}
|
|
27
27
|
type setModalProps = (changes: Partial<ModalProps>) => void;
|
|
28
28
|
/**
|
|
29
|
-
* Hook style modal
|
|
30
|
-
* @param init initial props
|
|
29
|
+
* Hook style modal
|
|
31
30
|
*
|
|
32
|
-
* ```
|
|
31
|
+
* ```tsx
|
|
33
32
|
* function Example() {
|
|
34
33
|
* const { modal, setModalProps } = useModal()
|
|
35
34
|
*
|
|
36
35
|
* return <>
|
|
37
36
|
* <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
|
|
38
|
-
* {modal}
|
|
37
|
+
* {modal}
|
|
38
|
+
* </>
|
|
39
39
|
* }
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
@@ -50,11 +50,9 @@ interface DrawerProps extends DrawerProps$1 {
|
|
|
50
50
|
}
|
|
51
51
|
type setDrawerProps = (changes: Partial<DrawerProps>) => void;
|
|
52
52
|
/**
|
|
53
|
-
* Hook style drawer
|
|
53
|
+
* Hook style drawer
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* ```ts
|
|
55
|
+
* ```tsx
|
|
58
56
|
* function Example() {
|
|
59
57
|
* const { drawer, setDrawerProps } = useDrawer()
|
|
60
58
|
*
|
|
@@ -73,6 +71,9 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
73
71
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
74
72
|
};
|
|
75
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Styled error boundary.
|
|
76
|
+
*/
|
|
76
77
|
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
77
78
|
|
|
78
79
|
interface ConfigProviderProps {
|
|
@@ -113,9 +114,12 @@ interface ConfigProviderProps {
|
|
|
113
114
|
}
|
|
114
115
|
declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
|
|
115
116
|
/**
|
|
116
|
-
* Config for
|
|
117
|
+
* Config for `@faasjs/ant-design` components.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* import { ConfigProvider } from '@faasjs/ant-design'
|
|
117
122
|
*
|
|
118
|
-
* ```ts
|
|
119
123
|
* <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
|
|
120
124
|
* <Blank />
|
|
121
125
|
* </ConfigProvider>
|
|
@@ -126,10 +130,15 @@ declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
|
126
130
|
|
|
127
131
|
interface AppProps {
|
|
128
132
|
children: React.ReactNode;
|
|
133
|
+
/** https://ant.design/docs/react/compatible-style#styleprovider */
|
|
129
134
|
styleProviderProps?: StyleProviderProps;
|
|
135
|
+
/** https://ant.design/components/config-provider/#API */
|
|
130
136
|
configProviderProps?: ConfigProviderProps$1;
|
|
137
|
+
/** https://reactrouter.com/en/router-components/browser-router */
|
|
131
138
|
browserRouterProps?: BrowserRouterProps;
|
|
139
|
+
/** https://faasjs.com/doc/ant-design/#errorboundary */
|
|
132
140
|
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
141
|
+
/** https://faasjs.com/doc/ant-design/#configprovider */
|
|
133
142
|
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'>;
|
|
134
143
|
}
|
|
135
144
|
interface useAppProps {
|
|
@@ -138,6 +147,33 @@ interface useAppProps {
|
|
|
138
147
|
setModalProps: (changes: Partial<ModalProps>) => void;
|
|
139
148
|
setDrawerProps: (changes: Partial<DrawerProps>) => void;
|
|
140
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* App component with Ant Design & FaasJS
|
|
152
|
+
*
|
|
153
|
+
* - Based on Ant Design's [ConfigProvider](https://ant.design/components/config-provider/) and [StyleProvider](https://ant.design/components/style-provider/).
|
|
154
|
+
* - Integrated Ant Design's [Message](https://ant.design/components/message/) and [Notification](https://ant.design/components/notification/).
|
|
155
|
+
* - Based on FaasJS's [ConfigProvider](https://faasjs.com/doc/ant-design/#configprovider).
|
|
156
|
+
* - 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).
|
|
157
|
+
* - Integrated React Router's [BrowserRouter](https://reactrouter.com/en/router-components/browser-router).
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```tsx
|
|
161
|
+
* import { App } from '@faasjs/ant-design'
|
|
162
|
+
*
|
|
163
|
+
* export default function () {
|
|
164
|
+
* return (
|
|
165
|
+
* <App
|
|
166
|
+
* styleProviderProps={{}} // https://ant.design/docs/react/compatible-style#styleprovider
|
|
167
|
+
* configProviderProps={{}} // https://ant.design/components/config-provider/#API
|
|
168
|
+
* browserRouterProps={{}} // https://reactrouter.com/en/router-components/browser-router
|
|
169
|
+
* errorBoundaryProps={{}} // https://faasjs.com/doc/ant-design/#errorboundary
|
|
170
|
+
* faasConfigProviderProps={{}} // https://faasjs.com/doc/ant-design/#configprovider
|
|
171
|
+
* >
|
|
172
|
+
* <div>content</div>
|
|
173
|
+
* </App>
|
|
174
|
+
* )
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
141
177
|
declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
|
|
142
178
|
declare namespace App {
|
|
143
179
|
var useApp: typeof useApp;
|
|
@@ -162,12 +198,10 @@ interface BlankProps {
|
|
|
162
198
|
*
|
|
163
199
|
* If value is undefined or null, return text, otherwise return value.
|
|
164
200
|
*
|
|
165
|
-
* @
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @returns {JSX.Element}
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* import { Blank } from '@faasjs/ant-design'
|
|
169
204
|
*
|
|
170
|
-
* ```ts
|
|
171
205
|
* <Blank value={undefined} text="Empty" />
|
|
172
206
|
* ```
|
|
173
207
|
*/
|
|
@@ -200,9 +234,13 @@ interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>,
|
|
|
200
234
|
if?: (values: Record<string, any>) => boolean;
|
|
201
235
|
}
|
|
202
236
|
/**
|
|
203
|
-
* FormItem
|
|
237
|
+
* FormItem
|
|
204
238
|
*
|
|
205
|
-
*
|
|
239
|
+
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
240
|
+
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```tsx
|
|
206
244
|
* // use inline type
|
|
207
245
|
* <FormItem type='string' id='name' />
|
|
208
246
|
*
|
|
@@ -230,11 +268,12 @@ type LoadingProps = {
|
|
|
230
268
|
/**
|
|
231
269
|
* Loading component based on Spin
|
|
232
270
|
*
|
|
271
|
+
* @example
|
|
233
272
|
* ```tsx
|
|
234
273
|
* <Loading /> // display loading
|
|
235
274
|
*
|
|
236
275
|
* <Loading loading={ !remoteData }>
|
|
237
|
-
*
|
|
276
|
+
* <div>{remoteData}</div>
|
|
238
277
|
* </Loading>
|
|
239
278
|
* ```
|
|
240
279
|
*/
|
|
@@ -248,6 +287,7 @@ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
|
248
287
|
/**
|
|
249
288
|
* FaasDataWrapper component with Loading
|
|
250
289
|
*
|
|
290
|
+
* @example
|
|
251
291
|
* ```tsx
|
|
252
292
|
* function MyComponent (props: FaasDataInjection) {
|
|
253
293
|
* return <div>{ props.data }</div>
|
|
@@ -293,7 +333,26 @@ interface DescriptionItemContentProps<T = any> {
|
|
|
293
333
|
};
|
|
294
334
|
}
|
|
295
335
|
/**
|
|
296
|
-
* Description component
|
|
336
|
+
* Description component
|
|
337
|
+
*
|
|
338
|
+
* - Based on [Ant Design Descriptions](https://ant.design/components/descriptions/).
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```tsx
|
|
342
|
+
* import { Description } from '@faasjs/ant-design'
|
|
343
|
+
*
|
|
344
|
+
* <Description
|
|
345
|
+
* title="Title"
|
|
346
|
+
* items={[
|
|
347
|
+
* {
|
|
348
|
+
* id: 'id',
|
|
349
|
+
* title: 'Title',
|
|
350
|
+
* type: 'string',
|
|
351
|
+
* },
|
|
352
|
+
* ]}
|
|
353
|
+
* dataSource={{ id: 'value' }}
|
|
354
|
+
* />
|
|
355
|
+
* ```
|
|
297
356
|
*/
|
|
298
357
|
declare function Description<T = any>(props: DescriptionProps<T>): react_jsx_runtime.JSX.Element;
|
|
299
358
|
|
|
@@ -326,12 +385,10 @@ type TableProps<T = any, ExtendTypes = any> = {
|
|
|
326
385
|
/**
|
|
327
386
|
* Table component with Ant Design & FaasJS
|
|
328
387
|
*
|
|
329
|
-
* -
|
|
388
|
+
* - Based on [Ant Design Table](https://ant.design/components/table/).
|
|
330
389
|
* - Support FaasJS injection.
|
|
331
390
|
* - Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
332
391
|
* - Auto generate sorter (disable with `sorter: false`).
|
|
333
|
-
*
|
|
334
|
-
* @ref https://ant.design/components/table/
|
|
335
392
|
*/
|
|
336
393
|
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
|
|
337
394
|
|
|
@@ -438,7 +495,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps =
|
|
|
438
495
|
/**
|
|
439
496
|
* Form component with Ant Design & FaasJS
|
|
440
497
|
*
|
|
441
|
-
*
|
|
498
|
+
* - Based on [Ant Design Form](https://ant.design/components/form/).
|
|
442
499
|
*/
|
|
443
500
|
declare function Form<Values = any>(props: FormProps<Values>): react_jsx_runtime.JSX.Element;
|
|
444
501
|
declare namespace Form {
|
|
@@ -464,9 +521,10 @@ interface LinkProps {
|
|
|
464
521
|
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
465
522
|
}
|
|
466
523
|
/**
|
|
467
|
-
* Link component with button
|
|
524
|
+
* Link component with button
|
|
468
525
|
*
|
|
469
|
-
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```tsx
|
|
470
528
|
* // pure link
|
|
471
529
|
* <Link href="/">Home</Link>
|
|
472
530
|
*
|
|
@@ -487,6 +545,7 @@ interface RoutesProps {
|
|
|
487
545
|
/**
|
|
488
546
|
* Routes with lazy loading and 404 page.
|
|
489
547
|
*
|
|
548
|
+
* @example
|
|
490
549
|
* ```tsx
|
|
491
550
|
* import { Routes, lazy } from '@faasjs/ant-design'
|
|
492
551
|
* import { BrowserRouter } from 'react-router-dom'
|
|
@@ -512,12 +571,32 @@ interface TabProps extends Partial<Tab> {
|
|
|
512
571
|
}
|
|
513
572
|
interface TabsProps extends Omit<TabsProps$1, 'items'> {
|
|
514
573
|
/** auto skip null tab */
|
|
515
|
-
items: (TabProps | null)[];
|
|
574
|
+
items: (TabProps | null | false)[];
|
|
516
575
|
}
|
|
517
576
|
/**
|
|
518
577
|
* Tabs component with Ant Design & FaasJS
|
|
519
578
|
*
|
|
520
|
-
*
|
|
579
|
+
* - Based on [Ant Design Tabs](https://ant.design/components/tabs/).
|
|
580
|
+
* - Support auto skip null/false tab item.
|
|
581
|
+
* - Support `id` as key and label.
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```tsx
|
|
585
|
+
* import { Tabs } from '@faasjs/ant-design'
|
|
586
|
+
*
|
|
587
|
+
* <Tabs
|
|
588
|
+
* items={[
|
|
589
|
+
* {
|
|
590
|
+
* id: 'id',
|
|
591
|
+
* children: 'content',
|
|
592
|
+
* },
|
|
593
|
+
* 1 === 0 && {
|
|
594
|
+
* id: 'hidden',
|
|
595
|
+
* children: 'content',
|
|
596
|
+
* },
|
|
597
|
+
* ]}
|
|
598
|
+
* />
|
|
599
|
+
* ```
|
|
521
600
|
*/
|
|
522
601
|
declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
|
|
523
602
|
|
|
@@ -537,10 +616,11 @@ interface TitleProps {
|
|
|
537
616
|
children?: JSX.Element;
|
|
538
617
|
}
|
|
539
618
|
/**
|
|
540
|
-
* Title is used to change the title of the page
|
|
619
|
+
* Title is used to change the title of the page
|
|
620
|
+
*
|
|
541
621
|
* Return null by default.
|
|
542
622
|
*
|
|
543
|
-
* ```
|
|
623
|
+
* ```tsx
|
|
544
624
|
* // return null
|
|
545
625
|
* <Title title='hi' /> // => change the document.title to 'hi'
|
|
546
626
|
* <Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lodash-es": "*"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@faasjs/react": "1.
|
|
29
|
+
"@faasjs/react": "1.3.1",
|
|
30
30
|
"antd": "*",
|
|
31
31
|
"react": "*",
|
|
32
32
|
"react-dom": "*",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@testing-library/jest-dom": "*",
|
|
38
38
|
"@testing-library/react": "*",
|
|
39
39
|
"@testing-library/user-event": "*",
|
|
40
|
-
"@faasjs/react": "1.
|
|
40
|
+
"@faasjs/react": "1.3.1",
|
|
41
41
|
"antd": "*",
|
|
42
42
|
"react": "*",
|
|
43
43
|
"react-dom": "*",
|