@hw-component/form 0.0.8-beta-v4 → 0.0.8-beta-v5
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/es/Form/hooks/useHForm.js +2 -1
- package/lib/Form/hooks/useHForm.js +2 -1
- package/package.json +1 -1
- package/src/components/CheckboxGroup/hooks.ts +3 -3
- package/src/components/CheckboxGroup/index.tsx +4 -4
- package/src/components/Form/hooks/useHForm.ts +2 -1
- package/src/pages/Checkbox/index.tsx +0 -7
- package/src/pages/Form/index.tsx +0 -1
|
@@ -165,7 +165,8 @@ var useHForm = (function () {
|
|
|
165
165
|
Reflect.deleteProperty(dispatchSourceData, key);
|
|
166
166
|
},
|
|
167
167
|
outputValues: function outputValues(value) {
|
|
168
|
-
|
|
168
|
+
var val = value || form.getFieldsValue();
|
|
169
|
+
return this.formatValues(val, "outputValue");
|
|
169
170
|
}
|
|
170
171
|
}, form), {}, {
|
|
171
172
|
setFieldsValue: function setFieldsValue(values) {
|
|
@@ -168,7 +168,8 @@ var useHForm = (function () {
|
|
|
168
168
|
Reflect.deleteProperty(dispatchSourceData, key);
|
|
169
169
|
},
|
|
170
170
|
outputValues: function outputValues(value) {
|
|
171
|
-
|
|
171
|
+
var val = value || form.getFieldsValue();
|
|
172
|
+
return this.formatValues(val, "outputValue");
|
|
172
173
|
}
|
|
173
174
|
}, form), {}, {
|
|
174
175
|
setFieldsValue: function setFieldsValue(values) {
|
package/package.json
CHANGED
|
@@ -58,7 +58,7 @@ export const useValueProvider = ({
|
|
|
58
58
|
}, [valueMap]);
|
|
59
59
|
|
|
60
60
|
useEffect(() => {
|
|
61
|
-
const { checked
|
|
61
|
+
const { checked, noChecked } = oldValueCheckMap.valueMap;
|
|
62
62
|
if (!value) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
@@ -68,8 +68,8 @@ export const useValueProvider = ({
|
|
|
68
68
|
}
|
|
69
69
|
setVal((oldVal) => {
|
|
70
70
|
const newVal = { ...oldVal };
|
|
71
|
-
Object.keys(newVal).forEach((key)=>{
|
|
72
|
-
newVal[key]=noChecked
|
|
71
|
+
Object.keys(newVal).forEach((key) => {
|
|
72
|
+
newVal[key] = noChecked;
|
|
73
73
|
});
|
|
74
74
|
value.forEach((itemVal) => {
|
|
75
75
|
newVal[itemVal] = checked;
|
|
@@ -47,10 +47,10 @@ const Index = ({
|
|
|
47
47
|
outputValue: (item, outputValue) => {
|
|
48
48
|
const { name = "" } = item;
|
|
49
49
|
const { [name]: itemVal = {} } = outputValue;
|
|
50
|
-
if (Array.isArray(itemVal)){
|
|
51
|
-
return
|
|
52
|
-
[name]:itemVal
|
|
53
|
-
}
|
|
50
|
+
if (Array.isArray(itemVal)) {
|
|
51
|
+
return {
|
|
52
|
+
[name]: itemVal,
|
|
53
|
+
};
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
56
|
...itemVal,
|
|
@@ -140,7 +140,8 @@ export default () => {
|
|
|
140
140
|
Reflect.deleteProperty(dispatchSourceData, key);
|
|
141
141
|
},
|
|
142
142
|
outputValues(value) {
|
|
143
|
-
|
|
143
|
+
const val=value||form.getFieldsValue()
|
|
144
|
+
return this.formatValues(val, "outputValue");
|
|
144
145
|
},
|
|
145
146
|
...form,
|
|
146
147
|
setFieldsValue(values) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Space } from "antd";
|
|
2
2
|
import { HCheckboxGroup } from "../../components";
|
|
3
|
-
import {useState} from "react";
|
|
4
3
|
export default () => {
|
|
5
|
-
const [val,setVal]=useState();
|
|
6
4
|
return (
|
|
7
5
|
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
8
6
|
<HCheckboxGroup
|
|
@@ -10,11 +8,6 @@ export default () => {
|
|
|
10
8
|
{ label: "测试", value: "uu" },
|
|
11
9
|
{ label: "测试1", value: "uu1" },
|
|
12
10
|
]}
|
|
13
|
-
value={val}
|
|
14
|
-
|
|
15
|
-
onChange={(val)=>{
|
|
16
|
-
setVal(val)
|
|
17
|
-
}}
|
|
18
11
|
/>
|
|
19
12
|
</Space>
|
|
20
13
|
);
|