gantt-task-react-v 1.0.53 → 1.0.55
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/gantt-task-react.es.js +184 -191
- package/dist/gantt-task-react.umd.js +184 -191
- package/package.json +1 -1
|
@@ -10921,6 +10921,184 @@ const getDateByOffset = (startDate, offset2, viewMode) => {
|
|
|
10921
10921
|
throw new Error("Unknown view mode");
|
|
10922
10922
|
}
|
|
10923
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
|
+
};
|
|
10924
11102
|
const ganttToday = "_ganttToday_1oyhk_1";
|
|
10925
11103
|
const ganttTodayCircle = "_ganttTodayCircle_1oyhk_9";
|
|
10926
11104
|
const styles$c = {
|
|
@@ -10948,13 +11126,8 @@ const GanttTodayInner = ({
|
|
|
10948
11126
|
return null;
|
|
10949
11127
|
}
|
|
10950
11128
|
const today = /* @__PURE__ */ new Date();
|
|
10951
|
-
const
|
|
10952
|
-
const
|
|
10953
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10954
|
-
const remainderMillis = today.getTime() - currentDate.getTime();
|
|
10955
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10956
|
-
const tickX = index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10957
|
-
const x = rtl ? tickX + columnWidth : tickX;
|
|
11129
|
+
const tick = taskXCoordinate(today, startDate, viewMode, columnWidth);
|
|
11130
|
+
const x = rtl ? tick + columnWidth : tick;
|
|
10958
11131
|
const color = todayColor || "var(--gantt-calendar-today-color)";
|
|
10959
11132
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10960
11133
|
/* @__PURE__ */ jsx(
|
|
@@ -11005,9 +11178,8 @@ const GanttTodayInner = ({
|
|
|
11005
11178
|
if (!showDataDateLine || !dataDate) {
|
|
11006
11179
|
return null;
|
|
11007
11180
|
}
|
|
11008
|
-
const
|
|
11009
|
-
const
|
|
11010
|
-
const x = rtl ? tickX + columnWidth : tickX;
|
|
11181
|
+
const tick = taskXCoordinate(dataDate, startDate, viewMode, columnWidth);
|
|
11182
|
+
const x = rtl ? tick + columnWidth : tick;
|
|
11011
11183
|
const color = dataDateColor || "var(--gantt-calendar-today-color)";
|
|
11012
11184
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11013
11185
|
/* @__PURE__ */ jsx(
|
|
@@ -11748,184 +11920,6 @@ const RelationLine = ({
|
|
|
11748
11920
|
}
|
|
11749
11921
|
);
|
|
11750
11922
|
};
|
|
11751
|
-
const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11752
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11753
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11754
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11755
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11756
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11757
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11758
|
-
};
|
|
11759
|
-
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11760
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11761
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11762
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11763
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11764
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11765
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11766
|
-
};
|
|
11767
|
-
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
11768
|
-
const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
|
|
11769
|
-
let progressX;
|
|
11770
|
-
if (rtl) {
|
|
11771
|
-
progressX = taskX2 - progressWidth;
|
|
11772
|
-
} else {
|
|
11773
|
-
progressX = taskX1;
|
|
11774
|
-
}
|
|
11775
|
-
return [progressWidth, progressX];
|
|
11776
|
-
};
|
|
11777
|
-
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
11778
|
-
let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
11779
|
-
newDate = new Date(
|
|
11780
|
-
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
11781
|
-
);
|
|
11782
|
-
return newDate;
|
|
11783
|
-
};
|
|
11784
|
-
const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11785
|
-
let result;
|
|
11786
|
-
switch (selectedTask.type) {
|
|
11787
|
-
case "milestone":
|
|
11788
|
-
result = handleTaskBySVGMouseEventForMilestone(
|
|
11789
|
-
action,
|
|
11790
|
-
selectedTask,
|
|
11791
|
-
initialCoordinates,
|
|
11792
|
-
coordinates,
|
|
11793
|
-
xStep,
|
|
11794
|
-
timeStep
|
|
11795
|
-
);
|
|
11796
|
-
break;
|
|
11797
|
-
default:
|
|
11798
|
-
result = handleTaskBySVGMouseEventForBar(
|
|
11799
|
-
action,
|
|
11800
|
-
selectedTask,
|
|
11801
|
-
initialCoordinates,
|
|
11802
|
-
coordinates,
|
|
11803
|
-
xStep,
|
|
11804
|
-
timeStep,
|
|
11805
|
-
rtl
|
|
11806
|
-
);
|
|
11807
|
-
break;
|
|
11808
|
-
}
|
|
11809
|
-
return result;
|
|
11810
|
-
};
|
|
11811
|
-
const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11812
|
-
const changedTask = { ...selectedTask };
|
|
11813
|
-
let isChanged = false;
|
|
11814
|
-
switch (action) {
|
|
11815
|
-
case "progress":
|
|
11816
|
-
isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
|
|
11817
|
-
if (isChanged) {
|
|
11818
|
-
changedTask.progress = Math.round(
|
|
11819
|
-
coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
|
|
11820
|
-
);
|
|
11821
|
-
}
|
|
11822
|
-
break;
|
|
11823
|
-
case "start": {
|
|
11824
|
-
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11825
|
-
if (isChanged) {
|
|
11826
|
-
if (rtl) {
|
|
11827
|
-
changedTask.end = dateByX(
|
|
11828
|
-
coordinates.x1,
|
|
11829
|
-
initialCoordinates.x1,
|
|
11830
|
-
selectedTask.end,
|
|
11831
|
-
xStep,
|
|
11832
|
-
timeStep
|
|
11833
|
-
);
|
|
11834
|
-
} else {
|
|
11835
|
-
changedTask.start = dateByX(
|
|
11836
|
-
coordinates.x1,
|
|
11837
|
-
initialCoordinates.x1,
|
|
11838
|
-
selectedTask.start,
|
|
11839
|
-
xStep,
|
|
11840
|
-
timeStep
|
|
11841
|
-
);
|
|
11842
|
-
}
|
|
11843
|
-
}
|
|
11844
|
-
break;
|
|
11845
|
-
}
|
|
11846
|
-
case "end": {
|
|
11847
|
-
isChanged = initialCoordinates.x2 !== coordinates.x2;
|
|
11848
|
-
if (isChanged) {
|
|
11849
|
-
if (rtl) {
|
|
11850
|
-
changedTask.start = dateByX(
|
|
11851
|
-
coordinates.x2,
|
|
11852
|
-
initialCoordinates.x2,
|
|
11853
|
-
selectedTask.start,
|
|
11854
|
-
xStep,
|
|
11855
|
-
timeStep
|
|
11856
|
-
);
|
|
11857
|
-
} else {
|
|
11858
|
-
changedTask.end = dateByX(
|
|
11859
|
-
coordinates.x2,
|
|
11860
|
-
initialCoordinates.x2,
|
|
11861
|
-
selectedTask.end,
|
|
11862
|
-
xStep,
|
|
11863
|
-
timeStep
|
|
11864
|
-
);
|
|
11865
|
-
}
|
|
11866
|
-
}
|
|
11867
|
-
break;
|
|
11868
|
-
}
|
|
11869
|
-
case "move": {
|
|
11870
|
-
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11871
|
-
if (isChanged) {
|
|
11872
|
-
if (rtl) {
|
|
11873
|
-
changedTask.end = dateByX(
|
|
11874
|
-
coordinates.x1,
|
|
11875
|
-
initialCoordinates.x1,
|
|
11876
|
-
selectedTask.end,
|
|
11877
|
-
xStep,
|
|
11878
|
-
timeStep
|
|
11879
|
-
);
|
|
11880
|
-
changedTask.start = dateByX(
|
|
11881
|
-
coordinates.x2,
|
|
11882
|
-
initialCoordinates.x2,
|
|
11883
|
-
selectedTask.start,
|
|
11884
|
-
xStep,
|
|
11885
|
-
timeStep
|
|
11886
|
-
);
|
|
11887
|
-
} else {
|
|
11888
|
-
changedTask.start = dateByX(
|
|
11889
|
-
coordinates.x1,
|
|
11890
|
-
initialCoordinates.x1,
|
|
11891
|
-
selectedTask.start,
|
|
11892
|
-
xStep,
|
|
11893
|
-
timeStep
|
|
11894
|
-
);
|
|
11895
|
-
changedTask.end = dateByX(
|
|
11896
|
-
coordinates.x2,
|
|
11897
|
-
initialCoordinates.x2,
|
|
11898
|
-
selectedTask.end,
|
|
11899
|
-
xStep,
|
|
11900
|
-
timeStep
|
|
11901
|
-
);
|
|
11902
|
-
}
|
|
11903
|
-
}
|
|
11904
|
-
break;
|
|
11905
|
-
}
|
|
11906
|
-
}
|
|
11907
|
-
return { isChanged, changedTask };
|
|
11908
|
-
};
|
|
11909
|
-
const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
|
|
11910
|
-
const changedTask = { ...selectedTask };
|
|
11911
|
-
const isChanged = coordinates.x1 !== initialCoordinates.x1;
|
|
11912
|
-
if (isChanged) {
|
|
11913
|
-
switch (action) {
|
|
11914
|
-
case "move": {
|
|
11915
|
-
changedTask.start = dateByX(
|
|
11916
|
-
coordinates.x1,
|
|
11917
|
-
initialCoordinates.x1,
|
|
11918
|
-
selectedTask.start,
|
|
11919
|
-
xStep,
|
|
11920
|
-
timeStep
|
|
11921
|
-
);
|
|
11922
|
-
changedTask.end = changedTask.start;
|
|
11923
|
-
break;
|
|
11924
|
-
}
|
|
11925
|
-
}
|
|
11926
|
-
}
|
|
11927
|
-
return { isChanged, changedTask };
|
|
11928
|
-
};
|
|
11929
11923
|
const barWrapper = "_barWrapper_5jhkr_1";
|
|
11930
11924
|
const barHandle = "_barHandle_5jhkr_11";
|
|
11931
11925
|
const barHandleImportantVisible = "_barHandleImportantVisible_5jhkr_37";
|
|
@@ -19868,7 +19862,7 @@ const Gantt = (props) => {
|
|
|
19868
19862
|
viewMode,
|
|
19869
19863
|
showTodayLine,
|
|
19870
19864
|
showDataDateLine,
|
|
19871
|
-
dataDate
|
|
19865
|
+
dataDate,
|
|
19872
19866
|
todayColor,
|
|
19873
19867
|
dataDateColor,
|
|
19874
19868
|
todayLabel,
|
|
@@ -19888,8 +19882,7 @@ const Gantt = (props) => {
|
|
|
19888
19882
|
todayColor,
|
|
19889
19883
|
dataDateColor,
|
|
19890
19884
|
todayLabel,
|
|
19891
|
-
dataDateLabel
|
|
19892
|
-
roundStartDate
|
|
19885
|
+
dataDateLabel
|
|
19893
19886
|
]
|
|
19894
19887
|
);
|
|
19895
19888
|
const calendarProps = useMemo(
|
|
@@ -10938,6 +10938,184 @@
|
|
|
10938
10938
|
throw new Error("Unknown view mode");
|
|
10939
10939
|
}
|
|
10940
10940
|
};
|
|
10941
|
+
const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
10942
|
+
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
10943
|
+
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
10944
|
+
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10945
|
+
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
10946
|
+
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10947
|
+
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10948
|
+
};
|
|
10949
|
+
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
10950
|
+
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
10951
|
+
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
10952
|
+
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10953
|
+
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
10954
|
+
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10955
|
+
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10956
|
+
};
|
|
10957
|
+
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
10958
|
+
const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
|
|
10959
|
+
let progressX;
|
|
10960
|
+
if (rtl) {
|
|
10961
|
+
progressX = taskX2 - progressWidth;
|
|
10962
|
+
} else {
|
|
10963
|
+
progressX = taskX1;
|
|
10964
|
+
}
|
|
10965
|
+
return [progressWidth, progressX];
|
|
10966
|
+
};
|
|
10967
|
+
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
10968
|
+
let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
10969
|
+
newDate = new Date(
|
|
10970
|
+
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
10971
|
+
);
|
|
10972
|
+
return newDate;
|
|
10973
|
+
};
|
|
10974
|
+
const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
10975
|
+
let result;
|
|
10976
|
+
switch (selectedTask.type) {
|
|
10977
|
+
case "milestone":
|
|
10978
|
+
result = handleTaskBySVGMouseEventForMilestone(
|
|
10979
|
+
action,
|
|
10980
|
+
selectedTask,
|
|
10981
|
+
initialCoordinates,
|
|
10982
|
+
coordinates,
|
|
10983
|
+
xStep,
|
|
10984
|
+
timeStep
|
|
10985
|
+
);
|
|
10986
|
+
break;
|
|
10987
|
+
default:
|
|
10988
|
+
result = handleTaskBySVGMouseEventForBar(
|
|
10989
|
+
action,
|
|
10990
|
+
selectedTask,
|
|
10991
|
+
initialCoordinates,
|
|
10992
|
+
coordinates,
|
|
10993
|
+
xStep,
|
|
10994
|
+
timeStep,
|
|
10995
|
+
rtl
|
|
10996
|
+
);
|
|
10997
|
+
break;
|
|
10998
|
+
}
|
|
10999
|
+
return result;
|
|
11000
|
+
};
|
|
11001
|
+
const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11002
|
+
const changedTask = { ...selectedTask };
|
|
11003
|
+
let isChanged = false;
|
|
11004
|
+
switch (action) {
|
|
11005
|
+
case "progress":
|
|
11006
|
+
isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
|
|
11007
|
+
if (isChanged) {
|
|
11008
|
+
changedTask.progress = Math.round(
|
|
11009
|
+
coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
|
|
11010
|
+
);
|
|
11011
|
+
}
|
|
11012
|
+
break;
|
|
11013
|
+
case "start": {
|
|
11014
|
+
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11015
|
+
if (isChanged) {
|
|
11016
|
+
if (rtl) {
|
|
11017
|
+
changedTask.end = dateByX(
|
|
11018
|
+
coordinates.x1,
|
|
11019
|
+
initialCoordinates.x1,
|
|
11020
|
+
selectedTask.end,
|
|
11021
|
+
xStep,
|
|
11022
|
+
timeStep
|
|
11023
|
+
);
|
|
11024
|
+
} else {
|
|
11025
|
+
changedTask.start = dateByX(
|
|
11026
|
+
coordinates.x1,
|
|
11027
|
+
initialCoordinates.x1,
|
|
11028
|
+
selectedTask.start,
|
|
11029
|
+
xStep,
|
|
11030
|
+
timeStep
|
|
11031
|
+
);
|
|
11032
|
+
}
|
|
11033
|
+
}
|
|
11034
|
+
break;
|
|
11035
|
+
}
|
|
11036
|
+
case "end": {
|
|
11037
|
+
isChanged = initialCoordinates.x2 !== coordinates.x2;
|
|
11038
|
+
if (isChanged) {
|
|
11039
|
+
if (rtl) {
|
|
11040
|
+
changedTask.start = dateByX(
|
|
11041
|
+
coordinates.x2,
|
|
11042
|
+
initialCoordinates.x2,
|
|
11043
|
+
selectedTask.start,
|
|
11044
|
+
xStep,
|
|
11045
|
+
timeStep
|
|
11046
|
+
);
|
|
11047
|
+
} else {
|
|
11048
|
+
changedTask.end = dateByX(
|
|
11049
|
+
coordinates.x2,
|
|
11050
|
+
initialCoordinates.x2,
|
|
11051
|
+
selectedTask.end,
|
|
11052
|
+
xStep,
|
|
11053
|
+
timeStep
|
|
11054
|
+
);
|
|
11055
|
+
}
|
|
11056
|
+
}
|
|
11057
|
+
break;
|
|
11058
|
+
}
|
|
11059
|
+
case "move": {
|
|
11060
|
+
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11061
|
+
if (isChanged) {
|
|
11062
|
+
if (rtl) {
|
|
11063
|
+
changedTask.end = dateByX(
|
|
11064
|
+
coordinates.x1,
|
|
11065
|
+
initialCoordinates.x1,
|
|
11066
|
+
selectedTask.end,
|
|
11067
|
+
xStep,
|
|
11068
|
+
timeStep
|
|
11069
|
+
);
|
|
11070
|
+
changedTask.start = dateByX(
|
|
11071
|
+
coordinates.x2,
|
|
11072
|
+
initialCoordinates.x2,
|
|
11073
|
+
selectedTask.start,
|
|
11074
|
+
xStep,
|
|
11075
|
+
timeStep
|
|
11076
|
+
);
|
|
11077
|
+
} else {
|
|
11078
|
+
changedTask.start = dateByX(
|
|
11079
|
+
coordinates.x1,
|
|
11080
|
+
initialCoordinates.x1,
|
|
11081
|
+
selectedTask.start,
|
|
11082
|
+
xStep,
|
|
11083
|
+
timeStep
|
|
11084
|
+
);
|
|
11085
|
+
changedTask.end = dateByX(
|
|
11086
|
+
coordinates.x2,
|
|
11087
|
+
initialCoordinates.x2,
|
|
11088
|
+
selectedTask.end,
|
|
11089
|
+
xStep,
|
|
11090
|
+
timeStep
|
|
11091
|
+
);
|
|
11092
|
+
}
|
|
11093
|
+
}
|
|
11094
|
+
break;
|
|
11095
|
+
}
|
|
11096
|
+
}
|
|
11097
|
+
return { isChanged, changedTask };
|
|
11098
|
+
};
|
|
11099
|
+
const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
|
|
11100
|
+
const changedTask = { ...selectedTask };
|
|
11101
|
+
const isChanged = coordinates.x1 !== initialCoordinates.x1;
|
|
11102
|
+
if (isChanged) {
|
|
11103
|
+
switch (action) {
|
|
11104
|
+
case "move": {
|
|
11105
|
+
changedTask.start = dateByX(
|
|
11106
|
+
coordinates.x1,
|
|
11107
|
+
initialCoordinates.x1,
|
|
11108
|
+
selectedTask.start,
|
|
11109
|
+
xStep,
|
|
11110
|
+
timeStep
|
|
11111
|
+
);
|
|
11112
|
+
changedTask.end = changedTask.start;
|
|
11113
|
+
break;
|
|
11114
|
+
}
|
|
11115
|
+
}
|
|
11116
|
+
}
|
|
11117
|
+
return { isChanged, changedTask };
|
|
11118
|
+
};
|
|
10941
11119
|
const ganttToday = "_ganttToday_1oyhk_1";
|
|
10942
11120
|
const ganttTodayCircle = "_ganttTodayCircle_1oyhk_9";
|
|
10943
11121
|
const styles$c = {
|
|
@@ -10965,13 +11143,8 @@
|
|
|
10965
11143
|
return null;
|
|
10966
11144
|
}
|
|
10967
11145
|
const today = /* @__PURE__ */ new Date();
|
|
10968
|
-
const
|
|
10969
|
-
const
|
|
10970
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
10971
|
-
const remainderMillis = today.getTime() - currentDate.getTime();
|
|
10972
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
10973
|
-
const tickX = index2 * columnWidth + percentOfInterval * columnWidth;
|
|
10974
|
-
const x = rtl ? tickX + columnWidth : tickX;
|
|
11146
|
+
const tick = taskXCoordinate(today, startDate, viewMode, columnWidth);
|
|
11147
|
+
const x = rtl ? tick + columnWidth : tick;
|
|
10975
11148
|
const color = todayColor || "var(--gantt-calendar-today-color)";
|
|
10976
11149
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10977
11150
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11022,9 +11195,8 @@
|
|
|
11022
11195
|
if (!showDataDateLine || !dataDate) {
|
|
11023
11196
|
return null;
|
|
11024
11197
|
}
|
|
11025
|
-
const
|
|
11026
|
-
const
|
|
11027
|
-
const x = rtl ? tickX + columnWidth : tickX;
|
|
11198
|
+
const tick = taskXCoordinate(dataDate, startDate, viewMode, columnWidth);
|
|
11199
|
+
const x = rtl ? tick + columnWidth : tick;
|
|
11028
11200
|
const color = dataDateColor || "var(--gantt-calendar-today-color)";
|
|
11029
11201
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11030
11202
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11765,184 +11937,6 @@
|
|
|
11765
11937
|
}
|
|
11766
11938
|
);
|
|
11767
11939
|
};
|
|
11768
|
-
const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11769
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11770
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11771
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11772
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11773
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11774
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11775
|
-
};
|
|
11776
|
-
const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
|
|
11777
|
-
const index2 = getDatesDiff(xDate, startDate, viewMode);
|
|
11778
|
-
const currentDate = getDateByOffset(startDate, index2, viewMode);
|
|
11779
|
-
const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
|
|
11780
|
-
const remainderMillis = xDate.getTime() - currentDate.getTime();
|
|
11781
|
-
const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
|
|
11782
|
-
return index2 * columnWidth + percentOfInterval * columnWidth;
|
|
11783
|
-
};
|
|
11784
|
-
const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
|
|
11785
|
-
const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
|
|
11786
|
-
let progressX;
|
|
11787
|
-
if (rtl) {
|
|
11788
|
-
progressX = taskX2 - progressWidth;
|
|
11789
|
-
} else {
|
|
11790
|
-
progressX = taskX1;
|
|
11791
|
-
}
|
|
11792
|
-
return [progressWidth, progressX];
|
|
11793
|
-
};
|
|
11794
|
-
const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
|
|
11795
|
-
let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
|
|
11796
|
-
newDate = new Date(
|
|
11797
|
-
newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
|
|
11798
|
-
);
|
|
11799
|
-
return newDate;
|
|
11800
|
-
};
|
|
11801
|
-
const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11802
|
-
let result;
|
|
11803
|
-
switch (selectedTask.type) {
|
|
11804
|
-
case "milestone":
|
|
11805
|
-
result = handleTaskBySVGMouseEventForMilestone(
|
|
11806
|
-
action,
|
|
11807
|
-
selectedTask,
|
|
11808
|
-
initialCoordinates,
|
|
11809
|
-
coordinates,
|
|
11810
|
-
xStep,
|
|
11811
|
-
timeStep
|
|
11812
|
-
);
|
|
11813
|
-
break;
|
|
11814
|
-
default:
|
|
11815
|
-
result = handleTaskBySVGMouseEventForBar(
|
|
11816
|
-
action,
|
|
11817
|
-
selectedTask,
|
|
11818
|
-
initialCoordinates,
|
|
11819
|
-
coordinates,
|
|
11820
|
-
xStep,
|
|
11821
|
-
timeStep,
|
|
11822
|
-
rtl
|
|
11823
|
-
);
|
|
11824
|
-
break;
|
|
11825
|
-
}
|
|
11826
|
-
return result;
|
|
11827
|
-
};
|
|
11828
|
-
const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
|
|
11829
|
-
const changedTask = { ...selectedTask };
|
|
11830
|
-
let isChanged = false;
|
|
11831
|
-
switch (action) {
|
|
11832
|
-
case "progress":
|
|
11833
|
-
isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
|
|
11834
|
-
if (isChanged) {
|
|
11835
|
-
changedTask.progress = Math.round(
|
|
11836
|
-
coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
|
|
11837
|
-
);
|
|
11838
|
-
}
|
|
11839
|
-
break;
|
|
11840
|
-
case "start": {
|
|
11841
|
-
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11842
|
-
if (isChanged) {
|
|
11843
|
-
if (rtl) {
|
|
11844
|
-
changedTask.end = dateByX(
|
|
11845
|
-
coordinates.x1,
|
|
11846
|
-
initialCoordinates.x1,
|
|
11847
|
-
selectedTask.end,
|
|
11848
|
-
xStep,
|
|
11849
|
-
timeStep
|
|
11850
|
-
);
|
|
11851
|
-
} else {
|
|
11852
|
-
changedTask.start = dateByX(
|
|
11853
|
-
coordinates.x1,
|
|
11854
|
-
initialCoordinates.x1,
|
|
11855
|
-
selectedTask.start,
|
|
11856
|
-
xStep,
|
|
11857
|
-
timeStep
|
|
11858
|
-
);
|
|
11859
|
-
}
|
|
11860
|
-
}
|
|
11861
|
-
break;
|
|
11862
|
-
}
|
|
11863
|
-
case "end": {
|
|
11864
|
-
isChanged = initialCoordinates.x2 !== coordinates.x2;
|
|
11865
|
-
if (isChanged) {
|
|
11866
|
-
if (rtl) {
|
|
11867
|
-
changedTask.start = dateByX(
|
|
11868
|
-
coordinates.x2,
|
|
11869
|
-
initialCoordinates.x2,
|
|
11870
|
-
selectedTask.start,
|
|
11871
|
-
xStep,
|
|
11872
|
-
timeStep
|
|
11873
|
-
);
|
|
11874
|
-
} else {
|
|
11875
|
-
changedTask.end = dateByX(
|
|
11876
|
-
coordinates.x2,
|
|
11877
|
-
initialCoordinates.x2,
|
|
11878
|
-
selectedTask.end,
|
|
11879
|
-
xStep,
|
|
11880
|
-
timeStep
|
|
11881
|
-
);
|
|
11882
|
-
}
|
|
11883
|
-
}
|
|
11884
|
-
break;
|
|
11885
|
-
}
|
|
11886
|
-
case "move": {
|
|
11887
|
-
isChanged = initialCoordinates.x1 !== coordinates.x1;
|
|
11888
|
-
if (isChanged) {
|
|
11889
|
-
if (rtl) {
|
|
11890
|
-
changedTask.end = dateByX(
|
|
11891
|
-
coordinates.x1,
|
|
11892
|
-
initialCoordinates.x1,
|
|
11893
|
-
selectedTask.end,
|
|
11894
|
-
xStep,
|
|
11895
|
-
timeStep
|
|
11896
|
-
);
|
|
11897
|
-
changedTask.start = dateByX(
|
|
11898
|
-
coordinates.x2,
|
|
11899
|
-
initialCoordinates.x2,
|
|
11900
|
-
selectedTask.start,
|
|
11901
|
-
xStep,
|
|
11902
|
-
timeStep
|
|
11903
|
-
);
|
|
11904
|
-
} else {
|
|
11905
|
-
changedTask.start = dateByX(
|
|
11906
|
-
coordinates.x1,
|
|
11907
|
-
initialCoordinates.x1,
|
|
11908
|
-
selectedTask.start,
|
|
11909
|
-
xStep,
|
|
11910
|
-
timeStep
|
|
11911
|
-
);
|
|
11912
|
-
changedTask.end = dateByX(
|
|
11913
|
-
coordinates.x2,
|
|
11914
|
-
initialCoordinates.x2,
|
|
11915
|
-
selectedTask.end,
|
|
11916
|
-
xStep,
|
|
11917
|
-
timeStep
|
|
11918
|
-
);
|
|
11919
|
-
}
|
|
11920
|
-
}
|
|
11921
|
-
break;
|
|
11922
|
-
}
|
|
11923
|
-
}
|
|
11924
|
-
return { isChanged, changedTask };
|
|
11925
|
-
};
|
|
11926
|
-
const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
|
|
11927
|
-
const changedTask = { ...selectedTask };
|
|
11928
|
-
const isChanged = coordinates.x1 !== initialCoordinates.x1;
|
|
11929
|
-
if (isChanged) {
|
|
11930
|
-
switch (action) {
|
|
11931
|
-
case "move": {
|
|
11932
|
-
changedTask.start = dateByX(
|
|
11933
|
-
coordinates.x1,
|
|
11934
|
-
initialCoordinates.x1,
|
|
11935
|
-
selectedTask.start,
|
|
11936
|
-
xStep,
|
|
11937
|
-
timeStep
|
|
11938
|
-
);
|
|
11939
|
-
changedTask.end = changedTask.start;
|
|
11940
|
-
break;
|
|
11941
|
-
}
|
|
11942
|
-
}
|
|
11943
|
-
}
|
|
11944
|
-
return { isChanged, changedTask };
|
|
11945
|
-
};
|
|
11946
11940
|
const barWrapper = "_barWrapper_5jhkr_1";
|
|
11947
11941
|
const barHandle = "_barHandle_5jhkr_11";
|
|
11948
11942
|
const barHandleImportantVisible = "_barHandleImportantVisible_5jhkr_37";
|
|
@@ -19885,7 +19879,7 @@
|
|
|
19885
19879
|
viewMode,
|
|
19886
19880
|
showTodayLine,
|
|
19887
19881
|
showDataDateLine,
|
|
19888
|
-
dataDate
|
|
19882
|
+
dataDate,
|
|
19889
19883
|
todayColor,
|
|
19890
19884
|
dataDateColor,
|
|
19891
19885
|
todayLabel,
|
|
@@ -19905,8 +19899,7 @@
|
|
|
19905
19899
|
todayColor,
|
|
19906
19900
|
dataDateColor,
|
|
19907
19901
|
todayLabel,
|
|
19908
|
-
dataDateLabel
|
|
19909
|
-
roundStartDate
|
|
19902
|
+
dataDateLabel
|
|
19910
19903
|
]
|
|
19911
19904
|
);
|
|
19912
19905
|
const calendarProps = React.useMemo(
|
package/package.json
CHANGED