@jaeungkim/gantt-chart 1.2.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 (67) 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 -11
  5. package/dist/index.d.ts +428 -11
  6. package/dist/index.js +2482 -2688
  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 -16
  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/index.d.ts +0 -3
  18. package/dist/core/reorder.d.ts +0 -55
  19. package/dist/core/tree.d.ts +0 -34
  20. package/dist/core/types.d.ts +0 -43
  21. package/dist/dependencies/components/GanttDependencyArrows.d.ts +0 -13
  22. package/dist/dependencies/hooks/useGanttLinkDrag.d.ts +0 -20
  23. package/dist/dependencies/utils/arrowPath.d.ts +0 -20
  24. package/dist/dependencies/utils/link.d.ts +0 -17
  25. package/dist/detail/components/GanttDetailPanel.d.ts +0 -21
  26. package/dist/detail/hooks/useGanttDetail.d.ts +0 -42
  27. package/dist/detail/utils/edit.d.ts +0 -21
  28. package/dist/interaction/hooks/useGanttInteraction.d.ts +0 -2
  29. package/dist/interaction/hooks/useGanttKeyboardNav.d.ts +0 -33
  30. package/dist/interaction/hooks/useGanttSelection.d.ts +0 -12
  31. package/dist/interaction/utils/a11y.d.ts +0 -84
  32. package/dist/props.d.ts +0 -121
  33. package/dist/rows/components/GanttRowsLayer.d.ts +0 -13
  34. package/dist/rows/hooks/useGanttCollapse.d.ts +0 -18
  35. package/dist/rows/hooks/useGanttRowModel.d.ts +0 -19
  36. package/dist/rows/utils/rows.d.ts +0 -21
  37. package/dist/shared/constants.d.ts +0 -24
  38. package/dist/shared/context.d.ts +0 -4
  39. package/dist/shared/hooks/useLatestRef.d.ts +0 -2
  40. package/dist/shared/hooks/useResolvedTheme.d.ts +0 -8
  41. package/dist/shared/store.d.ts +0 -81
  42. package/dist/shared/task.d.ts +0 -55
  43. package/dist/shared/types.d.ts +0 -115
  44. package/dist/shared/utils/holidays.d.ts +0 -12
  45. package/dist/shared/utils/i18n.d.ts +0 -5
  46. package/dist/shared/utils/pointerGesture.d.ts +0 -11
  47. package/dist/shared/virtual/axis.d.ts +0 -13
  48. package/dist/shared/virtual/useVirtualWindow.d.ts +0 -16
  49. package/dist/shared/virtual/window.d.ts +0 -30
  50. package/dist/task-list/components/GanttGridSplitter.d.ts +0 -6
  51. package/dist/task-list/components/GanttTaskAddRow.d.ts +0 -7
  52. package/dist/task-list/components/GanttTaskGrid.d.ts +0 -24
  53. package/dist/task-list/hooks/useGanttRowDrag.d.ts +0 -17
  54. package/dist/task-list/hooks/useGanttTaskListPane.d.ts +0 -11
  55. package/dist/task-list/hooks/useGanttTaskMove.d.ts +0 -16
  56. package/dist/timeline/components/GanttChartHeader.d.ts +0 -10
  57. package/dist/timeline/components/GanttHolidayLabels.d.ts +0 -6
  58. package/dist/timeline/components/GanttNonWorkingLayer.d.ts +0 -6
  59. package/dist/timeline/components/GanttTodayLine.d.ts +0 -6
  60. package/dist/timeline/hooks/useGanttScrollApi.d.ts +0 -62
  61. package/dist/timeline/hooks/useGanttViewport.d.ts +0 -47
  62. package/dist/timeline/hooks/useGanttVirtualization.d.ts +0 -28
  63. package/dist/timeline/utils/geometry.d.ts +0 -52
  64. package/dist/timeline/utils/header.d.ts +0 -8
  65. package/dist/timeline/utils/transform.d.ts +0 -4
  66. package/dist/timeline/utils/viewport.d.ts +0 -31
  67. package/dist/useGanttSelectors.d.ts +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaeungkim/gantt-chart",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -21,11 +21,9 @@
21
21
  "./package.json": "./package.json"
22
22
  },
23
23
  "files": [
24
- "dist",
25
- "README.md",
26
- "LICENSE"
24
+ "dist"
27
25
  ],
