import { OptionColor } from "../lib/option-color.js"; //#region src/kanban/grouping.d.ts /** * The band a column belongs to: a named run of adjacent columns the board * shows under one header and can collapse as a unit. A status property's * option groups ("To do", "In progress", "Done") are the usual source. */ export type KanbanColumnBand = { id: string; label: string; optionColor?: OptionColor | undefined; }; /** One column, before the uncategorized bucket is appended. */ export type KanbanGroupOption = { value: string; label: string; image?: string | null | undefined; color?: string | undefined; colorBg?: string | undefined; optionColor?: OptionColor | undefined; band?: KanbanColumnBand | undefined; }; /** A column, including the uncategorized bucket (`value: null`). */ export type KanbanGroup = { value: string | null; label: string; image?: string | null | undefined; color?: string | undefined; colorBg?: string | undefined; optionColor?: OptionColor | undefined; band?: KanbanColumnBand | undefined; }; /** * A column source that is not a schema property, addressed by a reserved id. * * The board's columns are the caller's `options`, in the caller's order, so a * built-in grouping is a data declaration rather than a branch this module has * to know about. */ export type KanbanBuiltInGroup = { /** Reserved group id, distinct from any property id. */ id: TGroupId; /** Ordered columns, without the uncategorized bucket. */ options: readonly KanbanGroupOption[]; /** * Narrows the board to the rows this grouping can place. Omit when every row * belongs on the board. */ selectRows?: ((rows: readonly TRow[]) => TRow[]) | undefined; }; /** * Everything the grouping needs to know about a board. * * `getPropertyOptions` returns `null` for a property that cannot carry columns, * which keeps the decision — and the property model it depends on — with the * caller. */ export type KanbanSchema = { builtInGroups: readonly KanbanBuiltInGroup[]; properties: readonly TProperty[]; getPropertyId: (property: TProperty) => TGroupId; getPropertyOptions: (property: TProperty) => readonly KanbanGroupOption[] | null; }; export type KanbanGrouping = { type: "none"; } | { type: "built-in"; propertyId: TGroupId; group: KanbanBuiltInGroup; } | { type: "property"; propertyId: TGroupId; property: TProperty; options: readonly KanbanGroupOption[]; }; export type ResolveKanbanGroupingParams = { /** The group-by id the view carries; empty means no grouping. */ groupBy: TGroupId | ""; schema: KanbanSchema; }; /** Resolve a stored group-by id against a schema. */ export declare const resolveKanbanGrouping: ({ groupBy, schema }: ResolveKanbanGroupingParams) => KanbanGrouping; export declare const getKanbanGroupingPropertyId: (grouping: KanbanGrouping) => TGroupId | null; /** * A grouping with no columns is not a board. A built-in grouping declares its * columns up front, so an empty declaration is the signal that the board cannot * be drawn; a property grouping always draws, even when the property has no * options yet, because rows still land in the uncategorized bucket. */ export declare const isKanbanGroupingRenderable: (grouping: KanbanGrouping) => boolean; /** The rows a grouping can place on the board, in their incoming order. */ export declare const selectKanbanRows: (rows: readonly TRow[], grouping: KanbanGrouping) => TRow[]; /** The static column options for a grouping, excluding uncategorized. */ export declare const resolveKanbanGroupOptions: (grouping: KanbanGrouping) => readonly KanbanGroupOption[]; /** Append the uncategorized bucket (null value) after the options. */ export declare const getKanbanGroups: (options: readonly KanbanGroupOption[], uncategorizedLabel: string) => KanbanGroup[]; //#endregion