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.mjs
CHANGED
|
@@ -10701,12 +10701,38 @@ function areRangeBoundsEqual(left, right) {
|
|
|
10701
10701
|
if (!left || !right) return false;
|
|
10702
10702
|
return left.fromDateIndex === right.fromDateIndex && left.toDateIndex === right.toDateIndex && left.fromSubrowIndex === right.fromSubrowIndex && left.toSubrowIndex === right.toSubrowIndex;
|
|
10703
10703
|
}
|
|
10704
|
+
function getRenderedDateWindow(dateRange, renderedDateIndices) {
|
|
10705
|
+
if (dateRange.length === 0 || renderedDateIndices.length === 0) {
|
|
10706
|
+
return {
|
|
10707
|
+
startIndex: 0,
|
|
10708
|
+
days: []
|
|
10709
|
+
};
|
|
10710
|
+
}
|
|
10711
|
+
let startIndex = dateRange.length - 1;
|
|
10712
|
+
let endIndex = 0;
|
|
10713
|
+
for (const dateIndex of renderedDateIndices) {
|
|
10714
|
+
if (dateIndex < 0 || dateIndex >= dateRange.length) continue;
|
|
10715
|
+
startIndex = Math.min(startIndex, dateIndex);
|
|
10716
|
+
endIndex = Math.max(endIndex, dateIndex);
|
|
10717
|
+
}
|
|
10718
|
+
if (startIndex > endIndex) {
|
|
10719
|
+
return {
|
|
10720
|
+
startIndex: 0,
|
|
10721
|
+
days: []
|
|
10722
|
+
};
|
|
10723
|
+
}
|
|
10724
|
+
return {
|
|
10725
|
+
startIndex,
|
|
10726
|
+
days: dateRange.slice(startIndex, endIndex + 1)
|
|
10727
|
+
};
|
|
10728
|
+
}
|
|
10704
10729
|
function PlanFactRowInner({
|
|
10705
10730
|
task,
|
|
10706
10731
|
rowIndex,
|
|
10707
10732
|
dateRange,
|
|
10708
10733
|
dateKeys,
|
|
10709
10734
|
renderedDateIndices,
|
|
10735
|
+
totalWidth,
|
|
10710
10736
|
rowHeight,
|
|
10711
10737
|
subrowHeight,
|
|
10712
10738
|
dayWidth,
|
|
@@ -10749,8 +10775,8 @@ function PlanFactRowInner({
|
|
|
10749
10775
|
),
|
|
10750
10776
|
style: {
|
|
10751
10777
|
top: `${rowIndex * rowHeight}px`,
|
|
10778
|
+
width: `${totalWidth}px`,
|
|
10752
10779
|
height: `${rowHeight}px`,
|
|
10753
|
-
gridTemplateColumns: `repeat(${dateRange.length}, ${dayWidth}px)`,
|
|
10754
10780
|
["--gantt-pf-today-left"]: todayDateIndex !== void 0 && todayDateIndex >= 0 ? `${todayDateIndex * dayWidth}px` : void 0
|
|
10755
10781
|
},
|
|
10756
10782
|
onClick: () => onTaskSelect?.(task.id),
|
|
@@ -10799,8 +10825,9 @@ function PlanFactRowInner({
|
|
|
10799
10825
|
isParent && "gantt-pf-cell-readonly"
|
|
10800
10826
|
),
|
|
10801
10827
|
style: {
|
|
10802
|
-
|
|
10803
|
-
|
|
10828
|
+
left: `${dateIndex * dayWidth}px`,
|
|
10829
|
+
top: kind === "plan" ? 0 : `${subrowHeight}px`,
|
|
10830
|
+
width: `${dayWidth}px`,
|
|
10804
10831
|
height: `${subrowHeight}px`
|
|
10805
10832
|
},
|
|
10806
10833
|
tabIndex: isParent ? -1 : 0,
|
|
@@ -10937,7 +10964,7 @@ function PlanFactRowInner({
|
|
|
10937
10964
|
function arePlanFactRowsEqual(previous, next) {
|
|
10938
10965
|
const previousRangeTouchesRow = doesRangeTouchRow(previous.renderedRangeBounds, previous.rowIndex);
|
|
10939
10966
|
const nextRangeTouchesRow = doesRangeTouchRow(next.renderedRangeBounds, next.rowIndex);
|
|
10940
|
-
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));
|
|
10967
|
+
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));
|
|
10941
10968
|
}
|
|
10942
10969
|
var PlanFactRow = React15.memo(PlanFactRowInner, arePlanFactRowsEqual);
|
|
10943
10970
|
function PlanFactMatrix({
|
|
@@ -10989,6 +11016,10 @@ function PlanFactMatrix({
|
|
|
10989
11016
|
return ids;
|
|
10990
11017
|
}, [allTasks]);
|
|
10991
11018
|
const dateKeys = useMemo12(() => dateRange.map(formatDateKey), [dateRange]);
|
|
11019
|
+
const renderedDateWindow = useMemo12(
|
|
11020
|
+
() => getRenderedDateWindow(dateRange, renderedDateIndices),
|
|
11021
|
+
[dateRange, renderedDateIndices]
|
|
11022
|
+
);
|
|
10992
11023
|
const dateRangeStartMs = dateRange[0] ? getDateOnlyMs(dateRange[0]) : 0;
|
|
10993
11024
|
const taskIndexById = useMemo12(() => {
|
|
10994
11025
|
const indexById = /* @__PURE__ */ new Map();
|
|
@@ -11431,16 +11462,26 @@ function PlanFactMatrix({
|
|
|
11431
11462
|
children: [
|
|
11432
11463
|
/* @__PURE__ */ jsxs14("div", { className: "gantt-pf-header", style: { width: `${totalWidth}px`, height: `${headerHeight}px` }, children: [
|
|
11433
11464
|
/* @__PURE__ */ jsx18(
|
|
11434
|
-
|
|
11465
|
+
"div",
|
|
11435
11466
|
{
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11467
|
+
className: "gantt-pf-dateWindow",
|
|
11468
|
+
style: {
|
|
11469
|
+
left: `${renderedDateWindow.startIndex * dayWidth}px`,
|
|
11470
|
+
width: `${renderedDateWindow.days.length * dayWidth}px`
|
|
11471
|
+
},
|
|
11472
|
+
children: /* @__PURE__ */ jsx18(
|
|
11473
|
+
TimeScaleHeader_default,
|
|
11474
|
+
{
|
|
11475
|
+
days: renderedDateWindow.days,
|
|
11476
|
+
dayWidth,
|
|
11477
|
+
headerHeight: headerHeight - 1,
|
|
11478
|
+
viewMode: "day",
|
|
11479
|
+
isCustomWeekend
|
|
11480
|
+
}
|
|
11481
|
+
)
|
|
11441
11482
|
}
|
|
11442
11483
|
),
|
|
11443
|
-
todayDateIndex !== void 0 && todayDateIndex >=
|
|
11484
|
+
todayDateIndex !== void 0 && todayDateIndex >= renderedDateWindow.startIndex && todayDateIndex < renderedDateWindow.startIndex + renderedDateWindow.days.length && /* @__PURE__ */ jsx18(
|
|
11444
11485
|
"span",
|
|
11445
11486
|
{
|
|
11446
11487
|
className: "gantt-pf-headerTodayLine",
|
|
@@ -11475,14 +11516,24 @@ function PlanFactMatrix({
|
|
|
11475
11516
|
},
|
|
11476
11517
|
children: [
|
|
11477
11518
|
/* @__PURE__ */ jsx18(
|
|
11478
|
-
|
|
11519
|
+
"div",
|
|
11479
11520
|
{
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11521
|
+
className: "gantt-pf-dateWindow gantt-pf-dateWindow-body",
|
|
11522
|
+
style: {
|
|
11523
|
+
left: `${renderedDateWindow.startIndex * dayWidth}px`,
|
|
11524
|
+
width: `${renderedDateWindow.days.length * dayWidth}px`
|
|
11525
|
+
},
|
|
11526
|
+
children: /* @__PURE__ */ jsx18(
|
|
11527
|
+
GridBackground_default,
|
|
11528
|
+
{
|
|
11529
|
+
dateRange: renderedDateWindow.days,
|
|
11530
|
+
dayWidth,
|
|
11531
|
+
totalHeight: tasks.length * rowHeight,
|
|
11532
|
+
viewMode: "day",
|
|
11533
|
+
isCustomWeekend,
|
|
11534
|
+
showGridLines: false
|
|
11535
|
+
}
|
|
11536
|
+
)
|
|
11486
11537
|
}
|
|
11487
11538
|
),
|
|
11488
11539
|
renderedRowIndices.map((rowIndex) => {
|
|
@@ -11498,6 +11549,7 @@ function PlanFactMatrix({
|
|
|
11498
11549
|
dateRange,
|
|
11499
11550
|
dateKeys,
|
|
11500
11551
|
renderedDateIndices,
|
|
11552
|
+
totalWidth,
|
|
11501
11553
|
rowHeight,
|
|
11502
11554
|
subrowHeight,
|
|
11503
11555
|
dayWidth,
|
|
@@ -11965,6 +12017,7 @@ var SCROLL_TO_ROW_CONTEXT_ROWS = 2;
|
|
|
11965
12017
|
var TASK_ROW_OVERSCAN = 8;
|
|
11966
12018
|
var PLAN_FACT_COLUMN_OVERSCAN = 24;
|
|
11967
12019
|
var PLAN_FACT_COLUMN_WINDOW_STEP = 14;
|
|
12020
|
+
var DEFAULT_INITIAL_VIEWPORT_HEIGHT = 768;
|
|
11968
12021
|
function getInitialScrollViewportHeight(containerHeight, headerHeight) {
|
|
11969
12022
|
if (containerHeight === void 0) {
|
|
11970
12023
|
return 0;
|
|
@@ -11972,18 +12025,15 @@ function getInitialScrollViewportHeight(containerHeight, headerHeight) {
|
|
|
11972
12025
|
if (typeof containerHeight === "number") {
|
|
11973
12026
|
return Math.max(0, containerHeight - headerHeight);
|
|
11974
12027
|
}
|
|
11975
|
-
if (typeof window === "undefined") {
|
|
11976
|
-
return 0;
|
|
11977
|
-
}
|
|
11978
12028
|
const dynamicViewportMatch = containerHeight.match(/^([\d.]+)dvh$/);
|
|
11979
12029
|
if (dynamicViewportMatch) {
|
|
11980
12030
|
const ratio = Number(dynamicViewportMatch[1]);
|
|
11981
|
-
return Number.isFinite(ratio) ? Math.max(0,
|
|
12031
|
+
return Number.isFinite(ratio) ? Math.max(0, DEFAULT_INITIAL_VIEWPORT_HEIGHT * (ratio / 100) - headerHeight) : 0;
|
|
11982
12032
|
}
|
|
11983
12033
|
const viewportMatch = containerHeight.match(/^([\d.]+)vh$/);
|
|
11984
12034
|
if (viewportMatch) {
|
|
11985
12035
|
const ratio = Number(viewportMatch[1]);
|
|
11986
|
-
return Number.isFinite(ratio) ? Math.max(0,
|
|
12036
|
+
return Number.isFinite(ratio) ? Math.max(0, DEFAULT_INITIAL_VIEWPORT_HEIGHT * (ratio / 100) - headerHeight) : 0;
|
|
11987
12037
|
}
|
|
11988
12038
|
const pixelMatch = containerHeight.match(/^([\d.]+)px$/);
|
|
11989
12039
|
if (pixelMatch) {
|