x-ui-design 0.3.87 → 0.3.89
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 +9 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/lib/components/Form/Item/Item.tsx +5 -2
- package/lib/components/Input/Input.tsx +7 -0
- package/lib/components/Select/Select.tsx +0 -2
- package/lib/hooks/useForm.ts +8 -8
- package/package.json +1 -1
- package/src/app/page.tsx +18 -3
package/dist/index.esm.js
CHANGED
|
@@ -957,11 +957,13 @@ const FormItem$1 = ({
|
|
|
957
957
|
if (name && !getFieldInstance(name)) {
|
|
958
958
|
registerField(name, rules);
|
|
959
959
|
}
|
|
960
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
960
961
|
}, [name, rules]);
|
|
961
962
|
useEffect(() => {
|
|
962
963
|
if (initialValue) {
|
|
963
964
|
setFieldValue(name, initialValue);
|
|
964
965
|
}
|
|
966
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
965
967
|
}, []);
|
|
966
968
|
useEffect(() => {
|
|
967
969
|
if (name && dependencies.length > 0) {
|
|
@@ -972,12 +974,14 @@ const FormItem$1 = ({
|
|
|
972
974
|
unsubscribe();
|
|
973
975
|
};
|
|
974
976
|
}
|
|
977
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
975
978
|
}, [dependencies, name]);
|
|
976
979
|
useEffect(() => {
|
|
977
980
|
if (errorRef.current && errorRef.current?.clientHeight >= REF_CLIENT_HEIGHT) {
|
|
978
981
|
errorRef.current.style.position = 'relative';
|
|
979
982
|
errorRef.current.style.marginTop = '-16px';
|
|
980
983
|
}
|
|
984
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
981
985
|
}, [errorRef.current]);
|
|
982
986
|
const isRequired = useMemo(() => rules.some(rule => rule.required), [rules]);
|
|
983
987
|
const errorMessage = getFieldError(name)?.[0];
|
|
@@ -2668,6 +2672,8 @@ const InputComponent = /*#__PURE__*/forwardRef(({
|
|
|
2668
2672
|
// @ts-expect-error
|
|
2669
2673
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2670
2674
|
__injected,
|
|
2675
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2676
|
+
defaultValue,
|
|
2671
2677
|
...props
|
|
2672
2678
|
}, ref) => {
|
|
2673
2679
|
const inputRef = useRef(null);
|
|
@@ -2686,6 +2692,9 @@ const InputComponent = /*#__PURE__*/forwardRef(({
|
|
|
2686
2692
|
}
|
|
2687
2693
|
}
|
|
2688
2694
|
}));
|
|
2695
|
+
useEffect(() => {
|
|
2696
|
+
setInternalValue(value ?? '');
|
|
2697
|
+
}, [value]);
|
|
2689
2698
|
const handleChange = e => {
|
|
2690
2699
|
setInternalValue(e.target.value);
|
|
2691
2700
|
props.onChange?.(e);
|
|
@@ -3089,7 +3098,6 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3089
3098
|
}
|
|
3090
3099
|
}, [autoClearSearchValue, prefixCls]);
|
|
3091
3100
|
useEffect(() => {
|
|
3092
|
-
console.log(hasMode ? checkModeInitialValue : initialValue);
|
|
3093
3101
|
setSelected(hasMode ? checkModeInitialValue : initialValue);
|
|
3094
3102
|
}, [checkModeInitialValue, hasMode, initialValue]);
|
|
3095
3103
|
useEffect(() => {
|