"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GridHelper = void 0;
var aurelia_i18n_1 = require("aurelia-i18n");
var common_model_1 = require("../../../model/common-model");
var list_view_model_base_1 = require("../../../vm/list-view-model-base");
var aurelia_framework_1 = require("aurelia-framework");
var constants_1 = require("./../../../constants/constants");
var GridHelper = (function () {
    function GridHelper() {
    }
    GridHelper.getSelectedColDef = function (vm, coldef) {
        if (coldef === void 0) { coldef = {}; }
        return Object.assign({
            headerName: "",
            field: "isSelected",
            maxWidth: constants_1.AGGridColumnsWidth.IsSelected,
            minWidth: constants_1.AGGridColumnsWidth.IsSelected,
            cellRenderer: "selectionCellRenderer",
            suppressMenu: true,
            sortable: false,
            resizable: false,
            suppressMovable: true,
            filter: false,
            pinned: "left",
            headerComponent: list_view_model_base_1.SelectAllHeaderComponent,
            headerComponentParams: { VM: vm }
        }, coldef);
    };
    GridHelper.getCreatedTimeColDef = function (coldef) {
        if (coldef === void 0) { coldef = {}; }
        var i18n = aurelia_framework_1.Container.instance.get(aurelia_i18n_1.I18N);
        return Object.assign({
            headerName: i18n.tr("general.createdTime", { ns: "common" }),
            field: "createdTime",
            hide: true,
            floatingFilterComponentParams: {
                suppressFilterButton: true,
                dateFormat: common_model_1.Various.DateFormatWithHours
            },
            type: common_model_1.FieldType.Date,
            showRowGroup: i18n.tr("general.generalInformation", { ns: "common" })
        }, coldef);
    };
    GridHelper.getCreatedFullNameColDef = function (entityUserName, coldef) {
        if (coldef === void 0) { coldef = {}; }
        var i18n = aurelia_framework_1.Container.instance.get(aurelia_i18n_1.I18N);
        return Object.assign({
            headerName: i18n.tr("general.createdByFullName", { ns: "common" }),
            field: "createdByFullName",
            hide: true,
            type: common_model_1.FieldType.User,
            filterParams: {
                userServiceName: entityUserName
            },
            floatingFilterComponentParams: {
                suppressFilterButton: true,
                userServiceName: entityUserName
            },
            showRowGroup: i18n.tr("general.generalInformation", { ns: "common" })
        }, coldef);
    };
    GridHelper.getUpdatedTimeColDef = function (coldef) {
        if (coldef === void 0) { coldef = {}; }
        var i18n = aurelia_framework_1.Container.instance.get(aurelia_i18n_1.I18N);
        return Object.assign({
            headerName: i18n.tr("general.updatedTime", { ns: "common" }),
            field: "updatedTime",
            hide: true,
            floatingFilterComponentParams: {
                suppressFilterButton: true,
                dateFormat: common_model_1.Various.DateFormatWithHours
            },
            type: common_model_1.FieldType.Date,
            showRowGroup: i18n.tr("general.generalInformation", { ns: "common" })
        }, coldef);
    };
    GridHelper.getUpdatedFullNameColDef = function (entityUserName, coldef) {
        if (coldef === void 0) { coldef = {}; }
        var i18n = aurelia_framework_1.Container.instance.get(aurelia_i18n_1.I18N);
        return Object.assign({
            headerName: i18n.tr("general.updatedByFullName", { ns: "common" }),
            field: "updatedByFullName",
            hide: true,
            type: common_model_1.FieldType.User,
            filterParams: {
                userServiceName: entityUserName
            },
            floatingFilterComponentParams: {
                suppressFilterButton: true,
                userServiceName: entityUserName
            },
            showRowGroup: i18n.tr("general.generalInformation", { ns: "common" })
        }, coldef);
    };
    GridHelper.getBaseEntityColDef = function (entityUserName, params) {
        var _a, _b, _c, _d;
        if (params == null) {
            params = { baseColDef: {} };
        }
        if (params.baseColDef == null) {
            params.baseColDef = {};
        }
        return [
            this.getCreatedTimeColDef(Object.assign({}, params.baseColDef, (_a = params.createdTimeColDef) !== null && _a !== void 0 ? _a : {})),
            this.getCreatedFullNameColDef(entityUserName, Object.assign({}, params.baseColDef, (_b = params.createdFullNameColDef) !== null && _b !== void 0 ? _b : {})),
            this.getUpdatedTimeColDef(Object.assign({}, params.baseColDef, (_c = params.updatedTimeColDef) !== null && _c !== void 0 ? _c : {})),
            this.getUpdatedFullNameColDef(entityUserName, Object.assign({}, params.baseColDef, (_d = params.updatedFullNameColDef) !== null && _d !== void 0 ? _d : {})),
        ];
    };
    return GridHelper;
}());
exports.GridHelper = GridHelper;

//# sourceMappingURL=grid-helper.js.map
