gantt-task-react-v 1.0.51 → 1.0.52

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/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  ## Install
15
15
 
16
16
  ```
17
- npm install https://github.com/aguilanbon/gantt-task-react-v"
17
+ npm install gantt-task-react-v
18
18
  ```
19
19
 
20
20
  ## How to use it
@@ -10921,184 +10921,6 @@ 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
- };
11102
10924
  const ganttToday = "_ganttToday_1oyhk_1";
11103
10925
  const ganttTodayCircle = "_ganttTodayCircle_1oyhk_9";
11104
10926
  const styles$c = {
@@ -11126,7 +10948,12 @@ const GanttTodayInner = ({
11126
10948
  return null;
11127
10949
  }
11128
10950
  const today = /* @__PURE__ */ new Date();
11129
- const tickX = taskXCoordinate(today, startDate, viewMode, columnWidth);
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;
11130
10957
  const x = rtl ? tickX + columnWidth : tickX;
11131
10958
  const color = todayColor || "var(--gantt-calendar-today-color)";
11132
10959
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -11178,7 +11005,12 @@ const GanttTodayInner = ({
11178
11005
  if (!showDataDateLine || !dataDate) {
11179
11006
  return null;
11180
11007
  }
11181
- const tickX = taskXCoordinate(dataDate, startDate, viewMode, columnWidth);
11008
+ const index2 = getDatesDiff(dataDate, startDate, viewMode);
11009
+ const currentDate = getDateByOffset(startDate, index2, viewMode);
11010
+ const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11011
+ const remainderMillis = dataDate.getTime() - currentDate.getTime();
11012
+ const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11013
+ const tickX = index2 * columnWidth + percentOfInterval * columnWidth;
11182
11014
  const x = rtl ? tickX + columnWidth : tickX;
11183
11015
  const color = dataDateColor || "var(--gantt-calendar-today-color)";
11184
11016
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -11920,6 +11752,184 @@ const RelationLine = ({
11920
11752
  }
11921
11753
  );
11922
11754
  };
11755
+ const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
11756
+ const index2 = getDatesDiff(xDate, startDate, viewMode);
11757
+ const currentDate = getDateByOffset(startDate, index2, viewMode);
11758
+ const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11759
+ const remainderMillis = xDate.getTime() - currentDate.getTime();
11760
+ const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11761
+ return index2 * columnWidth + percentOfInterval * columnWidth;
11762
+ };
11763
+ const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
11764
+ const index2 = getDatesDiff(xDate, startDate, viewMode);
11765
+ const currentDate = getDateByOffset(startDate, index2, viewMode);
11766
+ const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11767
+ const remainderMillis = xDate.getTime() - currentDate.getTime();
11768
+ const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11769
+ return index2 * columnWidth + percentOfInterval * columnWidth;
11770
+ };
11771
+ const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
11772
+ const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
11773
+ let progressX;
11774
+ if (rtl) {
11775
+ progressX = taskX2 - progressWidth;
11776
+ } else {
11777
+ progressX = taskX1;
11778
+ }
11779
+ return [progressWidth, progressX];
11780
+ };
11781
+ const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
11782
+ let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
11783
+ newDate = new Date(
11784
+ newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
11785
+ );
11786
+ return newDate;
11787
+ };
11788
+ const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11789
+ let result;
11790
+ switch (selectedTask.type) {
11791
+ case "milestone":
11792
+ result = handleTaskBySVGMouseEventForMilestone(
11793
+ action,
11794
+ selectedTask,
11795
+ initialCoordinates,
11796
+ coordinates,
11797
+ xStep,
11798
+ timeStep
11799
+ );
11800
+ break;
11801
+ default:
11802
+ result = handleTaskBySVGMouseEventForBar(
11803
+ action,
11804
+ selectedTask,
11805
+ initialCoordinates,
11806
+ coordinates,
11807
+ xStep,
11808
+ timeStep,
11809
+ rtl
11810
+ );
11811
+ break;
11812
+ }
11813
+ return result;
11814
+ };
11815
+ const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11816
+ const changedTask = { ...selectedTask };
11817
+ let isChanged = false;
11818
+ switch (action) {
11819
+ case "progress":
11820
+ isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
11821
+ if (isChanged) {
11822
+ changedTask.progress = Math.round(
11823
+ coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
11824
+ );
11825
+ }
11826
+ break;
11827
+ case "start": {
11828
+ isChanged = initialCoordinates.x1 !== coordinates.x1;
11829
+ if (isChanged) {
11830
+ if (rtl) {
11831
+ changedTask.end = dateByX(
11832
+ coordinates.x1,
11833
+ initialCoordinates.x1,
11834
+ selectedTask.end,
11835
+ xStep,
11836
+ timeStep
11837
+ );
11838
+ } else {
11839
+ changedTask.start = dateByX(
11840
+ coordinates.x1,
11841
+ initialCoordinates.x1,
11842
+ selectedTask.start,
11843
+ xStep,
11844
+ timeStep
11845
+ );
11846
+ }
11847
+ }
11848
+ break;
11849
+ }
11850
+ case "end": {
11851
+ isChanged = initialCoordinates.x2 !== coordinates.x2;
11852
+ if (isChanged) {
11853
+ if (rtl) {
11854
+ changedTask.start = dateByX(
11855
+ coordinates.x2,
11856
+ initialCoordinates.x2,
11857
+ selectedTask.start,
11858
+ xStep,
11859
+ timeStep
11860
+ );
11861
+ } else {
11862
+ changedTask.end = dateByX(
11863
+ coordinates.x2,
11864
+ initialCoordinates.x2,
11865
+ selectedTask.end,
11866
+ xStep,
11867
+ timeStep
11868
+ );
11869
+ }
11870
+ }
11871
+ break;
11872
+ }
11873
+ case "move": {
11874
+ isChanged = initialCoordinates.x1 !== coordinates.x1;
11875
+ if (isChanged) {
11876
+ if (rtl) {
11877
+ changedTask.end = dateByX(
11878
+ coordinates.x1,
11879
+ initialCoordinates.x1,
11880
+ selectedTask.end,
11881
+ xStep,
11882
+ timeStep
11883
+ );
11884
+ changedTask.start = dateByX(
11885
+ coordinates.x2,
11886
+ initialCoordinates.x2,
11887
+ selectedTask.start,
11888
+ xStep,
11889
+ timeStep
11890
+ );
11891
+ } else {
11892
+ changedTask.start = dateByX(
11893
+ coordinates.x1,
11894
+ initialCoordinates.x1,
11895
+ selectedTask.start,
11896
+ xStep,
11897
+ timeStep
11898
+ );
11899
+ changedTask.end = dateByX(
11900
+ coordinates.x2,
11901
+ initialCoordinates.x2,
11902
+ selectedTask.end,
11903
+ xStep,
11904
+ timeStep
11905
+ );
11906
+ }
11907
+ }
11908
+ break;
11909
+ }
11910
+ }
11911
+ return { isChanged, changedTask };
11912
+ };
11913
+ const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
11914
+ const changedTask = { ...selectedTask };
11915
+ const isChanged = coordinates.x1 !== initialCoordinates.x1;
11916
+ if (isChanged) {
11917
+ switch (action) {
11918
+ case "move": {
11919
+ changedTask.start = dateByX(
11920
+ coordinates.x1,
11921
+ initialCoordinates.x1,
11922
+ selectedTask.start,
11923
+ xStep,
11924
+ timeStep
11925
+ );
11926
+ changedTask.end = changedTask.start;
11927
+ break;
11928
+ }
11929
+ }
11930
+ }
11931
+ return { isChanged, changedTask };
11932
+ };
11923
11933
  const barWrapper = "_barWrapper_5jhkr_1";
