@faasjs/ant-design 0.0.3-beta.7 → 0.0.3-beta.70

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.
Files changed (5) hide show
  1. package/README.md +249 -266
  2. package/dist/index.d.ts +355 -245
  3. package/dist/index.js +1107 -756
  4. package/dist/index.mjs +1101 -749
  5. package/package.json +8 -7
package/dist/index.d.ts CHANGED
@@ -1,20 +1,102 @@
1
- import * as react from 'react';
2
- import { CSSProperties, ReactNode, LazyExoticComponent, ComponentType } from 'react';
3
1
  import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
4
- import { Dayjs } from 'dayjs';
5
- import { DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, FormInstance, InputProps, InputNumberProps, SwitchProps, DatePickerProps, TimePickerProps, SelectProps, FormProps as FormProps$1, ButtonProps, ModalProps as ModalProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
2
+ import { StyleProviderProps } from '@ant-design/cssinjs/lib/StyleContext';
3
+ import { MessageInstance } from 'antd/es/message/interface';
4
+ import { NotificationInstance } from 'antd/es/notification/interface';
5
+ import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, TimePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
6
6
  export { Drawer, Modal } from 'antd';
7
- import { FaasDataWrapperProps } from '@faasjs/react';
8
- import * as antd_es_form_Form from 'antd/es/form/Form';
7
+ import { BrowserRouterProps, RouteProps } from 'react-router-dom';
8
+ import * as react from 'react';
9
+ import { CSSProperties, ReactNode, ReactElement, Component, LazyExoticComponent, ComponentType } from 'react';
10
+ export { lazy } from 'react';
11
+ import { Dayjs } from 'dayjs';
9
12
  import { RuleObject } from 'rc-field-form/lib/interface';
10
- import { RouteProps } from 'react-router-dom';
13
+ import { FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
11
14
  import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
15
+ import * as antd_es_form_context from 'antd/es/form/context';
16
+ import * as antd_es_form_ErrorList from 'antd/es/form/ErrorList';
17
+ import * as antd_es_form from 'antd/es/form';
18
+ import * as rc_field_form_es_useWatch from 'rc-field-form/es/useWatch';
19
+ import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
20
+ import * as antd_es_form_Form from 'antd/es/form/Form';
21
+ import { Tab } from 'rc-tabs/es/interface';
22
+
23
+ interface ModalProps extends ModalProps$1 {
24
+ children?: JSX.Element | JSX.Element[] | string;
25
+ }
26
+ type setModalProps = (changes: Partial<ModalProps>) => void;
27
+ /**
28
+ * Hook style modal.
29
+ * @param init initial props
30
+ *
31
+ * ```ts
32
+ * function Example() {
33
+ * const { modal, setModalProps } = useModal()
34
+ *
35
+ * return <>
36
+ * <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
37
+ * {modal}</>
38
+ * }
39
+ * ```
40
+ */
41
+ declare function useModal(init?: ModalProps): {
42
+ modal: JSX.Element;
43
+ modalProps: ModalProps;
44
+ setModalProps(changes: Partial<ModalProps>): void;
45
+ };
12
46
 
13
- type BlankProps = {
47
+ interface DrawerProps extends DrawerProps$1 {
48
+ children?: JSX.Element | JSX.Element[];
49
+ }
50
+ type setDrawerProps = (changes: Partial<DrawerProps>) => void;
51
+ /**
52
+ * Hook style drawer.
53
+ *
54
+ * @param init initial props
55
+ *
56
+ * ```ts
57
+ * function Example() {
58
+ * const { drawer, setDrawerProps } = useDrawer()
59
+ *
60
+ * return <>
61
+ * <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }>
62
+ * Toggle
63
+ * </Button>
64
+ * {drawer}
65
+ * </>
66
+ * }
67
+ * ```
68
+ */
69
+ declare function useDrawer(init?: DrawerProps): {
70
+ drawer: JSX.Element;
71
+ drawerProps: DrawerProps;
72
+ setDrawerProps(changes: Partial<DrawerProps>): void;
73
+ };
74
+
75
+ interface AppProps {
76
+ children: React.ReactNode;
77
+ styleProviderProps?: StyleProviderProps;
78
+ configProviderProps?: ConfigProviderProps$1;
79
+ browserRouterProps?: BrowserRouterProps;
80
+ }
81
+ interface useAppProps {
82
+ message: MessageInstance;
83
+ notification: NotificationInstance;
84
+ setModalProps: (changes: Partial<ModalProps>) => void;
85
+ setDrawerProps: (changes: Partial<DrawerProps>) => void;
86
+ }
87
+ declare function App(props: AppProps): JSX.Element;
88
+ declare namespace App {
89
+ var useApp: typeof useApp;
90
+ }
91
+ declare function useApp(): useAppProps;
92
+
93
+ interface BlankProps {
14
94
  value?: any;
15
95
  text?: string;
16
- };
96
+ }
17
97
  /**
98
+ * Blank component.
99
+ *
18
100
  * If value is undefined or null, return text, otherwise return value.
19
101
  *
20
102
  * @param options {object}
@@ -28,8 +110,7 @@ type BlankProps = {
28
110
  */
29
111
  declare function Blank(options?: BlankProps): JSX.Element;
30
112
 
31
- type ConfigProviderProps = {
32
- antd?: ConfigProviderProps$1;
113
+ interface ConfigProviderProps {
33
114
  lang?: string;
34
115
  common?: {
35
116
  blank?: string;
@@ -60,7 +141,7 @@ type ConfigProviderProps = {
60
141
  target?: string;
61
142
  style?: CSSProperties;
62
143
  };
63
- };
144
+ }
64
145
  declare const ConfigContext: react.Context<ConfigProviderProps>;
65
146
  /**
66
147
  * Config for @faasjs/ant-design components.
@@ -81,6 +162,161 @@ declare function ConfigProvider({ config, children }: {
81
162
  }): JSX.Element;
82
163
  declare function useConfigContext(): ConfigProviderProps;
83
164
 
165
+ type ExtendFormTypeProps<T = any> = {
166
+ children?: UnionFaasItemElement<T>;
167
+ };
168
+ type ExtendTypes = {
169
+ [type: string]: ExtendFormTypeProps;
170
+ };
171
+ type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
172
+ interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
173
+ input?: InputProps | InputNumberProps | SwitchProps | SelectProps<T> | DatePickerProps | TimePickerProps;
174
+ maxCount?: number;
175
+ object?: FormItemProps[];
176
+ disabled?: boolean;
177
+ required?: boolean;
178
+ col?: number;
179
+ children?: UnionFaasItemElement<T>;
180
+ formChildren?: UnionFaasItemElement<T>;
181
+ render?: UnionFaasItemRender<T>;
182
+ formRender?: UnionFaasItemRender<T>;
183
+ rules?: RuleObject[];
184
+ label?: string | false;
185
+ extendTypes?: ExtendTypes;
186
+ /** trigger when current item's value changed */
187
+ onValueChange?: (value: T, values: any, form: FormInstance) => void;
188
+ /** trigger when any item's value changed */
189
+ if?: (values: Record<string, any>) => boolean;
190
+ }
191
+ /**
192
+ * FormItem, can be used without Form.
193
+ *
194
+ * ```ts
195
+ * // use inline type
196
+ * <FormItem type='string' id='name' />
197
+ *
198
+ * // use custom type
199
+ * <FormItem id='password'>
200
+ * <Input.Password />
201
+ * </>
202
+ * ```
203
+ */
204
+ declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
205
+ declare namespace FormItem {
206
+ var useStatus: () => {
207
+ status?: "" | "success" | "error" | "warning" | "validating";
208
+ };
209
+ }
210
+
211
+ type LoadingProps = {
212
+ style?: React.CSSProperties;
213
+ size?: 'small' | 'default' | 'large';
214
+ loading?: boolean;
215
+ children?: React.ReactNode;
216
+ };
217
+ /**
218
+ * Loading component based on Spin
219
+ *
220
+ * ```tsx
221
+ * <Loading /> // display loading
222
+ *
223
+ * <Loading loading={ !remoteData }>
224
+ * <div>{remoteData}</div>
225
+ * </Loading>
226
+ * ```
227
+ */
228
+ declare function Loading(props: LoadingProps): JSX.Element;
229
+
230
+ type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
231
+ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
232
+ loadingProps?: LoadingProps;
233
+ loading?: JSX.Element;
234
+ }
235
+ /**
236
+ * FaasDataWrapper component with Loading
237
+ *
238
+ * ```tsx
239
+ * function MyComponent (props: FaasDataInjection) {
240
+ * return <div>{ props.data }</div>
241
+ * }
242
+ *
243
+ * function MyPage () {
244
+ * return <FaasDataWrapper action="test" params={{ a: 1 }}>
245
+ * <MyComponent />
246
+ * </FaasDataWrapper>
247
+ * }
248
+ * ```
249
+ */
250
+ declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
251
+
252
+ interface ExtendDescriptionTypeProps<T = any> {
253
+ children?: UnionFaasItemElement<T>;
254
+ render?: UnionFaasItemRender<T>;
255
+ }
256
+ type ExtendDescriptionItemProps = BaseItemProps;
257
+ interface DescriptionItemProps<T = any> extends FaasItemProps {
258
+ children?: UnionFaasItemElement<T>;
259
+ descriptionChildren?: UnionFaasItemElement<T>;
260
+ render?: UnionFaasItemRender<T>;
261
+ descriptionRender?: UnionFaasItemRender<T>;
262
+ if?: (values: Record<string, any>) => boolean;
263
+ object?: DescriptionItemProps<T>[];
264
+ }
265
+ interface DescriptionProps<T = any, ExtendItemProps = any> extends DescriptionsProps {
266
+ renderTitle?: ((values: T) => ReactNode);
267
+ items: (DescriptionItemProps | ExtendItemProps)[];
268
+ extendTypes?: {
269
+ [key: string]: ExtendDescriptionTypeProps;
270
+ };
271
+ dataSource?: T;
272
+ faasData?: FaasDataWrapperProps<T>;
273
+ }
274
+ interface DescriptionItemContentProps<T = any> {
275
+ item: DescriptionItemProps;
276
+ value: T;
277
+ values?: any;
278
+ extendTypes?: {
279
+ [key: string]: ExtendDescriptionTypeProps;
280
+ };
281
+ }
282
+ /**
283
+ * Description component.
284
+ */
285
+ declare function Description<T = any>(props: DescriptionProps<T>): JSX.Element;
286
+
287
+ interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
288
+ optionsType?: 'auto';
289
+ children?: UnionFaasItemElement<T>;
290
+ tableChildren?: UnionFaasItemElement<T>;
291
+ render?: UnionFaasItemRender<T>;
292
+ tableRender?: UnionFaasItemRender<T>;
293
+ object?: TableItemProps<T>[];
294
+ }
295
+ type ExtendTableTypeProps<T = any> = {
296
+ children?: JSX.Element;
297
+ render?: UnionFaasItemRender<T>;
298
+ };
299
+ type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
300
+ type TableProps<T = any, ExtendTypes = any> = {
301
+ items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
302
+ extendTypes?: {
303
+ [key: string]: ExtendTableTypeProps;
304
+ };
305
+ faasData?: FaasDataWrapperProps<T>;
306
+ onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
307
+ pagination: TablePaginationConfig;
308
+ filters: Record<string, FilterValue | null>;
309
+ sorter: SorterResult<T> | SorterResult<T>[];
310
+ extra: TableCurrentDataSource<T>;
311
+ };
312
+ } & TableProps$1<T>;
313
+ /**
314
+ * Table component with Ant Design & FaasJS
315
+ *
316
+ * @ref https://ant.design/components/table/
317
+ */
318
+ declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
319
+
84
320
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
85
321
  /** FaasItemType's value type */
