@faasjs/ant-design 3.7.0-beta.3 → 3.7.0-beta.4
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 +173 -173
- package/dist/index.d.ts +173 -173
- package/dist/index.js +81 -81
- package/dist/index.mjs +82 -82
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FaasReactClientOptions, ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
2
2
|
export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, ConfigProviderProps as ConfigProviderProps$1, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
|
|
5
4
|
import { StyleProviderProps } from '@ant-design/cssinjs';
|
|
5
|
+
import { DrawerProps as DrawerProps$1, ModalProps as ModalProps$1, ConfigProviderProps as ConfigProviderProps$1, DescriptionsProps, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
|
|
6
6
|
import { MessageInstance } from 'antd/es/message/interface';
|
|
7
7
|
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
8
|
+
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
9
|
+
import * as react from 'react';
|
|
10
|
+
import { CSSProperties, Dispatch, SetStateAction, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
11
|
+
export { lazy } from 'react';
|
|
8
12
|
import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
|
|
9
13
|
import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
|
|
10
14
|
import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
|
|
11
|
-
import * as react from 'react';
|
|
12
|
-
import { Dispatch, SetStateAction, CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
13
|
-
export { lazy } from 'react';
|
|
14
|
-
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
15
15
|
import { Dayjs } from 'dayjs';
|
|
16
|
+
import { FaasAction } from '@faasjs/types';
|
|
16
17
|
import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
|
|
17
18
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
18
|
-
import { FaasAction } from '@faasjs/types';
|
|
19
19
|
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
|
|
20
20
|
import * as antd_es_form_context from 'antd/es/form/context';
|
|
21
21
|
import * as antd_es_form from 'antd/es/form';
|
|
@@ -24,35 +24,57 @@ import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormI
|
|
|
24
24
|
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
25
25
|
import { Tab } from 'rc-tabs/es/interface';
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
interface ConfigProviderProps {
|
|
28
|
+
faasClientOptions?: FaasReactClientOptions;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
theme?: {
|
|
31
|
+
lang?: string;
|
|
32
|
+
common?: {
|
|
33
|
+
blank?: string;
|
|
34
|
+
all?: string;
|
|
35
|
+
submit?: string;
|
|
36
|
+
pageNotFound?: string;
|
|
37
|
+
add?: string;
|
|
38
|
+
delete?: string;
|
|
39
|
+
required?: string;
|
|
40
|
+
search?: string;
|
|
41
|
+
reset?: string;
|
|
42
|
+
};
|
|
43
|
+
Blank?: {
|
|
44
|
+
text?: string;
|
|
45
|
+
};
|
|
46
|
+
Form?: {
|
|
47
|
+
submit?: {
|
|
48
|
+
text?: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
Title?: {
|
|
52
|
+
/** ' - ' as default */
|
|
53
|
+
separator?: string;
|
|
54
|
+
suffix?: string;
|
|
55
|
+
};
|
|
56
|
+
Link?: {
|
|
57
|
+
/** '_blank' as default */
|
|
58
|
+
target?: string;
|
|
59
|
+
style?: CSSProperties;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
35
62
|
}
|
|
36
|
-
|
|
63
|
+
declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
|
|
37
64
|
/**
|
|
38
|
-
*
|
|
65
|
+
* Config for `@faasjs/ant-design` components.
|
|
39
66
|
*
|
|
67
|
+
* @example
|
|
40
68
|
* ```tsx
|
|
41
|
-
*
|
|
42
|
-
* const { modal, setModalProps } = useModal()
|
|
69
|
+
* import { ConfigProvider } from '@faasjs/ant-design'
|
|
43
70
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* </>
|
|
48
|
-
* }
|
|
71
|
+
* <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
|
|
72
|
+
* <Blank />
|
|
73
|
+
* </ConfigProvider>
|
|
49
74
|
* ```
|
|
50
75
|
*/
|
|
51
|
-
declare function
|
|
52
|
-
|
|
53
|
-
modalProps: ModalProps;
|
|
54
|
-
setModalProps: setModalProps;
|
|
55
|
-
};
|
|
76
|
+
declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
77
|
+
declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
56
78
|
|
|
57
79
|
declare const Drawer: React.FC<DrawerProps> & {
|
|
58
80
|
whyDidYouRender?: boolean;
|
|
@@ -91,57 +113,35 @@ declare namespace ErrorBoundary {
|
|
|
91
113
|
var whyDidYouRender: boolean;
|
|
92
114
|
}
|
|
93
115
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
submit?: string;
|
|
103
|
-
pageNotFound?: string;
|
|
104
|
-
add?: string;
|
|
105
|
-
delete?: string;
|
|
106
|
-
required?: string;
|
|
107
|
-
search?: string;
|
|
108
|
-
reset?: string;
|
|
109
|
-
};
|
|
110
|
-
Blank?: {
|
|
111
|
-
text?: string;
|
|
112
|
-
};
|
|
113
|
-
Form?: {
|
|
114
|
-
submit?: {
|
|
115
|
-
text?: string;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
Title?: {
|
|
119
|
-
/** ' - ' as default */
|
|
120
|
-
separator?: string;
|
|
121
|
-
suffix?: string;
|
|
122
|
-
};
|
|
123
|
-
Link?: {
|
|
124
|
-
/** '_blank' as default */
|
|
125
|
-
target?: string;
|
|
126
|
-
style?: CSSProperties;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
116
|
+
declare const Modal: react.FC<ModalProps$1> & antd_es_modal_confirm.ModalStaticFunctions & {
|
|
117
|
+
useModal: typeof antd_es_modal_useModal.default;
|
|
118
|
+
destroyAll: () => void;
|
|
119
|
+
config: typeof antd_es_modal_confirm.modalGlobalConfig;
|
|
120
|
+
_InternalPanelDoNotUseOrYouWillBeFired: (props: antd_es_modal_PurePanel.PurePanelProps) => React.JSX.Element;
|
|
121
|
+
};
|
|
122
|
+
interface ModalProps extends ModalProps$1 {
|
|
123
|
+
children?: JSX.Element | JSX.Element[] | string;
|
|
129
124
|
}
|
|
130
|
-
|
|
125
|
+
type setModalProps = Dispatch<SetStateAction<ModalProps>>;
|
|
131
126
|
/**
|
|
132
|
-
*
|
|
127
|
+
* Hook style modal
|
|
133
128
|
*
|
|
134
|
-
* @example
|
|
135
129
|
* ```tsx
|
|
136
|
-
*
|
|
130
|
+
* function Example() {
|
|
131
|
+
* const { modal, setModalProps } = useModal()
|
|
137
132
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
133
|
+
* return <>
|
|
134
|
+
* <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
|
|
135
|
+
* {modal}
|
|
136
|
+
* </>
|
|
137
|
+
* }
|
|
141
138
|
* ```
|
|
142
139
|
*/
|
|
143
|
-
declare function
|
|
144
|
-
|
|
140
|
+
declare function useModal(init?: ModalProps): {
|
|
141
|
+
modal: react_jsx_runtime.JSX.Element;
|
|
142
|
+
modalProps: ModalProps;
|
|
143
|
+
setModalProps: setModalProps;
|
|
144
|
+
};
|
|
145
145
|
|
|
146
146
|
interface AppProps {
|
|
147
147
|
children: React.ReactNode;
|
|
@@ -236,106 +236,6 @@ declare namespace Blank {
|
|
|
236
236
|
var whyDidYouRender: boolean;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
type ExtendFormTypeProps<T = any> = {
|
|
240
|
-
children?: UnionFaasItemElement<T>;
|
|
241
|
-
};
|
|
242
|
-
type ExtendTypes = {
|
|
243
|
-
[type: string]: ExtendFormTypeProps;
|
|
244
|
-
};
|
|
245
|
-
type InputTypeMap<T> = {
|
|
246
|
-
string: InputProps | SelectProps<T> | RadioProps;
|
|
247
|
-
'string[]': InputProps | SelectProps<T> | RadioProps;
|
|
248
|
-
number: InputNumberProps | SelectProps<T> | RadioProps;
|
|
249
|
-
'number[]': InputNumberProps | SelectProps<T> | RadioProps;
|
|
250
|
-
boolean: SwitchProps;
|
|
251
|
-
date: DatePickerProps;
|
|
252
|
-
time: DatePickerProps;
|
|
253
|
-
object: never;
|
|
254
|
-
'object[]': never;
|
|
255
|
-
};
|
|
256
|
-
interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
257
|
-
type?: FaasItemType;
|
|
258
|
-
input?: InputTypeMap<T>[FaasItemType];
|
|
259
|
-
maxCount?: number;
|
|
260
|
-
object?: FormItemProps[];
|
|
261
|
-
disabled?: boolean;
|
|
262
|
-
required?: boolean;
|
|
263
|
-
col?: number;
|
|
264
|
-
children?: UnionFaasItemElement<T>;
|
|
265
|
-
formChildren?: UnionFaasItemElement<T>;
|
|
266
|
-
render?: UnionFaasItemRender<T>;
|
|
267
|
-
formRender?: UnionFaasItemRender<T>;
|
|
268
|
-
rules?: RuleObject[];
|
|
269
|
-
label?: string | false;
|
|
270
|
-
extendTypes?: ExtendTypes;
|
|
271
|
-
/** trigger when current item's value changed */
|
|
272
|
-
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
273
|
-
/** trigger when any item's value changed */
|
|
274
|
-
if?: (values: Record<string, any>) => boolean;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Extend custom form item types.
|
|
278
|
-
*
|
|
279
|
-
* @example
|
|
280
|
-
* ```ts
|
|
281
|
-
* import type { ExtendFormItemProps, FormProps } from '@faasjs/ant-design'
|
|
282
|
-
*
|
|
283
|
-
* // define custom type
|
|
284
|
-
* interface ExtendTypes extends ExtendFormItemProps {
|
|
285
|
-
* type: 'password'
|
|
286
|
-
* }
|
|
287
|
-
*
|
|
288
|
-
* // extend form
|
|
289
|
-
* function ExtendForm(props: FormProps<any, ExtendTypes>) {
|
|
290
|
-
* return (
|
|
291
|
-
* <Form
|
|
292
|
-
* {...props}
|
|
293
|
-
* extendTypes={{ password: { children: <Input.Password /> } }}
|
|
294
|
-
* />
|
|
295
|
-
* )
|
|
296
|
-
* }
|
|
297
|
-
*
|
|
298
|
-
* // use custom type
|
|
299
|
-
* <ExtendForm
|
|
300
|
-
* items={[
|
|
301
|
-
* {
|
|
302
|
-
* id: 'test',
|
|
303
|
-
* type: 'password',
|
|
304
|
-
* },
|
|
305
|
-
* ]}
|
|
306
|
-
* />
|
|
307
|
-
* ```
|
|
308
|
-
*/
|
|
309
|
-
interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
|
|
310
|
-
type?: string;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* FormItem
|
|
314
|
-
*
|
|
315
|
-
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
316
|
-
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* ```tsx
|
|
320
|
-
* // use inline type
|
|
321
|
-
* <FormItem type='string' id='name' />
|
|
322
|
-
*
|
|
323
|
-
* // use custom type
|
|
324
|
-
* <FormItem id='password'>
|
|
325
|
-
* <Input.Password />
|
|
326
|
-
* </>
|
|
327
|
-
* ```
|
|
328
|
-
*/
|
|
329
|
-
declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
|
|
330
|
-
declare namespace FormItem {
|
|
331
|
-
var whyDidYouRender: boolean;
|
|
332
|
-
var useStatus: () => {
|
|
333
|
-
status?: antd_es_form_FormItem.ValidateStatus;
|
|
334
|
-
errors: React.ReactNode[];
|
|
335
|
-
warnings: React.ReactNode[];
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
239
|
type LoadingProps = {
|
|
340
240
|
style?: React.CSSProperties;
|
|
341
241
|
size?: 'small' | 'default' | 'large';
|
|
@@ -451,6 +351,106 @@ declare namespace Description {
|
|
|
451
351
|
var whyDidYouRender: boolean;
|
|
452
352
|
}
|
|
453
353
|
|
|
354
|
+
type ExtendFormTypeProps<T = any> = {
|
|
355
|
+
children?: UnionFaasItemElement<T>;
|
|
356
|
+
};
|
|
357
|
+
type ExtendTypes = {
|
|
358
|
+
[type: string]: ExtendFormTypeProps;
|
|
359
|
+
};
|
|
360
|
+
type InputTypeMap<T> = {
|
|
361
|
+
string: InputProps | SelectProps<T> | RadioProps;
|
|
362
|
+
'string[]': InputProps | SelectProps<T> | RadioProps;
|
|
363
|
+
number: InputNumberProps | SelectProps<T> | RadioProps;
|
|
364
|
+
'number[]': InputNumberProps | SelectProps<T> | RadioProps;
|
|
365
|
+
boolean: SwitchProps;
|
|
366
|
+
date: DatePickerProps;
|
|
367
|
+
time: DatePickerProps;
|
|
368
|
+
object: never;
|
|
369
|
+
'object[]': never;
|
|
370
|
+
};
|
|
371
|
+
interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
372
|
+
type?: FaasItemType;
|
|
373
|
+
input?: InputTypeMap<T>[FaasItemType];
|
|
374
|
+
maxCount?: number;
|
|
375
|
+
object?: FormItemProps[];
|
|
376
|
+
disabled?: boolean;
|
|
377
|
+
required?: boolean;
|
|
378
|
+
col?: number;
|
|
379
|
+
children?: UnionFaasItemElement<T>;
|
|
380
|
+
formChildren?: UnionFaasItemElement<T>;
|
|
381
|
+
render?: UnionFaasItemRender<T>;
|
|
382
|
+
formRender?: UnionFaasItemRender<T>;
|
|
383
|
+
rules?: RuleObject[];
|
|
384
|
+
label?: string | false;
|
|
385
|
+
extendTypes?: ExtendTypes;
|
|
386
|
+
/** trigger when current item's value changed */
|
|
387
|
+
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
388
|
+
/** trigger when any item's value changed */
|
|
389
|
+
if?: (values: Record<string, any>) => boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Extend custom form item types.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* import type { ExtendFormItemProps, FormProps } from '@faasjs/ant-design'
|
|
397
|
+
*
|
|
398
|
+
* // define custom type
|
|
399
|
+
* interface ExtendTypes extends ExtendFormItemProps {
|
|
400
|
+
* type: 'password'
|
|
401
|
+
* }
|
|
402
|
+
*
|
|
403
|
+
* // extend form
|
|
404
|
+
* function ExtendForm(props: FormProps<any, ExtendTypes>) {
|
|
405
|
+
* return (
|
|
406
|
+
* <Form
|
|
407
|
+
* {...props}
|
|
408
|
+
* extendTypes={{ password: { children: <Input.Password /> } }}
|
|
409
|
+
* />
|
|
410
|
+
* )
|
|
411
|
+
* }
|
|
412
|
+
*
|
|
413
|
+
* // use custom type
|
|
414
|
+
* <ExtendForm
|
|
415
|
+
* items={[
|
|
416
|
+
* {
|
|
417
|
+
* id: 'test',
|
|
418
|
+
* type: 'password',
|
|
419
|
+
* },
|
|
420
|
+
* ]}
|
|
421
|
+
* />
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
|
|
425
|
+
type?: string;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* FormItem
|
|
429
|
+
*
|
|
430
|
+
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
431
|
+
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```tsx
|
|
435
|
+
* // use inline type
|
|
436
|
+
* <FormItem type='string' id='name' />
|
|
437
|
+
*
|
|
438
|
+
* // use custom type
|
|
439
|
+
* <FormItem id='password'>
|
|
440
|
+
* <Input.Password />
|
|
441
|
+
* </>
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
|
|
445
|
+
declare namespace FormItem {
|
|
446
|
+
var whyDidYouRender: boolean;
|
|
447
|
+
var useStatus: () => {
|
|
448
|
+
status?: antd_es_form_FormItem.ValidateStatus;
|
|
449
|
+
errors: React.ReactNode[];
|
|
450
|
+
warnings: React.ReactNode[];
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
|
|
454
454
|
interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
|
|
455
455
|
optionsType?: 'auto';
|
|
456
456
|
children?: UnionFaasItemElement<T>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FaasReactClientOptions, ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
2
2
|
export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, ConfigProviderProps as ConfigProviderProps$1, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
|
|
5
4
|
import { StyleProviderProps } from '@ant-design/cssinjs';
|
|
5
|
+
import { DrawerProps as DrawerProps$1, ModalProps as ModalProps$1, ConfigProviderProps as ConfigProviderProps$1, DescriptionsProps, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
|
|
6
6
|
import { MessageInstance } from 'antd/es/message/interface';
|
|
7
7
|
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
8
|
+
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
9
|
+
import * as react from 'react';
|
|
10
|
+
import { CSSProperties, Dispatch, SetStateAction, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
11
|
+
export { lazy } from 'react';
|
|
8
12
|
import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
|
|
9
13
|
import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
|
|
10
14
|
import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
|
|
11
|
-
import * as react from 'react';
|
|
12
|
-
import { Dispatch, SetStateAction, CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
13
|
-
export { lazy } from 'react';
|
|
14
|
-
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
15
15
|
import { Dayjs } from 'dayjs';
|
|
16
|
+
import { FaasAction } from '@faasjs/types';
|
|
16
17
|
import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
|
|
17
18
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
18
|
-
import { FaasAction } from '@faasjs/types';
|
|
19
19
|
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
|
|
20
20
|
import * as antd_es_form_context from 'antd/es/form/context';
|
|
21
21
|
import * as antd_es_form from 'antd/es/form';
|
|
@@ -24,35 +24,57 @@ import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormI
|
|
|
24
24
|
import * as antd_es_form_Form from 'antd/es/form/Form';
|
|
25
25
|
import { Tab } from 'rc-tabs/es/interface';
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
interface ConfigProviderProps {
|
|
28
|
+
faasClientOptions?: FaasReactClientOptions;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
theme?: {
|
|
31
|
+
lang?: string;
|
|
32
|
+
common?: {
|
|
33
|
+
blank?: string;
|
|
34
|
+
all?: string;
|
|
35
|
+
submit?: string;
|
|
36
|
+
pageNotFound?: string;
|
|
37
|
+
add?: string;
|
|
38
|
+
delete?: string;
|
|
39
|
+
required?: string;
|
|
40
|
+
search?: string;
|
|
41
|
+
reset?: string;
|
|
42
|
+
};
|
|
43
|
+
Blank?: {
|
|
44
|
+
text?: string;
|
|
45
|
+
};
|
|
46
|
+
Form?: {
|
|
47
|
+
submit?: {
|
|
48
|
+
text?: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
Title?: {
|
|
52
|
+
/** ' - ' as default */
|
|
53
|
+
separator?: string;
|
|
54
|
+
suffix?: string;
|
|
55
|
+
};
|
|
56
|
+
Link?: {
|
|
57
|
+
/** '_blank' as default */
|
|
58
|
+
target?: string;
|
|
59
|
+
style?: CSSProperties;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
35
62
|
}
|
|
36
|
-
|
|
63
|
+
declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
|
|
37
64
|
/**
|
|
38
|
-
*
|
|
65
|
+
* Config for `@faasjs/ant-design` components.
|
|
39
66
|
*
|
|
67
|
+
* @example
|
|
40
68
|
* ```tsx
|
|
41
|
-
*
|
|
42
|
-
* const { modal, setModalProps } = useModal()
|
|
69
|
+
* import { ConfigProvider } from '@faasjs/ant-design'
|
|
43
70
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* </>
|
|
48
|
-
* }
|
|
71
|
+
* <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
|
|
72
|
+
* <Blank />
|
|
73
|
+
* </ConfigProvider>
|
|
49
74
|
* ```
|
|
50
75
|
*/
|
|
51
|
-
declare function
|
|
52
|
-
|
|
53
|
-
modalProps: ModalProps;
|
|
54
|
-
setModalProps: setModalProps;
|
|
55
|
-
};
|
|
76
|
+
declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
77
|
+
declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
56
78
|
|
|
57
79
|
declare const Drawer: React.FC<DrawerProps> & {
|
|
58
80
|
whyDidYouRender?: boolean;
|
|
@@ -91,57 +113,35 @@ declare namespace ErrorBoundary {
|
|
|
91
113
|
var whyDidYouRender: boolean;
|
|
92
114
|
}
|
|
93
115
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
submit?: string;
|
|
103
|
-
pageNotFound?: string;
|
|
104
|
-
add?: string;
|
|
105
|
-
delete?: string;
|
|
106
|
-
required?: string;
|
|
107
|
-
search?: string;
|
|
108
|
-
reset?: string;
|
|
109
|
-
};
|
|
110
|
-
Blank?: {
|
|
111
|
-
text?: string;
|
|
112
|
-
};
|
|
113
|
-
Form?: {
|
|
114
|
-
submit?: {
|
|
115
|
-
text?: string;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
Title?: {
|
|
119
|
-
/** ' - ' as default */
|
|
120
|
-
separator?: string;
|
|
121
|
-
suffix?: string;
|
|
122
|
-
};
|
|
123
|
-
Link?: {
|
|
124
|
-
/** '_blank' as default */
|
|
125
|
-
target?: string;
|
|
126
|
-
style?: CSSProperties;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
116
|
+
declare const Modal: react.FC<ModalProps$1> & antd_es_modal_confirm.ModalStaticFunctions & {
|
|
117
|
+
useModal: typeof antd_es_modal_useModal.default;
|
|
118
|
+
destroyAll: () => void;
|
|
119
|
+
config: typeof antd_es_modal_confirm.modalGlobalConfig;
|
|
120
|
+
_InternalPanelDoNotUseOrYouWillBeFired: (props: antd_es_modal_PurePanel.PurePanelProps) => React.JSX.Element;
|
|
121
|
+
};
|
|
122
|
+
interface ModalProps extends ModalProps$1 {
|
|
123
|
+
children?: JSX.Element | JSX.Element[] | string;
|
|
129
124
|
}
|
|
130
|
-
|
|
125
|
+
type setModalProps = Dispatch<SetStateAction<ModalProps>>;
|
|
131
126
|
/**
|
|
132
|
-
*
|
|
127
|
+
* Hook style modal
|
|
133
128
|
*
|
|
134
|
-
* @example
|
|
135
129
|
* ```tsx
|
|
136
|
-
*
|
|
130
|
+
* function Example() {
|
|
131
|
+
* const { modal, setModalProps } = useModal()
|
|
137
132
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
133
|
+
* return <>
|
|
134
|
+
* <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button>
|
|
135
|
+
* {modal}
|
|
136
|
+
* </>
|
|
137
|
+
* }
|
|
141
138
|
* ```
|
|
142
139
|
*/
|
|
143
|
-
declare function
|
|
144
|
-
|
|
140
|
+
declare function useModal(init?: ModalProps): {
|
|
141
|
+
modal: react_jsx_runtime.JSX.Element;
|
|
142
|
+
modalProps: ModalProps;
|
|
143
|
+
setModalProps: setModalProps;
|
|
144
|
+
};
|
|
145
145
|
|
|
146
146
|
interface AppProps {
|
|
147
147
|
children: React.ReactNode;
|
|
@@ -236,106 +236,6 @@ declare namespace Blank {
|
|
|
236
236
|
var whyDidYouRender: boolean;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
type ExtendFormTypeProps<T = any> = {
|
|
240
|
-
children?: UnionFaasItemElement<T>;
|
|
241
|
-
};
|
|
242
|
-
type ExtendTypes = {
|
|
243
|
-
[type: string]: ExtendFormTypeProps;
|
|
244
|
-
};
|
|
245
|
-
type InputTypeMap<T> = {
|
|
246
|
-
string: InputProps | SelectProps<T> | RadioProps;
|
|
247
|
-
'string[]': InputProps | SelectProps<T> | RadioProps;
|
|
248
|
-
number: InputNumberProps | SelectProps<T> | RadioProps;
|
|
249
|
-
'number[]': InputNumberProps | SelectProps<T> | RadioProps;
|
|
250
|
-
boolean: SwitchProps;
|
|
251
|
-
date: DatePickerProps;
|
|
252
|
-
time: DatePickerProps;
|
|
253
|
-
object: never;
|
|
254
|
-
'object[]': never;
|
|
255
|
-
};
|
|
256
|
-
interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
257
|
-
type?: FaasItemType;
|
|
258
|
-
input?: InputTypeMap<T>[FaasItemType];
|
|
259
|
-
maxCount?: number;
|
|
260
|
-
object?: FormItemProps[];
|
|
261
|
-
disabled?: boolean;
|
|
262
|
-
required?: boolean;
|
|
263
|
-
col?: number;
|
|
264
|
-
children?: UnionFaasItemElement<T>;
|
|
265
|
-
formChildren?: UnionFaasItemElement<T>;
|
|
266
|
-
render?: UnionFaasItemRender<T>;
|
|
267
|
-
formRender?: UnionFaasItemRender<T>;
|
|
268
|
-
rules?: RuleObject[];
|
|
269
|
-
label?: string | false;
|
|
270
|
-
extendTypes?: ExtendTypes;
|
|
271
|
-
/** trigger when current item's value changed */
|
|
272
|
-
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
273
|
-
/** trigger when any item's value changed */
|
|
274
|
-
if?: (values: Record<string, any>) => boolean;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Extend custom form item types.
|
|
278
|
-
*
|
|
279
|
-
* @example
|
|
280
|
-
* ```ts
|
|
281
|
-
* import type { ExtendFormItemProps, FormProps } from '@faasjs/ant-design'
|
|
282
|
-
*
|
|
283
|
-
* // define custom type
|
|
284
|
-
* interface ExtendTypes extends ExtendFormItemProps {
|
|
285
|
-
* type: 'password'
|
|
286
|
-
* }
|
|
287
|
-
*
|
|
288
|
-
* // extend form
|
|
289
|
-
* function ExtendForm(props: FormProps<any, ExtendTypes>) {
|
|
290
|
-
* return (
|
|
291
|
-
* <Form
|
|
292
|
-
* {...props}
|
|
293
|
-
* extendTypes={{ password: { children: <Input.Password /> } }}
|
|
294
|
-
* />
|
|
295
|
-
* )
|
|
296
|
-
* }
|
|
297
|
-
*
|
|
298
|
-
* // use custom type
|
|
299
|
-
* <ExtendForm
|
|
300
|
-
* items={[
|
|
301
|
-
* {
|
|
302
|
-
* id: 'test',
|
|
303
|
-
* type: 'password',
|
|
304
|
-
* },
|
|
305
|
-
* ]}
|
|
306
|
-
* />
|
|
307
|
-
* ```
|
|
308
|
-
*/
|
|
309
|
-
interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
|
|
310
|
-
type?: string;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* FormItem
|
|
314
|
-
*
|
|
315
|
-
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
316
|
-
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* ```tsx
|
|
320
|
-
* // use inline type
|
|
321
|
-
* <FormItem type='string' id='name' />
|
|
322
|
-
*
|
|
323
|
-
* // use custom type
|
|
324
|
-
* <FormItem id='password'>
|
|
325
|
-
* <Input.Password />
|
|
326
|
-
* </>
|
|
327
|
-
* ```
|
|
328
|
-
*/
|
|
329
|
-
declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
|
|
330
|
-
declare namespace FormItem {
|
|
331
|
-
var whyDidYouRender: boolean;
|
|
332
|
-
var useStatus: () => {
|
|
333
|
-
status?: antd_es_form_FormItem.ValidateStatus;
|
|
334
|
-
errors: React.ReactNode[];
|
|
335
|
-
warnings: React.ReactNode[];
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
239
|
type LoadingProps = {
|
|
340
240
|
style?: React.CSSProperties;
|
|
341
241
|
size?: 'small' | 'default' | 'large';
|
|
@@ -451,6 +351,106 @@ declare namespace Description {
|
|
|
451
351
|
var whyDidYouRender: boolean;
|
|
452
352
|
}
|
|
453
353
|
|
|
354
|
+
type ExtendFormTypeProps<T = any> = {
|
|
355
|
+
children?: UnionFaasItemElement<T>;
|
|
356
|
+
};
|
|
357
|
+
type ExtendTypes = {
|
|
358
|
+
[type: string]: ExtendFormTypeProps;
|
|
359
|
+
};
|
|
360
|
+
type InputTypeMap<T> = {
|
|
361
|
+
string: InputProps | SelectProps<T> | RadioProps;
|
|
362
|
+
'string[]': InputProps | SelectProps<T> | RadioProps;
|
|
363
|
+
number: InputNumberProps | SelectProps<T> | RadioProps;
|
|
364
|
+
'number[]': InputNumberProps | SelectProps<T> | RadioProps;
|
|
365
|
+
boolean: SwitchProps;
|
|
366
|
+
date: DatePickerProps;
|
|
367
|
+
time: DatePickerProps;
|
|
368
|
+
object: never;
|
|
369
|
+
'object[]': never;
|
|
370
|
+
};
|
|
371
|
+
interface FormItemProps<T = any> extends BaseItemProps, Omit<FormItemProps$1<T>, 'id' | 'children' | 'render'> {
|
|
372
|
+
type?: FaasItemType;
|
|
373
|
+
input?: InputTypeMap<T>[FaasItemType];
|
|
374
|
+
maxCount?: number;
|
|
375
|
+
object?: FormItemProps[];
|
|
376
|
+
disabled?: boolean;
|
|
377
|
+
required?: boolean;
|
|
378
|
+
col?: number;
|
|
379
|
+
children?: UnionFaasItemElement<T>;
|
|
380
|
+
formChildren?: UnionFaasItemElement<T>;
|
|
381
|
+
render?: UnionFaasItemRender<T>;
|
|
382
|
+
formRender?: UnionFaasItemRender<T>;
|
|
383
|
+
rules?: RuleObject[];
|
|
384
|
+
label?: string | false;
|
|
385
|
+
extendTypes?: ExtendTypes;
|
|
386
|
+
/** trigger when current item's value changed */
|
|
387
|
+
onValueChange?: (value: T, values: any, form: FormInstance) => void;
|
|
388
|
+
/** trigger when any item's value changed */
|
|
389
|
+
if?: (values: Record<string, any>) => boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Extend custom form item types.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* import type { ExtendFormItemProps, FormProps } from '@faasjs/ant-design'
|
|
397
|
+
*
|
|
398
|
+
* // define custom type
|
|
399
|
+
* interface ExtendTypes extends ExtendFormItemProps {
|
|
400
|
+
* type: 'password'
|
|
401
|
+
* }
|
|
402
|
+
*
|
|
403
|
+
* // extend form
|
|
404
|
+
* function ExtendForm(props: FormProps<any, ExtendTypes>) {
|
|
405
|
+
* return (
|
|
406
|
+
* <Form
|
|
407
|
+
* {...props}
|
|
408
|
+
* extendTypes={{ password: { children: <Input.Password /> } }}
|
|
409
|
+
* />
|
|
410
|
+
* )
|
|
411
|
+
* }
|
|
412
|
+
*
|
|
413
|
+
* // use custom type
|
|
414
|
+
* <ExtendForm
|
|
415
|
+
* items={[
|
|
416
|
+
* {
|
|
417
|
+
* id: 'test',
|
|
418
|
+
* type: 'password',
|
|
419
|
+
* },
|
|
420
|
+
* ]}
|
|
421
|
+
* />
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
interface ExtendFormItemProps extends Omit<FormItemProps, 'type'> {
|
|
425
|
+
type?: string;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* FormItem
|
|
429
|
+
*
|
|
430
|
+
* - Based on [Ant Design Form.Item](https://ant.design/components/form#formitem).
|
|
431
|
+
* - Can be used without [Form](https://faasjs.com/doc/ant-design/#form).
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```tsx
|
|
435
|
+
* // use inline type
|
|
436
|
+
* <FormItem type='string' id='name' />
|
|
437
|
+
*
|
|
438
|
+
* // use custom type
|
|
439
|
+
* <FormItem id='password'>
|
|
440
|
+
* <Input.Password />
|
|
441
|
+
* </>
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
|
|
445
|
+
declare namespace FormItem {
|
|
446
|
+
var whyDidYouRender: boolean;
|
|
447
|
+
var useStatus: () => {
|
|
448
|
+
status?: antd_es_form_FormItem.ValidateStatus;
|
|
449
|
+
errors: React.ReactNode[];
|
|
450
|
+
warnings: React.ReactNode[];
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
|
|
454
454
|
interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
|
|
455
455
|
optionsType?: 'auto';
|
|
456
456
|
children?: UnionFaasItemElement<T>;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var react = require('@faasjs/react');
|
|
4
|
-
var antd = require('antd');
|
|
5
4
|
var cssinjs = require('@ant-design/cssinjs');
|
|
6
|
-
var
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var antd = require('antd');
|
|
8
6
|
var reactRouterDom = require('react-router-dom');
|
|
9
7
|
var lodashEs = require('lodash-es');
|
|
8
|
+
var react$1 = require('react');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var dayjs2 = require('dayjs');
|
|
11
11
|
var icons = require('@ant-design/icons');
|
|
12
12
|
|
|
@@ -15,84 +15,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
15
15
|
var dayjs2__default = /*#__PURE__*/_interopDefault(dayjs2);
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
|
-
var Modal = antd.Modal;
|
|
19
|
-
Modal.whyDidYouRender = true;
|
|
20
|
-
function useModal(init) {
|
|
21
|
-
const [props, setProps] = react$1.useState({ open: false, ...init });
|
|
22
|
-
const setModalProps = react.useEqualCallback(
|
|
23
|
-
(changes) => {
|
|
24
|
-
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
25
|
-
setProps((prev) => ({ ...prev, ...changed }));
|
|
26
|
-
},
|
|
27
|
-
[setProps]
|
|
28
|
-
);
|
|
29
|
-
return {
|
|
30
|
-
modal: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31
|
-
Modal,
|
|
32
|
-
{
|
|
33
|
-
onCancel: () => setProps((prev) => ({
|
|
34
|
-
...prev,
|
|
35
|
-
open: false
|
|
36
|
-
})),
|
|
37
|
-
...props
|
|
38
|
-
}
|
|
39
|
-
),
|
|
40
|
-
modalProps: props,
|
|
41
|
-
setModalProps
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
var Drawer = antd.Drawer;
|
|
45
|
-
Drawer.whyDidYouRender = true;
|
|
46
|
-
function useDrawer(init) {
|
|
47
|
-
const [props, setProps] = react$1.useState({
|
|
48
|
-
open: false,
|
|
49
|
-
...init
|
|
50
|
-
});
|
|
51
|
-
const setDrawerProps = react.useEqualCallback(
|
|
52
|
-
(changes) => {
|
|
53
|
-
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
54
|
-
setProps((prev) => ({ ...prev, ...changed }));
|
|
55
|
-
},
|
|
56
|
-
[setProps]
|
|
57
|
-
);
|
|
58
|
-
return {
|
|
59
|
-
drawer: /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
-
Drawer,
|
|
61
|
-
{
|
|
62
|
-
onClose: () => setProps((prev) => ({
|
|
63
|
-
...prev,
|
|
64
|
-
open: false
|
|
65
|
-
})),
|
|
66
|
-
...props
|
|
67
|
-
}
|
|
68
|
-
),
|
|
69
|
-
drawerProps: props,
|
|
70
|
-
setDrawerProps
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function ErrorChildren(props) {
|
|
74
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
-
antd.Alert,
|
|
76
|
-
{
|
|
77
|
-
type: "error",
|
|
78
|
-
message: props.errorMessage,
|
|
79
|
-
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
80
|
-
"pre",
|
|
81
|
-
{
|
|
82
|
-
style: {
|
|
83
|
-
fontSize: "0.9em",
|
|
84
|
-
overflowX: "auto"
|
|
85
|
-
},
|
|
86
|
-
children: props.errorDescription
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
function ErrorBoundary(props) {
|
|
93
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
94
|
-
}
|
|
95
|
-
ErrorBoundary.whyDidYouRender = true;
|
|
96
18
|
var zh = {
|
|
97
19
|
lang: "zh",
|
|
98
20
|
blank: "\u7A7A",
|
|
@@ -157,6 +79,84 @@ function ConfigProvider(props) {
|
|
|
157
79
|
function useConfigContext() {
|
|
158
80
|
return react$1.useContext(ConfigContext);
|
|
159
81
|
}
|
|
82
|
+
var Drawer = antd.Drawer;
|
|
83
|
+
Drawer.whyDidYouRender = true;
|
|
84
|
+
function useDrawer(init) {
|
|
85
|
+
const [props, setProps] = react$1.useState({
|
|
86
|
+
open: false,
|
|
87
|
+
...init
|
|
88
|
+
});
|
|
89
|
+
const setDrawerProps = react.useEqualCallback(
|
|
90
|
+
(changes) => {
|
|
91
|
+
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
92
|
+
setProps((prev) => ({ ...prev, ...changed }));
|
|
93
|
+
},
|
|
94
|
+
[setProps]
|
|
95
|
+
);
|
|
96
|
+
return {
|
|
97
|
+
drawer: /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
Drawer,
|
|
99
|
+
{
|
|
100
|
+
onClose: () => setProps((prev) => ({
|
|
101
|
+
...prev,
|
|
102
|
+
open: false
|
|
103
|
+
})),
|
|
104
|
+
...props
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
drawerProps: props,
|
|
108
|
+
setDrawerProps
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function ErrorChildren(props) {
|
|
112
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
113
|
+
antd.Alert,
|
|
114
|
+
{
|
|
115
|
+
type: "error",
|
|
116
|
+
message: props.errorMessage,
|
|
117
|
+
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
"pre",
|
|
119
|
+
{
|
|
120
|
+
style: {
|
|
121
|
+
fontSize: "0.9em",
|
|
122
|
+
overflowX: "auto"
|
|
123
|
+
},
|
|
124
|
+
children: props.errorDescription
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function ErrorBoundary(props) {
|
|
131
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
132
|
+
}
|
|
133
|
+
ErrorBoundary.whyDidYouRender = true;
|
|
134
|
+
var Modal = antd.Modal;
|
|
135
|
+
Modal.whyDidYouRender = true;
|
|
136
|
+
function useModal(init) {
|
|
137
|
+
const [props, setProps] = react$1.useState({ open: false, ...init });
|
|
138
|
+
const setModalProps = react.useEqualCallback(
|
|
139
|
+
(changes) => {
|
|
140
|
+
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
141
|
+
setProps((prev) => ({ ...prev, ...changed }));
|
|
142
|
+
},
|
|
143
|
+
[setProps]
|
|
144
|
+
);
|
|
145
|
+
return {
|
|
146
|
+
modal: /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
+
Modal,
|
|
148
|
+
{
|
|
149
|
+
onCancel: () => setProps((prev) => ({
|
|
150
|
+
...prev,
|
|
151
|
+
open: false
|
|
152
|
+
})),
|
|
153
|
+
...props
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
modalProps: props,
|
|
157
|
+
setModalProps
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
160
|
var AppContext = react.createSplittingContext({
|
|
161
161
|
message: null,
|
|
162
162
|
notification: null,
|
package/dist/index.mjs
CHANGED
|
@@ -1,94 +1,16 @@
|
|
|
1
|
-
import { createSplittingContext, useEqualCallback, ErrorBoundary as ErrorBoundary$1,
|
|
1
|
+
import { createSplittingContext, useEqualEffect, FaasReactClient, useEqualCallback, ErrorBoundary as ErrorBoundary$1, useEqualMemo, OptionalWrapper, FaasDataWrapper as FaasDataWrapper$1, withFaasData as withFaasData$1, faas } from '@faasjs/react';
|
|
2
2
|
export { faas, useFaas } from '@faasjs/react';
|
|
3
|
-
import { Form as Form$1, Modal as Modal$1, Drawer as Drawer$1, message, notification, ConfigProvider as ConfigProvider$1, Typography, Spin, Descriptions, Input, Button, Row, Col, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Alert, Space } from 'antd';
|
|
4
3
|
import { legacyLogicalPropertiesTransformer, StyleProvider } from '@ant-design/cssinjs';
|
|
4
|
+
import { Form as Form$1, Drawer as Drawer$1, Modal as Modal$1, message, notification, ConfigProvider as ConfigProvider$1, Typography, Spin, Descriptions, Input, Button, Row, Col, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Alert, Space } from 'antd';
|
|
5
|
+
import { BrowserRouter, useNavigate, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
|
|
6
|
+
import { defaultsDeep, cloneDeep, isNil, uniqBy } from 'lodash-es';
|
|
5
7
|
import { createContext, useState, useContext, useEffect, cloneElement, Suspense } from 'react';
|
|
6
8
|
export { lazy } from 'react';
|
|
7
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { BrowserRouter, useNavigate, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
|
|
9
|
-
import { defaultsDeep, cloneDeep, isNil, uniqBy } from 'lodash-es';
|
|
10
10
|
import dayjs2 from 'dayjs';
|
|
11
11
|
import { PlusOutlined, MinusCircleOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
|
-
var Modal = Modal$1;
|
|
15
|
-
Modal.whyDidYouRender = true;
|
|
16
|
-
function useModal(init) {
|
|
17
|
-
const [props, setProps] = useState({ open: false, ...init });
|
|
18
|
-
const setModalProps = useEqualCallback(
|
|
19
|
-
(changes) => {
|
|
20
|
-
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
21
|
-
setProps((prev) => ({ ...prev, ...changed }));
|
|
22
|
-
},
|
|
23
|
-
[setProps]
|
|
24
|
-
);
|
|
25
|
-
return {
|
|
26
|
-
modal: /* @__PURE__ */ jsx(
|
|
27
|
-
Modal,
|
|
28
|
-
{
|
|
29
|
-
onCancel: () => setProps((prev) => ({
|
|
30
|
-
...prev,
|
|
31
|
-
open: false
|
|
32
|
-
})),
|
|
33
|
-
...props
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
modalProps: props,
|
|
37
|
-
setModalProps
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
var Drawer = Drawer$1;
|
|
41
|
-
Drawer.whyDidYouRender = true;
|
|
42
|
-
function useDrawer(init) {
|
|
43
|
-
const [props, setProps] = useState({
|
|
44
|
-
open: false,
|
|
45
|
-
...init
|
|
46
|
-
});
|
|
47
|
-
const setDrawerProps = useEqualCallback(
|
|
48
|
-
(changes) => {
|
|
49
|
-
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
50
|
-
setProps((prev) => ({ ...prev, ...changed }));
|
|
51
|
-
},
|
|
52
|
-
[setProps]
|
|
53
|
-
);
|
|
54
|
-
return {
|
|
55
|
-
drawer: /* @__PURE__ */ jsx(
|
|
56
|
-
Drawer,
|
|
57
|
-
{
|
|
58
|
-
onClose: () => setProps((prev) => ({
|
|
59
|
-
...prev,
|
|
60
|
-
open: false
|
|
61
|
-
})),
|
|
62
|
-
...props
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
drawerProps: props,
|
|
66
|
-
setDrawerProps
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function ErrorChildren(props) {
|
|
70
|
-
return /* @__PURE__ */ jsx(
|
|
71
|
-
Alert,
|
|
72
|
-
{
|
|
73
|
-
type: "error",
|
|
74
|
-
message: props.errorMessage,
|
|
75
|
-
description: /* @__PURE__ */ jsx(
|
|
76
|
-
"pre",
|
|
77
|
-
{
|
|
78
|
-
style: {
|
|
79
|
-
fontSize: "0.9em",
|
|
80
|
-
overflowX: "auto"
|
|
81
|
-
},
|
|
82
|
-
children: props.errorDescription
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
function ErrorBoundary(props) {
|
|
89
|
-
return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
|
|
90
|
-
}
|
|
91
|
-
ErrorBoundary.whyDidYouRender = true;
|
|
92
14
|
var zh = {
|
|
93
15
|
lang: "zh",
|
|
94
16
|
blank: "\u7A7A",
|
|
@@ -153,6 +75,84 @@ function ConfigProvider(props) {
|
|
|
153
75
|
function useConfigContext() {
|
|
154
76
|
return useContext(ConfigContext);
|
|
155
77
|
}
|
|
78
|
+
var Drawer = Drawer$1;
|
|
79
|
+
Drawer.whyDidYouRender = true;
|
|
80
|
+
function useDrawer(init) {
|
|
81
|
+
const [props, setProps] = useState({
|
|
82
|
+
open: false,
|
|
83
|
+
...init
|
|
84
|
+
});
|
|
85
|
+
const setDrawerProps = useEqualCallback(
|
|
86
|
+
(changes) => {
|
|
87
|
+
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
88
|
+
setProps((prev) => ({ ...prev, ...changed }));
|
|
89
|
+
},
|
|
90
|
+
[setProps]
|
|
91
|
+
);
|
|
92
|
+
return {
|
|
93
|
+
drawer: /* @__PURE__ */ jsx(
|
|
94
|
+
Drawer,
|
|
95
|
+
{
|
|
96
|
+
onClose: () => setProps((prev) => ({
|
|
97
|
+
...prev,
|
|
98
|
+
open: false
|
|
99
|
+
})),
|
|
100
|
+
...props
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
drawerProps: props,
|
|
104
|
+
setDrawerProps
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function ErrorChildren(props) {
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
Alert,
|
|
110
|
+
{
|
|
111
|
+
type: "error",
|
|
112
|
+
message: props.errorMessage,
|
|
113
|
+
description: /* @__PURE__ */ jsx(
|
|
114
|
+
"pre",
|
|
115
|
+
{
|
|
116
|
+
style: {
|
|
117
|
+
fontSize: "0.9em",
|
|
118
|
+
overflowX: "auto"
|
|
119
|
+
},
|
|
120
|
+
children: props.errorDescription
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function ErrorBoundary(props) {
|
|
127
|
+
return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
|
|
128
|
+
}
|
|
129
|
+
ErrorBoundary.whyDidYouRender = true;
|
|
130
|
+
var Modal = Modal$1;
|
|
131
|
+
Modal.whyDidYouRender = true;
|
|
132
|
+
function useModal(init) {
|
|
133
|
+
const [props, setProps] = useState({ open: false, ...init });
|
|
134
|
+
const setModalProps = useEqualCallback(
|
|
135
|
+
(changes) => {
|
|
136
|
+
const changed = typeof changes === "function" ? changes(props) : changes;
|
|
137
|
+
setProps((prev) => ({ ...prev, ...changed }));
|
|
138
|
+
},
|
|
139
|
+
[setProps]
|
|
140
|
+
);
|
|
141
|
+
return {
|
|
142
|
+
modal: /* @__PURE__ */ jsx(
|
|
143
|
+
Modal,
|
|
144
|
+
{
|
|
145
|
+
onCancel: () => setProps((prev) => ({
|
|
146
|
+
...prev,
|
|
147
|
+
open: false
|
|
148
|
+
})),
|
|
149
|
+
...props
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
modalProps: props,
|
|
153
|
+
setModalProps
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
156
|
var AppContext = createSplittingContext({
|
|
157
157
|
message: null,
|
|
158
158
|
notification: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@faasjs/react": "3.7.0-beta.
|
|
37
|
+
"@faasjs/react": "3.7.0-beta.4",
|
|
38
38
|
"antd": "*",
|
|
39
39
|
"@ant-design/icons": "*",
|
|
40
40
|
"lodash-es": "*",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/lodash-es": "*",
|
|
47
|
-
"@faasjs/react": "3.7.0-beta.
|
|
47
|
+
"@faasjs/react": "3.7.0-beta.4",
|
|
48
48
|
"antd": "*",
|
|
49
49
|
"@ant-design/icons": "*",
|
|
50
50
|
"lodash-es": "*",
|