View as Markdown

API reference: @salmonui/data-grid/engine/export

ExportHandlersinterface

import type { ExportHandlers } from '@salmonui/data-grid/engine/export';
interface ExportHandlers<Row, Data = Uint8Array> {
    readonly onBeforeExport?: (event: BeforeExportEvent) => void;
    readonly onExport?: (event: ExportEvent<Data>) => void;
    readonly cell?: (ctx: ExportCellHookContext<Row>) => ExportCellPatch | null | undefined | void;
    readonly headerCell?: (ctx: ExportHeaderCellHookContext<Row>) => {
        readonly text?: string;
        readonly style?: ExportCellStyle;
    } | null | undefined | void;
    readonly aggregateCell?: (ctx: ExportAggregateCellHookContext) => {
        readonly text?: string;
        readonly style?: ExportCellStyle;
    } | null | undefined | void;
    readonly groupCaption?: (ctx: ExportGroupCaptionHookContext) => string | null | undefined | void;
    readonly detail?: (ctx: ExportDetailContext<Row>) => ExportDetail | null | undefined | void;
}

Hooks and events of an export.

ExportHandlers members (7)
NameSignatureDescription
onBeforeExportoptionalreadonly onBeforeExport?: (event: BeforeExportEvent) => void;

Synchronous; preventDefault() cancels.

onExportoptionalreadonly onExport?: (event: ExportEvent<Data>) => void;

Called once the file is being produced; file resolves when it is ready.

celloptionalreadonly cell?: (ctx: ExportCellHookContext<Row>) => ExportCellPatch | null | undefined | void;

Per data cell. Not called when unset.

headerCelloptionalreadonly headerCell?: (ctx: ExportHeaderCellHookContext<Row>) => { readonly text?: string; readonly style?: ExportCellStyle; } | null | undefined | void;

Per header cell.

aggregateCelloptionalreadonly aggregateCell?: (ctx: ExportAggregateCellHookContext) => { readonly text?: string; readonly style?: ExportCellStyle; } | null | undefined | void;

Per aggregate cell (grid footer, group footer, group caption).

groupCaptionoptionalreadonly groupCaption?: (ctx: ExportGroupCaptionHookContext) => string | null | undefined | void;

Group caption text.

detailoptionalreadonly detail?: (ctx: ExportDetailContext<Row>) => ExportDetail | null | undefined | void;

A detail block written after a data row (text lines or a child table), or null for none.