import { useMemo } from 'react'; import { CollectionState, FiltersMap } from '@wix/bex-core'; import { TableColumn as TableColumnWSR } from '@wix/design-system/dist/types/Table'; import { ActionCell } from './ActionCell'; import { useRenderActionCellColumn } from './useRenderActionCellColumn'; import { useActionCellColumnBase } from './useActionCellColumnBase'; import { useWixPatternsContainer } from '@wix/bex-core/react'; export interface UseActionCellColumnParams { actionCellWidth?: string | number; actionCellProps?: Partial, 'render' | 'style'>>; sticky?: boolean; actionCell?: ActionCell; collection: CollectionState; } export function useActionCellColumn( params: UseActionCellColumnParams, ) { const { collection, actionCell, actionCellProps, actionCellWidth, sticky } = params; const { isPanelLayout } = useWixPatternsContainer(); const baseColumn = useActionCellColumnBase({ actionCellProps, actionCellWidth, }); const render = useRenderActionCellColumn({ actionCell, sticky, collection, }); return useMemo(() => { if (isPanelLayout) { return null; } if (render == null) { return null; } return { ...baseColumn, render, }; }, [baseColumn, render, isPanelLayout]); }