gantt-lib 0.121.0 → 0.121.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.js +73 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -23
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +11 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10820,12 +10820,38 @@ function areRangeBoundsEqual(left, right) {
|
|
|
10820
10820
|
if (!left || !right) return false;
|
|
10821
10821
|
return left.fromDateIndex === right.fromDateIndex && left.toDateIndex === right.toDateIndex && left.fromSubrowIndex === right.fromSubrowIndex && left.toSubrowIndex === right.toSubrowIndex;
|
|
10822
10822
|
}
|
|
10823
|
+
function getRenderedDateWindow(dateRange, renderedDateIndices) {
|
|
10824
|
+
if (dateRange.length === 0 || renderedDateIndices.length === 0) {
|
|
10825
|
+
return {
|
|
10826
|
+
startIndex: 0,
|
|
10827
|
+
days: []
|
|
10828
|
+
};
|
|
10829
|
+
}
|
|
10830
|
+
let startIndex = dateRange.length - 1;
|
|
10831
|
+
let endIndex = 0;
|
|
10832
|
+
for (const dateIndex of renderedDateIndices) {
|
|
10833
|
+
if (dateIndex < 0 || dateIndex >= dateRange.length) continue;
|
|
10834
|
+
startIndex = Math.min(startIndex, dateIndex);
|
|
10835
|
+
endIndex = Math.max(endIndex, dateIndex);
|
|
10836
|
+
}
|
|
10837
|
+
if (startIndex > endIndex) {
|
|
10838
|
+
return {
|
|
10839
|
+
startIndex: 0,
|
|
10840
|
+
days: []
|
|
10841
|
+
};
|
|
10842
|
+
}
|
|
10843
|
+
return {
|
|
10844
|
+
startIndex,
|
|
10845
|
+
days: dateRange.slice(startIndex, endIndex + 1)
|
|
10846
|
+
};
|
|
10847
|
+
}
|
|
10823
10848
|
function PlanFactRowInner({
|
|
10824
10849
|
task,
|
|
10825
10850
|
rowIndex,
|
|
10826
10851
|
dateRange,
|
|
10827
10852
|
dateKeys,
|
|
10828
10853
|
renderedDateIndices,
|
|
10854
|
+
totalWidth,
|
|
10829
10855
|
rowHeight,
|
|
10830
10856
|
subrowHeight,
|
|
10831
10857
|
dayWidth,
|
|
@@ -10868,8 +10894,8 @@ function PlanFactRowInner({
|
|
|
10868
10894
|
),
|
|
10869
10895
|
style: {
|
|
10870
10896
|
top: `${rowIndex * rowHeight}px`,
|
|
10897
|
+
width: `${totalWidth}px`,
|
|
10871
10898
|
height: `${rowHeight}px`,
|
|
10872
|
-
gridTemplateColumns: `repeat(${dateRange.length}, ${dayWidth}px)`,
|
|
10873
10899
|
["--gantt-pf-today-left"]: todayDateIndex !== void 0 && todayDateIndex >= 0 ? `${todayDateIndex * dayWidth}px` : void 0
|
|
10874
10900
|
},
|
|
10875
10901
|
onClick: () => onTaskSelect?.(task.id),
|
|
@@ -10918,8 +10944,9 @@ function PlanFactRowInner({
|
|
|
10918
10944
|
isParent && "gantt-pf-cell-readonly"
|
|
10919
10945
|
),
|
|
10920
10946
|
style: {
|
|
10921
|
-
|
|
10922
|
-
|
|
10947
|
+
left: `${dateIndex * dayWidth}px`,
|
|
10948
|
+
top: kind === "plan" ? 0 : `${subrowHeight}px`,
|
|
10949
|
+
width: `${dayWidth}px`,
|
|
10923
10950
|
height: `${subrowHeight}px`
|
|
10924
10951
|
},
|
|
10925
10952
|
tabIndex: isParent ? -1 : 0,
|
|
@@ -11056,7 +11083,7 @@ function PlanFactRowInner({
|
|
|
11056
11083
|
function arePlanFactRowsEqual(previous, next) {
|
|
11057
11084
|
const previousRangeTouchesRow = doesRangeTouchRow(previous.renderedRangeBounds, previous.rowIndex);
|
|
11058
11085
|
const nextRangeTouchesRow = doesRangeTouchRow(next.renderedRangeBounds, next.rowIndex);
|
|
11059
|
-
return previous.task === next.task && previous.rowIndex === next.rowIndex && previous.dateRange === next.dateRange && previous.dateKeys === next.dateKeys && previous.renderedDateIndices === next.renderedDateIndices && previous.rowHeight === next.rowHeight && previous.subrowHeight === next.subrowHeight && previous.dayWidth === next.dayWidth && previous.plannedRange === next.plannedRange && previous.todayDateIndex === next.todayDateIndex && previous.isParent === next.isParent && previous.isHighlighted === next.isHighlighted && previous.selectedTaskId === previous.task.id === (next.selectedTaskId === next.task.id) && getCellSignatureForTask(previous.activeCell, previous.task.id) === getCellSignatureForTask(next.activeCell, next.task.id) && getEditingCellSignatureForTask(previous.editingCell, previous.task.id) === getEditingCellSignatureForTask(next.editingCell, next.task.id) && getRangeAnchorSignatureForTask(previous.selectedRange, previous.task.id) === getRangeAnchorSignatureForTask(next.selectedRange, next.task.id) && previousRangeTouchesRow === nextRangeTouchesRow && (!nextRangeTouchesRow || areRangeBoundsEqual(previous.renderedRangeBounds, next.renderedRangeBounds));
|
|
11086
|
+
return previous.task === next.task && previous.rowIndex === next.rowIndex && previous.dateRange === next.dateRange && previous.dateKeys === next.dateKeys && previous.renderedDateIndices === next.renderedDateIndices && previous.totalWidth === next.totalWidth && previous.rowHeight === next.rowHeight && previous.subrowHeight === next.subrowHeight && previous.dayWidth === next.dayWidth && previous.plannedRange === next.plannedRange && previous.todayDateIndex === next.todayDateIndex && previous.isParent === next.isParent && previous.isHighlighted === next.isHighlighted && previous.selectedTaskId === previous.task.id === (next.selectedTaskId === next.task.id) && getCellSignatureForTask(previous.activeCell, previous.task.id) === getCellSignatureForTask(next.activeCell, next.task.id) && getEditingCellSignatureForTask(previous.editingCell, previous.task.id) === getEditingCellSignatureForTask(next.editingCell, next.task.id) && getRangeAnchorSignatureForTask(previous.selectedRange, previous.task.id) === getRangeAnchorSignatureForTask(next.selectedRange, next.task.id) && previousRangeTouchesRow === nextRangeTouchesRow && (!nextRangeTouchesRow || areRangeBoundsEqual(previous.renderedRangeBounds, next.renderedRangeBounds));
|
|
11060
11087
|
}
|
|
11061
11088
|
var PlanFactRow = import_react17.default.memo(PlanFactRowInner, arePlanFactRowsEqual);
|
|
11062
11089
|
function PlanFactMatrix({
|
|
@@ -11108,6 +11135,10 @@ function PlanFactMatrix({
|
|
|
11108
11135
|
return ids;
|
|
11109
11136
|
}, [allTasks]);
|
|
11110
11137
|
const dateKeys = (0, import_react17.useMemo)(() => dateRange.map(formatDateKey), [dateRange]);
|
|
11138
|
+
const renderedDateWindow = (0, import_react17.useMemo)(
|
|
11139
|
+
() => getRenderedDateWindow(dateRange, renderedDateIndices),
|
|
11140
|
+
[dateRange, renderedDateIndices]
|
|
11141
|
+
);
|
|
11111
11142
|
const dateRangeStartMs = dateRange[0] ? getDateOnlyMs(dateRange[0]) : 0;
|
|
11112
11143
|
const taskIndexById = (0, import_react17.useMemo)(() => {
|
|
11113
11144
|
const indexById = /* @__PURE__ */ new Map();
|
|
@@ -11550,16 +11581,26 @@ function PlanFactMatrix({
|
|
|
11550
11581
|
children: [
|
|
11551
11582
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "gantt-pf-header", style: { width: `${totalWidth}px`, height: `${headerHeight}px` }, children: [
|
|
11552
11583
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
11553
|
-
|
|
11584
|
+
"div",
|
|
11554
11585
|
{
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11586
|
+
className: "gantt-pf-dateWindow",
|
|
11587
|
+
style: {
|
|
11588
|
+
left: `${renderedDateWindow.startIndex * dayWidth}px`,
|
|
11589
|
+
width: `${renderedDateWindow.days.length * dayWidth}px`
|
|
11590
|
+
},
|
|
11591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
11592
|
+
TimeScaleHeader_default,
|
|
11593
|
+
{
|
|
11594
|
+
days: renderedDateWindow.days,
|
|
11595
|
+
dayWidth,
|
|
11596
|
+
headerHeight: headerHeight - 1,
|
|
11597
|
+
viewMode: "day",
|
|
11598
|
+
isCustomWeekend
|
|
11599
|
+
}
|
|
11600
|
+
)
|
|
11560
11601
|
}
|
|
11561
11602
|
),
|
|
11562
|
-
todayDateIndex !== void 0 && todayDateIndex >=
|
|
11603
|
+
todayDateIndex !== void 0 && todayDateIndex >= renderedDateWindow.startIndex && todayDateIndex < renderedDateWindow.startIndex + renderedDateWindow.days.length && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
11563
11604
|
"span",
|
|
11564
11605
|
{
|
|
11565
11606
|
className: "gantt-pf-headerTodayLine",
|
|
@@ -11594,14 +11635,24 @@ function PlanFactMatrix({
|
|
|
11594
11635
|
},
|
|
11595
11636
|
children: [
|
|
11596
11637
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
11597
|
-
|
|
11638
|
+
"div",
|
|
11598
11639
|
{
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11640
|
+
className: "gantt-pf-dateWindow gantt-pf-dateWindow-body",
|
|
11641
|
+
style: {
|
|
11642
|
+
left: `${renderedDateWindow.startIndex * dayWidth}px`,
|
|
11643
|
+
width: `${renderedDateWindow.days.length * dayWidth}px`
|
|
11644
|
+
},
|
|
11645
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
11646
|
+
GridBackground_default,
|
|
11647
|
+
{
|
|
11648
|
+
dateRange: renderedDateWindow.days,
|
|
11649
|
+
dayWidth,
|
|
11650
|
+
totalHeight: tasks.length * rowHeight,
|
|
11651
|
+
viewMode: "day",
|
|
11652
|
+
isCustomWeekend,
|
|
11653
|
+
showGridLines: false
|
|
11654
|
+
}
|
|
11655
|
+
)
|
|
11605
11656
|
}
|
|
11606
11657
|
),
|
|
11607
11658
|
renderedRowIndices.map((rowIndex) => {
|
|
@@ -11617,6 +11668,7 @@ function PlanFactMatrix({
|
|
|
11617
11668
|
dateRange,
|
|
11618
11669
|
dateKeys,
|
|
11619
11670
|
renderedDateIndices,
|
|
11671
|
+
totalWidth,
|
|
11620
11672
|
rowHeight,
|
|
11621
11673
|
subrowHeight,
|
|
11622
11674
|
dayWidth,
|
|
@@ -12084,6 +12136,7 @@ var SCROLL_TO_ROW_CONTEXT_ROWS = 2;
|
|
|
12084
12136
|
var TASK_ROW_OVERSCAN = 8;
|
|
12085
12137
|
var PLAN_FACT_COLUMN_OVERSCAN = 24;
|
|
12086
12138
|
var PLAN_FACT_COLUMN_WINDOW_STEP = 14;
|
|
12139
|
+
var DEFAULT_INITIAL_VIEWPORT_HEIGHT = 768;
|
|
12087
12140
|
function getInitialScrollViewportHeight(containerHeight, headerHeight) {
|
|
12088
12141
|
if (containerHeight === void 0) {
|
|
12089
12142
|
return 0;
|
|
@@ -12091,18 +12144,15 @@ function getInitialScrollViewportHeight(containerHeight, headerHeight) {
|
|
|
12091
12144
|
if (typeof containerHeight === "number") {
|
|
12092
12145
|
return Math.max(0, containerHeight - headerHeight);
|
|
12093
12146
|
}
|
|
12094
|
-
if (typeof window === "undefined") {
|
|
12095
|
-
return 0;
|
|
12096
|
-
}
|
|
12097
12147
|
const dynamicViewportMatch = containerHeight.match(/^([\d.]+)dvh$/);
|
|
12098
12148
|
if (dynamicViewportMatch) {
|
|
12099
12149
|
const ratio = Number(dynamicViewportMatch[1]);
|
|
12100
|
-
return Number.isFinite(ratio) ? Math.max(0,
|
|
12150
|
+
return Number.isFinite(ratio) ? Math.max(0, DEFAULT_INITIAL_VIEWPORT_HEIGHT * (ratio / 100) - headerHeight) : 0;
|
|
12101
12151
|
}
|
|
12102
12152
|
const viewportMatch = containerHeight.match(/^([\d.]+)vh$/);
|
|
12103
12153
|
if (viewportMatch) {
|
|
12104
12154
|
const ratio = Number(viewportMatch[1]);
|
|
12105
|
-
return Number.isFinite(ratio) ? Math.max(0,
|
|
12155
|
+
return Number.isFinite(ratio) ? Math.max(0, DEFAULT_INITIAL_VIEWPORT_HEIGHT * (ratio / 100) - headerHeight) : 0;
|
|
12106
12156
|
}
|
|
12107
12157
|
const pixelMatch = containerHeight.match(/^([\d.]+)px$/);
|
|
12108
12158
|
if (pixelMatch) {
|