react-hook-form 7.61.0 → 7.62.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EAgBX,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAoDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EAEjC,KAAK,GAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAM,GACnE,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,CAAC;CACH,CA46CA"}
1
+ {"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EAgBX,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAoDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EAEjC,KAAK,GAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAM,GACnE,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,CAAC;CACH,CA+6CA"}
@@ -56,7 +56,7 @@ function cloneObject(data) {
56
56
  }
57
57
  else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
58
58
  (isArray || isObject(data))) {
59
- copy = isArray ? [] : {};
59
+ copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
60
60
  if (!isArray && !isPlainObject(data)) {
61
61
  copy = data;
62
62
  }
@@ -1202,8 +1202,10 @@ function createFormControl(props = {}) {
1202
1202
  const watched = isWatched(name, _names, isBlurEvent);
1203
1203
  set(_formValues, name, fieldValue);
1204
1204
  if (isBlurEvent) {
1205
- field._f.onBlur && field._f.onBlur(event);
1206
- delayErrorCallback && delayErrorCallback(0);
1205
+ if (!target || !target.readOnly) {
1206
+ field._f.onBlur && field._f.onBlur(event);
1207
+ delayErrorCallback && delayErrorCallback(0);
1208
+ }
1207
1209
  }
1208
1210
  else if (field._f.onChange) {
1209
1211
  field._f.onChange(event);
@@ -1698,6 +1700,7 @@ function createFormControl(props = {}) {
1698
1700
  ? _formState.isSubmitSuccessful
1699
1701
  : false,
1700
1702
  isSubmitting: false,
1703
+ defaultValues: _defaultValues,
1701
1704
  });
1702
1705
  };
1703
1706
  const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues)