@faasjs/ant-design 0.0.3-beta.31 → 0.0.3-beta.33
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 +120 -23
- package/dist/index.d.ts +175 -121
- package/dist/index.js +183 -95
- package/dist/index.mjs +268 -182
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -62,6 +62,7 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
|
|
|
62
62
|
- [RoutesProps](interfaces/RoutesProps.md)
|
|
63
63
|
- [TableItemProps](interfaces/TableItemProps.md)
|
|
64
64
|
- [TitleProps](interfaces/TitleProps.md)
|
|
65
|
+
- [UnionFaasItemProps](interfaces/UnionFaasItemProps.md)
|
|
65
66
|
|
|
66
67
|
### Type Aliases
|
|
67
68
|
|
|
@@ -77,7 +78,12 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
|
|
|
77
78
|
- [FaasItemType](#faasitemtype)
|
|
78
79
|
- [FaasItemTypeValue](#faasitemtypevalue)
|
|
79
80
|
- [FormSubmitProps](#formsubmitprops)
|
|
81
|
+
- [LoadingProps](#loadingprops)
|
|
80
82
|
- [TableProps](#tableprops)
|
|
83
|
+
- [UnionFaasItemElement](#unionfaasitemelement)
|
|
84
|
+
- [UnionFaasItemInjection](#unionfaasiteminjection)
|
|
85
|
+
- [UnionFaasItemRender](#unionfaasitemrender)
|
|
86
|
+
- [UnionScene](#unionscene)
|
|
81
87
|
- [setDrawerProps](#setdrawerprops)
|
|
82
88
|
- [setModalProps](#setmodalprops)
|
|
83
89
|
|
|
@@ -127,13 +133,19 @@ ___
|
|
|
127
133
|
|
|
128
134
|
### ExtendFormTypeProps
|
|
129
135
|
|
|
130
|
-
Ƭ **ExtendFormTypeProps
|
|
136
|
+
Ƭ **ExtendFormTypeProps**<`T`\>: `Object`
|
|
137
|
+
|
|
138
|
+
#### Type parameters
|
|
139
|
+
|
|
140
|
+
| Name | Type |
|
|
141
|
+
| :------ | :------ |
|
|
142
|
+
| `T` | `any` |
|
|
131
143
|
|
|
132
144
|
#### Type declaration
|
|
133
145
|
|
|
134
146
|
| Name | Type |
|
|
135
147
|
| :------ | :------ |
|
|
136
|
-
| `children?` | `
|
|
148
|
+
| `children?` | [`UnionFaasItemElement`](#unionfaasitemelement)<`T`\> |
|
|
137
149
|
|
|
138
150
|
___
|
|
139
151
|
|
|
@@ -151,14 +163,20 @@ ___
|
|
|
151
163
|
|
|
152
164
|
### ExtendTableTypeProps
|
|
153
165
|
|
|
154
|
-
Ƭ **ExtendTableTypeProps
|
|
166
|
+
Ƭ **ExtendTableTypeProps**<`T`\>: `Object`
|
|
167
|
+
|
|
168
|
+
#### Type parameters
|
|
169
|
+
|
|
170
|
+
| Name | Type |
|
|
171
|
+
| :------ | :------ |
|
|
172
|
+
| `T` | `any` |
|
|
155
173
|
|
|
156
174
|
#### Type declaration
|
|
157
175
|
|
|
158
176
|
| Name | Type |
|
|
159
177
|
| :------ | :------ |
|
|
160
178
|
| `children?` | `JSX.Element` |
|
|
161
|
-
| `render?` |
|
|
179
|
+
| `render?` | [`UnionFaasItemRender`](#unionfaasitemrender)<`T`\> |
|
|
162
180
|
|
|
163
181
|
___
|
|
164
182
|
|
|
@@ -204,26 +222,13 @@ ___
|
|
|
204
222
|
|
|
205
223
|
### FaasDataWrapperProps
|
|
206
224
|
|
|
207
|
-
Ƭ **FaasDataWrapperProps**<`
|
|
225
|
+
Ƭ **FaasDataWrapperProps**<`T`\>: `OriginProps`<`T`\> & { `loading?`: `JSX.Element` ; `loadingProps?`: [`LoadingProps`](#loadingprops) }
|
|
208
226
|
|
|
209
227
|
#### Type parameters
|
|
210
228
|
|
|
211
229
|
| Name | Type |
|
|
212
230
|
| :------ | :------ |
|
|
213
|
-
| `
|
|
214
|
-
|
|
215
|
-
#### Type declaration
|
|
216
|
-
|
|
217
|
-
| Name | Type | Description |
|
|
218
|
-
| :------ | :------ | :------ |
|
|
219
|
-
| `action` | `string` | - |
|
|
220
|
-
| `children?` | `JSX.Element` | - |
|
|
221
|
-
| `data?` | `FaasData`<`PathOrData`\> | use custom data, should work with setData |
|
|
222
|
-
| `fallback?` | `JSX.Element` \| ``false`` | - |
|
|
223
|
-
| `params?` | `FaasParams`<`PathOrData`\> | - |
|
|
224
|
-
| `setData?` | `React.Dispatch`<`React.SetStateAction`<`FaasData`<`PathOrData`\>\>\> | use custom setData, should work with data |
|
|
225
|
-
| `onDataChange?` | (`args`: [`FaasDataInjection`](#faasdatainjection)<`FaasData`<`PathOrData`\>\>) => `void` | - |
|
|
226
|
-
| `render?` | (`args`: [`FaasDataInjection`](#faasdatainjection)<`FaasData`<`PathOrData`\>\>) => `Element` \| `Element`[] | - |
|
|
231
|
+
| `T` | `any` |
|
|
227
232
|
|
|
228
233
|
___
|
|
229
234
|
|
|
@@ -273,6 +278,21 @@ ___
|
|
|
273
278
|
|
|
274
279
|
___
|
|
275
280
|
|
|
281
|
+
### LoadingProps
|
|
282
|
+
|
|
283
|
+
Ƭ **LoadingProps**: `Object`
|
|
284
|
+
|
|
285
|
+
#### Type declaration
|
|
286
|
+
|
|
287
|
+
| Name | Type |
|
|
288
|
+
| :------ | :------ |
|
|
289
|
+
| `children?` | `React.ReactNode` |
|
|
290
|
+
| `loading?` | `boolean` |
|
|
291
|
+
| `size?` | ``"small"`` \| ``"default"`` \| ``"large"`` |
|
|
292
|
+
| `style?` | `React.CSSProperties` |
|
|
293
|
+
|
|
294
|
+
___
|
|
295
|
+
|
|
276
296
|
### TableProps
|
|
277
297
|
|
|
278
298
|
Ƭ **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`\>
|
|
@@ -286,6 +306,77 @@ ___
|
|
|
286
306
|
|
|
287
307
|
___
|
|
288
308
|
|
|
309
|
+
### UnionFaasItemElement
|
|
310
|
+
|
|
311
|
+
Ƭ **UnionFaasItemElement**<`Value`, `Values`\>: `ReactElement`<[`UnionFaasItemInjection`](#unionfaasiteminjection)<`Value`, `Values`\>\> \| ``null``
|
|
312
|
+
|
|
313
|
+
#### Type parameters
|
|
314
|
+
|
|
315
|
+
| Name | Type |
|
|
316
|
+
| :------ | :------ |
|
|
317
|
+
| `Value` | `any` |
|
|
318
|
+
| `Values` | `any` |
|
|
319
|
+
|
|
320
|
+
___
|
|
321
|
+
|
|
322
|
+
### UnionFaasItemInjection
|
|
323
|
+
|
|
324
|
+
Ƭ **UnionFaasItemInjection**<`Value`, `Values`\>: `Object`
|
|
325
|
+
|
|
326
|
+
#### Type parameters
|
|
327
|
+
|
|
328
|
+
| Name | Type |
|
|
329
|
+
| :------ | :------ |
|
|
330
|
+
| `Value` | `any` |
|
|
331
|
+
| `Values` | `any` |
|
|
332
|
+
|
|
333
|
+
#### Type declaration
|
|
334
|
+
|
|
335
|
+
| Name | Type |
|
|
336
|
+
| :------ | :------ |
|
|
337
|
+
| `index?` | `number` |
|
|
338
|
+
| `scene?` | [`UnionScene`](#unionscene) |
|
|
339
|
+
| `value?` | `Value` |
|
|
340
|
+
| `values?` | `Values` |
|
|
341
|
+
|
|
342
|
+
___
|
|
343
|
+
|
|
344
|
+
### UnionFaasItemRender
|
|
345
|
+
|
|
346
|
+
Ƭ **UnionFaasItemRender**<`Value`, `Values`\>: (`value`: `Value`, `values`: `Values`, `index`: `number`, `scene`: [`UnionScene`](#unionscene)) => `JSX.Element` \| ``null``
|
|
347
|
+
|
|
348
|
+
#### Type parameters
|
|
349
|
+
|
|
350
|
+
| Name | Type |
|
|
351
|
+
| :------ | :------ |
|
|
352
|
+
| `Value` | `any` |
|
|
353
|
+
| `Values` | `any` |
|
|
354
|
+
|
|
355
|
+
#### Type declaration
|
|
356
|
+
|
|
357
|
+
▸ (`value`, `values`, `index`, `scene`): `JSX.Element` \| ``null``
|
|
358
|
+
|
|
359
|
+
##### Parameters
|
|
360
|
+
|
|
361
|
+
| Name | Type |
|
|
362
|
+
| :------ | :------ |
|
|
363
|
+
| `value` | `Value` |
|
|
364
|
+
| `values` | `Values` |
|
|
365
|
+
| `index` | `number` |
|
|
366
|
+
| `scene` | [`UnionScene`](#unionscene) |
|
|
367
|
+
|
|
368
|
+
##### Returns
|
|
369
|
+
|
|
370
|
+
`JSX.Element` \| ``null``
|
|
371
|
+
|
|
372
|
+
___
|
|
373
|
+
|
|
374
|
+
### UnionScene
|
|
375
|
+
|
|
376
|
+
Ƭ **UnionScene**: ``"form"`` \| ``"description"`` \| ``"table"``
|
|
377
|
+
|
|
378
|
+
___
|
|
379
|
+
|
|
289
380
|
### setDrawerProps
|
|
290
381
|
|
|
291
382
|
Ƭ **setDrawerProps**: (`changes`: `Partial`<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void`
|
|
@@ -528,13 +619,19 @@ ___
|
|
|
528
619
|
|
|
529
620
|
Loading component based on Spin
|
|
530
621
|
|
|
622
|
+
```tsx
|
|
623
|
+
<Loading /> // display loading
|
|
624
|
+
|
|
625
|
+
<Loading loading={ !remoteData }>
|
|
626
|
+
<div>{remoteData}</div>
|
|
627
|
+
</Loading>
|
|
628
|
+
```
|
|
629
|
+
|
|
531
630
|
#### Parameters
|
|
532
631
|
|
|
533
632
|
| Name | Type |
|
|
534
633
|
| :------ | :------ |
|
|
535
|
-
| `props` | `
|
|
536
|
-
| `props.size?` | ``"default"`` \| ``"small"`` \| ``"large"`` |
|
|
537
|
-
| `props.style?` | `CSSProperties` |
|
|
634
|
+
| `props` | [`LoadingProps`](#loadingprops) |
|
|
538
635
|
|
|
539
636
|
#### Returns
|
|
540
637
|
|
|
@@ -600,7 +697,7 @@ https://ant.design/components/table/
|
|
|
600
697
|
|
|
601
698
|
| Name | Type |
|
|
602
699
|
| :------ | :------ |
|
|
603
|
-
| `T` | `any
|
|
700
|
+
| `T` | extends `Record`<`string`, `any`\> |
|
|
604
701
|
| `ExtendTypes` | `any` |
|
|
605
702
|
|
|
606
703
|
#### Parameters
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, ReactNode, LazyExoticComponent, ComponentType } from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, ReactElement, Component, LazyExoticComponent, ComponentType } from 'react';
|
|
3
3
|
import { Dayjs } from 'dayjs';
|
|
4
|
-
import {
|
|
4
|
+
import { FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, TimePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, DrawerProps as DrawerProps$1, FormProps as FormProps$1, ButtonProps, ModalProps as ModalProps$1 } from 'antd';
|
|
5
5
|
export { Drawer, Modal } from 'antd';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
7
|
+
import { FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
8
|
+
export { FaasDataInjection } from '@faasjs/react';
|
|
9
|
+
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
|
|
8
10
|
import * as antd_es_form_context from 'antd/es/form/context';
|
|
9
11
|
import * as antd_es_form_ErrorList from 'antd/es/form/ErrorList';
|
|
10
12
|
import * as antd_es_form from 'antd/es/form';
|
|
11
13
|
import * as rc_field_form_es_useWatch from 'rc-field-form/es/useWatch';
|
|
12
14
|
import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
|
|
13
15
|
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
14
|
-
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
15
16
|
import { RouteProps } from 'react-router-dom';
|
|
16
|
-
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
|
|
17
17
|
|
|
18
18
|
interface BlankProps {
|
|
19
19
|
value?: any;
|
|
@@ -87,56 +87,92 @@ declare function ConfigProvider({ config, children }: {
|
|
|
87
87
|
}): JSX.Element;
|
|
88
88
|
declare function useConfigContext(): ConfigProviderProps;
|
|
89
89
|
|
|
90
|
-
type
|
|
91
|
-
|
|
92
|
-
type FaasItemTypeValue = {
|
|
93
|
-
string: string;
|
|
94
|
-
'string[]': string[];
|
|
95
|
-
number: number;
|
|
96
|
-
'number[]': number[];
|
|
97
|
-
boolean: boolean;
|
|
98
|
-
date: Dayjs;
|
|
99
|
-
time: Dayjs;
|
|
100
|
-
object: any;
|
|
101
|
-
'object[]': any[];
|
|
90
|
+
type ExtendFormTypeProps<T = any> = {
|
|
91
|
+
children?: UnionFaasItemElement<T>;
|
|
102
92
|
};
|
|
103
|
-
type
|
|
104
|
-
|
|
105
|
-
value?: string | number;
|
|
93
|
+
type ExtendTypes = {
|
|
94
|
+
[type: string]: ExtendFormTypeProps;
|
|
106
95
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
|
|
97
|
+
interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
98
|
+
input?: InputProps | InputNumberProps | SwitchProps | SelectProps<T> | DatePickerProps | TimePickerProps;
|
|
99
|
+
maxCount?: number;
|
|
100
|
+
object?: FormItemProps[];
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
required?: boolean;
|
|
103
|
+
col?: number;
|
|
104
|
+
children?: UnionFaasItemElement<T>;
|
|
105
|
+
formChildren?: UnionFaasItemElement<T>;
|
|
106
|
+
render?: UnionFaasItemRender<T>;
|
|
107
|
+
formRender?: UnionFaasItemRender<T>;
|
|
108
|
+
rules?: RuleObject[];
|
|
109
|
+
label?: string | false;
|
|
110
|
+
extendTypes?: ExtendTypes;
|
|
111
|
+
/** trigger when current item's value changed */
|
|
112
|
+
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
113
|
+
/** trigger when any item's value changed */
|
|
114
|
+
if?: (values: Record<string, any>) => boolean;
|
|
111
115
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
/**
|
|
117
|
+
* FormItem, can be used without Form.
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* // use inline type
|
|
121
|
+
* <FormItem type='string' id='name' />
|
|
122
|
+
*
|
|
123
|
+
* // use custom type
|
|
124
|
+
* <FormItem id='password'>
|
|
125
|
+
* <Input.Password />
|
|
126
|
+
* </>
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
|
|
130
|
+
declare namespace FormItem {
|
|
131
|
+
var useStatus: () => {
|
|
132
|
+
status?: "" | "warning" | "error" | "success" | "validating";
|
|
133
|
+
};
|
|
118
134
|
}
|
|
119
|
-
declare function transferOptions(options: BaseOption[]): {
|
|
120
|
-
label: string;
|
|
121
|
-
value?: string | number;
|
|
122
|
-
}[];
|
|
123
|
-
declare function transferValue(type: FaasItemType, value: any): any;
|
|
124
135
|
|
|
136
|
+
type LoadingProps = {
|
|
137
|
+
style?: React.CSSProperties;
|
|
138
|
+
size?: 'small' | 'default' | 'large';
|
|
139
|
+
loading?: boolean;
|
|
140
|
+
children?: React.ReactNode;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Loading component based on Spin
|
|
144
|
+
*
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <Loading /> // display loading
|
|
147
|
+
*
|
|
148
|
+
* <Loading loading={ !remoteData }>
|
|
149
|
+
* <div>{remoteData}</div>
|
|
150
|
+
* </Loading>
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare function Loading(props: LoadingProps): JSX.Element;
|
|
154
|
+
|
|
155
|
+
interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
156
|
+
loadingProps?: LoadingProps;
|
|
157
|
+
loading?: JSX.Element;
|
|
158
|
+
}
|
|
125
159
|
/**
|
|
126
160
|
* FaasDataWrapper component with Loading and ErrorBoundary
|
|
127
161
|
*/
|
|
128
162
|
declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
129
163
|
|
|
130
|
-
interface ExtendDescriptionTypeProps {
|
|
131
|
-
children?:
|
|
132
|
-
render?:
|
|
164
|
+
interface ExtendDescriptionTypeProps<T = any> {
|
|
165
|
+
children?: UnionFaasItemElement<T>;
|
|
166
|
+
render?: UnionFaasItemRender<T>;
|
|
133
167
|
}
|
|
134
168
|
type ExtendDescriptionItemProps = BaseItemProps;
|
|
135
169
|
interface DescriptionItemProps<T = any> extends FaasItemProps {
|
|
136
|
-
children?:
|
|
137
|
-
|
|
170
|
+
children?: UnionFaasItemElement<T>;
|
|
171
|
+
descriptionChildren?: UnionFaasItemElement<T>;
|
|
172
|
+
render?: UnionFaasItemRender<T>;
|
|
173
|
+
descriptionRender?: UnionFaasItemRender<T>;
|
|
138
174
|
if?: (values: Record<string, any>) => boolean;
|
|
139
|
-
object?: DescriptionItemProps[];
|
|
175
|
+
object?: DescriptionItemProps<T>[];
|
|
140
176
|
}
|
|
141
177
|
interface DescriptionProps<T = any, ExtendItemProps = any> extends DescriptionsProps {
|
|
142
178
|
renderTitle?: ((values: T) => ReactNode);
|
|
@@ -160,6 +196,88 @@ interface DescriptionItemContentProps<T = any> {
|
|
|
160
196
|
*/
|
|
161
197
|
declare function Description<T = any>(props: DescriptionProps<T>): JSX.Element;
|
|
162
198
|
|
|
199
|
+
interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
|
|
200
|
+
optionsType?: 'auto';
|
|
201
|
+
children?: UnionFaasItemElement<T>;
|
|
202
|
+
tableChildren?: UnionFaasItemElement<T>;
|
|
203
|
+
render?: UnionFaasItemRender<T>;
|
|
204
|
+
tableRender?: UnionFaasItemRender<T>;
|
|
205
|
+
object?: TableItemProps<T>[];
|
|
206
|
+
}
|
|
207
|
+
type ExtendTableTypeProps<T = any> = {
|
|
208
|
+
children?: JSX.Element;
|
|
209
|
+
render?: UnionFaasItemRender<T>;
|
|
210
|
+
};
|
|
211
|
+
type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
|
|
212
|
+
type TableProps<T = any, ExtendTypes = any> = {
|
|
213
|
+
items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
|
|
214
|
+
extendTypes?: {
|
|
215
|
+
[key: string]: ExtendTableTypeProps;
|
|
216
|
+
};
|
|
217
|
+
faasData?: FaasDataWrapperProps<T>;
|
|
218
|
+
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
|
|
219
|
+
pagination: TablePaginationConfig;
|
|
220
|
+
filters: Record<string, FilterValue | null>;
|
|
221
|
+
sorter: SorterResult<T> | SorterResult<T>[];
|
|
222
|
+
extra: TableCurrentDataSource<T>;
|
|
223
|
+
};
|
|
224
|
+
} & TableProps$1<T>;
|
|
225
|
+
/**
|
|
226
|
+
* Table component with Ant Design & FaasJS
|
|
227
|
+
*
|
|
228
|
+
* @ref https://ant.design/components/table/
|
|
229
|
+
*/
|
|
230
|
+
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
|
|
231
|
+
|
|
232
|
+
type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
|
|
233
|
+
/** FaasItemType's value type */
|
|
234
|
+
type FaasItemTypeValue = {
|
|
235
|
+
string: string;
|
|
236
|
+
'string[]': string[];
|
|
237
|
+
number: number;
|
|
238
|
+
'number[]': number[];
|
|
239
|
+
boolean: boolean;
|
|
240
|
+
date: Dayjs;
|
|
241
|
+
time: Dayjs;
|
|
242
|
+
object: any;
|
|
243
|
+
'object[]': any[];
|
|
244
|
+
};
|
|
245
|
+
type BaseOption = string | number | {
|
|
246
|
+
label: string;
|
|
247
|
+
value?: string | number;
|
|
248
|
+
};
|
|
249
|
+
interface BaseItemProps {
|
|
250
|
+
id: string;
|
|
251
|
+
title?: string;
|
|
252
|
+
options?: BaseOption[];
|
|
253
|
+
}
|
|
254
|
+
interface FaasItemProps extends BaseItemProps {
|
|
255
|
+
/**
|
|
256
|
+
* Support string, string[], number, number[], boolean, date, time, object, object[]
|
|
257
|
+
* @default 'string'
|
|
258
|
+
*/
|
|
259
|
+
type?: FaasItemType;
|
|
260
|
+
}
|
|
261
|
+
declare function transferOptions(options: BaseOption[]): {
|
|
262
|
+
label: string;
|
|
263
|
+
value?: string | number;
|
|
264
|
+
}[];
|
|
265
|
+
declare function transferValue(type: FaasItemType, value: any): any;
|
|
266
|
+
type UnionScene = 'form' | 'description' | 'table';
|
|
267
|
+
type UnionFaasItemInjection<Value = any, Values = any> = {
|
|
268
|
+
scene?: UnionScene;
|
|
269
|
+
value?: Value;
|
|
270
|
+
values?: Values;
|
|
271
|
+
index?: number;
|
|
272
|
+
};
|
|
273
|
+
type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => JSX.Element | null;
|
|
274
|
+
type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | null;
|
|
275
|
+
interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
|
|
276
|
+
children?: UnionFaasItemElement<UnionFaasItemProps<Value, Values>> | null;
|
|
277
|
+
render?: UnionFaasItemRender;
|
|
278
|
+
object?: UnionFaasItemProps<Value, Values>[];
|
|
279
|
+
}
|
|
280
|
+
|
|
163
281
|
interface DrawerProps extends DrawerProps$1 {
|
|
164
282
|
children?: JSX.Element | JSX.Element[];
|
|
165
283
|
}
|
|
@@ -188,48 +306,21 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
188
306
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
189
307
|
};
|
|
190
308
|
|
|
191
|
-
|
|
309
|
+
interface ErrorBoundaryProps {
|
|
310
|
+
message?: ReactNode;
|
|
311
|
+
description?: ReactNode;
|
|
192
312
|
children?: ReactNode;
|
|
193
|
-
|
|
194
|
-
type ExtendTypes = {
|
|
195
|
-
[type: string]: ExtendFormTypeProps;
|
|
196
|
-
};
|
|
197
|
-
type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
|
|
198
|
-
interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>, 'id' | 'children'> {
|
|
199
|
-
input?: InputProps | InputNumberProps | SwitchProps | SelectProps<T> | DatePickerProps | TimePickerProps;
|
|
200
|
-
maxCount?: number;
|
|
201
|
-
object?: FormItemProps[];
|
|
202
|
-
disabled?: boolean;
|
|
203
|
-
required?: boolean;
|
|
204
|
-
col?: number;
|
|
205
|
-
children?: JSX.Element;
|
|
206
|
-
render?: () => JSX.Element;
|
|
207
|
-
rules?: RuleObject[];
|
|
208
|
-
label?: string | false;
|
|
209
|
-
extendTypes?: ExtendTypes;
|
|
210
|
-
/** trigger when current item's value changed */
|
|
211
|
-
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
212
|
-
/** trigger when any item's value changed */
|
|
213
|
-
if?: (values: Record<string, any>) => boolean;
|
|
313
|
+
onError?: (error: Error | null, info: any) => ReactNode;
|
|
214
314
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* // use inline type
|
|
220
|
-
* <FormItem type='string' id='name' />
|
|
221
|
-
*
|
|
222
|
-
* // use custom type
|
|
223
|
-
* <FormItem id='password'>
|
|
224
|
-
* <Input.Password />
|
|
225
|
-
* </>
|
|
226
|
-
* ```
|
|
227
|
-
*/
|
|
228
|
-
declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
|
|
229
|
-
declare namespace FormItem {
|
|
230
|
-
var useStatus: () => {
|
|
231
|
-
status?: "" | "error" | "warning" | "success" | "validating";
|
|
315
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
|
|
316
|
+
error?: Error | null;
|
|
317
|
+
info?: {
|
|
318
|
+
componentStack?: string;
|
|
232
319
|
};
|
|
320
|
+
}> {
|
|
321
|
+
constructor(props: ErrorBoundaryProps);
|
|
322
|
+
componentDidCatch(error: Error | null, info: any): void;
|
|
323
|
+
render(): string | number | boolean | react.ReactFragment | JSX.Element;
|
|
233
324
|
}
|
|
234
325
|
|
|
235
326
|
type FormSubmitProps = {
|
|
@@ -303,6 +394,7 @@ interface LinkProps {
|
|
|
303
394
|
children?: ReactNode;
|
|
304
395
|
style?: CSSProperties;
|
|
305
396
|
button?: ButtonProps;
|
|
397
|
+
block?: boolean;
|
|
306
398
|
}
|
|
307
399
|
/**
|
|
308
400
|
* Link component with button.
|
|
@@ -315,15 +407,7 @@ interface LinkProps {
|
|
|
315
407
|
* <Link href="/" button={{ type:'primary' }}>Home</Link>
|
|
316
408
|
* ```
|
|
317
409
|
*/
|
|
318
|
-
declare function Link(
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Loading component based on Spin
|
|
322
|
-
*/
|
|
323
|
-
declare function Loading(props: {
|
|
324
|
-
style?: React.CSSProperties;
|
|
325
|
-
size?: 'small' | 'default' | 'large';
|
|
326
|
-
}): JSX.Element;
|
|
410
|
+
declare function Link(props: LinkProps): JSX.Element;
|
|
327
411
|
|
|
328
412
|
interface ModalProps extends ModalProps$1 {
|
|
329
413
|
children?: JSX.Element | JSX.Element[] | string;
|
|
@@ -378,36 +462,6 @@ interface RoutesProps {
|
|
|
378
462
|
*/
|
|
379
463
|
declare function Routes(props: RoutesProps): JSX.Element;
|
|
380
464
|
|
|
381
|
-
interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children'> {
|
|
382
|
-
optionsType?: 'auto';
|
|
383
|
-
children?: JSX.Element;
|
|
384
|
-
object?: TableItemProps[];
|
|
385
|
-
}
|
|
386
|
-
type ExtendTableTypeProps = {
|
|
387
|
-
children?: JSX.Element;
|
|
388
|
-
render?: (value: any, values: any, index: number) => JSX.Element | string | number | boolean | null;
|
|
389
|
-
};
|
|
390
|
-
type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
|
|
391
|
-
type TableProps<T = any, ExtendTypes = any> = {
|
|
392
|
-
items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
|
|
393
|
-
extendTypes?: {
|
|
394
|
-
[key: string]: ExtendTableTypeProps;
|
|
395
|
-
};
|
|
396
|
-
faasData?: FaasDataWrapperProps<T>;
|
|
397
|
-
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
|
|
398
|
-
pagination: TablePaginationConfig;
|
|
399
|
-
filters: Record<string, FilterValue | null>;
|
|
400
|
-
sorter: SorterResult<T> | SorterResult<T>[];
|
|
401
|
-
extra: TableCurrentDataSource<T>;
|
|
402
|
-
};
|
|
403
|
-
} & TableProps$1<T>;
|
|
404
|
-
/**
|
|
405
|
-
* Table component with Ant Design & FaasJS
|
|
406
|
-
*
|
|
407
|
-
* @ref https://ant.design/components/table/
|
|
408
|
-
*/
|
|
409
|
-
declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
|
|
410
|
-
|
|
411
465
|
interface TitleProps {
|
|
412
466
|
title: string | string[];
|
|
413
467
|
/** ` - ` as default */
|
|
@@ -442,4 +496,4 @@ interface TitleProps {
|
|
|
442
496
|
*/
|
|
443
497
|
declare function Title(props: TitleProps): JSX.Element;
|
|
444
498
|
|
|
445
|
-
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, FormSubmitProps, Link, LinkProps, Loading, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|
|
499
|
+
export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|