import * as React from 'react';
import { CnProgress } from '@cainiaofe/cn-ui';
import { getNumFromStr } from './utils/number';
export function createProgressFormat(numAdapterLocale) {
    return () => {
        return {
            align: 'left',
            cell(val) {
                if (typeof val !== 'object') {
                    val = { value: val };
                }
                return Number.isNaN(Number(val === null || val === void 0 ? void 0 : val.value)) ? ('') : (React.createElement(CnProgress, { className: "cn-table-cell-format-progress", percent: Number(val === null || val === void 0 ? void 0 : val.value), state: val === null || val === void 0 ? void 0 : val.state, textRender: (percent) => {
                        return Number.isNaN(Number(percent))
                            ? '-%'
                            : `${getNumFromStr(percent, numAdapterLocale)}%`;
                    } }));
            },
        };
    };
}
