@jaeungkim/gantt-chart 1.3.0 → 1.4.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.
Files changed (66) hide show
  1. package/README.md +15 -14
  2. package/dist/gantt-chart.css +1 -1
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.cts +428 -12
  5. package/dist/index.d.ts +428 -12
  6. package/dist/index.js +2499 -2682
  7. package/package.json +12 -10
  8. package/dist/Gantt.d.ts +0 -5
  9. package/dist/bars/components/GanttBar.d.ts +0 -20
  10. package/dist/bars/components/GanttBarsLayer.d.ts +0 -24
  11. package/dist/bars/components/GanttDragGuides.d.ts +0 -1
  12. package/dist/bars/hooks/useGanttBarDrag.d.ts +0 -15
  13. package/dist/bars/hooks/useGanttDrawCreate.d.ts +0 -25
  14. package/dist/bars/hooks/useGanttProgressDrag.d.ts +0 -11
  15. package/dist/core/calendar.d.ts +0 -27
  16. package/dist/core/dates.d.ts +0 -16
  17. package/dist/core/reorder.d.ts +0 -55
  18. package/dist/core/tree.d.ts +0 -34
  19. package/dist/core/types.d.ts +0 -43
  20. package/dist/dependencies/components/GanttDependencyArrows.d.ts +0 -13
  21. package/dist/dependencies/hooks/useGanttLinkDrag.d.ts +0 -20
  22. package/dist/dependencies/utils/arrowPath.d.ts +0 -20
  23. package/dist/dependencies/utils/link.d.ts +0 -16
  24. package/dist/detail/components/GanttDetailPanel.d.ts +0 -21
  25. package/dist/detail/hooks/useGanttDetail.d.ts +0 -42
  26. package/dist/detail/utils/edit.d.ts +0 -21
  27. package/dist/interaction/hooks/useGanttInteraction.d.ts +0 -2
  28. package/dist/interaction/hooks/useGanttKeyboardNav.d.ts +0 -33
  29. package/dist/interaction/hooks/useGanttSelection.d.ts +0 -12
  30. package/dist/interaction/utils/a11y.d.ts +0 -84
  31. package/dist/props.d.ts +0 -121
  32. package/dist/rows/components/GanttRowsLayer.d.ts +0 -13
  33. package/dist/rows/hooks/useGanttCollapse.d.ts +0 -18
  34. package/dist/rows/hooks/useGanttRowModel.d.ts +0 -19
  35. package/dist/rows/utils/rows.d.ts +0 -21
  36. package/dist/shared/constants.d.ts +0 -24
  37. package/dist/shared/context.d.ts +0 -4
  38. package/dist/shared/hooks/useLatestRef.d.ts +0 -2
  39. package/dist/shared/hooks/useResolvedTheme.d.ts +0 -8
  40. package/dist/shared/store.d.ts +0 -80
  41. package/dist/shared/task.d.ts +0 -55
  42. package/dist/shared/types.d.ts +0 -117
  43. package/dist/shared/utils/holidays.d.ts +0 -12
  44. package/dist/shared/utils/i18n.d.ts +0 -5
  45. package/dist/shared/utils/pointerGesture.d.ts +0 -11
  46. package/dist/shared/virtual/axis.d.ts +0 -13
  47. package/dist/shared/virtual/useVirtualWindow.d.ts +0 -16
  48. package/dist/shared/virtual/window.d.ts +0 -31
  49. package/dist/task-list/components/GanttGridSplitter.d.ts +0 -6
  50. package/dist/task-list/components/GanttTaskAddRow.d.ts +0 -7
  51. package/dist/task-list/components/GanttTaskGrid.d.ts +0 -24
  52. package/dist/task-list/hooks/useGanttRowDrag.d.ts +0 -17
  53. package/dist/task-list/hooks/useGanttTaskListPane.d.ts +0 -11
  54. package/dist/task-list/hooks/useGanttTaskMove.d.ts +0 -16
  55. package/dist/timeline/components/GanttChartHeader.d.ts +0 -10
  56. package/dist/timeline/components/GanttHolidayLabels.d.ts +0 -6
  57. package/dist/timeline/components/GanttNonWorkingLayer.d.ts +0 -6
  58. package/dist/timeline/components/GanttTodayLine.d.ts +0 -6
  59. package/dist/timeline/hooks/useGanttScrollApi.d.ts +0 -62
  60. package/dist/timeline/hooks/useGanttViewport.d.ts +0 -47
  61. package/dist/timeline/hooks/useGanttVirtualization.d.ts +0 -28
  62. package/dist/timeline/utils/geometry.d.ts +0 -49
  63. package/dist/timeline/utils/header.d.ts +0 -8
  64. package/dist/timeline/utils/transform.d.ts +0 -9
  65. package/dist/timeline/utils/viewport.d.ts +0 -31
  66. package/dist/useGanttSelectors.d.ts +0 -11
