@faasjs/ant-design 8.0.0-beta.6 → 8.0.0-beta.8

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,31 +1,79 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { DrawerProps as DrawerProps$1, ModalProps as ModalProps$1, ConfigProviderProps as ConfigProviderProps$1, FormItemProps as FormItemProps$1, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, FormInstance, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, DescriptionsProps, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1, GlobalToken } from 'antd';
3
- export { Drawer, Modal } from 'antd';
4
- import { MessageInstance } from 'antd/es/message/interface';
5
- import { NotificationInstance } from 'antd/es/notification/interface';
6
- import { BrowserRouterProps, RouteProps } from 'react-router-dom';
7
- import * as react from 'react';
8
- import { JSX, CSSProperties, Dispatch, SetStateAction, ReactElement, FC, ReactNode, LazyExoticComponent, ComponentType } from 'react';
9
- export { lazy } from 'react';
10
- import { FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataInjection as FaasDataInjection$1, FaasReactClientOptions, ErrorBoundaryProps } from '@faasjs/react';
11
- export { ErrorBoundaryProps, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from '@faasjs/react';
12
- import { FaasActionUnionType, FaasAction } from '@faasjs/types';
13
- import { Dayjs } from 'dayjs';
14
- import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
15
- import * as antd_es_form from 'antd/es/form';
16
- import { RuleObject } from 'antd/es/form';
17
- import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
18
- import * as antd_es_form_context from 'antd/es/form/context';
19
- import * as _rc_component_form from '@rc-component/form';
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-component/tabs/lib/interface';
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import { ButtonProps, ConfigProviderProps as ConfigProviderProps$1, DatePickerProps, DescriptionsProps, Drawer, DrawerProps as DrawerProps$1, FormInstance, FormItemProps as FormItemProps$1, FormProps as FormProps$1, GlobalToken, InputNumberProps, InputProps, Modal, ModalProps as ModalProps$1, RadioProps, SelectProps, SwitchProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, TabsProps as TabsProps$1 } from "antd";
3
+ import { MessageInstance } from "antd/es/message/interface";
4
+ import { NotificationInstance } from "antd/es/notification/interface";
5
+ import { BrowserRouterProps, RouteProps } from "react-router-dom";
6
+ import * as react from "react";
7
+ import { CSSProperties, ComponentType, Dispatch, FC, JSX, LazyExoticComponent, ReactElement, ReactNode, SetStateAction, lazy } from "react";
8
+ import { ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from "@faasjs/react";
9
+ import { Dayjs } from "dayjs";
10
+ import * as antd_es_form_FormItem0 from "antd/es/form/FormItem";
11
+ import * as antd_es_form0 from "antd/es/form";
12
+ import { RuleObject } from "antd/es/form";
13
+ import { FilterValue, SorterResult, TableCurrentDataSource } from "antd/es/table/interface";
14
+ import * as antd_es_form_Form0 from "antd/es/form/Form";
15
+ import * as antd_es_form_hooks_useFormInstance0 from "antd/es/form/hooks/useFormInstance";
16
+ import * as _rc_component_form0 from "@rc-component/form";
17
+ import * as antd_es_form_context0 from "antd/es/form/context";
18
+ import { Tab } from "@rc-component/tabs/lib/interface";
23
19
 
20
+ //#region ../types/src/index.d.ts
21
+ /**
22
+ * Interface for defining FaasJS actions.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * declare module '@faasjs/types' {
27
+ * interface FaasActions {
28
+ * demo: {
29
+ * Params: {
30
+ * key: string
31
+ * }
32
+ * Data: {
33
+ * value: string
34
+ * }
35
+ * }
36
+ * }
37
+ * }
38
+ * ```
39
+ */
40
+ interface FaasActions {
41
+ /**
42
+ * Internal placeholder to keep this interface visible in generated docs.
43
+ */
44
+ faasjsActionsPlaceholder?: {
45
+ Params: Record<string, any>;
46
+ Data: Record<string, any>;
47
+ };
48
+ }
49
+ /**
50
+ * Infer all action paths declared in {@link FaasActions}.
51
+ */
52
+ type FaasActionPaths = Exclude<Extract<keyof FaasActions, string>, 'faasjsActionsPlaceholder'>;
53
+ /**
54
+ * Union type accepted by action helpers.
55
+ */
56
+ type FaasActionUnionType = FaasActionPaths | Record<string, any> | string;
57
+ /**
58
+ * Infer the action path type.
59
+ *
60
+ * Returns the original type when `T` is a known action path,
61
+ * otherwise falls back to `string`.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * type A = FaasAction<'demo'> // 'demo'
66
+ * type B = FaasAction<number> // string
67
+ * ```
68
+ */
69
+ type FaasAction<T = any> = T extends FaasActionPaths ? T : string;
70
+ //#endregion
71
+ //#region src/Loading.d.ts
24
72
  type LoadingProps = {
25
- style?: React.CSSProperties;
26
- size?: 'small' | 'default' | 'large';
27
- loading?: boolean;
28
- children?: React.ReactNode;
73
+ style?: React.CSSProperties;
74
+ size?: 'small' | 'default' | 'large';
75
+ loading?: boolean;
76
+ children?: React.ReactNode;
29
77
  };
30
78
  /**
31
79
  * Loading component based on Spin
@@ -39,14 +87,14 @@ type LoadingProps = {
39
87
  * </Loading>
40
88
  * ```
41
89
  */
42
- declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
43
-
44
- type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
45
- interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
46
- loadingProps?: LoadingProps;
47
- loading?: JSX.Element;
90
+ declare function Loading(props: LoadingProps): react_jsx_runtime0.JSX.Element;
91
+ //#endregion
92
+ //#region src/FaasDataWrapper.d.ts
93
+ type FaasDataInjection<T extends FaasActionUnionType = any> = Partial<FaasDataInjection$1<T>>;
94
+ interface FaasDataWrapperProps<T extends FaasActionUnionType = any> extends FaasDataWrapperProps$1<T> {
95
+ loadingProps?: LoadingProps;
96
+ loading?: JSX.Element;
48
97
  }
49
-
50
98
  /**
51
99
  * FaasDataWrapper component with Loading
52
100
  *
@@ -63,7 +111,7 @@ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
63
111
  * }
64
112
  * ```
65
113
  */
66
- declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
114
+ declare function FaasDataWrapper<T extends FaasActionUnionType = any>(props: FaasDataWrapperProps<T>): JSX.Element;
67
115
  /**
68
116
  * HOC to wrap a component with FaasDataWrapper and Loading
69
117
  *
@@ -73,44 +121,76 @@ declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.E
73
121
  * ```
74
122
  */
75
123
  declare function withFaasData<PathOrData extends FaasActionUnionType, TComponentProps extends Required<FaasDataInjection<PathOrData>> = Required<FaasDataInjection<PathOrData>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<PathOrData>): React.FC<Omit<TComponentProps, keyof FaasDataInjection<PathOrData>>>;
76
-
124
+ //#endregion
125
+ //#region src/Config.d.ts
126
+ type ResolvedTheme = {
127
+ lang: string;
128
+ common: {
129
+ blank: string;
130
+ all: string;
131
+ submit: string;
132
+ pageNotFound: string;
133
+ add: string;
134
+ delete: string;
135
+ required: string;
136
+ search: string;
137
+ reset: string;
138
+ };
139
+ Blank: {
140
+ text: string;
141
+ };
142
+ Form: {
143
+ submit: {
144
+ text: string;
145
+ };
146
+ };
147
+ Title: {
148
+ separator: string;
149
+ suffix: string;
150
+ };
151
+ Link: {
152
+ target?: string;
153
+ style: CSSProperties;
154
+ };
155
+ };
156
+ type ConfigContextValue = {
157
+ theme: ResolvedTheme;
158
+ };
77
159
  interface ConfigProviderProps {
78
- faasClientOptions?: FaasReactClientOptions;
79
- children: React.ReactNode;
80
- theme?: {
81
- lang?: string;
82
- common?: {
83
- blank?: string;
84
- all?: string;
85
- submit?: string;
86
- pageNotFound?: string;
87
- add?: string;
88
- delete?: string;
89
- required?: string;
90
- search?: string;
91
- reset?: string;
92
- };
93
- Blank?: {
94
- text?: string;
95
- };
96
- Form?: {
97
- submit?: {
98
- text?: string;
99
- };
100
- };
101
- Title?: {
102
- /** ' - ' as default */
103
- separator?: string;
104
- suffix?: string;
105
- };
106
- Link?: {
107
- /** '_blank' as default */
108
- target?: string;
109
- style?: CSSProperties;
110
- };
160
+ faasClientOptions?: FaasReactClientOptions;
161
+ children: React.ReactNode;
162
+ theme?: {
163
+ lang?: string;
164
+ common?: {
165
+ blank?: string;
166
+ all?: string;
167
+ submit?: string;
168
+ pageNotFound?: string;
169
+ add?: string;
170
+ delete?: string;
171
+ required?: string;
172
+ search?: string;
173
+ reset?: string;
174
+ };
175
+ Blank?: {
176
+ text?: string;
111
177
  };
178
+ Form?: {
179
+ submit?: {
180
+ text?: string;
181
+ };
182
+ };
183
+ Title?: {
184
+ /** ' - ' as default */separator?: string;
185
+ suffix?: string;
186
+ };
187
+ Link?: {
188
+ /** '_blank' as default */target?: string;
189
+ style?: CSSProperties;
190
+ };
191
+ };
112
192
  }
113
- declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
193
+ declare const ConfigContext: react.Context<ConfigContextValue>;
114
194
  /**
115
195
  * Config for `@faasjs/ant-design` components.
116
196
  *
@@ -123,11 +203,12 @@ declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
123
203
  * </ConfigProvider>
124
204
  * ```
125
205
  */
126
- declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime.JSX.Element;
127
- declare function useConfigContext(): Partial<ConfigProviderProps>;
128
-
206
+ declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime0.JSX.Element | null;
207
+ declare function useConfigContext(): ConfigContextValue;
208
+ //#endregion
209
+ //#region src/Drawer.d.ts
129
210
  interface DrawerProps extends DrawerProps$1 {
130
- children?: JSX.Element | JSX.Element[];
211
+ children?: JSX.Element | JSX.Element[];
131
212
  }
132
213
  type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
133
214
  /**
@@ -147,18 +228,20 @@ type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
147
228
  * ```
148
229
  */
149
230
  declare function useDrawer(init?: DrawerProps): {
150
- drawer: react_jsx_runtime.JSX.Element;
151
- drawerProps: DrawerProps;
152
- setDrawerProps: setDrawerProps;
231
+ drawer: react_jsx_runtime0.JSX.Element;
232
+ drawerProps: DrawerProps;
233
+ setDrawerProps: setDrawerProps;
153
234
  };
154
-
235
+ //#endregion
236
+ //#region src/ErrorBoundary.d.ts
155
237
  /**
156
238
  * Styled error boundary.
157
239
  */
158
- declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
159
-
240
+ declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime0.JSX.Element;
241
+ //#endregion
242
+ //#region src/Modal.d.ts
160
243
  interface ModalProps extends ModalProps$1 {
161
- children?: JSX.Element | JSX.Element[] | string;
244
+ children?: JSX.Element | JSX.Element[] | string;
162
245
  }
163
246
  type setModalProps = Dispatch<SetStateAction<ModalProps>>;
164
247
  /**
@@ -176,35 +259,36 @@ type setModalProps = Dispatch<SetStateAction<ModalProps>>;
176
259
  * ```
177
260
  */
178
261
  declare function useModal(init?: ModalProps): {
179
- modal: react_jsx_runtime.JSX.Element;
180
- modalProps: ModalProps;
181
- setModalProps: setModalProps;
262
+ modal: react_jsx_runtime0.JSX.Element;
263
+ modalProps: ModalProps;
264
+ setModalProps: setModalProps;
182
265
  };
183
-
266
+ //#endregion
267
+ //#region src/App.d.ts
184
268
  interface AppProps {
185
- children: React.ReactNode;
186
- /** @see https://ant.design/components/config-provider/#API */
187
- configProviderProps?: ConfigProviderProps$1;
188
- /**
189
- * `false` to disable BrowserRouter.
190
- *
191
- * Auto disable when not in browser.
192
- *
193
- * @see https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html
194
- */
195
- browserRouterProps?: BrowserRouterProps | false;
196
- /** @see https://faasjs.com/doc/ant-design/#errorboundary */
197
- errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
198
- /** @see https://faasjs.com/doc/ant-design/#configprovider */
199
- faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
269
+ children: React.ReactNode;
270
+ /** @see https://ant.design/components/config-provider/#API */
271
+ configProviderProps?: ConfigProviderProps$1;
272
+ /**
273
+ * `false` to disable BrowserRouter.
274
+ *
275
+ * Auto disable when not in browser.
276
+ *
277
+ * @see https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html
278
+ */
279
+ browserRouterProps?: BrowserRouterProps | false;
280
+ /** @see https://faasjs.com/doc/ant-design/#errorboundary */
281
+ errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
282
+ /** @see https://faasjs.com/doc/ant-design/#configprovider */
283
+ faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
200
284
  }
201
285
  interface useAppProps {
202
- message: MessageInstance;
203
- notification: NotificationInstance;
204
- modalProps: ModalProps;
205
- setModalProps: setModalProps;
206
- drawerProps: DrawerProps;
207
- setDrawerProps: setDrawerProps;
286
+ message: MessageInstance;
287
+ notification: NotificationInstance;
288
+ modalProps: ModalProps;
289
+ setModalProps: setModalProps;
290
+ drawerProps: DrawerProps;
291
+ setDrawerProps: setDrawerProps;
208
292
  }
209
293
  /**
210
294
  * App component with Ant Design & FaasJS
@@ -233,9 +317,9 @@ interface useAppProps {
233
317
  * }
234
318
  * ```
235
319
  */
236
- declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
320
+ declare function App(props: AppProps): react_jsx_runtime0.JSX.Element;
237
321
  declare namespace App {
238
- var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
322
+ var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
239
323
  }
240
324
  /**
241
325
  * Get app context.
@@ -247,10 +331,11 @@ declare namespace App {
247
331
  * ```
248
332
  */
249
333
  declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
250
-
334
+ //#endregion
335
+ //#region src/Blank.d.ts
251
336
  interface BlankProps {
252
- value?: any;
253
- text?: string;
337
+ value?: any;
338
+ text?: string;
254
339
  }
255
340
  /**
256
341
  * Blank component.
@@ -265,43 +350,44 @@ interface BlankProps {
265
350
  * ```
266
351
  */
267
352
  declare function Blank(options?: BlankProps): JSX.Element;
268
-
353
+ //#endregion
354
+ //#region src/FormItem.d.ts
269
355
  type ExtendFormTypeProps<T = any> = {
270
- children?: UnionFaasItemElement<T>;
356
+ children?: UnionFaasItemElement<T>;
271
357
  };
272
358
  type ExtendTypes = {
273
- [type: string]: ExtendFormTypeProps;
359
+ [type: string]: ExtendFormTypeProps;
274
360
  };
275
361
  type InputTypeMap<T> = {
276
- string: InputProps | SelectProps<T> | RadioProps;
277
- 'string[]': InputProps | SelectProps<T> | RadioProps;
278
- number: InputNumberProps | SelectProps<T> | RadioProps;
279
- 'number[]': InputNumberProps | SelectProps<T> | RadioProps;
280
- boolean: SwitchProps;
281
- date: DatePickerProps;
282
- time: DatePickerProps;
283
- object: never;
284
- 'object[]': never;
362
+ string: InputProps | SelectProps<T> | RadioProps;
363
+ 'string[]': InputProps | SelectProps<T> | RadioProps;
364
+ number: InputNumberProps | SelectProps<T> | RadioProps;
365
+ 'number[]': InputNumberProps | SelectProps<T> | RadioProps;
366
+ boolean: SwitchProps;
367
+ date: DatePickerProps;
368
+ time: DatePickerProps;
369
+ object: never;
370
+ 'object[]': never;
285
371
  };
286
372
  interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
287
- type?: FaasItemType;
288
- input?: InputTypeMap<T>[FaasItemType];
289
- maxCount?: number;
290
- object?: FormItemProps[];
291
- disabled?: boolean;
292
- required?: boolean;
293
- col?: number;
294
- children?: UnionFaasItemElement<T> | null;
295
- formChildren?: UnionFaasItemElement<T> | null;
296
- render?: UnionFaasItemRender<T> | null;
297
- formRender?: UnionFaasItemRender<T> | null;
298
- rules?: RuleObject[];
299
- label?: string | false;
300
- extendTypes?: ExtendTypes;
301
- /** trigger when current item's value changed */
302
- onValueChange?: (value: T, values: any, form: FormInstance) => void;
303
- /** trigger when any item's value changed */
304
- if?: (values: Record<string, any>) => boolean;
373
+ type?: FaasItemType;
374
+ input?: InputTypeMap<T>[FaasItemType];
375
+ maxCount?: number;
376
+ object?: FormItemProps[];
377
+ disabled?: boolean;
378
+ required?: boolean;
379
+ col?: number;
380
+ children?: UnionFaasItemElement<T> | null;
381
+ formChildren?: UnionFaasItemElement<T> | null;
382
+ render?: UnionFaasItemRender<T> | null;
383
+ formRender?: UnionFaasItemRender<T> | null;
384
+ rules?: RuleObject[];
385
+ label?: string | false;
386
+ extendTypes?: ExtendTypes;
387
+ /** trigger when current item's value changed */
388
+ onValueChange?: (value: T, values: any, form: FormInstance) => void;
389
+ /** trigger when any item's value changed */
390
+ if?: (values: Record<string, any>) => boolean;
305
391
  }
306
392
  /**
307
393
  * Extend custom form item types.
@@ -337,7 +423,7 @@ interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>,
337
423
  * ```
338
424
  */
339
425
  interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
340
- type?: string;
426
+ type?: string;
341
427
  }
