@faasjs/ant-design 0.0.4-beta.15 → 0.0.4-beta.17
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 +18 -4
- package/dist/index.d.mts +53 -42
- package/dist/index.d.ts +53 -42
- package/dist/index.js +63 -64
- package/dist/index.mjs +66 -67
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -447,7 +447,7 @@ ___
|
|
|
447
447
|
|
|
448
448
|
### ConfigProvider
|
|
449
449
|
|
|
450
|
-
▸ **ConfigProvider**(
|
|
450
|
+
▸ **ConfigProvider**(`props`): `Element`
|
|
451
451
|
|
|
452
452
|
Config for @faasjs/ant-design components.
|
|
453
453
|
|
|
@@ -465,9 +465,10 @@ Config for @faasjs/ant-design components.
|
|
|
465
465
|
|
|
466
466
|
| Name | Type |
|
|
467
467
|
| :------ | :------ |
|
|
468
|
-
|
|
|
469
|
-
|
|
|
470
|
-
|
|
|
468
|
+
| `props` | `Object` |
|
|
469
|
+
| `props.children` | `ReactNode` |
|
|
470
|
+
| `props.config` | [`ConfigProviderProps`](interfaces/ConfigProviderProps.md) |
|
|
471
|
+
| `props.faasClientOptions?` | `FaasReactClientOptions` |
|
|
471
472
|
|
|
472
473
|
#### Returns
|
|
473
474
|
|
|
@@ -715,6 +716,11 @@ ___
|
|
|
715
716
|
|
|
716
717
|
Table component with Ant Design & FaasJS
|
|
717
718
|
|
|
719
|
+
- Support all Ant Design Table props.
|
|
720
|
+
- Support FaasJS injection.
|
|
721
|
+
- Auto generate filter dropdown (disable with `filterDropdown: false`).
|
|
722
|
+
- Auto generate sorter (disable with `sorter: false`).
|
|
723
|
+
|
|
718
724
|
#### Type parameters
|
|
719
725
|
|
|
720
726
|
| Name | Type |
|
|
@@ -862,6 +868,14 @@ ___
|
|
|
862
868
|
|
|
863
869
|
▸ **useApp**(): [`useAppProps`](interfaces/useAppProps.md)
|
|
864
870
|
|
|
871
|
+
Get app context.
|
|
872
|
+
|
|
873
|
+
```ts
|
|
874
|
+
import { useApp } from '@faasjs/ant-design'
|
|
875
|
+
|
|
876
|
+
const { message, notification, setModalProps, setDrawerProps } = useApp()
|
|
877
|
+
```
|
|
878
|
+
|
|
865
879
|
#### Returns
|
|
866
880
|
|
|
867
881
|
[`useAppProps`](interfaces/useAppProps.md)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
1
|
+
import { ErrorBoundaryProps, FaasReactClientOptions, 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
4
|
import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
|
|
@@ -75,45 +75,6 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
75
75
|
|
|
76
76
|
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
77
77
|
|
|
78
|
-
interface AppProps {
|
|
79
|
-
children: React.ReactNode;
|
|
80
|
-
styleProviderProps?: StyleProviderProps;
|
|
81
|
-
configProviderProps?: ConfigProviderProps$1;
|
|
82
|
-
browserRouterProps?: BrowserRouterProps;
|
|
83
|
-
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
84
|
-
}
|
|
85
|
-
interface useAppProps {
|
|
86
|
-
message: MessageInstance;
|
|
87
|
-
notification: NotificationInstance;
|
|
88
|
-
setModalProps: (changes: Partial<ModalProps>) => void;
|
|
89
|
-
setDrawerProps: (changes: Partial<DrawerProps>) => void;
|
|
90
|
-
}
|
|
91
|
-
declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
|
|
92
|
-
declare namespace App {
|
|
93
|
-
var useApp: typeof useApp;
|
|
94
|
-
}
|
|
95
|
-
declare function useApp(): useAppProps;
|
|
96
|
-
|
|
97
|
-
interface BlankProps {
|
|
98
|
-
value?: any;
|
|
99
|
-
text?: string;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Blank component.
|
|
103
|
-
*
|
|
104
|
-
* If value is undefined or null, return text, otherwise return value.
|
|
105
|
-
*
|
|
106
|
-
* @param options {object}
|
|
107
|
-
* @param options.value {any}
|
|
108
|
-
* @param options.text {string} Default is 'Empty'
|
|
109
|
-
* @returns {JSX.Element}
|
|
110
|
-
*
|
|
111
|
-
* ```ts
|
|
112
|
-
* <Blank value={undefined} text="Empty" />
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
declare function Blank(options?: BlankProps): JSX.Element;
|
|
116
|
-
|
|
117
78
|
interface ConfigProviderProps {
|
|
118
79
|
lang?: string;
|
|
119
80
|
common?: {
|
|
@@ -160,12 +121,62 @@ declare const ConfigContext: react.Context<ConfigProviderProps>;
|
|
|
160
121
|
* </ConfigProvider>
|
|
161
122
|
* ```
|
|
162
123
|
*/
|
|
163
|
-
declare function ConfigProvider(
|
|
124
|
+
declare function ConfigProvider(props: {
|
|
164
125
|
config: ConfigProviderProps;
|
|
126
|
+
faasClientOptions?: FaasReactClientOptions;
|
|
165
127
|
children: React.ReactNode;
|
|
166
128
|
}): react_jsx_runtime.JSX.Element;
|
|
167
129
|
declare function useConfigContext(): ConfigProviderProps;
|
|
168
130
|
|
|
131
|
+
interface AppProps {
|
|
132
|
+
children: React.ReactNode;
|
|
133
|
+
styleProviderProps?: StyleProviderProps;
|
|
134
|
+
configProviderProps?: ConfigProviderProps$1;
|
|
135
|
+
browserRouterProps?: BrowserRouterProps;
|
|
136
|
+
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
137
|
+
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'>;
|
|
138
|
+
}
|
|
139
|
+
interface useAppProps {
|
|
140
|
+
message: MessageInstance;
|
|
141
|
+
notification: NotificationInstance;
|
|
142
|
+
setModalProps: (changes: Partial<ModalProps>) => void;
|
|
143
|
+
setDrawerProps: (changes: Partial<DrawerProps>) => void;
|
|
144
|
+
}
|
|
145
|
+
declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
|
|
146
|
+
declare namespace App {
|
|
147
|
+
var useApp: typeof useApp;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get app context.
|
|
151
|
+
*
|
|
152
|
+
* ```ts
|
|
153
|
+
* import { useApp } from '@faasjs/ant-design'
|
|
154
|
+
*
|
|
155
|
+
* const { message, notification, setModalProps, setDrawerProps } = useApp()
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
declare function useApp(): useAppProps;
|
|
159
|
+
|
|
160
|
+
interface BlankProps {
|
|
161
|
+
value?: any;
|
|
162
|
+
text?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Blank component.
|
|
166
|
+
*
|
|
167
|
+
* If value is undefined or null, return text, otherwise return value.
|
|
168
|
+
*
|
|
169
|
+
* @param options {object}
|
|
170
|
+
* @param options.value {any}
|
|
171
|
+
* @param options.text {string} Default is 'Empty'
|
|
172
|
+
* @returns {JSX.Element}
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* <Blank value={undefined} text="Empty" />
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare function Blank(options?: BlankProps): JSX.Element;
|
|
179
|
+
|
|
169
180
|
type ExtendFormTypeProps<T = any> = {
|
|
170
181
|
children?: UnionFaasItemElement<T>;
|
|
171
182
|
};
|
|
@@ -548,4 +559,4 @@ interface TitleProps {
|
|
|
548
559
|
*/
|
|
549
560
|
declare function Title(props: TitleProps): JSX.Element;
|
|
550
561
|
|
|
551
|
-
export { App, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, TabProps, Table, TableItemProps, TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useModal };
|
|
562
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
|
|
1
|
+
import { ErrorBoundaryProps, FaasReactClientOptions, 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
4
|
import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
|
|
@@ -75,45 +75,6 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
75
75
|
|
|
76
76
|
declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
|
|
77
77
|
|
|
78
|
-
interface AppProps {
|
|
79
|
-
children: React.ReactNode;
|
|
80
|
-
styleProviderProps?: StyleProviderProps;
|
|
81
|
-
configProviderProps?: ConfigProviderProps$1;
|
|
82
|
-
browserRouterProps?: BrowserRouterProps;
|
|
83
|
-
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
84
|
-
}
|
|
85
|
-
interface useAppProps {
|
|
86
|
-
message: MessageInstance;
|
|
87
|
-
notification: NotificationInstance;
|
|
88
|
-
setModalProps: (changes: Partial<ModalProps>) => void;
|
|
89
|
-
setDrawerProps: (changes: Partial<DrawerProps>) => void;
|
|
90
|
-
}
|
|
91
|
-
declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
|
|
92
|
-
declare namespace App {
|
|
93
|
-
var useApp: typeof useApp;
|
|
94
|
-
}
|
|
95
|
-
declare function useApp(): useAppProps;
|
|
96
|
-
|
|
97
|
-
interface BlankProps {
|
|
98
|
-
value?: any;
|
|
99
|
-
text?: string;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Blank component.
|
|
103
|
-
*
|
|
104
|
-
* If value is undefined or null, return text, otherwise return value.
|
|
105
|
-
*
|
|
106
|
-
* @param options {object}
|
|
107
|
-
* @param options.value {any}
|
|
108
|
-
* @param options.text {string} Default is 'Empty'
|
|
109
|
-
* @returns {JSX.Element}
|
|
110
|
-
*
|
|
111
|
-
* ```ts
|
|
112
|
-
* <Blank value={undefined} text="Empty" />
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
declare function Blank(options?: BlankProps): JSX.Element;
|
|
116
|
-
|
|
117
78
|
interface ConfigProviderProps {
|
|
118
79
|
lang?: string;
|
|
119
80
|
common?: {
|
|
@@ -160,12 +121,62 @@ declare const ConfigContext: react.Context<ConfigProviderProps>;
|
|
|
160
121
|
* </ConfigProvider>
|
|
161
122
|
* ```
|
|
162
123
|
*/
|
|
163
|
-
declare function ConfigProvider(
|
|
124
|
+
declare function ConfigProvider(props: {
|
|
164
125
|
config: ConfigProviderProps;
|
|
126
|
+
faasClientOptions?: FaasReactClientOptions;
|
|
165
127
|
children: React.ReactNode;
|
|
166
128
|
}): react_jsx_runtime.JSX.Element;
|
|
167
129
|
declare function useConfigContext(): ConfigProviderProps;
|
|
168
130
|
|
|
131
|
+
interface AppProps {
|
|
132
|
+
children: React.ReactNode;
|
|
133
|
+
styleProviderProps?: StyleProviderProps;
|
|
134
|
+
configProviderProps?: ConfigProviderProps$1;
|
|
135
|
+
browserRouterProps?: BrowserRouterProps;
|
|
136
|
+
errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
|
|
137
|
+
faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'>;
|
|
138
|
+
}
|
|
139
|
+
interface useAppProps {
|
|
140
|
+
message: MessageInstance;
|
|
141
|
+
notification: NotificationInstance;
|
|
142
|
+
setModalProps: (changes: Partial<ModalProps>) => void;
|
|
143
|
+
setDrawerProps: (changes: Partial<DrawerProps>) => void;
|
|
144
|
+
}
|
|
145
|
+
declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
|
|
146
|
+
declare namespace App {
|
|
147
|
+
var useApp: typeof useApp;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get app context.
|
|
151
|
+
*
|
|
152
|
+
* ```ts
|
|
153
|
+
* import { useApp } from '@faasjs/ant-design'
|
|
154
|
+
*
|
|
155
|
+
* const { message, notification, setModalProps, setDrawerProps } = useApp()
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
declare function useApp(): useAppProps;
|
|
159
|
+
|
|
160
|
+
interface BlankProps {
|
|
161
|
+
value?: any;
|
|
162
|
+
text?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Blank component.
|
|
166
|
+
*
|
|
167
|
+
* If value is undefined or null, return text, otherwise return value.
|
|
168
|
+
*
|
|
169
|
+
* @param options {object}
|
|
170
|
+
* @param options.value {any}
|
|
171
|
+
* @param options.text {string} Default is 'Empty'
|
|
172
|
+
* @returns {JSX.Element}
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* <Blank value={undefined} text="Empty" />
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare function Blank(options?: BlankProps): JSX.Element;
|
|
179
|
+
|
|
169
180
|
type ExtendFormTypeProps<T = any> = {
|
|
170
181
|
children?: UnionFaasItemElement<T>;
|
|
171
182
|
};
|
|
@@ -548,4 +559,4 @@ interface TitleProps {
|
|
|
548
559
|
*/
|
|
549
560
|
declare function Title(props: TitleProps): JSX.Element;
|
|
550
561
|
|
|
551
|
-
export { App, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, TabProps, Table, TableItemProps, TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useModal };
|
|
562
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -77,57 +77,6 @@ function ErrorChildren(props) {
|
|
|
77
77
|
function ErrorBoundary(props) {
|
|
78
78
|
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
79
79
|
}
|
|
80
|
-
var AppContext = react$1.createContext({
|
|
81
|
-
message: {},
|
|
82
|
-
notification: {},
|
|
83
|
-
setModalProps: () => void 0,
|
|
84
|
-
setDrawerProps: () => void 0
|
|
85
|
-
});
|
|
86
|
-
function RoutesApp(props) {
|
|
87
|
-
const location = reactRouterDom.useLocation();
|
|
88
|
-
const { setDrawerProps, setModalProps } = useApp();
|
|
89
|
-
react$1.useEffect(() => {
|
|
90
|
-
console.debug("location", location);
|
|
91
|
-
setDrawerProps({ open: false });
|
|
92
|
-
setModalProps({ open: false });
|
|
93
|
-
}, [location]);
|
|
94
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
95
|
-
}
|
|
96
|
-
function App(props) {
|
|
97
|
-
const [messageApi, messageContextHolder] = antd.message.useMessage();
|
|
98
|
-
const [notificationApi, notificationContextHolder] = antd.notification.useNotification();
|
|
99
|
-
const { modal, setModalProps } = useModal();
|
|
100
|
-
const { drawer, setDrawerProps } = useDrawer();
|
|
101
|
-
const memoizedContextValue = react$1.useMemo(
|
|
102
|
-
() => ({
|
|
103
|
-
message: messageApi,
|
|
104
|
-
notification: notificationApi,
|
|
105
|
-
setModalProps,
|
|
106
|
-
setDrawerProps
|
|
107
|
-
}),
|
|
108
|
-
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
109
|
-
);
|
|
110
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
111
|
-
cssinjs.StyleProvider,
|
|
112
|
-
{
|
|
113
|
-
...Object.assign(props.styleProviderProps || {}, {
|
|
114
|
-
hashPriority: "high",
|
|
115
|
-
transformers: [cssinjs.legacyLogicalPropertiesTransformer]
|
|
116
|
-
}),
|
|
117
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
|
|
118
|
-
messageContextHolder,
|
|
119
|
-
notificationContextHolder,
|
|
120
|
-
modal,
|
|
121
|
-
drawer,
|
|
122
|
-
/* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children })
|
|
123
|
-
] }) }) }) })
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
function useApp() {
|
|
128
|
-
return react$1.useContext(AppContext);
|
|
129
|
-
}
|
|
130
|
-
App.useApp = useApp;
|
|
131
80
|
var isZH = /^zh/i.test(navigator.language);
|
|
132
81
|
var zh = {
|
|
133
82
|
lang: "zh",
|
|
@@ -167,16 +116,13 @@ var baseConfig = {
|
|
|
167
116
|
Link: { style: {} }
|
|
168
117
|
};
|
|
169
118
|
var ConfigContext = react$1.createContext(baseConfig);
|
|
170
|
-
function
|
|
171
|
-
config,
|
|
172
|
-
children
|
|
173
|
-
}) {
|
|
119
|
+
function ConfigProvider(props) {
|
|
174
120
|
const [values, setValues] = react$1.useState(baseConfig);
|
|
175
121
|
react$1.useEffect(() => {
|
|
176
|
-
if (config.lang === "zh") {
|
|
122
|
+
if (props.config.lang === "zh") {
|
|
177
123
|
setValues(
|
|
178
124
|
lodashEs.defaultsDeep(
|
|
179
|
-
config,
|
|
125
|
+
props.config,
|
|
180
126
|
{
|
|
181
127
|
lang: "zh",
|
|
182
128
|
common: zh,
|
|
@@ -187,13 +133,66 @@ function ConfigProvider2({
|
|
|
187
133
|
)
|
|
188
134
|
);
|
|
189
135
|
} else
|
|
190
|
-
setValues(lodashEs.defaultsDeep(config, values));
|
|
136
|
+
setValues(lodashEs.defaultsDeep(props.config, values));
|
|
137
|
+
if (props.faasClientOptions)
|
|
138
|
+
react.FaasReactClient(props.faasClientOptions);
|
|
191
139
|
}, []);
|
|
192
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ConfigContext.Provider, { value: values, children });
|
|
140
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ConfigContext.Provider, { value: values, children: props.children });
|
|
193
141
|
}
|
|
194
142
|
function useConfigContext() {
|
|
195
143
|
return react$1.useContext(ConfigContext);
|
|
196
144
|
}
|
|
145
|
+
var AppContext = react$1.createContext({
|
|
146
|
+
message: {},
|
|
147
|
+
notification: {},
|
|
148
|
+
setModalProps: () => void 0,
|
|
149
|
+
setDrawerProps: () => void 0
|
|
150
|
+
});
|
|
151
|
+
function RoutesApp(props) {
|
|
152
|
+
const location = reactRouterDom.useLocation();
|
|
153
|
+
const { setDrawerProps, setModalProps } = useApp();
|
|
154
|
+
react$1.useEffect(() => {
|
|
155
|
+
console.debug("location", location);
|
|
156
|
+
setDrawerProps({ open: false });
|
|
157
|
+
setModalProps({ open: false });
|
|
158
|
+
}, [location]);
|
|
159
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
160
|
+
}
|
|
161
|
+
function App(props) {
|
|
162
|
+
const [messageApi, messageContextHolder] = antd.message.useMessage();
|
|
163
|
+
const [notificationApi, notificationContextHolder] = antd.notification.useNotification();
|
|
164
|
+
const { modal, setModalProps } = useModal();
|
|
165
|
+
const { drawer, setDrawerProps } = useDrawer();
|
|
166
|
+
const memoizedContextValue = react$1.useMemo(
|
|
167
|
+
() => ({
|
|
168
|
+
message: messageApi,
|
|
169
|
+
notification: notificationApi,
|
|
170
|
+
setModalProps,
|
|
171
|
+
setDrawerProps
|
|
172
|
+
}),
|
|
173
|
+
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
174
|
+
);
|
|
175
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
cssinjs.StyleProvider,
|
|
177
|
+
{
|
|
178
|
+
...Object.assign(props.styleProviderProps || {}, {
|
|
179
|
+
hashPriority: "high",
|
|
180
|
+
transformers: [cssinjs.legacyLogicalPropertiesTransformer]
|
|
181
|
+
}),
|
|
182
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(ConfigProvider, { config: props.faasConfigProviderProps || {}, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
|
|
183
|
+
messageContextHolder,
|
|
184
|
+
notificationContextHolder,
|
|
185
|
+
modal,
|
|
186
|
+
drawer,
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children })
|
|
188
|
+
] }) }) }) }) })
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
function useApp() {
|
|
193
|
+
return react$1.useContext(AppContext);
|
|
194
|
+
}
|
|
195
|
+
App.useApp = useApp;
|
|
197
196
|
function Blank(options) {
|
|
198
197
|
const { Blank: Blank2 } = useConfigContext();
|
|
199
198
|
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) || Blank2.text }) : options.value;
|
|
@@ -278,7 +277,7 @@ function DescriptionItemContent(props) {
|
|
|
278
277
|
}, [props]);
|
|
279
278
|
if (!computedProps)
|
|
280
279
|
return null;
|
|
281
|
-
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type])
|
|
280
|
+
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type]) {
|
|
282
281
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
283
282
|
return react$1.cloneElement(
|
|
284
283
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
@@ -288,15 +287,15 @@ function DescriptionItemContent(props) {
|
|
|
288
287
|
values: computedProps.values
|
|
289
288
|
}
|
|
290
289
|
);
|
|
291
|
-
|
|
290
|
+
if (computedProps.extendTypes[computedProps.item.type].render)
|
|
292
291
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
|
|
293
292
|
computedProps.value,
|
|
294
293
|
computedProps.values,
|
|
295
294
|
0,
|
|
296
295
|
"description"
|
|
297
296
|
) });
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
throw Error(`${computedProps.item.type} requires children or render`);
|
|
298
|
+
}
|
|
300
299
|
if (computedProps.item.descriptionChildren === null)
|
|
301
300
|
return null;
|
|
302
301
|
if (computedProps.item.descriptionChildren)
|
|
@@ -1611,7 +1610,7 @@ Object.defineProperty(exports, 'lazy', {
|
|
|
1611
1610
|
exports.App = App;
|
|
1612
1611
|
exports.Blank = Blank;
|
|
1613
1612
|
exports.ConfigContext = ConfigContext;
|
|
1614
|
-
exports.ConfigProvider =
|
|
1613
|
+
exports.ConfigProvider = ConfigProvider;
|
|
1615
1614
|
exports.Description = Description;
|
|
1616
1615
|
exports.ErrorBoundary = ErrorBoundary;
|
|
1617
1616
|
exports.FaasDataWrapper = FaasDataWrapper;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ErrorBoundary as ErrorBoundary$1, FaasDataWrapper as FaasDataWrapper$1, faas } from '@faasjs/react';
|
|
1
|
+
import { ErrorBoundary as ErrorBoundary$1, FaasReactClient, FaasDataWrapper as FaasDataWrapper$1, faas } from '@faasjs/react';
|
|
2
2
|
export { faas, useFaas } from '@faasjs/react';
|
|
3
|
-
import { Form as Form$1, Modal, Drawer, message, notification, ConfigProvider, Typography, Spin, Descriptions, Input, Button, Row, Col, TimePicker, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Alert, Space } from 'antd';
|
|
3
|
+
import { Form as Form$1, Modal, Drawer, message, notification, ConfigProvider as ConfigProvider$1, Typography, Spin, Descriptions, Input, Button, Row, Col, TimePicker, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Alert, Space } from 'antd';
|
|
4
4
|
export { Drawer, Modal } from 'antd';
|
|
5
5
|
import { StyleProvider, legacyLogicalPropertiesTransformer } from '@ant-design/cssinjs';
|
|
6
|
-
import { createContext, useState,
|
|
6
|
+
import { createContext, useState, useEffect, useContext, useMemo, cloneElement, useCallback, isValidElement, Suspense } from 'react';
|
|
7
7
|
export { lazy } from 'react';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { BrowserRouter, useNavigate, Link as Link$1, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
|
|
@@ -74,57 +74,6 @@ function ErrorChildren(props) {
|
|
|
74
74
|
function ErrorBoundary(props) {
|
|
75
75
|
return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
|
|
76
76
|
}
|
|
77
|
-
var AppContext = createContext({
|
|
78
|
-
message: {},
|
|
79
|
-
notification: {},
|
|
80
|
-
setModalProps: () => void 0,
|
|
81
|
-
setDrawerProps: () => void 0
|
|
82
|
-
});
|
|
83
|
-
function RoutesApp(props) {
|
|
84
|
-
const location = useLocation();
|
|
85
|
-
const { setDrawerProps, setModalProps } = useApp();
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
console.debug("location", location);
|
|
88
|
-
setDrawerProps({ open: false });
|
|
89
|
-
setModalProps({ open: false });
|
|
90
|
-
}, [location]);
|
|
91
|
-
return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
92
|
-
}
|
|
93
|
-
function App(props) {
|
|
94
|
-
const [messageApi, messageContextHolder] = message.useMessage();
|
|
95
|
-
const [notificationApi, notificationContextHolder] = notification.useNotification();
|
|
96
|
-
const { modal, setModalProps } = useModal();
|
|
97
|
-
const { drawer, setDrawerProps } = useDrawer();
|
|
98
|
-
const memoizedContextValue = useMemo(
|
|
99
|
-
() => ({
|
|
100
|
-
message: messageApi,
|
|
101
|
-
notification: notificationApi,
|
|
102
|
-
setModalProps,
|
|
103
|
-
setDrawerProps
|
|
104
|
-
}),
|
|
105
|
-
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
106
|
-
);
|
|
107
|
-
return /* @__PURE__ */ jsx(
|
|
108
|
-
StyleProvider,
|
|
109
|
-
{
|
|
110
|
-
...Object.assign(props.styleProviderProps || {}, {
|
|
111
|
-
hashPriority: "high",
|
|
112
|
-
transformers: [legacyLogicalPropertiesTransformer]
|
|
113
|
-
}),
|
|
114
|
-
children: /* @__PURE__ */ jsx(ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxs(BrowserRouter, { ...props.browserRouterProps, children: [
|
|
115
|
-
messageContextHolder,
|
|
116
|
-
notificationContextHolder,
|
|
117
|
-
modal,
|
|
118
|
-
drawer,
|
|
119
|
-
/* @__PURE__ */ jsx(RoutesApp, { children: props.children })
|
|
120
|
-
] }) }) }) })
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
function useApp() {
|
|
125
|
-
return useContext(AppContext);
|
|
126
|
-
}
|
|
127
|
-
App.useApp = useApp;
|
|
128
77
|
var isZH = /^zh/i.test(navigator.language);
|
|
129
78
|
var zh = {
|
|
130
79
|
lang: "zh",
|
|
@@ -164,16 +113,13 @@ var baseConfig = {
|
|
|
164
113
|
Link: { style: {} }
|
|
165
114
|
};
|
|
166
115
|
var ConfigContext = createContext(baseConfig);
|
|
167
|
-
function
|
|
168
|
-
config,
|
|
169
|
-
children
|
|
170
|
-
}) {
|
|
116
|
+
function ConfigProvider(props) {
|
|
171
117
|
const [values, setValues] = useState(baseConfig);
|
|
172
118
|
useEffect(() => {
|
|
173
|
-
if (config.lang === "zh") {
|
|
119
|
+
if (props.config.lang === "zh") {
|
|
174
120
|
setValues(
|
|
175
121
|
defaultsDeep(
|
|
176
|
-
config,
|
|
122
|
+
props.config,
|
|
177
123
|
{
|
|
178
124
|
lang: "zh",
|
|
179
125
|
common: zh,
|
|
@@ -184,13 +130,66 @@ function ConfigProvider2({
|
|
|
184
130
|
)
|
|
185
131
|
);
|
|
186
132
|
} else
|
|
187
|
-
setValues(defaultsDeep(config, values));
|
|
133
|
+
setValues(defaultsDeep(props.config, values));
|
|
134
|
+
if (props.faasClientOptions)
|
|
135
|
+
FaasReactClient(props.faasClientOptions);
|
|
188
136
|
}, []);
|
|
189
|
-
return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: values, children });
|
|
137
|
+
return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: values, children: props.children });
|
|
190
138
|
}
|
|
191
139
|
function useConfigContext() {
|
|
192
140
|
return useContext(ConfigContext);
|
|
193
141
|
}
|
|
142
|
+
var AppContext = createContext({
|
|
143
|
+
message: {},
|
|
144
|
+
notification: {},
|
|
145
|
+
setModalProps: () => void 0,
|
|
146
|
+
setDrawerProps: () => void 0
|
|
147
|
+
});
|
|
148
|
+
function RoutesApp(props) {
|
|
149
|
+
const location = useLocation();
|
|
150
|
+
const { setDrawerProps, setModalProps } = useApp();
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
console.debug("location", location);
|
|
153
|
+
setDrawerProps({ open: false });
|
|
154
|
+
setModalProps({ open: false });
|
|
155
|
+
}, [location]);
|
|
156
|
+
return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
157
|
+
}
|
|
158
|
+
function App(props) {
|
|
159
|
+
const [messageApi, messageContextHolder] = message.useMessage();
|
|
160
|
+
const [notificationApi, notificationContextHolder] = notification.useNotification();
|
|
161
|
+
const { modal, setModalProps } = useModal();
|
|
162
|
+
const { drawer, setDrawerProps } = useDrawer();
|
|
163
|
+
const memoizedContextValue = useMemo(
|
|
164
|
+
() => ({
|
|
165
|
+
message: messageApi,
|
|
166
|
+
notification: notificationApi,
|
|
167
|
+
setModalProps,
|
|
168
|
+
setDrawerProps
|
|
169
|
+
}),
|
|
170
|
+
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
171
|
+
);
|
|
172
|
+
return /* @__PURE__ */ jsx(
|
|
173
|
+
StyleProvider,
|
|
174
|
+
{
|
|
175
|
+
...Object.assign(props.styleProviderProps || {}, {
|
|
176
|
+
hashPriority: "high",
|
|
177
|
+
transformers: [legacyLogicalPropertiesTransformer]
|
|
178
|
+
}),
|
|
179
|
+
children: /* @__PURE__ */ jsx(ConfigProvider$1, { ...props.configProviderProps, children: /* @__PURE__ */ jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsx(ConfigProvider, { config: props.faasConfigProviderProps || {}, children: /* @__PURE__ */ jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxs(BrowserRouter, { ...props.browserRouterProps, children: [
|
|
180
|
+
messageContextHolder,
|
|
181
|
+
notificationContextHolder,
|
|
182
|
+
modal,
|
|
183
|
+
drawer,
|
|
184
|
+
/* @__PURE__ */ jsx(RoutesApp, { children: props.children })
|
|
185
|
+
] }) }) }) }) })
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function useApp() {
|
|
190
|
+
return useContext(AppContext);
|
|
191
|
+
}
|
|
192
|
+
App.useApp = useApp;
|
|
194
193
|
function Blank(options) {
|
|
195
194
|
const { Blank: Blank2 } = useConfigContext();
|
|
196
195
|
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx(Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
|
|
@@ -275,7 +274,7 @@ function DescriptionItemContent(props) {
|
|
|
275
274
|
}, [props]);
|
|
276
275
|
if (!computedProps)
|
|
277
276
|
return null;
|
|
278
|
-
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type])
|
|
277
|
+
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type]) {
|
|
279
278
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
280
279
|
return cloneElement(
|
|
281
280
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
@@ -285,15 +284,15 @@ function DescriptionItemContent(props) {
|
|
|
285
284
|
values: computedProps.values
|
|
286
285
|
}
|
|
287
286
|
);
|
|
288
|
-
|
|
287
|
+
if (computedProps.extendTypes[computedProps.item.type].render)
|
|
289
288
|
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
|
|
290
289
|
computedProps.value,
|
|
291
290
|
computedProps.values,
|
|
292
291
|
0,
|
|
293
292
|
"description"
|
|
294
293
|
) });
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
throw Error(`${computedProps.item.type} requires children or render`);
|
|
295
|
+
}
|
|
297
296
|
if (computedProps.item.descriptionChildren === null)
|
|
298
297
|
return null;
|
|
299
298
|
if (computedProps.item.descriptionChildren)
|
|
@@ -1585,4 +1584,4 @@ function Title(props) {
|
|
|
1585
1584
|
return null;
|
|
1586
1585
|
}
|
|
1587
1586
|
|
|
1588
|
-
export { App, Blank, ConfigContext,
|
|
1587
|
+
export { App, Blank, ConfigContext, ConfigProvider, Description, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, PageNotFound, Routes, Table, Tabs, Title, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useModal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.4-beta.
|
|
3
|
+
"version": "0.0.4-beta.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lodash-es": "*"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@faasjs/react": "0.0.4-beta.
|
|
29
|
+
"@faasjs/react": "0.0.4-beta.17",
|
|
30
30
|
"antd": "*",
|
|
31
31
|
"react": "*",
|
|
32
32
|
"react-dom": "*",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@testing-library/jest-dom": "*",
|
|
38
38
|
"@testing-library/react": "*",
|
|
39
39
|
"@testing-library/user-event": "*",
|
|
40
|
-
"@faasjs/react": "0.0.4-beta.
|
|
40
|
+
"@faasjs/react": "0.0.4-beta.17",
|
|
41
41
|
"antd": "*",
|
|
42
42
|
"react": "*",
|
|
43
43
|
"react-dom": "*",
|