var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Emit } from 'vue-property-decorator';
import { InputLabel } from '../../mixins/input-label/input-label';
import { InputManagement } from '../../mixins/input-management/input-management';
import { InputState } from '../../mixins/input-state/input-state';
import { InputWidth } from '../../mixins/input-width/input-width';
import uuid from '../../utils/uuid/uuid';
import { ModulVue } from '../../utils/vue/vue';
import { ICON_BUTTON_NAME, ICON_NAME, INPUT_STYLE_NAME, SEARCHFIELD_NAME, VALIDATION_MESSAGE_NAME } from '../component-names';
import { MIconButton } from '../icon-button/icon-button';
import { MIcon } from '../icon/icon';
import { MInputStyle } from '../input-style/input-style';
import { MValidationMessage } from '../validation-message/validation-message';
import WithRender from './searchfield.html';
import './searchfield.scss';
var MSearchfield = /** @class */ (function (_super) {
    __extends(MSearchfield, _super);
    function MSearchfield() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.id = "mSearchfield-" + uuid.generate();
        _this.searchIconDescription = _this.$i18n.translate('m-textfield:search');
        return _this;
    }
    MSearchfield.prototype.onReset = function () {
        this.as().model = '';
    };
    MSearchfield.prototype.onSearch = function (event) {
        this.search(this.as().model);
    };
    MSearchfield.prototype.search = function (model) { };
    Object.defineProperty(MSearchfield.prototype, "hasSearchfieldError", {
        get: function () {
            return this.as().hasError;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MSearchfield.prototype, "isSearchfieldValid", {
        get: function () {
            return this.as().isValid;
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        Emit('empty-field')
    ], MSearchfield.prototype, "onReset", null);
    __decorate([
        Emit('search')
    ], MSearchfield.prototype, "search", null);
    MSearchfield = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[INPUT_STYLE_NAME] = MInputStyle,
                _a[ICON_BUTTON_NAME] = MIconButton,
                _a[ICON_NAME] = MIcon,
                _a[VALIDATION_MESSAGE_NAME] = MValidationMessage,
                _a),
            mixins: [
                InputState,
                InputWidth,
                InputLabel,
                InputManagement
            ]
        })
    ], MSearchfield);
    return MSearchfield;
}(ModulVue));
export { MSearchfield };
var SearchfieldPlugin = {
    install: function (v) {
        v.component(SEARCHFIELD_NAME, MSearchfield);
    }
};
export default SearchfieldPlugin;
//# sourceMappingURL=searchfield.js.map