gantt-task-react-v 1.0.46 → 1.0.48
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 +20 -0
- package/dist/components/gantt-today/index.d.ts +7 -0
- package/dist/components/task-item/bar/bar-display.d.ts +17 -0
- package/dist/components/task-item/project/project-display.d.ts +17 -0
- package/dist/components/task-item/task-item.d.ts +17 -0
- package/dist/gantt-task-react.es.js +303 -38
- package/dist/gantt-task-react.umd.js +303 -38
- package/dist/types/public-types.d.ts +58 -0
- package/package.json +1 -1
|
@@ -14,6 +14,26 @@ export interface TaskGanttContentProps extends GanttTaskBarActions {
|
|
|
14
14
|
distances: Distances;
|
|
15
15
|
endColumnIndex: number;
|
|
16
16
|
fullRowHeight: number;
|
|
17
|
+
/**
|
|
18
|
+
* Absolute X coordinate of data date in the main SVG (including additionalLeftSpace), or undefined
|
|
19
|
+
*/
|
|
20
|
+
dataDateX?: number | null;
|
|
21
|
+
splitbarColors?: {
|
|
22
|
+
task?: {
|
|
23
|
+
onTime?: string;
|
|
24
|
+
delayed?: string;
|
|
25
|
+
};
|
|
26
|
+
project?: {
|
|
27
|
+
onTime?: string;
|
|
28
|
+
delayed?: string;
|
|
29
|
+
};
|
|
30
|
+
comparison?: {
|
|
31
|
+
onTime?: string;
|
|
32
|
+
delayed?: string;
|
|
33
|
+
};
|
|
34
|
+
} | null;
|
|
35
|
+
showProgressBar?: boolean;
|
|
36
|
+
progressBarColor?: string;
|
|
17
37
|
ganttRelationEvent: GanttRelationEvent | null;
|
|
18
38
|
getDate: (index: number) => Date;
|
|
19
39
|
getTaskCoordinates: (task: Task) => TaskCoordinates;
|
|
@@ -8,5 +8,12 @@ export type GanttTodayProps = {
|
|
|
8
8
|
startDate: Date;
|
|
9
9
|
rtl: boolean;
|
|
10
10
|
viewMode: ViewMode;
|
|
11
|
+
showTodayLine?: boolean;
|
|
12
|
+
showDataDateLine?: boolean;
|
|
13
|
+
dataDate?: Date | null;
|
|
14
|
+
todayColor?: string | null;
|
|
15
|
+
dataDateColor?: string | null;
|
|
16
|
+
todayLabel?: string;
|
|
17
|
+
dataDateLabel?: string;
|
|
11
18
|
};
|
|
12
19
|
export declare const GanttToday: React.NamedExoticComponent<GanttTodayProps>;
|
|
@@ -14,6 +14,23 @@ type BarDisplayProps = {
|
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
16
|
customStyle?: CSSProperties;
|
|
17
|
+
dataDateX?: number | null;
|
|
18
|
+
splitbarColors?: {
|
|
19
|
+
task?: {
|
|
20
|
+
onTime?: string;
|
|
21
|
+
delayed?: string;
|
|
22
|
+
};
|
|
23
|
+
project?: {
|
|
24
|
+
onTime?: string;
|
|
25
|
+
delayed?: string;
|
|
26
|
+
};
|
|
27
|
+
comparison?: {
|
|
28
|
+
onTime?: string;
|
|
29
|
+
delayed?: string;
|
|
30
|
+
};
|
|
31
|
+
} | null;
|
|
32
|
+
showProgressBar?: boolean;
|
|
33
|
+
progressBarColor?: string;
|
|
17
34
|
};
|
|
18
35
|
export declare const BarDisplay: React.FC<BarDisplayProps>;
|
|
19
36
|
export {};
|
|
@@ -15,6 +15,23 @@ type ProjectDisplayProps = {
|
|
|
15
15
|
x1: number;
|
|
16
16
|
x2: number;
|
|
17
17
|
customStyle?: CSSProperties;
|
|
18
|
+
dataDateX?: number | null;
|
|
19
|
+
splitbarColors?: {
|
|
20
|
+
task?: {
|
|
21
|
+
onTime?: string;
|
|
22
|
+
delayed?: string;
|
|
23
|
+
};
|
|
24
|
+
project?: {
|
|
25
|
+
onTime?: string;
|
|
26
|
+
delayed?: string;
|
|
27
|
+
};
|
|
28
|
+
comparison?: {
|
|
29
|
+
onTime?: string;
|
|
30
|
+
delayed?: string;
|
|
31
|
+
};
|
|
32
|
+
} | null;
|
|
33
|
+
showProgressBar?: boolean;
|
|
34
|
+
progressBarColor?: string;
|
|
18
35
|
};
|
|
19
36
|
export declare const ProjectDisplay: React.FC<ProjectDisplayProps>;
|
|
20
37
|
export {};
|
|
@@ -13,6 +13,23 @@ export interface TaskItemProps extends Omit<GanttTaskBarActions, "taskBarMovingA
|
|
|
13
13
|
distances: Distances;
|
|
14
14
|
taskHeight: number;
|
|
15
15
|
taskHalfHeight: number;
|
|
16
|
+
dataDateX?: number | null;
|
|
17
|
+
splitbarColors?: {
|
|
18
|
+
task?: {
|
|
19
|
+
onTime?: string;
|
|
20
|
+
delayed?: string;
|
|
21
|
+
};
|
|
22
|
+
project?: {
|
|
23
|
+
onTime?: string;
|
|
24
|
+
delayed?: string;
|
|
25
|
+
};
|
|
26
|
+
comparison?: {
|
|
27
|
+
onTime?: string;
|
|
28
|
+
delayed?: string;
|
|
29
|
+
};
|
|
30
|
+
} | null;
|
|
31
|
+
showProgressBar?: boolean;
|
|
32
|
+
progressBarColor?: string;
|
|
16
33
|
authorizedRelations: RelationKind[];
|
|
17
34
|
ganttRelationEvent: GanttRelationEvent;
|
|
18
35
|
canDelete: boolean;
|
|
@@ -10914,31 +10914,38 @@ const GanttTodayInner = ({
|
|
|
10914
10914
|
isUnknownDates,
|
|
10915
10915
|
rtl,
|
|
10916
10916
|
startDate,
|
|
10917
|
-
viewMode
|
|
10917
|
+
viewMode,
|
|
10918
|
+
showTodayLine = true,
|
|
10919
|
+
showDataDateLine = false,
|
|
10920
|
+
dataDate = null,
|
|
10921
|
+
todayColor = null,
|
|
10922
|
+
dataDateColor = null,
|
|
10923
|
+
todayLabel = "Today",
|
|
10924
|
+
dataDateLabel = "Data Date"
|
|
10918
10925
|
}) => {
|
|
10919
|
-
const
|
|
10920
|
-
if (isUnknownDates) {
|
|
10926
|
+
const todayElement = useMemo(() => {
|
|
10927
|
+
if (isUnknownDates || !showTodayLine) {
|
|
10921
10928
|
return null;
|
|
10922
10929
|
}
|
|
10923
|
-
const
|
|
10924
|
-
const todayIndex = getDatesDiff(
|
|
10930
|
+
const today = /* @__PURE__ */ new Date();
|
|
10931
|
+
const todayIndex = getDatesDiff(today, startDate, viewMode);
|
|
10925
10932
|
const extraMultiplier = () => {
|
|
10926
10933
|
switch (viewMode) {
|
|
10927
10934
|
case ViewMode.Week: {
|
|
10928
|
-
const percent =
|
|
10935
|
+
const percent = today.getDay() / 7;
|
|
10929
10936
|
return 1 + percent * 0.2;
|
|
10930
10937
|
}
|
|
10931
10938
|
case ViewMode.Month: {
|
|
10932
|
-
const dayInMonth =
|
|
10939
|
+
const dayInMonth = today.getDate();
|
|
10933
10940
|
const maxDaysInMonth = getDaysInMonth(
|
|
10934
|
-
|
|
10935
|
-
|
|
10941
|
+
today.getMonth(),
|
|
10942
|
+
today.getFullYear()
|
|
10936
10943
|
);
|
|
10937
10944
|
const percent = dayInMonth / maxDaysInMonth;
|
|
10938
10945
|
return 1 + percent * 0.5;
|
|
10939
10946
|
}
|
|
10940
10947
|
case ViewMode.Year: {
|
|
10941
|
-
const percent =
|
|
10948
|
+
const percent = today.getMonth() / 12;
|
|
10942
10949
|
return 1 + percent * 0.5;
|
|
10943
10950
|
}
|
|
10944
10951
|
default:
|
|
@@ -10947,6 +10954,7 @@ const GanttTodayInner = ({
|
|
|
10947
10954
|
};
|
|
10948
10955
|
const tickX = todayIndex * columnWidth * extraMultiplier();
|
|
10949
10956
|
const x = rtl ? tickX + columnWidth : tickX;
|
|
10957
|
+
const color = todayColor || "var(--gantt-calendar-today-color)";
|
|
10950
10958
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10951
10959
|
/* @__PURE__ */ jsx(
|
|
10952
10960
|
"rect",
|
|
@@ -10955,7 +10963,7 @@ const GanttTodayInner = ({
|
|
|
10955
10963
|
y: 0,
|
|
10956
10964
|
width: 2,
|
|
10957
10965
|
height: ganttFullHeight,
|
|
10958
|
-
fill:
|
|
10966
|
+
fill: color
|
|
10959
10967
|
}
|
|
10960
10968
|
),
|
|
10961
10969
|
/* @__PURE__ */ jsx(
|
|
@@ -10965,7 +10973,18 @@ const GanttTodayInner = ({
|
|
|
10965
10973
|
cx: x + 1,
|
|
10966
10974
|
cy: 6,
|
|
10967
10975
|
r: 6,
|
|
10968
|
-
fill:
|
|
10976
|
+
fill: color
|
|
10977
|
+
}
|
|
10978
|
+
),
|
|
10979
|
+
/* @__PURE__ */ jsx(
|
|
10980
|
+
"text",
|
|
10981
|
+
{
|
|
10982
|
+
x: additionalLeftSpace + x + 8,
|
|
10983
|
+
y: 10,
|
|
10984
|
+
fill: color,
|
|
10985
|
+
fontSize: 12,
|
|
10986
|
+
fontWeight: 600,
|
|
10987
|
+
children: todayLabel
|
|
10969
10988
|
}
|
|
10970
10989
|
)
|
|
10971
10990
|
] });
|
|
@@ -10976,9 +10995,92 @@ const GanttTodayInner = ({
|
|
|
10976
10995
|
isUnknownDates,
|
|
10977
10996
|
rtl,
|
|
10978
10997
|
startDate,
|
|
10979
|
-
viewMode
|
|
10998
|
+
viewMode,
|
|
10999
|
+
showTodayLine,
|
|
11000
|
+
todayColor,
|
|
11001
|
+
todayLabel
|
|
11002
|
+
]);
|
|
11003
|
+
const dataDateElement = useMemo(() => {
|
|
11004
|
+
if (!showDataDateLine || !dataDate) {
|
|
11005
|
+
return null;
|
|
11006
|
+
}
|
|
11007
|
+
const dataIndex = getDatesDiff(dataDate, startDate, viewMode);
|
|
11008
|
+
const extraMultiplier = () => {
|
|
11009
|
+
switch (viewMode) {
|
|
11010
|
+
case ViewMode.Week: {
|
|
11011
|
+
const percent = dataDate.getDay() / 7;
|
|
11012
|
+
return 1 + percent * 0.2;
|
|
11013
|
+
}
|
|
11014
|
+
case ViewMode.Month: {
|
|
11015
|
+
const dayInMonth = dataDate.getDate();
|
|
11016
|
+
const maxDaysInMonth = getDaysInMonth(
|
|
11017
|
+
dataDate.getMonth(),
|
|
11018
|
+
dataDate.getFullYear()
|
|
11019
|
+
);
|
|
11020
|
+
const percent = dayInMonth / maxDaysInMonth;
|
|
11021
|
+
return 1 + percent * 0.5;
|
|
11022
|
+
}
|
|
11023
|
+
case ViewMode.Year: {
|
|
11024
|
+
const percent = dataDate.getMonth() / 12;
|
|
11025
|
+
return 1 + percent * 0.5;
|
|
11026
|
+
}
|
|
11027
|
+
default:
|
|
11028
|
+
return 1;
|
|
11029
|
+
}
|
|
11030
|
+
};
|
|
11031
|
+
const tickX = dataIndex * columnWidth * extraMultiplier();
|
|
11032
|
+
const x = rtl ? tickX + columnWidth : tickX;
|
|
11033
|
+
const color = dataDateColor || "var(--gantt-calendar-today-color)";
|
|
11034
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11035
|
+
/* @__PURE__ */ jsx(
|
|
11036
|
+
"rect",
|
|
11037
|
+
{
|
|
11038
|
+
x: additionalLeftSpace + x,
|
|
11039
|
+
y: 0,
|
|
11040
|
+
width: 2,
|
|
11041
|
+
height: ganttFullHeight,
|
|
11042
|
+
fill: color,
|
|
11043
|
+
opacity: 0.9
|
|
11044
|
+
}
|
|
11045
|
+
),
|
|
11046
|
+
/* @__PURE__ */ jsx(
|
|
11047
|
+
"circle",
|
|
11048
|
+
{
|
|
11049
|
+
className: styles$c.ganttTodayCircle,
|
|
11050
|
+
cx: x + 1,
|
|
11051
|
+
cy: 6,
|
|
11052
|
+
r: 6,
|
|
11053
|
+
fill: color
|
|
11054
|
+
}
|
|
11055
|
+
),
|
|
11056
|
+
/* @__PURE__ */ jsx(
|
|
11057
|
+
"text",
|
|
11058
|
+
{
|
|
11059
|
+
x: additionalLeftSpace + x + 8,
|
|
11060
|
+
y: 10,
|
|
11061
|
+
fill: color,
|
|
11062
|
+
fontSize: 12,
|
|
11063
|
+
fontWeight: 600,
|
|
11064
|
+
children: dataDateLabel || "Data Date"
|
|
11065
|
+
}
|
|
11066
|
+
)
|
|
11067
|
+
] });
|
|
11068
|
+
}, [
|
|
11069
|
+
additionalLeftSpace,
|
|
11070
|
+
columnWidth,
|
|
11071
|
+
ganttFullHeight,
|
|
11072
|
+
rtl,
|
|
11073
|
+
startDate,
|
|
11074
|
+
viewMode,
|
|
11075
|
+
showDataDateLine,
|
|
11076
|
+
dataDate,
|
|
11077
|
+
dataDateColor,
|
|
11078
|
+
dataDateLabel
|
|
10980
11079
|
]);
|
|
10981
|
-
return /* @__PURE__ */
|
|
11080
|
+
return /* @__PURE__ */ jsxs("g", { className: "today", children: [
|
|
11081
|
+
dataDateElement,
|
|
11082
|
+
todayElement
|
|
11083
|
+
] });
|
|
10982
11084
|
};
|
|
10983
11085
|
const GanttToday = memo(GanttTodayInner);
|
|
10984
11086
|
const calendarBottomText = "_calendarBottomText_15t8b_1";
|
|
@@ -11891,7 +11993,11 @@ const BarDisplay = ({
|
|
|
11891
11993
|
width,
|
|
11892
11994
|
x,
|
|
11893
11995
|
y,
|
|
11894
|
-
customStyle
|
|
11996
|
+
customStyle,
|
|
11997
|
+
dataDateX,
|
|
11998
|
+
splitbarColors,
|
|
11999
|
+
showProgressBar = true,
|
|
12000
|
+
progressBarColor
|
|
11895
12001
|
}) => {
|
|
11896
12002
|
return /* @__PURE__ */ jsxs(
|
|
11897
12003
|
"g",
|
|
@@ -11910,7 +12016,40 @@ const BarDisplay = ({
|
|
|
11910
12016
|
}
|
|
11911
12017
|
},
|
|
11912
12018
|
children: [
|
|
11913
|
-
|
|
12019
|
+
typeof dataDateX === "number" ? (() => {
|
|
12020
|
+
var _a, _b;
|
|
12021
|
+
const localSplit = Math.max(0, Math.min(width, dataDateX - x));
|
|
12022
|
+
const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _a.onTime) || "var(--gantt-bar-background-color)";
|
|
12023
|
+
const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _b.delayed) || "var(--gantt-bar-background-color)";
|
|
12024
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12025
|
+
/* @__PURE__ */ jsx(
|
|
12026
|
+
"rect",
|
|
12027
|
+
{
|
|
12028
|
+
x,
|
|
12029
|
+
width: localSplit,
|
|
12030
|
+
y,
|
|
12031
|
+
height,
|
|
12032
|
+
ry: barCornerRadius,
|
|
12033
|
+
rx: barCornerRadius,
|
|
12034
|
+
fill: leftFill,
|
|
12035
|
+
className: styles$8.barBackground
|
|
12036
|
+
}
|
|
12037
|
+
),
|
|
12038
|
+
/* @__PURE__ */ jsx(
|
|
12039
|
+
"rect",
|
|
12040
|
+
{
|
|
12041
|
+
x: x + localSplit,
|
|
12042
|
+
width: Math.max(0, width - localSplit),
|
|
12043
|
+
y,
|
|
12044
|
+
height,
|
|
12045
|
+
ry: barCornerRadius,
|
|
12046
|
+
rx: barCornerRadius,
|
|
12047
|
+
fill: rightFill,
|
|
12048
|
+
className: styles$8.barBackground
|
|
12049
|
+
}
|
|
12050
|
+
)
|
|
12051
|
+
] });
|
|
12052
|
+
})() : /* @__PURE__ */ jsx(
|
|
11914
12053
|
"rect",
|
|
11915
12054
|
{
|
|
11916
12055
|
x,
|
|
@@ -11923,7 +12062,7 @@ const BarDisplay = ({
|
|
|
11923
12062
|
className: styles$8.barBackground
|
|
11924
12063
|
}
|
|
11925
12064
|
),
|
|
11926
|
-
/* @__PURE__ */ jsx(
|
|
12065
|
+
showProgressBar && /* @__PURE__ */ jsx(
|
|
11927
12066
|
"rect",
|
|
11928
12067
|
{
|
|
11929
12068
|
x: progressX,
|
|
@@ -11932,7 +12071,7 @@ const BarDisplay = ({
|
|
|
11932
12071
|
height,
|
|
11933
12072
|
ry: barCornerRadius,
|
|
11934
12073
|
rx: barCornerRadius,
|
|
11935
|
-
fill: "
|
|
12074
|
+
fill: progressBarColor || "var(--gantt-bar-progress-color)"
|
|
11936
12075
|
}
|
|
11937
12076
|
)
|
|
11938
12077
|
]
|
|
@@ -11996,7 +12135,11 @@ const ProjectDisplay = ({
|
|
|
11996
12135
|
x1,
|
|
11997
12136
|
x2,
|
|
11998
12137
|
startMoveFullTask,
|
|
11999
|
-
customStyle
|
|
12138
|
+
customStyle,
|
|
12139
|
+
dataDateX,
|
|
12140
|
+
splitbarColors,
|
|
12141
|
+
showProgressBar = true,
|
|
12142
|
+
progressBarColor
|
|
12000
12143
|
}) => {
|
|
12001
12144
|
const projectLeftTriangle = [
|
|
12002
12145
|
x1,
|
|
@@ -12031,7 +12174,40 @@ const ProjectDisplay = ({
|
|
|
12031
12174
|
},
|
|
12032
12175
|
className: styles$7.projectWrapper,
|
|
12033
12176
|
children: [
|
|
12034
|
-
|
|
12177
|
+
typeof dataDateX === "number" ? (() => {
|
|
12178
|
+
var _a, _b;
|
|
12179
|
+
const localSplit = Math.max(0, Math.min(width, dataDateX - x1));
|
|
12180
|
+
const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _a.onTime) || "var(--gantt-project-background-color)";
|
|
12181
|
+
const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _b.delayed) || "var(--gantt-project-background-color)";
|
|
12182
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12183
|
+
/* @__PURE__ */ jsx(
|
|
12184
|
+
"rect",
|
|
12185
|
+
{
|
|
12186
|
+
x: x1,
|
|
12187
|
+
width: localSplit,
|
|
12188
|
+
y: taskYOffset,
|
|
12189
|
+
height: taskHeight,
|
|
12190
|
+
rx: barCornerRadius,
|
|
12191
|
+
ry: barCornerRadius,
|
|
12192
|
+
className: styles$7.projectBackground,
|
|
12193
|
+
fill: leftFill
|
|
12194
|
+
}
|
|
12195
|
+
),
|
|
12196
|
+
/* @__PURE__ */ jsx(
|
|
12197
|
+
"rect",
|
|
12198
|
+
{
|
|
12199
|
+
x: x1 + localSplit,
|
|
12200
|
+
width: Math.max(0, width - localSplit),
|
|
12201
|
+
y: taskYOffset,
|
|
12202
|
+
height: taskHeight,
|
|
12203
|
+
rx: barCornerRadius,
|
|
12204
|
+
ry: barCornerRadius,
|
|
12205
|
+
className: styles$7.projectBackground,
|
|
12206
|
+
fill: rightFill
|
|
12207
|
+
}
|
|
12208
|
+
)
|
|
12209
|
+
] });
|
|
12210
|
+
})() : /* @__PURE__ */ jsx(
|
|
12035
12211
|
"rect",
|
|
12036
12212
|
{
|
|
12037
12213
|
x: x1,
|
|
@@ -12044,7 +12220,7 @@ const ProjectDisplay = ({
|
|
|
12044
12220
|
fill: "unset"
|
|
12045
12221
|
}
|
|
12046
12222
|
),
|
|
12047
|
-
/* @__PURE__ */ jsx(
|
|
12223
|
+
showProgressBar && /* @__PURE__ */ jsx(
|
|
12048
12224
|
"rect",
|
|
12049
12225
|
{
|
|
12050
12226
|
x: progressX,
|
|
@@ -12053,7 +12229,7 @@ const ProjectDisplay = ({
|
|
|
12053
12229
|
height: taskHeight,
|
|
12054
12230
|
ry: barCornerRadius,
|
|
12055
12231
|
rx: barCornerRadius,
|
|
12056
|
-
fill: "
|
|
12232
|
+
fill: progressBarColor || "var(--gantt-bar-progress-color)"
|
|
12057
12233
|
}
|
|
12058
12234
|
),
|
|
12059
12235
|
/* @__PURE__ */ jsx(
|
|
@@ -12152,7 +12328,11 @@ const Bar = (props) => {
|
|
|
12152
12328
|
x1,
|
|
12153
12329
|
x2,
|
|
12154
12330
|
movingAction,
|
|
12155
|
-
ganttRelationEvent
|
|
12331
|
+
ganttRelationEvent,
|
|
12332
|
+
dataDateX,
|
|
12333
|
+
splitbarColors,
|
|
12334
|
+
showProgressBar,
|
|
12335
|
+
progressBarColor
|
|
12156
12336
|
} = props;
|
|
12157
12337
|
useMemo(() => width < 30, [width]);
|
|
12158
12338
|
const handleHeight = useMemo(() => taskHeight - 2, [taskHeight]);
|
|
@@ -12213,7 +12393,11 @@ const Bar = (props) => {
|
|
|
12213
12393
|
isSelected,
|
|
12214
12394
|
isCritical,
|
|
12215
12395
|
hasChildren,
|
|
12216
|
-
startMoveFullTask
|
|
12396
|
+
startMoveFullTask,
|
|
12397
|
+
dataDateX,
|
|
12398
|
+
splitbarColors,
|
|
12399
|
+
showProgressBar,
|
|
12400
|
+
progressBarColor
|
|
12217
12401
|
}
|
|
12218
12402
|
);
|
|
12219
12403
|
} else {
|
|
@@ -12232,7 +12416,11 @@ const Bar = (props) => {
|
|
|
12232
12416
|
isSelected,
|
|
12233
12417
|
isCritical,
|
|
12234
12418
|
hasChildren,
|
|
12235
|
-
startMoveFullTask
|
|
12419
|
+
startMoveFullTask,
|
|
12420
|
+
dataDateX,
|
|
12421
|
+
splitbarColors,
|
|
12422
|
+
showProgressBar,
|
|
12423
|
+
progressBarColor
|
|
12236
12424
|
}
|
|
12237
12425
|
);
|
|
12238
12426
|
}
|
|
@@ -12605,10 +12793,13 @@ const TaskItemInner = (props) => {
|
|
|
12605
12793
|
},
|
|
12606
12794
|
[onTooltipTask, task]
|
|
12607
12795
|
);
|
|
12608
|
-
const onMouseLeave = useCallback(
|
|
12609
|
-
event
|
|
12610
|
-
|
|
12611
|
-
|
|
12796
|
+
const onMouseLeave = useCallback(
|
|
12797
|
+
(event) => {
|
|
12798
|
+
event.stopPropagation();
|
|
12799
|
+
onTooltipTask(null, null);
|
|
12800
|
+
},
|
|
12801
|
+
[onTooltipTask]
|
|
12802
|
+
);
|
|
12612
12803
|
return /* @__PURE__ */ jsxs(
|
|
12613
12804
|
"g",
|
|
12614
12805
|
{
|
|
@@ -12787,7 +12978,11 @@ const TaskGanttContentInner = (props) => {
|
|
|
12787
12978
|
renderCustomLabel,
|
|
12788
12979
|
taskBarMovingAction,
|
|
12789
12980
|
waitCommitTasks,
|
|
12790
|
-
viewMode
|
|
12981
|
+
viewMode,
|
|
12982
|
+
dataDateX,
|
|
12983
|
+
splitbarColors,
|
|
12984
|
+
showProgressBar,
|
|
12985
|
+
progressBarColor
|
|
12791
12986
|
} = props;
|
|
12792
12987
|
const renderedHolidays = useMemo(() => {
|
|
12793
12988
|
const { columnWidth } = distances;
|
|
@@ -12874,6 +13069,11 @@ const TaskGanttContentInner = (props) => {
|
|
|
12874
13069
|
x2: taskX2,
|
|
12875
13070
|
comparisonDates
|
|
12876
13071
|
} = getTaskCoordinates2(task);
|
|
13072
|
+
const containerXAbs = Math.max(
|
|
13073
|
+
containerX + (additionalLeftSpace || 0),
|
|
13074
|
+
0
|
|
13075
|
+
);
|
|
13076
|
+
const dataDateXLocal = typeof dataDateX === "number" ? dataDateX - containerXAbs : void 0;
|
|
12877
13077
|
tasksRes.push(
|
|
12878
13078
|
/* @__PURE__ */ jsx(
|
|
12879
13079
|
"svg",
|
|
@@ -12917,7 +13117,11 @@ const TaskGanttContentInner = (props) => {
|
|
|
12917
13117
|
rtl,
|
|
12918
13118
|
onDeleteTask,
|
|
12919
13119
|
renderCustomLabel,
|
|
12920
|
-
viewMode
|
|
13120
|
+
viewMode,
|
|
13121
|
+
dataDateX: dataDateXLocal,
|
|
13122
|
+
splitbarColors,
|
|
13123
|
+
showProgressBar,
|
|
13124
|
+
progressBarColor
|
|
12921
13125
|
}
|
|
12922
13126
|
)
|
|
12923
13127
|
},
|
|
@@ -13127,6 +13331,10 @@ const TaskGanttContentInner = (props) => {
|
|
|
13127
13331
|
isDateChangeable,
|
|
13128
13332
|
isRelationChangeable,
|
|
13129
13333
|
visibleTasksMirror,
|
|
13334
|
+
dataDateX,
|
|
13335
|
+
splitbarColors,
|
|
13336
|
+
showProgressBar,
|
|
13337
|
+
progressBarColor,
|
|
13130
13338
|
onArrowDoubleClick
|
|
13131
13339
|
]);
|
|
13132
13340
|
return /* @__PURE__ */ jsxs("g", { className: "content", children: [
|
|
@@ -18563,14 +18771,32 @@ const Gantt = (props) => {
|
|
|
18563
18771
|
viewDate,
|
|
18564
18772
|
viewMode = ViewMode.Day,
|
|
18565
18773
|
locale: clientLocale,
|
|
18566
|
-
language
|
|
18774
|
+
language,
|
|
18775
|
+
rowHeight,
|
|
18776
|
+
showTodayLine = true,
|
|
18777
|
+
showDataDateLine = false,
|
|
18778
|
+
dataDate = null,
|
|
18779
|
+
todayColor,
|
|
18780
|
+
dataDateColor,
|
|
18781
|
+
todayLabel = "Today",
|
|
18782
|
+
dataDateLabel = "Data Date",
|
|
18783
|
+
splitbarColors,
|
|
18784
|
+
showProgressBar = true,
|
|
18785
|
+
progressBarColor
|
|
18567
18786
|
} = props;
|
|
18568
18787
|
const ganttSVGRef = useRef(null);
|
|
18569
18788
|
const wrapperRef = useRef(null);
|
|
18570
18789
|
const taskListRef = useRef(null);
|
|
18571
18790
|
const locale = useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
|
|
18572
18791
|
const theme = useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
|
|
18573
|
-
const {
|
|
18792
|
+
const { dateFormats: dateFormats2, rtl } = theme;
|
|
18793
|
+
const distances = useMemo(
|
|
18794
|
+
() => ({
|
|
18795
|
+
...theme.distances,
|
|
18796
|
+
rowHeight: rowHeight ?? theme.distances.rowHeight
|
|
18797
|
+
}),
|
|
18798
|
+
[theme, rowHeight]
|
|
18799
|
+
);
|
|
18574
18800
|
const [waitCommitTasks, setWaitCommitTasks] = useState(false);
|
|
18575
18801
|
const taskBar = useMemo(() => {
|
|
18576
18802
|
return mergeDeepObj(
|
|
@@ -18988,20 +19214,20 @@ const Gantt = (props) => {
|
|
|
18988
19214
|
horizontalContainerRef
|
|
18989
19215
|
]);
|
|
18990
19216
|
const handleKeyDown = (event) => {
|
|
18991
|
-
const { columnWidth, rowHeight } = distances;
|
|
19217
|
+
const { columnWidth, rowHeight: rowHeight2 } = distances;
|
|
18992
19218
|
let newScrollY = scrollY;
|
|
18993
19219
|
let newScrollX = scrollX;
|
|
18994
19220
|
let isX = true;
|
|
18995
19221
|
switch (event.key) {
|
|
18996
19222
|
case "Down":
|
|
18997
19223
|
case "ArrowDown":
|
|
18998
|
-
newScrollY +=
|
|
19224
|
+
newScrollY += rowHeight2;
|
|
18999
19225
|
isX = false;
|
|
19000
19226
|
event.preventDefault();
|
|
19001
19227
|
break;
|
|
19002
19228
|
case "Up":
|
|
19003
19229
|
case "ArrowUp":
|
|
19004
|
-
newScrollY -=
|
|
19230
|
+
newScrollY -= rowHeight2;
|
|
19005
19231
|
isX = false;
|
|
19006
19232
|
event.preventDefault();
|
|
19007
19233
|
break;
|
|
@@ -19693,7 +19919,14 @@ const Gantt = (props) => {
|
|
|
19693
19919
|
isUnknownDates,
|
|
19694
19920
|
rtl,
|
|
19695
19921
|
startDate,
|
|
19696
|
-
viewMode
|
|
19922
|
+
viewMode,
|
|
19923
|
+
showTodayLine,
|
|
19924
|
+
showDataDateLine,
|
|
19925
|
+
dataDate,
|
|
19926
|
+
todayColor,
|
|
19927
|
+
dataDateColor,
|
|
19928
|
+
todayLabel,
|
|
19929
|
+
dataDateLabel
|
|
19697
19930
|
}),
|
|
19698
19931
|
[
|
|
19699
19932
|
additionalLeftSpace,
|
|
@@ -19702,9 +19935,31 @@ const Gantt = (props) => {
|
|
|
19702
19935
|
isUnknownDates,
|
|
19703
19936
|
rtl,
|
|
19704
19937
|
startDate,
|
|
19705
|
-
viewMode
|
|
19938
|
+
viewMode,
|
|
19939
|
+
showTodayLine,
|
|
19940
|
+
showDataDateLine,
|
|
19941
|
+
dataDate,
|
|
19942
|
+
todayColor,
|
|
19943
|
+
dataDateColor,
|
|
19944
|
+
todayLabel,
|
|
19945
|
+
dataDateLabel
|
|
19706
19946
|
]
|
|
19707
19947
|
);
|
|
19948
|
+
const dataDateX = useMemo(() => {
|
|
19949
|
+
if (!dataDate)
|
|
19950
|
+
return void 0;
|
|
19951
|
+
try {
|
|
19952
|
+
const x = taskXCoordinate(
|
|
19953
|
+
dataDate,
|
|
19954
|
+
startDate,
|
|
19955
|
+
viewMode,
|
|
19956
|
+
distances.columnWidth
|
|
19957
|
+
);
|
|
19958
|
+
return additionalLeftSpace + x;
|
|
19959
|
+
} catch {
|
|
19960
|
+
return void 0;
|
|
19961
|
+
}
|
|
19962
|
+
}, [dataDate, startDate, viewMode, distances, additionalLeftSpace]);
|
|
19708
19963
|
const calendarProps = useMemo(
|
|
19709
19964
|
() => ({
|
|
19710
19965
|
additionalLeftSpace,
|
|
@@ -19738,6 +19993,11 @@ const Gantt = (props) => {
|
|
|
19738
19993
|
const renderTaskBarProps = useMemo(
|
|
19739
19994
|
() => ({
|
|
19740
19995
|
...taskBar,
|
|
19996
|
+
splitbarColors,
|
|
19997
|
+
dataDate,
|
|
19998
|
+
dataDateX,
|
|
19999
|
+
showProgressBar,
|
|
20000
|
+
progressBarColor,
|
|
19741
20001
|
taskBarMovingAction: (task) => {
|
|
19742
20002
|
var _a2;
|
|
19743
20003
|
return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
|
|
@@ -19778,6 +20038,11 @@ const Gantt = (props) => {
|
|
|
19778
20038
|
[
|
|
19779
20039
|
viewMode,
|
|
19780
20040
|
taskBar,
|
|
20041
|
+
splitbarColors,
|
|
20042
|
+
dataDate,
|
|
20043
|
+
dataDateX,
|
|
20044
|
+
showProgressBar,
|
|
20045
|
+
progressBarColor,
|
|
19781
20046
|
authorizedRelations,
|
|
19782
20047
|
additionalLeftSpace,
|
|
19783
20048
|
additionalRightSpace,
|
|
@@ -10931,31 +10931,38 @@
|
|
|
10931
10931
|
isUnknownDates,
|
|
10932
10932
|
rtl,
|
|
10933
10933
|
startDate,
|
|
10934
|
-
viewMode
|
|
10934
|
+
viewMode,
|
|
10935
|
+
showTodayLine = true,
|
|
10936
|
+
showDataDateLine = false,
|
|
10937
|
+
dataDate = null,
|
|
10938
|
+
todayColor = null,
|
|
10939
|
+
dataDateColor = null,
|
|
10940
|
+
todayLabel = "Today",
|
|
10941
|
+
dataDateLabel = "Data Date"
|
|
10935
10942
|
}) => {
|
|
10936
|
-
const
|
|
10937
|
-
if (isUnknownDates) {
|
|
10943
|
+
const todayElement = React.useMemo(() => {
|
|
10944
|
+
if (isUnknownDates || !showTodayLine) {
|
|
10938
10945
|
return null;
|
|
10939
10946
|
}
|
|
10940
|
-
const
|
|
10941
|
-
const todayIndex = getDatesDiff(
|
|
10947
|
+
const today = /* @__PURE__ */ new Date();
|
|
10948
|
+
const todayIndex = getDatesDiff(today, startDate, viewMode);
|
|
10942
10949
|
const extraMultiplier = () => {
|
|
10943
10950
|
switch (viewMode) {
|
|
10944
10951
|
case ViewMode.Week: {
|
|
10945
|
-
const percent =
|
|
10952
|
+
const percent = today.getDay() / 7;
|
|
10946
10953
|
return 1 + percent * 0.2;
|
|
10947
10954
|
}
|
|
10948
10955
|
case ViewMode.Month: {
|
|
10949
|
-
const dayInMonth =
|
|
10956
|
+
const dayInMonth = today.getDate();
|
|
10950
10957
|
const maxDaysInMonth = getDaysInMonth(
|
|
10951
|
-
|
|
10952
|
-
|
|
10958
|
+
today.getMonth(),
|
|
10959
|
+
today.getFullYear()
|
|
10953
10960
|
);
|
|
10954
10961
|
const percent = dayInMonth / maxDaysInMonth;
|
|
10955
10962
|
return 1 + percent * 0.5;
|
|
10956
10963
|
}
|
|
10957
10964
|
case ViewMode.Year: {
|
|
10958
|
-
const percent =
|
|
10965
|
+
const percent = today.getMonth() / 12;
|
|
10959
10966
|
return 1 + percent * 0.5;
|
|
10960
10967
|
}
|
|
10961
10968
|
default:
|
|
@@ -10964,6 +10971,7 @@
|
|
|
10964
10971
|
};
|
|
10965
10972
|
const tickX = todayIndex * columnWidth * extraMultiplier();
|
|
10966
10973
|
const x = rtl ? tickX + columnWidth : tickX;
|
|
10974
|
+
const color = todayColor || "var(--gantt-calendar-today-color)";
|
|
10967
10975
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10968
10976
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10969
10977
|
"rect",
|
|
@@ -10972,7 +10980,7 @@
|
|
|
10972
10980
|
y: 0,
|
|
10973
10981
|
width: 2,
|
|
10974
10982
|
height: ganttFullHeight,
|
|
10975
|
-
fill:
|
|
10983
|
+
fill: color
|
|
10976
10984
|
}
|
|
10977
10985
|
),
|
|
10978
10986
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10982,7 +10990,18 @@
|
|
|
10982
10990
|
cx: x + 1,
|
|
10983
10991
|
cy: 6,
|
|
10984
10992
|
r: 6,
|
|
10985
|
-
fill:
|
|
10993
|
+
fill: color
|
|
10994
|
+
}
|
|
10995
|
+
),
|
|
10996
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10997
|
+
"text",
|
|
10998
|
+
{
|
|
10999
|
+
x: additionalLeftSpace + x + 8,
|
|
11000
|
+
y: 10,
|
|
11001
|
+
fill: color,
|
|
11002
|
+
fontSize: 12,
|
|
11003
|
+
fontWeight: 600,
|
|
11004
|
+
children: todayLabel
|
|
10986
11005
|
}
|
|
10987
11006
|
)
|
|
10988
11007
|
] });
|
|
@@ -10993,9 +11012,92 @@
|
|
|
10993
11012
|
isUnknownDates,
|
|
10994
11013
|
rtl,
|
|
10995
11014
|
startDate,
|
|
10996
|
-
viewMode
|
|
11015
|
+
viewMode,
|
|
11016
|
+
showTodayLine,
|
|
11017
|
+
todayColor,
|
|
11018
|
+
todayLabel
|
|
11019
|
+
]);
|
|
11020
|
+
const dataDateElement = React.useMemo(() => {
|
|
11021
|
+
if (!showDataDateLine || !dataDate) {
|
|
11022
|
+
return null;
|
|
11023
|
+
}
|
|
11024
|
+
const dataIndex = getDatesDiff(dataDate, startDate, viewMode);
|
|
11025
|
+
const extraMultiplier = () => {
|
|
11026
|
+
switch (viewMode) {
|
|
11027
|
+
case ViewMode.Week: {
|
|
11028
|
+
const percent = dataDate.getDay() / 7;
|
|
11029
|
+
return 1 + percent * 0.2;
|
|
11030
|
+
}
|
|
11031
|
+
case ViewMode.Month: {
|
|
11032
|
+
const dayInMonth = dataDate.getDate();
|
|
11033
|
+
const maxDaysInMonth = getDaysInMonth(
|
|
11034
|
+
dataDate.getMonth(),
|
|
11035
|
+
dataDate.getFullYear()
|
|
11036
|
+
);
|
|
11037
|
+
const percent = dayInMonth / maxDaysInMonth;
|
|
11038
|
+
return 1 + percent * 0.5;
|
|
11039
|
+
}
|
|
11040
|
+
case ViewMode.Year: {
|
|
11041
|
+
const percent = dataDate.getMonth() / 12;
|
|
11042
|
+
return 1 + percent * 0.5;
|
|
11043
|
+
}
|
|
11044
|
+
default:
|
|
11045
|
+
return 1;
|
|
11046
|
+
}
|
|
11047
|
+
};
|
|
11048
|
+
const tickX = dataIndex * columnWidth * extraMultiplier();
|
|
11049
|
+
const x = rtl ? tickX + columnWidth : tickX;
|
|
11050
|
+
const color = dataDateColor || "var(--gantt-calendar-today-color)";
|
|
11051
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11052
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11053
|
+
"rect",
|
|
11054
|
+
{
|
|
11055
|
+
x: additionalLeftSpace + x,
|
|
11056
|
+
y: 0,
|
|
11057
|
+
width: 2,
|
|
11058
|
+
height: ganttFullHeight,
|
|
11059
|
+
fill: color,
|
|
11060
|
+
opacity: 0.9
|
|
11061
|
+
}
|
|
11062
|
+
),
|
|
11063
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11064
|
+
"circle",
|
|
11065
|
+
{
|
|
11066
|
+
className: styles$c.ganttTodayCircle,
|
|
11067
|
+
cx: x + 1,
|
|
11068
|
+
cy: 6,
|
|
11069
|
+
r: 6,
|
|
11070
|
+
fill: color
|
|
11071
|
+
}
|
|
11072
|
+
),
|
|
11073
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11074
|
+
"text",
|
|
11075
|
+
{
|
|
11076
|
+
x: additionalLeftSpace + x + 8,
|
|
11077
|
+
y: 10,
|
|
11078
|
+
fill: color,
|
|
11079
|
+
fontSize: 12,
|
|
11080
|
+
fontWeight: 600,
|
|
11081
|
+
children: dataDateLabel || "Data Date"
|
|
11082
|
+
}
|
|
11083
|
+
)
|
|
11084
|
+
] });
|
|
11085
|
+
}, [
|
|
11086
|
+
additionalLeftSpace,
|
|
11087
|
+
columnWidth,
|
|
11088
|
+
ganttFullHeight,
|
|
11089
|
+
rtl,
|
|
11090
|
+
startDate,
|
|
11091
|
+
viewMode,
|
|
11092
|
+
showDataDateLine,
|
|
11093
|
+
dataDate,
|
|
11094
|
+
dataDateColor,
|
|
11095
|
+
dataDateLabel
|
|
10997
11096
|
]);
|
|
10998
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
11097
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "today", children: [
|
|
11098
|
+
dataDateElement,
|
|
11099
|
+
todayElement
|
|
11100
|
+
] });
|
|
10999
11101
|
};
|
|
11000
11102
|
const GanttToday = React.memo(GanttTodayInner);
|
|
11001
11103
|
const calendarBottomText = "_calendarBottomText_15t8b_1";
|
|
@@ -11908,7 +12010,11 @@
|
|
|
11908
12010
|
width,
|
|
11909
12011
|
x,
|
|
11910
12012
|
y,
|
|
11911
|
-
customStyle
|
|
12013
|
+
customStyle,
|
|
12014
|
+
dataDateX,
|
|
12015
|
+
splitbarColors,
|
|
12016
|
+
showProgressBar = true,
|
|
12017
|
+
progressBarColor
|
|
11912
12018
|
}) => {
|
|
11913
12019
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11914
12020
|
"g",
|
|
@@ -11927,7 +12033,40 @@
|
|
|
11927
12033
|
}
|
|
11928
12034
|
},
|
|
11929
12035
|
children: [
|
|
11930
|
-
|
|
12036
|
+
typeof dataDateX === "number" ? (() => {
|
|
12037
|
+
var _a, _b;
|
|
12038
|
+
const localSplit = Math.max(0, Math.min(width, dataDateX - x));
|
|
12039
|
+
const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _a.onTime) || "var(--gantt-bar-background-color)";
|
|
12040
|
+
const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _b.delayed) || "var(--gantt-bar-background-color)";
|
|
12041
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12042
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12043
|
+
"rect",
|
|
12044
|
+
{
|
|
12045
|
+
x,
|
|
12046
|
+
width: localSplit,
|
|
12047
|
+
y,
|
|
12048
|
+
height,
|
|
12049
|
+
ry: barCornerRadius,
|
|
12050
|
+
rx: barCornerRadius,
|
|
12051
|
+
fill: leftFill,
|
|
12052
|
+
className: styles$8.barBackground
|
|
12053
|
+
}
|
|
12054
|
+
),
|
|
12055
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12056
|
+
"rect",
|
|
12057
|
+
{
|
|
12058
|
+
x: x + localSplit,
|
|
12059
|
+
width: Math.max(0, width - localSplit),
|
|
12060
|
+
y,
|
|
12061
|
+
height,
|
|
12062
|
+
ry: barCornerRadius,
|
|
12063
|
+
rx: barCornerRadius,
|
|
12064
|
+
fill: rightFill,
|
|
12065
|
+
className: styles$8.barBackground
|
|
12066
|
+
}
|
|
12067
|
+
)
|
|
12068
|
+
] });
|
|
12069
|
+
})() : /* @__PURE__ */ jsxRuntime.jsx(
|
|
11931
12070
|
"rect",
|
|
11932
12071
|
{
|
|
11933
12072
|
x,
|
|
@@ -11940,7 +12079,7 @@
|
|
|
11940
12079
|
className: styles$8.barBackground
|
|
11941
12080
|
}
|
|
11942
12081
|
),
|
|
11943
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12082
|
+
showProgressBar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11944
12083
|
"rect",
|
|
11945
12084
|
{
|
|
11946
12085
|
x: progressX,
|
|
@@ -11949,7 +12088,7 @@
|
|
|
11949
12088
|
height,
|
|
11950
12089
|
ry: barCornerRadius,
|
|
11951
12090
|
rx: barCornerRadius,
|
|
11952
|
-
fill: "
|
|
12091
|
+
fill: progressBarColor || "var(--gantt-bar-progress-color)"
|
|
11953
12092
|
}
|
|
11954
12093
|
)
|
|
11955
12094
|
]
|
|
@@ -12013,7 +12152,11 @@
|
|
|
12013
12152
|
x1,
|
|
12014
12153
|
x2,
|
|
12015
12154
|
startMoveFullTask,
|
|
12016
|
-
customStyle
|
|
12155
|
+
customStyle,
|
|
12156
|
+
dataDateX,
|
|
12157
|
+
splitbarColors,
|
|
12158
|
+
showProgressBar = true,
|
|
12159
|
+
progressBarColor
|
|
12017
12160
|
}) => {
|
|
12018
12161
|
const projectLeftTriangle = [
|
|
12019
12162
|
x1,
|
|
@@ -12048,7 +12191,40 @@
|
|
|
12048
12191
|
},
|
|
12049
12192
|
className: styles$7.projectWrapper,
|
|
12050
12193
|
children: [
|
|
12051
|
-
|
|
12194
|
+
typeof dataDateX === "number" ? (() => {
|
|
12195
|
+
var _a, _b;
|
|
12196
|
+
const localSplit = Math.max(0, Math.min(width, dataDateX - x1));
|
|
12197
|
+
const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _a.onTime) || "var(--gantt-project-background-color)";
|
|
12198
|
+
const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _b.delayed) || "var(--gantt-project-background-color)";
|
|
12199
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12200
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12201
|
+
"rect",
|
|
12202
|
+
{
|
|
12203
|
+
x: x1,
|
|
12204
|
+
width: localSplit,
|
|
12205
|
+
y: taskYOffset,
|
|
12206
|
+
height: taskHeight,
|
|
12207
|
+
rx: barCornerRadius,
|
|
12208
|
+
ry: barCornerRadius,
|
|
12209
|
+
className: styles$7.projectBackground,
|
|
12210
|
+
fill: leftFill
|
|
12211
|
+
}
|
|
12212
|
+
),
|
|
12213
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12214
|
+
"rect",
|
|
12215
|
+
{
|
|
12216
|
+
x: x1 + localSplit,
|
|
12217
|
+
width: Math.max(0, width - localSplit),
|
|
12218
|
+
y: taskYOffset,
|
|
12219
|
+
height: taskHeight,
|
|
12220
|
+
rx: barCornerRadius,
|
|
12221
|
+
ry: barCornerRadius,
|
|
12222
|
+
className: styles$7.projectBackground,
|
|
12223
|
+
fill: rightFill
|
|
12224
|
+
}
|
|
12225
|
+
)
|
|
12226
|
+
] });
|
|
12227
|
+
})() : /* @__PURE__ */ jsxRuntime.jsx(
|
|
12052
12228
|
"rect",
|
|
12053
12229
|
{
|
|
12054
12230
|
x: x1,
|
|
@@ -12061,7 +12237,7 @@
|
|
|
12061
12237
|
fill: "unset"
|
|
12062
12238
|
}
|
|
12063
12239
|
),
|
|
12064
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12240
|
+
showProgressBar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12065
12241
|
"rect",
|
|
12066
12242
|
{
|
|
12067
12243
|
x: progressX,
|
|
@@ -12070,7 +12246,7 @@
|
|
|
12070
12246
|
height: taskHeight,
|
|
12071
12247
|
ry: barCornerRadius,
|
|
12072
12248
|
rx: barCornerRadius,
|
|
12073
|
-
fill: "
|
|
12249
|
+
fill: progressBarColor || "var(--gantt-bar-progress-color)"
|
|
12074
12250
|
}
|
|
12075
12251
|
),
|
|
12076
12252
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12169,7 +12345,11 @@
|
|
|
12169
12345
|
x1,
|
|
12170
12346
|
x2,
|
|
12171
12347
|
movingAction,
|
|
12172
|
-
ganttRelationEvent
|
|
12348
|
+
ganttRelationEvent,
|
|
12349
|
+
dataDateX,
|
|
12350
|
+
splitbarColors,
|
|
12351
|
+
showProgressBar,
|
|
12352
|
+
progressBarColor
|
|
12173
12353
|
} = props;
|
|
12174
12354
|
React.useMemo(() => width < 30, [width]);
|
|
12175
12355
|
const handleHeight = React.useMemo(() => taskHeight - 2, [taskHeight]);
|
|
@@ -12230,7 +12410,11 @@
|
|
|
12230
12410
|
isSelected,
|
|
12231
12411
|
isCritical,
|
|
12232
12412
|
hasChildren,
|
|
12233
|
-
startMoveFullTask
|
|
12413
|
+
startMoveFullTask,
|
|
12414
|
+
dataDateX,
|
|
12415
|
+
splitbarColors,
|
|
12416
|
+
showProgressBar,
|
|
12417
|
+
progressBarColor
|
|
12234
12418
|
}
|
|
12235
12419
|
);
|
|
12236
12420
|
} else {
|
|
@@ -12249,7 +12433,11 @@
|
|
|
12249
12433
|
isSelected,
|
|
12250
12434
|
isCritical,
|
|
12251
12435
|
hasChildren,
|
|
12252
|
-
startMoveFullTask
|
|
12436
|
+
startMoveFullTask,
|
|
12437
|
+
dataDateX,
|
|
12438
|
+
splitbarColors,
|
|
12439
|
+
showProgressBar,
|
|
12440
|
+
progressBarColor
|
|
12253
12441
|
}
|
|
12254
12442
|
);
|
|
12255
12443
|
}
|
|
@@ -12622,10 +12810,13 @@
|
|
|
12622
12810
|
},
|
|
12623
12811
|
[onTooltipTask, task]
|
|
12624
12812
|
);
|
|
12625
|
-
const onMouseLeave = React.useCallback(
|
|
12626
|
-
event
|
|
12627
|
-
|
|
12628
|
-
|
|
12813
|
+
const onMouseLeave = React.useCallback(
|
|
12814
|
+
(event) => {
|
|
12815
|
+
event.stopPropagation();
|
|
12816
|
+
onTooltipTask(null, null);
|
|
12817
|
+
},
|
|
12818
|
+
[onTooltipTask]
|
|
12819
|
+
);
|
|
12629
12820
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12630
12821
|
"g",
|
|
12631
12822
|
{
|
|
@@ -12804,7 +12995,11 @@
|
|
|
12804
12995
|
renderCustomLabel,
|
|
12805
12996
|
taskBarMovingAction,
|
|
12806
12997
|
waitCommitTasks,
|
|
12807
|
-
viewMode
|
|
12998
|
+
viewMode,
|
|
12999
|
+
dataDateX,
|
|
13000
|
+
splitbarColors,
|
|
13001
|
+
showProgressBar,
|
|
13002
|
+
progressBarColor
|
|
12808
13003
|
} = props;
|
|
12809
13004
|
const renderedHolidays = React.useMemo(() => {
|
|
12810
13005
|
const { columnWidth } = distances;
|
|
@@ -12891,6 +13086,11 @@
|
|
|
12891
13086
|
x2: taskX2,
|
|
12892
13087
|
comparisonDates
|
|
12893
13088
|
} = getTaskCoordinates2(task);
|
|
13089
|
+
const containerXAbs = Math.max(
|
|
13090
|
+
containerX + (additionalLeftSpace || 0),
|
|
13091
|
+
0
|
|
13092
|
+
);
|
|
13093
|
+
const dataDateXLocal = typeof dataDateX === "number" ? dataDateX - containerXAbs : void 0;
|
|
12894
13094
|
tasksRes.push(
|
|
12895
13095
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12896
13096
|
"svg",
|
|
@@ -12934,7 +13134,11 @@
|
|
|
12934
13134
|
rtl,
|
|
12935
13135
|
onDeleteTask,
|
|
12936
13136
|
renderCustomLabel,
|
|
12937
|
-
viewMode
|
|
13137
|
+
viewMode,
|
|
13138
|
+
dataDateX: dataDateXLocal,
|
|
13139
|
+
splitbarColors,
|
|
13140
|
+
showProgressBar,
|
|
13141
|
+
progressBarColor
|
|
12938
13142
|
}
|
|
12939
13143
|
)
|
|
12940
13144
|
},
|
|
@@ -13144,6 +13348,10 @@
|
|
|
13144
13348
|
isDateChangeable,
|
|
13145
13349
|
isRelationChangeable,
|
|
13146
13350
|
visibleTasksMirror,
|
|
13351
|
+
dataDateX,
|
|
13352
|
+
splitbarColors,
|
|
13353
|
+
showProgressBar,
|
|
13354
|
+
progressBarColor,
|
|
13147
13355
|
onArrowDoubleClick
|
|
13148
13356
|
]);
|
|
13149
13357
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "content", children: [
|
|
@@ -18580,14 +18788,32 @@
|
|
|
18580
18788
|
viewDate,
|
|
18581
18789
|
viewMode = ViewMode.Day,
|
|
18582
18790
|
locale: clientLocale,
|
|
18583
|
-
language
|
|
18791
|
+
language,
|
|
18792
|
+
rowHeight,
|
|
18793
|
+
showTodayLine = true,
|
|
18794
|
+
showDataDateLine = false,
|
|
18795
|
+
dataDate = null,
|
|
18796
|
+
todayColor,
|
|
18797
|
+
dataDateColor,
|
|
18798
|
+
todayLabel = "Today",
|
|
18799
|
+
dataDateLabel = "Data Date",
|
|
18800
|
+
splitbarColors,
|
|
18801
|
+
showProgressBar = true,
|
|
18802
|
+
progressBarColor
|
|
18584
18803
|
} = props;
|
|
18585
18804
|
const ganttSVGRef = React.useRef(null);
|
|
18586
18805
|
const wrapperRef = React.useRef(null);
|
|
18587
18806
|
const taskListRef = React.useRef(null);
|
|
18588
18807
|
const locale = React.useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
|
|
18589
18808
|
const theme = React.useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
|
|
18590
|
-
const {
|
|
18809
|
+
const { dateFormats: dateFormats2, rtl } = theme;
|
|
18810
|
+
const distances = React.useMemo(
|
|
18811
|
+
() => ({
|
|
18812
|
+
...theme.distances,
|
|
18813
|
+
rowHeight: rowHeight ?? theme.distances.rowHeight
|
|
18814
|
+
}),
|
|
18815
|
+
[theme, rowHeight]
|
|
18816
|
+
);
|
|
18591
18817
|
const [waitCommitTasks, setWaitCommitTasks] = React.useState(false);
|
|
18592
18818
|
const taskBar = React.useMemo(() => {
|
|
18593
18819
|
return mergeDeepObj(
|
|
@@ -19005,20 +19231,20 @@
|
|
|
19005
19231
|
horizontalContainerRef
|
|
19006
19232
|
]);
|
|
19007
19233
|
const handleKeyDown = (event) => {
|
|
19008
|
-
const { columnWidth, rowHeight } = distances;
|
|
19234
|
+
const { columnWidth, rowHeight: rowHeight2 } = distances;
|
|
19009
19235
|
let newScrollY = scrollY;
|
|
19010
19236
|
let newScrollX = scrollX;
|
|
19011
19237
|
let isX = true;
|
|
19012
19238
|
switch (event.key) {
|
|
19013
19239
|
case "Down":
|
|
19014
19240
|
case "ArrowDown":
|
|
19015
|
-
newScrollY +=
|
|
19241
|
+
newScrollY += rowHeight2;
|
|
19016
19242
|
isX = false;
|
|
19017
19243
|
event.preventDefault();
|
|
19018
19244
|
break;
|
|
19019
19245
|
case "Up":
|
|
19020
19246
|
case "ArrowUp":
|
|
19021
|
-
newScrollY -=
|
|
19247
|
+
newScrollY -= rowHeight2;
|
|
19022
19248
|
isX = false;
|
|
19023
19249
|
event.preventDefault();
|
|
19024
19250
|
break;
|
|
@@ -19710,7 +19936,14 @@
|
|
|
19710
19936
|
isUnknownDates,
|
|
19711
19937
|
rtl,
|
|
19712
19938
|
startDate,
|
|
19713
|
-
viewMode
|
|
19939
|
+
viewMode,
|
|
19940
|
+
showTodayLine,
|
|
19941
|
+
showDataDateLine,
|
|
19942
|
+
dataDate,
|
|
19943
|
+
todayColor,
|
|
19944
|
+
dataDateColor,
|
|
19945
|
+
todayLabel,
|
|
19946
|
+
dataDateLabel
|
|
19714
19947
|
}),
|
|
19715
19948
|
[
|
|
19716
19949
|
additionalLeftSpace,
|
|
@@ -19719,9 +19952,31 @@
|
|
|
19719
19952
|
isUnknownDates,
|
|
19720
19953
|
rtl,
|
|
19721
19954
|
startDate,
|
|
19722
|
-
viewMode
|
|
19955
|
+
viewMode,
|
|
19956
|
+
showTodayLine,
|
|
19957
|
+
showDataDateLine,
|
|
19958
|
+
dataDate,
|
|
19959
|
+
todayColor,
|
|
19960
|
+
dataDateColor,
|
|
19961
|
+
todayLabel,
|
|
19962
|
+
dataDateLabel
|
|
19723
19963
|
]
|
|
19724
19964
|
);
|
|
19965
|
+
const dataDateX = React.useMemo(() => {
|
|
19966
|
+
if (!dataDate)
|
|
19967
|
+
return void 0;
|
|
19968
|
+
try {
|
|
19969
|
+
const x = taskXCoordinate(
|
|
19970
|
+
dataDate,
|
|
19971
|
+
startDate,
|
|
19972
|
+
viewMode,
|
|
19973
|
+
distances.columnWidth
|
|
19974
|
+
);
|
|
19975
|
+
return additionalLeftSpace + x;
|
|
19976
|
+
} catch {
|
|
19977
|
+
return void 0;
|
|
19978
|
+
}
|
|
19979
|
+
}, [dataDate, startDate, viewMode, distances, additionalLeftSpace]);
|
|
19725
19980
|
const calendarProps = React.useMemo(
|
|
19726
19981
|
() => ({
|
|
19727
19982
|
additionalLeftSpace,
|
|
@@ -19755,6 +20010,11 @@
|
|
|
19755
20010
|
const renderTaskBarProps = React.useMemo(
|
|
19756
20011
|
() => ({
|
|
19757
20012
|
...taskBar,
|
|
20013
|
+
splitbarColors,
|
|
20014
|
+
dataDate,
|
|
20015
|
+
dataDateX,
|
|
20016
|
+
showProgressBar,
|
|
20017
|
+
progressBarColor,
|
|
19758
20018
|
taskBarMovingAction: (task) => {
|
|
19759
20019
|
var _a2;
|
|
19760
20020
|
return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
|
|
@@ -19795,6 +20055,11 @@
|
|
|
19795
20055
|
[
|
|
19796
20056
|
viewMode,
|
|
19797
20057
|
taskBar,
|
|
20058
|
+
splitbarColors,
|
|
20059
|
+
dataDate,
|
|
20060
|
+
dataDateX,
|
|
20061
|
+
showProgressBar,
|
|
20062
|
+
progressBarColor,
|
|
19798
20063
|
authorizedRelations,
|
|
19799
20064
|
additionalLeftSpace,
|
|
19800
20065
|
additionalRightSpace,
|
|
@@ -320,6 +320,64 @@ 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;
|
|
339
|
+
/**
|
|
340
|
+
* Color used for the today line, pin and label. If not provided, theme calendarTodayColor is used.
|
|
341
|
+
*/
|
|
342
|
+
todayColor?: string;
|
|
343
|
+
/**
|
|
344
|
+
* Color used for the data date line, pin and label. If not provided, theme calendarTodayColor is used.
|
|
345
|
+
*/
|
|
346
|
+
dataDateColor?: string;
|
|
347
|
+
/**
|
|
348
|
+
* Label text for the today marker. Defaults to "Today".
|
|
349
|
+
*/
|
|
350
|
+
todayLabel?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Label text for the data date marker. Defaults to "Data Date".
|
|
353
|
+
*/
|
|
354
|
+
dataDateLabel?: string;
|
|
355
|
+
/**
|
|
356
|
+
* Colors to use when splitting bars at the data date line.
|
|
357
|
+
* Structure: { task?: { onTime?: string; delayed?: string }, project?: { onTime?: string; delayed?: string }, comparison?: { onTime?: string; delayed?: string } }
|
|
358
|
+
*/
|
|
359
|
+
splitbarColors?: {
|
|
360
|
+
task?: {
|
|
361
|
+
onTime?: string;
|
|
362
|
+
delayed?: string;
|
|
363
|
+
};
|
|
364
|
+
project?: {
|
|
365
|
+
onTime?: string;
|
|
366
|
+
delayed?: string;
|
|
367
|
+
};
|
|
368
|
+
comparison?: {
|
|
369
|
+
onTime?: string;
|
|
370
|
+
delayed?: string;
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Show or hide the progress bar overlay on tasks. Defaults to true.
|
|
375
|
+
*/
|
|
376
|
+
showProgressBar?: boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Color for the progress bar overlay. If not provided, theme progress color is used.
|
|
379
|
+
*/
|
|
380
|
+
progressBarColor?: string;
|
|
323
381
|
}
|
|
324
382
|
export interface GanttTaskBarActions {
|
|
325
383
|
allowMoveTaskBar?: (action: TaskBarMoveAction, task: RenderTask) => boolean;
|
package/package.json
CHANGED