@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.
- package/README.md +4 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.mjs +33 -16
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/logic/createFormControl.d.ts.map +1 -1
- package/dist/logic/schemaErrorLookup.d.ts.map +1 -1
- package/dist/logic/shouldSubscribeByName.d.ts +1 -1
- package/dist/logic/shouldSubscribeByName.d.ts.map +1 -1
- package/dist/react-server.esm.mjs +24 -10
- package/dist/react-server.esm.mjs.map +1 -1
- package/dist/types/form.d.ts +14 -10
- package/dist/types/form.d.ts.map +1 -1
- package/dist/useForm.d.ts.map +1 -1
- package/dist/useFormState.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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,
|
|
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,
|
|
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,
|
|
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.
|
|
1134
|
-
|
|
1135
|
-
(
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
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 =
|
|
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,
|