/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { SortedMap } from "@elaraai/east"; import { type ReferenceRows } from "../shared/schedule/reference.js"; import { type RosterPayload, type RosterSpan, type Status, type StoredDuty, type StoredTarget } from "./model.js"; /** * The periods of the spans either side of the span in view (#1553) — the weeks either side of a week, the months either * side of a month: what a run of an optimiser that takes the edges tells which of the duties at the edges are fixed by. */ export interface RosterNeighbours { /** The span they are either side of: its first week's first day. */ readonly start: Date; /** Each period's own row's bytes, by its first instant — the weeks', or their days' where the periods are days: a period with no row is not among them. */ readonly periods: SortedMap; } /** What the Roster has read of its records for a span. */ export interface RosterData { /** The span it is of: its first week's first day. */ readonly start: Date; /** Its weeks' first days. */ readonly weeks: readonly Date[]; /** The span's stored duties, by key — what its window read, other weeks' among them. */ readonly duties: ReadonlyMap; /** The week before's, read while a week in view holds none of its own: what Copy previous week copies; `undefined` otherwise, or while it is read. */ readonly previous: ReadonlyMap | undefined; /** * Each period's own row's bytes, by its first instant — each week's, or each day's where the periods are days * (#1550): a period with no row is not among them, nor any of a Roster with no periods. */ readonly periods: SortedMap; /** The open picker's periods' statuses, by their start — its weeks', or its days' (#1550): a period with no row is not among them. */ readonly picker: SortedMap; /** The span's targets, by key. */ readonly targets: ReadonlyMap; /** * The rows of the reference record the app's check reads (#1551): each week of the span's, by its first day — the * record's rows overlapping the week and the twelve hours either side, every one whatever the slice holds; empty * without one. */ readonly references: SortedMap; /** * The periods of the spans either side of the span in view — the weeks, or the months — for an optimiser that takes * the edges (#1553); `undefined` without one, and while they are read. */ readonly neighbours: RosterNeighbours | undefined; /** Why the read of the periods of the weeks either side failed (#1553): the eye waits on it, and the footer's line says it, with Retry. */ readonly neighboursError: string | undefined; /** Whether a read the span needs — its duties, its weeks' rows, its targets or its reference rows — is in flight. */ readonly loading: boolean; /** Whether a complete read of the span has landed. */ readonly ready: boolean; /** * Whether a complete read of any span has landed: the frame's cold load is * over (#1398, CL5), and a span not read yet is read with the frame live, * its geometry drawn and its placeholders where its content goes. */ readonly landed: boolean; /** Why the latest read failed. */ readonly error: string | undefined; } /** * The frame's data before its reader first reports: nothing held, a read in flight. * * @param span - The span the frame shows * @returns The state */ export declare function initialRosterData(span: Pick): RosterData; /** * Reads the span (see the module docs). * * @param value - The payload * @param span - The span in view * @param pickerDates - The open picker's weeks' first days * @param holds - Whether the span's stored duties hold one of its first week's: the week before is read only while a one-week span does not * @returns What the Roster has read of the span */ export declare function useRosterData(value: RosterPayload, span: RosterSpan, pickerDates: readonly Date[], holds: (duties: ReadonlyMap) => boolean): RosterData; /** * The span's reads, in a component of its own (#1343): each page and search * that lands re-runs it alone, and it hands the frame what it read only when * what the frame shows moves. * * @param props - The payload, the span, the open picker's weeks, which stored duties hold one of the first week's, and where the data goes * @returns Nothing: it reads */ export declare function RosterDataReader({ value, span, pickerDates, holds, onData }: { value: RosterPayload; span: RosterSpan; pickerDates: readonly Date[]; holds: (duties: ReadonlyMap) => boolean; onData: (data: RosterData) => void; }): null; //# sourceMappingURL=data.d.ts.map