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