import isPlainObject from 'lodash/isPlainObject';
import { getNumFromStr } from './utils/number';
import { renderValueHandleEmpty } from '../utils';
export function createCurrencyWithUnitFormat(numAdapterLocale) {
    return () => {
        return {
            align: 'right',
            cell(val) {
                if (isPlainObject(val)) {
                    const amount = val === null || val === void 0 ? void 0 : val.amount;
                    const currency = val === null || val === void 0 ? void 0 : val.currency;
                    return `${getNumFromStr(amount, numAdapterLocale)}  ${currency}`;
                }
                else if (val !== undefined &&
                    val !== null &&
                    (typeof val === 'string' || typeof val === 'number')) {
                    return getNumFromStr(val, numAdapterLocale);
                }
                // 其他情况返回空值占位符
                return renderValueHandleEmpty(val);
            },
        };
    };
}
