gantt-lib 0.88.0 → 0.88.2
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/dist/core/scheduling/index.d.mts +1 -1
- package/dist/core/scheduling/index.d.ts +1 -1
- package/dist/core/scheduling/index.js +15 -16
- package/dist/core/scheduling/index.js.map +1 -1
- package/dist/core/scheduling/index.mjs +15 -16
- package/dist/core/scheduling/index.mjs.map +1 -1
- package/dist/{index-BbdHmt1Q.d.mts → index-CQI1GCao.d.mts} +6 -3
- package/dist/{index-BbdHmt1Q.d.ts → index-CQI1GCao.d.ts} +6 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +62 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -18
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +3 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
|
-
import { T as Task$1, R as ResourceTimelineItem, V as ValidationResult, a as ResourcePlannerChartProps, b as ResourceTimelineResource } from './index-
|
|
3
|
-
export { D as DAY_MS, c as DependencyError, G as GanttChartMode, d as GanttDateRange, e as GridConfig, f as GridLine, L as LinkType, M as MonthSpan, g as ResourceTimelineMove, h as ResourceTimelineResourceMenuCommand, i as TaskBarGeometry, W as WeekendBlock, j as alignToWorkingDay, k as areTasksHierarchicallyRelated, l as buildAdjacencyList, m as buildTaskRangeFromEnd, n as buildTaskRangeFromStart, o as calculateSuccessorDate, p as cascadeByLinks, q as clampTaskRangeForIncomingFS, r as computeLagFromDates, s as computeParentDates, t as computeParentProgress, u as detectCycles, v as findParentId, w as getAllDependencyEdges, x as getAllDescendants, y as getBusinessDayOffset, z as getChildren, A as getDependencyLag, B as getSuccessorChain, C as getTaskDuration, E as getTransitiveCascadeChain, F as isAncestorTask, H as isTaskParent, I as moveTaskRange, J as moveTaskWithCascade, K as normalizeDependencyLag, N as normalizePredecessorDates, O as normalizeTaskDependencyLags, P as normalizeUTCDate, Q as parseDateOnly, S as recalculateIncomingLags, U as recalculateProjectSchedule, X as recalculateTaskFromDependencies, Y as reflowTasksOnModeSwitch, Z as removeDependenciesBetweenTasks, _ as resizeTaskWithCascade, $ as shiftBusinessDayOffset, a0 as universalCascade, a1 as validateDependencies } from './index-
|
|
2
|
+
import { T as Task$1, R as ResourceTimelineItem, V as ValidationResult, a as ResourcePlannerChartProps, b as ResourceTimelineResource } from './index-CQI1GCao.mjs';
|
|
3
|
+
export { D as DAY_MS, c as DependencyError, G as GanttChartMode, d as GanttDateRange, e as GridConfig, f as GridLine, L as LinkType, M as MonthSpan, g as ResourceTimelineMove, h as ResourceTimelineResourceMenuCommand, i as TaskBarGeometry, W as WeekendBlock, j as alignToWorkingDay, k as areTasksHierarchicallyRelated, l as buildAdjacencyList, m as buildTaskRangeFromEnd, n as buildTaskRangeFromStart, o as calculateSuccessorDate, p as cascadeByLinks, q as clampTaskRangeForIncomingFS, r as computeLagFromDates, s as computeParentDates, t as computeParentProgress, u as detectCycles, v as findParentId, w as getAllDependencyEdges, x as getAllDescendants, y as getBusinessDayOffset, z as getChildren, A as getDependencyLag, B as getSuccessorChain, C as getTaskDuration, E as getTransitiveCascadeChain, F as isAncestorTask, H as isTaskParent, I as moveTaskRange, J as moveTaskWithCascade, K as normalizeDependencyLag, N as normalizePredecessorDates, O as normalizeTaskDependencyLags, P as normalizeUTCDate, Q as parseDateOnly, S as recalculateIncomingLags, U as recalculateProjectSchedule, X as recalculateTaskFromDependencies, Y as reflowTasksOnModeSwitch, Z as removeDependenciesBetweenTasks, _ as resizeTaskWithCascade, $ as shiftBusinessDayOffset, a0 as universalCascade, a1 as validateDependencies } from './index-CQI1GCao.mjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as RadixPopover from '@radix-ui/react-popover';
|
|
6
6
|
|
|
@@ -372,7 +372,7 @@ interface Task {
|
|
|
372
372
|
* Optional array of task dependencies
|
|
373
373
|
* - Each dependency references a predecessor task by ID
|
|
374
374
|
* - Supports 4 link types: FS (finish-to-start), SS (start-to-start), FF (finish-to-finish), SF (start-to-finish)
|
|
375
|
-
* - Lag is required (positive = delay
|
|
375
|
+
* - Lag is required (positive = delay, negative = overlap)
|
|
376
376
|
*/
|
|
377
377
|
dependencies?: TaskDependency[];
|
|
378
378
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
|
-
import { T as Task$1, R as ResourceTimelineItem, V as ValidationResult, a as ResourcePlannerChartProps, b as ResourceTimelineResource } from './index-
|
|
3
|
-
export { D as DAY_MS, c as DependencyError, G as GanttChartMode, d as GanttDateRange, e as GridConfig, f as GridLine, L as LinkType, M as MonthSpan, g as ResourceTimelineMove, h as ResourceTimelineResourceMenuCommand, i as TaskBarGeometry, W as WeekendBlock, j as alignToWorkingDay, k as areTasksHierarchicallyRelated, l as buildAdjacencyList, m as buildTaskRangeFromEnd, n as buildTaskRangeFromStart, o as calculateSuccessorDate, p as cascadeByLinks, q as clampTaskRangeForIncomingFS, r as computeLagFromDates, s as computeParentDates, t as computeParentProgress, u as detectCycles, v as findParentId, w as getAllDependencyEdges, x as getAllDescendants, y as getBusinessDayOffset, z as getChildren, A as getDependencyLag, B as getSuccessorChain, C as getTaskDuration, E as getTransitiveCascadeChain, F as isAncestorTask, H as isTaskParent, I as moveTaskRange, J as moveTaskWithCascade, K as normalizeDependencyLag, N as normalizePredecessorDates, O as normalizeTaskDependencyLags, P as normalizeUTCDate, Q as parseDateOnly, S as recalculateIncomingLags, U as recalculateProjectSchedule, X as recalculateTaskFromDependencies, Y as reflowTasksOnModeSwitch, Z as removeDependenciesBetweenTasks, _ as resizeTaskWithCascade, $ as shiftBusinessDayOffset, a0 as universalCascade, a1 as validateDependencies } from './index-
|
|
2
|
+
import { T as Task$1, R as ResourceTimelineItem, V as ValidationResult, a as ResourcePlannerChartProps, b as ResourceTimelineResource } from './index-CQI1GCao.js';
|
|
3
|
+
export { D as DAY_MS, c as DependencyError, G as GanttChartMode, d as GanttDateRange, e as GridConfig, f as GridLine, L as LinkType, M as MonthSpan, g as ResourceTimelineMove, h as ResourceTimelineResourceMenuCommand, i as TaskBarGeometry, W as WeekendBlock, j as alignToWorkingDay, k as areTasksHierarchicallyRelated, l as buildAdjacencyList, m as buildTaskRangeFromEnd, n as buildTaskRangeFromStart, o as calculateSuccessorDate, p as cascadeByLinks, q as clampTaskRangeForIncomingFS, r as computeLagFromDates, s as computeParentDates, t as computeParentProgress, u as detectCycles, v as findParentId, w as getAllDependencyEdges, x as getAllDescendants, y as getBusinessDayOffset, z as getChildren, A as getDependencyLag, B as getSuccessorChain, C as getTaskDuration, E as getTransitiveCascadeChain, F as isAncestorTask, H as isTaskParent, I as moveTaskRange, J as moveTaskWithCascade, K as normalizeDependencyLag, N as normalizePredecessorDates, O as normalizeTaskDependencyLags, P as normalizeUTCDate, Q as parseDateOnly, S as recalculateIncomingLags, U as recalculateProjectSchedule, X as recalculateTaskFromDependencies, Y as reflowTasksOnModeSwitch, Z as removeDependenciesBetweenTasks, _ as resizeTaskWithCascade, $ as shiftBusinessDayOffset, a0 as universalCascade, a1 as validateDependencies } from './index-CQI1GCao.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as RadixPopover from '@radix-ui/react-popover';
|
|
6
6
|
|
|
@@ -372,7 +372,7 @@ interface Task {
|
|
|
372
372
|
* Optional array of task dependencies
|
|
373
373
|
* - Each dependency references a predecessor task by ID
|
|
374
374
|
* - Supports 4 link types: FS (finish-to-start), SS (start-to-start), FF (finish-to-finish), SF (start-to-finish)
|
|
375
|
-
* - Lag is required (positive = delay
|
|
375
|
+
* - Lag is required (positive = delay, negative = overlap)
|
|
376
376
|
*/
|
|
377
377
|
dependencies?: TaskDependency[];
|
|
378
378
|
/**
|
package/dist/index.js
CHANGED
|
@@ -588,26 +588,19 @@ function getDependencyLag(dep) {
|
|
|
588
588
|
return Number.isFinite(dep.lag) ? dep.lag : 0;
|
|
589
589
|
}
|
|
590
590
|
function normalizeTaskDependencyLags(task) {
|
|
591
|
-
|
|
592
|
-
return task;
|
|
593
|
-
}
|
|
594
|
-
let changed = false;
|
|
595
|
-
const dependencies = task.dependencies.map((dep) => {
|
|
596
|
-
const lag = getDependencyLag(dep);
|
|
597
|
-
const normalizedLag = dep.type === "FS" ? Math.max(0, lag) : lag;
|
|
598
|
-
if (normalizedLag === dep.lag) {
|
|
599
|
-
return dep;
|
|
600
|
-
}
|
|
601
|
-
changed = true;
|
|
602
|
-
return { ...dep, lag: normalizedLag };
|
|
603
|
-
});
|
|
604
|
-
return changed ? { ...task, dependencies } : task;
|
|
591
|
+
return task;
|
|
605
592
|
}
|
|
606
593
|
function normalizeDependencyLag(linkType, lag, predecessorStart, predecessorEnd, businessDays = false, weekendPredicate) {
|
|
607
594
|
if (linkType !== "FS") {
|
|
608
595
|
return lag;
|
|
609
596
|
}
|
|
610
|
-
|
|
597
|
+
const predecessorDuration = getTaskDuration(
|
|
598
|
+
predecessorStart,
|
|
599
|
+
predecessorEnd,
|
|
600
|
+
businessDays,
|
|
601
|
+
weekendPredicate
|
|
602
|
+
);
|
|
603
|
+
return Math.max(-predecessorDuration, lag);
|
|
611
604
|
}
|
|
612
605
|
function computeLagFromDates(linkType, predStart, predEnd, succStart, succEnd, businessDays = false, weekendPredicate) {
|
|
613
606
|
const pS = Date.UTC(predStart.getUTCFullYear(), predStart.getUTCMonth(), predStart.getUTCDate());
|
|
@@ -866,11 +859,17 @@ function clampTaskRangeForIncomingFS(task, proposedStart, proposedEnd, allTasks,
|
|
|
866
859
|
continue;
|
|
867
860
|
}
|
|
868
861
|
const { predStart: predecessorStart, predEnd: predecessorEnd } = normalizePredecessorDates(predecessor, parseDateOnly);
|
|
862
|
+
const predecessorDuration = getTaskDuration(
|
|
863
|
+
predecessorStart,
|
|
864
|
+
predecessorEnd,
|
|
865
|
+
businessDays,
|
|
866
|
+
weekendPredicate
|
|
867
|
+
);
|
|
869
868
|
const candidateMinStart = calculateSuccessorDate(
|
|
870
869
|
predecessorStart,
|
|
871
870
|
predecessorEnd,
|
|
872
871
|
"FS",
|
|
873
|
-
|
|
872
|
+
-predecessorDuration,
|
|
874
873
|
businessDays,
|
|
875
874
|
weekendPredicate
|
|
876
875
|
);
|
|
@@ -7747,6 +7746,43 @@ var layoutResourceTimelineItems = (resources, options) => {
|
|
|
7747
7746
|
|
|
7748
7747
|
// src/hooks/useResourceItemDrag.ts
|
|
7749
7748
|
var import_react13 = require("react");
|
|
7749
|
+
var RESOURCE_CURSOR_STYLE_ID = "gantt-resource-global-drag-cursor-style";
|
|
7750
|
+
function ensureResourceGlobalCursorStyle() {
|
|
7751
|
+
if (typeof document === "undefined") return;
|
|
7752
|
+
if (document.getElementById(RESOURCE_CURSOR_STYLE_ID)) return;
|
|
7753
|
+
const style = document.createElement("style");
|
|
7754
|
+
style.id = RESOURCE_CURSOR_STYLE_ID;
|
|
7755
|
+
style.textContent = `
|
|
7756
|
+
html.gantt-resource-global-cursor-grabbing,
|
|
7757
|
+
html.gantt-resource-global-cursor-grabbing *,
|
|
7758
|
+
html.gantt-resource-global-cursor-grabbing *::before,
|
|
7759
|
+
html.gantt-resource-global-cursor-grabbing *::after {
|
|
7760
|
+
cursor: grabbing !important;
|
|
7761
|
+
}
|
|
7762
|
+
|
|
7763
|
+
html.gantt-resource-global-cursor-resize,
|
|
7764
|
+
html.gantt-resource-global-cursor-resize *,
|
|
7765
|
+
html.gantt-resource-global-cursor-resize *::before,
|
|
7766
|
+
html.gantt-resource-global-cursor-resize *::after {
|
|
7767
|
+
cursor: ew-resize !important;
|
|
7768
|
+
}
|
|
7769
|
+
`;
|
|
7770
|
+
document.head.appendChild(style);
|
|
7771
|
+
}
|
|
7772
|
+
function applyResourceGlobalCursor(cursor) {
|
|
7773
|
+
if (typeof document === "undefined") return;
|
|
7774
|
+
ensureResourceGlobalCursorStyle();
|
|
7775
|
+
document.documentElement.classList.remove("gantt-resource-global-cursor-grabbing", "gantt-resource-global-cursor-resize");
|
|
7776
|
+
document.documentElement.classList.add(cursor === "grabbing" ? "gantt-resource-global-cursor-grabbing" : "gantt-resource-global-cursor-resize");
|
|
7777
|
+
document.body.style.cursor = cursor;
|
|
7778
|
+
document.documentElement.style.cursor = cursor;
|
|
7779
|
+
}
|
|
7780
|
+
function clearResourceGlobalCursor() {
|
|
7781
|
+
if (typeof document === "undefined") return;
|
|
7782
|
+
document.documentElement.classList.remove("gantt-resource-global-cursor-grabbing", "gantt-resource-global-cursor-resize");
|
|
7783
|
+
document.body.style.cursor = "";
|
|
7784
|
+
document.documentElement.style.cursor = "";
|
|
7785
|
+
}
|
|
7750
7786
|
var snapToDay = (pixels, dayWidth) => {
|
|
7751
7787
|
return Math.round(pixels / dayWidth) * dayWidth;
|
|
7752
7788
|
};
|
|
@@ -7812,6 +7848,7 @@ var resolveTargetResource = (rows, clientY, gridTop) => {
|
|
|
7812
7848
|
var useResourceItemDrag = ({
|
|
7813
7849
|
dayWidth,
|
|
7814
7850
|
monthStart,
|
|
7851
|
+
viewMode = "day",
|
|
7815
7852
|
rows,
|
|
7816
7853
|
gridElementRef,
|
|
7817
7854
|
readonly,
|
|
@@ -7839,6 +7876,7 @@ var useResourceItemDrag = ({
|
|
|
7839
7876
|
}, []);
|
|
7840
7877
|
const cancelDrag2 = (0, import_react13.useCallback)(() => {
|
|
7841
7878
|
clearRaf();
|
|
7879
|
+
clearResourceGlobalCursor();
|
|
7842
7880
|
activeDragRef.current = null;
|
|
7843
7881
|
setPreview(null);
|
|
7844
7882
|
}, [clearRaf]);
|
|
@@ -7887,6 +7925,7 @@ var useResourceItemDrag = ({
|
|
|
7887
7925
|
return;
|
|
7888
7926
|
}
|
|
7889
7927
|
clearRaf();
|
|
7928
|
+
clearResourceGlobalCursor();
|
|
7890
7929
|
activeDragRef.current = null;
|
|
7891
7930
|
setPreview(null);
|
|
7892
7931
|
const gridTop = gridElementRef?.current?.getBoundingClientRect().top ?? 0;
|
|
@@ -7919,8 +7958,10 @@ var useResourceItemDrag = ({
|
|
|
7919
7958
|
return;
|
|
7920
7959
|
}
|
|
7921
7960
|
const target = event.target;
|
|
7922
|
-
const
|
|
7961
|
+
const isSingleDayItem = viewMode === "day" && layoutItem.width <= dayWidth;
|
|
7962
|
+
const mode = isSingleDayItem ? "move" : target.closest(".gantt-resourceTimeline-resizeHandleStart") ? "resize-start" : target.closest(".gantt-resourceTimeline-resizeHandleEnd") ? "resize-end" : "move";
|
|
7923
7963
|
event.preventDefault();
|
|
7964
|
+
applyResourceGlobalCursor(mode === "move" ? "grabbing" : "ew-resize");
|
|
7924
7965
|
activeDragRef.current = {
|
|
7925
7966
|
item: layoutItem.item,
|
|
7926
7967
|
itemId: layoutItem.itemId,
|
|
@@ -7949,7 +7990,7 @@ var useResourceItemDrag = ({
|
|
|
7949
7990
|
startDate: layoutItem.startDate,
|
|
7950
7991
|
endDate: layoutItem.endDate
|
|
7951
7992
|
});
|
|
7952
|
-
}, [businessDays, dayWidth, monthStart, readonly, weekendPredicate]);
|
|
7993
|
+
}, [businessDays, dayWidth, monthStart, readonly, weekendPredicate, viewMode]);
|
|
7953
7994
|
return {
|
|
7954
7995
|
preview,
|
|
7955
7996
|
startDrag,
|
|
@@ -8710,6 +8751,7 @@ function ResourceTimelineChart({
|
|
|
8710
8751
|
const { preview, startDrag } = useResourceItemDrag({
|
|
8711
8752
|
dayWidth,
|
|
8712
8753
|
monthStart,
|
|
8754
|
+
viewMode,
|
|
8713
8755
|
rows: displayLayout.rows,
|
|
8714
8756
|
gridElementRef: gridRef,
|
|
8715
8757
|
readonly,
|
|
@@ -9025,10 +9067,12 @@ function ResourceTimelineChart({
|
|
|
9025
9067
|
(resourceItems) => resourceItems.map((layoutItem) => {
|
|
9026
9068
|
const customClassName = getItemClassName?.(layoutItem.item);
|
|
9027
9069
|
const isDraggingItem = preview?.itemId === layoutItem.itemId;
|
|
9070
|
+
const isSingleDayMoveOnlyItem = viewMode === "day" && layoutItem.width <= dayWidth;
|
|
9028
9071
|
const hasItemMenu = Boolean(onResourceItemMenuClick);
|
|
9029
9072
|
const isActiveItem = activeResourceItemId === layoutItem.itemId;
|
|
9030
9073
|
const className = [
|
|
9031
9074
|
"gantt-resourceTimeline-item",
|
|
9075
|
+
isSingleDayMoveOnlyItem && "gantt-resourceTimeline-itemMoveOnly",
|
|
9032
9076
|
hasItemMenu && "gantt-resourceTimeline-itemHasMenu",
|
|
9033
9077
|
isActiveItem && "gantt-resourceTimeline-itemActive",
|
|
9034
9078
|
isDraggingItem && "gantt-resourceTimeline-itemDragging",
|