28
- "description": "A controlled React Gantt chart. Every drag returns the complete next tasks array. Virtualized rows, dependency arrows, working calendar, keyboard editing.",
26
+ "description": "A Gantt chart for React that behaves like a controlled input. Every drag returns the complete next tasks array. An ARIA treegrid with keyboard editing, rows and time cells both virtualized, a headless core with no React or DOM, dependency arrows and a working calendar.",
29
27
  "keywords": [
30
28
  "gantt",
31
29
  "gantt-chart",
@@ -33,7 +31,11 @@
33
31
  "project-management",
34
32
  "react",
35
33
  "timeline",
36
- "virtualized"
34
+ "virtualized",
35
+ "accessibility",
36
+ "a11y",
37
+ "treegrid",
38
+ "headless"
37
39
  ],
38
40
  "author": "jaeungkim",
39
41
  "license": "MIT",
@@ -59,16 +61,15 @@
59
61
  "react-dom": "^18.0.0 || ^19.0.0"
60
62
  },
61
63
  "dependencies": {
62
- "dayjs": "^1.11.23",
63
- "zustand": "^5.0.15"
64
+ "dayjs": "^1.11.23"
64
65
  },
65
66
  "devDependencies": {
66
67
  "@eslint/js": "^9.39.5",
68
+ "@microsoft/api-extractor": "^7.55.2",
67
69
  "@types/node": "^22.20.1",
68
70
  "@types/react": "^19.2.18",
69
71
  "@vitejs/plugin-react": "^4.7.0",
70
72
  "eslint": "^9.39.5",
71
- "eslint-plugin-react": "^7.37.5",
72
73
  "eslint-plugin-react-hooks": "^7.1.1",
73
74
  "eslint-plugin-react-refresh": "^0.5.5",
74
75
  "globals": "^15.15.0",
@@ -79,7 +80,8 @@
79
80
  "vite": "^6.4.3",
80
81
  "vite-plugin-dts": "^5.1.0",
81
82
  "vite-tsconfig-paths": "^6.1.1",
82
- "vitest": "^4.1.11"
83
+ "vitest": "^4.1.11",
84
+ "zustand": "^5.0.15"
83
85
  },
84
86
  "packageManager": "pnpm@10.30.3",
