Skip to content

Audit History Panel

export function createAuditHistoryPanelDock(
panel: HTMLElement,
grid: HTMLRevoGridElement,
placement: AuditHistoryPanelPlacement,
);

Renders the Audit History panel into el for the given RevoGrid element.

The grid must have AuditHistoryPlugin installed.

export function defineAuditHistoryPanel(el: HTMLElement, grid: HTMLRevoGridElement, options: AuditHistoryPanelOptions = {}): AuditHistoryPanelHandle;

export type AuditHistoryPanelDateFormatContext = {
mode: 'time' | 'day' | 'filter';
record?: AuditRecord;
};

export type AuditHistoryPanelEvents = {
beforeRecordSelect?: (context: AuditHistoryPanelRecordContext) => boolean | void;
beforeCompareOpen?: (context: AuditHistoryPanelRecordContext) => boolean | void;
beforeJumpToCell?: (context: AuditHistoryPanelJumpContext) => boolean | void;
beforeRestore?: (context: AuditHistoryPanelRestoreContext) => boolean | void;
beforeExport?: (context: AuditHistoryPanelExportContext) => boolean | void;
};

export type AuditHistoryPanelExportContext = {
format: AuditHistoryExportFormat;
};

export type AuditHistoryPanelJumpContext = {
record: AuditRecord;
change: AuditChange;
};

export type AuditHistoryPanelLabels = {
title: string;
liveStatus: string;
recordsSummary: (count: number) => string;
changesSummary: (count: number) => string;
cellsSummary: (count: number) => string;
rowsSummary: (count: number) => string;
scopedChangesSummary: (visibleChanges: number, totalChanges: number) => string;
additionalChanges: (target: string, additionalCount: number) => string;
countLabel: (count: number) => string;
scopeLabel: (label: string, count: number) => string;
scopeAriaLabel?: string;
/** Optional full sentence formatter for languages with a different word order. */
recordSummary?: (context: AuditHistoryPanelRecordSummaryContext) => string;
allTab: string;
rowTab: string;
cellTab: string;
tableTab: string;
selectedCell: (rowId: string, column: ColumnProp) => string;
selectedRow: (rowId: string) => string;
export: string;
exportCsv: string;
exportJson: string;
exportCsvTitle: string;
exportJsonTitle: string;
close: string;
openPanel: string;
searchPlaceholder: string;
searchAriaLabel: string;
searchShortcut: string;
userPlaceholder: string;
/** Independent visible captions; omitted captions retain the existing placeholder/aria-label defaults. */
userFilterLabel?: string;
columnFilterLabel?: string;
actionFilterLabel?: string;
dateFromFilterLabel?: string;
dateToFilterLabel?: string;
userAriaLabel: string;
columnAriaLabel: string;
actionAriaLabel: string;
dateFromAriaLabel: string;
dateToAriaLabel: string;
dateFromPrefix: string;
dateToPrefix: string;
dateFromChip: (formattedDate: string, prefix: string) => string;
dateToChip: (formattedDate: string, prefix: string) => string;
allColumns: string;
allActions: string;
clearFilters: string;
addFilter: string;
closeFilters: string;
exportResults: (count: number) => string;
removeFilter: (label: string) => string;
noRecords: string;
noComparableRecord: string;
scopedRecordCount: (visibleChanges: number, totalChanges: number) => string;
changedBy: (changedAt: string, user: string) => string;
rowTarget: (rowId: string | undefined, column: ColumnProp | undefined) => string;
cellValues: (oldValue: string, newValue: string) => string;
rowSnapshotAvailable: string;
rowRemoved: string;
restoreCell: string;
restoreRow: string;
restoreTransaction: string;
restoreSnapshot: string;
jumpToCell: string;
revertAll: string;
moreActions: string;
compare: string;
compareTitle: string;
compareBefore: string;
compareAfter: string;
closeCompare: string;
compareEmpty: string;
viewChanges: (count: number) => string;
previousPage: string;
nextPage: string;
pageStatus: (currentPage: number, pageCount: number) => string;
dayToday: string;
dayYesterday: string;
sourceLabels: Record<AuditHistorySource, string>;
actions: Partial<Record<AuditActionType, string>>;
actionVerbs: Partial<Record<AuditActionType, string>>;
/** Optional translation lookup; undefined falls back to the action map. */
actionLabel?: (actionType: AuditActionType) => string | undefined;
actionVerb?: (actionType: AuditActionType) => string | undefined;
};

export type AuditHistoryPanelValueFormatContext = {
side: 'before' | 'after';
change: AuditChange;
};

export type AuditHistoryPanelRecordSummaryContext = {
user: string;
verb: string;
target: string;
detail?: string;
};

