RecordView
One record's screen, from its record view (defineRecordView): ```tsx <RecordView view={brandRecordView} row={brand} section={tab} sectionHref={(id) => `/brands/${brand.id}/${id}`} /> ``` A record page (ADR 0021): a full page in the shell by default, or `presentation="peek"` inline in a side or center peek (`RecordPeek`). A record view's `template: "document"` lays it out as a cover, an icon, a title, the properties and the body. Parts: `record-page` and, for a document, `record-page-cover`, `-icon`, `-title`, `-properties` and `-body`.
packages/ui/src/components/data/resource-view/RecordView.tsx
@marktiderman/genesis-ui/dataimport { RecordView } from "@marktiderman/genesis-ui/data";react-docgen-typescript.RecordView
One record's screen, from its record view (defineRecordView): ```tsx <RecordView view={brandRecordView} row={brand} section={tab} sectionHref={(id) => `/brands/${brand.id}/${id}`} /> ``` A record page (ADR 0021): a full page in the shell by default, or `presentation="peek"` inline in a side or center peek (`RecordPeek`). A record view's `template: "document"` lays it out as a cover, an icon, a title, the properties and the body. Parts: `record-page` and, for a document, `record-page-cover`, `-icon`, `-title`, `-properties` and `-body`.
| Prop | Type | Default | Description |
|---|---|---|---|
| row* | Row | — | The record, as the screen loaded it (`useOne`). A save refreshes it through the cache. |
| view* | RecordView<ResourceContract<any>, T & DataRow> | — | |
| can | ((action: string, row: T) => false | Allowed) | — | The screen's own rule for a header action. It only narrows the view's guards: `false` hides the action, a sentence refuses it with that reason. |
| lists | Partial<Record<string, Partial<Omit<ResourceViewProps, "view" | "filter">>>> | — | More props for a list section's ResourceView, by section id. |
| onAction | ((name: string, row: T) => unknown) | — | Runs a header action once allowed (and confirmed). Default: the provider's `runAction`. A rejection shows inline. |
| onDelete | ((row: T) => void) | — | Delete the record: a Delete button, last among the header's actions. |
| onEdit | ((row: T) => void) | — | Edit the record (the list's form, say): an Edit button among the header's actions. A peek opened from a list passes the list's own. |
| onSaved | ((row: T) => void) | — | After a settings section saved, with the stored row. |
| parent | ReactNode | — | The breadcrumb's parent link: one element, so the host's router renders it. |
| presentation | enum | — | Where the record page is drawn (ADR 0021): `page` (default) puts the header and the section tabs in the app shell, as a full page; `peek` draws them inline, for a side or center peek (`RecordPeek`, a view's `open`), with the tabs switching in place. |
| readinessLabels | ReadinessLabels | — | The readiness chip's words. |
| section | string | — | The section showing now: the route's segment. Default the first section. In a peek, the section it opens on; its tabs then switch in place. |
| sectionHref | ((id: string) => string) | — | Each section's route, for the shell's tabs: `(id) => \`/brands/${brand.id}/${id}\``. A full page needs it for its tabs; a peek switches sections in place and doesn't. |
| sectionIcons | Partial<Record<string, LucideIcon>> | — | Each section's icon, by section id, for the shell's tabs and the phone's bottom bar (which otherwise shows the label's first letter). |
| settingsLocked | ((sectionId: string, row: T) => string | null) | — | Why a settings section is read-only for this viewer, when the screen knows more than the view's guards (a role the viewer lacks): the reason, or null. It only narrows: a section the view's update guard locks stays locked. |
| slots | Partial<Record<string, ReactNode>> | — | The screen's own sections, by id (sections with neither list nor settings). |
| switcher | ReactNode | — | In the header's leading area, before the title: a switcher between records. |
| testID | string | — |
ResourceWorkspace
| Prop | Type | Default | Description |
|---|---|---|---|
| row* | Row | — | The record, as the screen loaded it (`useOne`). A save refreshes it through the cache. |
| workspace* | RecordView<ResourceContract<any>, T & DataRow> | — | |
| can | ((action: string, row: T) => false | Allowed) | — | The screen's own rule for a header action. It only narrows the view's guards: `false` hides the action, a sentence refuses it with that reason. |
| lists | Partial<Record<string, Partial<Omit<ResourceViewProps, "view" | "filter">>>> | — | More props for a list section's ResourceView, by section id. |
| onAction | ((name: string, row: T) => unknown) | — | Runs a header action once allowed (and confirmed). Default: the provider's `runAction`. A rejection shows inline. |
| onDelete | ((row: T) => void) | — | Delete the record: a Delete button, last among the header's actions. |
| onEdit | ((row: T) => void) | — | Edit the record (the list's form, say): an Edit button among the header's actions. A peek opened from a list passes the list's own. |
| onSaved | ((row: T) => void) | — | After a settings section saved, with the stored row. |
| parent | ReactNode | — | The breadcrumb's parent link: one element, so the host's router renders it. |
| presentation | enum | — | Where the record page is drawn (ADR 0021): `page` (default) puts the header and the section tabs in the app shell, as a full page; `peek` draws them inline, for a side or center peek (`RecordPeek`, a view's `open`), with the tabs switching in place. |
| readinessLabels | ReadinessLabels | — | The readiness chip's words. |
| section | string | — | The section showing now: the route's segment. Default the first section. In a peek, the section it opens on; its tabs then switch in place. |
| sectionHref | ((id: string) => string) | — | Each section's route, for the shell's tabs: `(id) => \`/brands/${brand.id}/${id}\``. A full page needs it for its tabs; a peek switches sections in place and doesn't. |
| sectionIcons | Partial<Record<string, LucideIcon>> | — | Each section's icon, by section id, for the shell's tabs and the phone's bottom bar (which otherwise shows the label's first letter). |
| settingsLocked | ((sectionId: string, row: T) => string | null) | — | Why a settings section is read-only for this viewer, when the screen knows more than the view's guards (a role the viewer lacks): the reason, or null. It only narrows: a section the view's update guard locks stays locked. |
| slots | Partial<Record<string, ReactNode>> | — | The screen's own sections, by id (sections with neither list nor settings). |
| switcher | ReactNode | — | In the header's leading area, before the title: a switcher between records. |
| testID | string | — |