gantt-task-react-v 1.0.49 → 1.0.51
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 +2 -20
- package/dist/components/gantt-today/index.d.ts +0 -1
- package/dist/components/task-item/bar/bar-display.d.ts +2 -17
- package/dist/components/task-item/project/project-display.d.ts +2 -17
- package/dist/components/task-item/task-item.d.ts +2 -17
- package/dist/gantt-task-react.es.js +471 -568
- package/dist/gantt-task-react.umd.js +471 -568
- package/dist/types/public-types.d.ts +4 -22
- package/package.json +1 -1
|
@@ -10901,6 +10901,204 @@ const TaskListInner = ({
|
|
|
10901
10901
|
] });
|
|
10902
10902
|
};
|
|
10903
10903
|
const TaskList = memo(TaskListInner);
|
|
10904
|
+
const getDateByOffset = (startDate, offset2, viewMode) => {
|
|
10905
|
+
switch (viewMode) {
|
|
10906
|
+
case ViewMode.Day:
|
|
10907
|
+
return addDays(startDate, offset2);
|
|
10908
|
+
case ViewMode.HalfDay:
|
|
10909
|
+
return addHours(startDate, offset2 * 12);
|
|
10910
|
+
case ViewMode.QuarterDay:
|
|
10911
|
+
return addHours(startDate, offset2 * 6);
|
|
10912
|
+
case ViewMode.Hour:
|
|
10913
|
+
return addHours(startDate, offset2);
|
|
10914
|
+
case ViewMode.Month:
|
|
10915
|
+
return addMonths(startDate, offset2);
|
|
10916
|
+
case ViewMode.Week:
|
|
10917
|
+
return addWeeks(startDate, offset2);
|
|
10918
|
+
case ViewMode.Year:
|
|
10919
|
+
return addYears(startDate, offset2);
|
|
10920
|
+
default:
|
|
10921
|
+
throw new Error("Unknown view mode");
|
|
10922
|
+
}
|
|
10923
|
+
};
|
|
10924
|
+
const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
10925
|
+
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
10926
|
+
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
10927
|
+
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10928
|
+
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
10929
|
+
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10930
|
+
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10931
|
+
};
|
|
10932
|
+
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
10933
|
+
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
10934
|
+
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
10935
|
+
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10936
|
+
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
10937
|
+
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10938
|
+
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10939
|
+
};
|
|
10940
|
+
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
10941
|
+
const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
|
|
10942
|
+
let progressX;
|
|
10943
|
+
if (rtl) {
|
|
10944
|
+
progressX = taskX2 - progressWidth;
|
|
10945
|
+
} else {
|
|
10946
|
+
progressX = taskX1;
|
|
10947
|
+
}
|
|
10948
|
+
return [progressWidth, progressX];
|
|
10949
|
+
};
|
|
10950
|
+
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
10951
|
+
let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
10952
|
+
newDate = new Date(
|
|
10953
|
+
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
10954
|
+
);
|
|
10955
|
+
return newDate;
|
|
10956
|
+
};
|
|
10957
|
+
const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
10958
|
+
let result;
|
|
10959
|
+
switch (selectedTask.type) {
|
|
10960
|
+
case "milestone":
|
|
10961
|
+
result = handleTaskBySVGMouseEventForMilestone(
|
|
10962
|
+
action,
|
|
10963
|
+
selectedTask,
|
|
10964
|
+
initialCoordinates,
|
|
10965
|
+
coordinates,
|
|
10966
|
+
xStep,
|
|
10967
|
+
timeStep
|
|
10968
|
+
);
|
|
10969
|
+
break;
|
|
10970
|
+
default:
|
|
10971
|
+
result = handleTaskBySVGMouseEventForBar(
|
|
10972
|
+
action,
|
|
10973
|
+
selectedTask,
|
|
10974
|
+
initialCoordinates,
|
|
10975
|
+
coordinates,
|
|
10976
|
+
xStep,
|
|
10977
|
+
timeStep,
|
|
10978
|
+
rtl
|
|
10979
|
+
);
|
|
10980
|
+
break;
|
|
10981
|
+
}
|
|
10982
|
+
return result;
|
|
10983
|
+
};
|
|
10984
|
+
const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
10985
|
+
const changedTask = { ...selectedTask };
|
|
10986
|
+
let isChanged = false;
|
|
10987
|
+
switch (action) {
|
|
10988
|
+
case "progress":
|
|
10989
|
+
isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
|
|
10990
|
+
if (isChanged) {
|
|
10991
|
+
changedTask.progress = Math.round(
|
|
10992
|
+
coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
|
|
10993
|
+
);
|
|
10994
|
+
}
|
|
10995
|
+
break;
|
|
10996
|
+
case "start": {
|
|
10997
|
+
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
10998
|
+
if (isChanged) {
|
|
10999
|
+
if (rtl) {
|
|
11000
|
+
changedTask.end = dateByX(
|
|
11001
|
+
coordinates.x1,
|
|
11002
|
+
initialCoordinates.x1,
|
|
11003
|
+
selectedTask.end,
|
|
11004
|
+
xStep,
|
|
11005
|
+
timeStep
|
|
11006
|
+
);
|
|
11007
|
+
} else {
|
|
11008
|
+
changedTask.start = dateByX(
|
|
11009
|
+
coordinates.x1,
|
|
11010
|
+
initialCoordinates.x1,
|
|
11011
|
+
selectedTask.start,
|
|
11012
|
+
xStep,
|
|
11013
|
+
timeStep
|
|
11014
|
+
);
|
|
11015
|
+
}
|
|
11016
|
+
}
|
|
11017
|
+
break;
|
|
11018
|
+
}
|
|
11019
|
+
case "end": {
|
|
11020
|
+
isChanged = initialCoordinates.x2 !== coordinates.x2;
|
|
11021
|
+
if (isChanged) {
|
|
11022
|
+
if (rtl) {
|
|
11023
|
+
changedTask.start = dateByX(
|
|
11024
|
+
coordinates.x2,
|
|
11025
|
+
initialCoordinates.x2,
|
|
11026
|
+
selectedTask.start,
|
|
11027
|
+
xStep,
|
|
11028
|
+
timeStep
|
|
11029
|
+
);
|
|
11030
|
+
} else {
|
|
11031
|
+
changedTask.end = dateByX(
|
|
11032
|
+
coordinates.x2,
|
|
11033
|
+
initialCoordinates.x2,
|
|
11034
|
+
selectedTask.end,
|
|
11035
|
+
xStep,
|
|
11036
|
+
timeStep
|
|
11037
|
+
);
|
|
11038
|
+
}
|
|
11039
|
+
}
|
|
11040
|
+
break;
|
|
11041
|
+
}
|
|
11042
|
+
case "move": {
|
|
11043
|
+
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11044
|
+
if (isChanged) {
|
|
11045
|
+
if (rtl) {
|
|
11046
|
+
changedTask.end = dateByX(
|
|
11047
|
+
coordinates.x1,
|
|
11048
|
+
initialCoordinates.x1,
|
|
11049
|
+
selectedTask.end,
|
|
11050
|
+
xStep,
|
|
11051
|
+
timeStep
|
|
11052
|
+
);
|
|
11053
|
+
changedTask.start = dateByX(
|
|
11054
|
+
coordinates.x2,
|
|
11055
|
+
initialCoordinates.x2,
|
|
11056
|
+
selectedTask.start,
|
|
11057
|
+
xStep,
|
|
11058
|
+
timeStep
|
|
11059
|
+
);
|
|
11060
|
+
} else {
|
|
11061
|
+
changedTask.start = dateByX(
|
|
11062
|
+
coordinates.x1,
|
|
11063
|
+
initialCoordinates.x1,
|
|
11064
|
+
selectedTask.start,
|
|
11065
|
+
xStep,
|
|
11066
|
+
timeStep
|
|
11067
|
+
);
|
|
11068
|
+
changedTask.end = dateByX(
|
|
11069
|
+
coordinates.x2,
|
|
11070
|
+
initialCoordinates.x2,
|
|
11071
|
+
selectedTask.end,
|
|
11072
|
+
xStep,
|
|
11073
|
+
timeStep
|
|
11074
|
+
);
|
|
11075
|
+
}
|
|
11076
|
+
}
|
|
11077
|
+
break;
|
|
11078
|
+
}
|
|
11079
|
+
}
|
|
11080
|
+
return { isChanged, changedTask };
|
|
11081
|
+
};
|
|
11082
|
+
const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
|
|
11083
|
+
const changedTask = { ...selectedTask };
|
|
11084
|
+
const isChanged = coordinates.x1 !== initialCoordinates.x1;
|
|
11085
|
+
if (isChanged) {
|
|
11086
|
+
switch (action) {
|
|
11087
|
+
case "move": {
|
|
11088
|
+
changedTask.start = dateByX(
|
|
11089
|
+
coordinates.x1,
|
|
11090
|
+
initialCoordinates.x1,
|
|
11091
|
+
selectedTask.start,
|
|
11092
|
+
xStep,
|
|
11093
|
+
timeStep
|
|
11094
|
+
);
|
|
11095
|
+
changedTask.end = changedTask.start;
|
|
11096
|
+
break;
|
|
11097
|
+
}
|
|
11098
|
+
}
|
|
11099
|
+
}
|
|
11100
|
+
return { isChanged, changedTask };
|
|
11101
|
+
};
|
|
10904
11102
|
const ganttToday = "_ganttToday_1oyhk_1";
|
|
10905
11103
|
const ganttTodayCircle = "_ganttTodayCircle_1oyhk_9";
|
|
10906
11104
|
const styles$c = {
|
|
@@ -10912,12 +11110,12 @@ const GanttTodayInner = ({
|
|
|
10912
11110
|
distances: { columnWidth },
|
|
10913
11111
|
ganttFullHeight,
|
|
10914
11112
|
isUnknownDates,
|
|
11113
|
+
rtl,
|
|
10915
11114
|
startDate,
|
|
10916
11115
|
viewMode,
|
|
10917
11116
|
showTodayLine = true,
|
|
10918
11117
|
showDataDateLine = false,
|
|
10919
11118
|
dataDate = null,
|
|
10920
|
-
dataDateX,
|
|
10921
11119
|
todayColor = null,
|
|
10922
11120
|
dataDateColor = null,
|
|
10923
11121
|
todayLabel = "Today",
|
|
@@ -10928,164 +11126,110 @@ const GanttTodayInner = ({
|
|
|
10928
11126
|
return null;
|
|
10929
11127
|
}
|
|
10930
11128
|
const today = /* @__PURE__ */ new Date();
|
|
10931
|
-
const
|
|
10932
|
-
const
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
const percent = today.getDay() / 7;
|
|
10936
|
-
return 1 + percent * 0.2;
|
|
10937
|
-
}
|
|
10938
|
-
case ViewMode.Month: {
|
|
10939
|
-
const dayInMonth = today.getDate();
|
|
10940
|
-
const maxDaysInMonth = getDaysInMonth(
|
|
10941
|
-
today.getMonth(),
|
|
10942
|
-
today.getFullYear()
|
|
10943
|
-
);
|
|
10944
|
-
const percent = dayInMonth / maxDaysInMonth;
|
|
10945
|
-
return 1 + percent * 0.5;
|
|
10946
|
-
}
|
|
10947
|
-
case ViewMode.Year: {
|
|
10948
|
-
const todayOfYear = Math.floor(
|
|
10949
|
-
(today.getTime() - new Date(today.getFullYear(), 0, 0).getTime()) / (1e3 * 60 * 60 * 24)
|
|
10950
|
-
);
|
|
10951
|
-
const totalDaysInYear = new Date(today.getFullYear(), 11, 31).getDate() === 31 ? 366 : 365;
|
|
10952
|
-
const percent = todayOfYear / totalDaysInYear;
|
|
10953
|
-
return 1 + percent * 0.5;
|
|
10954
|
-
}
|
|
10955
|
-
default:
|
|
10956
|
-
return 1;
|
|
10957
|
-
}
|
|
10958
|
-
};
|
|
10959
|
-
const x = additionalLeftSpace + todayIndex * columnWidth * extraMultiplier();
|
|
10960
|
-
return /* @__PURE__ */ jsxs("g", { className: "today-line", children: [
|
|
11129
|
+
const tickX = taskXCoordinate(today, startDate, viewMode, columnWidth);
|
|
11130
|
+
const x = rtl ? tickX + columnWidth : tickX;
|
|
11131
|
+
const color = todayColor || "var(--gantt-calendar-today-color)";
|
|
11132
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10961
11133
|
/* @__PURE__ */ jsx(
|
|
10962
|
-
"
|
|
11134
|
+
"rect",
|
|
10963
11135
|
{
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
stroke: todayColor || void 0
|
|
11136
|
+
x: additionalLeftSpace + x,
|
|
11137
|
+
y: 0,
|
|
11138
|
+
width: 2,
|
|
11139
|
+
height: ganttFullHeight,
|
|
11140
|
+
fill: color
|
|
10970
11141
|
}
|
|
10971
11142
|
),
|
|
10972
11143
|
/* @__PURE__ */ jsx(
|
|
10973
|
-
"
|
|
11144
|
+
"circle",
|
|
10974
11145
|
{
|
|
10975
|
-
className: styles$c.
|
|
10976
|
-
|
|
10977
|
-
|
|
11146
|
+
className: styles$c.ganttTodayCircle,
|
|
11147
|
+
cx: x + 1,
|
|
11148
|
+
cy: 6,
|
|
11149
|
+
r: 6,
|
|
11150
|
+
fill: color
|
|
10978
11151
|
}
|
|
10979
11152
|
),
|
|
10980
11153
|
/* @__PURE__ */ jsx(
|
|
10981
11154
|
"text",
|
|
10982
11155
|
{
|
|
10983
|
-
x,
|
|
10984
|
-
y:
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
11156
|
+
x: additionalLeftSpace + x + 8,
|
|
11157
|
+
y: 10,
|
|
11158
|
+
fill: color,
|
|
11159
|
+
fontSize: 12,
|
|
11160
|
+
fontWeight: 600,
|
|
10988
11161
|
children: todayLabel
|
|
10989
11162
|
}
|
|
10990
11163
|
)
|
|
10991
|
-
] }
|
|
11164
|
+
] });
|
|
10992
11165
|
}, [
|
|
10993
|
-
isUnknownDates,
|
|
10994
|
-
showTodayLine,
|
|
10995
|
-
startDate,
|
|
10996
|
-
viewMode,
|
|
10997
11166
|
additionalLeftSpace,
|
|
10998
11167
|
columnWidth,
|
|
10999
11168
|
ganttFullHeight,
|
|
11169
|
+
isUnknownDates,
|
|
11170
|
+
rtl,
|
|
11171
|
+
startDate,
|
|
11172
|
+
viewMode,
|
|
11173
|
+
showTodayLine,
|
|
11000
11174
|
todayColor,
|
|
11001
11175
|
todayLabel
|
|
11002
11176
|
]);
|
|
11003
11177
|
const dataDateElement = useMemo(() => {
|
|
11004
|
-
if (
|
|
11178
|
+
if (!showDataDateLine || !dataDate) {
|
|
11005
11179
|
return null;
|
|
11006
11180
|
}
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
const dataDateIndex = getDatesDiff(dataDate, startDate, viewMode);
|
|
11012
|
-
const extraMultiplier = () => {
|
|
11013
|
-
switch (viewMode) {
|
|
11014
|
-
case ViewMode.Week: {
|
|
11015
|
-
const percent = dataDate.getDay() / 7;
|
|
11016
|
-
return 1 + percent * 0.2;
|
|
11017
|
-
}
|
|
11018
|
-
case ViewMode.Month: {
|
|
11019
|
-
const dayInMonth = dataDate.getDate();
|
|
11020
|
-
const maxDaysInMonth = getDaysInMonth(
|
|
11021
|
-
dataDate.getMonth(),
|
|
11022
|
-
dataDate.getFullYear()
|
|
11023
|
-
);
|
|
11024
|
-
const percent = dayInMonth / maxDaysInMonth;
|
|
11025
|
-
return 1 + percent * 0.5;
|
|
11026
|
-
}
|
|
11027
|
-
case ViewMode.Year: {
|
|
11028
|
-
const dataDateOfYear = Math.floor(
|
|
11029
|
-
(dataDate.getTime() - new Date(dataDate.getFullYear(), 0, 0).getTime()) / (1e3 * 60 * 60 * 24)
|
|
11030
|
-
);
|
|
11031
|
-
const totalDaysInYear = new Date(dataDate.getFullYear(), 11, 31).getDate() === 31 ? 366 : 365;
|
|
11032
|
-
const percent = dataDateOfYear / totalDaysInYear;
|
|
11033
|
-
return 1 + percent * 0.5;
|
|
11034
|
-
}
|
|
11035
|
-
default:
|
|
11036
|
-
return 1;
|
|
11037
|
-
}
|
|
11038
|
-
};
|
|
11039
|
-
x = additionalLeftSpace + dataDateIndex * columnWidth * extraMultiplier();
|
|
11040
|
-
}
|
|
11041
|
-
return /* @__PURE__ */ jsxs("g", { className: "data-date-line", children: [
|
|
11181
|
+
const tickX = taskXCoordinate(dataDate, startDate, viewMode, columnWidth);
|
|
11182
|
+
const x = rtl ? tickX + columnWidth : tickX;
|
|
11183
|
+
const color = dataDateColor || "var(--gantt-calendar-today-color)";
|
|
11184
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11042
11185
|
/* @__PURE__ */ jsx(
|
|
11043
|
-
"
|
|
11186
|
+
"rect",
|
|
11044
11187
|
{
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11188
|
+
x: additionalLeftSpace + x,
|
|
11189
|
+
y: 0,
|
|
11190
|
+
width: 2,
|
|
11191
|
+
height: ganttFullHeight,
|
|
11192
|
+
fill: color,
|
|
11193
|
+
opacity: 0.9
|
|
11051
11194
|
}
|
|
11052
11195
|
),
|
|
11053
11196
|
/* @__PURE__ */ jsx(
|
|
11054
|
-
"
|
|
11197
|
+
"circle",
|
|
11055
11198
|
{
|
|
11056
|
-
className: styles$c.
|
|
11057
|
-
|
|
11058
|
-
|
|
11199
|
+
className: styles$c.ganttTodayCircle,
|
|
11200
|
+
cx: x + 1,
|
|
11201
|
+
cy: 6,
|
|
11202
|
+
r: 6,
|
|
11203
|
+
fill: color
|
|
11059
11204
|
}
|
|
11060
11205
|
),
|
|
11061
11206
|
/* @__PURE__ */ jsx(
|
|
11062
11207
|
"text",
|
|
11063
11208
|
{
|
|
11064
|
-
x,
|
|
11065
|
-
y:
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
children: dataDateLabel
|
|
11209
|
+
x: additionalLeftSpace + x + 8,
|
|
11210
|
+
y: 10,
|
|
11211
|
+
fill: color,
|
|
11212
|
+
fontSize: 12,
|
|
11213
|
+
fontWeight: 600,
|
|
11214
|
+
children: dataDateLabel || "Data Date"
|
|
11070
11215
|
}
|
|
11071
11216
|
)
|
|
11072
|
-
] }
|
|
11217
|
+
] });
|
|
11073
11218
|
}, [
|
|
11074
|
-
isUnknownDates,
|
|
11075
|
-
showDataDateLine,
|
|
11076
|
-
dataDate,
|
|
11077
|
-
dataDateX,
|
|
11078
|
-
startDate,
|
|
11079
|
-
viewMode,
|
|
11080
11219
|
additionalLeftSpace,
|
|
11081
11220
|
columnWidth,
|
|
11082
11221
|
ganttFullHeight,
|
|
11222
|
+
rtl,
|
|
11223
|
+
startDate,
|
|
11224
|
+
viewMode,
|
|
11225
|
+
showDataDateLine,
|
|
11226
|
+
dataDate,
|
|
11083
11227
|
dataDateColor,
|
|
11084
11228
|
dataDateLabel
|
|
11085
11229
|
]);
|
|
11086
|
-
return /* @__PURE__ */ jsxs(
|
|
11087
|
-
|
|
11088
|
-
|
|
11230
|
+
return /* @__PURE__ */ jsxs("g", { className: "today", children: [
|
|
11231
|
+
dataDateElement,
|
|
11232
|
+
todayElement
|
|
11089
11233
|
] });
|
|
11090
11234
|
};
|
|
11091
11235
|
const GanttToday = memo(GanttTodayInner);
|
|
@@ -11675,304 +11819,106 @@ const ArrowInner = (props) => {
|
|
|
11675
11819
|
} = props;
|
|
11676
11820
|
const indexFrom = useMemo(
|
|
11677
11821
|
() => Math.floor(fromY / fullRowHeight),
|
|
11678
|
-
[fromY, fullRowHeight]
|
|
11679
|
-
);
|
|
11680
|
-
const indexTo = useMemo(
|
|
11681
|
-
() => Math.floor(toY / fullRowHeight),
|
|
11682
|
-
[toY, fullRowHeight]
|
|
11683
|
-
);
|
|
11684
|
-
const onDoubleClick = useCallback(() => {
|
|
11685
|
-
if (onArrowDoubleClick) {
|
|
11686
|
-
onArrowDoubleClick(taskFrom, taskTo);
|
|
11687
|
-
}
|
|
11688
|
-
}, [taskFrom, taskTo, onArrowDoubleClick]);
|
|
11689
|
-
const [path, trianglePoints] = useMemo(
|
|
11690
|
-
() => drownPathAndTriangle(
|
|
11691
|
-
indexFrom,
|
|
11692
|
-
fromX1,
|
|
11693
|
-
fromX2,
|
|
11694
|
-
fromY,
|
|
11695
|
-
targetFrom === "startOfTask" !== rtl,
|
|
11696
|
-
indexTo,
|
|
11697
|
-
toX1,
|
|
11698
|
-
toX2,
|
|
11699
|
-
toY,
|
|
11700
|
-
targetTo === "startOfTask" !== rtl,
|
|
11701
|
-
fullRowHeight,
|
|
11702
|
-
taskHeight,
|
|
11703
|
-
arrowIndent
|
|
11704
|
-
),
|
|
11705
|
-
[
|
|
11706
|
-
indexFrom,
|
|
11707
|
-
fromX1,
|
|
11708
|
-
fromX2,
|
|
11709
|
-
fromY,
|
|
11710
|
-
targetFrom,
|
|
11711
|
-
indexTo,
|
|
11712
|
-
toX1,
|
|
11713
|
-
toX2,
|
|
11714
|
-
toY,
|
|
11715
|
-
targetTo,
|
|
11716
|
-
rtl,
|
|
11717
|
-
fullRowHeight,
|
|
11718
|
-
taskHeight,
|
|
11719
|
-
arrowIndent
|
|
11720
|
-
]
|
|
11721
|
-
);
|
|
11722
|
-
const color = useMemo(() => {
|
|
11723
|
-
if (isCritical) {
|
|
11724
|
-
return "var(--gantt-arrow-critical-color)";
|
|
11725
|
-
}
|
|
11726
|
-
return "var(--gantt-arrow-color)";
|
|
11727
|
-
}, [isCritical]);
|
|
11728
|
-
return /* @__PURE__ */ jsx("g", { fill: color, stroke: color, children: /* @__PURE__ */ jsxs(
|
|
11729
|
-
"g",
|
|
11730
|
-
{
|
|
11731
|
-
"data-testid": `task-arrow-${targetFrom}-${taskFrom.name}-${targetTo}-${taskTo.name}`,
|
|
11732
|
-
className: `arrow ${styles$a.arrow_clickable}`,
|
|
11733
|
-
onDoubleClick,
|
|
11734
|
-
children: [
|
|
11735
|
-
onArrowDoubleClick && /* @__PURE__ */ jsx("path", { d: path, className: styles$a.clickZone }),
|
|
11736
|
-
/* @__PURE__ */ jsx("path", { className: styles$a.mainPath, d: path }),
|
|
11737
|
-
/* @__PURE__ */ jsx("polygon", { className: "polygon", points: trianglePoints })
|
|
11738
|
-
]
|
|
11739
|
-
}
|
|
11740
|
-
) });
|
|
11741
|
-
};
|
|
11742
|
-
const Arrow = memo(ArrowInner);
|
|
11743
|
-
const drownPathAndTriangle = (indexForm, fromX1, fromX2, fromY, isTaskFromLeftSide, indexTo, toX1, toX2, toY, isTaskToLeftSide, fullRowHeight, taskHeight, arrowIndent) => {
|
|
11744
|
-
const isDownDirected = indexTo > indexForm;
|
|
11745
|
-
const horizontalDockingY = isDownDirected ? (indexForm + 1) * fullRowHeight : indexForm * fullRowHeight;
|
|
11746
|
-
const taskFromEndPositionX = isTaskFromLeftSide ? fromX1 - arrowIndent : fromX2 + arrowIndent;
|
|
11747
|
-
const taskToEndPositionX = isTaskToLeftSide ? toX1 - arrowIndent : toX2 + arrowIndent;
|
|
11748
|
-
const taskToEndPositionY = toY + taskHeight / 2;
|
|
11749
|
-
const path = `M ${isTaskFromLeftSide ? fromX1 : fromX2} ${fromY + taskHeight / 2}
|
|
11750
|
-
H ${taskFromEndPositionX}
|
|
11751
|
-
V ${horizontalDockingY}
|
|
11752
|
-
H ${taskToEndPositionX}
|
|
11753
|
-
V ${taskToEndPositionY}
|
|
11754
|
-
H ${isTaskToLeftSide ? toX1 : toX2}`;
|
|
11755
|
-
const trianglePoints = isTaskToLeftSide ? generateTrianglePoints(toX1, taskToEndPositionY, 5, false) : generateTrianglePoints(toX2, taskToEndPositionY, 5, true);
|
|
11756
|
-
return [path, trianglePoints];
|
|
11757
|
-
};
|
|
11758
|
-
const relationLine = "_relationLine_wh2qy_1";
|
|
11759
|
-
const styles$9 = {
|
|
11760
|
-
relationLine
|
|
11761
|
-
};
|
|
11762
|
-
const RelationLine = ({
|
|
11763
|
-
x1,
|
|
11764
|
-
x2,
|
|
11765
|
-
y1,
|
|
11766
|
-
y2
|
|
11767
|
-
}) => {
|
|
11768
|
-
return /* @__PURE__ */ jsx(
|
|
11769
|
-
"line",
|
|
11770
|
-
{
|
|
11771
|
-
x1,
|
|
11772
|
-
x2,
|
|
11773
|
-
y1,
|
|
11774
|
-
y2,
|
|
11775
|
-
className: styles$9.relationLine
|
|
11776
|
-
}
|
|
11777
|
-
);
|
|
11778
|
-
};
|
|
11779
|
-
const getDateByOffset = (startDate, offset2, viewMode) => {
|
|
11780
|
-
switch (viewMode) {
|
|
11781
|
-
case ViewMode.Day:
|
|
11782
|
-
return addDays(startDate, offset2);
|
|
11783
|
-
case ViewMode.HalfDay:
|
|
11784
|
-
return addHours(startDate, offset2 * 12);
|
|
11785
|
-
case ViewMode.QuarterDay:
|
|
11786
|
-
return addHours(startDate, offset2 * 6);
|
|
11787
|
-
case ViewMode.Hour:
|
|
11788
|
-
return addHours(startDate, offset2);
|
|
11789
|
-
case ViewMode.Month:
|
|
11790
|
-
return addMonths(startDate, offset2);
|
|
11791
|
-
case ViewMode.Week:
|
|
11792
|
-
return addWeeks(startDate, offset2);
|
|
11793
|
-
case ViewMode.Year:
|
|
11794
|
-
return addYears(startDate, offset2);
|
|
11795
|
-
default:
|
|
11796
|
-
throw new Error("Unknown view mode");
|
|
11797
|
-
}
|
|
11798
|
-
};
|
|
11799
|
-
const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11800
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11801
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11802
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11803
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11804
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11805
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11806
|
-
};
|
|
11807
|
-
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11808
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11809
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11810
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11811
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11812
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11813
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11814
|
-
};
|
|
11815
|
-
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
11816
|
-
const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
|
|
11817
|
-
let progressX;
|
|
11818
|
-
if (rtl) {
|
|
11819
|
-
progressX = taskX2 - progressWidth;
|
|
11820
|
-
} else {
|
|
11821
|
-
progressX = taskX1;
|
|
11822
|
-
}
|
|
11823
|
-
return [progressWidth, progressX];
|
|
11824
|
-
};
|
|
11825
|
-
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
11826
|
-
let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
11827
|
-
newDate = new Date(
|
|
11828
|
-
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
11829
|
-
);
|
|
11830
|
-
return newDate;
|
|
11831
|
-
};
|
|
11832
|
-
const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11833
|
-
let result;
|
|
11834
|
-
switch (selectedTask.type) {
|
|
11835
|
-
case "milestone":
|
|
11836
|
-
result = handleTaskBySVGMouseEventForMilestone(
|
|
11837
|
-
action,
|
|
11838
|
-
selectedTask,
|
|
11839
|
-
initialCoordinates,
|
|
11840
|
-
coordinates,
|
|
11841
|
-
xStep,
|
|
11842
|
-
timeStep
|
|
11843
|
-
);
|
|
11844
|
-
break;
|
|
11845
|
-
default:
|
|
11846
|
-
result = handleTaskBySVGMouseEventForBar(
|
|
11847
|
-
action,
|
|
11848
|
-
selectedTask,
|
|
11849
|
-
initialCoordinates,
|
|
11850
|
-
coordinates,
|
|
11851
|
-
xStep,
|
|
11852
|
-
timeStep,
|
|
11853
|
-
rtl
|
|
11854
|
-
);
|
|
11855
|
-
break;
|
|
11856
|
-
}
|
|
11857
|
-
return result;
|
|
11858
|
-
};
|
|
11859
|
-
const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11860
|
-
const changedTask = { ...selectedTask };
|
|
11861
|
-
let isChanged = false;
|
|
11862
|
-
switch (action) {
|
|
11863
|
-
case "progress":
|
|
11864
|
-
isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
|
|
11865
|
-
if (isChanged) {
|
|
11866
|
-
changedTask.progress = Math.round(
|
|
11867
|
-
coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
|
|
11868
|
-
);
|
|
11869
|
-
}
|
|
11870
|
-
break;
|
|
11871
|
-
case "start": {
|
|
11872
|
-
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11873
|
-
if (isChanged) {
|
|
11874
|
-
if (rtl) {
|
|
11875
|
-
changedTask.end = dateByX(
|
|
11876
|
-
coordinates.x1,
|
|
11877
|
-
initialCoordinates.x1,
|
|
11878
|
-
selectedTask.end,
|
|
11879
|
-
xStep,
|
|
11880
|
-
timeStep
|
|
11881
|
-
);
|
|
11882
|
-
} else {
|
|
11883
|
-
changedTask.start = dateByX(
|
|
11884
|
-
coordinates.x1,
|
|
11885
|
-
initialCoordinates.x1,
|
|
11886
|
-
selectedTask.start,
|
|
11887
|
-
xStep,
|
|
11888
|
-
timeStep
|
|
11889
|
-
);
|
|
11890
|
-
}
|
|
11891
|
-
}
|
|
11892
|
-
break;
|
|
11822
|
+
[fromY, fullRowHeight]
|
|
11823
|
+
);
|
|
11824
|
+
const indexTo = useMemo(
|
|
11825
|
+
() => Math.floor(toY / fullRowHeight),
|
|
11826
|
+
[toY, fullRowHeight]
|
|
11827
|
+
);
|
|
11828
|
+
const onDoubleClick = useCallback(() => {
|
|
11829
|
+
if (onArrowDoubleClick) {
|
|
11830
|
+
onArrowDoubleClick(taskFrom, taskTo);
|
|
11893
11831
|
}
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11832
|
+
}, [taskFrom, taskTo, onArrowDoubleClick]);
|
|
11833
|
+
const [path, trianglePoints] = useMemo(
|
|
11834
|
+
() => drownPathAndTriangle(
|
|
11835
|
+
indexFrom,
|
|
11836
|
+
fromX1,
|
|
11837
|
+
fromX2,
|
|
11838
|
+
fromY,
|
|
11839
|
+
targetFrom === "startOfTask" !== rtl,
|
|
11840
|
+
indexTo,
|
|
11841
|
+
toX1,
|
|
11842
|
+
toX2,
|
|
11843
|
+
toY,
|
|
11844
|
+
targetTo === "startOfTask" !== rtl,
|
|
11845
|
+
fullRowHeight,
|
|
11846
|
+
taskHeight,
|
|
11847
|
+
arrowIndent
|
|
11848
|
+
),
|
|
11849
|
+
[
|
|
11850
|
+
indexFrom,
|
|
11851
|
+
fromX1,
|
|
11852
|
+
fromX2,
|
|
11853
|
+
fromY,
|
|
11854
|
+
targetFrom,
|
|
11855
|
+
indexTo,
|
|
11856
|
+
toX1,
|
|
11857
|
+
toX2,
|
|
11858
|
+
toY,
|
|
11859
|
+
targetTo,
|
|
11860
|
+
rtl,
|
|
11861
|
+
fullRowHeight,
|
|
11862
|
+
taskHeight,
|
|
11863
|
+
arrowIndent
|
|
11864
|
+
]
|
|
11865
|
+
);
|
|
11866
|
+
const color = useMemo(() => {
|
|
11867
|
+
if (isCritical) {
|
|
11868
|
+
return "var(--gantt-arrow-critical-color)";
|
|
11916
11869
|
}
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
initialCoordinates.x2,
|
|
11931
|
-
selectedTask.start,
|
|
11932
|
-
xStep,
|
|
11933
|
-
timeStep
|
|
11934
|
-
);
|
|
11935
|
-
} else {
|
|
11936
|
-
changedTask.start = dateByX(
|
|
11937
|
-
coordinates.x1,
|
|
11938
|
-
initialCoordinates.x1,
|
|
11939
|
-
selectedTask.start,
|
|
11940
|
-
xStep,
|
|
11941
|
-
timeStep
|
|
11942
|
-
);
|
|
11943
|
-
changedTask.end = dateByX(
|
|
11944
|
-
coordinates.x2,
|
|
11945
|
-
initialCoordinates.x2,
|
|
11946
|
-
selectedTask.end,
|
|
11947
|
-
xStep,
|
|
11948
|
-
timeStep
|
|
11949
|
-
);
|
|
11950
|
-
}
|
|
11951
|
-
}
|
|
11952
|
-
break;
|
|
11870
|
+
return "var(--gantt-arrow-color)";
|
|
11871
|
+
}, [isCritical]);
|
|
11872
|
+
return /* @__PURE__ */ jsx("g", { fill: color, stroke: color, children: /* @__PURE__ */ jsxs(
|
|
11873
|
+
"g",
|
|
11874
|
+
{
|
|
11875
|
+
"data-testid": `task-arrow-${targetFrom}-${taskFrom.name}-${targetTo}-${taskTo.name}`,
|
|
11876
|
+
className: `arrow ${styles$a.arrow_clickable}`,
|
|
11877
|
+
onDoubleClick,
|
|
11878
|
+
children: [
|
|
11879
|
+
onArrowDoubleClick && /* @__PURE__ */ jsx("path", { d: path, className: styles$a.clickZone }),
|
|
11880
|
+
/* @__PURE__ */ jsx("path", { className: styles$a.mainPath, d: path }),
|
|
11881
|
+
/* @__PURE__ */ jsx("polygon", { className: "polygon", points: trianglePoints })
|
|
11882
|
+
]
|
|
11953
11883
|
}
|
|
11954
|
-
}
|
|
11955
|
-
return { isChanged, changedTask };
|
|
11884
|
+
) });
|
|
11956
11885
|
};
|
|
11957
|
-
const
|
|
11958
|
-
|
|
11959
|
-
const
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11886
|
+
const Arrow = memo(ArrowInner);
|
|
11887
|
+
const drownPathAndTriangle = (indexForm, fromX1, fromX2, fromY, isTaskFromLeftSide, indexTo, toX1, toX2, toY, isTaskToLeftSide, fullRowHeight, taskHeight, arrowIndent) => {
|
|
11888
|
+
const isDownDirected = indexTo > indexForm;
|
|
11889
|
+
const horizontalDockingY = isDownDirected ? (indexForm + 1) * fullRowHeight : indexForm * fullRowHeight;
|
|
11890
|
+
const taskFromEndPositionX = isTaskFromLeftSide ? fromX1 - arrowIndent : fromX2 + arrowIndent;
|
|
11891
|
+
const taskToEndPositionX = isTaskToLeftSide ? toX1 - arrowIndent : toX2 + arrowIndent;
|
|
11892
|
+
const taskToEndPositionY = toY + taskHeight / 2;
|
|
11893
|
+
const path = `M ${isTaskFromLeftSide ? fromX1 : fromX2} ${fromY + taskHeight / 2}
|
|
11894
|
+
H ${taskFromEndPositionX}
|
|
11895
|
+
V ${horizontalDockingY}
|
|
11896
|
+
H ${taskToEndPositionX}
|
|
11897
|
+
V ${taskToEndPositionY}
|
|
11898
|
+
H ${isTaskToLeftSide ? toX1 : toX2}`;
|
|
11899
|
+
const trianglePoints = isTaskToLeftSide ? generateTrianglePoints(toX1, taskToEndPositionY, 5, false) : generateTrianglePoints(toX2, taskToEndPositionY, 5, true);
|
|
11900
|
+
return [path, trianglePoints];
|
|
11901
|
+
};
|
|
11902
|
+
const relationLine = "_relationLine_wh2qy_1";
|
|
11903
|
+
const styles$9 = {
|
|
11904
|
+
relationLine
|
|
11905
|
+
};
|
|
11906
|
+
const RelationLine = ({
|
|
11907
|
+
x1,
|
|
11908
|
+
x2,
|
|
11909
|
+
y1,
|
|
11910
|
+
y2
|
|
11911
|
+
}) => {
|
|
11912
|
+
return /* @__PURE__ */ jsx(
|
|
11913
|
+
"line",
|
|
11914
|
+
{
|
|
11915
|
+
x1,
|
|
11916
|
+
x2,
|
|
11917
|
+
y1,
|
|
11918
|
+
y2,
|
|
11919
|
+
className: styles$9.relationLine
|
|
11973
11920
|
}
|
|
11974
|
-
|
|
11975
|
-
return { isChanged, changedTask };
|
|
11921
|
+
);
|
|
11976
11922
|
};
|
|
11977
11923
|
const barWrapper = "_barWrapper_5jhkr_1";
|
|
11978
11924
|
const barHandle = "_barHandle_5jhkr_11";
|
|
@@ -11989,9 +11935,9 @@ const styles$8 = {
|
|
|
11989
11935
|
const BarDisplay = ({
|
|
11990
11936
|
taskId,
|
|
11991
11937
|
barCornerRadius,
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
|
|
11938
|
+
isCritical,
|
|
11939
|
+
isSelected,
|
|
11940
|
+
hasChildren,
|
|
11995
11941
|
height,
|
|
11996
11942
|
progressWidth,
|
|
11997
11943
|
progressX,
|
|
@@ -12000,11 +11946,60 @@ const BarDisplay = ({
|
|
|
12000
11946
|
x,
|
|
12001
11947
|
y,
|
|
12002
11948
|
customStyle,
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
showProgressBar = true,
|
|
12006
|
-
progressBarColor
|
|
11949
|
+
showProgress = true,
|
|
11950
|
+
progressColor
|
|
12007
11951
|
}) => {
|
|
11952
|
+
const processColor = useMemo(() => {
|
|
11953
|
+
if (progressColor) {
|
|
11954
|
+
return progressColor;
|
|
11955
|
+
}
|
|
11956
|
+
if (isCritical) {
|
|
11957
|
+
if (hasChildren) {
|
|
11958
|
+
if (isSelected) {
|
|
11959
|
+
return "var(--gantt-group-progress-selected-critical-color)";
|
|
11960
|
+
}
|
|
11961
|
+
return "var(--gantt-group-progress-critical-color)";
|
|
11962
|
+
}
|
|
11963
|
+
if (isSelected) {
|
|
11964
|
+
return "var(--gantt-bar-progress-selected-critical-color)";
|
|
11965
|
+
}
|
|
11966
|
+
return "var(--gantt-bar-progress-critical-color)";
|
|
11967
|
+
}
|
|
11968
|
+
if (hasChildren) {
|
|
11969
|
+
if (isSelected) {
|
|
11970
|
+
return "var(--gantt-group-progress-selected-color)";
|
|
11971
|
+
}
|
|
11972
|
+
return "var(--gantt-group-progress-color)";
|
|
11973
|
+
}
|
|
11974
|
+
if (isSelected) {
|
|
11975
|
+
return "var(--gantt-bar-progress-selected-color)";
|
|
11976
|
+
}
|
|
11977
|
+
return "var(--gantt-bar-progress-color)";
|
|
11978
|
+
}, [isSelected, isCritical, hasChildren, progressColor]);
|
|
11979
|
+
const barColor = useMemo(() => {
|
|
11980
|
+
if (isCritical) {
|
|
11981
|
+
if (hasChildren) {
|
|
11982
|
+
if (isSelected) {
|
|
11983
|
+
return "var(--gantt-group-background-selected-critical-color)";
|
|
11984
|
+
}
|
|
11985
|
+
return "var(--gantt-group-background-critical-color)";
|
|
11986
|
+
}
|
|
11987
|
+
if (isSelected) {
|
|
11988
|
+
return "var(--gantt-bar-background-selected-critical-color)";
|
|
11989
|
+
}
|
|
11990
|
+
return "var(--gantt-bar-background-critical-color)";
|
|
11991
|
+
}
|
|
11992
|
+
if (hasChildren) {
|
|
11993
|
+
if (isSelected) {
|
|
11994
|
+
return "var(--gantt-group-background-selected-color)";
|
|
11995
|
+
}
|
|
11996
|
+
return "var(--gantt-group-background-color)";
|
|
11997
|
+
}
|
|
11998
|
+
if (isSelected) {
|
|
11999
|
+
return "var(--gantt-bar-background-selected-color)";
|
|
12000
|
+
}
|
|
12001
|
+
return "var(--gantt-bar-background-color)";
|
|
12002
|
+
}, [isSelected, isCritical, hasChildren]);
|
|
12008
12003
|
return /* @__PURE__ */ jsxs(
|
|
12009
12004
|
"g",
|
|
12010
12005
|
{
|
|
@@ -12022,40 +12017,7 @@ const BarDisplay = ({
|
|
|
12022
12017
|
}
|
|
12023
12018
|
},
|
|
12024
12019
|
children: [
|
|
12025
|
-
|
|
12026
|
-
var _a, _b;
|
|
12027
|
-
const localSplit = Math.max(0, Math.min(width, dataDateX - x));
|
|
12028
|
-
const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _a.onTime) || "var(--gantt-bar-background-color)";
|
|
12029
|
-
const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _b.delayed) || "var(--gantt-bar-background-color)";
|
|
12030
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12031
|
-
/* @__PURE__ */ jsx(
|
|
12032
|
-
"rect",
|
|
12033
|
-
{
|
|
12034
|
-
x,
|
|
12035
|
-
width: localSplit,
|
|
12036
|
-
y,
|
|
12037
|
-
height,
|
|
12038
|
-
ry: barCornerRadius,
|
|
12039
|
-
rx: barCornerRadius,
|
|
12040
|
-
fill: leftFill,
|
|
12041
|
-
className: styles$8.barBackground
|
|
12042
|
-
}
|
|
12043
|
-
),
|
|
12044
|
-
/* @__PURE__ */ jsx(
|
|
12045
|
-
"rect",
|
|
12046
|
-
{
|
|
12047
|
-
x: x + localSplit,
|
|
12048
|
-
width: Math.max(0, width - localSplit),
|
|
12049
|
-
y,
|
|
12050
|
-
height,
|
|
12051
|
-
ry: barCornerRadius,
|
|
12052
|
-
rx: barCornerRadius,
|
|
12053
|
-
fill: rightFill,
|
|
12054
|
-
className: styles$8.barBackground
|
|
12055
|
-
}
|
|
12056
|
-
)
|
|
12057
|
-
] });
|
|
12058
|
-
})() : /* @__PURE__ */ jsx(
|
|
12020
|
+
/* @__PURE__ */ jsx(
|
|
12059
12021
|
"rect",
|
|
12060
12022
|
{
|
|
12061
12023
|
x,
|
|
@@ -12064,11 +12026,11 @@ const BarDisplay = ({
|
|
|
12064
12026
|
height,
|
|
12065
12027
|
ry: barCornerRadius,
|
|
12066
12028
|
rx: barCornerRadius,
|
|
12067
|
-
fill:
|
|
12029
|
+
fill: barColor,
|
|
12068
12030
|
className: styles$8.barBackground
|
|
12069
12031
|
}
|
|
12070
12032
|
),
|
|
12071
|
-
|
|
12033
|
+
showProgress && /* @__PURE__ */ jsx(
|
|
12072
12034
|
"rect",
|
|
12073
12035
|
{
|
|
12074
12036
|
x: progressX,
|
|
@@ -12077,7 +12039,7 @@ const BarDisplay = ({
|
|
|
12077
12039
|
height,
|
|
12078
12040
|
ry: barCornerRadius,
|
|
12079
12041
|
rx: barCornerRadius,
|
|
12080
|
-
fill:
|
|
12042
|
+
fill: processColor
|
|
12081
12043
|
}
|
|
12082
12044
|
)
|
|
12083
12045
|
]
|
|
@@ -12132,8 +12094,8 @@ const ProjectDisplay = ({
|
|
|
12132
12094
|
taskName: taskName2,
|
|
12133
12095
|
taskHalfHeight,
|
|
12134
12096
|
taskHeight,
|
|
12135
|
-
|
|
12136
|
-
|
|
12097
|
+
isSelected,
|
|
12098
|
+
isCritical,
|
|
12137
12099
|
progressWidth,
|
|
12138
12100
|
progressX,
|
|
12139
12101
|
taskYOffset,
|
|
@@ -12142,11 +12104,36 @@ const ProjectDisplay = ({
|
|
|
12142
12104
|
x2,
|
|
12143
12105
|
startMoveFullTask,
|
|
12144
12106
|
customStyle,
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
showProgressBar = true,
|
|
12148
|
-
progressBarColor
|
|
12107
|
+
showProgress = true,
|
|
12108
|
+
progressColor
|
|
12149
12109
|
}) => {
|
|
12110
|
+
const barColor = useMemo(() => {
|
|
12111
|
+
if (isCritical) {
|
|
12112
|
+
if (isSelected) {
|
|
12113
|
+
return "var(--gantt-project-background-selected-critical-color)";
|
|
12114
|
+
}
|
|
12115
|
+
return "var(--gantt-project-background-critical-color)";
|
|
12116
|
+
}
|
|
12117
|
+
if (isSelected) {
|
|
12118
|
+
return "var(--gantt-project-background-selected-color)";
|
|
12119
|
+
}
|
|
12120
|
+
return "var(--gantt-project-background-color)";
|
|
12121
|
+
}, [isSelected, isCritical]);
|
|
12122
|
+
const processColor = useMemo(() => {
|
|
12123
|
+
if (progressColor) {
|
|
12124
|
+
return progressColor;
|
|
12125
|
+
}
|
|
12126
|
+
if (isCritical) {
|
|
12127
|
+
if (isSelected) {
|
|
12128
|
+
return "var(--gantt-project-progress-selected-critical-color)";
|
|
12129
|
+
}
|
|
12130
|
+
return "var(--gantt-project-progress-critical-color)";
|
|
12131
|
+
}
|
|
12132
|
+
if (isSelected) {
|
|
12133
|
+
return "var(--gantt-project-progress-selected-color)";
|
|
12134
|
+
}
|
|
12135
|
+
return "var(--gantt-project-progress-color)";
|
|
12136
|
+
}, [isSelected, isCritical, progressColor]);
|
|
12150
12137
|
const projectLeftTriangle = [
|
|
12151
12138
|
x1,
|
|
12152
12139
|
taskYOffset + taskHeight / 2 - 1,
|
|
@@ -12180,53 +12167,20 @@ const ProjectDisplay = ({
|
|
|
12180
12167
|
},
|
|
12181
12168
|
className: styles$7.projectWrapper,
|
|
12182
12169
|
children: [
|
|
12183
|
-
|
|
12184
|
-
var _a, _b;
|
|
12185
|
-
const localSplit = Math.max(0, Math.min(width, dataDateX - x1));
|
|
12186
|
-
const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _a.onTime) || "var(--gantt-project-background-color)";
|
|
12187
|
-
const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _b.delayed) || "var(--gantt-project-background-color)";
|
|
12188
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12189
|
-
/* @__PURE__ */ jsx(
|
|
12190
|
-
"rect",
|
|
12191
|
-
{
|
|
12192
|
-
x: x1,
|
|
12193
|
-
width: localSplit,
|
|
12194
|
-
y: taskYOffset,
|
|
12195
|
-
height: taskHeight,
|
|
12196
|
-
rx: barCornerRadius,
|
|
12197
|
-
ry: barCornerRadius,
|
|
12198
|
-
className: styles$7.projectBackground,
|
|
12199
|
-
fill: leftFill
|
|
12200
|
-
}
|
|
12201
|
-
),
|
|
12202
|
-
/* @__PURE__ */ jsx(
|
|
12203
|
-
"rect",
|
|
12204
|
-
{
|
|
12205
|
-
x: x1 + localSplit,
|
|
12206
|
-
width: Math.max(0, width - localSplit),
|
|
12207
|
-
y: taskYOffset,
|
|
12208
|
-
height: taskHeight,
|
|
12209
|
-
rx: barCornerRadius,
|
|
12210
|
-
ry: barCornerRadius,
|
|
12211
|
-
className: styles$7.projectBackground,
|
|
12212
|
-
fill: rightFill
|
|
12213
|
-
}
|
|
12214
|
-
)
|
|
12215
|
-
] });
|
|
12216
|
-
})() : /* @__PURE__ */ jsx(
|
|
12170
|
+
/* @__PURE__ */ jsx(
|
|
12217
12171
|
"rect",
|
|
12218
12172
|
{
|
|
12173
|
+
fill: barColor,
|
|
12219
12174
|
x: x1,
|
|
12220
12175
|
width,
|
|
12221
12176
|
y: taskYOffset,
|
|
12222
12177
|
height: taskHeight,
|
|
12223
12178
|
rx: barCornerRadius,
|
|
12224
12179
|
ry: barCornerRadius,
|
|
12225
|
-
className: styles$7.projectBackground
|
|
12226
|
-
fill: "unset"
|
|
12180
|
+
className: styles$7.projectBackground
|
|
12227
12181
|
}
|
|
12228
12182
|
),
|
|
12229
|
-
|
|
12183
|
+
showProgress && /* @__PURE__ */ jsx(
|
|
12230
12184
|
"rect",
|
|
12231
12185
|
{
|
|
12232
12186
|
x: progressX,
|
|
@@ -12235,13 +12189,13 @@ const ProjectDisplay = ({
|
|
|
12235
12189
|
height: taskHeight,
|
|
12236
12190
|
ry: barCornerRadius,
|
|
12237
12191
|
rx: barCornerRadius,
|
|
12238
|
-
fill:
|
|
12192
|
+
fill: processColor
|
|
12239
12193
|
}
|
|
12240
12194
|
),
|
|
12241
12195
|
/* @__PURE__ */ jsx(
|
|
12242
12196
|
"rect",
|
|
12243
12197
|
{
|
|
12244
|
-
fill:
|
|
12198
|
+
fill: barColor,
|
|
12245
12199
|
x: x1,
|
|
12246
12200
|
width,
|
|
12247
12201
|
y: taskYOffset,
|
|
@@ -12256,7 +12210,7 @@ const ProjectDisplay = ({
|
|
|
12256
12210
|
{
|
|
12257
12211
|
className: styles$7.projectTop,
|
|
12258
12212
|
points: projectLeftTriangle,
|
|
12259
|
-
fill:
|
|
12213
|
+
fill: barColor
|
|
12260
12214
|
}
|
|
12261
12215
|
),
|
|
12262
12216
|
/* @__PURE__ */ jsx(
|
|
@@ -12264,7 +12218,7 @@ const ProjectDisplay = ({
|
|
|
12264
12218
|
{
|
|
12265
12219
|
className: styles$7.projectTop,
|
|
12266
12220
|
points: projectRightTriangle,
|
|
12267
|
-
fill:
|
|
12221
|
+
fill: barColor
|
|
12268
12222
|
}
|
|
12269
12223
|
)
|
|
12270
12224
|
]
|
|
@@ -12335,10 +12289,8 @@ const Bar = (props) => {
|
|
|
12335
12289
|
x2,
|
|
12336
12290
|
movingAction,
|
|
12337
12291
|
ganttRelationEvent,
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
showProgressBar,
|
|
12341
|
-
progressBarColor
|
|
12292
|
+
showProgress = true,
|
|
12293
|
+
progressColor
|
|
12342
12294
|
} = props;
|
|
12343
12295
|
useMemo(() => width < 30, [width]);
|
|
12344
12296
|
const handleHeight = useMemo(() => taskHeight - 2, [taskHeight]);
|
|
@@ -12400,10 +12352,8 @@ const Bar = (props) => {
|
|
|
12400
12352
|
isCritical,
|
|
12401
12353
|
hasChildren,
|
|
12402
12354
|
startMoveFullTask,
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
showProgressBar,
|
|
12406
|
-
progressBarColor
|
|
12355
|
+
showProgress,
|
|
12356
|
+
progressColor
|
|
12407
12357
|
}
|
|
12408
12358
|
);
|
|
12409
12359
|
} else {
|
|
@@ -12423,10 +12373,8 @@ const Bar = (props) => {
|
|
|
12423
12373
|
isCritical,
|
|
12424
12374
|
hasChildren,
|
|
12425
12375
|
startMoveFullTask,
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
showProgressBar,
|
|
12429
|
-
progressBarColor
|
|
12376
|
+
showProgress,
|
|
12377
|
+
progressColor
|
|
12430
12378
|
}
|
|
12431
12379
|
);
|
|
12432
12380
|
}
|
|
@@ -12985,10 +12933,8 @@ const TaskGanttContentInner = (props) => {
|
|
|
12985
12933
|
taskBarMovingAction,
|
|
12986
12934
|
waitCommitTasks,
|
|
12987
12935
|
viewMode,
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
showProgressBar,
|
|
12991
|
-
progressBarColor
|
|
12936
|
+
showProgress = true,
|
|
12937
|
+
progressColor
|
|
12992
12938
|
} = props;
|
|
12993
12939
|
const renderedHolidays = useMemo(() => {
|
|
12994
12940
|
const { columnWidth } = distances;
|
|
@@ -13075,11 +13021,6 @@ const TaskGanttContentInner = (props) => {
|
|
|
13075
13021
|
x2: taskX2,
|
|
13076
13022
|
comparisonDates
|
|
13077
13023
|
} = getTaskCoordinates2(task);
|
|
13078
|
-
const containerXAbs = Math.max(
|
|
13079
|
-
containerX + (additionalLeftSpace || 0),
|
|
13080
|
-
0
|
|
13081
|
-
);
|
|
13082
|
-
const dataDateXLocal = typeof dataDateX === "number" ? dataDateX - containerXAbs : void 0;
|
|
13083
13024
|
tasksRes.push(
|
|
13084
13025
|
/* @__PURE__ */ jsx(
|
|
13085
13026
|
"svg",
|
|
@@ -13124,10 +13065,8 @@ const TaskGanttContentInner = (props) => {
|
|
|
13124
13065
|
onDeleteTask,
|
|
13125
13066
|
renderCustomLabel,
|
|
13126
13067
|
viewMode,
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
showProgressBar,
|
|
13130
|
-
progressBarColor
|
|
13068
|
+
showProgress,
|
|
13069
|
+
progressColor
|
|
13131
13070
|
}
|
|
13132
13071
|
)
|
|
13133
13072
|
},
|
|
@@ -13337,10 +13276,6 @@ const TaskGanttContentInner = (props) => {
|
|
|
13337
13276
|
isDateChangeable,
|
|
13338
13277
|
isRelationChangeable,
|
|
13339
13278
|
visibleTasksMirror,
|
|
13340
|
-
dataDateX,
|
|
13341
|
-
splitbarColors,
|
|
13342
|
-
showProgressBar,
|
|
13343
|
-
progressBarColor,
|
|
13344
13279
|
onArrowDoubleClick
|
|
13345
13280
|
]);
|
|
13346
13281
|
return /* @__PURE__ */ jsxs("g", { className: "content", children: [
|
|
@@ -18786,9 +18721,8 @@ const Gantt = (props) => {
|
|
|
18786
18721
|
dataDateColor,
|
|
18787
18722
|
todayLabel = "Today",
|
|
18788
18723
|
dataDateLabel = "Data Date",
|
|
18789
|
-
|
|
18790
|
-
|
|
18791
|
-
progressBarColor
|
|
18724
|
+
showProgress = true,
|
|
18725
|
+
progressColor
|
|
18792
18726
|
} = props;
|
|
18793
18727
|
const ganttSVGRef = useRef(null);
|
|
18794
18728
|
const wrapperRef = useRef(null);
|
|
@@ -19917,29 +19851,6 @@ const Gantt = (props) => {
|
|
|
19917
19851
|
() => svgWidth + additionalLeftSpace + additionalRightSpace,
|
|
19918
19852
|
[additionalLeftSpace, additionalRightSpace, svgWidth]
|
|
19919
19853
|
);
|
|
19920
|
-
const dataDateX = useMemo(() => {
|
|
19921
|
-
if (!dataDate)
|
|
19922
|
-
return void 0;
|
|
19923
|
-
try {
|
|
19924
|
-
const roundedDataDate = roundStartDate(dataDate);
|
|
19925
|
-
const x = taskXCoordinate(
|
|
19926
|
-
roundedDataDate,
|
|
19927
|
-
startDate,
|
|
19928
|
-
viewMode,
|
|
19929
|
-
distances.columnWidth
|
|
19930
|
-
);
|
|
19931
|
-
return additionalLeftSpace + x;
|
|
19932
|
-
} catch {
|
|
19933
|
-
return void 0;
|
|
19934
|
-
}
|
|
19935
|
-
}, [
|
|
19936
|
-
dataDate,
|
|
19937
|
-
startDate,
|
|
19938
|
-
viewMode,
|
|
19939
|
-
distances,
|
|
19940
|
-
additionalLeftSpace,
|
|
19941
|
-
roundStartDate
|
|
19942
|
-
]);
|
|
19943
19854
|
const gridProps = useMemo(
|
|
19944
19855
|
() => ({
|
|
19945
19856
|
additionalLeftSpace,
|
|
@@ -19952,7 +19863,6 @@ const Gantt = (props) => {
|
|
|
19952
19863
|
showTodayLine,
|
|
19953
19864
|
showDataDateLine,
|
|
19954
19865
|
dataDate,
|
|
19955
|
-
dataDateX,
|
|
19956
19866
|
todayColor,
|
|
19957
19867
|
dataDateColor,
|
|
19958
19868
|
todayLabel,
|
|
@@ -19969,7 +19879,6 @@ const Gantt = (props) => {
|
|
|
19969
19879
|
showTodayLine,
|
|
19970
19880
|
showDataDateLine,
|
|
19971
19881
|
dataDate,
|
|
19972
|
-
dataDateX,
|
|
19973
19882
|
todayColor,
|
|
19974
19883
|
dataDateColor,
|
|
19975
19884
|
todayLabel,
|
|
@@ -20009,11 +19918,6 @@ const Gantt = (props) => {
|
|
|
20009
19918
|
const renderTaskBarProps = useMemo(
|
|
20010
19919
|
() => ({
|
|
20011
19920
|
...taskBar,
|
|
20012
|
-
splitbarColors,
|
|
20013
|
-
dataDate,
|
|
20014
|
-
dataDateX,
|
|
20015
|
-
showProgressBar,
|
|
20016
|
-
progressBarColor,
|
|
20017
19921
|
taskBarMovingAction: (task) => {
|
|
20018
19922
|
var _a2;
|
|
20019
19923
|
return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
|
|
@@ -20049,16 +19953,13 @@ const Gantt = (props) => {
|
|
|
20049
19953
|
taskHeight,
|
|
20050
19954
|
taskYOffset,
|
|
20051
19955
|
visibleTasksMirror,
|
|
20052
|
-
viewMode
|
|
19956
|
+
viewMode,
|
|
19957
|
+
showProgress,
|
|
19958
|
+
progressColor
|
|
20053
19959
|
}),
|
|
20054
19960
|
[
|
|
20055
19961
|
viewMode,
|
|
20056
19962
|
taskBar,
|
|
20057
|
-
splitbarColors,
|
|
20058
|
-
dataDate,
|
|
20059
|
-
dataDateX,
|
|
20060
|
-
showProgressBar,
|
|
20061
|
-
progressBarColor,
|
|
20062
19963
|
authorizedRelations,
|
|
20063
19964
|
additionalLeftSpace,
|
|
20064
19965
|
additionalRightSpace,
|
|
@@ -20091,7 +19992,9 @@ const Gantt = (props) => {
|
|
|
20091
19992
|
visibleTasksMirror,
|
|
20092
19993
|
(_b = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _b.id,
|
|
20093
19994
|
changeInProgress == null ? void 0 : changeInProgress.action,
|
|
20094
|
-
handleDeleteTasks
|
|
19995
|
+
handleDeleteTasks,
|
|
19996
|
+
showProgress,
|
|
19997
|
+
progressColor
|
|
20095
19998
|
]
|
|
20096
19999
|
);
|
|
20097
20000
|
const renderTaskListProps = useMemo(
|