@faasjs/ant-design 0.0.3-beta.8 → 0.0.3-beta.81

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