342
428
  /**
343
429
  * FormItem
@@ -356,62 +442,63 @@ interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
356
442
  * </>
357
443
  * ```
358
444
  */
359
- declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
445
+ declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime0.JSX.Element | null;
360
446
  declare namespace FormItem {
361
- var useStatus: () => {
362
- status?: antd_es_form_FormItem.ValidateStatus;
363
- errors: React.ReactNode[];
364
- warnings: React.ReactNode[];
365
- };
447
+ var useStatus: () => {
448
+ status?: antd_es_form_FormItem0.ValidateStatus;
449
+ errors: React.ReactNode[];
450
+ warnings: React.ReactNode[];
451
+ };
366
452
  }
367
-
453
+ //#endregion
454
+ //#region src/Table.d.ts
368
455
  interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
369
- optionsType?: 'auto';
370
- children?: UnionFaasItemElement<T> | null;
371
- tableChildren?: UnionFaasItemElement<T> | null;
372
- render?: UnionFaasItemRender<T> | null;
373
- tableRender?: UnionFaasItemRender<T> | null;
374
- object?: TableItemProps<T>[];
456
+ optionsType?: 'auto';
457
+ children?: UnionFaasItemElement<T> | null;
458
+ tableChildren?: UnionFaasItemElement<T> | null;
459
+ render?: UnionFaasItemRender<T> | null;
460
+ tableRender?: UnionFaasItemRender<T> | null;
461
+ object?: TableItemProps<T>[];
375
462
  }
