import { EventEmitter } from "../../stencil-public-runtime"; import { DuetLanguage, DuetMargin, DuetTableBreakpoint, DuetTableStickyDistance, DuetTableVariant, DuetTheme } from "../../common-types"; import { ThemeableComponent } from "../../common/themeable-component"; import { DuetLangObject } from "../../utils/language-utils"; import { DuetActionButtonIconSize } from "../duet-action-button/duet-action-button"; export type DuetEditableTableGroupNames = { id: string; label: DuetLangObject; actionLabel?: DuetLangObject; }[]; export type DuetTableToggleEvent = { component: "duet-editable-table"; sort_order?: number; direction: 1 | -1; index: number; key: string; originalEvent: KeyboardEvent | MouseEvent; }; export type DuetTableMenuEvent = { component: "duet-editable-table"; originalEvent: KeyboardEvent | MouseEvent; }; export type DuetEditableTableActions = { icon: string; color: string; background: string; size: DuetActionButtonIconSize; name: string; map?: string[]; label?: DuetLangObject; }[]; export type DuetEditableTableItemData = { uid: string; item: any; group: string; }; export type DuetEditableTableColumn = { direction: 1 | -1; key: string; index: number; display?: boolean; sort_order?: number; label: DuetLangObject; }; export type DuetEditableTableColumns = DuetEditableTableColumn[]; /** * @slot caption: Inject things into the caption area of the table using this slot * @slot thead_first: Inject things into the thead area of the table before column names using this slot * @slot thead_last: Inject things into the thead area of the table after column names using this slot * @slot tfoot: Inject things into the tfoot area of the table using this slot */ export type DuetEditableTableRows = Record[]; export declare class DuetEditableTable implements ThemeableComponent { private hasHeadSlotFirst; private hasHeadSlotLast; private hasFootSlot; /** * Reference to host HTML element. */ element: HTMLElement; language: DuetLanguage; /** * Duet-table: margin of the component. */ margin: DuetMargin; /** * Duet-table: Style variation of the table. */ variation: DuetTableVariant; /** * Duet-table: Controls whether the table has a sticky header. * Sticky headers are not compatible with breakpoint="none-scrollable". */ sticky: boolean; /** * Duet-table: Adjust the distance from top of the viewport (in pixels) when the * table header becomes sticky. */ stickyDistance: DuetTableStickyDistance; /** * Duet-table: By default the table is responsive - it will be flattened at narrow viewport widths. * This prop controls the breakpoint at which the table should be rendered as a _regular_ table. * Set to "none" to disable the responsive functionality. * Set to "none-scrollable" to disable responsive functionality _and_ allow horizontal scrolling - * this is useful for comparison tables where it's important to maintain column and row layout. */ breakpoint: DuetTableBreakpoint; /** * Define actions for all items in a table * An alternative to inline HTML table. * required for Sortable tables * @default undefined */ actions: DuetEditableTableActions; /** * Define columns for a table * An alternative to inline HTML table. * required for Sortable tables * @default undefined */ columns: DuetEditableTableColumns; /** * Define rows for a table * An alternative to inline HTML table. * required for Sortable tables * @default undefined */ rows: DuetEditableTableRows; /** * Controls whether the table is sortable by headers */ sortable: boolean; /** * Optional id that get passed to the table and used to setup ::parts */ groupId: string; /** * Theme of the table. */ theme: DuetTheme; /** * Exposes the aria role for optimizing accessibility. */ accessibleRole: string; /** * Hide a thead section visually. The content is still available to screen readers. */ hideHeadVisually: boolean; /** * Event emitted when table is sortable and a header item is clicked/enter is pressed */ duetTableToggle: EventEmitter; /** * Event emitted when table is sortable and a header item is clicked/enter is pressed */ duetMenuClick: EventEmitter; private sortableDefaultLabel; private actionColumnLabel; /** * Component lifecycle events. */ componentWillLoad(): void; connectedCallback(): void; disconnectedCallback(): void; /** * Private methods. */ private toggleColumn; private handleKeyDown; private createLabel; private getSortedColumns; private getRowSortOrder; private renderTableHeader; private renderActions; private renderTableBody; /** * Render Methods */ render(): any; }