gantt-task-react-v 1.0.54 → 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.
@@ -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,15 +11126,8 @@ const GanttTodayInner = ({
10948
11126
  return null;
10949
11127
  }
10950
11128
  const today = /* @__PURE__ */ new Date();
10951
- const index2 = getDatesDiff(today, startDate, viewMode);
10952
- const currentDate = getDateByOffset(startDate, index2, viewMode);
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 offset2 = 5;
10958
- const adjustedTickX = tickX + (rtl ? -offset2 : offset2);
10959
- const x = rtl ? adjustedTickX + columnWidth : adjustedTickX;
11129
+ const tick = taskXCoordinate(today, startDate, viewMode, columnWidth);
11130
+ const x = rtl ? tick + columnWidth : tick;
10960
11131
  const color = todayColor || "var(--gantt-calendar-today-color)";
10961
11132
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10962
11133
  /* @__PURE__ */ jsx(
@@ -11007,15 +11178,8 @@ const GanttTodayInner = ({
11007
11178
  if (!showDataDateLine || !dataDate) {
11008
11179
  return null;
11009
11180
  }
11010
- const index2 = getDatesDiff(dataDate, startDate, viewMode);
11011
- const currentDate = getDateByOffset(startDate, index2, viewMode);
11012
- const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11013
- const remainderMillis = dataDate.getTime() - currentDate.getTime();
11014
- const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11015
- const tickX = index2 * columnWidth + percentOfInterval * columnWidth;
11016
- const offset2 = 5;
11017
- const adjustedTickX = tickX + (rtl ? -offset2 : offset2);
11018
- const x = rtl ? adjustedTickX + columnWidth : adjustedTickX;
11181
+ const tick = taskXCoordinate(dataDate, startDate, viewMode, columnWidth);
11182
+ const x = rtl ? tick + columnWidth : tick;
11019
11183
  const color = dataDateColor || "var(--gantt-calendar-today-color)";
11020
11184
  return /* @__PURE__ */ jsxs(Fragment, { children: [
11021
11185
  /* @__PURE__ */ jsx(
@@ -11756,184 +11920,6 @@ const RelationLine = ({
11756
11920
  }
11757
11921
  );
11758
11922
  };
11759
- const taskXCoordinate = (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 taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
11768
- const index2 = getDatesDiff(xDate, startDate, viewMode);
11769
- const currentDate = getDateByOffset(startDate, index2, viewMode);
11770
- const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11771
- const remainderMillis = xDate.getTime() - currentDate.getTime();
11772
- const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11773
- return index2 * columnWidth + percentOfInterval * columnWidth;
11774
- };
11775
- const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
11776
- const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
11777
- let progressX;
11778
- if (rtl) {
11779
- progressX = taskX2 - progressWidth;
11780
- } else {
11781
- progressX = taskX1;
11782
- }
11783
- return [progressWidth, progressX];
11784
- };
11785
- const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
11786
- let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
11787
- newDate = new Date(
11788
- newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
11789
- );
11790
- return newDate;
11791
- };
11792
- const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11793
- let result;
11794
- switch (selectedTask.type) {
11795
- case "milestone":
11796
- result = handleTaskBySVGMouseEventForMilestone(
11797
- action,
11798
- selectedTask,
11799
- initialCoordinates,
11800
- coordinates,
11801
- xStep,
11802
- timeStep
11803
- );
11804
- break;
11805
- default:
11806
- result = handleTaskBySVGMouseEventForBar(
11807
- action,
11808
- selectedTask,
11809
- initialCoordinates,
11810
- coordinates,
11811
- xStep,
11812
- timeStep,
11813
- rtl
11814
- );
11815
- break;
11816
- }
11817
- return result;
11818
- };
11819
- const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11820
- const changedTask = { ...selectedTask };
11821
- let isChanged = false;
11822
- switch (action) {
11823
- case "progress":
11824
- isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
11825
- if (isChanged) {
11826
- changedTask.progress = Math.round(
11827
- coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
11828
- );
11829
- }
11830
- break;
11831
- case "start": {
11832
- isChanged = initialCoordinates.x1 !== coordinates.x1;
11833
- if (isChanged) {
11834
- if (rtl) {
11835
- changedTask.end = dateByX(
11836
- coordinates.x1,
11837
- initialCoordinates.x1,
11838
- selectedTask.end,
11839
- xStep,
11840
- timeStep
11841
- );
11842
- } else {
11843
- changedTask.start = dateByX(
11844
- coordinates.x1,
11845
- initialCoordinates.x1,
11846
- selectedTask.start,
11847
- xStep,
11848
- timeStep
11849
- );
11850
- }
11851
- }
11852
- break;
11853
- }
11854
- case "end": {
11855
- isChanged = initialCoordinates.x2 !== coordinates.x2;
11856
- if (isChanged) {
11857
- if (rtl) {
11858
- changedTask.start = dateByX(
11859
- coordinates.x2,
11860
- initialCoordinates.x2,
11861
- selectedTask.start,
11862
- xStep,
11863
- timeStep
11864
- );
11865
- } else {
11866
- changedTask.end = dateByX(
11867
- coordinates.x2,
11868
- initialCoordinates.x2,
11869
- selectedTask.end,
11870
- xStep,
11871
- timeStep
11872
- );
11873
- }
11874
- }
11875
- break;
11876
- }
11877
- case "move": {
11878
- isChanged = initialCoordinates.x1 !== coordinates.x1;
11879
- if (isChanged) {
11880
- if (rtl) {
11881
- changedTask.end = dateByX(
11882
- coordinates.x1,
11883
- initialCoordinates.x1,
11884
- selectedTask.end,
11885
- xStep,
11886
- timeStep
11887
- );
11888
- changedTask.start = dateByX(
11889
- coordinates.x2,
11890
- initialCoordinates.x2,
11891
- selectedTask.start,
11892
- xStep,
11893
- timeStep
11894
- );
11895
- } else {
11896
- changedTask.start = dateByX(
11897
- coordinates.x1,
11898
- initialCoordinates.x1,
11899
- selectedTask.start,
11900
- xStep,
11901
- timeStep
11902
- );
11903
- changedTask.end = dateByX(
11904
- coordinates.x2,
11905
- initialCoordinates.x2,
11906
- selectedTask.end,
11907
- xStep,
11908
- timeStep
11909
- );
11910
- }
11911
- }
11912
- break;
11913
- }
11914
- }
11915
- return { isChanged, changedTask };
11916
- };
11917
- const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
11918
- const changedTask = { ...selectedTask };
11919
- const isChanged = coordinates.x1 !== initialCoordinates.x1;
11920
- if (isChanged) {
11921
- switch (action) {
11922
- case "move": {
11923
- changedTask.start = dateByX(
11924
- coordinates.x1,
11925
- initialCoordinates.x1,
11926
- selectedTask.start,
11927
- xStep,
11928
- timeStep
11929
- );
11930
- changedTask.end = changedTask.start;
11931
- break;
11932
- }
11933
- }
11934
- }
11935
- return { isChanged, changedTask };
11936
- };
11937
11923
  const barWrapper = "_barWrapper_5jhkr_1";
11938
11924
  const barHandle = "_barHandle_5jhkr_11";
11939
11925
  const barHandleImportantVisible = "_barHandleImportantVisible_5jhkr_37";
@@ -19876,7 +19862,7 @@ const Gantt = (props) => {
19876
19862
  viewMode,
19877
19863
  showTodayLine,
19878
19864
  showDataDateLine,
19879
- dataDate: dataDate ? roundStartDate(dataDate) : null,
19865
+ dataDate,
19880
19866
  todayColor,
19881
19867
  dataDateColor,
19882
19868
  todayLabel,
@@ -19896,8 +19882,7 @@ const Gantt = (props) => {
19896
19882
  todayColor,
19897
19883
  dataDateColor,
19898
19884
  todayLabel,
19899
- dataDateLabel,
19900
- roundStartDate
19885
+ dataDateLabel
19901
19886
  ]
19902
19887
  );
19903
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,15 +11143,8 @@
10965
11143
  return null;
10966
11144
  }
10967
11145
  const today = /* @__PURE__ */ new Date();
10968
- const index2 = getDatesDiff(today, startDate, viewMode);
10969
- const currentDate = getDateByOffset(startDate, index2, viewMode);
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 offset2 = 5;
10975
- const adjustedTickX = tickX + (rtl ? -offset2 : offset2);
10976
- const x = rtl ? adjustedTickX + columnWidth : adjustedTickX;
11146
+ const tick = taskXCoordinate(today, startDate, viewMode, columnWidth);
11147
+ const x = rtl ? tick + columnWidth : tick;
10977
11148
  const color = todayColor || "var(--gantt-calendar-today-color)";
10978
11149
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10979
11150
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11024,15 +11195,8 @@
11024
11195
  if (!showDataDateLine || !dataDate) {
11025
11196
  return null;
11026
11197
  }
11027
- const index2 = getDatesDiff(dataDate, startDate, viewMode);
11028
- const currentDate = getDateByOffset(startDate, index2, viewMode);
11029
- const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11030
- const remainderMillis = dataDate.getTime() - currentDate.getTime();
11031
- const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11032
- const tickX = index2 * columnWidth + percentOfInterval * columnWidth;
11033
- const offset2 = 5;
11034
- const adjustedTickX = tickX + (rtl ? -offset2 : offset2);
11035
- const x = rtl ? adjustedTickX + columnWidth : adjustedTickX;
11198
+ const tick = taskXCoordinate(dataDate, startDate, viewMode, columnWidth);
11199
+ const x = rtl ? tick + columnWidth : tick;
11036
11200
  const color = dataDateColor || "var(--gantt-calendar-today-color)";
11037
11201
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11038
11202
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11773,184 +11937,6 @@
11773
11937
  }
