x-ui-design 0.3.57 → 0.3.58
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/esm/types/components/Form/Item/Item.d.ts +1 -1
- package/dist/esm/types/types/form.d.ts +0 -2
- package/dist/index.esm.js +5 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/lib/components/Form/Item/Item.tsx +1 -7
- package/lib/hooks/useForm.ts +2 -0
- package/lib/types/form.ts +0 -2
- package/package.json +1 -1
- package/src/app/page.tsx +2 -2
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { FormItemProps } from '../../../types/form';
|
|
3
3
|
import './style.css';
|
|
4
4
|
declare const FormItem: {
|
|
5
|
-
({ prefixCls, name, label, rules, children, className, layout, style,
|
|
5
|
+
({ prefixCls, name, label, rules, children, className, layout, style, dependencies, initialValue, feedbackIcons, ...props }: FormItemProps): React.JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
7
|
};
|
|
8
8
|
export default FormItem;
|
|
@@ -62,7 +62,6 @@ export type FormItemProps = DefaultProps & {
|
|
|
62
62
|
};
|
|
63
63
|
})[];
|
|
64
64
|
layout?: FormLayoutTypes;
|
|
65
|
-
valuePropName?: string;
|
|
66
65
|
dependencies?: string[];
|
|
67
66
|
normalize?: (value: RuleType, prevValue: RuleType, allValues: RuleType) => RuleType;
|
|
68
67
|
feedbackIcons?: boolean;
|
|
@@ -75,7 +74,6 @@ export interface FormItemChildComponentProps {
|
|
|
75
74
|
value: RuleType;
|
|
76
75
|
setFieldValue: (name: string, value: RuleType) => void;
|
|
77
76
|
onChange?: (e: SyntheticBaseEvent, option?: OptionProps) => void;
|
|
78
|
-
valuePropName?: string;
|
|
79
77
|
size?: SizeType;
|
|
80
78
|
normalize?: (value: RuleType, prevValue: RuleType, allValues: RuleType) => RuleType;
|
|
81
79
|
noStyle?: boolean;
|
package/dist/index.esm.js
CHANGED
|
@@ -753,6 +753,10 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange) => {
|
|
|
753
753
|
}
|
|
754
754
|
async function validateFields(nameList) {
|
|
755
755
|
const fieldsToValidate = nameList || Object.keys(formRef.current);
|
|
756
|
+
console.log({
|
|
757
|
+
fieldsToValidate,
|
|
758
|
+
form: formRef.current
|
|
759
|
+
});
|
|
756
760
|
const results = await Promise.all(fieldsToValidate.map(name => validateField(name)));
|
|
757
761
|
return results.every(valid => valid);
|
|
758
762
|
}
|
|
@@ -923,13 +927,12 @@ const FormItem$1 = ({
|
|
|
923
927
|
className = '',
|
|
924
928
|
layout = 'vertical',
|
|
925
929
|
style = {},
|
|
926
|
-
valuePropName,
|
|
927
930
|
dependencies = [],
|
|
928
931
|
initialValue,
|
|
929
932
|
feedbackIcons,
|
|
930
933
|
...props
|
|
931
934
|
}) => {
|
|
932
|
-
const [_name] = useState(
|
|
935
|
+
const [_name] = useState(name);
|
|
933
936
|
const formContext = useContext(FormContext);
|
|
934
937
|
const errorRef = useRef(null);
|
|
935
938
|
if (!formContext) {
|
|
@@ -948,10 +951,6 @@ const FormItem$1 = ({
|
|
|
948
951
|
const childrenList = useMemo(() => flattenChildren(children), [children]);
|
|
949
952
|
useEffect(() => {
|
|
950
953
|
if (_name && !getFieldInstance(_name)) {
|
|
951
|
-
console.log({
|
|
952
|
-
_name,
|
|
953
|
-
rules
|
|
954
|
-
});
|
|
955
954
|
registerField(_name, rules);
|
|
956
955
|
}
|
|
957
956
|
}, [_name, rules]);
|