85
87
  "pnpm": {
package/dist/Gantt.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { GanttHandle } from './timeline/hooks/useGanttScrollApi';
2
- import { GanttProps } from './props';
3
- /** Gantt chart component. Creates a store per instance, so two charts on one page cannot share state. */
4
- declare const Gantt: import('react').ForwardRefExoticComponent<GanttProps & import('react').RefAttributes<GanttHandle>>;
5
- export default Gantt;
@@ -1,20 +0,0 @@
1
- import { GanttDependencyChange } from '../../dependencies/hooks/useGanttLinkDrag';
2
- import { GanttBarOptions } from '../../shared/types';
3
- import { GanttInteractionConfig, TaskTransformed } from '../../shared/task';
4
- import { WorkingCalendar } from '../../core';
5
- interface GanttBarProps {
6
- currentTask: TaskTransformed;
7
- options: GanttBarOptions;
8
- interaction?: GanttInteractionConfig;
9
- /** Roving tabindex of the treegrid - exactly one cell carries 0, so Tab enters the grid once */
10
- tabIndex: number;
11
- /** `row:column` coordinate the chart's focus manager looks the cell up by */
12
- cellCoord?: string;
13
- /** Working-day calendar - drag results snap forward off non-working days */
14
- calendar?: WorkingCalendar;
15
- /** Scroll the timeline when the drag reaches a viewport edge; Gantt.tsx owns the default */
16
- autoScrollOnDrag: boolean;
17
- onDependencyCreate?: (change: GanttDependencyChange) => boolean | void;
18
- }
19
- export default function GanttBar({ currentTask, options, interaction, tabIndex, cellCoord, calendar, autoScrollOnDrag, onDependencyCreate, }: GanttBarProps): import("react").JSX.Element;
20
- export {};
@@ -1,24 +0,0 @@
1
- import { VirtualItem } from '../../shared/virtual/window';
2
- import { GanttDependencyChange } from '../../dependencies/hooks/useGanttLinkDrag';
3
- import { GanttBarOptions } from '../../shared/types';
4
- import { WorkingCalendar } from '../../core';
5
- import { GanttInteractionConfig } from '../../shared/task';
6
- import { GanttFocus } from '../../interaction/utils/a11y';
7
- import { GanttRow } from '../../rows/utils/rows';
8
- interface GanttBarsLayerProps {
9
- rows: GanttRow[];
10
- virtualItems: VirtualItem[];
11
- /** Cells before the bars on a row - the bar's column is this plus its lane */
12
- gridColumnCount: number;
13
- focus: GanttFocus;
14
- /** Horizontal culling, shared with the header so the two cannot disagree */
15
- isBarVisible: (barLeft: number, barWidth: number) => boolean;
16
- options: GanttBarOptions;
17
- interaction: GanttInteractionConfig;
18
- /** Working-day calendar - drag results snap forward off non-working days */
19
- calendar?: WorkingCalendar;
20
- autoScrollOnDrag: boolean;
21
- onDependencyCreate?: (change: GanttDependencyChange) => boolean | void;
22
- }
23
- export default function GanttBarsLayer({ rows, virtualItems, gridColumnCount, focus, isBarVisible, options, interaction, calendar, autoScrollOnDrag, onDependencyCreate, }: GanttBarsLayerProps): (import("react").JSX.Element | null)[];
24
- export {};
@@ -1 +0,0 @@
1
- export default function GanttDragGuides(): import("react").JSX.Element | null;
@@ -1,16 +0,0 @@
1
- import { GanttDragMode } from '../../shared/types';
2
- import { GanttInteractionConfig, Task, TaskTransformed } from '../../shared/task';
3
- import { WorkingCalendar } from '../../core';
4
- export type DragMode = GanttDragMode;
5
- interface GanttBarDragOptions {
6
- onTasksChange?: (updatedTasks: Task[]) => void;
7
- /** Scroll the timeline when the drag reaches a viewport edge (default true) */
8
- autoScroll?: boolean;
9
- }
10
- /** Gantt bar drag behavior; `autoScroll` (default true) scrolls the timeline at a viewport edge. */
11
- export declare function useGanttBarDrag(task: TaskTransformed, options?: GanttBarDragOptions, interaction?: GanttInteractionConfig, calendar?: WorkingCalendar): {
12
- onPointerDown: import('react').PointerEventHandler<HTMLDivElement>;
13
- dragMode: GanttDragMode | null;
14
- consumeDragClick: () => boolean;
15
- };
16
- export {};
@@ -1,25 +0,0 @@
1
- import { Dayjs } from 'dayjs';
2
- import { GanttBottomRowCell, GanttScaleKey } from '../../shared/types';
3
- /** The task the user drew, handed to `onTaskCreate` - nothing is committed by the chart */
4
- export interface GanttTaskDraft {
5
- /** UTC ISO string, snapped to the current scale */
6
- startDate: string;
7
- endDate: string;
8
- }
9
- export declare function defaultTaskDraft(now: Dayjs, timelineTicks: GanttBottomRowCell[], scaleKey: GanttScaleKey): GanttTaskDraft | null;
10
- interface DrawGhost {
11
- leftPx: number;
12
- widthPx: number;
13
- topPx: number;
14
- }
15
- interface UseGanttDrawCreateParams {
16
- enabled: boolean;
17
- rowCount: number;
18
- onTaskCreate?: (draft: GanttTaskDraft) => void;
19
- }
20
- export declare function drawSlotTopPx(offsetY: number, rowCount: number): number | null;
21
- export declare function useGanttDrawCreate({ enabled, rowCount, onTaskCreate, }: UseGanttDrawCreateParams): {
22
- onDrawPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
23
- ghost: DrawGhost | null;
24
- };
25
- export {};
@@ -1,11 +0,0 @@
1
- import { default as React } from 'react';
2
- import { Task, TaskTransformed } from '../../shared/task';
3
- interface GanttProgressDragOptions {
4
- onTasksChange?: (updatedTasks: Task[]) => void;
5
- }
6
- export declare function useGanttProgressDrag(task: TaskTransformed, barRef: React.RefObject<HTMLDivElement | null>, options?: GanttProgressDragOptions): {
7
- onProgressPointerDown: React.PointerEventHandler<HTMLDivElement>;
8
- progress: number | null;
9
- isDraggingProgress: boolean;
10
- };
11
- export {};
@@ -1,27 +0,0 @@
1
- import { Dayjs } from 'dayjs';
2
- /** The calendar every piece of date arithmetic in the core routes through. */
3
- export interface WorkingCalendar {
4
- /** False for the default calendar (every day counts) */
5
- readonly skipsNonWorkingDays: boolean;
6
- isWorkingDay(date: Dayjs): boolean;
7
- /** Moves `days` days forward (or backward), skipping non-working days */
8
- addDays(date: Dayjs, days: number): Dayjs;
9
- /** Days from `from` to `to`, counted the same way `addDays` moves. Signed. */
10
- daysBetween(from: Dayjs, to: Dayjs): number;
11
- /** Smallest d where `addDays(from, d) >= target` - how far a task must move to clear a date */
12
- daysUntil(from: Dayjs, target: Dayjs): number;
13
- /** Largest d where `addDays(from, d) <= target` - how far a task may slip before it breaks one */
14
- daysUpTo(from: Dayjs, target: Dayjs): number;
15
- /** The date itself when it is a working day, otherwise the next one (time of day kept) */
16
- snapForward(date: Dayjs): Dayjs;
17
- }
18
- export interface WorkingCalendarOptions {
19
- /** Working weekdays as UTC day numbers, 0 = Sunday (default Mon-Fri) */
20
- workingWeekdays?: number[];
21
- /** Non-working dates as UTC `YYYY-MM-DD` strings */
22
- holidays?: string[];
23
- }
24
- /** The default calendar: every day counts, so arithmetic through it is plain calendar arithmetic. */
25
- export declare const CALENDAR_DAYS: WorkingCalendar;
26
- /** A calendar that skips weekends and holidays, configured like the chart's non-working-day shading. */
27
- export declare function createWorkingCalendar(options?: WorkingCalendarOptions): WorkingCalendar;
@@ -1,16 +0,0 @@
1
- import { default as dayjs, Dayjs } from 'dayjs';
2
- /**
3
- * The chart's own dayjs - always parses and displays in UTC, so the same data lands in the
4
- * same cells for every viewer and DST never changes a cell's width (#84, #28).
5
- */
6
- declare const ganttDayjs: typeof dayjs.utc;
7
- export default ganttDayjs;
8
- /** Calendar quarter of the date, 1-4 - inlined so dayjs' quarterOfYear plugin stays out of the bundle */
9
- export declare function quarterOfYear(date: Dayjs): number;
10
- /** First moment of the calendar quarter the date falls in */
11
- export declare function startOfQuarter(date: Dayjs): Dayjs;
12
- /**
13
- * First moment of the week the date falls in; `firstDayOfWeek` is 0 = Sunday .. 6 = Saturday.
14
- * Computed here because dayjs' `startOf('week')` is fixed to the loaded locale.
15
- */
16
- export declare function startOfWeek(date: Dayjs, firstDayOfWeek?: number): Dayjs;
@@ -1,3 +0,0 @@
1
- export { CALENDAR_DAYS, createWorkingCalendar, type WorkingCalendar, type WorkingCalendarOptions, } from './calendar';
2
- export { buildTaskTree, collectSubtreeIds, getVisibleTasks, rollUpTasks, type TaskTree, } from './tree';
3
- export { moveTask, sortTasksBySequence, validateMove, type GanttMoveOptions, } from './reorder';
@@ -1,55 +0,0 @@
1
- import { Task } from './types';
2
- /** Where a task is going: a parent, and a slot among that parent's children */
3
- export interface GanttTaskMove {
4
- taskId: string;
5
- /** New parent, null for the root level */
6
- toParentId: string | null;
7
- /** Slot among the new parent's children, counted in the list as it stands after the move */
8
- toIndex: number;
9
- }
10
- /** The move that was applied - `toIndex` for an index-based API, `afterId`/`beforeId` for a position-based one */
11
- export interface GanttTaskMoveChange extends GanttTaskMove {
12
- fromParentId: string | null;
13
- fromIndex: number;
14
- /** Sibling the task now follows - null when it is the first child */
15
- afterId: string | null;
16
- /** Sibling the task now precedes - null when it is the last child */
17
- beforeId: string | null;
18
- }
19
- /** Where a drop lands relative to the row under the pointer */
20
- export type GanttDropMode = "before" | "after" | "child";
21
- /** Why a move was refused - null from `validateMove` means it is allowed */
22
- export type GanttMoveRejection = "unknown-task" | "unknown-parent" | "read-only" | "cycle" | "reparent-disabled" | "no-op";
23
- export interface GanttMoveOptions {
24
- /** Whether the parentId hierarchy is on - off, depth comes from `sequence` and a reparent is refused */
25
- hierarchy: boolean;
26
- /** Whether this task may be moved at all - left out, every task may */
27
- canReorder?: (task: Task) => boolean;
28
- }
29
- /** The sibling lists a move is measured against - `toIndex` is counted against exactly these */
30
- interface TaskOrder {
31
- /** Normalized parent of each task - null for a root, an orphan or a cycle */
32
- parentOf: ReadonlyMap<string, string | null>;
33
- /** One parent's children in row order; pass null for the root list */
34
- childrenOf: (parentId: string | null) => readonly string[];
35
- }
36
- /** Sort tasks by their sequence hierarchy - row order comes from this and nothing else */
37
- export declare function sortTasksBySequence<T extends Pick<Task, "sequence">>(tasks: T[]): T[];
38
- /** Reads the ordered forest the moves below are counted against */
39
- export declare function buildTaskOrder(tasks: Task[], hierarchy: boolean): TaskOrder;
40
- /**
41
- * The move a drop on `targetId` would make: `before`/`after` make it a sibling, `child`
42
- * appends it. Says nothing about whether the move is allowed - that is `validateMove`.
43
- */
44
- export declare function moveForDrop(order: TaskOrder, taskId: string, targetId: string, mode: GanttDropMode): GanttTaskMove;
45
- /** Whether a move can be applied, and why not when it cannot - runs on every frame of a row drag */
46
- export declare function validateMove(tasks: Task[], move: GanttTaskMove, options: GanttMoveOptions): GanttMoveRejection | null;
47
- /**
48
- * Applies a move, renumbering every sequence from the resulting row order; `parentId` is rewritten
49
- * on the moved task only. Null when refused (`validateMove` says why); unchanged tasks keep identity.
50
- */
51
- export declare function moveTask(tasks: Task[], move: GanttTaskMove, options: GanttMoveOptions): {
52
- tasks: Task[];
53
- change: GanttTaskMoveChange;
54
- } | null;
55
- export {};
@@ -1,34 +0,0 @@
1
- import { Task } from './types';
2
- /** The minimum a task needs for the tree math - TaskTransformed fits as-is */
3
- type TaskNode = Pick<Task, "id" | "parentId">;
4
- /**
5
- * A normalized tree built from parentId. Orphans, self-references and cycles lose their
6
- * parent link and become roots, so what comes out is always acyclic.
7
- */
8
- export interface TaskTree {
9
- /** parent id -> child ids (in input order) */
10
- childIds: Map<string, string[]>;
11
- /** task id -> normalized parent id (null for a root, an orphan or a cycle) */
12
- parentOf: Map<string, string | null>;
13
- /** task id -> depth from the root */
14
- depthOf: Map<string, number>;
15
- /** Root ids, in input order - the sibling list childIds has no key for */
16
- rootIds: string[];
17
- }
18
- export declare function buildTaskTree(tasks: TaskNode[]): TaskTree;
19
- /**
20
- * The subtree's ids including the root itself (breadth first)
21
- * An id that is not in the tree yields an empty array
22
- */
23
- export declare function collectSubtreeIds(tasks: TaskNode[], rootId: string, tree?: TaskTree): string[];
24
- /**
25
- * The tasks left after dropping any task with a collapsed ancestor
26
- * Input order is preserved (row order is decided by the sequence sort)
27
- */
28
- export declare function getVisibleTasks<T extends TaskNode>(tasks: T[], collapsedIds: Iterable<string>, tree?: TaskTree): T[];
29
- /**
30
- * The tasks with every parent recomputed as a summary row: start/end always from the children
31
- * (deepest first, so a move travels all the way up); an explicit progress is left alone.
32
- */
33
- export declare function rollUpTasks(tasks: Task[], tree?: TaskTree): Task[];
34
- export {};
@@ -1,43 +0,0 @@
1
- export type DependencyType = 'FS' | 'SS' | 'FF' | 'SF';
2
- export interface TaskDependency {
3
- /** The predecessor's id - a task's `dependencies` list the tasks it waits on */
4
- targetId: string;
5
- type: DependencyType;
6
- }
7
- export interface Task {
8
- id: string;
9
- name: string;
10
- startDate: string;
11
- endDate: string;
12
- parentId: string | null;
13
- sequence: string;
14
- /** Progress 0-100 (%) - omitted means no progress display */
15
- progress?: number;
16
- /** Bar color (any CSS color) - progress fill and hover shade derive from it; omitted, the `--gantt-*` tokens decide */
17
- color?: string;
18
- /** Extra class name put on this task's bar and its task-list row */
19
- className?: string;
20
- /** Lane this task shares a row with - lane-mates draw side by side, overlaps stack onto extra rows */
21
- lane?: string;
22
- dependencies?: TaskDependency[];
23
- /** Blocks every gesture on this task - overrides the chart's `readOnly` prop */
24
- readOnly?: boolean;
25
- /** Allows/blocks moving this task - overrides both `readOnly` settings */
26
- allowMove?: boolean;
27
- /** Allows/blocks resizing this task - overrides both `readOnly` settings */
28
- allowResize?: boolean;
29
- /** Allows/blocks dragging this task's progress handle - overrides both `readOnly` settings */
30
- allowProgressChange?: boolean;
31
- /** Allows/blocks starting a dependency drag from this task - overrides both `readOnly` settings */
32
- allowLinkCreate?: boolean;
33
- /** Allows/blocks deleting a dependency this task owns - overrides both `readOnly` settings */
34
- allowLinkDelete?: boolean;
35
- /** Allows/blocks dragging this row to a new position or parent - opt-in, off unless this or the chart's `allowReorder` turns it on */
36
- allowReorder?: boolean;
37
- /** Earliest date this task may be dragged to (ISO string) - overrides the chart's `minDate` */
38
- minDate?: string;
39
- /** Latest date this task may be dragged to (ISO string) - overrides the chart's `maxDate` */
40
- maxDate?: string;
41
- }
42
- /** Normalizes progress into the 0-100 range; null when the value is missing or invalid */
43
- export declare function normalizeProgress(progress: number | undefined): number | null;
@@ -1,13 +0,0 @@
1
- import { GanttDependencyChange } from '../hooks/useGanttLinkDrag';
2
- import { GanttVirtualization } from '../../timeline/hooks/useGanttVirtualization';
3
- import { GanttInteractionConfig, Task, TaskTransformed } from '../../shared/task';
4
- interface Props {
5
- transformedTasks: TaskTransformed[];
6
- rowCount: number;
7
- virtual: GanttVirtualization;
8
- interaction?: GanttInteractionConfig;
9
- onTasksChange?: (updatedTasks: Task[]) => void;
10
- onDependencyDelete?: (change: GanttDependencyChange) => boolean | void;
11
- }
12
- export default function GanttDependencyArrows({ transformedTasks, rowCount, virtual, interaction, onTasksChange, onDependencyDelete, }: Props): import("react").JSX.Element;
13
- export {};
@@ -1,20 +0,0 @@
1
- import { DependencyType, GanttInteractionConfig, Task, TaskTransformed } from '../../shared/task';
2
- import { LinkAnchor } from '../utils/link';
3
- /** The link the user drew, handed to `onDependencyCreate` before anything is committed */
4
- export interface GanttDependencyChange {
5
- /** Task the drag started on */
6
- predecessorId: string;
7
- /** Task the drag was dropped on - the one whose `dependencies` gains the entry */
8
- successorId: string;
9
- type: DependencyType;
10
- }
11
- interface UseGanttLinkDragParams {
12
- task: TaskTransformed;
13
- interaction?: GanttInteractionConfig;
14
- onTasksChange?: (updatedTasks: Task[]) => void;
15
- onDependencyCreate?: (change: GanttDependencyChange) => boolean | void;
16
- }
17
- export declare function useGanttLinkDrag({ task, interaction, onTasksChange, onDependencyCreate, }: UseGanttLinkDragParams): {
18
- startLink: (anchor: LinkAnchor) => (e: React.PointerEvent<HTMLElement>) => void;
19
- };
20
- export {};
@@ -1,20 +0,0 @@
1
- import { RenderedDependency, TaskTransformed } from '../../shared/task';
2
- import { LinkAnchor } from './link';
3
- interface DragOffset {
4
- offsetX: number;
5
- offsetWidth: number;
6
- }
7
- export declare function getSmartGanttPath(dependencyType: string, startX: number, startY: number, endX: number, endY: number): string;
8
- export declare function anchorPoint(task: TaskTransformed, anchor: LinkAnchor, offset?: DragOffset): {
9
- x: number;
10
- y: number;
11
- };
12
- export declare function buildTaskIndex(transformedTasks: TaskTransformed[]): Map<string, TaskTransformed>;
13
- export interface ArrowViewport {
14
- topPx: number;
15
- bottomPx: number;
16
- isBarVisible: (left: number, width: number) => boolean;
17
- }
18
- export declare function isArrowVisible(dep: Pick<RenderedDependency, "fromX" | "fromY" | "toX" | "toY">, viewport: ArrowViewport): boolean;
19
- export declare function buildDependencies(taskById: Map<string, TaskTransformed>, liveOffsets: Record<string, DragOffset>): RenderedDependency[];
20
- export {};
@@ -1,17 +0,0 @@
1
- import { DependencyType, Task, TaskDependency, TaskTransformed } from '../../shared/task';
2
- export type LinkAnchor = "start" | "end";
3
- export type LinkRejection = "self" | "duplicate" | "cycle";
4
- type DependencyNode = Pick<Task, "id"> & {
5
- dependencies?: TaskDependency[];
6
- };
7
- export declare function linkTypeFromAnchors(from: LinkAnchor, to: LinkAnchor): DependencyType;
8
- interface LinkTarget {
9
- task: TaskTransformed;
10
- anchor: LinkAnchor;
11
- }
12
- export declare function resolveLinkTarget(rowTasks: TaskTransformed[], contentX: number, contentY: number, rowHeight: number, zone: number): LinkTarget | null;
13
- export declare function validateDependency(tasks: DependencyNode[], predecessorId: string, successorId: string): LinkRejection | null;
14
- export declare const LINK_REJECTION_LABEL: Record<LinkRejection, string>;
15
- export declare function addDependency(tasks: Task[], predecessorId: string, successorId: string, type: DependencyType): Task[];
16
- export declare function removeDependency(tasks: Task[], predecessorId: string, successorId: string): Task[];
17
- export {};
@@ -1,21 +0,0 @@
1
- import { GanttDetailRenderer, GanttLocaleOptions, GanttScaleKey } from '../../shared/types';
2
- import { GanttInteractionConfig, Task, TaskTransformed } from '../../shared/task';
3
- interface GanttDetailPanelProps {
4
- task: TaskTransformed;
5
- /** Every task, so a dependency's target id can be printed by name */
6
- tasks: TaskTransformed[];
7
- scale: GanttScaleKey;
8
- localeOptions?: GanttLocaleOptions;
9
- /** Gates which built-in fields take input - the same flags the drag gestures obey */
10
- interaction?: GanttInteractionConfig;
11
- onClose: () => void;
12
- onTasksChange?: (updatedTasks: Task[]) => void;
13
- /** Replaces the body; the panel element itself, and its width, stay the chart's */
14
- render?: GanttDetailRenderer;
15
- /** False while the panel slides shut - the slide lives in flex-basis, see .gantt-detail */
16
- open: boolean;
17
- onTransitionEnd: React.TransitionEventHandler<HTMLElement>;
18
- }
19
- /** The docked panel on the right */
20
- export default function GanttDetailPanel({ task, tasks, scale, localeOptions, interaction, onClose, onTasksChange, render, open, onTransitionEnd, }: GanttDetailPanelProps): import("react").JSX.Element;
21
- export {};
@@ -1,42 +0,0 @@
1
- import { TaskTransformed } from '../../shared/task';
2
- type TaskMouseHandler = (task: TaskTransformed, event: React.MouseEvent) => void;
3
- interface ResolvedDetailState<T extends {
4
- id: string;
5
- }> {
6
- openId: string | null;
7
- task: T | null;
8
- stale: boolean;
9
- }
10
- export declare function resolveDetailState<T extends {
11
- id: string;
12
- }>({ enabled, detailTaskId, uncontrolled, tasks, }: {
13
- enabled: boolean;
14
- detailTaskId?: string | null;
15
- uncontrolled: string | null;
16
- tasks: T[];
17
- }): ResolvedDetailState<T>;
18
- interface UseGanttDetailParams {
19
- enabled: boolean;
20
- tasks: TaskTransformed[];
21
- detailTaskId?: string | null;
22
- onDetailChange?: (task: TaskTransformed | null) => void;
23
- onTaskClick?: TaskMouseHandler;
24
- }
25
- interface GanttDetail {
26
- task: TaskTransformed | null;
27
- open: (taskId: string) => void;
28
- close: () => void;
29
- onTaskClick: TaskMouseHandler;
30
- }
31
- /** Controlled by `detailTaskId`, uncontrolled without it; `onDetailChange` fires in both modes */
32
- export declare function useGanttDetail({ enabled, tasks, detailTaskId, onDetailChange, onTaskClick, }: UseGanttDetailParams): GanttDetail;
33
- interface GanttDetailSlide {
34
- /** The task to keep rendered - the open one, or the last one while the panel slides shut */
35
- task: TaskTransformed | null;
36
- /** Drives .gantt-detail-open - false on the mount frame so opening transitions up from zero */
37
- open: boolean;
38
- onTransitionEnd: React.TransitionEventHandler<HTMLElement>;
39
- }
40
- /** Holds the panel mounted through the slide-closed transition, then releases it */
41
- export declare function useGanttDetailSlide(task: TaskTransformed | null): GanttDetailSlide;
42
- export {};
@@ -1,21 +0,0 @@
1
- import { GanttInteractionConfig, Task } from '../../shared/task';
2
- export type DetailEditableField = "name" | "startDate" | "endDate" | "progress";
3
- interface DetailEditability {
4
- name: boolean;
5
- /** One flag for both dates - changing either one is a resize */
6
- dates: boolean;
7
- progress: boolean;
8
- }
9
- export declare function resolveDetailEditability(task: Task & {
10
- isSummary?: boolean;
11
- }, config?: GanttInteractionConfig): DetailEditability;
12
- /** Turns one field's raw input into a patch; null means the value cannot commit and the field reverts */
13
- export declare function resolveFieldPatch(task: Task, field: DetailEditableField, value: string, config?: GanttInteractionConfig): Partial<Omit<Task, "id">> | null;
14
- export declare function applyTaskPatch(rawTasks: Task[], taskId: string, patch: Partial<Omit<Task, "id">>): Task[];
15
- export declare function commitDetailPatch(storeApi: {
16
- getState: () => {
17
- rawTasks: Task[];
18
- setRawTasks: (tasks: Task[]) => void;
19
- };
20
- }, taskId: string, patch: Partial<Omit<Task, "id">>, onTasksChange?: (tasks: Task[]) => void): void;
21
- export {};
@@ -1,2 +0,0 @@
1
- import { GanttInteractionConfig } from '../../shared/task';
2
- export declare function useGanttInteraction({ readOnly, allowMove, allowResize, allowProgressChange, allowLinkCreate, allowLinkDelete, allowTaskCreate, allowReorder, minDate, maxDate, }: GanttInteractionConfig): GanttInteractionConfig;
@@ -1,33 +0,0 @@
1
- import { ScrollAlign } from '../../shared/virtual/useVirtualWindow';
2
- import { RefObject } from 'react';
3
- import { GanttScrollApi } from '../../timeline/hooks/useGanttScrollApi';
4
- import { GanttTaskMoveApi } from '../../task-list/hooks/useGanttTaskMove';
5
- import { GanttLocaleOptions, GanttScaleKey } from '../../shared/types';
6
- import { GanttInteractionConfig, Task } from '../../shared/task';
7
- import { GanttFocus } from '../utils/a11y';
8
- import { GanttRow } from '../../rows/utils/rows';
9
- interface UseGanttKeyboardNavParams {
10
- rows: GanttRow[];
11
- rawTasks: Task[];
12
- gridColumnCount: number;
13
- hierarchy: boolean;
14
- collapsedIds: ReadonlySet<string>;
15
- selectedScale: GanttScaleKey;
16
- localeOptions: GanttLocaleOptions | undefined;
17
- interaction: GanttInteractionConfig;
18
- onActivate?: (taskId: string) => void;
19
- onToggleCollapse: (rowId: string) => void;
20
- onTasksChange?: (updatedTasks: Task[]) => void;
21
- move: GanttTaskMoveApi;
22
- scrollToRow: (index: number, align?: ScrollAlign) => void;
23
- scrollApi: GanttScrollApi;
24
- bodyRef: RefObject<HTMLDivElement | null>;
25
- }
26
- interface GanttKeyboardNav {
27
- focus: GanttFocus;
28
- announcement: string;
29
- onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
30
- onFocusCapture: (event: React.FocusEvent<HTMLDivElement>) => void;
31
- }
32
- export declare function useGanttKeyboardNav({ rows, rawTasks, gridColumnCount, hierarchy, collapsedIds, selectedScale, localeOptions, interaction, onActivate, onToggleCollapse, onTasksChange, move, scrollToRow, scrollApi, bodyRef, }: UseGanttKeyboardNavParams): GanttKeyboardNav;
33
- export {};
@@ -1,12 +0,0 @@
1
- import { TaskTransformed } from '../../shared/task';
2
- interface UseGanttSelectionParams {
3
- selectable?: boolean;
4
- onTaskSelect?: (task: TaskTransformed | null) => void;
5
- onTaskClick?: (task: TaskTransformed, event: React.MouseEvent) => void;
6
- }
7
- interface GanttSelection {
8
- select: (task: TaskTransformed | null) => void;
9
- onTaskClick: (task: TaskTransformed, event: React.MouseEvent) => void;
10
- }
11
- export declare function useGanttSelection({ selectable, onTaskSelect, onTaskClick, }: UseGanttSelectionParams): GanttSelection;
12
- export {};