josenanodev-react-components-library 0.0.12 → 0.0.15
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 +4 -4
- package/dist/cjs/Services/MulticalendarStatesAndSettings.d.ts +17 -17
- package/dist/cjs/Services/MulticalendarStatesAndSettings.js +29 -29
- package/dist/cjs/Services/accessToken.d.ts +3 -3
- package/dist/cjs/Services/accessToken.js +15 -15
- package/dist/cjs/common/constants.d.ts +5 -5
- package/dist/cjs/common/constants.js +8 -8
- package/dist/cjs/common/turboSuiteUrls.d.ts +7 -7
- package/dist/cjs/common/turboSuiteUrls.js +9 -9
- package/dist/cjs/common/types.d.ts +113 -113
- package/dist/cjs/components/Modal/Modal.css +43 -43
- package/dist/cjs/components/Modal/Modal.d.ts +5 -5
- package/dist/cjs/components/Modal/Modal.js +82 -82
- package/dist/cjs/components/Modal/types.d.ts +9 -9
- package/dist/cjs/components/Multicalendar/Multicalendar.css +191 -191
- package/dist/cjs/components/Multicalendar/Multicalendar.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/Multicalendar.js +302 -302
- package/dist/cjs/components/Multicalendar/MulticalendarOwnFunctions.d.ts +86 -86
- package/dist/cjs/components/Multicalendar/MulticalendarOwnFunctions.js +192 -192
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.css +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.js +20 -20
- package/dist/cjs/components/Multicalendar/subcomponents/composites/CellsRow/types.d.ts +11 -11
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.css +7 -7
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.js +20 -20
- package/dist/cjs/components/Multicalendar/subcomponents/composites/DatesGrid/types.d.ts +13 -13
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.css +3 -3
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.js +15 -15
- package/dist/cjs/components/Multicalendar/subcomponents/composites/ListElementsColumn/types.d.ts +9 -9
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/Cell.css +7 -7
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/Cell.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/Cell.js +12 -12
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/Cell/types.d.ts +10 -10
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.css +60 -60
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.js +56 -56
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DatesRow/types.d.ts +10 -10
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.css +13 -13
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.js +13 -13
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/types.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.css +14 -14
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.d.ts +5 -5
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.js +14 -14
- package/dist/cjs/components/Multicalendar/subcomponents/individuals/ListElement/types.d.ts +7 -7
- package/dist/cjs/components/Multicalendar/types.d.ts +45 -45
- package/dist/cjs/components/PopUp/PopUp.css +15 -15
- package/dist/cjs/components/PopUp/PopUp.d.ts +5 -5
- package/dist/cjs/components/PopUp/PopUp.js +50 -50
- package/dist/cjs/components/PopUp/types.d.ts +8 -8
- package/dist/cjs/components/SearchBar/SearchBar.css +35 -35
- package/dist/cjs/components/SearchBar/SearchBar.d.ts +5 -5
- package/dist/cjs/components/SearchBar/SearchBar.js +67 -67
- package/dist/cjs/components/SearchBar/types.d.ts +10 -10
- package/dist/cjs/components/SideBar/SideBar.css +50 -50
- package/dist/cjs/components/SideBar/SideBar.d.ts +8 -8
- package/dist/cjs/components/SideBar/SideBar.js +70 -70
- package/dist/cjs/components/SideBar/types.d.ts +8 -8
- package/dist/cjs/hooks/useOutsideClick.d.ts +6 -6
- package/dist/cjs/hooks/useOutsideClick.js +25 -25
- package/dist/cjs/hooks/useResizeObserver.d.ts +7 -7
- package/dist/cjs/hooks/useResizeObserver.js +30 -30
- package/dist/cjs/hooks/useWindowsSize.d.ts +6 -6
- package/dist/cjs/hooks/useWindowsSize.js +20 -20
- package/dist/cjs/index.css +77 -77
- package/dist/cjs/index.d.ts +7 -7
- package/dist/cjs/index.js +18 -18
- package/dist/cjs/languages/en-EN.d.ts +3 -3
- package/dist/cjs/languages/en-EN.js +25 -25
- package/dist/cjs/languages/es-ES.d.ts +3 -3
- package/dist/cjs/languages/es-ES.js +25 -25
- package/dist/cjs/languages/it-IT.d.ts +3 -3
- package/dist/cjs/languages/it-IT.js +25 -25
- package/dist/cjs/languages/types.d.ts +21 -21
- package/dist/cjs/mocks/ReactComponentMocksForTesting/CellChildrenMock.d.ts +4 -4
- package/dist/cjs/mocks/ReactComponentMocksForTesting/CellChildrenMock.js +13 -13
- package/dist/cjs/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.d.ts +4 -4
- package/dist/cjs/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.js +10 -10
- package/dist/cjs/react-app-env.d.ts +1 -1
- package/dist/cjs/setupTests.d.ts +2 -2
- package/dist/cjs/setupTests.js +8 -8
- package/dist/cjs/stories/css-presets.css +77 -77
- package/dist/cjs/utils/datesArray.d.ts +8 -8
- package/dist/cjs/utils/datesArray.js +23 -23
- package/dist/cjs/utils/jsToSqlDate.d.ts +7 -7
- package/dist/cjs/utils/jsToSqlDate.js +22 -22
- package/dist/cjs/utils/monthYearString.d.ts +3 -3
- package/dist/cjs/utils/monthYearString.js +27 -27
- package/dist/cjs/utils/numberOfDaysInAMonth.d.ts +6 -6
- package/dist/cjs/utils/numberOfDaysInAMonth.js +12 -12
- package/dist/cjs/utils/sqlToJsDate.d.ts +7 -7
- package/dist/cjs/utils/sqlToJsDate.js +14 -14
- package/dist/esm/Services/MulticalendarStatesAndSettings.d.ts +17 -17
- package/dist/esm/Services/MulticalendarStatesAndSettings.js +23 -23
- package/dist/esm/Services/accessToken.d.ts +3 -3
- package/dist/esm/Services/accessToken.js +9 -9
- package/dist/esm/common/constants.d.ts +5 -5
- package/dist/esm/common/constants.js +5 -5
- package/dist/esm/common/turboSuiteUrls.d.ts +7 -7
- package/dist/esm/common/turboSuiteUrls.js +7 -7
- package/dist/esm/common/types.d.ts +113 -113
- package/dist/esm/components/Modal/Modal.css +43 -43
- package/dist/esm/components/Modal/Modal.d.ts +5 -5
- package/dist/esm/components/Modal/Modal.js +54 -54
- package/dist/esm/components/Modal/types.d.ts +9 -9
- package/dist/esm/components/Multicalendar/Multicalendar.css +191 -191
- package/dist/esm/components/Multicalendar/Multicalendar.d.ts +5 -5
- package/dist/esm/components/Multicalendar/Multicalendar.js +274 -274
- package/dist/esm/components/Multicalendar/MulticalendarOwnFunctions.d.ts +86 -86
- package/dist/esm/components/Multicalendar/MulticalendarOwnFunctions.js +176 -176
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.css +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/CellsRow.js +15 -15
- package/dist/esm/components/Multicalendar/subcomponents/composites/CellsRow/types.d.ts +11 -11
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.css +7 -7
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/DatesGrid.js +15 -15
- package/dist/esm/components/Multicalendar/subcomponents/composites/DatesGrid/types.d.ts +13 -13
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.css +3 -3
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/ListElementsColumn.js +10 -10
- package/dist/esm/components/Multicalendar/subcomponents/composites/ListElementsColumn/types.d.ts +9 -9
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/Cell.css +7 -7
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/Cell.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/Cell.js +7 -7
- package/dist/esm/components/Multicalendar/subcomponents/individuals/Cell/types.d.ts +10 -10
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.css +60 -60
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/DatesRow.js +51 -51
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DatesRow/types.d.ts +10 -10
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.css +13 -13
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation.js +8 -8
- package/dist/esm/components/Multicalendar/subcomponents/individuals/DropdownMonthNavigation/types.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.css +14 -14
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.d.ts +5 -5
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/ListElement.js +9 -9
- package/dist/esm/components/Multicalendar/subcomponents/individuals/ListElement/types.d.ts +7 -7
- package/dist/esm/components/Multicalendar/types.d.ts +45 -45
- package/dist/esm/components/PopUp/PopUp.css +15 -15
- package/dist/esm/components/PopUp/PopUp.d.ts +5 -5
- package/dist/esm/components/PopUp/PopUp.js +22 -22
- package/dist/esm/components/PopUp/types.d.ts +8 -8
- package/dist/esm/components/SearchBar/SearchBar.css +35 -35
- package/dist/esm/components/SearchBar/SearchBar.d.ts +5 -5
- package/dist/esm/components/SearchBar/SearchBar.js +42 -42
- package/dist/esm/components/SearchBar/types.d.ts +10 -10
- package/dist/esm/components/SideBar/SideBar.css +50 -50
- package/dist/esm/components/SideBar/SideBar.d.ts +8 -8
- package/dist/esm/components/SideBar/SideBar.js +42 -42
- package/dist/esm/components/SideBar/types.d.ts +8 -8
- package/dist/esm/hooks/useOutsideClick.d.ts +6 -6
- package/dist/esm/hooks/useOutsideClick.js +23 -23
- package/dist/esm/hooks/useResizeObserver.d.ts +7 -7
- package/dist/esm/hooks/useResizeObserver.js +28 -28
- package/dist/esm/hooks/useWindowsSize.d.ts +6 -6
- package/dist/esm/hooks/useWindowsSize.js +18 -18
- package/dist/esm/index.css +77 -77
- package/dist/esm/index.d.ts +7 -7
- package/dist/esm/index.js +7 -7
- package/dist/esm/languages/en-EN.d.ts +3 -3
- package/dist/esm/languages/en-EN.js +23 -23
- package/dist/esm/languages/es-ES.d.ts +3 -3
- package/dist/esm/languages/es-ES.js +23 -23
- package/dist/esm/languages/it-IT.d.ts +3 -3
- package/dist/esm/languages/it-IT.js +23 -23
- package/dist/esm/languages/types.d.ts +21 -21
- package/dist/esm/mocks/ReactComponentMocksForTesting/CellChildrenMock.d.ts +4 -4
- package/dist/esm/mocks/ReactComponentMocksForTesting/CellChildrenMock.js +8 -8
- package/dist/esm/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.d.ts +4 -4
- package/dist/esm/mocks/ReactComponentMocksForTesting/ListElementChildrenMock.js +5 -5
- package/dist/esm/react-app-env.d.ts +1 -1
- package/dist/esm/setupTests.d.ts +2 -2
- package/dist/esm/setupTests.js +6 -6
- package/dist/esm/stories/css-presets.css +77 -77
- package/dist/esm/utils/datesArray.d.ts +8 -8
- package/dist/esm/utils/datesArray.js +21 -21
- package/dist/esm/utils/jsToSqlDate.d.ts +7 -7
- package/dist/esm/utils/jsToSqlDate.js +20 -20
- package/dist/esm/utils/monthYearString.d.ts +3 -3
- package/dist/esm/utils/monthYearString.js +25 -25
- package/dist/esm/utils/numberOfDaysInAMonth.d.ts +6 -6
- package/dist/esm/utils/numberOfDaysInAMonth.js +8 -8
- package/dist/esm/utils/sqlToJsDate.d.ts +7 -7
- package/dist/esm/utils/sqlToJsDate.js +12 -12
- package/package.json +103 -93
|
@@ -1,302 +1,302 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const Funciones = __importStar(require("./MulticalendarOwnFunctions"));
|
|
31
|
-
require("./Multicalendar.css");
|
|
32
|
-
//Assets
|
|
33
|
-
const bs_1 = require("react-icons/bs");
|
|
34
|
-
//Componentes
|
|
35
|
-
const DatesRow_1 = __importDefault(require("./subcomponents/individuals/DatesRow/DatesRow"));
|
|
36
|
-
const ListElementsColumn_1 = __importDefault(require("./subcomponents/composites/ListElementsColumn/ListElementsColumn"));
|
|
37
|
-
const DatesGrid_1 = __importDefault(require("./subcomponents/composites/DatesGrid/DatesGrid"));
|
|
38
|
-
const DropdownMonthNavigation_1 = __importDefault(require("./subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation"));
|
|
39
|
-
//Hooks
|
|
40
|
-
const useWindowsSize_1 = __importDefault(require("../../hooks/useWindowsSize"));
|
|
41
|
-
//Utils
|
|
42
|
-
const sqlToJsDate_1 = __importDefault(require("../../utils/sqlToJsDate"));
|
|
43
|
-
//Services
|
|
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, }) => {
|
|
46
|
-
//Constantes del componente
|
|
47
|
-
const origin = {
|
|
48
|
-
x: pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) * cellsWidth : 0,
|
|
49
|
-
y: 0,
|
|
50
|
-
};
|
|
51
|
-
const initialDateOffset = 2 + chunkRenderX;
|
|
52
|
-
//Refs
|
|
53
|
-
const datesRowRef = (0, react_1.useRef)(null);
|
|
54
|
-
const destiniesColumnRef = (0, react_1.useRef)(null);
|
|
55
|
-
const gridWrapperRef = (0, react_1.useRef)(null);
|
|
56
|
-
//Estados
|
|
57
|
-
const [firtsCall, setFirtsCall] = (0, react_1.useState)(false);
|
|
58
|
-
const [windowWidth, windowHeight] = (0, useWindowsSize_1.default)();
|
|
59
|
-
const [futureDaysQuantity, setFutureDaysQuantity] = (0, react_1.useState)(Math.ceil(futureDaysInitialQuantity));
|
|
60
|
-
const [pastDaysQuantity, setPastDaysQuantity] = (0, react_1.useState)(pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) : 0);
|
|
61
|
-
const [paginationWidth, setPaginationWidth] = (0, react_1.useState)(0);
|
|
62
|
-
const [paginationHeight, setPaginationHeight] = (0, react_1.useState)(0);
|
|
63
|
-
const [xOffset, setXOffset] = (0, react_1.useState)(1);
|
|
64
|
-
const [yOffset, setYOffset] = (0, react_1.useState)(0);
|
|
65
|
-
const [visibleDates, setVisibleDates] = (0, react_1.useState)([]);
|
|
66
|
-
const [visibleListElementsIds, setVisibleListElementsIds] = (0, react_1.useState)([]);
|
|
67
|
-
const [updateList, setUpdateList] = (0, react_1.useState)(false);
|
|
68
|
-
const [xPosition, setXPosition] = (0, react_1.useState)(origin.x);
|
|
69
|
-
const [yPosition, setYPosition] = (0, react_1.useState)(origin.y);
|
|
70
|
-
const [renderCoordinates, setRenderCoordinates] = (0, react_1.useState)({
|
|
71
|
-
x: origin.x,
|
|
72
|
-
y: origin.y,
|
|
73
|
-
});
|
|
74
|
-
const [minimumVisibleDate, setMinimumVisibleDate] = (0, react_1.useState)(new Date());
|
|
75
|
-
const [idTimeoutForCalls, setIdTimeoutForCalls] = (0, react_1.useState)(undefined);
|
|
76
|
-
const [clientXPositionOnGrid, setClientXPositionOnGrid] = (0, react_1.useState)(undefined);
|
|
77
|
-
const [clientYPositionOnGrid, setClientYPositionOnGrid] = (0, react_1.useState)(undefined);
|
|
78
|
-
const [scrollingOnCourse, setScrollingOnCourse] = (0, react_1.useState)(false);
|
|
79
|
-
//UseEffects
|
|
80
|
-
(0, react_1.useEffect)(() => {
|
|
81
|
-
if (pastDatesVisible) {
|
|
82
|
-
setPastDaysQuantity(Math.ceil(pastDaysInitialQuantity));
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
setPastDaysQuantity(0);
|
|
86
|
-
}
|
|
87
|
-
}, [pastDatesVisible, pastDaysInitialQuantity]);
|
|
88
|
-
(0, react_1.useEffect)(() => {
|
|
89
|
-
//Delegamos un cambio de estado a los primero renderes para evitar duplicado de llamadas a la API
|
|
90
|
-
if (!firtsCall) {
|
|
91
|
-
setFirtsCall(true);
|
|
92
|
-
//Cached Y position
|
|
93
|
-
let newYPosition = (0, MulticalendarStatesAndSettings_1.getMulticalendarYScrollPosition)(multicalendarId);
|
|
94
|
-
if (newYPosition !== null && newYPosition !== "0") {
|
|
95
|
-
if (gridWrapperRef.current) {
|
|
96
|
-
gridWrapperRef.current.scrollTop = Number(newYPosition);
|
|
97
|
-
(0, MulticalendarStatesAndSettings_1.eraseMulticalendarYScrollPosition)(multicalendarId);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}, [firtsCall]);
|
|
102
|
-
(0, react_1.useEffect)(() => {
|
|
103
|
-
// Posicionamiento inicial en X
|
|
104
|
-
if (gridWrapperRef.current !== null) {
|
|
105
|
-
gridWrapperRef.current.scrollLeft = origin.x;
|
|
106
|
-
}
|
|
107
|
-
}, [origin.x]);
|
|
108
|
-
(0, react_1.useEffect)(() => {
|
|
109
|
-
setUpdateList(true);
|
|
110
|
-
// Dimensiones de paginacion, requiere agregar 1 para no ver espacios en blanco
|
|
111
|
-
setPaginationWidth(Math.ceil((windowWidth - verticalAxisWidth) / cellsWidth) + 1);
|
|
112
|
-
setPaginationHeight(Math.ceil((windowHeight - horizontalAxisHeight) / cellsHeight) + 1);
|
|
113
|
-
// Redefinicion de posicion X ante cambios en el tamaño de la ventana
|
|
114
|
-
if (gridWrapperRef.current !== null) {
|
|
115
|
-
setXPosition(gridWrapperRef.current.scrollLeft);
|
|
116
|
-
setRenderCoordinates({
|
|
117
|
-
x: gridWrapperRef.current.scrollLeft,
|
|
118
|
-
y: gridWrapperRef.current.scrollTop,
|
|
119
|
-
});
|
|
120
|
-
setXOffset(Math.floor(gridWrapperRef.current.scrollLeft / cellsWidth) - chunkRenderX);
|
|
121
|
-
}
|
|
122
|
-
}, [
|
|
123
|
-
windowWidth,
|
|
124
|
-
windowHeight,
|
|
125
|
-
verticalAxisWidth,
|
|
126
|
-
horizontalAxisHeight,
|
|
127
|
-
cellsHeight,
|
|
128
|
-
cellsWidth,
|
|
129
|
-
chunkRenderX,
|
|
130
|
-
]);
|
|
131
|
-
(0, react_1.useEffect)(() => {
|
|
132
|
-
// Definicion de visibilidad y renderizacion del Eje Y
|
|
133
|
-
if ((renderCoordinates.x === origin.x && renderCoordinates.y === origin.y) ||
|
|
134
|
-
Math.abs(renderCoordinates.y - yPosition) / cellsHeight > chunkRenderY ||
|
|
135
|
-
updateList) {
|
|
136
|
-
if (!(renderCoordinates.x === origin.x && renderCoordinates.y === origin.y)) {
|
|
137
|
-
if (gridWrapperRef.current !== null)
|
|
138
|
-
setRenderCoordinates({
|
|
139
|
-
x: gridWrapperRef.current.scrollLeft,
|
|
140
|
-
y: gridWrapperRef.current.scrollTop,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
let desfase = Funciones.defineYOffset(yPosition, cellsHeight, chunkRenderY);
|
|
144
|
-
setYOffset(desfase);
|
|
145
|
-
setVisibleListElementsIds(Funciones.defineListElementsArrayVisibleList(paginationHeight, chunkRenderY, desfase, listElementsIdsArray));
|
|
146
|
-
if (updateList)
|
|
147
|
-
setUpdateList(false);
|
|
148
|
-
}
|
|
149
|
-
}, [
|
|
150
|
-
updateList,
|
|
151
|
-
yPosition,
|
|
152
|
-
cellsHeight,
|
|
153
|
-
chunkRenderY,
|
|
154
|
-
origin.x,
|
|
155
|
-
origin.y,
|
|
156
|
-
paginationHeight,
|
|
157
|
-
renderCoordinates.x,
|
|
158
|
-
renderCoordinates.y,
|
|
159
|
-
listElementsIdsArray,
|
|
160
|
-
]);
|
|
161
|
-
(0, react_1.useEffect)(() => {
|
|
162
|
-
// Definicion de visibilidad y renderizacion del Eje X
|
|
163
|
-
if ((renderCoordinates.x === origin.x && renderCoordinates.y === origin.y) ||
|
|
164
|
-
xPosition < cellsWidth ||
|
|
165
|
-
Math.abs(renderCoordinates.x - xPosition) / cellsWidth > chunkRenderX ||
|
|
166
|
-
updateList) {
|
|
167
|
-
setVisibleDates([]);
|
|
168
|
-
if (!(renderCoordinates.x === origin.x && renderCoordinates.y === origin.y)) {
|
|
169
|
-
if (gridWrapperRef.current !== null)
|
|
170
|
-
setRenderCoordinates({
|
|
171
|
-
x: gridWrapperRef.current.scrollLeft,
|
|
172
|
-
y: gridWrapperRef.current.scrollTop,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
setXOffset(Funciones.defineXOffset(xPosition, cellsWidth, chunkRenderX));
|
|
176
|
-
const fechaMinimaMilisegundos = Funciones.minimalDateMilliseconds(xPosition, cellsWidth, pastDaysQuantity, initialDateOffset);
|
|
177
|
-
setMinimumVisibleDate(Funciones.defineMinimalVisibleDate(fechaMinimaMilisegundos, initialDateOffset));
|
|
178
|
-
if (updateList)
|
|
179
|
-
setUpdateList(false);
|
|
180
|
-
setVisibleDates(Funciones.defineVisibleDatesArray(paginationWidth, chunkRenderX, fechaMinimaMilisegundos));
|
|
181
|
-
}
|
|
182
|
-
}, [
|
|
183
|
-
updateList,
|
|
184
|
-
paginationWidth,
|
|
185
|
-
xPosition,
|
|
186
|
-
chunkRenderX,
|
|
187
|
-
cellsWidth,
|
|
188
|
-
initialDateOffset,
|
|
189
|
-
pastDaysQuantity,
|
|
190
|
-
renderCoordinates.x,
|
|
191
|
-
renderCoordinates.y,
|
|
192
|
-
origin.x,
|
|
193
|
-
origin.y,
|
|
194
|
-
]);
|
|
195
|
-
(0, react_1.useEffect)(() => {
|
|
196
|
-
setScrollingOnCourse(true);
|
|
197
|
-
clearTimeout(idTimeoutForCalls);
|
|
198
|
-
setIdTimeoutForCalls(undefined);
|
|
199
|
-
// eslint-disable-next-line
|
|
200
|
-
}, [xPosition, yPosition]);
|
|
201
|
-
(0, react_1.useEffect)(() => {
|
|
202
|
-
if (idTimeoutForCalls === undefined) {
|
|
203
|
-
let _id = setTimeout(() => setScrollingOnCourse(false), waitTimeForCalls);
|
|
204
|
-
setIdTimeoutForCalls(_id);
|
|
205
|
-
}
|
|
206
|
-
}, [xPosition, yPosition, idTimeoutForCalls, waitTimeForCalls]);
|
|
207
|
-
(0, react_1.useEffect)(() => {
|
|
208
|
-
if (scrollingOnCourse && callsOnScrollingMoves) {
|
|
209
|
-
callsOnScrollingMoves();
|
|
210
|
-
}
|
|
211
|
-
else if (!scrollingOnCourse && callsOnScrollingStops) {
|
|
212
|
-
callsOnScrollingStops();
|
|
213
|
-
}
|
|
214
|
-
// eslint-disable-next-line
|
|
215
|
-
}, [scrollingOnCourse]);
|
|
216
|
-
//Cancelar idIntervalo Autoscroll de rango cuando se deja de seleccionar
|
|
217
|
-
(0, react_1.useEffect)(() => {
|
|
218
|
-
if (!draggingOverDateCells) {
|
|
219
|
-
if (clientXPositionOnGrid !== undefined)
|
|
220
|
-
setClientXPositionOnGrid(undefined);
|
|
221
|
-
if (clientYPositionOnGrid !== undefined)
|
|
222
|
-
setClientYPositionOnGrid(undefined);
|
|
223
|
-
}
|
|
224
|
-
}, [draggingOverDateCells, clientXPositionOnGrid, clientYPositionOnGrid]);
|
|
225
|
-
//Render
|
|
226
|
-
return (react_1.default.createElement("div", { "data-testid": "multicalendar", className: "multicalendar", style: {
|
|
227
|
-
gridTemplateColumns: `${verticalAxisWidth}px`,
|
|
228
|
-
gridTemplateRows: `70px ${horizontalAxisHeight - 70}px calc(100% - ${horizontalAxisHeight}px`,
|
|
229
|
-
} },
|
|
230
|
-
react_1.default.createElement("div", { className: "controls" },
|
|
231
|
-
react_1.default.createElement("div", { className: "div-dates-navigation" },
|
|
232
|
-
react_1.default.createElement(DropdownMonthNavigation_1.default, { minimumVisibleDate: minimumVisibleDate, onChangeAction: (valorDeOpcion) => {
|
|
233
|
-
Funciones.scrollByDate(new Date(Number(Date.parse((0, sqlToJsDate_1.default)(valorDeOpcion).toString()))), gridWrapperRef, pastDaysQuantity, cellsWidth);
|
|
234
|
-
}, options: Funciones.defineMonthsArray(pastDaysQuantity, futureDaysQuantity, language) }),
|
|
235
|
-
react_1.default.createElement("button", { onClick: () => Funciones.scrollByDate(new Date(), gridWrapperRef, pastDaysQuantity, cellsWidth) }, language["Today"])),
|
|
236
|
-
aditionalControlsComponents && (react_1.default.createElement("div", { className: "div-aditional-controls-components" }, aditionalControlsComponents))),
|
|
237
|
-
react_1.default.createElement("div", { className: "div-upper-left-component" }, upperLeftComponent),
|
|
238
|
-
react_1.default.createElement("div", { className: "vertical-axis" },
|
|
239
|
-
react_1.default.createElement("div", { ref: destiniesColumnRef, className: "div-list-element-column", onScroll: (e) => {
|
|
240
|
-
// Se puede hacer funcion
|
|
241
|
-
if (gridWrapperRef.current !== null)
|
|
242
|
-
gridWrapperRef.current.scrollTop = e.target.scrollTop;
|
|
243
|
-
} },
|
|
244
|
-
react_1.default.createElement(ListElementsColumn_1.default, { listHeight: cellsHeight * listElementsIdsArray.length, yOffset: yOffset, elementsHeight: cellsHeight, idsArray: visibleListElementsIds, ReactListElementChildren: ReactListElementChildren }))),
|
|
245
|
-
react_1.default.createElement("div", { className: "horizontal-axis" },
|
|
246
|
-
react_1.default.createElement("div", { className: "div-weeks-buttons" },
|
|
247
|
-
react_1.default.createElement("button", { className: "past-week-button", onClick: () => {
|
|
248
|
-
// Se puede hacer funcion
|
|
249
|
-
if (datesRowRef.current !== null)
|
|
250
|
-
datesRowRef.current.scroll({
|
|
251
|
-
left: datesRowRef.current.scrollLeft - cellsWidth * 7,
|
|
252
|
-
});
|
|
253
|
-
} },
|
|
254
|
-
react_1.default.createElement(bs_1.BsChevronLeft, null)),
|
|
255
|
-
react_1.default.createElement("button", { onClick: () => {
|
|
256
|
-
// Se puede hacer funcion
|
|
257
|
-
if (datesRowRef.current !== null)
|
|
258
|
-
datesRowRef.current.scroll({
|
|
259
|
-
left: datesRowRef.current.scrollLeft + cellsWidth * 7,
|
|
260
|
-
});
|
|
261
|
-
}, className: "next-week-button" },
|
|
262
|
-
react_1.default.createElement(bs_1.BsChevronRight, null))),
|
|
263
|
-
react_1.default.createElement("div", { ref: datesRowRef, className: "div-dates-row", onScroll: (e) => {
|
|
264
|
-
if (gridWrapperRef.current !== null)
|
|
265
|
-
gridWrapperRef.current.scrollLeft = e.target.scrollLeft;
|
|
266
|
-
} },
|
|
267
|
-
react_1.default.createElement(DatesRow_1.default, { visibleDates: visibleDates, width: (pastDaysQuantity + futureDaysQuantity) * cellsWidth, height: 64, cellsWidth: cellsWidth, cellsHeight: 64, offset: xOffset, language: language }))),
|
|
268
|
-
react_1.default.createElement("div", { className: "div-main-container" },
|
|
269
|
-
react_1.default.createElement("div", { ref: gridWrapperRef, className: "main-container", onScroll: (e) => {
|
|
270
|
-
if (datesRowRef.current !== null) {
|
|
271
|
-
datesRowRef.current.scrollLeft = e.target.scrollLeft;
|
|
272
|
-
setXPosition(e.target.scrollLeft);
|
|
273
|
-
}
|
|
274
|
-
if (destiniesColumnRef.current !== null) {
|
|
275
|
-
destiniesColumnRef.current.scrollTop = e.target.scrollTop;
|
|
276
|
-
setYPosition(e.target.scrollTop);
|
|
277
|
-
}
|
|
278
|
-
if (dynamicDaysQuantity &&
|
|
279
|
-
e.target.scrollLeft +
|
|
280
|
-
e.target.offsetWidth >
|
|
281
|
-
(pastDaysQuantity + futureDaysQuantity) * cellsWidth - cellsWidth) {
|
|
282
|
-
setFutureDaysQuantity(futureDaysQuantity + 1);
|
|
283
|
-
}
|
|
284
|
-
if (pastDatesVisible &&
|
|
285
|
-
dynamicDaysQuantity &&
|
|
286
|
-
e.target.scrollLeft < cellsWidth) {
|
|
287
|
-
setPastDaysQuantity(pastDaysQuantity + 1);
|
|
288
|
-
e.target.scrollLeft = cellsWidth * 3;
|
|
289
|
-
}
|
|
290
|
-
Funciones.authomaticScrollInGrid(draggingOverDateCells, clientXPositionOnGrid, clientYPositionOnGrid, cellsWidth, cellsHeight, e.target);
|
|
291
|
-
}, onMouseMove: (e) => {
|
|
292
|
-
if (gridWrapperRef.current !== null && draggingOverDateCells) {
|
|
293
|
-
let x = e.clientX - gridWrapperRef.current.getBoundingClientRect().left;
|
|
294
|
-
let y = e.clientY - gridWrapperRef.current.getBoundingClientRect().top;
|
|
295
|
-
setClientXPositionOnGrid(x);
|
|
296
|
-
setClientYPositionOnGrid(y);
|
|
297
|
-
Funciones.startAuthomaticScrollInGrid(draggingOverDateCells, x, y, cellsWidth, cellsHeight, gridWrapperRef);
|
|
298
|
-
}
|
|
299
|
-
} },
|
|
300
|
-
react_1.default.createElement(DatesGrid_1.default, { gridWidth: (pastDaysQuantity + futureDaysQuantity) * cellsWidth, gridHeight: cellsHeight * listElementsIdsArray.length, xOffset: xOffset, yOffset: yOffset, cellsWidth: cellsWidth, cellsHeight: cellsHeight, visibleListElementsIdsArray: visibleListElementsIds, visibleDates: visibleDates, ReactCellChildren: ReactCellChildren })))));
|
|
301
|
-
};
|
|
302
|
-
exports.default = Multicalendar;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const Funciones = __importStar(require("./MulticalendarOwnFunctions"));
|
|
31
|
+
require("./Multicalendar.css");
|
|
32
|
+
//Assets
|
|
33
|
+
const bs_1 = require("react-icons/bs");
|
|
34
|
+
//Componentes
|
|
35
|
+
const DatesRow_1 = __importDefault(require("./subcomponents/individuals/DatesRow/DatesRow"));
|
|
36
|
+
const ListElementsColumn_1 = __importDefault(require("./subcomponents/composites/ListElementsColumn/ListElementsColumn"));
|
|
37
|
+
const DatesGrid_1 = __importDefault(require("./subcomponents/composites/DatesGrid/DatesGrid"));
|
|
38
|
+
const DropdownMonthNavigation_1 = __importDefault(require("./subcomponents/individuals/DropdownMonthNavigation/DropdownMonthNavigation"));
|
|
39
|
+
//Hooks
|
|
40
|
+
const useWindowsSize_1 = __importDefault(require("../../hooks/useWindowsSize"));
|
|
41
|
+
//Utils
|
|
42
|
+
const sqlToJsDate_1 = __importDefault(require("../../utils/sqlToJsDate"));
|
|
43
|
+
//Services
|
|
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, }) => {
|
|
46
|
+
//Constantes del componente
|
|
47
|
+
const origin = {
|
|
48
|
+
x: pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) * cellsWidth : 0,
|
|
49
|
+
y: 0,
|
|
50
|
+
};
|
|
51
|
+
const initialDateOffset = 2 + chunkRenderX;
|
|
52
|
+
//Refs
|
|
53
|
+
const datesRowRef = (0, react_1.useRef)(null);
|
|
54
|
+
const destiniesColumnRef = (0, react_1.useRef)(null);
|
|
55
|
+
const gridWrapperRef = (0, react_1.useRef)(null);
|
|
56
|
+
//Estados
|
|
57
|
+
const [firtsCall, setFirtsCall] = (0, react_1.useState)(false);
|
|
58
|
+
const [windowWidth, windowHeight] = (0, useWindowsSize_1.default)();
|
|
59
|
+
const [futureDaysQuantity, setFutureDaysQuantity] = (0, react_1.useState)(Math.ceil(futureDaysInitialQuantity));
|
|
60
|
+
const [pastDaysQuantity, setPastDaysQuantity] = (0, react_1.useState)(pastDatesVisible ? Math.ceil(pastDaysInitialQuantity) : 0);
|
|
61
|
+
const [paginationWidth, setPaginationWidth] = (0, react_1.useState)(0);
|
|
62
|
+
const [paginationHeight, setPaginationHeight] = (0, react_1.useState)(0);
|
|
63
|
+
const [xOffset, setXOffset] = (0, react_1.useState)(1);
|
|
64
|
+
const [yOffset, setYOffset] = (0, react_1.useState)(0);
|
|
65
|
+
const [visibleDates, setVisibleDates] = (0, react_1.useState)([]);
|
|
66
|
+
const [visibleListElementsIds, setVisibleListElementsIds] = (0, react_1.useState)([]);
|
|
67
|
+
const [updateList, setUpdateList] = (0, react_1.useState)(false);
|
|
68
|
+
const [xPosition, setXPosition] = (0, react_1.useState)(origin.x);
|
|
69
|
+
const [yPosition, setYPosition] = (0, react_1.useState)(origin.y);
|
|
70
|
+
const [renderCoordinates, setRenderCoordinates] = (0, react_1.useState)({
|
|
71
|
+
x: origin.x,
|
|
72
|
+
y: origin.y,
|
|
73
|
+
});
|
|
74
|
+
const [minimumVisibleDate, setMinimumVisibleDate] = (0, react_1.useState)(new Date());
|
|
75
|
+
const [idTimeoutForCalls, setIdTimeoutForCalls] = (0, react_1.useState)(undefined);
|
|
76
|
+
const [clientXPositionOnGrid, setClientXPositionOnGrid] = (0, react_1.useState)(undefined);
|
|
77
|
+
const [clientYPositionOnGrid, setClientYPositionOnGrid] = (0, react_1.useState)(undefined);
|
|
78
|
+
const [scrollingOnCourse, setScrollingOnCourse] = (0, react_1.useState)(false);
|
|
79
|
+
//UseEffects
|
|
80
|
+
(0, react_1.useEffect)(() => {
|
|
81
|
+
if (pastDatesVisible) {
|
|
82
|
+
setPastDaysQuantity(Math.ceil(pastDaysInitialQuantity));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setPastDaysQuantity(0);
|
|
86
|
+
}
|
|
87
|
+
}, [pastDatesVisible, pastDaysInitialQuantity]);
|
|
88
|
+
(0, react_1.useEffect)(() => {
|
|
89
|
+
//Delegamos un cambio de estado a los primero renderes para evitar duplicado de llamadas a la API
|
|
90
|
+
if (!firtsCall) {
|
|
91
|
+
setFirtsCall(true);
|
|
92
|
+
//Cached Y position
|
|
93
|
+
let newYPosition = (0, MulticalendarStatesAndSettings_1.getMulticalendarYScrollPosition)(multicalendarId);
|
|
94
|
+
if (newYPosition !== null && newYPosition !== "0") {
|
|
95
|
+
if (gridWrapperRef.current) {
|
|
96
|
+
gridWrapperRef.current.scrollTop = Number(newYPosition);
|
|
97
|
+
(0, MulticalendarStatesAndSettings_1.eraseMulticalendarYScrollPosition)(multicalendarId);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, [firtsCall]);
|
|
102
|
+
(0, react_1.useEffect)(() => {
|
|
103
|
+
// Posicionamiento inicial en X
|
|
104
|
+
if (gridWrapperRef.current !== null) {
|
|
105
|
+
gridWrapperRef.current.scrollLeft = origin.x;
|
|
106
|
+
}
|
|
107
|
+
}, [origin.x]);
|
|
108
|
+
(0, react_1.useEffect)(() => {
|
|
109
|
+
setUpdateList(true);
|
|
110
|
+
// Dimensiones de paginacion, requiere agregar 1 para no ver espacios en blanco
|
|
111
|
+
setPaginationWidth(Math.ceil((windowWidth - verticalAxisWidth) / cellsWidth) + 1);
|
|
112
|
+
setPaginationHeight(Math.ceil((windowHeight - horizontalAxisHeight) / cellsHeight) + 1);
|
|
113
|
+
// Redefinicion de posicion X ante cambios en el tamaño de la ventana
|
|
114
|
+
if (gridWrapperRef.current !== null) {
|
|
115
|
+
setXPosition(gridWrapperRef.current.scrollLeft);
|
|
116
|
+
setRenderCoordinates({
|
|
117
|
+
x: gridWrapperRef.current.scrollLeft,
|
|
118
|
+
y: gridWrapperRef.current.scrollTop,
|
|
119
|
+
});
|
|
120
|
+
setXOffset(Math.floor(gridWrapperRef.current.scrollLeft / cellsWidth) - chunkRenderX);
|
|
121
|
+
}
|
|
122
|
+
}, [
|
|
123
|
+
windowWidth,
|
|
124
|
+
windowHeight,
|
|
125
|
+
verticalAxisWidth,
|
|
126
|
+
horizontalAxisHeight,
|
|
127
|
+
cellsHeight,
|
|
128
|
+
cellsWidth,
|
|
129
|
+
chunkRenderX,
|
|
130
|
+
]);
|
|
131
|
+
(0, react_1.useEffect)(() => {
|
|
132
|
+
// Definicion de visibilidad y renderizacion del Eje Y
|
|
133
|
+
if ((renderCoordinates.x === origin.x && renderCoordinates.y === origin.y) ||
|
|
134
|
+
Math.abs(renderCoordinates.y - yPosition) / cellsHeight > chunkRenderY ||
|
|
135
|
+
updateList) {
|
|
136
|
+
if (!(renderCoordinates.x === origin.x && renderCoordinates.y === origin.y)) {
|
|
137
|
+
if (gridWrapperRef.current !== null)
|
|
138
|
+
setRenderCoordinates({
|
|
139
|
+
x: gridWrapperRef.current.scrollLeft,
|
|
140
|
+
y: gridWrapperRef.current.scrollTop,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
let desfase = Funciones.defineYOffset(yPosition, cellsHeight, chunkRenderY);
|
|
144
|
+
setYOffset(desfase);
|
|
145
|
+
setVisibleListElementsIds(Funciones.defineListElementsArrayVisibleList(paginationHeight, chunkRenderY, desfase, listElementsIdsArray));
|
|
146
|
+
if (updateList)
|
|
147
|
+
setUpdateList(false);
|
|
148
|
+
}
|
|
149
|
+
}, [
|
|
150
|
+
updateList,
|
|
151
|
+
yPosition,
|
|
152
|
+
cellsHeight,
|
|
153
|
+
chunkRenderY,
|
|
154
|
+
origin.x,
|
|
155
|
+
origin.y,
|
|
156
|
+
paginationHeight,
|
|
157
|
+
renderCoordinates.x,
|
|
158
|
+
renderCoordinates.y,
|
|
159
|
+
listElementsIdsArray,
|
|
160
|
+
]);
|
|
161
|
+
(0, react_1.useEffect)(() => {
|
|
162
|
+
// Definicion de visibilidad y renderizacion del Eje X
|
|
163
|
+
if ((renderCoordinates.x === origin.x && renderCoordinates.y === origin.y) ||
|
|
164
|
+
xPosition < cellsWidth ||
|
|
165
|
+
Math.abs(renderCoordinates.x - xPosition) / cellsWidth > chunkRenderX ||
|
|
166
|
+
updateList) {
|
|
167
|
+
setVisibleDates([]);
|
|
168
|
+
if (!(renderCoordinates.x === origin.x && renderCoordinates.y === origin.y)) {
|
|
169
|
+
if (gridWrapperRef.current !== null)
|
|
170
|
+
setRenderCoordinates({
|
|
171
|
+
x: gridWrapperRef.current.scrollLeft,
|
|
172
|
+
y: gridWrapperRef.current.scrollTop,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
setXOffset(Funciones.defineXOffset(xPosition, cellsWidth, chunkRenderX));
|
|
176
|
+
const fechaMinimaMilisegundos = Funciones.minimalDateMilliseconds(xPosition, cellsWidth, pastDaysQuantity, initialDateOffset);
|
|
177
|
+
setMinimumVisibleDate(Funciones.defineMinimalVisibleDate(fechaMinimaMilisegundos, initialDateOffset));
|
|
178
|
+
if (updateList)
|
|
179
|
+
setUpdateList(false);
|
|
180
|
+
setVisibleDates(Funciones.defineVisibleDatesArray(paginationWidth, chunkRenderX, fechaMinimaMilisegundos));
|
|
181
|
+
}
|
|
182
|
+
}, [
|
|
183
|
+
updateList,
|
|
184
|
+
paginationWidth,
|
|
185
|
+
xPosition,
|
|
186
|
+
chunkRenderX,
|
|
187
|
+
cellsWidth,
|
|
188
|
+
initialDateOffset,
|
|
189
|
+
pastDaysQuantity,
|
|
190
|
+
renderCoordinates.x,
|
|
191
|
+
renderCoordinates.y,
|
|
192
|
+
origin.x,
|
|
193
|
+
origin.y,
|
|
194
|
+
]);
|
|
195
|
+
(0, react_1.useEffect)(() => {
|
|
196
|
+
setScrollingOnCourse(true);
|
|
197
|
+
clearTimeout(idTimeoutForCalls);
|
|
198
|
+
setIdTimeoutForCalls(undefined);
|
|
199
|
+
// eslint-disable-next-line
|
|
200
|
+
}, [xPosition, yPosition]);
|
|
201
|
+
(0, react_1.useEffect)(() => {
|
|
202
|
+
if (idTimeoutForCalls === undefined) {
|
|
203
|
+
let _id = setTimeout(() => setScrollingOnCourse(false), waitTimeForCalls);
|
|
204
|
+
setIdTimeoutForCalls(_id);
|
|
205
|
+
}
|
|
206
|
+
}, [xPosition, yPosition, idTimeoutForCalls, waitTimeForCalls]);
|
|
207
|
+
(0, react_1.useEffect)(() => {
|
|
208
|
+
if (scrollingOnCourse && callsOnScrollingMoves) {
|
|
209
|
+
callsOnScrollingMoves();
|
|
210
|
+
}
|
|
211
|
+
else if (!scrollingOnCourse && callsOnScrollingStops) {
|
|
212
|
+
callsOnScrollingStops();
|
|
213
|
+
}
|
|
214
|
+
// eslint-disable-next-line
|
|
215
|
+
}, [scrollingOnCourse]);
|
|
216
|
+
//Cancelar idIntervalo Autoscroll de rango cuando se deja de seleccionar
|
|
217
|
+
(0, react_1.useEffect)(() => {
|
|
218
|
+
if (!draggingOverDateCells) {
|
|
219
|
+
if (clientXPositionOnGrid !== undefined)
|
|
220
|
+
setClientXPositionOnGrid(undefined);
|
|
221
|
+
if (clientYPositionOnGrid !== undefined)
|
|
222
|
+
setClientYPositionOnGrid(undefined);
|
|
223
|
+
}
|
|
224
|
+
}, [draggingOverDateCells, clientXPositionOnGrid, clientYPositionOnGrid]);
|
|
225
|
+
//Render
|
|
226
|
+
return (react_1.default.createElement("div", { "data-testid": "multicalendar", className: "multicalendar", style: {
|
|
227
|
+
gridTemplateColumns: `${verticalAxisWidth}px`,
|
|
228
|
+
gridTemplateRows: `70px ${horizontalAxisHeight - 70}px calc(100% - ${horizontalAxisHeight}px`,
|
|
229
|
+
} },
|
|
230
|
+
react_1.default.createElement("div", { className: "controls" },
|
|
231
|
+
react_1.default.createElement("div", { className: "div-dates-navigation" },
|
|
232
|
+
react_1.default.createElement(DropdownMonthNavigation_1.default, { minimumVisibleDate: minimumVisibleDate, onChangeAction: (valorDeOpcion) => {
|
|
233
|
+
Funciones.scrollByDate(new Date(Number(Date.parse((0, sqlToJsDate_1.default)(valorDeOpcion).toString()))), gridWrapperRef, pastDaysQuantity, cellsWidth);
|
|
234
|
+
}, options: Funciones.defineMonthsArray(pastDaysQuantity, futureDaysQuantity, language) }),
|
|
235
|
+
react_1.default.createElement("button", { onClick: () => Funciones.scrollByDate(new Date(), gridWrapperRef, pastDaysQuantity, cellsWidth) }, language["Today"])),
|
|
236
|
+
aditionalControlsComponents && (react_1.default.createElement("div", { className: "div-aditional-controls-components" }, aditionalControlsComponents))),
|
|
237
|
+
react_1.default.createElement("div", { className: "div-upper-left-component" }, upperLeftComponent),
|
|
238
|
+
react_1.default.createElement("div", { className: "vertical-axis" },
|
|
239
|
+
react_1.default.createElement("div", { ref: destiniesColumnRef, className: "div-list-element-column", onScroll: (e) => {
|
|
240
|
+
// Se puede hacer funcion
|
|
241
|
+
if (gridWrapperRef.current !== null)
|
|
242
|
+
gridWrapperRef.current.scrollTop = e.target.scrollTop;
|
|
243
|
+
} },
|
|
244
|
+
react_1.default.createElement(ListElementsColumn_1.default, { listHeight: cellsHeight * listElementsIdsArray.length, yOffset: yOffset, elementsHeight: cellsHeight, idsArray: visibleListElementsIds, ReactListElementChildren: ReactListElementChildren }))),
|
|
245
|
+
react_1.default.createElement("div", { className: "horizontal-axis" },
|
|
246
|
+
react_1.default.createElement("div", { className: "div-weeks-buttons" },
|
|
247
|
+
react_1.default.createElement("button", { className: "past-week-button", onClick: () => {
|
|
248
|
+
// Se puede hacer funcion
|
|
249
|
+
if (datesRowRef.current !== null)
|
|
250
|
+
datesRowRef.current.scroll({
|
|
251
|
+
left: datesRowRef.current.scrollLeft - cellsWidth * 7,
|
|
252
|
+
});
|
|
253
|
+
} },
|
|
254
|
+
react_1.default.createElement(bs_1.BsChevronLeft, null)),
|
|
255
|
+
react_1.default.createElement("button", { onClick: () => {
|
|
256
|
+
// Se puede hacer funcion
|
|
257
|
+
if (datesRowRef.current !== null)
|
|
258
|
+
datesRowRef.current.scroll({
|
|
259
|
+
left: datesRowRef.current.scrollLeft + cellsWidth * 7,
|
|
260
|
+
});
|
|
261
|
+
}, className: "next-week-button" },
|
|
262
|
+
react_1.default.createElement(bs_1.BsChevronRight, null))),
|
|
263
|
+
react_1.default.createElement("div", { ref: datesRowRef, className: "div-dates-row", onScroll: (e) => {
|
|
264
|
+
if (gridWrapperRef.current !== null)
|
|
265
|
+
gridWrapperRef.current.scrollLeft = e.target.scrollLeft;
|
|
266
|
+
} },
|
|
267
|
+
react_1.default.createElement(DatesRow_1.default, { visibleDates: visibleDates, width: (pastDaysQuantity + futureDaysQuantity) * cellsWidth, height: 64, cellsWidth: cellsWidth, cellsHeight: 64, offset: xOffset, language: language }))),
|
|
268
|
+
react_1.default.createElement("div", { className: "div-main-container" },
|
|
269
|
+
react_1.default.createElement("div", { ref: gridWrapperRef, className: "main-container", onScroll: (e) => {
|
|
270
|
+
if (datesRowRef.current !== null) {
|
|
271
|
+
datesRowRef.current.scrollLeft = e.target.scrollLeft;
|
|
272
|
+
setXPosition(e.target.scrollLeft);
|
|
273
|
+
}
|
|
274
|
+
if (destiniesColumnRef.current !== null) {
|
|
275
|
+
destiniesColumnRef.current.scrollTop = e.target.scrollTop;
|
|
276
|
+
setYPosition(e.target.scrollTop);
|
|
277
|
+
}
|
|
278
|
+
if (dynamicDaysQuantity &&
|
|
279
|
+
e.target.scrollLeft +
|
|
280
|
+
e.target.offsetWidth >
|
|
281
|
+
(pastDaysQuantity + futureDaysQuantity) * cellsWidth - cellsWidth) {
|
|
282
|
+
setFutureDaysQuantity(futureDaysQuantity + 1);
|
|
283
|
+
}
|
|
284
|
+
if (pastDatesVisible &&
|
|
285
|
+
dynamicDaysQuantity &&
|
|
286
|
+
e.target.scrollLeft < cellsWidth) {
|
|
287
|
+
setPastDaysQuantity(pastDaysQuantity + 1);
|
|
288
|
+
e.target.scrollLeft = cellsWidth * 3;
|
|
289
|
+
}
|
|
290
|
+
Funciones.authomaticScrollInGrid(draggingOverDateCells, clientXPositionOnGrid, clientYPositionOnGrid, cellsWidth, cellsHeight, e.target);
|
|
291
|
+
}, onMouseMove: (e) => {
|
|
292
|
+
if (gridWrapperRef.current !== null && draggingOverDateCells) {
|
|
293
|
+
let x = e.clientX - gridWrapperRef.current.getBoundingClientRect().left;
|
|
294
|
+
let y = e.clientY - gridWrapperRef.current.getBoundingClientRect().top;
|
|
295
|
+
setClientXPositionOnGrid(x);
|
|
296
|
+
setClientYPositionOnGrid(y);
|
|
297
|
+
Funciones.startAuthomaticScrollInGrid(draggingOverDateCells, x, y, cellsWidth, cellsHeight, gridWrapperRef);
|
|
298
|
+
}
|
|
299
|
+
} },
|
|
300
|
+
react_1.default.createElement(DatesGrid_1.default, { gridWidth: (pastDaysQuantity + futureDaysQuantity) * cellsWidth, gridHeight: cellsHeight * listElementsIdsArray.length, xOffset: xOffset, yOffset: yOffset, cellsWidth: cellsWidth, cellsHeight: cellsHeight, visibleListElementsIdsArray: visibleListElementsIds, visibleDates: visibleDates, ReactCellChildren: ReactCellChildren })))));
|
|
301
|
+
};
|
|
302
|
+
exports.default = Multicalendar;
|