@faasjs/ant-design 8.0.0-beta.1 → 8.0.0-beta.11

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,33 +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
- 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 { JSX, CSSProperties, Dispatch, SetStateAction, ReactElement, FC, ReactNode, LazyExoticComponent, ComponentType } from 'react';
8
- export { lazy } from 'react';
9
- import { FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataInjection as FaasDataInjection$1, FaasReactClientOptions, ErrorBoundaryProps } from '@faasjs/react';
10
- export { ErrorBoundaryProps, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from '@faasjs/react';
11
- import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
12
- import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
13
- import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
14
- import { FaasActionUnionType, FaasAction } from '@faasjs/types';
15
- import { Dayjs } from 'dayjs';
16
- import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
17
- import * as antd_es_form from 'antd/es/form';
18
- import { RuleObject } from 'antd/es/form';
19
- import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
20
- import * as antd_es_form_context from 'antd/es/form/context';
21
- import * as _rc_component_form from '@rc-component/form';
22
- import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
23
- import * as antd_es_form_Form from 'antd/es/form/Form';
24
- 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";
25
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
26
72
  type LoadingProps = {
27
- style?: React.CSSProperties;
28
- size?: 'small' | 'default' | 'large';
29
- loading?: boolean;
30
- children?: React.ReactNode;
73
+ style?: React.CSSProperties;
74
+ size?: 'small' | 'default' | 'large';
75
+ loading?: boolean;
76
+ children?: React.ReactNode;
31
77
  };
32
78
  /**
33
79
  * Loading component based on Spin
@@ -41,17 +87,14 @@ type LoadingProps = {
41
87
  * </Loading>
42
88
  * ```
43
89
  */
44
- declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
45
- declare namespace Loading {
46
- var whyDidYouRender: boolean;
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;
47
97
  }
48
-
49
- type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
50
- interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
51
- loadingProps?: LoadingProps;
52
- loading?: JSX.Element;
53
- }
54
-
55
98
  /**
56
99
  * FaasDataWrapper component with Loading
57
100
  *
@@ -68,10 +111,7 @@ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
68
111
  * }
69
112
  * ```
70
113
  */
71
- declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
72
- declare namespace FaasDataWrapper {
73
- var whyDidYouRender: boolean;
74
- }
114
+ declare function FaasDataWrapper<T extends FaasActionUnionType = any>(props: FaasDataWrapperProps<T>): JSX.Element;
75
115
  /**
76
116
  * HOC to wrap a component with FaasDataWrapper and Loading
77
117
  *
@@ -81,44 +121,76 @@ declare namespace FaasDataWrapper {
81
121
  * ```
82
122
  */
83
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>>>;
84
-
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
+ };
85
159
  interface ConfigProviderProps {
86
- faasClientOptions?: FaasReactClientOptions;
87
- children: React.ReactNode;
88
- theme?: {
89
- lang?: string;
90
- common?: {
91
- blank?: string;
92
- all?: string;
93
- submit?: string;
94
- pageNotFound?: string;
95
- add?: string;
96
- delete?: string;
97
- required?: string;
98
- search?: string;
99
- reset?: string;
100
- };
101
- Blank?: {
102
- text?: string;
103
- };
104
- Form?: {
105
- submit?: {
106
- text?: string;
107
- };
108
- };
109
- Title?: {
110
- /** ' - ' as default */
111
- separator?: string;
112
- suffix?: string;
113
- };
114
- Link?: {
115
- /** '_blank' as default */
116
- target?: string;
117
- style?: CSSProperties;
118
- };
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;
119
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
+ };
120
192
  }
121
- declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
193
+ declare const ConfigContext: react.Context<ConfigContextValue>;
122
194
  /**
123
195
  * Config for `@faasjs/ant-design` components.
124
196
  *
@@ -131,14 +203,12 @@ declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
131
203
  * </ConfigProvider>
132
204
  * ```
133
205
  */
134
- declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime.JSX.Element;
135
- declare function useConfigContext(): Partial<ConfigProviderProps>;
136
-
137
- declare const Drawer: React.FC<DrawerProps> & {
138
- whyDidYouRender?: boolean;
139
- };
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
140
210
  interface DrawerProps extends DrawerProps$1 {
141
- children?: JSX.Element | JSX.Element[];
211
+ children?: JSX.Element | JSX.Element[];
142
212
  }
