api reference
Scheduler API Reference
createScheduler: resources as rows and events as bars on a shared time axis, with editing, a workload band, grouping and search, and builders from a Gantt plan, rows or a calendar.
API reference › The resource scheduler
All 24 pages Everything on one page → Developer guide →
The resource scheduler
modules/scheduler is an opt-in resource scheduler: resources as rows in a real Lattice grid on the left and each event as a bar in its resource's row on a shared time axis on the right. It is a separate bundle in the same shape as the other view modules - it adds no weight to a page that does not load it, changes nothing in grid core, and pulls in no dependency beyond the Gantt's shared time scale, zoom presets, calendar and non-working rules, which it reuses rather than copies so both views read the same numbers. The left grid is the page's own createGrid, injected - never bundled - so the scheduler shares the page's one licensed core. It is just another dataset viewer: scheduler.rows.apply({ add, update, remove }) feeds the resources and scheduler.events.apply(...) the events, so a Data Router can attach(value, scheduler) beside a grid, a kanban and a chart.
The data layer. The events can come from three sources without hand-rolling the mapping: schedulerFromGantt(el, gantt, opts) expands a Gantt plan's assignments into one event per task/resource and wires the scheduler's change event back through gantt.applyEdit so a reassign updates the Gantt; schedulerFromRows(el, rows, opts) builds straight over any dataset whose rows carry a resource, start and end (mapped by fields, the Gantt's own vocabulary); and schedulerFromCalendar(el, calendar, opts) reads a calendar's events. With no resources list the scheduler derives its resource rows from the events' resource field. scheduler.reassign(key, resourceId) moves one event between rows and fires change { id, kind, resource: { from, to }, row }, and getState()/setState(state) carry the zoom and scroll across browser history.
import { createScheduler } from '@toclocoinc/lattice-grid/modules/scheduler';
const scheduler = createScheduler(document.querySelector('#scheduler'), {
resources: [{ id: 'alice', name: 'Alice', role: 'Design', capacity: 4 }],
events: [{ id: 1, resourceId: 'alice', name: 'Review', startDate: '2026-03-02 09:00', endDate: '2026-03-02 11:00' }],
createGrid, // the page's own grid factory (injected, never bundled)
zoom: 'day', // 'hour' | 'day' | 'week' | 'month' | 'quarter' | px-per-day
fields: { resourceId: 'resourceId', startDate: 'startDate', endDate: 'endDate', name: 'name' },
});
The time axis reuses the Gantt's own zoom scale - hour, day, week, month and quarter presets, or a bare pixels-per-day number - with pointer-wheel (Ctrl+wheel) and keyboard (+/−) zoom and arrow-key scrolling. A todayLine marks today, and with nonWorking (default on) each resource's own calendar shades its non-working days exactly as the Gantt shades them: a 'weekends' string, a { workdays, holidays } spec, or a name looked up in calendars. Overlapping events in one resource stack into sub-lanes, so a two-hour review never hides the sketch behind it. Rows and time are both virtualised - only the rows and days under the viewport (plus overscan) create DOM, so 500 resources × 20 000 events stays bounded and scrollable. An event whose start cannot be read is counted in unscheduled and reported once, never thrown. With workload: true, each row also draws a histogram band across the bottom of the time axis - one cell per zoom bucket whose fill height is the booked share of the resource's own capacity, computed by the Gantt's computeWorkload against the resource's own calendar and capacity. An over-allocated bucket is highlighted with the theme's danger tokens and a warning glyph (never colour alone), and named resource-by-resource with its periods in an accessible live-region summary, which re-derives live when setEvents(events) replaces the feed. Pass null for the element and the same model answers headlessly.
Find and read the plan. A groupBy - a field name or a per-resource function - groups the resources into collapsible group rows, driven by the left grid's own grouping so the two panes can never disagree; the timeline mirrors the grid's expand/collapse state, and a toggle in either pane collapses the other. A search query narrows both sides at once, matching any string or number field of a resource or event (a row stays when its own text or one of its events' text matches, so a match never orphans its bar). A resourceFilter hides rows, an eventFilter hides bars, and each takes a predicate a row must pass. The Gantt's tooltip card - the same card its bars show - opens on an event's hover and keyboard focus with its start, end, duration and resource. Every bar, row, group header and the time axis is named for screen readers, and the keyboard alone reaches every event: the arrow keys walk between events and rows (roving focus), Enter activates, Home/End jump a row's ends, and +/− zoom - so the scheduler passes the same accessibility audit the grid does.
Events are editable: drag a bar to move it in time, drop it onto another resource row to reassign it, drag either edge to resize it, drag over empty time in a row to create an event, and press Delete (or use the right-click menu) to delete one. Every change snaps to the zoom step, writes back through events.apply - so a bound dataset sees it exactly as it sees a grid edit - and is one undo step: undo()/redo() or Ctrl/Cmd+Z / Ctrl/Cmd+Shift+Z. Each change raises the one cancellable beforeEventChange (call preventDefault() to refuse it, data untouched) and then one event:change carrying the event id and the old and new values. editable: false switches editing off; an event or a resource marked readOnly: true - or named by readOnlyWhen/resourceReadOnlyWhen - refuses the gesture with a catalogued reason.
| Member | Description |
|---|---|
| createScheduler(el, config) | Create a scheduler. Pass a DOM element to render into, or null for a headless scheduler that computes the same placement and axis model. |
| rows.apply({ add, update, remove }) / rows.forEach / rows.count / rows.get(key) | The keyed-diff consumer contract over the resources (the left grid's rows), keyed by resourceKey. |
| events.apply({ add, update, remove }) / events.forEach / events.count / events.get(key) | The same keyed-diff contract over the events, keyed by eventKey. |
| setZoom('hour'|'day'|'week'|'month'|'quarter'|number) / getZoom() | Change the axis scale, re-render and fire zoom:change; a bare number is pixels-per-day and picks the tick level that reads best at that density. |
| groupBy / setGroupBy(field | (resource) => value) | Group the resources into collapsible group rows by a field name or function; null is flat. The left grid does the grouping and the timeline mirrors its collapse state. |
| search / setSearch(query) | A case-insensitive query that narrows both the resource rows and the event bars, matching any string or number field (a row stays when one of its events matches). |
| resourceFilter / setResourceFilter(fn) | A predicate a resource must pass to stay visible; null clears it. |
| eventFilter / setEventFilter(fn) | A predicate an event must pass to keep its bar; null clears it. |
| toggleGroup(value) | Expand or collapse one group by its value (the collapse state lives in the grid, or the scheduler when headless). |
| setEvents(events) | Replace every event outright, keyed by eventKey, and re-render - the complement of events.apply for a host that holds the whole feed at once. The workload band (when on) re-derives in the same pass. |
| workload | The last computed workload model when workload is on: { buckets, rows, overAllocated, hoursPerDay, decimals }. |
| model | The computed axis { startDay, endDay, pxPerDay, ticks, unscheduled }, for tests and headless callers. |
| placement | The last placement: byResource (resource key → placed event models), keys and unscheduled. |
| refresh() | Re-seed from the config arrays (unless a diff has landed) and re-render. |
| edit.move(key, deltaDays) / edit.reassign(key, resourceKey) / edit.resize(key, edge, day) / edit.create(resourceKey, startDay, endDay) / edit.remove(key) | The editing controller: move in time, reassign to a row, resize one edge, create and delete - each one undo step and one event:change, refused on a read-only event or resource. |
| undo() / redo() / canUndo() / canRedo() | Step the edit history back and forth (Ctrl/Cmd+Z and Ctrl/Cmd+Shift+Z from the keyboard do the same). |
| reassign(key, resourceId) | Move an event to another resource row and fire change; returns false for an unknown key or an unchanged resource. |
| getState() / setState(state) | Serialise and reapply the restorable view state (zoom and the timeline scroll) across browser history. |
| schedulerFromGantt(el, gantt, opts) / schedulerFromRows(el, rows, opts) / schedulerFromCalendar(el, calendar, opts) | Build a scheduler over a Gantt plan's assignments (wired so a reassign writes back), a plain dataset, or a calendar's events. |
| on(name, fn) / off(name, fn) | Events: zoom:change { level, px }; change { id, kind, resource: { from, to }, row } on a reassign; the cancellable beforeEventChange (veto with preventDefault()), eventChange:cancelled, and event:change { id, action, changes, oldValues, newValues }. |
| destroy() | Destroy the left grid, empty the element, remove only what the module added, and drop handlers and caches. The host still owns the element. |
Placement, lanes, workload, zoom, grouping, search, editing and export, executed
Two resources, three events (two overlapping into two sub-lanes on Alice's row), the day axis, the keyed-diff contract, the per-resource workload band, grouping, search and the two filters, an edit and its undo, and a print-safe SVG export of the visible range, run headless on every build.
const { createScheduler } = await import('../packages/modules/scheduler/index.js');
const sched = createScheduler(null, {
resources: [
{ id: 'alice', name: 'Alice', role: 'Design', capacity: 4, calendar: 'weekends' },
{ id: 'bob', name: 'Bob', role: 'Dev', capacity: 3 },
],
events: [
{ id: 1, resourceId: 'alice', name: 'Review', startDate: '2026-03-02 09:00', endDate: '2026-03-02 11:00', status: 'done' },
{ id: 2, resourceId: 'alice', name: 'Sketch', startDate: '2026-03-02 10:00', endDate: '2026-03-02 12:00', status: 'wip' },
{ id: 3, resourceId: 'bob', name: 'Build', startDate: '2026-03-03 09:00' },
],
fields: { resourceId: 'resourceId', startDate: 'startDate', endDate: 'endDate', name: 'name' },
resourceKey: 'id', eventKey: 'id',
zoom: 'day', date: '2026-03-02',
defaultDuration: 60, rowHeight: 34, weekStartDay: 1,
todayLine: true, nonWorking: true,
calendars: { weekends: 'weekends' },
workload: true,
colorProperty: 'status', colorMap: { done: '#16a34a' },
ariaLabel: 'Scheduler', labels: { resource: 'Resource' },
overscan: 5,
groupBy: 'role',
search: '', resourceFilter: null, eventFilter: null,
editable: true,
readOnlyWhen: (e) => e.readOnly,
resourceReadOnlyWhen: (r) => r.readOnly,
});
const resources = sched.rows.count; // 2
const events = sched.events.count; // 3
const alice = sched.placement.byResource.get('alice');
const overlap = alice.length; // 2 (two sub-lanes)
const unscheduled = sched.model.unscheduled.length; // 0
const px = sched.model.pxPerDay; // 26 (the day preset)
const hasTicks = sched.model.ticks.length > 0; // true
const groups = sched.displayRows.filter((r) => r.type === 'group').length; // 2
sched.setSearch('review');
const matchedEvents = sched.ctx.visibleEvents.length; // 1
const matchedResources = sched.ctx.visibleResources.length; // 1
sched.setSearch('');
sched.setEventFilter((e) => e.status === 'done');
const filteredEvents = sched.ctx.visibleEvents.length; // 1
sched.setEventFilter(null);
sched.setResourceFilter((r) => r.role !== 'Dev');
const filteredResources = sched.ctx.visibleResources.length; // 1
sched.setResourceFilter(null);
const wlRows = sched.workload.rows.size; // 2 (one band row per resource)
const wlOver = sched.workload.overAllocated.length; // 0 (nothing over-allocated)
const changed = sched.edit.move(1, 1).ok; // true (moved one day)
const movedStart = sched.events.get(1).startDate; // 2026-03-03 09:00
sched.undo();
const undone = sched.events.get(1).startDate; // 2026-03-02 09:00
sched.setZoom('week');
const zoom = sched.getZoom().level; // week
sched.rows.apply({ add: [{ id: 'carol', name: 'Carol' }] });
const after = sched.rows.count; // 3
const svg = sched.toSVG(); // the visible range as one standalone SVG
const isSvg = /^<svg /.test(svg); // true
const hasBars = (svg.match(/<rect /g) || []).length >= 3; // true (one bar per placed event)
const noVar = svg.includes('var(') === false; // true (print-safe palette, no tokens)
const printed = sched.print(); // false (no window to open, headless)
sched.destroy();
return [resources, events, overlap, unscheduled, px, hasTicks, groups, matchedEvents, matchedResources, filteredEvents, filteredResources, wlRows, wlOver, changed, movedStart, undone, zoom, after, isSvg, hasBars, noVar, printed].join('|');
Type reference
Generated from the type declarations, so it always matches the release. Each surface lists its properties, its methods and the events it raises as three tables; an option or value type lists its members once.
The scheduler module
SchedulerFields
The field-to-property mapping naming the data each event and resource reads.
| Property | Type | Description |
|---|---|---|
| resourceId | string | The field on an event naming its resource (the resource key). Default `'resourceId'`. (optional) |
| startDate | string | The field on an event naming its start. Default `'startDate'`. (optional) |
| endDate | string | The field on an event naming its end; omitted falls back to `defaultDuration`. (optional) |
| name | string | The field naming an event's display text. Default `'name'`. (optional) |
| calendar | string | The field on a resource naming its calendar (a spec, or an id into `calendars`). (optional) |
SchedulerCalendar
A non-working calendar spec: the `'weekends'` shorthand, or workdays plus holidays.
| Property | Type | Description |
|---|---|---|
| workdays | number[] | Working weekdays, 0=Sun…6=Sat. Default Mon-Fri. (optional) |
| holidays | unknown[] | Non-working dates, as `Date`, `'YYYY-MM-DD'` or day numbers. (optional) |
SchedulerWorkload
The `workload` band option: a per-resource utilisation strip drawn at the bottom of each row, computed with the Gantt's own `computeWorkload` against each resource's calendar and capacity.
| Property | Type | Description |
|---|---|---|
| hoursPerDay | number | Hours per working day, the demand unit a calendar-less capacity is measured against. Default 8. (optional) |
| defaultCapacity | number | The unitless capacity a calendar-less resource with none stated reads as. Default 1. (optional) |
| decimals | number | Decimal places in the over-allocation percentage. Default 1. (optional) |
SchedulerKeyedRows
A keyed-diff consumer surface, the same contract a grid's `rows` exposes.
| Property | Type | Description |
|---|---|---|
| count | number | The number of stored rows. (read-only) |
| Method | Signature | Parameters | Returns | Description |
|---|---|---|---|---|
| apply | (change: { add?: SchedulerRow[]; update?: SchedulerRow[]; remove?: unknown[] }): void | change: { add?: SchedulerRow[]; update?: SchedulerRow[]; remove?: unknown[] } | void | Set `add` rows, merge `update` patches, drop `remove` keys. |
| forEach | (fn: (row: SchedulerRow, key: unknown) => void): void | fn: (row: SchedulerRow, key: unknown) => void | void | Iterate the stored rows. |
| get | (key: unknown): SchedulerRow | undefined | key: unknown | SchedulerRow | undefined | The row stored under a key. |
SchedulerModel
The scheduler's computed model, for tests and headless callers.
| Property | Type | Description |
|---|---|---|
| startDay | number | null | The first day of the axis span, a whole day-number. |
| endDay | number | null | The exclusive end of the axis span, a whole day-number. |
| pxPerDay | number | The pixels-per-day the axis is drawn at. |
| ticks | { day: number; label: string }[] | The header ticks, `{ day, label }`. |
| unscheduled | { key: unknown; row: SchedulerRow }[] | Events whose start could not be read. |
SchedulerPlacement
The event placement, for tests and headless callers.
| Property | Type | Description |
|---|---|---|
| byResource | Map<unknown, unknown[]> | Resource key → placed event models. |
| unscheduled | unknown[] | Events whose start could not be read. |
| keys | Map<unknown, unknown> | Event key → placed event model. |
SchedulerConfig
The configuration for {@link createScheduler}. `resources` are the left grid's rows; `events` draw as bars. `createGrid` is the page's own grid factory, injected so the scheduler shares the page's one core.
Properties
| Property | Type | Description |
|---|---|---|
| resources | SchedulerRow[] | The resources (one row each), or seed through `rows.apply`. (optional) |
| events | SchedulerRow[] | The events (one bar each), or seed through `events.apply`. (optional) |
| fields | SchedulerFields | The field-to-property mapping naming the data each event and resource reads. (optional) |
| createGrid | unknown | The grid factory the left resource table mounts through (required for a DOM mount). (optional) |
| resourceKey | string | The resource identity field. Default `'id'`. (optional) |
| eventKey | string | The event identity field. Default `'id'`. (optional) |
| columns | unknown[] | The left table's columns; defaults to name/role/capacity. (optional) |
| zoom | SchedulerZoom 'hour' | 'day' | 'week' | 'month' | 'quarter' | number | The zoom: a preset name or px-per-day. Default `'day'`. (optional) |
| date | Date | string | number | The anchor date the axis centres on. Default the earliest event start, else today. (optional) |
| defaultDuration | number | The minutes an event without an end runs. Default 60. (optional) |
| rowHeight | number | The row height in px. Default 34. (optional) |
| locale | string | BCP-47 locale for tick labels. (optional) |
| timeZone | string | IANA time-zone name for tick labels. Default UTC. (optional) |
| weekStartDay | number | Week-start weekday, 0=Sun…6=Sat. (optional) |
| todayLine | boolean | Draw the today line. Default true. (optional) |
| nonWorking | boolean | Shade each resource's non-working days from its calendar. Default true. (optional) |
| calendars | Record<string, SchedulerCalendar | 'weekends'> | Named calendars referenced by a resource's `calendar` field. (optional) |
| workload | boolean | SchedulerWorkload | Draw the per-resource utilisation band; `true` takes the defaults. (optional) |
| ariaLabel | string | The root's accessible label. (optional) |
| messages | unknown | A message catalogue with a `t(key, params)` formatter. (optional) |
| labels | Record<string, string> | Raw label overrides for the built-in English. (optional) |
| overscan | number | Extra rows rendered above/below the viewport. Default 5. (optional) |
| colorProperty | string | A field whose value colours the bar edge. (optional) |
| colorMap | Record<string, string> | Value → CSS colour for `colorProperty`. (optional) |
| groupBy | string | ((resource: SchedulerRow) => unknown) | null | Group the resources by a field name or a per-resource function; `null` is flat. (optional) |
| search | string | A case-insensitive query that narrows both the resource rows and the event bars. (optional) |
| editable | boolean | Enable pointer/keyboard editing of events. Default true. (optional) |
Methods
| Method | Signature | Parameters | Returns | Description |
|---|---|---|---|---|
| resourceFilter | ((resource: SchedulerRow) => unknown) | null | (resource: SchedulerRow) => unknown | | null | A predicate a resource must pass to stay visible; `null` clears it. (optional) |
| eventFilter | ((event: SchedulerRow) => unknown) | null | (event: SchedulerRow) => unknown | | null | A predicate an event must pass to keep its bar; `null` clears it. (optional) |
| readOnlyWhen | (event: SchedulerRow) => boolean | event: SchedulerRow | => boolean | A predicate naming events that refuse edits (a read-only event). (optional) |
| resourceReadOnlyWhen | (resource: SchedulerRow) => boolean | resource: SchedulerRow | => boolean | A predicate naming resources that refuse edits (a read-only row). (optional) |
Events
No events.
SchedulerEventChange
The payload every scheduler edit event carries: the event id, the changed fields and the before/after snapshots.
| Property | Type | Description |
|---|---|---|
| id | unknown | The event's key. |
| action | 'move' | 'reassign' | 'resize' | 'create' | 'delete' | What changed: `'move' | 'reassign' | 'resize' | 'create' | 'delete'`. |
| changes | SchedulerEventFieldChanges | Each changed field's old and new values (empty for create/delete). |
| oldValues | Record<string, unknown> | null | The editable fields before the edit, or null for a create. |
| newValues | Record<string, unknown> | null | The editable fields after the edit, or null for a delete. |
| event | unknown | The originating DOM event, or null for an API call. |
SchedulerEventChangeEvent
The cancellable `beforeEventChange` payload: cancelling it refuses the edit, data untouched.
| Method | Signature | Parameters | Returns | Description |
|---|---|---|---|---|
| preventDefault | (reason?: string): void | reason?: string | void | Cancel the edit before it is written. |
SchedulerEventChangeCancelled
The `eventChange:cancelled` payload: a `beforeEventChange` was vetoed.
| Property | Type | Description |
|---|---|---|
| reason | string | Why the edit was cancelled. |
SchedulerZoomChangeEvent
The `zoom:change` payload: the new zoom level and px-per-day.
| Property | Type | Description |
|---|---|---|
| level | string | The zoom level name. |
| px | number | The pixels-per-day. |
SchedulerReassignEvent
The `change` payload: a reassign moved an event to another resource row.
| Property | Type | Description |
|---|---|---|
| id | unknown | The event's key. |
| kind | 'reassign' | Always `'reassign'`. |
| resource | { from: unknown; to: unknown } | The old and new resource keys. |
| row | SchedulerRow | The event row after the reassign. |
SchedulerEventPayloads
The payload each scheduler event name carries.
| Property | Type | Description |
|---|---|---|
| zoom:change | SchedulerZoomChangeEvent | The new zoom level and px-per-day, after `setZoom` re-rendered. |
| change | SchedulerReassignEvent | A reassign wrote a new resource onto the event, carrying the old and new keys. |
| beforeEventChange | SchedulerEventChangeEvent | The edit about to be written, with `preventDefault` to refuse it. |
| eventChange:cancelled | SchedulerEventChangeCancelled | The edit a `beforeEventChange` handler vetoed, with the reason. |
| event:change | SchedulerEventChange | The committed edit (or undo/redo), carrying the id and old/new values. |
Scheduler
The scheduler instance {@link createScheduler} returns.
Properties
| Property | Type | Description |
|---|---|---|
| rows | SchedulerKeyedRows | The keyed-diff surface over the resources (the left grid's rows). |
| events | SchedulerKeyedRows | The keyed-diff surface over the events. |
| resources | SchedulerRow[] | The live resource array. |
| rowKey | string | The resource identity field. |
| eventKey | string | The event identity field. |
| model | SchedulerModel | The last computed model. |
| placement | SchedulerPlacement | The last event placement. |
| edit | unknown | The editing controller: `move`, `reassign`, `resize`, `create`, `remove`, `undo`, `redo`. |
Methods
| Method | Signature | Parameters | Returns | Description |
|---|---|---|---|---|
| refresh | (): Scheduler | - | Scheduler | Re-seed from the config arrays (unless a diff landed) and re-render. |
| setEvents | (events: SchedulerRow[]): Scheduler | events: SchedulerRow[] | Scheduler | Replace every event and re-render, keyed by `eventKey`. |
| setZoom | (zoom: SchedulerZoom): Scheduler | zoom: SchedulerZoom | Scheduler | Change the zoom and re-render, firing `zoom:change`. |
| getZoom | (): { level: string; px: number } | - | { level: string; px: number } | The current zoom `{ level, px }`. |
| setGroupBy | (groupBy: string | ((resource: SchedulerRow) => unknown) | null): Scheduler | groupBy: string | ((resource: SchedulerRow) => unknown) | null | Scheduler | Group the resources by a field or function, re-mounting the left grid. |
| setSearch | (query: string): Scheduler | query: string | Scheduler | Set the search query that narrows rows and bars; `''` clears it. |
| setResourceFilter | (fn: ((resource: SchedulerRow) => unknown) | null): Scheduler | fn: ((resource: SchedulerRow) => unknown) | null | Scheduler | Set the resource filter; `null` clears it. |
| setEventFilter | (fn: ((event: SchedulerRow) => unknown) | null): Scheduler | fn: ((event: SchedulerRow) => unknown) | null | Scheduler | Set the event filter; `null` clears it. |
| toggleGroup | (value: unknown): Scheduler | value: unknown | Scheduler | Expand or collapse one group by its value. |
| undo | (opts?: { origin?: string }): boolean | opts?: { origin?: string } | boolean | Undo the most recent edit. |
| redo | (opts?: { origin?: string }): boolean | opts?: { origin?: string } | boolean | Redo the most recently undone edit. |
| canUndo | (): boolean | - | boolean | Whether there is an edit to undo. |
| canRedo | (): boolean | - | boolean | Whether there is an edit to redo. |
| on | (name: SchedulerEventName, fn: (payload: SchedulerEventPayloads[SchedulerEventName]) => void): () => void | name: SchedulerEventNamefn: (payload: SchedulerEventPayloads[SchedulerEventName]) => void | () => void | Subscribe to a scheduler event; returns an unsubscribe function. |
| off | (name: SchedulerEventName, fn: (payload: SchedulerEventPayloads[SchedulerEventName]) => void): void | name: SchedulerEventNamefn: (payload: SchedulerEventPayloads[SchedulerEventName]) => void | void | Remove an event handler. |
| toSVG | (svgOpts?: { range?: { from?: number | string | Date; to?: number | string | Date } }): string | svgOpts?: { range?: { from?: number | string | Date; to?: number | string | Date } } | string | Serialise the scheduler - the resource table, the time axis and the placed bars - to a standalone SVG string, drawn with a print-safe palette independent of the mounted theme. `''` before anything has been laid out. |
| toPNG | (pngOpts?: { range?: { from?: number | string | Date; to?: number | string | Date }; scale?: number; background?: string; }): Promise<Blob | null> | pngOpts?: { range?: { from?: number | string | Date; to?: number | string | Date }; scale?: number; background?: string; } | Promise<Blob | null> | This scheduler as a PNG: `toSVG` rasterised through a canvas. Makes no network request. `null` when nothing is laid out or there is no canvas to rasterise with. |
| (printOpts?: { paper?: 'A4' | 'Letter' | 'A3'; orientation?: 'landscape' | 'portrait'; fitToWidth?: boolean; scale?: number; title?: string | false; header?: string | ((page: number, pages: number) => string) | false; footer?: string | ((page: number, pages: number) => string) | false; }): boolean | printOpts?: { paper?: 'A4' | 'Letter' | 'A3'; orientation?: 'landscape' | 'portrait'; fitToWidth?: boolean; scale?: number; title?: string | false; header?: string | ((page: number, pages: number) => string) | false; footer?: string | ((page: number, pages: number) => string) | false; } | boolean | Print this scheduler - the resource table, the time axis and the bars - paged and scaled: the table header and time header repeat on every page and no row is split across a page boundary. Opens the browser's own print path over a standalone document; "PDF" is whatever the browser's print dialog offers ("Save as PDF") - no server, no dependency. Always prints in a fixed, print-safe light palette, independent of the mounted theme. | |
| reassign | (key: unknown, resourceId: unknown): boolean | key: unknownresourceId: unknown | boolean | Move an event to another resource row and fire `change` (`{ id, kind: 'reassign', resource: { from, to }, row }`). Returns false when the event key is unknown or the resource is unchanged. |
| getState | (): { version: number; zoom: string; scroll: { left: number; top: number } } | - | { version: number; zoom: string; scroll: { left: number; top: number } } | Serialise the restorable view state: `{ version, zoom, scroll }`. |
| setState | (state: object): Scheduler | state: object | Scheduler | Reapply a state snapshot from {@link Scheduler.getState}. |
| destroy | (): void | - | void | Tear the scheduler down. |
Events
| Event | When | Payload | Cancellable |
|---|---|---|---|
| zoom:change | Fires after the zoom changed. | SchedulerZoomChangeEvent | no |
| change | Fires after a reassign moved an event to another resource row. | SchedulerReassignEvent | no |
| beforeEventChange | Fires before a move/reassign/resize/create/delete commits; cancellable. | SchedulerEventChangeEvent | yes |
| eventChange:cancelled | Fires when a `beforeEventChange` handler vetoed the edit. | SchedulerEventChangeCancelled | no |
| event:change | Fires after an edit (or an undo/redo) committed, carrying the id and old/new values. | SchedulerEventChange | no |