86
322
  type FaasItemTypeValue = {
@@ -98,202 +334,106 @@ type BaseOption = string | number | {
98
334
  label: string;
99
335
  value?: string | number;
100
336
  };
101
- type BaseItemProps = {
337
+ interface BaseItemProps {
102
338
  id: string;
103
339
  title?: string;
104
340
  options?: BaseOption[];
105
- };
106
- type FaasItemProps = BaseItemProps & {
341
+ }
342
+ interface FaasItemProps extends BaseItemProps {
107
343
  /**
108
- * Support string, string[], number, number[], boolean
344
+ * Support string, string[], number, number[], boolean, date, time, object, object[]
109
345
  * @default 'string'
110
346
  */
111
347
  type?: FaasItemType;
112
- };
348
+ }
349
+ /**
350
+ * convert options to { label, value }[]
351
+ */
113
352
  declare function transferOptions(options: BaseOption[]): {
114
353
  label: string;
115
354
  value?: string | number;
116
355
  }[];
117
356
  declare function transferValue(type: FaasItemType, value: any): any;
118
-
119
- type ExtendDescriptionTypeProps = {
120
- children?: JSX.Element | null;
121
- render?: (value: any, values: any) => ReactNode | JSX.Element;
122
- };
123
- type ExtendDescriptionItemProps = BaseItemProps;
124
- type DescriptionItemProps<T = any> = {
125
- children?: JSX.Element;
126
- render?: (value: T, values: any) => ReactNode | JSX.Element;
127
- if?: (values: Record<string, any>) => boolean;
128
- } & FaasItemProps & {
129
- object?: DescriptionItemProps[];
130
- };
131
- type DescriptionProps<T = any, ExtendItemProps = any> = {
132
- renderTitle?: ((values: T) => ReactNode | JSX.Element);
133
- items: (DescriptionItemProps | ExtendItemProps)[];
134
- extendTypes?: {
135
- [key: string]: ExtendDescriptionTypeProps;
136
- };
137
- dataSource?: T;
138
- faasData?: FaasDataWrapperProps<T>;
139
- } & DescriptionsProps;
140
- declare function Description<T = any>(props: DescriptionProps<T>): JSX.Element;
141
-
142
- type DrawerProps = DrawerProps$1 & {
143
- children?: JSX.Element | JSX.Element[];
144
- };
145
- type setDrawerProps = (changes: Partial<DrawerProps>) => void;
146
- /**
147
- * Hook style drawer.
148
- * @param init initial props
149
- *
150
- * ```ts
151
- * function Example() {
152
- * const { drawer, setDrawerProps } = useDrawer()
153
- *
154
- * return <>
155
- * <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }>
156
- * Toggle
157
- * </Button>
158
- * {drawer}
159
- * </>
160
- * }
161
- * ```
162
- */
163
- declare function useDrawer(init?: DrawerProps): {
164
- drawer: JSX.Element;
165
- drawerProps: DrawerProps;
166
- setDrawerProps(changes: Partial<DrawerProps>): void;
357
+ type UnionScene = 'form' | 'description' | 'table';
358
+ type UnionFaasItemInjection<Value = any, Values = any> = {
359
+ scene?: UnionScene;
360
+ value?: Value;
361
+ values?: Values;
362
+ index?: number;
167
363
  };
364
+ type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => React.ReactNode;
365
+ type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | null;
366
+ interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
367
+ children?: UnionFaasItemElement<UnionFaasItemProps<Value, Values>> | null;
368
+ render?: UnionFaasItemRender;
369
+ object?: UnionFaasItemProps<Value, Values>[];
370
+ }
168
371
 
169
- type StringProps = {
170
- type?: 'string';
171
- input?: InputProps;
172
- };
173
- type StringListProps = {
174
- type: 'string[]';
175
- input?: InputProps;
176
- maxCount?: number;
177
- };
178
- type NumberProps = {
179
- type: 'number';
180
- input?: InputNumberProps;
181
- };
182
- type NumberListProps = {
183
- type: 'number[]';
184
- input?: InputNumberProps;
185
- maxCount?: number;
186
- };
187
- type BooleanProps = {
188
- type: 'boolean';
189
- input?: SwitchProps;
190
- };
191
- type DateProps = {
192
- type: 'date';
193
- input?: DatePickerProps;
194
- };
195
- type TimeProps = {
196
- type: 'time';
197
- input?: TimePickerProps;
198
- };
199
- type ObjectProps = {
200
- type: 'object';
201
- object: FormItemProps[];
202
- };
203
- type ObjectListProps = {
204
- type: 'object[]';
205
- object: (FormItemProps & {
206
- /** default is 6 */
207
- col?: number;
208
- })[];
209
- maxCount?: number;
210
- };
211
- type OptionsProps = {
212
- options?: BaseOption[];
213
- type?: 'string' | 'string[]' | 'number' | 'number[]';
214
- input?: SelectProps<any>;
215
- };
216
- type FormItemInputProps = (StringProps | StringListProps | NumberProps | NumberListProps | BooleanProps | OptionsProps | DateProps | TimeProps | ObjectProps | ObjectListProps) & {
217
- disabled?: boolean;
218
- required?: boolean;
219
- };
220
- type ExtendFormTypeProps = {
372
+ interface ErrorBoundaryProps {
373
+ message?: ReactNode;
374
+ description?: ReactNode;
221
375
  children?: ReactNode;
222
- };
223
- type ExtendTypes = {
224
- [type: string]: ExtendFormTypeProps;
225
- };
226
- type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
227
- type FormItemProps<T = any> = {
228
- children?: ReactNode;
229
- render?: (value?: T) => ReactNode | JSX.Element;
230
- rules?: RuleObject[];
231
- label?: string | false;
232
- extendTypes?: ExtendTypes;
233
- /** trigger when current item's value changed */
234
- onValueChange?: (value: T, values: any, form: FormInstance) => void;
235
- /** trigger when any item's value changed */
236
- if?: (values: Record<string, any>) => boolean;
237
- } & FormItemInputProps & FaasItemProps & Omit<FormItemProps$1<T>, 'children'>;
238
- /**
239
- * FormItem, can be used without Form.
240
- *
241
- * ```ts
242
- * // use inline type
243
- * <FormItem type='string' id='name' />
244
- *
245
- * // use custom type
246
- * <FormItem id='password'>
247
- * <Input.Password />
248
- * </>
249
- * ```
250
- */
251
- declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
376
+ onError?: (error: Error | null, info: any) => ReactNode;
377
+ }
378
+ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
379
+ error?: Error | null;
380
+ info?: {
381
+ componentStack?: string;
382
+ };
383
+ }> {
384
+ constructor(props: ErrorBoundaryProps);
385
+ componentDidCatch(error: Error | null, info: any): void;
386
+ render(): string | number | boolean | react.ReactFragment | JSX.Element;
387
+ }
252
388
 
