@lincyaw/aegis-ui 0.19.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/AnchoredPopover.cjs +1 -1
- package/dist/components/ui/AnchoredPopover.cjs.map +1 -1
- package/dist/components/ui/AnchoredPopover.d.ts +7 -1
- package/dist/components/ui/AnchoredPopover.js +64 -62
- package/dist/components/ui/AnchoredPopover.js.map +1 -1
- package/dist/components/ui/DataTable.cjs +1 -1
- package/dist/components/ui/DataTable.cjs.map +1 -1
- package/dist/components/ui/DataTable.d.ts +11 -1
- package/dist/components/ui/DataTable.js +78 -74
- package/dist/components/ui/DataTable.js.map +1 -1
- package/dist/components/ui/DetailBeside.cjs +1 -1
- package/dist/components/ui/DetailBeside.cjs.map +1 -1
- package/dist/components/ui/DetailBeside.d.ts +9 -4
- package/dist/components/ui/DetailBeside.js +91 -77
- package/dist/components/ui/DetailBeside.js.map +1 -1
- package/dist/components/ui/IdentityCell.cjs +1 -1
- package/dist/components/ui/IdentityCell.cjs.map +1 -1
- package/dist/components/ui/IdentityCell.d.ts +6 -1
- package/dist/components/ui/IdentityCell.js +17 -15
- package/dist/components/ui/IdentityCell.js.map +1 -1
- package/dist/components/ui/PaneLayout.cjs +1 -1
- package/dist/components/ui/PaneLayout.cjs.map +1 -1
- package/dist/components/ui/PaneLayout.d.ts +7 -2
- package/dist/components/ui/PaneLayout.js +20 -22
- package/dist/components/ui/PaneLayout.js.map +1 -1
- package/dist/components/ui/Select.cjs +1 -1
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.d.ts +8 -2
- package/dist/components/ui/Select.js +44 -38
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/components/ui/TimeDisplay.cjs +1 -1
- package/dist/components/ui/TimeDisplay.cjs.map +1 -1
- package/dist/components/ui/TimeDisplay.d.ts +11 -3
- package/dist/components/ui/TimeDisplay.js +39 -34
- package/dist/components/ui/TimeDisplay.js.map +1 -1
- package/dist/components/ui/Timeline.cjs +1 -1
- package/dist/components/ui/Timeline.cjs.map +1 -1
- package/dist/components/ui/Timeline.d.ts +17 -4
- package/dist/components/ui/Timeline.js +88 -67
- package/dist/components/ui/Timeline.js.map +1 -1
- package/dist/components/ui/Toolbar.cjs.map +1 -1
- package/dist/components/ui/Toolbar.d.ts +2 -1
- package/dist/components/ui/Toolbar.js.map +1 -1
- package/dist/components/ui/TraceTree.cjs +1 -1
- package/dist/components/ui/TraceTree.cjs.map +1 -1
- package/dist/components/ui/TraceTree.d.ts +7 -1
- package/dist/components/ui/TraceTree.js +127 -119
- package/dist/components/ui/TraceTree.js.map +1 -1
- package/dist/components/ui/linkComponent.cjs +1 -1
- package/dist/components/ui/linkComponent.cjs.map +1 -1
- package/dist/components/ui/linkComponent.d.ts +6 -4
- package/dist/components/ui/linkComponent.js +12 -10
- package/dist/components/ui/linkComponent.js.map +1 -1
- package/dist/layouts/shell/AegisShell.cjs +1 -1
- package/dist/layouts/shell/AegisShell.cjs.map +1 -1
- package/dist/layouts/shell/AegisShell.js +24 -24
- package/dist/layouts/shell/AegisShell.js.map +1 -1
- package/dist/layouts/shell/RouterLink.cjs +1 -1
- package/dist/layouts/shell/RouterLink.cjs.map +1 -1
- package/dist/layouts/shell/RouterLink.js +14 -12
- package/dist/layouts/shell/RouterLink.js.map +1 -1
- package/dist/layouts/shell/types.d.ts +6 -0
- package/dist/locale/strings.cjs +1 -1
- package/dist/locale/strings.cjs.map +1 -1
- package/dist/locale/strings.d.ts +2 -0
- package/dist/locale/strings.js +7 -5
- package/dist/locale/strings.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","sources":["../../../src/components/ui/DataTable.tsx"],"sourcesContent":["import {\n type CSSProperties,\n Fragment,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useContext,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { RightOutlined } from '@ant-design/icons';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useDevelopAfterLoad } from '../../hooks/useDevelopAfterLoad';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { useStrings } from '../../locale';\nimport { Checkbox } from './Checkbox';\nimport './DataTable.css';\nimport { EmptyState } from './EmptyState';\nimport { Pagination, type PaginationProps } from './Pagination';\nimport { Skeleton, SkeletonText } from './Skeleton';\nimport { SelectedRowDetailContext } from './selectedRowDetail';\nimport { useColumnWidths } from './useColumnWidths';\n\nexport type DataTableSurface<T> = PrimitiveSurface<T[]>;\n\n/** Background wash of one cell, e.g. a step on a pass-rate scale. */\nexport interface DataTableCellTone {\n tone: 'success' | 'info' | 'caution' | 'warning';\n /**\n * 1 (default) is the tone's soft background; each step up mixes in more\n * of the tone's accent, to 5.\n */\n step?: 1 | 2 | 3 | 4 | 5;\n}\n\nexport interface DataTableColumn<T> {\n key: string;\n header: ReactNode;\n /** Initial column width. Number → px, string → as-is (e.g. '20%'). */\n width?: number | string;\n /** Minimum width during resize / when content squeezes. Default 60px. */\n minWidth?: number;\n /** Maximum width during resize. */\n maxWidth?: number;\n align?: 'left' | 'center' | 'right';\n /**\n * Whether the cell should ellipsis-truncate long content. Default true.\n * Set false for action cells, chip rows, links and other focusable content\n * (the clip cuts off their focus ring), or anything with non-text content\n * that should keep its natural width without being clipped.\n */\n truncate?: boolean;\n /**\n * Gives the header a resize handle on its right edge, dragged with the\n * pointer or moved with the arrow keys. Default false.\n */\n resizable?: boolean;\n /**\n * `'actions'` lays the cell out as a right-aligned, gapped, wrapping row of\n * controls — return them straight from `render`. Overrides `align` and\n * `truncate`.\n */\n kind?: 'actions';\n /**\n * Number column: header and cells right-aligned, figures in\n * `--font-numeric` with tabular widths so digits and decimal points line\n * up. Overrides `align`.\n */\n numeric?: boolean;\n /** Washes a cell's background in a tone. Table rows only, not mobile cards. */\n cellTone?: (row: T, index: number) => DataTableCellTone | undefined;\n /**\n * Makes the header a sort control. With `sortValue` the table orders\n * the rows itself; without it the host orders `data` (for instance the\n * server, from a URL parameter) and the header only shows the state.\n */\n sortable?: boolean;\n /** The value the table sorts this column by; `null` sorts last either way. */\n sortValue?: (row: T) => number | string | null;\n /** The direction of a first click. Defaults to `desc` for numeric columns, `asc` otherwise. */\n firstSortDirection?: DataTableSortDirection;\n render: (row: T, index: number) => ReactNode;\n}\n\nexport type DataTableSortDirection = 'asc' | 'desc';\n\nexport interface DataTableSort {\n key: string;\n direction: DataTableSortDirection;\n}\n\n/**\n * Server-side pagination: `data` is the current page, never sliced here.\n * The table supplies the page's row count and disables the pager while\n * loading.\n */\nexport type DataTablePagination = Pick<\n PaginationProps,\n 'page' | 'pageSize' | 'total' | 'onChange' | 'pageSizeOptions'\n>;\n\ninterface DataTableProps<T> {\n columns: Array<DataTableColumn<T>>;\n data: T[];\n rowKey: (row: T, index: number) => string | number;\n /** The table's accessible name. */\n ariaLabel?: string;\n /** Draws skeleton rows, and marks the table busy. */\n loading?: boolean;\n emptyTitle?: string;\n emptyDescription?: string;\n emptyAction?: ReactNode;\n className?: string;\n /**\n * Draws the table as its own card: `--radius-lg`, hairline border and\n * resting shadow, with the header flush with the top and clipped by the\n * radius. Default true. Pass false where a container already frames the\n * table, e.g. a titled `Panel padded={false}`, a dialog or an expanded row.\n */\n framed?: boolean;\n /**\n * When set, resized column widths are persisted to localStorage under\n * `aegis-data-table:<persistKey>`. Use a stable key per table.\n */\n persistKey?: string;\n /** Renders a footer with page navigation under the table. */\n pagination?: DataTablePagination;\n /** Adds a leading checkbox column and drives `selectedKeys`. */\n selectable?: boolean;\n /**\n * The selected rows: `aria-selected` and drawn selected. Without\n * `selectable` there is no checkbox column, e.g. for the row whose\n * details show beside the table.\n */\n selectedKeys?: Array<string | number>;\n onSelectedKeysChange?: (keys: Array<string | number>) => void;\n /**\n * Makes rows expandable: a leading column of chevron toggles, and this\n * content full-width under each expanded row.\n */\n renderExpanded?: (row: T, index: number) => ReactNode;\n /** Controlled expanded row keys. Omit to let the table track them. */\n expandedKeys?: Array<string | number>;\n /** Rows expanded on mount when `expandedKeys` is omitted. */\n defaultExpandedKeys?: Array<string | number>;\n onExpandedKeysChange?: (keys: Array<string | number>) => void;\n /**\n * At ≤768 px, renders each row through this instead of the columns, as a\n * stacked list with no sideways scroll. Selection, expansion, row clicks,\n * loading, empty state and pagination keep working.\n */\n renderMobileCard?: (row: T, index: number) => ReactNode;\n /**\n * Makes rows clickable: pointer cursor, a muted hover background, a\n * trailing chevron, and Enter on a focused row. Links, buttons and form\n * controls inside a cell keep their own behaviour.\n */\n onRowClick?: (row: T, index: number) => void;\n /**\n * Keeps the first column (with the selection and expansion columns) in\n * view while the other columns scroll sideways. The first column takes\n * at most 40% of the table's visible width, truncating past it.\n */\n stickyFirstColumn?: boolean;\n /**\n * The rows are out of date, e.g. the previous page while the next one\n * loads: they stay in place, dimmed, and the table is marked busy.\n */\n stale?: boolean;\n /**\n * The sorted column and direction. Omit to let the table track it,\n * starting from `defaultSort`. Row indices passed to `render`,\n * `cellTone` and the other callbacks count in the sorted order.\n */\n sort?: DataTableSort | null;\n defaultSort?: DataTableSort;\n /** Called with the sort a header click asks for. */\n onSortChange?: (sort: DataTableSort) => void;\n surface?: DataTableSurface<T>;\n}\n\nconst SELECTION_WIDTH = 44;\nconst TOGGLE_WIDTH = 32;\nconst CHEVRON_WIDTH = 40;\n/** The widest a pinned first column renders; DataTable.css sets the share. */\nconst PINNED_MAX = 'var(--aegis-data-table-pinned-max)';\nconst MOBILE_QUERY = '(max-width: 768px)';\nconst CONTROL_SELECTOR =\n 'a, button, input, select, textarea, label, [role=\"button\"], [role=\"link\"], [role=\"checkbox\"]';\n\n/** True when the click belongs to a control inside the row, or ends a text selection. */\nfunction isOwnedByControl(event: MouseEvent<HTMLElement>): boolean {\n if (window.getSelection()?.type === 'Range') {\n return true;\n }\n const target = event.target;\n if (!(target instanceof Element)) {\n return false;\n }\n const control = target.closest(CONTROL_SELECTOR);\n return control !== null && event.currentTarget.contains(control);\n}\n\n/**\n * The rows ordered by `column`'s sort value, ties and nulls (last in\n * either direction) keeping their order; unchanged when the column has no\n * sort value, because then the host ordered them.\n */\nfunction sortRows<T>(\n data: T[],\n column: DataTableColumn<T> | undefined,\n direction: DataTableSortDirection,\n): T[] {\n const value = column?.sortValue;\n if (!value) {\n return data;\n }\n const sign = direction === 'asc' ? 1 : -1;\n return data\n .map((row, index) => {\n const v = value(row);\n return { row, index, v: typeof v === 'number' && isNaN(v) ? null : v };\n })\n .sort((a, b) => {\n if (a.v === null || b.v === null) {\n return a.v === b.v ? a.index - b.index : a.v === null ? 1 : -1;\n }\n const order =\n typeof a.v === 'number' && typeof b.v === 'number'\n ? a.v - b.v\n : String(a.v).localeCompare(String(b.v));\n return order === 0 ? a.index - b.index : order * sign;\n })\n .map((entry) => entry.row);\n}\n\nfunction SortIcon({\n direction,\n}: {\n direction: DataTableSortDirection | null;\n}): ReactNode {\n return (\n <svg\n className=\"aegis-data-table__sort-icon\"\n viewBox=\"0 0 12 12\"\n aria-hidden=\"true\"\n >\n <path\n className={\n direction === 'asc' ? 'aegis-data-table__sort-mark--on' : undefined\n }\n d=\"M3.5 5L6 2.5 8.5 5\"\n />\n <path\n className={\n direction === 'desc' ? 'aegis-data-table__sort-mark--on' : undefined\n }\n d=\"M3.5 7L6 9.5 8.5 7\"\n />\n </svg>\n );\n}\n\nexport function DataTable<T>({\n columns,\n data,\n rowKey,\n ariaLabel,\n loading = false,\n emptyTitle,\n emptyDescription,\n emptyAction,\n className,\n framed = true,\n persistKey,\n pagination,\n selectable = false,\n selectedKeys,\n onSelectedKeysChange,\n renderExpanded,\n expandedKeys,\n defaultExpandedKeys,\n onExpandedKeysChange,\n renderMobileCard,\n onRowClick,\n stickyFirstColumn = false,\n stale = false,\n sort,\n defaultSort,\n onSortChange,\n surface,\n}: DataTableProps<T>) {\n const strings = useStrings();\n const isMobile = useMediaQuery(MOBILE_QUERY);\n const detailIdPrefix = useId();\n const cardMode = renderMobileCard !== undefined && isMobile;\n const develop = useDevelopAfterLoad(loading);\n\n const [uncontrolledSort, setUncontrolledSort] =\n useState<DataTableSort | null>(defaultSort ?? null);\n const activeSort = sort === undefined ? uncontrolledSort : sort;\n const sortColumn = columns.find((col) => col.key === activeSort?.key);\n const rows = useMemo(\n () => sortRows(data, sortColumn, activeSort?.direction ?? 'asc'),\n [data, sortColumn, activeSort?.direction],\n );\n const requestSort = (col: DataTableColumn<T>): void => {\n const first: DataTableSortDirection =\n col.firstSortDirection ?? (col.numeric ? 'desc' : 'asc');\n const next: DataTableSort = {\n key: col.key,\n direction:\n activeSort?.key === col.key\n ? activeSort.direction === 'asc'\n ? 'desc'\n : 'asc'\n : first,\n };\n if (sort === undefined) {\n setUncontrolledSort(next);\n }\n onSortChange?.(next);\n };\n\n const selected = selectedKeys ?? [];\n const keys = rows.map((row, index) => rowKey(row, index));\n const selection = useContext(SelectedRowDetailContext);\n // A DetailBeside follows the first selected row on the page.\n const detailKey = keys.find((key) => selected.includes(key));\n const selectedCount = keys.filter((key) => selected.includes(key)).length;\n const toggleRow = (key: string | number, checked: boolean): void => {\n onSelectedKeysChange?.(\n checked ? [...selected, key] : selected.filter((item) => item !== key),\n );\n };\n // Selections on other pages survive toggling the rows of this page.\n const togglePage = (checked: boolean): void => {\n const others = selected.filter((key) => !keys.includes(key));\n onSelectedKeysChange?.(checked ? [...others, ...keys] : others);\n };\n const selectionCell = (\n checked: boolean,\n onToggle: (next: boolean) => void,\n ) => (\n <Checkbox\n checked={checked}\n onChange={onToggle}\n ariaLabel={strings.selectRow}\n />\n );\n\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState<\n Array<string | number>\n >(defaultExpandedKeys ?? []);\n const expanded = expandedKeys ?? uncontrolledExpanded;\n // A row's detail mounts the first time it opens and stays mounted, so\n // collapsing can animate instead of dropping the content at once.\n const [visited, setVisited] = useState(expanded);\n const unvisited = expanded.filter((key) => !visited.includes(key));\n if (unvisited.length > 0) {\n setVisited([...visited, ...unvisited]);\n }\n const toggleExpanded = (key: string | number): void => {\n const next = expanded.includes(key)\n ? expanded.filter((item) => item !== key)\n : [...expanded, key];\n if (expandedKeys === undefined) {\n setUncontrolledExpanded(next);\n }\n onExpandedKeysChange?.(next);\n };\n\n const tableRef = useRef<HTMLTableElement>(null);\n const wrapRef = useRef<HTMLDivElement>(null);\n\n const agentAttrs = usePrimitiveSurface(surface, data, 'table', wrapRef);\n const expandable = renderExpanded !== undefined;\n const clickable = onRowClick !== undefined;\n const leadWidth =\n (selectable ? SELECTION_WIDTH : 0) + (expandable ? TOGGLE_WIDTH : 0);\n const trailWidth = clickable ? CHEVRON_WIDTH : 0;\n const sticky = stickyFirstColumn && !cardMode;\n\n const columnWidths = useColumnWidths({\n columns,\n persistKey,\n leadWidth,\n trailWidth,\n firstColumnMax: sticky ? PINNED_MAX : undefined,\n tableRef,\n });\n\n const cls = [\n 'aegis-data-table',\n framed ? 'aegis-data-table--framed' : '',\n stale ? 'aegis-data-table--stale' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n const fixedLayout = columnWidths.sized && !cardMode;\n const filler = fixedLayout && columnWidths.fillerStyle !== undefined;\n const bodyColumnCount =\n (cardMode ? 1 : columns.length) + (filler ? 1 : 0) + (clickable ? 1 : 0);\n const columnCount =\n bodyColumnCount + (selectable ? 1 : 0) + (expandable ? 1 : 0);\n const toggleLeft = selectable ? SELECTION_WIDTH : 0;\n\n /** Props of a leading selection or toggle cell, fixed in width so the sticky offsets line up. */\n const leadCellProps = (lead: 'select' | 'toggle', cell: 'th' | 'td') => ({\n className: [\n `aegis-data-table__${cell}`,\n `aegis-data-table__${lead}-cell`,\n sticky ? `aegis-data-table__${cell}--sticky` : '',\n ]\n .filter(Boolean)\n .join(' '),\n style: {\n width: lead === 'select' ? SELECTION_WIDTH : TOGGLE_WIDTH,\n left: sticky ? (lead === 'select' ? 0 : toggleLeft) : undefined,\n },\n });\n\n /** Classes of a header or body cell of data column `colIndex`. */\n const cellClass = (\n cell: 'th' | 'td',\n colIndex: number,\n tone?: DataTableCellTone,\n ): string => {\n const block = `aegis-data-table__${cell}`;\n const classes = [block];\n if (sticky && colIndex === 0) {\n classes.push(`${block}--sticky`, `${block}--pinned`);\n }\n if (tone !== undefined) {\n classes.push(\n 'aegis-data-table__td--tone',\n `aegis-data-table__td--tone-${tone.tone}`,\n );\n if (tone.step !== undefined && tone.step > 1) {\n classes.push(`aegis-data-table__td--step-${String(tone.step)}`);\n }\n }\n return classes.join(' ');\n };\n\n const columnAlign = (col: DataTableColumn<T>) =>\n col.kind === 'actions' || col.numeric === true\n ? 'right'\n : (col.align ?? 'left');\n\n const cellStyle = (\n col: DataTableColumn<T>,\n colIndex: number,\n ): CSSProperties => ({\n textAlign: columnAlign(col),\n left: sticky && colIndex === 0 ? leadWidth : undefined,\n });\n\n const renderCellContent = (col: DataTableColumn<T>, node: ReactNode) => {\n const classes = [\n 'aegis-data-table__cell',\n `aegis-data-table__cell--${columnAlign(col)}`,\n ];\n if (col.numeric) {\n classes.push('aegis-data-table__cell--numeric');\n }\n if (col.kind === 'actions') {\n classes.push('aegis-data-table__cell--actions');\n } else if (col.truncate ?? true) {\n classes.push('aegis-data-table__cell--truncate');\n }\n return <div className={classes.join(' ')}>{node}</div>;\n };\n\n const renderRowCells = (row: T, idx: number) =>\n cardMode ? (\n <td className=\"aegis-data-table__td aegis-data-table__card-cell\">\n {renderMobileCard(row, idx)}\n </td>\n ) : (\n columns.map((col, colIndex) => (\n <td\n key={col.key}\n className={cellClass('td', colIndex, col.cellTone?.(row, idx))}\n style={cellStyle(col, colIndex)}\n >\n {renderCellContent(col, col.render(row, idx))}\n </td>\n ))\n );\n\n const renderSkeletonCells = () =>\n cardMode ? (\n <td className=\"aegis-data-table__td aegis-data-table__card-cell\">\n <SkeletonText lines={2} />\n </td>\n ) : (\n columns.map((col, colIndex) => (\n <td\n key={col.key}\n className={cellClass('td', colIndex)}\n style={cellStyle(col, colIndex)}\n >\n {renderCellContent(\n col,\n <Skeleton width=\"80%\" height=\"var(--space-3)\" />,\n )}\n </td>\n ))\n );\n\n const fillerCell = filler && (\n <td className=\"aegis-data-table__td aegis-data-table__filler\" aria-hidden />\n );\n\n // The row itself takes the click, so the chevron column is not read.\n const chevronCell = clickable && (\n <td\n className=\"aegis-data-table__td aegis-data-table__chevron-cell\"\n aria-hidden\n >\n <RightOutlined className=\"aegis-data-table__chevron\" aria-hidden />\n </td>\n );\n\n const renderToggle = (key: string | number, detailId: string) => {\n const open = expanded.includes(key);\n return (\n <button\n type=\"button\"\n className=\"aegis-data-table__toggle\"\n aria-expanded={open}\n aria-controls={detailId}\n aria-label={open ? strings.collapseRow : strings.expandRow}\n onClick={() => {\n toggleExpanded(key);\n }}\n >\n <RightOutlined className=\"aegis-data-table__toggle-icon\" aria-hidden />\n </button>\n );\n };\n\n /** A full-width row under a data row, holding a row's expanded content or the selection's detail. */\n const renderDetailRow = (\n open: boolean,\n content: ReactNode,\n detailId?: string,\n ) => (\n <tr\n className={\n open\n ? 'aegis-data-table__detail-row aegis-data-table__detail-row--open'\n : 'aegis-data-table__detail-row'\n }\n >\n {selectable && <td className=\"aegis-data-table__detail-cell\" />}\n {expandable && <td className=\"aegis-data-table__detail-cell\" />}\n <td\n id={detailId}\n colSpan={bodyColumnCount}\n className=\"aegis-data-table__detail-cell\"\n >\n <div\n className=\"aegis-data-table__detail\"\n style={{\n left: leadWidth,\n width: `calc(100cqi - ${String(leadWidth)}px)`,\n }}\n >\n {content}\n </div>\n </td>\n </tr>\n );\n\n const handleRowClick = (\n event: MouseEvent<HTMLTableRowElement>,\n row: T,\n idx: number,\n ): void => {\n if (!isOwnedByControl(event)) {\n onRowClick?.(row, idx);\n }\n };\n\n const handleRowKeyDown = (\n event: KeyboardEvent<HTMLTableRowElement>,\n row: T,\n idx: number,\n ): void => {\n if (event.key === 'Enter' && event.target === event.currentTarget) {\n event.preventDefault();\n onRowClick?.(row, idx);\n }\n };\n\n const rowClass = (isSelected: boolean): string =>\n [\n 'aegis-data-table__row',\n clickable ? 'aegis-data-table__row--clickable' : '',\n expandable ? 'aegis-data-table__row--expandable' : '',\n isSelected ? 'aegis-data-table__row--selected' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const tableClass = [\n 'aegis-data-table__table',\n fixedLayout ? 'aegis-data-table__table--fixed' : '',\n cardMode ? 'aegis-data-table__table--cards' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div\n ref={wrapRef}\n className={cls}\n aria-busy={stale || loading ? true : undefined}\n {...agentAttrs}\n >\n <div className=\"aegis-data-table__scroll-frame\">\n <div className=\"aegis-data-table__scroll\">\n <table\n ref={tableRef}\n aria-label={ariaLabel}\n className={tableClass}\n style={fixedLayout ? columnWidths.tableStyle : undefined}\n >\n {fixedLayout && (\n <colgroup>\n {selectable && (\n <col key=\"__select\" style={{ width: SELECTION_WIDTH }} />\n )}\n {expandable && (\n <col key=\"__toggle\" style={{ width: TOGGLE_WIDTH }} />\n )}\n {columns.map((col, i) => {\n const width = columnWidths.widths[i];\n return (\n <col\n key={col.key}\n data-column-key={col.key}\n style={width ? { width } : undefined}\n />\n );\n })}\n {filler && (\n <col\n key=\"__filler\"\n data-column-filler\n style={columnWidths.fillerStyle}\n />\n )}\n {clickable && (\n <col key=\"__chevron\" style={{ width: CHEVRON_WIDTH }} />\n )}\n </colgroup>\n )}\n {(!cardMode || selectable) && (\n <thead>\n <tr>\n {selectable && (\n <th\n key=\"__select\"\n scope=\"col\"\n {...leadCellProps('select', 'th')}\n >\n <span className=\"aegis-data-table__th-label\">\n <Checkbox\n checked={\n keys.length > 0 && selectedCount === keys.length\n }\n indeterminate={\n selectedCount > 0 && selectedCount < keys.length\n }\n onChange={togglePage}\n ariaLabel={strings.selectAllRows}\n />\n </span>\n </th>\n )}\n {expandable && (\n <th\n key=\"__toggle\"\n scope=\"col\"\n {...leadCellProps('toggle', 'th')}\n />\n )}\n {cardMode ? (\n <th scope=\"col\" className=\"aegis-data-table__th\" />\n ) : (\n columns.map((col, i) => (\n <th\n key={col.key}\n scope=\"col\"\n data-column-key={col.key}\n className={cellClass('th', i)}\n style={cellStyle(col, i)}\n aria-sort={\n col.sortable\n ? activeSort?.key === col.key\n ? activeSort.direction === 'asc'\n ? 'ascending'\n : 'descending'\n : 'none'\n : undefined\n }\n >\n {col.sortable ? (\n <button\n type=\"button\"\n className=\"aegis-data-table__sort\"\n onClick={() => {\n requestSort(col);\n }}\n >\n <span className=\"aegis-data-table__th-label\">\n {col.header}\n </span>\n <SortIcon\n direction={\n activeSort?.key === col.key\n ? activeSort.direction\n : null\n }\n />\n </button>\n ) : (\n <span className=\"aegis-data-table__th-label\">\n {col.header}\n </span>\n )}\n {col.resizable && (\n <span\n aria-label={strings.resizeColumn}\n className=\"aegis-data-table__resizer\"\n {...columnWidths.handleProps(col)}\n />\n )}\n </th>\n ))\n )}\n {filler && (\n <th\n scope=\"col\"\n className=\"aegis-data-table__th aegis-data-table__filler\"\n aria-hidden\n />\n )}\n {clickable && (\n <th\n scope=\"col\"\n className=\"aegis-data-table__th aegis-data-table__chevron-cell\"\n aria-hidden\n />\n )}\n </tr>\n </thead>\n )}\n <tbody data-aegis-develop={develop || undefined}>\n {loading ? (\n Array.from({ length: 5 }).map((_, i) => (\n <tr key={`sk-${i}`} className=\"aegis-data-table__row\">\n {selectable && (\n <td key=\"__select\" {...leadCellProps('select', 'td')} />\n )}\n {expandable && (\n <td key=\"__toggle\" {...leadCellProps('toggle', 'td')} />\n )}\n {renderSkeletonCells()}\n {fillerCell}\n {clickable && (\n <td className=\"aegis-data-table__td\" aria-hidden />\n )}\n </tr>\n ))\n ) : rows.length === 0 ? (\n // Not a data row, so an empty table has no rows to read.\n <tr role=\"presentation\">\n <td\n colSpan={columnCount}\n className=\"aegis-data-table__empty-cell\"\n >\n <div className=\"aegis-data-table__empty\">\n <EmptyState\n title={emptyTitle ?? strings.noData}\n description={emptyDescription}\n action={emptyAction}\n />\n </div>\n </td>\n </tr>\n ) : (\n rows.map((row, idx) => {\n const key = rowKey(row, idx);\n const detailId = `${detailIdPrefix}-detail-${String(idx)}`;\n const isSelected = selected.includes(key);\n return (\n <Fragment key={key}>\n <tr\n ref={\n key === detailKey ? selection?.placeRow : undefined\n }\n className={rowClass(isSelected)}\n aria-selected={\n selectable || selectedKeys !== undefined\n ? isSelected\n : undefined\n }\n tabIndex={clickable ? 0 : undefined}\n onClick={\n clickable\n ? (event) => {\n handleRowClick(event, row, idx);\n }\n : undefined\n }\n onKeyDown={\n clickable\n ? (event) => {\n handleRowKeyDown(event, row, idx);\n }\n : undefined\n }\n >\n {selectable && (\n <td {...leadCellProps('select', 'td')}>\n {selectionCell(isSelected, (checked) => {\n toggleRow(key, checked);\n })}\n </td>\n )}\n {expandable && (\n <td {...leadCellProps('toggle', 'td')}>\n {renderToggle(key, detailId)}\n </td>\n )}\n {renderRowCells(row, idx)}\n {fillerCell}\n {chevronCell}\n </tr>\n {key === detailKey && selection?.inline\n ? renderDetailRow(true, selection.inline)\n : null}\n {expandable &&\n renderDetailRow(\n expanded.includes(key),\n <div className=\"aegis-data-table__detail-clip\">\n <div className=\"aegis-data-table__detail-body\">\n {(expanded.includes(key) ||\n visited.includes(key)) &&\n renderExpanded(row, idx)}\n </div>\n </div>,\n detailId,\n )}\n </Fragment>\n );\n })\n )}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <Pagination\n {...pagination}\n pageRowCount={data.length}\n disabled={loading}\n className=\"aegis-data-table__footer\"\n />\n )}\n </div>\n );\n}\n"],"names":["SELECTION_WIDTH","TOGGLE_WIDTH","CHEVRON_WIDTH","PINNED_MAX","MOBILE_QUERY","CONTROL_SELECTOR","isOwnedByControl","event","target","control","sortRows","data","column","direction","value","sign","row","index","v","a","b","order","entry","SortIcon","jsxs","jsx","DataTable","columns","rowKey","ariaLabel","loading","emptyTitle","emptyDescription","emptyAction","className","framed","persistKey","pagination","selectable","selectedKeys","onSelectedKeysChange","renderExpanded","expandedKeys","defaultExpandedKeys","onExpandedKeysChange","renderMobileCard","onRowClick","stickyFirstColumn","stale","sort","defaultSort","onSortChange","surface","strings","useStrings","isMobile","useMediaQuery","detailIdPrefix","useId","cardMode","develop","useDevelopAfterLoad","uncontrolledSort","setUncontrolledSort","useState","activeSort","sortColumn","col","rows","useMemo","requestSort","first","next","selected","keys","selection","useContext","SelectedRowDetailContext","detailKey","key","selectedCount","toggleRow","checked","item","togglePage","others","selectionCell","onToggle","Checkbox","uncontrolledExpanded","setUncontrolledExpanded","expanded","visited","setVisited","unvisited","toggleExpanded","tableRef","useRef","wrapRef","agentAttrs","usePrimitiveSurface","expandable","clickable","leadWidth","trailWidth","sticky","columnWidths","useColumnWidths","cls","fixedLayout","filler","bodyColumnCount","columnCount","toggleLeft","leadCellProps","lead","cell","cellClass","colIndex","tone","block","classes","columnAlign","cellStyle","renderCellContent","node","renderRowCells","idx","renderSkeletonCells","SkeletonText","Skeleton","fillerCell","chevronCell","RightOutlined","renderToggle","detailId","open","renderDetailRow","content","handleRowClick","handleRowKeyDown","rowClass","isSelected","tableClass","i","width","_","EmptyState","Fragment","Pagination"],"mappings":";;;;;;;;;;;;;;AA4LA,MAAMA,IAAkB,IAClBC,IAAe,IACfC,KAAgB,IAEhBC,KAAa,sCACbC,KAAe,sBACfC,KACJ;AAGF,SAASC,GAAiBC,GAAyC;AACjE,MAAI,OAAO,gBAAgB,SAAS;AAClC,WAAO;AAET,QAAMC,IAASD,EAAM;AACrB,MAAI,EAAEC,aAAkB;AACtB,WAAO;AAET,QAAMC,IAAUD,EAAO,QAAQH,EAAgB;AAC/C,SAAOI,MAAY,QAAQF,EAAM,cAAc,SAASE,CAAO;AACjE;AAOA,SAASC,GACPC,GACAC,GACAC,GACK;AACL,QAAMC,IAAQF,GAAQ;AACtB,MAAI,CAACE;AACH,WAAOH;AAET,QAAMI,IAAOF,MAAc,QAAQ,IAAI;AACvC,SAAOF,EACJ,IAAI,CAACK,GAAKC,MA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,KACC,gBAAA5E,EAAC,MAAA,EAAI,GAAGyF,EAAc,UAAU,IAAI,GACjC,UAAAoB,GAAavD,GAAKwD,CAAQ,EAAA,CAC7B;AAAA,wBAEDT,GAAe9G,GAAK+G,CAAG;AAAA,wBACvBI;AAAA,wBACAC;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAEFrD,MAAQD,KAAaH,GAAW,SAC7B8D,GAAgB,IAAM9D,EAAU,MAAM,IACtC;AAAA,kBACH0B,KACCoC;AAAA,oBACE9C,EAAS,SAASZ,CAAG;AAAA,oBACrB,gBAAAtD,EAAC,SAAI,WAAU,iCACb,4BAAC,OAAA,EAAI,WAAU,iCACX,WAAAkE,EAAS,SAASZ,CAAG,KACrBa,EAAQ,SAASb,CAAG,MACpBtC,EAAezB,GAAK+G,CAAG,GAC3B,EAAA,CACF;AAAA,oBACAQ;AAAA,kBAAA;AAAA,gBACF,EAAA,GAzDWxD,CA0Df;AAAA,cAEJ,CAAC,EAAA,CAEL;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,GAEJ,EAAA,CACF;AAAA,QACC1C,KACC,gBAAAZ;AAAA,UAAC4H;AAAA,UAAA;AAAA,YACE,GAAGhH;AAAA,YACJ,cAAc1B,EAAK;AAAA,YACnB,UAAUmB;AAAA,YACV,WAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
1
|
+
{"version":3,"file":"DataTable.js","sources":["../../../src/components/ui/DataTable.tsx"],"sourcesContent":["import {\n type CSSProperties,\n Fragment,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useContext,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { RightOutlined } from '@ant-design/icons';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useDevelopAfterLoad } from '../../hooks/useDevelopAfterLoad';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { useStrings } from '../../locale';\nimport { Checkbox } from './Checkbox';\nimport './DataTable.css';\nimport { EmptyState } from './EmptyState';\nimport { Pagination, type PaginationProps } from './Pagination';\nimport { Skeleton, SkeletonText } from './Skeleton';\nimport { SelectedRowDetailContext } from './selectedRowDetail';\nimport { useColumnWidths } from './useColumnWidths';\n\nexport type DataTableSurface<T> = PrimitiveSurface<T[]>;\n\n/** Background wash of one cell, e.g. a step on a pass-rate scale. */\nexport interface DataTableCellTone {\n tone: 'success' | 'info' | 'caution' | 'warning';\n /**\n * 1 (default) is the tone's soft background; each step up mixes in more\n * of the tone's accent, to 5.\n */\n step?: 1 | 2 | 3 | 4 | 5;\n}\n\nexport interface DataTableColumn<T> {\n key: string;\n header: ReactNode;\n /** Initial column width. Number → px, string → as-is (e.g. '20%'). */\n width?: number | string;\n /** Minimum width during resize / when content squeezes. Default 60px. */\n minWidth?: number;\n /** Maximum width during resize. */\n maxWidth?: number;\n align?: 'left' | 'center' | 'right';\n /**\n * Whether the cell should ellipsis-truncate long content. Default true.\n * Set false for action cells, chip rows, links and other focusable content\n * (the clip cuts off their focus ring), or anything with non-text content\n * that should keep its natural width without being clipped.\n */\n truncate?: boolean;\n /**\n * Gives the header a resize handle on its right edge, dragged with the\n * pointer or moved with the arrow keys. Default false.\n */\n resizable?: boolean;\n /**\n * `'actions'` lays the cell out as a right-aligned, gapped, wrapping row of\n * controls — return them straight from `render`. Overrides `align` and\n * `truncate`.\n */\n kind?: 'actions';\n /**\n * Number column: header and cells right-aligned, figures in\n * `--font-numeric` with tabular widths so digits and decimal points line\n * up. Overrides `align`.\n */\n numeric?: boolean;\n /** Washes a cell's background in a tone. Table rows only, not mobile cards. */\n cellTone?: (row: T, index: number) => DataTableCellTone | undefined;\n /**\n * Makes the header a sort control. With `sortValue` the table orders\n * the rows itself; without it the host orders `data` (for instance the\n * server, from a URL parameter) and the header only shows the state.\n */\n sortable?: boolean;\n /** The value the table sorts this column by; `null` sorts last either way. */\n sortValue?: (row: T) => number | string | null;\n /** The direction of a first click. Defaults to `desc` for numeric columns, `asc` otherwise. */\n firstSortDirection?: DataTableSortDirection;\n render: (row: T, index: number) => ReactNode;\n}\n\nexport type DataTableSortDirection = 'asc' | 'desc';\n\nexport interface DataTableSort {\n key: string;\n direction: DataTableSortDirection;\n}\n\n/**\n * Server-side pagination: `data` is the current page, never sliced here.\n * The table supplies the page's row count and disables the pager while\n * loading.\n */\nexport type DataTablePagination = Pick<\n PaginationProps,\n 'page' | 'pageSize' | 'total' | 'onChange' | 'pageSizeOptions'\n>;\n\ninterface DataTableProps<T> {\n columns: Array<DataTableColumn<T>>;\n data: T[];\n rowKey: (row: T, index: number) => string | number;\n /** The table's accessible name. */\n ariaLabel?: string;\n /** Draws skeleton rows, and marks the table busy. */\n loading?: boolean;\n emptyTitle?: string;\n emptyDescription?: string;\n emptyAction?: ReactNode;\n className?: string;\n /**\n * Draws the table as its own card: `--radius-lg`, hairline border and\n * resting shadow, with the header flush with the top and clipped by the\n * radius. Default true. Pass false where a container already frames the\n * table, e.g. a titled `Panel padded={false}`, a dialog or an expanded row.\n */\n framed?: boolean;\n /**\n * `compact` sets rows `--data-table-compact-row-min-height` high with\n * tighter cell padding, for a dense table in a pane.\n */\n density?: 'default' | 'compact';\n /**\n * `plain` draws the header on the table's own surface, divided from the\n * rows by its hairline alone; `filled` (default) sets it on a muted fill.\n */\n header?: 'filled' | 'plain';\n /**\n * When set, resized column widths are persisted to localStorage under\n * `aegis-data-table:<persistKey>`. Use a stable key per table.\n */\n persistKey?: string;\n /** Renders a footer with page navigation under the table. */\n pagination?: DataTablePagination;\n /** Adds a leading checkbox column and drives `selectedKeys`. */\n selectable?: boolean;\n /**\n * The selected rows: `aria-selected` and drawn selected. Without\n * `selectable` there is no checkbox column, e.g. for the row whose\n * details show beside the table.\n */\n selectedKeys?: Array<string | number>;\n onSelectedKeysChange?: (keys: Array<string | number>) => void;\n /**\n * Makes rows expandable: a leading column of chevron toggles, and this\n * content full-width under each expanded row.\n */\n renderExpanded?: (row: T, index: number) => ReactNode;\n /** Controlled expanded row keys. Omit to let the table track them. */\n expandedKeys?: Array<string | number>;\n /** Rows expanded on mount when `expandedKeys` is omitted. */\n defaultExpandedKeys?: Array<string | number>;\n onExpandedKeysChange?: (keys: Array<string | number>) => void;\n /**\n * At ≤768 px, renders each row through this instead of the columns, as a\n * stacked list with no sideways scroll. Selection, expansion, row clicks,\n * loading, empty state and pagination keep working.\n */\n renderMobileCard?: (row: T, index: number) => ReactNode;\n /**\n * Makes rows clickable: pointer cursor, a muted hover background, a\n * trailing chevron, and Enter on a focused row. Links, buttons and form\n * controls inside a cell keep their own behaviour.\n */\n onRowClick?: (row: T, index: number) => void;\n /**\n * Keeps the first column (with the selection and expansion columns) in\n * view while the other columns scroll sideways. The first column takes\n * at most 40% of the table's visible width, truncating past it.\n */\n stickyFirstColumn?: boolean;\n /**\n * The rows are out of date, e.g. the previous page while the next one\n * loads: they stay in place, dimmed, and the table is marked busy.\n */\n stale?: boolean;\n /**\n * The sorted column and direction. Omit to let the table track it,\n * starting from `defaultSort`. Row indices passed to `render`,\n * `cellTone` and the other callbacks count in the sorted order.\n */\n sort?: DataTableSort | null;\n defaultSort?: DataTableSort;\n /** Called with the sort a header click asks for. */\n onSortChange?: (sort: DataTableSort) => void;\n surface?: DataTableSurface<T>;\n}\n\nconst SELECTION_WIDTH = 44;\nconst TOGGLE_WIDTH = 32;\nconst CHEVRON_WIDTH = 40;\n/** The widest a pinned first column renders; DataTable.css sets the share. */\nconst PINNED_MAX = 'var(--aegis-data-table-pinned-max)';\nconst MOBILE_QUERY = '(max-width: 768px)';\nconst CONTROL_SELECTOR =\n 'a, button, input, select, textarea, label, [role=\"button\"], [role=\"link\"], [role=\"checkbox\"]';\n\n/** True when the click belongs to a control inside the row, or ends a text selection. */\nfunction isOwnedByControl(event: MouseEvent<HTMLElement>): boolean {\n if (window.getSelection()?.type === 'Range') {\n return true;\n }\n const target = event.target;\n if (!(target instanceof Element)) {\n return false;\n }\n const control = target.closest(CONTROL_SELECTOR);\n return control !== null && event.currentTarget.contains(control);\n}\n\n/**\n * The rows ordered by `column`'s sort value, ties and nulls (last in\n * either direction) keeping their order; unchanged when the column has no\n * sort value, because then the host ordered them.\n */\nfunction sortRows<T>(\n data: T[],\n column: DataTableColumn<T> | undefined,\n direction: DataTableSortDirection,\n): T[] {\n const value = column?.sortValue;\n if (!value) {\n return data;\n }\n const sign = direction === 'asc' ? 1 : -1;\n return data\n .map((row, index) => {\n const v = value(row);\n return { row, index, v: typeof v === 'number' && isNaN(v) ? null : v };\n })\n .sort((a, b) => {\n if (a.v === null || b.v === null) {\n return a.v === b.v ? a.index - b.index : a.v === null ? 1 : -1;\n }\n const order =\n typeof a.v === 'number' && typeof b.v === 'number'\n ? a.v - b.v\n : String(a.v).localeCompare(String(b.v));\n return order === 0 ? a.index - b.index : order * sign;\n })\n .map((entry) => entry.row);\n}\n\nfunction SortIcon({\n direction,\n}: {\n direction: DataTableSortDirection | null;\n}): ReactNode {\n return (\n <svg\n className=\"aegis-data-table__sort-icon\"\n viewBox=\"0 0 12 12\"\n aria-hidden=\"true\"\n >\n <path\n className={\n direction === 'asc' ? 'aegis-data-table__sort-mark--on' : undefined\n }\n d=\"M3.5 5L6 2.5 8.5 5\"\n />\n <path\n className={\n direction === 'desc' ? 'aegis-data-table__sort-mark--on' : undefined\n }\n d=\"M3.5 7L6 9.5 8.5 7\"\n />\n </svg>\n );\n}\n\nexport function DataTable<T>({\n columns,\n data,\n rowKey,\n ariaLabel,\n loading = false,\n emptyTitle,\n emptyDescription,\n emptyAction,\n className,\n framed = true,\n density = 'default',\n header = 'filled',\n persistKey,\n pagination,\n selectable = false,\n selectedKeys,\n onSelectedKeysChange,\n renderExpanded,\n expandedKeys,\n defaultExpandedKeys,\n onExpandedKeysChange,\n renderMobileCard,\n onRowClick,\n stickyFirstColumn = false,\n stale = false,\n sort,\n defaultSort,\n onSortChange,\n surface,\n}: DataTableProps<T>) {\n const strings = useStrings();\n const isMobile = useMediaQuery(MOBILE_QUERY);\n const detailIdPrefix = useId();\n const cardMode = renderMobileCard !== undefined && isMobile;\n const develop = useDevelopAfterLoad(loading);\n\n const [uncontrolledSort, setUncontrolledSort] =\n useState<DataTableSort | null>(defaultSort ?? null);\n const activeSort = sort === undefined ? uncontrolledSort : sort;\n const sortColumn = columns.find((col) => col.key === activeSort?.key);\n const rows = useMemo(\n () => sortRows(data, sortColumn, activeSort?.direction ?? 'asc'),\n [data, sortColumn, activeSort?.direction],\n );\n const requestSort = (col: DataTableColumn<T>): void => {\n const first: DataTableSortDirection =\n col.firstSortDirection ?? (col.numeric ? 'desc' : 'asc');\n const next: DataTableSort = {\n key: col.key,\n direction:\n activeSort?.key === col.key\n ? activeSort.direction === 'asc'\n ? 'desc'\n : 'asc'\n : first,\n };\n if (sort === undefined) {\n setUncontrolledSort(next);\n }\n onSortChange?.(next);\n };\n\n const selected = selectedKeys ?? [];\n const keys = rows.map((row, index) => rowKey(row, index));\n const selection = useContext(SelectedRowDetailContext);\n // A DetailBeside follows the first selected row on the page.\n const detailKey = keys.find((key) => selected.includes(key));\n const selectedCount = keys.filter((key) => selected.includes(key)).length;\n const toggleRow = (key: string | number, checked: boolean): void => {\n onSelectedKeysChange?.(\n checked ? [...selected, key] : selected.filter((item) => item !== key),\n );\n };\n // Selections on other pages survive toggling the rows of this page.\n const togglePage = (checked: boolean): void => {\n const others = selected.filter((key) => !keys.includes(key));\n onSelectedKeysChange?.(checked ? [...others, ...keys] : others);\n };\n const selectionCell = (\n checked: boolean,\n onToggle: (next: boolean) => void,\n ) => (\n <Checkbox\n checked={checked}\n onChange={onToggle}\n ariaLabel={strings.selectRow}\n />\n );\n\n const [uncontrolledExpanded, setUncontrolledExpanded] = useState<\n Array<string | number>\n >(defaultExpandedKeys ?? []);\n const expanded = expandedKeys ?? uncontrolledExpanded;\n // A row's detail mounts the first time it opens and stays mounted, so\n // collapsing can animate instead of dropping the content at once.\n const [visited, setVisited] = useState(expanded);\n const unvisited = expanded.filter((key) => !visited.includes(key));\n if (unvisited.length > 0) {\n setVisited([...visited, ...unvisited]);\n }\n const toggleExpanded = (key: string | number): void => {\n const next = expanded.includes(key)\n ? expanded.filter((item) => item !== key)\n : [...expanded, key];\n if (expandedKeys === undefined) {\n setUncontrolledExpanded(next);\n }\n onExpandedKeysChange?.(next);\n };\n\n const tableRef = useRef<HTMLTableElement>(null);\n const wrapRef = useRef<HTMLDivElement>(null);\n\n const agentAttrs = usePrimitiveSurface(surface, data, 'table', wrapRef);\n const expandable = renderExpanded !== undefined;\n const clickable = onRowClick !== undefined;\n const leadWidth =\n (selectable ? SELECTION_WIDTH : 0) + (expandable ? TOGGLE_WIDTH : 0);\n const trailWidth = clickable ? CHEVRON_WIDTH : 0;\n const sticky = stickyFirstColumn && !cardMode;\n\n const columnWidths = useColumnWidths({\n columns,\n persistKey,\n leadWidth,\n trailWidth,\n firstColumnMax: sticky ? PINNED_MAX : undefined,\n tableRef,\n });\n\n const cls = [\n 'aegis-data-table',\n framed ? 'aegis-data-table--framed' : '',\n density === 'compact' ? 'aegis-data-table--compact' : '',\n header === 'plain' ? 'aegis-data-table--plain-header' : '',\n stale ? 'aegis-data-table--stale' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n const fixedLayout = columnWidths.sized && !cardMode;\n const filler = fixedLayout && columnWidths.fillerStyle !== undefined;\n const bodyColumnCount =\n (cardMode ? 1 : columns.length) + (filler ? 1 : 0) + (clickable ? 1 : 0);\n const columnCount =\n bodyColumnCount + (selectable ? 1 : 0) + (expandable ? 1 : 0);\n const toggleLeft = selectable ? SELECTION_WIDTH : 0;\n\n /** Props of a leading selection or toggle cell, fixed in width so the sticky offsets line up. */\n const leadCellProps = (lead: 'select' | 'toggle', cell: 'th' | 'td') => ({\n className: [\n `aegis-data-table__${cell}`,\n `aegis-data-table__${lead}-cell`,\n sticky ? `aegis-data-table__${cell}--sticky` : '',\n ]\n .filter(Boolean)\n .join(' '),\n style: {\n width: lead === 'select' ? SELECTION_WIDTH : TOGGLE_WIDTH,\n left: sticky ? (lead === 'select' ? 0 : toggleLeft) : undefined,\n },\n });\n\n /** Classes of a header or body cell of data column `colIndex`. */\n const cellClass = (\n cell: 'th' | 'td',\n colIndex: number,\n tone?: DataTableCellTone,\n ): string => {\n const block = `aegis-data-table__${cell}`;\n const classes = [block];\n if (sticky && colIndex === 0) {\n classes.push(`${block}--sticky`, `${block}--pinned`);\n }\n if (tone !== undefined) {\n classes.push(\n 'aegis-data-table__td--tone',\n `aegis-data-table__td--tone-${tone.tone}`,\n );\n if (tone.step !== undefined && tone.step > 1) {\n classes.push(`aegis-data-table__td--step-${String(tone.step)}`);\n }\n }\n return classes.join(' ');\n };\n\n const columnAlign = (col: DataTableColumn<T>) =>\n col.kind === 'actions' || col.numeric === true\n ? 'right'\n : (col.align ?? 'left');\n\n const cellStyle = (\n col: DataTableColumn<T>,\n colIndex: number,\n ): CSSProperties => ({\n textAlign: columnAlign(col),\n left: sticky && colIndex === 0 ? leadWidth : undefined,\n });\n\n const renderCellContent = (col: DataTableColumn<T>, node: ReactNode) => {\n const classes = [\n 'aegis-data-table__cell',\n `aegis-data-table__cell--${columnAlign(col)}`,\n ];\n if (col.numeric) {\n classes.push('aegis-data-table__cell--numeric');\n }\n if (col.kind === 'actions') {\n classes.push('aegis-data-table__cell--actions');\n } else if (col.truncate ?? true) {\n classes.push('aegis-data-table__cell--truncate');\n }\n return <div className={classes.join(' ')}>{node}</div>;\n };\n\n const renderRowCells = (row: T, idx: number) =>\n cardMode ? (\n <td className=\"aegis-data-table__td aegis-data-table__card-cell\">\n {renderMobileCard(row, idx)}\n </td>\n ) : (\n columns.map((col, colIndex) => (\n <td\n key={col.key}\n className={cellClass('td', colIndex, col.cellTone?.(row, idx))}\n style={cellStyle(col, colIndex)}\n >\n {renderCellContent(col, col.render(row, idx))}\n </td>\n ))\n );\n\n const renderSkeletonCells = () =>\n cardMode ? (\n <td className=\"aegis-data-table__td aegis-data-table__card-cell\">\n <SkeletonText lines={2} />\n </td>\n ) : (\n columns.map((col, colIndex) => (\n <td\n key={col.key}\n className={cellClass('td', colIndex)}\n style={cellStyle(col, colIndex)}\n >\n {renderCellContent(\n col,\n <Skeleton width=\"80%\" height=\"var(--space-3)\" />,\n )}\n </td>\n ))\n );\n\n const fillerCell = filler && (\n <td className=\"aegis-data-table__td aegis-data-table__filler\" aria-hidden />\n );\n\n // The row itself takes the click, so the chevron column is not read.\n const chevronCell = clickable && (\n <td\n className=\"aegis-data-table__td aegis-data-table__chevron-cell\"\n aria-hidden\n >\n <RightOutlined className=\"aegis-data-table__chevron\" aria-hidden />\n </td>\n );\n\n const renderToggle = (key: string | number, detailId: string) => {\n const open = expanded.includes(key);\n return (\n <button\n type=\"button\"\n className=\"aegis-data-table__toggle\"\n aria-expanded={open}\n aria-controls={detailId}\n aria-label={open ? strings.collapseRow : strings.expandRow}\n onClick={() => {\n toggleExpanded(key);\n }}\n >\n <RightOutlined className=\"aegis-data-table__toggle-icon\" aria-hidden />\n </button>\n );\n };\n\n /** A full-width row under a data row, holding a row's expanded content or the selection's detail. */\n const renderDetailRow = (\n open: boolean,\n content: ReactNode,\n detailId?: string,\n ) => (\n <tr\n className={\n open\n ? 'aegis-data-table__detail-row aegis-data-table__detail-row--open'\n : 'aegis-data-table__detail-row'\n }\n >\n {selectable && <td className=\"aegis-data-table__detail-cell\" />}\n {expandable && <td className=\"aegis-data-table__detail-cell\" />}\n <td\n id={detailId}\n colSpan={bodyColumnCount}\n className=\"aegis-data-table__detail-cell\"\n >\n <div\n className=\"aegis-data-table__detail\"\n style={{\n left: leadWidth,\n width: `calc(100cqi - ${String(leadWidth)}px)`,\n }}\n >\n {content}\n </div>\n </td>\n </tr>\n );\n\n const handleRowClick = (\n event: MouseEvent<HTMLTableRowElement>,\n row: T,\n idx: number,\n ): void => {\n if (!isOwnedByControl(event)) {\n onRowClick?.(row, idx);\n }\n };\n\n const handleRowKeyDown = (\n event: KeyboardEvent<HTMLTableRowElement>,\n row: T,\n idx: number,\n ): void => {\n if (event.key === 'Enter' && event.target === event.currentTarget) {\n event.preventDefault();\n onRowClick?.(row, idx);\n }\n };\n\n const rowClass = (isSelected: boolean): string =>\n [\n 'aegis-data-table__row',\n clickable ? 'aegis-data-table__row--clickable' : '',\n expandable ? 'aegis-data-table__row--expandable' : '',\n isSelected ? 'aegis-data-table__row--selected' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const tableClass = [\n 'aegis-data-table__table',\n fixedLayout ? 'aegis-data-table__table--fixed' : '',\n cardMode ? 'aegis-data-table__table--cards' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div\n ref={wrapRef}\n className={cls}\n aria-busy={stale || loading ? true : undefined}\n {...agentAttrs}\n >\n <div className=\"aegis-data-table__scroll-frame\">\n <div className=\"aegis-data-table__scroll\">\n <table\n ref={tableRef}\n aria-label={ariaLabel}\n className={tableClass}\n style={fixedLayout ? columnWidths.tableStyle : undefined}\n >\n {fixedLayout && (\n <colgroup>\n {selectable && (\n <col key=\"__select\" style={{ width: SELECTION_WIDTH }} />\n )}\n {expandable && (\n <col key=\"__toggle\" style={{ width: TOGGLE_WIDTH }} />\n )}\n {columns.map((col, i) => {\n const width = columnWidths.widths[i];\n return (\n <col\n key={col.key}\n data-column-key={col.key}\n style={width ? { width } : undefined}\n />\n );\n })}\n {filler && (\n <col\n key=\"__filler\"\n data-column-filler\n style={columnWidths.fillerStyle}\n />\n )}\n {clickable && (\n <col key=\"__chevron\" style={{ width: CHEVRON_WIDTH }} />\n )}\n </colgroup>\n )}\n {(!cardMode || selectable) && (\n <thead>\n <tr>\n {selectable && (\n <th\n key=\"__select\"\n scope=\"col\"\n {...leadCellProps('select', 'th')}\n >\n <span className=\"aegis-data-table__th-label\">\n <Checkbox\n checked={\n keys.length > 0 && selectedCount === keys.length\n }\n indeterminate={\n selectedCount > 0 && selectedCount < keys.length\n }\n onChange={togglePage}\n ariaLabel={strings.selectAllRows}\n />\n </span>\n </th>\n )}\n {expandable && (\n <th\n key=\"__toggle\"\n scope=\"col\"\n {...leadCellProps('toggle', 'th')}\n />\n )}\n {cardMode ? (\n <th scope=\"col\" className=\"aegis-data-table__th\" />\n ) : (\n columns.map((col, i) => (\n <th\n key={col.key}\n scope=\"col\"\n data-column-key={col.key}\n className={cellClass('th', i)}\n style={cellStyle(col, i)}\n aria-sort={\n col.sortable\n ? activeSort?.key === col.key\n ? activeSort.direction === 'asc'\n ? 'ascending'\n : 'descending'\n : 'none'\n : undefined\n }\n >\n {col.sortable ? (\n <button\n type=\"button\"\n className=\"aegis-data-table__sort\"\n onClick={() => {\n requestSort(col);\n }}\n >\n <span className=\"aegis-data-table__th-label\">\n {col.header}\n </span>\n <SortIcon\n direction={\n activeSort?.key === col.key\n ? activeSort.direction\n : null\n }\n />\n </button>\n ) : (\n <span className=\"aegis-data-table__th-label\">\n {col.header}\n </span>\n )}\n {col.resizable && (\n <span\n aria-label={strings.resizeColumn}\n className=\"aegis-data-table__resizer\"\n {...columnWidths.handleProps(col)}\n />\n )}\n </th>\n ))\n )}\n {filler && (\n <th\n scope=\"col\"\n className=\"aegis-data-table__th aegis-data-table__filler\"\n aria-hidden\n />\n )}\n {clickable && (\n <th\n scope=\"col\"\n className=\"aegis-data-table__th aegis-data-table__chevron-cell\"\n aria-hidden\n />\n )}\n </tr>\n </thead>\n )}\n <tbody data-aegis-develop={develop || undefined}>\n {loading ? (\n Array.from({ length: 5 }).map((_, i) => (\n <tr key={`sk-${i}`} className=\"aegis-data-table__row\">\n {selectable && (\n <td key=\"__select\" {...leadCellProps('select', 'td')} />\n )}\n {expandable && (\n <td key=\"__toggle\" {...leadCellProps('toggle', 'td')} />\n )}\n {renderSkeletonCells()}\n {fillerCell}\n {clickable && (\n <td className=\"aegis-data-table__td\" aria-hidden />\n )}\n </tr>\n ))\n ) : rows.length === 0 ? (\n // Not a data row, so an empty table has no rows to read.\n <tr role=\"presentation\">\n <td\n colSpan={columnCount}\n className=\"aegis-data-table__empty-cell\"\n >\n <div className=\"aegis-data-table__empty\">\n <EmptyState\n title={emptyTitle ?? strings.noData}\n description={emptyDescription}\n action={emptyAction}\n />\n </div>\n </td>\n </tr>\n ) : (\n rows.map((row, idx) => {\n const key = rowKey(row, idx);\n const detailId = `${detailIdPrefix}-detail-${String(idx)}`;\n const isSelected = selected.includes(key);\n return (\n <Fragment key={key}>\n <tr\n ref={\n key === detailKey ? selection?.placeRow : undefined\n }\n className={rowClass(isSelected)}\n aria-selected={\n selectable || selectedKeys !== undefined\n ? isSelected\n : undefined\n }\n tabIndex={clickable ? 0 : undefined}\n onClick={\n clickable\n ? (event) => {\n handleRowClick(event, row, idx);\n }\n : undefined\n }\n onKeyDown={\n clickable\n ? (event) => {\n handleRowKeyDown(event, row, idx);\n }\n : undefined\n }\n >\n {selectable && (\n <td {...leadCellProps('select', 'td')}>\n {selectionCell(isSelected, (checked) => {\n toggleRow(key, checked);\n })}\n </td>\n )}\n {expandable && (\n <td {...leadCellProps('toggle', 'td')}>\n {renderToggle(key, detailId)}\n </td>\n )}\n {renderRowCells(row, idx)}\n {fillerCell}\n {chevronCell}\n </tr>\n {key === detailKey && selection?.inline\n ? renderDetailRow(true, selection.inline)\n : null}\n {expandable &&\n renderDetailRow(\n expanded.includes(key),\n <div className=\"aegis-data-table__detail-clip\">\n <div className=\"aegis-data-table__detail-body\">\n {(expanded.includes(key) ||\n visited.includes(key)) &&\n renderExpanded(row, idx)}\n </div>\n </div>,\n detailId,\n )}\n </Fragment>\n );\n })\n )}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <Pagination\n {...pagination}\n pageRowCount={data.length}\n disabled={loading}\n className=\"aegis-data-table__footer\"\n />\n )}\n </div>\n );\n}\n"],"names":["SELECTION_WIDTH","TOGGLE_WIDTH","CHEVRON_WIDTH","PINNED_MAX","MOBILE_QUERY","CONTROL_SELECTOR","isOwnedByControl","event","target","control","sortRows","data","column","direction","value","sign","row","index","v","a","b","order","entry","SortIcon","jsxs","jsx","DataTable","columns","rowKey","ariaLabel","loading","emptyTitle","emptyDescription","emptyAction","className","framed","density","header","persistKey","pagination","selectable","selectedKeys","onSelectedKeysChange","renderExpanded","expandedKeys","defaultExpandedKeys","onExpandedKeysChange","renderMobileCard","onRowClick","stickyFirstColumn","stale","sort","defaultSort","onSortChange","surface","strings","useStrings","isMobile","useMediaQuery","detailIdPrefix","useId","cardMode","develop","useDevelopAfterLoad","uncontrolledSort","setUncontrolledSort","useState","activeSort","sortColumn","col","rows","useMemo","requestSort","first","next","selected","keys","selection","useContext","SelectedRowDetailContext","detailKey","key","selectedCount","toggleRow","checked","item","togglePage","others","selectionCell","onToggle","Checkbox","uncontrolledExpanded","setUncontrolledExpanded","expanded","visited","setVisited","unvisited","toggleExpanded","tableRef","useRef","wrapRef","agentAttrs","usePrimitiveSurface","expandable","clickable","leadWidth","trailWidth","sticky","columnWidths","useColumnWidths","cls","fixedLayout","filler","bodyColumnCount","columnCount","toggleLeft","leadCellProps","lead","cell","cellClass","colIndex","tone","block","classes","columnAlign","cellStyle","renderCellContent","node","renderRowCells","idx","renderSkeletonCells","SkeletonText","Skeleton","fillerCell","chevronCell","RightOutlined","renderToggle","detailId","open","renderDetailRow","content","handleRowClick","handleRowKeyDown","rowClass","isSelected","tableClass","i","width","_","EmptyState","Fragment","Pagination"],"mappings":";;;;;;;;;;;;;;AAsMA,MAAMA,IAAkB,IAClBC,IAAe,IACfC,KAAgB,IAEhBC,KAAa,sCACbC,KAAe,sBACfC,KACJ;AAGF,SAASC,GAAiBC,GAAyC;AACjE,MAAI,OAAO,gBAAgB,SAAS;AAClC,WAAO;AAET,QAAMC,IAASD,EAAM;AACrB,MAAI,EAAEC,aAAkB;AACtB,WAAO;AAET,QAAMC,IAAUD,EAAO,QAAQH,EAAgB;AAC/C,SAAOI,MAAY,QAAQF,EAAM,cAAc,SAASE,CAAO;AACjE;AAOA,SAASC,GACPC,GACAC,GACAC,GACK;AACL,QAAMC,IAAQF,GAAQ;AACtB,MAA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;AAAA,sBAGL,UAAA;AAAA,wBAAAzF,KACC,gBAAAf,EAAC,MAAA,EAAI,GAAG2F,EAAc,UAAU,IAAI,GACjC,UAAA5B,GAAcwD,GAAY,CAAC5D,MAAY;AACtC,0BAAAD,GAAUF,GAAKG,CAAO;AAAA,wBACxB,CAAC,EAAA,CACH;AAAA,wBAEDmB,KACC,gBAAA9E,EAAC,MAAA,EAAI,GAAG2F,EAAc,UAAU,IAAI,GACjC,UAAAoB,GAAavD,GAAKwD,CAAQ,EAAA,CAC7B;AAAA,wBAEDT,GAAehH,GAAKiH,CAAG;AAAA,wBACvBI;AAAA,wBACAC;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAEFrD,MAAQD,KAAaH,GAAW,SAC7B8D,GAAgB,IAAM9D,EAAU,MAAM,IACtC;AAAA,kBACH0B,KACCoC;AAAA,oBACE9C,EAAS,SAASZ,CAAG;AAAA,oBACrB,gBAAAxD,EAAC,SAAI,WAAU,iCACb,4BAAC,OAAA,EAAI,WAAU,iCACX,WAAAoE,EAAS,SAASZ,CAAG,KACrBa,EAAQ,SAASb,CAAG,MACpBtC,EAAe3B,GAAKiH,CAAG,GAC3B,EAAA,CACF;AAAA,oBACAQ;AAAA,kBAAA;AAAA,gBACF,EAAA,GAzDWxD,CA0Df;AAAA,cAEJ,CAAC,EAAA,CAEL;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,GAEJ,EAAA,CACF;AAAA,QACC1C,KACC,gBAAAd;AAAA,UAAC8H;AAAA,UAAA;AAAA,YACE,GAAGhH;AAAA,YACJ,cAAc5B,EAAK;AAAA,YACnB,UAAUmB;AAAA,YACV,WAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),H=require("../../hooks/useIsomorphicLayoutEffect.cjs"),Y=require("../../hooks/useMediaQuery.cjs"),E=require("../../lib/scrollView.cjs");;/* empty css */const U=require("./PaneLayout.cjs"),q=require("./selectedRowDetail.cjs"),G="(max-width: 768px)",D=t.createContext(null);function J(r,i,d,y,f){const a=f.top+y,c=r.top<a?r.top-a:Math.max(r.bottom-f.bottom,0);return Math.max(c,i+d-f.bottom)}function X({boxRef:r}){const i=t.useContext(D);return l.jsx("div",{ref:r,className:"aegis-detail-beside__inline",role:"group",children:i})}function Z(r){const{detail:i,children:d,revealKey:y}=r,f=r.layout==="panes",a=f||r.scrollContainer==="nearest",c=f||r.scrollContainer==="nearest"?null:r.scrollContainer??null,v=Y.useMediaQuery(G),[L,p]=t.useState(!1),h=t.useRef(null),P=t.useRef(null),m=t.useRef(null),B=t.useRef(null),N=t.useRef(null),g=t.useRef(null),R=t.useRef(!1),O=t.useRef(0),k=t.useRef(y),M=t.useRef(void 0),S=t.useRef({children:d,detail:i}),T=t.useRef(c),C=t.useCallback(()=>a&&h.current!==null?E.scrollingAncestorOf(h.current):c,[a,c]),I=t.useCallback(e=>{const n=C();if(n===null)e.style.removeProperty("--detail-beside-view-height"),e.style.removeProperty("--detail-beside-sticky-top");else{const{paddingTop:s,paddingBottom:o}=getComputedStyle(n),b=n.clientHeight-parseFloat(s)-parseFloat(o);e.style.setProperty("--detail-beside-view-height",`${String(b)}px`),e.style.setProperty("--detail-beside-sticky-top","0px")}},[C]),u=t.useCallback(()=>{const e=g.current,n=m.current,s=P.current;if(e===null){s?.style.removeProperty("height");return}if(n===null)return;const o=e.getBoundingClientRect();if(I(n),s===null)n.style.setProperty("--aegis-detail-beside-row-height",`${String(o.height)}px`);else{const b=s.getBoundingClientRect().top;s.style.height=`${String(Math.max(o.top-b,0))}px`}},[I]),w=t.useCallback(()=>{u();const e=g.current,n=h.current,s=m.current,o=B.current!==null;if(e===null||n===null||s===null&&!o)return;const b=C(),Q=e.getBoundingClientRect(),$=P.current,V=J(Q,$===null?Q.bottom:$.getBoundingClientRect().top,s===null?0:s.getBoundingClientRect().height,s===null?0:parseFloat(getComputedStyle(s).scrollMarginTop),E.viewBoundsOf(b)),_=E.scrollerOf(b);Math.abs(V)>=1&&_.scrollBy({top:V,behavior:"instant"}),N.current=_,O.current=_.scrollTop},[u,C]),x=t.useCallback(()=>{M.current=k.current,B.current?.parentElement?.scrollTo({top:0,behavior:"instant"}),R.current=!0,p(!0),queueMicrotask(()=>{w(),p(!1)})},[w]),z=t.useCallback(e=>{const n=e!==g.current;g.current=e,e===null?(R.current=!1,p(!1),u()):M.current!==k.current?x():(n&&(R.current=!1),u())},[u,x]),A=t.useCallback(()=>{p(!0)},[]);H.useIsomorphicLayoutEffect(()=>{const e=S.current.children!==d||S.current.detail!==i;S.current={children:d,detail:i},k.current=y;const n=T.current!==c;T.current=c,(n||M.current!==y)&&g.current!==null?x():(e&&(R.current=!1),u())}),H.useIsomorphicLayoutEffect(()=>{const e=h.current;if(e===null)return;const n=new ResizeObserver(()=>{R.current?w():u()});for(const o of v?[e]:[e,m.current])o!==null&&n.observe(o);const s=o=>{o.target instanceof Node&&g.current?.contains(o.target)&&x()};return e.addEventListener("click",s),()=>{n.disconnect(),e.removeEventListener("click",s)}},[v,u,w,x]),t.useEffect(()=>{const e=()=>{const o=N.current;o!==null&&Math.abs(o.scrollTop-O.current)>=1&&(R.current=!1)},n=a?document:c??window,s={capture:a,passive:!0};return n.addEventListener("scroll",e,s),()=>{n.removeEventListener("scroll",e,s)}},[a,c]);const F=t.useMemo(()=>v?l.jsx(X,{boxRef:m}):null,[v]),K=t.useMemo(()=>({placeRow:z,awaitRow:A,inline:F}),[z,A,F]),j=l.jsx(q.SelectedRowDetailContext.Provider,{value:null,children:i});if(r.layout==="panes")return l.jsx(q.SelectedRowDetailContext.Provider,{value:K,children:l.jsxs(D.Provider,{value:j,children:[l.jsx(U.Pane,{size:"fill",...r.listPane,children:l.jsx("div",{ref:h,className:"aegis-detail-beside__list","aria-busy":L||void 0,children:d})}),!v&&l.jsx(U.Pane,{size:"lg",...r.detailPane,children:l.jsx("div",{ref:B,children:j})})]})});const W=["aegis-detail-beside",r.className??""].filter(Boolean).join(" ");return l.jsx(q.SelectedRowDetailContext.Provider,{value:K,children:l.jsx(D.Provider,{value:j,children:l.jsxs("div",{className:W,style:{"--aegis-detail-beside-columns":r.columns},"aria-busy":L||void 0,children:[l.jsx("div",{ref:h,className:"aegis-detail-beside__list",children:d}),!v&&l.jsxs("div",{className:"aegis-detail-beside__side",children:[l.jsx("div",{ref:P}),l.jsx("div",{ref:m,className:"aegis-detail-beside__detail",children:j})]})]})})})}exports.DetailBeside=Z;
|
|
2
2
|
//# sourceMappingURL=DetailBeside.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailBeside.cjs","sources":["../../../src/components/ui/DetailBeside.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ReactNode,\n type RefObject,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport {\n type ViewBounds,\n scrollerOf,\n scrollingAncestorOf,\n viewBoundsOf,\n} from '../../lib/scrollView';\nimport './DetailBeside.css';\nimport { Pane, type PaneProps } from './PaneLayout';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\n\ninterface DetailBesideBaseProps {\n /**\n * The selected item's detail: one element, such as a `Panel` titled with\n * the item's name. Render it anew from the host's data whenever that\n * data changes: that render tells DetailBeside the change was new data,\n * so the page stays where it is. A detail that fetches its own data and\n * redraws without this host rendering leaves the page following the row,\n * and its next change of size scrolls the page.\n */\n detail: ReactNode;\n /**\n * The list: a `TraceTree`, `FileTree`, `DataTable`, `TreeTable` or\n * `ServiceMap`, in a Panel say. The detail follows the row it draws\n * selected. Like `detail`, render it anew from the host's data whenever\n * that data changes, so the page stays where it is on new data; a list\n * that fetches its own data and redraws without this host rendering\n * leaves the page following the row, and its next change of size scrolls\n * the page.\n */\n children: ReactNode;\n /**\n * The selection as the page's address names it, or null where the\n * address names none and the list shows a default. It changes only by\n * the viewer's doing: a click, a key, a link, back or forward. The page\n * scrolls to the selected row when this changes, and on the first\n * placement after mount; a row that comes into place for new data, such\n * as a default the data moved, is only levelled with.\n */\n revealKey: string | null;\n}\n\n/** The column form: the list and the detail in a grid of their own. */\nexport interface DetailBesideColumnsProps extends DetailBesideBaseProps {\n layout?: 'columns';\n /**\n * `grid-template-columns` of the list and the detail above 768 px, e.g.\n * `'3fr 2fr'`. The detail is never taller than the view, so a long Panel\n * scrolls its body.\n */\n columns: string;\n /** The element that scrolls the page; omitted or null means the viewport. */\n scrollContainer?: HTMLElement | null;\n className?: string;\n}\n\n/** A `Pane` of the pane form, as `Pane` takes it but for its content. */\nexport type DetailBesidePane = Omit<PaneProps, 'children'>;\n\n/**\n * The pane form: the list and the detail as two `Pane`s, set directly in a\n * `PaneLayout` after any panes that come before the list.\n */\nexport interface DetailBesidePanesProps extends DetailBesideBaseProps {\n layout: 'panes';\n /** The list's pane; `size` defaults to `fill`. */\n listPane?: DetailBesidePane;\n /** The detail's pane above 768 px; `size` defaults to `lg`. */\n detailPane?: DetailBesidePane;\n}\n\nexport type DetailBesideProps =\n | DetailBesideColumnsProps\n | DetailBesidePanesProps;\n\nconst NARROW_QUERY = '(max-width: 768px)';\n\n/**\n * The detail as the inline slot draws it. It is kept out of the context the\n * lists read, so a new detail re-renders the slot and not the list.\n */\nconst DetailContext = createContext<ReactNode>(null);\n\n/**\n * How far to scroll so the row is in the view, clear of the `inset` at the\n * view's top, and the detail, whose top can rise no higher than `ceiling`,\n * fits above the view's bottom.\n */\nfunction revealDistance(\n row: DOMRect,\n ceiling: number,\n height: number,\n inset: number,\n view: ViewBounds,\n): number {\n const top = view.top + inset;\n const toRow =\n row.top < top ? row.top - top : Math.max(row.bottom - view.bottom, 0);\n return Math.max(toRow, ceiling + height - view.bottom);\n}\n\n/** The detail right after the selected row, at 768 px and below. */\nfunction InlineDetail({ boxRef }: { boxRef: RefObject<HTMLDivElement> }) {\n const detail = useContext(DetailContext);\n return (\n <div ref={boxRef} className=\"aegis-detail-beside__inline\" role=\"group\">\n {detail}\n </div>\n );\n}\n\n/**\n * A tree, table or map with the selected item's detail beside it. Above\n * 768 px the detail stands in a column on the right, level with the\n * selected row: when the row is too low for it, its bottom meets the\n * view's bottom, and while the page scrolls it stays in the view below\n * the header; while the list draws no row selected, it stands at the\n * column's top. At 768 px and below the list draws the detail right after\n * the selected row, the rows that follow under it; a map draws it over\n * the map, under the node. When the page opens with a selection,\n * `revealKey` changes or the viewer clicks the selected row, the page\n * scrolls at once, as little as it takes to show the row and the detail\n * whole, and again whenever the list or the detail changes size, until the\n * viewer scrolls or the host renders a new list or detail. Any other\n * placement, such as new data moving the selection or the rows, levels\n * the detail with its row by the same rule and leaves the page where it\n * is; the browser's scroll anchoring can still move it when rows arrive\n * above the view, unless the host sets `overflow-anchor: none` on its\n * scroller. The wrapper is `aria-busy` while a selected row it reveals is\n * still on its way.\n *\n * With `layout=\"panes\"` the list and the detail are two `Pane`s of the\n * `PaneLayout` it is set in, divided by a hairline, and each scrolls on its\n * own. Above 768 px the detail stands at its pane's top, and a reveal\n * scrolls the list's pane to the row and the detail's pane to its top. At\n * 768 px and below there is only the list's pane, which draws the detail\n * right after the selected row as the column form does, and a reveal\n * scrolls the nearest scroller around it, the stacked `PaneLayout` in a\n * bleed page. The list is `aria-busy` while a selected row is on its way.\n */\nexport function DetailBeside(props: DetailBesideProps) {\n const { detail, children, revealKey } = props;\n const panes = props.layout === 'panes';\n const scrollContainer = panes ? null : (props.scrollContainer ?? null);\n const narrow = useMediaQuery(NARROW_QUERY);\n const [busy, setBusy] = useState(false);\n const listRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const detailRef = useRef<HTMLDivElement>(null);\n /** Above 768 px in the pane form, the detail's box, whose parent is its pane. */\n const detailPaneRef = useRef<HTMLDivElement>(null);\n /** The scroller of the last reveal, whose scroll by the viewer ends following. */\n const scrollerRef = useRef<HTMLElement | null>(null);\n const rowRef = useRef<HTMLElement | null>(null);\n /** Whether the page is still where the last reveal left it. */\n const followRef = useRef(false);\n const revealedAtRef = useRef(0);\n /** The latest render's revealKey, and the last reveal's: undefined before the first. */\n const revealKeyRef = useRef(revealKey);\n const revealedKeyRef = useRef<string | null | undefined>(undefined);\n /** The latest render's list and detail, which change when the host renders them anew. */\n const shownRef = useRef({ children, detail });\n\n /**\n * Sets the detail level with the row: above 768 px through the spacer's\n * height, at and below by telling the inline detail how tall the row is.\n * While the list draws no row selected, such as when a filter or a closed\n * parent hides it, the detail stands at the top of its column.\n */\n const place = useCallback(() => {\n const row = rowRef.current;\n const box = detailRef.current;\n const spacer = spacerRef.current;\n if (row === null) {\n spacer?.style.removeProperty('height');\n return;\n }\n if (box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n if (spacer === null) {\n box.style.setProperty(\n '--aegis-detail-beside-row-height',\n `${String(rowBox.height)}px`,\n );\n const scroller =\n panes && listRef.current !== null\n ? scrollingAncestorOf(listRef.current)\n : null;\n if (scroller === null) {\n box.style.removeProperty('--detail-beside-view-height');\n box.style.removeProperty('--detail-beside-sticky-top');\n } else {\n box.style.setProperty(\n '--detail-beside-view-height',\n `${String(scroller.clientHeight)}px`,\n );\n box.style.setProperty('--detail-beside-sticky-top', '0px');\n }\n } else {\n const top = spacer.getBoundingClientRect().top;\n spacer.style.height = `${String(Math.max(rowBox.top - top, 0))}px`;\n }\n }, [panes]);\n\n /** Places the row and scrolls as little as it takes to show it and its detail whole. */\n const reveal = useCallback(() => {\n place();\n const row = rowRef.current;\n const list = listRef.current;\n const box = detailRef.current;\n // The detail's own pane, above 768 px, leaves only the row to show.\n const besidePane = detailPaneRef.current !== null;\n if (row === null || list === null || (box === null && !besidePane)) {\n return;\n }\n const container = panes ? scrollingAncestorOf(list) : scrollContainer;\n const rowBox = row.getBoundingClientRect();\n const spacer = spacerRef.current;\n const distance = revealDistance(\n rowBox,\n spacer === null ? rowBox.bottom : spacer.getBoundingClientRect().top,\n box === null ? 0 : box.getBoundingClientRect().height,\n box === null ? 0 : parseFloat(getComputedStyle(box).scrollMarginTop),\n viewBoundsOf(container),\n );\n const scroller = scrollerOf(container);\n if (Math.abs(distance) >= 1) {\n scroller.scrollBy({ top: distance, behavior: 'instant' });\n }\n scrollerRef.current = scroller;\n revealedAtRef.current = scroller.scrollTop;\n }, [panes, place, scrollContainer]);\n\n // A list places its row while React attaches refs, before the detail's\n // own ref is in and before the re-renders its layout effects ask for,\n // so the reveal waits for the commit to finish.\n const revealSoon = useCallback(() => {\n revealedKeyRef.current = revealKeyRef.current;\n detailPaneRef.current?.parentElement?.scrollTo({\n top: 0,\n behavior: 'instant',\n });\n followRef.current = true;\n setBusy(true);\n queueMicrotask(() => {\n reveal();\n setBusy(false);\n });\n }, [reveal]);\n\n // A row placed while a reveal is due is revealed; any other is levelled\n // with, and a new one ends following.\n const placeRow = useCallback(\n (row: HTMLElement | null) => {\n const fresh = row !== rowRef.current;\n rowRef.current = row;\n if (row === null) {\n followRef.current = false;\n setBusy(false);\n place();\n } else if (revealedKeyRef.current !== revealKeyRef.current) {\n revealSoon();\n } else {\n if (fresh) {\n followRef.current = false;\n }\n place();\n }\n },\n [place, revealSoon],\n );\n\n const awaitRow = useCallback(() => {\n setBusy(true);\n }, []);\n\n // Runs after the lists have placed their rows in this commit, so a new\n // revealKey reveals the row it selects. A render by the host without one\n // ends following.\n useIsomorphicLayoutEffect(() => {\n const rendered =\n shownRef.current.children !== children ||\n shownRef.current.detail !== detail;\n shownRef.current = { children, detail };\n revealKeyRef.current = revealKey;\n if (revealedKeyRef.current !== revealKey && rowRef.current !== null) {\n revealSoon();\n } else {\n if (rendered) {\n followRef.current = false;\n }\n place();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current;\n if (list === null) {\n return undefined;\n }\n const observer = new ResizeObserver(() => {\n if (followRef.current) {\n reveal();\n } else {\n place();\n }\n });\n // At 768 px and below the detail lies inside the list.\n for (const box of narrow ? [list] : [list, detailRef.current]) {\n if (box !== null) {\n observer.observe(box);\n }\n }\n const activate = (event: MouseEvent): void => {\n if (\n event.target instanceof Node &&\n rowRef.current?.contains(event.target)\n ) {\n revealSoon();\n }\n };\n list.addEventListener('click', activate);\n return () => {\n observer.disconnect();\n list.removeEventListener('click', activate);\n };\n }, [narrow, place, reveal, revealSoon]);\n\n useEffect(() => {\n const scrolled = (): void => {\n const scroller = scrollerRef.current;\n if (\n scroller !== null &&\n Math.abs(scroller.scrollTop - revealedAtRef.current) >= 1\n ) {\n followRef.current = false;\n }\n };\n // The pane form's scroller is whichever holds the list, found at each\n // reveal; scroll events do not bubble, but they pass the document.\n const target = panes ? document : (scrollContainer ?? window);\n const options = { capture: panes, passive: true };\n target.addEventListener('scroll', scrolled, options);\n return () => {\n target.removeEventListener('scroll', scrolled, options);\n };\n }, [panes, scrollContainer]);\n\n const inline = useMemo(\n () => (narrow ? <InlineDetail boxRef={detailRef} /> : null),\n [narrow],\n );\n const slot = useMemo(\n (): SelectedRowDetail => ({ placeRow, awaitRow, inline }),\n [placeRow, awaitRow, inline],\n );\n const isolated = (\n <SelectedRowDetailContext.Provider value={null}>\n {detail}\n </SelectedRowDetailContext.Provider>\n );\n\n if (props.layout === 'panes') {\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <Pane size=\"fill\" {...props.listPane}>\n <div\n ref={listRef}\n className=\"aegis-detail-beside__list\"\n aria-busy={busy || undefined}\n >\n {children}\n </div>\n </Pane>\n {!narrow && (\n <Pane size=\"lg\" {...props.detailPane}>\n <div ref={detailPaneRef}>{isolated}</div>\n </Pane>\n )}\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n }\n\n const cls = ['aegis-detail-beside', props.className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <div\n className={cls}\n style={\n {\n '--aegis-detail-beside-columns': props.columns,\n } as CSSProperties\n }\n aria-busy={busy || undefined}\n >\n <div ref={listRef} className=\"aegis-detail-beside__list\">\n {children}\n </div>\n {!narrow && (\n <div className=\"aegis-detail-beside__side\">\n <div ref={spacerRef} />\n <div ref={detailRef} className=\"aegis-detail-beside__detail\">\n {isolated}\n </div>\n </div>\n )}\n </div>\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n}\n"],"names":["NARROW_QUERY","DetailContext","createContext","revealDistance","row","ceiling","height","inset","view","top","toRow","InlineDetail","boxRef","detail","useContext","jsx","DetailBeside","props","children","revealKey","panes","scrollContainer","narrow","useMediaQuery","busy","setBusy","useState","listRef","useRef","spacerRef","detailRef","detailPaneRef","scrollerRef","rowRef","followRef","revealedAtRef","revealKeyRef","revealedKeyRef","shownRef","place","useCallback","box","spacer","rowBox","scroller","scrollingAncestorOf","reveal","list","besidePane","container","distance","viewBoundsOf","scrollerOf","revealSoon","placeRow","fresh","awaitRow","useIsomorphicLayoutEffect","rendered","observer","activate","event","useEffect","scrolled","target","options","inline","useMemo","slot","isolated","SelectedRowDetailContext","jsxs","Pane","cls"],"mappings":"2XA4FMA,EAAe,qBAMfC,EAAgBC,EAAAA,cAAyB,IAAI,EAOnD,SAASC,EACPC,EACAC,EACAC,EACAC,EACAC,EACQ,CACR,MAAMC,EAAMD,EAAK,IAAMD,EACjBG,EACJN,EAAI,IAAMK,EAAML,EAAI,IAAMK,EAAM,KAAK,IAAIL,EAAI,OAASI,EAAK,OAAQ,CAAC,EACtE,OAAO,KAAK,IAAIE,EAAOL,EAAUC,EAASE,EAAK,MAAM,CACvD,CAGA,SAASG,EAAa,CAAE,OAAAC,GAAiD,CACvE,MAAMC,EAASC,EAAAA,WAAWb,CA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AAKgB,EAAgB,WAAS,CAAA,CACrC,CAAA,CAAA,CAEJ,CAAA,CACF,EAIJ,MAAM0C,EAAM,CAAC,sBAAuBxD,EAAM,WAAa,EAAE,EACtD,OAAO,OAAO,EACd,KAAK,GAAG,EAEX,OACEF,EAAAA,IAACuD,EAAAA,yBAAyB,SAAzB,CAAkC,MAAOF,EACxC,SAAArD,EAAAA,IAACd,EAAc,SAAd,CAAuB,MAAOoE,EAC7B,SAAAE,EAAAA,KAAC,MAAA,CACC,UAAWE,EACX,MACE,CACE,gCAAiCxD,EAAM,OAAA,EAG3C,YAAWO,GAAQ,OAEnB,SAAA,CAAAT,EAAAA,IAAC,MAAA,CAAI,IAAKY,EAAS,UAAU,4BAC1B,SAAAT,EACH,EACC,CAACI,GACAiD,EAAAA,KAAC,MAAA,CAAI,UAAU,4BACb,SAAA,CAAAxD,EAAAA,IAAC,MAAA,CAAI,IAAKc,CAAA,CAAW,QACpB,MAAA,CAAI,IAAKC,EAAW,UAAU,8BAC5B,SAAAuC,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAGN,CAAA,CACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"DetailBeside.cjs","sources":["../../../src/components/ui/DetailBeside.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type ReactNode,\n type RefObject,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport {\n type ViewBounds,\n scrollerOf,\n scrollingAncestorOf,\n viewBoundsOf,\n} from '../../lib/scrollView';\nimport './DetailBeside.css';\nimport { Pane, type PaneProps } from './PaneLayout';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\n\ninterface DetailBesideBaseProps {\n /**\n * The selected item's detail: one element, such as a `Panel` titled with\n * the item's name. Render it anew from the host's data whenever that\n * data changes: that render tells DetailBeside the change was new data,\n * so the page stays where it is. A detail that fetches its own data and\n * redraws without this host rendering leaves the page following the row,\n * and its next change of size scrolls the page.\n */\n detail: ReactNode;\n /**\n * The list: a `TraceTree`, `FileTree`, `DataTable`, `TreeTable` or\n * `ServiceMap`, in a Panel say. The detail follows the row it draws\n * selected. Like `detail`, render it anew from the host's data whenever\n * that data changes, so the page stays where it is on new data; a list\n * that fetches its own data and redraws without this host rendering\n * leaves the page following the row, and its next change of size scrolls\n * the page.\n */\n children: ReactNode;\n /**\n * The selection as the page's address names it, or null where the\n * address names none and the list shows a default. It changes only by\n * the viewer's doing: a click, a key, a link, back or forward. The page\n * scrolls to the selected row when this changes, and on the first\n * placement after mount; a row that comes into place for new data, such\n * as a default the data moved, is only levelled with.\n */\n revealKey: string | null;\n}\n\n/** The column form: the list and the detail in a grid of their own. */\nexport interface DetailBesideColumnsProps extends DetailBesideBaseProps {\n layout?: 'columns';\n /**\n * `grid-template-columns` of the list and the detail above 768 px, e.g.\n * `'3fr 2fr'`. The detail is never taller than the view, so a long Panel\n * scrolls its body.\n */\n columns: string;\n /**\n * The element that scrolls the page; omitted or null means the viewport.\n * `nearest` is the nearest element around the list that scrolls, found at\n * each reveal, such as the `Pane` the DetailBeside is set in. Inside an\n * element the detail is never taller than that element's view.\n */\n scrollContainer?: HTMLElement | null | 'nearest';\n className?: string;\n}\n\n/** A `Pane` of the pane form, as `Pane` takes it but for its content. */\nexport type DetailBesidePane = Omit<PaneProps, 'children'>;\n\n/**\n * The pane form: the list and the detail as two `Pane`s, set directly in a\n * `PaneLayout` after any panes that come before the list.\n */\nexport interface DetailBesidePanesProps extends DetailBesideBaseProps {\n layout: 'panes';\n /** The list's pane; `size` defaults to `fill`. */\n listPane?: DetailBesidePane;\n /** The detail's pane above 768 px; `size` defaults to `lg`. */\n detailPane?: DetailBesidePane;\n}\n\nexport type DetailBesideProps =\n | DetailBesideColumnsProps\n | DetailBesidePanesProps;\n\nconst NARROW_QUERY = '(max-width: 768px)';\n\n/**\n * The detail as the inline slot draws it. It is kept out of the context the\n * lists read, so a new detail re-renders the slot and not the list.\n */\nconst DetailContext = createContext<ReactNode>(null);\n\n/**\n * How far to scroll so the row is in the view, clear of the `inset` at the\n * view's top, and the detail, whose top can rise no higher than `ceiling`,\n * fits above the view's bottom.\n */\nfunction revealDistance(\n row: DOMRect,\n ceiling: number,\n height: number,\n inset: number,\n view: ViewBounds,\n): number {\n const top = view.top + inset;\n const toRow =\n row.top < top ? row.top - top : Math.max(row.bottom - view.bottom, 0);\n return Math.max(toRow, ceiling + height - view.bottom);\n}\n\n/** The detail right after the selected row, at 768 px and below. */\nfunction InlineDetail({ boxRef }: { boxRef: RefObject<HTMLDivElement> }) {\n const detail = useContext(DetailContext);\n return (\n <div ref={boxRef} className=\"aegis-detail-beside__inline\" role=\"group\">\n {detail}\n </div>\n );\n}\n\n/**\n * A tree, table or map with the selected item's detail beside it. Above\n * 768 px the detail stands in a column on the right, level with the\n * selected row: when the row is too low for it, its bottom meets the\n * view's bottom, and while the page scrolls it stays in the view below\n * the header; while the list draws no row selected, it stands at the\n * column's top. At 768 px and below the list draws the detail right after\n * the selected row, the rows that follow under it; a map draws it over\n * the map, under the node. When the page opens with a selection,\n * `revealKey` changes or the viewer clicks the selected row, the page\n * scrolls at once, as little as it takes to show the row and the detail\n * whole, and again whenever the list or the detail changes size, until the\n * viewer scrolls or the host renders a new list or detail. Any other\n * placement, such as new data moving the selection or the rows, levels\n * the detail with its row by the same rule and leaves the page where it\n * is; the browser's scroll anchoring can still move it when rows arrive\n * above the view, unless the host sets `overflow-anchor: none` on its\n * scroller. The wrapper is `aria-busy` while a selected row it reveals is\n * still on its way.\n *\n * With `layout=\"panes\"` the list and the detail are two `Pane`s of the\n * `PaneLayout` it is set in, divided by a hairline, and each scrolls on its\n * own. Above 768 px the detail stands at its pane's top, and a reveal\n * scrolls the list's pane to the row and the detail's pane to its top. At\n * 768 px and below there is only the list's pane, which draws the detail\n * right after the selected row as the column form does, and a reveal\n * scrolls the nearest scroller around it, the window in a bleed page,\n * which grows with its stacked panes. The list is `aria-busy` while a selected row is on its way.\n */\nexport function DetailBeside(props: DetailBesideProps) {\n const { detail, children, revealKey } = props;\n const panes = props.layout === 'panes';\n /** Whether the scroller is whichever holds the list, found when needed. */\n const nearest = panes || props.scrollContainer === 'nearest';\n const scrollContainer =\n panes || props.scrollContainer === 'nearest'\n ? null\n : (props.scrollContainer ?? null);\n const narrow = useMediaQuery(NARROW_QUERY);\n const [busy, setBusy] = useState(false);\n const listRef = useRef<HTMLDivElement>(null);\n const spacerRef = useRef<HTMLDivElement>(null);\n const detailRef = useRef<HTMLDivElement>(null);\n /** Above 768 px in the pane form, the detail's box, whose parent is its pane. */\n const detailPaneRef = useRef<HTMLDivElement>(null);\n /** The scroller of the last reveal, whose scroll by the viewer ends following. */\n const scrollerRef = useRef<HTMLElement | null>(null);\n const rowRef = useRef<HTMLElement | null>(null);\n /** Whether the page is still where the last reveal left it. */\n const followRef = useRef(false);\n const revealedAtRef = useRef(0);\n /** The latest render's revealKey, and the last reveal's: undefined before the first. */\n const revealKeyRef = useRef(revealKey);\n const revealedKeyRef = useRef<string | null | undefined>(undefined);\n /** The latest render's list and detail, which change when the host renders them anew. */\n const shownRef = useRef({ children, detail });\n /** The scroll container of the latest render; a new one is revealed in anew. */\n const containerRef = useRef(scrollContainer);\n\n /** The element that scrolls the list, or null for the viewport. */\n const scrollerOfList = useCallback(\n (): HTMLElement | null =>\n nearest && listRef.current !== null\n ? scrollingAncestorOf(listRef.current)\n : scrollContainer,\n [nearest, scrollContainer],\n );\n\n /** Bounds the detail by the view of the element that scrolls it. */\n const fitView = useCallback(\n (box: HTMLElement) => {\n const scroller = scrollerOfList();\n if (scroller === null) {\n box.style.removeProperty('--detail-beside-view-height');\n box.style.removeProperty('--detail-beside-sticky-top');\n } else {\n // A sticky box sticks inside the scroller's padding.\n const { paddingTop, paddingBottom } = getComputedStyle(scroller);\n const height =\n scroller.clientHeight -\n parseFloat(paddingTop) -\n parseFloat(paddingBottom);\n box.style.setProperty(\n '--detail-beside-view-height',\n `${String(height)}px`,\n );\n box.style.setProperty('--detail-beside-sticky-top', '0px');\n }\n },\n [scrollerOfList],\n );\n\n /**\n * Sets the detail level with the row: above 768 px through the spacer's\n * height, at and below by telling the inline detail how tall the row is.\n * While the list draws no row selected, such as when a filter or a closed\n * parent hides it, the detail stands at the top of its column.\n */\n const place = useCallback(() => {\n const row = rowRef.current;\n const box = detailRef.current;\n const spacer = spacerRef.current;\n if (row === null) {\n spacer?.style.removeProperty('height');\n return;\n }\n if (box === null) {\n return;\n }\n const rowBox = row.getBoundingClientRect();\n fitView(box);\n if (spacer === null) {\n box.style.setProperty(\n '--aegis-detail-beside-row-height',\n `${String(rowBox.height)}px`,\n );\n } else {\n const top = spacer.getBoundingClientRect().top;\n spacer.style.height = `${String(Math.max(rowBox.top - top, 0))}px`;\n }\n }, [fitView]);\n\n /** Places the row and scrolls as little as it takes to show it and its detail whole. */\n const reveal = useCallback(() => {\n place();\n const row = rowRef.current;\n const list = listRef.current;\n const box = detailRef.current;\n // The detail's own pane, above 768 px, leaves only the row to show.\n const besidePane = detailPaneRef.current !== null;\n if (row === null || list === null || (box === null && !besidePane)) {\n return;\n }\n const container = scrollerOfList();\n const rowBox = row.getBoundingClientRect();\n const spacer = spacerRef.current;\n const distance = revealDistance(\n rowBox,\n spacer === null ? rowBox.bottom : spacer.getBoundingClientRect().top,\n box === null ? 0 : box.getBoundingClientRect().height,\n box === null ? 0 : parseFloat(getComputedStyle(box).scrollMarginTop),\n viewBoundsOf(container),\n );\n const scroller = scrollerOf(container);\n if (Math.abs(distance) >= 1) {\n scroller.scrollBy({ top: distance, behavior: 'instant' });\n }\n scrollerRef.current = scroller;\n revealedAtRef.current = scroller.scrollTop;\n }, [place, scrollerOfList]);\n\n // A list places its row while React attaches refs, before the detail's\n // own ref is in and before the re-renders its layout effects ask for,\n // so the reveal waits for the commit to finish.\n const revealSoon = useCallback(() => {\n revealedKeyRef.current = revealKeyRef.current;\n detailPaneRef.current?.parentElement?.scrollTo({\n top: 0,\n behavior: 'instant',\n });\n followRef.current = true;\n setBusy(true);\n queueMicrotask(() => {\n reveal();\n setBusy(false);\n });\n }, [reveal]);\n\n // A row placed while a reveal is due is revealed; any other is levelled\n // with, and a new one ends following.\n const placeRow = useCallback(\n (row: HTMLElement | null) => {\n const fresh = row !== rowRef.current;\n rowRef.current = row;\n if (row === null) {\n followRef.current = false;\n setBusy(false);\n place();\n } else if (revealedKeyRef.current !== revealKeyRef.current) {\n revealSoon();\n } else {\n if (fresh) {\n followRef.current = false;\n }\n place();\n }\n },\n [place, revealSoon],\n );\n\n const awaitRow = useCallback(() => {\n setBusy(true);\n }, []);\n\n // Runs after the lists have placed their rows in this commit, so a new\n // revealKey reveals the row it selects. A render by the host without one\n // ends following.\n useIsomorphicLayoutEffect(() => {\n const rendered =\n shownRef.current.children !== children ||\n shownRef.current.detail !== detail;\n shownRef.current = { children, detail };\n revealKeyRef.current = revealKey;\n const moved = containerRef.current !== scrollContainer;\n containerRef.current = scrollContainer;\n if (\n (moved || revealedKeyRef.current !== revealKey) &&\n rowRef.current !== null\n ) {\n revealSoon();\n } else {\n if (rendered) {\n followRef.current = false;\n }\n place();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current;\n if (list === null) {\n return undefined;\n }\n const observer = new ResizeObserver(() => {\n if (followRef.current) {\n reveal();\n } else {\n place();\n }\n });\n // At 768 px and below the detail lies inside the list.\n for (const box of narrow ? [list] : [list, detailRef.current]) {\n if (box !== null) {\n observer.observe(box);\n }\n }\n const activate = (event: MouseEvent): void => {\n if (\n event.target instanceof Node &&\n rowRef.current?.contains(event.target)\n ) {\n revealSoon();\n }\n };\n list.addEventListener('click', activate);\n return () => {\n observer.disconnect();\n list.removeEventListener('click', activate);\n };\n }, [narrow, place, reveal, revealSoon]);\n\n useEffect(() => {\n const scrolled = (): void => {\n const scroller = scrollerRef.current;\n if (\n scroller !== null &&\n Math.abs(scroller.scrollTop - revealedAtRef.current) >= 1\n ) {\n followRef.current = false;\n }\n };\n // A nearest scroller is whichever holds the list, found at each\n // reveal; scroll events do not bubble, but they pass the document.\n const target = nearest ? document : (scrollContainer ?? window);\n const options = { capture: nearest, passive: true };\n target.addEventListener('scroll', scrolled, options);\n return () => {\n target.removeEventListener('scroll', scrolled, options);\n };\n }, [nearest, scrollContainer]);\n\n const inline = useMemo(\n () => (narrow ? <InlineDetail boxRef={detailRef} /> : null),\n [narrow],\n );\n const slot = useMemo(\n (): SelectedRowDetail => ({ placeRow, awaitRow, inline }),\n [placeRow, awaitRow, inline],\n );\n const isolated = (\n <SelectedRowDetailContext.Provider value={null}>\n {detail}\n </SelectedRowDetailContext.Provider>\n );\n\n if (props.layout === 'panes') {\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <Pane size=\"fill\" {...props.listPane}>\n <div\n ref={listRef}\n className=\"aegis-detail-beside__list\"\n aria-busy={busy || undefined}\n >\n {children}\n </div>\n </Pane>\n {!narrow && (\n <Pane size=\"lg\" {...props.detailPane}>\n <div ref={detailPaneRef}>{isolated}</div>\n </Pane>\n )}\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n }\n\n const cls = ['aegis-detail-beside', props.className ?? '']\n .filter(Boolean)\n .join(' ');\n\n return (\n <SelectedRowDetailContext.Provider value={slot}>\n <DetailContext.Provider value={isolated}>\n <div\n className={cls}\n style={\n {\n '--aegis-detail-beside-columns': props.columns,\n } as CSSProperties\n }\n aria-busy={busy || undefined}\n >\n <div ref={listRef} className=\"aegis-detail-beside__list\">\n {children}\n </div>\n {!narrow && (\n <div className=\"aegis-detail-beside__side\">\n <div ref={spacerRef} />\n <div ref={detailRef} className=\"aegis-detail-beside__detail\">\n {isolated}\n </div>\n </div>\n )}\n </div>\n </DetailContext.Provider>\n </SelectedRowDetailContext.Provider>\n );\n}\n"],"names":["NARROW_QUERY","DetailContext","createContext","revealDistance","row","ceiling","height","inset","view","top","toRow","InlineDetail","boxRef","detail","useContext","jsx","DetailBeside","props","children","revealKey","panes","nearest","scrollContainer","narrow","useMediaQuery","busy","setBusy","useState","listRef","useRef","spacerRef","detailRef","detailPaneRef","scrollerRef","rowRef","followRef","revealedAtRef","revealKeyRef","revealedKeyRef","shownRef","containerRef","scrollerOfList","useCallback","scrollingAncestorOf","fitView","box","scroller","paddingTop","paddingBottom","place","spacer","rowBox","reveal","list","besidePane","container","distance","viewBoundsOf","scrollerOf","revealSoon","placeRow","fresh","awaitRow","useIsomorphicLayoutEffect","rendered","moved","observer","activate","event","useEffect","scrolled","target","options","inline","useMemo","slot","isolated","SelectedRowDetailContext","jsxs","Pane","cls"],"mappings":"2XAiGMA,EAAe,qBAMfC,EAAgBC,EAAAA,cAAyB,IAAI,EAOnD,SAASC,EACPC,EACAC,EACAC,EACAC,EACAC,EACQ,CACR,MAAMC,EAAMD,EAAK,IAAMD,EACjBG,EACJN,EAAI,IAAMK,EAAML,EAAI,IAAMK,EAAM,KAAK,IAAIL,EAAI,OAASI,EAAK,OAAQ,CAAC,EACtE,OAAO,KAAK,IAAIE,EAAOL,EAAUC,EAASE,EAAK,MAAM,CACvD,CAGA,SAASG,EAAa,CAAE,OAAAC,GAAiD,CACvE,MAAMC,EAASC,EAAAA,WAAWb,CAAa,EACvC,OACEc,MAAC,OAAI,IAAKH,EAAQ,UAAU,8BAA8B,KAAK,QAC5D,SAAAC,CAAA,CACH,CAEJ,CA+BO,SAASG,EAAaC,EAA0B,CACrD,KAAM,CAAE,OAAAJ,EAAQ,SAAAK,EAAU,UAAAC,CAAA,EAAcF,EAClCG,EAAQH,EAAM,SAAW,QAEzBI,EAAUD,GAASH,EAAM,kBAAoB,UAC7CK,EACJF,GAASH,EAAM,kBAAoB,UAC/B,KACCA,EAAM,iBAAmB,KAC1BM,EAASC,EAAAA,cAAcxB,CAAY,EACnC,CAACyB,EAAMC,CAAO,EAAIC,EAAAA,SAAS,EAAK,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IAAC,MAAA,CAAI,IAAKiB,EAAgB,WAAS,CAAA,CACrC,CAAA,CAAA,CAEJ,CAAA,CACF,EAIJ,MAAMgD,EAAM,CAAC,sBAAuB/D,EAAM,WAAa,EAAE,EACtD,OAAO,OAAO,EACd,KAAK,GAAG,EAEX,OACEF,EAAAA,IAAC8D,EAAAA,yBAAyB,SAAzB,CAAkC,MAAOF,EACxC,SAAA5D,EAAAA,IAACd,EAAc,SAAd,CAAuB,MAAO2E,EAC7B,SAAAE,EAAAA,KAAC,MAAA,CACC,UAAWE,EACX,MACE,CACE,gCAAiC/D,EAAM,OAAA,EAG3C,YAAWQ,GAAQ,OAEnB,SAAA,CAAAV,EAAAA,IAAC,MAAA,CAAI,IAAKa,EAAS,UAAU,4BAC1B,SAAAV,EACH,EACC,CAACK,GACAuD,EAAAA,KAAC,MAAA,CAAI,UAAU,4BACb,SAAA,CAAA/D,EAAAA,IAAC,MAAA,CAAI,IAAKe,CAAA,CAAW,QACpB,MAAA,CAAI,IAAKC,EAAW,UAAU,8BAC5B,SAAA6C,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAGN,CAAA,CACF,CAEJ"}
|
|
@@ -39,8 +39,13 @@ export interface DetailBesideColumnsProps extends DetailBesideBaseProps {
|
|
|
39
39
|
* scrolls its body.
|
|
40
40
|
*/
|
|
41
41
|
columns: string;
|
|
42
|
-
/**
|
|
43
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The element that scrolls the page; omitted or null means the viewport.
|
|
44
|
+
* `nearest` is the nearest element around the list that scrolls, found at
|
|
45
|
+
* each reveal, such as the `Pane` the DetailBeside is set in. Inside an
|
|
46
|
+
* element the detail is never taller than that element's view.
|
|
47
|
+
*/
|
|
48
|
+
scrollContainer?: HTMLElement | null | 'nearest';
|
|
44
49
|
className?: string;
|
|
45
50
|
}
|
|
46
51
|
/** A `Pane` of the pane form, as `Pane` takes it but for its content. */
|
|
@@ -83,8 +88,8 @@ export type DetailBesideProps = DetailBesideColumnsProps | DetailBesidePanesProp
|
|
|
83
88
|
* scrolls the list's pane to the row and the detail's pane to its top. At
|
|
84
89
|
* 768 px and below there is only the list's pane, which draws the detail
|
|
85
90
|
* right after the selected row as the column form does, and a reveal
|
|
86
|
-
* scrolls the nearest scroller around it, the
|
|
87
|
-
*
|
|
91
|
+
* scrolls the nearest scroller around it, the window in a bleed page,
|
|
92
|
+
* which grows with its stacked panes. The list is `aria-busy` while a selected row is on its way.
|
|
88
93
|
*/
|
|
89
94
|
export declare function DetailBeside(props: DetailBesideProps): import("react/jsx-runtime").JSX.Element;
|
|
90
95
|
export {};
|