react-weekly-planning 1.0.28 → 1.0.30

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.
Files changed (55) hide show
  1. package/README.md +3 -1
  2. package/__tests__/page.test.js +106 -46
  3. package/__tests__/page.test.tsx +117 -45
  4. package/babel.config.js +1 -0
  5. package/components/AddTask/index.js +17 -0
  6. package/components/AddTask/index.tsx +43 -0
  7. package/components/CalendarForWeek.js +50 -0
  8. package/components/CalendarForWeek.tsx +229 -0
  9. package/components/CalendarForday.js +34 -0
  10. package/components/CalendarForday.tsx +130 -0
  11. package/components/DayContainer/index.js +15 -0
  12. package/components/DayContainer/index.tsx +36 -0
  13. package/components/GroupContainer/index.js +15 -0
  14. package/components/GroupContainer/index.tsx +42 -0
  15. package/components/GroupsHeadContainer/index.js +9 -0
  16. package/components/GroupsHeadContainer/index.tsx +19 -0
  17. package/components/SumHoursContainer/index.js +15 -0
  18. package/components/SumHoursContainer/index.tsx +38 -0
  19. package/components/SumHoursHead/index.js +9 -0
  20. package/components/SumHoursHead/index.tsx +22 -0
  21. package/components/TaskContainer/index.js +35 -0
  22. package/components/TaskContainer/index.tsx +86 -0
  23. package/components/TaskList/index.js +5 -0
  24. package/components/TaskList/index.tsx +20 -0
  25. package/contexts/CalendarContext.js +12 -12
  26. package/contexts/CalendarContext.tsx +4 -0
  27. package/definitions/index.js +1 -1
  28. package/definitions/index.ts +668 -7
  29. package/docs/global.html +4982 -4982
  30. package/docs/index.html +474 -474
  31. package/docs/index.ts.html +121 -121
  32. package/docs/scripts/linenumber.js +26 -26
  33. package/docs/scripts/search.js +38 -38
  34. package/docs/styles/iframe.css +12 -12
  35. package/docs/styles/prettify-jsdoc.css +111 -111
  36. package/docs/styles/prettify-tomorrow.css +132 -132
  37. package/docs/styles/reset.css +44 -44
  38. package/hooks/useCalendarDateState.js +19 -0
  39. package/hooks/useCalendarDateState.ts +44 -0
  40. package/index.js +70 -248
  41. package/index.tsx +59 -605
  42. package/jest.config.js +9 -9
  43. package/lib/slyles.js +21 -0
  44. package/lib/slyles.ts +25 -0
  45. package/lib/utils.js +619 -490
  46. package/lib/utils.ts +687 -383
  47. package/out/index.html +128 -128
  48. package/out/scripts/linenumber.js +26 -26
  49. package/out/scripts/search.js +38 -38
  50. package/out/styles/iframe.css +12 -12
  51. package/out/styles/prettify-jsdoc.css +111 -111
  52. package/out/styles/prettify-tomorrow.css +132 -132
  53. package/out/styles/reset.css +44 -44
  54. package/package.json +81 -71
  55. package/style.css +26 -4
package/README.md CHANGED
@@ -85,7 +85,7 @@ It is possible to use either Weekoffset or Date, or even both simultaneously.
85
85
 
86
86
  **Example**:
87
87
  ```jsx
88
- import {getSavedTasks} from "react-weekly-planning";
88
+ import {getSavedTasks} from "react-weekly-planning/lib/utils";
89
89
  const [tasks,setTasks]=useState([])
90
90
 
91
91
  useEffect(()=>{
@@ -173,6 +173,7 @@ Props for the Calendar component.
173
173
 
174
174
  **Example**:
175
175
  ```javascript
176
+ import {updateOffsetWithDateCalendar} from "react-weekly-planning/lib/utils";
176
177
  const offset = updateOffsetWithDateCalendar(new Date());
