var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Emit, Prop } from 'vue-property-decorator';
import { FormatMode } from '../../utils/i18n/i18n';
import { ModulVue } from '../../utils/vue/vue';
import { MButton, MButtonSkin } from '../button/button';
import { BUTTON_NAME, PROGRESS_NAME, SHOW_MORE_NAME } from '../component-names';
import { MProgress } from '../progress/progress';
import WithRender from './show-more.html?style=./show-more.scss';
var MShowMore = /** @class */ (function (_super) {
    __extends(MShowMore, _super);
    function MShowMore() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(MShowMore.prototype, "isVisible", {
        get: function () {
            return this.nbTotal !== undefined && this.nbTotal > 0;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MShowMore.prototype, "isProgressVisible", {
        get: function () {
            return this.nbVisible < this.nbTotal;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MShowMore.prototype, "status", {
        get: function () {
            return this.$i18n.translate('m-show-more:status', { nbVisible: this.nbVisible, nbTotal: this.nbTotal }, undefined, undefined, undefined, FormatMode.Sprintf);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MShowMore.prototype, "visiblePourcentage", {
        get: function () {
            return (this.nbVisible / this.nbTotal) * 100;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MShowMore.prototype, "buttonLabel", {
        get: function () {
            return this.$i18n.translate('m-show-more:button-label');
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MShowMore.prototype, "buttonSkin", {
        get: function () {
            return MButtonSkin.Secondary;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MShowMore.prototype, "isButtonVisible", {
        get: function () {
            return this.nbVisible < this.nbTotal;
        },
        enumerable: false,
        configurable: true
    });
    MShowMore.prototype.showMore = function () {
        this.$emit('update:loading', true);
    };
    __decorate([
        Prop({ default: 0 })
    ], MShowMore.prototype, "nbVisible", void 0);
    __decorate([
        Prop({ required: true })
    ], MShowMore.prototype, "nbTotal", void 0);
    __decorate([
        Prop({ default: false })
    ], MShowMore.prototype, "loading", void 0);
    __decorate([
        Prop()
    ], MShowMore.prototype, "skin", void 0);
    __decorate([
        Emit('click')
    ], MShowMore.prototype, "showMore", null);
    MShowMore = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[BUTTON_NAME] = MButton,
                _a[PROGRESS_NAME] = MProgress,
                _a)
        })
    ], MShowMore);
    return MShowMore;
}(ModulVue));
export { MShowMore };
var ShowMorePlugin = {
    install: function (v, options) {
        v.component(SHOW_MORE_NAME, MShowMore);
    }
};
export default ShowMorePlugin;
//# sourceMappingURL=show-more.js.map