@kerkhoff-ict/solora 2.5.1 → 2.5.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/index.js +48 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1919,41 +1919,58 @@ function initDropdowns() {
|
|
|
1919
1919
|
}
|
|
1920
1920
|
|
|
1921
1921
|
// src/components/input.js
|
|
1922
|
-
function initInput(
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
inputElement.parentNode.appendChild(errorDisplay);
|
|
1929
|
-
}
|
|
1930
|
-
inputElement.addEventListener("invalid", (e) => {
|
|
1931
|
-
e.preventDefault();
|
|
1932
|
-
showError();
|
|
1933
|
-
});
|
|
1934
|
-
inputElement.addEventListener("input", () => {
|
|
1935
|
-
if (inputElement.validity.valid) {
|
|
1936
|
-
hideError();
|
|
1922
|
+
function initInput() {
|
|
1923
|
+
const inputs = document.querySelectorAll(".sol-input");
|
|
1924
|
+
inputs.forEach((input) => {
|
|
1925
|
+
const form = input.closest("form");
|
|
1926
|
+
if (form && !form.noValidate) {
|
|
1927
|
+
form.noValidate = true;
|
|
1937
1928
|
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
} else if (inputElement.validity.typeMismatch) {
|
|
1944
|
-
if (inputElement.type === "email") message = "Voer een geldig e-mailadres in";
|
|
1945
|
-
if (inputElement.type === "url") message = "Voer een geldige link in";
|
|
1946
|
-
} else if (inputElement.validity.rangeUnderflow) {
|
|
1947
|
-
message = `Minimum is ${inputElement.min}`;
|
|
1929
|
+
let errorDisplay = input.parentNode.querySelector(".sol-error-message");
|
|
1930
|
+
if (!errorDisplay) {
|
|
1931
|
+
errorDisplay = document.createElement("span");
|
|
1932
|
+
errorDisplay.className = "sol-error-message";
|
|
1933
|
+
input.parentNode.appendChild(errorDisplay);
|
|
1948
1934
|
}
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1935
|
+
input.addEventListener("invalid", (e) => {
|
|
1936
|
+
e.preventDefault();
|
|
1937
|
+
updateValidationState(input, errorDisplay);
|
|
1938
|
+
});
|
|
1939
|
+
input.addEventListener("input", () => {
|
|
1940
|
+
if (input.validity.valid) {
|
|
1941
|
+
clearError(input, errorDisplay);
|
|
1942
|
+
}
|
|
1943
|
+
});
|
|
1944
|
+
input.addEventListener("blur", () => {
|
|
1945
|
+
updateValidationState(input, errorDisplay);
|
|
1946
|
+
});
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
function updateValidationState(input, errorDisplay) {
|
|
1950
|
+
if (input.validity.valid) {
|
|
1951
|
+
clearError(input, errorDisplay);
|
|
1952
|
+
return;
|
|
1952
1953
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1954
|
+
let message = "Ongeldige invoer";
|
|
1955
|
+
if (input.validity.valueMissing) {
|
|
1956
|
+
message = "Dit veld is verplicht";
|
|
1957
|
+
} else if (input.validity.typeMismatch) {
|
|
1958
|
+
if (input.type === "email") message = "Voer een geldig e-mailadres in";
|
|
1959
|
+
if (input.type === "url") message = "Voer een geldige link in";
|
|
1960
|
+
} else if (input.validity.tooShort) {
|
|
1961
|
+
message = `Minimaal ${input.minLength} tekens nodig`;
|
|
1962
|
+
} else if (input.validity.rangeUnderflow) {
|
|
1963
|
+
message = `Minimum waarde is ${input.min}`;
|
|
1964
|
+
} else if (input.validity.patternMismatch) {
|
|
1965
|
+
message = "De opmaak is onjuist";
|
|
1956
1966
|
}
|
|
1967
|
+
errorDisplay.textContent = message;
|
|
1968
|
+
errorDisplay.style.display = "block";
|
|
1969
|
+
input.classList.add("is-invalid");
|
|
1970
|
+
}
|
|
1971
|
+
function clearError(input, errorDisplay) {
|
|
1972
|
+
errorDisplay.style.display = "none";
|
|
1973
|
+
input.classList.remove("is-invalid");
|
|
1957
1974
|
}
|
|
1958
1975
|
|
|
1959
1976
|
// src/components/contextMenu.js
|