@eifi1/ui-kit 0.48.2 → 0.49.0
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/README.md +26 -12
- package/dist/admin/admin-action-confirm.js +1 -1
- package/dist/admin/admin-action-confirm.js.map +1 -1
- package/dist/admin/invitations-panel.js +5 -1
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/user-roster.d.ts +11 -5
- package/dist/admin/user-roster.js +15 -4
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/accept-invitation.js +2 -2
- package/dist/auth/accept-invitation.js.map +1 -1
- package/dist/auth/not-found-page.js +1 -1
- package/dist/auth/not-found-page.js.map +1 -1
- package/dist/auth/reset-password-form.js +2 -2
- package/dist/auth/reset-password-form.js.map +1 -1
- package/dist/auth/verify-email.js +2 -2
- package/dist/auth/verify-email.js.map +1 -1
- package/dist/billing/plan-card.js +2 -2
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/components/breadcrumbs.d.ts +19 -1
- package/dist/components/breadcrumbs.js +11 -4
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button-look.d.ts +37 -7
- package/dist/components/button-look.js +33 -6
- package/dist/components/button-look.js.map +1 -1
- package/dist/components/button.d.ts +4 -1
- package/dist/components/button.js +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-heatmap.js +2 -1
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/chart-edge.d.ts +10 -0
- package/dist/components/chart-edge.js +57 -0
- package/dist/components/chart-edge.js.map +1 -0
- package/dist/components/chart.js +2 -1
- package/dist/components/chart.js.map +1 -1
- package/dist/components/chip.d.ts +8 -1
- package/dist/components/chip.js +4 -1
- package/dist/components/chip.js.map +1 -1
- package/dist/components/confirm-context.d.ts +5 -0
- package/dist/components/confirm-context.js +7 -0
- package/dist/components/confirm-context.js.map +1 -0
- package/dist/components/confirm-dialog.js +3 -3
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +2 -2
- package/dist/components/danger-confirm.js +1 -1
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-fit.js +21 -3
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/data-table-mobile.d.ts +48 -2
- package/dist/components/data-table-mobile.js +87 -10
- package/dist/components/data-table-mobile.js.map +1 -1
- package/dist/components/data-table-row-actions.d.ts +2 -1
- package/dist/components/data-table-row-actions.js +7 -0
- package/dist/components/data-table-row-actions.js.map +1 -1
- package/dist/components/data-table-row.d.ts +1 -1
- package/dist/components/data-table-row.js.map +1 -1
- package/dist/components/data-table.d.ts +34 -1
- package/dist/components/data-table.js +34 -9
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/error-boundary.js +2 -2
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/floating-panel.d.ts +36 -13
- package/dist/components/floating-panel.js +27 -7
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/form-actions.d.ts +1 -1
- package/dist/components/form-actions.js +1 -1
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/icon-button.d.ts +11 -0
- package/dist/components/icon-button.js +7 -5
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/nav-pills.d.ts +8 -1
- package/dist/components/nav-pills.js +61 -38
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/page-header-context.d.ts +8 -0
- package/dist/components/page-header-context.js +7 -0
- package/dist/components/page-header-context.js.map +1 -0
- package/dist/components/page-header.d.ts +14 -2
- package/dist/components/page-header.js +10 -1
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pie-chart.js +2 -1
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/progress-bar.js +5 -4
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/reauth-dialog.js +1 -1
- package/dist/components/reauth-dialog.js.map +1 -1
- package/dist/components/row-actions-labels.js +3 -1
- package/dist/components/row-actions-labels.js.map +1 -1
- package/dist/components/row-actions.d.ts +43 -9
- package/dist/components/row-actions.js +78 -15
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/section-nav.d.ts +37 -0
- package/dist/components/section-nav.js +33 -0
- package/dist/components/section-nav.js.map +1 -0
- package/dist/components/series-chart.js +8 -3
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/share-card.js +1 -1
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/signature-pad.js +1 -1
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/sparkline.js +2 -1
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/stat-tile.js +14 -7
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +5 -1
- package/dist/components/status-dot.js +4 -1
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/translation-review-editor.js +2 -2
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review.js +2 -2
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/treemap.d.ts +5 -2
- package/dist/components/treemap.js +26 -6
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/use-table-state.js +37 -6
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/demo/demo-banner.js +1 -1
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/demo/demo-ended.js +1 -1
- package/dist/demo/demo-ended.js.map +1 -1
- package/dist/demo/demo-start.js +1 -1
- package/dist/demo/demo-start.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-inbox.js +1 -1
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +9 -1
- package/dist/hooks/use-dismiss.js +25 -5
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/hooks/use-document-title.d.ts +14 -0
- package/dist/hooks/use-document-title.js +22 -0
- package/dist/hooks/use-document-title.js.map +1 -0
- package/dist/i18n/german.js +6 -2
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +31 -1
- package/dist/i18n/kit-labels.js +43 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +6 -2
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/es.js +6 -2
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +6 -2
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +6 -2
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +6 -2
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +6 -2
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +2 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js +1 -0
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-actions.js +2 -2
- package/dist/landing/landing-actions.js.map +1 -1
- package/dist/landing/public-header.js +2 -2
- package/dist/landing/public-header.js.map +1 -1
- package/dist/lib/clipboard-minus.d.ts +27 -0
- package/dist/lib/clipboard-minus.js +63 -0
- package/dist/lib/clipboard-minus.js.map +1 -0
- package/dist/lib/document-title.d.ts +17 -0
- package/dist/lib/document-title.js +29 -0
- package/dist/lib/document-title.js.map +1 -0
- package/dist/lib/float-clearance.js +8 -2
- package/dist/lib/float-clearance.js.map +1 -1
- package/dist/lib/format.d.ts +35 -10
- package/dist/lib/format.js +55 -11
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/minus.d.ts +22 -0
- package/dist/lib/minus.js +14 -0
- package/dist/lib/minus.js.map +1 -0
- package/dist/lib/status-tone.d.ts +30 -0
- package/dist/lib/status-tone.js +17 -0
- package/dist/lib/status-tone.js.map +1 -0
- package/dist/settings/settings-layout.js +3 -2
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/shell/account-menu-language.d.ts +1 -1
- package/dist/shell/account-menu-language.js +9 -1
- package/dist/shell/account-menu-language.js.map +1 -1
- package/dist/shell/app-shell-labels.js +2 -1
- package/dist/shell/app-shell-labels.js.map +1 -1
- package/dist/shell/app-shell.d.ts +58 -16
- package/dist/shell/app-shell.js +151 -43
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/language-code.d.ts +3 -0
- package/dist/shell/language-code.js +8 -0
- package/dist/shell/language-code.js.map +1 -0
- package/dist/shell/topbar-controls.d.ts +14 -6
- package/dist/shell/topbar-controls.js +14 -17
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/testing/css-variables.generated.d.ts +1 -1
- package/dist/testing/css-variables.generated.js +1 -1
- package/dist/testing/css-variables.generated.js.map +1 -1
- package/dist/theme/chart-palette.d.ts +82 -15
- package/dist/theme/chart-palette.js +51 -24
- package/dist/theme/chart-palette.js.map +1 -1
- package/dist/theme/palette-presets.d.ts +9 -0
- package/dist/theme/palette-presets.js +77 -62
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/tour/tour.js +1 -1
- package/dist/tour/tour.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +1 -1
- package/dist/wizard/stepper-nav.js +3 -3
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/package.json +1 -1
- package/src/admin/admin-action-confirm.tsx +1 -1
- package/src/admin/invitations-panel.tsx +7 -3
- package/src/admin/user-roster.tsx +23 -6
- package/src/auth/accept-invitation.tsx +3 -3
- package/src/auth/not-found-page.tsx +1 -1
- package/src/auth/reset-password-form.tsx +3 -3
- package/src/auth/verify-email.tsx +3 -3
- package/src/billing/plan-card.tsx +2 -2
- package/src/components/breadcrumbs.tsx +32 -4
- package/src/components/button-look.ts +86 -15
- package/src/components/button.tsx +6 -3
- package/src/components/calendar-heatmap.tsx +2 -1
- package/src/components/chart-edge.ts +73 -0
- package/src/components/chart.tsx +3 -1
- package/src/components/chip.tsx +10 -1
- package/src/components/confirm-context.ts +7 -0
- package/src/components/confirm-dialog.tsx +3 -3
- package/src/components/danger-confirm.tsx +3 -3
- package/src/components/data-table-fit.ts +41 -6
- package/src/components/data-table-mobile.tsx +162 -11
- package/src/components/data-table-row-actions.tsx +9 -1
- package/src/components/data-table-row.tsx +2 -0
- package/src/components/data-table.tsx +82 -18
- package/src/components/error-boundary.tsx +2 -2
- package/src/components/floating-panel.tsx +67 -16
- package/src/components/form-actions.tsx +2 -2
- package/src/components/icon-button.tsx +21 -8
- package/src/components/nav-pills.tsx +29 -2
- package/src/components/page-header-context.ts +8 -0
- package/src/components/page-header.tsx +34 -2
- package/src/components/pie-chart.tsx +2 -1
- package/src/components/progress-bar.tsx +6 -3
- package/src/components/reauth-dialog.tsx +1 -1
- package/src/components/row-actions-labels.ts +2 -0
- package/src/components/row-actions.tsx +154 -33
- package/src/components/section-nav.tsx +65 -0
- package/src/components/series-chart.tsx +12 -3
- package/src/components/share-card.tsx +1 -1
- package/src/components/signature-pad.tsx +1 -1
- package/src/components/sparkline.tsx +2 -1
- package/src/components/stat-tile.tsx +19 -7
- package/src/components/status-dot.tsx +7 -1
- package/src/components/tooltip.tsx +3 -1
- package/src/components/translation-review-editor.tsx +2 -2
- package/src/components/translation-review.tsx +2 -2
- package/src/components/treemap.tsx +34 -8
- package/src/components/use-table-state.ts +63 -8
- package/src/data-table.ts +3 -3
- package/src/demo/demo-banner.tsx +1 -1
- package/src/demo/demo-ended.tsx +1 -1
- package/src/demo/demo-start.tsx +1 -1
- package/src/feedback/feedback-inbox.tsx +1 -1
- package/src/hooks/use-dismiss.ts +43 -4
- package/src/hooks/use-document-title.ts +31 -0
- package/src/i18n/german.ts +4 -0
- package/src/i18n/kit-labels.tsx +76 -1
- package/src/i18n/locales/es.ts +4 -0
- package/src/i18n/locales/fr.ts +4 -0
- package/src/i18n/locales/hu.ts +4 -0
- package/src/i18n/locales/it.ts +4 -0
- package/src/i18n/locales/zh.ts +4 -0
- package/src/i18n/review.ts +2 -0
- package/src/i18n/shared-labels.ts +1 -0
- package/src/index.ts +13 -0
- package/src/landing/landing-actions.tsx +2 -2
- package/src/landing/public-header.tsx +2 -2
- package/src/lib/clipboard-minus.ts +94 -0
- package/src/lib/document-title.ts +41 -0
- package/src/lib/float-clearance.ts +19 -3
- package/src/lib/format.ts +115 -30
- package/src/lib/minus.ts +40 -0
- package/src/lib/status-tone.ts +43 -0
- package/src/settings/settings-layout.tsx +3 -2
- package/src/shell/account-menu-language.tsx +14 -2
- package/src/shell/app-shell-labels.ts +1 -0
- package/src/shell/app-shell.tsx +291 -68
- package/src/shell/language-code.ts +5 -0
- package/src/shell/topbar-controls.tsx +35 -15
- package/src/testing/css-variables.generated.ts +6 -6
- package/src/theme/chart-palette.ts +102 -20
- package/src/theme/palette-presets.ts +121 -84
- package/src/tour/tour.tsx +1 -1
- package/src/wizard/stepper-nav.tsx +4 -4
- package/tokens.css +28 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/data-table-row.tsx"],"sourcesContent":["import { Fragment, memo } from \"react\";\nimport type { MouseEvent as ReactMouseEvent, ReactNode, RefObject } from \"react\";\nimport { RowLink, cleanAttrs, fromOutside, fromOwnControl, logicalAlign, splitCellProps } from \"./data-table-shared\";\nimport { GROW_CELL_CLASS, GROW_PEER_CELL_CLASS } from \"./data-table-fit\";\nimport { MobileRow, type MobileRowProps } from \"./data-table-mobile\";\nimport type { DataTableColumn, MobileSwipeActions } from \"./data-table\";\nimport { cn } from \"../lib/cn\";\n\n// DataTable's rows as memoised components (0.48.2, keksdose K-052-2, dev #632 — Marcel:\n// \"The table is extremely slow. Is it virtualised or is everytime the whole table\n// rendered?\"). The owner's selection, expansion and the roving focus all live ABOVE the\n// rows, so every tick re-rendered the whole table: on keksdose's register one checkbox\n// cost 430–1200 ms of INP at 271 rows. A row now bails out unless one of its own inputs\n// changed.\n//\n// What a row compares, and so the contract a call site keeps:\n// * the row object, its index and its key;\n// * what the table derived for it from the caller's functions, as PRIMITIVES — selected,\n// selectable, expanded, its tab stop, its `rowClassName` string, its `rowHref`, and\n// its `rowAttributes` compared key by key. The functions themselves may be inline;\n// * the column definitions BY IDENTITY: a cell is the caller's render function, and\n// what it reads is the caller's to say. A page that memoises its columns (keksdose's\n// `useTransactionColumns`) gets the bail-out; one that writes them inline gets a new\n// array every render and the full re-render it always had — never a stale cell;\n// * an OPEN row's detail (`expandedRow`) is called on every render, so it re-renders\n// with the table as before, and an editor inside it keeps its live inputs.\n// The handlers do not take part: they read the table's latest props through `ctx`, a\n// ref the table refreshes each commit, so a row that bailed out still acts on the\n// current selection and the current `onRowClick`.\n\n/** What a row's handlers read at event time — DataTable's latest props and helpers. */\nexport interface DataTableRowCtx<T> {\n onRowClick: ((row: T) => void) | undefined;\n onToggle: ((row: T, checked: boolean) => void) | undefined;\n isSelected: (row: T) => boolean;\n canSelect: (row: T) => boolean;\n selectRange: (toIndex: number) => boolean;\n /** Anchor the next Shift+click range on this row's key. */\n setAnchor: (key: string | number) => void;\n /** Remember the checkbox click that drew a range… */\n markRangeClick: (e: Event) => void;\n /** …and drop that click's own change event (true once for it). */\n takeRangeClick: (e: Event) => boolean;\n setFocusRowKey: (key: string | number) => void;\n /** The phone card's long press: enter selection mode with this row selected. */\n onLongPress: (row: T) => void;\n /** Under `virtualize` (0.48.2): Arrow/Home/End over every row, rendered or not. True\n * when the key was one of them. Without it the roving walks the rendered rows. */\n moveFocus?: (fromIndex: number, key: string) => boolean;\n}\n\n/** `rowAttributes`' result compared key by key: a call site returns a fresh object (or\n * `undefined`) per call, and its values are strings. */\nfunction sameAttrs(\n a: Record<string, string | undefined> | undefined,\n b: Record<string, string | undefined> | undefined,\n): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n const ak = Object.keys(a);\n if (ak.length !== Object.keys(b).length) return false;\n for (const k of ak) if (a[k] !== b[k]) return false;\n return true;\n}\n\nfunction sameProps<P extends { attrs?: Record<string, string | undefined> }>(prev: P, next: P): boolean {\n for (const k of Object.keys(next) as (keyof P)[]) {\n if (k === \"attrs\") continue;\n if (!Object.is(prev[k], next[k])) return false;\n }\n return sameAttrs(prev.attrs, next.attrs);\n}\n\n/** Arrow/Home/End between the focusable rows of the table's bodies — the roving half of\n * the keyboard-activatable rows (see the row's `onKeyDown`). */\nfunction moveRowFocus(from: HTMLElement, key: string): boolean {\n if (!(key in ROW_NAV_KEYS)) return false;\n // Every body of the table: a grouped table (`groupBy`, 0.48) has one per group.\n const table = from.closest(\"table\");\n if (!table) return false;\n const rows = Array.from(table.tBodies).flatMap((body) =>\n Array.from(body.children).filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.hasAttribute(\"data-row-nav\"),\n ),\n );\n const i = rows.indexOf(from);\n const target =\n key === \"ArrowDown\"\n ? rows[i + 1]\n : key === \"ArrowUp\"\n ? rows[i - 1]\n : key === \"Home\"\n ? rows[0]\n : key === \"End\"\n ? rows[rows.length - 1]\n : undefined;\n // At either end the key is still consumed, or ArrowDown on the last row would\n // scroll the page out from under a focused row.\n target?.focus();\n return true;\n}\nconst ROW_NAV_KEYS = { ArrowDown: 1, ArrowUp: 1, Home: 1, End: 1 } as const;\n\n// ---------- Desktop row ----------\n\nexport interface DataTableRowProps<T> {\n row: T;\n rowIndex: number;\n rowKey: string | number;\n ctx: RefObject<DataTableRowCtx<T>>;\n columns: DataTableColumn<T>[];\n widths: Record<string, number>;\n growDrawn: boolean;\n linkColumn: DataTableColumn<T> | undefined;\n href: string | undefined;\n /** The selection column is drawn (DataTable's `selection`). */\n selectionColumn: boolean;\n selectable: boolean;\n selected: boolean;\n expanded: boolean;\n /** The open row's detail; `null` on a closed row. */\n expansion: ReactNode;\n /** The row carries the visually hidden disclosure button (focusable rows that expand). */\n disclosure: boolean;\n detailId: string;\n rowsFocusable: boolean;\n rowInteractive: boolean;\n tabbable: boolean;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n compact: boolean;\n totalColSpan: number;\n rowDetailsLabel: string;\n selectRowLabel: string;\n /** Under `virtualize` (0.48.2): the row's `aria-rowindex` (its open detail row is the\n * next), and the row is marked with its index for the window's measuring. */\n ariaRowIndex?: number;\n}\n\nfunction DataTableRowImpl<T>({\n row,\n rowIndex,\n rowKey: key,\n ctx,\n columns,\n widths,\n growDrawn,\n linkColumn,\n href,\n selectionColumn,\n selectable,\n selected,\n expanded,\n expansion,\n disclosure: hasDisclosure,\n detailId,\n rowsFocusable,\n rowInteractive,\n tabbable,\n className,\n attrs,\n compact,\n totalColSpan,\n rowDetailsLabel,\n selectRowLabel,\n ariaRowIndex,\n}: DataTableRowProps<T>) {\n const windowed = ariaRowIndex !== undefined;\n // Whether the row is open, said where ARIA allows it (round 0.34, the\n // showcase's axe check): `aria-expanded` belongs to a treegrid's row, not a\n // table's, and the <tr> wore it. A disclosure button in the first cell carries\n // it now, with `aria-controls` on the detail row while that is there.\n // Visually hidden and not a tab stop: the row stays the one roving stop, with\n // Enter/Space and the whole-row click — this is the screen reader cursor's\n // way in, and where it hears the state. Named by `aria-label`, so the cell's\n // text stays the cell's own.\n const disclosure = hasDisclosure ? (\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"sr-only-fixed\"\n aria-label={rowDetailsLabel}\n aria-expanded={expanded}\n aria-controls={expansion ? detailId : undefined}\n // The row's own handler leaves a click on a control inside it alone.\n onClick={() => ctx.current.onRowClick!(row)}\n />\n ) : null;\n return (\n <Fragment>\n <tr\n {...cleanAttrs(attrs)}\n aria-rowindex={ariaRowIndex}\n data-row-index={windowed ? rowIndex : undefined}\n data-row-nav={rowsFocusable ? \"\" : undefined}\n tabIndex={rowsFocusable ? (tabbable ? 0 : -1) : undefined}\n onFocus={\n rowsFocusable\n ? (e) => {\n if (e.target === e.currentTarget) ctx.current.setFocusRowKey(key);\n }\n : undefined\n }\n onKeyDown={\n rowsFocusable\n ? (e) => {\n // Only the row's own key presses: Enter on a nested button\n // or link is that control's, and Space in a nested input\n // is a space.\n if (e.target !== e.currentTarget) return;\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n // Space would otherwise scroll the table.\n e.preventDefault();\n ctx.current.onRowClick!(row);\n return;\n }\n if (e.shiftKey) return;\n const move = ctx.current.moveFocus;\n if (move ? move(rowIndex, e.key) : moveRowFocus(e.currentTarget, e.key)) e.preventDefault();\n }\n : undefined\n }\n className={cn(\n \"border-t border-subtle\",\n rowInteractive && \"cursor-pointer hover:bg-hover\",\n // The kit's focus frame width (§5, `--focus-ring-width`), drawn as an\n // OUTLINE rather than FOCUS_RING's box-shadow: a shadow on a `<tr>`\n // is not painted by every engine, an outline is.\n rowsFocusable &&\n \"focus-visible:bg-hover focus-visible:outline-focus focus-visible:-outline-offset-2 focus-visible:outline-brand\",\n className,\n )}\n onClick={\n rowInteractive\n ? (e: ReactMouseEvent<HTMLTableRowElement>) => {\n const c = ctx.current;\n // A click on a control inside the row (a button, a link,\n // an input the cell renders) is that control's — it must\n // not also open the row. Cells no longer have to\n // `stopPropagation` to get that.\n if (fromOwnControl(e.target, e.currentTarget)) return;\n if (fromOutside(e.target, e.currentTarget)) return;\n // Modifier-clicks anywhere in the row drive\n // selection instead of expanding it (feedback #289):\n // Ctrl/Cmd toggles a single row, Shift selects the\n // range from the last-toggled row (inclusive of this\n // one) — the same as the checkbox, but for the whole\n // row, which is what the checkbox-only version was\n // missing.\n if (c.onToggle && c.canSelect(row)) {\n if (e.shiftKey) {\n // Drop the text selection a shift-click would\n // otherwise smear across the rows.\n window.getSelection?.()?.removeAllRanges();\n if (c.selectRange(rowIndex)) return;\n // No anchor yet: treat it as the first pick.\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n if (e.metaKey || e.ctrlKey) {\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n }\n c.onRowClick?.(row);\n }\n : undefined\n }\n >\n {selectionColumn && (\n <td\n className={cn(\"align-top\", compact ? \"w-8 px-2 py-1\" : \"w-10 px-3 py-2\")}\n // Don't let selecting a row also trigger the row click\n // (which expands/edits it).\n onClick={(e) => e.stopPropagation()}\n >\n {selectable && (\n <input\n type=\"checkbox\"\n className={cn(\"accent-indigo-600\", compact ? \"size-3.5\" : \"size-4\")}\n checked={selected}\n // Shift+click selects the range from the last toggled\n // row. `preventDefault` puts the box back, but it does NOT\n // stop React's `onChange`: React derives a checkbox's\n // change from the `click` itself, after the browser has\n // already flipped `checked` and before the cancellation\n // reverts it — so the same click also reported itself as\n // a single toggle, and the owner got `onToggleMany` and\n // then `onToggle` for the clicked row. The click is\n // remembered by identity and its change is dropped; a\n // boolean flag would outlive a click whose change never\n // came and swallow the user's next real one.\n onClick={(e) => {\n if (e.shiftKey && ctx.current.selectRange(rowIndex)) {\n e.preventDefault();\n ctx.current.markRangeClick(e.nativeEvent);\n }\n }}\n onChange={(e) => {\n const c = ctx.current;\n if (c.takeRangeClick(e.nativeEvent)) return;\n c.setAnchor(key);\n c.onToggle?.(row, e.target.checked);\n }}\n aria-label={selectRowLabel}\n />\n )}\n </td>\n )}\n {columns.map((col, colIndex) => {\n const width = widths[col.key];\n // The caller's first, the table's over it — see `cellProps`.\n const own = splitCellProps(col.cellProps?.(row));\n const pinned = width ? { width, minWidth: width, maxWidth: width } : undefined;\n return (\n <td\n {...own.attrs}\n key={col.key}\n data-col={col.key}\n style={own.style || pinned ? { ...own.style, ...pinned } : undefined}\n className={cn(\n \"align-top\",\n compact ? \"px-2 py-1\" : \"px-3 py-2\",\n width && \"overflow-hidden text-ellipsis\",\n col.grow ? GROW_CELL_CLASS : growDrawn && GROW_PEER_CELL_CLASS,\n logicalAlign(own.className),\n logicalAlign(col.className),\n )}\n >\n {colIndex === 0 && disclosure}\n {col === linkColumn && href ? (\n // No `onActivate`: the click is left to bubble to the\n // <tr> handler above, which already owns expand-vs-select.\n // Calling it here as well would toggle the row twice.\n <RowLink href={href} className=\"block\" data-row-link=\"\">\n {col.cell(row)}\n </RowLink>\n ) : (\n col.cell(row)\n )}\n </td>\n );\n })}\n </tr>\n {expansion && (\n <tr\n id={hasDisclosure ? detailId : undefined}\n aria-rowindex={windowed ? ariaRowIndex + 1 : undefined}\n data-row-detail={windowed ? rowIndex : undefined}\n className=\"bg-surface-2 border-t border-subtle\"\n >\n {/* The detail panel spans every column. In an `auto` table\n layout (the default here — columns only get fixed style\n widths once the user resizes/auto-sizes them) the cell's\n content preferred-width is redistributed across the\n spanned columns, so a long expansion visibly re-sizes the\n columns above it — and one-line content does not, since\n its preferred width is small (feedback #104). Wrapping the\n content in `w-0 min-w-full` pins the cell's preferred\n width to ~0 (the explicit width:0 child), so it can never\n perturb the columns; the div then fills to the full row\n width only at paint time, and long text wraps within it.\n Inside it the content is pinned to what the scroller SHOWS\n (0.47, keksdose S4): on a table wider than its scroller a\n table-wide panel put an inline editor's Save/Cancel off-screen.\n `sticky start-0` holds it at the scroller's start edge (the\n right one in RTL) as the row scrolls sideways, and\n `--dt-visible-w` (the scroller's clientWidth, measured above)\n sizes it; before the first measure, and in a table no wider\n than its scroller, it is the full width as before. */}\n <td colSpan={totalColSpan} className=\"p-0\">\n <div className=\"w-0 min-w-full\">\n <div\n className={cn(\n \"sticky start-0 w-[var(--dt-visible-w,100%)] max-w-full\",\n compact ? \"px-2 py-2\" : \"px-3 py-3\",\n )}\n >\n {expansion}\n </div>\n </div>\n </td>\n </tr>\n )}\n </Fragment>\n );\n}\n\n/** One desktop row (its `<tr>` and, while open, its detail row), memoised — see the\n * file's note for what it compares. */\nexport const DataTableRow = memo(DataTableRowImpl, sameProps) as <T>(\n props: DataTableRowProps<T> & { key?: string | number },\n) => ReactNode;\n\n// ---------- Phone card ----------\n\nexport interface DataTableMobileRowProps<T>\n extends Pick<\n MobileRowProps<T>,\n | \"row\"\n | \"opensRow\"\n | \"mobileDir\"\n | \"mobileCardLinkable\"\n | \"mobileCard\"\n | \"mobilePrimaryCol\"\n | \"mobileSecondaryColumns\"\n | \"mobileExpandAsDialog\"\n | \"compact\"\n | \"large\"\n > {\n ctx: RefObject<DataTableRowCtx<T>>;\n rowKey: string | number;\n expanded: boolean;\n /** The opened row's content (`openedRowContent`); `null` on a closed card. */\n expansion: ReactNode;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n /** The table has `onRowClick`. */\n interactive: boolean;\n href: string | undefined;\n /** `mobileSwipeActions`, or the swipes derived from `rowActions` — by identity. */\n swipeActionsFor: ((row: T) => MobileSwipeActions | null) | undefined;\n /** The table has `selection`. */\n selectionOn: boolean;\n selectActive: boolean;\n selectable: boolean;\n selected: boolean;\n}\n\nconst yes = () => true;\n\nfunction DataTableMobileRowImpl<T>({\n ctx,\n rowKey: key,\n expanded,\n expansion,\n className,\n attrs,\n interactive,\n href,\n selectionOn,\n selectActive,\n selectable,\n selected,\n ...rest\n}: DataTableMobileRowProps<T>) {\n const { row } = rest;\n // `MobileRow` keeps its own shape (functions of the row); these hand it the values the\n // table derived, and the handlers read the latest props through `ctx`.\n return (\n <MobileRow\n {...rest}\n isExpanded={expanded ? yes : undefined}\n openedRowContent={() => expansion}\n rowClassName={() => className}\n rowAttributes={() => attrs}\n onRowClick={interactive ? (r) => ctx.current.onRowClick!(r) : undefined}\n rowHref={href !== undefined ? () => href : undefined}\n select={\n selectionOn\n ? {\n active: selectActive,\n selectable,\n selected,\n onToggle: (checked) => {\n ctx.current.setAnchor(key);\n ctx.current.onToggle?.(row, checked);\n },\n onLongPress: () => ctx.current.onLongPress(row),\n }\n : null\n }\n />\n );\n}\n\n/** One phone card, memoised like {@link DataTableRow}. */\nexport const DataTableMobileRow = memo(DataTableMobileRowImpl, sameProps) as <T>(\n props: DataTableMobileRowProps<T> & { key?: string | number },\n) => ReactNode;\n"],"mappings":";AAiLI,cAaE,YAbF;AA6IQ;AA9TZ,SAAS,UAAU,YAAY;AAE/B,SAAS,SAAS,YAAY,aAAa,gBAAgB,cAAc,sBAAsB;AAC/F,SAAS,iBAAiB,4BAA4B;AACtD,SAAS,iBAAsC;AAE/C,SAAS,UAAU;AA+CnB,SAAS,UACP,GACA,GACS;AACT,MAAI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,YAC1B;AAAA,YAEC;AAAA;AAAA,QACH,GACF,GACF;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;AAIO,MAAM,eAAe,KAAK,kBAAkB,SAAS;AAuC5D,MAAM,MAAM,MAAM;AAElB,SAAS,uBAA0B;AAAA,EACjC;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA+B;AAC7B,QAAM,EAAE,IAAI,IAAI;AAGhB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,YAAY,WAAW,MAAM;AAAA,MAC7B,kBAAkB,MAAM;AAAA,MACxB,cAAc,MAAM;AAAA,MACpB,eAAe,MAAM;AAAA,MACrB,YAAY,cAAc,CAAC,MAAM,IAAI,QAAQ,WAAY,CAAC,IAAI;AAAA,MAC9D,SAAS,SAAS,SAAY,MAAM,OAAO;AAAA,MAC3C,QACE,cACI;AAAA,QACE,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA,UAAU,CAAC,YAAY;AACrB,cAAI,QAAQ,UAAU,GAAG;AACzB,cAAI,QAAQ,WAAW,KAAK,OAAO;AAAA,QACrC;AAAA,QACA,aAAa,MAAM,IAAI,QAAQ,YAAY,GAAG;AAAA,MAChD,IACA;AAAA;AAAA,EAER;AAEJ;AAGO,MAAM,qBAAqB,KAAK,wBAAwB,SAAS;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/data-table-row.tsx"],"sourcesContent":["import { Fragment, memo } from \"react\";\nimport type { MouseEvent as ReactMouseEvent, ReactNode, RefObject } from \"react\";\nimport { RowLink, cleanAttrs, fromOutside, fromOwnControl, logicalAlign, splitCellProps } from \"./data-table-shared\";\nimport { GROW_CELL_CLASS, GROW_PEER_CELL_CLASS } from \"./data-table-fit\";\nimport { MobileRow, type MobileRowProps } from \"./data-table-mobile\";\nimport type { DataTableColumn, MobileSwipeActions } from \"./data-table\";\nimport { cn } from \"../lib/cn\";\n\n// DataTable's rows as memoised components (0.48.2, keksdose K-052-2, dev #632 — Marcel:\n// \"The table is extremely slow. Is it virtualised or is everytime the whole table\n// rendered?\"). The owner's selection, expansion and the roving focus all live ABOVE the\n// rows, so every tick re-rendered the whole table: on keksdose's register one checkbox\n// cost 430–1200 ms of INP at 271 rows. A row now bails out unless one of its own inputs\n// changed.\n//\n// What a row compares, and so the contract a call site keeps:\n// * the row object, its index and its key;\n// * what the table derived for it from the caller's functions, as PRIMITIVES — selected,\n// selectable, expanded, its tab stop, its `rowClassName` string, its `rowHref`, and\n// its `rowAttributes` compared key by key. The functions themselves may be inline;\n// * the column definitions BY IDENTITY: a cell is the caller's render function, and\n// what it reads is the caller's to say. A page that memoises its columns (keksdose's\n// `useTransactionColumns`) gets the bail-out; one that writes them inline gets a new\n// array every render and the full re-render it always had — never a stale cell;\n// * an OPEN row's detail (`expandedRow`) is called on every render, so it re-renders\n// with the table as before, and an editor inside it keeps its live inputs.\n// The handlers do not take part: they read the table's latest props through `ctx`, a\n// ref the table refreshes each commit, so a row that bailed out still acts on the\n// current selection and the current `onRowClick`.\n\n/** What a row's handlers read at event time — DataTable's latest props and helpers. */\nexport interface DataTableRowCtx<T> {\n onRowClick: ((row: T) => void) | undefined;\n onToggle: ((row: T, checked: boolean) => void) | undefined;\n isSelected: (row: T) => boolean;\n canSelect: (row: T) => boolean;\n selectRange: (toIndex: number) => boolean;\n /** Anchor the next Shift+click range on this row's key. */\n setAnchor: (key: string | number) => void;\n /** Remember the checkbox click that drew a range… */\n markRangeClick: (e: Event) => void;\n /** …and drop that click's own change event (true once for it). */\n takeRangeClick: (e: Event) => boolean;\n setFocusRowKey: (key: string | number) => void;\n /** The phone card's long press: enter selection mode with this row selected. */\n onLongPress: (row: T) => void;\n /** Under `virtualize` (0.48.2): Arrow/Home/End over every row, rendered or not. True\n * when the key was one of them. Without it the roving walks the rendered rows. */\n moveFocus?: (fromIndex: number, key: string) => boolean;\n}\n\n/** `rowAttributes`' result compared key by key: a call site returns a fresh object (or\n * `undefined`) per call, and its values are strings. */\nfunction sameAttrs(\n a: Record<string, string | undefined> | undefined,\n b: Record<string, string | undefined> | undefined,\n): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n const ak = Object.keys(a);\n if (ak.length !== Object.keys(b).length) return false;\n for (const k of ak) if (a[k] !== b[k]) return false;\n return true;\n}\n\nfunction sameProps<P extends { attrs?: Record<string, string | undefined> }>(prev: P, next: P): boolean {\n for (const k of Object.keys(next) as (keyof P)[]) {\n if (k === \"attrs\") continue;\n if (!Object.is(prev[k], next[k])) return false;\n }\n return sameAttrs(prev.attrs, next.attrs);\n}\n\n/** Arrow/Home/End between the focusable rows of the table's bodies — the roving half of\n * the keyboard-activatable rows (see the row's `onKeyDown`). */\nfunction moveRowFocus(from: HTMLElement, key: string): boolean {\n if (!(key in ROW_NAV_KEYS)) return false;\n // Every body of the table: a grouped table (`groupBy`, 0.48) has one per group.\n const table = from.closest(\"table\");\n if (!table) return false;\n const rows = Array.from(table.tBodies).flatMap((body) =>\n Array.from(body.children).filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.hasAttribute(\"data-row-nav\"),\n ),\n );\n const i = rows.indexOf(from);\n const target =\n key === \"ArrowDown\"\n ? rows[i + 1]\n : key === \"ArrowUp\"\n ? rows[i - 1]\n : key === \"Home\"\n ? rows[0]\n : key === \"End\"\n ? rows[rows.length - 1]\n : undefined;\n // At either end the key is still consumed, or ArrowDown on the last row would\n // scroll the page out from under a focused row.\n target?.focus();\n return true;\n}\nconst ROW_NAV_KEYS = { ArrowDown: 1, ArrowUp: 1, Home: 1, End: 1 } as const;\n\n// ---------- Desktop row ----------\n\nexport interface DataTableRowProps<T> {\n row: T;\n rowIndex: number;\n rowKey: string | number;\n ctx: RefObject<DataTableRowCtx<T>>;\n columns: DataTableColumn<T>[];\n widths: Record<string, number>;\n growDrawn: boolean;\n linkColumn: DataTableColumn<T> | undefined;\n href: string | undefined;\n /** The selection column is drawn (DataTable's `selection`). */\n selectionColumn: boolean;\n selectable: boolean;\n selected: boolean;\n expanded: boolean;\n /** The open row's detail; `null` on a closed row. */\n expansion: ReactNode;\n /** The row carries the visually hidden disclosure button (focusable rows that expand). */\n disclosure: boolean;\n detailId: string;\n rowsFocusable: boolean;\n rowInteractive: boolean;\n tabbable: boolean;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n compact: boolean;\n totalColSpan: number;\n rowDetailsLabel: string;\n selectRowLabel: string;\n /** Under `virtualize` (0.48.2): the row's `aria-rowindex` (its open detail row is the\n * next), and the row is marked with its index for the window's measuring. */\n ariaRowIndex?: number;\n}\n\nfunction DataTableRowImpl<T>({\n row,\n rowIndex,\n rowKey: key,\n ctx,\n columns,\n widths,\n growDrawn,\n linkColumn,\n href,\n selectionColumn,\n selectable,\n selected,\n expanded,\n expansion,\n disclosure: hasDisclosure,\n detailId,\n rowsFocusable,\n rowInteractive,\n tabbable,\n className,\n attrs,\n compact,\n totalColSpan,\n rowDetailsLabel,\n selectRowLabel,\n ariaRowIndex,\n}: DataTableRowProps<T>) {\n const windowed = ariaRowIndex !== undefined;\n // Whether the row is open, said where ARIA allows it (round 0.34, the\n // showcase's axe check): `aria-expanded` belongs to a treegrid's row, not a\n // table's, and the <tr> wore it. A disclosure button in the first cell carries\n // it now, with `aria-controls` on the detail row while that is there.\n // Visually hidden and not a tab stop: the row stays the one roving stop, with\n // Enter/Space and the whole-row click — this is the screen reader cursor's\n // way in, and where it hears the state. Named by `aria-label`, so the cell's\n // text stays the cell's own.\n const disclosure = hasDisclosure ? (\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"sr-only-fixed\"\n aria-label={rowDetailsLabel}\n aria-expanded={expanded}\n aria-controls={expansion ? detailId : undefined}\n // The row's own handler leaves a click on a control inside it alone.\n onClick={() => ctx.current.onRowClick!(row)}\n />\n ) : null;\n return (\n <Fragment>\n <tr\n {...cleanAttrs(attrs)}\n aria-rowindex={ariaRowIndex}\n data-row-index={windowed ? rowIndex : undefined}\n data-row-nav={rowsFocusable ? \"\" : undefined}\n tabIndex={rowsFocusable ? (tabbable ? 0 : -1) : undefined}\n onFocus={\n rowsFocusable\n ? (e) => {\n if (e.target === e.currentTarget) ctx.current.setFocusRowKey(key);\n }\n : undefined\n }\n onKeyDown={\n rowsFocusable\n ? (e) => {\n // Only the row's own key presses: Enter on a nested button\n // or link is that control's, and Space in a nested input\n // is a space.\n if (e.target !== e.currentTarget) return;\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n // Space would otherwise scroll the table.\n e.preventDefault();\n ctx.current.onRowClick!(row);\n return;\n }\n if (e.shiftKey) return;\n const move = ctx.current.moveFocus;\n if (move ? move(rowIndex, e.key) : moveRowFocus(e.currentTarget, e.key)) e.preventDefault();\n }\n : undefined\n }\n className={cn(\n \"border-t border-subtle\",\n rowInteractive && \"cursor-pointer hover:bg-hover\",\n // The kit's focus frame width (§5, `--focus-ring-width`), drawn as an\n // OUTLINE rather than FOCUS_RING's box-shadow: a shadow on a `<tr>`\n // is not painted by every engine, an outline is.\n rowsFocusable &&\n \"focus-visible:bg-hover focus-visible:outline-focus focus-visible:-outline-offset-2 focus-visible:outline-brand\",\n className,\n )}\n onClick={\n rowInteractive\n ? (e: ReactMouseEvent<HTMLTableRowElement>) => {\n const c = ctx.current;\n // A click on a control inside the row (a button, a link,\n // an input the cell renders) is that control's — it must\n // not also open the row. Cells no longer have to\n // `stopPropagation` to get that.\n if (fromOwnControl(e.target, e.currentTarget)) return;\n if (fromOutside(e.target, e.currentTarget)) return;\n // Modifier-clicks anywhere in the row drive\n // selection instead of expanding it (feedback #289):\n // Ctrl/Cmd toggles a single row, Shift selects the\n // range from the last-toggled row (inclusive of this\n // one) — the same as the checkbox, but for the whole\n // row, which is what the checkbox-only version was\n // missing.\n if (c.onToggle && c.canSelect(row)) {\n if (e.shiftKey) {\n // Drop the text selection a shift-click would\n // otherwise smear across the rows.\n window.getSelection?.()?.removeAllRanges();\n if (c.selectRange(rowIndex)) return;\n // No anchor yet: treat it as the first pick.\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n if (e.metaKey || e.ctrlKey) {\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n }\n c.onRowClick?.(row);\n }\n : undefined\n }\n >\n {selectionColumn && (\n <td\n className={cn(\"align-top\", compact ? \"w-8 px-2 py-1\" : \"w-10 px-3 py-2\")}\n // Don't let selecting a row also trigger the row click\n // (which expands/edits it).\n onClick={(e) => e.stopPropagation()}\n >\n {selectable && (\n <input\n type=\"checkbox\"\n className={cn(\"accent-indigo-600\", compact ? \"size-3.5\" : \"size-4\")}\n checked={selected}\n // Shift+click selects the range from the last toggled\n // row. `preventDefault` puts the box back, but it does NOT\n // stop React's `onChange`: React derives a checkbox's\n // change from the `click` itself, after the browser has\n // already flipped `checked` and before the cancellation\n // reverts it — so the same click also reported itself as\n // a single toggle, and the owner got `onToggleMany` and\n // then `onToggle` for the clicked row. The click is\n // remembered by identity and its change is dropped; a\n // boolean flag would outlive a click whose change never\n // came and swallow the user's next real one.\n onClick={(e) => {\n if (e.shiftKey && ctx.current.selectRange(rowIndex)) {\n e.preventDefault();\n ctx.current.markRangeClick(e.nativeEvent);\n }\n }}\n onChange={(e) => {\n const c = ctx.current;\n if (c.takeRangeClick(e.nativeEvent)) return;\n c.setAnchor(key);\n c.onToggle?.(row, e.target.checked);\n }}\n aria-label={selectRowLabel}\n />\n )}\n </td>\n )}\n {columns.map((col, colIndex) => {\n const width = widths[col.key];\n // The caller's first, the table's over it — see `cellProps`.\n const own = splitCellProps(col.cellProps?.(row));\n const pinned = width ? { width, minWidth: width, maxWidth: width } : undefined;\n return (\n <td\n {...own.attrs}\n key={col.key}\n data-col={col.key}\n style={own.style || pinned ? { ...own.style, ...pinned } : undefined}\n className={cn(\n \"align-top\",\n compact ? \"px-2 py-1\" : \"px-3 py-2\",\n width && \"overflow-hidden text-ellipsis\",\n col.grow ? GROW_CELL_CLASS : growDrawn && GROW_PEER_CELL_CLASS,\n logicalAlign(own.className),\n logicalAlign(col.className),\n )}\n >\n {colIndex === 0 && disclosure}\n {col === linkColumn && href ? (\n // No `onActivate`: the click is left to bubble to the\n // <tr> handler above, which already owns expand-vs-select.\n // Calling it here as well would toggle the row twice.\n <RowLink href={href} className=\"block\" data-row-link=\"\">\n {col.cell(row)}\n </RowLink>\n ) : (\n col.cell(row)\n )}\n </td>\n );\n })}\n </tr>\n {expansion && (\n <tr\n id={hasDisclosure ? detailId : undefined}\n aria-rowindex={windowed ? ariaRowIndex + 1 : undefined}\n data-row-detail={windowed ? rowIndex : undefined}\n className=\"bg-surface-2 border-t border-subtle\"\n >\n {/* The detail panel spans every column. In an `auto` table\n layout (the default here — columns only get fixed style\n widths once the user resizes/auto-sizes them) the cell's\n content preferred-width is redistributed across the\n spanned columns, so a long expansion visibly re-sizes the\n columns above it — and one-line content does not, since\n its preferred width is small (feedback #104). Wrapping the\n content in `w-0 min-w-full` pins the cell's preferred\n width to ~0 (the explicit width:0 child), so it can never\n perturb the columns; the div then fills to the full row\n width only at paint time, and long text wraps within it.\n Inside it the content is pinned to what the scroller SHOWS\n (0.47, keksdose S4): on a table wider than its scroller a\n table-wide panel put an inline editor's Save/Cancel off-screen.\n `sticky start-0` holds it at the scroller's start edge (the\n right one in RTL) as the row scrolls sideways, and\n `--dt-visible-w` (the scroller's clientWidth, measured above)\n sizes it; before the first measure, and in a table no wider\n than its scroller, it is the full width as before. */}\n <td colSpan={totalColSpan} className=\"p-0\">\n <div className=\"w-0 min-w-full\">\n <div\n className={cn(\n \"sticky start-0 w-[var(--dt-visible-w,100%)] max-w-full\",\n compact ? \"px-2 py-2\" : \"px-3 py-3\",\n )}\n >\n {expansion}\n </div>\n </div>\n </td>\n </tr>\n )}\n </Fragment>\n );\n}\n\n/** One desktop row (its `<tr>` and, while open, its detail row), memoised — see the\n * file's note for what it compares. */\nexport const DataTableRow = memo(DataTableRowImpl, sameProps) as <T>(\n props: DataTableRowProps<T> & { key?: string | number },\n) => ReactNode;\n\n// ---------- Phone card ----------\n\nexport interface DataTableMobileRowProps<T>\n extends Pick<\n MobileRowProps<T>,\n | \"row\"\n | \"opensRow\"\n | \"mobileDir\"\n | \"mobileCardLinkable\"\n | \"mobileCard\"\n | \"mobilePrimaryCol\"\n | \"mobileStatusColumns\"\n | \"mobileSecondaryColumns\"\n | \"mobileActionColumns\"\n | \"mobileExpandAsDialog\"\n | \"compact\"\n | \"large\"\n > {\n ctx: RefObject<DataTableRowCtx<T>>;\n rowKey: string | number;\n expanded: boolean;\n /** The opened row's content (`openedRowContent`); `null` on a closed card. */\n expansion: ReactNode;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n /** The table has `onRowClick`. */\n interactive: boolean;\n href: string | undefined;\n /** `mobileSwipeActions`, or the swipes derived from `rowActions` — by identity. */\n swipeActionsFor: ((row: T) => MobileSwipeActions | null) | undefined;\n /** The table has `selection`. */\n selectionOn: boolean;\n selectActive: boolean;\n selectable: boolean;\n selected: boolean;\n}\n\nconst yes = () => true;\n\nfunction DataTableMobileRowImpl<T>({\n ctx,\n rowKey: key,\n expanded,\n expansion,\n className,\n attrs,\n interactive,\n href,\n selectionOn,\n selectActive,\n selectable,\n selected,\n ...rest\n}: DataTableMobileRowProps<T>) {\n const { row } = rest;\n // `MobileRow` keeps its own shape (functions of the row); these hand it the values the\n // table derived, and the handlers read the latest props through `ctx`.\n return (\n <MobileRow\n {...rest}\n isExpanded={expanded ? yes : undefined}\n openedRowContent={() => expansion}\n rowClassName={() => className}\n rowAttributes={() => attrs}\n onRowClick={interactive ? (r) => ctx.current.onRowClick!(r) : undefined}\n rowHref={href !== undefined ? () => href : undefined}\n select={\n selectionOn\n ? {\n active: selectActive,\n selectable,\n selected,\n onToggle: (checked) => {\n ctx.current.setAnchor(key);\n ctx.current.onToggle?.(row, checked);\n },\n onLongPress: () => ctx.current.onLongPress(row),\n }\n : null\n }\n />\n );\n}\n\n/** One phone card, memoised like {@link DataTableRow}. */\nexport const DataTableMobileRow = memo(DataTableMobileRowImpl, sameProps) as <T>(\n props: DataTableMobileRowProps<T> & { key?: string | number },\n) => ReactNode;\n"],"mappings":";AAiLI,cAaE,YAbF;AA6IQ;AA9TZ,SAAS,UAAU,YAAY;AAE/B,SAAS,SAAS,YAAY,aAAa,gBAAgB,cAAc,sBAAsB;AAC/F,SAAS,iBAAiB,4BAA4B;AACtD,SAAS,iBAAsC;AAE/C,SAAS,UAAU;AA+CnB,SAAS,UACP,GACA,GACS;AACT,MAAI,MAAM,EAAG,QAAO;AACpB,MAAI,CAAC,KAAK,CAAC,EAAG,QAAO;AACrB,QAAM,KAAK,OAAO,KAAK,CAAC;AACxB,MAAI,GAAG,WAAW,OAAO,KAAK,CAAC,EAAE,OAAQ,QAAO;AAChD,aAAW,KAAK,GAAI,KAAI,EAAE,CAAC,MAAM,EAAE,CAAC,EAAG,QAAO;AAC9C,SAAO;AACT;AAEA,SAAS,UAAoE,MAAS,MAAkB;AACtG,aAAW,KAAK,OAAO,KAAK,IAAI,GAAkB;AAChD,QAAI,MAAM,QAAS;AACnB,QAAI,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,EAAG,QAAO;AAAA,EAC3C;AACA,SAAO,UAAU,KAAK,OAAO,KAAK,KAAK;AACzC;AAIA,SAAS,aAAa,MAAmB,KAAsB;AAC7D,MAAI,EAAE,OAAO,cAAe,QAAO;AAEnC,QAAM,QAAQ,KAAK,QAAQ,OAAO;AAClC,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,OAAO,MAAM,KAAK,MAAM,OAAO,EAAE;AAAA,IAAQ,CAAC,SAC9C,MAAM,KAAK,KAAK,QAAQ,EAAE;AAAA,MACxB,CAAC,OAA0B,cAAc,eAAe,GAAG,aAAa,cAAc;AAAA,IACxF;AAAA,EACF;AACA,QAAM,IAAI,K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AI,QAAQ,YAAY,GAAG;AAAA,MAChD,IACA;AAAA;AAAA,EAER;AAEJ;AAGO,MAAM,qBAAqB,KAAK,wBAAwB,SAAS;","names":[]}
|
|
@@ -21,6 +21,36 @@ export interface DataTableColumn<T> {
|
|
|
21
21
|
headClassName?: string;
|
|
22
22
|
mobilePrimary?: boolean;
|
|
23
23
|
mobileHidden?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* This column on the phone's default card (0.49 KIT-7; ignored with `mobileCard`):
|
|
26
|
+
* `"primary"` — the card's title, as `mobilePrimary`; `"secondary"` — one of its
|
|
27
|
+
* fields; `"hidden"` — not on the card, as `mobileHidden`. The card shows at most
|
|
28
|
+
* three fields: the columns marked `"secondary"` when any
|
|
29
|
+
* is, else the first three visible columns after the title. A field whose value is
|
|
30
|
+
* empty — the cell returns `null`, `undefined`, `""` or the formatters' empty "—" —
|
|
31
|
+
* is left out of that card. The columns the card does not show go into the opened
|
|
32
|
+
* row with `mobileDetailsInRow`. A `noRowLink` column (the cell's own buttons or link)
|
|
33
|
+
* counts as a field: past the third it leaves the card with its action, and a
|
|
34
|
+
* development build says so once per table and column key. Give a column of row
|
|
35
|
+
* actions `role: "actions"` instead: it is then no field, and the card draws it after
|
|
36
|
+
* them.
|
|
37
|
+
*/
|
|
38
|
+
mobile?: "primary" | "secondary" | "hidden";
|
|
39
|
+
/**
|
|
40
|
+
* What the column is (0.49 KIT-7), for the phone's default card; the desktop table is
|
|
41
|
+
* unchanged.
|
|
42
|
+
*
|
|
43
|
+
* - `"status"`: its value sits as a chip beside the title instead of as a label/value
|
|
44
|
+
* line, and takes none of the card's three fields. A cell that returns text is drawn
|
|
45
|
+
* in a neutral `Chip`; one that returns an element (a `Chip` with its own tone, a
|
|
46
|
+
* `StatusDot`) is drawn as it is.
|
|
47
|
+
* - `"actions"`: the row's buttons (`rowActionsColumn` sets it). Never the card's title
|
|
48
|
+
* and never one of its three fields: the card draws it after them, at its end,
|
|
49
|
+
* whether or not other columns are marked `mobile: "secondary"`; only `mobileHidden`
|
|
50
|
+
* / `mobile: "hidden"` take it off. Its cell keeps its own clicks, as `noRowLink`:
|
|
51
|
+
* no row link wraps it, and a card that draws it is not a link.
|
|
52
|
+
*/
|
|
53
|
+
role?: "status" | "actions";
|
|
24
54
|
/**
|
|
25
55
|
* Set on a column whose cell renders its own `<a>` (or anything else that must
|
|
26
56
|
* keep its own click): the row anchor of `rowHref` then skips it and lands on
|
|
@@ -232,7 +262,10 @@ export interface DataTableProps<T> {
|
|
|
232
262
|
* When true, mirror filter/sort/page state into URL search params so views are
|
|
233
263
|
* shareable and bookmarkable. URL params used: `f.<column>`, `sort`, `p`, `ps`.
|
|
234
264
|
* URL state takes precedence over localStorage on initial load. Requires the
|
|
235
|
-
* consuming app to render inside a react-router Router.
|
|
265
|
+
* consuming app to render inside a react-router Router (0.49: only with `urlSync` — a
|
|
266
|
+
* table without it needs none). With `urlSync` and no Router, a development build
|
|
267
|
+
* throws "DataTable urlSync requires a Router"; a production build keeps the view in
|
|
268
|
+
* local state instead.
|
|
236
269
|
*
|
|
237
270
|
* `{ prefix }` namespaces them, for two URL-synced tables on one page:
|
|
238
271
|
* `urlSync={{ prefix: "inv." }}` uses `inv.f.<column>`, `inv.sort`, `inv.p`, `inv.ps`.
|
|
@@ -7,7 +7,15 @@ import { isTableOwnColumn, useRowActionColumn } from "./data-table-row-actions.j
|
|
|
7
7
|
import { useColumnResize } from "./data-table-resize.js";
|
|
8
8
|
import { useRangeSelection } from "./data-table-selection.js";
|
|
9
9
|
import { columnLabel, logicalAlign, resolveDataTableLabels } from "./data-table-shared.js";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
MobileFilters,
|
|
12
|
+
MobileSelectBar,
|
|
13
|
+
MobileSort,
|
|
14
|
+
StackedFields,
|
|
15
|
+
keepsOwnClicks,
|
|
16
|
+
mobileCardColumns,
|
|
17
|
+
useCardColumnWarnings
|
|
18
|
+
} from "./data-table-mobile.js";
|
|
11
19
|
import { DataTableMobileRow, DataTableRow } from "./data-table-row.js";
|
|
12
20
|
import { DataTableHead } from "./data-table-head.js";
|
|
13
21
|
import { DataTableLeadingRow } from "./data-table-leading-row.js";
|
|
@@ -317,7 +325,7 @@ function DataTable({
|
|
|
317
325
|
[columns, hiddenCols, autoHidden]
|
|
318
326
|
);
|
|
319
327
|
const growDrawn = visibleColumns.some((c) => c.grow);
|
|
320
|
-
const linkColumn = rowHref ? visibleColumns.find((c) => c.mobilePrimary && !c
|
|
328
|
+
const linkColumn = rowHref ? visibleColumns.find((c) => c.mobilePrimary && !keepsOwnClicks(c)) ?? visibleColumns.find((c) => !keepsOwnClicks(c)) : void 0;
|
|
321
329
|
const { startResize, moveResize, finishResize, autoSizeAll } = useColumnResize({
|
|
322
330
|
headRefs,
|
|
323
331
|
widths,
|
|
@@ -350,13 +358,28 @@ function DataTable({
|
|
|
350
358
|
return () => ro.disconnect();
|
|
351
359
|
}, [measuresVisibleWidth]);
|
|
352
360
|
const edgeFadeProps = useEdgeFade(desktopScroller, edgeFade && isMdUp);
|
|
353
|
-
const mobileColumns = useMemo(
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
361
|
+
const mobileColumns = useMemo(
|
|
362
|
+
() => visibleColumns.filter((c) => !c.mobileHidden && c.mobile !== "hidden"),
|
|
363
|
+
[visibleColumns]
|
|
364
|
+
);
|
|
365
|
+
const {
|
|
366
|
+
primary: mobilePrimaryCol,
|
|
367
|
+
status: mobileStatusColumns,
|
|
368
|
+
fields: mobileSecondaryColumns,
|
|
369
|
+
actions: mobileActionColumns
|
|
370
|
+
} = useMemo(() => mobileCardColumns(mobileColumns), [mobileColumns]);
|
|
371
|
+
useCardColumnWarnings(
|
|
372
|
+
columns,
|
|
373
|
+
!mobileCard && !mobileDetailsInRow,
|
|
374
|
+
storageKey ?? (typeof urlSync === "object" ? urlSync.prefix : void 0)
|
|
358
375
|
);
|
|
359
|
-
const
|
|
376
|
+
const onCard = /* @__PURE__ */ new Set([
|
|
377
|
+
...mobilePrimaryCol ? [mobilePrimaryCol] : [],
|
|
378
|
+
...mobileStatusColumns,
|
|
379
|
+
...mobileSecondaryColumns,
|
|
380
|
+
...mobileActionColumns
|
|
381
|
+
]);
|
|
382
|
+
const mobileDetailColumns = mobileDetailsInRow ? visibleColumns.filter((c) => mobileCard ? c.mobileHidden || c.mobile === "hidden" : !onCard.has(c)) : [];
|
|
360
383
|
const opensRow = !!expandedRow || mobileDetailColumns.length > 0;
|
|
361
384
|
const openedRowContent = (row) => {
|
|
362
385
|
const detail = expandedRow?.(row) ?? null;
|
|
@@ -366,7 +389,7 @@ function DataTable({
|
|
|
366
389
|
detail
|
|
367
390
|
] });
|
|
368
391
|
};
|
|
369
|
-
const mobileCardLinkable = mobileColumns.every((c) => !c
|
|
392
|
+
const mobileCardLinkable = (mobileCard ? mobileColumns : [...onCard]).every((c) => !keepsOwnClicks(c));
|
|
370
393
|
const [mobileDir, setMobileDir] = useState("ltr");
|
|
371
394
|
const mobileRootRef = (el) => {
|
|
372
395
|
if (!el) return;
|
|
@@ -468,7 +491,9 @@ function DataTable({
|
|
|
468
491
|
mobileCardLinkable,
|
|
469
492
|
mobileCard,
|
|
470
493
|
mobilePrimaryCol,
|
|
494
|
+
mobileStatusColumns,
|
|
471
495
|
mobileSecondaryColumns,
|
|
496
|
+
mobileActionColumns,
|
|
472
497
|
mobileExpandAsDialog,
|
|
473
498
|
compact,
|
|
474
499
|
large,
|