import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { KeyCode } from '../../utils/keycode/keycode';
import { ModulVue } from '../../utils/vue/vue';
import { InputState } from '../input-state/input-state';
import { MediaQueries } from '../media-queries/media-queries';
var InputPopup = /** @class */ (function (_super) {
    __extends(InputPopup, _super);
    function InputPopup() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.internalValue = '';
        return _this;
    }
    InputPopup.prototype.inputOnKeydownEnter = function ($event) {
        if (!this.open) {
            this.open = true;
        }
        $event.preventDefault();
    };
    InputPopup.prototype.inputOnKeydownTab = function ($event) {
        if (this.as().isMqMinS) {
            this.open = false;
        }
    };
    InputPopup.prototype.inputOnKeydownDelete = function () {
        this.internalValue = '';
    };
    InputPopup.prototype.inputOnKeydown = function ($event) {
        // tslint:disable: deprecation
        if ($event.keyCode !== KeyCode.M_RETURN &&
            $event.keyCode !== KeyCode.M_ENTER &&
            $event.keyCode !== KeyCode.M_TAB &&
            $event.keyCode !== KeyCode.M_SHIFT &&
            $event.keyCode !== KeyCode.M_ESCAPE && !this.open) {
            this.open = true;
        }
        // tslint:enable: deprecation
    };
    InputPopup.prototype.inputOnFocus = function () {
        if (!this.open && !this.as().isDisabled && this.as().isMqMinS) {
            this.open = true;
        }
    };
    Object.defineProperty(InputPopup.prototype, "isEmpty", {
        get: function () {
            return this.as().hasValue || (this.hasPlaceholder() && this.open) ? false : true;
        },
        enumerable: false,
        configurable: true
    });
    InputPopup.prototype.hasPlaceholder = function () {
        return this.placeholder !== undefined && this.placeholder !== '';
    };
    InputPopup = __decorate([
        Component({
            mixins: [
                InputState,
                MediaQueries
            ]
        })
    ], InputPopup);
    return InputPopup;
}(ModulVue));
export { InputPopup };
//# sourceMappingURL=input-popup.js.map