@faasjs/ant-design 3.0.0-canary.4 → 3.1.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.js CHANGED
@@ -19,7 +19,7 @@ var Modal = antd.Modal;
19
19
  Modal.whyDidYouRender = true;
20
20
  function useModal(init) {
21
21
  const [props, setProps] = react$1.useState({ open: false, ...init });
22
- const setModalProps = react$1.useCallback(
22
+ const setModalProps = react.useEqualCallback(
23
23
  (changes) => {
24
24
  const changed = typeof changes === "function" ? changes(props) : changes;
25
25
  setProps((prev) => ({ ...prev, ...changed }));
@@ -48,7 +48,7 @@ function useDrawer(init) {
48
48
  open: false,
49
49
  ...init
50
50
  });
51
- const setDrawerProps = react$1.useCallback(
51
+ const setDrawerProps = react.useEqualCallback(
52
52
  (changes) => {
53
53
  const changed = typeof changes === "function" ? changes(props) : changes;
54
54
  setProps((prev) => ({ ...prev, ...changed }));
@@ -135,7 +135,7 @@ var ConfigContext = react$1.createContext({
135
135
  });
136
136
  function ConfigProvider(props) {
137
137
  const [theme, setTheme] = react$1.useState();
138
- react$1.useEffect(() => {
138
+ react.useEqualEffect(() => {
139
139
  if (props.theme?.lang === "zh") {
140
140
  setTheme(
141
141
  lodashEs.defaultsDeep(
@@ -151,7 +151,7 @@ function ConfigProvider(props) {
151
151
  );
152
152
  } else setTheme(lodashEs.defaultsDeep(props.theme, baseTheme));
153
153
  if (props.faasClientOptions) react.FaasReactClient(props.faasClientOptions);
154
- }, [JSON.stringify(props.theme)]);
154
+ }, [props.theme]);
155
155
  if (!theme) return null;
156
156
  return /* @__PURE__ */ jsxRuntime.jsx(ConfigContext.Provider, { value: { theme }, children: props.children });
157
157
  }
@@ -831,7 +831,7 @@ function Form(props) {
831
831
  }
832
832
  setComputedProps(propsCopy);
833
833
  }, [props]);
834
- const onValuesChange = react$1.useCallback(
834
+ const onValuesChange = react.useEqualCallback(
835
835
  (changedValues, allValues) => {
836
836
  console.debug("Form:onValuesChange", changedValues, allValues);
837
837
  if (props.onValuesChange) {
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { createSplittingContext, ErrorBoundary as ErrorBoundary$1, FaasReactClient, OptionalWrapper, FaasDataWrapper as FaasDataWrapper$1, withFaasData as withFaasData$1, faas } from '@faasjs/react';
1
+ import { createSplittingContext, useEqualCallback, ErrorBoundary as ErrorBoundary$1, useEqualEffect, FaasReactClient, OptionalWrapper, FaasDataWrapper as FaasDataWrapper$1, withFaasData as withFaasData$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
- import { createContext, useState, useCallback, useEffect, useContext, useMemo, cloneElement, Suspense } from 'react';
5
+ import { createContext, useState, useContext, useMemo, useEffect, cloneElement, Suspense } from 'react';
6
6
  export { lazy } from 'react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { BrowserRouter, useNavigate, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
@@ -15,7 +15,7 @@ var Modal = Modal$1;
15
15
  Modal.whyDidYouRender = true;
16
16
  function useModal(init) {
17
17
  const [props, setProps] = useState({ open: false, ...init });
18
- const setModalProps = useCallback(
18
+ const setModalProps = useEqualCallback(
19
19
  (changes) => {
20
20
  const changed = typeof changes === "function" ? changes(props) : changes;
21
21
  setProps((prev) => ({ ...prev, ...changed }));
@@ -44,7 +44,7 @@ function useDrawer(init) {
44
44
  open: false,
45
45
  ...init
46
46
  });
47
- const setDrawerProps = useCallback(
47
+ const setDrawerProps = useEqualCallback(
48
48
  (changes) => {
49
49
  const changed = typeof changes === "function" ? changes(props) : changes;
50
50
  setProps((prev) => ({ ...prev, ...changed }));
@@ -131,7 +131,7 @@ var ConfigContext = createContext({
131
131
  });
132
132
  function ConfigProvider(props) {
133
133
  const [theme, setTheme] = useState();
134
- useEffect(() => {
134
+ useEqualEffect(() => {
135
135
  if (props.theme?.lang === "zh") {
136
136
  setTheme(
137
137
  defaultsDeep(
@@ -147,7 +147,7 @@ function ConfigProvider(props) {
147
147
  );
148
148
  } else setTheme(defaultsDeep(props.theme, baseTheme));
149
149
  if (props.faasClientOptions) FaasReactClient(props.faasClientOptions);
150
- }, [JSON.stringify(props.theme)]);
150
+ }, [props.theme]);
151
151
  if (!theme) return null;
152
152
  return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: { theme }, children: props.children });
153
153
  }
@@ -827,7 +827,7 @@ function Form(props) {
827
827
  }
828
828
  setComputedProps(propsCopy);
829
829
  }, [props]);
830
- const onValuesChange = useCallback(
830
+ const onValuesChange = useEqualCallback(
831
831
  (changedValues, allValues) => {
832
832
  console.debug("Form:onValuesChange", changedValues, allValues);
833
833
  if (props.onValuesChange) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "3.0.0-canary.4",
3
+ "version": "3.1.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": "3.0.0-canary.4",
41
+ "@faasjs/react": "3.1.0",
42
42
  "antd": "*",
43
43
  "react": "*",
44
44
  "react-dom": "*",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/lodash-es": "*",
49
- "@faasjs/react": "3.0.0-canary.4",
49
+ "@faasjs/react": "3.1.0",
50
50
  "antd": "*",
51
51
  "react": "*",
52
52
  "react-dom": "*",