@bombillazo/rhf-plus 7.56.3-plus.2 → 7.57.0-plus.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,EAaL,WAAW,EACX,YAAY,EAgBZ,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAuDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EACjC,SAAS,SAAS,YAAY,GAAG,GAAG,EAEpC,KAAK,GAAE,YAAY,CACjB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,SAAS,CACL,GACL,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,CAAC;CACH,CAo9CA"}
1
+ {"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,EAaL,WAAW,EACX,YAAY,EAgBZ,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAuDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EACjC,SAAS,SAAS,YAAY,GAAG,GAAG,EAEpC,KAAK,GAAE,YAAY,CACjB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,SAAS,CACL,GACL,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,CAAC;CACH,CA29CA"}
@@ -1 +1 @@
1
- {"version":3,"file":"schemaErrorLookup.d.ts","sourceRoot":"","sources":["../../src/logic/schemaErrorLookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIhE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC3E,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,GACX;IACD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,CAkCA"}
1
+ {"version":3,"file":"schemaErrorLookup.d.ts","sourceRoot":"","sources":["../../src/logic/schemaErrorLookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIhE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC3E,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,GACX;IACD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,CAyCA"}
@@ -1,3 +1,3 @@
1
- declare const _default: <T extends string | string[] | undefined>(name?: T, signalName?: string, exact?: boolean) => boolean;
1
+ declare const _default: <T extends string | readonly string[] | undefined>(name?: T, signalName?: string, exact?: boolean) => boolean;
2
2
  export default _default;
3
3
  //# sourceMappingURL=shouldSubscribeByName.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shouldSubscribeByName.d.ts","sourceRoot":"","sources":["../../src/logic/shouldSubscribeByName.ts"],"names":[],"mappings":"yBAEgB,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACrD,OAAO,CAAC,EACR,aAAa,MAAM,EACnB,QAAQ,OAAO;AAHjB,wBAeI"}
1
+ {"version":3,"file":"shouldSubscribeByName.d.ts","sourceRoot":"","sources":["../../src/logic/shouldSubscribeByName.ts"],"names":[],"mappings":"yBAEgB,CAAC,SAAS,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,EAC9D,OAAO,CAAC,EACR,aAAa,MAAM,EACnB,QAAQ,OAAO;AAHjB,wBAeI"}
@@ -542,6 +542,12 @@ function schemaErrorLookup(errors, _fields, name) {
542
542
  error: foundError,
543
543
  };
544
544
  }
545
+ if (foundError && foundError.root && foundError.root.type) {
546
+ return {
547
+ name: `${fieldName}.root`,
548
+ error: foundError.root,
549
+ };
550
+ }
545
551
  names.pop();
546
552
  }
547
553
  return {
@@ -857,8 +863,6 @@ function createFormControl(props = {}) {
857
863
  array: createSubject(),
858
864
  state: createSubject(),
859
865
  };
860
- const validationModeBeforeSubmit = getValidationModes(_options.mode);
861
- const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
862
866
  const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
863
867
  const id = createId(props.id);
864
868
  const debounce = (callback) => (wait) => {
@@ -1130,13 +1134,17 @@ function createFormControl(props = {}) {
1130
1134
  }
1131
1135
  else if (fieldReference.refs) {
1132
1136
  if (isCheckBoxInput(fieldReference.ref)) {
1133
- fieldReference.refs.length > 1
1134
- ? fieldReference.refs.forEach((checkboxRef) => (!checkboxRef.defaultChecked || !checkboxRef.disabled) &&
1135
- (checkboxRef.checked = Array.isArray(fieldValue)
1136
- ? !!fieldValue.find((data) => data === checkboxRef.value)
1137
- : fieldValue === checkboxRef.value))
1138
- : fieldReference.refs[0] &&
1139
- (fieldReference.refs[0].checked = !!fieldValue);
1137
+ fieldReference.refs.forEach((checkboxRef) => {
1138
+ if (!checkboxRef.defaultChecked || !checkboxRef.disabled) {
1139
+ if (Array.isArray(fieldValue)) {
1140
+ checkboxRef.checked = !!fieldValue.find((data) => data === checkboxRef.value);
1141
+ }
1142
+ else {
1143
+ checkboxRef.checked =
1144
+ fieldValue === checkboxRef.value || !!fieldValue;
1145
+ }
1146
+ }
1147
+ });
1140
1148
  }
1141
1149
  else {
1142
1150
  fieldReference.refs.forEach((radioRef) => (radioRef.checked = radioRef.value === fieldValue));
@@ -1162,8 +1170,11 @@ function createFormControl(props = {}) {
1162
1170
  };
1163
1171
  const setValues = (name, value, options) => {
1164
1172
  for (const fieldKey in value) {
1173
+ if (!value.hasOwnProperty(fieldKey)) {
1174
+ return;
1175
+ }
1165
1176
  const fieldValue = value[fieldKey];
1166
- const fieldName = `${name}.${fieldKey}`;
1177
+ const fieldName = name + '.' + fieldKey;
1167
1178
  const field = get(_fields, fieldName);
1168
1179
  (_names.array.has(name) ||
1169
1180
  isObject(fieldValue) ||
@@ -1218,6 +1229,8 @@ function createFormControl(props = {}) {
1218
1229
  (isDateObject(fieldValue) && isNaN(fieldValue.getTime())) ||
1219
1230
  deepEqual(fieldValue, get(_formValues, name, fieldValue));
1220
1231
  };
1232
+ const validationModeBeforeSubmit = getValidationModes(_options.mode);
1233
+ const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
1221
1234
  if (field) {
1222
1235
  let error;
1223
1236
  let isValid;
@@ -1803,6 +1816,7 @@ function createFormControl(props = {}) {
1803
1816
  setError,
1804
1817
  _subscribe,
1805
1818
  _runSchema,
1819
+ _focusError,
1806
1820
  _getWatch,
1807
1821
  _getDirty,
1808
1822
  _setValid,