var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
import uuid from '../../utils/uuid/uuid';
import { INPUT_GROUP_NAME, VALIDATION_MESSAGE_NAME } from '../component-names';
import { MValidationMessage } from '../validation-message/validation-message';
import { InputManagement } from './../../mixins/input-management/input-management';
import { InputState } from './../../mixins/input-state/input-state';
import { ModulVue } from './../../utils/vue/vue';
import WithRender from './input-group.html?style=./input-group.scss';
export var MMInputGroupValidationMessagePosition;
(function (MMInputGroupValidationMessagePosition) {
    MMInputGroupValidationMessagePosition["Top"] = "top";
    MMInputGroupValidationMessagePosition["Bottom"] = "bottom";
})(MMInputGroupValidationMessagePosition || (MMInputGroupValidationMessagePosition = {}));
var MInputGroup = /** @class */ (function (_super) {
    __extends(MInputGroup, _super);
    function MInputGroup() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(MInputGroup.prototype, "hasLabel", {
        get: function () {
            return !!this.label;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MInputGroup.prototype, "isValidationMessagePositionBottom", {
        get: function () {
            return this.validationMessagePosition === MMInputGroupValidationMessagePosition.Bottom;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MInputGroup.prototype, "idLabel", {
        get: function () {
            return this.hasLabel ? uuid.generate() : undefined;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MInputGroup.prototype, "idValidationMessage", {
        get: function () {
            return this.as().errorMessage || this.as().validMessage || this.as().helperMessage ? uuid.generate() : undefined;
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        Prop()
    ], MInputGroup.prototype, "label", void 0);
    __decorate([
        Prop()
    ], MInputGroup.prototype, "requiredMarker", void 0);
    __decorate([
        Prop({
            default: MMInputGroupValidationMessagePosition.Top,
            validator: function (value) {
                return value === MMInputGroupValidationMessagePosition.Top ||
                    value === MMInputGroupValidationMessagePosition.Bottom;
            }
        })
    ], MInputGroup.prototype, "validationMessagePosition", void 0);
    MInputGroup = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[VALIDATION_MESSAGE_NAME] = MValidationMessage,
                _a),
            mixins: [
                InputState,
                InputManagement
            ]
        })
    ], MInputGroup);
    return MInputGroup;
}(ModulVue));
export { MInputGroup };
var InputGroupPlugin = {
    install: function (v, options) {
        v.component(INPUT_GROUP_NAME, MInputGroup);
    }
};
export default InputGroupPlugin;
//# sourceMappingURL=input-group.js.map