Genesis
@beta

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/data
import { 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.

PropTypeDefaultDescription
view*ResourceView<ResourceContract<any>, T & DataRow>—
allDayFieldstring—A yes/no field: the row is all day, its timestamp shown without a time.
anchorstring—A day in the window (default today). With `onAnchorChange` the screen owns it (put it in the URL).
cellsPartial<Record<string, (row: T) => ReactNode>>—Draw some peek fields the screen's own way, by column key (ResourceView's `cells`).
classNamestring—
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.
colorLanesboolean—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'.
durationFieldstring—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.
durationUnitenum—What `durationField` counts. Default `minutes`.
enabledboolean—False while the screen waits (on its scope, say): nothing is fetched. Default true.
endFieldstring—Where a row ends: its last day for a date field, its end instant for a timestamp.
fieldstring—The date or timestamp field that places each row.
filtersreadonly FilterParam[]—Server filters (the view's scope and the screen's), already as params.
laneBystring—The field whose value (or list of values) names a row's lanes: a dot each, a lane each.
lanesreadonly 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`.
layoutenum—Default `month`.
layoutsreadonly CalendarLayout[]—The layouts the toolbar offers to switch between. Without two or more, no switch.
limitnumber—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.
liveboolean | LiveOptions—Refetch when the provider reports a change, as a list's `live` does.
maxDurationnumber—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)—
onNavigateNavigateFn—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)—
openenum—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.
phoneLayoutenum—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.
print{ 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.
recordViewRecordView<ResourceContract<any>, any>—The record view a peek draws. Default the view's `recordView`, else the view's columns.
selectstring—Supabase select syntax for joined columns (`resourceOptions.select`), sent with each request.
showEmptyDaysboolean—The agenda shows empty days too.
statusOf((row: T) => string)—Words read out after a row's title ("Cancelled"), for what `classNameOf` shows.
subtitlestring—A line under the title (ResourceView's `subtitle`, else the view's `copy.subtitle`).
testIDstring—
timeZonestring—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.
titlestring—
toolbarReactNode | ((state: ResourceCalendarToolbarState) => ReactNode)—Beside the layout and weeks switches: a Print button, a mode switch. A function gets what the calendar shows now.
weeksenum—For `weeks`, `agenda` and `lanes`: 1 to 4. Default 2.
weeksOptionsreadonly 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.
weekStartsOnenum—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.