import * as React from 'react';
import isNil from 'lodash/isNil';
import { CnFormat } from '../../../../../../../../cn-ai-table/view/components/format';
import { renderValueHandleEmpty } from '../utils';
import { renderLine } from './utils/text-render';
export function createMultipleTextFormat() {
    return () => {
        return {
            align: 'left',
            cell(val) {
                // 处理空值：如果值为 null、undefined 或空字符串，显示空值占位符
                if (isNil(val) || val === '') {
                    return renderValueHandleEmpty(val);
                }
                // 如果是数组且为空，也显示空值占位符
                if (Array.isArray(val) && val.length === 0) {
                    return renderValueHandleEmpty(null);
                }
                return (React.createElement("div", { className: "cn-table-cell-format-multiple-text" }, Array.isArray(val) ? (val.map((item, index) => renderLine(item, 1, index))) : (React.createElement(CnFormat, { format: "CnInputTextArea", value: val }))));
            },
        };
    };
}
