Skip to content

Commit

Permalink
added optional field property debounceValidateTime which works at t…
Browse files Browse the repository at this point in the history
…he field level, allowing individual fields to be debounced as opposed to the entire schema. works the same as `formOptions.debounceValidateTime`
  • Loading branch information
zoul0813 committed Dec 21, 2018
1 parent 9f4c72a commit d98fa50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/fields/abstractField.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default {
if (!isFunction(this.debouncedValidateFunc)) {
this.debouncedValidateFunc = debounce(
this.validate.bind(this),
objGet(this, "$parent.options.validateDebounceTime", 500)
objGet(this.schema, 'validateDebounceTime', objGet(this.formOptions, 'validateDebounceTime', 500))
);
}
this.debouncedValidateFunc();
Expand All @@ -162,8 +162,8 @@ export default {
this.schema.onChanged.call(this, this.model, newValue, oldValue, this.schema);
}

if (objGet(this.$parent, "options.validateAfterChanged", false) === true) {
if (objGet(this.$parent, "options.validateDebounceTime", 0) > 0) {
if (objGet(this.formOptions, "validateAfterChanged", false) === true) {
if (objGet(this.schema, 'validateDebounceTime', objGet(this.formOptions, 'validateDebounceTime', 0)) > 0) {
this.debouncedValidate();
} else {
this.validate();
Expand Down
3 changes: 2 additions & 1 deletion src/formGenerator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export default {
default() {
return {
validateAfterLoad: false,
validateAsync: false,
validateAfterChanged: false,
fieldIdPrefix: '',
validateAsync: false,
validationErrorClass: "error",
validationSuccessClass: ""
};
Expand Down

0 comments on commit d98fa50

Please sign in to comment.