gantt-task-react-v 1.0.46 → 1.0.47
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.
|
@@ -10914,31 +10914,34 @@ const GanttTodayInner = ({
|
|
|
10914
10914
|
isUnknownDates,
|
|
10915
10915
|
rtl,
|
|
10916
10916
|
startDate,
|
|
10917
|
-
viewMode
|
|
10917
|
+
viewMode,
|
|
10918
|
+
showTodayLine = true,
|
|
10919
|
+
showDataDateLine = false,
|
|
10920
|
+
dataDate = null
|
|
10918
10921
|
}) => {
|
|
10919
|
-
const
|
|
10920
|
-
if (isUnknownDates) {
|
|
10922
|
+
const todayElement = useMemo(() => {
|
|
10923
|
+
if (isUnknownDates || !showTodayLine) {
|
|
10921
10924
|
return null;
|
|
10922
10925
|
}
|
|
10923
|
-
const
|
|
10924
|
-
const todayIndex = getDatesDiff(
|
|
10926
|
+
const today = /* @__PURE__ */ new Date();
|
|
10927
|
+
const todayIndex = getDatesDiff(today, startDate, viewMode);
|
|
10925
10928
|
const extraMultiplier = () => {
|
|
10926
10929
|
switch (viewMode) {
|
|
10927
10930
|
case ViewMode.Week: {
|
|
10928
|
-
const percent =
|
|
10931
|
+
const percent = today.getDay() / 7;
|
|
10929
10932
|
return 1 + percent * 0.2;
|
|
10930
10933
|
}
|
|
10931
10934
|
case ViewMode.Month: {
|
|
10932
|
-
const dayInMonth =
|
|
10935
|
+
const dayInMonth = today.getDate();
|
|
10933
10936
|
const maxDaysInMonth = getDaysInMonth(
|
|
10934
|
-
|
|
10935
|
-
|
|
10937
|
+
today.getMonth(),
|
|
10938
|
+
today.getFullYear()
|
|
10936
10939
|
);
|
|
10937
10940
|
const percent = dayInMonth / maxDaysInMonth;
|
|
10938
10941
|
return 1 + percent * 0.5;
|
|
10939
10942
|
}
|
|
10940
10943
|
case ViewMode.Year: {
|
|
10941
|
-
const percent =
|
|
10944
|
+
const percent = today.getMonth() / 12;
|
|
10942
10945
|
return 1 + percent * 0.5;
|
|
10943
10946
|
}
|
|
10944
10947
|
default:
|
|
@@ -10976,9 +10979,88 @@ const GanttTodayInner = ({
|
|
|
10976
10979
|
isUnknownDates,
|
|
10977
10980
|
rtl,
|
|
10978
10981
|
startDate,
|
|
10979
|
-
viewMode
|
|
10982
|
+
viewMode,
|
|
10983
|
+
showTodayLine
|
|
10980
10984
|
]);
|
|
10981
|
-
|
|
10985
|
+
const dataDateElement = useMemo(() => {
|
|
10986
|
+
if (!showDataDateLine || !dataDate) {
|
|
10987
|
+
return null;
|
|
10988
|
+
}
|
|
10989
|
+
const dataIndex = getDatesDiff(dataDate, startDate, viewMode);
|
|
10990
|
+
const extraMultiplier = () => {
|
|
10991
|
+
switch (viewMode) {
|
|
10992
|
+
case ViewMode.Week: {
|
|
10993
|
+
const percent = dataDate.getDay() / 7;
|
|
10994
|
+
return 1 + percent * 0.2;
|
|
10995
|
+
}
|
|
10996
|
+
case ViewMode.Month: {
|
|
10997
|
+
const dayInMonth = dataDate.getDate();
|
|
10998
|
+
const maxDaysInMonth = getDaysInMonth(
|
|
10999
|
+
dataDate.getMonth(),
|
|
11000
|
+
dataDate.getFullYear()
|
|
11001
|
+
);
|
|
11002
|
+
const percent = dayInMonth / maxDaysInMonth;
|
|
11003
|
+
return 1 + percent * 0.5;
|
|
11004
|
+
}
|
|
11005
|
+
case ViewMode.Year: {
|
|
11006
|
+
const percent = dataDate.getMonth() / 12;
|
|
11007
|
+
return 1 + percent * 0.5;
|
|
11008
|
+
}
|
|
11009
|
+
default:
|
|
11010
|
+
return 1;
|
|
11011
|
+
}
|
|
11012
|
+
};
|
|
11013
|
+
const tickX = dataIndex * columnWidth * extraMultiplier();
|
|
11014
|
+
const x = rtl ? tickX + columnWidth : tickX;
|
|
11015
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11016
|
+
/* @__PURE__ */ jsx(
|
|
11017
|
+
"rect",
|
|
11018
|
+
{
|
|
11019
|
+
x: additionalLeftSpace + x,
|
|
11020
|
+
y: 0,
|
|
11021
|
+
width: 2,
|
|
11022
|
+
height: ganttFullHeight,
|
|
11023
|
+
fill: "var(--gantt-calendar-today-color)",
|
|
11024
|
+
opacity: 0.9
|
|
11025
|
+
}
|
|
11026
|
+
),
|
|
11027
|
+
/* @__PURE__ */ jsx(
|
|
11028
|
+
"circle",
|
|
11029
|
+
{
|
|
11030
|
+
className: styles$c.ganttTodayCircle,
|
|
11031
|
+
cx: x + 1,
|
|
11032
|
+
cy: 6,
|
|
11033
|
+
r: 6,
|
|
11034
|
+
fill: "var(--gantt-calendar-today-color)"
|
|
11035
|
+
}
|
|
11036
|
+
),
|
|
11037
|
+
/* @__PURE__ */ jsx(
|
|
11038
|
+
"text",
|
|
11039
|
+
{
|
|
11040
|
+
x: additionalLeftSpace + x + 8,
|
|
11041
|
+
y: 6,
|
|
11042
|
+
dy: 2,
|
|
11043
|
+
fill: "var(--gantt-calendar-today-color)",
|
|
11044
|
+
fontSize: 12,
|
|
11045
|
+
fontWeight: 600,
|
|
11046
|
+
children: "Data Date"
|
|
11047
|
+
}
|
|
11048
|
+
)
|
|
11049
|
+
] });
|
|
11050
|
+
}, [
|
|
11051
|
+
additionalLeftSpace,
|
|
11052
|
+
columnWidth,
|
|
11053
|
+
ganttFullHeight,
|
|
11054
|
+
rtl,
|
|
11055
|
+
startDate,
|
|
11056
|
+
viewMode,
|
|
11057
|
+
showDataDateLine,
|
|
11058
|
+
dataDate
|
|
11059
|
+
]);
|
|
11060
|
+
return /* @__PURE__ */ jsxs("g", { className: "today", children: [
|
|
11061
|
+
dataDateElement,
|
|
11062
|
+
todayElement
|
|
11063
|
+
] });
|
|
10982
11064
|
};
|
|
10983
11065
|
const GanttToday = memo(GanttTodayInner);
|
|
10984
11066
|
const calendarBottomText = "_calendarBottomText_15t8b_1";
|
|
@@ -18563,14 +18645,25 @@ const Gantt = (props) => {
|
|
|
18563
18645
|
viewDate,
|
|
18564
18646
|
viewMode = ViewMode.Day,
|
|
18565
18647
|
locale: clientLocale,
|
|
18566
|
-
language
|
|
18648
|
+
language,
|
|
18649
|
+
rowHeight,
|
|
18650
|
+
showTodayLine = true,
|
|
18651
|
+
showDataDateLine = false,
|
|
18652
|
+
dataDate = null
|
|
18567
18653
|
} = props;
|
|
18568
18654
|
const ganttSVGRef = useRef(null);
|
|
18569
18655
|
const wrapperRef = useRef(null);
|
|
18570
18656
|
const taskListRef = useRef(null);
|
|
18571
18657
|
const locale = useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
|
|
18572
18658
|
const theme = useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
|
|
18573
|
-
const {
|
|
18659
|
+
const { dateFormats: dateFormats2, rtl } = theme;
|
|
18660
|
+
const distances = useMemo(
|
|
18661
|
+
() => ({
|
|
18662
|
+
...theme.distances,
|
|
18663
|
+
rowHeight: rowHeight ?? theme.distances.rowHeight
|
|
18664
|
+
}),
|
|
18665
|
+
[theme, rowHeight]
|
|
18666
|
+
);
|
|
18574
18667
|
const [waitCommitTasks, setWaitCommitTasks] = useState(false);
|
|
18575
18668
|
const taskBar = useMemo(() => {
|
|
18576
18669
|
return mergeDeepObj(
|
|
@@ -18988,20 +19081,20 @@ const Gantt = (props) => {
|
|
|
18988
19081
|
horizontalContainerRef
|
|
18989
19082
|
]);
|
|
18990
19083
|
const handleKeyDown = (event) => {
|
|
18991
|
-
const { columnWidth, rowHeight } = distances;
|
|
19084
|
+
const { columnWidth, rowHeight: rowHeight2 } = distances;
|
|
18992
19085
|
let newScrollY = scrollY;
|
|
18993
19086
|
let newScrollX = scrollX;
|
|
18994
19087
|
let isX = true;
|
|
18995
19088
|
switch (event.key) {
|
|
18996
19089
|
case "Down":
|
|
18997
19090
|
case "ArrowDown":
|
|
18998
|
-
newScrollY +=
|
|
19091
|
+
newScrollY += rowHeight2;
|
|
18999
19092
|
isX = false;
|
|
19000
19093
|
event.preventDefault();
|
|
19001
19094
|
break;
|
|
19002
19095
|
case "Up":
|
|
19003
19096
|
case "ArrowUp":
|
|
19004
|
-
newScrollY -=
|
|
19097
|
+
newScrollY -= rowHeight2;
|
|
19005
19098
|
isX = false;
|
|
19006
19099
|
event.preventDefault();
|
|
19007
19100
|
break;
|
|
@@ -19693,7 +19786,10 @@ const Gantt = (props) => {
|
|
|
19693
19786
|
isUnknownDates,
|
|
19694
19787
|
rtl,
|
|
19695
19788
|
startDate,
|
|
19696
|
-
viewMode
|
|
19789
|
+
viewMode,
|
|
19790
|
+
showTodayLine,
|
|
19791
|
+
showDataDateLine,
|
|
19792
|
+
dataDate
|
|
19697
19793
|
}),
|
|
19698
19794
|
[
|
|
19699
19795
|
additionalLeftSpace,
|
|
@@ -19702,7 +19798,10 @@ const Gantt = (props) => {
|
|
|
19702
19798
|
isUnknownDates,
|
|
19703
19799
|
rtl,
|
|
19704
19800
|
startDate,
|
|
19705
|
-
viewMode
|
|
19801
|
+
viewMode,
|
|
19802
|
+
showTodayLine,
|
|
19803
|
+
showDataDateLine,
|
|
19804
|
+
dataDate
|
|
19706
19805
|
]
|
|
19707
19806
|
);
|
|
19708
19807
|
const calendarProps = useMemo(
|
|
@@ -10931,31 +10931,34 @@
|
|
|
10931
10931
|
isUnknownDates,
|
|
10932
10932
|
rtl,
|
|
10933
10933
|
startDate,
|
|
10934
|
-
viewMode
|
|
10934
|
+
viewMode,
|
|
10935
|
+
showTodayLine = true,
|
|
10936
|
+
showDataDateLine = false,
|
|
10937
|
+
dataDate = null
|
|
10935
10938
|
}) => {
|
|
10936
|
-
const
|
|
10937
|
-
if (isUnknownDates) {
|
|
10939
|
+
const todayElement = React.useMemo(() => {
|
|
10940
|
+
if (isUnknownDates || !showTodayLine) {
|
|
10938
10941
|
return null;
|
|
10939
10942
|
}
|
|
10940
|
-
const
|
|
10941
|
-
const todayIndex = getDatesDiff(
|
|
10943
|
+
const today = /* @__PURE__ */ new Date();
|
|
10944
|
+
const todayIndex = getDatesDiff(today, startDate, viewMode);
|
|
10942
10945
|
const extraMultiplier = () => {
|
|
10943
10946
|
switch (viewMode) {
|
|
10944
10947
|
case ViewMode.Week: {
|
|
10945
|
-
const percent =
|
|
10948
|
+
const percent = today.getDay() / 7;
|
|
10946
10949
|
return 1 + percent * 0.2;
|
|
10947
10950
|
}
|
|
10948
10951
|
case ViewMode.Month: {
|
|
10949
|
-
const dayInMonth =
|
|
10952
|
+
const dayInMonth = today.getDate();
|
|
10950
10953
|
const maxDaysInMonth = getDaysInMonth(
|
|
10951
|
-
|
|
10952
|
-
|
|
10954
|
+
today.getMonth(),
|
|
10955
|
+
today.getFullYear()
|
|
10953
10956
|
);
|
|
10954
10957
|
const percent = dayInMonth / maxDaysInMonth;
|
|
10955
10958
|
return 1 + percent * 0.5;
|
|
10956
10959
|
}
|
|
10957
10960
|
case ViewMode.Year: {
|
|
10958
|
-
const percent =
|
|
10961
|
+
const percent = today.getMonth() / 12;
|
|
10959
10962
|
return 1 + percent * 0.5;
|
|
10960
10963
|
}
|
|
10961
10964
|
default:
|
|
@@ -10993,9 +10996,88 @@
|
|
|
10993
10996
|
isUnknownDates,
|
|
10994
10997
|
rtl,
|
|
10995
10998
|
startDate,
|
|
10996
|
-
viewMode
|
|
10999
|
+
viewMode,
|
|
11000
|
+
showTodayLine
|
|
10997
11001
|
]);
|
|
10998
|
-
|
|
11002
|
+
const dataDateElement = React.useMemo(() => {
|
|
11003
|
+
if (!showDataDateLine || !dataDate) {
|
|
11004
|
+
return null;
|
|
11005
|
+
}
|
|
11006
|
+
const dataIndex = getDatesDiff(dataDate, startDate, viewMode);
|
|
11007
|
+
const extraMultiplier = () => {
|
|
11008
|
+
switch (viewMode) {
|
|
11009
|
+
case ViewMode.Week: {
|
|
11010
|
+
const percent = dataDate.getDay() / 7;
|
|
11011
|
+
return 1 + percent * 0.2;
|
|
11012
|
+
}
|
|
11013
|
+
case ViewMode.Month: {
|
|
11014
|
+
const dayInMonth = dataDate.getDate();
|
|
11015
|
+
const maxDaysInMonth = getDaysInMonth(
|
|
11016
|
+
dataDate.getMonth(),
|
|
11017
|
+
dataDate.getFullYear()
|
|
11018
|
+
);
|
|
11019
|
+
const percent = dayInMonth / maxDaysInMonth;
|
|
11020
|
+
return 1 + percent * 0.5;
|
|
11021
|
+
}
|
|
11022
|
+
case ViewMode.Year: {
|
|
11023
|
+
const percent = dataDate.getMonth() / 12;
|
|
11024
|
+
return 1 + percent * 0.5;
|
|
11025
|
+
}
|
|
11026
|
+
default:
|
|
11027
|
+
return 1;
|
|
11028
|
+
}
|
|
11029
|
+
};
|
|
11030
|
+
const tickX = dataIndex * columnWidth * extraMultiplier();
|
|
11031
|
+
const x = rtl ? tickX + columnWidth : tickX;
|
|
11032
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11033
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11034
|
+
"rect",
|
|
11035
|
+
{
|
|
11036
|
+
x: additionalLeftSpace + x,
|
|
11037
|
+
y: 0,
|
|
11038
|
+
width: 2,
|
|
11039
|
+
height: ganttFullHeight,
|
|
11040
|
+
fill: "var(--gantt-calendar-today-color)",
|
|
11041
|
+
opacity: 0.9
|
|
11042
|
+
}
|
|
11043
|
+
),
|
|
11044
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11045
|
+
"circle",
|
|
11046
|
+
{
|
|
11047
|
+
className: styles$c.ganttTodayCircle,
|
|
11048
|
+
cx: x + 1,
|
|
11049
|
+
cy: 6,
|
|
11050
|
+
r: 6,
|
|
11051
|
+
fill: "var(--gantt-calendar-today-color)"
|
|
11052
|
+
}
|
|
11053
|
+
),
|
|
11054
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11055
|
+
"text",
|
|
11056
|
+
{
|
|
11057
|
+
x: additionalLeftSpace + x + 8,
|
|
11058
|
+
y: 6,
|
|
11059
|
+
dy: 2,
|
|
11060
|
+
fill: "var(--gantt-calendar-today-color)",
|
|
11061
|
+
fontSize: 12,
|
|
11062
|
+
fontWeight: 600,
|
|
11063
|
+
children: "Data Date"
|
|
11064
|
+
}
|
|
11065
|
+
)
|
|
11066
|
+
] });
|
|
11067
|
+
}, [
|
|
11068
|
+
additionalLeftSpace,
|
|
11069
|
+
columnWidth,
|
|
11070
|
+
ganttFullHeight,
|
|
11071
|
+
rtl,
|
|
11072
|
+
startDate,
|
|
11073
|
+
viewMode,
|
|
11074
|
+
showDataDateLine,
|
|
11075
|
+
dataDate
|
|
11076
|
+
]);
|
|
11077
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "today", children: [
|
|
11078
|
+
dataDateElement,
|
|
11079
|
+
todayElement
|
|
11080
|
+
] });
|
|
10999
11081
|
};
|
|
11000
11082
|
const GanttToday = React.memo(GanttTodayInner);
|
|
11001
11083
|
const calendarBottomText = "_calendarBottomText_15t8b_1";
|
|
@@ -18580,14 +18662,25 @@
|
|
|
18580
18662
|
viewDate,
|
|
18581
18663
|
viewMode = ViewMode.Day,
|
|
18582
18664
|
locale: clientLocale,
|
|
18583
|
-
language
|
|
18665
|
+
language,
|
|
18666
|
+
rowHeight,
|
|
18667
|
+
showTodayLine = true,
|
|
18668
|
+
showDataDateLine = false,
|
|
18669
|
+
dataDate = null
|
|
18584
18670
|
} = props;
|
|
18585
18671
|
const ganttSVGRef = React.useRef(null);
|
|
18586
18672
|
const wrapperRef = React.useRef(null);
|
|
18587
18673
|
const taskListRef = React.useRef(null);
|
|
18588
18674
|
const locale = React.useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
|
|
18589
18675
|
const theme = React.useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
|
|
18590
|
-
const {
|
|
18676
|
+
const { dateFormats: dateFormats2, rtl } = theme;
|
|
18677
|
+
const distances = React.useMemo(
|
|
18678
|
+
() => ({
|
|
18679
|
+
...theme.distances,
|
|
18680
|
+
rowHeight: rowHeight ?? theme.distances.rowHeight
|
|
18681
|
+
}),
|
|
18682
|
+
[theme, rowHeight]
|
|
18683
|
+
);
|
|
18591
18684
|
const [waitCommitTasks, setWaitCommitTasks] = React.useState(false);
|
|
18592
18685
|
const taskBar = React.useMemo(() => {
|
|
18593
18686
|
return mergeDeepObj(
|
|
@@ -19005,20 +19098,20 @@
|
|
|
19005
19098
|
horizontalContainerRef
|
|
19006
19099
|
]);
|
|
19007
19100
|
const handleKeyDown = (event) => {
|
|
19008
|
-
const { columnWidth, rowHeight } = distances;
|
|
19101
|
+
const { columnWidth, rowHeight: rowHeight2 } = distances;
|
|
19009
19102
|
let newScrollY = scrollY;
|
|
19010
19103
|
let newScrollX = scrollX;
|
|
19011
19104
|
let isX = true;
|
|
19012
19105
|
switch (event.key) {
|
|
19013
19106
|
case "Down":
|
|
19014
19107
|
case "ArrowDown":
|
|
19015
|
-
newScrollY +=
|
|
19108
|
+
newScrollY += rowHeight2;
|
|
19016
19109
|
isX = false;
|
|
19017
19110
|
event.preventDefault();
|
|
19018
19111
|
break;
|
|
19019
19112
|
case "Up":
|
|
19020
19113
|
case "ArrowUp":
|
|
19021
|
-
newScrollY -=
|
|
19114
|
+
newScrollY -= rowHeight2;
|
|
19022
19115
|
isX = false;
|
|
19023
19116
|
event.preventDefault();
|
|
19024
19117
|
break;
|
|
@@ -19710,7 +19803,10 @@
|
|
|
19710
19803
|
isUnknownDates,
|
|
19711
19804
|
rtl,
|
|
19712
19805
|
startDate,
|
|
19713
|
-
viewMode
|
|
19806
|
+
viewMode,
|
|
19807
|
+
showTodayLine,
|
|
19808
|
+
showDataDateLine,
|
|
19809
|
+
dataDate
|
|
19714
19810
|
}),
|
|
19715
19811
|
[
|
|
19716
19812
|
additionalLeftSpace,
|
|
@@ -19719,7 +19815,10 @@
|
|
|
19719
19815
|
isUnknownDates,
|
|
19720
19816
|
rtl,
|
|
19721
19817
|
startDate,
|
|
19722
|
-
viewMode
|
|
19818
|
+
viewMode,
|
|
19819
|
+
showTodayLine,
|
|
19820
|
+
showDataDateLine,
|
|
19821
|
+
dataDate
|
|
19723
19822
|
]
|
|
19724
19823
|
);
|
|
19725
19824
|
const calendarProps = React.useMemo(
|
|
@@ -320,6 +320,22 @@ export interface GanttProps {
|
|
|
320
320
|
* Move dates of tasks to working days during change
|
|
321
321
|
*/
|
|
322
322
|
isAdjustToWorkingDates?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Force row height (in pixels) for each single row. If not provided theme distances.rowHeight is used.
|
|
325
|
+
*/
|
|
326
|
+
rowHeight?: number;
|
|
327
|
+
/**
|
|
328
|
+
* Show vertical line for current day on the chart
|
|
329
|
+
*/
|
|
330
|
+
showTodayLine?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Show vertical line for a custom 'data date' on the chart
|
|
333
|
+
*/
|
|
334
|
+
showDataDateLine?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Custom date to render as data date line when `showDataDateLine` is true
|
|
337
|
+
*/
|
|
338
|
+
dataDate?: Date | null;
|
|
323
339
|
}
|
|
324
340
|
export interface GanttTaskBarActions {
|
|
325
341
|
allowMoveTaskBar?: (action: TaskBarMoveAction, task: RenderTask) => boolean;
|
package/package.json
CHANGED