@startinblox/core 0.19.16 → 0.19.17
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.
|
@@ -4,6 +4,7 @@ const en = {
|
|
|
4
4
|
"autocompletion.searchText": "No result",
|
|
5
5
|
"solid-delete.button": "Delete",
|
|
6
6
|
"solid-form.submit-button": "Submit",
|
|
7
|
+
"solid-form.validation-error": "A validation error occurred.",
|
|
7
8
|
"validation.message": "Please, confirm your choice",
|
|
8
9
|
"validation.submit-text": "Yes",
|
|
9
10
|
"validation.cancel-text": "Cancel"
|
|
@@ -4,6 +4,7 @@ const fr = {
|
|
|
4
4
|
"autocompletion.searchText": "Aucun résultat",
|
|
5
5
|
"solid-delete.button": "Supprimer",
|
|
6
6
|
"solid-form.submit-button": "Envoyer",
|
|
7
|
+
"solid-form.validation-error": "Erreur de validation.",
|
|
7
8
|
"validation.message": "Merci de confirmer votre choix",
|
|
8
9
|
"validation.submit-text": "Oui",
|
|
9
10
|
"validation.cancel-text": "Annuler"
|
package/dist/index.js
CHANGED
|
@@ -26116,8 +26116,8 @@ const TranslationMixin = {
|
|
|
26116
26116
|
async getTranslationModule(langCode) {
|
|
26117
26117
|
const translationsModules = {
|
|
26118
26118
|
// define modules in a static way, snowpack does not support dynamic strings here
|
|
26119
|
-
en: () => import("./en-
|
|
26120
|
-
fr: () => import("./fr-
|
|
26119
|
+
en: () => import("./en-CZGbNQZd.js"),
|
|
26120
|
+
fr: () => import("./fr-IUy0jqNf.js")
|
|
26121
26121
|
};
|
|
26122
26122
|
if (!translationsModules[langCode]) {
|
|
26123
26123
|
console.warn(`${langCode}.json translation file may not exist, English is setted by default`);
|
|
@@ -53284,40 +53284,73 @@ const SolidForm = {
|
|
|
53284
53284
|
if (!this.isCreationForm(formValue) && this.isSavingAutomatically)
|
|
53285
53285
|
this.submitForm();
|
|
53286
53286
|
},
|
|
53287
|
-
|
|
53288
|
-
let errorsArray = [];
|
|
53287
|
+
displayErrorMessage(errors2, errorFullName = "") {
|
|
53289
53288
|
errors2.forEach((member) => {
|
|
53290
53289
|
let errorNextName = Object.values(member)[0];
|
|
53291
|
-
let
|
|
53292
|
-
|
|
53293
|
-
|
|
53294
|
-
|
|
53295
|
-
|
|
53296
|
-
|
|
53290
|
+
let subErrorName = errorFullName === "" ? errorNextName : errorFullName.concat("." + errorNextName);
|
|
53291
|
+
let errorFieldName = "";
|
|
53292
|
+
if (errorFullName)
|
|
53293
|
+
errorFieldName = errorFullName.concat("." + errorNextName);
|
|
53294
|
+
else
|
|
53295
|
+
errorFieldName = errorNextName;
|
|
53296
|
+
if (errorFieldName) {
|
|
53297
|
+
let formField = this.element.querySelector(`[name="${errorFieldName}"]`);
|
|
53298
|
+
if (formField) {
|
|
53299
|
+
formField.classList.add("error");
|
|
53300
|
+
let errorParagraph = document.createElement("p");
|
|
53301
|
+
if (Array.isArray(Object.values(member)[1]) === true) {
|
|
53302
|
+
Object.values(member)[1].forEach((error2) => {
|
|
53303
|
+
let errorText = document.createElement("p");
|
|
53304
|
+
errorText.textContent = error2;
|
|
53305
|
+
errorParagraph.appendChild(errorText);
|
|
53306
|
+
});
|
|
53307
|
+
} else if (typeof Object.values(member)[1] === "object") {
|
|
53308
|
+
for (const [key, value] of Object.entries(Object.values(member)[1])) {
|
|
53309
|
+
if (Array.isArray(value)) {
|
|
53310
|
+
value.forEach((error2) => {
|
|
53311
|
+
let errorText = document.createElement("p");
|
|
53312
|
+
errorText.textContent = error2;
|
|
53313
|
+
errorParagraph.appendChild(errorText);
|
|
53314
|
+
});
|
|
53315
|
+
} else if (typeof value === "string") {
|
|
53316
|
+
let errorText = document.createElement("p");
|
|
53317
|
+
errorText.textContent = value;
|
|
53318
|
+
errorParagraph.appendChild(errorText);
|
|
53319
|
+
}
|
|
53320
|
+
}
|
|
53321
|
+
} else {
|
|
53322
|
+
errorParagraph.textContent = Object.values(member)[1];
|
|
53323
|
+
}
|
|
53324
|
+
errorParagraph.classList.add("error-message");
|
|
53325
|
+
formField.appendChild(errorParagraph);
|
|
53326
|
+
}
|
|
53327
|
+
}
|
|
53328
|
+
if (!Array.isArray(Object.values(member)[1]) === true) {
|
|
53297
53329
|
let objectErrors = Object.values(member)[1];
|
|
53298
53330
|
let subErrors = Object.entries(objectErrors);
|
|
53299
|
-
|
|
53331
|
+
this.displayErrorMessage(subErrors, subErrorName);
|
|
53300
53332
|
}
|
|
53301
53333
|
});
|
|
53302
|
-
return errorsArray;
|
|
53303
53334
|
},
|
|
53304
53335
|
empty() {
|
|
53305
53336
|
},
|
|
53306
53337
|
showError(e) {
|
|
53307
53338
|
let errors2 = Object.entries(e).filter((field) => !field[0].startsWith("@context"));
|
|
53339
|
+
this.displayErrorMessage(errors2);
|
|
53308
53340
|
const errorTemplate = html$1`
|
|
53309
|
-
<p
|
|
53310
|
-
<ul>
|
|
53311
|
-
${this.findErrorMessage(errors2).map((field) => html$1`
|
|
53312
|
-
<li>${field}</li>
|
|
53313
|
-
`)}
|
|
53314
|
-
</ul>
|
|
53341
|
+
<p>${this.t("solid-form.validation-error")}</p>
|
|
53315
53342
|
`;
|
|
53316
53343
|
const parentElement = this.element.querySelector("[data-id=error]");
|
|
53317
53344
|
if (parentElement)
|
|
53318
53345
|
render$1(errorTemplate, parentElement);
|
|
53319
53346
|
},
|
|
53320
53347
|
hideError() {
|
|
53348
|
+
let formErrors = this.element.querySelectorAll(".error-message");
|
|
53349
|
+
if (formErrors)
|
|
53350
|
+
formErrors.forEach((error2) => error2.remove());
|
|
53351
|
+
let errorFields = this.element.querySelectorAll(".error");
|
|
53352
|
+
if (errorFields)
|
|
53353
|
+
errorFields.forEach((errorField) => errorField.classList.remove("error"));
|
|
53321
53354
|
const parentElement = this.element.querySelector("[data-id=error]");
|
|
53322
53355
|
if (parentElement)
|
|
53323
53356
|
render$1("", parentElement);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.17",
|
|
4
4
|
"description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|