143
213
  type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
144
214
  /**
@@ -158,27 +228,20 @@ type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
158
228
  * ```
159
229
  */
160
230
  declare function useDrawer(init?: DrawerProps): {
161
- drawer: react_jsx_runtime.JSX.Element;
162
- drawerProps: DrawerProps;
163
- setDrawerProps: setDrawerProps;
231
+ drawer: react_jsx_runtime0.JSX.Element;
232
+ drawerProps: DrawerProps;
233
+ setDrawerProps: setDrawerProps;
164
234
  };
165
-
235
+ //#endregion
236
+ //#region src/ErrorBoundary.d.ts
166
237
  /**
167
238
  * Styled error boundary.
168
239
  */
169
- declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
170
- declare namespace ErrorBoundary {
171
- var whyDidYouRender: boolean;
172
- }
173
-
174
- declare const Modal: react.FC<ModalProps$1> & antd_es_modal_confirm.ModalStaticFunctions & {
175
- useModal: typeof antd_es_modal_useModal.default;
176
- destroyAll: () => void;
177
- config: typeof antd_es_modal_confirm.modalGlobalConfig;
178
- _InternalPanelDoNotUseOrYouWillBeFired: (props: antd_es_modal_PurePanel.PurePanelProps) => React.JSX.Element;
179
- };
240
+ declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime0.JSX.Element;
241
+ //#endregion
242
+ //#region src/Modal.d.ts
180
243
  interface ModalProps extends ModalProps$1 {
181
- children?: JSX.Element | JSX.Element[] | string;
244
+ children?: JSX.Element | JSX.Element[] | string;
182
245
  }
183
246
  type setModalProps = Dispatch<SetStateAction<ModalProps>>;
184
247
  /**
@@ -196,35 +259,36 @@ type setModalProps = Dispatch<SetStateAction<ModalProps>>;
196
259
  * ```
197
260
  */
198
261
  declare function useModal(init?: ModalProps): {
199
- modal: react_jsx_runtime.JSX.Element;
200
- modalProps: ModalProps;
201
- setModalProps: setModalProps;
262
+ modal: react_jsx_runtime0.JSX.Element;
263
+ modalProps: ModalProps;
264
+ setModalProps: setModalProps;
202
265
  };
203
-
266
+ //#endregion
267
+ //#region src/App.d.ts
204
268
  interface AppProps {
205
- children: React.ReactNode;
206
- /** @see https://ant.design/components/config-provider/#API */
207
- configProviderProps?: ConfigProviderProps$1;
208
- /**
209
- * `false` to disable BrowserRouter.
210
- *
211
- * Auto disable when not in browser.
212
- *
213
- * @see https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html
214
- */
215
- browserRouterProps?: BrowserRouterProps | false;
216
- /** @see https://faasjs.com/doc/ant-design/#errorboundary */
217
- errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
218
- /** @see https://faasjs.com/doc/ant-design/#configprovider */
219
- 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;
220
284
  }
221
285
  interface useAppProps {
222
- message: MessageInstance;
223
- notification: NotificationInstance;
224
- modalProps: ModalProps;
225
- setModalProps: setModalProps;
226
- drawerProps: DrawerProps;
227
- setDrawerProps: setDrawerProps;
286
+ message: MessageInstance;
287
+ notification: NotificationInstance;
288
+ modalProps: ModalProps;
289
+ setModalProps: setModalProps;
290
+ drawerProps: DrawerProps;
291
+ setDrawerProps: setDrawerProps;
228
292
  }
229
293
  /**
230
294
  * App component with Ant Design & FaasJS
@@ -253,10 +317,9 @@ interface useAppProps {
253
317
  * }
254
318
  * ```
255
319
  */
256
- declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
320
+ declare function App(props: AppProps): react_jsx_runtime0.JSX.Element;
257
321
  declare namespace App {
258
- var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
259
- var whyDidYouRender: boolean;
322
+ var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
260
323
  }
261
324
  /**
262
325
  * Get app context.
@@ -268,10 +331,11 @@ declare namespace App {
268
331
  * ```
269
332
  */
270
333
  declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
271
-
334
+ //#endregion
335
+ //#region src/Blank.d.ts
272
336
  interface BlankProps {
273
- value?: any;
274
- text?: string;
337
+ value?: any;
338
+ text?: string;
275
339
  }
