@faasjs/ant-design 0.0.2-beta.442 → 0.0.2-beta.443

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.ts CHANGED
@@ -268,7 +268,7 @@ declare type FormItemProps<T = any> = {
268
268
  */
269
269
  declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
270
270
 
271
- declare type FormProps<Values = any, ExtendItemProps = any> = {
271
+ declare type FormProps<Values extends Record<string, any> = any, ExtendItemProps = any> = {
272
272
  items?: (FormItemProps | ExtendItemProps)[];
273
273
  /** Default: { text: 'Submit' }, set false to disable it */
274
274
  submit?: false | {
package/dist/index.js CHANGED
@@ -750,6 +750,8 @@ function Form(props) {
750
750
  const [form] = import_antd6.Form.useForm(props.form);
751
751
  (0, import_react9.useEffect)(() => {
752
752
  var _a2, _b2;
753
+ if (!props.items)
754
+ return;
753
755
  const propsCopy = {
754
756
  ...props,
755
757
  form
@@ -757,7 +759,7 @@ function Form(props) {
757
759
  if (propsCopy.initialValues)
758
760
  for (const key in propsCopy.initialValues)
759
761
  propsCopy.initialValues[key] = transferValue(
760
- (_a2 = propsCopy.items.find((i) => i.id === key)) == null ? void 0 : _a2.type,
762
+ (_a2 = propsCopy.items.find((item) => item.id === key)) == null ? void 0 : _a2.type,
761
763
  propsCopy.initialValues[key]
762
764
  );
763
765
  if (propsCopy.onFinish) {
@@ -796,8 +798,6 @@ function Form(props) {
796
798
  propsCopy.onValuesChange = (changedValues, allValues) => {
797
799
  if (originValuesChange)
798
800
  originValuesChange(changedValues, allValues);
799
- if (!propsCopy.items)
800
- return;
801
801
  for (const key in changedValues) {
802
802
  const item = propsCopy.items.find((i) => i.id === key);
803
803
  if (item == null ? void 0 : item.onValueChange)
@@ -805,7 +805,7 @@ function Form(props) {
805
805
  }
806
806
  };
807
807
  setComputedProps(propsCopy);
808
- }, []);
808
+ }, [props]);
809
809
  if (!computedProps)
810
810
  return null;
811
811
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_antd6.Form, {
package/dist/index.mjs CHANGED
@@ -729,6 +729,8 @@ function Form(props) {
729
729
  const [form] = AntdForm2.useForm(props.form);
730
730
  useEffect4(() => {
731
731
  var _a2, _b2;
732
+ if (!props.items)
733
+ return;
732
734
  const propsCopy = {
733
735
  ...props,
734
736
  form
@@ -736,7 +738,7 @@ function Form(props) {
736
738
  if (propsCopy.initialValues)
737
739
  for (const key in propsCopy.initialValues)
738
740
  propsCopy.initialValues[key] = transferValue(
739
- (_a2 = propsCopy.items.find((i) => i.id === key)) == null ? void 0 : _a2.type,
741
+ (_a2 = propsCopy.items.find((item) => item.id === key)) == null ? void 0 : _a2.type,
740
742
  propsCopy.initialValues[key]
741
743
  );
742
744
  if (propsCopy.onFinish) {
@@ -775,8 +777,6 @@ function Form(props) {
775
777
  propsCopy.onValuesChange = (changedValues, allValues) => {
776
778
  if (originValuesChange)
777
779
  originValuesChange(changedValues, allValues);
778
- if (!propsCopy.items)
779
- return;
780
780
  for (const key in changedValues) {
781
781
  const item = propsCopy.items.find((i) => i.id === key);
782
782
  if (item == null ? void 0 : item.onValueChange)
@@ -784,7 +784,7 @@ function Form(props) {
784
784
  }
785
785
  };
786
786
  setComputedProps(propsCopy);
787
- }, []);
787
+ }, [props]);
788
788
  if (!computedProps)
789
789
  return null;
790
790
  return /* @__PURE__ */ jsxs2(AntdForm2, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.442",
3
+ "version": "0.0.2-beta.443",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "lodash": "*",
29
29
  "react": "*",
30
30
  "react-dom": "*",
31
- "@faasjs/react": "^0.0.2-beta.442",
31
+ "@faasjs/react": "^0.0.2-beta.443",
32
32
  "react-router-dom": "*",
33
33
  "dayjs": "*"
34
34
  },