import { I18N } from 'aurelia-i18n';
import { FieldType, Various } from '../../../model/common-model';
import { SelectAllHeaderComponent } from "../../../vm/list-view-model-base";
import { Container } from 'aurelia-framework';
import { AGGridColumnsWidth } from './../../../constants/constants';
var GridHelper = (function () {
    function GridHelper() {
    }
    GridHelper.getSelectedColDef = function (vm, coldef) {
        if (coldef === void 0) { coldef = {}; }
        return Object.assign({
            headerName: "",
            field: "isSelected",
            maxWidth: AGGridColumnsWidth.IsSelected,
            minWidth: AGGridColumnsWidth.IsSelected,
            cellRenderer: "selectionCellRenderer",
            suppressMenu: true,
            sortable: false,
            resizable: false,
            suppressMovable: true,
            filter: false,
            pinned: "left",
            headerComponent: SelectAllHeaderComponent,
            headerComponentParams: { VM: vm }
        }, coldef);
    };
    GridHelper.getCreatedTimeColDef = function (coldef) {
        if (coldef === void 0) { coldef = {}; }
        var i18n = Container.instance.get(I18N);
        return Object.assign({
            headerName: i18n.tr("general.createdTime", { ns: "common" }),
            field: "createdTime",
            hide: true,
            floatingFilterComponentParams: {
                suppressFilterButton: true,
                dateFormat: Various.DateFormatWithHours
            },
            type: FieldType.Date,
            showRowGroup: i18n.tr("general.generalInformation", { ns: "common" })
        }, coldef);
    };
    GridHelper.getCreatedFullNameColDef = function (entityUserName, coldef) {
        if (coldef === void 0) { coldef = {}; }
        var i18n = Container.instance.get(I18N);
        return Object.assign({
            headerName: i18n.tr("general.createdByFullName", { ns: "common" }),
            field: "createdByFullName",
            hide: true,
            type: 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 = Container.instance.get(I18N);
        return Object.assign({
            headerName: i18n.tr("general.updatedTime", { ns: "common" }),
            field: "updatedTime",
            hide: true,
            floatingFilterComponentParams: {
                suppressFilterButton: true,
                dateFormat: Various.DateFormatWithHours
            },
            type: FieldType.Date,
            showRowGroup: i18n.tr("general.generalInformation", { ns: "common" })
        }, coldef);
    };
    GridHelper.getUpdatedFullNameColDef = function (entityUserName, coldef) {
        if (coldef === void 0) { coldef = {}; }
        var i18n = Container.instance.get(I18N);
        return Object.assign({
            headerName: i18n.tr("general.updatedByFullName", { ns: "common" }),
            field: "updatedByFullName",
            hide: true,
            type: 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;
}());
export { GridHelper };

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