Merge pull request 'feat: add custom postfix column support and date formatting in EnterpriseDataTable' (#32) from core/page-provider into main

Reviewed-on: eigen/fe-monorepo-template#32
This commit is contained in:
2026-07-24 07:40:24 +00:00
@@ -46,6 +46,7 @@ import { BulkActionConfirmationModal } from '../bulk-action-confirmation';
import { TableFilterDrawer, TableFilterConfig } from './components/table-filter-drawer';
// import { TableSettingDrawer } from './components/table-setting-drawer';
import { EntityId } from '../../../../../../core-api/src/data-services/types';
import { DateUtils } from '@repo/utils';
export * from 'ag-grid-community';
export * from 'ag-grid-react';
@@ -88,6 +89,7 @@ export interface EnterpriseDataTableProps<E extends BaseEntity> extends Omit<AgG
showStatusbar?: boolean;
customPrefixColumn?: (col: ColDef<E>[]) => ColDef<E>[];
customPostfixColumn?: (col: ColDef<E>[]) => ColDef<E>[];
// Action related props
statusKey?: string;
@@ -154,6 +156,7 @@ export function EnterpriseDataTable<E extends BaseEntity>(props: EnterpriseDataT
noRowsMessage = 'No records found',
showStatusbar,
customPrefixColumn,
customPostfixColumn,
// new action props
statusKey = 'status',
@@ -665,7 +668,43 @@ export function EnterpriseDataTable<E extends BaseEntity>(props: EnterpriseDataT
statusColumn,
].filter(Boolean);
return [...(customPrefixColumn ? customPrefixColumn(prefixColumn) : prefixColumn), ...columnDefs];
const postfixColumn: ColDef<E>[] = [
{
colId: 'creator_name',
field: 'creator_name' as any,
headerName: t('common:fields.createdBy'),
cellRenderer: ({ value }: any) => value ?? '-',
},
{
colId: 'created_at',
field: 'created_at',
headerName: t('common:fields.createdAt'),
cellRenderer: ({ value }: any) => {
return value ? new DateUtils(Number(value)).format('DD-MM-YYYY, HH:mm') : '-';
},
},
{
colId: 'editor_name',
field: 'editor_name' as any,
headerName: t('common:fields.updatedBy'),
cellRenderer: ({ value }: any) => value ?? '-',
},
{
colId: 'updated_at',
field: 'updated_at',
headerName: t('common:fields.updatedAt'),
cellRenderer: ({ value }: any) => {
return value ? new DateUtils(Number(value)).format('DD-MM-YYYY, HH:mm') : '-';
},
},
];
const finalPrefixColumn = customPrefixColumn ? customPrefixColumn(prefixColumn) : prefixColumn;
const finalPostfixColumn = customPostfixColumn ? customPostfixColumn(postfixColumn) : postfixColumn;
return [...finalPrefixColumn, ...columnDefs, ...finalPostfixColumn];
}, [
columnDefs,
props.masterDetail,