@faasjs/ant-design 0.0.3-beta.4 → 0.0.3-beta.41
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 +221 -258
- package/dist/index.d.ts +259 -201
- package/dist/index.js +466 -278
- package/dist/index.mjs +487 -303
- 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,48 @@ 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
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* convert options to { label, value }[]
|
|
263
|
+
*/
|
|
113
264
|
declare function transferOptions(options: BaseOption[]): {
|
|
114
265
|
label: string;
|
|
115
266
|
value?: string | number;
|
|
116
267
|
}[];
|
|
117
268
|
declare function transferValue(type: FaasItemType, value: any): any;
|
|
118
|
-
|
|
119
|
-
type
|
|
120
|
-
|
|
121
|
-
|
|
269
|
+
type UnionScene = 'form' | 'description' | 'table';
|
|
270
|
+
type UnionFaasItemInjection<Value = any, Values = any> = {
|
|
271
|
+
scene?: UnionScene;
|
|
272
|
+
value?: Value;
|
|
273
|
+
values?: Values;
|
|
274
|
+
index?: number;
|
|
122
275
|
};
|
|
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;
|
|
276
|
+
type UnionFaasItemRender<Value = any, Values = any> = (value: Value, values: Values, index: number, scene: UnionScene) => JSX.Element | null;
|
|
277
|
+
type UnionFaasItemElement<Value = any, Values = any> = ReactElement<UnionFaasItemInjection<Value, Values>> | null;
|
|
278
|
+
interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, DescriptionItemProps, TableItemProps {
|
|
279
|
+
children?: UnionFaasItemElement<UnionFaasItemProps<Value, Values>> | null;
|
|
280
|
+
render?: UnionFaasItemRender;
|
|
281
|
+
object?: UnionFaasItemProps<Value, Values>[];
|
|
282
|
+
}
|
|
141
283
|
|
|
142
|
-
|
|
284
|
+
interface DrawerProps extends DrawerProps$1 {
|
|
143
285
|
children?: JSX.Element | JSX.Element[];
|
|
144
|
-
}
|
|
286
|
+
}
|
|
145
287
|
type setDrawerProps = (changes: Partial<DrawerProps>) => void;
|
|
146
288
|
/**
|
|
147
289
|
* Hook style drawer.
|
|
290
|
+
*
|
|
148
291
|
* @param init initial props
|
|
149
292
|
*
|
|
150
293
|
* ```ts
|
|
@@ -166,134 +309,71 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
166
309
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
167
310
|
};
|
|
168
311
|
|
|
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> = {
|
|
312
|
+
interface ErrorBoundaryProps {
|
|
313
|
+
message?: ReactNode;
|
|
314
|
+
description?: ReactNode;
|
|
228
315
|
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;
|
|
316
|
+
onError?: (error: Error | null, info: any) => ReactNode;
|
|
317
|
+
}
|
|
318
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
|
|
319
|
+
error?: Error | null;
|
|
320
|
+
info?: {
|
|
321
|
+
componentStack?: string;
|
|
322
|
+
};
|
|
323
|
+
}> {
|
|
324
|
+
constructor(props: ErrorBoundaryProps);
|
|
325
|
+
componentDidCatch(error: Error | null, info: any): void;
|
|
326
|
+
render(): string | number | boolean | react.ReactFragment | JSX.Element;
|
|
327
|
+
}
|
|
252
328
|
|
|
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
|
-
};
|
|
329
|
+
type FormSubmitProps = {
|
|
330
|
+
/** Default: Submit */
|
|
331
|
+
text?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Submit to FaasJS server.
|
|
334
|
+
*
|
|
335
|
+
* If use onFinish, you should call submit manually.
|
|
336
|
+
* ```ts
|
|
337
|
+
* {
|
|
338
|
+
* submit: {
|
|
339
|
+
* to: {
|
|
340
|
+
* action: 'action_name'
|
|
341
|
+
* }
|
|
342
|
+
* },
|
|
343
|
+
* onFinish: (values, submit) => {
|
|
344
|
+
* // do something before submit
|
|
345
|
+
*
|
|
346
|
+
* // submit
|
|
347
|
+
* await submit({
|
|
348
|
+
* ...values,
|
|
349
|
+
* extraProps: 'some extra props'
|
|
350
|
+
* })
|
|
351
|
+
*
|
|
352
|
+
* // do something after submit
|
|
353
|
+
* }
|
|
354
|
+
* }
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
to?: {
|
|
358
|
+
action: string;
|
|
359
|
+
/** params will overwrite form values before submit */
|
|
360
|
+
params?: Record<string, any>;
|
|
361
|
+
then?: (result: any) => void;
|
|
362
|
+
catch?: (error: any) => void;
|
|
363
|
+
finally?: () => void;
|
|
289
364
|
};
|
|
365
|
+
};
|
|
366
|
+
interface FormProps<Values extends Record<string, any> = any, ExtendItemProps = any> extends Omit<FormProps$1<Values>, 'onFinish' | 'children' | 'initialValues'> {
|
|
367
|
+
items?: (FormItemProps | ExtendItemProps | JSX.Element)[];
|
|
368
|
+
/** Default: { text: 'Submit' }, set false to disable it */
|
|
369
|
+
submit?: false | FormSubmitProps;
|
|
290
370
|
onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
|
|
291
371
|
beforeItems?: JSX.Element | JSX.Element[];
|
|
292
372
|
footer?: JSX.Element | JSX.Element[];
|
|
293
373
|
extendTypes?: ExtendTypes;
|
|
294
374
|
children?: ReactNode;
|
|
295
375
|
initialValues?: Values;
|
|
296
|
-
}
|
|
376
|
+
}
|
|
297
377
|
/**
|
|
298
378
|
* Form component with Ant Design & FaasJS
|
|
299
379
|
*
|
|
@@ -302,30 +382,39 @@ type FormProps<Values extends Record<string, any> = any, ExtendItemProps = any>
|
|
|
302
382
|
declare function Form<Values = any>(props: FormProps<Values>): JSX.Element;
|
|
303
383
|
declare namespace Form {
|
|
304
384
|
var useForm: typeof antd_es_form_Form.useForm;
|
|
385
|
+
var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
|
|
386
|
+
var useWatch: typeof rc_field_form_es_useWatch.default;
|
|
387
|
+
var Item: typeof FormItem;
|
|
388
|
+
var List: react.FC<antd_es_form.FormListProps>;
|
|
389
|
+
var ErrorList: typeof antd_es_form_ErrorList.default;
|
|
390
|
+
var Provider: react.FC<antd_es_form_context.FormProviderProps>;
|
|
305
391
|
}
|
|
306
392
|
|
|
307
|
-
|
|
393
|
+
interface LinkProps {
|
|
308
394
|
href: string;
|
|
309
395
|
target?: string;
|
|
310
396
|
text?: string | number;
|
|
311
397
|
children?: ReactNode;
|
|
312
398
|
style?: CSSProperties;
|
|
313
399
|
button?: ButtonProps;
|
|
314
|
-
|
|
400
|
+
block?: boolean;
|
|
401
|
+
}
|
|
315
402
|
/**
|
|
403
|
+
* Link component with button.
|
|
404
|
+
*
|
|
316
405
|
* ```ts
|
|
317
406
|
* // pure link
|
|
318
407
|
* <Link href="/">Home</Link>
|
|
319
408
|
*
|
|
320
409
|
* // link with button
|
|
321
|
-
* <Link href="/" button={{type:'primary'}}>Home</Link>
|
|
410
|
+
* <Link href="/" button={{ type:'primary' }}>Home</Link>
|
|
322
411
|
* ```
|
|
323
412
|
*/
|
|
324
|
-
declare function Link(
|
|
413
|
+
declare function Link(props: LinkProps): JSX.Element;
|
|
325
414
|
|
|
326
|
-
|
|
415
|
+
interface ModalProps extends ModalProps$1 {
|
|
327
416
|
children?: JSX.Element | JSX.Element[] | string;
|
|
328
|
-
}
|
|
417
|
+
}
|
|
329
418
|
type setModalProps = (changes: Partial<ModalProps>) => void;
|
|
330
419
|
/**
|
|
331
420
|
* Hook style modal.
|
|
@@ -348,13 +437,13 @@ declare function useModal(init?: ModalProps): {
|
|
|
348
437
|
};
|
|
349
438
|
|
|
350
439
|
declare function PageNotFound(): JSX.Element;
|
|
351
|
-
|
|
440
|
+
interface RoutesProps {
|
|
352
441
|
routes: (RouteProps & {
|
|
353
442
|
page?: LazyExoticComponent<ComponentType<any>>;
|
|
354
443
|
})[];
|
|
355
444
|
fallback?: JSX.Element;
|
|
356
445
|
notFound?: JSX.Element;
|
|
357
|
-
}
|
|
446
|
+
}
|
|
358
447
|
/**
|
|
359
448
|
* Routes with lazy loading and 404 page.
|
|
360
449
|
*
|
|
@@ -376,38 +465,7 @@ type RoutesProps = {
|
|
|
376
465
|
*/
|
|
377
466
|
declare function Routes(props: RoutesProps): JSX.Element;
|
|
378
467
|
|
|
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 = {
|
|
468
|
+
interface TitleProps {
|
|
411
469
|
title: string | string[];
|
|
412
470
|
/** ` - ` as default */
|
|
413
471
|
separator?: string;
|
|
@@ -421,7 +479,7 @@ type TitleProps = {
|
|
|
421
479
|
plain?: boolean;
|
|
422
480
|
/** return children */
|
|
423
481
|
children?: JSX.Element;
|
|
424
|
-
}
|
|
482
|
+
}
|
|
425
483
|
/**
|
|
426
484
|
* Title is used to change the title of the page.
|
|
427
485
|
* Return null by default.
|
|
@@ -441,4 +499,4 @@ type TitleProps = {
|
|
|
441
499
|
*/
|
|
442
500
|
declare function Title(props: TitleProps): JSX.Element;
|
|
443
501
|
|
|
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 };
|
|
502
|
+
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 };
|