gantt-lib 0.120.0 → 0.121.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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +69 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -391,8 +391,9 @@ interface TableMatrixProps<TTask extends Task = Task> {
|
|
|
391
391
|
dateOverlay?: TableMatrixDateOverlay<TTask> | false;
|
|
392
392
|
highlightedTaskIds?: Set<string>;
|
|
393
393
|
filterMode?: 'highlight' | 'hide';
|
|
394
|
+
visibleRowIndices?: number[];
|
|
394
395
|
}
|
|
395
|
-
declare function TableMatrix<TTask extends Task = Task>({ tasks, allTasks, columns, columnGroups, rowHeight, headerHeight, bodyMinHeight, selectedTaskId, onTaskSelect, onCellClick, dateOverlay, highlightedTaskIds, filterMode, }: TableMatrixProps<TTask>): react_jsx_runtime.JSX.Element;
|
|
396
|
+
declare function TableMatrix<TTask extends Task = Task>({ tasks, allTasks, columns, columnGroups, rowHeight, headerHeight, bodyMinHeight, selectedTaskId, onTaskSelect, onCellClick, dateOverlay, highlightedTaskIds, filterMode, visibleRowIndices, }: TableMatrixProps<TTask>): react_jsx_runtime.JSX.Element;
|
|
396
397
|
|
|
397
398
|
type PlanFactCellKind = 'plan' | 'fact';
|
|
398
399
|
interface PlanFactCellCommitContext<TTask extends Task = Task> {
|
package/dist/index.d.ts
CHANGED
|
@@ -391,8 +391,9 @@ interface TableMatrixProps<TTask extends Task = Task> {
|
|
|
391
391
|
dateOverlay?: TableMatrixDateOverlay<TTask> | false;
|
|
392
392
|
highlightedTaskIds?: Set<string>;
|
|
393
393
|
filterMode?: 'highlight' | 'hide';
|
|
394
|
+
visibleRowIndices?: number[];
|
|
394
395
|
}
|
|
395
|
-
declare function TableMatrix<TTask extends Task = Task>({ tasks, allTasks, columns, columnGroups, rowHeight, headerHeight, bodyMinHeight, selectedTaskId, onTaskSelect, onCellClick, dateOverlay, highlightedTaskIds, filterMode, }: TableMatrixProps<TTask>): react_jsx_runtime.JSX.Element;
|
|
396
|
+
declare function TableMatrix<TTask extends Task = Task>({ tasks, allTasks, columns, columnGroups, rowHeight, headerHeight, bodyMinHeight, selectedTaskId, onTaskSelect, onCellClick, dateOverlay, highlightedTaskIds, filterMode, visibleRowIndices, }: TableMatrixProps<TTask>): react_jsx_runtime.JSX.Element;
|
|
396
397
|
|
|
397
398
|
type PlanFactCellKind = 'plan' | 'fact';
|
|
398
399
|
interface PlanFactCellCommitContext<TTask extends Task = Task> {
|
package/dist/index.js
CHANGED
|
@@ -3600,6 +3600,24 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
3600
3600
|
});
|
|
3601
3601
|
}
|
|
3602
3602
|
}
|
|
3603
|
+
if (allTasks) {
|
|
3604
|
+
for (const task of allTasks) {
|
|
3605
|
+
if (positions.has(task.id)) continue;
|
|
3606
|
+
if (collapsedParentIds.size > 0 && isTaskHidden(task.id, collapsedParentIds, taskMap)) continue;
|
|
3607
|
+
hidden.add(task.id);
|
|
3608
|
+
const override = dragOverrides?.get(task.id);
|
|
3609
|
+
const computed = resolveTaskHorizontalGeometry(task, monthStart, dayWidth, override);
|
|
3610
|
+
const rowIndex = rowIndexByTaskId?.get(task.id);
|
|
3611
|
+
const rowTop = rowIndex !== void 0 ? rowIndex * rowHeight : 0;
|
|
3612
|
+
positions.set(task.id, {
|
|
3613
|
+
left: computed.left,
|
|
3614
|
+
right: computed.right,
|
|
3615
|
+
centerX: computed.centerX,
|
|
3616
|
+
rowTop,
|
|
3617
|
+
isVirtual: false
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3603
3621
|
return { taskPositions: positions, taskIndices: indices, hiddenTaskIds: hidden };
|
|
3604
3622
|
}, [tasks, tasksForPositions, allTasks, collapsedParentIds, monthStart, dayWidth, rowHeight, dragOverrides, rowIndexByTaskId]);
|
|
3605
3623
|
const cycleInfo = (0, import_react7.useMemo)(() => {
|
|
@@ -3612,6 +3630,7 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
3612
3630
|
const tasksForEdges = allTasks ?? tasks;
|
|
3613
3631
|
const taskMap = new Map(tasksForEdges.map((task) => [task.id, task]));
|
|
3614
3632
|
const positionedTaskIds = Array.from(taskPositions.keys());
|
|
3633
|
+
const renderedTaskIdSet = new Set(tasks.map((t) => t.id));
|
|
3615
3634
|
const lines2 = [];
|
|
3616
3635
|
for (const successorId of positionedTaskIds) {
|
|
3617
3636
|
const successorTaskForEdges = taskMap.get(successorId);
|
|
@@ -3642,6 +3661,9 @@ var DependencyLines = import_react7.default.memo(({
|
|
|
3642
3661
|
continue;
|
|
3643
3662
|
}
|
|
3644
3663
|
}
|
|
3664
|
+
if (!renderedTaskIdSet.has(edge.predecessorId) && !renderedTaskIdSet.has(edge.successorId)) {
|
|
3665
|
+
continue;
|
|
3666
|
+
}
|
|
3645
3667
|
const isVirtual = predecessor.isVirtual || successor.isVirtual;
|
|
3646
3668
|
let reverseOrder = false;
|
|
3647
3669
|
if (predecessorIndex !== void 0 && successorIndex !== void 0) {
|
|
@@ -10332,7 +10354,8 @@ function TableMatrix({
|
|
|
10332
10354
|
onCellClick,
|
|
10333
10355
|
dateOverlay,
|
|
10334
10356
|
highlightedTaskIds,
|
|
10335
|
-
filterMode = "highlight"
|
|
10357
|
+
filterMode = "highlight",
|
|
10358
|
+
visibleRowIndices
|
|
10336
10359
|
}) {
|
|
10337
10360
|
const measureRef = (0, import_react16.useRef)(null);
|
|
10338
10361
|
const [measuredAutoWidths, setMeasuredAutoWidths] = (0, import_react16.useState)([]);
|
|
@@ -10459,6 +10482,15 @@ function TableMatrix({
|
|
|
10459
10482
|
}
|
|
10460
10483
|
return depthMap;
|
|
10461
10484
|
}, [allTasks]);
|
|
10485
|
+
const renderedRows = (0, import_react16.useMemo)(() => {
|
|
10486
|
+
if (!visibleRowIndices) {
|
|
10487
|
+
return tasks.map((task, index) => ({ task, index }));
|
|
10488
|
+
}
|
|
10489
|
+
return visibleRowIndices.map((index) => {
|
|
10490
|
+
const task = tasks[index];
|
|
10491
|
+
return task ? { task, index } : null;
|
|
10492
|
+
}).filter((entry) => entry !== null);
|
|
10493
|
+
}, [tasks, visibleRowIndices]);
|
|
10462
10494
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "gantt-mx-root", style: { width: `${totalWidth}px` }, children: [
|
|
10463
10495
|
hasAutoWidthColumns && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: measureRef, className: "gantt-mx-measure", "aria-hidden": "true", children: [
|
|
10464
10496
|
columns.map((column, columnIndex) => typeof column.width === "number" ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -10544,7 +10576,7 @@ function TableMatrix({
|
|
|
10544
10576
|
height: `${tasks.length * rowHeight}px`,
|
|
10545
10577
|
minHeight: bodyMinHeight
|
|
10546
10578
|
},
|
|
10547
|
-
children:
|
|
10579
|
+
children: renderedRows.map(({ task, index }) => {
|
|
10548
10580
|
const isHighlighted = filterMode === "highlight" && !!highlightedTaskIds?.has(task.id);
|
|
10549
10581
|
const isParent = parentTaskIds.has(task.id);
|
|
10550
10582
|
const nestingDepth = nestingDepthMap.get(task.id) ?? 0;
|
|
@@ -12052,6 +12084,33 @@ var SCROLL_TO_ROW_CONTEXT_ROWS = 2;
|
|
|
12052
12084
|
var TASK_ROW_OVERSCAN = 8;
|
|
12053
12085
|
var PLAN_FACT_COLUMN_OVERSCAN = 24;
|
|
12054
12086
|
var PLAN_FACT_COLUMN_WINDOW_STEP = 14;
|
|
12087
|
+
function getInitialScrollViewportHeight(containerHeight, headerHeight) {
|
|
12088
|
+
if (containerHeight === void 0) {
|
|
12089
|
+
return 0;
|
|
12090
|
+
}
|
|
12091
|
+
if (typeof containerHeight === "number") {
|
|
12092
|
+
return Math.max(0, containerHeight - headerHeight);
|
|
12093
|
+
}
|
|
12094
|
+
if (typeof window === "undefined") {
|
|
12095
|
+
return 0;
|
|
12096
|
+
}
|
|
12097
|
+
const dynamicViewportMatch = containerHeight.match(/^([\d.]+)dvh$/);
|
|
12098
|
+
if (dynamicViewportMatch) {
|
|
12099
|
+
const ratio = Number(dynamicViewportMatch[1]);
|
|
12100
|
+
return Number.isFinite(ratio) ? Math.max(0, window.innerHeight * (ratio / 100) - headerHeight) : 0;
|
|
12101
|
+
}
|
|
12102
|
+
const viewportMatch = containerHeight.match(/^([\d.]+)vh$/);
|
|
12103
|
+
if (viewportMatch) {
|
|
12104
|
+
const ratio = Number(viewportMatch[1]);
|
|
12105
|
+
return Number.isFinite(ratio) ? Math.max(0, window.innerHeight * (ratio / 100) - headerHeight) : 0;
|
|
12106
|
+
}
|
|
12107
|
+
const pixelMatch = containerHeight.match(/^([\d.]+)px$/);
|
|
12108
|
+
if (pixelMatch) {
|
|
12109
|
+
const height = Number(pixelMatch[1]);
|
|
12110
|
+
return Number.isFinite(height) ? Math.max(0, height - headerHeight) : 0;
|
|
12111
|
+
}
|
|
12112
|
+
return 0;
|
|
12113
|
+
}
|
|
12055
12114
|
function waitForNextPaint2(win) {
|
|
12056
12115
|
return new Promise((resolve) => {
|
|
12057
12116
|
if (typeof win.requestAnimationFrame === "function") {
|
|
@@ -12235,7 +12294,10 @@ function TaskGanttChartInner(props, ref) {
|
|
|
12235
12294
|
const [selectedTaskId, setSelectedTaskId] = (0, import_react18.useState)(null);
|
|
12236
12295
|
const [taskListHasRightShadow, setTaskListHasRightShadow] = (0, import_react18.useState)(false);
|
|
12237
12296
|
const [internalTaskDateChangeMode, setInternalTaskDateChangeMode] = (0, import_react18.useState)("preserve-duration");
|
|
12238
|
-
const [scrollViewport, setScrollViewport] = (0, import_react18.useState)(
|
|
12297
|
+
const [scrollViewport, setScrollViewport] = (0, import_react18.useState)(() => ({
|
|
12298
|
+
scrollTop: 0,
|
|
12299
|
+
viewportHeight: getInitialScrollViewportHeight(containerHeight, headerHeight + 1)
|
|
12300
|
+
}));
|
|
12239
12301
|
const [forceFullRenderForPrint, setForceFullRenderForPrint] = (0, import_react18.useState)(false);
|
|
12240
12302
|
const [planFactDateWindow, setPlanFactDateWindow] = (0, import_react18.useState)(null);
|
|
12241
12303
|
const [selectedChip, setSelectedChip] = (0, import_react18.useState)(null);
|
|
@@ -12384,7 +12446,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
12384
12446
|
(previous) => previous === nextHasRightShadow ? previous : nextHasRightShadow
|
|
12385
12447
|
);
|
|
12386
12448
|
setScrollViewport(
|
|
12387
|
-
(previous) => previous.scrollTop === nextScrollTop && previous.viewportHeight === nextViewportHeight ? previous : { scrollTop: nextScrollTop, viewportHeight: nextViewportHeight }
|
|
12449
|
+
(previous) => previous.viewportHeight > 0 && nextViewportHeight === 0 ? { scrollTop: nextScrollTop, viewportHeight: previous.viewportHeight } : previous.scrollTop === nextScrollTop && previous.viewportHeight === nextViewportHeight ? previous : { scrollTop: nextScrollTop, viewportHeight: nextViewportHeight }
|
|
12388
12450
|
);
|
|
12389
12451
|
setPlanFactDateWindow((previous) => {
|
|
12390
12452
|
if (!isPlanFactMode || dateRange.length === 0 || nextViewportWidth <= 0) {
|
|
@@ -13050,7 +13112,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
13050
13112
|
onDelete: handleDelete,
|
|
13051
13113
|
onInsertAfter: handleInsertAfter,
|
|
13052
13114
|
onReorder: handleReorder,
|
|
13053
|
-
disableTaskDrag: disableTaskListReorder,
|
|
13115
|
+
disableTaskDrag: disableTaskDrag || disableTaskListReorder,
|
|
13054
13116
|
editingTaskId,
|
|
13055
13117
|
enableAddTask,
|
|
13056
13118
|
defaultTaskDurationDays,
|
|
@@ -13110,7 +13172,8 @@ function TaskGanttChartInner(props, ref) {
|
|
|
13110
13172
|
onCellClick: onMatrixCellClick,
|
|
13111
13173
|
dateOverlay: matrixDateOverlay,
|
|
13112
13174
|
highlightedTaskIds: taskListHighlightedTaskIds,
|
|
13113
|
-
filterMode
|
|
13175
|
+
filterMode,
|
|
13176
|
+
visibleRowIndices: visibleTaskWindowIndices
|
|
13114
13177
|
}
|
|
13115
13178
|
) : isPlanFactMode ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
13116
13179
|
PlanFactMatrix,
|