@faasjs/ant-design 6.2.0 → 6.3.1

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.cjs CHANGED
@@ -772,7 +772,7 @@ function Form(props) {
772
772
  const [extendTypes, setExtendTypes] = react$1.useState();
773
773
  const [form] = antd.Form.useForm(props.form);
774
774
  const [initialValues, setInitialValues] = react$1.useState(
775
- props.initialValues
775
+ props.initialValues || /* @__PURE__ */ Object.create(null)
776
776
  );
777
777
  react$1.useEffect(() => {
778
778
  const { submit: submit2, ...propsCopy } = {
@@ -783,21 +783,18 @@ function Form(props) {
783
783
  if (propsCopy.initialValues && propsCopy.items?.length) {
784
784
  for (const key in propsCopy.initialValues) {
785
785
  propsCopy.initialValues[key] = transferValue(
786
- propsCopy.items.find((item2) => isFormItemProps(item2) && item2.id === key)?.type,
786
+ propsCopy.items.find((item) => isFormItemProps(item) && item.id === key)?.type,
787
787
  propsCopy.initialValues[key]
788
788
  );
789
- const item = propsCopy.items.find(
790
- (item2) => isFormItemProps(item2) && item2.id === key
791
- );
792
- if (item?.if) item.hidden = !item.if(propsCopy.initialValues);
793
- }
794
- for (const item of propsCopy.items) {
795
- if (isFormItemProps(item) && item.if)
796
- item.hidden = !item.if(propsCopy.initialValues);
797
789
  }
798
790
  setInitialValues(propsCopy.initialValues);
799
791
  delete propsCopy.initialValues;
800
792
  }
793
+ if (propsCopy.items?.length)
794
+ for (const item of propsCopy.items) {
795
+ if (isFormItemProps(item) && item.if)
796
+ item.hidden = !item.if(propsCopy.initialValues || /* @__PURE__ */ Object.create(null));
797
+ }
801
798
  if (propsCopy.onFinish) {
802
799
  propsCopy.onFinish = async (values) => {
803
800
  setLoading(true);
@@ -1473,7 +1470,7 @@ function FaasDataTable({
1473
1470
  }
1474
1471
  return newColumns;
1475
1472
  });
1476
- }, [columns, data]);
1473
+ }, [data, props.dataSource]);
1477
1474
  if (!data)
1478
1475
  return /* @__PURE__ */ jsxRuntime.jsx(
1479
1476
  antd.Table,
@@ -1550,7 +1547,7 @@ function Title(props) {
1550
1547
  react$1.useEffect(() => {
1551
1548
  const title = Array.isArray(props.title) ? props.title : [props.title];
1552
1549
  document.title = title.concat(props.suffix || theme.Title.suffix).filter((t) => !!t).join(props.separator || theme.Title.separator);
1553
- }, [props]);
1550
+ }, [props, theme.Title]);
1554
1551
  if (props.h1) {
1555
1552
  if (typeof props.h1 === "boolean")
1556
1553
  return /* @__PURE__ */ jsxRuntime.jsx("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
package/dist/index.mjs CHANGED
@@ -768,7 +768,7 @@ function Form(props) {
768
768
  const [extendTypes, setExtendTypes] = useState();
769
769
  const [form] = Form$1.useForm(props.form);
770
770
  const [initialValues, setInitialValues] = useState(
771
- props.initialValues
771
+ props.initialValues || /* @__PURE__ */ Object.create(null)
772
772
  );
773
773
  useEffect(() => {
774
774
  const { submit: submit2, ...propsCopy } = {
@@ -779,21 +779,18 @@ function Form(props) {
779
779
  if (propsCopy.initialValues && propsCopy.items?.length) {
780
780
  for (const key in propsCopy.initialValues) {
781
781
  propsCopy.initialValues[key] = transferValue(
782
- propsCopy.items.find((item2) => isFormItemProps(item2) && item2.id === key)?.type,
782
+ propsCopy.items.find((item) => isFormItemProps(item) && item.id === key)?.type,
783
783
  propsCopy.initialValues[key]
784
784
  );
785
- const item = propsCopy.items.find(
786
- (item2) => isFormItemProps(item2) && item2.id === key
787
- );
788
- if (item?.if) item.hidden = !item.if(propsCopy.initialValues);
789
- }
790
- for (const item of propsCopy.items) {
791
- if (isFormItemProps(item) && item.if)
792
- item.hidden = !item.if(propsCopy.initialValues);
793
785
  }
794
786
  setInitialValues(propsCopy.initialValues);
795
787
  delete propsCopy.initialValues;
796
788
  }
789
+ if (propsCopy.items?.length)
790
+ for (const item of propsCopy.items) {
791
+ if (isFormItemProps(item) && item.if)
792
+ item.hidden = !item.if(propsCopy.initialValues || /* @__PURE__ */ Object.create(null));
793
+ }
797
794
  if (propsCopy.onFinish) {
798
795
  propsCopy.onFinish = async (values) => {
799
796
  setLoading(true);
@@ -1469,7 +1466,7 @@ function FaasDataTable({
1469
1466
  }
1470
1467
  return newColumns;
1471
1468
  });
1472
- }, [columns, data]);
1469
+ }, [data, props.dataSource]);
1473
1470
  if (!data)
1474
1471
  return /* @__PURE__ */ jsx(
1475
1472
  Table$1,
@@ -1546,7 +1543,7 @@ function Title(props) {
1546
1543
  useEffect(() => {
1547
1544
  const title = Array.isArray(props.title) ? props.title : [props.title];
1548
1545
  document.title = title.concat(props.suffix || theme.Title.suffix).filter((t) => !!t).join(props.separator || theme.Title.separator);
1549
- }, [props]);
1546
+ }, [props, theme.Title]);
1550
1547
  if (props.h1) {
1551
1548
  if (typeof props.h1 === "boolean")
1552
1549
  return /* @__PURE__ */ jsx("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "6.2.0",
3
+ "version": "6.3.1",
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.2.0",
33
+ "@faasjs/react": "6.3.1",
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.2.0",
43
+ "@faasjs/react": "6.3.1",
44
44
  "antd": "*",
45
45
  "@ant-design/icons": "*",
46
46
  "lodash-es": "*",