/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The Table (`Allocation Spec.md` §8, A41–A49, A84, #1329): one row per lane * slot of the day and one per extra bin of a batch, in foldable time bands * (the app's, four by default), narrowed by the lanes, the resources and the * arrivals the slice shows (#1336, #1339) and never reordered by an * allocation. Each row's arrival and resource are a chip or a dashed * placeholder; a chip's × removes or unlinks, and a cell's chevron opens the * shared Chooser, every section of it the app's fit's answer. A bin's chip * drags onto a free row's arrival cell (A47). A split or partly allocated bin lists its parts as resource chips * with their quantities across the Resource and Load columns, each its own * chevron and ×, and `+ resource` for its remainder (A71, #1332). Every * figure and word is e3-ui's; every size the `allocationBuilder` recipe's. A * day not read yet draws its column heads and its bands at once, each band's * count a placeholder and one placeholder row in it (#1398, CL2); a day whose * read failed says so once, in the first of those rows in view, with Retry * (CL11). * * @packageDocumentation */ import { type ReactElement } from "react"; import { type SortedMap, type option } from "@elaraai/east"; import { type Formatters } from "@elaraai/east-ui-components"; import { type ChooserSection } from "@elaraai/east-ui-components/internal"; import type { PeriodRead } from "../shared/loading.js"; import { type RowAnchor, type RowNarrowing } from "../shared/schedule/row-anchor.js"; import { type AllocationCommands } from "./actions.js"; import { type ChoiceWords } from "./choices.js"; import { type AllocationDrag, type Target } from "./drag.js"; import type { AllocationFit } from "./fit.js"; import { type TableRow } from "./table-rows.js"; import type { AllocationOptimised } from "./optimise.js"; import type { TimelineFollow } from "./timeline.js"; import { type AllocationDomain, type AllocationStyles, type AllocationValue, type Bin, type Context, type Day, type Load, type Selection, type Slot } from "./model.js"; /** The probe reservation a free row's resource Chooser asks the fit about. */ export declare const RESERVE_PROBE = "\0reserve"; /** The Table's props. */ export interface TableProps { value: AllocationValue; domain: AllocationDomain; context: Context; styles: AllocationStyles; format: Formatters; day: Date; plan: Day; held: Day | undefined; sameBin: (a: Bin, b: Bin) => boolean; /** Whether a bin holds a conflict not yet chosen: it wears the warn ring. None by default. */ conflicted?: ((id: string) => boolean) | undefined; /** Whether a bin's row breaks its form's bounds (#1585), stored or changed: it wears the warn ring too. None by default. */ bounded?: ((id: string) => boolean) | undefined; loads: SortedMap; slots: readonly Slot[]; selection: Selection | undefined; editable: boolean; select: (next: Selection | undefined, soft?: boolean) => void; follow: TimelineFollow; drag: AllocationDrag; commands: AllocationCommands; fit: AllocationFit; /** The day without a bin, and with a probe reservation in a free slot: what a cell's Chooser asks the fit of. */ without: (bin: string) => Day; reserving: (lane: string, at: Date) => Day; /** The lanes, the resources and the arrivals the narrowing shows, by key; `none` for every one (#1336, #1339). */ visibleLanes: option>; visibleResources: option>; visibleArrivals: option>; /** Clears the narrowing, where nothing shows; `undefined` with no narrowing. */ clearFilters: (() => void) | undefined; /** The arrival whose every bin the Library's Allocated card highlights (A10). */ highlight: string | undefined; /** Books the picked arrival where a click lands, as its drop would (A11). */ book: (target: Target) => void; /** * What it draws of the day's read (#1398): the day as read; a day not read yet — the day without its bins handed in * as `plan`, its bands real, a placeholder row in each once the reveal says so; or one whose read failed — the failure * said once, in the first of those rows in view. */ read: PeriodRead; /** Where the Table's view last rested (#1398): its top line, by key, which it comes back to as it mounts. */ anchor?: RowAnchor | undefined; /** Told where the Table's view rests as its scroll settles. */ onAnchor?: ((at: RowAnchor) => void) | undefined; /** * The board's narrowing, as text, and whether its rows are in (#1398): across a new one the Table keeps the line at the * top of its view where the narrowing holds it — by its key, and the px into it — and else starts at its top. */ narrowing?: RowNarrowing | undefined; /** What the runs of the app's optimiser left on the day's bins (#1409): each bin's operation, drawn on its row's chip, and its provenance on hover. */ optimised?: AllocationOptimised | undefined; /** Whether a run's highlight is on (#1409): a band's count flashes where the run changed its rows. */ lit?: boolean | undefined; } /** * A row's cell a Chooser is open on: its arrival, or its resource — the * row's, one part of a split bin's (`part`, its resource), or the remainder's * (`part: null`, `+ resource`, A71). A narrow card's actions open the same * Choosers (A78). */ export interface Open { row: string; side: "arrival" | "resource"; part?: string | null | undefined; } /** A Chooser's identity in its row, as a row's memo compares it: `arrival`, `resource`, `resource:K-203`, `resource:+`. */ export declare const openKey: (side: Open["side"], part: Open["part"]) => string; /** * The Table (see the module docs). * * @param props - See {@link TableProps} * @returns Its bands and rows under their column heads */ export declare function AllocationTable(props: TableProps): import("react/jsx-runtime").JSX.Element; /** * A Chooser in the shared anchored popover (A48): its trigger, the sections * its question was answered with, and what a choice does; its search takes the * focus as it opens. * * @param args - Its identity (`data-allocation-choices`), its label, its trigger, whether it is open, its sections, its search's words and what a choice does * @returns The popover */ export declare function ChooserPopover({ id, label, trigger, open, onOpenChange, sections, placeholder, onChoose }: { id: string; label: string; trigger: ReactElement; open: boolean; onOpenChange: (open: boolean) => void; sections: ChooserSection[]; placeholder: string; onChoose: (key: string) => void; }): import("react/jsx-runtime").JSX.Element; /** What a cell's Chooser reads of the board: the day, every arrival and resource, the fit, the commands, the days it asks of, and what the narrowing shows. */ export type ChoiceScene = Pick; /** * A cell's chevron and its Chooser (A48, A49): the question the cell asks the * fit, its answer's sections, and what a choice does. A split bin's part * chip moves that part, and `+ resource` links the remainder, each asked * for the quantity it places (A71, A73). A narrow card's `Book…`, `Reserve…`, * `Allocate…` and `Move` are these Choosers on its own trigger (A78). * * @param args - The board, the row, its side and part, whether it is open, the words and its trigger * @returns The Chooser's popover on its trigger */ export declare function ChoiceCell({ props, row, side, part, open, setOpen, words, trigger }: { props: ChoiceScene; row: TableRow; side: "arrival" | "resource"; /** A resource Chooser's part: the row's (`undefined`, its bin's first), a part's resource, or the remainder (`null`). */ part?: string | null | undefined; open: boolean; setOpen: (open: Open | undefined) => void; words: ChoiceWords; trigger: (open: boolean) => ReactElement; }): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=table.d.ts.map