import { type DeletableGridModel, type EditableGridModel, type EditOperation, GridRange, type ModelIndex, type MoveOperation, type VisibleIndex } from '@deephaven/grid'; import type { dh as DhType } from '@deephaven/jsapi-types'; import { type CancelablePromise } from '@deephaven/utils'; import { TableUtils, Formatter, type SortDescriptor } from '@deephaven/jsapi-utils'; import IrisGridModel, { type DisplayColumn } from './IrisGridModel'; import IrisGridUtils from './IrisGridUtils'; import MissingKeyError from './MissingKeyError'; import { type ColumnName, type UITotalsTableConfig, type UIRow, type PendingDataMap, type CellData, type UIViewportData, type PendingDataErrorMap } from './CommonTypes'; import { type IrisGridThemeType } from './IrisGridTheme'; import type ColumnHeaderGroup from './ColumnHeaderGroup'; export declare function isIrisGridTableModelTemplate(model: IrisGridModel): model is IrisGridTableModelTemplate; /** * Template model for a grid */ declare class IrisGridTableModelTemplate extends IrisGridModel implements DeletableGridModel, EditableGridModel { static ROW_BUFFER_PAGES: number; seekRow(startRow: number, column: DhType.Column, valueType: DhType.ValueTypeType, value: unknown, insensitive?: boolean | undefined, contains?: boolean | undefined, isBackwards?: boolean | undefined): Promise; export(): Promise; columnStatistics(column: DhType.Column): Promise; get customColumns(): ColumnName[]; set customColumns(customColumns: ColumnName[]); get formatColumns(): DhType.CustomColumn[]; set formatColumns(formatColumns: DhType.CustomColumn[]); updateFrozenColumns(columns: ColumnName[]): void; get rollupConfig(): DhType.RollupConfig | null; set rollupConfig(rollupConfig: DhType.RollupConfig | null); get selectDistinctColumns(): ColumnName[]; set selectDistinctColumns(names: ColumnName[]); /** * Returns an array of the columns in the model * The order of model columns should never change once established */ get columns(): DhType.Column[]; dh: typeof DhType; irisGridUtils: IrisGridUtils; tableUtils: TableUtils; private irisFormatter; private irisColumnAlignmentMap; inputTable: DhType.InputTable | null; private subscription; table: T; viewport: { top: VisibleIndex; bottom: VisibleIndex; columns?: DhType.Column[]; } | null; viewportData: UIViewportData | null; formattedStringData: (string | null)[][]; private pendingStringData; private isSaveInProgress; private totalsTable; totalsTablePromise: CancelablePromise | null; totals: UITotalsTableConfig | null; private totalsDataMap; private pendingNewDataMap; private pendingNewRowCount; private _columnHeaderGroupMap; private columnHeaderParentMap; private _columnHeaderMaxDepth; private _columnHeaderGroups; private _isColumnHeaderGroupsInitialized; private _movedColumns; /** * @param dh JSAPI instance * @param table Iris data table to be used in the model * @param formatter The formatter to use when getting formats * @param inputTable Iris input table associated with this table * @param columnAlignmentMap Map of column alignments */ constructor(dh: typeof DhType, table: T, formatter?: Formatter, inputTable?: DhType.InputTable | null, columnAlignmentMap?: Map); close(): void; startListening(): void; stopListening(): void; addTotalsListeners(totalsTable: DhType.TotalsTable): void; removeTotalsListeners(totalsTable: DhType.TotalsTable): void; handleTableDisconnect(): void; handleTableReconnect(): void; handleTableUpdate(event: DhType.Event): void; handleTotalsUpdate(event: DhType.Event): void; handleRequestFailed(event: DhType.Event): void; handleCustomColumnsChanged(): void; get rowCount(): number; get pendingDataErrors(): PendingDataErrorMap; get pendingDataMap(): PendingDataMap; set pendingDataMap(map: PendingDataMap); get pendingRowCount(): number; set pendingRowCount(count: number); get maxPendingDataRow(): number; get columnCount(): number; get floatingBottomRowCount(): number; get floatingTopRowCount(): number; get isValuesTableAvailable(): boolean; get isChartBuilderAvailable(): boolean; get isOrganizeColumnsAvailable(): boolean; get isTotalsAvailable(): boolean; get isEditable(): boolean; get isDeletable(): boolean; get isViewportPending(): boolean; cacheFormattedValue(x: ModelIndex, y: ModelIndex, text: string | null): void; cachePendingValue(x: ModelIndex, y: ModelIndex, text: string | null): void; clearPendingValue(x: ModelIndex, y: ModelIndex): void; textValueForCell(x: ModelIndex, y: ModelIndex): string | null | undefined; textForCell(x: ModelIndex, y: ModelIndex): string; truncationCharForCell(x: ModelIndex): '#' | undefined; colorForCell(x: ModelIndex, y: ModelIndex, theme: IrisGridThemeType): string; backgroundColorForCell(x: ModelIndex, y: ModelIndex, theme: IrisGridThemeType): string | null; textAlignForCell(x: ModelIndex, y: ModelIndex): CanvasTextAlign; textForColumnHeader(x: ModelIndex, depth?: number): string | undefined; colorForColumnHeader(x: ModelIndex, depth?: number): string | null; tooltipForCell(column: ModelIndex, row: ModelIndex): string | null; getColumnHeaderGroup(modelIndex: ModelIndex, depth: number): ColumnHeaderGroup | undefined; getColumnHeaderParentGroup(modelIndex: ModelIndex, depth: number): ColumnHeaderGroup | undefined; columnAtDepth(x: ModelIndex, depth?: number): ColumnHeaderGroup | DisplayColumn | undefined; textForRowFooter(y: ModelIndex): string; private getMemoizedInitialMovedColumns; /** * Used to get the initial moved columns based on layout hints */ get initialMovedColumns(): readonly MoveOperation[]; getMemoizedInitialColumnHeaderGroups: (layoutHints?: DhType.LayoutHints) => ColumnHeaderGroup[]; get initialColumnHeaderGroups(): ColumnHeaderGroup[]; get columnHeaderMaxDepth(): number; private set columnHeaderMaxDepth(value); get columnHeaderGroupMap(): Map; get columnHeaderGroups(): ColumnHeaderGroup[]; set columnHeaderGroups(groups: ColumnHeaderGroup[]); private initializeColumnHeaderGroups; row(y: ModelIndex): R | null; /** * Retrieve the source column for given coordinates. * - Retrieve the totals column if this is a totals row * - Retrieve the source column if it's a proxied column * - Otherwise return the column at the given index * @param column Column index to get the source column from * @param row Row index to get the source column from */ sourceColumn(column: ModelIndex, row: ModelIndex): DhType.Column; /** * Translate from the row in the model to a row in the totals table. * If the row is not a totals row, return null * @param y The row in the model to get the totals row for * @returns The row within the totals table if it's a totals row, null otherwise */ totalsRow(y: ModelIndex): ModelIndex | null; /** * Translate from the row in the model to a pending input row. * If the row is not a pending input row, return null * @param y The row in the model to get the pending row for * @returns The row within the pending input rows if it's a pending row, null otherwise */ pendingRow(y: ModelIndex): ModelIndex | null; /** * Check if a row is a totals table row * @param y The row in the model to check if it's a totals table row * @returns True if the row is a totals row, false if not */ isTotalsRow(y: ModelIndex): boolean; /** * Check if a row is a pending input row * @param y The row in the model to check if it's a pending new row * @returns True if the row is a pending new row, false if not */ isPendingRow(y: ModelIndex): boolean; dataForCell(x: ModelIndex, y: ModelIndex): CellData | undefined; formatForCell(x: ModelIndex, y: ModelIndex): DhType.Format | undefined; valueForCell(x: ModelIndex, y: ModelIndex): unknown; copyViewportData(data: DhType.ViewportData): void; copyTotalsData(totalsData: DhType.ViewportData): void; /** * Use this as the canonical column index since things like layoutHints could have * changed the column order. */ getColumnIndexByName(name: ColumnName): number | undefined; getColumnIndicesByNameMap: (columns: DhType.Column[]) => Map; /** * Copies all the viewport data into an object that we can reference later. * @param data The data to copy from */ extractViewportData(data: DhType.ViewportData): UIViewportData; extractViewportRow(row: DhType.Row, columns: DhType.Column[]): R; closeSubscription(): void; get filter(): DhType.FilterCondition[]; set filter(filter: DhType.FilterCondition[]); get formatter(): Formatter; set formatter(formatter: Formatter); get columnAlignmentMap(): ReadonlyMap; set columnAlignmentMap(columnAlignmentMap: Map); displayString(value: unknown, columnType: string, columnName?: string, formatOverride?: { formatString?: string | null; }): string; get sort(): readonly SortDescriptor[]; set sort(sort: readonly SortDescriptor[]); set totalsConfig(totalsConfig: UITotalsTableConfig | null); setTotalsTable(totalsTable: DhType.TotalsTable | null): void; setViewport: import("lodash").DebouncedFuncLeading<(top: VisibleIndex, bottom: VisibleIndex, columns?: DhType.Column[]) => void>; /** * Applies the current viewport to the underlying table. */ applyViewport: import("lodash").DebouncedFunc<() => void>; applyBufferedViewport(viewportTop: number, viewportBottom: number, columns?: DhType.Column[]): void; snapshot(ranges: readonly GridRange[], includeHeaders?: boolean, formatValue?: (value: unknown, column: DhType.Column) => unknown, consolidateRanges?: boolean): Promise; /** * Get a text snapshot of the provided ranges * @param ranges The ranges to get the snapshot for * @param includeHeaders Whether to include the headers in the snapshot or not * @param formatValue Function for formatting the raw value into a string * @returns A formatted string of all the data, columns separated by `\t` and rows separated by `\n` */ textSnapshot(ranges: readonly GridRange[], includeHeaders?: boolean, formatValue?: (value: unknown, column: DhType.Column, row?: DhType.Row) => string): Promise; valuesTable(columns: DhType.Column | readonly DhType.Column[]): Promise; getCachedFormattedString: ((formatter: Formatter, value: unknown, columnType: string, columnName: ColumnName, formatOverride?: { formatString?: string | null; }) => string) & import("@types/memoizee").Memoized<(formatter: Formatter, value: unknown, columnType: string, columnName: ColumnName, formatOverride?: { formatString?: string | null; }) => string>; getCachedCustomColumnFormatFlag: typeof import("@deephaven/jsapi-utils").isCustomColumnFormatDefined & import("@types/memoizee").Memoized; getCachedViewportRowRange: (top: number, bottom: number) => [number, number]; getCachedPendingErrors: (pendingDataMap: PendingDataMap, columns: DhType.Column[], keyColumnCount: number) => Map; isColumnMovable(modelIndex: ModelIndex, depth: number): boolean; isColumnSortable(modelIndex: ModelIndex): boolean; isKeyColumn(x: ModelIndex): boolean; isValueColumn(x: ModelIndex): boolean; isRowMovable(): boolean; isEditableRange(range: GridRange): boolean; isDeletableRange(range: GridRange): boolean; isEditableRanges(ranges: GridRange[]): boolean; isDeletableRanges(ranges: readonly GridRange[]): boolean; /** * @returns A range corresponding to the underlying table */ getTableAreaRange(): GridRange; /** * @returns A range corresponding to the pending new rows */ getPendingAreaRange(): GridRange; /** * Set value in an editable table * @param x The column to set * @param y The row to set * @param value The value to set * @returns A promise that resolves successfully when the operation is complete, or rejects if there's an error */ setValueForCell(x: ModelIndex, y: ModelIndex, text: string): Promise; /** * Set value in an editable table * @param ranges The ranges to set * @param value The values to set * @returns A promise that resolves successfully when the operation is complete, or rejects if there's an error */ setValueForRanges(ranges: readonly GridRange[], text: string): Promise; setValues(edits?: readonly EditOperation[]): Promise; commitPending(): Promise; editValueForCell(column: ModelIndex, row: ModelIndex): string; delete(ranges: readonly GridRange[]): Promise; isValidForCell(x: ModelIndex, y: ModelIndex, value: string): boolean; } export default IrisGridTableModelTemplate; //# sourceMappingURL=IrisGridTableModelTemplate.d.ts.map