11924
11934
  const barHandle = "_barHandle_5jhkr_11";
11925
11935
  const barHandleImportantVisible = "_barHandleImportantVisible_5jhkr_37";
@@ -19862,7 +19872,7 @@ const Gantt = (props) => {
19862
19872
  viewMode,
19863
19873
  showTodayLine,
19864
19874
  showDataDateLine,
19865
- dataDate,
19875
+ dataDate: dataDate ? roundStartDate(dataDate) : null,
19866
19876
  todayColor,
19867
19877
  dataDateColor,
19868
19878
  todayLabel,
@@ -19882,7 +19892,8 @@ const Gantt = (props) => {
19882
19892
  todayColor,
19883
19893
  dataDateColor,
19884
19894
  todayLabel,
19885
- dataDateLabel
19895
+ dataDateLabel,
19896
+ roundStartDate
19886
19897
  ]
19887
19898
  );
19888
19899
  const calendarProps = useMemo(
@@ -10938,184 +10938,6 @@
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
- };
11119
10941
  const ganttToday = "_ganttToday_1oyhk_1";
11120
10942
  const ganttTodayCircle = "_ganttTodayCircle_1oyhk_9";
11121
10943
  const styles$c = {
@@ -11143,7 +10965,12 @@
11143
10965
  return null;
11144
10966
  }
