import React from 'react';
import { DataTableBaseCell, DataTableBoolCell, DataTableCell } from './dataTable.types';
import numberPipe from 'app/shared/pipes/number.pipe';
import datePipe from 'app/shared/pipes/date.pipe';
import cx from 'classnames';
import { columnWidth } from './dataTable.helper';
export const BaseCell = ({ width, align, children, defaultColumnWidth, extraClass }: DataTableBaseCell) => (
);
export const NumberCell = ({ value, align, width, defaultColumnWidth, extraClass, invertValueMarking }: DataTableCell) => (
0)
|| (!invertValueMarking && Number(value?.toFixed(2)) < 0),
})}>
{value !== null && !isNaN(value as number) ? numberPipe.format(Number(value?.toFixed(2)), 2) : '-'}
);
export const DateCell = ({ value, align, width, showFullDate, defaultColumnWidth, extraClass }: DataTableCell & { showFullDate: boolean }) => (
{showFullDate ? datePipe.formatLong(value) : datePipe.formatShortMonthWithYear(value)}
);
export const BoolCell = ({ value, align, width, defaultColumnWidth, trueValue = 'Yes', falseValue = 'No', extraClass }: DataTableBoolCell) => (
{value ? trueValue : falseValue}
);
export const TextCell = ({ value, align, width, defaultColumnWidth, extraClass }: DataTableCell) => (
{value}
);