@toclocoinc/lattice-grid 1.33.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/API.html +330 -2
- package/docs/api-detail.html +3 -1
- package/lattice-grid.d.ts +495 -1
- package/lattice-grid.esm.min.js +4 -4
- package/lattice-grid.min.cjs +4 -4
- package/lattice-grid.min.js +4 -4
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/charts.esm.min.js +4 -4
- package/modules/charts.min.cjs +4 -4
- package/modules/charts.min.js +4 -4
- package/modules/data-router.esm.min.js +370 -6
- package/modules/data-router.min.cjs +370 -6
- package/modules/data-router.min.js +370 -6
- package/modules/devtools.esm.min.js +2 -2
- package/modules/devtools.min.cjs +2 -2
- package/modules/devtools.min.js +2 -2
- package/modules/dhtmlx-compat.esm.min.js +4 -4
- package/modules/dhtmlx-compat.min.cjs +4 -4
- package/modules/dhtmlx-compat.min.js +4 -4
- package/modules/gantt.esm.min.js +2004 -0
- package/modules/gantt.min.cjs +1996 -0
- package/modules/gantt.min.js +1996 -0
- package/modules/htmx.esm.min.js +4 -4
- package/modules/htmx.min.cjs +4 -4
- package/modules/htmx.min.js +4 -4
- package/modules/kanban.esm.min.js +2278 -0
- package/modules/kanban.min.cjs +2281 -0
- package/modules/kanban.min.js +2281 -0
- package/modules/mock-socket.esm.min.js +2 -2
- package/modules/mock-socket.min.cjs +2 -2
- package/modules/mock-socket.min.js +2 -2
- package/modules/react.esm.min.js +2 -2
- package/modules/react.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/svelte.esm.min.js +2 -2
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- package/modules/vue.esm.min.js +2 -2
- package/modules/vue.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/webcomponent.esm.min.js +4 -4
- package/modules/webcomponent.min.cjs +4 -4
- package/modules/webcomponent.min.js +4 -4
- package/package.json +1 -1
package/lattice-grid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.34.0, type declarations
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -6272,6 +6272,189 @@ declare module 'lattice-grid/modules/data-router' {
|
|
|
6272
6272
|
export default createDataRouter;
|
|
6273
6273
|
}
|
|
6274
6274
|
|
|
6275
|
+
declare module 'lattice-grid/modules/gantt' {
|
|
6276
|
+
/** One of the four dependency link types (finish-to-start, start-to-start, finish-to-finish, start-to-finish). */
|
|
6277
|
+
export type GanttLinkType = 'FS' | 'SS' | 'FF' | 'SF';
|
|
6278
|
+
|
|
6279
|
+
/**
|
|
6280
|
+
* A task in a Gantt plan. Give a `duration` or a numeric `start`+`end` (one is
|
|
6281
|
+
* derived from the other). `milestone: true` (or `duration: 0`) is a
|
|
6282
|
+
* zero-duration point. `parent` nests a task under a summary task, whose window
|
|
6283
|
+
* and progress are DERIVED from its children rather than scheduled.
|
|
6284
|
+
*/
|
|
6285
|
+
export interface GanttTask {
|
|
6286
|
+
id: string | number;
|
|
6287
|
+
name?: string;
|
|
6288
|
+
start?: number;
|
|
6289
|
+
end?: number;
|
|
6290
|
+
duration?: number;
|
|
6291
|
+
percentComplete?: number;
|
|
6292
|
+
milestone?: boolean;
|
|
6293
|
+
parent?: string | number;
|
|
6294
|
+
}
|
|
6295
|
+
|
|
6296
|
+
/**
|
|
6297
|
+
* A typed dependency between two tasks (by id), with optional lag/lead. `type`
|
|
6298
|
+
* defaults to `'FS'`; either endpoint may be a leaf or a summary.
|
|
6299
|
+
*/
|
|
6300
|
+
export interface GanttDependency {
|
|
6301
|
+
from: string | number;
|
|
6302
|
+
to: string | number;
|
|
6303
|
+
type?: GanttLinkType;
|
|
6304
|
+
lag?: number;
|
|
6305
|
+
}
|
|
6306
|
+
|
|
6307
|
+
/** The computed CPM values for one task (a leaf is scheduled, a summary derived). */
|
|
6308
|
+
interface GanttScheduledTask {
|
|
6309
|
+
id: string;
|
|
6310
|
+
name: string;
|
|
6311
|
+
duration: number;
|
|
6312
|
+
es: number;
|
|
6313
|
+
ef: number;
|
|
6314
|
+
ls: number;
|
|
6315
|
+
lf: number;
|
|
6316
|
+
totalFloat: number;
|
|
6317
|
+
critical: boolean;
|
|
6318
|
+
percentComplete: number | null;
|
|
6319
|
+
parent: string | null;
|
|
6320
|
+
isSummary: boolean;
|
|
6321
|
+
isMilestone: boolean;
|
|
6322
|
+
children: string[];
|
|
6323
|
+
}
|
|
6324
|
+
|
|
6325
|
+
/** A CPM schedule result: per-task dates/float and the critical path, or an error. */
|
|
6326
|
+
interface GanttSchedule {
|
|
6327
|
+
ok: boolean;
|
|
6328
|
+
error?: { code: string; message: string; cycle?: string[] };
|
|
6329
|
+
tasks?: Map<string, GanttScheduledTask>;
|
|
6330
|
+
order?: string[];
|
|
6331
|
+
critical?: string[];
|
|
6332
|
+
criticalPaths?: string[][];
|
|
6333
|
+
projectStart?: number;
|
|
6334
|
+
projectFinish?: number;
|
|
6335
|
+
projectDuration?: number;
|
|
6336
|
+
}
|
|
6337
|
+
|
|
6338
|
+
/** A placement violation flagged by `findViolations`. */
|
|
6339
|
+
interface GanttViolation {
|
|
6340
|
+
id: string;
|
|
6341
|
+
placedStart: number;
|
|
6342
|
+
earliestStart: number;
|
|
6343
|
+
by: number;
|
|
6344
|
+
}
|
|
6345
|
+
|
|
6346
|
+
/** The four link types, in documented order. */
|
|
6347
|
+
export const LINK_TYPES: readonly GanttLinkType[];
|
|
6348
|
+
|
|
6349
|
+
/** Error codes the scheduler reports (rather than throwing) on bad input. */
|
|
6350
|
+
export const SCHEDULE_ERROR: Record<string, string>;
|
|
6351
|
+
|
|
6352
|
+
/**
|
|
6353
|
+
* Compute the CPM schedule for a set of tasks and dependencies: forward and
|
|
6354
|
+
* backward passes over the leaf tasks honouring FS/SS/FF/SF + lag, slack/float
|
|
6355
|
+
* and the zero-float critical path, with summaries derived from their children,
|
|
6356
|
+
* milestones scheduled as points, and dependency cycles refused (never looped).
|
|
6357
|
+
*/
|
|
6358
|
+
export function computeSchedule(tasks: GanttTask[], deps?: GanttDependency[], options?: { projectStart?: number; deadline?: number }): GanttSchedule;
|
|
6359
|
+
|
|
6360
|
+
/** The tasks placed earlier than their earliest feasible start (manual validation). */
|
|
6361
|
+
export function findViolations(tasks: GanttTask[], schedule: GanttSchedule): GanttViolation[];
|
|
6362
|
+
|
|
6363
|
+
/** Format an engine day-number as an ISO calendar date (`YYYY-MM-DD`, UTC). */
|
|
6364
|
+
export function toISODate(day: number): string | null;
|
|
6365
|
+
|
|
6366
|
+
/** A headless Gantt controller: holds the model, recomputes on edits, emits changes. */
|
|
6367
|
+
interface Gantt {
|
|
6368
|
+
readonly tasks: GanttTask[];
|
|
6369
|
+
readonly dependencies: GanttDependency[];
|
|
6370
|
+
readonly schedule: GanttSchedule | null;
|
|
6371
|
+
readonly critical: string[];
|
|
6372
|
+
readonly autoSchedule: boolean;
|
|
6373
|
+
readonly grid: unknown;
|
|
6374
|
+
setTasks(tasks: GanttTask[]): GanttSchedule;
|
|
6375
|
+
setDependencies(deps: GanttDependency[]): GanttSchedule;
|
|
6376
|
+
applyEdit(patch: { id: string | number; start?: number; end?: number; duration?: number }, editOpts?: { writeBack?: boolean }): GanttSchedule;
|
|
6377
|
+
compute(): GanttSchedule;
|
|
6378
|
+
findViolations(): GanttViolation[];
|
|
6379
|
+
/** Export the scheduled tasks as CSV; `{ dates: true }` writes ISO dates. */
|
|
6380
|
+
toCSV(csvOpts?: { dates?: boolean }): string;
|
|
6381
|
+
/**
|
|
6382
|
+
* The live consumer surface, mirroring `grid.rows.apply`, so a Data Router
|
|
6383
|
+
* can drive the Gantt like any other view. Keyed by the controller's rowKey.
|
|
6384
|
+
*/
|
|
6385
|
+
readonly rows: {
|
|
6386
|
+
apply(change: { add?: GanttTask[]; update?: GanttTask[]; remove?: Array<string | GanttTask> }): {
|
|
6387
|
+
added: GanttTask[]; updated: GanttTask[]; removed: string[];
|
|
6388
|
+
};
|
|
6389
|
+
};
|
|
6390
|
+
on(event: 'schedule' | 'error', fn: (payload: unknown) => void): () => void;
|
|
6391
|
+
off(event: 'schedule' | 'error', fn: (payload: unknown) => void): void;
|
|
6392
|
+
/**
|
|
6393
|
+
* Render the plan into a container as an SVG timeline (bars, dependency
|
|
6394
|
+
* arrows, critical-path highlight, today line, non-working shading,
|
|
6395
|
+
* milestones, progress). The view redraws when the schedule recomputes.
|
|
6396
|
+
*/
|
|
6397
|
+
mount(container: unknown, options?: {
|
|
6398
|
+
width?: number;
|
|
6399
|
+
rowHeight?: number;
|
|
6400
|
+
labelWidth?: number;
|
|
6401
|
+
rowLabels?: boolean;
|
|
6402
|
+
showArrows?: boolean;
|
|
6403
|
+
showCritical?: boolean;
|
|
6404
|
+
showProgress?: boolean;
|
|
6405
|
+
dateAxis?: boolean;
|
|
6406
|
+
today?: number;
|
|
6407
|
+
nonWorking?: 'weekends' | ((day: number) => boolean);
|
|
6408
|
+
label?: 'name' | 'percent' | 'dates' | 'none' | ((task: GanttScheduledTask) => string);
|
|
6409
|
+
/** Whether bars can be dragged to move/resize (default true). */
|
|
6410
|
+
editable?: boolean;
|
|
6411
|
+
/** Pixels from a bar's right edge that begin a resize rather than a move. */
|
|
6412
|
+
resizeZone?: number;
|
|
6413
|
+
/** Time-scale zoom: a level, or raw pixels-per-day. Omit to fit the width. */
|
|
6414
|
+
zoom?: 'day' | 'week' | 'month' | 'quarter' | number;
|
|
6415
|
+
/** Scroll so the today line is in view after drawing. */
|
|
6416
|
+
scrollToToday?: boolean;
|
|
6417
|
+
/** Show a hover tooltip (dates/duration/%/slack); default true. */
|
|
6418
|
+
tooltip?: boolean;
|
|
6419
|
+
/** Group tasks into swimlanes by a task property name or `fn(task)`. */
|
|
6420
|
+
groupBy?: string | ((task: GanttTask) => unknown);
|
|
6421
|
+
/** Keyboard editing + focusable bars + ARIA announcements (default true). */
|
|
6422
|
+
keyboard?: boolean;
|
|
6423
|
+
/** Days a keyboard arrow moves/resizes a task (default 1). */
|
|
6424
|
+
moveStep?: number;
|
|
6425
|
+
}): unknown;
|
|
6426
|
+
/** Detach the mounted view, if any. The host still owns the container. */
|
|
6427
|
+
unmount(): void;
|
|
6428
|
+
/** The mounted view, or null. */
|
|
6429
|
+
readonly view: unknown;
|
|
6430
|
+
destroy(): void;
|
|
6431
|
+
}
|
|
6432
|
+
|
|
6433
|
+
/**
|
|
6434
|
+
* Create a Gantt controller over a task list and a dependency list. Computes
|
|
6435
|
+
* the CPM schedule immediately and again on every `setTasks`/`setDependencies`/
|
|
6436
|
+
* `applyEdit`, emitting `schedule` on success and `error` on a cycle or bad
|
|
6437
|
+
* input. `grid` is stored for the write-back binding; `autoSchedule` requests
|
|
6438
|
+
* dependent cascading.
|
|
6439
|
+
*/
|
|
6440
|
+
export function createGantt(opts?: {
|
|
6441
|
+
tasks?: GanttTask[];
|
|
6442
|
+
dependencies?: GanttDependency[];
|
|
6443
|
+
projectStart?: number;
|
|
6444
|
+
/** A project deadline (day-number); tasks that cannot meet it get negative float. */
|
|
6445
|
+
deadline?: number;
|
|
6446
|
+
autoSchedule?: boolean;
|
|
6447
|
+
grid?: unknown;
|
|
6448
|
+
/** Map task fields to grid column ids to enable drag write-back. */
|
|
6449
|
+
columns?: { start?: string; end?: string; duration?: string };
|
|
6450
|
+
/** Task identity for the live `rows.apply` surface (a field or fn); default 'id'. */
|
|
6451
|
+
rowKey?: string | ((row: GanttTask) => unknown);
|
|
6452
|
+
/** Auto-mount into this element at construction. */
|
|
6453
|
+
element?: unknown;
|
|
6454
|
+
}): Gantt;
|
|
6455
|
+
export default createGantt;
|
|
6456
|
+
}
|
|
6457
|
+
|
|
6275
6458
|
declare module 'lattice-grid/modules/webcomponent' {
|
|
6276
6459
|
/**
|
|
6277
6460
|
* Register `<lattice-grid>`.
|
|
@@ -6496,3 +6679,314 @@ declare module 'lattice-grid/modules/mock-socket' {
|
|
|
6496
6679
|
|
|
6497
6680
|
export default MockWebSocket;
|
|
6498
6681
|
}
|
|
6682
|
+
|
|
6683
|
+
declare module 'lattice-grid/modules/kanban' {
|
|
6684
|
+
/** A row backing a card: any object. Its column comes from `columnProperty` and its identity from `rowKey`. */
|
|
6685
|
+
type KanbanRow = Record<string, unknown>;
|
|
6686
|
+
|
|
6687
|
+
/**
|
|
6688
|
+
* A card model — one row as it appears on the board. `fields` holds the
|
|
6689
|
+
* resolved display text for each mapped card field; `columnId` is the column
|
|
6690
|
+
* the card sits in; `points` is the numeric points value (0 when absent).
|
|
6691
|
+
* `swimlane`/`sprint`/`epic`/`order` are read from their configured properties
|
|
6692
|
+
* and carried for the later cycles that render them.
|
|
6693
|
+
*/
|
|
6694
|
+
interface KanbanCard {
|
|
6695
|
+
key: unknown;
|
|
6696
|
+
row: KanbanRow;
|
|
6697
|
+
columnId: string | null;
|
|
6698
|
+
points: number;
|
|
6699
|
+
hasPoints: boolean;
|
|
6700
|
+
order?: unknown;
|
|
6701
|
+
swimlane?: unknown;
|
|
6702
|
+
sprint?: unknown;
|
|
6703
|
+
epic?: unknown;
|
|
6704
|
+
fields: Record<string, string>;
|
|
6705
|
+
}
|
|
6706
|
+
|
|
6707
|
+
/** A column with its cards and aggregates. `over` is true when `count` exceeds `wipLimit`. */
|
|
6708
|
+
interface KanbanColumn {
|
|
6709
|
+
id: string;
|
|
6710
|
+
title: string;
|
|
6711
|
+
color: string | null;
|
|
6712
|
+
wipLimit: number | null;
|
|
6713
|
+
collapsed: boolean;
|
|
6714
|
+
cards: KanbanCard[];
|
|
6715
|
+
count: number;
|
|
6716
|
+
points: number;
|
|
6717
|
+
over: boolean;
|
|
6718
|
+
}
|
|
6719
|
+
|
|
6720
|
+
/** A column definition: an id string, or an object configuring one column. */
|
|
6721
|
+
type KanbanColumnDef = string | {
|
|
6722
|
+
id: string;
|
|
6723
|
+
title?: string;
|
|
6724
|
+
color?: string;
|
|
6725
|
+
wipLimit?: number;
|
|
6726
|
+
collapsed?: boolean;
|
|
6727
|
+
};
|
|
6728
|
+
|
|
6729
|
+
/** A card field editor handle returned by a host editor factory. */
|
|
6730
|
+
interface KanbanEditor {
|
|
6731
|
+
el: HTMLElement;
|
|
6732
|
+
focus?: () => void;
|
|
6733
|
+
destroy?: () => void;
|
|
6734
|
+
}
|
|
6735
|
+
|
|
6736
|
+
/** A card field mapping: a property path, a function, or an object opting into inline edit. */
|
|
6737
|
+
type KanbanFieldMap = string | ((row: KanbanRow) => unknown) | {
|
|
6738
|
+
field: string;
|
|
6739
|
+
edit?: boolean;
|
|
6740
|
+
editor?: (ctx: { card: KanbanCard; field: string; value: string; commit: (value: unknown) => void; cancel: () => void }) => KanbanEditor;
|
|
6741
|
+
};
|
|
6742
|
+
|
|
6743
|
+
/** The field-to-property mapping that drives the card template. */
|
|
6744
|
+
interface KanbanCardMap {
|
|
6745
|
+
title?: KanbanFieldMap;
|
|
6746
|
+
subtitle?: KanbanFieldMap;
|
|
6747
|
+
labels?: KanbanFieldMap;
|
|
6748
|
+
assignee?: KanbanFieldMap;
|
|
6749
|
+
due?: KanbanFieldMap;
|
|
6750
|
+
cover?: KanbanFieldMap;
|
|
6751
|
+
progress?: KanbanFieldMap;
|
|
6752
|
+
badges?: KanbanFieldMap;
|
|
6753
|
+
accent?: KanbanFieldMap;
|
|
6754
|
+
[field: string]: KanbanFieldMap | undefined;
|
|
6755
|
+
}
|
|
6756
|
+
|
|
6757
|
+
/** Granular readonly: the whole board, or selectively by column id and card key. */
|
|
6758
|
+
type KanbanReadonly = boolean | {
|
|
6759
|
+
board?: boolean;
|
|
6760
|
+
columns?: Record<string, boolean>;
|
|
6761
|
+
cards?: Record<string, boolean>;
|
|
6762
|
+
};
|
|
6763
|
+
|
|
6764
|
+
/** The payload every board event carries. */
|
|
6765
|
+
interface KanbanEvent {
|
|
6766
|
+
card: KanbanCard;
|
|
6767
|
+
column: string | null;
|
|
6768
|
+
el?: unknown;
|
|
6769
|
+
originalEvent?: unknown;
|
|
6770
|
+
}
|
|
6771
|
+
|
|
6772
|
+
/**
|
|
6773
|
+
* Kanban configuration. Every structural property is named here so the same
|
|
6774
|
+
* board maps DemandFlow (a status field, `points`, `sprint`, `epic`, a
|
|
6775
|
+
* swimlane property) and any customer schema without code change.
|
|
6776
|
+
*/
|
|
6777
|
+
interface KanbanConfig {
|
|
6778
|
+
rows?: KanbanRow[];
|
|
6779
|
+
grid?: unknown;
|
|
6780
|
+
rowKey?: string | ((row: KanbanRow) => unknown);
|
|
6781
|
+
columnProperty?: string;
|
|
6782
|
+
columns?: KanbanColumnDef[];
|
|
6783
|
+
columnOrder?: string[];
|
|
6784
|
+
pointsProperty?: string;
|
|
6785
|
+
showPoints?: boolean;
|
|
6786
|
+
orderProperty?: string;
|
|
6787
|
+
swimlaneProperty?: string;
|
|
6788
|
+
/** Render the 2D swimlane layout using `swimlaneProperty` (default false). */
|
|
6789
|
+
swimlanes?: boolean;
|
|
6790
|
+
/** Explicit lane definitions; otherwise lanes come from the distinct swimlane values. */
|
|
6791
|
+
lanes?: (string | { id: string; title?: string })[];
|
|
6792
|
+
sprintProperty?: string;
|
|
6793
|
+
epicProperty?: string;
|
|
6794
|
+
/** The initially selected sprint id, `Kanban.BACKLOG`, or undefined for all. */
|
|
6795
|
+
sprint?: unknown;
|
|
6796
|
+
/** The initially selected epic id, or undefined for all. */
|
|
6797
|
+
epic?: unknown;
|
|
6798
|
+
/** Column ids that count as "done" for a rollup's progress (also a column def's `done: true`). */
|
|
6799
|
+
doneColumns?: string[];
|
|
6800
|
+
/** Card pop-out: a nested child grid or board (master-detail by composition). */
|
|
6801
|
+
children?: KanbanChildren;
|
|
6802
|
+
/** Card virtualization for tall columns: true, or `{ rowHeight, overscan, threshold, viewport }`. */
|
|
6803
|
+
virtualize?: boolean | { rowHeight?: number; overscan?: number; threshold?: number; viewport?: number };
|
|
6804
|
+
/** A saved board state (from `getState`) to restore on construction. */
|
|
6805
|
+
state?: object;
|
|
6806
|
+
/** Show a per-column add-card affordance. */
|
|
6807
|
+
addCard?: boolean;
|
|
6808
|
+
/** Persist a standalone inline edit; return false or a rejected promise to revert. */
|
|
6809
|
+
onCardEdit?: (event: { card: KanbanCard; key: unknown; field: string; fieldPath: string; value: unknown }) => boolean | void | Promise<boolean | void>;
|
|
6810
|
+
/** Create a card for a column on add-card; return the row to create (with its key), or nothing to auto-generate. */
|
|
6811
|
+
onAddCard?: (columnId: string) => KanbanRow | void;
|
|
6812
|
+
/** A predicate filter over cards; only matching cards are shown. */
|
|
6813
|
+
filter?: (row: KanbanRow, card: KanbanCard) => boolean;
|
|
6814
|
+
/** Quick-filter text matched case-insensitively across card fields. */
|
|
6815
|
+
quickFilter?: string;
|
|
6816
|
+
card?: KanbanCardMap;
|
|
6817
|
+
readonly?: KanbanReadonly;
|
|
6818
|
+
ariaLabel?: string;
|
|
6819
|
+
emptyText?: string;
|
|
6820
|
+
/** Whether card selection is enabled (default true). */
|
|
6821
|
+
selectable?: boolean;
|
|
6822
|
+
/** Host-localised words for the move announcements (grabbed/moved/dropped/reverted/cancelled). */
|
|
6823
|
+
labels?: Record<string, string>;
|
|
6824
|
+
/**
|
|
6825
|
+
* Veto/confirm a move before any write. Return `false` (or a promise of it)
|
|
6826
|
+
* to refuse; `from`/`to` are column ids, `index` the target position.
|
|
6827
|
+
*/
|
|
6828
|
+
onBeforeMove?: (card: KanbanCard, from: string | null, to: string, index: number | null) => boolean | Promise<boolean>;
|
|
6829
|
+
/**
|
|
6830
|
+
* Persist a move on a standalone (non-grid) board. Return `false` or a
|
|
6831
|
+
* rejected promise to revert the optimistic move. On a grid-bound board the
|
|
6832
|
+
* grid's write-back pipeline persists instead and this is not called.
|
|
6833
|
+
*/
|
|
6834
|
+
onCardMove?: (event: KanbanMoveEvent) => boolean | void | Promise<boolean | void>;
|
|
6835
|
+
/** A per-card context menu: items, or `fn(card, selectedCards)` returning items. Suppresses `card:contextmenu`. */
|
|
6836
|
+
contextMenu?: KanbanMenuItem[] | ((card: KanbanCard, selected: KanbanCard[]) => KanbanMenuItem[]);
|
|
6837
|
+
onCardClick?: (event: KanbanEvent) => void;
|
|
6838
|
+
onCardDblClick?: (event: KanbanEvent) => void;
|
|
6839
|
+
onCardContextMenu?: (event: KanbanEvent) => void;
|
|
6840
|
+
}
|
|
6841
|
+
|
|
6842
|
+
/**
|
|
6843
|
+
* Card pop-out configuration. The child view is a full composed grid (via
|
|
6844
|
+
* `factory`, a `createGrid`), a nested board (`asBoard`), or a custom `render`.
|
|
6845
|
+
* The child set is the rows whose `property` equals the card key, or the
|
|
6846
|
+
* `load(card)` result. Recursion falls out: a nested board can pop its own
|
|
6847
|
+
* children.
|
|
6848
|
+
*/
|
|
6849
|
+
interface KanbanChildren {
|
|
6850
|
+
/** Parent-id property linking child rows to a card within the same dataset. */
|
|
6851
|
+
property?: string;
|
|
6852
|
+
/** Per-card child rows, sync or async — an alternative (or addition) to `property`. */
|
|
6853
|
+
load?: (card: KanbanCard) => KanbanRow[] | Promise<KanbanRow[]>;
|
|
6854
|
+
/** Whether a card can be expanded, overriding the property/load inference. */
|
|
6855
|
+
hasChildren?: (card: KanbanCard) => boolean;
|
|
6856
|
+
/** Where the pop-out appears (default `drawer`). */
|
|
6857
|
+
present?: 'drawer' | 'modal' | 'inline';
|
|
6858
|
+
/** The grid factory (a `createGrid`) that builds the child grid. */
|
|
6859
|
+
factory?: (container: HTMLElement, options: object) => { destroy?: () => void };
|
|
6860
|
+
/** Make the child a nested board (recursive) instead of a grid. */
|
|
6861
|
+
asBoard?: boolean;
|
|
6862
|
+
/** Options for the child grid/board — an object or `fn(card)`. */
|
|
6863
|
+
gridOptions?: object | ((card: KanbanCard) => object);
|
|
6864
|
+
/** Fully custom child render; returns a cleanup function. */
|
|
6865
|
+
render?: (container: HTMLElement, ctx: { card: KanbanCard; rows: KanbanRow[]; board: Kanban; depth: number }) => (void | (() => void));
|
|
6866
|
+
/** The pop-out title (default the card title). */
|
|
6867
|
+
title?: (card: KanbanCard) => string;
|
|
6868
|
+
}
|
|
6869
|
+
|
|
6870
|
+
/** One context-menu item. `action` receives the card, the selected cards, and the board. */
|
|
6871
|
+
interface KanbanMenuItem {
|
|
6872
|
+
label: string;
|
|
6873
|
+
action?: (ctx: { card: KanbanCard; cards: KanbanCard[]; board: Kanban }) => void;
|
|
6874
|
+
disabled?: boolean;
|
|
6875
|
+
}
|
|
6876
|
+
|
|
6877
|
+
/** The payload of a `card:move` (and `card:reverted`) event. */
|
|
6878
|
+
interface KanbanMoveEvent {
|
|
6879
|
+
keys: unknown[];
|
|
6880
|
+
cards: KanbanCard[];
|
|
6881
|
+
from: (string | null)[];
|
|
6882
|
+
to: string;
|
|
6883
|
+
index: number | null;
|
|
6884
|
+
orders: number[] | null;
|
|
6885
|
+
}
|
|
6886
|
+
|
|
6887
|
+
/** The keyed-diff consumer surface a board shares with a grid, so a Data Router routes to it directly. */
|
|
6888
|
+
interface KanbanRows {
|
|
6889
|
+
apply(change: { add?: KanbanRow[]; update?: KanbanRow[]; remove?: unknown[] }): void;
|
|
6890
|
+
forEach(fn: (row: KanbanRow, key: unknown) => void): void;
|
|
6891
|
+
readonly count: number;
|
|
6892
|
+
}
|
|
6893
|
+
|
|
6894
|
+
/**
|
|
6895
|
+
* A board instance: a kanban view of grid rows as cards grouped into columns.
|
|
6896
|
+
* It consumes data through the same keyed-diff `rows.apply` contract a grid
|
|
6897
|
+
* exposes, so `dataRouter.attach(value, board)` drives it like any other
|
|
6898
|
+
* viewer.
|
|
6899
|
+
*/
|
|
6900
|
+
interface Kanban {
|
|
6901
|
+
readonly el: unknown | null;
|
|
6902
|
+
readonly rowKey: string | ((row: KanbanRow) => unknown);
|
|
6903
|
+
rows: KanbanRows;
|
|
6904
|
+
columns(): KanbanColumn[];
|
|
6905
|
+
column(id: string): KanbanColumn | undefined;
|
|
6906
|
+
count(id: string): number;
|
|
6907
|
+
points(id: string): number;
|
|
6908
|
+
cards(): KanbanCard[];
|
|
6909
|
+
card(key: unknown): KanbanCard | undefined;
|
|
6910
|
+
on(name: string, fn: (event: KanbanEvent) => void): () => void;
|
|
6911
|
+
off(name: string, fn: (event: KanbanEvent) => void): void;
|
|
6912
|
+
readonly(scope?: { column?: string; card?: unknown }): boolean;
|
|
6913
|
+
/**
|
|
6914
|
+
* Move one or more cards to a column (and, with an order property, to a
|
|
6915
|
+
* position within it), through the `onBeforeMove` veto and the grid's
|
|
6916
|
+
* shipped write-back path. The single entry point behind drag-and-drop and
|
|
6917
|
+
* keyboard move.
|
|
6918
|
+
*/
|
|
6919
|
+
move(keys: unknown | unknown[], toColumn: string, toIndex?: number | null, toLane?: string): Promise<{ moved: unknown[]; reverted: boolean }>;
|
|
6920
|
+
/** The selected card keys. */
|
|
6921
|
+
selection(): unknown[];
|
|
6922
|
+
/** Whether a card is selected. */
|
|
6923
|
+
isSelected(key: unknown): boolean;
|
|
6924
|
+
/** Change the selection: `set` (replace), `add`, `toggle` or `remove`. */
|
|
6925
|
+
select(keys: unknown | unknown[], mode?: 'set' | 'add' | 'toggle' | 'remove'): Kanban;
|
|
6926
|
+
/** Clear the selection. */
|
|
6927
|
+
clearSelection(): Kanban;
|
|
6928
|
+
/** Collapse, expand or toggle a column (emits `column:collapse`). */
|
|
6929
|
+
collapseColumn(id: string, collapsed?: boolean): Kanban;
|
|
6930
|
+
/** Collapse, expand or toggle a swimlane (emits `swimlane:collapse`). */
|
|
6931
|
+
collapseLane(id: string, collapsed?: boolean): Kanban;
|
|
6932
|
+
/** Reorder the columns to the given id order (emits `column:reorder`). */
|
|
6933
|
+
reorderColumns(order: string[]): Kanban;
|
|
6934
|
+
/** Move one column before another (or to the end); emits `column:reorder`. */
|
|
6935
|
+
moveColumn(id: string, beforeId: string | null): Kanban;
|
|
6936
|
+
/** Set a predicate filter over cards, or clear it with null. */
|
|
6937
|
+
setFilter(fn: ((row: KanbanRow, card: KanbanCard) => boolean) | null): Kanban;
|
|
6938
|
+
/** Set the quick-filter text matched across card fields. */
|
|
6939
|
+
setQuickFilter(text: string): Kanban;
|
|
6940
|
+
/** Distinct values of a property with card counts — the raw material for a facet control. */
|
|
6941
|
+
facets(property: string): { value: unknown; count: number }[];
|
|
6942
|
+
/** The sentinel `setSprint` value that selects the backlog (cards with no sprint). */
|
|
6943
|
+
readonly BACKLOG: unknown;
|
|
6944
|
+
/** Select the shown sprint (`BACKLOG` for the backlog, undefined for all); emits `sprint:changed`. */
|
|
6945
|
+
setSprint(sprint: unknown): Kanban;
|
|
6946
|
+
/** Show only the backlog (cards with no sprint). */
|
|
6947
|
+
showBacklog(): Kanban;
|
|
6948
|
+
/** Select the shown epic (undefined for all); emits `epic:changed`. */
|
|
6949
|
+
setEpic(epic: unknown): Kanban;
|
|
6950
|
+
/** The distinct sprint values (the switcher's options). */
|
|
6951
|
+
sprints(): unknown[];
|
|
6952
|
+
/** The distinct epic values. */
|
|
6953
|
+
epics(): unknown[];
|
|
6954
|
+
/** Roll rows up by a property: per-bucket count, points, done and progress. */
|
|
6955
|
+
rollup(property: string): { value: unknown; count: number; points: number; doneCount: number; donePoints: number; progress: number }[];
|
|
6956
|
+
/** The epic rollup (empty when no epic property is configured). */
|
|
6957
|
+
epicRollup(): { value: unknown; count: number; points: number; doneCount: number; donePoints: number; progress: number }[];
|
|
6958
|
+
/** Whether a card can be expanded to a child pop-out. */
|
|
6959
|
+
canExpand(card: KanbanCard): boolean;
|
|
6960
|
+
/** Open a card's children in a pop-out (drawer/modal/inline); emits `card:expand`/`card:drill`. */
|
|
6961
|
+
expand(key: unknown): Promise<object | null>;
|
|
6962
|
+
/** Close any open card pop-out. */
|
|
6963
|
+
closeDetail(): Kanban;
|
|
6964
|
+
/** Whether a mapped card field is opted into inline edit and writable. */
|
|
6965
|
+
isFieldEditable(name: string): boolean;
|
|
6966
|
+
/** Start inline editing a card's field (the grid's own field editor when bound); no-op headless. */
|
|
6967
|
+
editCard(key: unknown, name?: string): object | null;
|
|
6968
|
+
/** Commit an inline edit through the write-back path (grid.edit.setCells when bound); emits `card:edit`. */
|
|
6969
|
+
applyEdit(key: unknown, name: string, value: unknown): Promise<boolean>;
|
|
6970
|
+
/** Add a card to a column and open it in inline edit; emits `card:add`. */
|
|
6971
|
+
addCard(columnId: string, seed?: KanbanRow): unknown;
|
|
6972
|
+
/** Serialise the restorable state: collapsed columns/lanes, order, filter, sprint/epic, selection. */
|
|
6973
|
+
getState(): object;
|
|
6974
|
+
/** Restore a state snapshot from {@link Kanban#getState}. */
|
|
6975
|
+
setState(snapshot: object): Kanban;
|
|
6976
|
+
/** Mark the board loading (renders a host-localised loading state). */
|
|
6977
|
+
setLoading(loading: boolean): Kanban;
|
|
6978
|
+
/** Set (or clear with null) an error state, rendered as a host-supplied message. */
|
|
6979
|
+
setError(message: string | null): Kanban;
|
|
6980
|
+
setRows(rows: KanbanRow[]): Kanban;
|
|
6981
|
+
refresh(): Kanban;
|
|
6982
|
+
destroy(): void;
|
|
6983
|
+
}
|
|
6984
|
+
|
|
6985
|
+
/**
|
|
6986
|
+
* Create a board (kanban) view of rows, grouped into columns by a configurable
|
|
6987
|
+
* property. Pass a DOM element to render into, or `null` for a headless board
|
|
6988
|
+
* that computes the same column/card model without a DOM.
|
|
6989
|
+
*/
|
|
6990
|
+
export function createKanban(el: HTMLElement | null, config?: KanbanConfig): Kanban;
|
|
6991
|
+
export default createKanban;
|
|
6992
|
+
}
|