"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldInputForm = void 0;
const cn_ui_1 = require("@cainiaofe/cn-ui");
const react_1 = __importDefault(require("react"));
const context_1 = require("../../../cn-sender/view/context");
const component_adapter_1 = require("../../../utils/component-adapter/index.js");
const dayjs_1 = __importDefault(require("dayjs"));
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const isEqual_1 = __importDefault(require("lodash/isEqual"));
const get_1 = __importDefault(require("lodash/get"));
const cn_ai_filter_item_1 = __importDefault(require("./cn-ai-filter-item"));
const datetime_picker_display_utils_1 = require("../../utils/display/datetime-picker-display-utils");
const date_shortcuts_1 = require("../../utils/constants/date-shortcuts");
const build_selected_options_1 = require("../../utils/build-selected-options");
const AiFilterDateValueInput_1 = require("./AiFilterDateValueInput");
const address_display_utils_1 = require("../../utils/display/address-display-utils");
const { createForm, onFieldValueChange } = cn_ui_1.formilyCore;
/**
 * 根据缓存更新labels
 * @param values 值
 * @param detailValue 详细值
 * @param labels 标题集合
 * @param cache 缓存
 * @param fieldName 字段名
 */
function updateLabelsByCache(values, detailValue, labels, cache, fieldName) {
    values.forEach((item) => {
        const details = Array.isArray(detailValue) ? detailValue : [detailValue];
        const matchItem = details.find((i) => i.value === item);
        if (!matchItem) {
            const label = getLabelByCache(cache, fieldName, item);
            if (label) {
                labels.push(label);
            }
            else {
                labels.push(item);
            }
        }
    });
}
/**
 * 更新缓存
 * @param cache 缓存
 * @param fieldName 字段名
 * @param value 值
 * @param label 标题
 */
function updateCache(cache, fieldName, value, label) {
    if (!(0, isPlainObject_1.default)(cache[fieldName])) {
        cache[fieldName] = {};
    }
    cache[fieldName][value] = label;
}
/**
 * 根据缓存获取label
 * @param cache 缓存
 * @param fieldName 字段名
 * @param value 值
 */
function getLabelByCache(cache, fieldName, value) {
    if (!(0, isPlainObject_1.default)(cache[fieldName])) {
        return;
    }
    return cache[fieldName][value];
}
/**
 * 根据dataSource更新缓存
 * @param dataSource 数据源
 * @param cache 缓存
 * @param fieldName 字段名
 */
function updateCacheByDataSource(dataSource, cache, fieldName) {
    if (Array.isArray(dataSource)) {
        dataSource.forEach((item) => {
            updateCache(cache, fieldName, item.value, item.label);
            if (Array.isArray(item.children)) {
                updateCacheByDataSource(item.children, cache, fieldName);
            }
        });
    }
}
/**
 * 从缓存中获取 options
 * @param cache 缓存
 * @param fieldName 字段名
 */
