@targoninc/jess-components 0.0.31 → 0.0.33
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 +10 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -748,7 +748,11 @@ var InputType;
|
|
|
748
748
|
|
|
749
749
|
// src/src/Debounce.ts
|
|
750
750
|
var debounceMap = {};
|
|
751
|
-
function debounce(identifier, func, delay =
|
|
751
|
+
function debounce(identifier, func, delay = 0) {
|
|
752
|
+
if (!delay) {
|
|
753
|
+
func();
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
752
756
|
if (debounceMap[identifier]) {
|
|
753
757
|
clearTimeout(debounceMap[identifier]);
|
|
754
758
|
}
|
|
@@ -790,7 +794,7 @@ function input(config) {
|
|
|
790
794
|
errors.value = [];
|
|
791
795
|
if (config.debounce) {
|
|
792
796
|
if (Date.now() - lastChange < config.debounce) {
|
|
793
|
-
debounce(inputId, () => validate(newValue), config.debounce);
|
|
797
|
+
debounce(inputId + "validate", () => validate(newValue), config.debounce);
|
|
794
798
|
return;
|
|
795
799
|
}
|
|
796
800
|
}
|
|
@@ -819,9 +823,9 @@ function input(config) {
|
|
|
819
823
|
validate(e.target.value);
|
|
820
824
|
}
|
|
821
825
|
if (config.onchange) {
|
|
822
|
-
debounce(inputId, () => config.onchange(e.target.value), config.debounce);
|
|
826
|
+
debounce(inputId + "change", () => config.onchange(e.target.value), config.debounce);
|
|
823
827
|
}
|
|
824
|
-
value.value = e.target.value;
|
|
828
|
+
debounce(inputId + "value", () => value.value = e.target.value, config.debounce);
|
|
825
829
|
}).onchange((e) => {
|
|
826
830
|
touched.value = true;
|
|
827
831
|
lastChange = Date.now();
|
|
@@ -829,9 +833,9 @@ function input(config) {
|
|
|
829
833
|
validate(e.target.value);
|
|
830
834
|
}
|
|
831
835
|
if (config.onchange) {
|
|
832
|
-
debounce(inputId, () => config.onchange(e.target.value), config.debounce);
|
|
836
|
+
debounce(inputId + "change", () => config.onchange(e.target.value), config.debounce);
|
|
833
837
|
}
|
|
834
|
-
value.value = e.target.value;
|
|
838
|
+
debounce(inputId + "value", () => value.value = e.target.value, config.debounce);
|
|
835
839
|
}).onkeydown(config.onkeydown ?? (() => {})).name(config.name).build(), when(isPassword, eyeButton(toggleState, () => {
|
|
836
840
|
toggleState.value = !toggleState.value;
|
|
837
841
|
}))).build(), when(hasError, errorList(errors))).build();
|