"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sumTotalsFormatter = void 0;
const utils_1 = require("@slickgrid-universal/utils");
const utilities_1 = require("../services/utilities");
const formatterUtilities_1 = require("../formatters/formatterUtilities");
const sumTotalsFormatter = (totals, columnDef, grid) => {
    const field = columnDef.field ?? '';
    const val = totals.sum?.[field];
    const params = columnDef?.params;
    const prefix = params?.groupFormatterPrefix || '';
    const suffix = params?.groupFormatterSuffix || '';
    const { minDecimal, maxDecimal, decimalSeparator, thousandSeparator, wrapNegativeNumber } = (0, formatterUtilities_1.retrieveFormatterOptions)(columnDef, grid, 'regular', 'group');
    if ((0, utils_1.isNumber)(val)) {
        const formattedNumber = (0, utilities_1.formatNumber)(val, minDecimal, maxDecimal, wrapNegativeNumber, '', '', decimalSeparator, thousandSeparator);
        return `${prefix}${formattedNumber}${suffix}`;
    }
    return '';
};
exports.sumTotalsFormatter = sumTotalsFormatter;
//# sourceMappingURL=sumTotalsFormatter.js.map