@faasjs/ant-design 0.0.3-beta.24 → 0.0.3-beta.25
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 +111 -2
- package/dist/index.d.ts +23 -1
- package/dist/index.js +164 -121
- package/dist/index.mjs +197 -152
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -71,6 +71,8 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
|
|
|
71
71
|
- [ExtendTableItemProps](#extendtableitemprops)
|
|
72
72
|
- [ExtendTableTypeProps](#extendtabletypeprops)
|
|
73
73
|
- [ExtendTypes](#extendtypes)
|
|
74
|
+
- [FaasDataInjection](#faasdatainjection)
|
|
75
|
+
- [FaasDataWrapperProps](#faasdatawrapperprops)
|
|
74
76
|
- [FaasItemType](#faasitemtype)
|
|
75
77
|
- [FaasItemTypeValue](#faasitemtypevalue)
|
|
76
78
|
- [TableProps](#tableprops)
|
|
@@ -86,9 +88,11 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
|
|
|
86
88
|
- [Blank](#blank)
|
|
87
89
|
- [ConfigProvider](#configprovider)
|
|
88
90
|
- [Description](#description)
|
|
91
|
+
- [FaasDataWrapper](#faasdatawrapper)
|
|
89
92
|
- [Form](#form)
|
|
90
93
|
- [FormItem](#formitem)
|
|
91
94
|
- [Link](#link)
|
|
95
|
+
- [Loading](#loading)
|
|
92
96
|
- [PageNotFound](#pagenotfound)
|
|
93
97
|
- [Routes](#routes)
|
|
94
98
|
- [Table](#table)
|
|
@@ -166,6 +170,61 @@ ___
|
|
|
166
170
|
|
|
167
171
|
___
|
|
168
172
|
|
|
173
|
+
### FaasDataInjection
|
|
174
|
+
|
|
175
|
+
Ƭ **FaasDataInjection**<`Data`\>: `Object`
|
|
176
|
+
|
|
177
|
+
Injects FaasData props.
|
|
178
|
+
|
|
179
|
+
#### Type parameters
|
|
180
|
+
|
|
181
|
+
| Name | Type |
|
|
182
|
+
| :------ | :------ |
|
|
183
|
+
| `Data` | `any` |
|
|
184
|
+
|
|
185
|
+
#### Type declaration
|
|
186
|
+
|
|
187
|
+
| Name | Type |
|
|
188
|
+
| :------ | :------ |
|
|
189
|
+
| `action` | `string` \| `any` |
|
|
190
|
+
| `data` | `Data` |
|
|
191
|
+
| `error` | `any` |
|
|
192
|
+
| `loading` | `boolean` |
|
|
193
|
+
| `params` | `Record`<`string`, `any`\> |
|
|
194
|
+
| `promise` | `Promise`<`Response`<`Data`\>\> |
|
|
195
|
+
| `setData` | `React.Dispatch`<`React.SetStateAction`<`Data`\>\> |
|
|
196
|
+
| `setError` | `React.Dispatch`<`React.SetStateAction`<`any`\>\> |
|
|
197
|
+
| `setLoading` | `React.Dispatch`<`React.SetStateAction`<`boolean`\>\> |
|
|
198
|
+
| `setPromise` | `React.Dispatch`<`React.SetStateAction`<`Promise`<`Response`<`Data`\>\>\>\> |
|
|
199
|
+
| `reload` | (`params?`: `Record`<`string`, `any`\>) => `Promise`<`Response`<`Data`\>\> |
|
|
200
|
+
|
|
201
|
+
___
|
|
202
|
+
|
|
203
|
+
### FaasDataWrapperProps
|
|
204
|
+
|
|
205
|
+
Ƭ **FaasDataWrapperProps**<`PathOrData`\>: `Object`
|
|
206
|
+
|
|
207
|
+
#### Type parameters
|
|
208
|
+
|
|
209
|
+
| Name | Type |
|
|
210
|
+
| :------ | :------ |
|
|
211
|
+
| `PathOrData` | extends `FaasAction` |
|
|
212
|
+
|
|
213
|
+
#### Type declaration
|
|
214
|
+
|
|
215
|
+
| Name | Type | Description |
|
|
216
|
+
| :------ | :------ | :------ |
|
|
217
|
+
| `action` | `string` | - |
|
|
218
|
+
| `children?` | `JSX.Element` | - |
|
|
219
|
+
| `data?` | `FaasData`<`PathOrData`\> | use custom data, should work with setData |
|
|
220
|
+
| `fallback?` | `JSX.Element` \| ``false`` | - |
|
|
221
|
+
| `params?` | `FaasParams`<`PathOrData`\> | - |
|
|
222
|
+
| `setData?` | `React.Dispatch`<`React.SetStateAction`<`FaasData`<`PathOrData`\>\>\> | use custom setData, should work with data |
|
|
223
|
+
| `onDataChange?` | (`args`: [`FaasDataInjection`](#faasdatainjection)<`FaasData`<`PathOrData`\>\>) => `void` | - |
|
|
224
|
+
| `render?` | (`args`: [`FaasDataInjection`](#faasdatainjection)<`FaasData`<`PathOrData`\>\>) => `Element` \| `Element`[] | - |
|
|
225
|
+
|
|
226
|
+
___
|
|
227
|
+
|
|
169
228
|
### FaasItemType
|
|
170
229
|
|
|
171
230
|
Ƭ **FaasItemType**: ``"string"`` \| ``"string[]"`` \| ``"number"`` \| ``"number[]"`` \| ``"boolean"`` \| ``"date"`` \| ``"time"`` \| ``"object"`` \| ``"object[]"``
|
|
@@ -196,7 +255,7 @@ ___
|
|
|
196
255
|
|
|
197
256
|
### TableProps
|
|
198
257
|
|
|
199
|
-
Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: `FaasDataWrapperProps
|
|
258
|
+
Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: [`FaasDataWrapperProps`](#faasdatawrapperprops)<`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`\>
|
|
200
259
|
|
|
201
260
|
#### Type parameters
|
|
202
261
|
|
|
@@ -257,6 +316,8 @@ ___
|
|
|
257
316
|
|
|
258
317
|
▸ **Blank**(`options?`): `JSX.Element`
|
|
259
318
|
|
|
319
|
+
Blank component.
|
|
320
|
+
|
|
260
321
|
If value is undefined or null, return text, otherwise return value.
|
|
261
322
|
|
|
262
323
|
#### Parameters
|
|
@@ -309,6 +370,8 @@ ___
|
|
|
309
370
|
|
|
310
371
|
▸ **Description**<`T`\>(`props`): `Element`
|
|
311
372
|
|
|
373
|
+
Description component.
|
|
374
|
+
|
|
312
375
|
#### Type parameters
|
|
313
376
|
|
|
314
377
|
| Name | Type |
|
|
@@ -327,6 +390,30 @@ ___
|
|
|
327
390
|
|
|
328
391
|
___
|
|
329
392
|
|
|
393
|
+
### FaasDataWrapper
|
|
394
|
+
|
|
395
|
+
▸ **FaasDataWrapper**<`T`\>(`props`): `JSX.Element`
|
|
396
|
+
|
|
397
|
+
FaasDataWrapper component with Loading and ErrorBoundary
|
|
398
|
+
|
|
399
|
+
#### Type parameters
|
|
400
|
+
|
|
401
|
+
| Name | Type |
|
|
402
|
+
| :------ | :------ |
|
|
403
|
+
| `T` | `any` |
|
|
404
|
+
|
|
405
|
+
#### Parameters
|
|
406
|
+
|
|
407
|
+
| Name | Type |
|
|
408
|
+
| :------ | :------ |
|
|
409
|
+
| `props` | [`FaasDataWrapperProps`](#faasdatawrapperprops)<`T`\> |
|
|
410
|
+
|
|
411
|
+
#### Returns
|
|
412
|
+
|
|
413
|
+
`JSX.Element`
|
|
414
|
+
|
|
415
|
+
___
|
|
416
|
+
|
|
330
417
|
### Form
|
|
331
418
|
|
|
332
419
|
▸ **Form**<`Values`\>(`props`): `Element`
|
|
@@ -393,12 +480,14 @@ ___
|
|
|
393
480
|
|
|
394
481
|
▸ **Link**(`«destructured»`): `Element`
|
|
395
482
|
|
|
483
|
+
Link component with button.
|
|
484
|
+
|
|
396
485
|
```ts
|
|
397
486
|
// pure link
|
|
398
487
|
<Link href="/">Home</Link>
|
|
399
488
|
|
|
400
489
|
// link with button
|
|
401
|
-
<Link href="/" button={{type:'primary'}}>Home</Link>
|
|
490
|
+
<Link href="/" button={{ type:'primary' }}>Home</Link>
|
|
402
491
|
```
|
|
403
492
|
|
|
404
493
|
#### Parameters
|
|
@@ -413,6 +502,26 @@ ___
|
|
|
413
502
|
|
|
414
503
|
___
|
|
415
504
|
|
|
505
|
+
### Loading
|
|
506
|
+
|
|
507
|
+
▸ **Loading**(`props`): `Element`
|
|
508
|
+
|
|
509
|
+
Loading component based on Spin
|
|
510
|
+
|
|
511
|
+
#### Parameters
|
|
512
|
+
|
|
513
|
+
| Name | Type |
|
|
514
|
+
| :------ | :------ |
|
|
515
|
+
| `props` | `Object` |
|
|
516
|
+
| `props.size?` | ``"small"`` \| ``"default"`` \| ``"large"`` |
|
|
517
|
+
| `props.style?` | `CSSProperties` |
|
|
518
|
+
|
|
519
|
+
#### Returns
|
|
520
|
+
|
|
521
|
+
`Element`
|
|
522
|
+
|
|
523
|
+
___
|
|
524
|
+
|
|
416
525
|
### PageNotFound
|
|
417
526
|
|
|
418
527
|
▸ **PageNotFound**(): `Element`
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Dayjs } from 'dayjs';
|
|
|
4
4
|
import { DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, TimePickerProps, FormInstance, FormProps as FormProps$1, ButtonProps, ModalProps as ModalProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
|
|
5
5
|
export { Drawer, Modal } from 'antd';
|
|
6
6
|
import { FaasDataWrapperProps } from '@faasjs/react';
|
|
7
|
+
export { FaasDataInjection, FaasDataWrapperProps } from '@faasjs/react';
|
|
7
8
|
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
8
9
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
9
10
|
import { RouteProps } from 'react-router-dom';
|
|
@@ -14,6 +15,8 @@ interface BlankProps {
|
|
|
14
15
|
text?: string;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
18
|
+
* Blank component.
|
|
19
|
+
*
|
|
17
20
|
* If value is undefined or null, return text, otherwise return value.
|
|
18
21
|
*
|
|
19
22
|
* @param options {object}
|
|
@@ -114,6 +117,11 @@ declare function transferOptions(options: BaseOption[]): {
|
|
|
114
117
|
}[];
|
|
115
118
|
declare function transferValue(type: FaasItemType, value: any): any;
|
|
116
119
|
|
|
120
|
+
/**
|
|
121
|
+
* FaasDataWrapper component with Loading and ErrorBoundary
|
|
122
|
+
*/
|
|
123
|
+
declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
124
|
+
|
|
117
125
|
interface ExtendDescriptionTypeProps {
|
|
118
126
|
children?: JSX.Element;
|
|
119
127
|
render?: (value: any, values: any) => JSX.Element;
|
|
@@ -142,6 +150,9 @@ interface DescriptionItemContentProps<T = any> {
|
|
|
142
150
|
[key: string]: ExtendDescriptionTypeProps;
|
|
143
151
|
};
|
|
144
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Description component.
|
|
155
|
+
*/
|
|
145
156
|
declare function Description<T = any>(props: DescriptionProps<T>): JSX.Element;
|
|
146
157
|
|
|
147
158
|
interface DrawerProps extends DrawerProps$1 {
|
|
@@ -150,6 +161,7 @@ interface DrawerProps extends DrawerProps$1 {
|
|
|
150
161
|
type setDrawerProps = (changes: Partial<DrawerProps>) => void;
|
|
151
162
|
/**
|
|
152
163
|
* Hook style drawer.
|
|
164
|
+
*
|
|
153
165
|
* @param init initial props
|
|
154
166
|
*
|
|
155
167
|
* ```ts
|
|
@@ -273,6 +285,8 @@ interface LinkProps {
|
|
|
273
285
|
button?: ButtonProps;
|
|
274
286
|
}
|
|
275
287
|
/**
|
|
288
|
+
* Link component with button.
|
|
289
|
+
*
|
|
276
290
|
* ```ts
|
|
277
291
|
* // pure link
|
|
278
292
|
* <Link href="/">Home</Link>
|
|
@@ -283,6 +297,14 @@ interface LinkProps {
|
|
|
283
297
|
*/
|
|
284
298
|
declare function Link({ href, target, text, children, style, button, }: LinkProps): JSX.Element;
|
|
285
299
|
|
|
300
|
+
/**
|
|
301
|
+
* Loading component based on Spin
|
|
302
|
+
*/
|
|
303
|
+
declare function Loading(props: {
|
|
304
|
+
style?: React.CSSProperties;
|
|
305
|
+
size?: 'small' | 'default' | 'large';
|
|
306
|
+
}): JSX.Element;
|
|
307
|
+
|
|
286
308
|
interface ModalProps extends ModalProps$1 {
|
|
287
309
|
children?: JSX.Element | JSX.Element[] | string;
|
|
288
310
|
}
|
|
@@ -400,4 +422,4 @@ interface TitleProps {
|
|
|
400
422
|
*/
|
|
401
423
|
declare function Title(props: TitleProps): JSX.Element;
|
|
402
424
|
|
|
403
|
-
export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Link, LinkProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|
|
425
|
+
export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataWrapper, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Link, LinkProps, Loading, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|