UNPKG

@deephaven/js-plugin-ag-grid

Version:
57 lines 3.65 kB
import type { dh as CorePlusDhType } from '@deephaven-enterprise/jsapi-coreplus-types'; import { ColDef, ColGroupDef } from 'ag-grid-community'; import { AgGridViewportRowData, SingleRowData } from './AgGridTableUtils'; export type PivotColumnGroupContext = { snapshotIndex: number; }; export declare function isPivotColumnGroupContext(context?: unknown): context is PivotColumnGroupContext; /** * Converts an array of group keys to a string representation. * @param groupKeys The group keys to convert to a string. * @returns A string representation of the group keys. */ export declare function toGroupKeyString(groupKeys: (unknown | null)[]): string; /** * Converts a group key string and a value source name to a value key string. * @param groupKeyString The group key string. * @param valueSourceName The value source name. * @returns A value key string. */ export declare function toValueKeyString(groupKeyString: string, valueSourceName: string): string; /** * Get the row group keys from the provided row sources and data. * @param rowSources The row sources to extract keys from. * @param data The data object containing the values. * @returns An array of row group keys. */ export declare function getRowGroupKeys(rowSources: CorePlusDhType.coreplus.pivot.PivotSource[], data: Record<string, unknown>): string[]; /** * Finds the index of a row in the pivot table snapshot based on the provided row group keys. * @param rows Rows from the pivot table snapshot. * @param rowGroupKeys The row group keys to find the index for. * @returns The index of the row, or null if not found. */ export declare function findRowIndex(rows: CorePlusDhType.coreplus.pivot.DimensionData, rowGroupKeys: string[]): number | null; export declare function getHeaderName(columnKeys: (string | null)[]): string; export declare function makePendingColDef(groupId: string): ColDef; /** * Get the column definition for a column with value sources in a pivot table. * If only one value source is provided, it will return a simple column definition. * If multiple value sources are provided, it will return a column group definition * @param headerName Header name of the value source group * @param columnKey Column key of the value source group * @param valueSources Value sources for the pivot table * @returns The pivot value source group definition */ export declare function makeColumnValuesColDef(headerName: string, columnKey: string, valueSources: CorePlusDhType.coreplus.pivot.PivotSource[]): ColGroupDef | ColDef; /** * Get the pivot result columns from the provided pivot dimension data. This tells AG Grid how to display the columns, including expandable/collapsible groups. * @param columns The pivot dimension data representing the columns. * @param valueSources The value sources for the pivot table. * @returns An array of column definitions for the pivot result. */ export declare function getPivotResultColumns(columns: CorePlusDhType.coreplus.pivot.DimensionData, valueSources: CorePlusDhType.coreplus.pivot.PivotSource[]): (ColGroupDef | ColDef)[]; export declare function extractSnapshotRow(snapshot: CorePlusDhType.coreplus.pivot.PivotSnapshot, table: CorePlusDhType.coreplus.pivot.PivotTable, rowIndex: number): SingleRowData; export declare function extractTotalsRow(snapshot: CorePlusDhType.coreplus.pivot.PivotSnapshot, table: CorePlusDhType.coreplus.pivot.PivotTable): SingleRowData; export declare function extractSnapshotRows(snapshot: CorePlusDhType.coreplus.pivot.PivotSnapshot, table: CorePlusDhType.coreplus.pivot.PivotTable): AgGridViewportRowData; //# sourceMappingURL=AgGridPivotUtils.d.ts.map