@deephaven/js-plugin-ag-grid
Version:
Deephaven AG Grid plugin
74 lines • 3 kB
TypeScript
import type { dh as DhType } from '@deephaven/jsapi-types';
import { GridApi, IViewportDatasource, IViewportDatasourceParams } from 'ag-grid-community';
import type { AgGridTableType } from '../types';
/**
* Class that takes the input table and provides a viewport data source for AG Grid.
* Also listens for grouping to change from a table to a tree table and vice versa.
*/
export declare class DeephavenViewportDatasource implements IViewportDatasource {
private dh;
private table;
/** The current parameters for the viewport datasource */
private params;
/** The GridApi for communicating with AG Grid and notifying of updates */
private gridApi;
/** Track the original table passed in */
private readonly originalTable;
/** Current promises being awaited for operations applied to the table */
private pending;
/** The current viewport being viewed */
private currentViewport?;
/** Store the column keys from the last snapshot. This way we can tell when we need to update the pivot result columns. */
private lastSnapshotColumnKeys;
/**
* Create a Deephaven Viewport Row Model data source that can be used with AG Grid.
* @param dh Deephaven API instance to use
* @param table The table to use, either a Table or TreeTable.
*/
constructor(dh: typeof DhType, table: AgGridTableType);
init(params: IViewportDatasourceParams): void;
setViewportRange(firstRow: number, lastRow: number): void;
/**
* Expand or collapse a row in the tree table.
*
* @param row Row to expand or collapse
* @param isExpanded Whether to expand or collapse the row
*/
setExpanded(row: DhType.TreeRow | number, isExpanded: boolean): void;
setColumnExpanded(column: DhType.Column | number, isExpanded: boolean): void;
setGridApi(gridApi: GridApi): void;
private startTableListening;
private stopTableListening;
private handleColumnRowGroupChanged;
private handleColumnValueChanged;
private handleFilterChanged;
private handleSortChanged;
private handleColumnGroupOpened;
private handleTableUpdate;
private handleStandardTableUpdate;
private handlePivotUpdate;
private updatePivotColumnsIfNecessary;
private handleTableDisconnect;
private queueOperation;
private applySort;
private applyFilter;
private applyViewport;
private refreshViewport;
/**
* Syncs this data source with the current GridApi state.
* This includes applying the current filter, sort, and viewport.
*/
private updateGridState;
/** Syncs the filter with the GridApi */
private updateFilter;
/** Syncs the sort with the GridApi */
private updateSort;
/**
* Get the current row group columns and aggregations and apply them.
*/
private updateAggregations;
private setTable;
destroy(): void;
}
export default DeephavenViewportDatasource;
//# sourceMappingURL=DeephavenViewportDatasource.d.ts.map