@faasjs/ant-design 1.4.2 → 1.5.0

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 CHANGED
@@ -5,12 +5,14 @@ import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-pro
5
5
  import { StyleProviderProps } from '@ant-design/cssinjs/lib/StyleContext';
6
6
  import { MessageInstance } from 'antd/es/message/interface';
7
7
  import { NotificationInstance } from 'antd/es/notification/interface';
8
- import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
9
- export { Drawer, Modal } from 'antd';
10
- import { BrowserRouterProps, RouteProps } from 'react-router-dom';
8
+ import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
9
+ import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
10
+ import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
11
11
  import * as react from 'react';
12
12
  import { CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
13
13
  export { lazy } from 'react';
14
+ import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
15
+ import { BrowserRouterProps, RouteProps } from 'react-router-dom';
14
16
  import { Dayjs } from 'dayjs';
15
17
  import { RuleObject } from 'rc-field-form/lib/interface';
16
18
  import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
@@ -21,10 +23,16 @@ import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormI
21
23
  import * as antd_es_form_Form from 'antd/es/form/Form';
22
24
  import { Tab } from 'rc-tabs/es/interface';
23
25
 
26
+ declare const Modal: react.FC<ModalProps$1> & antd_es_modal_confirm.ModalStaticFunctions & {
27
+ useModal: typeof antd_es_modal_useModal.default;
28
+ destroyAll: () => void;
29
+ config: typeof antd_es_modal_confirm.modalGlobalConfig;
30
+ _InternalPanelDoNotUseOrYouWillBeFired: (props: antd_es_modal_PurePanel.PurePanelProps) => react.JSX.Element;
31
+ };
24
32
  interface ModalProps extends ModalProps$1 {
25
33
  children?: JSX.Element | JSX.Element[] | string;
26
34
  }
27
- type setModalProps = (changes: Partial<ModalProps>) => void;
35
+ type setModalProps = (changes: Partial<ModalProps> | ((prev: Partial<ModalProps>) => Partial<ModalProps>)) => void;
28
36
  /**
29
37
  * Hook style modal
30
38
  *
@@ -42,13 +50,16 @@ type setModalProps = (changes: Partial<ModalProps>) => void;
42
50
  declare function useModal(init?: ModalProps): {
43
51
  modal: react_jsx_runtime.JSX.Element;
44
52
  modalProps: ModalProps;
45
- setModalProps(changes: Partial<ModalProps>): void;
53
+ setModalProps: setModalProps;
46
54
  };
47
55
 
56
+ declare const Drawer: react.FC<DrawerProps> & {
57
+ whyDidYouRender?: boolean;
58
+ };
48
59
  interface DrawerProps extends DrawerProps$1 {
49
60
  children?: JSX.Element | JSX.Element[];
50
61
  }
51
- type setDrawerProps = (changes: Partial<DrawerProps>) => void;
62
+ type setDrawerProps = (changes: Partial<DrawerProps> | ((prev: Partial<DrawerProps>) => Partial<DrawerProps>)) => void;
52
63
  /**
53
64
  * Hook style drawer
54
65
  *
@@ -68,13 +79,16 @@ type setDrawerProps = (changes: Partial<DrawerProps>) => void;
68
79
  declare function useDrawer(init?: DrawerProps): {
69
80
  drawer: react_jsx_runtime.JSX.Element;
70
81
  drawerProps: DrawerProps;
71
- setDrawerProps(changes: Partial<DrawerProps>): void;
82
+ setDrawerProps(changes: Parameters<setDrawerProps>[0]): void;
72
83
  };
73
84
 
74
85
  /**
75
86
  * Styled error boundary.
76
87
  */
77
88
  declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
89
+ declare namespace ErrorBoundary {
90
+ var whyDidYouRender: boolean;
91
+ }
78
92
 
79
93
  interface ConfigProviderProps {
80
94
  faasClientOptions?: FaasReactClientOptions;
@@ -177,6 +191,7 @@ interface useAppProps {
177
191
  declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
178
192
  declare namespace App {
179
193
  var useApp: typeof useApp;
194
+ var whyDidYouRender: boolean;
180
195
  }
181
196
  /**
182
197
  * Get app context.
@@ -206,6 +221,9 @@ interface BlankProps {
206
221
  * ```
207
222
  */
208
223
  declare function Blank(options?: BlankProps): JSX.Element;
224
+ declare namespace Blank {
225
+ var whyDidYouRender: boolean;
226
+ }
209
227
 
210
228
  type ExtendFormTypeProps<T = any> = {
211
229
  children?: UnionFaasItemElement<T>;
@@ -252,6 +270,7 @@ interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>,
252
270
  */
253
271
  declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
254
272
  declare namespace FormItem {
273
+ var whyDidYouRender: boolean;
255
274
  var useStatus: () => {
256
275
  status?: "" | "success" | "error" | "warning" | "validating";
257
276
  errors: react.ReactNode[];
@@ -278,6 +297,9 @@ type LoadingProps = {
278
297
  * ```
279
298
  */
280
299
  declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
300
+ declare namespace Loading {
301
+ var whyDidYouRender: boolean;
302
+ }
281
303
 
282
304
  type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
283
305
  interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
@@ -301,6 +323,9 @@ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
301
323
  * ```
302
324
  */
303
325
  declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
326
+ declare namespace FaasDataWrapper {
327
+ var whyDidYouRender: boolean;
328
+ }
304
329
 
305
330
  interface ExtendDescriptionTypeProps<T = any> {
306
331
  children?: UnionFaasItemElement<T>;
@@ -355,6 +380,9 @@ interface DescriptionItemContentProps<T = any> {
355
380
  * ```
356
381
  */
357
382
  declare function Description<T = any>(props: DescriptionProps<T>): react_jsx_runtime.JSX.Element;
383
+ declare namespace Description {
384
+ var whyDidYouRender: boolean;
385
+ }
358
386
 
359
387
  interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
360
388
  optionsType?: 'auto';
@@ -391,6 +419,9 @@ type TableProps<T = any, ExtendTypes = any> = {
391
419
  * - Auto generate sorter (disable with `sorter: false`).
392
420
  */
393
421
  declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
422
+ declare namespace Table {
423
+ var whyDidYouRender: boolean;
424
+ }
394
425
 
395
426
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
396
427
  /** FaasItemType's value type */
@@ -499,6 +530,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps =
499
530
  */
500
531
  declare function Form<Values = any>(props: FormProps<Values>): react_jsx_runtime.JSX.Element;
501
532
  declare namespace Form {
533
+ var whyDidYouRender: boolean;
502
534
  var useForm: typeof antd_es_form_Form.useForm;
503
535
  var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
504
536
  var useWatch: typeof rc_field_form_es_useWatch.default;
@@ -533,6 +565,9 @@ interface LinkProps {
533
565
  * ```
534
566
  */
535
567
  declare function Link(props: LinkProps): react_jsx_runtime.JSX.Element;
568
+ declare namespace Link {
569
+ var whyDidYouRender: boolean;
570
+ }
536
571
 
537
572
  declare function PageNotFound(): react_jsx_runtime.JSX.Element;
538
573
  interface RoutesProps {
@@ -563,6 +598,9 @@ interface RoutesProps {
563
598
  * ```
564
599
  */
565
600
  declare function Routes(props: RoutesProps): react_jsx_runtime.JSX.Element;
601
+ declare namespace Routes {
602
+ var whyDidYouRender: boolean;
603
+ }
566
604
 
567
605
  interface TabProps extends Partial<Tab> {
568
606
  id: string;
@@ -599,6 +637,9 @@ interface TabsProps extends Omit<TabsProps$1, 'items'> {
599
637
  * ```
600
638
  */
601
639
  declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
640
+ declare namespace Tabs {
641
+ var whyDidYouRender: boolean;
642
+ }
602
643
 
603
644
  interface TitleProps {
604
645
  title: string | string[];
@@ -634,5 +675,8 @@ interface TitleProps {
634
675
  * ```
635
676
  */
636
677
  declare function Title(props: TitleProps): JSX.Element;
678
+ declare namespace Title {
679
+ var whyDidYouRender: boolean;
680
+ }
637
681
 
638
- export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal };
682
+ export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal };
package/dist/index.d.ts CHANGED
@@ -5,12 +5,14 @@ import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-pro
5
5
  import { StyleProviderProps } from '@ant-design/cssinjs/lib/StyleContext';
6
6
  import { MessageInstance } from 'antd/es/message/interface';
7
7
  import { NotificationInstance } from 'antd/es/notification/interface';
8
- import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
9
- export { Drawer, Modal } from 'antd';
10
- import { BrowserRouterProps, RouteProps } from 'react-router-dom';
8
+ import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
9
+ import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
10
+ import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
11
11
  import * as react from 'react';
12
12
  import { CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
13
13
  export { lazy } from 'react';
14
+ import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
15
+ import { BrowserRouterProps, RouteProps } from 'react-router-dom';
14
16
  import { Dayjs } from 'dayjs';
15
17
  import { RuleObject } from 'rc-field-form/lib/interface';
16
18
  import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
@@ -21,10 +23,16 @@ import * as antd_es_form_hooks_useFormInstance from 'antd/es/form/hooks/useFormI
21
23
  import * as antd_es_form_Form from 'antd/es/form/Form';
22
24
  import { Tab } from 'rc-tabs/es/interface';
23
25
 
26
+ declare const Modal: react.FC<ModalProps$1> & antd_es_modal_confirm.ModalStaticFunctions & {
27
+ useModal: typeof antd_es_modal_useModal.default;
28
+ destroyAll: () => void;
29
+ config: typeof antd_es_modal_confirm.modalGlobalConfig;
30
+ _InternalPanelDoNotUseOrYouWillBeFired: (props: antd_es_modal_PurePanel.PurePanelProps) => react.JSX.Element;
31
+ };
24
32
  interface ModalProps extends ModalProps$1 {
25
33
  children?: JSX.Element | JSX.Element[] | string;
26
34
  }
27
- type setModalProps = (changes: Partial<ModalProps>) => void;
35
+ type setModalProps = (changes: Partial<ModalProps> | ((prev: Partial<ModalProps>) => Partial<ModalProps>)) => void;
28
36
  /**
29
37
  * Hook style modal
30
38
  *
@@ -42,13 +50,16 @@ type setModalProps = (changes: Partial<ModalProps>) => void;
42
50
  declare function useModal(init?: ModalProps): {
43
51
  modal: react_jsx_runtime.JSX.Element;
44
52
  modalProps: ModalProps;
45
- setModalProps(changes: Partial<ModalProps>): void;
53
+ setModalProps: setModalProps;
46
54
  };
47
55
 
56
+ declare const Drawer: react.FC<DrawerProps> & {
57
+ whyDidYouRender?: boolean;
58
+ };
48
59
  interface DrawerProps extends DrawerProps$1 {
49
60
  children?: JSX.Element | JSX.Element[];
50
61
  }
51
- type setDrawerProps = (changes: Partial<DrawerProps>) => void;
62
+ type setDrawerProps = (changes: Partial<DrawerProps> | ((prev: Partial<DrawerProps>) => Partial<DrawerProps>)) => void;
52
63
  /**
53
64
  * Hook style drawer
54
65
  *
@@ -68,13 +79,16 @@ type setDrawerProps = (changes: Partial<DrawerProps>) => void;
68
79
  declare function useDrawer(init?: DrawerProps): {
69
80
  drawer: react_jsx_runtime.JSX.Element;
70
81
  drawerProps: DrawerProps;
71
- setDrawerProps(changes: Partial<DrawerProps>): void;
82
+ setDrawerProps(changes: Parameters<setDrawerProps>[0]): void;
72
83
  };
73
84
 
74
85
  /**
75
86
  * Styled error boundary.
76
87
  */
77
88
  declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
89
+ declare namespace ErrorBoundary {
90
+ var whyDidYouRender: boolean;
91
+ }
78
92
 
79
93
  interface ConfigProviderProps {
80
94
  faasClientOptions?: FaasReactClientOptions;
@@ -177,6 +191,7 @@ interface useAppProps {
177
191
  declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
178
192
  declare namespace App {
179
193
  var useApp: typeof useApp;
194
+ var whyDidYouRender: boolean;
180
195
  }
181
196
  /**
182
197
  * Get app context.
@@ -206,6 +221,9 @@ interface BlankProps {
206
221
  * ```
207
222
  */
208
223
  declare function Blank(options?: BlankProps): JSX.Element;
224
+ declare namespace Blank {
225
+ var whyDidYouRender: boolean;
226
+ }
209
227
 
210
228
  type ExtendFormTypeProps<T = any> = {
211
229
  children?: UnionFaasItemElement<T>;
@@ -252,6 +270,7 @@ interface FormItemProps<T = any> extends FaasItemProps, Omit<FormItemProps$1<T>,
252
270
  */
253
271
  declare function FormItem<T = any>(props: FormItemProps<T>): react_jsx_runtime.JSX.Element;
254
272
  declare namespace FormItem {
273
+ var whyDidYouRender: boolean;
255
274
  var useStatus: () => {
256
275
  status?: "" | "success" | "error" | "warning" | "validating";
257
276
  errors: react.ReactNode[];
@@ -278,6 +297,9 @@ type LoadingProps = {
278
297
  * ```
279
298
  */
280
299
  declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
300
+ declare namespace Loading {
301
+ var whyDidYouRender: boolean;
302
+ }
281
303
 
282
304
  type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
283
305
  interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
@@ -301,6 +323,9 @@ interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
301
323
  * ```
302
324
  */
303
325
  declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
326
+ declare namespace FaasDataWrapper {
327
+ var whyDidYouRender: boolean;
328
+ }
304
329
 
305
330
  interface ExtendDescriptionTypeProps<T = any> {
306
331
  children?: UnionFaasItemElement<T>;
@@ -355,6 +380,9 @@ interface DescriptionItemContentProps<T = any> {
355
380
  * ```
356
381
  */
357
382
  declare function Description<T = any>(props: DescriptionProps<T>): react_jsx_runtime.JSX.Element;
383
+ declare namespace Description {
384
+ var whyDidYouRender: boolean;
385
+ }
358
386
 
359
387
  interface TableItemProps<T = any> extends FaasItemProps, Omit<TableColumnProps<T>, 'title' | 'children' | 'render'> {
360
388
  optionsType?: 'auto';
@@ -391,6 +419,9 @@ type TableProps<T = any, ExtendTypes = any> = {
391
419
  * - Auto generate sorter (disable with `sorter: false`).
392
420
  */
393
421
  declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
422
+ declare namespace Table {
423
+ var whyDidYouRender: boolean;
424
+ }
394
425
 
395
426
  type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
396
427
  /** FaasItemType's value type */
@@ -499,6 +530,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps =
499
530
  */
500
531
  declare function Form<Values = any>(props: FormProps<Values>): react_jsx_runtime.JSX.Element;
501
532
  declare namespace Form {
533
+ var whyDidYouRender: boolean;
502
534
  var useForm: typeof antd_es_form_Form.useForm;
503
535
  var useFormInstance: typeof antd_es_form_hooks_useFormInstance.default;
504
536
  var useWatch: typeof rc_field_form_es_useWatch.default;
@@ -533,6 +565,9 @@ interface LinkProps {
533
565
  * ```
534
566
  */
535
567
  declare function Link(props: LinkProps): react_jsx_runtime.JSX.Element;
568
+ declare namespace Link {
569
+ var whyDidYouRender: boolean;
570
+ }
536
571
 
537
572
  declare function PageNotFound(): react_jsx_runtime.JSX.Element;
538
573
  interface RoutesProps {
@@ -563,6 +598,9 @@ interface RoutesProps {
563
598
  * ```
564
599
  */
565
600
  declare function Routes(props: RoutesProps): react_jsx_runtime.JSX.Element;
601
+ declare namespace Routes {
602
+ var whyDidYouRender: boolean;
603
+ }
566
604
 
567
605
  interface TabProps extends Partial<Tab> {
568
606
  id: string;
@@ -599,6 +637,9 @@ interface TabsProps extends Omit<TabsProps$1, 'items'> {
599
637
  * ```
600
638
  */
601
639
  declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
640
+ declare namespace Tabs {
641
+ var whyDidYouRender: boolean;
642
+ }
602
643
 
603
644
  interface TitleProps {
604
645
  title: string | string[];
@@ -634,5 +675,8 @@ interface TitleProps {
634
675
  * ```
635
676
  */
636
677
  declare function Title(props: TitleProps): JSX.Element;
678
+ declare namespace Title {
679
+ var whyDidYouRender: boolean;
680
+ }
637
681
 
638
- export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal };
682
+ export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal };
package/dist/index.js CHANGED
@@ -15,26 +15,37 @@ 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;
18
20
  function useModal(init) {
19
- const [props, setProps] = react$1.useState({
20
- open: false,
21
- onCancel: () => setProps((prev) => ({
21
+ const [props, setProps] = react$1.useState({ open: false, ...init });
22
+ const onCancel = react$1.useCallback(() => {
23
+ setProps((prev) => ({
22
24
  ...prev,
23
25
  open: false
24
- })),
25
- ...init
26
- });
27
- return {
28
- modal: /* @__PURE__ */ jsxRuntime.jsx(antd.Modal, { ...props }),
29
- modalProps: props,
30
- setModalProps(changes) {
26
+ }));
27
+ }, []);
28
+ const modal = react$1.useMemo(() => /* @__PURE__ */ jsxRuntime.jsx(Modal, { onCancel, ...props }), [props]);
29
+ const setModalProps = react$1.useCallback((changes) => {
30
+ if (typeof changes === "function") {
31
31
  setProps((prev) => ({
32
32
  ...prev,
33
- ...changes
33
+ ...changes(props)
34
34
  }));
35
+ return;
35
36
  }
37
+ setProps((prev) => ({
38
+ ...prev,
39
+ ...changes
40
+ }));
41
+ }, []);
42
+ return {
43
+ modal,
44
+ modalProps: props,
45
+ setModalProps
36
46
  };
37
47
  }
48
+ var Drawer = antd.Drawer;
38
49
  function useDrawer(init) {
39
50
  const [props, setProps] = react$1.useState({
40
51
  open: false,
@@ -45,9 +56,16 @@ function useDrawer(init) {
45
56
  ...init
46
57
  });
47
58
  return {
48
- drawer: /* @__PURE__ */ jsxRuntime.jsx(antd.Drawer, { ...props }),
59
+ drawer: /* @__PURE__ */ jsxRuntime.jsx(Drawer, { ...props }),
49
60
  drawerProps: props,
50
61
  setDrawerProps(changes) {
62
+ if (typeof changes === "function") {
63
+ setProps((prev) => ({
64
+ ...prev,
65
+ ...changes(props)
66
+ }));
67
+ return;
68
+ }
51
69
  setProps((prev) => ({
52
70
  ...prev,
53
71
  ...changes
@@ -55,6 +73,7 @@ function useDrawer(init) {
55
73
  }
56
74
  };
57
75
  }
76
+ Drawer.whyDidYouRender = true;
58
77
  function ErrorChildren(props) {
59
78
  return /* @__PURE__ */ jsxRuntime.jsx(
60
79
  antd.Alert,
@@ -77,6 +96,7 @@ function ErrorChildren(props) {
77
96
  function ErrorBoundary(props) {
78
97
  return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
79
98
  }
99
+ ErrorBoundary.whyDidYouRender = true;
80
100
  var isZH = /^zh/i.test(navigator.language);
81
101
  var zh = {
82
102
  lang: "zh",
@@ -165,7 +185,7 @@ function RoutesApp(props) {
165
185
  function App(props) {
166
186
  const [messageApi, messageContextHolder] = antd.message.useMessage();
167
187
  const [notificationApi, notificationContextHolder] = antd.notification.useNotification();
168
- const { modal, setModalProps } = useModal();
188
+ const { modal, modalProps, setModalProps } = useModal();
169
189
  const { drawer, setDrawerProps } = useDrawer();
170
190
  const memoizedContextValue = react$1.useMemo(
171
191
  () => ({
@@ -176,31 +196,32 @@ function App(props) {
176
196
  }),
177
197
  [messageApi, notificationApi, setModalProps, setDrawerProps]
178
198
  );
179
- return /* @__PURE__ */ jsxRuntime.jsx(
180
- cssinjs.StyleProvider,
181
- {
182
- ...Object.assign(props.styleProviderProps || {}, {
183
- hashPriority: "high",
184
- transformers: [cssinjs.legacyLogicalPropertiesTransformer]
185
- }),
186
- children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
187
- messageContextHolder,
188
- notificationContextHolder,
189
- modal,
190
- drawer,
191
- /* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children })
192
- ] }) }) }) }) })
193
- }
199
+ const styleProviderProps = react$1.useMemo(
200
+ () => ({
201
+ ...props.styleProviderProps,
202
+ hashPriority: "high",
203
+ transformers: [cssinjs.legacyLogicalPropertiesTransformer]
204
+ }),
205
+ [props.styleProviderProps]
194
206
  );
207
+ return /* @__PURE__ */ jsxRuntime.jsx(cssinjs.StyleProvider, { ...styleProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
208
+ messageContextHolder,
209
+ notificationContextHolder,
210
+ modal,
211
+ drawer,
212
+ /* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children })
213
+ ] }) }) }) }) }) });
195
214
  }
196
215
  function useApp() {
197
216
  return react$1.useContext(AppContext);
198
217
  }
199
218
  App.useApp = useApp;
219
+ App.whyDidYouRender = true;
200
220
  function Blank(options) {
201
221
  const { theme } = useConfigContext();
202
222
  return !options || lodashEs.isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || theme.Blank.text }) : options.value;
203
223
  }
224
+ Blank.whyDidYouRender = true;
204
225
  function transferOptions(options) {
205
226
  if (!options)
206
227
  return [];
@@ -263,6 +284,7 @@ function Loading(props) {
263
284
  }
264
285
  );
265
286
  }
287
+ Loading.whyDidYouRender = true;
266
288
  function FaasDataWrapper(props) {
267
289
  return /* @__PURE__ */ jsxRuntime.jsx(
268
290
  react.FaasDataWrapper,
@@ -272,6 +294,7 @@ function FaasDataWrapper(props) {
272
294
  }
273
295
  );
274
296
  }
297
+ FaasDataWrapper.whyDidYouRender = true;
275
298
  function DescriptionItemContent(props) {
276
299
  var _a, _b;
277
300
  const [computedProps, setComputedProps] = react$1.useState();
@@ -410,6 +433,7 @@ function DescriptionItemContent(props) {
410
433
  return computedProps.value || null;
411
434
  }
412
435
  }
436
+ DescriptionItemContent.whyDidYouRender = true;
413
437
  function Description(props) {
414
438
  if (props.faasData && !props.dataSource)
415
439
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -441,6 +465,7 @@ function Description(props) {
441
465
  }
442
466
  );
443
467
  }
468
+ Description.whyDidYouRender = true;
444
469
  function processProps(propsCopy, config) {
445
470
  if (!propsCopy.title)
446
471
  propsCopy.title = lodashEs.upperFirst(propsCopy.id);
@@ -732,6 +757,7 @@ function FormItem(props) {
732
757
  return null;
733
758
  }
734
759
  }
760
+ FormItem.whyDidYouRender = true;
735
761
  FormItem.useStatus = antd.Form.Item.useStatus;
736
762
  function Form(props) {
737
763
  var _a, _b;
@@ -861,6 +887,7 @@ function Form(props) {
861
887
  computedProps.footer
862
888
  ] });
863
889
  }
890
+ Form.whyDidYouRender = true;
864
891
  Form.useForm = antd.Form.useForm;
865
892
  Form.useFormInstance = antd.Form.useFormInstance;
866
893
  Form.useWatch = antd.Form.useWatch;
@@ -970,6 +997,7 @@ function Link(props) {
970
997
  }
971
998
  );
972
999
  }
1000
+ Link.whyDidYouRender = true;
973
1001
  function PageNotFound() {
974
1002
  const { theme } = useConfigContext();
975
1003
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "404", title: theme.common.pageNotFound });
@@ -993,6 +1021,7 @@ function Routes(props) {
993
1021
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: props.notFound || /* @__PURE__ */ jsxRuntime.jsx(PageNotFound, {}) }, "*")
994
1022
  ] });
995
1023
  }
1024
+ Routes.whyDidYouRender = true;
996
1025
  function processValue(item, value) {
997
1026
  var _a;
998
1027
  const transferred = transferValue(item.type, value);
@@ -1591,6 +1620,7 @@ function FaasDataTable({
1591
1620
  }
1592
1621
  );
1593
1622
  }
1623
+ Table.whyDidYouRender = true;
1594
1624
  function Tabs(props) {
1595
1625
  return /* @__PURE__ */ jsxRuntime.jsx(
1596
1626
  antd.Tabs,
@@ -1604,6 +1634,7 @@ function Tabs(props) {
1604
1634
  }
1605
1635
  );
1606
1636
  }
1637
+ Tabs.whyDidYouRender = true;
1607
1638
  function Title(props) {
1608
1639
  const { theme } = useConfigContext();
1609
1640
  react$1.useEffect(() => {
@@ -1621,6 +1652,7 @@ function Title(props) {
1621
1652
  return react$1.cloneElement(props.children, { title: props.title });
1622
1653
  return null;
1623
1654
  }
1655
+ Title.whyDidYouRender = true;
1624
1656
 
1625
1657
  Object.defineProperty(exports, "faas", {
1626
1658
  enumerable: true,
@@ -1630,14 +1662,6 @@ Object.defineProperty(exports, "useFaas", {
1630
1662
  enumerable: true,
1631
1663
  get: function () { return react.useFaas; }
1632
1664
  });
1633
- Object.defineProperty(exports, "Drawer", {
1634
- enumerable: true,
1635
- get: function () { return antd.Drawer; }
1636
- });
1637
- Object.defineProperty(exports, "Modal", {
1638
- enumerable: true,
1639
- get: function () { return antd.Modal; }
1640
- });
1641
1665
  Object.defineProperty(exports, "lazy", {
1642
1666
  enumerable: true,
1643
1667
  get: function () { return react$1.lazy; }
@@ -1647,12 +1671,14 @@ exports.Blank = Blank;
1647
1671
  exports.ConfigContext = ConfigContext;
1648
1672
  exports.ConfigProvider = ConfigProvider;
1649
1673
  exports.Description = Description;
1674
+ exports.Drawer = Drawer;
1650
1675
  exports.ErrorBoundary = ErrorBoundary;
1651
1676
  exports.FaasDataWrapper = FaasDataWrapper;
1652
1677
  exports.Form = Form;
1653
1678
  exports.FormItem = FormItem;
1654
1679
  exports.Link = Link;
1655
1680
  exports.Loading = Loading;
1681
+ exports.Modal = Modal;
1656
1682
  exports.PageNotFound = PageNotFound;
1657
1683
  exports.Routes = Routes;
1658
1684
  exports.Table = Table;