x-ui-design 0.4.68 → 0.4.70
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.esm.js +5 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -8
- package/dist/index.js.map +1 -1
- package/lib/components/Form/Item/Item.tsx +2 -7
- package/lib/hooks/useForm.ts +1 -2
- package/package.json +1 -1
- package/src/app/page.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -611,7 +611,6 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
|
|
|
611
611
|
const formRef = useRef({
|
|
612
612
|
...initialValues
|
|
613
613
|
});
|
|
614
|
-
useRef({});
|
|
615
614
|
const fieldInstancesRef = useRef({});
|
|
616
615
|
const [isReseting, setIsReseting] = useState(false);
|
|
617
616
|
const [errors, setErrors] = useState({});
|
|
@@ -706,7 +705,9 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange, scrollToFir
|
|
|
706
705
|
return !!name;
|
|
707
706
|
}
|
|
708
707
|
function registerField(name, rules = [], remove = false) {
|
|
709
|
-
if (remove)
|
|
708
|
+
if (remove) {
|
|
709
|
+
delete formRef.current[name];
|
|
710
|
+
} else {
|
|
710
711
|
if (!(name in formRef.current)) {
|
|
711
712
|
formRef.current[name] = initialValues?.[name];
|
|
712
713
|
}
|
|
@@ -987,12 +988,8 @@ const FormItem$1 = ({
|
|
|
987
988
|
}
|
|
988
989
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
989
990
|
}, [name, rules]);
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
return () => {
|
|
993
|
-
console.log(1);
|
|
994
|
-
};
|
|
995
|
-
}, [name]);
|
|
991
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
992
|
+
useEffect(() => () => registerField(name, undefined, true), [name]);
|
|
996
993
|
useEffect(() => {
|
|
997
994
|
if (initialValue) {
|
|
998
995
|
setFieldValue(name, initialValue);
|