Skip to content

Commit 4239123

Browse files
authored
Merge pull request #447 from zoul0813/feature/425-make-debouce-time-configurable
#425 - made DEBOUNCE_FORMAT_MS configurable in the schema, use `debounceFormatTimeout: TIME_IN_MS` as schema property
2 parents 73921d4 + 9b94ab9 commit 4239123

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)