import { EventEmitter, JSX } from '../../stencil-public-runtime'; import { ColumnSizingInfoState, RowSelectionState, Updater, Row } from '@tanstack/table-core'; import { ModusTableManualSortingOptions, ModusTableCellValueChange, ModusTableColumnOrderState, ModusTableColumnSizingState, ModusTableColumnVisibilityState, ModusTableExpandedState, ModusTableManualPaginationOptions, ModusTablePaginationState, ModusTableRowAction, ModusTableRowActionClick, ModusTableSortingState, ModusTableColumnSort, ModusTableErrors, ModusTableRowActionConfig } from './models/modus-table.models'; import ColumnDragState from './models/column-drag-state.model'; import { ModusTableColumn, ModusTableCellLink, ModusTableDisplayOptions, ModusTableToolbarOptions, ModusTableRowSelectionOptions } from './models/modus-table.models'; import { TableHeaderDragDrop } from './utilities/table-header-drag-drop.utility'; import ModusTableCore from './modus-table.core'; import TableState from './models/table-state.model'; import { TableContext, TableCellEdited } from './models/table-context.models'; import { TableRowActionWithOverflow } from './models/table-row-actions.models'; /** * @slot customFooter - Slot for custom footer. * @slot groupLeft - Slot for custom toolbar options added to the left. * @slot groupRight - Slot for custom toolbar options added to the right. */ export declare class ModusTable { element: HTMLElement; /** (Required) To display headers in the table. */ columns: ModusTableColumn[]; onColumnsChange(newVal: ModusTableColumn[]): void; columnResize: boolean; onColumnResizeChange(newVal: boolean): void; /** (Optional) To allow column reordering. */ columnReorder: boolean; onColumnReorderChange(): void; /** (Required) To display data in the table. */ data: unknown[]; onDataChange(newVal: unknown[]): void; /** (optional) The density of the table. */ density: 'relaxed' | 'comfortable' | 'compact'; /** (Optional) To control display options of table. */ displayOptions?: ModusTableDisplayOptions; errors: ModusTableErrors; /** (Optional) To enable row hover in table. */ hover: boolean; fullWidth: boolean; /** (Optional) To display a vertical scrollbar when the height is exceeded. */ maxHeight: string; /** (Optional) To display a horizontal scrollbar when the width is exceeded. */ maxWidth: string; pageSizeList: number[]; pagination: boolean; onPaginationChange(newVal: boolean): void; /** (Optional) Actions that can be performed on each row. A maximum of 4 icons will be shown, including overflow menu and expand icons. */ rowActions: ModusTableRowAction[]; /** (Optional) The width and header of the rowActionsConfig. */ rowActionsConfig: ModusTableRowActionConfig; /** (Optional) To display expanded rows. */ rowsExpandable: boolean; onRowsExpandableChange(newVal: boolean): void; /** (Optional) To display checkbox. */ rowSelection: boolean; onRowSlectionChange(newVal: boolean): void; /** (Optional) To enable manual pagination mode. When enabled, the table will not automatically paginate rows, instead will expect the current page index and other details to be passed. */ manualPaginationOptions: ModusTableManualPaginationOptions; onManualPaginationOptionsChange(newVal: ModusTableManualPaginationOptions): void; /** (Optional) To set modus-table in manual sorting mode. */ manualSortingOptions: ModusTableManualSortingOptions; onManualSortOptionsChange(newVal: ModusTableManualSortingOptions, oldVal: ModusTableManualSortingOptions): void; /** (Optional) To control multiple row selection. */ rowSelectionOptions: ModusTableRowSelectionOptions; onRowSelectionOptionsChange(newVal: ModusTableRowSelectionOptions, oldVal: ModusTableRowSelectionOptions): void; /** (Optional) To display sort icon on hover. */ showSortIconOnHover: boolean; /** (Optional) To sort data in table. */ sort: boolean; onSortChange(newVal: any): void; /** (Optional) To display a-z or arrow sort icons. */ sortIconStyle: 'alphabetical' | 'directional'; /** (Optional) To display summary row. */ summaryRow: boolean; /** (Optional) To display a toolbar for the table. */ toolbar: boolean; /** (Optional) To display a toolbar, which allows access to table operations like hiding columns. */ toolbarOptions: ModusTableToolbarOptions | null; onToolbarOptionsChange(newVal: ModusTableToolbarOptions | null): void; /** (Optional) To set the default sorting for the table. */ defaultSort: ModusTableColumnSort; onDefaultSortChange(newVal: ModusTableColumnSort | null): void; /** (Optional) To wrap text that overflows the cell. */ wrapText: boolean; /** (Optional) Function to determine if a row is disabled for selection. */ rowSelectionDisabled?: (row: Row) => boolean; /** Emits the cell value that was edited */ cellValueChange: EventEmitter; /** Emits the link that was clicked */ cellLinkClick: EventEmitter; /** Emits columns in the updated order */ columnOrderChange: EventEmitter; /** Emits latest column size */ columnSizingChange: EventEmitter; /** Emits visibility state of each column */ columnVisibilityChange: EventEmitter; /** An event that fires when a row action is clicked. */ rowActionClick: EventEmitter; /** Emits expanded state of the columns */ rowExpanded: EventEmitter; /** Emits rows selected */ rowSelectionChange: EventEmitter; /** Emits column sort order */ sortChange: EventEmitter; /** Emits selected page index and size */ paginationChange: EventEmitter; itemDragState: ColumnDragState; handleItemDragState(newValue: string, oldValue: string): void; dragAndDropObj: TableHeaderDragDrop; tableState: TableState; tableCore: ModusTableCore; cells: HTMLModusTableCellMainElement[]; classByDensity: Map; private frozenColumns; private isColumnResizing; private _id; private _context; private onMouseMove; private onKeyDown; private onMouseUp; /** Updates the cells state by querying the shadow DOM for modus-table-cell-main elements.*/ private updateCells; componentWillLoad(): void; componentWillRender(): void; /** * Returns data of a column. * @param accessorKey : Column name as key. * @returns : Column data as Array or empty array. */ getColumnData(accessorKey: string): Promise; /** * Selects or deselects all rows in the table. * * @param select - `true` to select all rows, `false` to deselect them. * @returns A promise that resolves when the operation is complete. * * @example * await toggleAllRowsSelection(true); // Select all * await toggleAllRowsSelection(false); // Deselect all */ toggleAllRowsSelection(select: boolean): Promise; /** * Returns whether a cell is editable based on row index and column ID. * @param rowIndex The index of the row. * @param columnId The ID of the column. * @returns Boolean indicating if the cell is editable. */ getEditableCell(rowIndex: string, columnId: string): Promise; /** * Toggle the table column visibility * @param columnId Column id * @param show Boolean value decides to visibility of column */ toggleColumnVisibility(columnId: string, show: boolean): Promise; documentClickHandler(event: MouseEvent): void; freezeColumn(columnId: string): void; getRowId(originalRow: unknown, index: number, parent?: Row): string; getRowActionsWithOverflow(): TableRowActionWithOverflow[]; getTableContext(): TableContext; handleDragStart(event: MouseEvent | KeyboardEvent, draggedColumnId: string, elementRef: HTMLTableCellElement, mouseInteracted: boolean): void; handleDragOver(event: MouseEvent): void; handleKeyDown(event: KeyboardEvent): void; handleDrop(): void; getPreselectedRowState(): RowSelectionState; initializeTable(): void; setTableState(state: TableState): void; updateTableCore(updater: Updater, key: string, event?: EventEmitter): void; updateData(updater: Updater, context: TableCellEdited): void; lastDirection: string; private anchorRowIndex; updateSelectedRows(nextRowIndex: number, currentRowIndex: number): void; updateClickedRows(currentRowIndex: number, isShiftClick: boolean): void; updateRowSelection(updater: Updater): void; updateColumnSizingInfo(updater: Updater): void; renderToolBar(): JSX.Element | null; renderMain(): JSX.Element | null; renderTable(): JSX.Element | null; renderTableHeader(): JSX.Element | null; renderTableBody(): JSX.Element | null; renderTableFooter(): JSX.Element | null; renderPagination(): JSX.Element | null; render(): void; }