"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCurrencyWithUnitFormat = createCurrencyWithUnitFormat;
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const number_1 = require("./utils/number");
const utils_1 = require("../utils");
function createCurrencyWithUnitFormat(numAdapterLocale) {
    return () => {
        return {
            align: 'right',
            cell(val) {
                if ((0, isPlainObject_1.default)(val)) {
                    const amount = val === null || val === void 0 ? void 0 : val.amount;
                    const currency = val === null || val === void 0 ? void 0 : val.currency;
                    return `${(0, number_1.getNumFromStr)(amount, numAdapterLocale)}  ${currency}`;
                }
                else if (val !== undefined &&
                    val !== null &&
                    (typeof val === 'string' || typeof val === 'number')) {
                    return (0, number_1.getNumFromStr)(val, numAdapterLocale);
                }
                // 其他情况返回空值占位符
                return (0, utils_1.renderValueHandleEmpty)(val);
            },
        };
    };
}