11774
11938
  );
11775
11939
  };
11776
- const taskXCoordinate = (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 taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
11785
- const index2 = getDatesDiff(xDate, startDate, viewMode);
11786
- const currentDate = getDateByOffset(startDate, index2, viewMode);
11787
- const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11788
- const remainderMillis = xDate.getTime() - currentDate.getTime();
11789
- const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11790
- return index2 * columnWidth + percentOfInterval * columnWidth;
11791
- };
11792
- const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
11793
- const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
11794
- let progressX;
11795
- if (rtl) {
11796
- progressX = taskX2 - progressWidth;
11797
- } else {
11798
- progressX = taskX1;
11799
- }
11800
- return [progressWidth, progressX];
11801
- };
11802
- const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
11803
- let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
11804
- newDate = new Date(
11805
- newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
11806
- );
11807
- return newDate;
11808
- };
11809
- const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11810
- let result;
11811
- switch (selectedTask.type) {
11812
- case "milestone":
11813
- result = handleTaskBySVGMouseEventForMilestone(
11814
- action,
11815
- selectedTask,
11816
- initialCoordinates,
11817
- coordinates,
11818
- xStep,
11819
- timeStep
11820
- );
11821
- break;
11822
- default:
11823
- result = handleTaskBySVGMouseEventForBar(
11824
- action,
11825
- selectedTask,
11826
- initialCoordinates,
11827
- coordinates,
11828
- xStep,
11829
- timeStep,
11830
- rtl
11831
- );
11832
- break;
11833
- }
11834
- return result;
11835
- };
11836
- const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11837
- const changedTask = { ...selectedTask };
11838
- let isChanged = false;
11839
- switch (action) {
11840
- case "progress":
11841
- isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
11842
- if (isChanged) {
11843
- changedTask.progress = Math.round(
11844
- coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
11845
- );
11846
- }
11847
- break;
11848
- case "start": {
11849
- isChanged = initialCoordinates.x1 !== coordinates.x1;
11850
- if (isChanged) {
11851
- if (rtl) {
11852
- changedTask.end = dateByX(
11853
- coordinates.x1,
11854
- initialCoordinates.x1,
11855
- selectedTask.end,
11856
- xStep,
11857
- timeStep
11858
- );
11859
- } else {
11860
- changedTask.start = dateByX(
11861
- coordinates.x1,
11862
- initialCoordinates.x1,
11863
- selectedTask.start,
11864
- xStep,
11865
- timeStep
11866
- );
11867
- }
11868
- }
11869
- break;
11870
- }
11871
- case "end": {
11872
- isChanged = initialCoordinates.x2 !== coordinates.x2;
11873
- if (isChanged) {
11874
- if (rtl) {
11875
- changedTask.start = dateByX(
11876
- coordinates.x2,
11877
- initialCoordinates.x2,
11878
- selectedTask.start,
11879
- xStep,
11880
- timeStep
11881
- );
11882
- } else {
11883
- changedTask.end = dateByX(
11884
- coordinates.x2,
11885
- initialCoordinates.x2,
11886
- selectedTask.end,
11887
- xStep,
11888
- timeStep
11889
- );
11890
- }
11891
- }
11892
- break;
11893
- }
11894
- case "move": {
11895
- isChanged = initialCoordinates.x1 !== coordinates.x1;
11896
- if (isChanged) {
11897
- if (rtl) {
11898
- changedTask.end = dateByX(
11899
- coordinates.x1,
11900
- initialCoordinates.x1,
11901
- selectedTask.end,
11902
- xStep,
11903
- timeStep
11904
- );
11905
- changedTask.start = dateByX(
11906
- coordinates.x2,
11907
- initialCoordinates.x2,
11908
- selectedTask.start,
11909
- xStep,
11910
- timeStep
11911
- );
11912
- } else {
11913
- changedTask.start = dateByX(
11914
- coordinates.x1,
11915
- initialCoordinates.x1,
11916
- selectedTask.start,
11917
- xStep,
11918
- timeStep
11919
- );
11920
- changedTask.end = dateByX(
11921
- coordinates.x2,
11922
- initialCoordinates.x2,
11923
- selectedTask.end,
11924
- xStep,
11925
- timeStep
11926
- );
11927
- }
11928
- }
11929
- break;
11930
- }
11931
- }
11932
- return { isChanged, changedTask };
11933
- };
11934
- const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
11935
- const changedTask = { ...selectedTask };
11936
- const isChanged = coordinates.x1 !== initialCoordinates.x1;
11937
- if (isChanged) {
11938
- switch (action) {
11939
- case "move": {
11940
- changedTask.start = dateByX(
11941
- coordinates.x1,
11942
- initialCoordinates.x1,
11943
- selectedTask.start,
11944
- xStep,
11945
- timeStep
11946
- );
11947
- changedTask.end = changedTask.start;
11948
- break;
11949
- }
11950
- }
11951
- }
11952
- return { isChanged, changedTask };
11953
- };
11954
11940
  const barWrapper = "_barWrapper_5jhkr_1";
11955
11941
  const barHandle = "_barHandle_5jhkr_11";
11956
11942
  const barHandleImportantVisible = "_barHandleImportantVisible_5jhkr_37";
@@ -19893,7 +19879,7 @@
19893
19879
  viewMode,
19894
19880
  showTodayLine,
19895
19881
  showDataDateLine,
19896
- dataDate: dataDate ? roundStartDate(dataDate) : null,
19882
+ dataDate,
19897
19883
  todayColor,
19898
19884
  dataDateColor,
19899
19885
  todayLabel,
@@ -19913,8 +19899,7 @@
19913
19899
  todayColor,
19914
19900
  dataDateColor,
19915
19901
  todayLabel,
19916
- dataDateLabel,
19917
- roundStartDate
19902
+ dataDateLabel
19918
19903
  ]
19919
19904
  );
19920
19905
  const calendarProps = React.useMemo(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "description": "Interactive Gantt Chart for React with TypeScript.",
5
5
  "author": "aguilanbon",
6
6
  "homepage": "https://github.com/aguilanbon/gantt-task-react-v",