import React, { useContext } from 'react'; import { observer, RecursionField, Schema } from '@formily/react'; import { cloneDeepWith, set } from 'lodash'; import { uid, merge } from '@formily/shared'; import { CollectionFieldContext, TableRowContext } from './context'; import { Table } from './Table'; export const TableCell = observer((props: any) => { const ctx = useContext(TableRowContext); const schema = props.schema; const collectionField = useContext(CollectionFieldContext); if (schema['x-component'] === 'Table.Operation') { return ; } let uiSchema = collectionField?.uiSchema as Schema; if (uiSchema?.['x-component'] === 'Upload.Attachment') { uiSchema = cloneDeepWith(uiSchema); set(uiSchema, 'x-component-props.size', 'small'); } const componentProps = merge(uiSchema?.['x-component-props'] || {}, schema?.['x-component-props'] || {}, { arrayMerge: (t, s) => s, }); console.log('Table.Cell', collectionField?.interface, componentProps); return (
); });