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