276
340
  /**
277
341
  * Blank component.
@@ -286,46 +350,44 @@ interface BlankProps {
286
350
  * ```
287
351
  */
288
352
  declare function Blank(options?: BlankProps): JSX.Element;
289
- declare namespace Blank {
290
- var whyDidYouRender: boolean;
291
- }
292
-
353
+ //#endregion
354
+ //#region src/FormItem.d.ts
293
355
  type ExtendFormTypeProps<T = any> = {
294
- children?: UnionFaasItemElement<T>;
356
+ children?: UnionFaasItemElement<T>;
295
357
  };
296
358
  type ExtendTypes = {
297
- [type: string]: ExtendFormTypeProps;
359
+ [type: string]: ExtendFormTypeProps;
298
360
  };
299
361
  type InputTypeMap<T> = {
300
- string: InputProps | SelectProps<T> | RadioProps;
301
- 'string[]': InputProps | SelectProps<T> | RadioProps;
302
- number: InputNumberProps | SelectProps<T> | RadioProps;
303
- 'number[]': InputNumberProps | SelectProps<T> | RadioProps;
304
- boolean: SwitchProps;
305
- date: DatePickerProps;
306
- time: DatePickerProps;
307
- object: never;
308
- '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;
309
371
  };
310
372
  interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
311
- type?: FaasItemType;
312
- input?: InputTypeMap<T>[FaasItemType];
313
- maxCount?: number;
314
- object?: FormItemProps[];
315
- disabled?: boolean;
316
- required?: boolean;
317
- col?: number;
318
- children?: UnionFaasItemElement<T> | null;
319
- formChildren?: UnionFaasItemElement<T> | null;
320
- render?: UnionFaasItemRender<T> | null;
321
- formRender?: UnionFaasItemRender<T> | null;
322
- rules?: RuleObject[];
323
- label?: string | false;
324
- extendTypes?: ExtendTypes;
325
- /** trigger when current item's value changed */
326
- onValueChange?: (value: T, values: any, form: FormInstance) => void;
327
- /** trigger when any item's value changed */
328
- 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;
329
391
  }
330
392
  /**
331
393
  * Extend custom form item types.
@@ -361,7 +423,7 @@ interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>,
361
423
  * ```
362
424
  */
363
425
  interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
364
- type?: string;
426
+ type?: string;
365
427
  }
366
428
  /**
367
429
  * FormItem
@@ -380,63 +442,63 @@ interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
380
442
  * </>
381
443
  * ```
382
444
  */
383
- 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;
384
446
  declare namespace FormItem {
385
- var whyDidYouRender: boolean;
386
- var useStatus: () => {
387
- status?: antd_es_form_FormItem.ValidateStatus;
388
- errors: React.ReactNode[];
389
- warnings: React.ReactNode[];
390
- };
391
- }
392
-
447
+ var useStatus: () => {
448
+ status?: antd_es_form_FormItem0.ValidateStatus;
449
+ errors: React.ReactNode[];
450
+ warnings: React.ReactNode[];
451
+ };
452
+ }
453
+ //#endregion
454
+ //#region src/Table.d.ts
393
455
  interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
394
- optionsType?: 'auto';
395
- children?: UnionFaasItemElement<T> | null;
396
- tableChildren?: UnionFaasItemElement<T> | null;
397
- render?: UnionFaasItemRender<T> | null;
398
- tableRender?: UnionFaasItemRender<T> | null;
399
- 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>[];
400
462
  }
401
463
  type ExtendTableTypeProps<T = any> = {
402
- children?: UnionFaasItemElement<T>;
403
- render?: UnionFaasItemRender<T>;
464
+ children?: UnionFaasItemElement<T>;
465
+ render?: UnionFaasItemRender<T>;
404
466
  };
405
467
  type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
406
468
  type TableProps<T = any, ExtendTypes = any> = {
407
- items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
408
- extendTypes?: {
409
- [key: string]: ExtendTableTypeProps;
410
- };
411
- faasData?: FaasDataWrapperProps<T>;
412
- onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
413
- pagination: TablePaginationConfig;
414
- filters: Record<string, FilterValue | null>;
415
- sorter: SorterResult<T> | SorterResult<T>[];
416
- extra: TableCurrentDataSource<T>;
417
- };
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
+ };
418
480
  } & TableProps$1<T>;
