@faasjs/ant-design 0.0.2-beta.444 → 0.0.2-beta.446
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 +38 -37
- package/dist/index.mjs +40 -38
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -797,47 +797,46 @@ function Form(props) {
|
|
|
797
797
|
setExtendTypes(propsCopy.extendTypes);
|
|
798
798
|
delete propsCopy.extendTypes;
|
|
799
799
|
}
|
|
800
|
-
let originValuesChange;
|
|
801
|
-
if (propsCopy.onValuesChange)
|
|
802
|
-
originValuesChange = propsCopy.onValuesChange;
|
|
803
|
-
propsCopy.onValuesChange = (changedValues, allValues) => {
|
|
804
|
-
if (originValuesChange)
|
|
805
|
-
originValuesChange(changedValues, allValues);
|
|
806
|
-
if (!props.items)
|
|
807
|
-
return;
|
|
808
|
-
for (const key in changedValues) {
|
|
809
|
-
const item = propsCopy.items.find((i) => i.id === key);
|
|
810
|
-
if (item == null ? void 0 : item.onValueChange)
|
|
811
|
-
item.onValueChange(changedValues[key], allValues, form);
|
|
812
|
-
}
|
|
813
|
-
const filterItems = props.items.filter((it) => {
|
|
814
|
-
if (!it.if) {
|
|
815
|
-
return true;
|
|
816
|
-
}
|
|
817
|
-
const show = it.if(allValues);
|
|
818
|
-
if (show) {
|
|
819
|
-
propsCopy.form.setFields([
|
|
820
|
-
{
|
|
821
|
-
name: it.id,
|
|
822
|
-
errors: null
|
|
823
|
-
}
|
|
824
|
-
]);
|
|
825
|
-
}
|
|
826
|
-
return show;
|
|
827
|
-
});
|
|
828
|
-
if (propsCopy.items.length !== filterItems.length || propsCopy.items.some((it, i) => it !== filterItems[i])) {
|
|
829
|
-
setComputedProps({
|
|
830
|
-
...propsCopy,
|
|
831
|
-
items: filterItems
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
800
|
setComputedProps(propsCopy);
|
|
836
801
|
}, [props]);
|
|
802
|
+
const onValuesChange = (0, import_react9.useCallback)((changedValues, allValues) => {
|
|
803
|
+
if (props.onValuesChange) {
|
|
804
|
+
props.onValuesChange(changedValues, allValues);
|
|
805
|
+
}
|
|
806
|
+
if (!props.items)
|
|
807
|
+
return;
|
|
808
|
+
for (const key in changedValues) {
|
|
809
|
+
const item = computedProps.items.find((i) => i.id === key);
|
|
810
|
+
if (item == null ? void 0 : item.onValueChange)
|
|
811
|
+
item.onValueChange(changedValues[key], allValues, form);
|
|
812
|
+
}
|
|
813
|
+
const filterItems = props.items.filter((it) => {
|
|
814
|
+
if (!it.if) {
|
|
815
|
+
return true;
|
|
816
|
+
}
|
|
817
|
+
const show = it.if(allValues);
|
|
818
|
+
if (show) {
|
|
819
|
+
props.form.setFields([
|
|
820
|
+
{
|
|
821
|
+
name: it.id,
|
|
822
|
+
errors: null
|
|
823
|
+
}
|
|
824
|
+
]);
|
|
825
|
+
}
|
|
826
|
+
return show;
|
|
827
|
+
});
|
|
828
|
+
if (computedProps.items.length !== filterItems.length || computedProps.items.some((it, i) => it !== filterItems[i])) {
|
|
829
|
+
setComputedProps({
|
|
830
|
+
...computedProps,
|
|
831
|
+
items: filterItems
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
}, [computedProps]);
|
|
837
835
|
if (!computedProps)
|
|
838
836
|
return null;
|
|
839
837
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_antd6.Form, {
|
|
840
838
|
...computedProps,
|
|
839
|
+
onValuesChange,
|
|
841
840
|
children: [
|
|
842
841
|
computedProps.beforeItems,
|
|
843
842
|
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FormItem, {
|
|
@@ -1246,14 +1245,16 @@ function Table(props) {
|
|
|
1246
1245
|
if (!item.render)
|
|
1247
1246
|
item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Description, {
|
|
1248
1247
|
items: item.object,
|
|
1249
|
-
dataSource: value
|
|
1248
|
+
dataSource: value,
|
|
1249
|
+
column: 1
|
|
1250
1250
|
});
|
|
1251
1251
|
break;
|
|
1252
1252
|
case "object[]":
|
|
1253
1253
|
if (!item.render)
|
|
1254
1254
|
item.render = (value) => value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Description, {
|
|
1255
1255
|
items: item.object,
|
|
1256
|
-
dataSource: v
|
|
1256
|
+
dataSource: v,
|
|
1257
|
+
column: 1
|
|
1257
1258
|
}, i));
|
|
1258
1259
|
break;
|
|
1259
1260
|
default:
|
package/dist/index.mjs
CHANGED
|
@@ -327,7 +327,8 @@ import {
|
|
|
327
327
|
} from "antd";
|
|
328
328
|
import {
|
|
329
329
|
useEffect as useEffect4,
|
|
330
|
-
useState as useState5
|
|
330
|
+
useState as useState5,
|
|
331
|
+
useCallback
|
|
331
332
|
} from "react";
|
|
332
333
|
|
|
333
334
|
// src/FormItem.tsx
|
|
@@ -776,47 +777,46 @@ function Form(props) {
|
|
|
776
777
|
setExtendTypes(propsCopy.extendTypes);
|
|
777
778
|
delete propsCopy.extendTypes;
|
|
778
779
|
}
|
|
779
|
-
let originValuesChange;
|
|
780
|
-
if (propsCopy.onValuesChange)
|
|
781
|
-
originValuesChange = propsCopy.onValuesChange;
|
|
782
|
-
propsCopy.onValuesChange = (changedValues, allValues) => {
|
|
783
|
-
if (originValuesChange)
|
|
784
|
-
originValuesChange(changedValues, allValues);
|
|
785
|
-
if (!props.items)
|
|
786
|
-
return;
|
|
787
|
-
for (const key in changedValues) {
|
|
788
|
-
const item = propsCopy.items.find((i) => i.id === key);
|
|
789
|
-
if (item == null ? void 0 : item.onValueChange)
|
|
790
|
-
item.onValueChange(changedValues[key], allValues, form);
|
|
791
|
-
}
|
|
792
|
-
const filterItems = props.items.filter((it) => {
|
|
793
|
-
if (!it.if) {
|
|
794
|
-
return true;
|
|
795
|
-
}
|
|
796
|
-
const show = it.if(allValues);
|
|
797
|
-
if (show) {
|
|
798
|
-
propsCopy.form.setFields([
|
|
799
|
-
{
|
|
800
|
-
name: it.id,
|
|
801
|
-
errors: null
|
|
802
|
-
}
|
|
803
|
-
]);
|
|
804
|
-
}
|
|
805
|
-
return show;
|
|
806
|
-
});
|
|
807
|
-
if (propsCopy.items.length !== filterItems.length || propsCopy.items.some((it, i) => it !== filterItems[i])) {
|
|
808
|
-
setComputedProps({
|
|
809
|
-
...propsCopy,
|
|
810
|
-
items: filterItems
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
780
|
setComputedProps(propsCopy);
|
|
815
781
|
}, [props]);
|
|
782
|
+
const onValuesChange = useCallback((changedValues, allValues) => {
|
|
783
|
+
if (props.onValuesChange) {
|
|
784
|
+
props.onValuesChange(changedValues, allValues);
|
|
785
|
+
}
|
|
786
|
+
if (!props.items)
|
|
787
|
+
return;
|
|
788
|
+
for (const key in changedValues) {
|
|
789
|
+
const item = computedProps.items.find((i) => i.id === key);
|
|
790
|
+
if (item == null ? void 0 : item.onValueChange)
|
|
791
|
+
item.onValueChange(changedValues[key], allValues, form);
|
|
792
|
+
}
|
|
793
|
+
const filterItems = props.items.filter((it) => {
|
|
794
|
+
if (!it.if) {
|
|
795
|
+
return true;
|
|
796
|
+
}
|
|
797
|
+
const show = it.if(allValues);
|
|
798
|
+
if (show) {
|
|
799
|
+
props.form.setFields([
|
|
800
|
+
{
|
|
801
|
+
name: it.id,
|
|
802
|
+
errors: null
|
|
803
|
+
}
|
|
804
|
+
]);
|
|
805
|
+
}
|
|
806
|
+
return show;
|
|
807
|
+
});
|
|
808
|
+
if (computedProps.items.length !== filterItems.length || computedProps.items.some((it, i) => it !== filterItems[i])) {
|
|
809
|
+
setComputedProps({
|
|
810
|
+
...computedProps,
|
|
811
|
+
items: filterItems
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
}, [computedProps]);
|
|
816
815
|
if (!computedProps)
|
|
817
816
|
return null;
|
|
818
817
|
return /* @__PURE__ */ jsxs2(AntdForm2, {
|
|
819
818
|
...computedProps,
|
|
819
|
+
onValuesChange,
|
|
820
820
|
children: [
|
|
821
821
|
computedProps.beforeItems,
|
|
822
822
|
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx7(FormItem, {
|
|
@@ -1243,14 +1243,16 @@ function Table(props) {
|
|
|
1243
1243
|
if (!item.render)
|
|
1244
1244
|
item.render = (value) => /* @__PURE__ */ jsx11(Description, {
|
|
1245
1245
|
items: item.object,
|
|
1246
|
-
dataSource: value
|
|
1246
|
+
dataSource: value,
|
|
1247
|
+
column: 1
|
|
1247
1248
|
});
|
|
1248
1249
|
break;
|
|
1249
1250
|
case "object[]":
|
|
1250
1251
|
if (!item.render)
|
|
1251
1252
|
item.render = (value) => value.map((v, i) => /* @__PURE__ */ jsx11(Description, {
|
|
1252
1253
|
items: item.object,
|
|
1253
|
-
dataSource: v
|
|
1254
|
+
dataSource: v,
|
|
1255
|
+
column: 1
|
|
1254
1256
|
}, i));
|
|
1255
1257
|
break;
|
|
1256
1258
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.446",
|
|
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.
|
|
31
|
+
"@faasjs/react": "^0.0.2-beta.446",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|