376
463
  type ExtendTableTypeProps<T = any> = {
377
- children?: UnionFaasItemElement<T>;
378
- render?: UnionFaasItemRender<T>;
464
+ children?: UnionFaasItemElement<T>;
465
+ render?: UnionFaasItemRender<T>;
379
466
  };
380
467
  type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
381
468
  type TableProps<T = any, ExtendTypes = any> = {
382
- items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
383
- extendTypes?: {
384
- [key: string]: ExtendTableTypeProps;
385
- };
386
- faasData?: FaasDataWrapperProps<T>;
387
- onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
388
- pagination: TablePaginationConfig;
389
- filters: Record<string, FilterValue | null>;
390
- sorter: SorterResult<T> | SorterResult<T>[];
391
- extra: TableCurrentDataSource<T>;
392
- };
469
+ items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
470
+ extendTypes?: {
471
+ [key: string]: ExtendTableTypeProps;
472
+ };
473
+ faasData?: FaasDataWrapperProps<any>;
474
+ onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
475
+ pagination: TablePaginationConfig;
476
+ filters: Record<string, FilterValue | null>;
477
+ sorter: SorterResult<T> | SorterResult<T>[];
478
+ extra: TableCurrentDataSource<T>;
479
+ };
393
480
  } & TableProps$1<T>;