419
481
  type TableFaasDataParams = {
420
- filters?: Record<string, any[]>;
421
- pagination?: {
422
- current?: number;
423
- pageSize?: number;
424
- };
425
- sorter?: {
426
- field: string;
427
- order: 'ascend' | 'descend';
428
- } | {
429
- field: string;
430
- order?: 'ascend' | 'descend';
431
- }[];
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
+ }[];
432
494
  };
433
495
  type TableFaasDataResponse<T = any> = {
434
- rows: T[];
435
- pagination: {
436
- current: number;
437
- pageSize: number;
438
- total: number;
439
- };
496
+ rows: T[];
497
+ pagination: {
498
+ current: number;
499
+ pageSize: number;
500
+ total: number;
501
+ };
440
502
  };
441
503
  /**
442
504
  * Table component with Ant Design & FaasJS
@@ -446,36 +508,37 @@ type TableFaasDataResponse<T = any> = {
446
508
  * - Auto generate filter dropdown (disable with `filterDropdown: false`).
447
509
  * - Auto generate sorter (disable with `sorter: false`).
448
510
  */
449
- declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
450
-
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
451
514
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
452
515
  /** FaasItemType's value type */
453
516
  type FaasItemTypeValue = {
454
- string: string;
455
- 'string[]': string[];
456
- number: number;
457
- 'number[]': number[];
458
- boolean: boolean;
459
- date: Dayjs;
460
- time: Dayjs;
461
- object: any;
462
- '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[];
463
526
  };
464
527
  type BaseOption = string | number | {
465
- label: string;
466
- value?: any;
528
+ label: string;
529
+ value?: any;
467
530
  };
468
531
  interface BaseItemProps {
469
- id: string | number;
470
- title?: string;
471
- options?: BaseOption[];
532
+ id: string | number;
533
+ title?: string;
534
+ options?: BaseOption[];
472
535
  }
473
536
  interface FaasItemProps extends BaseItemProps {
474
- /**
475
- * Support string, string[], number, number[], boolean, date, time, object, object[]
476
- * @default 'string'
477
- */
478
- type?: FaasItemType;
537
+ /**
538
+ * Support string, string[], number, number[], boolean, date, time, object, object[]
539
+ * @default 'string'
540
+ */
541
+ type?: FaasItemType;
479
542
  }
480
543
  /**
481
544
  * Converts an identifier string to a title case string.
@@ -496,16 +559,16 @@ declare function idToTitle(id: string | number): string;
496
559
  * convert string[] or number[] to { label, value }[]
497
560
  */
498
561
  declare function transferOptions(options: BaseOption[]): {
499
- label: string;
500
- value?: string | number;
562
+ label: string;
563
+ value?: string | number;
501
564
  }[];
502
- declare function transferValue(type: FaasItemType, value: any): any;
565
+ declare function transferValue(type: FaasItemType | null | undefined, value: any): any;
503
566
  type UnionScene = 'form' | 'description' | 'table';
504
567
  type UnionFaasItemInjection<Value = any, Values = any> = {
505
- scene?: UnionScene;
506
- value?: Value;
507
- values?: Values;
508
- index?: number;
568
+ scene?: UnionScene;
569
+ value?: Value;
570
+ values?: Values;
571
+ index?: number;
509
572
  };
510
573
  /**
511
574
  * A type representing a function that renders a React node for a given item in a list.
@@ -652,9 +715,9 @@ type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasIte
652
715
  * ```
653
716
  */
654
717
  interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
655
- children?: UnionFaasItemElement<Value, Values> | null;
656
- render?: UnionFaasItemRender<Value, Values> | null;
657
- object?: UnionFaasItemProps<Value, Values>[];
718
+ children?: UnionFaasItemElement<Value, Values> | null;
719
+ render?: UnionFaasItemRender<Value, Values> | null;
720
+ object?: UnionFaasItemProps<Value, Values>[];
658
721
  }
659
722
  /**
660
723
  * Clone a UnionFaasItemElement with the given props.
@@ -668,36 +731,37 @@ interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, D
668
731
  * @returns The cloned element with the applied props.
669
732
  */
670
733
  declare function cloneUnionFaasItemElement(element: UnionFaasItemElement, props: any): ReactElement<UnionFaasItemInjection<any, any>, string | react.JSXElementConstructor<any>>;