177
178
  console.log(offset); // Logs the week offset for the given date
178
179
  ```
@@ -186,6 +187,7 @@ Props for the Calendar component.
186
187
 
187
188
  **Example**:
188
189
  ```javascript
190
+ import {millisecondsToHours} from "react-weekly-planning/lib/utils";
189
191
  const formattedTime = millisecondsToHours(1716905215397);
190
192
  console.log(formattedTime); // Logs the formatted time for 14h06
191
193
  ```
@@ -1,46 +1,106 @@
1
- import moment from "moment";
2
- function getWeekNumber(date) {
3
- date.setHours(0, 0, 0, 0);
4
- date.setDate(date.getDate() + 4 - (date.getDay() || 7));
5
- const yearStart = new Date(date.getFullYear(), 0, 1).getTime();
6
- const weekNumber = Math.ceil(((date.getTime() - yearStart) / 86400000 + 1) / 7);
7
- return weekNumber;
8
- }
9
- function calculerEcartSemaine(dateSelectionnee) {
10
- // Récupérer la date actuelle
11
- const dateActuelle = new Date();
12
- // Extraire l'année et le numéro de la semaine de la date actuelle
13
- const anneeActuelle = dateActuelle.getFullYear();
14
- const numeroSemaineActuelle = getWeekNumber(dateActuelle);
15
- // Extraire l'année et le numéro de la semaine de la date sélectionnée
16
- const anneeSelectionnee = dateSelectionnee.getFullYear();
17
- const numeroSemaineSelectionnee = getWeekNumber(dateSelectionnee);
18
- // Calculer le nombre de semaines depuis une date d'origine arbitraire
19
- // Calculer l'écart entre les semaines en utilisant la formule
20
- const ecartSemaine = semainesDepuisOrigine(anneeSelectionnee, numeroSemaineSelectionnee) -
21
- semainesDepuisOrigine(anneeActuelle, numeroSemaineActuelle);
22
- return ecartSemaine * 7;
23
- }
24
- function semainesDepuisOrigine(annee, numeroSemaine) {
25
- // Choisir le 1er janvier 2022 comme date d'origine
26
- const dateOrigine = new Date(2022, 0, 1);
27
- const anneeOrigine = dateOrigine.getFullYear();
28
- const numeroSemaineOrigine = getWeekNumber(dateOrigine);
29
- // Calculer le nombre total de semaines écoulées depuis la date d'origine
30
- let nombreSemaines = 0;
31
- for (let i = anneeOrigine; i < annee; i++) {
32
- nombreSemaines += moment().year(i).weeksInYear();
33
- }
34
- nombreSemaines += numeroSemaine - numeroSemaineOrigine;
35
- return nombreSemaines;
36
- }
37
- const makeCalcul = (date) => calculerEcartSemaine(date);
38
- describe("Ecartweek", () => {
39
- test("current week to next week to be 7", () => {
40
- const currentDay = Date.now();
41
- const nextWeekDay = currentDay - 14 * 86400000;
42
- // console.log(calculerEcartSemaine(new Date(nextWeekDay)));
43
- const nextWeek = new Date(nextWeekDay);
44
- expect(makeCalcul(nextWeek)).toBe(-14);
45
- });
46
- });
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import "@testing-library/jest-dom";
11
+ import ical from "ical";
12
+ export function parseICSToTasks(icsData, group) {
13
+ var _a;
14
+ const events = ical.parseICS(icsData);
15
+ const tasks = [];
16
+ for (const key in events) {
17
+ const event = events[key];
18
+ if (event.type === "VEVENT") {
19
+ const taskStart = event.start
20
+ ? new Date(event.start).getTime()
21
+ : new Date().getTime();
22
+ const taskEnd = event.end
23
+ ? new Date(event.end).getTime()
24
+ : new Date().getTime();
25
+ const taskDate = event.start ? new Date(event.start) : new Date();
26
+ const taskSummary = event.summary || "";
27
+ const taskLocation = event.location || "";
28
+ const taskTimezone = "";
29
+ const taskCreatedAt = event.created
30
+ ? new Date(event.created)
31
+ : new Date();
32
+ const taskExpiryDate = ((_a = event.rrule) === null || _a === void 0 ? void 0 : _a.options.until)
33
+ ? new Date(event.rrule.options.until)
34
+ : new Date();
35
+ const task = {
36
+ taskStart,
37
+ taskEnd,
38
+ taskDate,
39
+ taskSummary,
40
+ taskLocation,
41
+ taskTimzone: taskTimezone,
42
+ groupId: group,
43
+ dayIndex: taskDate.getDay() || 0,
44
+ taskId: event.uid || "",
45
+ taskCreatedAt,
46
+ taskExpiryDate,
47
+ };
48
+ tasks.push(task);
49
+ if (!event.start)
50
+ return [];
51
+ // Gestion des occurrences récurrentes
52
+ if (event.rrule) {
53
+ const occurrences = event.rrule.between(event.start, taskExpiryDate || new Date());
54
+ occurrences.forEach((occurrence) => {
55
+ tasks.push(Object.assign(Object.assign({}, task), { taskStart: occurrence.getTime(), taskEnd: occurrence.getTime() + (taskEnd - taskStart), taskDate: new Date(occurrence.getTime()), dayIndex: new Date(occurrence.getTime()).getDay() }));
56
+ });
57
+ }
58
+ }
59
+ }
60
+ return tasks;
61
+ }
62
+ import axios from "axios";
63
+ // Get ICS text however you like, example below
64
+ // Make sure you have the right CORS settings if needed
65
+ const convert = (fileLocation) => __awaiter(void 0, void 0, void 0, function* () {
66
+ try {
67
+ const task = fileLocation.map((link) => __awaiter(void 0, void 0, void 0, function* () {
68
+ const icsRes = yield axios.get(link);
69
+ const icstext = yield icsRes.data;
70
+ const data = parseICSToTasks(icstext, "morel");
71
+ return data;
72
+ }));
73
+ console.log(task);
74
+ return "success";
75
+ }
76
+ catch (error) {
77
+ return "error";
78
+ }
79
+ });
80
+ export function convertTasksToIcsFormat(tasks) {
81
+ const ics = tasks.reduce((previousIcs, task) => {
82
+ previousIcs += `
83
+
84
+ BEGIN:VCALENDAR
85
+ VERSION:1.0
86
+ BEGIN:VEVENT
87
+ DTSTART:${task.taskStart}
88
+ DTEND:${task.taskEnd}
89
+ LOCATION:
90
+ DESCRIPTION:Purpose: Provide example of this file type Document file type: ICS Version: 1.0 Created by http://www.online-convert.com More example files: http://www.online-convert.com/file-type License: http://creativecommons.org/licenses Feel free to use & share the file according to the license above.
91
+ SUMMARY:ICS test file
92
+ PRIORITY:3
93
+ END:VEVENT
94
+ END:VCALENDAR
95
+
96
+ `;
97
+ return previousIcs;
98
+ }, "");
99
+ return ics;
100
+ }
101
+ test("the fetch fails with an error", () => {
102
+ return convert([
103
+ "https://firebasestorage.googleapis.com/v0/b/ashtonv2.appspot.com/o/example.ics?alt=media&token=679cab97-cde2-4074-b96f-b63c10f1b7e2",
104
+ "https://firebasestorage.googleapis.com/v0/b/ashtonv2.appspot.com/o/example.ics?alt=media&token=679cab97-cde2-4074-b96f-b63c10f1b7e2",
105
+ ]).catch((error) => expect(error).toMatch("error"));
106
+ });
@@ -1,57 +1,129 @@
1
- import moment from "moment";
2
-
3
- function getWeekNumber(date: Date) {
4
- date.setHours(0, 0, 0, 0);
5
- date.setDate(date.getDate() + 4 - (date.getDay() || 7));
6
- const yearStart= new Date(date.getFullYear(), 0, 1).getTime();
7
- const weekNumber = Math.ceil(((date.getTime() - yearStart) / 86400000 + 1) / 7);
8
- return weekNumber;
9
- }
1
+ import { render } from "@testing-library/react";
2
+ import Calendar from "..";
3
+ import "@testing-library/jest-dom";
4
+ import { TaskFeildsType } from "../definitions";
5
+ import { icsToJson } from "ics-to-json";
6
+
7
+ import ical from "ical";
8
+
9
+ export function parseICSToTasks(
10
+ icsData: string,
11
+ group: string
12
+ ): TaskFeildsType[] {
13
+ const events = ical.parseICS(icsData);
14
+ const tasks: TaskFeildsType[] = [];
15
+
16
+ for (const key in events) {
17
+ const event = events[key];
10
18
 
11
- function calculerEcartSemaine(dateSelectionnee: Date) {
12
- // Récupérer la date actuelle
13
- const dateActuelle = new Date();
19
+ if (event.type === "VEVENT") {
20
+ const taskStart = event.start
21
+ ? new Date(event.start).getTime()
22
+ : new Date().getTime();
23
+ const taskEnd = event.end
24
+ ? new Date(event.end).getTime()
25
+ : new Date().getTime();
26
+ const taskDate = event.start ? new Date(event.start) : new Date();
27
+ const taskSummary = event.summary || "";
28
+ const taskLocation = event.location || "";
29
+ const taskTimezone = "";
30
+ const taskCreatedAt = event.created
31
+ ? new Date(event.created)
32
+ : new Date();
33
+ const taskExpiryDate = event.rrule?.options.until
34
+ ? new Date(event.rrule.options.until)
35
+ : new Date();
14
36
 
15
- // Extraire l'année et le numéro de la semaine de la date actuelle
16
- const anneeActuelle = dateActuelle.getFullYear();
17
- const numeroSemaineActuelle = getWeekNumber(dateActuelle);
37
+ const task: TaskFeildsType[][number] = {
38
+ taskStart,
39
+ taskEnd,
40
+ taskDate,
41
+ taskSummary,
42
+ taskLocation,
43
+ taskTimzone: taskTimezone,
44
+ groupId: group,
45
+ dayIndex: taskDate.getDay() || 0,
46
+ taskId: event.uid || "",
47
+ taskCreatedAt,
48
+ taskExpiryDate,
49
+ };
18
50
 
19
- // Extraire l'année et le numéro de la semaine de la date sélectionnée
51
+ tasks.push(task);
20
52
 
21
- const anneeSelectionnee = dateSelectionnee.getFullYear();
22
- const numeroSemaineSelectionnee = getWeekNumber(dateSelectionnee);
53
+ if (!event.start) return [];
23
54
 
24
- // Calculer le nombre de semaines depuis une date d'origine arbitraire
55
+ // Gestion des occurrences récurrentes
56
+ if (event.rrule) {
57
+ const occurrences = event.rrule.between(
58
+ event.start,
59
+ taskExpiryDate || new Date()
60
+ );
25
61
 
26
- // Calculer l'écart entre les semaines en utilisant la formule
27
- const ecartSemaine =
28
- semainesDepuisOrigine(anneeSelectionnee, numeroSemaineSelectionnee) -
29
- semainesDepuisOrigine(anneeActuelle, numeroSemaineActuelle);
62
+ occurrences.forEach((occurrence) => {
63
+ tasks.push({
64
+ ...task,
65
+ taskStart: occurrence.getTime(),
66
+ taskEnd: occurrence.getTime() + (taskEnd - taskStart),
67
+ taskDate: new Date(occurrence.getTime()),
68
+ dayIndex: new Date(occurrence.getTime()).getDay(),
69
+ });
70
+ });
71
+ }
72
+ }
73
+ }
30
74
 
31
- return ecartSemaine * 7;
75
+ return tasks;
32
76
  }
33
- function semainesDepuisOrigine(annee: number, numeroSemaine: number) {
34
- // Choisir le 1er janvier 2022 comme date d'origine
35
- const dateOrigine = new Date(2022, 0, 1);
36
- const anneeOrigine = dateOrigine.getFullYear();
37
- const numeroSemaineOrigine = getWeekNumber(dateOrigine);
38
-
39
- // Calculer le nombre total de semaines écoulées depuis la date d'origine
40
- let nombreSemaines = 0;
41
- for (let i = anneeOrigine; i < annee; i++) {
42
- nombreSemaines += moment().year(i).weeksInYear();
77
+
78
+ import axios from "axios";
79
+ // Get ICS text however you like, example below
80
+ // Make sure you have the right CORS settings if needed
81
+ const convert = async (fileLocation: string[]) => {
82
+
83
+ try {
84
+ const task = fileLocation.map(async (link) => {
85
+ const icsRes = await axios.get(link);
86
+ const icstext:string = await icsRes.data;
87
+ const data = parseICSToTasks(icstext, "morel");
88
+ return data;
89
+ });
90
+
91
+ console.log(task);
92
+ return "success";
93
+ } catch (error) {
94
+ return "error";
43
95
  }
44
- nombreSemaines += numeroSemaine - numeroSemaineOrigine;
96
+ };
45
97
 
46
- return nombreSemaines;
98
+
99
+ export function convertTasksToIcsFormat(tasks: TaskFeildsType[]) {
100
+ const ics = tasks.reduce((previousIcs: string, task: TaskFeildsType) => {
101
+ previousIcs += `
102
+
103
+ BEGIN:VCALENDAR
104
+ VERSION:1.0
105
+ BEGIN:VEVENT
106
+ DTSTART:${task.taskStart}
107
+ DTEND:${task.taskEnd}
108
+ LOCATION:
109
+ DESCRIPTION:Purpose: Provide example of this file type Document file type: ICS Version: 1.0 Created by http://www.online-convert.com More example files: http://www.online-convert.com/file-type License: http://creativecommons.org/licenses Feel free to use & share the file according to the license above.
110
+ SUMMARY:ICS test file
111
+ PRIORITY:3
112
+ END:VEVENT
113
+ END:VCALENDAR
114
+
115
+ `;
116
+
117
+ return previousIcs;
118
+ }, "");
119
+
120
+ return ics;
47
121
  }
48
- const makeCalcul=(date:Date)=>calculerEcartSemaine(date)
49
- describe("Ecartweek", () => {
50
- test("current week to next week to be 7", () => {
51
- const currentDay = Date.now();
52
- const nextWeekDay = currentDay - 14 * 86400000;
53
- // console.log(calculerEcartSemaine(new Date(nextWeekDay)));
54
- const nextWeek = new Date(nextWeekDay);
55
- expect(makeCalcul(nextWeek)).toBe(-14);
56
- });
122
+
123
+
124
+ test("the fetch fails with an error", () => {
125
+ return convert([
126
+ "https://firebasestorage.googleapis.com/v0/b/ashtonv2.appspot.com/o/example.ics?alt=media&token=679cab97-cde2-4074-b96f-b63c10f1b7e2",
127
+ "https://firebasestorage.googleapis.com/v0/b/ashtonv2.appspot.com/o/example.ics?alt=media&token=679cab97-cde2-4074-b96f-b63c10f1b7e2",
128
+ ]).catch((error) => expect(error).toMatch("error"));
57
129
  });
@@ -0,0 +1 @@
1
+ module.exports = {presets: ['@babel/preset-env']}
@@ -0,0 +1,17 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from "react";
3
+ const AddTask = ({ currentGroup, handleAddTask, addTaskRender, dayInfo, addTaskStyle, addTaskClassName, }) => {
4
+ if (addTaskRender) {
5
+ return (_jsx(_Fragment, { children: addTaskRender({
6
+ currentGroup,
7
+ dayInfo,
8
+ }) }));
9
+ }
10
+ const handleClick = () => {
11
+ if (!handleAddTask)
12
+ return;
13
+ handleAddTask(currentGroup, dayInfo);
14
+ };
15
+ return (_jsx("div", { onClick: handleClick, style: addTaskStyle, className: `addPlanStyle ${addTaskClassName}`, children: "+" }));
16
+ };
17
+ export default memo(AddTask);
@@ -0,0 +1,43 @@
1
+ import { memo } from "react";
2
+ import { AddTaskPropsType } from "../../definitions";
3
+
4
+ const AddTask = ({
5
+
6
+ currentGroup,
7
+ handleAddTask,
8
+ addTaskRender,
9
+ dayInfo,
10
+ addTaskStyle,
11
+ addTaskClassName,
12
+
13
+ }: AddTaskPropsType) => {
14
+ if (addTaskRender) {
15
+ return (
16
+ <>
17
+ {addTaskRender({
18
+ currentGroup,
19
+ dayInfo,
20
+ })}
21
+ </>
22
+ );
23
+ }
24
+
25
+ const handleClick = () => {
26
+
27
+ if (!handleAddTask) return;
28
+ handleAddTask(currentGroup, dayInfo);
29
+
30
+ };
31
+
32
+ return (
33
+ <div
34
+ onClick={handleClick}
35
+ style={addTaskStyle}
36
+ className={`addPlanStyle ${addTaskClassName}`}
37
+ >
38
+ +
39
+ </div>
40
+ );
41
+ };
42
+
43
+ export default memo(AddTask);
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import GroupContainer from "./GroupContainer";
4
+ import GroupsHeadContainer from "./GroupsHeadContainer";
5
+ import { groupTdStyle, theadTrStyle } from "../lib/slyles";
6
+ import DayContainer from "./DayContainer";
7
+ import SumHoursHead from "./SumHoursHead";
8
+ import { compareWeekOffset, getSessionStorageRecordForDragAndDrop, saveTasksToLocalStorage, sumHoursByGroups, } from "../lib/utils";
9
+ import TaskContainer from "./TaskContainer";
10
+ import AddTask from "./AddTask";
11
+ import SumHoursContainer from "./SumHoursContainer";
12
+ import { memo, useEffect } from "react";
13
+ import useCalendarDateState from "../hooks/useCalendarDateState";
14
+ function CalendarForWeek(props) {
15
+ var _a;
16
+ const { dailyHours, weekDays } = useCalendarDateState(props.date, props.weekOffset, props.timeZone);
17
+ const handleDragOver = (event) => {
18
+ event.preventDefault();
19
+ };
20
+ useEffect(() => {
21
+ saveTasksToLocalStorage(props.tasks);
22
+ }, [props.tasks]);
23
+ return (_jsxs("table", { className: `planningCalendar ${props.className}`, style: Object.assign({}, props.style), children: [_jsx("thead", { children: _jsxs("tr", { className: `${props.rowsClassName}`, style: Object.assign(Object.assign({}, theadTrStyle), props.rowsStyle), children: [_jsx("th", { className: `dayTh ${props.groupsColsClassName}`, style: Object.assign({}, props.groupsColsStyle), children: _jsx(GroupsHeadContainer, { className: `${props.groupHeadContainerClassName}`, style: props.groupHeadContainerStyle, groupsHeadRender: props.groupsHeadRender }) }), weekDays.map((day, i) => (_jsx("th", { className: `${props.daysColsClassName}`, style: Object.assign({}, props.daysColsStyle), children: _jsx(DayContainer, { style: props.dayStyle, className: props.dayClassName, dayIndex: i, dayRender: props.dayRender, day: day.day, dayOfTheMonth: day.dayOfTheMonth, dayMonth: day.dayMonth, dayYear: day.dayYear }) }, i))), _jsx("th", { className: `totalTh ${props.hoursColsClassName}`, style: props.hoursColsStyle, children: _jsx(SumHoursHead, { className: props.sumHoursHeadClassName, style: props.sumHoursHeadStyle, sumHoursHeadRender: props.sumHoursHeadRender }) })] }, "") }), _jsx("tbody", { children: (_a = props.groups) === null || _a === void 0 ? void 0 : _a.map((group, i) => (_jsxs("tr", { className: `${props.rowsClassName}`, style: Object.assign({}, props.rowsStyle), children: [_jsx("td", { className: `${props.groupsColsClassName}`, style: Object.assign(Object.assign({}, groupTdStyle), props.groupsColsStyle), children: _jsx(GroupContainer, { style: props.groupContainerStyle, className: props.groupContainerClassName, groupRender: props.groupRender, currentGroup: group, handleClickGroup: props.handleClickGroup }) }, i), dailyHours.map((_, positionDay) => (_jsx("td", { onDragOver: handleDragOver, onDrop: (event) => {
24
+ if (!props.handleDropTask || !props.tasks)
25
+ return;
26
+ const dropInfo = getSessionStorageRecordForDragAndDrop(props.tasks, positionDay, group.id);
27
+ if (!dropInfo)
28
+ return;
29
+ props.handleDropTask(event, dropInfo.taskDropStart, dropInfo.taskDropEnd, dropInfo.taskDropDate, group.id, positionDay, dropInfo.newTask, dropInfo.newTasks);
30
+ }, id: `td-${group.id}day-i`, className: props.dayColsClassName, style: props.dayColsStyle, children: _jsxs("div", { style: {
31
+ display: "flex",
32
+ width: "100%",
33
+ height: "100%",
34
+ flexDirection: "column",
35
+ padding: "5px",
36
+ }, children: [_jsx(_Fragment, { children: props.tasks
37
+ .map((task, taskKey) => {
38
+ if (task.dayIndex === positionDay &&
39
+ task.groupId === group.id &&
40
+ compareWeekOffset(props.date, props.weekOffset || 0, task.taskDate)) {
41
+ return (_jsx(TaskContainer, { handleDragTask: props.handleDragTask, taskRender: props.taskRender, handleDragTaskEnd: props.handleDragTaskEnd, style: props.taskContainerStyle, className: `${props.taskContainerClassName}`, currentTask: task, handleClickTask: props.handleClickTask }, `${taskKey} task`));
42
+ }
43
+ else
44
+ return "";
45
+ }) }), _jsx(AddTask, { addTaskStyle: props.addTaskStyle, addTaskClassName: props.addTaskClassName, currentGroup: group, dayInfo: dailyHours[positionDay], addTaskRender: props.addTaskRender, handleAddTask: props.handleAddTask })] }, positionDay) }, `td-${group.id}day-i${positionDay}`))), _jsx("td", { style: props.hoursColsStyle, className: props.hoursColsClassName, children: _jsx(SumHoursContainer, { groupId: group.id, tasks: props.tasks, weekOffset: props.weekOffset || 0, calendarDate: props.date, sumHoursRender: props.sumHoursRender, sumHoursByGroups: sumHoursByGroups(group.id, props.tasks, props.weekOffset || 0, props.date), className: props.sumHoursContainerClassName, style: props.sumHoursContainerStyle }) }, `${i}sumHours`)] }, `${i} tr`))) })] }));
46
+ }
47
+ export default memo(CalendarForWeek, (prevProps, nextProps) => prevProps.tasks === nextProps.tasks &&
48
+ prevProps.date === nextProps.date &&
49
+ prevProps.groups === nextProps.groups &&
50
+ prevProps.weekOffset === nextProps.weekOffset);