import { __decorate, __extends, __spreadArrays } from "tslib";
import Component from 'vue-class-component';
import { Emit, Prop, Watch } from 'vue-property-decorator';
import { ModulVue } from '../../utils/vue/vue';
import { MButton } from '../button/button';
import { ORGANIZE_TABLE_COLUMNS_MODAL_NAME } from '../component-names';
import { MModal } from '../modal/modal';
import WithRender from './organize-table-columns-modal.html?style=./organize-table-columns-modal.scss';
import { MOrganizeTableColumns } from './organize-table-columns/organize-table-columns';
var MOrganizeTableColumnsModal = /** @class */ (function (_super) {
    __extends(MOrganizeTableColumnsModal, _super);
    function MOrganizeTableColumnsModal() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.internalColumns = [];
        _this.open = false;
        return _this;
    }
    MOrganizeTableColumnsModal.prototype.setInternalColumns = function (columns) {
        this.internalColumns = __spreadArrays(this.columns);
    };
    MOrganizeTableColumnsModal.prototype.reorganize = function (columns) {
        this.internalColumns = columns;
    };
    MOrganizeTableColumnsModal.prototype.saveReorganize = function () {
        this.emitReorganize(this.internalColumns);
    };
    MOrganizeTableColumnsModal.prototype.emitReorganize = function (columns) {
        this.open = false;
    };
    MOrganizeTableColumnsModal.prototype.reset = function () {
        this.setInternalColumns(this.columns);
        this.open = false;
    };
    __decorate([
        Prop({
            required: true
        })
    ], MOrganizeTableColumnsModal.prototype, "columns", void 0);
    __decorate([
        Watch('columns', { immediate: true })
    ], MOrganizeTableColumnsModal.prototype, "setInternalColumns", null);
    __decorate([
        Emit('reorganize')
    ], MOrganizeTableColumnsModal.prototype, "emitReorganize", null);
    __decorate([
        Emit('reset')
    ], MOrganizeTableColumnsModal.prototype, "reset", null);
    MOrganizeTableColumnsModal = __decorate([
        WithRender,
        Component({
            components: {
                MModal: MModal,
                MButton: MButton,
                MOrganizeTableColumns: MOrganizeTableColumns
            }
        })
    ], MOrganizeTableColumnsModal);
    return MOrganizeTableColumnsModal;
}(ModulVue));
export { MOrganizeTableColumnsModal };
var OrganizeTableColumnsModalPlugin = {
    install: function (v, options) {
        v.component(ORGANIZE_TABLE_COLUMNS_MODAL_NAME, MOrganizeTableColumnsModal);
    }
};
export default OrganizeTableColumnsModalPlugin;
//# sourceMappingURL=organize-table-columns-modal.js.map