josenanodev-react-components-library 0.0.23 → 0.0.25

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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import "./Multicalendar.css";
3
3
  import { MulticalendarPropsType } from "./types";
4
- declare const Multicalendar: ({ multicalendarId, ReactCellChildren, ReactListElementChildren, listElementsIdsArray, language, pastDatesVisible, cellsWidth, cellsHeight, verticalAxisWidth, horizontalAxisHeight, pastDaysInitialQuantity, futureDaysInitialQuantity, chunkRenderX, chunkRenderY, dynamicDaysQuantity, draggingOverDateCells, waitTimeForCalls, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }: MulticalendarPropsType) => JSX.Element;
4
+ declare const Multicalendar: ({ multicalendarId, ReactCellChildren, ReactListElementChildren, listElementsIdsArray, language, pastDatesVisible, cellsWidth, cellsHeight, verticalAxisWidth, horizontalAxisHeight, pastDaysInitialQuantity, futureDaysInitialQuantity, chunkRenderX, chunkRenderY, dynamicDaysQuantity, draggingOverDateCells, waitTimeForCalls, callsOnInitialView, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }: MulticalendarPropsType) => JSX.Element;
5
5
  export default Multicalendar;
@@ -42,7 +42,7 @@ const useWindowsSize_1 = __importDefault(require("../../hooks/useWindowsSize"));
42
42
  const sqlToJsDate_1 = __importDefault(require("../../utils/sqlToJsDate"));
43
43
  //Services
44
44
  const MulticalendarStatesAndSettings_1 = require("../../Services/MulticalendarStatesAndSettings");
45
- 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, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }) => {
45
+ 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, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }) => {
46
46
  //Constantes del componente
47
47
  const origin = {
48
48
  x: pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) * cellsWidth : 0,
@@ -55,6 +55,7 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
55
55
  const gridWrapperRef = (0, react_1.useRef)(null);
56
56
  //Estados
57
57
  const [firtsCall, setFirtsCall] = (0, react_1.useState)(false);
58
+ const [firtsCallOnInitialViewDone, setFirtsCallOnInitialViewDone] = (0, react_1.useState)(false);
58
59
  const [windowWidth, windowHeight] = (0, useWindowsSize_1.default)();
59
60
  const [futureDaysQuantity, setFutureDaysQuantity] = (0, react_1.useState)(Math.ceil(futureDaysInitialQuantity));
60
61
  const [pastDaysQuantity, setPastDaysQuantity] = (0, react_1.useState)(pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) : 0);
@@ -99,6 +100,20 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
99
100
  }
100
101
  }
101
102
  }, [firtsCall]);
103
+ (0, react_1.useEffect)(() => {
104
+ if (!firtsCallOnInitialViewDone &&
105
+ visibleListElementsIds.length > 0 &&
106
+ visibleDates.length > 0 &&
107
+ callsOnInitialView) {
108
+ setFirtsCallOnInitialViewDone(true);
109
+ callsOnInitialView(visibleListElementsIds, visibleDates);
110
+ }
111
+ }, [
112
+ firtsCallOnInitialViewDone,
113
+ visibleListElementsIds,
114
+ visibleDates,
115
+ callsOnInitialView,
116
+ ]);
102
117
  (0, react_1.useEffect)(() => {
103
118
  // Posicionamiento inicial en X
104
119
  if (gridWrapperRef.current !== null) {
@@ -18,6 +18,7 @@ export interface MulticalendarPropsType {
18
18
  draggingOverDateCells?: boolean;
19
19
  dynamicDaysQuantity?: boolean;
20
20
  waitTimeForCalls?: number;
21
+ callsOnInitialView?: (visibleIds: string[] | number[], visibleDates: Date[]) => void;
21
22
  callsOnScrollingMoves?: (visibleIds: string[] | number[], visibleDates: Date[]) => void;
22
23
  callsOnScrollingStops?: (visibleIds: string[] | number[], visibleDates: Date[]) => void;
23
24
  aditionalControlsComponents?: JSX.Element | JSX.Element[]
@@ -36,9 +36,6 @@ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, onSelectio
36
36
  }
37
37
  });
38
38
  setSelectedDatumsIds(selectedDatumsIdsClone);
39
- if (onSelectionChange) {
40
- onSelectionChange(selectedDatumsIdsClone);
41
- }
42
39
  };
43
40
  const removeFromSelectedDatumsIds = (datumIdsArray) => {
44
41
  const selectedDatumsIdsClone = [...selectedDatumsIds];
@@ -48,9 +45,6 @@ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, onSelectio
48
45
  }
49
46
  });
50
47
  setSelectedDatumsIds(selectedDatumsIdsClone);
51
- if (onSelectionChange) {
52
- onSelectionChange(selectedDatumsIdsClone);
53
- }
54
48
  };
55
49
  //useEffects
56
50
  (0, react_2.useEffect)(() => {
@@ -97,6 +91,13 @@ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, onSelectio
97
91
  listElementsHeight,
98
92
  filteredRightList.length,
99
93
  ]);
