import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime'; import type { Q2DataTableHeader, Q2DataTableCell, Q2DataTableRow, Q2DataTableSerializedRow } from 'q2-tecton-common/lib/types/elements'; export type Q2DataTableBadgeCell = Q2DataTableCell & { type: 'badge'; tags: { value: any; badgeTheme: HTMLQ2BadgeElement['theme']; }[]; }; /** * @name Data Table * @category Display * @summary Use for displaying large datasets with sorting, filtering, and selecting. * @slot row--cell- - A slot for overriding the content of any cell in any row of the table with custom content. * @slot header-cell- - A slot for the content of any cell in the header of the table. * @slot row--dropdown - A slot to provide a [Dropdown](https://tecton.q2developer.com/design-system/q2-dropdown/) for a row. * @slot row--expandable-content - A slot that makes the row expandable and displays the provided content. * @slot empty-table - An optional slot to display custom content when the table is empty. */ export declare class Q2DataTable implements ComponentInterface { mutationObserver: MutationObserver; resizeObserver: ResizeObserver; hostElement: HTMLElement; allRowsSelected: boolean; checkSlotCount: number; hasDropdowns: boolean; hasExpandableRows: boolean; hasRowData: boolean; hasStatusRows: boolean; serializedHeaders: Q2DataTableHeader[]; serializedRows: Q2DataTableSerializedRow[]; someRowsSelected: boolean; /** Adds borders between rows and/or columns in the table. */ bordered: boolean | 'horizontal' | 'vertical' | 'grid'; /** Provides a caption for the data table. */ caption: string; /** Adds the ability to click a row and have the table emit an event with the selected row's data. */ clickable: boolean; /** Determines the amount of padding for each of the cells in the table. */ density: 'compact' | 'normal' | 'comfortable'; /** Determines the `q2-icon` that will display when `rows` has no value. */ emptyIcon: string; /** Determines the message that will display when `rows` has no value. * @localizable */ emptyMessage: string; /** * Defines the headers of the table. * * **Example:** * @snippet * element.headers = [ * { * title: 'Day of the Week', * key: 'day', * }, * { * title: 'Sales', * key: 'sales', * align: 'end', * } * ] * */ headers: Q2DataTableHeader[]; /** Hides the caption from view, but still makes it available to screen readers for accessibility purposes. */ hideCaption: boolean; /** * Visually hides the `Select` button that displays when `clickable=true`. It will still be discoverable by assistive technologies. * * @info * Use of this property requires `clickable` to be set to `true`. */ hideClickable: boolean; /** Displays a loading state on the table to indicate background activity. */ loading: boolean; /** * Defines the rows of the table. * * **Example:** * @snippet * element.rows = [ * { * id: 1, * cells: { * day: 'Monday', * sales: 93 * } * }, * { * id: 2, * cells: { * day: 'Tuesday', * sales: 127 * } * }, * { * id: 3, * cells: { * day: 'Wednesday', * sales: 121 * } * ] */ rows: Q2DataTableRow[]; /** Adds a checkbox to each row of the table making it selectable. */ selectable: boolean; /** * Controls the position of the checkbox column when `selectable` is true. * When set to 'right', the checkbox column will appear on the right side of the table. * * @warning * Use of this property requires `selectable` to be set to `true`. */ selectAlign: 'left' | 'right'; /** * Returns selected rows. * @readonly */ get selectedRows(): Q2DataTableRow[]; set selectedRows(_: Q2DataTableRow[]); /** * Determines if the selectable checkboxes allow for multi-select or not. If set to "single", once a row is selected, all other rows will be disabled. * See the documentation on the `select` event for how to handle selections. * * @warning * Use of this property requires `selectable` to be set to `true`. */ selectMode: 'multiple' | 'single'; /** Adds a shadow to the table */ shadowed: boolean; /** Makes table header sticky */ sticky: boolean; /** Enables alternating background colors for the table rows */ striped: boolean; /** * Emitted when a row is clicked. * * Requires the `clickable` prop to be set to `true`. * * Call `event.preventDefault()` to prevent the default click behavior. * @deprecated Use 'tctClick' instead */ click: EventEmitter<{ row: Q2DataTableSerializedRow; }>; /** * Emitted when a row is selected. * * Requires the `selectable` prop to be set to `true`. * * Call `event.preventDefault()` to prevent the default selection behavior. * @deprecated Use 'tctSelect' instead */ select: EventEmitter<{ row: Q2DataTableSerializedRow; rows: Q2DataTableSerializedRow[]; allSelected: boolean; }>; /** * Emitted when the select-all checkbox is toggled. * * Requires the `selectable` prop to be set to `true` and the `selectMode` prop to be set to `multiple`. * * Call `event.preventDefault()` to prevent the default behavior. * @deprecated Use 'tctSelectAllRows' instead */ selectAllRows: EventEmitter<{ checked: boolean; }>; /** * Emitted when a column is sorted. * * Requires the `sortable` prop to be set to `true` on the column. * * Call `event.preventDefault()` to prevent the default sorting behavior. * @deprecated Use 'tctSort' instead */ sort: EventEmitter<{ header: Q2DataTableHeader; direction: 'ASC' | 'DESC'; }>; /** * Emitted when a row is clicked. * * Requires the `clickable` prop to be set to `true`. * * Call `event.preventDefault()` to prevent the default click behavior. */ tctClick: EventEmitter<{ row: Q2DataTableSerializedRow; }>; /** * Emitted when a row is selected. * * Requires the `selectable` prop to be set to `true`. * * Call `event.preventDefault()` to prevent the default selection behavior. */ tctSelect: EventEmitter<{ row: Q2DataTableSerializedRow; rows: Q2DataTableSerializedRow[]; allSelected: boolean; }>; /** * Emitted when the select-all checkbox is toggled. * * Requires the `selectable` prop to be set to `true` and the `selectMode` prop to be set to `multiple`. * * Call `event.preventDefault()` to prevent the default behavior. */ tctSelectAllRows: EventEmitter<{ checked: boolean; }>; /** * Emitted when a column is sorted. * * Requires the `sortable` prop to be set to `true` on the column. * * Call `event.preventDefault()` to prevent the default sorting behavior. */ tctSort: EventEmitter<{ header: Q2DataTableHeader; direction: 'ASC' | 'DESC'; }>; /** * Emitted when an expandable row is toggled. * * Requires content in the `row-{id}-expandable-content` slot. * * Call `event.preventDefault()` to prevent the default toggling behavior. */ tctToggle: EventEmitter<{ row: Q2DataTableSerializedRow; }>; /** * Emitted when an expandable row is toggled. * * Requires content in the `row-{id}-expandable-content` slot. * * Call `event.preventDefault()` to prevent the default toggling behavior. * @deprecated Use 'tctToggle' instead */ toggle: EventEmitter<{ row: Q2DataTableSerializedRow; }>; disconnectedCallback(): void; componentWillLoad(): void; componentDidLoad(): void; onClickListener(event: MouseEvent): void; onSelectAllRows(event: CustomEvent<{ checked: boolean; }>): void; /** * A method to click a row that accepts a row ID that is will be clicked. * * @testOnly */ clickRow(rowId: number | string): Promise; /** * A method that returns the plain text value of a particular cell (including slot content). * * @testOnly */ getCellContent(rowId: number | string, columnKey: string): Promise; /** * A method to sort a column that accepts a header object with key and sorted property. * * @testOnly */ sortColumn(header: Q2DataTableHeader): Promise; /** * A method to toggle row expansion that accepts a row ID that will be clicked to expand or collapse the expandable content * * @testOnly */ toggleRowExpansion(rowId: number | string): Promise; /** * A method to toggle row selection that accepts a row ID whose checkbox will be checked, if the feature is enabled. * * @testOnly */ toggleRowSelect(rowId: number | string): Promise; /** * A method to toggle select all button (checkbox) on left top corner. * * @testOnly */ toggleSelectAllRows(): Promise; headersHandler(headers?: Q2DataTableHeader[]): void; rowsHandler(rows?: Q2DataTableRow[]): void; selectableHandler(): void; get mappedHeaders(): Record; get numberOfColumns(): number; _badgeColumnContent(cell: Q2DataTableBadgeCell): any; checkSlots: () => void; getSelectRowLabel(row: Q2DataTableSerializedRow): string; onClickRow: (event: MouseEvent, row: Q2DataTableSerializedRow) => void; onClickTableRow: (event: MouseEvent, row: Q2DataTableSerializedRow) => void; onControlContainerClick: (event: MouseEvent) => void; onSelectRow: (event: CustomEvent<{ checked: boolean; }>, row: Q2DataTableSerializedRow) => void; onSort: (header: Q2DataTableHeader) => void; onToggleRow: (event: MouseEvent, row: Q2DataTableSerializedRow) => void; sortRows(rows: Q2DataTableSerializedRow[], header: Q2DataTableHeader): Q2DataTableSerializedRow[]; statusIconType(status: Q2DataTableSerializedRow['status']): string; render(): any; renderCellContent(cell: Q2DataTableCell): any; renderEmptyState(): any; renderTableColGroup(): any; renderTableHeader(): any; renderTableRows(): any; }