/**
 * 进度/图形百分比格式文本提取器
 */
import isNil from 'lodash/isNil';
import { numberFormat } from '@cainiaofe/cn-ui-common';
/**
 * 进度文本提取器
 */
export function extractProgressText(value, _column, _record, numAdapterLocale) {
    if (isNil(value) || value === '') {
        return '';
    }
    const numValue = parseFloat(String(value));
    if (isNaN(numValue)) {
        return '';
    }
    // 进度值通常是 0-100 或 0-1
    const percentValue = numValue <= 1 ? numValue * 100 : numValue;
    const formatted = numAdapterLocale
        ? numberFormat(percentValue.toFixed(0), numAdapterLocale)
        : percentValue.toFixed(0);
    return `${formatted}%`;
}
/**
 * 图形百分比文本提取器
 */
export function extractGraphicsPercentText(value, column, record, numAdapterLocale) {
    return extractProgressText(value, column, record, numAdapterLocale);
}