253
- type FormProps<Values extends Record<string, any> = any, ExtendItemProps = any> = {
389
+ type FormSubmitProps = {
390
+ /** Default: Submit */
391
+ text?: string;
392
+ /**
393
+ * Submit to FaasJS server.
394
+ *
395
+ * If use onFinish, you should call submit manually.
396
+ * ```ts
397
+ * {
398
+ * submit: {
399
+ * to: {
400
+ * action: 'action_name'
401
+ * }
402
+ * },
403
+ * onFinish: (values, submit) => {
404
+ * // do something before submit
405
+ *
406
+ * // submit
407
+ * await submit({
408
+ * ...values,
409
+ * extraProps: 'some extra props'
410
+ * })
411
+ *
412
+ * // do something after submit
413
+ * }
414
+ * }
415
+ * ```
416
+ */
417
+ to?: {
418
+ action: string;
419
+ /** params will overwrite form values before submit */
420
+ params?: Record<string, any>;
421
+ then?: (result: any) => void;
422
+ catch?: (error: any) => void;
423
+ finally?: () => void;
424
+ };
425
+ };
426
+ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps = any> extends Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> {
254
427
  items?: (FormItemProps | ExtendItemProps | JSX.Element)[];
255
428
  /** Default: { text: 'Submit' }, set false to disable it */
256
- submit?: false | {
257
- /** Default: Submit */
258
- text?: string;
259
- /**
260
- * Submit to FaasJS server.
261
- *
262
- * If use onFinish, you should call submit manually.
263
- * ```ts
264
- * {
265
- * submit: {
266
- * to: {
267
- * action: 'action_name'
268
- * }
269
- * },
270
- * onFinish: (values, submit) => {
271
- * // do something before submit
272
- *
273
- * // submit
274
- * await submit({
275
- * ...values,
276
- * extraProps: 'some extra props'
277
- * })
278
- *
279
- * // do something after submit
280
- * }
281
- * }
282
- * ```
283
- */
284
- to?: {
285
- action: string;
286
- /** params will overwrite form values before submit */
287
- params?: Record<string, any>;
288
- };
289
- };
429
+ submit?: false | FormSubmitProps;
290
430
  onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
291
431
  beforeItems?: JSX.Element | JSX.Element[];
292
432
  footer?: JSX.Element | JSX.Element[];
293
433
  extendTypes?: ExtendTypes;
294
434
  children?: ReactNode;
295
435
  initialValues?: Values;
296
- } & Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'>;
436
+ }
297
437
  /**
298
438
  * Form component with Ant Design & FaasJS
299
439
  *
@@ -302,64 +442,49 @@ type FormProps<Values extends Record<string, any> = any, ExtendItemProps = any>
302
442
  declare function Form<Values = any>(props: FormProps<Values>): JSX.Element;
303
443
  declare namespace Form {
304
444
  var useForm: typeof antd_es_form_Form.useForm;
445
+ var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
446
+ var useWatch: typeof rc_field_form_es_useWatch.default;
447
+ var Item: typeof FormItem;
448
+ var List: react.FC<antd_es_form.FormListProps>;
449
+ var ErrorList: typeof antd_es_form_ErrorList.default;
450
+ var Provider: react.FC<antd_es_form_context.FormProviderProps>;
305
451
  }
306
452
 
307
- type LinkProps = {
453
+ interface LinkProps {
308
454
  href: string;
309
455
  target?: string;
310
456
  text?: string | number;
311
457
  children?: ReactNode;
312
458
  style?: CSSProperties;
313
459
  button?: ButtonProps;
314
- };
460
+ block?: boolean;
461
+ }
315
462
  /**
463
+ * Link component with button.
464
+ *
316
465
  * ```ts
317
466
  * // pure link
318
467
  * <Link href="/">Home</Link>
319
468
  *
320
469
  * // link with button
321
- * <Link href="/" button={{type:'primary'}}>Home</Link>
322
- * ```
323
- */
324
- declare function Link({ href, target, text, children, style, button, }: LinkProps): JSX.Element;
325
-
326
- type ModalProps = ModalProps$1 & {
327
- children?: JSX.Element | JSX.Element[] | string;
328
- };
329
- type setModalProps = (changes: Partial<ModalProps>) => void;
330
- /**
331
- * Hook style modal.
332
- * @param init initial props
333
- *
334
- * ```ts
335
- * function Example() {
336
- * const { modal, setModalProps } = useModal()
337
- *
338
- * return <>
339
- * <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
340
- * {modal}</>
341
- * }
470
+ * <Link href="/" button={{ type:'primary' }}>Home</Link>
342
471
  * ```
343
472
  */