package/dist/index.d.cts CHANGED
@@ -1,12 +1,428 @@
1
- export { default as ReactGanttChart } from './Gantt';
2
- export type { GanttProps } from './props';
3
- export type { GanttDetailApi, GanttHandle, GanttTaskCreateApi, GanttScrollApi, GanttScrollOptions, GanttZoomAnchor, } from './timeline/hooks/useGanttScrollApi';
4
- export type { Task, TaskDependency, DependencyType, TaskTransformed, GanttInteractionConfig, } from './shared/task';
5
- export type { GanttDependencyChange } from './dependencies/hooks/useGanttLinkDrag';
6
- export type { GanttMoveRejection, GanttTaskMove, GanttTaskMoveChange, } from './core/reorder';
7
- export type { GanttTaskDraft } from './bars/hooks/useGanttDrawCreate';
8
- export type { GanttDateRange, GanttDetailRenderProps, GanttDetailRenderer, GanttFormatOverrides, GanttScaleFormat, GanttScaleKey, GanttTheme, Holiday, } from './shared/types';
9
- export type { GanttRow } from './rows/utils/rows';
10
- export { CALENDAR_DAYS, createWorkingCalendar, type WorkingCalendar, type WorkingCalendarOptions, } from './core/calendar';
11
- export { buildTaskTree, collectSubtreeIds, rollUpTasks, type TaskTree, } from './core/tree';
12
- export { moveTask, sortTasksBySequence, validateMove, type GanttMoveOptions, } from './core/reorder';
1
+ import { Dayjs } from 'dayjs';
2
+ import { ForwardRefExoticComponent } from 'react';
3
+ import { ReactNode } from 'react';
4
+ import { RefAttributes } from 'react';
5
+
6
+ export declare function buildTaskTree(tasks: TaskNode[]): TaskTree;
7
+
8
+ /** The default calendar: every day counts, so arithmetic through it is plain calendar arithmetic. */
9
+ export declare const CALENDAR_DAYS: WorkingCalendar;
10
+
11
+ /**
12
+ * The subtree's ids including the root itself (breadth first)
13
+ * An id that is not in the tree yields an empty array
14
+ */
15
+ export declare function collectSubtreeIds(tasks: TaskNode[], rootId: string, tree?: TaskTree): string[];
16
+
17
+ /** A calendar that skips weekends and holidays, configured like the chart's non-working-day shading. */
18
+ export declare function createWorkingCalendar(options?: WorkingCalendarOptions): WorkingCalendar;
19
+
20
+ export declare type DependencyType = 'FS' | 'SS' | 'FF' | 'SF';
21
+
22
+ /** The rendered timeline range, as reported by `onRangeChange` */
23
+ export declare interface GanttDateRange {
24
+ start: Dayjs;
25
+ end: Dayjs;
26
+ }
27
+
28
+ /** The link the user drew, handed to `onDependencyCreate` before anything is committed */
29
+ export declare interface GanttDependencyChange {
30
+ /** Task the drag started on */
31
+ predecessorId: string;
32
+ /** Task the drag was dropped on - the one whose `dependencies` gains the entry */
33
+ successorId: string;
34
+ type: DependencyType;
35
+ }
36
+
37
+ /** Opening and closing the detail panel from outside the chart */
38
+ export declare interface GanttDetailApi {
39
+ /** Opens the detail panel on a task; unknown ids and a panel-less chart (no `renderDetail`/`showDetail`) are ignored */
40
+ openDetail: (taskId: string) => void;
41
+ /** Closes the detail panel */
42
+ closeDetail: () => void;
43
+ }
44
+
45
+ export declare type GanttDetailRenderer = (props: GanttDetailRenderProps) => ReactNode;
46
+
47
+ /** Props handed to a `renderDetail` override */
48
+ export declare interface GanttDetailRenderProps {
49
+ task: TaskTransformed;
50
+ /** Closes the panel - wire it to your own close control */
51
+ close: () => void;
52
+ scale: GanttScaleKey;
53
+ /**
54
+ * Patches the open task through the chart's normal commit path (the store, then
55
+ * `onTasksChange`), so a custom body can commit edits in uncontrolled mode. Applies NO
56
+ * permission checks - a custom body enforces its own rules.
57
+ */
58
+ update: (patch: Partial<Omit<Task, 'id'>>) => void;
59
+ }
60
+
61
+ /** Per-scale label overrides, e.g. `{ quarter: { header: (d) => ... } }` */
62
+ export declare type GanttFormatOverrides = Partial<Record<GanttScaleKey, GanttScaleFormat>>;
63
+
64
+ /** Imperative API exposed through the ref */
65
+ export declare interface GanttHandle extends GanttScrollApi, GanttDetailApi, GanttTaskCreateApi {
66
+ }
67
+
68
+ /** Chart-wide interaction settings - every gesture is allowed by default (task creation also needs `onTaskCreate`), and a task's own field of the same name wins. */
69
+ export declare interface GanttInteractionConfig {
70
+ readOnly?: boolean;
71
+ allowMove?: boolean;
72
+ allowResize?: boolean;
73
+ allowProgressChange?: boolean;
74
+ allowLinkCreate?: boolean;
75
+ allowLinkDelete?: boolean;
76
+ allowTaskCreate?: boolean;
77
+ /** Turns row reordering on - opt-in (default false). */
78
+ allowReorder?: boolean;
79
+ minDate?: string;
80
+ maxDate?: string;
81
+ }
82
+
83
+ export declare interface GanttMoveOptions {
84
+ /** Whether the parentId hierarchy is on - off, depth comes from `sequence` and a reparent is refused */
85
+ hierarchy: boolean;
86
+ /** Whether this task may be moved at all - left out, every task may */
87
+ canReorder?: (task: Task) => boolean;
88
+ }
89
+
90
+ /** Why a move was refused - null from `validateMove` means it is allowed */
91
+ export declare type GanttMoveRejection = "unknown-task" | "unknown-parent" | "read-only" | "cycle" | "reparent-disabled" | "no-op";
92
+
93
+ export declare interface GanttProps {
94
+ /** Task data array. Applied only when the contents change (a new array with equal contents is ignored); `[]` clears the chart. */
95
+ tasks?: Task[];
96
+ /** Callback invoked when tasks change */
97
+ onTasksChange?: (updatedTasks: Task[]) => void;
98
+ /** Chart height (px or a CSS value, default 600) */
99
+ height?: number | string;
100
+ /** Chart width (px or a CSS value, default `"100%"`) */
101
+ width?: number | string;
102
+ /** Theme setting. One of 'light', 'dark', or 'system'; omitted, the host page's `color-scheme` decides. */
103
+ theme?: GanttTheme;
104
+ /** Scale the chart starts at (default `"month"`). A mount-time seed; use `setScale` on the ref to change it later. */
105
+ defaultScale?: GanttScaleKey;
106
+ /** Called whenever the scale changes, from any source (ref, Ctrl/Cmd + wheel, `zoomToFit()`, keyboard). Not on mount. */
107
+ onScaleChange?: (scale: GanttScaleKey) => void;
108
+ /** Additional CSS class name */
109
+ className?: string;
110
+ /** Whether to shade non-working days and show holiday names (default true). `false` hides both. */
111
+ showNonWorkingDays?: boolean;
112
+ /** Which weekdays are worked, 0 = Sunday (default Mon-Fri). Pass a stable array. */
113
+ workingWeekdays?: number[];
114
+ /** Days off beyond the weekend. A bare `YYYY-MM-DD` string is one with no label. Pass a stable array. */
115
+ holidays?: (string | Holiday)[];
116
+ /** Scroll here once after the first render. Takes `"today"` or a date string; later data updates leave the scroll alone. */
117
+ initialScrollTo?: "today" | string;
118
+ /** Blocks every editing gesture on every task. Any `allowX` flag at either level beats it, and reordering defaults to false whether or not this is set. */
119
+ readOnly?: boolean;
120
+ /** Allows/blocks moving bars, and `Delete` on a focused row (default true). Beats `readOnly`. */
121
+ allowMove?: boolean;
122
+ /** Allows/blocks resizing bars (default true). Beats `readOnly`. */
123
+ allowResize?: boolean;
124
+ /** Allows/blocks dragging the progress handle (default true). Beats `readOnly`. */
125
+ allowProgressChange?: boolean;
126
+ /** Earliest date any bar may be dragged to (ISO string). A task's own `minDate` wins. */
127
+ minDate?: string;
128
+ /** Latest date any bar may be dragged to (ISO string). A task's own `maxDate` wins. */
129
+ maxDate?: string;
130
+ /** Pins the timeline to start here (ISO string) instead of fitting to the tasks */
131
+ visibleStart?: string;
132
+ /** Pins the timeline to end here (ISO string) instead of fitting to the tasks */
133
+ visibleEnd?: string;
134
+ /** BCP 47 locale tag for every date label, e.g. `"ko-KR"`, via `Intl.DateTimeFormat`. Omitted or unusable falls back to the built-in English labels. */
135
+ locale?: string;
136
+ /** Per-scale label overrides (`tick`, `header`, `tooltip`). They win over `locale`, and the `Dayjs` handed in is in UTC mode. */
137
+ formats?: GanttFormatOverrides;
138
+ /** First day of the week, 0 = Sunday .. 6 = Saturday. Set it to group the week scale's top header by week instead of by month (off when omitted). */
139
+ firstDayOfWeek?: number;
140
+ /** Whether to show the task list pane on the left (default false). Names only; per-task detail belongs in `renderDetail`. */
141
+ showTaskList?: boolean;
142
+ /** Whether the task list prints each row's `sequence` as a leading number column (default false). */
143
+ showRowNumbers?: boolean;
144
+ /** Whether to use the parentId hierarchy (default false). Parents become summary rows (dates and progress rolled up, dragging moves the subtree); row order still comes from `sequence`. */
145
+ hierarchy?: boolean;
146
+ /** Ids of collapsed parents. Controlled: given, this value is what the chart shows. */
147
+ collapsedIds?: string[];
148
+ /** Initial collapsed list (uncontrolled seed; later changes are ignored) */
149
+ defaultCollapsedIds?: string[];
150
+ /** Called whenever the collapsed state changes. In controlled and uncontrolled mode alike. */
151
+ onCollapsedChange?: (collapsedIds: string[]) => void;
152
+ /** Allows/blocks drawing dependencies between bars (default true). Beats `readOnly`. */
153
+ allowLinkCreate?: boolean;
154
+ /** Allows/blocks selecting and deleting dependency arrows (default true). Beats `readOnly`. */
155
+ allowLinkDelete?: boolean;
156
+ /** Allows/blocks drawing a new task below the last row (default true). Beats `readOnly`. */
157
+ allowTaskCreate?: boolean;
158
+ /**
159
+ * Whether task-list rows can be dragged to a new position or a new parent (default false). A
160
+ * task's own `allowReorder` wins, and a move rewrites `sequence` (re-parenting also `parentId`).
161
+ */
162
+ allowReorder?: boolean;
163
+ /** Called with the link the user drew, before it is applied. Return false to reject it; self-links, duplicates and cycles never reach it. */
164
+ onDependencyCreate?: (change: GanttDependencyChange) => boolean | void;
165
+ /** Called with the arrow the user asked to remove, before it is applied. Return false to keep it. */
166
+ onDependencyDelete?: (change: GanttDependencyChange) => boolean | void;
167
+ /** Called with the range drawn below the last row, snapped to the current scale. The chart adds nothing itself; the host passes a new `tasks` array back. */
168
+ onTaskCreate?: (draft: GanttTaskDraft) => void;
169
+ /**
170
+ * Called with the move the user made, before it is applied. Return false to reject it (sync only,
171
+ * revert by passing the previous `tasks` back). Carries `toParentId`/`toIndex` and `afterId`/`beforeId`;
172
+ * moves the chart already refuses never reach it.
173
+ */
174
+ onTaskMove?: (change: GanttTaskMoveChange) => boolean | void;
175
+ /** Fires when a bar or a task-list row is clicked (not after a drag) */
176
+ onTaskClick?: (task: TaskTransformed, event: React.MouseEvent) => void;
177
+ /** Fires on a double click. The two clicks that make it up still fire `onTaskClick` */
178
+ onTaskDoubleClick?: (task: TaskTransformed, event: React.MouseEvent) => void;
179
+ /** Fires when the selection changes, null when the empty timeline is clicked. Passing it turns selection on. */
180
+ onTaskSelect?: (task: TaskTransformed | null) => void;
181
+ /** Whether clicking selects a row. Omitted, selection is on when `onTaskSelect` is given or the detail panel is on. */
182
+ selectable?: boolean;
183
+ /** Panel body shown beside the chart for one task. Passing it turns the panel on, and the timeline narrows rather than being covered. The props include `update` for committing edits. */
184
+ renderDetail?: GanttDetailRenderer;
185
+ /**
186
+ * Whether the detail panel is available (omitted, it exists exactly when `renderDetail` is given;
187
+ * `true` alone shows the built-in field list, editable in place where the task's interaction
188
+ * flags allow). A click on a bar or row opens it, `Enter` on a focused row too. Turning it on
189
+ * also turns row selection on unless `selectable` says otherwise.
190
+ */
191
+ showDetail?: boolean;
192
+ /** Id of the task whose detail is open, `null` for closed. Controlled: given, this value is what the chart shows. */
193
+ detailTaskId?: string | null;
194
+ /** Called on every open and close. In controlled and uncontrolled mode alike. */
195
+ onDetailChange?: (task: TaskTransformed | null) => void;
196
+ /** Hover and drag tooltips (default true). `false` suppresses both. */
197
+ showTooltip?: boolean;
198
+ /** Whether Ctrl/Cmd + wheel steps through the scales (default false). The date under the cursor stays put. */
199
+ zoomOnWheel?: boolean;
200
+ /** Whether scrolling or dragging past an end grows the rendered range (default false). It extends by about a viewport at a time. */
201
+ infiniteScroll?: boolean;
202
+ /** Called whenever the rendered timeline range changes. The hook for lazy-loading tasks. */
203
+ onRangeChange?: (range: GanttDateRange) => void;
204
+ /** Whether a bar drag reaching a viewport edge scrolls the timeline (default true) */
205
+ autoScrollOnDrag?: boolean;
206
+ /** Snap a drag result forward off non-working days (default false). Uses the same days that shade the timeline; bars still span them visually. */
207
+ workingCalendar?: boolean;
208
+ }
209
+
210
+ /** One rendered row: one task, or several sharing a `lane` */
211
+ export declare interface GanttRow {
212
+ /** Stable key - the ids on the row, joined with "+" */
213
+ id: string;
214
+ tasks: TaskTransformed[];
215
+ /** Indentation level, 0-based */
216
+ depth: number;
217
+ /** `aria-level`, 1-based */
218
+ level: number;
219
+ /** `aria-posinset` among the rows that share a parent */
220
+ posinset: number;
221
+ /** `aria-setsize` for that same set */
222
+ setsize: number;
223
+ }
224
+
225
+ /** Replaces the generated labels of one scale - whatever is left out keeps the built-in (or locale) label. */
226
+ export declare interface GanttScaleFormat {
227
+ /** Bottom header row - one label per tick */
228
+ tick?: (date: Dayjs) => string;
229
+ /** Top header row - one label per group */
230
+ header?: (date: Dayjs) => string;
231
+ /**
232
+ * Every date the chart writes as a single date: the bar's hover tooltip, its live drag readout
233
+ * and aria-label, the header's drag guide labels (through `edge` and `range`, which follow this
234
+ * slot), and the detail panel's Start and End where they are not editable - an editable date is
235
+ * a native `<input type="date">` and never reaches a formatter.
236
+ */
237
+ tooltip?: (date: Dayjs) => string;
238
+ }
239
+
240
+ export declare type GanttScaleKey = 'day' | 'week' | 'month' | 'quarter' | 'year';
241
+
242
+ /** Imperative scroll and zoom API */
243
+ export declare interface GanttScrollApi {
244
+ /** Scroll horizontally to a given date */
245
+ scrollToDate: (date: string | Date | Dayjs, options?: GanttScrollOptions) => void;
246
+ /** Scroll horizontally to today */
247
+ scrollToToday: (options?: GanttScrollOptions) => void;
248
+ /** Scroll horizontally and vertically to a given task */
249
+ scrollToTask: (taskId: string, options?: GanttScrollOptions) => void;
250
+ /** Switches the scale, keeping the center date centered; an unknown key is ignored */
251
+ setScale: (scale: GanttScaleKey) => void;
252
+ /** Switches to the finest scale the whole project fits at and scrolls it into view (no-op with no tasks) */
253
+ zoomToFit: () => void;
254
+ /** The scroll container DOM node (null when unavailable) */
255
+ getScrollElement: () => HTMLDivElement | null;
256
+ }
257
+
258
+ /** Options for the scrollTo* methods */
259
+ export declare interface GanttScrollOptions {
260
+ /** Whether to animate the scroll (default true) */
261
+ smooth?: boolean;
262
+ /** Where the target lands inside the viewport (default 'center') */
263
+ align?: "start" | "center";
264
+ }
265
+
266
+ /** Proposing a new task from outside the chart */
267
+ export declare interface GanttTaskCreateApi {
268
+ /** Sends a one-tick draft at today to `onTaskCreate`, as the "Add task" button does; no-op without `onTaskCreate` or with `allowTaskCreate` false */
269
+ addTask: () => void;
270
+ }
271
+
272
+ /** The task the user drew, handed to `onTaskCreate` - nothing is committed by the chart */
273
+ export declare interface GanttTaskDraft {
274
+ /** UTC ISO string, snapped to the current scale */
275
+ startDate: string;
276
+ endDate: string;
277
+ }
278
+
279
+ /** Where a task is going: a parent, and a slot among that parent's children */
280
+ export declare interface GanttTaskMove {
281
+ taskId: string;
282
+ /** New parent, null for the root level */
283
+ toParentId: string | null;
284
+ /** Slot among the new parent's children, counted in the list as it stands after the move */
285
+ toIndex: number;
286
+ }
287
+
288
+ /** The move that was applied - `toIndex` for an index-based API, `afterId`/`beforeId` for a position-based one */
289
+ export declare interface GanttTaskMoveChange extends GanttTaskMove {
290
+ fromParentId: string | null;
291
+ fromIndex: number;
292
+ /** Sibling the task now follows - null when it is the first child */
293
+ afterId: string | null;
294
+ /** Sibling the task now precedes - null when it is the last child */
295
+ beforeId: string | null;
296
+ }
297
+
298
+ /** Chart theme - 'system' follows the OS setting; omit the prop to follow the host page's `color-scheme`. */
299
+ export declare type GanttTheme = 'light' | 'dark' | 'system';
300
+
301
+ /** A day off beyond the weekend. A bare `YYYY-MM-DD` string is the same thing with no label. */
302
+ export declare interface Holiday {
303
+ /** UTC `YYYY-MM-DD`. A string carrying a time or an offset is read as a UTC instant. */
304
+ date: string;
305
+ /** Inclusive last day, read the same way as `date`. Omit for a single day. */
306
+ endDate?: string;
307
+ /** Written in the tick row over the holiday's band, when the band is wide enough to hold it */
308
+ label?: string;
309
+ /** Any CSS color. Tinted onto the grid at the weekend shade's weight, never painted over it. */
310
+ color?: string;
311
+ }
312
+
313
+ /**
314
+ * Applies a move, renumbering every sequence from the resulting row order; `parentId` is rewritten
315
+ * on the moved task only. Null when refused (`validateMove` says why); unchanged tasks keep identity.
316
+ */
317
+ export declare function moveTask(tasks: Task[], move: GanttTaskMove, options: GanttMoveOptions): {
318
+ tasks: Task[];
319
+ change: GanttTaskMoveChange;
320
+ } | null;
321
+
322
+ /** Gantt chart component. Creates a store per instance, so two charts on one page cannot share state. */
323
+ export declare const ReactGanttChart: ForwardRefExoticComponent<GanttProps & RefAttributes<GanttHandle>>;
324
+
325
+ /**
326
+ * The tasks with every parent recomputed as a summary row: start/end always from the children
327
+ * (deepest first, so a move travels all the way up); an explicit progress is left alone.
328
+ */
329
+ export declare function rollUpTasks(tasks: Task[], tree?: TaskTree): Task[];
330
+
331
+ /** Sort tasks by their sequence hierarchy - row order comes from this and nothing else */
332
+ export declare function sortTasksBySequence<T extends Pick<Task, "sequence">>(tasks: T[]): T[];
333
+
334
+ export declare interface Task {
335
+ id: string;
336
+ name: string;
337
+ startDate: string;
338
+ endDate: string;
339
+ parentId: string | null;
340
+ sequence: string;
341
+ /** Progress 0-100 (%) - omitted means no progress display */
342
+ progress?: number;
343
+ /** Bar color (any CSS color) - progress fill and hover shade derive from it; omitted, the `--gantt-*` tokens decide */
344
+ color?: string;
345
+ /** Extra class name put on this task's bar and its task-list row */
346
+ className?: string;
347
+ /** Lane this task shares a row with - lane-mates draw side by side, overlaps stack onto extra rows */
348
+ lane?: string;
349
+ dependencies?: TaskDependency[];
350
+ /** Blocks every gesture on this task - overrides the chart's `readOnly` prop */
351
+ readOnly?: boolean;
352
+ /** Allows/blocks moving this task - overrides both `readOnly` settings */
353
+ allowMove?: boolean;
354
+ /** Allows/blocks resizing this task - overrides both `readOnly` settings */
355
+ allowResize?: boolean;
356
+ /** Allows/blocks dragging this task's progress handle - overrides both `readOnly` settings */
357
+ allowProgressChange?: boolean;
358
+ /** Allows/blocks starting a dependency drag from this task - overrides both `readOnly` settings */
359
+ allowLinkCreate?: boolean;
360
+ /** Allows/blocks deleting a dependency this task owns - overrides both `readOnly` settings */
361
+ allowLinkDelete?: boolean;
362
+ /** Allows/blocks dragging this row to a new position or parent - opt-in, off unless this or the chart's `allowReorder` turns it on */
363
+ allowReorder?: boolean;
364
+ /** Earliest date this task may be dragged to (ISO string) - overrides the chart's `minDate` */
365
+ minDate?: string;
366
+ /** Latest date this task may be dragged to (ISO string) - overrides the chart's `maxDate` */
367
+ maxDate?: string;
368
+ }
369
+
370
+ export declare interface TaskDependency {
371
+ /** The predecessor's id - a task's `dependencies` list the tasks it waits on */
372
+ targetId: string;
373
+ type: DependencyType;
374
+ }
375
+
376
+ /** The minimum a task needs for the tree math - TaskTransformed fits as-is */
377
+ declare type TaskNode = Pick<Task, "id" | "parentId">;
378
+
379
+ export declare interface TaskTransformed extends Task {
380
+ barLeft: number;
381
+ barWidth: number;
382
+ depth: number;
383
+ order: number;
384
+ originalOrder: number;
385
+ /** Row with children - its dates roll up, so resize and progress editing are off and dragging moves the subtree. */
386
+ isSummary?: boolean;
387
+ dependencies?: TaskDependency[];
388
+ }
389
+
390
+ /**
391
+ * A normalized tree built from parentId. Orphans, self-references and cycles lose their
392
+ * parent link and become roots, so what comes out is always acyclic.
393
+ */
394
+ export declare interface TaskTree {
395
+ /** parent id -> child ids (in input order) */
396
+ childIds: Map<string, string[]>;
397
+ /** task id -> normalized parent id (null for a root, an orphan or a cycle) */
398
+ parentOf: Map<string, string | null>;
399
+ /** task id -> depth from the root */
400
+ depthOf: Map<string, number>;
401
+ /** Root ids, in input order - the sibling list childIds has no key for */
402
+ rootIds: string[];
403
+ }
404
+
405
+ /** Whether a move can be applied, and why not when it cannot - runs on every frame of a row drag */
406
+ export declare function validateMove(tasks: Task[], move: GanttTaskMove, options: GanttMoveOptions): GanttMoveRejection | null;
407
+
408
+ /** Day arithmetic that can skip non-working days. */
409
+ export declare interface WorkingCalendar {
410
+ /** False for the default calendar (every day counts) */
411
+ readonly skipsNonWorkingDays: boolean;
412
+ isWorkingDay(date: Dayjs): boolean;
413
+ /** Moves `days` days forward (or backward), skipping non-working days */
414
+ addDays(date: Dayjs, days: number): Dayjs;
415
+ /** Days from `from` to `to`, counted the same way `addDays` moves. Signed. */
416
+ daysBetween(from: Dayjs, to: Dayjs): number;
417
+ /** The date itself when it is a working day, otherwise the next one (time of day kept) */
418
+ snapForward(date: Dayjs): Dayjs;
419
+ }
420
+
421
+ export declare interface WorkingCalendarOptions {
422
+ /** Working weekdays as UTC day numbers, 0 = Sunday (default Mon-Fri) */
423
+ workingWeekdays?: number[];
424
+ /** Non-working dates as UTC `YYYY-MM-DD` strings */
425
+ holidays?: string[];
426
+ }
427
+
428
+ export { }