671
-
734
+ //#endregion
735
+ //#region src/Description.d.ts
672
736
  interface ExtendDescriptionTypeProps<T = any> {
673
- children?: UnionFaasItemElement<T>;
674
- render?: UnionFaasItemRender<T>;
737
+ children?: UnionFaasItemElement<T>;
738
+ render?: UnionFaasItemRender<T>;
675
739
  }
676
740
  type ExtendDescriptionItemProps = BaseItemProps;
677
741
  interface DescriptionItemProps<T = any> extends FaasItemProps {
678
- children?: UnionFaasItemElement<T> | null;
679
- descriptionChildren?: UnionFaasItemElement<T> | null;
680
- render?: UnionFaasItemRender<T> | null;
681
- descriptionRender?: UnionFaasItemRender<T> | null;
682
- if?: (values: Record<string, any>) => boolean;
683
- 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>[];
684
748
  }
685
749
  interface DescriptionProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
686
- renderTitle?(values: T): ReactNode;
687
- items: (DescriptionItemProps | ExtendItemProps)[];
688
- extendTypes?: {
689
- [key: string]: ExtendDescriptionTypeProps;
690
- };
691
- dataSource?: T;
692
- 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>;
693
757
  }
694
758
  interface DescriptionItemContentProps<T = any> {
695
- item: DescriptionItemProps;
696
- value: T;
697
- values?: any;
698
- extendTypes?: {
699
- [key: string]: ExtendDescriptionTypeProps;
700
- };
759
+ item: DescriptionItemProps;
760
+ value: T;
761
+ values?: any;
762
+ extendTypes?: {
763
+ [key: string]: ExtendDescriptionTypeProps;
764
+ };
701
765
  }
702
766
  /**
703
767
  * Description component
@@ -721,88 +785,92 @@ interface DescriptionItemContentProps<T = any> {
721
785
  * />
722
786
  * ```
723
787
  */
724
- 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;
725
795
  declare namespace Description {
726
- var displayName: string;
727
- var whyDidYouRender: boolean;
796
+ var displayName: string;
728
797
  }
729
-
798
+ //#endregion
799
+ //#region src/Form.d.ts
730
800
  type FormSubmitProps = {
731
- /** Default: Submit */
732
- text?: string;
733
- /**
734
- * Submit to FaasJS server.
735
- *
736
- * If use onFinish, you should call submit manually.
737
- * ```ts
738
- * {
739
- * submit: {
740
- * to: {
741
- * action: 'action_name'
742
- * }
743
- * },
744
- * onFinish: (values, submit) => {
745
- * // do something before submit
746
- *
747
- * // submit
748
- * await submit({
749
- * ...values,
750
- * extraProps: 'some extra props'
751
- * })
752
- *
753
- * // do something after submit
754
- * }
755
- * }
756
- * ```
757
- */
758
- to?: {
759
- action: FaasAction | string;
760
- /** params will overwrite form values before submit */
761
- params?: Record<string, any>;
762
- then?: (result: any) => void;
763
- catch?: (error: any) => void;
764
- finally?: () => void;
765
- };
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
+ };
766
834
  };
767
835
  interface FormProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> extends Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> {
768
- items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
769
- /** Default: { text: 'Submit' }, set false to disable it */
770
- submit?: false | FormSubmitProps;
771
- onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
772
- beforeItems?: JSX.Element | JSX.Element[];
773
- footer?: JSX.Element | JSX.Element[];
774
- extendTypes?: ExtendTypes;
775
- children?: ReactNode;
776
- 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>;
777
845
  }
778
846
  /**
779
847
  * Form component with Ant Design & FaasJS
780
848
  *
781
849
  * - Based on [Ant Design Form](https://ant.design/components/form/).
782
850
  */
783
- 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;
784
852
  declare namespace Form {
785
- var whyDidYouRender: boolean;
786
- var useForm: typeof antd_es_form_Form.useForm;
787
- var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
788
- var useWatch: typeof _rc_component_form.useWatch;
789
- var Item: typeof FormItem;
790
- var List: react.FC<antd_es_form.FormListProps>;
791
- var ErrorList: react.FC<antd_es_form.ErrorListProps>;
792
- var Provider: react.FC<antd_es_form_context.FormProviderProps>;
793
- }
794
-
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>;
860
+ }
861
+ //#endregion
862
+ //#region src/Link.d.ts
795
863
  interface LinkProps {
796
- href: string;
797
- target?: '_blank';
798
- text?: string | number;
799
- children?: ReactNode;
800
- style?: CSSProperties;
801
- button?: ButtonProps | boolean;
802
- block?: boolean;
803
- /** only use for text without button */
804
- copyable?: boolean;
805
- 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;
806
874
  }
