devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
54 lines (53 loc) • 1.44 kB
JavaScript
/**
* DevExtreme (esm/__internal/ui/validation/default_adapter.js)
* Version: 26.1.6
* Build date: Fri Oct 16 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
class DefaultAdapter {
constructor(editor, validator) {
this.editor = editor;
this.validator = validator;
this.validationRequestsCallbacks = [];
const handler = args => {
this.validationRequestsCallbacks.forEach(item => item(args))
};
editor.validationRequest.add(handler);
editor.on("disposing", () => {
editor.validationRequest.remove(handler)
})
}
getValue() {
const {
value: value
} = this.editor.option();
return value
}
getCurrentValidationError() {
const {
validationError: validationError
} = this.editor.option();
return validationError
}
bypass() {
const {
disabled: disabled
} = this.editor.option();
return disabled
}
applyValidationResults(params) {
this.editor.option({
validationErrors: params.brokenRules,
validationStatus: params.status
})
}
reset() {
this.editor.clear()
}
focus() {
this.editor.focus()
}
}
export default DefaultAdapter;