gantt-lib 0.102.0 → 0.103.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.css.map +1 -1
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +106 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -23
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +30 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -343,6 +343,8 @@ interface TableMatrixColumn<TTask extends Task = Task> {
|
|
|
343
343
|
width?: number | 'auto';
|
|
344
344
|
minWidth?: number;
|
|
345
345
|
maxWidth?: number;
|
|
346
|
+
periodStartDate?: string | Date;
|
|
347
|
+
periodEndDate?: string | Date;
|
|
346
348
|
groupId?: string;
|
|
347
349
|
align?: 'left' | 'center' | 'right';
|
|
348
350
|
className?: string;
|
|
@@ -357,6 +359,18 @@ interface TableMatrixCellClickContext<TTask extends Task = Task> {
|
|
|
357
359
|
columnIndex: number;
|
|
358
360
|
event: React$1.MouseEvent<HTMLDivElement>;
|
|
359
361
|
}
|
|
362
|
+
interface TableMatrixDateOverlay<TTask extends Task = Task> {
|
|
363
|
+
date: string | Date;
|
|
364
|
+
className?: string;
|
|
365
|
+
color?: string;
|
|
366
|
+
edgeColor?: string;
|
|
367
|
+
shouldRender?: (context: {
|
|
368
|
+
task: TTask;
|
|
369
|
+
column: TableMatrixColumn<TTask>;
|
|
370
|
+
rowIndex: number;
|
|
371
|
+
columnIndex: number;
|
|
372
|
+
}) => boolean;
|
|
373
|
+
}
|
|
360
374
|
interface TableMatrixProps<TTask extends Task = Task> {
|
|
361
375
|
tasks: TTask[];
|
|
362
376
|
allTasks?: TTask[];
|
|
@@ -368,10 +382,11 @@ interface TableMatrixProps<TTask extends Task = Task> {
|
|
|
368
382
|
selectedTaskId?: string | null;
|
|
369
383
|
onTaskSelect?: (taskId: string | null) => void;
|
|
370
384
|
onCellClick?: (context: TableMatrixCellClickContext<TTask>) => void;
|
|
385
|
+
dateOverlay?: TableMatrixDateOverlay<TTask> | false;
|
|
371
386
|
highlightedTaskIds?: Set<string>;
|
|
372
387
|
filterMode?: 'highlight' | 'hide';
|
|
373
388
|
}
|
|
374
|
-
declare function TableMatrix<TTask extends Task = Task>({ tasks, allTasks, columns, columnGroups, rowHeight, headerHeight, bodyMinHeight, selectedTaskId, onTaskSelect, onCellClick, highlightedTaskIds, filterMode, }: TableMatrixProps<TTask>): react_jsx_runtime.JSX.Element;
|
|
389
|
+
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;
|
|
375
390
|
|
|
376
391
|
/**
|
|
377
392
|
* Task data structure for Gantt chart
|
|
@@ -582,6 +597,8 @@ interface TableMatrixModeProps<TTask extends Task = Task> extends TaskChartShare
|
|
|
582
597
|
matrixColumnGroups?: Array<TableMatrixColumnGroup>;
|
|
583
598
|
/** Called when any data cell in the right-side matrix is clicked. */
|
|
584
599
|
onMatrixCellClick?: (context: TableMatrixCellClickContext<TTask>) => void;
|
|
600
|
+
/** Optional actual-date overlay rendered under matrix cell content for date-ranged columns. */
|
|
601
|
+
matrixDateOverlay?: TableMatrixDateOverlay<TTask> | false;
|
|
585
602
|
}
|
|
586
603
|
type GanttChartProps<TTask extends Task = Task, TItem extends ResourceTimelineItem = ResourceTimelineItem> = GanttModeProps<TTask> | TableMatrixModeProps<TTask> | ResourcePlannerChartProps<TItem>;
|
|
587
604
|
interface ExportToPdfOptions {
|
|
@@ -1380,4 +1397,4 @@ interface VisibleReorderPosition {
|
|
|
1380
1397
|
*/
|
|
1381
1398
|
declare function getVisibleReorderPosition(orderedTasks: TaskLike[], visibleTasks: TaskLike[], movedTaskId: string, originVisibleIndex: number, dropVisibleIndex: number): VisibleReorderPosition | null;
|
|
1382
1399
|
|
|
1383
|
-
export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
|
|
1400
|
+
export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixDateOverlay, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
|
package/dist/index.d.ts
CHANGED
|
@@ -343,6 +343,8 @@ interface TableMatrixColumn<TTask extends Task = Task> {
|
|
|
343
343
|
width?: number | 'auto';
|
|
344
344
|
minWidth?: number;
|
|
345
345
|
maxWidth?: number;
|
|
346
|
+
periodStartDate?: string | Date;
|
|
347
|
+
periodEndDate?: string | Date;
|
|
346
348
|
groupId?: string;
|
|
347
349
|
align?: 'left' | 'center' | 'right';
|
|
348
350
|
className?: string;
|
|
@@ -357,6 +359,18 @@ interface TableMatrixCellClickContext<TTask extends Task = Task> {
|
|
|
357
359
|
columnIndex: number;
|
|
358
360
|
event: React$1.MouseEvent<HTMLDivElement>;
|
|
359
361
|
}
|
|
362
|
+
interface TableMatrixDateOverlay<TTask extends Task = Task> {
|
|
363
|
+
date: string | Date;
|
|
364
|
+
className?: string;
|
|
365
|
+
color?: string;
|
|
366
|
+
edgeColor?: string;
|
|
367
|
+
shouldRender?: (context: {
|
|
368
|
+
task: TTask;
|
|
369
|
+
column: TableMatrixColumn<TTask>;
|
|
370
|
+
rowIndex: number;
|
|
371
|
+
columnIndex: number;
|
|
372
|
+
}) => boolean;
|
|
373
|
+
}
|
|
360
374
|
interface TableMatrixProps<TTask extends Task = Task> {
|
|
361
375
|
tasks: TTask[];
|
|
362
376
|
allTasks?: TTask[];
|
|
@@ -368,10 +382,11 @@ interface TableMatrixProps<TTask extends Task = Task> {
|
|
|
368
382
|
selectedTaskId?: string | null;
|
|
369
383
|
onTaskSelect?: (taskId: string | null) => void;
|
|
370
384
|
onCellClick?: (context: TableMatrixCellClickContext<TTask>) => void;
|
|
385
|
+
dateOverlay?: TableMatrixDateOverlay<TTask> | false;
|
|
371
386
|
highlightedTaskIds?: Set<string>;
|
|
372
387
|
filterMode?: 'highlight' | 'hide';
|
|
373
388
|
}
|
|
374
|
-
declare function TableMatrix<TTask extends Task = Task>({ tasks, allTasks, columns, columnGroups, rowHeight, headerHeight, bodyMinHeight, selectedTaskId, onTaskSelect, onCellClick, highlightedTaskIds, filterMode, }: TableMatrixProps<TTask>): react_jsx_runtime.JSX.Element;
|
|
389
|
+
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;
|
|
375
390
|
|
|
376
391
|
/**
|
|
377
392
|
* Task data structure for Gantt chart
|
|
@@ -582,6 +597,8 @@ interface TableMatrixModeProps<TTask extends Task = Task> extends TaskChartShare
|
|
|
582
597
|
matrixColumnGroups?: Array<TableMatrixColumnGroup>;
|
|
583
598
|
/** Called when any data cell in the right-side matrix is clicked. */
|
|
584
599
|
onMatrixCellClick?: (context: TableMatrixCellClickContext<TTask>) => void;
|
|
600
|
+
/** Optional actual-date overlay rendered under matrix cell content for date-ranged columns. */
|
|
601
|
+
matrixDateOverlay?: TableMatrixDateOverlay<TTask> | false;
|
|
585
602
|
}
|
|
586
603
|
type GanttChartProps<TTask extends Task = Task, TItem extends ResourceTimelineItem = ResourceTimelineItem> = GanttModeProps<TTask> | TableMatrixModeProps<TTask> | ResourcePlannerChartProps<TItem>;
|
|
587
604
|
interface ExportToPdfOptions {
|
|
@@ -1380,4 +1397,4 @@ interface VisibleReorderPosition {
|
|
|
1380
1397
|
*/
|
|
1381
1398
|
declare function getVisibleReorderPosition(orderedTasks: TaskLike[], visibleTasks: TaskLike[], movedTaskId: string, originVisibleIndex: number, dropVisibleIndex: number): VisibleReorderPosition | null;
|
|
1382
1399
|
|
|
1383
|
-
export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
|
|
1400
|
+
export { type BuiltInTaskListColumnId, Button, type ButtonProps, Calendar, type CalendarProps, type CustomDayConfig, type CustomDayPredicateConfig, DatePicker, type DatePickerProps, DragGuideLines, type ExportToPdfHeaderOptions, type ExportToPdfOptions, GanttChart, type GanttChartHandle, type GanttChartProps, type GanttModeProps, GridBackground, Input, type InputProps, type MonthBlock, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, ResourcePlannerChartProps, ResourceTimelineChart, type ResourceTimelineConflictRange, ResourceTimelineItem, type ResourceTimelineLayoutDiagnostic, type ResourceTimelineLayoutItem, type ResourceTimelineLayoutOptions, type ResourceTimelineLayoutResult, type ResourceTimelineLayoutRow, ResourceTimelineResource, TableMatrix, type TableMatrixCellClickContext, type TableMatrixColumn, type TableMatrixColumnGroup, type TableMatrixDateOverlay, type TableMatrixModeProps, type Task, TaskDateChangeMode, type TaskDependency, TaskList, type TaskListColumn, type TaskListColumnContext, type TaskListColumnId, type TaskListMenuCommand, type TaskListProps, type TaskPredicate, TaskRow, TimeScaleHeader, TodayIndicator, ValidationResult, type VisibleReorderPosition, type WeekBlock, type WeekSpan, type WithoutDepsOptions, type YearSpan, addBusinessDays, and, calculateBezierPath, calculateDependencyPath, calculateGridLines, calculateGridWidth, calculateMilestoneConnectionBounds, calculateMilestoneGeometry, calculateMonthGridLines, calculateOrthogonalPath, calculateTaskBar, calculateWeekGridLines, calculateWeekendBlocks, clampDateRangeForIncomingFS, createCustomDayPredicate, createDateKey, detectEdgeZone, expired, flattenHierarchy, formatDateLabel, formatDateRangeLabel, getBusinessDaysCount, getCursorForPosition, getDayOffset, getMonthBlocks, getMonthDays, getMonthSpans, getMultiMonthDays, getVisibleReorderPosition, getWeekBlocks, getWeekSpans, getYearSpans, inDateRange, isTaskExpired, isToday, isWeekend, layoutResourceTimelineItems, nameContains, normalizeHierarchyTasks, normalizeTaskDates, not, or, parseUTCDate, pixelsToDate, progressInRange, resolveDateRangeFromPixels, resolveTaskHorizontalGeometry, subtractBusinessDays, useTaskDrag, withoutDeps };
|
package/dist/index.js
CHANGED
|
@@ -717,13 +717,13 @@ function computeParentProgress(parentId, tasks) {
|
|
|
717
717
|
if (children.length === 0) {
|
|
718
718
|
return 0;
|
|
719
719
|
}
|
|
720
|
-
const
|
|
720
|
+
const DAY_MS5 = 24 * 60 * 60 * 1e3;
|
|
721
721
|
let totalWeight = 0;
|
|
722
722
|
let weightedSum = 0;
|
|
723
723
|
for (const child of children) {
|
|
724
724
|
const start = new Date(child.startDate).getTime();
|
|
725
725
|
const end = new Date(child.endDate).getTime();
|
|
726
|
-
const duration = (end - start +
|
|
726
|
+
const duration = (end - start + DAY_MS5) / DAY_MS5;
|
|
727
727
|
const progress = child.progress ?? 0;
|
|
728
728
|
totalWeight += duration;
|
|
729
729
|
weightedSum += duration * progress;
|
|
@@ -817,10 +817,10 @@ function buildTaskRangeFromStart(startDate, duration, businessDays = false, week
|
|
|
817
817
|
end: parseDateOnly(addBusinessDays(normalizedStart, duration, weekendPredicate))
|
|
818
818
|
};
|
|
819
819
|
}
|
|
820
|
-
const
|
|
820
|
+
const DAY_MS5 = 24 * 60 * 60 * 1e3;
|
|
821
821
|
return {
|
|
822
822
|
start: normalizedStart,
|
|
823
|
-
end: new Date(normalizedStart.getTime() + (Math.max(1, duration) - 1) *
|
|
823
|
+
end: new Date(normalizedStart.getTime() + (Math.max(1, duration) - 1) * DAY_MS5)
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
826
|
function buildTaskRangeFromEnd(endDate, duration, businessDays = false, weekendPredicate, snapDirection = -1) {
|
|
@@ -831,9 +831,9 @@ function buildTaskRangeFromEnd(endDate, duration, businessDays = false, weekendP
|
|
|
831
831
|
end: normalizedEnd
|
|
832
832
|
};
|
|
833
833
|
}
|
|
834
|
-
const
|
|
834
|
+
const DAY_MS5 = 24 * 60 * 60 * 1e3;
|
|
835
835
|
return {
|
|
836
|
-
start: new Date(normalizedEnd.getTime() - (Math.max(1, duration) - 1) *
|
|
836
|
+
start: new Date(normalizedEnd.getTime() - (Math.max(1, duration) - 1) * DAY_MS5),
|
|
837
837
|
end: normalizedEnd
|
|
838
838
|
};
|
|
839
839
|
}
|
|
@@ -9398,6 +9398,7 @@ var import_react15 = require("react");
|
|
|
9398
9398
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
9399
9399
|
var AUTO_COLUMN_MIN_WIDTH = 72;
|
|
9400
9400
|
var AUTO_COLUMN_MAX_WIDTH = 180;
|
|
9401
|
+
var DAY_MS4 = 24 * 60 * 60 * 1e3;
|
|
9401
9402
|
function joinClasses(...values) {
|
|
9402
9403
|
return values.filter(Boolean).join(" ");
|
|
9403
9404
|
}
|
|
@@ -9410,6 +9411,40 @@ function getAutoMinWidth(column) {
|
|
|
9410
9411
|
function getAutoMaxWidth(column) {
|
|
9411
9412
|
return column.maxWidth ?? AUTO_COLUMN_MAX_WIDTH;
|
|
9412
9413
|
}
|
|
9414
|
+
function parseDateOnlyMs(value) {
|
|
9415
|
+
if (value instanceof Date) {
|
|
9416
|
+
return Date.UTC(value.getFullYear(), value.getMonth(), value.getDate());
|
|
9417
|
+
}
|
|
9418
|
+
const [year, month, day] = value.split("T")[0].split("-").map(Number);
|
|
9419
|
+
if (!year || !month || !day) {
|
|
9420
|
+
return Number.NaN;
|
|
9421
|
+
}
|
|
9422
|
+
return Date.UTC(year, month - 1, day);
|
|
9423
|
+
}
|
|
9424
|
+
function getOverlayWidthPercent(column, overlayDateMs) {
|
|
9425
|
+
if (overlayDateMs === null || column.periodStartDate === void 0 || column.periodEndDate === void 0) {
|
|
9426
|
+
return 0;
|
|
9427
|
+
}
|
|
9428
|
+
const startMs = parseDateOnlyMs(column.periodStartDate);
|
|
9429
|
+
const endMs = parseDateOnlyMs(column.periodEndDate);
|
|
9430
|
+
if (!Number.isFinite(startMs) || !Number.isFinite(endMs) || endMs < startMs || overlayDateMs < startMs) {
|
|
9431
|
+
return 0;
|
|
9432
|
+
}
|
|
9433
|
+
if (overlayDateMs >= endMs) {
|
|
9434
|
+
return 100;
|
|
9435
|
+
}
|
|
9436
|
+
const totalDays = Math.max(1, Math.round((endMs - startMs) / DAY_MS4) + 1);
|
|
9437
|
+
const elapsedDays = Math.min(totalDays, Math.max(0, Math.round((overlayDateMs - startMs) / DAY_MS4) + 1));
|
|
9438
|
+
return elapsedDays / totalDays * 100;
|
|
9439
|
+
}
|
|
9440
|
+
function isOverlayDateInColumn(column, overlayDateMs) {
|
|
9441
|
+
if (overlayDateMs === null || column.periodStartDate === void 0 || column.periodEndDate === void 0) {
|
|
9442
|
+
return false;
|
|
9443
|
+
}
|
|
9444
|
+
const startMs = parseDateOnlyMs(column.periodStartDate);
|
|
9445
|
+
const endMs = parseDateOnlyMs(column.periodEndDate);
|
|
9446
|
+
return Number.isFinite(startMs) && Number.isFinite(endMs) && startMs <= overlayDateMs && overlayDateMs <= endMs;
|
|
9447
|
+
}
|
|
9413
9448
|
function TableMatrix({
|
|
9414
9449
|
tasks,
|
|
9415
9450
|
allTasks = tasks,
|
|
@@ -9421,6 +9456,7 @@ function TableMatrix({
|
|
|
9421
9456
|
selectedTaskId,
|
|
9422
9457
|
onTaskSelect,
|
|
9423
9458
|
onCellClick,
|
|
9459
|
+
dateOverlay,
|
|
9424
9460
|
highlightedTaskIds,
|
|
9425
9461
|
filterMode = "highlight"
|
|
9426
9462
|
}) {
|
|
@@ -9474,6 +9510,10 @@ function TableMatrix({
|
|
|
9474
9510
|
() => resolvedColumnWidths.reduce((sum, width) => sum + width, 0),
|
|
9475
9511
|
[resolvedColumnWidths]
|
|
9476
9512
|
);
|
|
9513
|
+
const overlayDateMs = (0, import_react15.useMemo)(
|
|
9514
|
+
() => dateOverlay ? parseDateOnlyMs(dateOverlay.date) : null,
|
|
9515
|
+
[dateOverlay]
|
|
9516
|
+
);
|
|
9477
9517
|
const hasGroupHeader = (0, import_react15.useMemo)(
|
|
9478
9518
|
() => columns.some((column) => !!column.groupId) || (columnGroups?.length ?? 0) > 0,
|
|
9479
9519
|
[columnGroups, columns]
|
|
@@ -9484,7 +9524,7 @@ function TableMatrix({
|
|
|
9484
9524
|
);
|
|
9485
9525
|
const headerSpans = (0, import_react15.useMemo)(() => {
|
|
9486
9526
|
if (!hasGroupHeader) return [];
|
|
9487
|
-
if (
|
|
9527
|
+
if (columnGroups?.some((group) => typeof group.width === "number")) {
|
|
9488
9528
|
return columnGroups.map((group) => ({
|
|
9489
9529
|
id: group.id,
|
|
9490
9530
|
header: group.header,
|
|
@@ -9572,14 +9612,14 @@ function TableMatrix({
|
|
|
9572
9612
|
{
|
|
9573
9613
|
className: "gantt-mx-headerRow gantt-mx-headerGroupRow",
|
|
9574
9614
|
style: {
|
|
9575
|
-
gridTemplateColumns:
|
|
9615
|
+
gridTemplateColumns: headerSpans.map((span) => `${span.width ?? 0}px`).join(" "),
|
|
9576
9616
|
height: `${topRowHeight}px`
|
|
9577
9617
|
},
|
|
9578
9618
|
children: headerSpans.map((span) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9579
9619
|
"div",
|
|
9580
9620
|
{
|
|
9581
9621
|
className: joinClasses("gantt-mx-groupCell", span.className),
|
|
9582
|
-
style:
|
|
9622
|
+
style: span.columnSpan !== void 0 ? { gridColumn: `span ${span.columnSpan}` } : void 0,
|
|
9583
9623
|
children: span.header
|
|
9584
9624
|
},
|
|
9585
9625
|
span.id
|
|
@@ -9591,18 +9631,34 @@ function TableMatrix({
|
|
|
9591
9631
|
{
|
|
9592
9632
|
className: "gantt-mx-headerRow",
|
|
9593
9633
|
style: { gridTemplateColumns, height: `${hasGroupHeader ? bottomRowHeight : topRowHeight}px` },
|
|
9594
|
-
children: columns.map((column) =>
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9634
|
+
children: columns.map((column) => {
|
|
9635
|
+
const overlayWidthPercent = getOverlayWidthPercent(column, overlayDateMs);
|
|
9636
|
+
const shouldRenderOverlayEdge = isOverlayDateInColumn(column, overlayDateMs);
|
|
9637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9638
|
+
"div",
|
|
9639
|
+
{
|
|
9640
|
+
className: joinClasses(
|
|
9641
|
+
"gantt-mx-headerCell",
|
|
9642
|
+
column.headerClassName
|
|
9643
|
+
),
|
|
9644
|
+
style: column.minWidth !== void 0 ? { minWidth: `${column.minWidth}px` } : void 0,
|
|
9645
|
+
children: [
|
|
9646
|
+
shouldRenderOverlayEdge && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9647
|
+
"span",
|
|
9648
|
+
{
|
|
9649
|
+
className: "gantt-mx-dateOverlayEdge",
|
|
9650
|
+
style: {
|
|
9651
|
+
left: `${overlayWidthPercent}%`,
|
|
9652
|
+
background: dateOverlay && dateOverlay.edgeColor ? dateOverlay.edgeColor : void 0
|
|
9653
|
+
}
|
|
9654
|
+
}
|
|
9655
|
+
),
|
|
9656
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "gantt-mx-headerContent", children: column.header })
|
|
9657
|
+
]
|
|
9658
|
+
},
|
|
9659
|
+
column.id
|
|
9660
|
+
);
|
|
9661
|
+
})
|
|
9606
9662
|
}
|
|
9607
9663
|
)
|
|
9608
9664
|
] }),
|
|
@@ -9642,7 +9698,10 @@ function TableMatrix({
|
|
|
9642
9698
|
onClick: () => onTaskSelect?.(task.id),
|
|
9643
9699
|
children: columns.map((column, columnIndex) => {
|
|
9644
9700
|
const resolvedCellClassName = typeof column.cellClassName === "function" ? column.cellClassName(task) : column.cellClassName;
|
|
9645
|
-
|
|
9701
|
+
const overlayWidthPercent = getOverlayWidthPercent(column, overlayDateMs);
|
|
9702
|
+
const shouldRenderOverlay = overlayWidthPercent > 0 && (!dateOverlay || !dateOverlay.shouldRender || dateOverlay.shouldRender({ task, column, rowIndex: index, columnIndex }));
|
|
9703
|
+
const shouldRenderOverlayEdge = isOverlayDateInColumn(column, overlayDateMs);
|
|
9704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9646
9705
|
"div",
|
|
9647
9706
|
{
|
|
9648
9707
|
className: joinClasses(
|
|
@@ -9656,7 +9715,29 @@ function TableMatrix({
|
|
|
9656
9715
|
onClick: (event) => {
|
|
9657
9716
|
onCellClick?.({ task, column, rowIndex: index, columnIndex, event });
|
|
9658
9717
|
},
|
|
9659
|
-
children:
|
|
9718
|
+
children: [
|
|
9719
|
+
shouldRenderOverlay && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9720
|
+
"span",
|
|
9721
|
+
{
|
|
9722
|
+
className: joinClasses("gantt-mx-dateOverlay", dateOverlay && dateOverlay.className),
|
|
9723
|
+
style: {
|
|
9724
|
+
width: `${overlayWidthPercent}%`,
|
|
9725
|
+
background: dateOverlay && dateOverlay.color ? dateOverlay.color : void 0
|
|
9726
|
+
}
|
|
9727
|
+
}
|
|
9728
|
+
),
|
|
9729
|
+
shouldRenderOverlayEdge && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9730
|
+
"span",
|
|
9731
|
+
{
|
|
9732
|
+
className: "gantt-mx-dateOverlayEdge",
|
|
9733
|
+
style: {
|
|
9734
|
+
left: `${overlayWidthPercent}%`,
|
|
9735
|
+
background: dateOverlay && dateOverlay.edgeColor ? dateOverlay.edgeColor : void 0
|
|
9736
|
+
}
|
|
9737
|
+
}
|
|
9738
|
+
),
|
|
9739
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "gantt-mx-cellContent", children: column.renderCell(task) })
|
|
9740
|
+
]
|
|
9660
9741
|
},
|
|
9661
9742
|
`${task.id}:${column.id}`
|
|
9662
9743
|
);
|
|
@@ -10075,6 +10156,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
10075
10156
|
const matrixColumns = isTableMatrixMode ? props.matrixColumns : [];
|
|
10076
10157
|
const matrixColumnGroups = isTableMatrixMode ? props.matrixColumnGroups : void 0;
|
|
10077
10158
|
const onMatrixCellClick = isTableMatrixMode ? props.onMatrixCellClick : void 0;
|
|
10159
|
+
const matrixDateOverlay = isTableMatrixMode ? props.matrixDateOverlay : void 0;
|
|
10078
10160
|
const containerRef = (0, import_react16.useRef)(null);
|
|
10079
10161
|
const scrollContainerRef = (0, import_react16.useRef)(null);
|
|
10080
10162
|
const scrollContentRef = (0, import_react16.useRef)(null);
|
|
@@ -10757,6 +10839,7 @@ function TaskGanttChartInner(props, ref) {
|
|
|
10757
10839
|
selectedTaskId,
|
|
10758
10840
|
onTaskSelect: handleTaskSelect,
|
|
10759
10841
|
onCellClick: onMatrixCellClick,
|
|
10842
|
+
dateOverlay: matrixDateOverlay,
|
|
10760
10843
|
highlightedTaskIds: taskListHighlightedTaskIds,
|
|
10761
10844
|
filterMode
|
|
10762
10845
|
}
|