Skip to content

Commit 8527b28

Browse files
committed
resolves #425 - made DEBOUNCE_FORMAT_MS configurable in the schema, you can now set debounceFormatTimeout to adjust how long the field will "wait" before attempting to format the value ... defaults to 1s, and allows you to accommodate "slower data entry".
1 parent 2cf4a47 commit 8527b28

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/fields/core/fieldInput.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
<script>
4343
import abstractField from "../abstractField";
44-
import { debounce, isFunction, isNumber } from "lodash";
44+
import { debounce, get as objGet, isFunction, isNumber } from "lodash";
4545
import fecha from "fecha";
4646
4747
const DATETIME_FORMATS = {
@@ -50,8 +50,6 @@ const DATETIME_FORMATS = {
5050
"datetime-local": "YYYY-MM-DDTHH:mm:ss",
5151
};
5252
53-
const DEBOUNCE_FORMAT_MS = 1000;
54-
5553
export default {
5654
mixins: [abstractField],
5755
methods: {
@@ -115,8 +113,7 @@ export default {
115113
case "range":
116114
this.debouncedFormatFunc = debounce((newValue, oldValue) => {
117115
this.formatNumberToModel(newValue, oldValue);
118-
}
119-
, DEBOUNCE_FORMAT_MS, {
116+
}, parseInt(objGet(this.schema, 'debounceFormatTimeout', 1000)), {
120117
trailing: true,
121118
leading: false
122119
});
@@ -127,8 +124,7 @@ export default {
127124
// wait 1s before calling 'formatDatetimeToModel' to allow user to input data
128125
this.debouncedFormatFunc = debounce((newValue, oldValue) => {
129126
this.formatDatetimeToModel(newValue, oldValue);
130-
}
131-
, DEBOUNCE_FORMAT_MS, {
127+
}, parseInt(objGet(this.schema, 'debounceFormatTimeout', 1000)), {
132128
trailing: true,
133129
leading: false
134130
});

0 commit comments

Comments
 (0)