@faasjs/ant-design 2.6.1 → 2.7.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
@@ -145,16 +145,24 @@ declare function useConfigContext(): Partial<ConfigProviderProps>;
145
145
 
146
146
  interface AppProps {
147
147
  children: React.ReactNode;
148
- /** https://ant.design/docs/react/compatible-style#styleprovider */
149
- styleProviderProps?: StyleProviderProps;
150
- /** https://ant.design/components/config-provider/#API */
148
+ /**
149
+ * `false` to disable StyleProvider.
150
+ *
151
+ * @see https://ant.design/docs/react/compatible-style#styleprovider
152
+ */
153
+ styleProviderProps?: StyleProviderProps | false;
154
+ /** @see https://ant.design/components/config-provider/#API */
151
155
  configProviderProps?: ConfigProviderProps$1;
152
- /** https://reactrouter.com/en/router-components/browser-router */
153
- browserRouterProps?: BrowserRouterProps;
154
- /** https://faasjs.com/doc/ant-design/#errorboundary */
156
+ /**
157
+ * `false` to disable BrowserRouter.
158
+ *
159
+ * @see https://reactrouter.com/en/router-components/browser-router
160
+ */
161
+ browserRouterProps?: BrowserRouterProps | false;
162
+ /** @see https://faasjs.com/doc/ant-design/#errorboundary */
155
163
  errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
156
- /** https://faasjs.com/doc/ant-design/#configprovider */
157
- faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'>;
164
+ /** @see https://faasjs.com/doc/ant-design/#configprovider */
165
+ faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
158
166
  }
159
167
  interface useAppProps {
160
168
  message: MessageInstance;
@@ -571,7 +579,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps ex
571
579
  footer?: JSX.Element | JSX.Element[];
572
580
  extendTypes?: ExtendTypes;
573
581
  children?: ReactNode;
574
- initialValues?: Values;
582
+ initialValues?: Partial<Values>;
575
583
  }
576
584
  /**
577
585
  * Form component with Ant Design & FaasJS
package/dist/index.d.ts CHANGED
@@ -145,16 +145,24 @@ declare function useConfigContext(): Partial<ConfigProviderProps>;
145
145
 
146
146
  interface AppProps {
147
147
  children: React.ReactNode;
148
- /** https://ant.design/docs/react/compatible-style#styleprovider */
149
- styleProviderProps?: StyleProviderProps;
150
- /** https://ant.design/components/config-provider/#API */
148
+ /**
149
+ * `false` to disable StyleProvider.
150
+ *
151
+ * @see https://ant.design/docs/react/compatible-style#styleprovider
152
+ */
153
+ styleProviderProps?: StyleProviderProps | false;
154
+ /** @see https://ant.design/components/config-provider/#API */
151
155
  configProviderProps?: ConfigProviderProps$1;
152
- /** https://reactrouter.com/en/router-components/browser-router */
153
- browserRouterProps?: BrowserRouterProps;
154
- /** https://faasjs.com/doc/ant-design/#errorboundary */
156
+ /**
157
+ * `false` to disable BrowserRouter.
158
+ *
159
+ * @see https://reactrouter.com/en/router-components/browser-router
160
+ */
161
+ browserRouterProps?: BrowserRouterProps | false;
162
+ /** @see https://faasjs.com/doc/ant-design/#errorboundary */
155
163
  errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
156
- /** https://faasjs.com/doc/ant-design/#configprovider */
157
- faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'>;
164
+ /** @see https://faasjs.com/doc/ant-design/#configprovider */
165
+ faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'> | false;
158
166
  }
159
167
  interface useAppProps {
160
168
  message: MessageInstance;
@@ -571,7 +579,7 @@ interface FormProps<Values extends Record<string, any> = any, ExtendItemProps ex
571
579
  footer?: JSX.Element | JSX.Element[];
572
580
  extendTypes?: ExtendTypes;
573
581
  children?: ReactNode;
574
- initialValues?: Values;
582
+ initialValues?: Partial<Values>;
575
583
  }
576
584
  /**
577
585
  * Form component with Ant Design & FaasJS
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.createSplitedContext({
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(cssinjs.StyleProvider, { ...styleProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(
194
- AppContext.Provider,
193
+ return /* @__PURE__ */ jsxRuntime.jsx(
194
+ react.OptionalWrapper,
195
195
  {
196
- value: {
197
- message: messageApi,
198
- notification: notificationApi,
199
- drawerProps,
200
- setDrawerProps,
201
- modalProps,
202
- setModalProps
203
- },
204
- children: /* @__PURE__ */ jsxRuntime.jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
205
- messageContextHolder,
206
- notificationContextHolder,
207
- modal,
208
- drawer,
209
- /* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children })
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;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createSplitedContext, ErrorBoundary as ErrorBoundary$1, FaasReactClient, FaasDataWrapper as FaasDataWrapper$1, faas } from '@faasjs/react';
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';
@@ -155,7 +155,7 @@ function ConfigProvider(props) {
155
155
  function useConfigContext() {
156
156
  return useContext(ConfigContext);
157
157
  }
158
- var AppContext = createSplitedContext({
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(StyleProvider, { ...styleProviderProps, children: /* @__PURE__ */ jsx(ConfigProvider$1, { ...props.configProviderProps, children: /* @__PURE__ */ jsx(
190
- AppContext.Provider,
189
+ return /* @__PURE__ */ jsx(
190
+ OptionalWrapper,
191
191
  {
192
- value: {
193
- message: messageApi,
194
- notification: notificationApi,
195
- drawerProps,
196
- setDrawerProps,
197
- modalProps,
198
- setModalProps
199
- },
200
- children: /* @__PURE__ */ jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxs(BrowserRouter, { ...props.browserRouterProps, children: [
201
- messageContextHolder,
202
- notificationContextHolder,
203
- modal,
204
- drawer,
205
- /* @__PURE__ */ jsx(RoutesApp, { children: props.children })
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "2.6.1",
3
+ "version": "2.7.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.6.1",
41
+ "@faasjs/react": "2.7.0",
42
42
  "antd": "*",
43
43
  "react": "*",
44
44
  "react-dom": "*",
@@ -50,7 +50,7 @@
50
50
  "@testing-library/react": "*",
51
51
  "@testing-library/user-event": "*",
52
52
  "@welldone-software/why-did-you-render": "*",
53
- "@faasjs/react": "2.6.1",
53
+ "@faasjs/react": "2.7.0",
54
54
  "antd": "*",
55
55
  "react": "*",
56
56
  "react-dom": "*",