import { useField, useFieldSchema } from "@tachybase/schema";
import { useIsFileField } from "../../../../schema-component/index.mjs";
import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
function useFieldComponentName() {
    var _fieldSchema_xcomponentprops, _field_componentProps, _collectionField_uiSchema;
    const { fieldSchema: tableColumnSchema, collectionField } = useColumnSchema();
    const field = useField();
    const isFileField = useIsFileField();
    const schema = useFieldSchema();
    const fieldSchema = tableColumnSchema || schema;
    const map = {
        AssociationField: 'Select'
    };
    const fieldComponentName = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['mode']) || (null == field ? void 0 : null == (_field_componentProps = field.componentProps) ? void 0 : _field_componentProps['mode']) || (isFileField ? 'FileManager' : '') || (null == collectionField ? void 0 : null == (_collectionField_uiSchema = collectionField.uiSchema) ? void 0 : _collectionField_uiSchema['x-component']);
    return map[fieldComponentName] || fieldComponentName;
}
export { useFieldComponentName };
