@jsenv/navi 0.10.0 → 0.10.2
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/jsenv_navi.js
CHANGED
|
@@ -13817,14 +13817,6 @@ const installCustomConstraintValidation = (
|
|
|
13817
13817
|
});
|
|
13818
13818
|
return;
|
|
13819
13819
|
}
|
|
13820
|
-
const { form } = element;
|
|
13821
|
-
if (!form) {
|
|
13822
|
-
return;
|
|
13823
|
-
}
|
|
13824
|
-
dispatchActionRequestedCustomEvent(form, {
|
|
13825
|
-
event: e,
|
|
13826
|
-
requester: element,
|
|
13827
|
-
});
|
|
13828
13820
|
});
|
|
13829
13821
|
addTeardown(() => {
|
|
13830
13822
|
stop();
|
|
@@ -14216,9 +14208,25 @@ const useExecuteAction = (
|
|
|
14216
14208
|
|
|
14217
14209
|
const validationMessageTargetRef = useRef(null);
|
|
14218
14210
|
const addErrorMessage = (error) => {
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14211
|
+
let calloutAnchor = validationMessageTargetRef.current;
|
|
14212
|
+
let message;
|
|
14213
|
+
if (errorMapping) {
|
|
14214
|
+
const errorMappingResult = errorMapping(error);
|
|
14215
|
+
if (typeof errorMappingResult === "string") {
|
|
14216
|
+
message = errorMappingResult;
|
|
14217
|
+
} else if (Error.isError(errorMappingResult)) {
|
|
14218
|
+
message = errorMappingResult;
|
|
14219
|
+
} else if (
|
|
14220
|
+
typeof errorMappingResult === "object" &&
|
|
14221
|
+
errorMappingResult !== null
|
|
14222
|
+
) {
|
|
14223
|
+
message = errorMappingResult.message || error.message;
|
|
14224
|
+
calloutAnchor = errorMappingResult.target || calloutAnchor;
|
|
14225
|
+
}
|
|
14226
|
+
} else {
|
|
14227
|
+
message = error;
|
|
14228
|
+
}
|
|
14229
|
+
addCustomMessage(calloutAnchor, "action_error", message, {
|
|
14222
14230
|
// This error should not prevent <form> submission
|
|
14223
14231
|
// so whenever user tries to submit the form the error is cleared
|
|
14224
14232
|
// (Hitting enter key, clicking on submit button, etc. would allow to re-submit the form in error state)
|
package/package.json
CHANGED
|
@@ -28,9 +28,25 @@ export const useExecuteAction = (
|
|
|
28
28
|
|
|
29
29
|
const validationMessageTargetRef = useRef(null);
|
|
30
30
|
const addErrorMessage = (error) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
let calloutAnchor = validationMessageTargetRef.current;
|
|
32
|
+
let message;
|
|
33
|
+
if (errorMapping) {
|
|
34
|
+
const errorMappingResult = errorMapping(error);
|
|
35
|
+
if (typeof errorMappingResult === "string") {
|
|
36
|
+
message = errorMappingResult;
|
|
37
|
+
} else if (Error.isError(errorMappingResult)) {
|
|
38
|
+
message = errorMappingResult;
|
|
39
|
+
} else if (
|
|
40
|
+
typeof errorMappingResult === "object" &&
|
|
41
|
+
errorMappingResult !== null
|
|
42
|
+
) {
|
|
43
|
+
message = errorMappingResult.message || error.message;
|
|
44
|
+
calloutAnchor = errorMappingResult.target || calloutAnchor;
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
message = error;
|
|
48
|
+
}
|
|
49
|
+
addCustomMessage(calloutAnchor, "action_error", message, {
|
|
34
50
|
// This error should not prevent <form> submission
|
|
35
51
|
// so whenever user tries to submit the form the error is cleared
|
|
36
52
|
// (Hitting enter key, clicking on submit button, etc. would allow to re-submit the form in error state)
|
|
@@ -595,14 +595,6 @@ export const installCustomConstraintValidation = (
|
|
|
595
595
|
});
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
|
-
const { form } = element;
|
|
599
|
-
if (!form) {
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
dispatchActionRequestedCustomEvent(form, {
|
|
603
|
-
event: e,
|
|
604
|
-
requester: element,
|
|
605
|
-
});
|
|
606
598
|
});
|
|
607
599
|
addTeardown(() => {
|
|
608
600
|
stop();
|