import { ComponentWrapper, ElementWrapper } from '@cloudscape-design/test-utils-core/dom'; import ButtonWrapper from '../button'; import ButtonDropdownWrapper from '../button-dropdown'; import CollectionPreferencesWrapper from '../collection-preferences'; import PaginationWrapper from '../pagination'; import PropertyFilterWrapper from '../property-filter'; import TextFilterWrapper from '../text-filter'; export default class TableWrapper extends ComponentWrapper { static rootSelector: string; private containerWrapper; private findNativeTable; private findActiveTHead; findHeaderSlot(): ElementWrapper | null; /** * Alias for findHeaderSlot method for compatibility with previous versions * @deprecated */ findHeaderRegion(): ElementWrapper | null; findFooterSlot(): ElementWrapper | null; /** * Returns column header cells from the table's header region. * * By default, returns all leaf-column headers (`scope="col"`). * For tables without column grouping this is equivalent to the previous behavior. * For tables with column grouping this excludes group header cells. * * @param option.groupId When provided, returns only leaf columns belonging to this group * (matched via `data-column-group-id` attribute). */ findColumnHeaders(option?: { groupId?: string; }): Array; /** * Returns the element the user clicks when resizing a column. * * @param columnIndex 1-based index of the column containing the resizer. */ findColumnResizer(columnIndex: number): ElementWrapper | null; /** * Returns a table cell based on given row and column indices. * * @param rowIndex 1-based index of the row of the cell to select. * @param columnIndex 1-based index of the column of the cell to select. */ findBodyCell(rowIndex: number, columnIndex: number): ElementWrapper | null; /** * Returns a table cell counter, if defined, based on given row and column indices. * * @param rowIndex 1-based index of the row of the cell to select. * @param columnIndex 1-based index of the column of the cell to select. */ findBodyCellCounter(rowIndex: number, columnIndex: number): ElementWrapper | null; findRows(): Array; findSelectedRows(): Array; /** * Alias for findEmptySlot method for compatibility with previous versions * @deprecated */ findEmptyRegion(): ElementWrapper | null; findEmptySlot(): ElementWrapper | null; findLoadingText(): ElementWrapper | null; /** * Returns the clickable sorting area of a column header. * * @param colIndex 1-based index of the column. */ findColumnSortingArea(colIndex: number): ElementWrapper | null; /** * Returns the column that is used for ascending sorting. */ findAscSortedColumn(): ElementWrapper | null; /** * Returns the column that is used for descending sorting. */ findDescSortedColumn(): ElementWrapper | null; /** * Returns the per-column sort menu (kebab dropdown) for the column header at the * given index. Only present on tables that opt in to multi-column sorting. * * @param columnIndex 1-based index of the column. */ findColumnSortMenu(columnIndex: number): TableColumnSortMenuWrapper | null; /** * Returns the sort priority badge on the column header at the given index. * The badge is only rendered when two or more columns participate in a * multi-column sort. Returns `null` otherwise. * * @param columnIndex 1-based index of the column. */ findColumnSortPriorityBadge(columnIndex: number): ElementWrapper | null; /** * Returns the "Clear sort" button rendered in the table header tools area. * The button is auto-rendered only when multi-column sorting is enabled and at * least one column is sorted. Returns `null` otherwise. */ findClearSort(): ButtonWrapper | null; /** * Returns a row selection area for a given index. * * @param rowIndex 1-based index of the row selection area to return. */ findRowSelectionArea(rowIndex: number): ElementWrapper | null; findSelectAllTrigger(): ElementWrapper | null; findTextFilter(): TextFilterWrapper | null; findPropertyFilter(): PropertyFilterWrapper | null; findFilterSlot(): ElementWrapper | null; findCollectionPreferences(): CollectionPreferencesWrapper | null; findPagination(): PaginationWrapper | null; /** * Returns the button that activates inline editing for a table cell based on given row and column indices. * * @param rowIndex 1-based index of the row of the cell to select. * @param columnIndex 1-based index of the column of the cell to select. */ findEditCellButton(rowIndex: number, columnIndex: number): ElementWrapper | null; findEditingCell(): ElementWrapper | null; private _findEditingCellControls; findEditingCellSaveButton(): ElementWrapper | null; findEditingCellCancelButton(): ElementWrapper | null; /** * Returns the expandable row toggle button. * * @param rowIndex 1-based index of the row. */ findExpandToggle(rowIndex: number): ElementWrapper | null; /** * Returns `true` if the row expand toggle is present and expanded. Returns `false` otherwise. * * @param rowIndex 1-based index of the row. */ isRowToggled(rowIndex: number): boolean; /** * Returns items loader of the root table level. */ findRootItemsLoader(): null | ElementWrapper; /** * Returns items loader of the specific item (matched by item's track ID). * * @param itemId the (expandable) item ID provided with `trackBy` property. * * Note: when used with collection-hooks the `trackBy` is set automatically from `expandableRows.getId`. */ findItemsLoaderByItemId(itemId: string): null | ElementWrapper; } /** * Wraps the per-column sort menu (kebab dropdown) used by multi-column sorting. * * Extends `ButtonDropdownWrapper` with named finders for each sort action, so * tests don't depend on the dropdown item IDs (an internal implementation * detail). Call `openDropdown()` before using the item finders. */ export declare class TableColumnSortMenuWrapper extends ButtonDropdownWrapper { /** * Returns the "Sort ascending" menu item. * * Supported options: * * `disabled` (boolean) - Use it to find the disabled or non-disabled item. */ findSortAscendingItem(options?: { disabled?: boolean; }): ElementWrapper | null; /** * Returns the "Sort descending" menu item. * * Supported options: * * `disabled` (boolean) - Use it to find the disabled or non-disabled item. */ findSortDescendingItem(options?: { disabled?: boolean; }): ElementWrapper | null; /** * Returns the "Add to sort (ascending)" menu item. * * Supported options: * * `disabled` (boolean) - Use it to find the disabled or non-disabled item. */ findAddToSortAscendingItem(options?: { disabled?: boolean; }): ElementWrapper | null; /** * Returns the "Add to sort (descending)" menu item. * * Supported options: * * `disabled` (boolean) - Use it to find the disabled or non-disabled item. */ findAddToSortDescendingItem(options?: { disabled?: boolean; }): ElementWrapper | null; /** * Returns the "Remove from sort" menu item. * * Supported options: * * `disabled` (boolean) - Use it to find the disabled or non-disabled item. */ findRemoveFromSortItem(options?: { disabled?: boolean; }): ElementWrapper | null; }