@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.
@@ -6,7 +6,7 @@ interface UseGanttSelectionParams {
6
6
  }
7
7
  interface GanttSelection {
8
8
  select: (task: TaskTransformed | null) => void;
9
- onTaskClick: (task: TaskTransformed, event: React.MouseEvent) => void;
9
+ onTaskActivate: (task: TaskTransformed, event: React.MouseEvent) => void;
10
10
  }
11
11
  export declare function useGanttSelection({ selectable, onTaskSelect, onTaskClick, }: UseGanttSelectionParams): GanttSelection;
12
12
  export {};
@@ -1,7 +1,6 @@
1
- import { GanttBottomRowCell, GanttDragMode, GanttDragOffset, GanttLocaleOptions, GanttScaleKey } from './types';
1
+ import { GanttBottomRowCell, GanttDragMode, GanttDragOffset, GanttLocaleOptions, GanttScaleKey, LinkAnchor, LinkRejection } from './types';
2
2
  import { Task, TaskTransformed } from './task';
3
3
  import { GanttDropMode, GanttMoveRejection, GanttTaskMove } from '../core/reorder';
4
- import { LinkAnchor, LinkRejection } from '../dependencies/utils/link';
5
4
  interface GanttLinkDraft {
6
5
  /** Task the drag started on - it becomes the predecessor */
7
6
  fromTaskId: string;
@@ -5,6 +5,8 @@ import { Task, TaskTransformed } from './task';
5
5
  export type GanttTheme = 'light' | 'dark' | 'system';
6
6
  export type GanttScaleKey = 'day' | 'week' | 'month' | 'quarter' | 'year';
7
7
  export type GanttLabelUnit = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
8
+ export type LinkAnchor = 'start' | 'end';
9
+ export type LinkRejection = 'self' | 'duplicate' | 'cycle';
8
10
  export type GanttDragMode = 'bar' | 'left' | 'right';
9
11
  export interface GanttDragBounds {
10
12
  min?: Dayjs;
@@ -95,7 +97,7 @@ export interface GanttDragOffset {
95
97
  }
96
98
  export interface GanttBarOptions {
97
99
  onTasksChange?: (updatedTasks: Task[]) => void;
98
- onTaskClick?: (task: TaskTransformed, event: ReactMouseEvent) => void;
100
+ onTaskActivate?: (task: TaskTransformed, event: ReactMouseEvent) => void;
99
101
  onTaskDoubleClick?: (task: TaskTransformed, event: ReactMouseEvent) => void;
100
102
  showTooltip?: boolean;
101
103
  }
@@ -1,5 +1,6 @@
1
1
  import { VirtualAxis } from './axis';
2
2
  export declare const MIN_VIRTUAL_COUNT = 24;
3
+ export declare const OVERSCAN = 5;
3
4
  export interface VirtualWindow {
4
5
  /** First index to render */
5
6
  start: number;
@@ -24,6 +24,7 @@ export declare function originShiftPx(prevTicks: GanttBottomRowCell[], nextTicks
24
24
  export declare function computeNonWorkingRanges(timelineTicks: GanttBottomRowCell[], scaleKey: GanttScaleKey, nonWorkingDayAt: (date: Dayjs) => NonWorkingDay | null): NonWorkingRange[];
25
25
  export declare function shiftByDragSteps(date: Dayjs, steps: number, scaleKey: GanttScaleKey): Dayjs;
26
26
  export declare function pxBetweenDates(from: Dayjs, to: Dayjs, scaleKey: GanttScaleKey): number;
27
+ export declare function toDragBounds(min: string | undefined, max: string | undefined): GanttDragBounds | null;
27
28
  export declare function clampDragDates(mode: GanttDragMode, startDate: Dayjs, endDate: Dayjs, bounds: GanttDragBounds, scaleKey: GanttScaleKey): {
28
29
  startDate: Dayjs;
29
30
  endDate: Dayjs;
@@ -33,10 +34,6 @@ export declare function clampMoveDelta(members: {
33
34
  end: Dayjs;
34
35
  bounds: GanttDragBounds;
35
36
  }[], requestedMs: number, scaleKey: GanttScaleKey): number;
36
- export declare function calculateDateOffsets(startDate: Dayjs, endDate: Dayjs, timelineTicks: GanttBottomRowCell[], scaleKey: GanttScaleKey): {
37
- barMarginLeftAmount: number;
38
- barWidthSize: number;
39
- };
40
37
  export declare function calculateDateOffsetPx(date: Dayjs, timelineTicks: GanttBottomRowCell[], scaleKey: GanttScaleKey): number | null;
41
38
  export declare function dateAtOffsetPx(offsetPx: number, timelineTicks: GanttBottomRowCell[], scaleKey: GanttScaleKey): Dayjs | null;
42
39
  export declare function timelineRange(timelineTicks: GanttBottomRowCell[], scaleKey: GanttScaleKey): GanttDateRange | null;
@@ -1,4 +1,9 @@
1
+ import { Dayjs } from 'dayjs';
1
2
  import { GanttBottomRowCell, GanttScaleKey } from '../../shared/types';
2
3
  import { Task, TaskTransformed } from '../../shared/task';
3
4
  import { TaskTree } from '../../core/tree';
5
+ export declare function calculateDateOffsets(startDate: Dayjs, endDate: Dayjs, timelineTicks: GanttBottomRowCell[], scaleKey: GanttScaleKey): {
6
+ barMarginLeftAmount: number;
7
+ barWidthSize: number;
8
+ };
4
9
  export declare function transformTasks(tasks: Task[], timelineTicks: GanttBottomRowCell[], selectedScale: GanttScaleKey, tree?: TaskTree): TaskTransformed[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaeungkim/gantt-chart",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -25,7 +25,7 @@
25
25
  "README.md",
26
26
  "LICENSE"
27
27
  ],
28
- "description": "React Gantt chart with editable bars, dependency arrows, and headless date utilities",
28
+ "description": "A controlled React Gantt chart. Every drag returns the complete next tasks array. Virtualized rows, dependency arrows, working calendar, keyboard editing.",
29
29
  "keywords": [
30
30
  "gantt",
31
31
  "gantt-chart",
@@ -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';