import { FASTElement } from "@microsoft/fast-element";
import type { SortDirection, TableColumnData, TableRowData } from "./table.options.js";
/**
* Table
* @summary A highly accessible, customizable table component supporting sorting, custom cell rendering, and live region announcements for screen readers.
*
* @example
* ```html
*
*
*
* | Column 1 |
* Column 2 |
*
*
*
*
* | Row 1, Cell 1 |
* Row 1, Cell 2 |
*
*
* | Row 2, Cell 1 |
* Row 2, Cell 2 |
*
*
*
* ```
*
* @attr {boolean} sortable - Whether the table columns are sortable
* @attr {SortDirection} sort-direction - The current sort direction ("ascending" | "descending")
*
* @prop {HTMLTableSectionElement | null} tableHeadRef - Reference to the table head element.
* @prop {HTMLTableSectionElement | null} tableBodyRef - Reference to the table body element.
* @prop {TableRowData[]} rows - The data for the rows of the table.
* @prop {TableColumnData[]} columns - The data for the columns of the table.
* @prop {boolean} tableRendered - Flag indicating if the table has been rendered.
* @prop {SortDirection} sortDirection - The current sort direction of the table.
* @prop {string} activeColumnKey - The key of the currently active (sorted) column.
*
* @slot - Default slot for table content (not directly used, but for consistency)
*
* @csspart head - The table head section
* @csspart body - The table body section
* @csspart cell - The table cell
* @csspart row - The table row
*
* @method renderTable - Renders the complete table by rendering both head and rows.
* @method sortByColumn - Handles column sorting when a column header is clicked.
* @method toggleSortDirection - Toggles the sort direction between ascending and descending.
* @method sortRows - Sorts the table rows based on the active column and sort direction.
*
* @fires {CustomEvent<{direction: SortDirection, columnKey: string}>} sortChanged - Fired when the sort direction or column changes
* @fires {CustomEvent
} tableRendered - Fired when the table rendering is complete
*
* @extends FASTElement
* @tagname fabric-table
* @public
*/
export declare class Table extends FASTElement {
/**
* Reference to the table head element.
* @type {HTMLTableSectionElement | null}
* @observable
*/
tableHeadRef: HTMLTableSectionElement | null;
/**
* Reference to the table body element.
* @type {HTMLTableSectionElement | null}
* @observable
*/
tableBodyRef: HTMLTableSectionElement | null;
/**
* The data for the rows of the table.
* @type {TableRowData[]}
* @observable
*/
rows: TableRowData[];
/**
* The data for the columns of the table.
* @type {TableColumnData[]}
* @observable
*/
columns: TableColumnData[];
/**
* Determines if the table is sortable.
* @type {boolean}
* @attr {boolean}
*/
sortable?: boolean;
/**
* Handler for changes to the sortable attribute.
* @private
*/
sortableChanged(): void;
/**
* Handler for changes to the rows property.
* @private
*/
rowsChanged(): void;
/**
* Handler for changes to the columns property.
* @private
*/
columnsChanged(): void;
/**
* Renders the complete table by rendering both head and rows.
* @public
*/
renderTable(): void;
/**
* Flag indicating if the table has been rendered.
* @type {boolean}
* @observable
*/
tableRendered: boolean;
/**
* Handler for changes to the tableRendered property.
* Emits a tableRendered event when rendering is complete.
* @private
*/
tableRenderedChanged(): void;
/**
* The current sort direction of the table.
* @type {SortDirection}
* @observable
*/
sortDirection: SortDirection;
/**
* Toggles the sort direction between ascending and descending.
* @public
*/
toggleSortDirection(): void;
/**
* The key of the currently active (sorted) column.
* @type {string}
*/
activeColumnKey: string;
/**
* Sorts the table rows based on the active column and sort direction.
* @param {SortDirection} [direction] - The direction to sort ("ascending" | "descending" | undefined). If undefined, uses the current sortDirection.
* @public
*/
sortRows(direction?: SortDirection): void;
private sortAnnouncer;
/**
* Creates and initializes the live region for sort announcements.
* @private
*/
private initializeSortAnnouncer;
/**
* Announces the current sort state to screen readers.
* @param {string} columnLabel - The label of the sorted column.
* @param {SortDirection} direction - The sort direction.
* @private
*/
private announceSortChange;
/**
* Handles column sorting when a column header is clicked.
* @param {Event} event - The click event.
* @param {string} columnKey - The key of the column to sort by.
* @public
*/
sortByColumn(event: Event, columnKey: string): void;
/**
* Creates an SVG icon element from an SVG string.
* @param {typeof UP_ARROW | typeof DOWN_ARROW} icon - The SVG string to convert.
* @returns {HTMLElement} The created SVG element.
* @private
*/
private createSVGIcon;
/**
* Renders a sortable column header with appropriate attributes and event handlers.
* @param {TableColumnData} column - The column data.
* @param {HTMLDivElement} div - The div element within the header cell.
* @param {HTMLTableCellElement} th - The table header cell element.
* @private
*/
private renderSortableColumn;
/**
* Adds focus, blur, click and keyboard event handlers to a header cell.
* @param {HTMLTableCellElement} th - The table header cell element.
* @param {TableColumnData} column - The column data.
* @private
*/
private addHeaderCellEventHandlers;
/**
* Renders the table header section with column headers.
* @private
*/
private renderTableHead;
/**
* Appends content to a destination element.
* @param {object} args - The arguments for appending content.
* @param {HTMLElement} args.dest - The destination element.
* @param {HTMLElement | string | SVGElement} args.content - The content to append.
* @returns {Promise}
* @private
*/
private appendContent;
/**
* Renders custom content for a table cell using render functions.
* @param {object} args - The arguments for rendering custom content.
* @param {TableColumnData} args.column - The column data.
* @param {HTMLElement} args.cell - The table cell element.
* @param {any} args.row - The row data.
* @returns {Promise}
* @private
*/
private renderCustomContent;
/**
* Renders the default text content for a table cell.
* @param {object} args - The arguments for rendering text content.
* @param {TableColumnData} args.column - The column data.
* @param {HTMLElement} args.cell - The table cell element.
* @param {any} args.row - The row data.
* @returns {Promise}
* @private
*/
private renderTextContent;
/**
* Renders a single table row cell.
* @param {object} args - The arguments for rendering a row.
* @param {TableColumnData} args.column - The column data.
* @param {any} args.row - The row data.
* @param {HTMLElement} args.dest - The destination element (table row).
* @returns {Promise}
* @private
*/
private renderRow;
/**
* Renders all rows in the table body.
* @returns {Promise}
* @private
*/
renderTableRows(): Promise;
/**
* Lifecycle method called when the element is connected to the DOM.
* Defines the TableCell custom element and initializes the sort announcer.
* @public
*/
connectedCallback(): void;
/**
* Lifecycle method called when the element is disconnected from the DOM.
* Cleans up the sort announcer.
* @public
*/
disconnectedCallback(): void;
}
//# sourceMappingURL=table.d.ts.map