import { forwardRef } from 'react'; import { addDecimalsFormatNumber, PriceCell, t, } from '@vegaprotocol/react-helpers'; import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit'; import { AgGridDynamic as AgGrid, progressBarCellRendererSelector, } from '@vegaprotocol/ui-toolkit'; import { AgGridColumn } from 'ag-grid-react'; import type { AgGridReact, AgGridReactProps } from 'ag-grid-react'; import type { AccountFields } from './accounts-data-provider'; import { AccountTypeMapping } from '@vegaprotocol/types'; import { progressBarHeaderComponentParams, progressBarValueFormatter, } from './accounts-table'; interface BreakdownTableProps extends AgGridReactProps { data: AccountFields[] | null; } const BreakdownTable = forwardRef( ({ data }, ref) => { return ( `${data.asset.id}-${data.type}-${data.market?.id}` } ref={ref} rowHeight={34} components={{ PriceCell }} tooltipShowDelay={500} defaultColDef={{ flex: 1, resizable: true, }} > ) => AccountTypeMapping[value] } /> ) => { if (!value) return '-'; return value; }} minWidth={200} /> ) => { if (data && data.asset) { return addDecimalsFormatNumber(value, data.asset.decimals); } return '-'; }} maxWidth={300} /> ) => { if (data && data.asset) { return addDecimalsFormatNumber(value, data.asset.decimals); } return '-'; }} maxWidth={300} /> ); } ); export default BreakdownTable;