x-ui-design 0.2.87 → 0.2.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/esm/types/types/form.d.ts +1 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/lib/components/Select/Select.tsx +2 -2
- package/lib/hooks/useForm.ts +3 -3
- package/lib/types/form.ts +1 -1
- package/package.json +1 -1
- package/src/app/page.tsx +1819 -3392
|
@@ -83,7 +83,7 @@ export interface FormItemChildComponentProps {
|
|
|
83
83
|
export interface FormInstance {
|
|
84
84
|
submit: () => Promise<Record<string, RuleTypes> | undefined>;
|
|
85
85
|
setFields: (fields: FieldData[]) => void;
|
|
86
|
-
resetFields: (nameList?: string[]) => void;
|
|
86
|
+
resetFields: (nameList?: string[], showError?: boolean) => void;
|
|
87
87
|
getFieldError: (name: string) => string[];
|
|
88
88
|
registerField: (name: string, rules?: RuleObject[]) => void;
|
|
89
89
|
setFieldValue: (name: string, value: RuleTypes) => void;
|
package/dist/index.esm.js
CHANGED
|
@@ -737,7 +737,7 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange) => {
|
|
|
737
737
|
const results = await Promise.all(fieldsToValidate.map(name => validateField(name)));
|
|
738
738
|
return results.every(valid => valid);
|
|
739
739
|
}
|
|
740
|
-
function resetFields(nameList) {
|
|
740
|
+
function resetFields(nameList, showError = true) {
|
|
741
741
|
if (nameList?.length) {
|
|
742
742
|
nameList.forEach(name => {
|
|
743
743
|
formRef.current[name] = initialValues[name];
|
|
@@ -747,13 +747,13 @@ const useForm = (initialValues = {}, onFieldsChange, onValuesChange) => {
|
|
|
747
747
|
...prev,
|
|
748
748
|
[name]: []
|
|
749
749
|
}));
|
|
750
|
-
setFieldValue(name, initialValues[name], undefined,
|
|
750
|
+
setFieldValue(name, initialValues[name], undefined, showError);
|
|
751
751
|
});
|
|
752
752
|
} else {
|
|
753
753
|
touchedFieldsRef.current.clear();
|
|
754
754
|
warningsRef.current = {};
|
|
755
755
|
Object.keys(formRef.current).forEach(name => {
|
|
756
|
-
setFieldValue(name, initialValues[name], undefined,
|
|
756
|
+
setFieldValue(name, initialValues[name], undefined, showError);
|
|
757
757
|
});
|
|
758
758
|
}
|
|
759
759
|
formSubscribers.current.forEach(callback => callback(getFieldsValue()));
|
|
@@ -2921,7 +2921,7 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
2921
2921
|
searchValue = '',
|
|
2922
2922
|
autoClearSearchValue = true,
|
|
2923
2923
|
filterOption = true,
|
|
2924
|
-
optionFilterProp
|
|
2924
|
+
optionFilterProp,
|
|
2925
2925
|
children,
|
|
2926
2926
|
options = [],
|
|
2927
2927
|
listHeight = LIST_HEIGHT,
|