@faasjs/ant-design 2.6.1 → 2.8.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/README.md +1 -0
- package/dist/index.d.mts +30 -12
- package/dist/index.d.ts +30 -12
- package/dist/index.js +60 -77
- package/dist/index.mjs +62 -80
- package/package.json +3 -7
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -9,13 +9,14 @@ import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
|
|
|
9
9
|
import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
|
|
10
10
|
import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
|
|
11
11
|
import * as react from 'react';
|
|
12
|
-
import { Dispatch, SetStateAction, CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
12
|
+
import { Dispatch, SetStateAction, CSSProperties, ComponentProps, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
13
13
|
export { lazy } from 'react';
|
|
14
14
|
import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$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';
|
|
15
15
|
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
16
16
|
import { Dayjs } from 'dayjs';
|
|
17
17
|
import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
|
|
18
18
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
19
|
+
import { FaasAction } from '@faasjs/types';
|
|
19
20
|
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
|
|
20
21
|
import * as antd_es_form_context from 'antd/es/form/context';
|
|
21
22
|
import * as antd_es_form from 'antd/es/form';
|
|
@@ -145,16 +146,24 @@ declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
|
145
146
|
|
|
146
147
|
interface AppProps {
|
|
147
148
|
children: React.ReactNode;
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
/**
|
|
150
|
+
* `false` to disable StyleProvider.
|
|
151
|
+
*
|
|
152
|
+
* @see https://ant.design/docs/react/compatible-style#styleprovider
|
|
153
|
+
*/
|
|
154
|
+
styleProviderProps?: StyleProviderProps | false;
|
|
155
|
+
/** @see https://ant.design/components/config-provider/#API */
|
|
151
156
|
configProviderProps?: ConfigProviderProps$1;
|
|
152
|
-
/**
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
/**
|
|
158
|
+
* `false` to disable BrowserRouter.
|
|
159
|
+
*
|
|
160
|
+
* @see https://reactrouter.com/en/router-components/browser-router
|
|
161
|
+
*/
|
|
162
|
+
browserRouterProps?: BrowserRouterProps | false;
|
|
163
|
+
/** @see https://faasjs.com/doc/ant-design/#errorboundary */
|
|
155
164
|
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
156
|
-
/** https://faasjs.com/doc/ant-design/#configprovider */
|
|
157
|
-
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'
|
|
165
|
+
/** @see https://faasjs.com/doc/ant-design/#configprovider */
|
|
166
|
+
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
|
|
158
167
|
}
|
|
159
168
|
interface useAppProps {
|
|
160
169
|
message: MessageInstance;
|
|
@@ -376,6 +385,15 @@ declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.E
|
|
|
376
385
|
declare namespace FaasDataWrapper {
|
|
377
386
|
var whyDidYouRender: boolean;
|
|
378
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* HOC to wrap a component with FaasDataWrapper and Loading
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```tsx
|
|
393
|
+
* const MyComponent = withFaasData(MyComponent, { action: 'test', params: { a: 1 } })
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
declare function withFaasData<TComponent extends React.FC<any>, PathOrData extends FaasAction>(Component: TComponent, faasProps: FaasDataWrapperProps<PathOrData>): (props: ComponentProps<TComponent> & {}) => react_jsx_runtime.JSX.Element;
|
|
379
397
|
|
|
380
398
|
interface ExtendDescriptionTypeProps<T = any> {
|
|
381
399
|
children?: UnionFaasItemElement<T>;
|
|
@@ -571,7 +589,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps ex
|
|
|
571
589
|
footer?: JSX.Element | JSX.Element[];
|
|
572
590
|
extendTypes?: ExtendTypes;
|
|
573
591
|
children?: ReactNode;
|
|
574
|
-
initialValues?: Values
|
|
592
|
+
initialValues?: Partial<Values>;
|
|
575
593
|
}
|
|
576
594
|
/**
|
|
577
595
|
* Form component with Ant Design & FaasJS
|
|
@@ -596,7 +614,7 @@ interface LinkProps {
|
|
|
596
614
|
text?: string | number;
|
|
597
615
|
children?: ReactNode;
|
|
598
616
|
style?: CSSProperties;
|
|
599
|
-
button?: ButtonProps;
|
|
617
|
+
button?: ButtonProps | boolean;
|
|
600
618
|
block?: boolean;
|
|
601
619
|
/** only use for text without button */
|
|
602
620
|
copyable?: boolean;
|
|
@@ -729,4 +747,4 @@ declare namespace Title {
|
|
|
729
747
|
var whyDidYouRender: boolean;
|
|
730
748
|
}
|
|
731
749
|
|
|
732
|
-
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 };
|
|
750
|
+
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, withFaasData };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,13 +9,14 @@ import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
|
|
|
9
9
|
import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
|
|
10
10
|
import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
|
|
11
11
|
import * as react from 'react';
|
|
12
|
-
import { Dispatch, SetStateAction, CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
12
|
+
import { Dispatch, SetStateAction, CSSProperties, ComponentProps, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
13
13
|
export { lazy } from 'react';
|
|
14
14
|
import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$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';
|
|
15
15
|
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
16
16
|
import { Dayjs } from 'dayjs';
|
|
17
17
|
import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
|
|
18
18
|
import { RuleObject } from 'rc-field-form/lib/interface';
|
|
19
|
+
import { FaasAction } from '@faasjs/types';
|
|
19
20
|
import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
|
|
20
21
|
import * as antd_es_form_context from 'antd/es/form/context';
|
|
21
22
|
import * as antd_es_form from 'antd/es/form';
|
|
@@ -145,16 +146,24 @@ declare function useConfigContext(): Partial<ConfigProviderProps>;
|
|
|
145
146
|
|
|
146
147
|
interface AppProps {
|
|
147
148
|
children: React.ReactNode;
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
/**
|
|
150
|
+
* `false` to disable StyleProvider.
|
|
151
|
+
*
|
|
152
|
+
* @see https://ant.design/docs/react/compatible-style#styleprovider
|
|
153
|
+
*/
|
|
154
|
+
styleProviderProps?: StyleProviderProps | false;
|
|
155
|
+
/** @see https://ant.design/components/config-provider/#API */
|
|
151
156
|
configProviderProps?: ConfigProviderProps$1;
|
|
152
|
-
/**
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
/**
|
|
158
|
+
* `false` to disable BrowserRouter.
|
|
159
|
+
*
|
|
160
|
+
* @see https://reactrouter.com/en/router-components/browser-router
|
|
161
|
+
*/
|
|
162
|
+
browserRouterProps?: BrowserRouterProps | false;
|
|
163
|
+
/** @see https://faasjs.com/doc/ant-design/#errorboundary */
|
|
155
164
|
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
156
|
-
/** https://faasjs.com/doc/ant-design/#configprovider */
|
|
157
|
-
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'
|
|
165
|
+
/** @see https://faasjs.com/doc/ant-design/#configprovider */
|
|
166
|
+
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
|
|
158
167
|
}
|
|
159
168
|
interface useAppProps {
|
|
160
169
|
message: MessageInstance;
|
|
@@ -376,6 +385,15 @@ declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.E
|
|
|
376
385
|
declare namespace FaasDataWrapper {
|
|
377
386
|
var whyDidYouRender: boolean;
|
|
378
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* HOC to wrap a component with FaasDataWrapper and Loading
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```tsx
|
|
393
|
+
* const MyComponent = withFaasData(MyComponent, { action: 'test', params: { a: 1 } })
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
declare function withFaasData<TComponent extends React.FC<any>, PathOrData extends FaasAction>(Component: TComponent, faasProps: FaasDataWrapperProps<PathOrData>): (props: ComponentProps<TComponent> & {}) => react_jsx_runtime.JSX.Element;
|
|
379
397
|
|
|
380
398
|
interface ExtendDescriptionTypeProps<T = any> {
|
|
381
399
|
children?: UnionFaasItemElement<T>;
|
|
@@ -571,7 +589,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps ex
|
|
|
571
589
|
footer?: JSX.Element | JSX.Element[];
|
|
572
590
|
extendTypes?: ExtendTypes;
|
|
573
591
|
children?: ReactNode;
|
|
574
|
-
initialValues?: Values
|
|
592
|
+
initialValues?: Partial<Values>;
|
|
575
593
|
}
|
|
576
594
|
/**
|
|
577
595
|
* Form component with Ant Design & FaasJS
|
|
@@ -596,7 +614,7 @@ interface LinkProps {
|
|
|
596
614
|
text?: string | number;
|
|
597
615
|
children?: ReactNode;
|
|
598
616
|
style?: CSSProperties;
|
|
599
|
-
button?: ButtonProps;
|
|
617
|
+
button?: ButtonProps | boolean;
|
|
600
618
|
block?: boolean;
|
|
601
619
|
/** only use for text without button */
|
|
602
620
|
copyable?: boolean;
|
|
@@ -729,4 +747,4 @@ declare namespace Title {
|
|
|
729
747
|
var whyDidYouRender: boolean;
|
|
730
748
|
}
|
|
731
749
|
|
|
732
|
-
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 };
|
|
750
|
+
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, withFaasData };
|
package/dist/index.js
CHANGED
|
@@ -159,7 +159,7 @@ function ConfigProvider(props) {
|
|
|
159
159
|
function useConfigContext() {
|
|
160
160
|
return react$1.useContext(ConfigContext);
|
|
161
161
|
}
|
|
162
|
-
var AppContext = react.
|
|
162
|
+
var AppContext = react.createSplittingContext({
|
|
163
163
|
message: null,
|
|
164
164
|
notification: null,
|
|
165
165
|
modalProps: {},
|
|
@@ -190,26 +190,50 @@ function App(props) {
|
|
|
190
190
|
}),
|
|
191
191
|
[props.styleProviderProps]
|
|
192
192
|
);
|
|
193
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
-
|
|
193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
react.OptionalWrapper,
|
|
195
195
|
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
196
|
+
condition: props.styleProviderProps !== false,
|
|
197
|
+
Wrapper: cssinjs.StyleProvider,
|
|
198
|
+
wrapperProps: styleProviderProps,
|
|
199
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
+
react.OptionalWrapper,
|
|
201
|
+
{
|
|
202
|
+
condition: !!props.configProviderProps,
|
|
203
|
+
Wrapper: antd.ConfigProvider,
|
|
204
|
+
wrapperProps: props.configProviderProps,
|
|
205
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
+
AppContext.Provider,
|
|
207
|
+
{
|
|
208
|
+
value: {
|
|
209
|
+
message: messageApi,
|
|
210
|
+
notification: notificationApi,
|
|
211
|
+
drawerProps,
|
|
212
|
+
setDrawerProps,
|
|
213
|
+
modalProps,
|
|
214
|
+
setModalProps
|
|
215
|
+
},
|
|
216
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
217
|
+
react.OptionalWrapper,
|
|
218
|
+
{
|
|
219
|
+
condition: props.browserRouterProps !== false,
|
|
220
|
+
Wrapper: reactRouterDom.BrowserRouter,
|
|
221
|
+
wrapperProps: props.browserRouterProps,
|
|
222
|
+
children: [
|
|
223
|
+
messageContextHolder,
|
|
224
|
+
notificationContextHolder,
|
|
225
|
+
modal,
|
|
226
|
+
drawer,
|
|
227
|
+
props.browserRouterProps !== false ? /* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children }) : props.children
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
) }) })
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
)
|
|
211
235
|
}
|
|
212
|
-
)
|
|
236
|
+
);
|
|
213
237
|
}
|
|
214
238
|
var useApp = AppContext.use;
|
|
215
239
|
App.useApp = useApp;
|
|
@@ -283,6 +307,9 @@ function FaasDataWrapper(props) {
|
|
|
283
307
|
);
|
|
284
308
|
}
|
|
285
309
|
FaasDataWrapper.whyDidYouRender = true;
|
|
310
|
+
function withFaasData(Component, faasProps) {
|
|
311
|
+
return (props) => /* @__PURE__ */ jsxRuntime.jsx(FaasDataWrapper, { ...faasProps, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props }) });
|
|
312
|
+
}
|
|
286
313
|
function DescriptionItemContent(props) {
|
|
287
314
|
var _a, _b;
|
|
288
315
|
const [computedProps, setComputedProps] = react$1.useState();
|
|
@@ -867,9 +894,10 @@ Form.List = antd.Form.List;
|
|
|
867
894
|
Form.ErrorList = antd.Form.ErrorList;
|
|
868
895
|
Form.Provider = antd.Form.Provider;
|
|
869
896
|
function Link(props) {
|
|
870
|
-
var _a, _b, _c
|
|
897
|
+
var _a, _b, _c;
|
|
871
898
|
const { theme } = useConfigContext();
|
|
872
899
|
const navigate = reactRouterDom.useNavigate();
|
|
900
|
+
const target = props.target || ((_a = theme.Link) == null ? void 0 : _a.target) || (props.href.startsWith("http") ? "_blank" : void 0);
|
|
873
901
|
let computedStyle = {
|
|
874
902
|
...theme.Link.style || {},
|
|
875
903
|
cursor: "pointer",
|
|
@@ -883,85 +911,39 @@ function Link(props) {
|
|
|
883
911
|
},
|
|
884
912
|
computedStyle
|
|
885
913
|
);
|
|
886
|
-
if (props.href.startsWith("http")) {
|
|
887
|
-
if (props.button)
|
|
888
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
889
|
-
antd.Button,
|
|
890
|
-
{
|
|
891
|
-
...props.button,
|
|
892
|
-
target: props.target || ((_a = theme.Link) == null ? void 0 : _a.target) || "_blank",
|
|
893
|
-
style: computedStyle,
|
|
894
|
-
href: props.href,
|
|
895
|
-
onClick: props.onClick,
|
|
896
|
-
children: (_b = props.text) != null ? _b : props.children
|
|
897
|
-
}
|
|
898
|
-
);
|
|
899
|
-
if (props.children)
|
|
900
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
901
|
-
"a",
|
|
902
|
-
{
|
|
903
|
-
href: props.href,
|
|
904
|
-
target: props.target || ((_c = theme.Link) == null ? void 0 : _c.target),
|
|
905
|
-
style: computedStyle,
|
|
906
|
-
onClick: props.onClick,
|
|
907
|
-
children: props.children
|
|
908
|
-
}
|
|
909
|
-
);
|
|
910
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
911
|
-
antd.Typography.Link,
|
|
912
|
-
{
|
|
913
|
-
href: props.href,
|
|
914
|
-
target: props.target || ((_d = theme.Link) == null ? void 0 : _d.target) || "_blank",
|
|
915
|
-
style: computedStyle,
|
|
916
|
-
copyable: props.copyable,
|
|
917
|
-
onClick: props.onClick,
|
|
918
|
-
children: props.text
|
|
919
|
-
}
|
|
920
|
-
);
|
|
921
|
-
}
|
|
922
914
|
if (props.button)
|
|
923
915
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
924
916
|
antd.Button,
|
|
925
917
|
{
|
|
926
|
-
...props.button,
|
|
918
|
+
...props.button || {},
|
|
927
919
|
style: computedStyle,
|
|
928
920
|
onClick: (e) => {
|
|
929
|
-
|
|
930
|
-
|
|
921
|
+
props.onClick ? props.onClick(e) : target === "_blank" ? window.open(props.href) : navigate(props.href);
|
|
922
|
+
e.preventDefault();
|
|
931
923
|
},
|
|
932
|
-
children: (
|
|
933
|
-
}
|
|
934
|
-
);
|
|
935
|
-
if (props.children)
|
|
936
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
937
|
-
reactRouterDom.Link,
|
|
938
|
-
{
|
|
939
|
-
to: props.href,
|
|
940
|
-
target: props.target || ((_f = theme.Link) == null ? void 0 : _f.target),
|
|
941
|
-
style: computedStyle,
|
|
942
|
-
onClick: props.onClick,
|
|
943
|
-
children: props.children
|
|
924
|
+
children: (_b = props.children) != null ? _b : props.text
|
|
944
925
|
}
|
|
945
926
|
);
|
|
946
927
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
947
928
|
antd.Typography.Link,
|
|
948
929
|
{
|
|
949
930
|
href: props.href,
|
|
950
|
-
target
|
|
931
|
+
target,
|
|
951
932
|
style: computedStyle,
|
|
952
933
|
copyable: props.copyable,
|
|
953
934
|
onClick: (e) => {
|
|
954
|
-
|
|
935
|
+
e.preventDefault();
|
|
955
936
|
if (props.onClick) {
|
|
956
937
|
props.onClick(e);
|
|
957
938
|
return;
|
|
958
939
|
}
|
|
959
|
-
if (
|
|
960
|
-
|
|
961
|
-
|
|
940
|
+
if (target === "_blank") {
|
|
941
|
+
window.open(props.href);
|
|
942
|
+
return;
|
|
962
943
|
}
|
|
944
|
+
navigate(props.href);
|
|
963
945
|
},
|
|
964
|
-
children: props.text
|
|
946
|
+
children: (_c = props.children) != null ? _c : props.text
|
|
965
947
|
}
|
|
966
948
|
);
|
|
967
949
|
}
|
|
@@ -1625,3 +1607,4 @@ exports.useApp = useApp;
|
|
|
1625
1607
|
exports.useConfigContext = useConfigContext;
|
|
1626
1608
|
exports.useDrawer = useDrawer;
|
|
1627
1609
|
exports.useModal = useModal;
|
|
1610
|
+
exports.withFaasData = withFaasData;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createSplittingContext, ErrorBoundary as ErrorBoundary$1, FaasReactClient, OptionalWrapper, FaasDataWrapper as FaasDataWrapper$1, faas } from '@faasjs/react';
|
|
2
2
|
export { faas, useFaas } from '@faasjs/react';
|
|
3
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
4
|
import { legacyLogicalPropertiesTransformer, StyleProvider } from '@ant-design/cssinjs';
|
|
5
5
|
import { createContext, useState, useCallback, useEffect, useContext, useMemo, cloneElement, Suspense } from 'react';
|
|
6
6
|
export { lazy } from 'react';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { BrowserRouter, useNavigate,
|
|
8
|
+
import { BrowserRouter, useNavigate, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
|
|
9
9
|
import { defaultsDeep, isNil, upperFirst, isFunction, cloneDeep, uniqBy } from 'lodash-es';
|
|
10
10
|
import dayjs2 from 'dayjs';
|
|
11
11
|
import { PlusOutlined, MinusCircleOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
|
|
@@ -155,7 +155,7 @@ function ConfigProvider(props) {
|
|
|
155
155
|
function useConfigContext() {
|
|
156
156
|
return useContext(ConfigContext);
|
|
157
157
|
}
|
|
158
|
-
var AppContext =
|
|
158
|
+
var AppContext = createSplittingContext({
|
|
159
159
|
message: null,
|
|
160
160
|
notification: null,
|
|
161
161
|
modalProps: {},
|
|
@@ -186,26 +186,50 @@ function App(props) {
|
|
|
186
186
|
}),
|
|
187
187
|
[props.styleProviderProps]
|
|
188
188
|
);
|
|
189
|
-
return /* @__PURE__ */ jsx(
|
|
190
|
-
|
|
189
|
+
return /* @__PURE__ */ jsx(
|
|
190
|
+
OptionalWrapper,
|
|
191
191
|
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
192
|
+
condition: props.styleProviderProps !== false,
|
|
193
|
+
Wrapper: StyleProvider,
|
|
194
|
+
wrapperProps: styleProviderProps,
|
|
195
|
+
children: /* @__PURE__ */ jsx(
|
|
196
|
+
OptionalWrapper,
|
|
197
|
+
{
|
|
198
|
+
condition: !!props.configProviderProps,
|
|
199
|
+
Wrapper: ConfigProvider$1,
|
|
200
|
+
wrapperProps: props.configProviderProps,
|
|
201
|
+
children: /* @__PURE__ */ jsx(
|
|
202
|
+
AppContext.Provider,
|
|
203
|
+
{
|
|
204
|
+
value: {
|
|
205
|
+
message: messageApi,
|
|
206
|
+
notification: notificationApi,
|
|
207
|
+
drawerProps,
|
|
208
|
+
setDrawerProps,
|
|
209
|
+
modalProps,
|
|
210
|
+
setModalProps
|
|
211
|
+
},
|
|
212
|
+
children: /* @__PURE__ */ jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxs(
|
|
213
|
+
OptionalWrapper,
|
|
214
|
+
{
|
|
215
|
+
condition: props.browserRouterProps !== false,
|
|
216
|
+
Wrapper: BrowserRouter,
|
|
217
|
+
wrapperProps: props.browserRouterProps,
|
|
218
|
+
children: [
|
|
219
|
+
messageContextHolder,
|
|
220
|
+
notificationContextHolder,
|
|
221
|
+
modal,
|
|
222
|
+
drawer,
|
|
223
|
+
props.browserRouterProps !== false ? /* @__PURE__ */ jsx(RoutesApp, { children: props.children }) : props.children
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
) }) })
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
)
|
|
207
231
|
}
|
|
208
|
-
)
|
|
232
|
+
);
|
|
209
233
|
}
|
|
210
234
|
var useApp = AppContext.use;
|
|
211
235
|
App.useApp = useApp;
|
|
@@ -279,6 +303,9 @@ function FaasDataWrapper(props) {
|
|
|
279
303
|
);
|
|
280
304
|
}
|
|
281
305
|
FaasDataWrapper.whyDidYouRender = true;
|
|
306
|
+
function withFaasData(Component, faasProps) {
|
|
307
|
+
return (props) => /* @__PURE__ */ jsx(FaasDataWrapper, { ...faasProps, children: /* @__PURE__ */ jsx(Component, { ...props }) });
|
|
308
|
+
}
|
|
282
309
|
function DescriptionItemContent(props) {
|
|
283
310
|
var _a, _b;
|
|
284
311
|
const [computedProps, setComputedProps] = useState();
|
|
@@ -863,9 +890,10 @@ Form.List = Form$1.List;
|
|
|
863
890
|
Form.ErrorList = Form$1.ErrorList;
|
|
864
891
|
Form.Provider = Form$1.Provider;
|
|
865
892
|
function Link(props) {
|
|
866
|
-
var _a, _b, _c
|
|
893
|
+
var _a, _b, _c;
|
|
867
894
|
const { theme } = useConfigContext();
|
|
868
895
|
const navigate = useNavigate();
|
|
896
|
+
const target = props.target || ((_a = theme.Link) == null ? void 0 : _a.target) || (props.href.startsWith("http") ? "_blank" : void 0);
|
|
869
897
|
let computedStyle = {
|
|
870
898
|
...theme.Link.style || {},
|
|
871
899
|
cursor: "pointer",
|
|
@@ -879,85 +907,39 @@ function Link(props) {
|
|
|
879
907
|
},
|
|
880
908
|
computedStyle
|
|
881
909
|
);
|
|
882
|
-
if (props.href.startsWith("http")) {
|
|
883
|
-
if (props.button)
|
|
884
|
-
return /* @__PURE__ */ jsx(
|
|
885
|
-
Button,
|
|
886
|
-
{
|
|
887
|
-
...props.button,
|
|
888
|
-
target: props.target || ((_a = theme.Link) == null ? void 0 : _a.target) || "_blank",
|
|
889
|
-
style: computedStyle,
|
|
890
|
-
href: props.href,
|
|
891
|
-
onClick: props.onClick,
|
|
892
|
-
children: (_b = props.text) != null ? _b : props.children
|
|
893
|
-
}
|
|
894
|
-
);
|
|
895
|
-
if (props.children)
|
|
896
|
-
return /* @__PURE__ */ jsx(
|
|
897
|
-
"a",
|
|
898
|
-
{
|
|
899
|
-
href: props.href,
|
|
900
|
-
target: props.target || ((_c = theme.Link) == null ? void 0 : _c.target),
|
|
901
|
-
style: computedStyle,
|
|
902
|
-
onClick: props.onClick,
|
|
903
|
-
children: props.children
|
|
904
|
-
}
|
|
905
|
-
);
|
|
906
|
-
return /* @__PURE__ */ jsx(
|
|
907
|
-
Typography.Link,
|
|
908
|
-
{
|
|
909
|
-
href: props.href,
|
|
910
|
-
target: props.target || ((_d = theme.Link) == null ? void 0 : _d.target) || "_blank",
|
|
911
|
-
style: computedStyle,
|
|
912
|
-
copyable: props.copyable,
|
|
913
|
-
onClick: props.onClick,
|
|
914
|
-
children: props.text
|
|
915
|
-
}
|
|
916
|
-
);
|
|
917
|
-
}
|
|
918
910
|
if (props.button)
|
|
919
911
|
return /* @__PURE__ */ jsx(
|
|
920
912
|
Button,
|
|
921
913
|
{
|
|
922
|
-
...props.button,
|
|
914
|
+
...props.button || {},
|
|
923
915
|
style: computedStyle,
|
|
924
916
|
onClick: (e) => {
|
|
925
|
-
|
|
926
|
-
|
|
917
|
+
props.onClick ? props.onClick(e) : target === "_blank" ? window.open(props.href) : navigate(props.href);
|
|
918
|
+
e.preventDefault();
|
|
927
919
|
},
|
|
928
|
-
children: (
|
|
929
|
-
}
|
|
930
|
-
);
|
|
931
|
-
if (props.children)
|
|
932
|
-
return /* @__PURE__ */ jsx(
|
|
933
|
-
Link$1,
|
|
934
|
-
{
|
|
935
|
-
to: props.href,
|
|
936
|
-
target: props.target || ((_f = theme.Link) == null ? void 0 : _f.target),
|
|
937
|
-
style: computedStyle,
|
|
938
|
-
onClick: props.onClick,
|
|
939
|
-
children: props.children
|
|
920
|
+
children: (_b = props.children) != null ? _b : props.text
|
|
940
921
|
}
|
|
941
922
|
);
|
|
942
923
|
return /* @__PURE__ */ jsx(
|
|
943
924
|
Typography.Link,
|
|
944
925
|
{
|
|
945
926
|
href: props.href,
|
|
946
|
-
target
|
|
927
|
+
target,
|
|
947
928
|
style: computedStyle,
|
|
948
929
|
copyable: props.copyable,
|
|
949
930
|
onClick: (e) => {
|
|
950
|
-
|
|
931
|
+
e.preventDefault();
|
|
951
932
|
if (props.onClick) {
|
|
952
933
|
props.onClick(e);
|
|
953
934
|
return;
|
|
954
935
|
}
|
|
955
|
-
if (
|
|
956
|
-
|
|
957
|
-
|
|
936
|
+
if (target === "_blank") {
|
|
937
|
+
window.open(props.href);
|
|
938
|
+
return;
|
|
958
939
|
}
|
|
940
|
+
navigate(props.href);
|
|
959
941
|
},
|
|
960
|
-
children: props.text
|
|
942
|
+
children: (_c = props.children) != null ? _c : props.text
|
|
961
943
|
}
|
|
962
944
|
);
|
|
963
945
|
}
|
|
@@ -1585,4 +1567,4 @@ function Title(props) {
|
|
|
1585
1567
|
}
|
|
1586
1568
|
Title.whyDidYouRender = true;
|
|
1587
1569
|
|
|
1588
|
-
export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useModal };
|
|
1570
|
+
export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useModal, withFaasData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"lodash-es": "*"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@faasjs/react": "2.
|
|
41
|
+
"@faasjs/react": "2.8.0",
|
|
42
42
|
"antd": "*",
|
|
43
43
|
"react": "*",
|
|
44
44
|
"react-dom": "*",
|
|
@@ -46,11 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/lodash-es": "*",
|
|
49
|
-
"@
|
|
50
|
-
"@testing-library/react": "*",
|
|
51
|
-
"@testing-library/user-event": "*",
|
|
52
|
-
"@welldone-software/why-did-you-render": "*",
|
|
53
|
-
"@faasjs/react": "2.6.1",
|
|
49
|
+
"@faasjs/react": "2.8.0",
|
|
54
50
|
"antd": "*",
|
|
55
51
|
"react": "*",
|
|
56
52
|
"react-dom": "*",
|