export type DateDisplayFormat = 'locale' | 'eu' | 'us' | 'iso' | 'long';
export type TimeDisplayFormat = 'locale' | '12h' | '24h';
export type DateTimeDisplayOptions = {
locale?: string | string[];
dateFormat?: DateDisplayFormat;
timeFormat?: TimeDisplayFormat;
timeZone?: string;
};

The shared formatter is also exported from @revolist/revogrid-pro:

export function formatDateTimeDisplay(
value: unknown,
options: DateTimeDisplayOptions & { mode: 'date' | 'time' | 'dateTime' },
): string | undefined;

dateFormat controls day headings and date-filter chips. timeFormat controls timestamps and chip times. EU and ISO default to 24-hour clocks; US defaults to 12-hour clocks. locale controls localized month/day names and the panel language attribute. timeZone controls record timestamps and their calendar-day groups; native date-filter inputs remain browser-local. formatDate overrides every built-in format. See the localization guide for configuration examples.


AuditHistoryPanelLabelsOptions (Extended from index.tsx)

Section titled “AuditHistoryPanelLabelsOptions (Extended from index.tsx)”
export type AuditHistoryPanelLabelsOptions = Partial<Omit<AuditHistoryPanelLabels, 'actions' | 'actionVerbs' | 'sourceLabels'>> & {
actions?: Partial<Record<AuditActionType, string>>;
actionVerbs?: Partial<Record<AuditActionType, string>>;
sourceLabels?: Partial<Record<AuditHistorySource, string>>;
};

export type AuditHistoryPanelHandle = {
destroy: () => void;
setPlacement: (placement: AuditHistoryPanelPlacement) => void;
refresh: () => Promise<void>;
};

export type AuditHistoryPanelOptions = DateTimeDisplayOptions & {
pageSize?: number;
allowExport?: boolean;
allowCompare?: boolean | ((context: AuditHistoryPanelRecordContext) => boolean);
allowClose?: boolean;
miniOnClose?: boolean;
restoreActions?: false | AuditRestoreType[] | ((context: AuditHistoryPanelRestoreContext) => boolean);
formatDate?: (value: string, context: AuditHistoryPanelDateFormatContext) => string;
/** Display only; raw record values, filtering and exports remain unchanged. */
formatValue?: (value: unknown, context: AuditHistoryPanelValueFormatContext) => string;
events?: AuditHistoryPanelEvents;
placement?: AuditHistoryPanelPlacement;
tooltips?: false | Partial<Record<AuditHistoryPanelTooltipKey, string | false>>;
labels?: AuditHistoryPanelLabelsOptions;
};

export type AuditHistoryPanelRecordContext = {
record: AuditRecord;
changes: AuditChange[];
};

export type AuditHistoryPanelRestoreContext = {
type: AuditRestoreType;
record?: AuditRecord;
change?: AuditChange;
transactionId?: string;
};

export type AuditHistoryPanelPlacement = 'right' | 'left' | 'top' | 'bottom' | 'none';

export type AuditHistoryPanelTooltipKey =
| 'totalRecords'
| 'totalChanges'
| 'selectedScope'
| 'searchFilter'
| 'userFilter'
| 'columnFilter'
| 'actionFilter'
| 'dateFromFilter'
| 'dateToFilter'
| 'clearFilters';

export function resolveLabels(labels?: AuditHistoryPanelLabelsOptions): AuditHistoryPanelLabels;

export function getAuditActionLabel(labels: AuditHistoryPanelLabels, actionType: AuditActionType): string;

export function getAuditActionVerb(labels: AuditHistoryPanelLabels, actionType: AuditActionType): string;

actionTypes: AuditActionType[];

titleizeActionType: (value: string) => string;

export function createInitialFilters(): AuditPanelFilters;

export function stringifyValue(value: unknown): string;

export function formatTime(value: string, mode?: 'compact' | 'day', locale?: string | string[]);

export function formatPanelDate(
value: string,
options: AuditHistoryPanelOptions,
context: { mode: 'time' | 'day' | 'filter'; record?: AuditRecord },
);

export function getUserLabel(record: AuditRecord);

export function getAvatarLabel(record: AuditRecord);

export function matchesFilters(record: AuditRecord, filters: AuditPanelFilters);

export function getScopedChanges(record: AuditRecord, tab: AuditPanelTab, selected: SelectedAuditTarget): AuditChange[];

export function getRecordSource(type: AuditActionType, record?: AuditRecord): AuditHistorySource;

export function getTargetLabel(record: AuditRecord, changes: AuditChange[], labels: AuditHistoryPanelLabels);

export function getDetailLabel(record: AuditRecord, changes: AuditChange[], labels?: AuditHistoryPanelLabels);

