gantt-lib 0.85.1 → 0.86.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/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +196 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +196 -150
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +12 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -710,7 +710,7 @@ interface TaskListProps {
|
|
|
710
710
|
rowHeight: number;
|
|
711
711
|
/** Height of the header row in pixels (must match Gantt chart's headerHeight) */
|
|
712
712
|
headerHeight: number;
|
|
713
|
-
/** Width of the task list overlay in pixels. Values below
|
|
713
|
+
/** Width of the task list overlay in pixels. Values below the visible column width are clamped. */
|
|
714
714
|
taskListWidth?: number;
|
|
715
715
|
/** Callback when tasks are modified via inline edit. Receives array of changed tasks. */
|
|
716
716
|
onTasksChange?: (tasks: Task[]) => void;
|
package/dist/index.js
CHANGED
|
@@ -2976,6 +2976,7 @@ var TaskRow = import_react3.default.memo(
|
|
|
2976
2976
|
"div",
|
|
2977
2977
|
{
|
|
2978
2978
|
"data-filter-match": isFilterMatch ? "true" : "false",
|
|
2979
|
+
"data-gantt-task-row-id": task.id,
|
|
2979
2980
|
className: `gantt-tr-row ${isFilterMatch ? "gantt-tr-row-filter-match" : ""}`,
|
|
2980
2981
|
style: { height: `${rowHeight}px` },
|
|
2981
2982
|
children: [
|
|
@@ -6292,6 +6293,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
6292
6293
|
isParent ? "gantt-tl-row-parent" : ""
|
|
6293
6294
|
].filter(Boolean).join(" "),
|
|
6294
6295
|
style: { minHeight: `${rowHeight}px`, position: "relative" },
|
|
6296
|
+
"data-gantt-task-row-id": task.id,
|
|
6295
6297
|
onClick: handleRowClickInternal,
|
|
6296
6298
|
onKeyDown: handleRowKeyDown,
|
|
6297
6299
|
onDragOver: (e) => onDragOver?.(rowIndex, e),
|
|
@@ -6575,7 +6577,7 @@ var TaskList = ({
|
|
|
6575
6577
|
tasks,
|
|
6576
6578
|
rowHeight,
|
|
6577
6579
|
headerHeight,
|
|
6578
|
-
taskListWidth
|
|
6580
|
+
taskListWidth,
|
|
6579
6581
|
onTasksChange,
|
|
6580
6582
|
selectedTaskId,
|
|
6581
6583
|
onTaskSelect,
|
|
@@ -7148,7 +7150,8 @@ var TaskList = ({
|
|
|
7148
7150
|
() => resolvedColumns.reduce((sum, col) => sum + (col.width ?? 120), 0),
|
|
7149
7151
|
[resolvedColumns]
|
|
7150
7152
|
);
|
|
7151
|
-
const
|
|
7153
|
+
const requestedTaskListWidth = taskListWidth ?? Math.min(MIN_TASK_LIST_WIDTH, resolvedColumnWidthTotal);
|
|
7154
|
+
const effectiveTaskListWidth = Math.max(requestedTaskListWidth, resolvedColumnWidthTotal);
|
|
7152
7155
|
const tableHeaderHeight = headerHeight + 1;
|
|
7153
7156
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7154
7157
|
"div",
|
|
@@ -9630,6 +9633,40 @@ function TaskGanttChartInner(props, ref) {
|
|
|
9630
9633
|
const handleTaskSelect = (0, import_react15.useCallback)((taskId) => {
|
|
9631
9634
|
setSelectedTaskId(taskId);
|
|
9632
9635
|
}, []);
|
|
9636
|
+
const hoveredRowElementsRef = (0, import_react15.useRef)([]);
|
|
9637
|
+
const clearHoveredRows = (0, import_react15.useCallback)(() => {
|
|
9638
|
+
for (const element of hoveredRowElementsRef.current) {
|
|
9639
|
+
element.classList.remove("gantt-tl-row-hovered", "gantt-tr-row-hovered");
|
|
9640
|
+
}
|
|
9641
|
+
hoveredRowElementsRef.current = [];
|
|
9642
|
+
}, []);
|
|
9643
|
+
const applyHoveredRows = (0, import_react15.useCallback)((taskId) => {
|
|
9644
|
+
const root = scrollContentRef.current;
|
|
9645
|
+
if (!root) return;
|
|
9646
|
+
clearHoveredRows();
|
|
9647
|
+
const nextHoveredRows = Array.from(
|
|
9648
|
+
root.querySelectorAll("[data-gantt-task-row-id]")
|
|
9649
|
+
).filter((element) => element.dataset.ganttTaskRowId === taskId);
|
|
9650
|
+
for (const element of nextHoveredRows) {
|
|
9651
|
+
if (element.classList.contains("gantt-tl-row")) {
|
|
9652
|
+
element.classList.add("gantt-tl-row-hovered");
|
|
9653
|
+
}
|
|
9654
|
+
if (element.classList.contains("gantt-tr-row")) {
|
|
9655
|
+
element.classList.add("gantt-tr-row-hovered");
|
|
9656
|
+
}
|
|
9657
|
+
}
|
|
9658
|
+
hoveredRowElementsRef.current = nextHoveredRows;
|
|
9659
|
+
}, [clearHoveredRows]);
|
|
9660
|
+
const handleSharedRowHover = (0, import_react15.useCallback)((event) => {
|
|
9661
|
+
const target = event.target;
|
|
9662
|
+
const row = target.closest("[data-gantt-task-row-id]");
|
|
9663
|
+
const taskId = row?.dataset.ganttTaskRowId;
|
|
9664
|
+
if (!taskId) return;
|
|
9665
|
+
if (hoveredRowElementsRef.current.some((element) => element.dataset.ganttTaskRowId === taskId)) {
|
|
9666
|
+
return;
|
|
9667
|
+
}
|
|
9668
|
+
applyHoveredRows(taskId);
|
|
9669
|
+
}, [applyHoveredRows]);
|
|
9633
9670
|
const handleToggleCollapse = externalOnToggleCollapse ?? (0, import_react15.useCallback)((parentId) => {
|
|
9634
9671
|
setInternalCollapsedParentIds((prev) => {
|
|
9635
9672
|
const next = new Set(prev);
|
|
@@ -9862,157 +9899,166 @@ function TaskGanttChartInner(props, ref) {
|
|
|
9862
9899
|
className: "gantt-scrollContainer",
|
|
9863
9900
|
style: { height: containerHeight ?? "auto", cursor: "grab" },
|
|
9864
9901
|
onMouseDown: handlePanStart,
|
|
9865
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9903
|
+
"div",
|
|
9904
|
+
{
|
|
9905
|
+
ref: scrollContentRef,
|
|
9906
|
+
className: "gantt-scrollContent",
|
|
9907
|
+
onMouseOver: handleSharedRowHover,
|
|
9908
|
+
onMouseLeave: clearHoveredRows,
|
|
9909
|
+
children: [
|
|
9910
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9911
|
+
TaskList,
|
|
9912
|
+
{
|
|
9913
|
+
tasks: normalizedTasks,
|
|
9914
|
+
rowHeight,
|
|
9915
|
+
headerHeight,
|
|
9916
|
+
taskListWidth,
|
|
9917
|
+
onTasksChange: handleTaskChange,
|
|
9918
|
+
selectedTaskId: selectedTaskId ?? void 0,
|
|
9919
|
+
onTaskSelect: handleTaskSelect,
|
|
9920
|
+
show: showTaskList,
|
|
9921
|
+
hasRightShadow: taskListHasRightShadow,
|
|
9922
|
+
disableTaskNameEditing,
|
|
9923
|
+
disableDependencyEditing,
|
|
9924
|
+
onScrollToTask: scrollToTask,
|
|
9925
|
+
onSelectedChipChange: setSelectedChip,
|
|
9926
|
+
onAdd,
|
|
9927
|
+
onDelete: handleDelete,
|
|
9928
|
+
onInsertAfter: handleInsertAfter,
|
|
9929
|
+
onReorder: handleReorder,
|
|
9930
|
+
editingTaskId,
|
|
9931
|
+
enableAddTask,
|
|
9932
|
+
defaultTaskDurationDays,
|
|
9933
|
+
collapsedParentIds,
|
|
9934
|
+
onToggleCollapse: handleToggleCollapse,
|
|
9935
|
+
onPromoteTask: onPromoteTask ?? handlePromoteTask,
|
|
9936
|
+
onDemoteTask: onDemoteTask ?? handleDemoteTask,
|
|
9937
|
+
onUngroupTask: onUngroupTask ?? handleUngroupTask,
|
|
9938
|
+
highlightedTaskIds: taskListHighlightedTaskIds,
|
|
9939
|
+
customDays,
|
|
9940
|
+
isWeekend: isWeekend3,
|
|
9941
|
+
businessDays,
|
|
9942
|
+
filterMode,
|
|
9943
|
+
filteredTaskIds: matchedTaskIds,
|
|
9944
|
+
isFilterActive: !!taskFilter,
|
|
9945
|
+
additionalColumns,
|
|
9946
|
+
hiddenTaskListColumns,
|
|
9947
|
+
taskListMenuCommands
|
|
9948
|
+
}
|
|
9949
|
+
),
|
|
9950
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9951
|
+
"div",
|
|
9952
|
+
{
|
|
9953
|
+
className: showChart ? "gantt-chartSurface" : "gantt-chartSurface gantt-chart-hidden",
|
|
9954
|
+
style: { minWidth: `${gridWidth}px`, flex: 1, display: showChart ? void 0 : "none" },
|
|
9955
|
+
children: [
|
|
9956
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9957
|
+
"div",
|
|
9919
9958
|
{
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9959
|
+
className: "gantt-stickyHeader",
|
|
9960
|
+
style: { width: `${gridWidth}px`, height: `${timelineHeaderHeight}px` },
|
|
9961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9962
|
+
TimeScaleHeader_default,
|
|
9963
|
+
{
|
|
9964
|
+
days: dateRange,
|
|
9965
|
+
dayWidth,
|
|
9966
|
+
headerHeight,
|
|
9967
|
+
viewMode,
|
|
9968
|
+
isCustomWeekend
|
|
9969
|
+
}
|
|
9970
|
+
)
|
|
9925
9971
|
}
|
|
9926
|
-
)
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
position: "relative",
|
|
9935
|
-
width: `${gridWidth}px`
|
|
9936
|
-
},
|
|
9937
|
-
children: [
|
|
9938
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9939
|
-
GridBackground_default,
|
|
9940
|
-
{
|
|
9941
|
-
dateRange,
|
|
9942
|
-
dayWidth,
|
|
9943
|
-
totalHeight: totalGridHeight,
|
|
9944
|
-
viewMode,
|
|
9945
|
-
isCustomWeekend
|
|
9946
|
-
}
|
|
9947
|
-
),
|
|
9948
|
-
todayInRange && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TodayIndicator_default, { monthStart, dayWidth }),
|
|
9949
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9950
|
-
DependencyLines_default,
|
|
9951
|
-
{
|
|
9952
|
-
tasks: previewVisibleTasks,
|
|
9953
|
-
allTasks: previewNormalizedTasks,
|
|
9954
|
-
collapsedParentIds,
|
|
9955
|
-
monthStart,
|
|
9956
|
-
dayWidth,
|
|
9957
|
-
rowHeight,
|
|
9958
|
-
gridWidth,
|
|
9959
|
-
dragOverrides: dependencyOverrides,
|
|
9960
|
-
selectedDep: selectedChip,
|
|
9961
|
-
businessDays,
|
|
9962
|
-
weekendPredicate: isCustomWeekend
|
|
9963
|
-
}
|
|
9964
|
-
),
|
|
9965
|
-
dragGuideLines && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9966
|
-
DragGuideLines_default,
|
|
9967
|
-
{
|
|
9968
|
-
isDragging: dragGuideLines.isDragging,
|
|
9969
|
-
dragMode: dragGuideLines.dragMode,
|
|
9970
|
-
left: dragGuideLines.left,
|
|
9971
|
-
width: dragGuideLines.width,
|
|
9972
|
-
totalHeight: totalGridHeight
|
|
9973
|
-
}
|
|
9974
|
-
),
|
|
9975
|
-
visibleTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9976
|
-
TaskRow_default,
|
|
9977
|
-
{
|
|
9978
|
-
task,
|
|
9979
|
-
monthStart,
|
|
9980
|
-
dayWidth,
|
|
9981
|
-
rowHeight,
|
|
9982
|
-
onTasksChange: handleTaskChange,
|
|
9983
|
-
onDragStateChange: (state) => {
|
|
9984
|
-
if (state.isDragging) {
|
|
9985
|
-
setDragGuideLines(state);
|
|
9986
|
-
setDraggedTaskOverride({ taskId: task.id, left: state.left, width: state.width });
|
|
9987
|
-
} else {
|
|
9988
|
-
setDragGuideLines(null);
|
|
9989
|
-
setDraggedTaskOverride(null);
|
|
9990
|
-
}
|
|
9991
|
-
},
|
|
9992
|
-
rowIndex: index,
|
|
9993
|
-
allTasks: normalizedTasks,
|
|
9994
|
-
enableAutoSchedule: enableAutoSchedule ?? false,
|
|
9995
|
-
disableConstraints: disableConstraints ?? false,
|
|
9996
|
-
overridePosition: cascadeOverrides.get(task.id),
|
|
9997
|
-
onCascadeProgress: handleCascadeProgress,
|
|
9998
|
-
onCascade: handleCascade,
|
|
9999
|
-
highlightExpiredTasks,
|
|
10000
|
-
showBaseline,
|
|
10001
|
-
isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
|
|
10002
|
-
businessDays,
|
|
10003
|
-
customDays,
|
|
10004
|
-
isWeekend: isWeekend3,
|
|
10005
|
-
disableTaskDrag
|
|
9972
|
+
),
|
|
9973
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9974
|
+
"div",
|
|
9975
|
+
{
|
|
9976
|
+
className: "gantt-taskArea",
|
|
9977
|
+
style: {
|
|
9978
|
+
position: "relative",
|
|
9979
|
+
width: `${gridWidth}px`
|
|
10006
9980
|
},
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
9981
|
+
children: [
|
|
9982
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9983
|
+
GridBackground_default,
|
|
9984
|
+
{
|
|
9985
|
+
dateRange,
|
|
9986
|
+
dayWidth,
|
|
9987
|
+
totalHeight: totalGridHeight,
|
|
9988
|
+
viewMode,
|
|
9989
|
+
isCustomWeekend
|
|
9990
|
+
}
|
|
9991
|
+
),
|
|
9992
|
+
todayInRange && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TodayIndicator_default, { monthStart, dayWidth }),
|
|
9993
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9994
|
+
DependencyLines_default,
|
|
9995
|
+
{
|
|
9996
|
+
tasks: previewVisibleTasks,
|
|
9997
|
+
allTasks: previewNormalizedTasks,
|
|
9998
|
+
collapsedParentIds,
|
|
9999
|
+
monthStart,
|
|
10000
|
+
dayWidth,
|
|
10001
|
+
rowHeight,
|
|
10002
|
+
gridWidth,
|
|
10003
|
+
dragOverrides: dependencyOverrides,
|
|
10004
|
+
selectedDep: selectedChip,
|
|
10005
|
+
businessDays,
|
|
10006
|
+
weekendPredicate: isCustomWeekend
|
|
10007
|
+
}
|
|
10008
|
+
),
|
|
10009
|
+
dragGuideLines && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10010
|
+
DragGuideLines_default,
|
|
10011
|
+
{
|
|
10012
|
+
isDragging: dragGuideLines.isDragging,
|
|
10013
|
+
dragMode: dragGuideLines.dragMode,
|
|
10014
|
+
left: dragGuideLines.left,
|
|
10015
|
+
width: dragGuideLines.width,
|
|
10016
|
+
totalHeight: totalGridHeight
|
|
10017
|
+
}
|
|
10018
|
+
),
|
|
10019
|
+
visibleTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
10020
|
+
TaskRow_default,
|
|
10021
|
+
{
|
|
10022
|
+
task,
|
|
10023
|
+
monthStart,
|
|
10024
|
+
dayWidth,
|
|
10025
|
+
rowHeight,
|
|
10026
|
+
onTasksChange: handleTaskChange,
|
|
10027
|
+
onDragStateChange: (state) => {
|
|
10028
|
+
if (state.isDragging) {
|
|
10029
|
+
setDragGuideLines(state);
|
|
10030
|
+
setDraggedTaskOverride({ taskId: task.id, left: state.left, width: state.width });
|
|
10031
|
+
} else {
|
|
10032
|
+
setDragGuideLines(null);
|
|
10033
|
+
setDraggedTaskOverride(null);
|
|
10034
|
+
}
|
|
10035
|
+
},
|
|
10036
|
+
rowIndex: index,
|
|
10037
|
+
allTasks: normalizedTasks,
|
|
10038
|
+
enableAutoSchedule: enableAutoSchedule ?? false,
|
|
10039
|
+
disableConstraints: disableConstraints ?? false,
|
|
10040
|
+
overridePosition: cascadeOverrides.get(task.id),
|
|
10041
|
+
onCascadeProgress: handleCascadeProgress,
|
|
10042
|
+
onCascade: handleCascade,
|
|
10043
|
+
highlightExpiredTasks,
|
|
10044
|
+
showBaseline,
|
|
10045
|
+
isFilterMatch: filterMode === "highlight" ? matchedTaskIds.has(task.id) : false,
|
|
10046
|
+
businessDays,
|
|
10047
|
+
customDays,
|
|
10048
|
+
isWeekend: isWeekend3,
|
|
10049
|
+
disableTaskDrag
|
|
10050
|
+
},
|
|
10051
|
+
task.id
|
|
10052
|
+
))
|
|
10053
|
+
]
|
|
10054
|
+
}
|
|
10055
|
+
)
|
|
10056
|
+
]
|
|
10057
|
+
}
|
|
10058
|
+
)
|
|
10059
|
+
]
|
|
10060
|
+
}
|
|
10061
|
+
)
|
|
10016
10062
|
}
|
|
10017
10063
|
) });
|
|
10018
10064
|
}
|