import * as React from 'react';
import isNil from 'lodash/isNil';
import classNames from 'classnames';
import { CnEllipsis } from '@cainiaofe/cn-ui';
import '../styles/format-ellipsis.scss';
export default (column) => {
    return {
        cell(val) {
            const classes = classNames({
                'cn-table-format-align-left': !(column === null || column === void 0 ? void 0 : column.align) || (column === null || column === void 0 ? void 0 : column.align) === 'left',
                'cn-table-format-align-center': (column === null || column === void 0 ? void 0 : column.align) === 'center',
                'cn-table-format-align-right': (column === null || column === void 0 ? void 0 : column.align) === 'right',
            });
            const isEmptyValue = isNil(val) || val === '';
            const text = isEmptyValue ? '- -' : val;
            const style = (column === null || column === void 0 ? void 0 : column.width) ? { width: parseInt(column.width) - 30 } : {};
            return (React.createElement(CnEllipsis, { className: classes, style: style }, text));
        },
    };
};
