gantt-task-react-powern 0.6.1 → 0.6.3
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/components/gantt/task-gantt-content.d.ts +4 -0
- package/dist/components/grid/grid-body.d.ts +4 -0
- package/dist/components/task-list/task-list-table.d.ts +2 -0
- package/dist/components/task-list/task-list.d.ts +2 -0
- package/dist/index.js +214 -99
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +214 -99
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
2
3
|
|
|
3
4
|
function _extends() {
|
|
4
5
|
_extends = Object.assign || function (target) {
|
|
@@ -423,7 +424,8 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
423
424
|
_ref$taskLabelRendere = _ref.taskLabelRenderer,
|
|
424
425
|
taskLabelRenderer = _ref$taskLabelRendere === void 0 ? function (t) {
|
|
425
426
|
return " " + t.name;
|
|
426
|
-
} : _ref$taskLabelRendere
|
|
427
|
+
} : _ref$taskLabelRendere,
|
|
428
|
+
virtualItems = _ref.virtualItems;
|
|
427
429
|
var toLocaleDateString = useMemo(function () {
|
|
428
430
|
return toLocaleDateStringFactory(locale);
|
|
429
431
|
}, [locale]);
|
|
@@ -444,13 +446,25 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
444
446
|
return hasSelectedAncestor(parentWbs, selectedSet, allTasks);
|
|
445
447
|
};
|
|
446
448
|
|
|
449
|
+
var itemsToRender = virtualItems || tasks.map(function (_, index) {
|
|
450
|
+
return {
|
|
451
|
+
index: index,
|
|
452
|
+
start: index * rowHeight,
|
|
453
|
+
size: rowHeight,
|
|
454
|
+
key: index,
|
|
455
|
+
end: (index + 1) * rowHeight,
|
|
456
|
+
lane: 0,
|
|
457
|
+
measureElement: function measureElement() {}
|
|
458
|
+
};
|
|
459
|
+
});
|
|
447
460
|
return React.createElement("div", {
|
|
448
461
|
className: styles$1.taskListWrapper,
|
|
449
462
|
style: {
|
|
450
463
|
fontFamily: fontFamily,
|
|
451
464
|
fontSize: fontSize
|
|
452
465
|
}
|
|
453
|
-
},
|
|
466
|
+
}, itemsToRender.map(function (vi) {
|
|
467
|
+
var t = tasks[vi.index];
|
|
454
468
|
var expanderSymbol = "";
|
|
455
469
|
|
|
456
470
|
if (!(leafTaskIds.has(t.id) || t.type === "milestone")) {
|
|
@@ -464,6 +478,17 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
464
478
|
var isSelected = selectedTasks.includes(t.id);
|
|
465
479
|
var isAncestorSelected = hasSelectedAncestor(t.id, new Set(selectedTasks), tasks);
|
|
466
480
|
return React.createElement("div", {
|
|
481
|
+
key: "" + vi.key,
|
|
482
|
+
"data-index": vi.index,
|
|
483
|
+
style: {
|
|
484
|
+
position: "absolute",
|
|
485
|
+
top: 0,
|
|
486
|
+
left: 0,
|
|
487
|
+
width: "100%",
|
|
488
|
+
height: vi.size + "px",
|
|
489
|
+
transform: "translateY(" + vi.start + "px)"
|
|
490
|
+
}
|
|
491
|
+
}, React.createElement("div", {
|
|
467
492
|
className: t.type === "milestone" ? styles$1.taskListMilestoneRow : scheduleType === "lookAhead" ? styles$1.taskListLookAheadRow : styles$1.taskListTableRow,
|
|
468
493
|
style: {
|
|
469
494
|
height: rowHeight
|
|
@@ -567,7 +592,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
567
592
|
}
|
|
568
593
|
}, React.createElement("div", {
|
|
569
594
|
className: styles$1.taskListText
|
|
570
|
-
}, "\xA0", toLocaleDateString(t.actualEnd, dateTimeOptions))));
|
|
595
|
+
}, "\xA0", toLocaleDateString(t.actualEnd, dateTimeOptions)))));
|
|
571
596
|
}));
|
|
572
597
|
};
|
|
573
598
|
|
|
@@ -759,6 +784,16 @@ var TaskList = function TaskList(_ref) {
|
|
|
759
784
|
|
|
760
785
|
var prevSelectedTasksRef = useRef([]);
|
|
761
786
|
var expandedTasks = useRef([]);
|
|
787
|
+
var virtualizer = useVirtualizer({
|
|
788
|
+
count: tasks.length,
|
|
789
|
+
getScrollElement: function getScrollElement() {
|
|
790
|
+
return horizontalContainerRef.current;
|
|
791
|
+
},
|
|
792
|
+
estimateSize: function estimateSize() {
|
|
793
|
+
return rowHeight;
|
|
794
|
+
},
|
|
795
|
+
overscan: 10
|
|
796
|
+
});
|
|
762
797
|
useEffect(function () {
|
|
763
798
|
if (horizontalContainerRef.current) {
|
|
764
799
|
horizontalContainerRef.current.scrollTop = scrollY;
|
|
@@ -910,8 +945,10 @@ var TaskList = function TaskList(_ref) {
|
|
|
910
945
|
onExpanderClick: onExpanderClick,
|
|
911
946
|
selectedTasks: onMultiSelect ? selectedTasks : undefined,
|
|
912
947
|
onTaskSelect: onMultiSelect ? handleTaskSelect : undefined,
|
|
913
|
-
taskLabelRenderer: taskLabelRenderer
|
|
948
|
+
taskLabelRenderer: taskLabelRenderer,
|
|
949
|
+
virtualItems: virtualizer.getVirtualItems()
|
|
914
950
|
};
|
|
951
|
+
console.debug(virtualizer.getTotalSize());
|
|
915
952
|
return React.createElement("div", {
|
|
916
953
|
ref: taskListRef
|
|
917
954
|
}, React.createElement(TaskListHeader, Object.assign({}, headerProps)), React.createElement("div", {
|
|
@@ -920,7 +957,13 @@ var TaskList = function TaskList(_ref) {
|
|
|
920
957
|
style: ganttHeight ? {
|
|
921
958
|
height: ganttHeight
|
|
922
959
|
} : {}
|
|
923
|
-
}, React.createElement(
|
|
960
|
+
}, React.createElement("div", {
|
|
961
|
+
style: {
|
|
962
|
+
height: virtualizer.getTotalSize() + "px",
|
|
963
|
+
width: "100%",
|
|
964
|
+
position: "relative"
|
|
965
|
+
}
|
|
966
|
+
}, React.createElement(TaskListTable, Object.assign({}, tableProps)))));
|
|
924
967
|
};
|
|
925
968
|
|
|
926
969
|
var styles$4 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","darkerGridRow":"_2M-tt"};
|
|
@@ -934,103 +977,128 @@ var GridBody = function GridBody(_ref) {
|
|
|
934
977
|
columnWidth = _ref.columnWidth,
|
|
935
978
|
todayColor = _ref.todayColor,
|
|
936
979
|
weekendColor = _ref.weekendColor,
|
|
937
|
-
rtl = _ref.rtl
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
y1: 0,
|
|
944
|
-
x2: svgWidth,
|
|
945
|
-
y2: 0,
|
|
946
|
-
className: styles$4.gridRowLine
|
|
947
|
-
})];
|
|
948
|
-
|
|
949
|
-
for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
|
|
950
|
-
var task = _step.value;
|
|
951
|
-
var isDarkerRow = task.type === "milestone";
|
|
952
|
-
gridRows.push(React.createElement("rect", {
|
|
953
|
-
key: "Row" + task.id,
|
|
954
|
-
x: "0",
|
|
955
|
-
y: y,
|
|
956
|
-
width: svgWidth,
|
|
957
|
-
height: rowHeight,
|
|
958
|
-
className: isDarkerRow ? styles$4.darkerGridRow : scheduleType === "lookAhead" ? styles$4.gridRowLookAhead : styles$4.gridRow
|
|
959
|
-
}));
|
|
960
|
-
rowLines.push(React.createElement("line", {
|
|
961
|
-
key: "RowLine" + task.id,
|
|
962
|
-
x: "0",
|
|
963
|
-
y1: y + rowHeight,
|
|
964
|
-
x2: svgWidth,
|
|
965
|
-
y2: y + rowHeight,
|
|
966
|
-
className: styles$4.gridRowLine
|
|
967
|
-
}));
|
|
968
|
-
y += rowHeight;
|
|
969
|
-
}
|
|
970
|
-
|
|
980
|
+
rtl = _ref.rtl,
|
|
981
|
+
_ref$virtualItems = _ref.virtualItems,
|
|
982
|
+
virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
|
|
983
|
+
visibleStartY = _ref.visibleStartY,
|
|
984
|
+
visibleEndY = _ref.visibleEndY;
|
|
985
|
+
var visibleHeight = visibleEndY - visibleStartY;
|
|
971
986
|
var now = new Date();
|
|
972
|
-
var
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
987
|
+
var items = virtualItems.length > 0 ? virtualItems : tasks.map(function (_, i) {
|
|
988
|
+
return {
|
|
989
|
+
index: i,
|
|
990
|
+
start: i * rowHeight,
|
|
991
|
+
end: (i + 1) * rowHeight,
|
|
992
|
+
size: rowHeight,
|
|
993
|
+
key: i
|
|
994
|
+
};
|
|
995
|
+
});
|
|
996
|
+
|
|
997
|
+
var isWeekend = function isWeekend(date) {
|
|
998
|
+
var d = date.getDay();
|
|
999
|
+
return d === 0 || d === 6;
|
|
1000
|
+
};
|
|
976
1001
|
|
|
977
|
-
|
|
1002
|
+
var isTodayColumn = function isTodayColumn(i) {
|
|
978
1003
|
var date = dates[i];
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
}
|
|
1004
|
+
var next = dates[i + 1];
|
|
1005
|
+
if (next && date <= now && next > now) return true;
|
|
1006
|
+
|
|
1007
|
+
if (!next && date <= now) {
|
|
1008
|
+
var step = date.getTime() - dates[i - 1].getTime();
|
|
1009
|
+
var end = addToDate(date, step, "millisecond");
|
|
1010
|
+
return end > now;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
return false;
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
var todayRects = [];
|
|
1017
|
+
var weekendRects = [];
|
|
987
1018
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1019
|
+
for (var i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
|
|
1020
|
+
if (isTodayColumn(i)) {
|
|
1021
|
+
todayRects.push(React.createElement("rect", {
|
|
1022
|
+
key: "today-" + i,
|
|
1023
|
+
x: rtl ? x + columnWidth : x,
|
|
1024
|
+
y: visibleStartY,
|
|
992
1025
|
width: columnWidth,
|
|
993
|
-
height:
|
|
1026
|
+
height: visibleHeight,
|
|
994
1027
|
fill: todayColor
|
|
995
|
-
});
|
|
1028
|
+
}));
|
|
996
1029
|
}
|
|
997
1030
|
|
|
998
|
-
if (
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1031
|
+
if (isWeekend(dates[i])) {
|
|
1032
|
+
weekendRects.push(React.createElement("rect", {
|
|
1033
|
+
key: "weekend-" + i,
|
|
1034
|
+
x: x,
|
|
1035
|
+
y: visibleStartY,
|
|
1002
1036
|
width: columnWidth,
|
|
1003
|
-
height:
|
|
1037
|
+
height: visibleHeight,
|
|
1004
1038
|
fill: weekendColor
|
|
1005
1039
|
}));
|
|
1006
1040
|
}
|
|
1041
|
+
}
|
|
1007
1042
|
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
}
|
|
1043
|
+
var tickLines = dates.map(function (_, i) {
|
|
1044
|
+
return React.createElement("line", {
|
|
1045
|
+
key: "tick-" + i,
|
|
1046
|
+
x1: i * columnWidth,
|
|
1047
|
+
y1: visibleStartY,
|
|
1048
|
+
x2: i * columnWidth,
|
|
1049
|
+
y2: visibleEndY,
|
|
1050
|
+
className: styles$4.gridTick
|
|
1051
|
+
});
|
|
1052
|
+
});
|
|
1053
|
+
var rowBackgrounds = [];
|
|
1054
|
+
var rowLines = [];
|
|
1055
|
+
rowLines.push(React.createElement("line", {
|
|
1056
|
+
key: "top-line",
|
|
1057
|
+
x1: 0,
|
|
1058
|
+
y1: visibleStartY,
|
|
1059
|
+
x2: svgWidth,
|
|
1060
|
+
y2: visibleStartY,
|
|
1061
|
+
className: styles$4.gridRowLine
|
|
1062
|
+
}));
|
|
1017
1063
|
|
|
1018
|
-
|
|
1064
|
+
for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
|
|
1065
|
+
var vi = _step.value;
|
|
1066
|
+
var task = tasks[vi.index];
|
|
1067
|
+
if (!task) break;
|
|
1068
|
+
var y = vi.start;
|
|
1069
|
+
var isMilestone = task.type === "milestone";
|
|
1070
|
+
var rowClass = isMilestone ? styles$4.darkerGridRow : scheduleType === "lookAhead" ? styles$4.gridRowLookAhead : styles$4.gridRow;
|
|
1071
|
+
rowBackgrounds.push(React.createElement("rect", {
|
|
1072
|
+
key: "bg-" + vi.key,
|
|
1073
|
+
x: 0,
|
|
1074
|
+
y: y,
|
|
1075
|
+
width: svgWidth,
|
|
1076
|
+
height: rowHeight,
|
|
1077
|
+
className: rowClass
|
|
1078
|
+
}));
|
|
1079
|
+
rowLines.push(React.createElement("line", {
|
|
1080
|
+
key: "line-" + vi.key,
|
|
1081
|
+
x1: 0,
|
|
1082
|
+
y1: y + rowHeight,
|
|
1083
|
+
x2: svgWidth,
|
|
1084
|
+
y2: y + rowHeight,
|
|
1085
|
+
className: styles$4.gridRowLine
|
|
1086
|
+
}));
|
|
1019
1087
|
}
|
|
1020
1088
|
|
|
1021
1089
|
return React.createElement("g", {
|
|
1022
1090
|
className: "gridBody"
|
|
1023
1091
|
}, React.createElement("g", {
|
|
1024
1092
|
className: "rows"
|
|
1025
|
-
},
|
|
1093
|
+
}, rowBackgrounds), React.createElement("g", {
|
|
1026
1094
|
className: "rowLines"
|
|
1027
1095
|
}, rowLines), React.createElement("g", {
|
|
1028
1096
|
className: "ticks"
|
|
1029
|
-
},
|
|
1097
|
+
}, tickLines), scheduleType === "lookAhead" && React.createElement("g", {
|
|
1030
1098
|
className: "weekend"
|
|
1031
|
-
},
|
|
1099
|
+
}, weekendRects), React.createElement("g", {
|
|
1032
1100
|
className: "today"
|
|
1033
|
-
},
|
|
1101
|
+
}, todayRects));
|
|
1034
1102
|
};
|
|
1035
1103
|
|
|
1036
1104
|
var Grid = function Grid(props) {
|
|
@@ -2463,6 +2531,8 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2463
2531
|
fontFamily = _ref.fontFamily,
|
|
2464
2532
|
fontSize = _ref.fontSize,
|
|
2465
2533
|
rtl = _ref.rtl,
|
|
2534
|
+
_ref$virtualItems = _ref.virtualItems,
|
|
2535
|
+
virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
|
|
2466
2536
|
setGanttEvent = _ref.setGanttEvent,
|
|
2467
2537
|
setFailedTask = _ref.setFailedTask,
|
|
2468
2538
|
setSelectedTask = _ref.setSelectedTask,
|
|
@@ -2470,7 +2540,9 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2470
2540
|
onProgressChange = _ref.onProgressChange,
|
|
2471
2541
|
onDoubleClick = _ref.onDoubleClick,
|
|
2472
2542
|
onClick = _ref.onClick,
|
|
2473
|
-
onDelete = _ref.onDelete
|
|
2543
|
+
onDelete = _ref.onDelete,
|
|
2544
|
+
visibleStartY = _ref.visibleStartY,
|
|
2545
|
+
visibleEndY = _ref.visibleEndY;
|
|
2474
2546
|
var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
|
|
2475
2547
|
|
|
2476
2548
|
var _useState = useState(0),
|
|
@@ -2682,12 +2754,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2682
2754
|
var task = _task.start.getTime() > 0 && _task.end.getTime() > 0 ? _task : undefined;
|
|
2683
2755
|
|
|
2684
2756
|
if (!task) {
|
|
2685
|
-
return [
|
|
2686
|
-
key: _task.id + (isCritical ? "-critical" : "-normal"),
|
|
2687
|
-
style: {
|
|
2688
|
-
height: taskHeight
|
|
2689
|
-
}
|
|
2690
|
-
})];
|
|
2757
|
+
return [];
|
|
2691
2758
|
}
|
|
2692
2759
|
|
|
2693
2760
|
return task.barChildren.map(function (child) {
|
|
@@ -2697,6 +2764,15 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2697
2764
|
var criticalTask = (_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : _task$criticalPathArr.find(function (arrow) {
|
|
2698
2765
|
return arrow.taskId === tasks[child.index].id && (!!arrow.criticalPathType ? arrow.criticalPathType === criticalPathType : !criticalPathType);
|
|
2699
2766
|
});
|
|
2767
|
+
var taskTo = tasks[child.index];
|
|
2768
|
+
var yFrom = task.y + taskHeight / 2;
|
|
2769
|
+
var yTo = taskTo.y + taskHeight / 2;
|
|
2770
|
+
var minY = Math.min(yFrom, yTo);
|
|
2771
|
+
var maxY = Math.max(yFrom, yTo);
|
|
2772
|
+
|
|
2773
|
+
if (maxY < visibleStartY || minY > visibleEndY) {
|
|
2774
|
+
return null;
|
|
2775
|
+
}
|
|
2700
2776
|
|
|
2701
2777
|
if (!!criticalTask === isCritical) {
|
|
2702
2778
|
return React.createElement(Arrow, {
|
|
@@ -2725,34 +2801,44 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2725
2801
|
className: "bar",
|
|
2726
2802
|
fontFamily: fontFamily,
|
|
2727
2803
|
fontSize: fontSize
|
|
2728
|
-
},
|
|
2729
|
-
var
|
|
2804
|
+
}, virtualItems.map(function (vi) {
|
|
2805
|
+
var _task = tasks[vi.index];
|
|
2806
|
+
|
|
2807
|
+
var task = _extends({}, _task, {
|
|
2808
|
+
y: 0
|
|
2809
|
+
});
|
|
2730
2810
|
|
|
2731
2811
|
if (!task && _task.typeInternal === "milestone") {
|
|
2732
|
-
return React.createElement(
|
|
2733
|
-
|
|
2812
|
+
return React.createElement("g", {
|
|
2813
|
+
key: _task.id,
|
|
2814
|
+
transform: "translate(0, " + vi.start + ")"
|
|
2815
|
+
}, React.createElement(Milestone, {
|
|
2816
|
+
task: task,
|
|
2734
2817
|
arrowIndent: arrowIndent,
|
|
2735
2818
|
taskHeight: taskHeight,
|
|
2736
2819
|
isProgressChangeable: false,
|
|
2737
2820
|
isDateChangeable: false,
|
|
2738
2821
|
isDelete: !_task.isDisabled,
|
|
2739
2822
|
onEventStart: handleBarEventStart,
|
|
2740
|
-
key: _task.id,
|
|
2741
2823
|
isSelected: !!selectedTask && _task.id === selectedTask.id,
|
|
2742
2824
|
rtl: rtl
|
|
2743
|
-
});
|
|
2825
|
+
}));
|
|
2744
2826
|
}
|
|
2745
2827
|
|
|
2746
2828
|
if (!task) {
|
|
2747
2829
|
return React.createElement("g", {
|
|
2748
2830
|
key: _task.id,
|
|
2831
|
+
transform: "translate(0, " + vi.start + ")",
|
|
2749
2832
|
style: {
|
|
2750
2833
|
height: taskHeight
|
|
2751
2834
|
}
|
|
2752
2835
|
});
|
|
2753
2836
|
}
|
|
2754
2837
|
|
|
2755
|
-
return React.createElement(
|
|
2838
|
+
return React.createElement("g", {
|
|
2839
|
+
key: task.id,
|
|
2840
|
+
transform: "translate(0, " + vi.start + ")"
|
|
2841
|
+
}, React.createElement(TaskItem, {
|
|
2756
2842
|
task: task,
|
|
2757
2843
|
arrowIndent: arrowIndent,
|
|
2758
2844
|
taskHeight: taskHeight,
|
|
@@ -2760,10 +2846,9 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2760
2846
|
isDateChangeable: !!onDateChange && !task.isDisabled,
|
|
2761
2847
|
isDelete: !task.isDisabled,
|
|
2762
2848
|
onEventStart: handleBarEventStart,
|
|
2763
|
-
key: task.id,
|
|
2764
2849
|
isSelected: !!selectedTask && task.id === selectedTask.id,
|
|
2765
2850
|
rtl: rtl
|
|
2766
|
-
});
|
|
2851
|
+
}));
|
|
2767
2852
|
})));
|
|
2768
2853
|
};
|
|
2769
2854
|
|
|
@@ -2781,9 +2866,24 @@ var TaskGantt = function TaskGantt(_ref) {
|
|
|
2781
2866
|
var verticalGanttContainerRef = useRef(null);
|
|
2782
2867
|
|
|
2783
2868
|
var newBarProps = _extends({}, barProps, {
|
|
2784
|
-
svg: ganttSVGRef
|
|
2869
|
+
svg: ganttSVGRef,
|
|
2870
|
+
ganttHeight: ganttHeight,
|
|
2871
|
+
scrollY: scrollY
|
|
2785
2872
|
});
|
|
2786
2873
|
|
|
2874
|
+
var buffer = barProps.rowHeight * 10;
|
|
2875
|
+
var visibleStartY = scrollY - buffer;
|
|
2876
|
+
var visibleEndY = scrollY + ganttHeight + buffer;
|
|
2877
|
+
var virtualizer = useVirtualizer({
|
|
2878
|
+
count: barProps.tasks.length,
|
|
2879
|
+
getScrollElement: function getScrollElement() {
|
|
2880
|
+
return horizontalContainerRef.current;
|
|
2881
|
+
},
|
|
2882
|
+
estimateSize: function estimateSize() {
|
|
2883
|
+
return barProps.rowHeight;
|
|
2884
|
+
},
|
|
2885
|
+
overscan: 10
|
|
2886
|
+
});
|
|
2787
2887
|
useEffect(function () {
|
|
2788
2888
|
if (horizontalContainerRef.current) {
|
|
2789
2889
|
horizontalContainerRef.current.scrollTop = scrollY;
|
|
@@ -2815,10 +2915,18 @@ var TaskGantt = function TaskGantt(_ref) {
|
|
|
2815
2915
|
}, React.createElement("svg", {
|
|
2816
2916
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2817
2917
|
width: gridProps.svgWidth,
|
|
2818
|
-
height:
|
|
2918
|
+
height: virtualizer.getTotalSize(),
|
|
2819
2919
|
fontFamily: barProps.fontFamily,
|
|
2820
2920
|
ref: ganttSVGRef
|
|
2821
|
-
}, React.createElement(Grid, Object.assign({}, gridProps
|
|
2921
|
+
}, React.createElement(Grid, Object.assign({}, gridProps, {
|
|
2922
|
+
virtualItems: virtualizer.getVirtualItems(),
|
|
2923
|
+
visibleStartY: visibleStartY,
|
|
2924
|
+
visibleEndY: visibleEndY
|
|
2925
|
+
})), React.createElement(TaskGanttContent, Object.assign({}, newBarProps, {
|
|
2926
|
+
visibleStartY: visibleStartY,
|
|
2927
|
+
visibleEndY: visibleEndY,
|
|
2928
|
+
virtualItems: virtualizer.getVirtualItems()
|
|
2929
|
+
})))));
|
|
2822
2930
|
};
|
|
2823
2931
|
|
|
2824
2932
|
var styles$a = {"scrollWrapper":"_2k9Ys","scroll":"_19jgW"};
|
|
@@ -3019,6 +3127,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
3019
3127
|
lastTouchY = _useState14[0],
|
|
3020
3128
|
setLastTouchY = _useState14[1];
|
|
3021
3129
|
|
|
3130
|
+
var buffer = rowHeight * 10;
|
|
3131
|
+
var visibleStartY = scrollY - buffer;
|
|
3132
|
+
var visibleEndY = scrollY + ganttHeight + buffer;
|
|
3022
3133
|
useEffect(function () {
|
|
3023
3134
|
if (scheduleType === "lookAhead" && startDate && endDate) {
|
|
3024
3135
|
setDateSetup({
|
|
@@ -3075,7 +3186,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
3075
3186
|
}
|
|
3076
3187
|
|
|
3077
3188
|
setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
|
|
3078
|
-
}, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl,
|
|
3189
|
+
}, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl, onExpanderClick]);
|
|
3079
3190
|
useEffect(function () {
|
|
3080
3191
|
if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
|
|
3081
3192
|
var dates = dateSetup.dates;
|
|
@@ -3350,7 +3461,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
3350
3461
|
dates: dateSetup.dates,
|
|
3351
3462
|
todayColor: todayColor,
|
|
3352
3463
|
weekendColor: weekendColor,
|
|
3353
|
-
rtl: rtl
|
|
3464
|
+
rtl: rtl,
|
|
3465
|
+
visibleStartY: visibleStartY,
|
|
3466
|
+
visibleEndY: visibleEndY
|
|
3354
3467
|
};
|
|
3355
3468
|
var calendarProps = {
|
|
3356
3469
|
dateSetup: dateSetup,
|
|
@@ -3384,7 +3497,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
3384
3497
|
onProgressChange: onProgressChange,
|
|
3385
3498
|
onDoubleClick: onDoubleClick,
|
|
3386
3499
|
onClick: onClick,
|
|
3387
|
-
onDelete: onDelete
|
|
3500
|
+
onDelete: onDelete,
|
|
3501
|
+
visibleStartY: visibleStartY,
|
|
3502
|
+
visibleEndY: visibleEndY
|
|
3388
3503
|
};
|
|
3389
3504
|
var tableProps = {
|
|
3390
3505
|
rowHeight: rowHeight,
|