@jaeungkim/gantt-chart 1.0.0 → 1.1.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 +25 -168
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,106 +6,23 @@
|
|
|
6
6
|
[](https://github.com/jaeungkim/gantt-chart/actions/workflows/ci.yml)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
working-day calendar, keyboard and screen-reader support, and a date core that runs without a DOM.
|
|
9
|
+
An editable Gantt chart for React.
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
The package is two layers. `ReactGanttChart` renders the chart, handles every gesture, and hands
|
|
18
|
-
your app a new `tasks` array each time an edit commits. The tree and calendar math underneath it is
|
|
19
|
-
exported as plain functions, so a server, a worker or a test can call them without rendering
|
|
20
|
-
anything.
|
|
11
|
+
[Quick start](https://gantt.jaeungkim.com/docs/quick-start) |
|
|
12
|
+
[Playground](https://gantt.jaeungkim.com/playground) |
|
|
13
|
+
[Documentation](https://gantt.jaeungkim.com/docs) |
|
|
14
|
+
[한국어 문서](https://gantt.jaeungkim.com/ko/docs)
|
|
21
15
|
|
|
22
16
|
## Features
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
- `
|
|
32
|
-
- Dependency arrows routed as elbows for all four link types: `FS`, `SS`, `FF`, `SF`.
|
|
33
|
-
- A today line, weekend and holiday shading, and a hover card per bar.
|
|
34
|
-
- A docked detail panel that narrows the timeline instead of covering it. `renderDetail` replaces
|
|
35
|
-
its body; `detailTaskId` controls which task is open.
|
|
36
|
-
|
|
37
|
-
### Editing
|
|
38
|
-
|
|
39
|
-
- Drag a bar to move it, pull either edge to resize it, drag the handle to set progress. Touch and
|
|
40
|
-
pen get wider grab zones.
|
|
41
|
-
- While a drag is live the dragged dates print in the date-axis cells they land in. Nothing floats
|
|
42
|
-
over the chart.
|
|
43
|
-
- Draw a dependency from one bar's link handle to another; click an arrow and press Delete to
|
|
44
|
-
remove it. `onDependencyCreate` and `onDependencyDelete` can veto either.
|
|
45
|
-
- Propose a new task from the **Add task** button under the task list, from `addTask()` on the ref,
|
|
46
|
-
or by drawing a range below the last row. The chart reports a draft through `onTaskCreate` and
|
|
47
|
-
never adds the row itself.
|
|
48
|
-
- Drag a task-list row to a new position or a new parent with `allowReorder`. `onTaskMove` can
|
|
49
|
-
reject the move.
|
|
50
|
-
- The detail panel edits too. Its built-in body changes the name, either date and the progress in
|
|
51
|
-
place, committing through the same `onTasksChange` and gated by the same per-task flags as the
|
|
52
|
-
bar gestures. A `renderDetail` body of your own commits through `update(patch)`.
|
|
53
|
-
- Permissions per chart and per task: `readOnly`, `allowMove`, `allowResize`,
|
|
54
|
-
`allowProgressChange`, `allowLinkCreate`, `allowLinkDelete`, `allowTaskCreate`, `allowReorder`,
|
|
55
|
-
plus `minDate` and `maxDate` drag bounds.
|
|
56
|
-
- Every committed gesture ends in one `onTasksChange` call with the complete next array.
|
|
57
|
-
|
|
58
|
-
### Dates
|
|
59
|
-
|
|
60
|
-
- `workingCalendar` moves a drop forward off a weekend or a holiday. `workingWeekdays` says which
|
|
61
|
-
weekdays are worked and `holidays` lists the days off beyond them; both feed the calendar and the
|
|
62
|
-
shading, so the two cannot drift apart.
|
|
63
|
-
- A holiday can carry a `label` and a `color`. The name is written in the tick row over its band and
|
|
64
|
-
the colour tints it, so it reads apart from the weekend beside it.
|
|
65
|
-
- `visibleStart` and `visibleEnd` pin the range; `infiniteScroll` grows it at either end and
|
|
66
|
-
`onRangeChange` reports every change.
|
|
67
|
-
- Every date is UTC. A bare `YYYY-MM-DD` lands on the day it names in every viewer's time zone.
|
|
68
|
-
|
|
69
|
-
### Keyboard and screen readers
|
|
70
|
-
|
|
71
|
-
- The chart is one ARIA treegrid with a single roving tab stop. Arrow keys move between rows and
|
|
72
|
-
cells; Home and End jump.
|
|
73
|
-
- Bars move, resize and step their progress from the keyboard. Rows reorder, indent and outdent.
|
|
74
|
-
Ctrl/Cmd + ArrowUp and ArrowDown step the scale, and edits are announced.
|
|
75
|
-
- A bar's accessible name is built from the task name, its dates and its progress.
|
|
76
|
-
- The gestures with no keyboard equivalent are written down in
|
|
77
|
-
[Keyboard and screen readers](https://gantt.jaeungkim.com/docs/accessibility), not hidden.
|
|
78
|
-
|
|
79
|
-
### Locale and theme
|
|
80
|
-
|
|
81
|
-
- `locale` renders every date label through `Intl.DateTimeFormat`. `formats` overrides the tick,
|
|
82
|
-
header and tooltip labels per scale, and `firstDayOfWeek` picks where a week starts. No locale
|
|
83
|
-
package needed.
|
|
84
|
-
- `theme` takes `'light'`, `'dark'` or `'system'`. Omitted, the chart follows the host page's
|
|
85
|
-
`color-scheme`, which is what an app's own light/dark toggle already sets.
|
|
86
|
-
- 26 `--gantt-*` custom properties scoped to `.gantt-container`, so they cannot collide with your
|
|
87
|
-
own tokens.
|
|
88
|
-
- A per-task `color` derives the bar, its progress fill, its hover shade and a readable label color
|
|
89
|
-
from one value. A per-task `className` reaches the bar and its task-list row.
|
|
90
|
-
|
|
91
|
-
### Imperative API
|
|
92
|
-
|
|
93
|
-
A `ref` of type `GanttHandle` exposes `scrollToDate`, `scrollToToday`, `scrollToTask`, `setScale`,
|
|
94
|
-
`zoomToFit`, `openDetail`, `closeDetail`, `addTask` and `getScrollElement`. The chart renders no
|
|
95
|
-
toolbar and no scale picker; you render the control and drive it through the ref.
|
|
96
|
-
|
|
97
|
-
### Headless core
|
|
98
|
-
|
|
99
|
-
`buildTaskTree`, `collectSubtreeIds`, `rollUpTasks`, `sortTasksBySequence`, `validateMove`,
|
|
100
|
-
`moveTask`, `createWorkingCalendar` and `CALENDAR_DAYS` import no React and touch no DOM. They are
|
|
101
|
-
the same functions the chart runs, so a report on the server and the bars in the browser agree.
|
|
102
|
-
|
|
103
|
-
### Packaging
|
|
104
|
-
|
|
105
|
-
- TypeScript types for every prop, callback and helper.
|
|
106
|
-
- ESM and CJS builds, one stylesheet at `@jaeungkim/gantt-chart/style.css`.
|
|
107
|
-
- React 18 and 19 as peer dependencies. Two runtime dependencies: `dayjs` and `zustand`.
|
|
108
|
-
- Published from CI with npm provenance.
|
|
18
|
+
- Bar drags that move a task, resize it from either edge and set its progress.
|
|
19
|
+
- Dependency arrows for `FS`, `SS`, `FF` and `SF`, drawn between bars and removed with Delete or Backspace.
|
|
20
|
+
- A task list pane with the `parentId` tree, summary roll-up and row reordering.
|
|
21
|
+
- A docked detail panel that narrows the timeline and edits the task in place.
|
|
22
|
+
- Five scales from `day` to `year`, rows and time cells virtualized together, and tasks packed onto shared rows by `lane`.
|
|
23
|
+
- A working calendar from `workingWeekdays` and `holidays`, which also shades the timeline.
|
|
24
|
+
- Keyboard editing and screen reader announcements on one ARIA treegrid.
|
|
25
|
+
- `locale` date labels through `Intl.DateTimeFormat`, and a light, dark or system theme.
|
|
109
26
|
|
|
110
27
|
## Install
|
|
111
28
|
|
|
@@ -115,7 +32,8 @@ pnpm add @jaeungkim/gantt-chart
|
|
|
115
32
|
# yarn add @jaeungkim/gantt-chart
|
|
116
33
|
```
|
|
117
34
|
|
|
118
|
-
`react` and `react-dom` (`^18` or `^19`) are peer dependencies.
|
|
35
|
+
`react` and `react-dom` (`^18` or `^19`) are peer dependencies. The runtime dependencies are
|
|
36
|
+
`dayjs` and `zustand`.
|
|
119
37
|
|
|
120
38
|
## Quick example
|
|
121
39
|
|
|
@@ -170,87 +88,26 @@ export default function ProjectChart() {
|
|
|
170
88
|
}
|
|
171
89
|
```
|
|
172
90
|
|
|
173
|
-
That chart is
|
|
174
|
-
|
|
175
|
-
truth.
|
|
176
|
-
|
|
177
|
-
### Add a scale control
|
|
178
|
-
|
|
179
|
-
The chart ships no toolbar, so the scale picker is a control you own: render it, and call `setScale`
|
|
180
|
-
on the ref. `onScaleChange` fires for every source, so your control stays in step when Ctrl/Cmd +
|
|
181
|
-
wheel or Ctrl/Cmd + arrow moves the scale instead.
|
|
182
|
-
|
|
183
|
-
The whole recipe is in **[Imperative API](https://gantt.jaeungkim.com/docs/imperative-api)**.
|
|
184
|
-
|
|
185
|
-
### Use the core without a chart
|
|
186
|
-
|
|
187
|
-
```ts
|
|
188
|
-
import { createWorkingCalendar, rollUpTasks, type Task } from '@jaeungkim/gantt-chart';
|
|
189
|
-
|
|
190
|
-
const calendar = createWorkingCalendar({ holidays: ['2026-09-21'] });
|
|
191
|
-
const rolled = rollUpTasks(tasks); // summary rows recomputed from their children
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Full walkthroughs: **[Quick start](https://gantt.jaeungkim.com/docs/quick-start)** and
|
|
195
|
-
**[Headless core](https://gantt.jaeungkim.com/docs/headless-core)**.
|
|
196
|
-
|
|
197
|
-
## What it leaves to you
|
|
198
|
-
|
|
199
|
-
The chart renders the timeline and handles the gestures. Your app owns everything else:
|
|
200
|
-
|
|
201
|
-
- Data fetching and persistence. Tasks arrive as a prop; nothing is stored, not even the scale.
|
|
202
|
-
- Validation. Ids, date order and parseable dates are not checked before render.
|
|
203
|
-
- Automatic rescheduling. Moving a predecessor never moves its successors.
|
|
204
|
-
- Chrome. No toolbar, scale picker, zoom buttons or collapse button.
|
|
205
|
-
- Resources, costs, export and print.
|
|
206
|
-
|
|
207
|
-
The full boundary list is in
|
|
208
|
-
**[Introduction](https://gantt.jaeungkim.com/docs/introduction)**.
|
|
91
|
+
That chart is editable. Every committed gesture ends in one `onTasksChange` call with the complete
|
|
92
|
+
next array. The chart persists nothing, including the scale.
|
|
209
93
|
|
|
210
94
|
## Documentation
|
|
211
95
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
| [Quick start](https://gantt.jaeungkim.com/docs/quick-start) | Install to a working, editable chart |
|
|
217
|
-
| [Task data](https://gantt.jaeungkim.com/docs/task-data) | The `Task` shape, date handling, and how the `tasks` prop is compared |
|
|
218
|
-
| [Task list and hierarchy](https://gantt.jaeungkim.com/docs/task-list) | The left pane and the `parentId` tree |
|
|
219
|
-
| [Lanes](https://gantt.jaeungkim.com/docs/lanes) | The `lane` task field, which packs tasks that never overlap onto one row |
|
|
220
|
-
| [The timeline](https://gantt.jaeungkim.com/docs/timeline) | Scales, range, zoom, the today line, and non-working days |
|
|
221
|
-
| [Editing tasks](https://gantt.jaeungkim.com/docs/editing) | Move, resize, progress, permissions, drag bounds, and touch |
|
|
222
|
-
| [Creating tasks](https://gantt.jaeungkim.com/docs/task-creation) | The three ways a new task is proposed, and `onTaskCreate` |
|
|
223
|
-
| [Reordering rows](https://gantt.jaeungkim.com/docs/reordering) | Dragging a row to a new position or a new parent, and `onTaskMove` |
|
|
224
|
-
| [Dependencies](https://gantt.jaeungkim.com/docs/dependencies) | The four link types, and drawing arrows |
|
|
225
|
-
| [Working calendar](https://gantt.jaeungkim.com/docs/working-calendar) | Keeping a drop off weekends and holidays |
|
|
226
|
-
| [Detail panel](https://gantt.jaeungkim.com/docs/detail-panel) | The docked side panel: what opens it, editing in place, `renderDetail`, and controlling it |
|
|
227
|
-
| [Events](https://gantt.jaeungkim.com/docs/events) | Every callback a click, a drag and a keyboard edit fire |
|
|
228
|
-
| [Styling](https://gantt.jaeungkim.com/docs/styling) | Per-task color and class names |
|
|
229
|
-
| [Imperative API](https://gantt.jaeungkim.com/docs/imperative-api) | The `ref` handle: scrolling, zoom, the detail panel and task creation |
|
|
230
|
-
| [Keyboard and screen readers](https://gantt.jaeungkim.com/docs/accessibility) | The key map, the ARIA tree, and the gaps |
|
|
231
|
-
| [Locale and date formats](https://gantt.jaeungkim.com/docs/i18n) | `locale`, per-scale overrides, week start |
|
|
232
|
-
| [Theming](https://gantt.jaeungkim.com/docs/theming) | The theme prop and the CSS custom properties |
|
|
233
|
-
| [Headless core](https://gantt.jaeungkim.com/docs/headless-core) | Tree and calendar math without React or a DOM |
|
|
96
|
+
[Quick start](https://gantt.jaeungkim.com/docs/quick-start) goes from install to a chart your app
|
|
97
|
+
can edit. [GanttProps](https://gantt.jaeungkim.com/docs/ref/props) lists every prop, callback and
|
|
98
|
+
default. The chart renders no toolbar, so your app renders the scale control and drives it
|
|
99
|
+
through the `ref` in [Imperative API](https://gantt.jaeungkim.com/docs/imperative-api).
|
|
234
100
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
| [GanttProps](https://gantt.jaeungkim.com/docs/ref/props) | `GanttProps` |
|
|
238
|
-
| [Task and task types](https://gantt.jaeungkim.com/docs/ref/task) | `Task`, `TaskDependency`, `DependencyType`, `TaskTransformed` |
|
|
239
|
-
| [GanttInteractionConfig](https://gantt.jaeungkim.com/docs/ref/interaction-config) | `GanttInteractionConfig` |
|
|
240
|
-
| [GanttRow](https://gantt.jaeungkim.com/docs/ref/rows) | `GanttRow` |
|
|
241
|
-
| [Detail renderer](https://gantt.jaeungkim.com/docs/ref/renderers) | `GanttDetailRenderer`, `GanttDetailRenderProps` |
|
|
242
|
-
| [GanttHandle](https://gantt.jaeungkim.com/docs/ref/handle) | `GanttHandle`, `GanttScrollApi`, `GanttDetailApi`, `GanttTaskCreateApi`, `GanttScrollOptions`, `GanttZoomAnchor` |
|
|
243
|
-
| [Scale and theme types](https://gantt.jaeungkim.com/docs/ref/scales) | `GanttScaleKey`, `GanttScaleFormat`, `GanttFormatOverrides`, `GanttTheme`, `Holiday` |
|
|
244
|
-
| [Tree helpers](https://gantt.jaeungkim.com/docs/ref/core-tree) | `buildTaskTree`, `collectSubtreeIds`, `rollUpTasks`, `moveTask`, `validateMove`, `sortTasksBySequence` |
|
|
245
|
-
| [Working calendar helpers](https://gantt.jaeungkim.com/docs/ref/core-calendar) | `createWorkingCalendar`, `CALENDAR_DAYS`, `WorkingCalendar` |
|
|
101
|
+
The tree and calendar helpers are exported as plain functions that run without React or a DOM. See
|
|
102
|
+
[Headless core](https://gantt.jaeungkim.com/docs/headless-core).
|
|
246
103
|
|
|
247
|
-
|
|
104
|
+
Release notes are on [GitHub Releases](https://github.com/jaeungkim/gantt-chart/releases).
|
|
248
105
|
|
|
249
106
|
## Contributing
|
|
250
107
|
|
|
251
108
|
Setup, the checks CI runs, and the branch and PR conventions are in
|
|
252
109
|
[CONTRIBUTING.md](CONTRIBUTING.md). Questions and ideas go in
|
|
253
|
-
[Discussions](https://github.com/jaeungkim/gantt-chart/discussions)
|
|
110
|
+
[Discussions](https://github.com/jaeungkim/gantt-chart/discussions). Issues are for bugs and
|
|
254
111
|
concrete feature requests.
|
|
255
112
|
|
|
256
113
|
## License
|