807
875
  /**
808
876
  * Link component with button
@@ -816,18 +884,16 @@ interface LinkProps {
816
884
  * <Link href="/" button={{ type:'primary' }}>Home</Link>
817
885
  * ```
818
886
  */
819
- declare function Link(props: LinkProps): react_jsx_runtime.JSX.Element;
820
- declare namespace Link {
821
- var whyDidYouRender: boolean;
822
- }
823
-
824
- 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;
825
891
  interface RoutesProps {
826
- routes: (RouteProps & {
827
- page?: LazyExoticComponent<ComponentType<any>>;
828
- })[];
829
- fallback?: JSX.Element;
830
- notFound?: JSX.Element;
892
+ routes: (RouteProps & {
893
+ page?: LazyExoticComponent<ComponentType<any>>;
894
+ })[];
895
+ fallback?: JSX.Element;
896
+ notFound?: JSX.Element;
831
897
  }
832
898
  /**
833
899
  * Routes with lazy loading and 404 page.
@@ -849,19 +915,17 @@ interface RoutesProps {
849
915
  * }
850
916
  * ```
851
917
  */
852
- declare function Routes(props: RoutesProps): react_jsx_runtime.JSX.Element;
853
- declare namespace Routes {
854
- var whyDidYouRender: boolean;
855
- }
856
-
918
+ declare function Routes(props: RoutesProps): react_jsx_runtime0.JSX.Element;
919
+ //#endregion
920
+ //#region src/Tabs.d.ts
857
921
  interface TabProps extends Partial<Tab> {
858
- id: string;
859
- title?: React.ReactNode;
860
- children: React.ReactNode;
922
+ id: string;
923
+ title?: React.ReactNode;
924
+ children: React.ReactNode;
861
925
  }
862
926
  interface TabsProps extends Omit<TabsProps$1, 'items'> {
863
- /** auto skip null tab */
864
- items: (TabProps | null | false)[];
927
+ /** auto skip null tab */
928
+ items: (TabProps | null | false)[];
865
929
  }
866
930
  /**
867
931
  * Tabs component with Ant Design & FaasJS
@@ -888,25 +952,23 @@ interface TabsProps extends Omit<TabsProps$1, 'items'> {
888
952
  * />
889
953
  * ```
890
954
  */
891
- declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
892
- declare namespace Tabs {
893
- var whyDidYouRender: boolean;
894
- }
895
-
955
+ declare function Tabs(props: TabsProps): react_jsx_runtime0.JSX.Element;
956
+ //#endregion
957
+ //#region src/Title.d.ts
896
958
  interface TitleProps {
897
- title: string | string[];
898
- /** ` - ` as default */
899
- separator?: string;
900
- suffix?: string;
901
- /** return a h1 element */
902
- h1?: boolean | {
903
- className?: string;
904
- style?: React.CSSProperties;
905
- };
906
- /** return a pure text element */
907
- plain?: boolean;
908
- /** return children */
909
- 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;
910
972
  }
911
973
  /**
912
974
  * Title is used to change the title of the page
@@ -926,11 +988,9 @@ interface TitleProps {
926
988
  * <Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
927
989
  * ```
928
990
  */
929
- declare function Title(props: TitleProps): JSX.Element;
930
- declare namespace Title {
931
- var whyDidYouRender: boolean;
932
- }
933
-
991
+ declare function Title(props: TitleProps): JSX.Element | null;
992
+ //#endregion
993
+ //#region src/useThemeToken.d.ts
934
994
  /**
935
995
  * Hook to retrieve the theme token from the Ant Design theme configuration.
936
996
  *
@@ -940,5 +1000,5 @@ declare namespace Title {
940
1000
  * @returns {GlobalToken} The theme token from the Ant Design theme configuration.
941
1001
  */
942
1002
  declare function useThemeToken(): GlobalToken;
943
-
944
- export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, 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, Modal, 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 };