adapterOf
A router adapter from ResourcePage's `urlState` shapes.
packages/ui/src/components/data/resource-view/list-controls.tsx
@marktiderman/genesis-ui/dataimport { adapterOf } from "@marktiderman/genesis-ui/data";react-docgen-typescript.adapterOf
A router adapter from ResourcePage's `urlState` shapes.
| Prop | Type | Default | Description |
|---|---|---|---|
| searchParams* | SearchParamsAdapter | URLSearchParams | — | |
| setSearchParams* | (next: URLSearchParams, options?: { replace?: boolean | undefined; } | undefined) => void | — | |
| params | ResourceUrlParams | — |
ViewSegments
The view's segments as one segmented strip, each with its count when it asks for one.
| Prop | Type | Default | Description |
|---|---|---|---|
| baseFilters* | FilterParam[] | — | The list's other filters (scope, the screen's, the declared filters), which counts include. |
| onChange* | (id: string) => void | — | |
| value* | string | undefined | — | |
| view* | AnyView<any> | — | |
| enabled | boolean | true |
choiceFilterConfigs
A view's choice filters as DataFilters' comboboxes (`DataFilterConfig`).
No declared props.
ViewFilterControls
A view's range and text filters, for the filter row beside its choice filters.
| Prop | Type | Default | Description |
|---|---|---|---|
| state* | Pick<ListStateResult, "values" | "setValue"> | — | |
| view* | AnyView<any> | — |
ViewTypeSwitcher
The view types a person may switch between (ADR 0017): Genesis's and registered ones, limited to the ones the view supports. Each button is named by the type's label.
| Prop | Type | Default | Description |
|---|---|---|---|
| onChange* | (type: string) => void | — | |
| types* | readonly string[] | — | |
| value* | string | undefined | — |
refuseHeldRows
Rows a screen holds are drawn by the list page only (table, list, grid, gallery). A type that reads its own rows (board, calendar, inbox, sheet, an app's type) says so rather than show rows other than the screen's, whether ResourceView dispatches to it or the screen renders it directly.
No declared props.
switchableTypes
The types the view supports that are registered here, in the view's order.
No declared props.
useServedActions
The actions a provider serves for the resource: all of them when it doesn't say. A provider whose capabilities say it runs no actions for this resource (`actions: false`) runs none of them.
| Prop | Type | Default | Description |
|---|---|---|---|
| actions* | () => readonly ResolvedViewAction[] | — | The view's actions, in order, frozen. |
| can* | { (action: "create", viewer?: Viewer | undefined): Allowed; (action: "update" | "delete", row: any, viewer?: Viewer | undefined): Allowed; } | — | Whether the view's guard allows it for this viewer: `true`, or the guard's reason. Without a viewer, guards get `NO_VIEWER` (no one), so one that needs the viewer refuses. |
| canAction* | (name: string, row: any, viewer?: Viewer | undefined) => Allowed | — | Whether this row allows the named action: `true`, or the guard's reason. Only narrows what the server allows. Throws {@link ViewDefinitionError } for a name the view doesn't define. |
| column* | (name: string) => ResolvedColumn<any> | undefined | — | One field as a column, resolved as a preset lists it (a board card's fields, say). Undefined for a name that isn't a field or one the viewer can't read (`permissions.read: false`). |
| columns* | (preset?: string | undefined) => readonly ResolvedColumn<any>[] | — | |
| contract* | ResourceContract<any> | — | |
| definition* | Readonly<ViewDefinition<ResourceContract<any>, any>> | — | |
| display* | (name: string) => DisplayHint | — | |
| exportPlan* | (preset?: string | undefined) => { readonly columns: readonly ResolvedColumn<any>[]; readonly filename: string; readonly maxRows: number; readonly raw: boolean; } | undefined | — | What "Export CSV" writes for a column preset, or undefined when the view has no `export`. @stability Beta |
| field* | (name: string) => FieldSchema | undefined | — | |
| filterParams* | (values: Readonly<Record<string, ViewFilterValue | undefined>> | null | undefined, zone?: string | undefined) => FilterParam[] | — | Declared filters' values as provider filters. Only declared filters count, and a value a filter doesn't accept (a choice it doesn't offer, a malformed range) is dropped: the URL is an allow-list, never a way to send any field. Days and times on a timestamp column are read on `zone`'s clock (the viewer's; default the device's): a day runs from its start to the next day's start, and a time with no offset is that zone's. @stability Beta |
| filters* | () => readonly ResolvedFilter[] | — | The declared filters, resolved (ADR 0017). Empty without `filters`. @stability Beta |
| form* | (mode: "create" | "edit") => readonly ResolvedFormField[] | — | |
| galleryItem* | (row: any, override?: Partial<ViewGallery<string>> | undefined) => GalleryItem | undefined | — | The row as a gallery photo, by the view's `gallery` block and any `override` a screen passes (ResourceView's `gallery`): undefined without a gallery block. Its `id` is the row's key, its `alt` the row's label unless the block names a field; a row without an image has an empty `src`, which GalleryGrid and NativeGalleryGrid draw as a placeholder tile; leave those out of a Lightbox. |
| inboxActions* | () => { readonly done?: string | undefined; readonly markRead?: string | undefined; } | — | The inbox's `done` and `markRead` actions, when the view declares them. @stability Beta |
| inboxRow* | (row: any) => InboxRow | — | The row as an inbox draws it, by the view's `inbox` block (its title from `labelField` when the block says none). Works without a block too: the summary's title. @stability Beta |
| label* | (name: string) => string | — | |
| labelField* | string | undefined | — | The field that names a row, for links, pickers and the peek's title. |
| noun* | string | — | |
| nounPlural* | string | — | |
| presets* | readonly string[] | — | The column presets this view has, `default` first. |
| resource* | string | — | The resource name the provider addresses. |
| rowTone* | (row: any) => ChipTone | undefined | — | The row's tone (`rowTone`), or undefined. @stability Beta |
| segmentFilters* | (id: string, viewer?: Viewer | undefined) => FilterParam[] | — | A segment's rows as provider filters, for this viewer. Throws {@link ViewDefinitionError } for an id the view doesn't define. @stability Beta |
| segments* | () => readonly ResolvedSegment[] | — | The declared segments, resolved. Empty without `segments`. @stability Beta |
| summary* | (row: any) => RowSummary | — | |
| title* | string | — | |
| types* | () => readonly string[] | — | The view types a person may switch between, in order (`types`, or the derived default). @stability Beta |
| valueLabel* | (name: string, value: unknown) => string | — | A value in words: the field's `labels`, else title case. For badges, choices and group titles. |
| writable* | (mode: "create" | "edit") => readonly string[] | — | Fields a writer may send: the form's, never generated, read-only, key or scope fields. |
useListActions
The view's actions for a list: a row menu (edit, the actions, delete; refusals with their reasons) and the bulk bar's actions, each run through the provider (or the action's own `run`).
No declared props.
useViewExport
"Export CSV" for a view's list: every row the list's query matches, paged through the provider by core's `exportCsv` (formula-safe), with the view's words for coded values unless `raw`.
No declared props.
useViewSavedViews
ResourcePage's saved-view props from a `SavedViewStore`: list, save (the segment, filters, type, grouping and column preset, plus the search and sort the URL holds) and remove, each stamped with the view's `version`.
No declared props.
reasonOf
A refusal's words, or undefined when allowed.
No declared props.
ListModelContext
No declared props.