"use strict";
/**
 * 进度/图形百分比格式文本提取器
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractProgressText = extractProgressText;
exports.extractGraphicsPercentText = extractGraphicsPercentText;
const isNil_1 = __importDefault(require("lodash/isNil"));
const cn_ui_common_1 = require("@cainiaofe/cn-ui-common");
/**
 * 进度文本提取器
 */
function extractProgressText(value, _column, _record, numAdapterLocale) {
    if ((0, isNil_1.default)(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
        ? (0, cn_ui_common_1.numberFormat)(percentValue.toFixed(0), numAdapterLocale)
        : percentValue.toFixed(0);
    return `${formatted}%`;
}
/**
 * 图形百分比文本提取器
 */
function extractGraphicsPercentText(value, column, record, numAdapterLocale) {
    return extractProgressText(value, column, record, numAdapterLocale);
}
