import { UiElement } from '../shared/element.js'; import { type TableCellEditor, type TableEditOption, type TableHeaderCellSortDetail, type TableSortCycle, type TableSortDirection } from './defs.js'; /** * Carbon `cds-table-header-cell`: a column header (`role=columnheader`). Sortable (`is-sortable`, or the * table's `is-sortable`), it is a button that steps through `sort-cycle` (default none → ascending → * descending → none) and fires a cancelable `ui-table-header-cell-sort`; the table then sorts its rows. * `aria-sort` follows `sort-direction` (Carbon React; Carbon web components set none). * * Columns (no Carbon counterpart): `column` names the column for events and the column settings (default: its * place); `column-hidden` hides it and its cells (`hideable="false"` keeps it out of the column settings' reach); * `pinned="start"` (first header) / `"end"` (last header) keeps the column in view while the table scrolls * sideways; `resizable` (or the table's) puts a resize handle on its end edge, and `width` / `min-width` / * `max-width` (px) size it. `editable="text|number|select"` lets its cells be edited in place (the table becomes a * grid): `options` lists a select column's choices (a property, or JSON in the attribute), `validate` checks a value. * * @slot - The header's label * @csspart content - The box inside the header that holds its padding * @csspart sort-button - The button of a sortable header * @csspart label-text - The label * @csspart sort-icon - The sort arrow * @csspart resizer - The resize handle (an invisible range input over the end edge) * @fires ui-table-header-cell-sort - cancelable; detail: { oldSortDirection, sortDirection } before the column sorts (`preventDefault()` keeps the rows and this header as they are: sort the data yourself and set `sort-direction`) * @cssprop --ui-table-header-background - Fill of the header (default `--ui-layer-accent`; Kanok: the table's fill) * @cssprop --ui-table-header-ink - Text colour of the header (default `--ui-ink`; Kanok: secondary text) * @cssprop --ui-table-sort-hover / --ui-table-sorted-background / --ui-table-sorted-icon - A sortable header: hover fill, the sorted column's fill and arrow (default layer-selected-hover, icon-primary; Kanok: the header fill, an `--ui-icon-interactive` arrow) */ export declare class UiTableHeaderCell extends UiElement { static readonly shadowRootOptions: { delegatesFocus: boolean; clonable?: boolean; customElementRegistry?: CustomElementRegistry | null; mode: ShadowRootMode; serializable?: boolean; slotAssignment?: SlotAssignmentMode; }; static readonly styles: import("lit").CSSResult[]; /** Sortable on its own (the table's `is-sortable` sets every header). */ isSortable: boolean; /** The column the rows are sorted by (set with the direction). */ sortActive: boolean; /** The states each click steps through. */ sortCycle?: TableSortCycle; /** Sorted ascending, descending or not; a sortable header without one starts at none. */ sortDirection?: TableSortDirection; /** The column's name in events and the column settings (default: its place, "0", "1" …). */ column: string; /** Hidden with its cells (the column settings set it; set it in the markup to start hidden). */ columnHidden: boolean; /** Can be hidden from the column settings (`hideable="false"` keeps it shown). */ hideable: boolean; /** Stays in view while the table scrolls sideways: `start` on the first header, `end` on the last. */ pinned?: 'start' | 'end'; /** A resize handle on its end edge (the table's `resizable` sets every header). */ resizable: boolean; /** The column's width in px (a resize sets it). */ width?: number; /** The narrowest a resize makes it (default 50). */ minWidth?: number; /** The widest a resize makes it (default: the table's width). */ maxWidth?: number; /** Its cells can be edited in place, with this editor (no Carbon counterpart; the table becomes a grid). */ editable?: TableCellEditor; /** A `select` column's choices: the value saved and the label shown (JSON in the attribute). */ options: TableEditOption[]; /** Checks an edited value before it's saved: a message keeps the editor open and shows it. */ validate?: (value: string | number, cell: HTMLElement) => string; private readonly resize; private readonly localize; connectedCallback(): void; protected willUpdate(changed: Map): void; protected updated(changed: Map): void; /** The label as text (the button's title, the screen reader hint, the column settings). */ get labelText(): string; /** The column's key: `column`, else its place among the headers. */ get columnKey(): string; private renderResize; private readonly onSortClick; /** What the next click does, for screen readers (the data table's wording). */ private sortHint; render(): import("lit-html").TemplateResult<1>; } export interface UiTableHeaderCellEventMap extends HTMLElementEventMap { 'ui-table-header-cell-sort': CustomEvent; } /** Typed listeners for UiTableHeaderCell's events (declaration merging with the class). */ export interface UiTableHeaderCell { addEventListener(type: K, listener: (this: UiTableHeaderCell, event: UiTableHeaderCellEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiTableHeaderCell, event: UiTableHeaderCellEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-table-header-cell': UiTableHeaderCell; } }