94
+ (0, react_2.useEffect)(() => {
95
+ //I know what I am doing... maybe
96
+ if (onSelectionChange) {
97
+ onSelectionChange(selectedDatumsIds);
98
+ }
99
+ // eslint-disable-next-line
100
+ }, [selectedDatumsIds]);
100
101
  return (react_1.default.createElement("div", { className: "parallel-selection-list" },
101
102
  react_1.default.createElement("div", { className: "div-left-list" },
102
103
  react_1.default.createElement("p", { className: "list-title" }, leftListTitle),
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import "./Multicalendar.css";
3
3
  import { MulticalendarPropsType } from "./types";
4
- declare const Multicalendar: ({ multicalendarId, ReactCellChildren, ReactListElementChildren, listElementsIdsArray, language, pastDatesVisible, cellsWidth, cellsHeight, verticalAxisWidth, horizontalAxisHeight, pastDaysInitialQuantity, futureDaysInitialQuantity, chunkRenderX, chunkRenderY, dynamicDaysQuantity, draggingOverDateCells, waitTimeForCalls, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }: MulticalendarPropsType) => JSX.Element;
4
+ declare const Multicalendar: ({ multicalendarId, ReactCellChildren, ReactListElementChildren, listElementsIdsArray, language, pastDatesVisible, cellsWidth, cellsHeight, verticalAxisWidth, horizontalAxisHeight, pastDaysInitialQuantity, futureDaysInitialQuantity, chunkRenderX, chunkRenderY, dynamicDaysQuantity, draggingOverDateCells, waitTimeForCalls, callsOnInitialView, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }: MulticalendarPropsType) => JSX.Element;
5
5
  export default Multicalendar;
@@ -14,7 +14,7 @@ import useWindowSize from "../../hooks/useWindowsSize";
14
14
  import sqlToJsDate from "../../utils/sqlToJsDate";
15
15
  //Services
16
16
  import { eraseMulticalendarYScrollPosition, getMulticalendarYScrollPosition, } from "../../Services/MulticalendarStatesAndSettings";
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, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }) => {
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, callsOnScrollingMoves, callsOnScrollingStops, aditionalControlsComponents, upperLeftComponent, }) => {
18
18
  //Constantes del componente
19
19
  const origin = {
20
20
  x: pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) * cellsWidth : 0,
@@ -27,6 +27,7 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
27
27
  const gridWrapperRef = useRef(null);
28
28
  //Estados
29
29
  const [firtsCall, setFirtsCall] = useState(false);
30
+ const [firtsCallOnInitialViewDone, setFirtsCallOnInitialViewDone] = useState(false);
30
31
  const [windowWidth, windowHeight] = useWindowSize();
31
32
  const [futureDaysQuantity, setFutureDaysQuantity] = useState(Math.ceil(futureDaysInitialQuantity));
32
33
  const [pastDaysQuantity, setPastDaysQuantity] = useState(pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) : 0);
@@ -71,6 +72,20 @@ const Multicalendar = ({ multicalendarId, ReactCellChildren, ReactListElementChi
71
72
  }
72
73
  }
73
74
  }, [firtsCall]);
75
+ useEffect(() => {
76
+ if (!firtsCallOnInitialViewDone &&
77
+ visibleListElementsIds.length > 0 &&
78
+ visibleDates.length > 0 &&
79
+ callsOnInitialView) {
80
+ setFirtsCallOnInitialViewDone(true);
81
+ callsOnInitialView(visibleListElementsIds, visibleDates);
82
+ }
83
+ }, [
84
+ firtsCallOnInitialViewDone,
85
+ visibleListElementsIds,
86
+ visibleDates,
87
+ callsOnInitialView,
88
+ ]);
74
89
  useEffect(() => {
75
90
  // Posicionamiento inicial en X
76
91
  if (gridWrapperRef.current !== null) {
@@ -18,6 +18,7 @@ export interface MulticalendarPropsType {
18
18
  draggingOverDateCells?: boolean;
19
19
  dynamicDaysQuantity?: boolean;
20
20
  waitTimeForCalls?: number;
21
+ callsOnInitialView?: (visibleIds: string[] | number[], visibleDates: Date[]) => void;
21
22
  callsOnScrollingMoves?: (visibleIds: string[] | number[], visibleDates: Date[]) => void;
22
23
  callsOnScrollingStops?: (visibleIds: string[] | number[], visibleDates: Date[]) => void;
23
24
  aditionalControlsComponents?: JSX.Element | JSX.Element[]
@@ -31,9 +31,6 @@ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, onSelectio
31
31
  }
32
32
  });
33
33
  setSelectedDatumsIds(selectedDatumsIdsClone);
34
- if (onSelectionChange) {
35
- onSelectionChange(selectedDatumsIdsClone);
36
- }
37
34
  };
38
35
  const removeFromSelectedDatumsIds = (datumIdsArray) => {
39
36
  const selectedDatumsIdsClone = [...selectedDatumsIds];
@@ -43,9 +40,6 @@ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, onSelectio
43
40
  }
44
41
  });
45
42
  setSelectedDatumsIds(selectedDatumsIdsClone);
46
- if (onSelectionChange) {
47
- onSelectionChange(selectedDatumsIdsClone);
48
- }
49
43
  };
50
44
  //useEffects
51
45
  useEffect(() => {
@@ -92,6 +86,13 @@ const ParallelSelectionList = ({ dataList, applyAction, cancelAction, onSelectio
92
86
  listElementsHeight,
93
87
  filteredRightList.length,
94
88
  ]);
89
+ useEffect(() => {
90
+ //I know what I am doing... maybe
91
+ if (onSelectionChange) {
92
+ onSelectionChange(selectedDatumsIds);
93
+ }
94
+ // eslint-disable-next-line
95
+ }, [selectedDatumsIds]);
95
96
  return (React.createElement("div", { className: "parallel-selection-list" },
96
97
  React.createElement("div", { className: "div-left-list" },
97
98
  React.createElement("p", { className: "list-title" }, leftListTitle),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "josenanodev-react-components-library",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "author": {
5
5
  "name": "Jose Carlos Cardenas Martinez"
6
6
  },