394
481
  type TableFaasDataParams = {
395
- filters?: Record<string, any[]>;
396
- pagination?: {
397
- current?: number;
398
- pageSize?: number;
399
- };
400
- sorter?: {
401
- field: string;
402
- order: 'ascend' | 'descend';
403
- } | {
404
- field: string;
405
- order?: 'ascend' | 'descend';
406
- }[];
482
+ filters?: Record<string, any[]>;
483
+ pagination?: {
484
+ current?: number;
485
+ pageSize?: number;
486
+ };
487
+ sorter?: {
488
+ field: string;
489
+ order: 'ascend' | 'descend';
490
+ } | {
491
+ field: string;
492
+ order?: 'ascend' | 'descend';
493
+ }[];
407
494
  };
408
495
  type TableFaasDataResponse<T = any> = {
409
- rows: T[];
410
- pagination: {
411
- current: number;
412
- pageSize: number;
413
- total: number;
414
- };
496
+ rows: T[];
497
+ pagination: {
498
+ current: number;
499
+ pageSize: number;
500
+ total: number;
501
+ };
415
502
  };
416
503
  /**
417
504
  * Table component with Ant Design & FaasJS
@@ -421,36 +508,37 @@ type TableFaasDataResponse<T = any> = {
421
508
  * - Auto generate filter dropdown (disable with `filterDropdown: false`).
422
509
  * - Auto generate sorter (disable with `sorter: false`).
423
510
  */
