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