@faasjs/ant-design 0.0.3-beta.4 → 0.0.3-beta.40
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 +220 -257
- package/dist/index.d.ts +256 -201
- package/dist/index.js +464 -276
- package/dist/index.mjs +485 -301
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, ReactNode, LazyExoticComponent, ComponentType } from 'react';
|
|
3
|
-
import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
|
|
2
|
+
import { CSSProperties, ReactNode, ReactElement, Component, LazyExoticComponent, ComponentType } from 'react';
|
|
4
3
|
import { Dayjs } from 'dayjs';
|
|
5
|
-
import {
|
|
4
|
+
import { FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, TimePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, DrawerProps as DrawerProps$1, FormProps as FormProps$1, ButtonProps, ModalProps as ModalProps$1 } from 'antd';
|
|
6
5
|
export { Drawer, Modal } from 'antd';
|
|
7
|
-
import { FaasDataWrapperProps } from '@faasjs/react';
|
|
8
|
-
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
9
6
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
10
|
-
import {
|
|
7
|
+
import { FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
8
|
+
export { FaasDataInjection } from '@faasjs/react';
|
|
11
9
|
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
|
|
10
|
+
import * as antd_es_form_context from 'antd/es/form/context';
|
|
11
|
+
import * as antd_es_form_ErrorList from 'antd/es/form/ErrorList';
|
|
12
|
+
import * as antd_es_form from 'antd/es/form';
|
|
13
|
+
import * as rc_field_form_es_useWatch from 'rc-field-form/es/useWatch';
|
|
14
|
+
import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormInstance';
|
|
15
|
+
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
16
|
+
import { RouteProps } from 'react-router-dom';
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
interface BlankProps {
|
|
14
19
|
value?: any;
|
|
15
20
|
text?: string;
|
|
16
|
-
}
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
23
|
+
* Blank component.
|
|
24
|
+
*
|
|
18
25
|
* If value is undefined or null, return text, otherwise return value.
|
|
19
26
|
*
|
|
20
27
|
* @param options {object}
|
|
@@ -28,8 +35,7 @@ type BlankProps = {
|
|
|
28
35
|
*/
|
|
29
36
|
declare function Blank(options?: BlankProps): JSX.Element;
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
antd?: ConfigProviderProps$1;
|
|
38
|
+
interface ConfigProviderProps {
|
|
33
39
|
lang?: string;
|
|
34
40
|
common?: {
|
|
35
41
|
blank?: string;
|
|
@@ -60,7 +66,7 @@ type ConfigProviderProps = {
|
|
|
60
66
|
target?: string;
|
|
61
67
|
style?: CSSProperties;
|
|
62
68
|
};
|
|
63
|
-
}
|
|
69
|
+
}
|
|
64
70
|
declare const ConfigContext: react.Context<ConfigProviderProps>;
|
|
65
71
|
/**
|
|
66
72
|
* Config for @faasjs/ant-design components.
|
|
@@ -81,6 +87,148 @@ declare function ConfigProvider({ config, children }: {
|
|
|
81
87
|
}): JSX.Element;
|
|
82
88
|
declare function useConfigContext(): ConfigProviderProps;
|
|
83
89
|
|
|
90
|
+
type ExtendFormTypeProps<T = any> = {
|
|
91
|
+
children?: UnionFaasItemElement<T>;
|
|
92
|
+
};
|
|
93
|
+
type ExtendTypes = {
|
|
94
|
+
[type: string]: ExtendFormTypeProps;
|
|
95
|
+
};
|
|
96
|
+
type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
|
|
97
|
+
interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
98
|
+
input?: InputProps | InputNumberProps | SwitchProps | SelectProps<T> | DatePickerProps | TimePickerProps;
|
|
99
|
+
maxCount?: number;
|
|
100
|
+
object?: FormItemProps[];
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
required?: boolean;
|
|
103
|
+
col?: number;
|
|
104
|
+
children?: UnionFaasItemElement<T>;
|
|
105
|
+
formChildren?: UnionFaasItemElement<T>;
|
|
106
|
+
render?: UnionFaasItemRender<T>;
|
|
107
|
+
formRender?: UnionFaasItemRender<T>;
|
|
108
|
+
rules?: RuleObject[];
|
|
109
|
+
label?: string | false;
|
|
110
|
+
extendTypes?: ExtendTypes;
|
|
111
|
+
/** trigger when current item's value changed */
|
|
112
|
+
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
113
|
+
/** trigger when any item's value changed */
|
|
114
|
+
if?: (values: Record<string, any>) => boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* FormItem, can be used without Form.
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* // use inline type
|
|
121
|
+
* <FormItem type='string' id='name' />
|
|
122
|
+
*
|
|
123
|
+
* // use custom type
|
|
124
|
+
* <FormItem id='password'>
|
|
125
|
+
* <Input.Password />
|
|
126
|
+
* </>
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
|
|
130
|
+
declare namespace FormItem {
|
|
131
|
+
var useStatus: () => {
|
|
132
|
+
status?: "" | "warning" | "error" | "success" | "validating";
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type LoadingProps = {
|
|
137
|
+
style?: React.CSSProperties;
|
|
138
|
+
size?: 'small' | 'default' | 'large';
|
|
139
|
+
loading?: boolean;
|
|
140
|
+
children?: React.ReactNode;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Loading component based on Spin
|
|
144
|
+
*
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <Loading /> // display loading
|
|
147
|
+
*
|
|
148
|
+
* <Loading loading={ !remoteData }>
|
|
149
|
+
* <div>{remoteData}</div>
|
|
150
|
+
* </Loading>
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare function Loading(props: LoadingProps): JSX.Element;
|
|
154
|
+
|
|
155
|
+
interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
156
|
+
loadingProps?: LoadingProps;
|
|
157
|
+
loading?: JSX.Element;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* FaasDataWrapper component with Loading
|
|
161
|
+
*/
|
|
162
|
+
declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
163
|
+
|
|
164
|
+
interface ExtendDescriptionTypeProps<T = any> {
|
|
165
|
+
children?: UnionFaasItemElement<T>;
|
|
166
|
+
render?: UnionFaasItemRender<T>;
|
|
167
|
+
}
|
|
168
|
+
type ExtendDescriptionItemProps = BaseItemProps;
|
|
169
|
+
interface DescriptionItemProps<T = any> extends FaasItemProps {
|
|
170
|
+
children?: UnionFaasItemElement<T>;
|
|
171
|
+
descriptionChildren?: UnionFaasItemElement<T>;
|
|
172
|
+
render?: UnionFaasItemRender<T>;
|
|
173
|
+
descriptionRender?: UnionFaasItemRender<T>;
|
|
174
|
+
if?: (values: Record<string, any>) => boolean;
|
|
175
|
+
object?: DescriptionItemProps<T>[];
|
|
176
|
+
}
|
|
177
|
+
interface DescriptionProps<T = any, ExtendItemProps = any> extends DescriptionsProps {
|
|
178
|
+
renderTitle?: ((values: T) => ReactNode);
|
|
179
|
+
items: (DescriptionItemProps | ExtendItemProps)[];
|
|
180
|
+
extendTypes?: {
|
|
181
|
+
[key: string]: ExtendDescriptionTypeProps;
|
|
182
|
+
};
|
|
183
|
+
dataSource?: T;
|
|
184
|
+
faasData?: FaasDataWrapperProps<T>;
|
|
185
|
+
}
|
|
186
|
+
interface DescriptionItemContentProps<T = any> {
|
|
187
|
+
item: DescriptionItemProps;
|
|
188
|
+
value: T;
|
|
189
|
+
values?: any;
|
|
190
|
+
extendTypes?: {
|
|
191
|
+
[key: string]: ExtendDescriptionTypeProps;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Description component.
|
|
196
|
+
*/
|
|
197
|
+
declare function Description<T = any>(props: DescriptionProps<T>): JSX.Element;
|
|
198
|
+
|
|
199
|
+
interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
|
|
200
|
+
optionsType?: 'auto';
|
|
201
|
+
children?: UnionFaasItemElement<T>;
|
|
202
|
+
tableChildren?: UnionFaasItemElement<T>;
|
|
203
|
+
render?: UnionFaasItemRender<T>;
|
|
204
|
+
tableRender?: UnionFaasItemRender<T>;
|
|
205
|
+
object?: TableItemProps<T>[];
|
|
206
|
+
}
|
|
207
|
+
type ExtendTableTypeProps<T = any> = {
|
|
208
|
+
children?: JSX.Element;
|
|
209
|
+
render?: UnionFaasItemRender<T>;
|
|
210
|
+
};
|
|
211
|
+
type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
|
|
212
|
+
type TableProps<T = any, ExtendTypes = any> = {
|
|
213
|
+
items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
|
|
214
|
+
extendTypes?: {
|
|
215
|
+
[key: string]: ExtendTableTypeProps;
|
|
216
|
+
};
|
|
217
|
+
faasData?: FaasDataWrapperProps<T>;
|
|
218
|
+
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
|
|
219
|
+
pagination: TablePaginationConfig;
|
|
220
|
+
filters: Record<string, FilterValue | null>;
|
|
221
|
+
sorter: SorterResult<T> | SorterResult<T>[];
|
|
222
|
+
extra: TableCurrentDataSource<T>;
|
|
223
|
+
};
|
|
224
|
+
} & TableProps$1<T>;
|
|
225
|
+
/**
|
|
226
|
+
* Table component with Ant Design & FaasJS
|
|
227
|
+
*
|
|
228
|
+
* @ref https://ant.design/components/table/
|
|
229
|
+
*/
|
|
230
|
+
declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
|
|
231
|
+
|
|
84
232
|
type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
|
|
85
233
|
/** FaasItemType's value type */
|
|
86
234
|
type FaasItemTypeValue = {
|
|
@@ -98,53 +246,45 @@ type BaseOption = string | number | {
|
|
|
98
246
|
label: string;
|
|
99
247
|
value?: string | number;
|
|
100
248
|
};
|
|
101
|
-
|
|
249
|
+
interface BaseItemProps {
|
|
102
250
|
id: string;
|
|
103
251
|
title?: string;
|
|
104
252
|
options?: BaseOption[];
|
|
105
|
-
}
|
|
106
|
-
|
|
253
|
+
}
|
|
254
|
+
interface FaasItemProps extends BaseItemProps {
|
|
107
255
|
/**
|
|
108
|
-
* Support string, string[], number, number[], boolean
|
|
256
|
+
* Support string, string[], number, number[], boolean, date, time, object, object[]
|
|
109
257
|
* @default 'string'
|
|
110
258
|
*/
|
|
111
259
|
type?: FaasItemType;
|
|
112
|
-
}
|
|
260
|
+
}
|
|
113
261
|
declare function transferOptions(options: BaseOption[]): {
|
|
114
262
|
label: string;
|
|
115
263
|
value?: string | number;
|
|
116
264
|
}[];
|
|
117
265
|
declare function transferValue(type: FaasItemType, value: any): any;
|
|
118
|
-
|
|
119
|
-
type
|
|
120
|
-
|
|
121
|
-
|
|
266
|
+
type UnionScene = 'form' | 'description' | 'table';
|
|
267
|
+
type UnionFaasItemInjection<Value = any, Values = any> = {
|
|
268
|
+
scene?: UnionScene;
|
|
269
|
+
value?: Value;
|
|
270
|
+
values?: Values;
|
|
271
|
+
index?: number;
|
|
122
272
|
};
|
|
123
|
-
type
|
|
124
|
-
type
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
};
|
|
131
|
-
type DescriptionProps<T = any, ExtendItemProps = any> = {
|
|
132
|
-
renderTitle?: ((values: T) => ReactNode | JSX.Element);
|
|
133
|
-
items: (DescriptionItemProps | ExtendItemProps)[];
|
|
134
|
-
extendTypes?: {
|
|
135
|
-
[key: string]: ExtendDescriptionTypeProps;
|
|
136
|
-
};
|
|
137
|
-
dataSource?: T;
|
|
138
|
-
faasData?: FaasDataWrapperProps<T>;
|
|
139
|
-
} & DescriptionsProps;
|
|
140
|
-
declare function Description<T = any>(props: DescriptionProps<T>): JSX.Element;
|
|
273
|
+
type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => JSX.Element | null;
|
|
274
|
+
type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | null;
|
|
275
|
+
interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
|
|
276
|
+
children?: UnionFaasItemElement<UnionFaasItemProps<Value, Values>> | null;
|
|
277
|
+
render?: UnionFaasItemRender;
|
|
278
|
+
object?: UnionFaasItemProps<Value, Values>[];
|
|
279
|
+
}
|
|
141
280
|
|
|
142
|
-
|
|
281
|
+
interface DrawerProps extends DrawerProps$1 {
|
|
143
282
|
children?: JSX.Element | JSX.Element[];
|
|
144
|
-
}
|
|
283
|
+
}
|
|
145
284
|
type setDrawerProps = (changes: Partial<DrawerProps>) => void;
|
|
146
285
|
/**
|
|
147
286
|
* Hook style drawer.
|
|
287
|
+
*
|
|
148
288
|
* @param init initial props
|
|
149
289
|
*
|
|
150
290
|
* ```ts
|
|
@@ -166,134 +306,71 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
166
306
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
167
307
|
};
|
|
168
308
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
type StringListProps = {
|
|
174
|
-
type: 'string[]';
|
|
175
|
-
input?: InputProps;
|
|
176
|
-
maxCount?: number;
|
|
177
|
-
};
|
|
178
|
-
type NumberProps = {
|
|
179
|
-
type: 'number';
|
|
180
|
-
input?: InputNumberProps;
|
|
181
|
-
};
|
|
182
|
-
type NumberListProps = {
|
|
183
|
-
type: 'number[]';
|
|
184
|
-
input?: InputNumberProps;
|
|
185
|
-
maxCount?: number;
|
|
186
|
-
};
|
|
187
|
-
type BooleanProps = {
|
|
188
|
-
type: 'boolean';
|
|
189
|
-
input?: SwitchProps;
|
|
190
|
-
};
|
|
191
|
-
type DateProps = {
|
|
192
|
-
type: 'date';
|
|
193
|
-
input?: DatePickerProps;
|
|
194
|
-
};
|
|
195
|
-
type TimeProps = {
|
|
196
|
-
type: 'time';
|
|
197
|
-
input?: TimePickerProps;
|
|
198
|
-
};
|
|
199
|
-
type ObjectProps = {
|
|
200
|
-
type: 'object';
|
|
201
|
-
object: FormItemProps[];
|
|
202
|
-
};
|
|
203
|
-
type ObjectListProps = {
|
|
204
|
-
type: 'object[]';
|
|
205
|
-
object: (FormItemProps & {
|
|
206
|
-
/** default is 6 */
|
|
207
|
-
col?: number;
|
|
208
|
-
})[];
|
|
209
|
-
maxCount?: number;
|
|
210
|
-
};
|
|
211
|
-
type OptionsProps = {
|
|
212
|
-
options?: BaseOption[];
|
|
213
|
-
type?: 'string' | 'string[]' | 'number' | 'number[]';
|
|
214
|
-
input?: SelectProps<any>;
|
|
215
|
-
};
|
|
216
|
-
type FormItemInputProps = (StringProps | StringListProps | NumberProps | NumberListProps | BooleanProps | OptionsProps | DateProps | TimeProps | ObjectProps | ObjectListProps) & {
|
|
217
|
-
disabled?: boolean;
|
|
218
|
-
required?: boolean;
|
|
219
|
-
};
|
|
220
|
-
type ExtendFormTypeProps = {
|
|
221
|
-
children?: ReactNode;
|
|
222
|
-
};
|
|
223
|
-
type ExtendTypes = {
|
|
224
|
-
[type: string]: ExtendFormTypeProps;
|
|
225
|
-
};
|
|
226
|
-
type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
|
|
227
|
-
type FormItemProps<T = any> = {
|
|
309
|
+
interface ErrorBoundaryProps {
|
|
310
|
+
message?: ReactNode;
|
|
311
|
+
description?: ReactNode;
|
|
228
312
|
children?: ReactNode;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
* ```ts
|
|
242
|
-
* // use inline type
|
|
243
|
-
* <FormItem item={{ type: 'string', id: 'name' }} />
|
|
244
|
-
*
|
|
245
|
-
* // use custom type
|
|
246
|
-
* <FormItem item={{ id: 'password' }}>
|
|
247
|
-
* <Input.Password />
|
|
248
|
-
* </>
|
|
249
|
-
* ```
|
|
250
|
-
*/
|
|
251
|
-
declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
|
|
313
|
+
onError?: (error: Error | null, info: any) => ReactNode;
|
|
314
|
+
}
|
|
315
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
|
|
316
|
+
error?: Error | null;
|
|
317
|
+
info?: {
|
|
318
|
+
componentStack?: string;
|
|
319
|
+
};
|
|
320
|
+
}> {
|
|
321
|
+
constructor(props: ErrorBoundaryProps);
|
|
322
|
+
componentDidCatch(error: Error | null, info: any): void;
|
|
323
|
+
render(): string | number | boolean | react.ReactFragment | JSX.Element;
|
|
324
|
+
}
|
|
252
325
|
|
|
253
|
-
type
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
};
|
|
326
|
+
type FormSubmitProps = {
|
|
327
|
+
/** Default: Submit */
|
|
328
|
+
text?: string;
|
|
329
|
+
/**
|
|
330
|
+
* Submit to FaasJS server.
|
|
331
|
+
*
|
|
332
|
+
* If use onFinish, you should call submit manually.
|
|
333
|
+
* ```ts
|
|
334
|
+
* {
|
|
335
|
+
* submit: {
|
|
336
|
+
* to: {
|
|
337
|
+
* action: 'action_name'
|
|
338
|
+
* }
|
|
339
|
+
* },
|
|
340
|
+
* onFinish: (values, submit) => {
|
|
341
|
+
* // do something before submit
|
|
342
|
+
*
|
|
343
|
+
* // submit
|
|
344
|
+
* await submit({
|
|
345
|
+
* ...values,
|
|
346
|
+
* extraProps: 'some extra props'
|
|
347
|
+
* })
|
|
348
|
+
*
|
|
349
|
+
* // do something after submit
|
|
350
|
+
* }
|
|
351
|
+
* }
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
to?: {
|
|
355
|
+
action: string;
|
|
356
|
+
/** params will overwrite form values before submit */
|
|
357
|
+
params?: Record<string, any>;
|
|
358
|
+
then?: (result: any) => void;
|
|
359
|
+
catch?: (error: any) => void;
|
|
360
|
+
finally?: () => void;
|
|
289
361
|
};
|
|
362
|
+
};
|
|
363
|
+
interface FormProps<Values extends Record<string, any> = any, ExtendItemProps = any> extends Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> {
|
|
364
|
+
items?: (FormItemProps | ExtendItemProps | JSX.Element)[];
|
|
365
|
+
/** Default: { text: 'Submit' }, set false to disable it */
|
|
366
|
+
submit?: false | FormSubmitProps;
|
|
290
367
|
onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
|
|
291
368
|
beforeItems?: JSX.Element | JSX.Element[];
|
|
292
369
|
footer?: JSX.Element | JSX.Element[];
|
|
293
370
|
extendTypes?: ExtendTypes;
|
|
294
371
|
children?: ReactNode;
|
|
295
372
|
initialValues?: Values;
|
|
296
|
-
}
|
|
373
|
+
}
|
|
297
374
|
/**
|
|
298
375
|
* Form component with Ant Design & FaasJS
|
|
299
376
|
*
|
|
@@ -302,30 +379,39 @@ type FormProps<Values extends Record<string, any> = any, ExtendItemProps = any>
|
|
|
302
379
|
declare function Form<Values = any>(props: FormProps<Values>): JSX.Element;
|
|
303
380
|
declare namespace Form {
|
|
304
381
|
var useForm: typeof antd_es_form_Form.useForm;
|
|
382
|
+
var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
|
|
383
|
+
var useWatch: typeof rc_field_form_es_useWatch.default;
|
|
384
|
+
var Item: typeof FormItem;
|
|
385
|
+
var List: react.FC<antd_es_form.FormListProps>;
|
|
386
|
+
var ErrorList: typeof antd_es_form_ErrorList.default;
|
|
387
|
+
var Provider: react.FC<antd_es_form_context.FormProviderProps>;
|
|
305
388
|
}
|
|
306
389
|
|
|
307
|
-
|
|
390
|
+
interface LinkProps {
|
|
308
391
|
href: string;
|
|
309
392
|
target?: string;
|
|
310
393
|
text?: string | number;
|
|
311
394
|
children?: ReactNode;
|
|
312
395
|
style?: CSSProperties;
|
|
313
396
|
button?: ButtonProps;
|
|
314
|
-
|
|
397
|
+
block?: boolean;
|
|
398
|
+
}
|
|
315
399
|
/**
|
|
400
|
+
* Link component with button.
|
|
401
|
+
*
|
|
316
402
|
* ```ts
|
|
317
403
|
* // pure link
|
|
318
404
|
* <Link href="/">Home</Link>
|
|
319
405
|
*
|
|
320
406
|
* // link with button
|
|
321
|
-
* <Link href="/" button={{type:'primary'}}>Home</Link>
|
|
407
|
+
* <Link href="/" button={{ type:'primary' }}>Home</Link>
|
|
322
408
|
* ```
|
|
323
409
|
*/
|
|
324
|
-
declare function Link(
|
|
410
|
+
declare function Link(props: LinkProps): JSX.Element;
|
|
325
411
|
|
|
326
|
-
|
|
412
|
+
interface ModalProps extends ModalProps$1 {
|
|
327
413
|
children?: JSX.Element | JSX.Element[] | string;
|
|
328
|
-
}
|
|
414
|
+
}
|
|
329
415
|
type setModalProps = (changes: Partial<ModalProps>) => void;
|
|
330
416
|
/**
|
|
331
417
|
* Hook style modal.
|
|
@@ -348,13 +434,13 @@ declare function useModal(init?: ModalProps): {
|
|
|
348
434
|
};
|
|
349
435
|
|
|
350
436
|
declare function PageNotFound(): JSX.Element;
|
|
351
|
-
|
|
437
|
+
interface RoutesProps {
|
|
352
438
|
routes: (RouteProps & {
|
|
353
439
|
page?: LazyExoticComponent<ComponentType<any>>;
|
|
354
440
|
})[];
|
|
355
441
|
fallback?: JSX.Element;
|
|
356
442
|
notFound?: JSX.Element;
|
|
357
|
-
}
|
|
443
|
+
}
|
|
358
444
|
/**
|
|
359
445
|
* Routes with lazy loading and 404 page.
|
|
360
446
|
*
|
|
@@ -376,38 +462,7 @@ type RoutesProps = {
|
|
|
376
462
|
*/
|
|
377
463
|
declare function Routes(props: RoutesProps): JSX.Element;
|
|
378
464
|
|
|
379
|
-
|
|
380
|
-
optionsType?: 'auto';
|
|
381
|
-
/** @deprecated use render */
|
|
382
|
-
children?: JSX.Element | null;
|
|
383
|
-
object?: TableItemProps[];
|
|
384
|
-
} & FaasItemProps & Omit<TableColumnProps<T>, 'children'>;
|
|
385
|
-
type ExtendTableTypeProps = {
|
|
386
|
-
children?: JSX.Element | null;
|
|
387
|
-
render?: (value: any, values: any, index: number) => JSX.Element | string | number | boolean | null;
|
|
388
|
-
};
|
|
389
|
-
type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
|
|
390
|
-
type TableProps<T = any, ExtendTypes = any> = {
|
|
391
|
-
items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
|
|
392
|
-
extendTypes?: {
|
|
393
|
-
[key: string]: ExtendTableTypeProps;
|
|
394
|
-
};
|
|
395
|
-
faasData?: FaasDataWrapperProps<T>;
|
|
396
|
-
onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
|
|
397
|
-
pagination: TablePaginationConfig;
|
|
398
|
-
filters: Record<string, FilterValue | null>;
|
|
399
|
-
sorter: SorterResult<T> | SorterResult<T>[];
|
|
400
|
-
extra: TableCurrentDataSource<T>;
|
|
401
|
-
};
|
|
402
|
-
} & TableProps$1<T>;
|
|
403
|
-
/**
|
|
404
|
-
* Table component with Ant Design & FaasJS
|
|
405
|
-
*
|
|
406
|
-
* @ref https://ant.design/components/table/
|
|
407
|
-
*/
|
|
408
|
-
declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
|
|
409
|
-
|
|
410
|
-
type TitleProps = {
|
|
465
|
+
interface TitleProps {
|
|
411
466
|
title: string | string[];
|
|
412
467
|
/** ` - ` as default */
|
|
413
468
|
separator?: string;
|
|
@@ -421,7 +476,7 @@ type TitleProps = {
|
|
|
421
476
|
plain?: boolean;
|
|
422
477
|
/** return children */
|
|
423
478
|
children?: JSX.Element;
|
|
424
|
-
}
|
|
479
|
+
}
|
|
425
480
|
/**
|
|
426
481
|
* Title is used to change the title of the page.
|
|
427
482
|
* Return null by default.
|
|
@@ -441,4 +496,4 @@ type TitleProps = {
|
|
|
441
496
|
*/
|
|
442
497
|
declare function Title(props: TitleProps): JSX.Element;
|
|
443
498
|
|
|
444
|
-
export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Link, LinkProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|
|
499
|
+
export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|