@faasjs/ant-design 5.0.0-beta.1 → 5.0.0-beta.3
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/package.json +4 -4
- package/dist/index.d.cts +0 -751
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": {
|
|
12
|
-
"types": "./dist/index.d.
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
13
|
"default": "./dist/index.mjs"
|
|
14
14
|
},
|
|
15
15
|
"require": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@faasjs/react": "5.0.0-beta.
|
|
38
|
+
"@faasjs/react": "5.0.0-beta.3",
|
|
39
39
|
"antd": "*",
|
|
40
40
|
"@ant-design/icons": "*",
|
|
41
41
|
"lodash-es": "*",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/lodash-es": "*",
|
|
48
|
-
"@faasjs/react": "5.0.0-beta.
|
|
48
|
+
"@faasjs/react": "5.0.0-beta.3",
|
|
49
49
|
"antd": "*",
|
|
50
50
|
"@ant-design/icons": "*",
|
|
51
51
|
"lodash-es": "*",
|
package/dist/index.d.cts
DELETED
|
@@ -1,751 +0,0 @@
|
|
|
1
|
-
import { FaasReactClientOptions, ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
2
|
-
export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { StyleProviderProps } from '@ant-design/cssinjs';
|
|
5
|
-
import { DrawerProps as DrawerProps$1, ModalProps as ModalProps$1, ConfigProviderProps as ConfigProviderProps$1, DescriptionsProps, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
|
|
6
|
-
import { MessageInstance } from 'antd/es/message/interface';
|
|
7
|
-
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
8
|
-
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
9
|
-
import * as react from 'react';
|
|
10
|
-
import { CSSProperties, JSX, Dispatch, SetStateAction, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
11
|
-
export { lazy } from 'react';
|
|
12
|
-
import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
|
|
13
|
-
import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
|
|
14
|
-
import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
|
|
15
|
-
import { Dayjs } from 'dayjs';
|
|
16
|
-
import { FaasAction } from '@faasjs/types';
|
|
17
|
-
import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
|
|
18
|
-
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
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 antd_es_form from 'antd/es/form';
|
|
22
|
-
import * as rc_field_form from 'rc-field-form';
|
|
23
|
-
import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
|
|
24
|
-
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
25
|
-
import { Tab } from 'rc-tabs/es/interface';
|
|
26
|
-
|
|
27
|
-
interface ConfigProviderProps {
|
|
28
|
-
faasClientOptions?: FaasReactClientOptions;
|
|
29
|
-
children: React.ReactNode;
|
|
30
|
-
theme?: {
|
|
31
|
-
lang?: string;
|
|
32
|
-
common?: {
|
|
33
|
-
blank?: string;
|
|
34
|
-
all?: string;
|
|
35
|
-
submit?: string;
|
|
36
|
-
pageNotFound?: string;
|
|
37
|
-
add?: string;
|
|
38
|
-
delete?: string;
|
|
39
|
-
required?: string;
|
|
40
|
-
search?: string;
|
|
41
|
-
reset?: string;
|
|
42
|
-
};
|
|
43
|
-
Blank?: {
|
|
44
|
-
text?: string;
|
|
45
|
-
};
|
|
46
|
-
Form?: {
|
|
47
|
-
submit?: {
|
|
48
|
-
text?: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
Title?: {
|
|
52
|
-
/** ' - ' as default */
|
|
53
|
-
separator?: string;
|
|
54
|
-
suffix?: string;
|
|
55
|
-
};
|
|
56
|
-
Link?: {
|
|
57
|
-
/** '_blank' as default */
|
|
58
|
-
target?: string;
|
|
59
|
-
style?: CSSProperties;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
|
|
64
|
-
/**
|
|
65
|
-
* Config for `@faasjs/ant-design` components.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```tsx
|
|
69
|
-
* import { ConfigProvider } from '@faasjs/ant-design'
|
|
70
|
-
*
|
|
71
|
-
* <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
|
|
72
|
-
* <Blank />
|
|
73
|
-
* </ConfigProvider>
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
77
|
-
declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
78
|
-
|
|
79
|
-
declare const Drawer: React.FC<DrawerProps> & {
|
|
80
|
-
whyDidYouRender?: boolean;
|
|
81
|
-
};
|
|
82
|
-
interface DrawerProps extends DrawerProps$1 {
|
|
83
|
-
children?: JSX.Element | JSX.Element[];
|
|
84
|
-
}
|
|
85
|
-
type setDrawerProps = Dispatch<SetStateAction<DrawerProps>>;
|
|
86
|
-
/**
|
|
87
|
-
* Hook style drawer
|
|
88
|
-
*
|
|
89
|
-
* ```tsx
|
|
90
|
-
* function Example() {
|
|
91
|
-
* const { drawer, setDrawerProps } = useDrawer()
|
|
92
|
-
*
|
|
93
|
-
* return <>
|
|
94
|
-
* <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }>
|
|
95
|
-
* Toggle
|
|
96
|
-
* </Button>
|
|
97
|
-
* {drawer}
|
|
98
|
-
* </>
|
|
99
|
-
* }
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
declare function useDrawer(init?: DrawerProps): {
|
|
103
|
-
drawer: react_jsx_runtime.JSX.Element;
|
|
104
|
-
drawerProps: DrawerProps;
|
|
105
|
-
setDrawerProps: setDrawerProps;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Styled error boundary.
|
|
110
|
-
*/
|
|
111
|
-
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
112
|
-
declare namespace ErrorBoundary {
|
|
113
|
-
var whyDidYouRender: boolean;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
declare const Modal: react.FC<ModalProps$1> & antd_es_modal_confirm.ModalStaticFunctions & {
|
|
117
|
-
useModal: typeof antd_es_modal_useModal.default;
|
|
118
|
-
destroyAll: () => void;
|
|
119
|
-
config: typeof antd_es_modal_confirm.modalGlobalConfig;
|
|
120
|
-
_InternalPanelDoNotUseOrYouWillBeFired: (props: antd_es_modal_PurePanel.PurePanelProps) => React.JSX.Element;
|
|
121
|
-
};
|
|
122
|
-
interface ModalProps extends ModalProps$1 {
|
|
123
|
-
children?: JSX.Element | JSX.Element[] | string;
|
|
124
|
-
}
|
|
125
|
-
type setModalProps = Dispatch<SetStateAction<ModalProps>>;
|
|
126
|
-
/**
|
|
127
|
-
* Hook style modal
|
|
128
|
-
*
|
|
129
|
-
* ```tsx
|
|
130
|
-
* function Example() {
|
|
131
|
-
* const { modal, setModalProps } = useModal()
|
|
132
|
-
*
|
|
133
|
-
* return <>
|
|
134
|
-
* <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
|
|
135
|
-
* {modal}
|
|
136
|
-
* </>
|
|
137
|
-
* }
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
declare function useModal(init?: ModalProps): {
|
|
141
|
-
modal: react_jsx_runtime.JSX.Element;
|
|
142
|
-
modalProps: ModalProps;
|
|
143
|
-
setModalProps: setModalProps;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
interface AppProps {
|
|
147
|
-
children: React.ReactNode;
|
|
148
|
-
/**
|
|
149
|
-
* `false` to disable StyleProvider.
|
|
150
|
-
*
|
|
151
|
-
* @see https://github.com/ant-design/cssinjs?tab=readme-ov-file#styleprovider
|
|
152
|
-
*/
|
|
153
|
-
styleProviderProps?: StyleProviderProps | false;
|
|
154
|
-
/** @see https://ant.design/components/config-provider/#API */
|
|
155
|
-
configProviderProps?: ConfigProviderProps$1;
|
|
156
|
-
/**
|
|
157
|
-
* `false` to disable BrowserRouter.
|
|
158
|
-
*
|
|
159
|
-
* @see https://reactrouter.com/en/router-components/browser-router
|
|
160
|
-
*/
|
|
161
|
-
browserRouterProps?: BrowserRouterProps | false;
|
|
162
|
-
/** @see https://faasjs.com/doc/ant-design/#errorboundary */
|
|
163
|
-
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
164
|
-
/** @see https://faasjs.com/doc/ant-design/#configprovider */
|
|
165
|
-
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
|
|
166
|
-
}
|
|
167
|
-
interface useAppProps {
|
|
168
|
-
message: MessageInstance;
|
|
169
|
-
notification: NotificationInstance;
|
|
170
|
-
modalProps: ModalProps;
|
|
171
|
-
setModalProps: setModalProps;
|
|
172
|
-
drawerProps: DrawerProps;
|
|
173
|
-
setDrawerProps: setDrawerProps;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* App component with Ant Design & FaasJS
|
|
177
|
-
*
|
|
178
|
-
* - Based on Ant Design's [ConfigProvider](https://ant.design/components/config-provider/) and [StyleProvider](https://ant.design/docs/react/compatible-style#styleprovider).
|
|
179
|
-
* - Integrated Ant Design's [Message](https://ant.design/components/message/) and [Notification](https://ant.design/components/notification/).
|
|
180
|
-
* - Based on FaasJS's [ConfigProvider](https://faasjs.com/doc/ant-design/#configprovider).
|
|
181
|
-
* - Integrated FaasJS's [Modal](https://faasjs.com/doc/ant-design/#usemodal), [Drawer](https://faasjs.com/doc/ant-design/#usedrawer) and [ErrorBoundary](https://faasjs.com/doc/ant-design/#errorboundary).
|
|
182
|
-
* - Integrated React Router's [BrowserRouter](https://reactrouter.com/en/router-components/browser-router).
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```tsx
|
|
186
|
-
* import { App } from '@faasjs/ant-design'
|
|
187
|
-
*
|
|
188
|
-
* export default function () {
|
|
189
|
-
* return (
|
|
190
|
-
* <App
|
|
191
|
-
* styleProviderProps={{}} // https://ant.design/docs/react/compatible-style#styleprovider
|
|
192
|
-
* configProviderProps={{}} // https://ant.design/components/config-provider/#API
|
|
193
|
-
* browserRouterProps={{}} // https://reactrouter.com/en/router-components/browser-router
|
|
194
|
-
* errorBoundaryProps={{}} // https://faasjs.com/doc/ant-design/#errorboundary
|
|
195
|
-
* faasConfigProviderProps={{}} // https://faasjs.com/doc/ant-design/#configprovider
|
|
196
|
-
* >
|
|
197
|
-
* <div>content</div>
|
|
198
|
-
* </App>
|
|
199
|
-
* )
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
|
|
203
|
-
declare namespace App {
|
|
204
|
-
var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
|
|
205
|
-
var whyDidYouRender: boolean;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Get app context.
|
|
209
|
-
*
|
|
210
|
-
* ```ts
|
|
211
|
-
* import { useApp } from '@faasjs/ant-design'
|
|
212
|
-
*
|
|
213
|
-
* const { message, notification, setModalProps, setDrawerProps } = useApp()
|
|
214
|
-
* ```
|
|
215
|
-
*/
|
|
216
|
-
declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
|
|
217
|
-
|
|
218
|
-
interface BlankProps {
|
|
219
|
-
value?: any;
|
|
220
|
-
text?: string;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Blank component.
|
|
224
|
-
*
|
|
225
|
-
* If value is undefined or null, return text, otherwise return value.
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* ```tsx
|
|
229
|
-
* import { Blank } from '@faasjs/ant-design'
|
|
230
|
-
*
|
|
231
|
-
* <Blank value={undefined} text="Empty" />
|
|
232
|
-
* ```
|
|
233
|
-
*/
|
|
234
|
-
declare function Blank(options?: BlankProps): JSX.Element;
|
|
235
|
-
declare namespace Blank {
|
|
236
|
-
var whyDidYouRender: boolean;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
type LoadingProps = {
|
|
240
|
-
style?: React.CSSProperties;
|
|
241
|
-
size?: 'small' | 'default' | 'large';
|
|
242
|
-
loading?: boolean;
|
|
243
|
-
children?: React.ReactNode;
|
|
244
|
-
};
|
|
245
|
-
/**
|
|
246
|
-
* Loading component based on Spin
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* ```tsx
|
|
250
|
-
* <Loading /> // display loading
|
|
251
|
-
*
|
|
252
|
-
* <Loading loading={ !remoteData }>
|
|
253
|
-
* <div>{remoteData}</div>
|
|
254
|
-
* </Loading>
|
|
255
|
-
* ```
|
|
256
|
-
*/
|
|
257
|
-
declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
|
|
258
|
-
declare namespace Loading {
|
|
259
|
-
var whyDidYouRender: boolean;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
|
|
263
|
-
interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
264
|
-
loadingProps?: LoadingProps;
|
|
265
|
-
loading?: JSX.Element;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* FaasDataWrapper component with Loading
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* ```tsx
|
|
272
|
-
* function MyComponent (props: FaasDataInjection) {
|
|
273
|
-
* return <div>{ props.data }</div>
|
|
274
|
-
* }
|
|
275
|
-
*
|
|
276
|
-
* function MyPage () {
|
|
277
|
-
* return <FaasDataWrapper action="test" params={{ a: 1 }}>
|
|
278
|
-
* <MyComponent />
|
|
279
|
-
* </FaasDataWrapper>
|
|
280
|
-
* }
|
|
281
|
-
* ```
|
|
282
|
-
*/
|
|
283
|
-
declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
284
|
-
declare namespace FaasDataWrapper {
|
|
285
|
-
var whyDidYouRender: boolean;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* HOC to wrap a component with FaasDataWrapper and Loading
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* ```tsx
|
|
292
|
-
* const MyComponent = withFaasData(({ data }) => <div>{data.name}</div>, { action: 'test', params: { a: 1 } })
|
|
293
|
-
* ```
|
|
294
|
-
*/
|
|
295
|
-
declare function withFaasData<PathOrData extends FaasAction, 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>> & Record<string, any>>;
|
|
296
|
-
|
|
297
|
-
interface ExtendDescriptionTypeProps<T = any> {
|
|
298
|
-
children?: UnionFaasItemElement<T>;
|
|
299
|
-
render?: UnionFaasItemRender<T>;
|
|
300
|
-
}
|
|
301
|
-
type ExtendDescriptionItemProps = BaseItemProps;
|
|
302
|
-
interface DescriptionItemProps<T = any> extends FaasItemProps {
|
|
303
|
-
children?: UnionFaasItemElement<T>;
|
|
304
|
-
descriptionChildren?: UnionFaasItemElement<T>;
|
|
305
|
-
render?: UnionFaasItemRender<T>;
|
|
306
|
-
descriptionRender?: UnionFaasItemRender<T>;
|
|
307
|
-
if?: (values: Record<string, any>) => boolean;
|
|
308
|
-
object?: DescriptionItemProps<T>[];
|
|
309
|
-
}
|
|
310
|
-
interface DescriptionProps<T = any, ExtendItemProps = any> extends Omit<DescriptionsProps, 'items'> {
|
|
311
|
-
renderTitle?(values: T): ReactNode;
|
|
312
|
-
items: (DescriptionItemProps | ExtendItemProps)[];
|
|
313
|
-
extendTypes?: {
|
|
314
|
-
[key: string]: ExtendDescriptionTypeProps;
|
|
315
|
-
};
|
|
316
|
-
dataSource?: T;
|
|
317
|
-
faasData?: FaasDataWrapperProps<T>;
|
|
318
|
-
}
|
|
319
|
-
interface DescriptionItemContentProps<T = any> {
|
|
320
|
-
item: DescriptionItemProps;
|
|
321
|
-
value: T;
|
|
322
|
-
values?: any;
|
|
323
|
-
extendTypes?: {
|
|
324
|
-
[key: string]: ExtendDescriptionTypeProps;
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Description component
|
|
329
|
-
*
|
|
330
|
-
* - Based on [Ant Design Descriptions](https://ant.design/components/descriptions/).
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* ```tsx
|
|
334
|
-
* import { Description } from '@faasjs/ant-design'
|
|
335
|
-
*
|
|
336
|
-
* <Description
|
|
337
|
-
* title="Title"
|
|
338
|
-
* items={[
|
|
339
|
-
* {
|
|
340
|
-
* id: 'id',
|
|
341
|
-
* title: 'Title',
|
|
342
|
-
* type: 'string',
|
|
343
|
-
* },
|
|
344
|
-
* ]}
|
|
345
|
-
* dataSource={{ id: 'value' }}
|
|
346
|
-
* />
|
|
347
|
-
* ```
|
|
348
|
-
*/
|
|
349
|
-
declare function Description<T extends Record<string, any> = any>({ faasData, dataSource, renderTitle, extendTypes, ...props }: DescriptionProps<T>): react_jsx_runtime.JSX.Element;
|
|
350
|
-
declare namespace Description {
|
|
351
|
-
var displayName: string;
|
|
352
|
-
var whyDidYouRender: boolean;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
type ExtendFormTypeProps<T = any> = {
|
|
356
|
-
children?: UnionFaasItemElement<T>;
|
|
357
|
-
};
|
|
358
|
-
type ExtendTypes = {
|
|
359
|
-
[type: string]: ExtendFormTypeProps;
|
|
360
|
-
};
|
|
361
|
-
type InputTypeMap<T> = {
|
|
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;
|
|
371
|
-
};
|
|
372
|
-
interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
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>;
|
|
381
|
-
formChildren?: UnionFaasItemElement<T>;
|
|
382
|
-
render?: UnionFaasItemRender<T>;
|
|
383
|
-
formRender?: UnionFaasItemRender<T>;
|
|
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;
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Extend custom form item types.
|
|
394
|
-
*
|
|
395
|
-
* @example
|
|
396
|
-
* ```ts
|
|
397
|
-
* import type { ExtendFormItemProps, FormProps } from '@faasjs/ant-design'
|
|
398
|
-
*
|
|
399
|
-
* // define custom type
|
|
400
|
-
* interface ExtendTypes extends ExtendFormItemProps {
|
|
401
|
-
* type: 'password'
|
|
402
|
-
* }
|
|
403
|
-
*
|
|
404
|
-
* // extend form
|
|
405
|
-
* function ExtendForm(props: FormProps<any, ExtendTypes>) {
|
|
406
|
-
* return (
|
|
407
|
-
* <Form
|
|
408
|
-
* {...props}
|
|
409
|
-
* extendTypes={{ password: { children: <Input.Password /> } }}
|
|
410
|
-
* />
|
|
411
|
-
* )
|
|
412
|
-
* }
|
|
413
|
-
*
|
|
414
|
-
* // use custom type
|
|
415
|
-
* <ExtendForm
|
|
416
|
-
* items={[
|
|
417
|
-
* {
|
|
418
|
-
* id: 'test',
|
|
419
|
-
* type: 'password',
|
|
420
|
-
* },
|
|
421
|
-
* ]}
|
|
422
|
-
* />
|
|
423
|
-
* ```
|
|
424
|
-
*/
|
|
425
|
-
interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
|
|
426
|
-
type?: string;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* FormItem
|
|
430
|
-
*
|
|
431
|
-
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
432
|
-
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
433
|
-
*
|
|
434
|
-
* @example
|
|
435
|
-
* ```tsx
|
|
436
|
-
* // use inline type
|
|
437
|
-
* <FormItem type='string' id='name' />
|
|
438
|
-
*
|
|
439
|
-
* // use custom type
|
|
440
|
-
* <FormItem id='password'>
|
|
441
|
-
* <Input.Password />
|
|
442
|
-
* </>
|
|
443
|
-
* ```
|
|
444
|
-
*/
|
|
445
|
-
declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
|
|
446
|
-
declare namespace FormItem {
|
|
447
|
-
var whyDidYouRender: boolean;
|
|
448
|
-
var useStatus: () => {
|
|
449
|
-
status?: antd_es_form_FormItem.ValidateStatus;
|
|
450
|
-
errors: React.ReactNode[];
|
|
451
|
-
warnings: React.ReactNode[];
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
|
|
456
|
-
optionsType?: 'auto';
|
|
457
|
-
children?: UnionFaasItemElement<T>;
|
|
458
|
-
tableChildren?: UnionFaasItemElement<T>;
|
|
459
|
-
render?: UnionFaasItemRender<T>;
|
|
460
|
-
tableRender?: UnionFaasItemRender<T>;
|
|
461
|
-
object?: TableItemProps<T>[];
|
|
462
|
-
}
|
|
463
|
-
type ExtendTableTypeProps<T = any> = {
|
|
464
|
-
children?: JSX.Element;
|
|
465
|
-
render?: UnionFaasItemRender<T>;
|
|
466
|
-
};
|
|
467
|
-
type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
|
|
468
|
-
type TableProps<T = any, ExtendTypes = any> = {
|
|
469
|
-
items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
|
|
470
|
-
extendTypes?: {
|
|
471
|
-
[key: string]: ExtendTableTypeProps;
|
|
472
|
-
};
|
|
473
|
-
faasData?: FaasDataWrapperProps<T>;
|
|
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
|
-
};
|
|
480
|
-
} & TableProps$1<T>;
|
|
481
|
-
/**
|
|
482
|
-
* Table component with Ant Design & FaasJS
|
|
483
|
-
*
|
|
484
|
-
* - Based on [Ant Design Table](https://ant.design/components/table/).
|
|
485
|
-
* - Support FaasJS injection.
|
|
486
|
-
* - Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
487
|
-
* - Auto generate sorter (disable with `sorter: false`).
|
|
488
|
-
*/
|
|
489
|
-
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
|
|
490
|
-
declare namespace Table {
|
|
491
|
-
var whyDidYouRender: boolean;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
|
|
495
|
-
/** FaasItemType's value type */
|
|
496
|
-
type FaasItemTypeValue = {
|
|
497
|
-
string: string;
|
|
498
|
-
'string[]': string[];
|
|
499
|
-
number: number;
|
|
500
|
-
'number[]': number[];
|
|
501
|
-
boolean: boolean;
|
|
502
|
-
date: Dayjs;
|
|
503
|
-
time: Dayjs;
|
|
504
|
-
object: any;
|
|
505
|
-
'object[]': any[];
|
|
506
|
-
};
|
|
507
|
-
type BaseOption = string | number | {
|
|
508
|
-
label: string;
|
|
509
|
-
value?: any;
|
|
510
|
-
};
|
|
511
|
-
interface BaseItemProps {
|
|
512
|
-
id: string;
|
|
513
|
-
title?: string;
|
|
514
|
-
options?: BaseOption[];
|
|
515
|
-
}
|
|
516
|
-
interface FaasItemProps extends BaseItemProps {
|
|
517
|
-
/**
|
|
518
|
-
* Support string, string[], number, number[], boolean, date, time, object, object[]
|
|
519
|
-
* @default 'string'
|
|
520
|
-
*/
|
|
521
|
-
type?: FaasItemType;
|
|
522
|
-
}
|
|
523
|
-
declare function upperFirst(str: string): string;
|
|
524
|
-
/**
|
|
525
|
-
* convert string[] or number[] to { label, value }[]
|
|
526
|
-
*/
|
|
527
|
-
declare function transferOptions(options: BaseOption[]): {
|
|
528
|
-
label: string;
|
|
529
|
-
value?: string | number;
|
|
530
|
-
}[];
|
|
531
|
-
declare function transferValue(type: FaasItemType, value: any): any;
|
|
532
|
-
type UnionScene = 'form' | 'description' | 'table';
|
|
533
|
-
type UnionFaasItemInjection<Value = any, Values = any> = {
|
|
534
|
-
scene?: UnionScene;
|
|
535
|
-
value?: Value;
|
|
536
|
-
values?: Values;
|
|
537
|
-
index?: number;
|
|
538
|
-
};
|
|
539
|
-
type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => React.ReactNode;
|
|
540
|
-
type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | null;
|
|
541
|
-
interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
|
|
542
|
-
children?: UnionFaasItemElement<UnionFaasItemProps<Value, Values>> | null;
|
|
543
|
-
render?: UnionFaasItemRender;
|
|
544
|
-
object?: UnionFaasItemProps<Value, Values>[];
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
type FormSubmitProps = {
|
|
548
|
-
/** Default: Submit */
|
|
549
|
-
text?: string;
|
|
550
|
-
/**
|
|
551
|
-
* Submit to FaasJS server.
|
|
552
|
-
*
|
|
553
|
-
* If use onFinish, you should call submit manually.
|
|
554
|
-
* ```ts
|
|
555
|
-
* {
|
|
556
|
-
* submit: {
|
|
557
|
-
* to: {
|
|
558
|
-
* action: 'action_name'
|
|
559
|
-
* }
|
|
560
|
-
* },
|
|
561
|
-
* onFinish: (values, submit) => {
|
|
562
|
-
* // do something before submit
|
|
563
|
-
*
|
|
564
|
-
* // submit
|
|
565
|
-
* await submit({
|
|
566
|
-
* ...values,
|
|
567
|
-
* extraProps: 'some extra props'
|
|
568
|
-
* })
|
|
569
|
-
*
|
|
570
|
-
* // do something after submit
|
|
571
|
-
* }
|
|
572
|
-
* }
|
|
573
|
-
* ```
|
|
574
|
-
*/
|
|
575
|
-
to?: {
|
|
576
|
-
action: FaasAction | string;
|
|
577
|
-
/** params will overwrite form values before submit */
|
|
578
|
-
params?: Record<string, any>;
|
|
579
|
-
then?: (result: any) => void;
|
|
580
|
-
catch?: (error: any) => void;
|
|
581
|
-
finally?: () => void;
|
|
582
|
-
};
|
|
583
|
-
};
|
|
584
|
-
interface FormProps<Values extends Record<string, any> = any, ExtendItemProps extends ExtendFormItemProps = ExtendFormItemProps> extends Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> {
|
|
585
|
-
items?: ((ExtendItemProps extends ExtendFormItemProps ? ExtendItemProps | FormItemProps : FormItemProps) | JSX.Element)[];
|
|
586
|
-
/** Default: { text: 'Submit' }, set false to disable it */
|
|
587
|
-
submit?: false | FormSubmitProps;
|
|
588
|
-
onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
|
|
589
|
-
beforeItems?: JSX.Element | JSX.Element[];
|
|
590
|
-
footer?: JSX.Element | JSX.Element[];
|
|
591
|
-
extendTypes?: ExtendTypes;
|
|
592
|
-
children?: ReactNode;
|
|
593
|
-
initialValues?: Partial<Values>;
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Form component with Ant Design & FaasJS
|
|
597
|
-
*
|
|
598
|
-
* - Based on [Ant Design Form](https://ant.design/components/form/).
|
|
599
|
-
*/
|
|
600
|
-
declare function Form<Values = any>(props: FormProps<Values>): react_jsx_runtime.JSX.Element;
|
|
601
|
-
declare namespace Form {
|
|
602
|
-
var whyDidYouRender: boolean;
|
|
603
|
-
var useForm: typeof antd_es_form_Form.useForm;
|
|
604
|
-
var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
|
|
605
|
-
var useWatch: typeof rc_field_form.useWatch;
|
|
606
|
-
var Item: typeof FormItem;
|
|
607
|
-
var List: react.FC<antd_es_form.FormListProps>;
|
|
608
|
-
var ErrorList: react.FC<antd_es_form.ErrorListProps>;
|
|
609
|
-
var Provider: react.FC<antd_es_form_context.FormProviderProps>;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
interface LinkProps {
|
|
613
|
-
href: string;
|
|
614
|
-
target?: '_blank';
|
|
615
|
-
text?: string | number;
|
|
616
|
-
children?: ReactNode;
|
|
617
|
-
style?: CSSProperties;
|
|
618
|
-
button?: ButtonProps | boolean;
|
|
619
|
-
block?: boolean;
|
|
620
|
-
/** only use for text without button */
|
|
621
|
-
copyable?: boolean;
|
|
622
|
-
onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Link component with button
|
|
626
|
-
*
|
|
627
|
-
* @example
|
|
628
|
-
* ```tsx
|
|
629
|
-
* // pure link
|
|
630
|
-
* <Link href="/">Home</Link>
|
|
631
|
-
*
|
|
632
|
-
* // link with button
|
|
633
|
-
* <Link href="/" button={{ type:'primary' }}>Home</Link>
|
|
634
|
-
* ```
|
|
635
|
-
*/
|
|
636
|
-
declare function Link(props: LinkProps): react_jsx_runtime.JSX.Element;
|
|
637
|
-
declare namespace Link {
|
|
638
|
-
var whyDidYouRender: boolean;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
declare function PageNotFound(): react_jsx_runtime.JSX.Element;
|
|
642
|
-
interface RoutesProps {
|
|
643
|
-
routes: (RouteProps & {
|
|
644
|
-
page?: LazyExoticComponent<ComponentType<any>>;
|
|
645
|
-
})[];
|
|
646
|
-
fallback?: JSX.Element;
|
|
647
|
-
notFound?: JSX.Element;
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Routes with lazy loading and 404 page.
|
|
651
|
-
*
|
|
652
|
-
* @example
|
|
653
|
-
* ```tsx
|
|
654
|
-
* import { Routes, lazy } from '@faasjs/ant-design'
|
|
655
|
-
* import { BrowserRouter } from 'react-router-dom'
|
|
656
|
-
*
|
|
657
|
-
* export function App () {
|
|
658
|
-
* return <BrowserRouter>
|
|
659
|
-
* <Routes routes={[
|
|
660
|
-
* {
|
|
661
|
-
* path: '/',
|
|
662
|
-
* page: lazy(() => import('./pages/home'))
|
|
663
|
-
* }
|
|
664
|
-
* ]} />
|
|
665
|
-
* </BrowserRouter>
|
|
666
|
-
* }
|
|
667
|
-
* ```
|
|
668
|
-
*/
|
|
669
|
-
declare function Routes(props: RoutesProps): react_jsx_runtime.JSX.Element;
|
|
670
|
-
declare namespace Routes {
|
|
671
|
-
var whyDidYouRender: boolean;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
interface TabProps extends Partial<Tab> {
|
|
675
|
-
id: string;
|
|
676
|
-
title?: React.ReactNode;
|
|
677
|
-
children: React.ReactNode;
|
|
678
|
-
}
|
|
679
|
-
interface TabsProps extends Omit<TabsProps$1, 'items'> {
|
|
680
|
-
/** auto skip null tab */
|
|
681
|
-
items: (TabProps | null | false)[];
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* Tabs component with Ant Design & FaasJS
|
|
685
|
-
*
|
|
686
|
-
* - Based on [Ant Design Tabs](https://ant.design/components/tabs/).
|
|
687
|
-
* - Support auto skip null/false tab item.
|
|
688
|
-
* - Support `id` as key and label.
|
|
689
|
-
*
|
|
690
|
-
* @example
|
|
691
|
-
* ```tsx
|
|
692
|
-
* import { Tabs } from '@faasjs/ant-design'
|
|
693
|
-
*
|
|
694
|
-
* <Tabs
|
|
695
|
-
* items={[
|
|
696
|
-
* {
|
|
697
|
-
* id: 'id',
|
|
698
|
-
* children: 'content',
|
|
699
|
-
* },
|
|
700
|
-
* 1 === 0 && {
|
|
701
|
-
* id: 'hidden',
|
|
702
|
-
* children: 'content',
|
|
703
|
-
* },
|
|
704
|
-
* ]}
|
|
705
|
-
* />
|
|
706
|
-
* ```
|
|
707
|
-
*/
|
|
708
|
-
declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
|
|
709
|
-
declare namespace Tabs {
|
|
710
|
-
var whyDidYouRender: boolean;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
interface TitleProps {
|
|
714
|
-
title: string | string[];
|
|
715
|
-
/** ` - ` as default */
|
|
716
|
-
separator?: string;
|
|
717
|
-
suffix?: string;
|
|
718
|
-
/** return a h1 element */
|
|
719
|
-
h1?: boolean | {
|
|
720
|
-
className?: string;
|
|
721
|
-
style?: React.CSSProperties;
|
|
722
|
-
};
|
|
723
|
-
/** return a pure text element */
|
|
724
|
-
plain?: boolean;
|
|
725
|
-
/** return children */
|
|
726
|
-
children?: JSX.Element;
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* Title is used to change the title of the page
|
|
730
|
-
*
|
|
731
|
-
* Return null by default.
|
|
732
|
-
*
|
|
733
|
-
* ```tsx
|
|
734
|
-
* // return null
|
|
735
|
-
* <Title title='hi' /> // => change the document.title to 'hi'
|
|
736
|
-
* <Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
|
737
|
-
*
|
|
738
|
-
* // return h1
|
|
739
|
-
* <Title title='hi' h1 /> // => <h1>hi</h1>
|
|
740
|
-
* <Title title={['a', 'b']} h1 /> // => <h1>a</h1>
|
|
741
|
-
*
|
|
742
|
-
* // return children
|
|
743
|
-
* <Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
|
|
744
|
-
* ```
|
|
745
|
-
*/
|
|
746
|
-
declare function Title(props: TitleProps): JSX.Element;
|
|
747
|
-
declare namespace Title {
|
|
748
|
-
var whyDidYouRender: boolean;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
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 TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, upperFirst, useApp, type useAppProps, useConfigContext, useDrawer, useModal, withFaasData };
|