424
- declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
425
-
511
+ declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime0.JSX.Element | null;
512
+ //#endregion
513
+ //#region src/data.d.ts
426
514
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
427
515
  /** FaasItemType's value type */
428
516
  type FaasItemTypeValue = {
429
- string: string;
430
- 'string[]': string[];
431
- number: number;
432
- 'number[]': number[];
433
- boolean: boolean;
434
- date: Dayjs;
435
- time: Dayjs;
436
- object: any;
437
- 'object[]': any[];
517
+ string: string;
518
+ 'string[]': string[];
519
+ number: number;
520
+ 'number[]': number[];
521
+ boolean: boolean;
522
+ date: Dayjs;
523
+ time: Dayjs;
524
+ object: any;
525
+ 'object[]': any[];
438
526
  };
439
527
  type BaseOption = string | number | {
440
- label: string;
441
- value?: any;
528
+ label: string;
529
+ value?: any;
442
530
  };
443
531
  interface BaseItemProps {
444
- id: string | number;
445
- title?: string;
446
- options?: BaseOption[];
532
+ id: string | number;
533
+ title?: string;
534
+ options?: BaseOption[];
447
535
  }
448
536
  interface FaasItemProps extends BaseItemProps {
449
- /**
450
- * Support string, string[], number, number[], boolean, date, time, object, object[]
451
- * @default 'string'
452
- */
453
- type?: FaasItemType;
537
+ /**
538
+ * Support string, string[], number, number[], boolean, date, time, object, object[]
539
+ * @default 'string'
540
+ */
541
+ type?: FaasItemType;
454
542
  }
455
543
  /**
456
544
  * Converts an identifier string to a title case string.
@@ -471,16 +559,16 @@ declare function idToTitle(id: string | number): string;
471
559
  * convert string[] or number[] to { label, value }[]
472
560
  */
473
561
  declare function transferOptions(options: BaseOption[]): {
474
- label: string;
475
- value?: string | number;
562
+ label: string;
563
+ value?: string | number;
476
564
  }[];
