@faasjs/ant-design 8.0.0-beta.3 → 8.0.0-beta.31
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/README.md +15 -39
- package/dist/index.d.ts +1132 -690
- package/dist/index.mjs +1822 -1497
- package/package.json +28 -30
- package/dist/index.cjs +0 -1625
package/dist/index.d.ts
CHANGED
|
@@ -1,231 +1,456 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import * as
|
|
15
|
-
import * as
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
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 { ErrorBoundaryProps, FaasDataInjection, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from "@faasjs/react";
|
|
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 { BrowserRouterProps, RouteProps } from "react-router-dom";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { CSSProperties, ComponentType, Dispatch, FC, JSX, LazyExoticComponent, ReactElement, ReactNode, SetStateAction, lazy } from "react";
|
|
6
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
|
+
import { Dayjs } from "dayjs";
|
|
8
|
+
import { FaasActionPaths, FaasParams } from "@faasjs/types";
|
|
9
|
+
import * as _$antd_es_form0 from "antd/es/form/index.js";
|
|
10
|
+
import { RuleObject } from "antd/es/form/index.js";
|
|
11
|
+
import { FilterValue, SorterResult, TableCurrentDataSource } from "antd/es/table/interface.js";
|
|
12
|
+
import * as _$antd_es_form_Form0 from "antd/es/form/Form.js";
|
|
13
|
+
import * as _$antd_es_form_hooks_useFormInstance0 from "antd/es/form/hooks/useFormInstance.js";
|
|
14
|
+
import * as _$_rc_component_form0 from "@rc-component/form";
|
|
15
|
+
import * as _$antd_es_form_context0 from "antd/es/form/context.js";
|
|
16
|
+
import * as _$antd_es_form_FormItem0 from "antd/es/form/FormItem/index.js";
|
|
17
|
+
import { Tab } from "@rc-component/tabs/lib/interface.js";
|
|
18
|
+
import { MessageInstance } from "antd/es/message/interface.js";
|
|
19
|
+
import { NotificationInstance } from "antd/es/notification/interface.js";
|
|
23
20
|
|
|
21
|
+
//#region src/Loading/index.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* Props for the {@link Loading} component.
|
|
24
|
+
*/
|
|
24
25
|
type LoadingProps = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
/** Inline styles applied to the loading wrapper. */style?: React.CSSProperties;
|
|
27
|
+
/**
|
|
28
|
+
* Ant Design spinner size.
|
|
29
|
+
*
|
|
30
|
+
* @default 'large'
|
|
31
|
+
*/
|
|
32
|
+
size?: 'small' | 'default' | 'large';
|
|
33
|
+
/**
|
|
34
|
+
* Whether the loading indicator should be shown.
|
|
35
|
+
*
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
loading?: boolean; /** Content rendered when `loading` is `false`. */
|
|
39
|
+
children?: React.ReactNode;
|
|
29
40
|
};
|
|
30
41
|
/**
|
|
31
|
-
*
|
|
42
|
+
* Render an Ant Design loading spinner with an optional content fallback.
|
|
43
|
+
*
|
|
44
|
+
* @param {LoadingProps} props - Loading indicator props and optional wrapped children.
|
|
32
45
|
*
|
|
33
46
|
* @example
|
|
34
47
|
* ```tsx
|
|
35
|
-
*
|
|
48
|
+
* import { Loading } from '@faasjs/ant-design'
|
|
36
49
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
50
|
+
* export function Page({ remoteData }: { remoteData?: string }) {
|
|
51
|
+
* return (
|
|
52
|
+
* <>
|
|
53
|
+
* <Loading />
|
|
54
|
+
* <Loading loading={!remoteData}>
|
|
55
|
+
* <div>{remoteData}</div>
|
|
56
|
+
* </Loading>
|
|
57
|
+
* </>
|
|
58
|
+
* )
|
|
59
|
+
* }
|
|
40
60
|
* ```
|
|
41
61
|
*/
|
|
42
|
-
declare function Loading(props: LoadingProps):
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
declare function Loading(props: LoadingProps): _$react_jsx_runtime0.JSX.Element;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/FaasDataWrapper/index.d.ts
|
|
65
|
+
/**
|
|
66
|
+
* Ant Design wrapper props for the underlying `@faasjs/react` data wrapper.
|
|
67
|
+
*
|
|
68
|
+
* @template T - Action path or response data type used for inference.
|
|
69
|
+
*/
|
|
70
|
+
interface FaasDataWrapperProps<T extends FaasActionPaths = any> extends FaasDataWrapperProps$1<T> {
|
|
71
|
+
/** Props forwarded to the built-in {@link Loading} fallback. */
|
|
72
|
+
loadingProps?: LoadingProps;
|
|
73
|
+
/** Explicit loading element that overrides the built-in {@link Loading} fallback. */
|
|
74
|
+
loading?: JSX.Element;
|
|
48
75
|
}
|
|
49
|
-
|
|
50
76
|
/**
|
|
51
|
-
*
|
|
77
|
+
* Render the `@faasjs/react` data wrapper with an Ant Design loading fallback.
|
|
78
|
+
*
|
|
79
|
+
* When `loading` is not provided, the component renders {@link Loading} with `loadingProps` while
|
|
80
|
+
* the wrapped FaasJS request is pending.
|
|
81
|
+
*
|
|
82
|
+
* @template T - Action path or response data type used for inference.
|
|
83
|
+
* @param {FaasDataWrapperProps<T>} props - Wrapper props including loading fallbacks and request configuration.
|
|
52
84
|
*
|
|
53
85
|
* @example
|
|
54
86
|
* ```tsx
|
|
55
|
-
*
|
|
56
|
-
*
|
|
87
|
+
* import { Alert, Button } from 'antd'
|
|
88
|
+
* import { FaasDataWrapper } from '@faasjs/ant-design'
|
|
89
|
+
*
|
|
90
|
+
* type User = {
|
|
91
|
+
* name: string
|
|
92
|
+
* }
|
|
93
|
+
*
|
|
94
|
+
* function UserView(props: {
|
|
95
|
+
* data?: User
|
|
96
|
+
* error?: Error
|
|
97
|
+
* reload?: () => void
|
|
98
|
+
* }) {
|
|
99
|
+
* if (props.error) {
|
|
100
|
+
* return (
|
|
101
|
+
* <Alert
|
|
102
|
+
* type="error"
|
|
103
|
+
* message={props.error.message}
|
|
104
|
+
* action={
|
|
105
|
+
* <Button size="small" onClick={() => props.reload?.()}>
|
|
106
|
+
* Retry
|
|
107
|
+
* </Button>
|
|
108
|
+
* }
|
|
109
|
+
* />
|
|
110
|
+
* )
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* return <div>Hello, {props.data?.name}</div>
|
|
57
114
|
* }
|
|
58
115
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
116
|
+
* // Render-prop mode
|
|
117
|
+
* export function UserProfile(props: { id: number }) {
|
|
118
|
+
* return (
|
|
119
|
+
* <FaasDataWrapper<User>
|
|
120
|
+
* action="user/get"
|
|
121
|
+
* params={{ id: props.id }}
|
|
122
|
+
* loading={<div>Loading user...</div>}
|
|
123
|
+
* render={({ data, error, reload }) => {
|
|
124
|
+
* if (error) {
|
|
125
|
+
* return (
|
|
126
|
+
* <Alert
|
|
127
|
+
* type="error"
|
|
128
|
+
* message={error.message}
|
|
129
|
+
* action={
|
|
130
|
+
* <Button size="small" onClick={() => reload()}>
|
|
131
|
+
* Retry
|
|
132
|
+
* </Button>
|
|
133
|
+
* }
|
|
134
|
+
* />
|
|
135
|
+
* )
|
|
136
|
+
* }
|
|
137
|
+
*
|
|
138
|
+
* return <div>Hello, {data.name}</div>
|
|
139
|
+
* }}
|
|
140
|
+
* />
|
|
141
|
+
* )
|
|
142
|
+
* }
|
|
143
|
+
*
|
|
144
|
+
* // Children injection mode
|
|
145
|
+
* export function UserProfileWithChildren(props: { id: number }) {
|
|
146
|
+
* return (
|
|
147
|
+
* <FaasDataWrapper<User>
|
|
148
|
+
* action="user/get"
|
|
149
|
+
* params={{ id: props.id }}
|
|
150
|
+
* loading={<div>Loading user...</div>}
|
|
151
|
+
* >
|
|
152
|
+
* <UserView />
|
|
153
|
+
* </FaasDataWrapper>
|
|
154
|
+
* )
|
|
63
155
|
* }
|
|
64
156
|
* ```
|
|
65
157
|
*/
|
|
66
|
-
declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
158
|
+
declare function FaasDataWrapper<T extends FaasActionPaths = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
67
159
|
/**
|
|
68
|
-
*
|
|
160
|
+
* Wrap a component with {@link FaasDataWrapper} and its Ant Design loading fallback.
|
|
161
|
+
*
|
|
162
|
+
* @template Path - Action path or response data type used for inference.
|
|
163
|
+
* @template TComponentProps - Component props including injected Faas data fields.
|
|
164
|
+
* @param {React.FC<TComponentProps & Record<string, any>>} Component - Component that consumes injected Faas data props.
|
|
165
|
+
* @param {FaasDataWrapperProps<Path>} faasProps - Request configuration forwarded to {@link FaasDataWrapper}.
|
|
166
|
+
* @returns Higher-order component that injects Faas data props.
|
|
69
167
|
*
|
|
70
168
|
* @example
|
|
71
169
|
* ```tsx
|
|
72
|
-
*
|
|
170
|
+
* import { withFaasData } from '@faasjs/ant-design'
|
|
171
|
+
*
|
|
172
|
+
* const UserCard = withFaasData(
|
|
173
|
+
* ({ data, error, reload }) =>
|
|
174
|
+
* error ? (
|
|
175
|
+
* <a onClick={() => reload()}>Retry</a>
|
|
176
|
+
* ) : (
|
|
177
|
+
* <div>{data.name}</div>
|
|
178
|
+
* ),
|
|
179
|
+
* { action: 'user/get', params: { id: 1 } },
|
|
180
|
+
* )
|
|
73
181
|
* ```
|
|
74
182
|
*/
|
|
75
|
-
declare function withFaasData<
|
|
76
|
-
|
|
183
|
+
declare function withFaasData<Path extends FaasActionPaths, TComponentProps extends Required<FaasDataInjection$1<Path>> = Required<FaasDataInjection$1<Path>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<Path>): React.FC<Omit<TComponentProps, keyof FaasDataInjection$1<Path>>>;
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/Config/index.d.ts
|
|
186
|
+
/**
|
|
187
|
+
* Fully resolved theme object consumed by `@faasjs/ant-design` components.
|
|
188
|
+
*/
|
|
189
|
+
type ResolvedTheme = {
|
|
190
|
+
/** Current language code used for built-in copy. */lang: string; /** Shared copy used by multiple components. */
|
|
191
|
+
common: {
|
|
192
|
+
blank: string;
|
|
193
|
+
all: string;
|
|
194
|
+
submit: string;
|
|
195
|
+
pageNotFound: string;
|
|
196
|
+
add: string;
|
|
197
|
+
delete: string;
|
|
198
|
+
required: string;
|
|
199
|
+
search: string;
|
|
200
|
+
reset: string;
|
|
201
|
+
}; /** Theme values consumed by the `Blank` component. */
|
|
202
|
+
Blank: {
|
|
203
|
+
text: string;
|
|
204
|
+
}; /** Theme values consumed by the `Form` component. */
|
|
205
|
+
Form: {
|
|
206
|
+
submit: {
|
|
207
|
+
text: string;
|
|
208
|
+
};
|
|
209
|
+
}; /** Theme values consumed by the `Title` component. */
|
|
210
|
+
Title: {
|
|
211
|
+
separator: string;
|
|
212
|
+
suffix: string;
|
|
213
|
+
}; /** Theme values consumed by the `Link` component. */
|
|
214
|
+
Link: {
|
|
215
|
+
target?: string;
|
|
216
|
+
style: CSSProperties;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
type ConfigContextValue = {
|
|
220
|
+
theme: ResolvedTheme;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Props for the `@faasjs/ant-design` {@link ConfigProvider}.
|
|
224
|
+
*/
|
|
77
225
|
interface ConfigProviderProps {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
226
|
+
/** Optional FaasJS client options used to initialize {@link FaasReactClient}. */
|
|
227
|
+
faasClientOptions?: FaasReactClientOptions;
|
|
228
|
+
/** Descendant components that consume the resolved config context. */
|
|
229
|
+
children: React.ReactNode;
|
|
230
|
+
/** Theme overrides merged with the built-in defaults. */
|
|
231
|
+
theme?: {
|
|
232
|
+
/** Language code used to select localized defaults. */lang?: string; /** Common shared copy and labels used across components. */
|
|
233
|
+
common?: {
|
|
234
|
+
blank?: string;
|
|
235
|
+
all?: string;
|
|
236
|
+
submit?: string;
|
|
237
|
+
pageNotFound?: string;
|
|
238
|
+
add?: string;
|
|
239
|
+
delete?: string;
|
|
240
|
+
required?: string;
|
|
241
|
+
search?: string;
|
|
242
|
+
reset?: string;
|
|
243
|
+
}; /** Blank-component theme overrides. */
|
|
244
|
+
Blank?: {
|
|
245
|
+
text?: string;
|
|
246
|
+
}; /** Form-component theme overrides. */
|
|
247
|
+
Form?: {
|
|
248
|
+
submit?: {
|
|
249
|
+
text?: string;
|
|
250
|
+
};
|
|
251
|
+
}; /** Title-component theme overrides. */
|
|
252
|
+
Title?: {
|
|
253
|
+
/**
|
|
254
|
+
* Separator inserted between title segments.
|
|
255
|
+
*
|
|
256
|
+
* @default ' - '
|
|
257
|
+
*/
|
|
258
|
+
separator?: string; /** Suffix appended to generated page titles. */
|
|
259
|
+
suffix?: string;
|
|
260
|
+
}; /** Link-component theme overrides. */
|
|
261
|
+
Link?: {
|
|
262
|
+
/**
|
|
263
|
+
* Default target used by the `Link` component when `props.target` is omitted.
|
|
264
|
+
*
|
|
265
|
+
* @default '_blank'
|
|
266
|
+
*/
|
|
267
|
+
target?: string; /** Default inline styles merged into every `Link`. */
|
|
268
|
+
style?: CSSProperties;
|
|
111
269
|
};
|
|
270
|
+
};
|
|
112
271
|
}
|
|
113
|
-
declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
|
|
114
272
|
/**
|
|
115
|
-
*
|
|
273
|
+
* Low-level React context that stores the resolved theme from {@link ConfigProvider}.
|
|
274
|
+
*
|
|
275
|
+
* Most app code should call {@link useConfigContext} instead of reading this context directly.
|
|
116
276
|
*
|
|
117
277
|
* @example
|
|
118
278
|
* ```tsx
|
|
119
|
-
* import { ConfigProvider } from '@faasjs/ant-design'
|
|
279
|
+
* import { ConfigContext, ConfigProvider } from '@faasjs/ant-design'
|
|
280
|
+
* import { useContext } from 'react'
|
|
120
281
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
282
|
+
* function OrdersHeader() {
|
|
283
|
+
* const { theme } = useContext(ConfigContext)
|
|
284
|
+
*
|
|
285
|
+
* return <h1>{`Orders - ${theme.Title.suffix}`}</h1>
|
|
286
|
+
* }
|
|
287
|
+
*
|
|
288
|
+
* export function OrdersPage() {
|
|
289
|
+
* return (
|
|
290
|
+
* <ConfigProvider
|
|
291
|
+
* theme={{
|
|
292
|
+
* common: { blank: 'No orders yet' },
|
|
293
|
+
* Title: { suffix: 'Acme Admin' },
|
|
294
|
+
* }}
|
|
295
|
+
* >
|
|
296
|
+
* <OrdersHeader />
|
|
297
|
+
* </ConfigProvider>
|
|
298
|
+
* )
|
|
299
|
+
* }
|
|
124
300
|
* ```
|
|
125
301
|
*/
|
|
126
|
-
declare
|
|
127
|
-
declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
128
|
-
|
|
129
|
-
interface DrawerProps extends DrawerProps$1 {
|
|
130
|
-
children?: JSX.Element | JSX.Element[];
|
|
131
|
-
}
|
|
132
|
-
type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
|
|
302
|
+
declare const ConfigContext: _$react.Context<ConfigContextValue>;
|
|
133
303
|
/**
|
|
134
|
-
*
|
|
304
|
+
* Provide theme overrides and optional FaasJS client initialization for descendants.
|
|
305
|
+
*
|
|
306
|
+
* Theme overrides are merged with the built-in defaults. When `theme.lang` is omitted, the
|
|
307
|
+
* provider infers a default language from `navigator.language`.
|
|
135
308
|
*
|
|
309
|
+
* @param {ConfigProviderProps} props - Theme overrides and optional FaasJS client configuration.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
136
312
|
* ```tsx
|
|
137
|
-
*
|
|
138
|
-
* const { drawer, setDrawerProps } = useDrawer()
|
|
313
|
+
* import { Blank, ConfigProvider } from '@faasjs/ant-design'
|
|
139
314
|
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
315
|
+
* function OrdersEmptyState() {
|
|
316
|
+
* return <Blank />
|
|
317
|
+
* }
|
|
318
|
+
*
|
|
319
|
+
* export function OrdersPage() {
|
|
320
|
+
* return (
|
|
321
|
+
* <ConfigProvider
|
|
322
|
+
* theme={{
|
|
323
|
+
* common: { blank: 'No orders yet' },
|
|
324
|
+
* Title: { suffix: 'Acme Admin' },
|
|
325
|
+
* }}
|
|
326
|
+
* >
|
|
327
|
+
* <OrdersEmptyState />
|
|
328
|
+
* </ConfigProvider>
|
|
329
|
+
* )
|
|
146
330
|
* }
|
|
147
331
|
* ```
|
|
148
332
|
*/
|
|
149
|
-
declare function
|
|
150
|
-
drawer: react_jsx_runtime.JSX.Element;
|
|
151
|
-
drawerProps: DrawerProps;
|
|
152
|
-
setDrawerProps: setDrawerProps;
|
|
153
|
-
};
|
|
154
|
-
|
|
333
|
+
declare function ConfigProvider(props: ConfigProviderProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
155
334
|
/**
|
|
156
|
-
*
|
|
335
|
+
* Read the current `@faasjs/ant-design` config context.
|
|
336
|
+
*
|
|
337
|
+
* @returns Current config context value containing the resolved theme.
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```tsx
|
|
341
|
+
* import { ConfigProvider, useConfigContext } from '@faasjs/ant-design'
|
|
342
|
+
*
|
|
343
|
+
* function OrdersSummary() {
|
|
344
|
+
* const { theme } = useConfigContext()
|
|
345
|
+
*
|
|
346
|
+
* return (
|
|
347
|
+
* <>
|
|
348
|
+
* <h1>{`Orders - ${theme.Title.suffix}`}</h1>
|
|
349
|
+
* <p>{theme.common.blank}</p>
|
|
350
|
+
* </>
|
|
351
|
+
* )
|
|
352
|
+
* }
|
|
353
|
+
*
|
|
354
|
+
* export function OrdersPage() {
|
|
355
|
+
* return (
|
|
356
|
+
* <ConfigProvider
|
|
357
|
+
* theme={{
|
|
358
|
+
* common: { blank: 'No orders yet' },
|
|
359
|
+
* Title: { suffix: 'Acme Admin' },
|
|
360
|
+
* }}
|
|
361
|
+
* >
|
|
362
|
+
* <OrdersSummary />
|
|
363
|
+
* </ConfigProvider>
|
|
364
|
+
* )
|
|
365
|
+
* }
|
|
366
|
+
* ```
|
|
157
367
|
*/
|
|
158
|
-
declare function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
children?: JSX.Element | JSX.Element[] | string;
|
|
162
|
-
}
|
|
163
|
-
type setModalProps = Dispatch<SetStateAction<ModalProps>>;
|
|
368
|
+
declare function useConfigContext(): ConfigContextValue;
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/ErrorBoundary/index.d.ts
|
|
164
371
|
/**
|
|
165
|
-
*
|
|
372
|
+
* Styled error boundary.
|
|
166
373
|
*
|
|
374
|
+
* When `errorChildren` is not provided, the fallback UI renders an Ant Design `Alert` containing
|
|
375
|
+
* the captured error message and description.
|
|
376
|
+
*
|
|
377
|
+
* @param {ErrorBoundaryProps} props - Error boundary props forwarded to the underlying React implementation.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
167
380
|
* ```tsx
|
|
168
|
-
*
|
|
169
|
-
* const { modal, setModalProps } = useModal()
|
|
381
|
+
* import { ErrorBoundary } from '@faasjs/ant-design'
|
|
170
382
|
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
383
|
+
* export function Page() {
|
|
384
|
+
* return (
|
|
385
|
+
* <ErrorBoundary>
|
|
386
|
+
* <DangerousWidget />
|
|
387
|
+
* </ErrorBoundary>
|
|
388
|
+
* )
|
|
175
389
|
* }
|
|
176
390
|
* ```
|
|
177
391
|
*/
|
|
178
|
-
declare function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
392
|
+
declare function ErrorBoundary(props: ErrorBoundaryProps): _$react_jsx_runtime0.JSX.Element;
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/App/index.d.ts
|
|
395
|
+
/**
|
|
396
|
+
* Props for the root {@link App} shell.
|
|
397
|
+
*
|
|
398
|
+
* `App` composes the Ant Design provider tree, FaasJS config provider, shared modal and drawer
|
|
399
|
+
* state, and optional browser routing into a single wrapper component.
|
|
400
|
+
*/
|
|
184
401
|
interface AppProps {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
402
|
+
/** Descendant elements rendered inside all configured providers. */
|
|
403
|
+
children: React.ReactNode;
|
|
404
|
+
/**
|
|
405
|
+
* Props forwarded to Ant Design's `ConfigProvider`.
|
|
406
|
+
*
|
|
407
|
+
* @see [Ant Design ConfigProvider API](https://ant.design/components/config-provider/#API)
|
|
408
|
+
*/
|
|
409
|
+
configProviderProps?: ConfigProviderProps$1;
|
|
410
|
+
/**
|
|
411
|
+
* Props forwarded to React Router's `BrowserRouter`, or `false` to disable browser routing.
|
|
412
|
+
*
|
|
413
|
+
* Routing is enabled automatically when running in a browser and this prop is not `false`.
|
|
414
|
+
*
|
|
415
|
+
* @see [React Router BrowserRouterProps](https://api.reactrouter.com/v7/interfaces/react_router.BrowserRouterProps.html)
|
|
416
|
+
*/
|
|
417
|
+
browserRouterProps?: BrowserRouterProps | false;
|
|
418
|
+
/**
|
|
419
|
+
* Props forwarded to {@link ErrorBoundary}.
|
|
420
|
+
*
|
|
421
|
+
* @see [FaasJS Ant Design ErrorBoundary docs](https://faasjs.com/doc/ant-design/#errorboundary)
|
|
422
|
+
*/
|
|
423
|
+
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
424
|
+
/**
|
|
425
|
+
* Props forwarded to {@link ConfigProvider}, or `false` to skip the FaasJS config layer.
|
|
426
|
+
*
|
|
427
|
+
* @see [FaasJS Ant Design ConfigProvider docs](https://faasjs.com/doc/ant-design/#configprovider)
|
|
428
|
+
*/
|
|
429
|
+
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
|
|
208
430
|
}
|
|
431
|
+
declare function createOnErrorHandler(messageApi: {
|
|
432
|
+
error: (message: string) => void;
|
|
433
|
+
}): (action: string) => (res: any) => Promise<void>;
|
|
209
434
|
/**
|
|
210
|
-
*
|
|
435
|
+
* Render the root provider shell for a FaasJS Ant Design application.
|
|
211
436
|
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* -
|
|
437
|
+
* `App` initializes Ant Design message and notification APIs, exposes hook-managed modal and
|
|
438
|
+
* drawer state through {@link AppContext}, wraps descendants with {@link ErrorBoundary}, and
|
|
439
|
+
* optionally mounts React Router's `BrowserRouter`.
|
|
440
|
+
*
|
|
441
|
+
* @param {AppProps} props - App shell props including providers, routing, and error handling options.
|
|
217
442
|
*
|
|
218
443
|
* @example
|
|
219
444
|
* ```tsx
|
|
220
445
|
* import { App } from '@faasjs/ant-design'
|
|
221
446
|
*
|
|
222
|
-
* export default function () {
|
|
447
|
+
* export default function Page() {
|
|
223
448
|
* return (
|
|
224
449
|
* <App
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
450
|
+
* configProviderProps={{}}
|
|
451
|
+
* browserRouterProps={{}}
|
|
452
|
+
* errorBoundaryProps={{}}
|
|
453
|
+
* faasConfigProviderProps={{}}
|
|
229
454
|
* >
|
|
230
455
|
* <div>content</div>
|
|
231
456
|
* </App>
|
|
@@ -233,673 +458,890 @@ interface useAppProps {
|
|
|
233
458
|
* }
|
|
234
459
|
* ```
|
|
235
460
|
*/
|
|
236
|
-
declare function App(props: AppProps):
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
461
|
+
declare function App(props: AppProps): _$react_jsx_runtime0.JSX.Element;
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/Blank/index.d.ts
|
|
240
464
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* ```ts
|
|
244
|
-
* import { useApp } from '@faasjs/ant-design'
|
|
245
|
-
*
|
|
246
|
-
* const { message, notification, setModalProps, setDrawerProps } = useApp()
|
|
247
|
-
* ```
|
|
465
|
+
* Props for the {@link Blank} placeholder component.
|
|
248
466
|
*/
|
|
249
|
-
declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
|
|
250
|
-
|
|
251
467
|
interface BlankProps {
|
|
252
|
-
|
|
253
|
-
|
|
468
|
+
/** Value to render when it is present. */
|
|
469
|
+
value?: any;
|
|
470
|
+
/** Placeholder text shown when `value` is empty. */
|
|
471
|
+
text?: string;
|
|
254
472
|
}
|
|
255
473
|
/**
|
|
256
|
-
*
|
|
474
|
+
* Render a disabled placeholder when a value is empty.
|
|
257
475
|
*
|
|
258
|
-
*
|
|
476
|
+
* Empty values include `undefined`, `null`, empty strings, and empty arrays.
|
|
477
|
+
*
|
|
478
|
+
* @param {BlankProps} [options] - Placeholder text and value to render.
|
|
479
|
+
* @returns Rendered value or the configured placeholder text.
|
|
259
480
|
*
|
|
260
481
|
* @example
|
|
261
482
|
* ```tsx
|
|
262
483
|
* import { Blank } from '@faasjs/ant-design'
|
|
263
484
|
*
|
|
264
|
-
*
|
|
485
|
+
* export function FieldPreview() {
|
|
486
|
+
* return <Blank value={undefined} text="Empty" />
|
|
487
|
+
* }
|
|
265
488
|
* ```
|
|
266
489
|
*/
|
|
267
490
|
declare function Blank(options?: BlankProps): JSX.Element;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
};
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/FormItem/types.d.ts
|
|
493
|
+
type ExtendFormTypeProps<T = any> = BaseExtendTypeProps<T>;
|
|
272
494
|
type ExtendTypes = {
|
|
273
|
-
|
|
495
|
+
[type: string]: ExtendFormTypeProps;
|
|
274
496
|
};
|
|
275
497
|
type InputTypeMap<T> = {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
498
|
+
string: InputProps | SelectProps<T> | RadioProps;
|
|
499
|
+
'string[]': InputProps | SelectProps<T> | RadioProps;
|
|
500
|
+
number: InputNumberProps | SelectProps<T> | RadioProps;
|
|
501
|
+
'number[]': InputNumberProps | SelectProps<T> | RadioProps;
|
|
502
|
+
boolean: SwitchProps;
|
|
503
|
+
date: DatePickerProps;
|
|
504
|
+
time: DatePickerProps;
|
|
505
|
+
object: never;
|
|
506
|
+
'object[]': never;
|
|
285
507
|
};
|
|
286
508
|
interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
/** trigger when any item's value changed */
|
|
304
|
-
if?: (values: Record<string, any>) => boolean;
|
|
509
|
+
type?: FaasItemType;
|
|
510
|
+
input?: InputTypeMap<T>[FaasItemType];
|
|
511
|
+
maxCount?: number;
|
|
512
|
+
object?: FormItemProps[];
|
|
513
|
+
disabled?: boolean;
|
|
514
|
+
required?: boolean;
|
|
515
|
+
col?: number;
|
|
516
|
+
children?: UnionFaasItemElement<T> | null;
|
|
517
|
+
formChildren?: UnionFaasItemElement<T> | null;
|
|
518
|
+
render?: UnionFaasItemRender<T> | null;
|
|
519
|
+
formRender?: UnionFaasItemRender<T> | null;
|
|
520
|
+
rules?: RuleObject[];
|
|
521
|
+
label?: string | false;
|
|
522
|
+
extendTypes?: ExtendTypes;
|
|
523
|
+
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
524
|
+
if?: (values: Record<string, any>) => boolean;
|
|
305
525
|
}
|
|
306
|
-
/**
|
|
307
|
-
* Extend custom form item types.
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* ```ts
|
|
311
|
-
* import type { ExtendFormItemProps, FormProps } from '@faasjs/ant-design'
|
|
312
|
-
*
|
|
313
|
-
* // define custom type
|
|
314
|
-
* interface ExtendTypes extends ExtendFormItemProps {
|
|
315
|
-
* type: 'password'
|
|
316
|
-
* }
|
|
317
|
-
*
|
|
318
|
-
* // extend form
|
|
319
|
-
* function ExtendForm(props: FormProps<any, ExtendTypes>) {
|
|
320
|
-
* return (
|
|
321
|
-
* <Form
|
|
322
|
-
* {...props}
|
|
323
|
-
* extendTypes={{ password: { children: <Input.Password /> } }}
|
|
324
|
-
* />
|
|
325
|
-
* )
|
|
326
|
-
* }
|
|
327
|
-
*
|
|
328
|
-
* // use custom type
|
|
329
|
-
* <ExtendForm
|
|
330
|
-
* items={[
|
|
331
|
-
* {
|
|
332
|
-
* id: 'test',
|
|
333
|
-
* type: 'password',
|
|
334
|
-
* },
|
|
335
|
-
* ]}
|
|
336
|
-
* />
|
|
337
|
-
* ```
|
|
338
|
-
*/
|
|
339
526
|
interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
|
|
340
|
-
|
|
527
|
+
type?: string;
|
|
341
528
|
}
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/Table/types.d.ts
|
|
342
531
|
/**
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
346
|
-
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
347
|
-
*
|
|
348
|
-
* @example
|
|
349
|
-
* ```tsx
|
|
350
|
-
* // use inline type
|
|
351
|
-
* <FormItem type='string' id='name' />
|
|
532
|
+
* Column definition used by the FaasJS Ant Design {@link Table} component.
|
|
352
533
|
*
|
|
353
|
-
*
|
|
354
|
-
* <FormItem id='password'>
|
|
355
|
-
* <Input.Password />
|
|
356
|
-
* </>
|
|
357
|
-
* ```
|
|
534
|
+
* @template T - Row record type rendered by the table.
|
|
358
535
|
*/
|
|
359
|
-
declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
|
|
360
|
-
declare namespace FormItem {
|
|
361
|
-
var useStatus: () => {
|
|
362
|
-
status?: antd_es_form_FormItem.ValidateStatus;
|
|
363
|
-
errors: React.ReactNode[];
|
|
364
|
-
warnings: React.ReactNode[];
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
|
|
368
536
|
interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
537
|
+
/** Use built-in option inference for filters when supported. */
|
|
538
|
+
optionsType?: 'auto';
|
|
539
|
+
/** Generic custom element rendered when no table-specific child overrides it. */
|
|
540
|
+
children?: UnionFaasItemElement<T> | null;
|
|
541
|
+
/** Table-specific custom element. */
|
|
542
|
+
tableChildren?: UnionFaasItemElement<T> | null;
|
|
543
|
+
/** Generic custom render callback. */
|
|
544
|
+
render?: UnionFaasItemRender<T> | null;
|
|
545
|
+
/** Table-specific custom render callback. */
|
|
546
|
+
tableRender?: UnionFaasItemRender<T> | null;
|
|
547
|
+
/** Nested item definitions used by `object` and `object[]` item types. */
|
|
548
|
+
object?: TableItemProps<T>[];
|
|
375
549
|
}
|
|
376
|
-
type ExtendTableTypeProps<T = any> =
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
550
|
+
type ExtendTableTypeProps<T = any> = BaseExtendTypeProps<T>;
|
|
551
|
+
/**
|
|
552
|
+
* Shared fields for extending table item unions.
|
|
553
|
+
*
|
|
554
|
+
* @template T - Row record type rendered by the table.
|
|
555
|
+
*/
|
|
380
556
|
type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
|
|
557
|
+
/**
|
|
558
|
+
* Props for the FaasJS Ant Design {@link Table} component.
|
|
559
|
+
*
|
|
560
|
+
* @template T - Row record type rendered by the table.
|
|
561
|
+
* @template ExtendTypes - Additional item prop shape accepted by `items`.
|
|
562
|
+
*/
|
|
381
563
|
type TableProps<T = any, ExtendTypes = any> = {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
564
|
+
/** Column definitions rendered by the table. */items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[]; /** Custom type renderers keyed by item type. */
|
|
565
|
+
extendTypes?: {
|
|
566
|
+
[key: string]: ExtendTableTypeProps;
|
|
567
|
+
}; /** Request config used to fetch table data before rendering. */
|
|
568
|
+
faasData?: FaasDataWrapperProps<any>; /** Change handler that can return rewritten pagination, filter, and sorter state. */
|
|
569
|
+
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
|
|
570
|
+
pagination: TablePaginationConfig;
|
|
571
|
+
filters: Record<string, FilterValue | null>;
|
|
572
|
+
sorter: SorterResult<T> | SorterResult<T>[];
|
|
573
|
+
extra: TableCurrentDataSource<T>;
|
|
574
|
+
};
|
|
393
575
|
} & TableProps$1<T>;
|
|
576
|
+
/**
|
|
577
|
+
* Query params shape expected by table-backed FaasJS endpoints.
|
|
578
|
+
*/
|
|
394
579
|
type TableFaasDataParams = {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
};
|
|
408
|
-
type TableFaasDataResponse<T = any> = {
|
|
409
|
-
rows: T[];
|
|
410
|
-
pagination: {
|
|
411
|
-
current: number;
|
|
412
|
-
pageSize: number;
|
|
413
|
-
total: number;
|
|
414
|
-
};
|
|
580
|
+
/** Active filter values keyed by column field. */filters?: Record<string, any[]>; /** Pagination state sent to the endpoint. */
|
|
581
|
+
pagination?: {
|
|
582
|
+
/** Current page number. */current?: number; /** Requested page size. */
|
|
583
|
+
pageSize?: number;
|
|
584
|
+
}; /** Sorter state sent to the endpoint. */
|
|
585
|
+
sorter?: {
|
|
586
|
+
/** Column field being sorted. */field: string; /** Sort direction. */
|
|
587
|
+
order: 'ascend' | 'descend';
|
|
588
|
+
} | {
|
|
589
|
+
/** Column field being sorted. */field: string; /** Sort direction when active. */
|
|
590
|
+
order?: 'ascend' | 'descend';
|
|
591
|
+
}[];
|
|
415
592
|
};
|
|
416
593
|
/**
|
|
417
|
-
*
|
|
594
|
+
* Paginated response shape expected by {@link Table} when using `faasData`.
|
|
418
595
|
*
|
|
419
|
-
* -
|
|
420
|
-
* - Support FaasJS injection.
|
|
421
|
-
* - Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
422
|
-
* - Auto generate sorter (disable with `sorter: false`).
|
|
596
|
+
* @template T - Row record type contained in `rows`.
|
|
423
597
|
*/
|
|
424
|
-
|
|
425
|
-
|
|
598
|
+
type TableFaasDataResponse<T = any> = {
|
|
599
|
+
/** Rows rendered by the table. */rows: T[]; /** Pagination state returned by the endpoint. */
|
|
600
|
+
pagination: {
|
|
601
|
+
/** Current page number. */current: number; /** Page size used for the result set. */
|
|
602
|
+
pageSize: number; /** Total number of available rows. */
|
|
603
|
+
total: number;
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region src/data/types.d.ts
|
|
426
608
|
type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
|
|
427
|
-
/** FaasItemType's value type */
|
|
428
609
|
type FaasItemTypeValue = {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
610
|
+
string: string;
|
|
611
|
+
'string[]': string[];
|
|
612
|
+
number: number;
|
|
613
|
+
'number[]': number[];
|
|
614
|
+
boolean: boolean;
|
|
615
|
+
date: Dayjs;
|
|
616
|
+
time: Dayjs;
|
|
617
|
+
object: any;
|
|
618
|
+
'object[]': any[];
|
|
438
619
|
};
|
|
439
620
|
type BaseOption = string | number | {
|
|
440
|
-
|
|
441
|
-
|
|
621
|
+
label: string;
|
|
622
|
+
value?: any;
|
|
442
623
|
};
|
|
443
624
|
interface BaseItemProps {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
625
|
+
id: string | number;
|
|
626
|
+
title?: string;
|
|
627
|
+
options?: BaseOption[];
|
|
447
628
|
}
|
|
448
629
|
interface FaasItemProps extends BaseItemProps {
|
|
449
|
-
|
|
450
|
-
* Support string, string[], number, number[], boolean, date, time, object, object[]
|
|
451
|
-
* @default 'string'
|
|
452
|
-
*/
|
|
453
|
-
type?: FaasItemType;
|
|
630
|
+
type?: FaasItemType;
|
|
454
631
|
}
|
|
632
|
+
type UnionScene = 'form' | 'description' | 'table';
|
|
633
|
+
type UnionFaasItemInjection<Value = any, Values = any> = {
|
|
634
|
+
scene?: UnionScene;
|
|
635
|
+
value?: Value;
|
|
636
|
+
values?: Values;
|
|
637
|
+
index?: number;
|
|
638
|
+
};
|
|
639
|
+
type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => React.ReactNode;
|
|
640
|
+
type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | FC<UnionFaasItemInjection<Value, Values>>;
|
|
641
|
+
interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
|
|
642
|
+
children?: UnionFaasItemElement<Value, Values> | null;
|
|
643
|
+
render?: UnionFaasItemRender<Value, Values> | null;
|
|
644
|
+
object?: UnionFaasItemProps<Value, Values>[];
|
|
645
|
+
}
|
|
646
|
+
type BaseExtendTypeProps<T = any> = {
|
|
647
|
+
children?: UnionFaasItemElement<T>;
|
|
648
|
+
render?: UnionFaasItemRender<T>;
|
|
649
|
+
};
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region src/Description/types.d.ts
|
|
652
|
+
type ExtendDescriptionTypeProps<T = any> = BaseExtendTypeProps<T>;
|
|
653
|
+
type ExtendDescriptionItemProps = BaseItemProps;
|
|
654
|
+
interface DescriptionItemProps<T = any> extends FaasItemProps {
|
|
655
|
+
children?: UnionFaasItemElement<T> | null;
|
|
656
|
+
descriptionChildren?: UnionFaasItemElement<T> | null;
|
|
657
|
+
render?: UnionFaasItemRender<T> | null;
|
|
658
|
+
descriptionRender?: UnionFaasItemRender<T> | null;
|
|
659
|
+
if?: (values: Record<string, any>) => boolean;
|
|
660
|
+
object?: DescriptionItemProps<T>[];
|
|
661
|
+
}
|
|
662
|
+
interface DescriptionCommonProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
|
|
663
|
+
renderTitle?(this: void, values: T): ReactNode;
|
|
664
|
+
items: (DescriptionItemProps | ExtendItemProps)[];
|
|
665
|
+
extendTypes?: {
|
|
666
|
+
[key: string]: ExtendDescriptionTypeProps;
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
interface DescriptionWithoutFaasProps<T = any, ExtendItemProps = any> extends DescriptionCommonProps<T, ExtendItemProps> {
|
|
670
|
+
dataSource?: T;
|
|
671
|
+
faasData?: never;
|
|
672
|
+
}
|
|
673
|
+
interface DescriptionWithFaasProps<Path extends FaasActionPaths = any, T = any, ExtendItemProps = any> extends DescriptionCommonProps<T, ExtendItemProps> {
|
|
674
|
+
dataSource?: never;
|
|
675
|
+
faasData?: FaasDataWrapperProps<Path>;
|
|
676
|
+
}
|
|
677
|
+
type DescriptionProps<T = any, ExtendItemProps = any> = DescriptionWithoutFaasProps<T, ExtendItemProps> | DescriptionWithFaasProps<any, T, ExtendItemProps>;
|
|
678
|
+
interface DescriptionItemContentProps<T = any> {
|
|
679
|
+
item: DescriptionItemProps;
|
|
680
|
+
value: T;
|
|
681
|
+
values?: any;
|
|
682
|
+
extendTypes?: {
|
|
683
|
+
[key: string]: ExtendDescriptionTypeProps;
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/Description/index.d.ts
|
|
455
688
|
/**
|
|
456
|
-
*
|
|
689
|
+
* Render an Ant Design description list from a local data source.
|
|
457
690
|
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
691
|
+
* The component applies FaasJS item type normalization helpers to render item metadata with
|
|
692
|
+
* appropriate display formatting.
|
|
460
693
|
*
|
|
461
|
-
* @
|
|
462
|
-
* @
|
|
694
|
+
* @template T - Data record shape rendered by the component.
|
|
695
|
+
* @param {DescriptionWithoutFaasProps<T>} props - Description props including items and a local data source.
|
|
463
696
|
*
|
|
464
697
|
* @example
|
|
465
|
-
* ```
|
|
466
|
-
*
|
|
698
|
+
* ```tsx
|
|
699
|
+
* import { Description } from '@faasjs/ant-design'
|
|
700
|
+
*
|
|
701
|
+
* export function Detail() {
|
|
702
|
+
* return (
|
|
703
|
+
* <Description
|
|
704
|
+
* title="Title"
|
|
705
|
+
* items={[
|
|
706
|
+
* { id: 'id', title: 'Title', type: 'string' },
|
|
707
|
+
* ]}
|
|
708
|
+
* dataSource={{ id: 'value' }}
|
|
709
|
+
* />
|
|
710
|
+
* )
|
|
711
|
+
* }
|
|
467
712
|
* ```
|
|
468
713
|
*/
|
|
469
|
-
declare function
|
|
470
|
-
/**
|
|
471
|
-
* convert string[] or number[] to { label, value }[]
|
|
472
|
-
*/
|
|
473
|
-
declare function transferOptions(options: BaseOption[]): {
|
|
474
|
-
label: string;
|
|
475
|
-
value?: string | number;
|
|
476
|
-
}[];
|
|
477
|
-
declare function transferValue(type: FaasItemType, value: any): any;
|
|
478
|
-
type UnionScene = 'form' | 'description' | 'table';
|
|
479
|
-
type UnionFaasItemInjection<Value = any, Values = any> = {
|
|
480
|
-
scene?: UnionScene;
|
|
481
|
-
value?: Value;
|
|
482
|
-
values?: Values;
|
|
483
|
-
index?: number;
|
|
484
|
-
};
|
|
714
|
+
declare function Description<T extends Record<string, any> = any>(props: DescriptionWithoutFaasProps<T>): JSX.Element;
|
|
485
715
|
/**
|
|
486
|
-
*
|
|
716
|
+
* Render an Ant Design description list with fetched FaasJS data.
|
|
717
|
+
*
|
|
718
|
+
* The component fetches data via `faasData` and applies FaasJS item type normalization helpers
|
|
719
|
+
* to render item metadata with appropriate display formatting.
|
|
720
|
+
*
|
|
721
|
+
* When `Path` is provided, the `action` and `params` in `faasData` are strongly typed from the
|
|
722
|
+
* {@link FaasActions} type augmentation.
|
|
487
723
|
*
|
|
488
|
-
* @
|
|
489
|
-
* @
|
|
490
|
-
* @param
|
|
491
|
-
* @param scene {@link UnionScene} - The scene in which the rendering is taking place.
|
|
724
|
+
* @template Path - Action path type inferred from `faasData.action` for strong typing.
|
|
725
|
+
* @template T - Data record shape rendered by the component.
|
|
726
|
+
* @param {DescriptionWithFaasProps<Path, T>} props - Description props including items and FaasJS data config.
|
|
492
727
|
*
|
|
493
728
|
* @example
|
|
494
729
|
* ```tsx
|
|
495
|
-
* import {
|
|
496
|
-
*
|
|
497
|
-
* const nameReader: UnionFaasItemRender = (value, values, index, scene) => {
|
|
498
|
-
* switch (scene) {
|
|
499
|
-
* case 'form':
|
|
500
|
-
* return <input />
|
|
501
|
-
* case 'description':
|
|
502
|
-
* case 'table':
|
|
503
|
-
* return <span>{value}</span>
|
|
504
|
-
* default:
|
|
505
|
-
* return null
|
|
506
|
-
* }
|
|
507
|
-
* }
|
|
508
|
-
*
|
|
509
|
-
* const items = [
|
|
510
|
-
* {
|
|
511
|
-
* id: 'name',
|
|
512
|
-
* render: nameReader,
|
|
513
|
-
* }
|
|
514
|
-
* ]
|
|
730
|
+
* import { Description } from '@faasjs/ant-design'
|
|
515
731
|
*
|
|
516
|
-
* function
|
|
517
|
-
* return
|
|
518
|
-
* <
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
732
|
+
* export function Detail() {
|
|
733
|
+
* return (
|
|
734
|
+
* <Description
|
|
735
|
+
* title="Title"
|
|
736
|
+
* items={[
|
|
737
|
+
* { id: 'id', title: 'Title', type: 'string' },
|
|
738
|
+
* ]}
|
|
739
|
+
* faasData={{
|
|
740
|
+
* action: 'user/get',
|
|
741
|
+
* params: { id: 1 },
|
|
742
|
+
* }}
|
|
743
|
+
* />
|
|
744
|
+
* )
|
|
522
745
|
* }
|
|
523
746
|
* ```
|
|
524
747
|
*/
|
|
525
|
-
|
|
748
|
+
declare function Description<Path extends FaasActionPaths, T extends Record<string, any> = any>(props: DescriptionWithFaasProps<Path, T>): JSX.Element;
|
|
526
749
|
/**
|
|
527
|
-
*
|
|
750
|
+
* Render an Ant Design description list (catch-all overload for backward compatibility).
|
|
751
|
+
*/
|
|
752
|
+
declare function Description<T extends Record<string, any> = any>(props: DescriptionProps<T>): JSX.Element;
|
|
753
|
+
declare namespace Description {
|
|
754
|
+
var displayName: string;
|
|
755
|
+
}
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/Drawer/index.d.ts
|
|
758
|
+
/**
|
|
759
|
+
* Props accepted by the hook-managed drawer wrapper.
|
|
760
|
+
*/
|
|
761
|
+
interface DrawerProps extends DrawerProps$1 {
|
|
762
|
+
/** Drawer body content managed by {@link useDrawer}. */
|
|
763
|
+
children?: JSX.Element | JSX.Element[];
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* State setter used to update hook-managed drawer props.
|
|
767
|
+
*/
|
|
768
|
+
type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
|
|
769
|
+
/**
|
|
770
|
+
* Create a hook-managed Ant Design drawer instance.
|
|
771
|
+
*
|
|
772
|
+
* The returned setter merges partial updates into the current drawer props instead of replacing the
|
|
773
|
+
* entire state object.
|
|
528
774
|
*
|
|
529
|
-
*
|
|
775
|
+
* @param {DrawerProps} [init] - Initial drawer props.
|
|
776
|
+
* @returns Hook-managed drawer element, current props, and a state-merging setter.
|
|
530
777
|
*
|
|
531
778
|
* @example
|
|
532
779
|
* ```tsx
|
|
533
|
-
* import {
|
|
534
|
-
*
|
|
535
|
-
* const NameComponent: UnionFaasItemElement = ({ scene, value }) => {
|
|
536
|
-
* switch (scene) {
|
|
537
|
-
* switch (scene) {
|
|
538
|
-
* case 'form':
|
|
539
|
-
* return <input />
|
|
540
|
-
* case 'description':
|
|
541
|
-
* case 'table':
|
|
542
|
-
* return <span>{value}</span>
|
|
543
|
-
* default:
|
|
544
|
-
* return null
|
|
545
|
-
* }
|
|
546
|
-
* }
|
|
780
|
+
* import { useDrawer } from '@faasjs/ant-design'
|
|
781
|
+
* import { Button } from 'antd'
|
|
547
782
|
*
|
|
548
|
-
*
|
|
549
|
-
* {
|
|
550
|
-
* id: 'name',
|
|
551
|
-
* children: NameComponent // both `NameComponent` and `<NameComponent />` is valid
|
|
552
|
-
* }
|
|
553
|
-
* ]
|
|
783
|
+
* function Example() {
|
|
784
|
+
* const { drawer, setDrawerProps } = useDrawer()
|
|
554
785
|
*
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
786
|
+
* return (
|
|
787
|
+
* <>
|
|
788
|
+
* <Button onClick={() => setDrawerProps({ open: true, title: 'Details', children: <div>Content</div> })}>
|
|
789
|
+
* Open
|
|
790
|
+
* </Button>
|
|
791
|
+
* {drawer}
|
|
792
|
+
* </>
|
|
793
|
+
* )
|
|
561
794
|
* }
|
|
562
795
|
* ```
|
|
563
796
|
*/
|
|
564
|
-
|
|
797
|
+
declare function useDrawer(init?: DrawerProps): {
|
|
798
|
+
drawer: _$react_jsx_runtime0.JSX.Element;
|
|
799
|
+
drawerProps: DrawerProps;
|
|
800
|
+
setDrawerProps: setDrawerProps;
|
|
801
|
+
};
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region src/data/render.d.ts
|
|
804
|
+
declare function renderDisplayValue(type: FaasItemType, value: any, options?: {
|
|
805
|
+
label: string;
|
|
806
|
+
value?: string | number;
|
|
807
|
+
}[]): JSX.Element | string | number | boolean | null;
|
|
808
|
+
//#endregion
|
|
809
|
+
//#region src/data/utils.d.ts
|
|
810
|
+
declare function idToTitle(id: string | number): string;
|
|
811
|
+
declare function transferOptions(options: BaseOption[]): {
|
|
812
|
+
label: string;
|
|
813
|
+
value?: string | number;
|
|
814
|
+
}[];
|
|
815
|
+
declare function transferValue(type: FaasItemType | null | undefined, value: any): any;
|
|
816
|
+
declare function cloneUnionFaasItemElement(element: UnionFaasItemElement, props: any): _$react.ReactElement<UnionFaasItemInjection<any, any>, string | _$react.JSXElementConstructor<any>>;
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region src/FormItem/index.d.ts
|
|
565
819
|
/**
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
* The
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
* - `formChildren` / `descriptionChildren` / `tableChildren` / `formRender` / `descriptionRender` / `tableRender`
|
|
575
|
-
* 2. Returns `null` if `children` or `render` prop is null
|
|
576
|
-
* 2. **Children Rendering**
|
|
577
|
-
* 1. First priority: Component-specific children
|
|
578
|
-
* - `formChildren` for Form
|
|
579
|
-
* - `descriptionChildren` for Description
|
|
580
|
-
* - `tableChildren` for Table
|
|
581
|
-
* 2. Second priority: Generic `children` prop
|
|
582
|
-
* 3. **Custom Render Functions**
|
|
583
|
-
* 1. First priority: Component-specific render functions
|
|
584
|
-
* - `formRender` for Form
|
|
585
|
-
* - `descriptionRender` for Description
|
|
586
|
-
* - `tableRender` for Table
|
|
587
|
-
* 2. Second priority: Generic `render` prop
|
|
588
|
-
* 4. **Extended Types**
|
|
589
|
-
* - Renders based on registered extended type handlers
|
|
590
|
-
* 5. **Default Rendering**
|
|
591
|
-
* - Renders primitive types (string, number, etc.)
|
|
592
|
-
* - Uses default formatting based on data type
|
|
820
|
+
* Render a FaasJS-aware Ant Design form field or nested field group.
|
|
821
|
+
*
|
|
822
|
+
* The component derives default labels from `id`, applies required validation messages from the
|
|
823
|
+
* active theme, supports surface-specific union renderers, and can render nested `object` or
|
|
824
|
+
* `object[]` field structures.
|
|
825
|
+
*
|
|
826
|
+
* @template T - Value type rendered or edited by the form item.
|
|
827
|
+
* @param {FormItemProps<T>} props - Form item props including field metadata, rules, and custom renderers.
|
|
593
828
|
*
|
|
594
829
|
* @example
|
|
595
830
|
* ```tsx
|
|
596
|
-
* import {
|
|
597
|
-
*
|
|
598
|
-
* const item: UnionFaasItemProps[] = [
|
|
599
|
-
* {
|
|
600
|
-
* id: 'id',
|
|
601
|
-
* formChildren: null, // Don't show in form, only in description and table
|
|
602
|
-
* },
|
|
603
|
-
* {
|
|
604
|
-
* id: 'name',
|
|
605
|
-
* required: true, // Required in form
|
|
606
|
-
* },
|
|
607
|
-
* {
|
|
608
|
-
* id: 'age',
|
|
609
|
-
* type: 'number', // Number type in form, description and table
|
|
610
|
-
* options: ['< 18', '>= 18'], // Options in form and table
|
|
611
|
-
* }
|
|
612
|
-
* ]
|
|
831
|
+
* import { FormItem } from '@faasjs/ant-design'
|
|
832
|
+
* import { Input } from 'antd'
|
|
613
833
|
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
*
|
|
617
|
-
*
|
|
834
|
+
* export function AccountFields() {
|
|
835
|
+
* return (
|
|
836
|
+
* <>
|
|
837
|
+
* <FormItem id="name" type="string" />
|
|
838
|
+
* <FormItem id="password">
|
|
839
|
+
* <Input.Password />
|
|
840
|
+
* </FormItem>
|
|
841
|
+
* </>
|
|
842
|
+
* )
|
|
618
843
|
* }
|
|
844
|
+
* ```
|
|
845
|
+
*/
|
|
846
|
+
declare function FormItem<T = any>(props: FormItemProps<T>): _$react_jsx_runtime0.JSX.Element | null;
|
|
847
|
+
declare namespace FormItem {
|
|
848
|
+
var useStatus: () => {
|
|
849
|
+
status?: _$antd_es_form_FormItem0.ValidateStatus;
|
|
850
|
+
errors: React.ReactNode[];
|
|
851
|
+
warnings: React.ReactNode[];
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region src/Form/types.d.ts
|
|
856
|
+
type FormSubmitProps = {
|
|
857
|
+
text?: string;
|
|
858
|
+
buttonProps?: ButtonProps;
|
|
859
|
+
};
|
|
860
|
+
type FormFaasProps<Values extends Record<string, any> = any, Path extends FaasActionPaths = any> = {
|
|
861
|
+
action: Path;
|
|
862
|
+
params?: FaasParams<Path> | ((values: Record<string, any>) => FaasParams<Path>);
|
|
863
|
+
transformValues?: (values: Values) => Record<string, any> | Promise<Record<string, any>>;
|
|
864
|
+
onSuccess?: (result: any, values: Record<string, any>) => void;
|
|
865
|
+
onError?: (error: any, values: Record<string, any>) => void;
|
|
866
|
+
onFinally?: () => void;
|
|
867
|
+
};
|
|
868
|
+
type FormCommonProps<Values extends Record<string, any>, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> & {
|
|
869
|
+
items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
|
|
870
|
+
submit?: false | FormSubmitProps;
|
|
871
|
+
beforeItems?: JSX.Element | JSX.Element[];
|
|
872
|
+
footer?: JSX.Element | JSX.Element[];
|
|
873
|
+
extendTypes?: ExtendTypes;
|
|
874
|
+
children?: ReactNode;
|
|
875
|
+
initialValues?: Partial<Values>;
|
|
876
|
+
};
|
|
877
|
+
type FormWithoutFaasProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormCommonProps<Values, ExtendItemProps> & {
|
|
878
|
+
faas?: never;
|
|
879
|
+
onFinish?: (values: Values) => void | Promise<void>;
|
|
880
|
+
};
|
|
881
|
+
type FormWithFaasProps<Path extends FaasActionPaths = any, Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormCommonProps<Values, ExtendItemProps> & {
|
|
882
|
+
faas?: FormFaasProps<Values, Path>;
|
|
883
|
+
onFinish?: never;
|
|
884
|
+
};
|
|
885
|
+
type FormProps<Values extends Record<string, any> = any, Path extends FaasActionPaths = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> = FormWithoutFaasProps<Values, ExtendItemProps> | FormWithFaasProps<Path, Values, ExtendItemProps>;
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region src/Form/index.d.ts
|
|
888
|
+
/**
|
|
889
|
+
* Render a data-aware Ant Design form without the built-in FaasJS submit handler.
|
|
890
|
+
*
|
|
891
|
+
* The component normalizes `initialValues` with {@link transferValue}, renders item definitions
|
|
892
|
+
* through {@link FormItem}, and delegates submission to the custom `onFinish` handler.
|
|
893
|
+
*
|
|
894
|
+
* @template Values - Form values shape.
|
|
895
|
+
* @param {FormWithoutFaasProps<Values>} props - Form props including items, submit behavior, and a custom `onFinish` handler.
|
|
619
896
|
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```tsx
|
|
899
|
+
* import { Form } from '@faasjs/ant-design'
|
|
900
|
+
*
|
|
901
|
+
* export function ProfileForm() {
|
|
902
|
+
* return (
|
|
903
|
+
* <Form
|
|
904
|
+
* items={[
|
|
905
|
+
* { id: 'name', required: true },
|
|
906
|
+
* { id: 'email', required: true },
|
|
907
|
+
* ]}
|
|
908
|
+
* onFinish={async (values) => {
|
|
909
|
+
* console.log(values)
|
|
910
|
+
* }}
|
|
911
|
+
* />
|
|
912
|
+
* )
|
|
626
913
|
* }
|
|
627
914
|
* ```
|
|
628
915
|
*/
|
|
629
|
-
|
|
630
|
-
children?: UnionFaasItemElement<Value, Values> | null;
|
|
631
|
-
render?: UnionFaasItemRender<Value, Values> | null;
|
|
632
|
-
object?: UnionFaasItemProps<Value, Values>[];
|
|
633
|
-
}
|
|
916
|
+
declare function Form<Values extends Record<string, any> = any>(props: FormWithoutFaasProps<Values>): JSX.Element;
|
|
634
917
|
/**
|
|
635
|
-
*
|
|
918
|
+
* Render a data-aware Ant Design form with the built-in FaasJS submit handler.
|
|
919
|
+
*
|
|
920
|
+
* The component normalizes `initialValues` with {@link transferValue}, renders item definitions
|
|
921
|
+
* through {@link FormItem}, and submits via the built-in FaasJS request flow configured by `faas`.
|
|
636
922
|
*
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
* Otherwise, it creates a new element from the provided element and props.
|
|
923
|
+
* When `Path` is provided, the `action` and `params` in `faas` are strongly typed from the
|
|
924
|
+
* {@link FaasActions} type augmentation.
|
|
640
925
|
*
|
|
641
|
-
* @
|
|
642
|
-
* @
|
|
643
|
-
* @
|
|
926
|
+
* @template Path - Action path type inferred from `faas.action` for strong typing.
|
|
927
|
+
* @template Values - Form values shape.
|
|
928
|
+
* @param {FormWithFaasProps<Path, Values>} props - Form props including items, submit behavior, and FaasJS integration.
|
|
929
|
+
*
|
|
930
|
+
* @example
|
|
931
|
+
* ```tsx
|
|
932
|
+
* import { Form } from '@faasjs/ant-design'
|
|
933
|
+
*
|
|
934
|
+
* export function CreateUserForm() {
|
|
935
|
+
* return (
|
|
936
|
+
* <Form
|
|
937
|
+
* initialValues={{ role: 'user' }}
|
|
938
|
+
* items={[
|
|
939
|
+
* { id: 'name', required: true },
|
|
940
|
+
* { id: 'role', options: ['user', 'admin'] },
|
|
941
|
+
* ]}
|
|
942
|
+
* faas={{
|
|
943
|
+
* action: 'user/create',
|
|
944
|
+
* params: (values) => ({
|
|
945
|
+
* role: values.role || 'user',
|
|
946
|
+
* }),
|
|
947
|
+
* }}
|
|
948
|
+
* />
|
|
949
|
+
* )
|
|
950
|
+
* }
|
|
951
|
+
* ```
|
|
644
952
|
*/
|
|
645
|
-
declare function
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
object?: DescriptionItemProps<T>[];
|
|
659
|
-
}
|
|
660
|
-
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>;
|
|
953
|
+
declare function Form<Path extends FaasActionPaths, Values extends Record<string, any> = any>(props: FormWithFaasProps<Path, Values>): JSX.Element;
|
|
954
|
+
/**
|
|
955
|
+
* Render a data-aware Ant Design form (catch-all overload for backward compatibility).
|
|
956
|
+
*/
|
|
957
|
+
declare function Form<Values extends Record<string, any> = any, Path extends FaasActionPaths = any>(props: FormProps<Values, Path>): JSX.Element;
|
|
958
|
+
declare namespace Form {
|
|
959
|
+
var useForm: typeof _$antd_es_form_Form0.useForm;
|
|
960
|
+
var useFormInstance: typeof _$antd_es_form_hooks_useFormInstance0.default;
|
|
961
|
+
var useWatch: typeof _$_rc_component_form0.useWatch;
|
|
962
|
+
var Item: typeof FormItem;
|
|
963
|
+
var List: _$react.FC<_$antd_es_form0.FormListProps>;
|
|
964
|
+
var ErrorList: _$react.FC<_$antd_es_form0.ErrorListProps>;
|
|
965
|
+
var Provider: _$react.FC<_$antd_es_form_context0.FormProviderProps>;
|
|
668
966
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/Link/index.d.ts
|
|
969
|
+
/**
|
|
970
|
+
* Props for the navigation-aware {@link Link} component.
|
|
971
|
+
*/
|
|
972
|
+
interface LinkProps {
|
|
973
|
+
/** Target URL or route path. */
|
|
974
|
+
href: string;
|
|
975
|
+
/** Explicit link target. Absolute HTTP URLs default to `_blank`. */
|
|
976
|
+
target?: '_blank';
|
|
977
|
+
/** Text rendered when `children` is not provided. */
|
|
978
|
+
text?: string | number;
|
|
979
|
+
/** Custom link content rendered instead of `text`. */
|
|
980
|
+
children?: ReactNode;
|
|
981
|
+
/** Inline styles merged with the theme defaults. */
|
|
982
|
+
style?: CSSProperties;
|
|
983
|
+
/** Button mode config, or `true` to render with default Ant Design button props. */
|
|
984
|
+
button?: ButtonProps | boolean;
|
|
985
|
+
/** Whether the rendered link or button should take the full width. */
|
|
986
|
+
block?: boolean;
|
|
987
|
+
/** Whether plain-text links should enable the Typography copy action. */
|
|
988
|
+
copyable?: boolean;
|
|
989
|
+
/** Custom click handler that overrides the built-in navigation behavior. */
|
|
990
|
+
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
676
991
|
}
|
|
677
992
|
/**
|
|
678
|
-
*
|
|
993
|
+
* Render a navigation-aware link or button.
|
|
679
994
|
*
|
|
680
|
-
*
|
|
995
|
+
* Internal links are pushed through React Router, while links with `_blank` targets are opened
|
|
996
|
+
* with `window.open`.
|
|
997
|
+
*
|
|
998
|
+
* @param {LinkProps} props - Link props controlling navigation target, rendering mode, and button behavior.
|
|
681
999
|
*
|
|
682
1000
|
* @example
|
|
683
1001
|
* ```tsx
|
|
684
|
-
* import {
|
|
1002
|
+
* import { Link } from '@faasjs/ant-design'
|
|
685
1003
|
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
* />
|
|
1004
|
+
* export function Navigation() {
|
|
1005
|
+
* return (
|
|
1006
|
+
* <>
|
|
1007
|
+
* <Link href="/">Home</Link>
|
|
1008
|
+
* <Link href="/users/new" button={{ type: 'primary' }}>
|
|
1009
|
+
* Create User
|
|
1010
|
+
* </Link>
|
|
1011
|
+
* </>
|
|
1012
|
+
* )
|
|
1013
|
+
* }
|
|
697
1014
|
* ```
|
|
698
1015
|
*/
|
|
699
|
-
declare function
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
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
|
-
};
|
|
740
|
-
};
|
|
741
|
-
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>;
|
|
1016
|
+
declare function Link(props: LinkProps): _$react_jsx_runtime0.JSX.Element;
|
|
1017
|
+
//#endregion
|
|
1018
|
+
//#region src/Modal/index.d.ts
|
|
1019
|
+
/**
|
|
1020
|
+
* Props accepted by the hook-managed modal wrapper.
|
|
1021
|
+
*/
|
|
1022
|
+
interface ModalProps extends ModalProps$1 {
|
|
1023
|
+
/** Modal body content managed by {@link useModal}. */
|
|
1024
|
+
children?: JSX.Element | JSX.Element[] | string;
|
|
751
1025
|
}
|
|
752
1026
|
/**
|
|
753
|
-
*
|
|
1027
|
+
* State setter used to update hook-managed modal props.
|
|
1028
|
+
*/
|
|
1029
|
+
type setModalProps = Dispatch<SetStateAction<ModalProps>>;
|
|
1030
|
+
/**
|
|
1031
|
+
* Create a hook-managed Ant Design modal instance.
|
|
1032
|
+
*
|
|
1033
|
+
* The returned setter merges partial updates into the current modal props instead of replacing the
|
|
1034
|
+
* entire state object.
|
|
754
1035
|
*
|
|
755
|
-
*
|
|
1036
|
+
* @param {ModalProps} [init] - Initial modal props.
|
|
1037
|
+
* @returns Hook-managed modal element, current props, and a state-merging setter.
|
|
1038
|
+
*
|
|
1039
|
+
* @example
|
|
1040
|
+
* ```tsx
|
|
1041
|
+
* import { useModal } from '@faasjs/ant-design'
|
|
1042
|
+
* import { Button } from 'antd'
|
|
1043
|
+
*
|
|
1044
|
+
* function Example() {
|
|
1045
|
+
* const { modal, setModalProps } = useModal()
|
|
1046
|
+
*
|
|
1047
|
+
* return (
|
|
1048
|
+
* <>
|
|
1049
|
+
* <Button onClick={() => setModalProps({ open: true, title: 'Delete', children: 'Are you sure?' })}>
|
|
1050
|
+
* Open Modal
|
|
1051
|
+
* </Button>
|
|
1052
|
+
* {modal}
|
|
1053
|
+
* </>
|
|
1054
|
+
* )
|
|
1055
|
+
* }
|
|
1056
|
+
* ```
|
|
756
1057
|
*/
|
|
757
|
-
declare function
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
var ErrorList: react.FC<antd_es_form.ErrorListProps>;
|
|
765
|
-
var Provider: react.FC<antd_es_form_context.FormProviderProps>;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
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;
|
|
779
|
-
}
|
|
1058
|
+
declare function useModal(init?: ModalProps): {
|
|
1059
|
+
modal: _$react_jsx_runtime0.JSX.Element;
|
|
1060
|
+
modalProps: ModalProps;
|
|
1061
|
+
setModalProps: setModalProps;
|
|
1062
|
+
};
|
|
1063
|
+
//#endregion
|
|
1064
|
+
//#region src/Routers/index.d.ts
|
|
780
1065
|
/**
|
|
781
|
-
*
|
|
1066
|
+
* Default 404 route element that uses the configured localized title.
|
|
782
1067
|
*
|
|
783
1068
|
* @example
|
|
784
1069
|
* ```tsx
|
|
785
|
-
*
|
|
786
|
-
* <Link href="/">Home</Link>
|
|
1070
|
+
* import { PageNotFound, Routes } from '@faasjs/ant-design'
|
|
787
1071
|
*
|
|
788
|
-
*
|
|
789
|
-
*
|
|
1072
|
+
* export function AppRoutes() {
|
|
1073
|
+
* return (
|
|
1074
|
+
* <Routes
|
|
1075
|
+
* routes={[{ path: '/', element: <div>Home</div> }]}
|
|
1076
|
+
* notFound={<PageNotFound />}
|
|
1077
|
+
* />
|
|
1078
|
+
* )
|
|
1079
|
+
* }
|
|
790
1080
|
* ```
|
|
791
1081
|
*/
|
|
792
|
-
declare function
|
|
793
|
-
|
|
794
|
-
|
|
1082
|
+
declare function PageNotFound(): _$react_jsx_runtime0.JSX.Element;
|
|
1083
|
+
/**
|
|
1084
|
+
* Props for the lazy-loading {@link Routes} wrapper.
|
|
1085
|
+
*/
|
|
795
1086
|
interface RoutesProps {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
1087
|
+
/** Route records forwarded to React Router, with optional lazy `page` components. */
|
|
1088
|
+
routes: (RouteProps & {
|
|
1089
|
+
page?: LazyExoticComponent<ComponentType<any>>;
|
|
1090
|
+
})[];
|
|
1091
|
+
/** Fallback element rendered while lazy pages are loading. */
|
|
1092
|
+
fallback?: JSX.Element;
|
|
1093
|
+
/** Element rendered for the generated catch-all 404 route. */
|
|
1094
|
+
notFound?: JSX.Element;
|
|
801
1095
|
}
|
|
802
1096
|
/**
|
|
803
|
-
*
|
|
1097
|
+
* Render React Router routes with lazy-page support and a default 404 route.
|
|
1098
|
+
*
|
|
1099
|
+
* The wrapper adds a catch-all route automatically and uses an Ant Design `Skeleton` fallback when
|
|
1100
|
+
* `fallback` is not provided.
|
|
1101
|
+
*
|
|
1102
|
+
* @param {RoutesProps} props - Route definitions and optional fallback or 404 elements.
|
|
804
1103
|
*
|
|
805
1104
|
* @example
|
|
806
1105
|
* ```tsx
|
|
807
1106
|
* import { Routes, lazy } from '@faasjs/ant-design'
|
|
808
1107
|
* import { BrowserRouter } from 'react-router-dom'
|
|
809
1108
|
*
|
|
810
|
-
* export function App
|
|
811
|
-
* return
|
|
812
|
-
* <
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
*
|
|
818
|
-
*
|
|
1109
|
+
* export function App() {
|
|
1110
|
+
* return (
|
|
1111
|
+
* <BrowserRouter>
|
|
1112
|
+
* <Routes
|
|
1113
|
+
* routes={[
|
|
1114
|
+
* {
|
|
1115
|
+
* path: '/',
|
|
1116
|
+
* page: lazy(() => import('./pages/home')),
|
|
1117
|
+
* },
|
|
1118
|
+
* ]}
|
|
1119
|
+
* />
|
|
1120
|
+
* </BrowserRouter>
|
|
1121
|
+
* )
|
|
819
1122
|
* }
|
|
820
1123
|
* ```
|
|
821
1124
|
*/
|
|
822
|
-
declare function Routes(props: RoutesProps):
|
|
823
|
-
|
|
1125
|
+
declare function Routes(props: RoutesProps): _$react_jsx_runtime0.JSX.Element;
|
|
1126
|
+
//#endregion
|
|
1127
|
+
//#region src/Table/table.d.ts
|
|
1128
|
+
/**
|
|
1129
|
+
* Render an Ant Design table from FaasJS item metadata.
|
|
1130
|
+
*
|
|
1131
|
+
* The component can render local `dataSource` rows or resolve remote rows through `faasData`. It
|
|
1132
|
+
* also generates default filters and sorters for built-in item types unless you disable them with
|
|
1133
|
+
* the corresponding Ant Design column props.
|
|
1134
|
+
*
|
|
1135
|
+
* @template T - Row record type rendered by the table.
|
|
1136
|
+
* @template ExtendTypes - Additional item prop shape accepted by `items`.
|
|
1137
|
+
* @param {TableProps<T, ExtendTypes>} props - Table props including columns, data source, and optional Faas data config.
|
|
1138
|
+
* @throws {Error} When an entry in `extendTypes` omits both `children` and `render`.
|
|
1139
|
+
*
|
|
1140
|
+
* @example
|
|
1141
|
+
* ```tsx
|
|
1142
|
+
* import { Table } from '@faasjs/ant-design'
|
|
1143
|
+
*
|
|
1144
|
+
* const rows = [
|
|
1145
|
+
* { id: 1, name: 'Alice', active: true },
|
|
1146
|
+
* { id: 2, name: 'Bob', active: false },
|
|
1147
|
+
* ]
|
|
1148
|
+
*
|
|
1149
|
+
* export function UserTable() {
|
|
1150
|
+
* return (
|
|
1151
|
+
* <Table
|
|
1152
|
+
* rowKey="id"
|
|
1153
|
+
* dataSource={rows}
|
|
1154
|
+
* items={[
|
|
1155
|
+
* { id: 'name', title: 'Name' },
|
|
1156
|
+
* { id: 'active', type: 'boolean', title: 'Active' },
|
|
1157
|
+
* ]}
|
|
1158
|
+
* />
|
|
1159
|
+
* )
|
|
1160
|
+
* }
|
|
1161
|
+
* ```
|
|
1162
|
+
*/
|
|
1163
|
+
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): _$react_jsx_runtime0.JSX.Element;
|
|
1164
|
+
//#endregion
|
|
1165
|
+
//#region src/Tabs/index.d.ts
|
|
1166
|
+
/**
|
|
1167
|
+
* Tab item accepted by the FaasJS Ant Design {@link Tabs} wrapper.
|
|
1168
|
+
*/
|
|
824
1169
|
interface TabProps extends Partial<Tab> {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1170
|
+
/** Stable tab identifier used as the default key and label. */
|
|
1171
|
+
id: string;
|
|
1172
|
+
/** Title used as the default Ant Design tab label. */
|
|
1173
|
+
title?: React.ReactNode;
|
|
1174
|
+
/** Tab panel content. */
|
|
1175
|
+
children: React.ReactNode;
|
|
828
1176
|
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Props for the FaasJS Ant Design {@link Tabs} component.
|
|
1179
|
+
*/
|
|
829
1180
|
interface TabsProps extends Omit<TabsProps$1, 'items'> {
|
|
830
|
-
|
|
831
|
-
|
|
1181
|
+
/** Tab definitions. `null` and `false` entries are skipped automatically. */
|
|
1182
|
+
items: (TabProps | null | false)[];
|
|
832
1183
|
}
|
|
833
1184
|
/**
|
|
834
|
-
*
|
|
1185
|
+
* Render an Ant Design tabs wrapper that accepts FaasJS-style tab definitions.
|
|
835
1186
|
*
|
|
836
|
-
*
|
|
837
|
-
*
|
|
838
|
-
* -
|
|
1187
|
+
* Missing `key` and `label` values are derived from each tab's `id` and `title`.
|
|
1188
|
+
*
|
|
1189
|
+
* @param {TabsProps} props - Tabs props including tab items and Ant Design tab options.
|
|
839
1190
|
*
|
|
840
1191
|
* @example
|
|
841
1192
|
* ```tsx
|
|
842
1193
|
* import { Tabs } from '@faasjs/ant-design'
|
|
843
1194
|
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
*
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
1195
|
+
* export function Page() {
|
|
1196
|
+
* return (
|
|
1197
|
+
* <Tabs
|
|
1198
|
+
* items={[
|
|
1199
|
+
* {
|
|
1200
|
+
* id: 'id',
|
|
1201
|
+
* children: 'content',
|
|
1202
|
+
* },
|
|
1203
|
+
* 1 === 0 && {
|
|
1204
|
+
* id: 'hidden',
|
|
1205
|
+
* children: 'content',
|
|
1206
|
+
* },
|
|
1207
|
+
* ]}
|
|
1208
|
+
* />
|
|
1209
|
+
* )
|
|
1210
|
+
* }
|
|
856
1211
|
* ```
|
|
857
1212
|
*/
|
|
858
|
-
declare function Tabs(props: TabsProps):
|
|
859
|
-
|
|
1213
|
+
declare function Tabs(props: TabsProps): _$react_jsx_runtime0.JSX.Element;
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region src/Title/index.d.ts
|
|
1216
|
+
/**
|
|
1217
|
+
* Props for the document-title helper component.
|
|
1218
|
+
*/
|
|
860
1219
|
interface TitleProps {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1220
|
+
/** Title text or title segments used to update `document.title`. */
|
|
1221
|
+
title: string | string[];
|
|
1222
|
+
/**
|
|
1223
|
+
* Separator used when joining title segments.
|
|
1224
|
+
*
|
|
1225
|
+
* @default ' - '
|
|
1226
|
+
*/
|
|
1227
|
+
separator?: string;
|
|
1228
|
+
/** Suffix appended to the generated document title. */
|
|
1229
|
+
suffix?: string;
|
|
1230
|
+
/** Whether to render an `h1`, or the props used to style that `h1`. */
|
|
1231
|
+
h1?: boolean | {
|
|
1232
|
+
className?: string;
|
|
1233
|
+
style?: React.CSSProperties;
|
|
1234
|
+
};
|
|
1235
|
+
/** Whether to render plain text instead of returning `null`. */
|
|
1236
|
+
plain?: boolean;
|
|
1237
|
+
/** Existing element cloned with a `title` prop. */
|
|
1238
|
+
children?: JSX.Element;
|
|
874
1239
|
}
|
|
875
1240
|
/**
|
|
876
|
-
*
|
|
1241
|
+
* Update `document.title` and optionally render the title inline.
|
|
1242
|
+
*
|
|
1243
|
+
* The component returns `null` by default and is often used only for its side effect.
|
|
877
1244
|
*
|
|
878
|
-
*
|
|
1245
|
+
* @param {TitleProps} props - Title props controlling document title updates and optional inline rendering.
|
|
879
1246
|
*
|
|
1247
|
+
* @example
|
|
880
1248
|
* ```tsx
|
|
881
|
-
*
|
|
882
|
-
* <Title title='hi' /> // => change the document.title to 'hi'
|
|
883
|
-
* <Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
|
1249
|
+
* import { Title } from '@faasjs/ant-design'
|
|
884
1250
|
*
|
|
885
|
-
*
|
|
886
|
-
*
|
|
887
|
-
*
|
|
1251
|
+
* export function DetailPage() {
|
|
1252
|
+
* return (
|
|
1253
|
+
* <>
|
|
1254
|
+
* <Title title={['Orders', 'Detail']} h1 />
|
|
1255
|
+
* <div>...</div>
|
|
1256
|
+
* </>
|
|
1257
|
+
* )
|
|
1258
|
+
* }
|
|
1259
|
+
* ```
|
|
1260
|
+
*/
|
|
1261
|
+
declare function Title(props: TitleProps): JSX.Element | null;
|
|
1262
|
+
//#endregion
|
|
1263
|
+
//#region src/useApp/index.d.ts
|
|
1264
|
+
/**
|
|
1265
|
+
* Shared app services exposed by {@link AppContext} and {@link useApp}.
|
|
1266
|
+
*/
|
|
1267
|
+
interface useAppProps {
|
|
1268
|
+
/** Ant Design message API instance created by the root `App` component. */
|
|
1269
|
+
message: MessageInstance;
|
|
1270
|
+
/** Ant Design notification API instance created by the root `App` component. */
|
|
1271
|
+
notification: NotificationInstance;
|
|
1272
|
+
/** Current props of the hook-managed modal element. */
|
|
1273
|
+
modalProps: ModalProps;
|
|
1274
|
+
/** Setter that merges updates into the hook-managed modal props. */
|
|
1275
|
+
setModalProps: setModalProps;
|
|
1276
|
+
/** Current props of the hook-managed drawer element. */
|
|
1277
|
+
drawerProps: DrawerProps;
|
|
1278
|
+
/** Setter that merges updates into the hook-managed drawer props. */
|
|
1279
|
+
setDrawerProps: setDrawerProps;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Shared context storing message, notification, modal, and drawer helpers.
|
|
888
1283
|
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
1284
|
+
* @example
|
|
1285
|
+
* ```ts
|
|
1286
|
+
* const { message } = AppContext.use()
|
|
891
1287
|
* ```
|
|
892
1288
|
*/
|
|
893
|
-
declare
|
|
894
|
-
|
|
1289
|
+
declare const AppContext: any;
|
|
1290
|
+
/**
|
|
1291
|
+
* Read app-level services exposed by the root `App` component.
|
|
1292
|
+
*
|
|
1293
|
+
* @template NewT - Narrowed app context shape to read from `AppContext`.
|
|
1294
|
+
* @param {void} this - Explicit void receiver that keeps the hook unbound.
|
|
1295
|
+
* @returns Read-only app context value.
|
|
1296
|
+
*
|
|
1297
|
+
* @example
|
|
1298
|
+
* ```tsx
|
|
1299
|
+
* import { App, useApp } from '@faasjs/ant-design'
|
|
1300
|
+
* import { Button } from 'antd'
|
|
1301
|
+
*
|
|
1302
|
+
* function Page() {
|
|
1303
|
+
* const { message, setModalProps } = useApp()
|
|
1304
|
+
*
|
|
1305
|
+
* return (
|
|
1306
|
+
* <Button
|
|
1307
|
+
* onClick={() => {
|
|
1308
|
+
* message.success('Saved')
|
|
1309
|
+
* setModalProps({ open: true, title: 'Done', children: 'Profile updated.' })
|
|
1310
|
+
* }}
|
|
1311
|
+
* >
|
|
1312
|
+
* Save
|
|
1313
|
+
* </Button>
|
|
1314
|
+
* )
|
|
1315
|
+
* }
|
|
1316
|
+
*
|
|
1317
|
+
* export function Root() {
|
|
1318
|
+
* return (
|
|
1319
|
+
* <App>
|
|
1320
|
+
* <Page />
|
|
1321
|
+
* </App>
|
|
1322
|
+
* )
|
|
1323
|
+
* }
|
|
1324
|
+
* ```
|
|
1325
|
+
*/
|
|
1326
|
+
declare function useApp<NewT extends useAppProps = useAppProps>(this: void): Readonly<NewT>;
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/useThemeToken/index.d.ts
|
|
895
1329
|
/**
|
|
896
|
-
*
|
|
1330
|
+
* Read the current Ant Design theme token.
|
|
1331
|
+
*
|
|
1332
|
+
* @returns Ant Design global token object for the active theme.
|
|
897
1333
|
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
1334
|
+
* @example
|
|
1335
|
+
* ```tsx
|
|
1336
|
+
* import { useThemeToken } from '@faasjs/ant-design'
|
|
1337
|
+
*
|
|
1338
|
+
* function PrimarySwatch() {
|
|
1339
|
+
* const { colorPrimary } = useThemeToken()
|
|
900
1340
|
*
|
|
901
|
-
*
|
|
1341
|
+
* return <div style={{ width: 24, height: 24, background: colorPrimary }} />
|
|
1342
|
+
* }
|
|
1343
|
+
* ```
|
|
902
1344
|
*/
|
|
903
1345
|
declare function useThemeToken(): GlobalToken;
|
|
904
|
-
|
|
905
|
-
export { App,
|
|
1346
|
+
//#endregion
|
|
1347
|
+
export { App, AppContext, AppProps, BaseExtendTypeProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, type DescriptionCommonProps, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DescriptionWithFaasProps, type DescriptionWithoutFaasProps, Drawer, DrawerProps, ErrorBoundary, type ErrorBoundaryProps, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, type FaasDataWrapperRef, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasReactClient, type FaasReactClientOptions, Form, type FormFaasProps, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, type FormWithFaasProps, type FormWithoutFaasProps, Link, LinkProps, Loading, LoadingProps, Modal, ModalProps, PageNotFound, ResolvedTheme, Routes, RoutesProps, TabProps, Table, type TableFaasDataParams, type TableFaasDataResponse, type TableItemProps, type TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, cloneUnionFaasItemElement, createOnErrorHandler, faas, idToTitle, lazy, renderDisplayValue, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
|