mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
24 lines
758 B
TypeScript
24 lines
758 B
TypeScript
import {
|
|
ColumnNullFallback,
|
|
ColumnSkeletonFixed,
|
|
ItemTableListInnerColumn,
|
|
TableColumnTextContainer,
|
|
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
|
|
|
export const CountColumn = (props: ItemTableListInnerColumn) => {
|
|
const rowItem = props.getRowItem?.(props.rowIndex) ?? (props.data as any[])[props.rowIndex];
|
|
const row: number | undefined = (rowItem as any)?.[props.columns[props.columnIndex].id];
|
|
|
|
if (typeof row === 'number') {
|
|
return (
|
|
<TableColumnTextContainer {...props}>{row.toLocaleString()}</TableColumnTextContainer>
|
|
);
|
|
}
|
|
|
|
if (row === null) {
|
|
return <ColumnNullFallback {...props} />;
|
|
}
|
|
|
|
return <ColumnSkeletonFixed {...props} />;
|
|
};
|