import type { CollectionKey } from "../collection/keys"; import type { useTableNavigation } from "./navigation"; export type TableKey = CollectionKey; import type { ComputedRef, InjectionKey, Ref } from "vue"; import type { tableVariants } from "@heroui-vue/styles"; export type TableSlots = ReturnType; export type TableSortDirection = "ascending" | "descending" | "none"; export interface TableContextValue { columnDefinitions?: Ref<{ id?: string; isRowHeader: boolean }[]>; columns?: Ref< Map >; navigation?: ReturnType; slots: ComputedRef; variant: ComputedRef; selectionMode: ComputedRef<"none" | "single" | "multiple">; selectedKeys: ComputedRef; disabledKeys: ComputedRef; sortDescriptor: ComputedRef<{ column: string; direction: TableSortDirection; } | null>; expandedKeys: ComputedRef; treeColumn: ComputedRef; toggleSelect: (key: TableKey, event?: MouseEvent | KeyboardEvent) => void; toggleExpand: (key: TableKey) => void; isRowSelected: (key: TableKey) => boolean; isRowDisabled: (key: TableKey) => boolean; isRowExpanded: (key: TableKey) => boolean; sort: (column: string) => void; } export const tableContextKey: InjectionKey = Symbol("hv-table"); export interface TableRowContextValue { nextCellIndex: () => number; key: TableKey; isSelected: ComputedRef; isDisabled: ComputedRef; isExpanded: ComputedRef; hasChildItems: boolean; } export const tableRowContextKey: InjectionKey = Symbol("hv-table-row"); export interface TableColumnContextValue { key: ComputedRef; allowsSorting: ComputedRef; sortDirection: ComputedRef; } export const tableColumnContextKey: InjectionKey = Symbol("hv-table-column"); export interface TableColumnWidthContext { minWidth: ComputedRef; maxWidth: ComputedRef; width: ComputedRef; setWidth: (width: number) => void; } export const tableColumnWidthKey: InjectionKey = Symbol("hv-table-column-width");