@faasjs/ant-design 6.11.0 → 6.12.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 +2 -0
- package/dist/index.cjs +72 -51
- package/dist/index.d.ts +62 -62
- package/dist/index.mjs +71 -54
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ type FaasItemProps = {
|
|
|
45
45
|
- [ErrorBoundary](functions/ErrorBoundary.md)
|
|
46
46
|
- [faas](functions/faas.md)
|
|
47
47
|
- [FaasDataWrapper](functions/FaasDataWrapper.md)
|
|
48
|
+
- [FaasReactClient](functions/FaasReactClient.md)
|
|
48
49
|
- [Form](functions/Form.md)
|
|
49
50
|
- [FormItem](functions/FormItem.md)
|
|
50
51
|
- [idToTitle](functions/idToTitle.md)
|
|
@@ -103,6 +104,7 @@ type FaasItemProps = {
|
|
|
103
104
|
- [FaasDataWrapperRef](type-aliases/FaasDataWrapperRef.md)
|
|
104
105
|
- [FaasItemType](type-aliases/FaasItemType.md)
|
|
105
106
|
- [FaasItemTypeValue](type-aliases/FaasItemTypeValue.md)
|
|
107
|
+
- [FaasReactClientOptions](type-aliases/FaasReactClientOptions.md)
|
|
106
108
|
- [FormSubmitProps](type-aliases/FormSubmitProps.md)
|
|
107
109
|
- [LoadingProps](type-aliases/LoadingProps.md)
|
|
108
110
|
- [setDrawerProps](type-aliases/setDrawerProps.md)
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var react = require('@faasjs/react');
|
|
4
3
|
var cssinjs = require('@ant-design/cssinjs');
|
|
4
|
+
var react = require('@faasjs/react');
|
|
5
5
|
var antd = require('antd');
|
|
6
6
|
var reactRouterDom = require('react-router-dom');
|
|
7
7
|
var lodashEs = require('lodash-es');
|
|
@@ -14,7 +14,40 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
14
14
|
|
|
15
15
|
var dayjs2__default = /*#__PURE__*/_interopDefault(dayjs2);
|
|
16
16
|
|
|
17
|
-
// src/
|
|
17
|
+
// src/App.tsx
|
|
18
|
+
function Loading(props) {
|
|
19
|
+
if (props.loading === false) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
style: {
|
|
24
|
+
...props.style || {},
|
|
25
|
+
...!props.size || props.size === "large" ? {
|
|
26
|
+
margin: "20vh auto",
|
|
27
|
+
textAlign: "center"
|
|
28
|
+
} : {}
|
|
29
|
+
},
|
|
30
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { size: props.size || "large" })
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
Loading.whyDidYouRender = true;
|
|
35
|
+
function FaasDataWrapper(props) {
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
+
react.FaasDataWrapper,
|
|
38
|
+
{
|
|
39
|
+
fallback: props.loading || /* @__PURE__ */ jsxRuntime.jsx(Loading, { ...props.loadingProps }),
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
FaasDataWrapper.whyDidYouRender = true;
|
|
45
|
+
function withFaasData(Component, faasProps) {
|
|
46
|
+
return react.withFaasData(Component, {
|
|
47
|
+
fallback: faasProps.loading || /* @__PURE__ */ jsxRuntime.jsx(Loading, { ...faasProps.loadingProps }),
|
|
48
|
+
...faasProps
|
|
49
|
+
});
|
|
50
|
+
}
|
|
18
51
|
var zh = {
|
|
19
52
|
lang: "zh",
|
|
20
53
|
blank: "\u7A7A",
|
|
@@ -54,7 +87,7 @@ var ConfigContext = react$1.createContext({
|
|
|
54
87
|
theme: baseTheme
|
|
55
88
|
});
|
|
56
89
|
function ConfigProvider(props) {
|
|
57
|
-
const [theme2, setTheme] = react$1.useState(
|
|
90
|
+
const [theme2, setTheme] = react$1.useState();
|
|
58
91
|
react.useEqualEffect(() => {
|
|
59
92
|
const lang = props.theme?.lang || (!props.theme?.lang && /^zh/i.test(navigator.language) ? "zh" : "en");
|
|
60
93
|
if (lang === "zh") {
|
|
@@ -182,9 +215,9 @@ function App(props) {
|
|
|
182
215
|
const { drawer, drawerProps, setDrawerProps } = useDrawer();
|
|
183
216
|
const styleProviderProps = react.useEqualMemo(
|
|
184
217
|
() => ({
|
|
185
|
-
...props.styleProviderProps,
|
|
186
218
|
hashPriority: "high",
|
|
187
|
-
transformers: [cssinjs.legacyLogicalPropertiesTransformer]
|
|
219
|
+
transformers: [cssinjs.legacyLogicalPropertiesTransformer],
|
|
220
|
+
...props.styleProviderProps
|
|
188
221
|
}),
|
|
189
222
|
[props.styleProviderProps]
|
|
190
223
|
);
|
|
@@ -211,21 +244,38 @@ function App(props) {
|
|
|
211
244
|
modalProps,
|
|
212
245
|
setModalProps
|
|
213
246
|
},
|
|
214
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
215
|
-
|
|
247
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
+
ConfigProvider,
|
|
216
249
|
{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
250
|
+
...props.faasConfigProviderProps,
|
|
251
|
+
faasClientOptions: {
|
|
252
|
+
onError: (action) => async (res) => {
|
|
253
|
+
if ("message" in res && res.message.includes("AbortError"))
|
|
254
|
+
return;
|
|
255
|
+
console.error(`[FaasJS][${action}]`, res);
|
|
256
|
+
messageApi.error(
|
|
257
|
+
"message" in res ? res.message : "Unknown error"
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
...props.faasConfigProviderProps ? props.faasConfigProviderProps.faasClientOptions : {}
|
|
261
|
+
},
|
|
262
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
263
|
+
react.OptionalWrapper,
|
|
264
|
+
{
|
|
265
|
+
condition: typeof document !== "undefined" && props.browserRouterProps !== false,
|
|
266
|
+
Wrapper: reactRouterDom.BrowserRouter,
|
|
267
|
+
wrapperProps: props.browserRouterProps,
|
|
268
|
+
children: [
|
|
269
|
+
messageContextHolder,
|
|
270
|
+
notificationContextHolder,
|
|
271
|
+
modal,
|
|
272
|
+
drawer,
|
|
273
|
+
props.browserRouterProps !== false ? /* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children }) : props.children
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
) })
|
|
227
277
|
}
|
|
228
|
-
)
|
|
278
|
+
)
|
|
229
279
|
}
|
|
230
280
|
)
|
|
231
281
|
}
|
|
@@ -288,39 +338,6 @@ function cloneUnionFaasItemElement(element, props) {
|
|
|
288
338
|
props
|
|
289
339
|
);
|
|
290
340
|
}
|
|
291
|
-
function Loading(props) {
|
|
292
|
-
if (props.loading === false) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
293
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
294
|
-
"div",
|
|
295
|
-
{
|
|
296
|
-
style: {
|
|
297
|
-
...props.style || {},
|
|
298
|
-
...!props.size || props.size === "large" ? {
|
|
299
|
-
margin: "20vh auto",
|
|
300
|
-
textAlign: "center"
|
|
301
|
-
} : {}
|
|
302
|
-
},
|
|
303
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { size: props.size || "large" })
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
Loading.whyDidYouRender = true;
|
|
308
|
-
function FaasDataWrapper(props) {
|
|
309
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
-
react.FaasDataWrapper,
|
|
311
|
-
{
|
|
312
|
-
fallback: props.loading || /* @__PURE__ */ jsxRuntime.jsx(Loading, { ...props.loadingProps }),
|
|
313
|
-
...props
|
|
314
|
-
}
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
FaasDataWrapper.whyDidYouRender = true;
|
|
318
|
-
function withFaasData(Component, faasProps) {
|
|
319
|
-
return react.withFaasData(Component, {
|
|
320
|
-
fallback: faasProps.loading || /* @__PURE__ */ jsxRuntime.jsx(Loading, { ...faasProps.loadingProps }),
|
|
321
|
-
...faasProps
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
341
|
function DescriptionItemContent(props) {
|
|
325
342
|
const [computedProps, setComputedProps] = react$1.useState();
|
|
326
343
|
react$1.useEffect(() => {
|
|
@@ -1565,6 +1582,10 @@ function useThemeToken() {
|
|
|
1565
1582
|
return config.token;
|
|
1566
1583
|
}
|
|
1567
1584
|
|
|
1585
|
+
Object.defineProperty(exports, "FaasReactClient", {
|
|
1586
|
+
enumerable: true,
|
|
1587
|
+
get: function () { return react.FaasReactClient; }
|
|
1588
|
+
});
|
|
1568
1589
|
Object.defineProperty(exports, "faas", {
|
|
1569
1590
|
enumerable: true,
|
|
1570
1591
|
get: function () { return react.faas; }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { FaasReactClientOptions, ErrorBoundaryProps, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataInjection as FaasDataInjection$1 } from '@faasjs/react';
|
|
2
|
-
export { ErrorBoundaryProps, FaasDataWrapperRef, faas, useFaas } from '@faasjs/react';
|
|
3
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
2
|
import { StyleProviderProps } from '@ant-design/cssinjs';
|
|
5
3
|
import { DrawerProps as DrawerProps$1, ModalProps as ModalProps$1, ConfigProviderProps as ConfigProviderProps$1, DescriptionsProps, FormItemProps as FormItemProps$1, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, FormInstance, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1, GlobalToken } from 'antd';
|
|
@@ -7,8 +5,10 @@ import { MessageInstance } from 'antd/es/message/interface';
|
|
|
7
5
|
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
8
6
|
import { BrowserRouterProps, RouteProps } from 'react-router-dom';
|
|
9
7
|
import * as react from 'react';
|
|
10
|
-
import {
|
|
8
|
+
import { JSX, CSSProperties, Dispatch, SetStateAction, ReactNode, ReactElement, FC, LazyExoticComponent, ComponentType } from 'react';
|
|
11
9
|
export { lazy } from 'react';
|
|
10
|
+
import { FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataInjection as FaasDataInjection$1, FaasReactClientOptions, ErrorBoundaryProps } from '@faasjs/react';
|
|
11
|
+
export { ErrorBoundaryProps, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from '@faasjs/react';
|
|
12
12
|
import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
|
|
13
13
|
import * as antd_es_modal_useModal from 'antd/es/modal/useModal';
|
|
14
14
|
import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
|
|
@@ -24,6 +24,65 @@ 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
|
+
type LoadingProps = {
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
size?: 'small' | 'default' | 'large';
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Loading component based on Spin
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <Loading /> // display loading
|
|
39
|
+
*
|
|
40
|
+
* <Loading loading={ !remoteData }>
|
|
41
|
+
* <div>{remoteData}</div>
|
|
42
|
+
* </Loading>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
|
|
46
|
+
declare namespace Loading {
|
|
47
|
+
var whyDidYouRender: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
|
|
51
|
+
interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
52
|
+
loadingProps?: LoadingProps;
|
|
53
|
+
loading?: JSX.Element;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* FaasDataWrapper component with Loading
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* function MyComponent (props: FaasDataInjection) {
|
|
62
|
+
* return <div>{ props.data }</div>
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* function MyPage () {
|
|
66
|
+
* return <FaasDataWrapper action="test" params={{ a: 1 }}>
|
|
67
|
+
* <MyComponent />
|
|
68
|
+
* </FaasDataWrapper>
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
73
|
+
declare namespace FaasDataWrapper {
|
|
74
|
+
var whyDidYouRender: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* HOC to wrap a component with FaasDataWrapper and Loading
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* const MyComponent = withFaasData(({ data }) => <div>{data.name}</div>, { action: 'test', params: { a: 1 } })
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
declare function withFaasData<PathOrData extends FaasActionUnionType, TComponentProps extends Required<FaasDataInjection<PathOrData>> = Required<FaasDataInjection<PathOrData>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<PathOrData>): React.FC<Omit<TComponentProps, keyof FaasDataInjection<PathOrData>>>;
|
|
85
|
+
|
|
27
86
|
interface ConfigProviderProps {
|
|
28
87
|
faasClientOptions?: FaasReactClientOptions;
|
|
29
88
|
children: React.ReactNode;
|
|
@@ -238,65 +297,6 @@ declare namespace Blank {
|
|
|
238
297
|
var whyDidYouRender: boolean;
|
|
239
298
|
}
|
|
240
299
|
|
|
241
|
-
type LoadingProps = {
|
|
242
|
-
style?: React.CSSProperties;
|
|
243
|
-
size?: 'small' | 'default' | 'large';
|
|
244
|
-
loading?: boolean;
|
|
245
|
-
children?: React.ReactNode;
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* Loading component based on Spin
|
|
249
|
-
*
|
|
250
|
-
* @example
|
|
251
|
-
* ```tsx
|
|
252
|
-
* <Loading /> // display loading
|
|
253
|
-
*
|
|
254
|
-
* <Loading loading={ !remoteData }>
|
|
255
|
-
* <div>{remoteData}</div>
|
|
256
|
-
* </Loading>
|
|
257
|
-
* ```
|
|
258
|
-
*/
|
|
259
|
-
declare function Loading(props: LoadingProps): react_jsx_runtime.JSX.Element;
|
|
260
|
-
declare namespace Loading {
|
|
261
|
-
var whyDidYouRender: boolean;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
|
|
265
|
-
interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
266
|
-
loadingProps?: LoadingProps;
|
|
267
|
-
loading?: JSX.Element;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* FaasDataWrapper component with Loading
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* ```tsx
|
|
275
|
-
* function MyComponent (props: FaasDataInjection) {
|
|
276
|
-
* return <div>{ props.data }</div>
|
|
277
|
-
* }
|
|
278
|
-
*
|
|
279
|
-
* function MyPage () {
|
|
280
|
-
* return <FaasDataWrapper action="test" params={{ a: 1 }}>
|
|
281
|
-
* <MyComponent />
|
|
282
|
-
* </FaasDataWrapper>
|
|
283
|
-
* }
|
|
284
|
-
* ```
|
|
285
|
-
*/
|
|
286
|
-
declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
|
|
287
|
-
declare namespace FaasDataWrapper {
|
|
288
|
-
var whyDidYouRender: boolean;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* HOC to wrap a component with FaasDataWrapper and Loading
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* ```tsx
|
|
295
|
-
* const MyComponent = withFaasData(({ data }) => <div>{data.name}</div>, { action: 'test', params: { a: 1 } })
|
|
296
|
-
* ```
|
|
297
|
-
*/
|
|
298
|
-
declare function withFaasData<PathOrData extends FaasActionUnionType, TComponentProps extends Required<FaasDataInjection<PathOrData>> = Required<FaasDataInjection<PathOrData>>>(Component: React.FC<TComponentProps & Record<string, any>>, faasProps: FaasDataWrapperProps<PathOrData>): React.FC<Omit<TComponentProps, keyof FaasDataInjection<PathOrData>>>;
|
|
299
|
-
|
|
300
300
|
interface ExtendDescriptionTypeProps<T = any> {
|
|
301
301
|
children?: UnionFaasItemElement<T>;
|
|
302
302
|
render?: UnionFaasItemRender<T>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,49 @@
|
|
|
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
|
-
export { faas, useFaas } from '@faasjs/react';
|
|
3
1
|
import { legacyLogicalPropertiesTransformer, StyleProvider } from '@ant-design/cssinjs';
|
|
4
|
-
import {
|
|
2
|
+
import { createSplittingContext, FaasDataWrapper as FaasDataWrapper$1, withFaasData as withFaasData$1, useEqualEffect, FaasReactClient, useEqualCallback, ErrorBoundary as ErrorBoundary$1, useEqualMemo, OptionalWrapper, faas } from '@faasjs/react';
|
|
3
|
+
export { FaasReactClient, faas, useFaas } from '@faasjs/react';
|
|
4
|
+
import { Drawer as Drawer$1, Modal as Modal$1, Form as Form$1, Spin, message, notification, ConfigProvider as ConfigProvider$1, Typography, Descriptions, Input, Button, Row, Col, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, theme, Alert, Space } from 'antd';
|
|
5
5
|
import { BrowserRouter, useNavigate, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
|
|
6
6
|
import { defaultsDeep, cloneDeep, isNil, uniqBy } from 'lodash-es';
|
|
7
7
|
import { createContext, useState, useContext, cloneElement, createElement, isValidElement, useEffect, Suspense } from 'react';
|
|
8
8
|
export { lazy } from 'react';
|
|
9
|
-
import { jsx,
|
|
9
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
10
10
|
import dayjs2 from 'dayjs';
|
|
11
11
|
import { PlusOutlined, MinusCircleOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
|
|
12
12
|
|
|
13
|
-
// src/
|
|
13
|
+
// src/App.tsx
|
|
14
|
+
function Loading(props) {
|
|
15
|
+
if (props.loading === false) return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
style: {
|
|
20
|
+
...props.style || {},
|
|
21
|
+
...!props.size || props.size === "large" ? {
|
|
22
|
+
margin: "20vh auto",
|
|
23
|
+
textAlign: "center"
|
|
24
|
+
} : {}
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ jsx(Spin, { size: props.size || "large" })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
Loading.whyDidYouRender = true;
|
|
31
|
+
function FaasDataWrapper(props) {
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
FaasDataWrapper$1,
|
|
34
|
+
{
|
|
35
|
+
fallback: props.loading || /* @__PURE__ */ jsx(Loading, { ...props.loadingProps }),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
FaasDataWrapper.whyDidYouRender = true;
|
|
41
|
+
function withFaasData(Component, faasProps) {
|
|
42
|
+
return withFaasData$1(Component, {
|
|
43
|
+
fallback: faasProps.loading || /* @__PURE__ */ jsx(Loading, { ...faasProps.loadingProps }),
|
|
44
|
+
...faasProps
|
|
45
|
+
});
|
|
46
|
+
}
|
|
14
47
|
var zh = {
|
|
15
48
|
lang: "zh",
|
|
16
49
|
blank: "\u7A7A",
|
|
@@ -50,7 +83,7 @@ var ConfigContext = createContext({
|
|
|
50
83
|
theme: baseTheme
|
|
51
84
|
});
|
|
52
85
|
function ConfigProvider(props) {
|
|
53
|
-
const [theme2, setTheme] = useState(
|
|
86
|
+
const [theme2, setTheme] = useState();
|
|
54
87
|
useEqualEffect(() => {
|
|
55
88
|
const lang = props.theme?.lang || (!props.theme?.lang && /^zh/i.test(navigator.language) ? "zh" : "en");
|
|
56
89
|
if (lang === "zh") {
|
|
@@ -178,9 +211,9 @@ function App(props) {
|
|
|
178
211
|
const { drawer, drawerProps, setDrawerProps } = useDrawer();
|
|
179
212
|
const styleProviderProps = useEqualMemo(
|
|
180
213
|
() => ({
|
|
181
|
-
...props.styleProviderProps,
|
|
182
214
|
hashPriority: "high",
|
|
183
|
-
transformers: [legacyLogicalPropertiesTransformer]
|
|
215
|
+
transformers: [legacyLogicalPropertiesTransformer],
|
|
216
|
+
...props.styleProviderProps
|
|
184
217
|
}),
|
|
185
218
|
[props.styleProviderProps]
|
|
186
219
|
);
|
|
@@ -207,21 +240,38 @@ function App(props) {
|
|
|
207
240
|
modalProps,
|
|
208
241
|
setModalProps
|
|
209
242
|
},
|
|
210
|
-
children: /* @__PURE__ */ jsx(
|
|
211
|
-
|
|
243
|
+
children: /* @__PURE__ */ jsx(
|
|
244
|
+
ConfigProvider,
|
|
212
245
|
{
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
246
|
+
...props.faasConfigProviderProps,
|
|
247
|
+
faasClientOptions: {
|
|
248
|
+
onError: (action) => async (res) => {
|
|
249
|
+
if ("message" in res && res.message.includes("AbortError"))
|
|
250
|
+
return;
|
|
251
|
+
console.error(`[FaasJS][${action}]`, res);
|
|
252
|
+
messageApi.error(
|
|
253
|
+
"message" in res ? res.message : "Unknown error"
|
|
254
|
+
);
|
|
255
|
+
},
|
|
256
|
+
...props.faasConfigProviderProps ? props.faasConfigProviderProps.faasClientOptions : {}
|
|
257
|
+
},
|
|
258
|
+
children: /* @__PURE__ */ jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxs(
|
|
259
|
+
OptionalWrapper,
|
|
260
|
+
{
|
|
261
|
+
condition: typeof document !== "undefined" && props.browserRouterProps !== false,
|
|
262
|
+
Wrapper: BrowserRouter,
|
|
263
|
+
wrapperProps: props.browserRouterProps,
|
|
264
|
+
children: [
|
|
265
|
+
messageContextHolder,
|
|
266
|
+
notificationContextHolder,
|
|
267
|
+
modal,
|
|
268
|
+
drawer,
|
|
269
|
+
props.browserRouterProps !== false ? /* @__PURE__ */ jsx(RoutesApp, { children: props.children }) : props.children
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
) })
|
|
223
273
|
}
|
|
224
|
-
)
|
|
274
|
+
)
|
|
225
275
|
}
|
|
226
276
|
)
|
|
227
277
|
}
|
|
@@ -284,39 +334,6 @@ function cloneUnionFaasItemElement(element, props) {
|
|
|
284
334
|
props
|
|
285
335
|
);
|
|
286
336
|
}
|
|
287
|
-
function Loading(props) {
|
|
288
|
-
if (props.loading === false) return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
289
|
-
return /* @__PURE__ */ jsx(
|
|
290
|
-
"div",
|
|
291
|
-
{
|
|
292
|
-
style: {
|
|
293
|
-
...props.style || {},
|
|
294
|
-
...!props.size || props.size === "large" ? {
|
|
295
|
-
margin: "20vh auto",
|
|
296
|
-
textAlign: "center"
|
|
297
|
-
} : {}
|
|
298
|
-
},
|
|
299
|
-
children: /* @__PURE__ */ jsx(Spin, { size: props.size || "large" })
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
Loading.whyDidYouRender = true;
|
|
304
|
-
function FaasDataWrapper(props) {
|
|
305
|
-
return /* @__PURE__ */ jsx(
|
|
306
|
-
FaasDataWrapper$1,
|
|
307
|
-
{
|
|
308
|
-
fallback: props.loading || /* @__PURE__ */ jsx(Loading, { ...props.loadingProps }),
|
|
309
|
-
...props
|
|
310
|
-
}
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
FaasDataWrapper.whyDidYouRender = true;
|
|
314
|
-
function withFaasData(Component, faasProps) {
|
|
315
|
-
return withFaasData$1(Component, {
|
|
316
|
-
fallback: faasProps.loading || /* @__PURE__ */ jsx(Loading, { ...faasProps.loadingProps }),
|
|
317
|
-
...faasProps
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
337
|
function DescriptionItemContent(props) {
|
|
321
338
|
const [computedProps, setComputedProps] = useState();
|
|
322
339
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@faasjs/react": ">=6.
|
|
33
|
+
"@faasjs/react": ">=6.12.0",
|
|
34
34
|
"antd": "*",
|
|
35
35
|
"@ant-design/icons": "*",
|
|
36
36
|
"lodash-es": "*",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/lodash-es": "*",
|
|
43
|
-
"@faasjs/react": ">=6.
|
|
43
|
+
"@faasjs/react": ">=6.12.0",
|
|
44
44
|
"antd": "*",
|
|
45
45
|
"@ant-design/icons": "*",
|
|
46
46
|
"lodash-es": "*",
|