11145
10967
  const today = /* @__PURE__ */ new Date();
11146
- const tickX = taskXCoordinate(today, startDate, viewMode, columnWidth);
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;
11147
10974
  const x = rtl ? tickX + columnWidth : tickX;
11148
10975
  const color = todayColor || "var(--gantt-calendar-today-color)";
11149
10976
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -11195,7 +11022,12 @@
11195
11022
  if (!showDataDateLine || !dataDate) {
11196
11023
  return null;
11197
11024
  }
11198
- const tickX = taskXCoordinate(dataDate, startDate, viewMode, columnWidth);
11025
+ const index2 = getDatesDiff(dataDate, startDate, viewMode);
11026
+ const currentDate = getDateByOffset(startDate, index2, viewMode);
11027
+ const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11028
+ const remainderMillis = dataDate.getTime() - currentDate.getTime();
11029
+ const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11030
+ const tickX = index2 * columnWidth + percentOfInterval * columnWidth;
11199
11031
  const x = rtl ? tickX + columnWidth : tickX;
11200
11032
  const color = dataDateColor || "var(--gantt-calendar-today-color)";
11201
11033
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -11937,6 +11769,184 @@
11937
11769
  }
11938
11770
  );
11939
11771
  };
11772
+ const taskXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
11773
+ const index2 = getDatesDiff(xDate, startDate, viewMode);
11774
+ const currentDate = getDateByOffset(startDate, index2, viewMode);
11775
+ const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11776
+ const remainderMillis = xDate.getTime() - currentDate.getTime();
11777
+ const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11778
+ return index2 * columnWidth + percentOfInterval * columnWidth;
11779
+ };
11780
+ const taskComparisonXCoordinate = (xDate, startDate, viewMode, columnWidth) => {
11781
+ const index2 = getDatesDiff(xDate, startDate, viewMode);
11782
+ const currentDate = getDateByOffset(startDate, index2, viewMode);
11783
+ const nextDate = getDateByOffset(startDate, index2 + 1, viewMode);
11784
+ const remainderMillis = xDate.getTime() - currentDate.getTime();
11785
+ const percentOfInterval = remainderMillis / (nextDate.getTime() - currentDate.getTime());
11786
+ return index2 * columnWidth + percentOfInterval * columnWidth;
11787
+ };
11788
+ const progressWithByParams = (taskX1, taskX2, progress, rtl) => {
11789
+ const progressWidth = Math.max((taskX2 - taskX1) * progress * 0.01, 0);
11790
+ let progressX;
11791
+ if (rtl) {
11792
+ progressX = taskX2 - progressWidth;
11793
+ } else {
11794
+ progressX = taskX1;
11795
+ }
11796
+ return [progressWidth, progressX];
11797
+ };
11798
+ const dateByX = (x, taskX, taskDate, xStep, timeStep) => {
11799
+ let newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
11800
+ newDate = new Date(
11801
+ newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 6e4
11802
+ );
11803
+ return newDate;
11804
+ };
11805
+ const handleTaskBySVGMouseEvent = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11806
+ let result;
11807
+ switch (selectedTask.type) {
11808
+ case "milestone":
11809
+ result = handleTaskBySVGMouseEventForMilestone(
11810
+ action,
11811
+ selectedTask,
11812
+ initialCoordinates,
11813
+ coordinates,
11814
+ xStep,
11815
+ timeStep
11816
+ );
11817
+ break;
11818
+ default:
11819
+ result = handleTaskBySVGMouseEventForBar(
11820
+ action,
11821
+ selectedTask,
11822
+ initialCoordinates,
11823
+ coordinates,
11824
+ xStep,
11825
+ timeStep,
11826
+ rtl
11827
+ );
11828
+ break;
11829
+ }
11830
+ return result;
11831
+ };
11832
+ const handleTaskBySVGMouseEventForBar = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep, rtl) => {
11833
+ const changedTask = { ...selectedTask };
11834
+ let isChanged = false;
11835
+ switch (action) {
11836
+ case "progress":
11837
+ isChanged = initialCoordinates.progressWidth !== coordinates.progressWidth;
11838
+ if (isChanged) {
11839
+ changedTask.progress = Math.round(
11840
+ coordinates.progressWidth * 100 / (coordinates.x2 - coordinates.x1)
11841
+ );
11842
+ }
11843
+ break;
11844
+ case "start": {
11845
+ isChanged = initialCoordinates.x1 !== coordinates.x1;
11846
+ if (isChanged) {
11847
+ if (rtl) {
11848
+ changedTask.end = dateByX(
11849
+ coordinates.x1,
11850
+ initialCoordinates.x1,
11851
+ selectedTask.end,
11852
+ xStep,
11853
+ timeStep
11854
+ );
11855
+ } else {
11856
+ changedTask.start = dateByX(
11857
+ coordinates.x1,
11858
+ initialCoordinates.x1,
11859
+ selectedTask.start,
11860
+ xStep,
11861
+ timeStep
11862
+ );
11863
+ }
11864
+ }
11865
+ break;
11866
+ }
11867
+ case "end": {
11868
+ isChanged = initialCoordinates.x2 !== coordinates.x2;
11869
+ if (isChanged) {
11870
+ if (rtl) {
11871
+ changedTask.start = dateByX(
11872
+ coordinates.x2,
11873
+ initialCoordinates.x2,
11874
+ selectedTask.start,
11875
+ xStep,
11876
+ timeStep
11877
+ );
11878
+ } else {
11879
+ changedTask.end = dateByX(
11880
+ coordinates.x2,
11881
+ initialCoordinates.x2,
11882
+ selectedTask.end,
11883
+ xStep,
11884
+ timeStep
11885
+ );
11886
+ }
11887
+ }
11888
+ break;
11889
+ }
11890
+ case "move": {
11891
+ isChanged = initialCoordinates.x1 !== coordinates.x1;
11892
+ if (isChanged) {
11893
+ if (rtl) {
11894
+ changedTask.end = dateByX(
11895
+ coordinates.x1,
11896
+ initialCoordinates.x1,
11897
+ selectedTask.end,
11898
+ xStep,
11899
+ timeStep
11900
+ );
11901
+ changedTask.start = dateByX(
11902
+ coordinates.x2,
11903
+ initialCoordinates.x2,
11904
+ selectedTask.start,
11905
+ xStep,
11906
+ timeStep
11907
+ );
11908
+ } else {
11909
+ changedTask.start = dateByX(
11910
+ coordinates.x1,
11911
+ initialCoordinates.x1,
11912
+ selectedTask.start,
11913
+ xStep,
11914
+ timeStep
11915
+ );
11916
+ changedTask.end = dateByX(
11917
+ coordinates.x2,
11918
+ initialCoordinates.x2,
11919
+ selectedTask.end,
11920
+ xStep,
11921
+ timeStep
11922
+ );
11923
+ }
11924
+ }
11925
+ break;
11926
+ }
11927
+ }
11928
+ return { isChanged, changedTask };
11929
+ };
11930
+ const handleTaskBySVGMouseEventForMilestone = (action, selectedTask, initialCoordinates, coordinates, xStep, timeStep) => {
11931
+ const changedTask = { ...selectedTask };
11932
+ const isChanged = coordinates.x1 !== initialCoordinates.x1;
11933
+ if (isChanged) {
11934
+ switch (action) {
11935
+ case "move": {
11936
+ changedTask.start = dateByX(
11937
+ coordinates.x1,
11938
+ initialCoordinates.x1,
11939
+ selectedTask.start,
11940
+ xStep,
11941
+ timeStep
11942
+ );
11943
+ changedTask.end = changedTask.start;
11944
+ break;
11945
+ }
11946
+ }
11947
+ }
11948
+ return { isChanged, changedTask };
11949
+ };
11940
11950
  const barWrapper = "_barWrapper_5jhkr_1";
11941
11951
  const barHandle = "_barHandle_5jhkr_11";
11942
11952
  const barHandleImportantVisible = "_barHandleImportantVisible_5jhkr_37";
@@ -19879,7 +19889,7 @@
19879
19889
  viewMode,
19880
19890
  showTodayLine,
19881
19891
  showDataDateLine,
19882
- dataDate,
19892
+ dataDate: dataDate ? roundStartDate(dataDate) : null,
19883
19893
  todayColor,
19884
19894
  dataDateColor,
19885
19895
  todayLabel,
@@ -19899,7 +19909,8 @@
19899
19909
  todayColor,
19900
19910
  dataDateColor,
19901
19911
  todayLabel,
19902
- dataDateLabel
19912
+ dataDateLabel,
19913
+ roundStartDate
19903
19914
  ]
19904
19915
  );
19905
19916
  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.51",
3
+ "version": "1.0.52",
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",