@limetech/lime-elements
Version:
62 lines • 2.22 kB
TypeScript
import { EventEmitter } from '../../stencil-public-runtime';
import Tabulator from 'tabulator-tables';
import { ElementPool } from './element-pool';
import { RowData } from './table.types';
/**
* Provides row selection to Tabulator with shift-click support for range selections
*/
export declare class TableSelection {
private getTable;
private pool;
private selectEvent;
private getTranslation;
private selection;
/**
* Creates an instance of the TableSelection class
*
* @param getTable - Function that returns the Tabulator instance
* @param pool - The element pool used to cache the checkbox components
* @param selectEvent - The event emitter to use when checkboxes are toggled
* @param getTranslation - Function to get translated strings
*/
constructor(getTable: () => Tabulator, pool: ElementPool, selectEvent: EventEmitter<RowData[]>, getTranslation: (key: string) => string);
/**
* @returns Returns `true` when the selection is non-empty, otherwise `false`
*/
get hasSelection(): boolean;
/**
* Clears the selection
*/
clear(): void;
/**
* Sets the selected items
*
* @param data - The selected items
*/
setSelection(data?: RowData[]): void;
/**
* Prepends a checkbox column used for row selection to the given column definitions
*
* @param columnDefinitions - The column definition for the table
* @returns The column definitions with the checkbox column prepended to it
*/
getColumnDefinitions(columnDefinitions: Tabulator.ColumnDefinition[]): Tabulator.ColumnDefinition[];
private getRowSelectorColumnDefinition;
private headerClick;
private getRowSelectorFormatter;
/**
* Tabulator cell click handler that updates the selection for the clicked
* row and toggles the selection from the last clicked row if the shift key
* is pressed down.
*
* @param ev - The pointer event
* @param cell - The clicked cell component
*/
protected rowSelectorCellClick: (ev: PointerEvent, cell: Tabulator.CellComponent) => void;
private getRowData;
private updateRowSelectors;
private updateRowSelector;
private getActiveRows;
private getRowByIndex;
}
//# sourceMappingURL=table-selection.d.ts.map