gantt-lib 0.103.0 → 0.104.1
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 +91 -36
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +183 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -19
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +46 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,21 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://gantt-lib-demo.vercel.app/)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`gantt-lib` is a React/Next.js library for planning interfaces. It covers classic Gantt timelines, resource planning screens, and period-based table-matrix views such as finance plans, budgets, and plan-vs-actual layouts.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Project Timeline
|
|
8
|
+
|
|
9
|
+
Classic Gantt-style planning for phases, tasks, dates, and dependencies.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
### Resource Planner
|
|
14
|
+
|
|
15
|
+
Dedicated scheduling mode for people, equipment, materials, rooms, and other resources with load visibility and reassignment flows.
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
### Finance Matrix
|
|
20
|
+
|
|
21
|
+
Period-based table view for budgets, plan-vs-actual, KPIs, and other data-matrix scenarios.
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
Use it for project timelines, delivery planning, resource allocation, capacity views, and spreadsheet-like matrices that stay aligned with the same left-side task list and time context.
|
|
26
|
+
|
|
27
|
+
Production-style example: [ai.getgantt.ru](https://ai.getgantt.ru/)
|
|
8
28
|
|
|
9
29
|
## Features
|
|
10
30
|
|
|
11
|
-
- 📊 **
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
31
|
+
- 📊 **Classic Gantt chart mode** with tasks, phases, hierarchy, and progress
|
|
32
|
+
- ✋ **Drag-and-drop schedule editing** for moving and resizing timeline bars
|
|
33
|
+
- 🔗 **Task dependencies and cascade scheduling** for linked plans
|
|
34
|
+
- 🗓️ **Calendar and business-day modes** with weekend and custom-day support
|
|
35
|
+
- 📋 **Integrated left-side task list** with configurable and hideable columns
|
|
36
|
+
- 🔎 **Task filtering, search, and focus flows** for large schedules
|
|
37
|
+
- 👥 **Resource planner mode** for people, equipment, rooms, crews, and assignments
|
|
38
|
+
- ↔️ **Resource reassignment and date moves** directly on the calendar
|
|
39
|
+
- ⚠️ **Resource grouping and conflict-oriented workflows** for capacity views
|
|
40
|
+
- 💰 **Table matrix mode** for finance plans, budgets, KPIs, and other period-based data views
|
|
41
|
+
- 🎨 **Customizable styling** via CSS variables
|
|
42
|
+
- 📦 **Tree-shakeable ESM + CJS builds** with TypeScript types included
|
|
20
43
|
|
|
21
44
|
## Installation
|
|
22
45
|
|
|
@@ -29,8 +52,9 @@ npm install gantt-lib
|
|
|
29
52
|
```tsx
|
|
30
53
|
import { GanttChart, type Task } from "gantt-lib";
|
|
31
54
|
import "gantt-lib/styles.css";
|
|
55
|
+
import { useState } from "react";
|
|
32
56
|
|
|
33
|
-
const
|
|
57
|
+
const initialTasks: Task[] = [
|
|
34
58
|
{
|
|
35
59
|
id: "1",
|
|
36
60
|
name: "Project Kickoff",
|
|
@@ -47,17 +71,23 @@ const tasks: Task[] = [
|
|
|
47
71
|
];
|
|
48
72
|
|
|
49
73
|
export default function App() {
|
|
50
|
-
const
|
|
51
|
-
// Handle task updates
|
|
52
|
-
setTasks(updated);
|
|
53
|
-
};
|
|
74
|
+
const [tasks, setTasks] = useState(initialTasks);
|
|
54
75
|
|
|
55
76
|
return (
|
|
56
77
|
<GanttChart
|
|
57
78
|
tasks={tasks}
|
|
79
|
+
showTaskList
|
|
58
80
|
dayWidth={30}
|
|
59
81
|
rowHeight={36}
|
|
60
|
-
|
|
82
|
+
onTasksChange={(changedTasks) => {
|
|
83
|
+
setTasks((prev) => {
|
|
84
|
+
const byId = new Map(prev.map((task) => [task.id, task]));
|
|
85
|
+
for (const task of changedTasks) {
|
|
86
|
+
byId.set(task.id, task);
|
|
87
|
+
}
|
|
88
|
+
return [...byId.values()];
|
|
89
|
+
});
|
|
90
|
+
}}
|
|
61
91
|
/>
|
|
62
92
|
);
|
|
63
93
|
}
|
|
@@ -110,7 +140,7 @@ export default function Planner() {
|
|
|
110
140
|
|
|
111
141
|
`ResourceTimelineChart` is also exported for consumers who want the specialized renderer directly. Resource mode does not render task list editing, dependency lines, hierarchy/cascade scheduling, or task reorder behavior.
|
|
112
142
|
|
|
113
|
-
See the full guide: [Resource Planner Mode](
|
|
143
|
+
See the full guide: [Resource Planner Mode](https://github.com/simon100500/gantt-lib/blob/master/docs/reference/15-resource-planner.md).
|
|
114
144
|
|
|
115
145
|
## API
|
|
116
146
|
|
|
@@ -118,18 +148,32 @@ See the full guide: [Resource Planner Mode](../../docs/reference/15-resource-pla
|
|
|
118
148
|
|
|
119
149
|
Main component that renders the interactive Gantt chart.
|
|
120
150
|
|
|
121
|
-
| Prop
|
|
122
|
-
|
|
|
123
|
-
| `tasks`
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
151
|
+
| Prop | Type | Default | Description |
|
|
152
|
+
| --- | --- | --- | --- |
|
|
153
|
+
| `tasks` | `Task[]` | _required_ | Array of task rows shown in gantt mode. |
|
|
154
|
+
| `viewMode` | `'day' \| 'week' \| 'month'` | `'day'` | Time scale mode. |
|
|
155
|
+
| `dayWidth` | `number` | `40` | Width of one day column in pixels. |
|
|
156
|
+
| `rowHeight` | `number` | `40` | Height of one task row. |
|
|
157
|
+
| `headerHeight` | `number` | `40` | Height of the time-scale header. |
|
|
158
|
+
| `containerHeight` | `number \| string` | `undefined` | Container height in px, `%`, `vh`, or auto. |
|
|
159
|
+
| `showTaskList` | `boolean` | `false` | Shows the left-side task list. |
|
|
160
|
+
| `showChart` | `boolean` | `true` | Hides the chart area when set to `false`. |
|
|
161
|
+
| `showBaseline` | `boolean` | `false` | Renders baselines for tasks with `baselineStartDate` and `baselineEndDate`. |
|
|
162
|
+
| `taskListWidth` | `number` | `660` | Requested width of the task list panel. |
|
|
163
|
+
| `taskListColumnWidths` | `TaskListColumnWidthMap` | `undefined` | Width overrides for built-in and custom TaskList columns. |
|
|
164
|
+
| `businessDays` | `boolean` | `true` | Uses working days instead of calendar days for duration and drag behavior. |
|
|
165
|
+
| `disableTaskDrag` | `boolean` | `false` | Disables drag and resize interactions. |
|
|
166
|
+
| `onTasksChange` | `(tasks: Task[]) => void` | `undefined` | Receives only changed tasks. Merge them into your state. |
|
|
167
|
+
| `enableAutoSchedule` | `boolean` | `false` | Enables dependency-aware cascade scheduling. |
|
|
168
|
+
| `disableConstraints` | `boolean` | `false` | Lets tasks move freely, ignoring dependency rules. |
|
|
169
|
+
| `onCascade` | `(tasks: Task[]) => void` | `undefined` | Fires with all shifted tasks after a hard cascade drag. |
|
|
170
|
+
| `onValidateDependencies` | `(result: ValidationResult) => void` | `undefined` | Receives cycles, missing references, and constraint violations. |
|
|
171
|
+
|
|
172
|
+
More props, mode-specific APIs, and examples:
|
|
173
|
+
|
|
174
|
+
- [GanttChart Props](https://github.com/simon100500/gantt-lib/blob/master/docs/reference/04-props.md)
|
|
175
|
+
- [Resource Planner Mode](https://github.com/simon100500/gantt-lib/blob/master/docs/reference/15-resource-planner.md)
|
|
176
|
+
- [Table Matrix Mode](https://github.com/simon100500/gantt-lib/blob/master/docs/reference/16-table-matrix.md)
|
|
133
177
|
|
|
134
178
|
### Task
|
|
135
179
|
|
|
@@ -137,15 +181,23 @@ Main component that renders the interactive Gantt chart.
|
|
|
137
181
|
interface Task {
|
|
138
182
|
id: string;
|
|
139
183
|
name: string;
|
|
140
|
-
startDate: string
|
|
141
|
-
endDate: string
|
|
184
|
+
startDate: string | Date;
|
|
185
|
+
endDate: string | Date;
|
|
186
|
+
baselineStartDate?: string | Date;
|
|
187
|
+
baselineEndDate?: string | Date;
|
|
188
|
+
type?: 'task' | 'milestone';
|
|
142
189
|
color?: string; // Optional bar color (CSS color value)
|
|
143
|
-
progress?: number;
|
|
144
|
-
accepted?: boolean;
|
|
145
|
-
dependencies?: TaskDependency[];
|
|
190
|
+
progress?: number;
|
|
191
|
+
accepted?: boolean;
|
|
192
|
+
dependencies?: TaskDependency[];
|
|
193
|
+
locked?: boolean;
|
|
194
|
+
divider?: 'top' | 'bottom';
|
|
195
|
+
parentId?: string;
|
|
146
196
|
}
|
|
147
197
|
```
|
|
148
198
|
|
|
199
|
+
Tasks accept ISO strings or `Date` objects, but internal calculations are UTC-safe. Milestones use `type: 'milestone'`. Hierarchy uses `parentId`. Locked tasks cannot be dragged or edited.
|
|
200
|
+
|
|
149
201
|
### Dependencies
|
|
150
202
|
|
|
151
203
|
Tasks can have dependencies on predecessor tasks using 4 link types following PM standards:
|
|
@@ -210,7 +262,10 @@ Example with cascade scheduling enabled:
|
|
|
210
262
|
onCascade={(shiftedTasks) => {
|
|
211
263
|
console.log(`${shiftedTasks.length} tasks were shifted`);
|
|
212
264
|
}}
|
|
213
|
-
|
|
265
|
+
onTasksChange={(changedTasks) => {
|
|
266
|
+
// Keep your normal merge handler for non-cascade edits.
|
|
267
|
+
console.log(changedTasks);
|
|
268
|
+
}}
|
|
214
269
|
/>
|
|
215
270
|
```
|
|
216
271
|
|