/**
 * DevExtreme (esm/renovation/component_wrapper/editors/check_box.js)
 * Version: 21.2.0 (build 21200-0321)
 * Build date: Mon Jul 19 2021
 *
 * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import Editor from "./editor";
import {
    addAttributes,
    getAriaName
} from "../utils/utils";
export default class CheckBox extends Editor {
    _useTemplates() {
        return false
    }
    _optionChanged(option) {
        var _this$_valueChangeAct;
        var {
            name: name,
            previousValue: previousValue,
            value: value
        } = option;
        switch (name) {
            case "value":
                null === (_this$_valueChangeAct = this._valueChangeAction) || void 0 === _this$_valueChangeAct ? void 0 : _this$_valueChangeAct.call(this, {
                    element: this.$element(),
                    previousValue: previousValue,
                    value: value,
                    event: this._valueChangeEventInstance
                });
                this._valueChangeEventInstance = void 0;
                break;
            case "onValueChanged":
                this._valueChangeAction = this._createActionByOption("onValueChanged", {
                    excludeValidators: ["disabled", "readOnly"]
                })
        }
        super._optionChanged(option)
    }
    setAria(name, value) {
        var attrName = getAriaName(name);
        addAttributes(this.$element(), [{
            name: attrName,
            value: value
        }])
    }
}
