import { f as ListTargetDropEvent, g as ItemTagKeys, i as ListDropPositions, l as ListReorderEvent, m as ItemTagBehaviour, n as ListCanReorder, s as ListReorderBlocked, t as ListCanDrop, u as ListResolveInternalDrag } from "./list-drop-types-Bye1r3Ub.js"; import { H as ListNativeDragStartEvent, P as ListDragDataTransferWriter, R as ListDragPreviewRenderer, z as ListDragPreviewSourceResolver } from "./tree-component-BE7OEIiH.js"; import { a as ViewStateBase, t as GetViewStateOptions } from "./types-16GC5k1z.js"; import { m as ListSelectKeysDetail, u as ListSelectIntentDetail } from "./list-selection-types-CKTt7Rrw.js"; import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BJ8c6qur.js"; import "./index-Cdcek1Oj.js"; import { S as ListSearchController } from "./index-C3N2TOmf.js"; import "./icon-YIyJDwM9.js"; import "./index-DyWQfh14.js"; import "./pan-text-DKe2zinH.js"; import { LitElement } from "lit"; import { CommandId, CommandRegistry } from "@clinth/ui-commands"; type DataGridSelectionMode = `none` | `single` | `multiple`; type DataGridInteractionMode = `standard` | `implicit` | `manual` | `checked` | `sticky` | `vscode`; type DataGridSortDirection = `asc` | `desc`; type DataGridSortState = { readonly key: string; readonly direction: DataGridSortDirection; } | null; type DataGridDataType = `text` | `number` | `boolean` | `custom`; type DataGridEditorType = `auto` | `select`; type DataGridEditorContext = { readonly row: R; readonly column: DataGridColumn; readonly rowIndex: number; readonly colIndex: number; readonly value: unknown; /** Write `nextValue`, fire `datagrid-cell-edit` and close the editor. */ commit: (nextValue: unknown) => void; /** Record `nextValue` without closing. A popup editor commits it when dismissed by clicking outside. */ update: (nextValue: unknown) => void; /** Close the editor, discarding anything passed to `update`. */ cancel: () => void; }; type DataGridEditorFactory = (ctx: DataGridEditorContext) => unknown; type DataGridColumn = { key: string; label: string; width?: number; minWidth?: number; maxWidth?: number; visible?: boolean; sortable?: boolean; sortFn?: (a: R, b: R) => number; resizable?: boolean; reorderable?: boolean; align?: `left` | `center` | `right`; renderer?: (row: R, col: DataGridColumn, rowIndex: number) => unknown; selectable?: boolean; groupable?: boolean; editable?: boolean; dataType?: DataGridDataType; editor?: DataGridEditorType | DataGridEditorFactory; editorOptions?: ReadonlyArray; /** * Render the `editor` factory's output in a popup anchored to the cell instead of in place. The cell keeps * showing its value (via `renderer` / `formatter`). Clicking outside commits the last `ctx.update` value; * `Escape` cancels. */ editorPopup?: boolean; /** What opens the editor in `user` mode: `default` is a slow double-click, `click` a single click. Popup editors always open on a single click in `immediate` mode. */ editTrigger?: `default` | `click`; formatter?: (value: unknown, row: R, col: DataGridColumn) => unknown; button?: false | true | { icon?: string; }; /** Heading for this column in the built-in column menu; columns sharing a group are listed in one submenu. Ungrouped columns stay at the top level. */ group?: string; /** Pixels added to the measured text width when auto-sizing (e.g. a thumbnail beside the text). Lets a `renderer` column be auto-sized. */ fixedExtraWidth?: number; /** Custom content-width measure (px) for one row, used when auto-sizing. Lets a `renderer` column be auto-sized. */ measure?: (row: R, col: DataGridColumn) => number; }; type GlobalFormatter = (value: unknown, columnName: string, row: unknown) => unknown; /** * Optional appearance fields a row may carry, honoured only in the column * nominated by the matching grid property (`textColorColumn`, `iconColumn`, * `badgeColumn`). Read off the *row*, not off the nominated column's own * value, so one row can tint just one of its cells: * * ```ts * grid.textColorColumn = 'status'; * grid.rows = [{ status: 'failed', statusTextColor: 'crimson' }]; * ``` */ type DataGridRowLook = { /** CSS colour applied to the cell nominated by `textColorColumn`. */ textColor?: string; /** Icon content for the cell nominated by `iconColumn` — anything Lit can render. */ icon?: unknown; /** CSS colour tinting the row's `icon`. */ iconColor?: string; /** Finder-style badge for the cell nominated by `badgeColumn` — anything Lit can render. */ badge?: unknown; }; type DataGridEditability = `disabled` | `manual` | `user` | `immediate`; /** * How cell text that's too long for its column width is handled. * - `ellipsis` (default): CSS truncates with an ellipsis. * - `pan-text`: the cell swaps to an `ixfx-pan-text` (looping pan) while its * row is selected or tickled (hovered / keyboard cursor). */ type DataGridCellOverflow = `ellipsis` | `pan-text`; type BuiltInFormatterName = `fixed` | `percentage` | `integer`; type BuiltInFormatterOptions = { digits?: number; }; /** One replacement for `updateRows()`: the new row object for the row currently at `key`. */ type DataGridRowUpdate = { readonly key: string; readonly row: R; }; type DataGridGetRowKey = (row: R, index: number) => string; type DataGridGroupBy = string | ((row: R) => string); type DataGridGroupLabel = (groupKey: string, rows: readonly unknown[]) => string; /** Whether the data-grid renders its built-in header column/group menu. */ type DataGridColumnMenu = `auto` | `none`; /** * Pure view-state helpers for `ixfx-data-grid`. The grid runs these whenever * its rows or columns change, so state keyed to rows / columns that left the * data goes pending and comes back when those keys reappear. */ /** Saved layout for one column, keyed by column key in {@link DataGridViewState.columns}. */ type DataGridColumnViewState = { readonly width?: number; readonly visible?: boolean; /** Rank among the saved columns (lower is further left). */ readonly order?: number; }; /** * `ixfx-data-grid` view state. `expanded` is keyed by group key; groups * default to open, so a collapsed group is `false`. */ type DataGridViewState = ViewStateBase & { readonly columns?: Readonly>; /** Sorted column + direction; `null` means unsorted. */ readonly sort?: DataGridSortState; /** Group-by column key (`null` = ungrouped). Only recorded when `allowGrouping` is on. */ readonly groupBy?: string | null; }; type DataGridSortDetail = { readonly sort: DataGridSortState; readonly previous: DataGridSortState; }; type DataGridSortEvent = CustomEvent; type DataGridSelectDetail = { readonly selectedKeys: ReadonlySet; readonly previous: ReadonlySet; }; type DataGridSelectEvent = CustomEvent; /** `list-select`: the same event name and key-based detail as the other list-like components. */ type DataGridListSelectDetail = ListSelectKeysDetail & { readonly previous: ReadonlySet; }; type DataGridListSelectEvent = CustomEvent; type DataGridSelectIntentEvent = CustomEvent; type DataGridColumnReorderDetail = { readonly from: number; readonly to: number; readonly columns: readonly DataGridColumn[]; }; type DataGridColumnReorderEvent = CustomEvent; type DataGridColumnResizeDetail = { readonly key: string; readonly width: number; }; type DataGridColumnResizeEvent = CustomEvent; type DataGridColumnVisibilityDetail = { readonly key: string; readonly visible: boolean; }; type DataGridColumnVisibilityEvent = CustomEvent; type DataGridCellClickDetail = { readonly rowKey: string; readonly colKey: string; readonly rowIndex: number; readonly colIndex: number; }; type DataGridCellClickEvent = CustomEvent; type DataGridCellEditDetail = { readonly rowKey: string; readonly colKey: string; readonly oldValue: unknown; readonly newValue: unknown; }; type DataGridCellEditEvent = CustomEvent; type DataGridGroupChangeDetail = { readonly groupBy: DataGridGroupBy | null; }; type DataGridGroupChangeEvent = CustomEvent; type DataGridRowActivateDetail = { readonly rowKey: string; readonly row: unknown; readonly rowIndex: number; }; type DataGridRowActivateEvent = CustomEvent; /** Same shape as the list components' shared `ListViewportChangeDetail`. */ type DataGridViewportChangeDetail = ListViewportChangeDetail; type DataGridViewportChangeEvent = ListViewportChangeEvent; interface DataGridElementEventMap { 'datagrid-sort': DataGridSortEvent; 'datagrid-select': DataGridSelectEvent; 'list-select': DataGridListSelectEvent; 'list-select-intent': DataGridSelectIntentEvent; 'datagrid-column-reorder': DataGridColumnReorderEvent; 'datagrid-column-resize': DataGridColumnResizeEvent; 'datagrid-column-visibility': DataGridColumnVisibilityEvent; 'datagrid-cell-click': DataGridCellClickEvent; 'datagrid-cell-edit': DataGridCellEditEvent; 'datagrid-group-change': DataGridGroupChangeEvent; 'datagrid-row-activate': DataGridRowActivateEvent; 'datagrid-viewport-change': DataGridViewportChangeEvent; 'list-native-drag-start': ListNativeDragStartEvent; 'list-drop': ListTargetDropEvent; 'list-reorder': ListReorderEvent; } declare class DataGridElement extends LitElement { #private; static styles: import("lit").CSSResult[]; columns: DataGridColumn[]; rows: unknown[]; selectionMode: DataGridSelectionMode; interactionMode: DataGridInteractionMode; sortState: DataGridSortState; rowHeight: number; getRowKey: DataGridGetRowKey; checkboxRenderer?: (checked: boolean) => unknown; editable: boolean | ((row: unknown, col: DataGridColumn) => boolean); editability: DataGridEditability; cellOverflow: DataGridCellOverflow; zebraStripes: boolean; /** * Rows rendered beyond the viewport on each side. See `overscanMax` for letting the * window also run ahead of a fast scroll. */ overscan: number; /** * Cap on the rows rendered beyond the viewport. When above `overscan`, the window * runs ahead in the scroll direction in proportion to scroll velocity (up to this cap), * so a fling that outruns the main thread still finds rows rendered. Default `0`: off — * in a headless Chrome fling at 1500 px/frame the lead cost ~1.4 ms render + ~0.7 ms script * per frame and saved nothing while frames weren't being dropped. */ overscanMax: number; /** Turn off the vertical edge-fade mask on the scroller (a masked scroller is re-rasterised as it scrolls). */ noScrollFade: boolean; groupBy: DataGridGroupBy | null; allowGrouping: boolean; groupLabel: DataGridGroupLabel | undefined; /** Columns keys that can be grouped by; undefined = all groupable columns */ groupableColumns: string[] | undefined; crossGroupSelection: boolean; /** * `none` (default): don't render the built-in header column/group menu — hosts can * supply their own column UI via `column.visible` + `datagrid-column-visibility`. * `auto`: opt in to the built-in menu. */ columnMenu: DataGridColumnMenu; globalFormatter?: GlobalFormatter; /** * Key of the column whose cell text takes the row's `textColor` — e.g. a * status column that renders a red "Failed" only on some rows. */ textColorColumn: string; /** * Key of the column that renders the row's `icon` (tinted by `iconColor`). */ iconColumn: string; /** * Key of the column that renders the row's `badge`, right-justified in the * cell after the cell's own value. */ badgeColumn: string; /** * Predicate used by incremental filter-search (and callable directly). Rows * for which it returns `false` are dropped from the flat list — hidden from * view and navigation. */ filterPredicate?: (row: unknown) => boolean; /** * Text a row is matched against by incremental search. Overrides * `searchColumn`; matches against it aren't highlighted, since they can't be * mapped onto a cell. */ rowSearchText?: (row: unknown) => string; /** * Key of the column incremental search matches against, using the cell's * displayed (formatted) text. Default: the first visible column. */ searchColumn: string; /** * Space-separated subset of `navigate select filter` — limits which * incremental-search modes are offered. Unset ⇒ all three; empty ⇒ search * disabled. See `docs/infra-incremental.md`. */ searchModes: string | undefined; /** * Enable native browser drag-and-drop for selectable rows. When true, * selectable rows become draggable and the grid emits * `list-native-drag-start` when a drag begins. */ itemsDraggable: boolean; /** * Rows and the empty space below them accept native drops: `list-drop` fires with the resolved * `ListDropTarget`. (Column reordering is separate: see `DataGridColumn.reorderable`.) */ itemsDroppable: boolean; /** * Which targets a drag can resolve to: onto a row (`on`), into the gap between two rows (`between`), * or both (`both`: the top and bottom quarter of a row mean `between`, the middle half means `on`). */ dropPositions: ListDropPositions; /** * A drag that starts in this grid and ends between its own rows is a **reorder** (`list-reorder`), * not a drop. Implies `items-draggable`, and `between` targets for internal drags. The grid never * reorders `rows` itself — the host owns the order (see `applyListReorder`). Refused while a sort * column is active or rows are grouped (see {@link reorderBlocked}). */ itemsReorderable: boolean; /** Sync gate on every `dragover`, given the resolved target. `false` ⇒ no indicator and no event. */ canDrop: ListCanDrop | undefined; /** Sync gate for internal moves (e.g. nothing may go above a pinned row). */ canReorder: ListCanReorder | undefined; /** * For a host that cancels the browser drag in `list-native-drag-start` and starts an OS drag in its * place: say which row keys a drag carries, so a drop inside the grid is still a `list-reorder`. */ resolveInternalDrag: ListResolveInternalDrag | undefined; /** Why `between` drops are refused (`sorted` / `grouped`), or `undefined` when they work. `on` drops still work. */ get reorderBlocked(): ListReorderBlocked | undefined; /** * Custom drag preview renderer (synchronous). Defaults to the shared * built-in HTML+canvas preview. */ dragPreviewRenderer: ListDragPreviewRenderer | undefined; /** * Write an application payload onto the drag's `DataTransfer` (e.g. a custom * MIME type). Called once per drag, synchronously inside `dragstart`, after a * non-cancelled `list-native-drag-start`. */ writeDataTransfer: ListDragDataTransferWriter | undefined; dragPreviewSource: ListDragPreviewSourceResolver | undefined; /** * Default icon name for column header buttons. Defaults to `ellipsis`. * Individual columns can override with `button: { icon: '...' }`. */ columnButtonIcon: string; private _columnFormatters; private _resizingColKey; private _animatingColKeys; private _selectedKeys; /** Not reactive: `_onScroll` only re-renders when the row window actually moves. */ private _scrollTop; /** Not reactive: columns aren't virtualised, so render never reads it. */ private _scrollLeft; private _viewportH; private _viewportW; private _collapsedGroups; private _editing; private _editingRow; private _lastClick; private _lastClickedCell; private _editValue; private _viewportEl; private _headerRowEl; private _tickled; private _sortedRows; private _flat; private _flatKeys; /** Incremental search (navigate / select / filter). See `docs/infra-incremental.md`. */ readonly search: ListSearchController; /** Command registry carrying this grid's `list.search.*` commands. */ get registry(): CommandRegistry | undefined; private _visibleColumns; private _colOffsets; private _colWidthSum; private _raf; private _drag; connectedCallback(): void; disconnectedCallback(): void; /** * Dispatch a command to this grid — routes through the command registry so * `list.search.*` (and any other registered commands) work. */ dispatch(commandId: CommandId, args?: Record): void; private _onFocusOut; protected firstUpdated(): void; /** * Force a fresh re-measure of the viewport and re-render. Normally * unnecessary — a `ResizeObserver` tracks the viewport automatically — but * gives a consumer an escape hatch to recover if an ancestor's * layout/visibility changes without the observer noticing (matches * `ixfx-grid-list`'s `refreshLayout()`). */ refreshLayout(): void; protected updated(changed: Map): void; protected willUpdate(changed: Map): void; private _getGroupKey; private _rebuildFlat; private _toggleGroup; private _applySort; private _onScroll; private _onHeaderClick; private _onHeaderPointerUp; private _onColButtonClick; private _onRowClick; private _onCheckboxClick; private _onVisibilityToggle; private _beginHeaderDrag; private _onReorderDrag; private _anchorKey; private _scrollRowIntoView; private _getRowForKey; /** The selected row keys (read-only). */ get selectedKeys(): ReadonlySet; private _partialKeys; /** * Rows shown as *partially* selected (a part of the resource is selected): * `[data-partial]`, `.partial` and an accessible description. Independent of * `selectedKeys` — a key in both counts as selected. Replace-on-set; keys * without a row are kept for when the row appears. */ get partialKeys(): ReadonlySet; set partialKeys(keys: Iterable); /** * Caller-assigned tags for a row (`undefined` ⇒ none). Each tag is exposed on * the row as a `tag-` `part` token (`::part(item tag-foo)`) and in * `data-tags` (`[data-tags~="foo"]`); `tagBehaviour` can switch off selection, * focus, drag or search per tag. `index` is the row's position in the sorted * order. Re-read on every render; call {@link refreshTags} after mutating * data the hook reads. */ tags: ((row: unknown, index: number) => readonly string[] | undefined) | undefined; /** Tags by row key, apart from the row data (like {@link partialKeys}): tag name → keys. Merged with the `tags` hook. */ get tagKeys(): ItemTagKeys | undefined; set tagKeys(value: ItemTagKeys | undefined); /** * Interaction flags per tag name: `selectable`, `focusable`, `draggable`, * `searchable` (`false` switches one off; omitted keeps the default). With * several tags the most restrictive wins. Rows stay rendered and keep their * place in layout and scroll. */ get tagBehaviour(): ItemTagBehaviour | undefined; set tagBehaviour(value: ItemTagBehaviour | undefined); /** Re-evaluate tags and re-render (the `tags` hook is read live; this drops cached cursor state). */ refreshTags(): void; /** Replace the selection with these row keys (clamped to known rows). */ set selectedKeys(keys: Iterable); /** * Replace the selection with the given row keys. Unknown keys are dropped; * in a single-select mode only the last surviving key is kept; * `selectionMode="none"` clears. Fires `datagrid-select` with the previous * set when the selection actually changes. */ selectKeys(keys: Iterable): void; /** The row key under the cursor, or `undefined`. */ get tickledKey(): string | undefined; /** Move the cursor to this row key and scroll it into view. */ tickleRow(key: string): void; /** * Append rows without the full O(n log n) rebuild that reassigning `rows` * incurs. `rows` still gets a new array reference (reactivity is preserved), * but the derived arrays are extended over the appended slice only. When a * sort is active the new rows show unsorted for one frame, then a single * coalesced re-sort runs. Scroll position, selection and cursor are kept. */ appendRows(rows: readonly unknown[]): void; /** * Re-render the row with this key without touching `rows` — for a host that * mutated the row object in place (or changed something the cells read from * outside it). Only the rendered window is re-evaluated; a no-op for unknown * keys and for rows outside the window. Changing a sorted / grouped / * filtered value this way doesn't move the row: use {@link updateRows}. */ refreshRow(key: string): void; /** * Replace several rows by key — the batched counterpart of `grid-list`'s * `updateItems`. `entries` is `{ key, row }` pairs or a `Map`. * * Unknown keys and entries whose row is the object already there are * ignored. When a replacement leaves the row's key, position (sort), group * and filter result unchanged — the usual case for metadata arriving for a * row — the derived row model is patched in place, so nothing is re-sorted * or rebuilt. Otherwise the whole batch falls back to a normal `rows` reset. * Selection, cursor and scroll are untouched either way. */ updateRows(entries: Iterable | ReadonlyMap): void; private _replaceSelection; private _toggleSelection; private _rangeSelectTo; private _onKeyDown; private _isEditable; private _isTextEditor; private _isCellEditing; /** A popup editor is open for this cell. */ private _isPopupOpen; private _activateRow; private _startEdit; /** Programmatic: put a single cell in edit mode. Works in manual/user/immediate (no-op if disabled or not editable). */ startEdit(rowKey: string, colKey: string): void; /** Programmatic: put all editable cells of a row in edit mode. */ startRowEdit(rowKey: string): void; stopEdit(): void; setColumnFormatter(columnKey: string, formatter: ((value: unknown) => unknown) | BuiltInFormatterName | null, options?: BuiltInFormatterOptions): void; private _formatValue; /** * Resolve the per-row appearance for the cell at `colKey`, honouring the * nominated columns. Additive — `col.renderer` / `col.formatter` still own * the cell's value; this only decorates it. Returns all-`undefined` for * every cell when nothing is nominated (the common case). */ private _cellLook; private _handleCellSecondClick; private _commitEdit; private _suppressBlurCommit; private _tabToNext; private _commitImmediate; /** * Measure the width a column would need to show its header label and every * row's (formatted) value without truncation, clamped to `minWidth`/`maxWidth`. * Values are measured from their formatted string via canvas `measureText` - * accurate for plain text, an estimate for anything else. */ private _measureAutoWidth; private _autoSizeColumn; /** * Resize a single column, by key, to fit its contents (header label + every * row's formatted value), animating the width change smoothly. Only works * for plain columns, or `renderer` columns that supply `measure` or * `fixedExtraWidth` - otherwise a renderer's output can't be measured * reliably from the raw value, so it's left untouched. Returns `false` (and * does nothing) if the column doesn't exist, isn't resizable, or has an * unmeasurable `renderer`. */ autoSizeColumn(key: string): boolean; private _columnResizeAnimationMs; private _onResizePointerDown; /** * Snapshot selection, cursor, scroll, collapsed groups, column layout, sort * and (with `allowGrouping`) grouping as plain JSON, keyed by row / group / * column key. Includes pending state for keys not currently present. Rows * keyed by index (no `key` / `id` under the default `getRowKey`) are never * recorded. */ getViewState(options?: GetViewStateOptions): DataGridViewState; /** * Apply saved view state. Fields present replace the current ones; row and * column keys that aren't defined yet are applied as they appear (including * rows streamed in with `appendRows()`). */ setViewState(state: Partial): void; clearPendingViewState(): void; getVisibleRange(): { startRow: number; endRow: number; startCol: number; endCol: number; }; /** Row keys currently within the windowed/visible range, in display order. */ renderedKeys(): string[]; private _findFirstVisibleCol; private _findLastVisibleCol; protected render(): import("lit").TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { 'ixfx-data-grid': DataGridElement; } } interface DataGridElement { addEventListener: ((type: K, listener: (this: DataGridElement, event: DataGridElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void); removeEventListener: ((type: K, listener: (this: DataGridElement, event: DataGridElementEventMap[K]) => void, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void); } export { DataGridColumn as A, DataGridInteractionMode as B, DataGridSortEvent as C, DataGridViewState as D, DataGridColumnViewState as E, DataGridEditorFactory as F, DataGridSortState as G, DataGridRowUpdate as H, DataGridEditorType as I, GlobalFormatter as K, DataGridGetRowKey as L, DataGridDataType as M, DataGridEditability as N, BuiltInFormatterName as O, DataGridEditorContext as P, DataGridGroupBy as R, DataGridSortDetail as S, DataGridViewportChangeEvent as T, DataGridSelectionMode as U, DataGridRowLook as V, DataGridSortDirection as W, DataGridRowActivateDetail as _, DataGridColumnReorderDetail as a, DataGridSelectEvent as b, DataGridColumnResizeEvent as c, DataGridElement as d, DataGridElementEventMap as f, DataGridListSelectEvent as g, DataGridListSelectDetail as h, DataGridCellEditEvent as i, DataGridColumnMenu as j, BuiltInFormatterOptions as k, DataGridColumnVisibilityDetail as l, DataGridGroupChangeEvent as m, DataGridCellClickEvent as n, DataGridColumnReorderEvent as o, DataGridGroupChangeDetail as p, DataGridCellEditDetail as r, DataGridColumnResizeDetail as s, DataGridCellClickDetail as t, DataGridColumnVisibilityEvent as u, DataGridRowActivateEvent as v, DataGridViewportChangeDetail as w, DataGridSelectIntentEvent as x, DataGridSelectDetail as y, DataGridGroupLabel as z };