josenanodev-react-components-library 0.2.8 → 0.2.9

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.
@@ -62,8 +62,14 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
62
62
  const [visibleListElementsIds, setVisibleListElementsIds] = (0, react_1.useState)([]);
63
63
  const [updateList, setUpdateList] = (0, react_1.useState)(false);
64
64
  const [origin, setOrigin] = (0, react_1.useState)({
65
- x: pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) * cellsWidth : 0,
66
- y: 0,
65
+ x: (0, MulticalendarStatesAndSettings_1.getMulticalendarScrollLeftPosition)(multicalendarId)
66
+ ? Number((0, MulticalendarStatesAndSettings_1.getMulticalendarScrollLeftPosition)(multicalendarId))
67
+ : pastDatesVisible
68
+ ? Math.ceil(pastDaysInitialQuantity) * cellsWidth
69
+ : 0,
70
+ y: (0, MulticalendarStatesAndSettings_1.getMulticalendarScrollTopPosition)(multicalendarId)
71
+ ? Number((0, MulticalendarStatesAndSettings_1.getMulticalendarScrollTopPosition)(multicalendarId))
72
+ : 0,
67
73
  });
68
74
  const [xPosition, setXPosition] = (0, react_1.useState)(origin.x);
69
75
  const [yPosition, setYPosition] = (0, react_1.useState)(origin.y);
@@ -86,23 +92,9 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
86
92
  }, [pastDatesVisible, pastDaysInitialQuantity, cellsWidth]);
87
93
  (0, react_1.useEffect)(() => {
88
94
  //Cached positions
89
- let newYPosition = (0, MulticalendarStatesAndSettings_1.getMulticalendarScrollTopPosition)(multicalendarId);
90
- let newXPosition = (0, MulticalendarStatesAndSettings_1.getMulticalendarScrollLeftPosition)(multicalendarId);
91
95
  if (gridWrapperRef.current && initialPositioningDone === false) {
92
- if (newYPosition !== null && newYPosition !== String(origin.y)) {
93
- gridWrapperRef.current.scrollTop = Number(newYPosition);
94
- (0, MulticalendarStatesAndSettings_1.eraseMulticalendarScrollTopPosition)(multicalendarId);
95
- }
96
- else {
97
- gridWrapperRef.current.scrollTop = origin.y;
98
- }
99
- if (newXPosition !== null && newXPosition !== String(origin.x)) {
100
- gridWrapperRef.current.scrollLeft = Number(newXPosition);
101
- (0, MulticalendarStatesAndSettings_1.eraseMulticalendarScrollLeftPosition)(multicalendarId);
102
- }
103
- else {
104
- gridWrapperRef.current.scrollLeft = origin.x;
105
- }
96
+ gridWrapperRef.current.scrollTop = origin.y;
97
+ gridWrapperRef.current.scrollLeft = origin.x;
106
98
  setInitialPositioningDone(true);
107
99
  }
108
100
  }, [origin.y, origin.x, initialPositioningDone]);
@@ -13,7 +13,7 @@ import useWindowSize from "../../hooks/useWindowsSize";
13
13
  //Utils
14
14
  import sqlToJsDate from "../../utils/sqlToJsDate";
15
15
  //Services
16
- import { eraseMulticalendarScrollLeftPosition, eraseMulticalendarScrollTopPosition, getMulticalendarScrollLeftPosition, getMulticalendarScrollTopPosition, setMulticalendarScrollLeftPosition, setMulticalendarScrollTopPosition, } from "../../Services/MulticalendarStatesAndSettings";
16
+ import { getMulticalendarScrollLeftPosition, getMulticalendarScrollTopPosition, setMulticalendarScrollLeftPosition, setMulticalendarScrollTopPosition, } from "../../Services/MulticalendarStatesAndSettings";
17
17
  const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChildren, listElementsIdsArray, language, pastDatesVisible = true, cellsWidth = 120, cellsHeight = 80, verticalAxisWidth = 280, horizontalAxisHeight = 148, pastDaysInitialQuantity = 365, futureDaysInitialQuantity = 365, chunkRenderX = 0, chunkRenderY = 0, dynamicDaysQuantity = false, draggingOverDateCells = false, waitTimeForCalls = 500, callsOnInitialView, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, autoSavePosition, onScrollTopChanges, onScrollLeftChanges, }) => {
18
18
  //Constantes del componente
19
19
  const initialDateOffset = 1 + chunkRenderX;
@@ -34,8 +34,14 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
34
34
  const [visibleListElementsIds, setVisibleListElementsIds] = useState([]);
35
35
  const [updateList, setUpdateList] = useState(false);
36
36
  const [origin, setOrigin] = useState({
37
- x: pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) * cellsWidth : 0,
38
- y: 0,
37
+ x: getMulticalendarScrollLeftPosition(multicalendarId)
38
+ ? Number(getMulticalendarScrollLeftPosition(multicalendarId))
39
+ : pastDatesVisible
40
+ ? Math.ceil(pastDaysInitialQuantity) * cellsWidth
41
+ : 0,
42
+ y: getMulticalendarScrollTopPosition(multicalendarId)
43
+ ? Number(getMulticalendarScrollTopPosition(multicalendarId))
44
+ : 0,
39
45
  });
40
46
  const [xPosition, setXPosition] = useState(origin.x);
41
47
  const [yPosition, setYPosition] = useState(origin.y);
@@ -58,23 +64,9 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
58
64
  }, [pastDatesVisible, pastDaysInitialQuantity, cellsWidth]);
59
65
  useEffect(() => {
60
66
  //Cached positions
61
- let newYPosition = getMulticalendarScrollTopPosition(multicalendarId);
62
- let newXPosition = getMulticalendarScrollLeftPosition(multicalendarId);
63
67
  if (gridWrapperRef.current && initialPositioningDone === false) {
64
- if (newYPosition !== null && newYPosition !== String(origin.y)) {
65
- gridWrapperRef.current.scrollTop = Number(newYPosition);
66
- eraseMulticalendarScrollTopPosition(multicalendarId);
67
- }
68
- else {
69
- gridWrapperRef.current.scrollTop = origin.y;
70
- }
71
- if (newXPosition !== null && newXPosition !== String(origin.x)) {
72
- gridWrapperRef.current.scrollLeft = Number(newXPosition);
73
- eraseMulticalendarScrollLeftPosition(multicalendarId);
74
- }
75
- else {
76
- gridWrapperRef.current.scrollLeft = origin.x;
77
- }
68
+ gridWrapperRef.current.scrollTop = origin.y;
69
+ gridWrapperRef.current.scrollLeft = origin.x;
78
70
  setInitialPositioningDone(true);
79
71
  }
80
72
  }, [origin.y, origin.x, initialPositioningDone]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "josenanodev-react-components-library",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "author": {
5
5
  "name": "Jose Carlos Cardenas Martinez"
6
6
  },