export function isComparable(record: AuditRecord, changes: AuditChange[]);

export function toTimelineRecord(
record: AuditRecord,
changes: AuditChange[],
labels: AuditHistoryPanelLabels,
options: AuditHistoryPanelOptions = {},
): TimelineRecord;

export function groupTimelineRecords(records: TimelineRecord[]): TimelineGroup[];

export async function getPlugin(grid: HTMLRevoGridElement): Promise<AuditHistoryPluginRuntime | undefined>;

panelRefreshEvents: readonly ["auditrecord", "auditrecordsloaded", "auditrestore"];

export function canSelectRecord(options: AuditHistoryPanelOptions, context: AuditHistoryPanelRecordContext);

export function canOpenCompare(options: AuditHistoryPanelOptions, context: AuditHistoryPanelRecordContext);

export function canJumpToCell(options: AuditHistoryPanelOptions, context: AuditHistoryPanelJumpContext);

export function canUseRestoreAction(options: AuditHistoryPanelOptions, context: AuditHistoryPanelRestoreContext);

export function canExportAuditHistory(options: AuditHistoryPanelOptions, format: AuditHistoryExportFormat);

export function AuditHistoryTooltip({ options, tooltipKey }: { options: AuditHistoryPanelOptions; tooltipKey: AuditHistoryPanelTooltipKey });

export type AuditPanelTab = 'cell' | 'row' | 'table';

export type SelectedAuditTarget = {
rowId?: string;
column?: ColumnProp;
columnLabel?: ColumnProp;
rowIndex?: number;
rowType?: DimensionRows;
};

export type AuditPanelFilters = {
search: string;
user: string;
column: string;
actionType: '' | AuditActionType;
dateFrom: string;
dateTo: string;
};

export type AuditHistoryPluginRuntime = {
getRecords: () => AuditRecord[];
getCellHistory: (rowId: string, column: ColumnProp) => AuditRecord[];
getRowHistory: (rowId: string) => AuditRecord[];
getStats: () => AuditHistoryStats;
exportRecords: (options?: AuditHistoryExportOptions) => string;
getRowIdentity: (row: DataType | undefined, rowIndex: number, rowType: DimensionRows) => string | undefined;
canRestoreRecord: (context: { type: AuditRestoreType; record?: AuditRecord; change?: AuditChange; transactionId?: string }) => boolean;
restoreCell: (change: AuditChange) => boolean;
restoreRow: (record: AuditRecord) => boolean;
restoreTransaction: (transactionId: string) => boolean;
restoreSnapshot?: (recordOrId: AuditRecord | string) => boolean;
recordEvent?: (input: AuditRecordEventInput) => AuditRecord | undefined;
createSnapshot?: (label: string, options?: AuditSnapshotOptions) => AuditRecord | undefined;
};

export type VisibleAuditRecord = {
record: AuditRecord;
changes: AuditChange[];
};

export type TimelineRecord = VisibleAuditRecord & {
id: string;
source: AuditHistorySource;
verb: string;
userLabel: string;
avatarLabel: string;
avatarIndex?: number;
avatarColor?: string;
targetLabel: string;
detailLabel?: string;
rangeLabel?: string;
changedAtLabel: string;
dayKey: string;
dayLabel: string;
daySubLabel?: string;
accent: boolean;
comparable: boolean;
};

export type TimelineGroup = {
key: string;
label: string;
subLabel?: string;
records: TimelineRecord[];
};

export function AuditHistoryPanel({
grid,
options = {},
refreshSignal = 0,
onClose,
}: {
grid: HTMLRevoGridElement;
options?: AuditHistoryPanelOptions;
refreshSignal?: number;
onClose?: () => void;
});

export function CompareDrawer({ record, labels, options, onClose }: CompareDrawerProps);

export function Filters({ filters, columns, actionTypes, labels, options, searchInputRef, onFiltersChange, onClearFilters }: FiltersProps);

export function MiniAuditHistoryPanel({
grid,
options,
onOpen,
}: {
grid: HTMLRevoGridElement;
options: AuditHistoryPanelOptions;
onOpen: () => void;
});

export function Pagination({
visibleRecordCount,
pageSize,
currentPage,
pageCount,
labels,
onPageChange,
}: PaginationProps);

export function RecordsList({
groups,
labels,
plugin,
selectedRecordId,
collapsingRecordId,
onSelectRecord,
onRestoreCell,
onRestoreRow,
onRestoreTransaction,
onRestoreSnapshot,
onJumpToChange,
canUseRestoreAction,
canJumpToChange,
}: RecordsListProps);

export function Toolbar({
records,
stats,
selected,
tab,
tabCounts,
labels,
options,
onTabChange,
onExport,
onClose,
}: ToolbarProps);