import type { CustomizeComponent } from '../interface'; import Cell from '../Cell'; import { defineComponent } from 'vue'; import { useInjectTable } from '../context/TableContext'; import { useInjectExpandedRow } from '../context/ExpandedRowContext'; export interface ExpandedRowProps { prefixCls: string; component: CustomizeComponent; cellComponent: CustomizeComponent; expanded: boolean; colSpan: number; isEmpty: boolean; } export default defineComponent({ name: 'ExpandedRow', inheritAttrs: false, props: ['prefixCls', 'component', 'cellComponent', 'expanded', 'colSpan', 'isEmpty'] as any, setup(props, { slots, attrs }) { const tableContext = useInjectTable(); const expandedRowContext = useInjectExpandedRow(); const { fixHeader, fixColumn, componentWidth, horizonScroll } = expandedRowContext; return () => { const { prefixCls, component: Component, cellComponent, expanded, colSpan, isEmpty } = props; return ( { let contentNode: any = slots.default?.(); if (isEmpty ? horizonScroll.value : fixColumn.value) { contentNode = (
{contentNode}
); } return contentNode; }, }} >
); }; }, });