344
- declare function useModal(init?: ModalProps): {
345
- modal: JSX.Element;
346
- modalProps: ModalProps;
347
- setModalProps(changes: Partial<ModalProps>): void;
348
- };
473
+ declare function Link(props: LinkProps): JSX.Element;
349
474
 
350
475
  declare function PageNotFound(): JSX.Element;
351
- type RoutesProps = {
476
+ interface RoutesProps {
352
477
  routes: (RouteProps & {
353
478
  page?: LazyExoticComponent<ComponentType<any>>;
354
479
  })[];
355
480
  fallback?: JSX.Element;
356
481
  notFound?: JSX.Element;
357
- };
482
+ }
358
483
  /**
359
484
  * Routes with lazy loading and 404 page.
360
485
  *
361
486
  * ```tsx
362
- * import { lazy } from 'react'
487
+ * import { Routes, lazy } from '@faasjs/ant-design'
363
488
  * import { BrowserRouter } from 'react-router-dom'
364
489
  *
365
490
  * export function App () {
@@ -376,38 +501,23 @@ type RoutesProps = {
376
501
  */
377
502
  declare function Routes(props: RoutesProps): JSX.Element;
378
503
 
379
- type TableItemProps<T = any> = {
380
- optionsType?: 'auto';
381
- /** @deprecated use render */
382
- children?: JSX.Element | null;
383
- object?: TableItemProps[];
384
- } & FaasItemProps & Omit<TableColumnProps<T>, 'children'>;
385
- type ExtendTableTypeProps = {
386
- children?: JSX.Element | null;
387
- render?: (value: any, values: any, index: number) => JSX.Element | string | number | boolean | null;
388
- };
389
- type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
390
- type TableProps<T = any, ExtendTypes = any> = {
391
- items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
392
- extendTypes?: {
393
- [key: string]: ExtendTableTypeProps;
394
- };
395
- faasData?: FaasDataWrapperProps<T>;
396
- onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
397
- pagination: TablePaginationConfig;
398
- filters: Record<string, FilterValue | null>;
399
- sorter: SorterResult<T> | SorterResult<T>[];
400
- extra: TableCurrentDataSource<T>;
401
- };
402
- } & TableProps$1<T>;
504
+ interface TabProps extends Partial<Tab> {
505
+ id: string;
506
+ title?: React.ReactNode;
507
+ children: React.ReactNode;
508
+ }
509
+ interface TabsProps extends Omit<TabsProps$1, 'items'> {
510
+ /** auto skip null tab */
511
+ items: (TabProps | null)[];
512
+ }
403
513
  /**
404
- * Table component with Ant Design & FaasJS
514
+ * Tabs component with Ant Design & FaasJS
405
515
  *
406
- * @ref https://ant.design/components/table/
516
+ * @ref https://ant.design/components/tabs/
407
517
  */
408
- declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
518
+ declare function Tabs(props: TabsProps): JSX.Element;
409
519
 
410
- type TitleProps = {
520
+ interface TitleProps {
411
521
  title: string | string[];
412
522
  /** ` - ` as default */
413
523
  separator?: string;
@@ -421,7 +531,7 @@ type TitleProps = {
421
531
  plain?: boolean;
422
532
  /** return children */
423
533
  children?: JSX.Element;
424
- };
534
+ }
425
535
  /**
426
536
  * Title is used to change the title of the page.
427
537
  * Return null by default.
@@ -441,4 +551,4 @@ type TitleProps = {
441
551
  */
442
552
  declare function Title(props: TitleProps): JSX.Element;
443
553
 
444
- export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, 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 };
554
+ export { App, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, TabProps, Table, TableItemProps, TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useModal };