@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
38 lines (37 loc) • 2.41 kB
TypeScript
import { IRowNode } from 'ag-grid-enterprise';
import { CellDataChangedInfo } from '../../AdaptableState/Common/CellDataChangedInfo';
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
import { AdaptableColumn } from '../../AdaptableState/Common/AdaptableColumn';
import { AdaptableApi } from '../../types';
export interface DataChangeHistoryData {
primaryKey: string;
changeKey: string;
changeTriggerLabel: string;
changedColumnLabel: string;
changeInfo: CellDataChangedInfo;
}
export declare const getColumnHeaderLabel: (columnId: string, mainAdaptableInstance: IAdaptable) => string;
export declare const getChangeTriggerLabel: (changeInfo: CellDataChangedInfo) => string;
export declare const isValidChangeHistoryLogEntry: (changeInfo: CellDataChangedInfo | undefined) => changeInfo is CellDataChangedInfo;
export declare const mapChangeHistoryRowData: (changeHistoryLog: Record<string, CellDataChangedInfo>, mainAdaptableInstance: IAdaptable) => DataChangeHistoryData[];
export declare const getChangeHistoryRowChangeInfo: (rowData: Partial<DataChangeHistoryData> | undefined) => CellDataChangedInfo | undefined;
/**
* Format an old/new value for display in the Data Change History Monitor.
*
* If the changed column has a `DisplayFormat` configured (via Format Column),
* the value is run through the matching formatter so the History Log shows the
* same rendered text the user sees in the grid (e.g. a timestamp appears as
* `18:40:34` rather than the underlying `1751469622156`).
*
* If no `DisplayFormat` is scoped to the column, we fall back to `String(value)`
* — which preserves the previous behaviour for columns whose raw value already
* *is* the display value (e.g. plain numeric or string columns).
*
* Note: the `rowNode` passed here is the node captured when the change was
* recorded. Its data may have moved on since; that only matters for
* `CustomDisplayFormatters` that read other cells on the row — in which case
* the formatted value reflects the current state of that row, not the state at
* the time of the change. Any thrown error inside a formatter is swallowed and
* the raw value is shown, so the History Monitor never crashes on stale data.
*/
export declare const formatChangeHistoryCellValue: (value: unknown, column: AdaptableColumn | undefined, rowNode: IRowNode | null | undefined, api: AdaptableApi) => string;