import { InteractionEvent, InteractionManager, Point, Rectangle } from "pixi.js"; import { DBase, DBaseEvents, DBaseOptions, DThemeBase } from "./d-base"; import { DTableBodyRow, DTableBodyRowOnChange, DTableBodyRowOptions } from "./d-table-body-row"; import { DTableColumn } from "./d-table-column"; import { DTableData, DTableDataOptions } from "./d-table-data"; import { DTableDataList, DTableDataListOptions } from "./d-table-data-list"; import { DTableDataSelection } from "./d-table-data-selection"; import { DTableBodyCell } from "./d-table-body-cell"; import { DTableBodyCellOptions } from "./d-table-body-cell-options"; import { DOnOptions } from "./d-on-options"; /** * {@link DTableBody} events. */ export interface DTableBodyEvents extends DBaseEvents { /** * Triggered when rows are updated. * The first and second parameters are an mapped index range of visible data. * Please note that these parameters are real numbers. * For instance, An index range of [0.5, 2.5] means: * * * The row at index 0 is partially visible. * * The row at index 1 is fully visible. * * The row at index 2 is partially visible. * * @param from a lowest mapped index of visible data * @param to a highest mapped index of vislble data * @param emitter an emitter */ update(from: number, to: number, emitter: EMITTER): void; } /** * {@link DTableBody} "on" options. */ export interface DTableBodyOnOptions extends Partial>, DOnOptions { } export interface DTableBodyOptions = DTableDataList, THEME extends DThemeTableBody = DThemeTableBody, EMITTER = any> extends DBaseOptions { row?: DTableBodyRowOptions; data?: DTableDataListOptions | DATA; on?: DTableBodyOnOptions; } export interface DThemeTableBody extends DThemeBase { getRowHeight(): number; } export declare class DTableBody = DTableDataList, THEME extends DThemeTableBody = DThemeTableBody, OPTIONS extends DTableBodyOptions = DTableBodyOptions> extends DBase { protected static WORK_ON_CLICK: Point; protected _columns: DTableColumn[]; protected _frozen: number; protected _rowHeight: number; protected _rowIndexMappedStart: number; protected _rowIndexMappedEnd: number; protected _rowOptions: DTableBodyRowOptions; protected _updateRowsCount: number; protected _isUpdateRowsCalled: boolean; protected _isUpdateRowsCalledForcibly: boolean; protected _workRows: Array>; protected _onRowChangeBound: DTableBodyRowOnChange; protected _columnIndexToCellOptions: Map>; protected _data: DATA; constructor(columns: DTableColumn[], frozen: number, offset: number, options: OPTIONS); protected onRowChange(newValue: unknown, oldValue: unknown, row: ROW, rowIndex: number, columnIndex: number, column: DTableColumn): void; protected toData(options?: DATA | DTableDataListOptions): DATA; protected isData(target?: ROW[] | DTableDataOptions | DTableData): target is DTableData; onResize(newWidth: number, newHeight: number, oldWidth: number, oldHeight: number): void; get selection(): DTableDataSelection; lock(): void; unlock(callIfNeeded: boolean): void; /** * Updates rows. If the `forcibly` is true, some dirty checkings for * avoiding unnecessary state changes are skipped. * * @param forcibly true to update forcibly */ update(forcibly?: boolean): void; protected resetRow(row: DTableBodyRow): DTableBodyRow; protected newRow(isEven: boolean): DTableBodyRow; protected onParentMove(newX: number, newY: number, oldX: number, oldY: number): void; protected updateFrozenCellPosition(x: number): void; getClippingRect(target: unknown, result: Rectangle): void; /** * Scroll to the given row or row index. * * @param target a row or an row index to which the body scrolls to. * @returns true if succeeded */ scrollTo(target: ROW | number): boolean; /** * Returns a mapped row index at the given local Y position or -1. * * @param localY a local Y position * @returns a mapped row index at the given local Y position or -1. */ toRowIndexMapped(localY: number): number; /** * Returns a row at the given mapped row index or null if not exits. * * @param rowIndexMapped a mapped row index * @returns a row at the given mapped row index or null if not exists. */ toRow(rowIndexMapped: number): DTableBodyRow | null; /** * Returns a cell at the given local X position or null if not exits. * This method assumes the given local X position is on the given row. * * @param row a row * @param localX a local X position * @returns a cell at the given local X position or null if not exits */ toCell(row: DTableBodyRow, localX: number): DTableBodyCell | null; onRowClick(e: InteractionEvent): void; protected onRowSelect(e: InteractionEvent, rowIndexMapped: number): void; onDblClick(e: MouseEvent | TouchEvent, interactionManager: InteractionManager): boolean; protected getType(): string; get data(): DATA; }