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.
@@ -43,7 +43,7 @@ const SelectComponent = forwardRef<HTMLDivElement, SelectProps>(
43
43
  searchValue = '',
44
44
  autoClearSearchValue = true,
45
45
  filterOption = true,
46
- optionFilterProp = 'value',
46
+ optionFilterProp,
47
47
  children,
48
48
  options = [],
49
49
  listHeight = LIST_HEIGHT,
@@ -370,7 +370,7 @@ const SelectComponent = forwardRef<HTMLDivElement, SelectProps>(
370
370
  return true;
371
371
  }
372
372
 
373
- const valueToCheck = `${['string', 'number'].includes(typeof option.children)
373
+ const valueToCheck = `${['string', 'number'].includes(typeof (option.children))
374
374
  ? option.children
375
375
  : // eslint-disable-next-line @typescript-eslint/ban-ts-comment
376
376
  // @ts-expect-error
@@ -225,21 +225,21 @@ const useForm = (
225
225
  return results.every(valid => valid);
226
226
  }
227
227
 
228
- function resetFields(nameList?: string[]) {
228
+ function resetFields(nameList?: string[], showError: boolean = true) {
229
229
  if (nameList?.length) {
230
230
  nameList.forEach((name: string) => {
231
231
  formRef.current[name] = initialValues[name];
232
232
  touchedFieldsRef.current.delete(name);
233
233
  delete warningsRef.current[name];
234
234
  setErrors(prev => ({ ...prev, [name]: [] }));
235
- setFieldValue(name, initialValues[name], undefined, true);
235
+ setFieldValue(name, initialValues[name], undefined, showError);
236
236
  });
237
237
  } else {
238
238
  touchedFieldsRef.current.clear();
239
239
  warningsRef.current = {};
240
240
 
241
241
  Object.keys(formRef.current).forEach(name => {
242
- setFieldValue(name, initialValues[name], undefined, true);
242
+ setFieldValue(name, initialValues[name], undefined, showError);
243
243
  });
244
244
  }
245
245
 
package/lib/types/form.ts CHANGED
@@ -110,7 +110,7 @@ export interface FormItemChildComponentProps {
110
110
  export interface FormInstance {
111
111
  submit: () => Promise<Record<string, RuleTypes> | undefined>;
112
112
  setFields: (fields: FieldData[]) => void;
113
- resetFields: (nameList?: string[]) => void;
113
+ resetFields: (nameList?: string[], showError?: boolean) => void;
114
114
  getFieldError: (name: string) => string[];
115
115
  registerField: (name: string, rules?: RuleObject[]) => void;
116
116
  setFieldValue: (name: string, value: RuleTypes) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-ui-design",
3
- "version": "0.2.87",
3
+ "version": "0.2.89",
4
4
  "license": "ISC",
5
5
  "author": "Gabriel Boyajyan",
6
6
  "main": "dist/index.js",