477
- declare function transferValue(type: FaasItemType, value: any): any;
565
+ declare function transferValue(type: FaasItemType | null | undefined, value: any): any;
478
566
  type UnionScene = 'form' | 'description' | 'table';
479
567
  type UnionFaasItemInjection<Value = any, Values = any> = {
480
- scene?: UnionScene;
481
- value?: Value;
482
- values?: Values;
483
- index?: number;
568
+ scene?: UnionScene;
569
+ value?: Value;
570
+ values?: Values;
571
+ index?: number;
484
572
  };
485
573
  /**
486
574
  * A type representing a function that renders a React node for a given item in a list.
@@ -627,9 +715,9 @@ type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasIte
627
715
  * ```
628
716
  */
629
717
  interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
630
- children?: UnionFaasItemElement<Value, Values> | null;
631
- render?: UnionFaasItemRender<Value, Values> | null;
632
- object?: UnionFaasItemProps<Value, Values>[];
718
+ children?: UnionFaasItemElement<Value, Values> | null;
719
+ render?: UnionFaasItemRender<Value, Values> | null;
720
+ object?: UnionFaasItemProps<Value, Values>[];
633
721
  }
634
722
  /**
635
723
  * Clone a UnionFaasItemElement with the given props.
@@ -643,36 +731,37 @@ interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, D
643
731
  * @returns The cloned element with the applied props.
644
732
  */
645
733
  declare function cloneUnionFaasItemElement(element: UnionFaasItemElement, props: any): ReactElement<UnionFaasItemInjection<any, any>, string | react.JSXElementConstructor<any>>;
646
-
734
+ //#endregion
735
+ //#region src/Description.d.ts
647
736
  interface ExtendDescriptionTypeProps<T = any> {
648
- children?: UnionFaasItemElement<T>;
649
- render?: UnionFaasItemRender<T>;
737
+ children?: UnionFaasItemElement<T>;
738
+ render?: UnionFaasItemRender<T>;
650
739
  }
651
740
  type ExtendDescriptionItemProps = BaseItemProps;
652
741
  interface DescriptionItemProps<T = any> extends FaasItemProps {
653
- children?: UnionFaasItemElement<T> | null;
654
- descriptionChildren?: UnionFaasItemElement<T> | null;
655
- render?: UnionFaasItemRender<T> | null;
656
- descriptionRender?: UnionFaasItemRender<T> | null;
657
- if?: (values: Record<string, any>) => boolean;
658
- object?: DescriptionItemProps<T>[];
742
+ children?: UnionFaasItemElement<T> | null;
743
+ descriptionChildren?: UnionFaasItemElement<T> | null;
744
+ render?: UnionFaasItemRender<T> | null;
745
+ descriptionRender?: UnionFaasItemRender<T> | null;
746
+ if?: (values: Record<string, any>) => boolean;
747
+ object?: DescriptionItemProps<T>[];
659
748
  }
660
749
  interface DescriptionProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
661
- renderTitle?(values: T): ReactNode;
662
- items: (DescriptionItemProps | ExtendItemProps)[];
663
- extendTypes?: {
664
- [key: string]: ExtendDescriptionTypeProps;
665
- };
666
- dataSource?: T;
667
- faasData?: FaasDataWrapperProps<T>;
750
+ renderTitle?(values: T): ReactNode;
751
+ items: (DescriptionItemProps | ExtendItemProps)[];
752
+ extendTypes?: {
753
+ [key: string]: ExtendDescriptionTypeProps;
754
+ };
755
+ dataSource?: T;
756
+ faasData?: FaasDataWrapperProps<any>;
668
757
  }
669
758
  interface DescriptionItemContentProps<T = any> {
670
- item: DescriptionItemProps;
671
- value: T;
672
- values?: any;
673
- extendTypes?: {
674
- [key: string]: ExtendDescriptionTypeProps;
675
- };
759
+ item: DescriptionItemProps;
760
+ value: T;
761
+ values?: any;
762
+ extendTypes?: {
763
+ [key: string]: ExtendDescriptionTypeProps;
764
+ };
676
765
  }
677
766
  /**
678
767
  * Description component
@@ -696,86 +785,92 @@ interface DescriptionItemContentProps<T = any> {
696
785
  * />
697
786
  * ```
698
787
  */
699
- declare function Description<T extends Record<string, any> = any>({ faasData, dataSource, renderTitle, extendTypes, ...props }: DescriptionProps<T>): react_jsx_runtime.JSX.Element;
788
+ declare function Description<T extends Record<string, any> = any>({
789
+ faasData,
790
+ dataSource,
791
+ renderTitle,
792
+ extendTypes,
793
+ ...props
794
+ }: DescriptionProps<T>): react_jsx_runtime0.JSX.Element;
700
795
  declare namespace Description {
701
- var displayName: string;
796
+ var displayName: string;
702
797
  }
