gantt-lib 0.24.0 → 0.25.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/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -573,6 +573,8 @@ interface GanttChartProps {
|
|
|
573
573
|
collapsedParentIds?: Set<string>;
|
|
574
574
|
/** Callback when collapse/expand button is clicked (controlled mode) */
|
|
575
575
|
onToggleCollapse?: (parentId: string) => void;
|
|
576
|
+
/** Task IDs to highlight in the task list (for search results) */
|
|
577
|
+
highlightedTaskIds?: Set<string>;
|
|
576
578
|
}
|
|
577
579
|
/**
|
|
578
580
|
* Ref handle type for GanttChart — exposes imperative scroll methods.
|
|
@@ -580,6 +582,7 @@ interface GanttChartProps {
|
|
|
580
582
|
interface GanttChartHandle {
|
|
581
583
|
scrollToToday: () => void;
|
|
582
584
|
scrollToTask: (taskId: string) => void;
|
|
585
|
+
scrollToRow: (taskId: string) => void;
|
|
583
586
|
collapseAll: () => void;
|
|
584
587
|
expandAll: () => void;
|
|
585
588
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -573,6 +573,8 @@ interface GanttChartProps {
|
|
|
573
573
|
collapsedParentIds?: Set<string>;
|
|
574
574
|
/** Callback when collapse/expand button is clicked (controlled mode) */
|
|
575
575
|
onToggleCollapse?: (parentId: string) => void;
|
|
576
|
+
/** Task IDs to highlight in the task list (for search results) */
|
|
577
|
+
highlightedTaskIds?: Set<string>;
|
|
576
578
|
}
|
|
577
579
|
/**
|
|
578
580
|
* Ref handle type for GanttChart — exposes imperative scroll methods.
|
|
@@ -580,6 +582,7 @@ interface GanttChartProps {
|
|
|
580
582
|
interface GanttChartHandle {
|
|
581
583
|
scrollToToday: () => void;
|
|
582
584
|
scrollToTask: (taskId: string) => void;
|
|
585
|
+
scrollToRow: (taskId: string) => void;
|
|
583
586
|
collapseAll: () => void;
|
|
584
587
|
expandAll: () => void;
|
|
585
588
|
}
|
package/dist/index.js
CHANGED
|
@@ -4608,13 +4608,18 @@ var TaskListRow = import_react10.default.memo(
|
|
|
4608
4608
|
}
|
|
4609
4609
|
},
|
|
4610
4610
|
onMouseEnter: () => setHighlightedDependencyIndex(index),
|
|
4611
|
+
onKeyDown: (e) => {
|
|
4612
|
+
if (isAlreadyLinked && (e.key === "Delete" || e.key === "Backspace")) {
|
|
4613
|
+
e.preventDefault();
|
|
4614
|
+
handleSearchRemove(candidate.id);
|
|
4615
|
+
}
|
|
4616
|
+
},
|
|
4611
4617
|
title: label,
|
|
4612
4618
|
children: [
|
|
4613
4619
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "gantt-tl-dep-source-option-label", children: label }),
|
|
4614
4620
|
isAlreadyLinked && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4615
|
-
"
|
|
4621
|
+
"span",
|
|
4616
4622
|
{
|
|
4617
|
-
type: "button",
|
|
4618
4623
|
className: "gantt-tl-dep-source-option-remove",
|
|
4619
4624
|
onClick: (e) => {
|
|
4620
4625
|
e.stopPropagation();
|
|
@@ -5911,6 +5916,7 @@ var TaskList = ({
|
|
|
5911
5916
|
|
|
5912
5917
|
// src/components/GanttChart/GanttChart.tsx
|
|
5913
5918
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5919
|
+
var SCROLL_TO_ROW_CONTEXT_ROWS = 2;
|
|
5914
5920
|
var GanttChart = (0, import_react13.forwardRef)(({
|
|
5915
5921
|
tasks,
|
|
5916
5922
|
dayWidth = 40,
|
|
@@ -5940,7 +5946,8 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
5940
5946
|
businessDays = true,
|
|
5941
5947
|
taskFilter,
|
|
5942
5948
|
collapsedParentIds: externalCollapsedParentIds,
|
|
5943
|
-
onToggleCollapse: externalOnToggleCollapse
|
|
5949
|
+
onToggleCollapse: externalOnToggleCollapse,
|
|
5950
|
+
highlightedTaskIds
|
|
5944
5951
|
}, ref) => {
|
|
5945
5952
|
const scrollContainerRef = (0, import_react13.useRef)(null);
|
|
5946
5953
|
const [selectedTaskId, setSelectedTaskId] = (0, import_react13.useState)(null);
|
|
@@ -5977,6 +5984,14 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
5977
5984
|
if (!taskFilter) return /* @__PURE__ */ new Set();
|
|
5978
5985
|
return new Set(visibleTasks.filter(taskFilter).map((task) => task.id));
|
|
5979
5986
|
}, [visibleTasks, taskFilter]);
|
|
5987
|
+
const taskListHighlightedTaskIds = (0, import_react13.useMemo)(() => {
|
|
5988
|
+
if ((!highlightedTaskIds || highlightedTaskIds.size === 0) && matchedTaskIds.size === 0) {
|
|
5989
|
+
return /* @__PURE__ */ new Set();
|
|
5990
|
+
}
|
|
5991
|
+
const mergedHighlightedTaskIds = new Set(highlightedTaskIds ?? []);
|
|
5992
|
+
matchedTaskIds.forEach((taskId) => mergedHighlightedTaskIds.add(taskId));
|
|
5993
|
+
return mergedHighlightedTaskIds;
|
|
5994
|
+
}, [highlightedTaskIds, matchedTaskIds]);
|
|
5980
5995
|
const totalGridHeight = (0, import_react13.useMemo)(
|
|
5981
5996
|
() => visibleTasks.length * rowHeight,
|
|
5982
5997
|
[visibleTasks.length, rowHeight]
|
|
@@ -6046,6 +6061,18 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
6046
6061
|
const scrollLeft = Math.round(taskOffset - dayWidth * 2);
|
|
6047
6062
|
container.scrollTo({ left: Math.max(0, scrollLeft), behavior: "smooth" });
|
|
6048
6063
|
}, [tasks, dateRange, dayWidth]);
|
|
6064
|
+
const scrollToRow = (0, import_react13.useCallback)((taskId) => {
|
|
6065
|
+
const container = scrollContainerRef.current;
|
|
6066
|
+
if (!container) return;
|
|
6067
|
+
const task = tasks.find((t) => t.id === taskId);
|
|
6068
|
+
if (!task) return;
|
|
6069
|
+
const rowIndex = visibleTasks.findIndex((visibleTask) => visibleTask.id === task.id);
|
|
6070
|
+
if (rowIndex === -1) return;
|
|
6071
|
+
const paddedRowIndex = Math.max(0, rowIndex - SCROLL_TO_ROW_CONTEXT_ROWS);
|
|
6072
|
+
const scrollTop = Math.max(0, rowHeight * paddedRowIndex);
|
|
6073
|
+
setSelectedTaskId(taskId);
|
|
6074
|
+
container.scrollTo({ top: scrollTop, behavior: "smooth" });
|
|
6075
|
+
}, [tasks, visibleTasks, rowHeight]);
|
|
6049
6076
|
const [dragGuideLines, setDragGuideLines] = (0, import_react13.useState)(null);
|
|
6050
6077
|
const [draggedTaskOverride, setDraggedTaskOverride] = (0, import_react13.useState)(null);
|
|
6051
6078
|
const [previewTasksById, setPreviewTasksById] = (0, import_react13.useState)(/* @__PURE__ */ new Map());
|
|
@@ -6211,10 +6238,11 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
6211
6238
|
() => ({
|
|
6212
6239
|
scrollToToday,
|
|
6213
6240
|
scrollToTask,
|
|
6241
|
+
scrollToRow,
|
|
6214
6242
|
collapseAll: handleCollapseAll,
|
|
6215
6243
|
expandAll: handleExpandAll
|
|
6216
6244
|
}),
|
|
6217
|
-
[scrollToToday, scrollToTask, handleCollapseAll, handleExpandAll]
|
|
6245
|
+
[scrollToToday, scrollToTask, scrollToRow, handleCollapseAll, handleExpandAll]
|
|
6218
6246
|
);
|
|
6219
6247
|
function getTaskDepth(taskId, tasks2) {
|
|
6220
6248
|
let depth = 0;
|
|
@@ -6376,7 +6404,7 @@ var GanttChart = (0, import_react13.forwardRef)(({
|
|
|
6376
6404
|
onToggleCollapse: handleToggleCollapse,
|
|
6377
6405
|
onPromoteTask: onPromoteTask ?? handlePromoteTask,
|
|
6378
6406
|
onDemoteTask: onDemoteTask ?? handleDemoteTask,
|
|
6379
|
-
highlightedTaskIds:
|
|
6407
|
+
highlightedTaskIds: taskListHighlightedTaskIds,
|
|
6380
6408
|
customDays,
|
|
6381
6409
|
isWeekend: isWeekend3,
|
|
6382
6410
|
businessDays
|