import type { Checkbox } from '../checkbox'; import type { MenuButton } from '../menu-button'; import type { TableColumn } from '../table-column/base'; import type { ValidityObject } from '../utilities/models/validator'; import type { TableCell } from './components/cell'; /** * TableFieldName describes the type associated with keys within * a table's records. */ export type TableFieldName = string; /** * TableFieldValue describes the type associated with values within * a table's records. */ export type TableFieldValue = string | number | boolean | null | undefined; /** * TableStringFieldValue describes the type associated with values within * a table's string records. */ export type TableStringFieldValue = string | null | undefined; /** * TableBooleanFieldValue describes the type associated with values within * a table's boolean records. */ export type TableBooleanFieldValue = boolean | null | undefined; /** * TableNumberFieldValue describes the type associated with values within * a table's number records. */ export type TableNumberFieldValue = number | null | undefined; /** * TableRecord describes the data structure that backs a single row in a table. * It is made up of fields, which are key/value pairs that have a key of type * TableFieldName and a value of type TableFieldValue. */ export interface TableRecord { [key: TableFieldName]: TableFieldValue; } /** * @internal * * Describes a hierarchical data structure that is used for * the internal representation of the data, and allows us to represent data with * parent-child relationships within Tanstack. */ export interface TableNode { subRows?: TableNode[]; originalIndex: number; clientRecord: TRecord; } export type TableStringField = { [name in FieldName]: TableStringFieldValue; }; export type TableBooleanField = { [name in FieldName]: TableBooleanFieldValue; }; export type TableNumberField = { [name in FieldName]: TableNumberFieldValue; }; export interface TableValidity extends ValidityObject { readonly duplicateRecordId: boolean; readonly missingRecordId: boolean; readonly invalidRecordId: boolean; readonly duplicateColumnId: boolean; readonly missingColumnId: boolean; readonly duplicateSortIndex: boolean; readonly duplicateGroupIndex: boolean; readonly idFieldNameNotConfigured: boolean; readonly invalidColumnConfiguration: boolean; readonly invalidParentIdConfiguration: boolean; } /** * The hierarachy options for a record in the table. */ export interface TableSetRecordHierarchyOptions { recordId: string; options: TableRecordHierarchyOptions; } /** * Describes the hierarchy options that can be configured for a record in the table. */ export interface TableRecordHierarchyOptions { delayedHierarchyState: TableRecordDelayedHierarchyState; } export declare const TableRecordDelayedHierarchyState: { readonly none: undefined; readonly canLoadChildren: "can-load-children"; readonly loadingChildren: "loading-children"; }; export type TableRecordDelayedHierarchyState = (typeof TableRecordDelayedHierarchyState)[keyof typeof TableRecordDelayedHierarchyState]; export interface TableActionMenuToggleEventDetail { newState: boolean; oldState: boolean; recordIds: string[]; operatingRecordId: string; columnId?: string; } /** * The possible directions a table column can be sorted in. */ export declare const TableColumnSortDirection: { readonly none: undefined; readonly ascending: "ascending"; readonly descending: "descending"; }; export type TableColumnSortDirection = (typeof TableColumnSortDirection)[keyof typeof TableColumnSortDirection]; /** * The selection modes of rows in the table. */ export declare const TableRowSelectionMode: { readonly none: undefined; readonly single: "single"; readonly multiple: "multiple"; }; export type TableRowSelectionMode = (typeof TableRowSelectionMode)[keyof typeof TableRowSelectionMode]; /** * @internal * * The possible selection states that the table or a table row can be in. */ export declare const TableRowSelectionState: { readonly notSelected: "not-selected"; readonly selected: "selected"; readonly partiallySelected: "partially-selected"; }; export type TableRowSelectionState = (typeof TableRowSelectionState)[keyof typeof TableRowSelectionState]; /** * @internal * * Internal event detail type for a row's selection state changing */ export interface TableRowSelectionToggleEventDetail { oldState: boolean; newState: boolean; } /** * Event detail type for row selection events in the table. */ export interface TableRowSelectionEventDetail { selectedRecordIds: string[]; } /** * Event detail type for row toggle events in the table. */ export interface TableRowExpansionToggleEventDetail { oldState: boolean; newState: boolean; recordId: string; } /** * Event detail type for interactive column configuration changes. * * The column-configuration-change event is emitted when a column's configuration * is modified programmatically, such as by clicking on the column's header to sort * the column. The items in the `columns` array are specified in the same order as * the columns are listed in the DOM. */ export interface TableColumnConfigurationChangeEventDetail { columns: TableColumnConfiguration[]; } /** * A representation of the current configuration of a column within the table. */ export interface TableColumnConfiguration { columnId?: string; sortIndex?: number; sortDirection: TableColumnSortDirection; groupIndex?: number; hidden: boolean; fractionalWidth: number; pixelWidth?: number; } /** * @internal * * Internal representation of a row in the table */ export interface TableRowState { record: TData; id: string; selectionState: TableRowSelectionState; isGroupRow: boolean; groupRowValue?: unknown; isExpanded: boolean; nestingLevel?: number; immediateChildCount?: number; groupColumn?: TableColumn; isParentRow: boolean; isLoadingChildren: boolean; requestedSlots: SlotMetadata[]; resolvedRowIndex?: number; } /** * @internal * * Alignment of column content */ export declare const TableColumnAlignment: { readonly left: "left"; readonly right: "right"; }; export type TableColumnAlignment = (typeof TableColumnAlignment)[keyof typeof TableColumnAlignment]; /** * Table keyboard focus types */ export declare const TableFocusType: { readonly none: "none"; readonly columnHeader: "columnHeader"; readonly headerActions: "headerActions"; readonly row: "row"; readonly rowSelectionCheckbox: "rowSelectionCheckbox"; readonly cell: "cell"; readonly cellActionMenu: "cellActionMenu"; readonly cellContent: "cellContent"; }; export type TableFocusType = (typeof TableFocusType)[keyof typeof TableFocusType]; /** * @internal * * Focusable elements of a table row */ export interface TableRowFocusableElements { selectionCheckbox?: Checkbox; cells: { cell: TableCell; actionMenuButton?: MenuButton; }[]; } /** * Focusable elements of a table's header */ export interface TableHeaderFocusableElements { headerActions: HTMLElement[]; columnHeaders: HTMLElement[]; } /** * @internal */ export interface CellViewSlotRequestEventDetail { slots: SlotMetadata[]; } /** * @internal */ export interface RowSlotRequestEventDetail { columnInternalId: string; recordId: string; slots: SlotMetadata[]; } /** * @internal */ export interface SlotMetadata { slot: string; name: string; }