@jaeungkim/gantt-chart 1.1.0 → 1.3.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 CHANGED
@@ -6,7 +6,7 @@
6
6
  [![CI](https://github.com/jaeungkim/gantt-chart/actions/workflows/ci.yml/badge.svg)](https://github.com/jaeungkim/gantt-chart/actions/workflows/ci.yml)
7
7
  [![license](https://img.shields.io/npm/l/@jaeungkim/gantt-chart)](LICENSE)
8
8
 
9
- An editable Gantt chart for React.
9
+ A Gantt chart for React that behaves like a controlled input.
10
10
 
11
11
  [Quick start](https://gantt.jaeungkim.com/docs/quick-start) |
12
12
  [Playground](https://gantt.jaeungkim.com/playground) |
@@ -15,7 +15,8 @@ An editable Gantt chart for React.
15
15
 
16
16
  ## Features
17
17
 
18
- - Bar drags that move a task, resize it from either edge and set its progress.
18
+ - One controlled `tasks` prop. Bar drags move a task, resize it from either edge and set its
19
+ progress, and every commit returns the complete next array through `onTasksChange`.
19
20
  - Dependency arrows for `FS`, `SS`, `FF` and `SF`, drawn between bars and removed with Delete or Backspace.
20
21
  - A task list pane with the `parentId` tree, summary roll-up and row reordering.
21
22
  - A docked detail panel that narrows the timeline and edits the task in place.
@@ -88,8 +89,8 @@ export default function ProjectChart() {
88
89
  }
89
90
  ```
90
91
 
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.
92
+ Your app holds the `tasks` array. Every committed gesture ends in one `onTasksChange` call with the
93
+ complete next array, and the chart persists nothing, including the scale.
93
94
 
94
95
  ## Documentation
95
96
 
@@ -1,7 +1,7 @@
1
1
  import { GanttDependencyChange } from '../../dependencies/hooks/useGanttLinkDrag';
2
2
  import { GanttBarOptions } from '../../shared/types';
3
3
  import { GanttInteractionConfig, TaskTransformed } from '../../shared/task';
4
- import { WorkingCalendar } from '../../core';
4
+ import { WorkingCalendar } from '../../core/calendar';
5
5
  interface GanttBarProps {
6
6
  currentTask: TaskTransformed;
7
7
  options: GanttBarOptions;
@@ -1,7 +1,7 @@
1
1
  import { VirtualItem } from '../../shared/virtual/window';
2
2
  import { GanttDependencyChange } from '../../dependencies/hooks/useGanttLinkDrag';
3
3
  import { GanttBarOptions } from '../../shared/types';
4
- import { WorkingCalendar } from '../../core';
4
+ import { WorkingCalendar } from '../../core/calendar';
5
5
  import { GanttInteractionConfig } from '../../shared/task';
6
6
  import { GanttFocus } from '../../interaction/utils/a11y';
7
7
  import { GanttRow } from '../../rows/utils/rows';
@@ -1,6 +1,6 @@
1
1
  import { GanttDragMode } from '../../shared/types';
2
2
  import { GanttInteractionConfig, Task, TaskTransformed } from '../../shared/task';
3
- import { WorkingCalendar } from '../../core';
3
+ import { WorkingCalendar } from '../../core/calendar';
4
4
  export type DragMode = GanttDragMode;
5
5
  interface GanttBarDragOptions {
6
6
  onTasksChange?: (updatedTasks: Task[]) => void;
@@ -10,7 +10,6 @@ interface GanttBarDragOptions {
10
10
  /** Gantt bar drag behavior; `autoScroll` (default true) scrolls the timeline at a viewport edge. */
11
11
  export declare function useGanttBarDrag(task: TaskTransformed, options?: GanttBarDragOptions, interaction?: GanttInteractionConfig, calendar?: WorkingCalendar): {
12
12
  onPointerDown: import('react').PointerEventHandler<HTMLDivElement>;
13
- dragMode: GanttDragMode | null;
14
13
  consumeDragClick: () => boolean;
15
14
  };
16
15
  export {};
@@ -1,5 +1,5 @@
1
1
  import { DependencyType, GanttInteractionConfig, Task, TaskTransformed } from '../../shared/task';
2
- import { LinkAnchor } from '../utils/link';
2
+ import { LinkAnchor } from '../../shared/types';
3
3
  /** The link the user drew, handed to `onDependencyCreate` before anything is committed */
4
4
  export interface GanttDependencyChange {
5
5
  /** Task the drag started on */
@@ -1,5 +1,5 @@
1
1
  import { RenderedDependency, TaskTransformed } from '../../shared/task';
2
- import { LinkAnchor } from './link';
2
+ import { LinkAnchor } from '../../shared/types';
3
3
  interface DragOffset {
4
4
  offsetX: number;
5
5
  offsetWidth: number;
@@ -1,6 +1,5 @@
1
1
  import { DependencyType, Task, TaskDependency, TaskTransformed } from '../../shared/task';
2
- export type LinkAnchor = "start" | "end";
3
- export type LinkRejection = "self" | "duplicate" | "cycle";
2
+ import { LinkAnchor, LinkRejection } from '../../shared/types';
4
3
  type DependencyNode = Pick<Task, "id"> & {
5
4
  dependencies?: TaskDependency[];
6
5
  };
@@ -20,16 +20,16 @@ interface UseGanttDetailParams {
20
20
  tasks: TaskTransformed[];
21
21
  detailTaskId?: string | null;
22
22
  onDetailChange?: (task: TaskTransformed | null) => void;
23
- onTaskClick?: TaskMouseHandler;
23
+ onTaskActivate?: TaskMouseHandler;
24
24
  }
25
25
  interface GanttDetail {
26
26
  task: TaskTransformed | null;
27
27
  open: (taskId: string) => void;
28
28
  close: () => void;
29
- onTaskClick: TaskMouseHandler;
29
+ onTaskActivate: TaskMouseHandler;
30
30
  }
31
31
  /** Controlled by `detailTaskId`, uncontrolled without it; `onDetailChange` fires in both modes */
32
- export declare function useGanttDetail({ enabled, tasks, detailTaskId, onDetailChange, onTaskClick, }: UseGanttDetailParams): GanttDetail;
32
+ export declare function useGanttDetail({ enabled, tasks, detailTaskId, onDetailChange, onTaskActivate, }: UseGanttDetailParams): GanttDetail;
33
33
  interface GanttDetailSlide {
34
34
  /** The task to keep rendered - the open one, or the last one while the panel slides shut */
35
35
  task: TaskTransformed | null;