/** * Copyright 2019, SumUp Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Component, type HTMLAttributes, type UIEvent } from 'react'; import type { Direction, Row, HeaderCell } from './types.js'; export interface TableProps extends HTMLAttributes { /** * An array of header cells for the table. */ headers?: HeaderCell[]; /** * An array of rows or an object with children containing an array of cells * for the table. */ rows: Row[]; /** * Enables/disables sticky columns on mobile. Defaults to true. */ rowHeaders?: boolean; /** * Removes the default box-shadow from the table. */ noShadow?: boolean; /** * Toggles condensed styles on the Table. */ condensed?: boolean; /** * Toggles vertical scroll on the Table body. */ scrollable?: boolean; /** * Custom onSortBy function for the onSort handler. * The signature is (index, currentRows, nextDirection) and it should return * an array of rows */ onSortBy?: (index: number, currentRows: Row[], nextDirection?: Direction) => Row[]; /** * Specifies the initial sort order of the table */ initialSortDirection?: 'ascending' | 'descending'; /** * Specifies the column index which `initialSortDirection` will be applied to */ initialSortedColumn?: number; /** * Click handler for the row * The signature is (index) */ onRowClick?: (rowIndex: number) => void; /** * Collapses the table cells. */ borderCollapsed?: boolean; } type TableState = { sortedColumn?: number; rows?: Row[]; sortHover?: number; sortDirection?: Direction; scrollTop?: number; tableBodyHeight?: string; }; /** * Table interface component. It handles rendering rows/headers properly */ export declare class Table extends Component { constructor(props: TableProps); private tableRef; componentDidMount(): void; componentDidUpdate(prevProps: TableProps): void; componentWillUnmount(): void; addVerticalScroll: () => void; removeVerticalScroll: () => void; calculateTableBodyHeight: () => void; onSortEnter: (i: number) => void; onSortLeave: () => void; onSortBy: (i: number) => void; getInitialRows: (rows: Row[], initialSortDirection: Direction | undefined, initialSortedColumn: number | undefined) => Row[]; getSortedRows: (sortDirection: Direction, sortedRow: number) => Row[]; updateSort: (i: number, nextDirection: Direction, sortedRows: Row[]) => void; handleScroll: (e: UIEvent) => void; render(): import("react/jsx-runtime").JSX.Element; } export {};