function getOptionsFromCache(cache, fieldName) {
    const fieldCache = cache[fieldName];
    if (!(0, isPlainObject_1.default)(fieldCache)) {
        return undefined;
    }
    const options = [];
    Object.entries(fieldCache).forEach(([value, label]) => {
        if (label && value) {
            options.push({ label: String(label), value });
        }
    });
    return options.length > 0 ? options : undefined;
}
/** 时区日期组件：单元素对象数组解包为对象，与 token-utils / 组件预期一致 */
function normalizeTimeZonePickerValue(componentType, value) {
    if (value == null)
        return value;
    const isTz = componentType === 'CnTimeZoneDatePicker' || componentType === 'CnTimeZoneRangeDatePicker';
    if (isTz &&
        Array.isArray(value) &&
        value.length === 1 &&
        typeof value[0] === 'object' &&
        value[0] !== null &&
        ('zoneId' in value[0] || 'timestamp' in value[0])) {
        return value[0];
    }
    return value;
}
// 统一的字段输入组件（使用 CnForm 实现）
// 支持两种模式：
// 1. 字符串模式（convertToString=true）：用于弹层中选择字段后输入值，将值转换为字符串
// 2. 原始值模式（convertToString=false）：用于输入框中点击 tag 后弹出编辑弹层，保持原始值类型
const FieldInputForm = react_1.default.memo(({ form, formProps, schema, fieldConfig, currentValue, onValueChange, disabled: isDisabled, readOnly: isReadOnly, convertToString = false, inline = false, autoFocus = true, prefixCls = 'sender', fieldKey, onFormMapUpdate, formMapRef, onConfirm, }) => {
    const { components: senderComponents } = react_1.default.useContext(context_1.SenderContext);
    const { input: _omitSenderInput, ...formilyComponentsFromSender } = senderComponents !== null && senderComponents !== void 0 ? senderComponents : {};
    // 为每个字段创建独立的表单实例
    const [formInstance, setFormInstance] = react_1.default.useState();
    const [schemaChanged, setSchemaChanged] = react_1.default.useState();
    const componentType = fieldConfig['x-component'];
    const normalizedCurrentValue = react_1.default.useMemo(() => {
        // 对于地址类型组件，需要将对象值转换为 code
        if ((0, address_display_utils_1.isAddressType)(componentType) && currentValue != null) {
            return (0, address_display_utils_1.extractAddressCode)(currentValue);
        }
        return normalizeTimeZonePickerValue(componentType, currentValue);
    }, [componentType, currentValue]);
    // 处理值变化的回调
    const handleValueChange = react_1.default.useCallback((value) => {
        if (convertToString) {
            // 不同组件返回的值格式可能不同，统一转换为字符串
            let stringValue = '';
            if (value === null || value === undefined) {
                stringValue = '';
            }
            else if (typeof value === 'string' || typeof value === 'number') {
                stringValue = String(value);
            }
            else if (Array.isArray(value)) {
                stringValue = value
                    .map((v) => (typeof v === 'object' ? (v === null || v === void 0 ? void 0 : v.label) || (v === null || v === void 0 ? void 0 : v.value) : v))
                    .join(',');
            }
            else if (typeof value === 'object' && value !== null) {
                stringValue = value.label || value.value || JSON.stringify(value);
            }
            else {
                stringValue = String(value);
            }
            onValueChange(stringValue);
        }
        else {
            // 直接传递原始值，不转换为字符串（因为可能需要在输入框中编辑）
            onValueChange(value);
        }
    }, [onValueChange, convertToString]);
    // 判断是否为时间选择器组件
    const isTimePicker = (0, datetime_picker_display_utils_1.isTimePickerType)(componentType);
    const isRangePicker = ['RangePicker', 'CnRangeDatePickerPro'].includes(componentType);
    // RangePicker 统一使用 AiFilterDateValueInput（快捷选项面板），便于显示「本周」等中文并保持编辑一致
    const shouldUseDateShortcuts = isRangePicker;
    // 构建字段 schema，在 x-component-props 中设置 onChange 和 onOk
    const fieldSchema = {
        ...fieldConfig,
        'x-component-props': {
            ...fieldConfig['x-component-props'],
            ...(['EmployeeSelect', 'CnEmployeeSelect'].includes(componentType) && {
                useDetailValue: true,
            }),
            size: 'small',
            autoFocus,
            disabled: isDisabled || isReadOnly,
            readOnly: isReadOnly,
            className: inline
                ? `${prefixCls}-schema-field-input-inline`
                : `${prefixCls}-schema-field-input`,
            onChange: handleValueChange,
            // 对于时间选择器，添加 onOk 回调，点击确定按钮时关闭弹层
            ...(isTimePicker && onConfirm ? { onOk: onConfirm } : {}),
        },
    };
    react_1.default.useEffect(() => {
        // 刷新form要在realSchema更新后的nexttick中，否则不能生效
        setSchemaChanged({});
    }, [form, fieldConfig]);
    const selectedCacheRef = react_1.default.useRef({});
    // 从 formMapRef 中恢复 selectedCacheRef 的缓存数据
    // 这样即使组件重新挂载，也能保持已选项的 label 信息
    react_1.default.useEffect(() => {
        if ((formMapRef === null || formMapRef === void 0 ? void 0 : formMapRef.current) && fieldKey) {
            const formMapData = formMapRef.current[fieldKey];
            if ((formMapData === null || formMapData === void 0 ? void 0 : formMapData.options) && Array.isArray(formMapData.options)) {
                // 从 formMap 的 options 恢复到 selectedCacheRef
                formMapData.options.forEach((opt) => {
                    if (opt.value !== undefined && opt.label) {
                        updateCache(selectedCacheRef.current, fieldKey, String(opt.value), opt.label);
                    }
                });
            }
        }
    }, [formMapRef, fieldKey]);
    // 创建或获取 form 实例
    react_1.default.useEffect(() => {
        if (form) {
            // 如果传入了外部 form，直接使用
            setFormInstance(form);
            return;
        }
        // 如果没有传入外部 form，创建新的 form 实例
        const newForm = createForm({ ...formProps });
        newForm === null || newForm === void 0 ? void 0 : newForm.addEffects('onFormInputChange', () => { });
        setFormInstance(newForm);
    }, [form, formProps, schemaChanged]);
    // 在 formInstance 上注册 onFieldValueChange 监听器
    // 必须在 formInstance 设置后再注册，因为 CnForm 使用的是 formInstance
    react_1.default.useEffect(() => {
        if (!formInstance) {
            return;
        }
        // 注册 onFieldValueChange 监听器
        formInstance === null || formInstance === void 0 ? void 0 : formInstance.addEffects('onFieldValueChange', () => {
            onFieldValueChange('*', (field) => {
                var _a, _b, _c, _d, _e;
                const { componentType: fieldComponentType, dataSource, value, inputValue, inputValues, } = field;
                const properties = schema === null || schema === void 0 ? void 0 : schema.properties;
                const allState = field.getState();
                const entire = (_a = field.path) === null || _a === void 0 ? void 0 : _a.entire;
                // 非通过onFieldInputValueChange修改值的标识
                const isNotFieldInputValueChange = !(0, isEqual_1.default)(inputValue, value);
                let labels = [];
                const values = Array.isArray(value) ? value : [value];
                // 缓存dataSource到selectedCacheRef中
                updateCacheByDataSource(dataSource, selectedCacheRef.current, entire);
                if (['CnAsyncSelect', 'Select'].includes(fieldComponentType)) {
                    // 非主动修改时，需要将value合并到labels中
                    if (isNotFieldInputValueChange) {
                        updateLabelsByCache(values, [], labels, selectedCacheRef.current, entire);
                    }
                    else {
                        // 这些组件取onChange的第三个参数
                        const detailValue = Array.isArray(inputValues) && inputValues.length > 2 ? inputValues[2] : [];
                        if (Array.isArray(detailValue)) {
                            detailValue === null || detailValue === void 0 ? void 0 : detailValue.forEach((item) => {
                                labels.push(item.label);
                                updateCache(selectedCacheRef.current, entire, item.value, item.label);
                            });
                        }
                        else if (typeof detailValue === 'object' && detailValue.label) {
                            labels.push(detailValue.label);
                            updateCache(selectedCacheRef.current, entire, detailValue.value, detailValue.label);
                        }
                    }
                }
                else if (['CnEmployeeSelect', 'EmployeeSelect'].includes(fieldComponentType)) {
                    // 解决低码/鸟搭的人员选择器label在搜索框里无法展示的问题 20241115
                    if (!(0, isEqual_1.default)(inputValue, value)) {
                        return;
                    }
                    values === null || values === void 0 ? void 0 : values.forEach((item) => {
                        const label = item.nickName || item.name;
                        labels.push(label);
                        // 缓存人员选项，使用 workNo 或 value 作为 key
                        const optionValue = item.workNo || item.value;
                        if (optionValue && label) {
                            updateCache(selectedCacheRef.current, entire, optionValue, label);
                        }
                    });
                }
                else if (
                // 这些组件取onChange的第二个参数
                [
                    'CnCascaderSelect',
                    'CascaderSelect',
                    'CnTreeSelect',
                    'TreeSelect',
                    'CnDepartmentSelect',
                    'DepartmentSelect',
                    'CnAddress',
                    'AddressSelect',
                    'CnTimePickerPro',
                    'TimePicker',
                    'DatePicker',
                    'CnDatePickerPro',
                    'CnRangeTimePickerPro',
                    'RangeTimePickerPro',
                    'RangeTimePicker',
                    'RangePicker',
                    'CnRangeDatePickerPro',
                ].includes(componentType)) {
                    // 非主动修改时
                    if (isNotFieldInputValueChange) {
                        if (['CnTimePickerPro', 'TimePicker'].includes(fieldComponentType)) {
                            const format = (0, get_1.default)(allState, 'component.1.format', 'HH:mm:ss');
                            value && labels.push((0, dayjs_1.default)(value).format(format));
                        }
                        else if (['CnRangeTimePickerPro', 'RangeTimePickerPro', 'RangeTimePicker'].includes(fieldComponentType)) {
                            const format = (0, get_1.default)(allState, 'component.1.format', 'HH:mm:ss');
                            Array.isArray(value) &&
                                value.forEach((item) => {
                                    labels.push((0, dayjs_1.default)(item).format(format));
                                });
                        }
                        else if (['DatePicker', 'CnDatePickerPro'].includes(fieldComponentType)) {
                            const type = (0, get_1.default)(allState, 'component.1.type');
                            let format = (0, get_1.default)(allState, 'component.1.format');
                            //  优先取format，如果没取到，则根据type映射format
                            if (!format) {
                                switch (type) {
                                    case 'year':
                                        format = 'YYYY';
                                        break;
                                    case 'month':
                                        format = 'YYYY-MM';
                                        break;
                                    case 'week':
                                        format = 'YYYY-wo';
                                        break;
                                    case 'date':
                                        format = 'YYYY-MM-DD';
                                        break;
                                    default:
                                        format = 'YYYY-MM-DD';
                                        break;
                                }
                            }
                            value && labels.push((0, dayjs_1.default)(value).format(format));
                        }
                        else if (['RangePicker', 'CnRangeDatePickerPro'].includes(fieldComponentType)) {
                            const mode = (0, get_1.default)(allState, 'component.1.mode');
                            const showTime = (0, get_1.default)(allState, 'component.1.showTime');
                            let format = (0, get_1.default)(allState, 'component.1.format');
                            if (!format) {
                                switch (mode) {
                                    case 'year':
                                        format = 'YYYY';
                                        break;
                                    case 'quarter':
                                        format = 'YYYY-[Q]Q';
                                        break;
                                    case 'month':
                                        format = 'YYYY-MM';
                                        break;
                                    case 'week':
                                        format = 'YYYY-wo';
                                        break;
                                    case 'date':
                                        format = showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
                                        break;
                                    default:
                                        format = 'YYYY-MM-DD';
                                        break;
                                }
                            }
                            Array.isArray(value) &&
                                value.forEach((item) => {
                                    labels.push((0, dayjs_1.default)(item).format(format));
                                });
                        }
                        else if ([
                            'CnCascaderSelect',
                            'CascaderSelect',
                            'CnTreeSelect',
                            'TreeSelect',
                            'CnAddress',
                            'AddressSelect',
                            'CnDepartmentSelect',
                            'DepartmentSelect',
                        ].includes(fieldComponentType)) {
                            updateLabelsByCache(values, [], labels, selectedCacheRef.current, entire);
                        }
                    }
                    else if (Array.isArray(inputValues) && inputValues.length >= 2) {
                        const detailValue = inputValues[1];
                        if (Array.isArray(detailValue)) {
                            detailValue === null || detailValue === void 0 ? void 0 : detailValue.forEach((item) => {
                                // 级联和树形选择多选
                                if (typeof item === 'object') {
                                    (item === null || item === void 0 ? void 0 : item.label) && labels.push(item.label);
                                    // 同时更新缓存
                                    if ((item === null || item === void 0 ? void 0 : item.value) !== undefined && (item === null || item === void 0 ? void 0 : item.label)) {
                                        updateCache(selectedCacheRef.current, entire, item.value, item.label);
                                    }
                                }
                                else {
                                    // 日期和时间区间
                                    labels.push(item);
                                }
                            });
                        }
                        else if (detailValue === null || detailValue === void 0 ? void 0 : detailValue.label) {
                            labels.push(detailValue.label);
                            // 同时更新缓存
                            if ((detailValue === null || detailValue === void 0 ? void 0 : detailValue.value) !== undefined) {
                                updateCache(selectedCacheRef.current, entire, detailValue.value, detailValue.label);
                            }
                        }
                        else if (detailValue) {
                            // 时间
                            labels.push(detailValue);
                        }
                    }
                }
                else if ([
                    'CheckboxGroup',
                    'CnCheckbox',
                    'CnCheckboxGroup',
                    'CnRadio',
                    'RadioGroup',
                    'CnRadioGroup',
                    'CnComplexCheckbox',
                    'CnComplexCheckboxGroup',
                    'CnComplexRadio',
                    'CnComplexRadioGroup',
                ].includes(fieldComponentType)) {
                    // TODO: 当前仅兼容dataSource，后续需要兼容requestConfig
                    updateLabelsByCache(values, [], labels, selectedCacheRef.current, entire);
                }
                else if (['CnInput', 'Input', 'CnBankInput'].includes(fieldComponentType)) {
                    labels = [value];
                }
                else if ([
                    'CnNumberPicker',
                    'NumberPicker',
                    'CnPercentInput',
                    'Range',
                    'CnRange',
                    'RangeNumberPicker',
                    'CnRangeNumnerPicker',
                ].includes(fieldComponentType)) {
                    // 数字选择器：直接用值的字符串表示作为 label
                    labels = values.filter((v) => v !== undefined && v !== null).map((v) => String(v));
                }
                else if (['CnTimeZoneDatePicker', 'CnTimeZoneRangeDatePicker'].includes(fieldComponentType)) {
                    if (isNotFieldInputValueChange) {
                        const k = entire || fieldKey;
                        const existing = onFormMapUpdate && k ? (_b = formMapRef === null || formMapRef === void 0 ? void 0 : formMapRef.current) === null || _b === void 0 ? void 0 : _b[k] : null;
                        if ((_c = existing === null || existing === void 0 ? void 0 : existing.labels) === null || _c === void 0 ? void 0 : _c.length)
                            labels = existing.labels;
                        else if (values === null || values === void 0 ? void 0 : values.length) {
                            // 不能直接使用 values，需要格式化为字符串
                            const label = (0, datetime_picker_display_utils_1.formatTimeZoneDateToDisplayString)(value);
                            if (label) {
                                labels = [label];
                            }
                        }
                    }
                    else if (inputValues.length > 1 && (0, isPlainObject_1.default)(inputValues[1])) {
                        labels = [inputValues[1].label];
                    }
                    else {
                        // Fallback: 如果 inputValues[1] 不存在，使用格式化函数生成 label
                        const label = (0, datetime_picker_display_utils_1.formatTimeZoneDateToDisplayString)(value);
                        if (label) {
                            labels = [label];
                        }
                    }
                }
                else {
                    /**
                     * 自定义组件，按照规范可正常运行
                     * @doc 规范文档：https://alidocs.dingtalk.com/i/nodes/ZgpG2NdyVXRmQ0jgCXQ5lZq28MwvDqPk
                     * 基本规范：arg[0]: newValue 改变后的value，用于formily的onFiledValueChange和setValue，也是触发后端接口的实际参数值
                     * arg[1]: 选中的value对应的数据对象，用于oneSearch展现，不参与实际搜索；arg[1]一般为数组或者对象，遵循label和value的数据规范。
                     *
                     */
                    const name = entire;
                    const recordIndex = ((_e = (_d = properties[name]) === null || _d === void 0 ? void 0 : _d['x-component-props']) === null || _e === void 0 ? void 0 : _e.recordIndex) || 1;
                    if (Array.isArray(inputValues[recordIndex])) {
                        labels = inputValues[recordIndex].map((i) => i.label);
                        // delete values.customDataIndexSelect;
                    }
                    else if ((0, isPlainObject_1.default)(inputValues[recordIndex])) {
                        labels = [inputValues[recordIndex].label];
                    }
                    else if (typeof inputValues[0] === 'string') {
                        labels = inputValues[0].split(',');
                    }
                    else if (Array.isArray(inputValues[0])) {
                        labels = inputValues[0].map((i) => {
                            if ((0, isPlainObject_1.default)(i)) {
                                return i.label;
                            }
                            return i;
                        });
                    }
                }
                // 将 labels、values 和 options 存入 formMap
                // 使用 entire（Formily 的字段路径）而不是 fieldKey，确保 key 一致
                // entire 应该等于 fieldKey，因为 schema 中只有一个字段
                const mapKey = entire || fieldKey;
                if (onFormMapUpdate && mapKey) {
                    // 从已选项缓存中获取所有 options
                    const allOptions = getOptionsFromCache(selectedCacheRef.current, entire);
                    // 只保留当前选中的 options，过滤掉旧选项
                    let options = allOptions;
                    if (allOptions && values && values.length > 0) {
                        // 将 values 转换为数组格式
                        const selectedValues = Array.isArray(values) ? values : [values];
                        // 只保留当前选中的选项
                        options = (0, build_selected_options_1.filterSelectedOptions)(allOptions, selectedValues);
                    }
                    onFormMapUpdate(mapKey, {
                        labels,
                        values,
                        options,
                    });
                }
            });
        });
    }, [formInstance, fieldKey, onFormMapUpdate, schema]);
    const isTimeZonePickerForSetValues = componentType === 'CnTimeZoneDatePicker' || componentType === 'CnTimeZoneRangeDatePicker';
    react_1.default.useEffect(() => {
        if (!formInstance)
            return;
        // 只在 formInstance 初次创建时设置值，不监听 currentValue 的变化
        // 这样用户在弹窗中修改值时，不会被覆盖
        if (isTimeZonePickerForSetValues && normalizedCurrentValue != null) {
            formInstance.setValues({ [fieldKey]: normalizedCurrentValue });
        }
        else if ((0, address_display_utils_1.isAddressType)(componentType)) {
            // 对于地址类型，使用 normalizedCurrentValue（已转换为 code）
            if (normalizedCurrentValue != null) {
                formInstance.setValues({ [fieldKey]: normalizedCurrentValue });
            }
        }
        else if (currentValue) {
            formInstance.setValues({ [fieldKey]: currentValue });
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [formInstance, fieldKey]);
    // 如果是RangePicker，统一使用AiFilterDateValueInput组件（快捷选项面板）
    if (shouldUseDateShortcuts) {
        // 获取 showTime 配置
        const showTime = (0, get_1.default)(fieldConfig, 'x-component-props.showTime', false);
        // 获取日期格式，用于将时间戳格式化为可读日期字符串
        const dateFormat = (0, get_1.default)(fieldConfig, 'x-component-props.format') ||
            (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD');
        // 将 currentValue 转为 AiFilterDateValueInput 可识别的字符串格式
        // 如果是数组（时间戳或 ISO 字符串），先格式化为可读日期字符串再拼接
        let valueForDateInput;
        if (Array.isArray(currentValue) && currentValue.length >= 2) {
            const formatted = (0, datetime_picker_display_utils_1.formatTimestampToDateStringArray)(currentValue, dateFormat);
            if (formatted.length >= 2) {
                valueForDateInput = `${date_shortcuts_1.DATE_RANGE_OPTION}:${formatted[0]},${formatted[1]}`;
            }
            else {
                valueForDateInput = '';
            }
        }
        else {
            valueForDateInput = currentValue || '';
        }
        return (react_1.default.createElement("div", { style: {
                display: inline ? 'inline-block' : 'block',
                minWidth: '200px',
            } },
            react_1.default.createElement(AiFilterDateValueInput_1.AiFilterDateValueInput, { value: valueForDateInput, showTime: showTime, onConfirm: onConfirm, onChange: (newValue) => {
                    onValueChange(newValue);
                    if (onFormMapUpdate &&
                        fieldKey &&
                        newValue &&
                        (0, datetime_picker_display_utils_1.isDatePickerType)(fieldConfig['x-component'])) {
                        const values = Array.isArray(newValue) ? newValue : [newValue];
                        const labels = (0, datetime_picker_display_utils_1.formatTimestampToDateStringArray)(newValue);
                        onFormMapUpdate(fieldKey, {
                            labels,
                            values,
                            options: [],
                            columnType: fieldConfig['x-component'],
                        });
                    }
                } })));
    }
    const isTimeZonePicker = componentType === 'CnTimeZoneDatePicker' || componentType === 'CnTimeZoneRangeDatePicker';
    const formContent = (react_1.default.createElement(cn_ui_1.CnForm, { form: formInstance, hasFooterSubmit: false, components: {
            // sender 侧自定义 x-component 先展开；内置 componentMap / 适配层后展开，避免与 `CnSender` `components` 同名键相互覆盖时丢失 Formily 包装与样式
            ...formilyComponentsFromSender,
            ...cn_ui_1.componentMap,
            ...component_adapter_1.componentAdapterMap,
            CnFilterProItem: cn_ai_filter_item_1.default,
        }, schema: {
            type: 'object',
            properties: {
                [fieldKey]: {
                    ...fieldSchema,
                    ...(isTimeZonePicker && normalizedCurrentValue != null
                        ? { default: normalizedCurrentValue }
                        : {}),
                },
            },
        } }));
    if (inline) {
        return react_1.default.createElement("div", { style: { display: 'inline-block', minWidth: '100px' } }, formContent);
    }
    return formContent;
});
exports.FieldInputForm = FieldInputForm;
FieldInputForm.displayName = 'FieldInputForm';
