@faasjs/ant-design 6.3.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);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "6.3.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.3.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.3.0",
43
+ "@faasjs/react": "6.3.1",
44
44
  "antd": "*",
45
45
  "@ant-design/icons": "*",
46
46
  "lodash-es": "*",