import { TableExpandableControl } from "./expandable/control" ; import { TableSelectableControl } from "./selectable/control" ; import { TableColumn , TableProps , TableState } from "../table" ; import s from "./actions.module.css" ; const renderActions = < R > ( props , state ) => ( _row , _index , rowKey ) : JSX . Element => ( < div className = { s . container } > { props . selectable !== undefined && ( < TableSelectableControl rowKey = { rowKey } selectable = { props . selectable } / > ) } { props . expandable !== undefined && ( < TableExpandableControl rowKey = { rowKey } expandable = { state . expandable } / > ) } < /div>); export const getTableActionsColumn = < R > ( props , state ) : TableColumn < R > => ( { className : s . column , title : "" , render : renderActions ( props , state ) , } ) ; export const isTableActionsExist = < R > ( props ) : boolean => { return [ props . expandable , props . selectable ] . some ( ( i ) => i !== undefined ) ; } ; TODO export const getTableActionsColumnWidth = < R > ( { expandable , selectable , } ) : number => { if ( ! expandable && ! selectable ) return 0 ; const base = 16 + 8 ; const expanded = expandable ? 24 : 0 ; const selected = selectable ? 20 : 0 ; const padding = expandable && selectable ? 16 : 0 ; return base + expanded + selected + padding ; } ;