import { type DataTableProps } from './data-table.component'; import type { GridColDef } from '@mui/x-data-grid'; import type { ReactNode } from 'react'; import type { ListColumnSort } from '../hooks/use-list-column-sort'; import { type RowActionsMenuItem } from './row-actions-menu.component'; /** * ONE row grammar for every artifact list (AGL-2501). * * * They did. Three of the four are `DataTableComponent`, but each declared its * own column set, its own action arrangement and its own row-click, and the * fourth — screens — is a hand-rolled tree because it has to be: drag to * reorder, expand to nest, no grid can do that. So "the same table" cannot * literally be one component for all four, and pretending otherwise would mean * either losing the hierarchy or bolting a tree onto a grid. * * What IS shared is the row GRAMMAR, and that is what actually differed on * screen. Every artifact row now reads the same way: * * ``` * [ drag · expand ] name id description updated created [ ⇗ ⋮ ] * screens only quick menu * ``` * * - **The row opens the detail view.** Clicking anywhere that is not a control * navigates. It is the primary action on every one of these lists and it was * previously a link buried in one column. * - **Rows are NOT selectable.** The grid lists shipped with selection on, so * a click both navigated AND tinted the row, and the footer counted "1 row * selected" for a selection nothing could act on. A selection with no bulk * action is a state the reader has to dismiss and cannot use. * - **Exactly one quick action, then the menu.** Everything else moves behind * the overflow — a delete sitting inline is one mis-click from the row's own * open handler, which is the argument AGL-701 already made for components and * never carried to the rest. * * The quick action is the one thing worth a direct click on that kind of * artifact: **Open live page** for a screen, **Preview** for anything that has * no address of its own. It is the only per-kind variation in the trailing * cluster, and it is chosen by the caller rather than inferred here. * * A screen is the only artifact of the four with a route the public can reach, * so it is the only one whose quick action says "live". Layouts, components * and templates render inside something else and have no address to open, so * theirs is a **Preview** into the console's own canvas render. * * **A preview or view quick action opens in a NEW TAB** (AGL-3660). It shows * the reader something beside the list, not instead of it, so it must not * take the list's tab — that is `href` (always a new tab) or `to` with * `newTab: true`. `apps/console/specs/preview-links-open-in-new-tab.spec.ts` * holds every eye-icon / Preview / View quick action to it. * * The quick action is ALSO the menu's first entry — see * {@link quickActionMenuItem}. The icon alone is a glyph with a tooltip; the * menu is where every action on the row is spelled out, and an action missing * from it reads as an action the row does not have. */ /** * The single trailing icon beside the overflow menu. * * Three shapes, because the destinations genuinely differ: an EXTERNAL live * page (always a new tab), an IN-APP route (a new tab with `newTab`, which a * preview or view route always sets), and a plain handler for the rare * action that opens a dialog. `unavailableReason` is the fourth state and the * one most easily got wrong — a screen with no single live page (a collection * template renders under routes it does not own) must still show the control, * disabled, saying why. Hiding it would read as the feature being absent. */ export interface ListQuickAction { /** `mdi` icon path. */ icon: string; /** Accessible name; also the tooltip when the action is unavailable. */ label: string; /** A live, external URL — opened in a new tab. */ href?: string; /** An in-app route — a client navigation, or a new tab with `newTab`. */ to?: string; /** * Open `to` in a new tab (AGL-3660). Required on every Preview / View * quick action: the reader is glancing at something beside the list, and * taking the list's tab throws away their place in it. `href` is always a * new tab and does not need it. */ newTab?: boolean; onClick?: () => void; /** * Why this row cannot use the action. Renders it DISABLED with the reason as * its tooltip, rather than removing it — an absent control and an * inapplicable one look identical, and only one of them is honest. */ unavailableReason?: string; } export interface ListRowActionsProps { /** The artifact's name — every control is labelled with it, because these * Repeat once per row and "More actions" alone says nothing about which. */ label: string; quick?: ListQuickAction | null; items: RowActionsMenuItem[]; } /** Whether a quick action's destination opens in a tab of its own. */ export declare function opensInNewTab(quick: ListQuickAction): boolean; /** The trailing cluster: one quick action, then the overflow menu. */ export declare function ListRowActions(props: ListRowActionsProps): import("react").JSX.Element; export declare namespace ListRowActions { var displayName: string; } /** The field `listActionsColumn` draws, which a row click never opens through. */ export declare const LIST_ACTIONS_FIELD = "actions"; /** * The trailing ACTIONS column, identical on every grid list. * * Deliberately NOT MUI's `type: 'actions'`. That type renders each * `GridActionsCellItem` as its own icon and moves the ones marked `showInMenu` * into a menu it owns — which is how the three lists ended up with two, three * and five inline icons respectively, each a different width, and how the * screens table (which cannot use it at all) grew a second implementation. * One `renderCell` gives every list the same cluster and the same width. */ export declare function listActionsColumn(render: (row: any) => ReactNode, options?: { width?: number; }): GridColDef; /** * Row selection, opted into by a list that has something to DO with a * selection (AGL-2595). * * Controlled, and in the caller's vocabulary — an array of `$id`s in, an * array out — rather than MUI's own model. The grid's model is a * `{ type, ids: Set }` whose `exclude` form appears the moment the header * checkbox is ticked, and a caller that had to fold "everything except * these" back into "these" would do it wrong on the page boundary; the * table holds the rows and does the fold once, here. */ export interface ListTableSelection { /** The `$id`s currently selected; ids not in `rows` are ignored. */ selected: readonly string[]; /** Every change, as the full new selection. */ onChange: (ids: string[]) => void; } export interface ListTableProps extends DataTableProps { /** Row click → the artifact's detail view. */ onOpen?: (id: string, row: any) => void; /** * The toolbar's free-text search box. * * Defaults to shown where the GRID answers it, which is client filtering. * Under `filterMode="server"` the grid applies no filter at all and the * model goes to the caller, so the box defaults to hidden: a list whose * handler reads only the column filter would otherwise offer a search that * narrows nothing, which reads as "no match" rather than "not supported". * Pass it on a server-filtered list whose handler reads `quickFilterValues`. */ quickFilter?: boolean; /** * Present → a checkbox column and a controlled selection. Absent → the * navigation-only grid every list had before, checkbox column and all. * The row click keeps opening the record either way: a checkbox is the * only thing that selects, so the two gestures cannot collide. */ selectable?: ListTableSelection; /** * The toolbar, its Filters panel and its search, and none of the rows * (AGL-3327). * * For a list the reader can also see some other way — the media library's * thumbnail grid — that must filter exactly as its table view does. The * panel, the quick search and Export all live inside the grid, bound to * its API, so a second, hand-built toolbar for the other view would be a * second filter UI to keep in step with this one. Instead the grid is * drawn with its body collapsed and no rows: the toolbar stays, and the * panel still opens under it (its anchor is kept, at the top of the * collapsed body). The columns chooser and Export go — there are no * columns on screen to choose, and the rows are the other view's to draw * and to export. */ toolbarOnly?: boolean; /** * The list's header sorts (AGL-3680), from `useListColumnSort`. * * Present, the table draws `columnSort.rows`, sorts nothing itself * (`sortingMode="server"`), and decides every column's `sortable` from it: * a column the hook names sorts — a page-sorted one says so on its header * — and every other column does not. Pass this rather than * `disableColumnSorting`, which `specs/list-tables-sort-by-their-headers` * refuses on any new caller. */ columnSort?: ListColumnSort; /** * The Actions column stays on screen when the table scrolls sideways * (AGL-4047): a table of many columns in a narrow card keeps its row * controls in reach rather than past the right edge. Pinned with CSS, and * column virtualization is off so the column is always drawn. */ pinActions?: boolean; } export declare function ListTable(props: ListTableProps): import("react").JSX.Element; export declare namespace ListTable { var displayName: string; } export default ListTable;