ResourceCalendar
A view's rows on a calendar, as its `calendar` block describes them. Prefer `<ResourceView view={v} mode="calendar" />`, which passes the scope and the screen's filters.
packages/ui/src/components/data/resource-view/ResourceCalendar.tsx
Import
Subpath export:
@marktiderman/genesis-ui/dataimport { ResourceCalendar } from "@marktiderman/genesis-ui/data";Components
Auto-generated from TypeScript source via
react-docgen-typescript.ResourceCalendar
A view's rows on a calendar, as its `calendar` block describes them. Prefer `<ResourceView view={v} mode="calendar" />`, which passes the scope and the screen's filters.
| Prop | Type | Default | Description |
|---|---|---|---|
| view* | ResourceView<ResourceContract<any>, T & DataRow> | — | |
| allDayField | string | — | A yes/no field: the row is all day, its timestamp shown without a time. |
| anchor | string | — | A day in the window (default today). With `onAnchorChange` the screen owns it (put it in the URL). |
| cells | Partial<Record<string, (row: T) => ReactNode>> | — | Draw some peek fields the screen's own way, by column key (ResourceView's `cells`). |
| className | string | — | |
| classNameOf | ((row: T) => string) | — | Classes for a row's event (`(row) => row.status === "cancelled" ? "line-through opacity-60" : undefined`): a cancelled event struck through rather than dropped. Give `statusOf` too, so the look isn't the only cue. |
| colorLanes | boolean | — | Give lanes with no colour of their own `laneColor(i)` (EventCalendar's `colorLanes`). Default false. |
| colorsOf | ((row: T) => readonly string[]) | — | A row's dot colours, when not its lanes'. |
| durationField | string | — | A number field holding how long a row runs, for a row with no end column: its end is the start plus this many `durationUnit`s. A row whose `endField` has a value keeps that end. |
| durationUnit | enum | — | What `durationField` counts. Default `minutes`. |
| enabled | boolean | — | False while the screen waits (on its scope, say): nothing is fetched. Default true. |
| endField | string | — | Where a row ends: its last day for a date field, its end instant for a timestamp. |
| field | string | — | The date or timestamp field that places each row. |
| filters | readonly FilterParam[] | — | Server filters (the view's scope and the screen's), already as params. |
| laneBy | string | — | The field whose value (or list of values) names a row's lanes: a dot each, a lane each. |
| lanes | readonly CalendarLane[] | — | The lanes, in order, with their labels and colours. |
| lanesOf | ((row: T) => readonly string[]) | — | A row's lanes, when a field doesn't say (several people on one event). Wins over `laneBy`. |
| layout | enum | — | Default `month`. |
| layouts | readonly CalendarLayout[] | — | The layouts the toolbar offers to switch between. Without two or more, no switch. |
| limit | number | — | Most rows one request loads. Default {@link CALENDAR_LIMIT}. With an `endField` the calendar makes two (rows starting in the window, and rows that started before it and run into it), each capped. |
| live | boolean | LiveOptions | — | Refetch when the provider reports a change, as a list's `live` does. |
| maxDuration | number | — | The longest a row with a `durationField` runs, in `durationUnit`s. The calendar reads rows that started up to this long before its window too, so one that runs into the window from before it (a session at 23:00 for two hours) is drawn. Without it, such a row is drawn only on the days it starts in the window, and a calendar with no `endField` warns once. Past the read's limit, the latest starts are kept. |
| onAnchorChange | ((anchor: string) => void) | — | |
| onLayoutChange | ((layout: CalendarLayout) => void) | — | |
| onNavigate | NavigateFn | — | With `open="page"`: how to go to the record's page. Default a full-page navigation. |
| onSelect | ((row: T) => void) | — | A row was chosen. Default: the view's peek (or page, with `open="page"`). |
| onWeeksChange | ((weeks: CalendarWeeks) => void) | — | |
| open | enum | — | How an event's record opens (ADR 0021): `side-peek`, `center-peek` or `page` (navigates to `/{resource}/{id}` through `onNavigate`), or `none`. Default the view's `open`, else a side peek. |
| phoneLayout | enum | — | The layout on a phone (below 768px), until the person picks one from the layout switch: `"agenda"` turns a month grid too narrow to read into a day-by-day list. Unset, a phone shows `layout`, as before. |
| { sections?: readonly PrintableSection[]; title?: ReactNode; headingLevel?: 2 | 3 | 4 | 5; } | undefined | — | Print one sheet per lane (PrintableAgenda) for the week the calendar shows, instead of the calendar itself: the same rows, scope and filters, with no screen code reading data. Lanes come from `lanes`, else the linked rows' words (`laneBy` on a link), else the lane values. | |
| recordView | RecordView<ResourceContract<any>, any> | — | The record view a peek draws. Default the view's `recordView`, else the view's columns. |
| select | string | — | Supabase select syntax for joined columns (`resourceOptions.select`), sent with each request. |
| showEmptyDays | boolean | — | The agenda shows empty days too. |
| statusOf | ((row: T) => string) | — | Words read out after a row's title ("Cancelled"), for what `classNameOf` shows. |
| subtitle | string | — | A line under the title (ResourceView's `subtitle`, else the view's `copy.subtitle`). |
| testID | string | — | |
| timeZone | string | — | The clock timestamps land on days by. Default the field's own (`fields.<field>.timeZone`: the scope's or a fixed zone), else the viewer's (ViewerScope's `timeZone`), else the device's: the same clock the field's cells use. |
| title | string | — | |
| toolbar | ReactNode | ((state: ResourceCalendarToolbarState) => ReactNode) | — | Beside the layout and weeks switches: a Print button, a mode switch. A function gets what the calendar shows now. |
| weeks | enum | — | For `weeks`, `agenda` and `lanes`: 1 to 4. Default 2. |
| weeksOptions | readonly CalendarWeeks[] | — | Week counts the toolbar offers beside `layouts` (`[1, 2, 4]`), for the `weeks`, `agenda` and `lanes` layouts. Without two or more, no switch. The pick is kept as the layout's is: with `onWeeksChange` the screen owns it (`weeks`, in the URL), else the calendar does. |
| weekStartsOn | enum | — | 0 Sunday or 1 Monday (default). |
CALENDAR_LIMIT
Most rows one request loads (a calendar with an `endField` makes two, so up to twice this). A month grid is six weeks: 500 is about a dozen a day, more than a busy shared calendar holds, and still one quick request. Past it the calendar says how many it left out ("+N more") rather than dropping them silently.
No declared props.