@faasjs/ant-design 0.0.3-beta.10 → 0.0.3-beta.101

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