703
-
798
+ //#endregion
799
+ //#region src/Form.d.ts
704
800
  type FormSubmitProps = {
705
- /** Default: Submit */
706
- text?: string;
707
- /**
708
- * Submit to FaasJS server.
709
- *
710
- * If use onFinish, you should call submit manually.
711
- * ```ts
712
- * {
713
- * submit: {
714
- * to: {
715
- * action: 'action_name'
716
- * }
717
- * },
718
- * onFinish: (values, submit) => {
719
- * // do something before submit
720
- *
721
- * // submit
722
- * await submit({
723
- * ...values,
724
- * extraProps: 'some extra props'
725
- * })
726
- *
727
- * // do something after submit
728
- * }
729
- * }
730
- * ```
731
- */
732
- to?: {
733
- action: FaasAction | string;
734
- /** params will overwrite form values before submit */
735
- params?: Record<string, any>;
736
- then?: (result: any) => void;
737
- catch?: (error: any) => void;
738
- finally?: () => void;
739
- };
801
+ /** Default: Submit */text?: string;
802
+ /**
803
+ * Submit to FaasJS server.
804
+ *
805
+ * If use onFinish, you should call submit manually.
806
+ * ```ts
807
+ * {
808
+ * submit: {
809
+ * to: {
810
+ * action: 'action_name'
811
+ * }
812
+ * },
813
+ * onFinish: (values, submit) => {
814
+ * // do something before submit
815
+ *
816
+ * // submit
817
+ * await submit({
818
+ * ...values,
819
+ * extraProps: 'some extra props'
820
+ * })
821
+ *
822
+ * // do something after submit
823
+ * }
824
+ * }
825
+ * ```
826
+ */
827
+ to?: {
828
+ action: FaasAction | string; /** params will overwrite form values before submit */
829
+ params?: Record<string, any>;
830
+ then?: (result: any) => void;
831
+ catch?: (error: any) => void;
832
+ finally?: () => void;
833
+ };
740
834
  };
741
835
  interface FormProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> extends Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> {
742
- items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
743
- /** Default: { text: 'Submit' }, set false to disable it */
744
- submit?: false | FormSubmitProps;
745
- onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
746
- beforeItems?: JSX.Element | JSX.Element[];
747
- footer?: JSX.Element | JSX.Element[];
748
- extendTypes?: ExtendTypes;
749
- children?: ReactNode;
750
- initialValues?: Partial<Values>;
836
+ items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
837
+ /** Default: { text: 'Submit' }, set false to disable it */
838
+ submit?: false | FormSubmitProps;
839
+ onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
840
+ beforeItems?: JSX.Element | JSX.Element[];
841
+ footer?: JSX.Element | JSX.Element[];
842
+ extendTypes?: ExtendTypes;
843
+ children?: ReactNode;
844
+ initialValues?: Partial<Values>;
751
845
  }
752
846
  /**
753
847
  * Form component with Ant Design & FaasJS
754
848
  *
755
849
  * - Based on [Ant Design Form](https://ant.design/components/form/).
756
850
  */
757
- declare function Form<Values = any>(props: FormProps<Values>): react_jsx_runtime.JSX.Element;
851
+ declare function Form<Values extends Record<string, any> = any>(props: FormProps<Values>): react_jsx_runtime0.JSX.Element | null;
758
852
  declare namespace Form {
759
- var useForm: typeof antd_es_form_Form.useForm;
760
- var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
761
- var useWatch: typeof _rc_component_form.useWatch;
762
- var Item: typeof FormItem;
763
- var List: react.FC<antd_es_form.FormListProps>;
764
- var ErrorList: react.FC<antd_es_form.ErrorListProps>;
765
- var Provider: react.FC<antd_es_form_context.FormProviderProps>;
853
+ var useForm: typeof antd_es_form_Form0.useForm;
854
+ var useFormInstance: typeof antd_es_form_hooks_useFormInstance0.default;
855
+ var useWatch: typeof _rc_component_form0.useWatch;
856
+ var Item: typeof FormItem;
857
+ var List: react.FC<antd_es_form0.FormListProps>;
858
+ var ErrorList: react.FC<antd_es_form0.ErrorListProps>;
859
+ var Provider: react.FC<antd_es_form_context0.FormProviderProps>;
766
860
  }
767
-
861
+ //#endregion
862
+ //#region src/Link.d.ts
768
863
  interface LinkProps {
769
- href: string;
770
- target?: '_blank';
771
- text?: string | number;
772
- children?: ReactNode;
773
- style?: CSSProperties;
774
- button?: ButtonProps | boolean;
775
- block?: boolean;
776
- /** only use for text without button */
777
- copyable?: boolean;
778
- onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
864
+ href: string;
865
+ target?: '_blank';
866
+ text?: string | number;
867
+ children?: ReactNode;
868
+ style?: CSSProperties;
869
+ button?: ButtonProps | boolean;
870
+ block?: boolean;
871
+ /** only use for text without button */
872
+ copyable?: boolean;
873
+ onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
779
874
  }
