@thepocman/gantt-task-react 1.0.25 → 1.0.28
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.
|
@@ -15,5 +15,6 @@ export type GridBodyProps = {
|
|
|
15
15
|
checkIsHoliday: (date: Date, dateExtremity: DateExtremity) => boolean;
|
|
16
16
|
getDate: (index: number) => Date;
|
|
17
17
|
minTaskDate: Date;
|
|
18
|
+
dividerColor: string;
|
|
18
19
|
};
|
|
19
20
|
export declare const GridBody: React.NamedExoticComponent<GridBodyProps>;
|
|
@@ -4923,6 +4923,34 @@ const Calendar = ({
|
|
|
4923
4923
|
}
|
|
4924
4924
|
) });
|
|
4925
4925
|
};
|
|
4926
|
+
const shouldDrawVerticalDivider = (currentDate, previousDate, viewMode, isUnknownDates, columnIndex, startColumnIndex) => {
|
|
4927
|
+
if (isUnknownDates)
|
|
4928
|
+
return false;
|
|
4929
|
+
if (columnIndex === startColumnIndex)
|
|
4930
|
+
return true;
|
|
4931
|
+
if (!previousDate)
|
|
4932
|
+
return false;
|
|
4933
|
+
switch (viewMode) {
|
|
4934
|
+
case ViewMode.Year:
|
|
4935
|
+
return currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4936
|
+
case ViewMode.HalfYear:
|
|
4937
|
+
return currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4938
|
+
case ViewMode.QuarterYear:
|
|
4939
|
+
return Math.ceil((currentDate.getMonth() + 1) / 3) !== Math.ceil((previousDate.getMonth() + 1) / 3) || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4940
|
+
case ViewMode.Month:
|
|
4941
|
+
return currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4942
|
+
case ViewMode.Week:
|
|
4943
|
+
return currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4944
|
+
case ViewMode.Day:
|
|
4945
|
+
return currentDate.getDate() !== previousDate.getDate() || currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4946
|
+
case ViewMode.HalfDay:
|
|
4947
|
+
case ViewMode.QuarterDay:
|
|
4948
|
+
case ViewMode.Hour:
|
|
4949
|
+
return currentDate.getDate() !== previousDate.getDate() || currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4950
|
+
default:
|
|
4951
|
+
return false;
|
|
4952
|
+
}
|
|
4953
|
+
};
|
|
4926
4954
|
const GridBodyInner = ({
|
|
4927
4955
|
additionalLeftSpace,
|
|
4928
4956
|
columnWidth,
|
|
@@ -4931,7 +4959,11 @@ const GridBodyInner = ({
|
|
|
4931
4959
|
todayColor,
|
|
4932
4960
|
rtl,
|
|
4933
4961
|
startDate,
|
|
4934
|
-
viewMode
|
|
4962
|
+
viewMode,
|
|
4963
|
+
dividerColor,
|
|
4964
|
+
startColumnIndex,
|
|
4965
|
+
endColumnIndex,
|
|
4966
|
+
getDate
|
|
4935
4967
|
}) => {
|
|
4936
4968
|
const today = useMemo(() => {
|
|
4937
4969
|
if (isUnknownDates) {
|
|
@@ -4960,7 +4992,56 @@ const GridBodyInner = ({
|
|
|
4960
4992
|
todayColor,
|
|
4961
4993
|
viewMode
|
|
4962
4994
|
]);
|
|
4963
|
-
|
|
4995
|
+
const verticalDividers = useMemo(() => {
|
|
4996
|
+
const dividers = [];
|
|
4997
|
+
for (let i2 = startColumnIndex; i2 <= endColumnIndex; i2++) {
|
|
4998
|
+
const currentDate = getDate(i2);
|
|
4999
|
+
const previousDate = i2 > startColumnIndex ? getDate(i2 - 1) : null;
|
|
5000
|
+
if (shouldDrawVerticalDivider(
|
|
5001
|
+
currentDate,
|
|
5002
|
+
previousDate,
|
|
5003
|
+
viewMode,
|
|
5004
|
+
isUnknownDates,
|
|
5005
|
+
i2,
|
|
5006
|
+
startColumnIndex
|
|
5007
|
+
)) {
|
|
5008
|
+
const x3 = additionalLeftSpace + columnWidth * i2;
|
|
5009
|
+
console.log("debugging x:", x3);
|
|
5010
|
+
console.log("divider color", dividerColor);
|
|
5011
|
+
dividers.push(
|
|
5012
|
+
/* @__PURE__ */ jsx(
|
|
5013
|
+
"line",
|
|
5014
|
+
{
|
|
5015
|
+
x1: x3,
|
|
5016
|
+
x2: x3,
|
|
5017
|
+
y1: 0,
|
|
5018
|
+
y2: ganttFullHeight,
|
|
5019
|
+
stroke: dividerColor,
|
|
5020
|
+
opacity: 0.15,
|
|
5021
|
+
strokeWidth: 2
|
|
5022
|
+
},
|
|
5023
|
+
`divider-${i2}`
|
|
5024
|
+
)
|
|
5025
|
+
);
|
|
5026
|
+
}
|
|
5027
|
+
}
|
|
5028
|
+
return dividers;
|
|
5029
|
+
}, [
|
|
5030
|
+
additionalLeftSpace,
|
|
5031
|
+
columnWidth,
|
|
5032
|
+
ganttFullHeight,
|
|
5033
|
+
viewMode,
|
|
5034
|
+
isUnknownDates,
|
|
5035
|
+
startColumnIndex,
|
|
5036
|
+
endColumnIndex,
|
|
5037
|
+
getDate,
|
|
5038
|
+
dividerColor
|
|
5039
|
+
]);
|
|
5040
|
+
console.log("verticalDividers :>> ", verticalDividers);
|
|
5041
|
+
return /* @__PURE__ */ jsxs("g", { className: "gridBody", children: [
|
|
5042
|
+
/* @__PURE__ */ jsx("g", { className: "today", children: today }),
|
|
5043
|
+
/* @__PURE__ */ jsx("g", { className: "verticalDividers", children: verticalDividers })
|
|
5044
|
+
] });
|
|
4964
5045
|
};
|
|
4965
5046
|
const GridBody = memo(GridBodyInner);
|
|
4966
5047
|
function isWeekend(dirtyDate) {
|
|
@@ -6905,7 +6986,6 @@ const TaskGanttInner = (props) => {
|
|
|
6905
6986
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
6906
6987
|
width: (ganttTaskRootRef == null ? void 0 : ganttTaskRootRef.current) ? ganttTaskRootRef.current.clientWidth + ganttTaskRootRef.current.scrollLeft : fullSvgWidth
|
|
6907
6988
|
};
|
|
6908
|
-
console.log("containerStyle:>> ", containerStyle);
|
|
6909
6989
|
const gridStyle = useMemo(
|
|
6910
6990
|
() => ({
|
|
6911
6991
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
@@ -11624,6 +11704,8 @@ const defaultColors = {
|
|
|
11624
11704
|
selectedTaskBackgroundColor: "rgba(252, 248, 227, 0.5)",
|
|
11625
11705
|
taskDragColor: "#7474ff",
|
|
11626
11706
|
todayColor: "rgba(252, 248, 227, 0.5)",
|
|
11707
|
+
dividerColor: "rgba(22, 16, 14, 0.27)",
|
|
11708
|
+
//new color
|
|
11627
11709
|
contextMenuBoxShadow: "rgb(0 0 0 / 25%) 1px 1px 5px 1px",
|
|
11628
11710
|
contextMenuBgColor: "#fff",
|
|
11629
11711
|
contextMenuTextColor: "inherit"
|
|
@@ -12984,6 +13066,7 @@ const Gantt = ({
|
|
|
12984
13066
|
rtl,
|
|
12985
13067
|
startDate,
|
|
12986
13068
|
todayColor: colorStyles.todayColor,
|
|
13069
|
+
dividerColor: colorStyles.dividerColor,
|
|
12987
13070
|
holidayBackgroundColor: colorStyles.holidayBackgroundColor,
|
|
12988
13071
|
viewMode,
|
|
12989
13072
|
startColumnIndex,
|
|
@@ -4936,6 +4936,34 @@
|
|
|
4936
4936
|
}
|
|
4937
4937
|
) });
|
|
4938
4938
|
};
|
|
4939
|
+
const shouldDrawVerticalDivider = (currentDate, previousDate, viewMode, isUnknownDates, columnIndex, startColumnIndex) => {
|
|
4940
|
+
if (isUnknownDates)
|
|
4941
|
+
return false;
|
|
4942
|
+
if (columnIndex === startColumnIndex)
|
|
4943
|
+
return true;
|
|
4944
|
+
if (!previousDate)
|
|
4945
|
+
return false;
|
|
4946
|
+
switch (viewMode) {
|
|
4947
|
+
case ViewMode.Year:
|
|
4948
|
+
return currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4949
|
+
case ViewMode.HalfYear:
|
|
4950
|
+
return currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4951
|
+
case ViewMode.QuarterYear:
|
|
4952
|
+
return Math.ceil((currentDate.getMonth() + 1) / 3) !== Math.ceil((previousDate.getMonth() + 1) / 3) || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4953
|
+
case ViewMode.Month:
|
|
4954
|
+
return currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4955
|
+
case ViewMode.Week:
|
|
4956
|
+
return currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4957
|
+
case ViewMode.Day:
|
|
4958
|
+
return currentDate.getDate() !== previousDate.getDate() || currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4959
|
+
case ViewMode.HalfDay:
|
|
4960
|
+
case ViewMode.QuarterDay:
|
|
4961
|
+
case ViewMode.Hour:
|
|
4962
|
+
return currentDate.getDate() !== previousDate.getDate() || currentDate.getMonth() !== previousDate.getMonth() || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4963
|
+
default:
|
|
4964
|
+
return false;
|
|
4965
|
+
}
|
|
4966
|
+
};
|
|
4939
4967
|
const GridBodyInner = ({
|
|
4940
4968
|
additionalLeftSpace,
|
|
4941
4969
|
columnWidth,
|
|
@@ -4944,7 +4972,11 @@
|
|
|
4944
4972
|
todayColor,
|
|
4945
4973
|
rtl,
|
|
4946
4974
|
startDate,
|
|
4947
|
-
viewMode
|
|
4975
|
+
viewMode,
|
|
4976
|
+
dividerColor,
|
|
4977
|
+
startColumnIndex,
|
|
4978
|
+
endColumnIndex,
|
|
4979
|
+
getDate
|
|
4948
4980
|
}) => {
|
|
4949
4981
|
const today = React.useMemo(() => {
|
|
4950
4982
|
if (isUnknownDates) {
|
|
@@ -4973,7 +5005,56 @@
|
|
|
4973
5005
|
todayColor,
|
|
4974
5006
|
viewMode
|
|
4975
5007
|
]);
|
|
4976
|
-
|
|
5008
|
+
const verticalDividers = React.useMemo(() => {
|
|
5009
|
+
const dividers = [];
|
|
5010
|
+
for (let i = startColumnIndex; i <= endColumnIndex; i++) {
|
|
5011
|
+
const currentDate = getDate(i);
|
|
5012
|
+
const previousDate = i > startColumnIndex ? getDate(i - 1) : null;
|
|
5013
|
+
if (shouldDrawVerticalDivider(
|
|
5014
|
+
currentDate,
|
|
5015
|
+
previousDate,
|
|
5016
|
+
viewMode,
|
|
5017
|
+
isUnknownDates,
|
|
5018
|
+
i,
|
|
5019
|
+
startColumnIndex
|
|
5020
|
+
)) {
|
|
5021
|
+
const x2 = additionalLeftSpace + columnWidth * i;
|
|
5022
|
+
console.log("debugging x:", x2);
|
|
5023
|
+
console.log("divider color", dividerColor);
|
|
5024
|
+
dividers.push(
|
|
5025
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5026
|
+
"line",
|
|
5027
|
+
{
|
|
5028
|
+
x1: x2,
|
|
5029
|
+
x2,
|
|
5030
|
+
y1: 0,
|
|
5031
|
+
y2: ganttFullHeight,
|
|
5032
|
+
stroke: dividerColor,
|
|
5033
|
+
opacity: 0.15,
|
|
5034
|
+
strokeWidth: 2
|
|
5035
|
+
},
|
|
5036
|
+
`divider-${i}`
|
|
5037
|
+
)
|
|
5038
|
+
);
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
return dividers;
|
|
5042
|
+
}, [
|
|
5043
|
+
additionalLeftSpace,
|
|
5044
|
+
columnWidth,
|
|
5045
|
+
ganttFullHeight,
|
|
5046
|
+
viewMode,
|
|
5047
|
+
isUnknownDates,
|
|
5048
|
+
startColumnIndex,
|
|
5049
|
+
endColumnIndex,
|
|
5050
|
+
getDate,
|
|
5051
|
+
dividerColor
|
|
5052
|
+
]);
|
|
5053
|
+
console.log("verticalDividers :>> ", verticalDividers);
|
|
5054
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "gridBody", children: [
|
|
5055
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { className: "today", children: today }),
|
|
5056
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { className: "verticalDividers", children: verticalDividers })
|
|
5057
|
+
] });
|
|
4977
5058
|
};
|
|
4978
5059
|
const GridBody = React.memo(GridBodyInner);
|
|
4979
5060
|
function isWeekend(dirtyDate) {
|
|
@@ -6918,7 +6999,6 @@
|
|
|
6918
6999
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
6919
7000
|
width: (ganttTaskRootRef == null ? void 0 : ganttTaskRootRef.current) ? ganttTaskRootRef.current.clientWidth + ganttTaskRootRef.current.scrollLeft : fullSvgWidth
|
|
6920
7001
|
};
|
|
6921
|
-
console.log("containerStyle:>> ", containerStyle);
|
|
6922
7002
|
const gridStyle = React.useMemo(
|
|
6923
7003
|
() => ({
|
|
6924
7004
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
@@ -11637,6 +11717,8 @@
|
|
|
11637
11717
|
selectedTaskBackgroundColor: "rgba(252, 248, 227, 0.5)",
|
|
11638
11718
|
taskDragColor: "#7474ff",
|
|
11639
11719
|
todayColor: "rgba(252, 248, 227, 0.5)",
|
|
11720
|
+
dividerColor: "rgba(22, 16, 14, 0.27)",
|
|
11721
|
+
//new color
|
|
11640
11722
|
contextMenuBoxShadow: "rgb(0 0 0 / 25%) 1px 1px 5px 1px",
|
|
11641
11723
|
contextMenuBgColor: "#fff",
|
|
11642
11724
|
contextMenuTextColor: "inherit"
|
|
@@ -12997,6 +13079,7 @@
|
|
|
12997
13079
|
rtl,
|
|
12998
13080
|
startDate,
|
|
12999
13081
|
todayColor: colorStyles.todayColor,
|
|
13082
|
+
dividerColor: colorStyles.dividerColor,
|
|
13000
13083
|
holidayBackgroundColor: colorStyles.holidayBackgroundColor,
|
|
13001
13084
|
viewMode,
|
|
13002
13085
|
startColumnIndex,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thepocman/gantt-task-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "Fork of gantt-task-react with support for grouped tasks on a single row when collapsed",
|
|
5
5
|
"author": "Adrian Bueno <adrianlbueno@users.noreply.github.com>",
|
|
6
6
|
"homepage": "https://github.com/adrianlbueno/gantt-task-react#readme",
|