@jaeungkim/gantt-chart 0.4.0 → 1.0.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 +192 -53
- package/dist/Gantt.d.ts +5 -0
- package/dist/bars/components/GanttBar.d.ts +20 -0
- package/dist/bars/components/GanttBarsLayer.d.ts +24 -0
- package/dist/bars/components/GanttDragGuides.d.ts +1 -0
- package/dist/bars/hooks/useGanttBarDrag.d.ts +16 -0
- package/dist/bars/hooks/useGanttDrawCreate.d.ts +25 -0
- package/dist/{hooks → bars/hooks}/useGanttProgressDrag.d.ts +3 -8
- package/dist/core/calendar.d.ts +4 -22
- package/dist/core/dates.d.ts +5 -21
- package/dist/core/index.d.ts +1 -14
- package/dist/core/reorder.d.ts +55 -0
- package/dist/core/tree.d.ts +4 -12
- package/dist/core/types.d.ts +4 -37
- package/dist/{components → dependencies/components}/GanttDependencyArrows.d.ts +4 -6
- package/dist/{hooks → dependencies/hooks}/useGanttLinkDrag.d.ts +2 -13
- package/dist/dependencies/utils/arrowPath.d.ts +20 -0
- package/dist/dependencies/utils/link.d.ts +17 -0
- package/dist/detail/components/GanttDetailPanel.d.ts +21 -0
- package/dist/detail/hooks/useGanttDetail.d.ts +42 -0
- package/dist/detail/utils/edit.d.ts +21 -0
- package/dist/gantt-chart.css +1 -1
- package/dist/index.cjs +1 -4
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +4071 -5141
- package/dist/interaction/hooks/useGanttInteraction.d.ts +2 -0
- package/dist/interaction/hooks/useGanttKeyboardNav.d.ts +33 -0
- package/dist/interaction/hooks/useGanttSelection.d.ts +12 -0
- package/dist/interaction/utils/a11y.d.ts +84 -0
- package/dist/props.d.ts +121 -0
- package/dist/rows/components/GanttRowsLayer.d.ts +13 -0
- package/dist/rows/hooks/useGanttCollapse.d.ts +18 -0
- package/dist/rows/hooks/useGanttRowModel.d.ts +19 -0
- package/dist/rows/utils/rows.d.ts +21 -0
- package/dist/shared/constants.d.ts +24 -0
- package/dist/{stores → shared}/context.d.ts +1 -7
- package/dist/shared/hooks/useLatestRef.d.ts +2 -0
- package/dist/shared/hooks/useResolvedTheme.d.ts +8 -0
- package/dist/shared/store.d.ts +81 -0
- package/dist/shared/task.d.ts +55 -0
- package/dist/shared/types.d.ts +115 -0
- package/dist/shared/utils/holidays.d.ts +12 -0
- package/dist/shared/utils/i18n.d.ts +5 -0
- package/dist/shared/utils/pointerGesture.d.ts +11 -0
- package/dist/shared/virtual/axis.d.ts +13 -0
- package/dist/shared/virtual/useVirtualWindow.d.ts +16 -0
- package/dist/shared/virtual/window.d.ts +30 -0
- package/dist/task-list/components/GanttGridSplitter.d.ts +6 -0
- package/dist/task-list/components/GanttTaskAddRow.d.ts +7 -0
- package/dist/task-list/components/GanttTaskGrid.d.ts +24 -0
- package/dist/task-list/hooks/useGanttRowDrag.d.ts +17 -0
- package/dist/task-list/hooks/useGanttTaskListPane.d.ts +11 -0
- package/dist/task-list/hooks/useGanttTaskMove.d.ts +16 -0
- package/dist/timeline/components/GanttChartHeader.d.ts +10 -0
- package/dist/timeline/components/GanttHolidayLabels.d.ts +6 -0
- package/dist/timeline/components/GanttNonWorkingLayer.d.ts +6 -0
- package/dist/timeline/components/GanttTodayLine.d.ts +6 -0
- package/dist/{hooks → timeline/hooks}/useGanttScrollApi.d.ts +22 -23
- package/dist/timeline/hooks/useGanttViewport.d.ts +47 -0
- package/dist/timeline/hooks/useGanttVirtualization.d.ts +28 -0
- package/dist/timeline/utils/geometry.d.ts +52 -0
- package/dist/timeline/utils/header.d.ts +8 -0
- package/dist/timeline/utils/transform.d.ts +4 -0
- package/dist/timeline/utils/viewport.d.ts +31 -0
- package/dist/useGanttSelectors.d.ts +11 -0
- package/package.json +12 -12
- package/dist/components/GanttBar.d.ts +0 -23
- package/dist/components/GanttChartHeader.d.ts +0 -17
- package/dist/components/GanttDragGuides.d.ts +0 -9
- package/dist/components/GanttGridSplitter.d.ts +0 -14
- package/dist/components/GanttMarkers.d.ts +0 -18
- package/dist/components/GanttTaskGrid.d.ts +0 -42
- package/dist/components/ScaleSelector.d.ts +0 -11
- package/dist/constants/gantt.d.ts +0 -47
- package/dist/core/criticalPath.d.ts +0 -67
- package/dist/core/scheduling.d.ts +0 -104
- package/dist/hooks/useGanttBarDrag.d.ts +0 -35
- package/dist/hooks/useGanttDrawCreate.d.ts +0 -31
- package/dist/hooks/useGanttExportApi.d.ts +0 -30
- package/dist/hooks/useGanttHistoryApi.d.ts +0 -28
- package/dist/hooks/useGanttRowDrag.d.ts +0 -33
- package/dist/hooks/useGanttSelectors.d.ts +0 -23
- package/dist/hooks/useGanttVirtualization.d.ts +0 -32
- package/dist/hooks/useResolvedTheme.d.ts +0 -15
- package/dist/pages/Gantt.d.ts +0 -306
- package/dist/stores/store.d.ts +0 -118
- package/dist/types/gantt.d.ts +0 -283
- package/dist/types/task.d.ts +0 -111
- package/dist/utils/a11y.d.ts +0 -141
- package/dist/utils/arrowPath.d.ts +0 -66
- package/dist/utils/dependency.d.ts +0 -42
- package/dist/utils/grouping.d.ts +0 -81
- package/dist/utils/headerUtils.d.ts +0 -6
- package/dist/utils/history.d.ts +0 -56
- package/dist/utils/i18n.d.ts +0 -16
- package/dist/utils/mutation.d.ts +0 -47
- package/dist/utils/pngExport.d.ts +0 -67
- package/dist/utils/pointerGesture.d.ts +0 -31
- package/dist/utils/rowDrag.d.ts +0 -69
- package/dist/utils/timeline.d.ts +0 -161
- package/dist/utils/transformData.d.ts +0 -15
- package/dist/utils/viewport.d.ts +0 -95
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { VirtualItem } from '@tanstack/react-virtual';
|
|
2
|
-
import { GanttColumn, GanttReorderChange } from '../types/gantt';
|
|
3
|
-
import { GanttInteractionConfig, Task, TaskTransformed } from '../types/task';
|
|
4
|
-
import { GanttFocus } from '../utils/a11y';
|
|
5
|
-
import { GanttRow } from '../utils/grouping';
|
|
6
|
-
interface GanttTaskGridProps {
|
|
7
|
-
/** The rows on screen (collapsed subtrees and groups are already filtered out) */
|
|
8
|
-
rows: GanttRow[];
|
|
9
|
-
columns: GanttColumn[];
|
|
10
|
-
/** The timeline's own virtualization result - leaves no room for the rows to drift apart */
|
|
11
|
-
virtualItems: VirtualItem[];
|
|
12
|
-
totalHeight: number;
|
|
13
|
-
width: number;
|
|
14
|
-
hierarchy: boolean;
|
|
15
|
-
collapsedIds: Set<string>;
|
|
16
|
-
onToggleCollapse: (rowId: string) => void;
|
|
17
|
-
/** Which cell currently holds the chart's single tab stop */
|
|
18
|
-
focus: GanttFocus;
|
|
19
|
-
/** Whether rows can be dragged to reorder and re-parent */
|
|
20
|
-
allowRowReorder: boolean;
|
|
21
|
-
/** The same guards the bars use - a row is draggable only where the task can move */
|
|
22
|
-
interaction: GanttInteractionConfig;
|
|
23
|
-
onReorder?: (change: GanttReorderChange) => void | boolean;
|
|
24
|
-
onTasksChange?: (updatedTasks: Task[]) => void;
|
|
25
|
-
/** The selected row, highlighted in step with its bar */
|
|
26
|
-
selectedTaskId?: string | null;
|
|
27
|
-
onRowClick?: (task: TaskTransformed, event: React.MouseEvent) => void;
|
|
28
|
-
onRowDoubleClick?: (task: TaskTransformed, event: React.MouseEvent) => void;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The task grid on the left
|
|
32
|
-
*
|
|
33
|
-
* A sticky column inside the timeline's own scroll container, so vertical scrolling is
|
|
34
|
-
* locked to the rows by construction.
|
|
35
|
-
* (Syncing two panes through scroll events drifts the moment virtualization kicks in)
|
|
36
|
-
*
|
|
37
|
-
* These rows are the treegrid's `row` elements: each one owns its bars in the
|
|
38
|
-
* timeline through `aria-owns`, which is what makes the two panes read as a
|
|
39
|
-
* single widget rather than two unrelated lists.
|
|
40
|
-
*/
|
|
41
|
-
export default function GanttTaskGrid({ rows, columns, virtualItems, totalHeight, width, hierarchy, collapsedIds, onToggleCollapse, focus, allowRowReorder, interaction, onReorder, onTasksChange, selectedTaskId, onRowClick, onRowDoubleClick, }: GanttTaskGridProps): import("react").JSX.Element;
|
|
42
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GanttScaleKey } from '../types/gantt';
|
|
2
|
-
interface ScaleSelectorProps {
|
|
3
|
-
selectedScale: GanttScaleKey;
|
|
4
|
-
onScaleChange: (scale: GanttScaleKey) => void;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Segmented control for choosing the Gantt chart scale
|
|
8
|
-
* Uses a pill-style button group instead of a dropdown
|
|
9
|
-
*/
|
|
10
|
-
export default function ScaleSelector({ selectedScale, onScaleChange, }: ScaleSelectorProps): import("react").JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { GanttColumn, GanttScaleConfig, GanttScaleKey } from '../types/gantt';
|
|
2
|
-
export declare const NODE_HEIGHT = 38;
|
|
3
|
-
/** Full timeline header height (44 top group + 28 bottom cell + 1 border) - the grid header matches it */
|
|
4
|
-
export declare const HEADER_HEIGHT = 73;
|
|
5
|
-
/** Default grid column width (px) */
|
|
6
|
-
export declare const DEFAULT_COLUMN_WIDTH = 120;
|
|
7
|
-
/** Grid pane width limits (px) */
|
|
8
|
-
export declare const MIN_GRID_WIDTH = 120;
|
|
9
|
-
export declare const MAX_GRID_WIDTH = 800;
|
|
10
|
-
/** Indentation per tree level (px) */
|
|
11
|
-
export declare const TREE_INDENT = 16;
|
|
12
|
-
/**
|
|
13
|
-
* Default task grid columns
|
|
14
|
-
* Replaceable wholesale through the columns prop, so no header label is baked into the library.
|
|
15
|
-
*/
|
|
16
|
-
export declare const DEFAULT_COLUMNS: GanttColumn[];
|
|
17
|
-
export declare const TIMELINE_SHIFT_BUFFER = 5;
|
|
18
|
-
/** Bars render at least this wide, however narrow they are (px) - keeps short tasks grabbable */
|
|
19
|
-
export declare const MIN_BAR_WIDTH = 14;
|
|
20
|
-
/** Below this width the task name is shown outside the bar (px) */
|
|
21
|
-
export declare const MIN_LABEL_INSIDE_WIDTH = 56;
|
|
22
|
-
/** Size of the resize edge hit area (px) */
|
|
23
|
-
export declare const EDGE_THRESHOLD = 8;
|
|
24
|
-
/**
|
|
25
|
-
* Size of the resize edge hit area for touch and pen (px)
|
|
26
|
-
*
|
|
27
|
-
* The 44px accessibility guideline, applied to the axis the bar can grow along. A bar
|
|
28
|
-
* is half a row tall, so the target cannot also be 44px high without covering the row
|
|
29
|
-
* next to it - what keeps a mistimed tap harmless instead is the long press: a touch
|
|
30
|
-
* has to rest on the edge before anything is lifted.
|
|
31
|
-
*/
|
|
32
|
-
export declare const TOUCH_EDGE_THRESHOLD = 44;
|
|
33
|
-
/** Below this bar width there is no edge resizing and the whole bar is the move handle (px) */
|
|
34
|
-
export declare const MIN_RESIZABLE_WIDTH: number;
|
|
35
|
-
/** Same rule for touch - below this a bar is move-only, so the edges cannot swallow it (px) */
|
|
36
|
-
export declare const MIN_TOUCH_RESIZABLE_WIDTH: number;
|
|
37
|
-
/** Side length of the milestone diamond (px, before the 45-degree rotation) */
|
|
38
|
-
export declare const MILESTONE_SIZE = 16;
|
|
39
|
-
/** Horizontal distance from the diamond's center to its vertex (px) */
|
|
40
|
-
export declare const MILESTONE_HALF_DIAGONAL: number;
|
|
41
|
-
/**
|
|
42
|
-
* Date display format per scale (shared by the tooltip and the drag guides) - year included, 24-hour clock
|
|
43
|
-
* The chart is drawn in UTC, so the zone is spelled out only on the day scale, where the time is visible
|
|
44
|
-
*/
|
|
45
|
-
export declare const DATE_FORMATS: Record<GanttScaleKey, string>;
|
|
46
|
-
/** Declaration order is the order the scale selector lists the scales in - finest first */
|
|
47
|
-
export declare const GANTT_SCALE_CONFIG: Record<GanttScaleKey, GanttScaleConfig>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
|
-
import { WorkingCalendar } from './calendar';
|
|
3
|
-
import { TaskGraph } from './scheduling';
|
|
4
|
-
import { Task } from './types';
|
|
5
|
-
/**
|
|
6
|
-
* Critical path method over the dependency graph.
|
|
7
|
-
*
|
|
8
|
-
* Every task carries real dates, so its own start acts as a "no earlier than" constraint:
|
|
9
|
-
* the forward pass moves a task later when a predecessor demands it and never earlier, and
|
|
10
|
-
* the backward pass works out how much later each task could still finish without pushing
|
|
11
|
-
* the project's end out. Zero difference between the two is zero slack - the critical path.
|
|
12
|
-
*
|
|
13
|
-
* Everything is measured as a whole-day shift of the task's own dates, so times of day
|
|
14
|
-
* survive untouched and the numbers are working days whenever the calendar says so.
|
|
15
|
-
*/
|
|
16
|
-
export interface EarlyDates {
|
|
17
|
-
start: Dayjs;
|
|
18
|
-
finish: Dayjs;
|
|
19
|
-
/** Days later than the task's own dates */
|
|
20
|
-
shift: number;
|
|
21
|
-
}
|
|
22
|
-
export interface LateDates {
|
|
23
|
-
start: Dayjs;
|
|
24
|
-
finish: Dayjs;
|
|
25
|
-
/** Days later than the task's own dates the task could still run */
|
|
26
|
-
shift: number;
|
|
27
|
-
}
|
|
28
|
-
export interface TaskScheduleMetrics {
|
|
29
|
-
earlyStart: string;
|
|
30
|
-
earlyFinish: string;
|
|
31
|
-
lateStart: string;
|
|
32
|
-
lateFinish: string;
|
|
33
|
-
/** Days a task can slip before the project's finish moves */
|
|
34
|
-
totalSlack: number;
|
|
35
|
-
/** Days a task can slip before any successor's early start moves */
|
|
36
|
-
freeSlack: number;
|
|
37
|
-
critical: boolean;
|
|
38
|
-
/** Calendar days, or working days when the working-day calendar is on */
|
|
39
|
-
duration: number;
|
|
40
|
-
}
|
|
41
|
-
export interface CriticalPathResult {
|
|
42
|
-
metrics: Map<string, TaskScheduleMetrics>;
|
|
43
|
-
criticalTaskIds: Set<string>;
|
|
44
|
-
/** Keys from `linkKey` for the links that lie along the critical path */
|
|
45
|
-
criticalLinkIds: Set<string>;
|
|
46
|
-
/** Ids caught in a dependency cycle - they get no metrics */
|
|
47
|
-
cycle: string[] | null;
|
|
48
|
-
/** The project's earliest finish (UTC ISO string), or null with no tasks */
|
|
49
|
-
projectFinish: string | null;
|
|
50
|
-
}
|
|
51
|
-
export interface CriticalPathOptions {
|
|
52
|
-
calendar?: WorkingCalendar;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Earliest each task can run given its predecessors, walked predecessors-first.
|
|
56
|
-
* A task with no predecessor stays on its own dates.
|
|
57
|
-
*/
|
|
58
|
-
export declare function forwardPass(tasks: Task[], calendar?: WorkingCalendar, graph?: TaskGraph): Map<string, EarlyDates>;
|
|
59
|
-
/**
|
|
60
|
-
* Latest each task can run without moving the project's finish, walked successors-first.
|
|
61
|
-
*
|
|
62
|
-
* Takes the forward pass's output rather than recomputing it, so it can be exercised on
|
|
63
|
-
* its own with hand-written early dates.
|
|
64
|
-
*/
|
|
65
|
-
export declare function backwardPass(tasks: Task[], early: Map<string, EarlyDates>, calendar?: WorkingCalendar, graph?: TaskGraph, projectFinish?: Dayjs): Map<string, LateDates>;
|
|
66
|
-
/** Forward pass, backward pass, and the slack numbers that fall out of the two */
|
|
67
|
-
export declare function computeCriticalPath(tasks: Task[], options?: CriticalPathOptions): CriticalPathResult;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
|
-
import { WorkingCalendar } from './calendar';
|
|
3
|
-
import { DependencyType, Task } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* How far a predecessor's move carries into its successors.
|
|
6
|
-
*
|
|
7
|
-
* - `off` - nothing propagates (the default; a chart behaves exactly as it did before)
|
|
8
|
-
* - `shift-on-overlap` - a successor is pushed later only when a link would otherwise be
|
|
9
|
-
* broken, and is never pulled earlier
|
|
10
|
-
* - `maintain-gap` - a successor sits exactly at its earliest legal date, so it follows the
|
|
11
|
-
* predecessor in both directions and the gap stays equal to the link's lag
|
|
12
|
-
*/
|
|
13
|
-
export type SchedulingPolicy = 'off' | 'shift-on-overlap' | 'maintain-gap';
|
|
14
|
-
/** One dependency, with both ends resolved */
|
|
15
|
-
export interface SchedulingLink {
|
|
16
|
-
predecessorId: string;
|
|
17
|
-
successorId: string;
|
|
18
|
-
type: DependencyType;
|
|
19
|
-
/** Signed, in the calendar's day unit */
|
|
20
|
-
lag: number;
|
|
21
|
-
}
|
|
22
|
-
/** Stable identity for a link - used to tag the rendered arrow */
|
|
23
|
-
export declare function linkKey(link: SchedulingLink): string;
|
|
24
|
-
export interface TaskGraph {
|
|
25
|
-
byId: Map<string, Task>;
|
|
26
|
-
links: SchedulingLink[];
|
|
27
|
-
/** successor id -> the links that constrain it */
|
|
28
|
-
incoming: Map<string, SchedulingLink[]>;
|
|
29
|
-
/** predecessor id -> the links it constrains */
|
|
30
|
-
outgoing: Map<string, SchedulingLink[]>;
|
|
31
|
-
/** Topological order, predecessors first. Excludes anything caught in a cycle. */
|
|
32
|
-
order: string[];
|
|
33
|
-
/** Ids that could not be ordered because they sit on a cycle (null when there is none) */
|
|
34
|
-
cycle: string[] | null;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Builds the dependency graph and topologically sorts it (Kahn).
|
|
38
|
-
*
|
|
39
|
-
* Links pointing at a task that is not in the data are dropped, and anything caught in a
|
|
40
|
-
* cycle is left out of `order` and reported in `cycle` - so every caller walks a finite,
|
|
41
|
-
* acyclic list no matter what the data says.
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildTaskGraph(tasks: Task[]): TaskGraph;
|
|
44
|
-
/**
|
|
45
|
-
* A dependency path from `fromId` to `toId`, or null when there is none.
|
|
46
|
-
* Walks successors, so the result reads predecessor-first.
|
|
47
|
-
*/
|
|
48
|
-
export declare function findPath(tasks: Task[], fromId: string, toId: string): string[] | null;
|
|
49
|
-
/**
|
|
50
|
-
* Whether a new predecessor -> successor link can be added without closing a loop.
|
|
51
|
-
*
|
|
52
|
-
* Call this before writing a link into the data: a cycle that never gets created is a
|
|
53
|
-
* cycle the engine never has to work around. `cycle` is the offending chain, ready to
|
|
54
|
-
* put in an error message.
|
|
55
|
-
*/
|
|
56
|
-
export declare function canLink(tasks: Task[], predecessorId: string, successorId: string): {
|
|
57
|
-
ok: boolean;
|
|
58
|
-
cycle: string[] | null;
|
|
59
|
-
};
|
|
60
|
-
/** The instant a task starts (milestones are a single point at startDate) */
|
|
61
|
-
export declare function taskStart(task: Task): Dayjs;
|
|
62
|
-
/** The instant a task finishes (milestones are a single point at startDate) */
|
|
63
|
-
export declare function taskEnd(task: Task): Dayjs;
|
|
64
|
-
/** The predecessor end of a link: FS and FF hang off the finish, SS and SF off the start */
|
|
65
|
-
export declare function linkSourceDate(link: SchedulingLink, predecessor: Task): Dayjs;
|
|
66
|
-
/** The successor end of a link: FS and SS constrain the start, FF and SF the finish */
|
|
67
|
-
export declare function linkTargetDate(link: SchedulingLink, successor: Task): Dayjs;
|
|
68
|
-
/**
|
|
69
|
-
* How many days the successor must move for this link to hold.
|
|
70
|
-
*
|
|
71
|
-
* Positive means it has to move later, negative means it is sitting later than it needs
|
|
72
|
-
* to. Whole days in the calendar's unit, so applying it keeps every time of day intact.
|
|
73
|
-
*/
|
|
74
|
-
export declare function linkDelta(link: SchedulingLink, predecessor: Task, successor: Task, calendar: WorkingCalendar): number;
|
|
75
|
-
/** Moves a task by whole days - both ends together, so its duration is untouched */
|
|
76
|
-
export declare function shiftTask(task: Task, days: number, calendar: WorkingCalendar): Task;
|
|
77
|
-
export interface ScheduleOptions {
|
|
78
|
-
policy?: SchedulingPolicy;
|
|
79
|
-
calendar?: WorkingCalendar;
|
|
80
|
-
/**
|
|
81
|
-
* The tasks that just moved. Only their successors are rescheduled, and the seeds
|
|
82
|
-
* themselves are left exactly where the caller put them.
|
|
83
|
-
* Omitted, the whole project is levelled.
|
|
84
|
-
*/
|
|
85
|
-
seeds?: Iterable<string>;
|
|
86
|
-
/** Pins summary rows - with hierarchy on their dates come from their children */
|
|
87
|
-
hierarchy?: boolean;
|
|
88
|
-
/** Called with the ids caught in a dependency cycle; those tasks are left alone */
|
|
89
|
-
onCycle?: (taskIds: string[]) => void;
|
|
90
|
-
}
|
|
91
|
-
export interface ScheduleResult {
|
|
92
|
-
/** The same array instance when nothing moved, so callers can skip the update */
|
|
93
|
-
tasks: Task[];
|
|
94
|
-
movedIds: string[];
|
|
95
|
-
cycle: string[] | null;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Propagates a move through the dependency graph.
|
|
99
|
-
*
|
|
100
|
-
* One forward pass in topological order: each task is shifted by the largest delta its
|
|
101
|
-
* predecessors demand, then becomes the input for its own successors. Cycles are reported
|
|
102
|
-
* and skipped rather than followed, so this always terminates.
|
|
103
|
-
*/
|
|
104
|
-
export declare function scheduleTasks(tasks: Task[], options?: ScheduleOptions): ScheduleResult;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
|
-
import { GanttBeforeChangeHandler, GanttDragMode, GanttScheduling } from '../types/gantt';
|
|
3
|
-
import { GanttInteractionConfig, Task, TaskTransformed } from '../types/task';
|
|
4
|
-
export type DragMode = GanttDragMode;
|
|
5
|
-
export interface GanttBarDragOptions {
|
|
6
|
-
onTasksChange?: (updatedTasks: Task[]) => void;
|
|
7
|
-
onBeforeTaskChange?: GanttBeforeChangeHandler;
|
|
8
|
-
/** Scroll the timeline when the drag reaches a viewport edge (default true) */
|
|
9
|
-
autoScroll?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/** The dates the drag is proposing for the tasks it moves directly */
|
|
12
|
-
type DraggedDates = Map<string, {
|
|
13
|
-
start: Dayjs;
|
|
14
|
-
end: Dayjs;
|
|
15
|
-
}>;
|
|
16
|
-
/** The task array with the dragged tasks' proposed dates written in */
|
|
17
|
-
export declare function applyDraggedDates(rawTasks: Task[], dragged: DraggedDates): Task[];
|
|
18
|
-
/**
|
|
19
|
-
* Runs the scheduling engine for the tasks the drag is moving.
|
|
20
|
-
* The dragged tasks are the seeds, so only what they reach is rescheduled and the bar
|
|
21
|
-
* under the pointer stays exactly where the pointer put it.
|
|
22
|
-
*/
|
|
23
|
-
export declare function reschedule(rawTasks: Task[], dragged: DraggedDates, scheduling: GanttScheduling): import('core').ScheduleResult;
|
|
24
|
-
/**
|
|
25
|
-
* Hook providing the Gantt bar drag behavior
|
|
26
|
-
*
|
|
27
|
-
* `autoScroll` (default on) scrolls the timeline when the drag reaches a viewport edge,
|
|
28
|
-
* faster the closer the pointer gets, and stops on drop or cancel.
|
|
29
|
-
*/
|
|
30
|
-
export declare function useGanttBarDrag(task: TaskTransformed, options?: GanttBarDragOptions, interaction?: GanttInteractionConfig, scheduling?: GanttScheduling): {
|
|
31
|
-
onPointerDown: import('react').PointerEventHandler<HTMLDivElement>;
|
|
32
|
-
dragMode: GanttDragMode | null;
|
|
33
|
-
consumeDragClick: () => boolean;
|
|
34
|
-
};
|
|
35
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** The task the user drew, handed to `onTaskCreate` - nothing is committed by the chart */
|
|
2
|
-
export interface GanttTaskDraft {
|
|
3
|
-
/** UTC ISO string, snapped to the current scale */
|
|
4
|
-
startDate: string;
|
|
5
|
-
endDate: string;
|
|
6
|
-
/** Id of the task whose row the range was drawn on, null when the row has none */
|
|
7
|
-
rowTaskId: string | null;
|
|
8
|
-
}
|
|
9
|
-
/** The ghost bar drawn while the pointer is down (px, timeline content coordinates) */
|
|
10
|
-
interface DrawGhost {
|
|
11
|
-
leftPx: number;
|
|
12
|
-
widthPx: number;
|
|
13
|
-
topPx: number;
|
|
14
|
-
}
|
|
15
|
-
interface UseGanttDrawCreateParams {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
/** Rows on screen, in order - the row under the pointer names the task it belongs to */
|
|
18
|
-
rowIds: (string | null)[];
|
|
19
|
-
onTaskCreate?: (draft: GanttTaskDraft) => void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Drawing a new task on the empty part of a row
|
|
23
|
-
*
|
|
24
|
-
* The chart never adds the task itself: the drawn range is snapped to the current scale
|
|
25
|
-
* and handed to `onTaskCreate`, and the host decides what (if anything) to do with it.
|
|
26
|
-
*/
|
|
27
|
-
export declare function useGanttDrawCreate({ enabled, rowIds, onTaskCreate, }: UseGanttDrawCreateParams): {
|
|
28
|
-
onDrawPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
|
|
29
|
-
ghost: DrawGhost | null;
|
|
30
|
-
};
|
|
31
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { GanttBottomRowCell, GanttScaleKey } from '../types/gantt';
|
|
3
|
-
import { GanttExportOptions } from '../utils/pngExport';
|
|
4
|
-
/** Imperative export API */
|
|
5
|
-
export interface GanttExportApi {
|
|
6
|
-
/**
|
|
7
|
-
* Renders the whole chart to a PNG and resolves with the blob
|
|
8
|
-
*
|
|
9
|
-
* No download is triggered - what to do with the blob is the caller's choice
|
|
10
|
-
* (save it, upload it, drop it into a PDF).
|
|
11
|
-
*/
|
|
12
|
-
exportToPng: (options?: GanttExportOptions) => Promise<Blob>;
|
|
13
|
-
}
|
|
14
|
-
interface UseGanttExportApiParams {
|
|
15
|
-
scrollRef: RefObject<HTMLDivElement | null>;
|
|
16
|
-
bottomRowCells: GanttBottomRowCell[];
|
|
17
|
-
selectedScale: GanttScaleKey;
|
|
18
|
-
taskCount: number;
|
|
19
|
-
totalWidth: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Imperative PNG export
|
|
23
|
-
*
|
|
24
|
-
* Rows, arrows and header cells are all virtualized, so the live DOM only ever
|
|
25
|
-
* holds the visible slice. The export turns virtualization off, waits for the
|
|
26
|
-
* full chart to render, captures it, and puts the chart back exactly as it was
|
|
27
|
-
* - scroll position included - whether the capture succeeded or threw.
|
|
28
|
-
*/
|
|
29
|
-
export declare function useGanttExportApi({ scrollRef, bottomRowCells, selectedScale, taskCount, totalWidth, }: UseGanttExportApiParams): GanttExportApi;
|
|
30
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { Task } from '../types/task';
|
|
3
|
-
/** Imperative undo/redo API */
|
|
4
|
-
export interface GanttHistoryApi {
|
|
5
|
-
/** Reverts the newest gesture and fires `onTasksChange`. No-op with an empty stack. */
|
|
6
|
-
undo: () => void;
|
|
7
|
-
/** Replays the newest undone gesture and fires `onTasksChange`. No-op with an empty stack. */
|
|
8
|
-
redo: () => void;
|
|
9
|
-
/** Whether there is a gesture to undo */
|
|
10
|
-
canUndo: boolean;
|
|
11
|
-
/** Whether there is an undone gesture to redo */
|
|
12
|
-
canRedo: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Whether the key event landed in something the user is typing into, e.g. an input
|
|
16
|
-
* rendered by a custom task list cell
|
|
17
|
-
*/
|
|
18
|
-
export declare function isTextEntryTarget(target: unknown): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Undo/redo for the chart: the imperative methods plus the keyboard shortcuts.
|
|
21
|
-
*
|
|
22
|
-
* The key handler is meant for the chart container, so it only ever sees events
|
|
23
|
-
* from inside the chart - the shortcut does nothing while the chart is not focused.
|
|
24
|
-
*/
|
|
25
|
-
export declare function useGanttHistoryApi(onTasksChange?: (updatedTasks: Task[]) => void): {
|
|
26
|
-
historyApi: GanttHistoryApi;
|
|
27
|
-
onKeyDown: React.KeyboardEventHandler<HTMLElement>;
|
|
28
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { GanttReorderChange } from '../types/gantt';
|
|
3
|
-
import { Task } from '../types/task';
|
|
4
|
-
import { RowDropRow, RowDropTarget } from '../utils/rowDrag';
|
|
5
|
-
export interface RowDragState {
|
|
6
|
-
draggedId: string;
|
|
7
|
-
/** Where the drop would land - null while the pointer is nowhere useful */
|
|
8
|
-
target: RowDropTarget | null;
|
|
9
|
-
}
|
|
10
|
-
interface UseGanttRowDragParams {
|
|
11
|
-
/** The rows on screen, in row order */
|
|
12
|
-
rows: RowDropRow[];
|
|
13
|
-
/** The element the rows are positioned in - pointer Y is measured from its top */
|
|
14
|
-
bodyRef: RefObject<HTMLDivElement | null>;
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
onReorder?: (change: GanttReorderChange) => void | boolean;
|
|
17
|
-
onTasksChange?: (updatedTasks: Task[]) => void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Vertical drag of a grid row - reorders siblings and re-parents
|
|
21
|
-
*
|
|
22
|
-
* Deliberately separate from useGanttBarDrag: that one is horizontal and lives on the bars in
|
|
23
|
-
* the timeline pane, this one is vertical and lives on the rows in the grid pane, so neither
|
|
24
|
-
* gesture can start the other.
|
|
25
|
-
*
|
|
26
|
-
* Nothing is committed while the drop is illegal - the indicator says so during the drag and
|
|
27
|
-
* the pointerup does nothing.
|
|
28
|
-
*/
|
|
29
|
-
export declare function useGanttRowDrag({ rows, bodyRef, enabled, onReorder, onTasksChange, }: UseGanttRowDragParams): {
|
|
30
|
-
onRowPointerDown: import('react').PointerEventHandler<HTMLDivElement>;
|
|
31
|
-
dragState: RowDragState | null;
|
|
32
|
-
};
|
|
33
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook selecting the state and actions needed from the Gantt store
|
|
3
|
-
* Uses shallow comparison to avoid unnecessary re-renders
|
|
4
|
-
*
|
|
5
|
-
* dragOffsets/currentTask change on every drag frame and are deliberately not
|
|
6
|
-
* subscribed to here. (Components that need them subscribe individually - this keeps
|
|
7
|
-
* the whole chart from re-rendering every frame)
|
|
8
|
-
*/
|
|
9
|
-
export declare function useGanttSelectors(): {
|
|
10
|
-
rawTasks: import('..').Task[];
|
|
11
|
-
transformedTasks: import('..').TaskTransformed[];
|
|
12
|
-
bottomRowCells: import('../types/gantt').GanttBottomRowCell[];
|
|
13
|
-
selectedScale: import('..').GanttScaleKey;
|
|
14
|
-
selectedTaskId: string | null;
|
|
15
|
-
syncTasksFromProps: (rawTasks: import('..').Task[]) => void;
|
|
16
|
-
setHistoryLimit: (limit: number) => void;
|
|
17
|
-
setTransformedTasks: (tasks: import('..').TaskTransformed[]) => void;
|
|
18
|
-
setBottomRowCells: (cells: import('../types/gantt').GanttBottomRowCell[]) => void;
|
|
19
|
-
setSelectedScale: (scale: import('..').GanttScaleKey) => void;
|
|
20
|
-
setLocaleOptions: (options: import('../types/gantt').GanttLocaleOptions | undefined) => void;
|
|
21
|
-
clearAllDragOffsets: () => void;
|
|
22
|
-
getTotalWidth: () => number;
|
|
23
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Virtualizer } from '@tanstack/react-virtual';
|
|
2
|
-
import { RefObject } from 'react';
|
|
3
|
-
import { GanttBottomRowCell } from '../types/gantt';
|
|
4
|
-
interface UseGanttColumnVirtualizationParams {
|
|
5
|
-
bottomRowCells: GanttBottomRowCell[];
|
|
6
|
-
scrollRef: RefObject<HTMLDivElement | null>;
|
|
7
|
-
}
|
|
8
|
-
interface UseGanttColumnVirtualizationResult {
|
|
9
|
-
columnVirtualizer: Virtualizer<HTMLDivElement, Element>;
|
|
10
|
-
isBarVisible: (barLeft: number, barWidth: number) => boolean;
|
|
11
|
-
}
|
|
12
|
-
interface UseGanttVirtualizationParams extends UseGanttColumnVirtualizationParams {
|
|
13
|
-
/** Number of rows on screen - not the task count, since a lane can share one row */
|
|
14
|
-
rowCount: number;
|
|
15
|
-
}
|
|
16
|
-
interface UseGanttVirtualizationResult extends UseGanttColumnVirtualizationResult {
|
|
17
|
-
rowVirtualizer: Virtualizer<HTMLDivElement, Element>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Column virtualization
|
|
21
|
-
*
|
|
22
|
-
* Split out so that rendering the header's bottom time cells and judging horizontal
|
|
23
|
-
* visibility use the same window - the header and the bars must not be culled by
|
|
24
|
-
* different criteria.
|
|
25
|
-
*/
|
|
26
|
-
export declare function useGanttColumnVirtualization({ bottomRowCells, scrollRef, }: UseGanttColumnVirtualizationParams): UseGanttColumnVirtualizationResult;
|
|
27
|
-
/**
|
|
28
|
-
* Hook managing the Gantt chart's virtualization
|
|
29
|
-
* Sets up row and column virtualization and provides the visibility check
|
|
30
|
-
*/
|
|
31
|
-
export declare function useGanttVirtualization({ rowCount, bottomRowCells, scrollRef, }: UseGanttVirtualizationParams): UseGanttVirtualizationResult;
|
|
32
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { GanttTheme } from '../types/gantt';
|
|
2
|
-
interface UseResolvedThemeResult {
|
|
3
|
-
containerClassName: string;
|
|
4
|
-
dataTheme: 'light' | 'dark' | undefined;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Hook that resolves the theme and builds the matching class name and data attribute
|
|
8
|
-
*
|
|
9
|
-
* The 'system' theme is subscribed to with useSyncExternalStore - server rendering and
|
|
10
|
-
* the first hydration render use null (no theme class) and switch to the real system
|
|
11
|
-
* setting after hydration, so there is no hydration mismatch and no getting stuck on
|
|
12
|
-
* the wrong theme.
|
|
13
|
-
*/
|
|
14
|
-
export declare function useResolvedTheme(theme?: GanttTheme, baseClassName?: string): UseResolvedThemeResult;
|
|
15
|
-
export {};
|