780
875
  /**
781
876
  * Link component with button
@@ -789,15 +884,16 @@ interface LinkProps {
789
884
  * <Link href="/" button={{ type:'primary' }}>Home</Link>
790
885
  * ```
791
886
  */
792
- declare function Link(props: LinkProps): react_jsx_runtime.JSX.Element;
793
-
794
- declare function PageNotFound(): react_jsx_runtime.JSX.Element;
887
+ declare function Link(props: LinkProps): react_jsx_runtime0.JSX.Element;
888
+ //#endregion
889
+ //#region src/Routers.d.ts
890
+ declare function PageNotFound(): react_jsx_runtime0.JSX.Element;
795
891
  interface RoutesProps {
796
- routes: (RouteProps & {
797
- page?: LazyExoticComponent<ComponentType<any>>;
798
- })[];
799
- fallback?: JSX.Element;
800
- notFound?: JSX.Element;
892
+ routes: (RouteProps & {
893
+ page?: LazyExoticComponent<ComponentType<any>>;
894
+ })[];
895
+ fallback?: JSX.Element;
896
+ notFound?: JSX.Element;
801
897
  }
802
898
  /**
803
899
  * Routes with lazy loading and 404 page.
@@ -819,16 +915,17 @@ interface RoutesProps {
819
915
  * }
820
916
  * ```
821
917
  */
822
- declare function Routes(props: RoutesProps): react_jsx_runtime.JSX.Element;
823
-
918
+ declare function Routes(props: RoutesProps): react_jsx_runtime0.JSX.Element;
919
+ //#endregion
920
+ //#region src/Tabs.d.ts
824
921
  interface TabProps extends Partial<Tab> {
825
- id: string;
826
- title?: React.ReactNode;
827
- children: React.ReactNode;
922
+ id: string;
923
+ title?: React.ReactNode;
924
+ children: React.ReactNode;
828
925
  }
829
926
  interface TabsProps extends Omit<TabsProps$1, 'items'> {
830
- /** auto skip null tab */
831
- items: (TabProps | null | false)[];
927
+ /** auto skip null tab */
928
+ items: (TabProps | null | false)[];
832
929
  }
833
930
  /**
834
931
  * Tabs component with Ant Design & FaasJS
@@ -855,22 +952,23 @@ interface TabsProps extends Omit<TabsProps$1, 'items'> {
855
952
  * />
856
953
  * ```
857
954
  */
858
- declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
859
-
955
+ declare function Tabs(props: TabsProps): react_jsx_runtime0.JSX.Element;
956
+ //#endregion
957
+ //#region src/Title.d.ts
860
958
  interface TitleProps {
861
- title: string | string[];
862
- /** ` - ` as default */
863
- separator?: string;
864
- suffix?: string;
865
- /** return a h1 element */
866
- h1?: boolean | {
867
- className?: string;
868
- style?: React.CSSProperties;
869
- };
870
- /** return a pure text element */
871
- plain?: boolean;
872
- /** return children */
873
- children?: JSX.Element;
959
+ title: string | string[];
960
+ /** ` - ` as default */
961
+ separator?: string;
962
+ suffix?: string;
963
+ /** return a h1 element */
964
+ h1?: boolean | {
965
+ className?: string;
966
+ style?: React.CSSProperties;
967
+ };
968
+ /** return a pure text element */
969
+ plain?: boolean;
970
+ /** return children */
971
+ children?: JSX.Element;
874
972
  }
875
973
  /**
876
974
  * Title is used to change the title of the page
@@ -890,8 +988,9 @@ interface TitleProps {
890
988
  * <Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
891
989
  * ```
892
990
  */
893
- declare function Title(props: TitleProps): JSX.Element;
894
-
991
+ declare function Title(props: TitleProps): JSX.Element | null;
992
+ //#endregion
993
+ //#region src/useThemeToken.d.ts
895
994
  /**
896
995
  * Hook to retrieve the theme token from the Ant Design theme configuration.
897
996
  *
@@ -901,5 +1000,5 @@ declare function Title(props: TitleProps): JSX.Element;
901
1000
  * @returns {GlobalToken} The theme token from the Ant Design theme configuration.
902
1001
  */
903
1002
  declare function useThemeToken(): GlobalToken;
904
-
905
- export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableFaasDataParams, type TableFaasDataResponse, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, cloneUnionFaasItemElement, idToTitle, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal, useThemeToken, withFaasData };
1003
+ //#endregion
1004
+ export { App, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, Drawer, DrawerProps, ErrorBoundary, type ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, type FaasDataWrapperRef, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasReactClient, type FaasReactClientOptions, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, Modal, ModalProps, PageNotFound, ResolvedTheme, Routes, RoutesProps, TabProps, Table, TableFaasDataParams, TableFaasDataResponse, TableItemProps, TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, cloneUnionFaasItemElement, faas, idToTitle, lazy, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };