react-weekly-planning 1.0.38 → 1.0.40
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 +219 -98
- package/dist/components/AddTask/index.js +1 -2
- package/dist/components/CalendarForWeek.js +25 -44
- package/dist/components/CalendarForday.js +14 -25
- package/dist/components/GroupsHeadContainer/index.js +1 -2
- package/dist/components/SumHoursContainer/index.js +1 -2
- package/dist/components/SumHoursHead/index.js +1 -2
- package/dist/components/TaskContainer/TaskVirtual.js +18 -0
- package/dist/components/TaskContainer/index.js +5 -4
- package/dist/components/VirtualGroupRow.js +64 -0
- package/dist/components/VirtualGroupRowDay.js +49 -0
- package/dist/components/index.js +3 -2
- package/dist/contexts/CalendarContext.js +3 -7
- package/dist/contexts/CalendarTaskContext.js +32 -0
- package/dist/hooks/useCalendarDateState.js +3 -3
- package/dist/hooks/useCalendarTask.js +191 -0
- package/dist/hooks/useContainerScroll.js +14 -0
- package/dist/hooks/useData.js +7 -0
- package/dist/hooks/useGridContainer.js +24 -0
- package/dist/hooks/useIntersectionObserver.js +19 -0
- package/dist/hooks/useMainContainerItemContent.js +16 -0
- package/dist/hooks/useWindowsSize.js +19 -0
- package/dist/index.js +13 -1
- package/dist/lib/utils.js +43 -31
- package/dist/types/components/AddTask/index.d.ts +2 -2
- package/dist/types/components/CalendarForWeek.d.ts +1 -2
- package/dist/types/components/GroupsHeadContainer/index.d.ts +2 -2
- package/dist/types/components/SumHoursContainer/index.d.ts +1 -1
- package/dist/types/components/SumHoursHead/index.d.ts +2 -2
- package/dist/types/components/TaskContainer/TaskVirtual.d.ts +4 -0
- package/dist/types/components/VirtualGroupRow.d.ts +18 -0
- package/dist/types/components/VirtualGroupRowDay.d.ts +19 -0
- package/dist/types/contexts/CalendarContext.d.ts +2 -10
- package/dist/types/contexts/CalendarTaskContext.d.ts +23 -0
- package/dist/types/definitions/index.d.ts +30 -8
- package/dist/types/hooks/useCalendarTask.d.ts +16 -0
- package/dist/types/hooks/useContainerScroll.d.ts +3 -0
- package/dist/types/hooks/useData.d.ts +4 -0
- package/dist/types/hooks/useGridContainer.d.ts +5 -0
- package/dist/types/hooks/useIntersectionObserver.d.ts +5 -0
- package/dist/types/hooks/useMainContainerItemContent.d.ts +4 -0
- package/dist/types/hooks/useWindowsSize.d.ts +4 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/lib/utils.d.ts +8 -4
- package/package.json +49 -1
- package/dist/components/style.css +0 -123
package/dist/lib/utils.js
CHANGED
|
@@ -165,17 +165,17 @@ function updateSelectedDateForEcartSemaine(dateSelectionnee) {
|
|
|
165
165
|
* @param dateSelectionnee - The selected date.
|
|
166
166
|
* @returns The week difference in days.
|
|
167
167
|
*/
|
|
168
|
-
export function
|
|
168
|
+
export function calculateWeekDifference(dateSelectionnee, timeZone) {
|
|
169
169
|
const dateActuelle = getCalendarDate(timeZone);
|
|
170
170
|
// 1. Retrieve only the year, month, and day, and force it to midnight UTC.
|
|
171
171
|
// This eliminates any risk related to time zones and daylight saving time.
|
|
172
|
-
const utcSelected = Date.UTC(dateSelectionnee.getFullYear(), dateSelectionnee.getMonth(), dateSelectionnee.getDate());
|
|
172
|
+
const utcSelected = Date.UTC(typeof dateSelectionnee === "string" ? new Date(dateSelectionnee).getFullYear() : dateSelectionnee.getFullYear(), typeof dateSelectionnee === "string" ? new Date(dateSelectionnee).getMonth() : dateSelectionnee.getMonth(), typeof dateSelectionnee === "string" ? new Date(dateSelectionnee).getDate() : dateSelectionnee.getDate());
|
|
173
173
|
const utcActuelle = Date.UTC(dateActuelle.getFullYear(), dateActuelle.getMonth(), dateActuelle.getDate());
|
|
174
174
|
const MS_PAR_JOUR = 86400000;
|
|
175
175
|
// 2. Resize each date to the Sunday of its corresponding week.
|
|
176
176
|
// getDay() returns a number from 0 (Sunday) to 6 (Saturday).
|
|
177
177
|
// By subtracting (day * ms_per_day), we arrive at Sunday at midnight.
|
|
178
|
-
const dimancheSelected = utcSelected - (dateSelectionnee.getDay() * MS_PAR_JOUR);
|
|
178
|
+
const dimancheSelected = utcSelected - (typeof dateSelectionnee === "string" ? new Date(dateSelectionnee).getDay() : dateSelectionnee.getDay() * MS_PAR_JOUR);
|
|
179
179
|
const dimancheActuelle = utcActuelle - (dateActuelle.getDay() * MS_PAR_JOUR);
|
|
180
180
|
const ecartJours = Math.round((dimancheSelected - dimancheActuelle) / MS_PAR_JOUR);
|
|
181
181
|
return ecartJours; // Retournera 0, 7, -7, 14, -14...
|
|
@@ -186,20 +186,25 @@ export function calculerEcartSemaine(dateSelectionnee, timeZone) {
|
|
|
186
186
|
* @param numeroSemaine - The week number.
|
|
187
187
|
* @returns The number of weeks since the origin date.
|
|
188
188
|
*/
|
|
189
|
-
export function getSessionStorageRecordForDragAndDrop(tasks, positionDay, dropGroupId) {
|
|
189
|
+
export function getSessionStorageRecordForDragAndDrop(tasks, positionDay, dropGroupId, getTask, hash) {
|
|
190
190
|
const dragtaskId = window.sessionStorage.getItem("calendardragtaskId");
|
|
191
191
|
const dragtaskStart = window.sessionStorage.getItem("calendardragtaskStart");
|
|
192
192
|
const dragtaskEnd = window.sessionStorage.getItem("calendardragtaskEnd");
|
|
193
193
|
const dragdayIndex = window.sessionStorage.getItem("calendardragdayIndex");
|
|
194
|
+
const draghash = window.sessionStorage.getItem("calendardraghash");
|
|
194
195
|
let newTask;
|
|
195
|
-
let newTasks = [];
|
|
196
196
|
window.sessionStorage.clear();
|
|
197
197
|
if (!dragdayIndex || !dragtaskStart || !dragtaskEnd || !dragtaskId || !tasks)
|
|
198
198
|
return;
|
|
199
|
-
const
|
|
199
|
+
const convertTaskDropStart = new Date(parseInt(dragtaskStart));
|
|
200
|
+
if (draghash === null)
|
|
201
|
+
return;
|
|
202
|
+
const dragTask = getTask(draghash, dragtaskId);
|
|
203
|
+
console.log('dragTask', dragTask, draghash, hash);
|
|
204
|
+
if (!dragTask)
|
|
205
|
+
return;
|
|
200
206
|
const dayIndex = parseInt(dragdayIndex);
|
|
201
207
|
let ecartDaysIndex = positionDay - dayIndex;
|
|
202
|
-
const convertTaskDropStart = new Date(parseInt(dragtaskStart));
|
|
203
208
|
convertTaskDropStart.setDate(convertTaskDropStart.getDate() + ecartDaysIndex);
|
|
204
209
|
const taskDropStart = convertTaskDropStart.getTime();
|
|
205
210
|
let convertTaskDropEnd = new Date(parseInt(dragtaskEnd));
|
|
@@ -208,23 +213,20 @@ export function getSessionStorageRecordForDragAndDrop(tasks, positionDay, dropGr
|
|
|
208
213
|
const taskDropDate = new Date(taskDropStart);
|
|
209
214
|
if (dragTask) {
|
|
210
215
|
const { taskStart, taskEnd, taskDate, groupId, dayIndex } = dragTask, rest = __rest(dragTask, ["taskStart", "taskEnd", "taskDate", "groupId", "dayIndex"]);
|
|
211
|
-
newTask = Object.assign({ taskStart: taskDropStart, taskEnd: taskDropEnd, taskDate: taskDropDate, groupId: dropGroupId, dayIndex: positionDay }, rest);
|
|
212
|
-
const dragTaskIndex = tasks.findIndex((task) => task.taskId === dragtaskId);
|
|
213
|
-
newTasks = [...tasks];
|
|
214
|
-
newTasks.splice(dragTaskIndex, 1, newTask);
|
|
216
|
+
newTask = Object.assign(Object.assign({ taskStart: taskDropStart, taskEnd: taskDropEnd, taskDate: taskDropDate, groupId: dropGroupId, dayIndex: positionDay }, rest), { hash: hash, draghash: draghash });
|
|
215
217
|
}
|
|
216
|
-
return { taskDropStart, taskDropEnd, taskDropDate, newTask
|
|
218
|
+
return { taskDropStart, taskDropEnd, taskDropDate, newTask };
|
|
217
219
|
}
|
|
218
220
|
export function compareWeekOffset(calendarDate, weekOffset, taskDate, timeZone) {
|
|
219
|
-
// if (taskDate.getDay() === 0 &&
|
|
221
|
+
// if (taskDate.getDay() === 0 && calculateWeekDifference(taskDate) === -7) {
|
|
220
222
|
// return true;
|
|
221
223
|
// }
|
|
222
224
|
const currentDate = getCalendarDate(timeZone);
|
|
223
|
-
const currentWeekOffset =
|
|
225
|
+
const currentWeekOffset = calculateWeekDifference(currentDate, timeZone);
|
|
224
226
|
const localTaskDate = getArbitraryDateInTimeZone(taskDate, timeZone);
|
|
225
227
|
// if (calendarDate)
|
|
226
|
-
// return (
|
|
227
|
-
const ecartTask =
|
|
228
|
+
// return (calculateWeekDifference(calendarDate) === calculateWeekDifference(taskDate));
|
|
229
|
+
const ecartTask = calculateWeekDifference(taskDate, timeZone);
|
|
228
230
|
return weekOffset === ecartTask;
|
|
229
231
|
}
|
|
230
232
|
export const sumHoursByGroups = (groupId, tasks, weekOffset, calendarDate, timeZone) => {
|
|
@@ -260,13 +262,16 @@ export function saveTasksToLocalStorage(tasks) {
|
|
|
260
262
|
window.localStorage.setItem("CalendarTaskSaved", JSON.stringify(backup));
|
|
261
263
|
}
|
|
262
264
|
}
|
|
263
|
-
export const updateCalendarDateWithOffset = (offset,
|
|
264
|
-
const newDate =
|
|
265
|
+
export const updateCalendarDateWithOffset = (offset, timeZone) => {
|
|
266
|
+
const newDate = getCalendarDate(timeZone);
|
|
265
267
|
newDate.setDate(newDate.getDate() + offset);
|
|
266
268
|
return newDate;
|
|
267
269
|
};
|
|
268
270
|
export const updateOffsetWithDateCalendar = (calendarDate, timeZone) => {
|
|
269
|
-
|
|
271
|
+
if (typeof calendarDate === 'string') {
|
|
272
|
+
return calculateWeekDifference(new Date(calendarDate), timeZone);
|
|
273
|
+
}
|
|
274
|
+
return calculateWeekDifference(calendarDate, timeZone);
|
|
270
275
|
};
|
|
271
276
|
export const millisecondsToHours = (milliseconds) => {
|
|
272
277
|
return millisecondsToDate(milliseconds).formattedDate;
|
|
@@ -299,7 +304,7 @@ export const deleteTaskSaved = (taskId) => {
|
|
|
299
304
|
if (!tasksSavedString)
|
|
300
305
|
return;
|
|
301
306
|
const tasksSavedTable = JSON.parse(tasksSavedString);
|
|
302
|
-
const taskIndex = tasksSavedTable.findIndex((task) => task.
|
|
307
|
+
const taskIndex = tasksSavedTable.findIndex((task) => task.id === taskId);
|
|
303
308
|
if (taskIndex) {
|
|
304
309
|
tasksSavedTable.splice(taskIndex, 1);
|
|
305
310
|
window.localStorage.setItem("CalendarTaskSaved", JSON.stringify(tasksSavedTable));
|
|
@@ -384,7 +389,7 @@ function recurring(ecartDay, task, timeZone) {
|
|
|
384
389
|
newTask.taskExpiryDate = new Date(newTask.taskExpiryDate.getTime() + ecartDay);
|
|
385
390
|
newTask.taskDate = new Date(newTask.taskStart);
|
|
386
391
|
newTask.dayIndex = getArbitraryDateInTimeZone(newTask.taskDate, timeZone).getDay();
|
|
387
|
-
newTask.
|
|
392
|
+
newTask.id = getUnqueId();
|
|
388
393
|
return newTask;
|
|
389
394
|
}
|
|
390
395
|
export function recurringTasks(allTasks, task, recurrenceType, occurrences, timeZone) {
|
|
@@ -483,13 +488,13 @@ export function addTask(tasks, task) {
|
|
|
483
488
|
return [...tasks, task];
|
|
484
489
|
}
|
|
485
490
|
export function deleteTask(tasks, taskId) {
|
|
486
|
-
const taskPos = tasks.findIndex((task) => task.
|
|
491
|
+
const taskPos = tasks.findIndex((task) => task.id === taskId);
|
|
487
492
|
const alltasks = [...tasks];
|
|
488
493
|
alltasks.splice(taskPos, 1);
|
|
489
494
|
return alltasks;
|
|
490
495
|
}
|
|
491
496
|
export function getTaskInfoById(tasks, groups, taskId) {
|
|
492
|
-
const task = tasks.find((task) => task.
|
|
497
|
+
const task = tasks.find((task) => task.id === taskId);
|
|
493
498
|
if (!task)
|
|
494
499
|
throw new Error("no such to task");
|
|
495
500
|
const group = groups.find((group) => group.id === task.groupId);
|
|
@@ -512,7 +517,7 @@ export function deSelectTask(task) {
|
|
|
512
517
|
if (typeof window !== "undefined") {
|
|
513
518
|
const copiedTasks = JSON.parse(window.sessionStorage.getItem("copiedTasks") || "[]");
|
|
514
519
|
if (copiedTasks.length > 0) {
|
|
515
|
-
const newTasks = deleteTask(copiedTasks, task.
|
|
520
|
+
const newTasks = deleteTask(copiedTasks, task.id);
|
|
516
521
|
window.sessionStorage.setItem("copiedTasks", JSON.stringify([...newTasks]));
|
|
517
522
|
}
|
|
518
523
|
else
|
|
@@ -544,12 +549,12 @@ export function pastTasks(dayInfo, groupId, tasks, taskExpiryDate, timeZone) {
|
|
|
544
549
|
const copiedTasks = JSON.parse(window.sessionStorage.getItem("copiedTasks") || "[]");
|
|
545
550
|
if (copiedTasks.length > 0) {
|
|
546
551
|
const newTasks = copiedTasks.reduce((previousTasks, task) => {
|
|
547
|
-
const { dayIndex: copiedTaskDayIndex, taskStart: copiedTasktaskStart, taskEnd: copiedTasktaskEnd, taskDate: copiedTasktaskDate, groupId: copiedTaskGroupId,
|
|
552
|
+
const { dayIndex: copiedTaskDayIndex, taskStart: copiedTasktaskStart, taskEnd: copiedTasktaskEnd, taskDate: copiedTasktaskDate, groupId: copiedTaskGroupId, id: copiedTaskId, taskExpiryDate: copiedTaskExpiryDate } = task, rest = __rest(task, ["dayIndex", "taskStart", "taskEnd", "taskDate", "groupId", "id", "taskExpiryDate"]);
|
|
548
553
|
const newTaskStartAndEnd = updateTaskStartTimeAnEndTime(copiedTasktaskStart, copiedTasktaskEnd, updateOffsetWithDateCalendar(dayInfo.day, timeZone), dayInfo.positionDay, copiedTaskDayIndex, timeZone);
|
|
549
554
|
if (!checkDuplicates(previousTasks, newTaskStartAndEnd.startTime, newTaskStartAndEnd.endTime, groupId)) {
|
|
550
555
|
const newTaskDate = new Date(newTaskStartAndEnd.startTime);
|
|
551
556
|
const newTaskId = `${getUnqueId()}`;
|
|
552
|
-
const newTask = Object.assign({ taskStart: newTaskStartAndEnd.startTime, taskEnd: newTaskStartAndEnd.endTime, dayIndex: dayInfo.positionDay,
|
|
557
|
+
const newTask = Object.assign({ taskStart: newTaskStartAndEnd.startTime, taskEnd: newTaskStartAndEnd.endTime, dayIndex: dayInfo.positionDay, id: newTaskId, taskDate: newTaskDate, groupId: groupId, taskExpiryDate: taskExpiryDate }, rest);
|
|
553
558
|
return [...previousTasks, newTask];
|
|
554
559
|
}
|
|
555
560
|
else
|
|
@@ -564,7 +569,7 @@ export function pastTasks(dayInfo, groupId, tasks, taskExpiryDate, timeZone) {
|
|
|
564
569
|
}
|
|
565
570
|
export function updateTask(tasks, taskId, newtask) {
|
|
566
571
|
return tasks.map((task) => {
|
|
567
|
-
if (task.
|
|
572
|
+
if (task.id === taskId) {
|
|
568
573
|
return newtask;
|
|
569
574
|
}
|
|
570
575
|
return task;
|
|
@@ -580,14 +585,14 @@ export function duplicateTasksForPeriod(periodStart, periodEnd, calendarOffset,
|
|
|
580
585
|
const findPlanning = currentWeekallTasks.filter((planning) => planning.dayIndex === dayIndex);
|
|
581
586
|
if (findPlanning.length > 0) {
|
|
582
587
|
findPlanning.forEach((plan) => {
|
|
583
|
-
const { taskStart, taskEnd, taskDate, offset,
|
|
588
|
+
const { taskStart, taskEnd, taskDate, offset, id } = plan, rest = __rest(plan, ["taskStart", "taskEnd", "taskDate", "offset", "id"]);
|
|
584
589
|
const newOffset = updateOffsetWithDateCalendar(periodEnd);
|
|
585
590
|
const ecartDay = Math.round((periodEnd.getTime() - periodStart.getTime()) / DAY_IN_MILLISECONDS);
|
|
586
591
|
const newTaskStart = taskStart + ecartDay * DAY_IN_MILLISECONDS;
|
|
587
592
|
const newTaskEnd = taskEnd + ecartDay * DAY_IN_MILLISECONDS;
|
|
588
593
|
const newTaskDate = new Date(taskDate.getTime() + ecartDay * DAY_IN_MILLISECONDS);
|
|
589
594
|
if (!checkDuplicates(allTasks, newTaskStart, newTaskEnd, rest.groupId)) {
|
|
590
|
-
const newTask = Object.assign(Object.assign({}, rest), { taskDate: newTaskDate, taskStart: newTaskStart, taskEnd: newTaskEnd,
|
|
595
|
+
const newTask = Object.assign(Object.assign({}, rest), { taskDate: newTaskDate, taskStart: newTaskStart, taskEnd: newTaskEnd, id: getUnqueId() });
|
|
591
596
|
tasks.push(Object.assign(Object.assign({}, newTask), { offset: newOffset }));
|
|
592
597
|
}
|
|
593
598
|
});
|
|
@@ -602,14 +607,14 @@ export function duplicateTaskForPeriod(periodStart, periodEnd, task, ecartDay, g
|
|
|
602
607
|
for (let dayInMilliseconds = periodStart.getTime(); dayInMilliseconds <= periodEnd.getTime(); dayInMilliseconds += ecartDay
|
|
603
608
|
? DAY_IN_MILLISECONDS * ecartDay
|
|
604
609
|
: DAY_IN_MILLISECONDS) {
|
|
605
|
-
const { taskStart, taskEnd, taskDate, offset,
|
|
610
|
+
const { taskStart, taskEnd, taskDate, offset, id, groupId: currentTaskGroupId, taskExpiryDate: currentTaskExpiryDate } = task, rest = __rest(task, ["taskStart", "taskEnd", "taskDate", "offset", "id", "groupId", "taskExpiryDate"]);
|
|
606
611
|
const newOffset = updateOffsetWithDateCalendar(periodEnd);
|
|
607
612
|
const ecartDay = Math.round((dayInMilliseconds - taskDate.getTime()) / DAY_IN_MILLISECONDS);
|
|
608
613
|
const newTaskStart = taskStart + ecartDay * DAY_IN_MILLISECONDS;
|
|
609
614
|
const newTaskEnd = taskEnd + ecartDay * DAY_IN_MILLISECONDS;
|
|
610
615
|
const newTaskDate = new Date(taskDate.getTime() + ecartDay * DAY_IN_MILLISECONDS);
|
|
611
616
|
if (!checkDuplicates(allTasks, newTaskStart, newTaskEnd, rest.groupId)) {
|
|
612
|
-
const newTask = Object.assign(Object.assign({}, rest), { taskDate: newTaskDate, taskStart: newTaskStart, taskEnd: newTaskEnd,
|
|
617
|
+
const newTask = Object.assign(Object.assign({}, rest), { taskDate: newTaskDate, taskStart: newTaskStart, taskEnd: newTaskEnd, id: getUnqueId(), groupId: groupId ? groupId : currentTaskGroupId, taskExpiryDate: taskExpiryDate });
|
|
613
618
|
allTasks.push(Object.assign(Object.assign({}, newTask), { offset: newOffset }));
|
|
614
619
|
}
|
|
615
620
|
}
|
|
@@ -643,3 +648,10 @@ export function totalLabel(milliseconds) {
|
|
|
643
648
|
label = `${hourConv}:0:0`;
|
|
644
649
|
return label;
|
|
645
650
|
}
|
|
651
|
+
export function getHash(weekOffset, groupId, dayIndex) {
|
|
652
|
+
return {
|
|
653
|
+
"week": `${weekOffset}`,
|
|
654
|
+
"group": `${weekOffset}/${groupId}`,
|
|
655
|
+
"day": `${weekOffset}/${groupId}/${dayIndex}`
|
|
656
|
+
};
|
|
657
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AddTaskPropsType } from "../../definitions";
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const AddTask: ({ currentGroup, handleAddTask, addTaskRender, dayInfo, addTaskStyle, addTaskClassName, }: AddTaskPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default AddTask;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { CalendarTablePropsType } from "../definitions";
|
|
2
|
-
declare
|
|
3
|
-
declare const _default: import("react").MemoExoticComponent<typeof CalendarForWeek>;
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<(props: CalendarTablePropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
4
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GroupsHeadContainerPropsType } from "../../definitions";
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const GroupsHeadContainer: ({ groupsHeadRender, style, className, }: GroupsHeadContainerPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default GroupsHeadContainer;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SumHoursContainerPropsType } from "../../definitions";
|
|
2
|
-
declare const _default: import("react").MemoExoticComponent<({ groupId,
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<({ groupId, weekOffset, calendarDate, sumHoursByGroups, sumHoursRender, className, style, }: SumHoursContainerPropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SumHoursHeadContainerPropsType } from "../../definitions";
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const SumHoursHead: ({ sumHoursHeadRender, className, style, }: SumHoursHeadContainerPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default SumHoursHead;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CalendarTablePropsType, GroupFeildsType, TaskType, TasksStore, TasksType, dayInfoType } from "../definitions";
|
|
3
|
+
interface VirtualGroupRowProps {
|
|
4
|
+
group: GroupFeildsType;
|
|
5
|
+
i: number;
|
|
6
|
+
props: CalendarTablePropsType;
|
|
7
|
+
getTasks: (hash: string) => TasksType;
|
|
8
|
+
isValidTask: (task: TaskType) => boolean;
|
|
9
|
+
addTask: (task: TaskType) => void;
|
|
10
|
+
deleteTask: (hash: string, taskId: string) => void;
|
|
11
|
+
getTask: (hash: string, taskId: string) => TaskType | undefined;
|
|
12
|
+
dailyHours: dayInfoType[];
|
|
13
|
+
hashScope: "week" | "group" | "day";
|
|
14
|
+
tasks: TasksStore;
|
|
15
|
+
sumHoursByGroupsCount: number;
|
|
16
|
+
}
|
|
17
|
+
declare const _default: React.NamedExoticComponent<VirtualGroupRowProps>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CalendarTablePropsType, GroupFeildsType, TaskType, TasksStore, TasksType, dayInfoType } from "../definitions";
|
|
3
|
+
interface VirtualGroupRowDayProps {
|
|
4
|
+
group: GroupFeildsType;
|
|
5
|
+
i: number;
|
|
6
|
+
props: CalendarTablePropsType;
|
|
7
|
+
getTasks: (hash: string) => TasksType;
|
|
8
|
+
isValidTask: (task: TaskType) => boolean;
|
|
9
|
+
addTask: (task: TaskType) => void;
|
|
10
|
+
deleteTask: (hash: string, taskId: string) => void;
|
|
11
|
+
updateTask: (hash: string, taskId: string, updatedTask: Partial<TaskType>) => void;
|
|
12
|
+
getTask: (hash: string, taskId: string) => TaskType | undefined;
|
|
13
|
+
dailyHours: dayInfoType[];
|
|
14
|
+
dayOffset: number;
|
|
15
|
+
hashScope: "week" | "group" | "day";
|
|
16
|
+
tasks: TasksStore;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: React.NamedExoticComponent<VirtualGroupRowDayProps>;
|
|
19
|
+
export default _default;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import { GroupPropsType } from "../definitions";
|
|
2
1
|
type CalendarContextProviderPropsType = {
|
|
3
2
|
children: React.ReactNode;
|
|
4
|
-
groups: GroupPropsType[];
|
|
5
|
-
weekOffset: number;
|
|
6
|
-
date: Date;
|
|
7
3
|
};
|
|
8
|
-
type CalendarContextType = {
|
|
9
|
-
|
|
10
|
-
weekOffset: number;
|
|
11
|
-
date: Date;
|
|
12
|
-
};
|
|
13
|
-
declare const CalendarContextProvider: ({ groups, weekOffset, children, date }: CalendarContextProviderPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
type CalendarContextType = {};
|
|
5
|
+
declare const CalendarContextProvider: ({ children, }: CalendarContextProviderPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
14
6
|
export declare const useCalendarContext: () => CalendarContextType;
|
|
15
7
|
export default CalendarContextProvider;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TaskFeildsType } from "../definitions";
|
|
2
|
+
import { TasksStore } from "../definitions";
|
|
3
|
+
type Task = TaskFeildsType;
|
|
4
|
+
type CalendarTaskContextProviderPropsType = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
timeZone?: string;
|
|
7
|
+
hashScope?: "week" | "group" | "day";
|
|
8
|
+
};
|
|
9
|
+
type CalendarTaskContextType = {
|
|
10
|
+
tasks: TasksStore;
|
|
11
|
+
addTask: (task: Task) => void;
|
|
12
|
+
getTasks: (hash: string) => Task[];
|
|
13
|
+
updateTask: (hash: string, taskId: string, updatedTask: Partial<Task>) => void;
|
|
14
|
+
deleteTask: (hash: string, taskId: string) => void;
|
|
15
|
+
cleanExpiredTasks: () => void;
|
|
16
|
+
cleanExpiredTasksByHash: (hash: string) => void;
|
|
17
|
+
isValidTask: (task: Task) => boolean;
|
|
18
|
+
getTask: (hash: string, taskId: string) => TaskFeildsType | undefined;
|
|
19
|
+
hashScope?: "week" | "group" | "day";
|
|
20
|
+
};
|
|
21
|
+
declare const CalendarTaskContextProvider: ({ children, hashScope }: CalendarTaskContextProviderPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const useCalendarTaskContext: () => CalendarTaskContextType;
|
|
23
|
+
export default CalendarTaskContextProvider;
|
|
@@ -95,6 +95,7 @@ export type DayPropsType = {
|
|
|
95
95
|
* Props for the Calendar component.
|
|
96
96
|
*/
|
|
97
97
|
export type CalendarPropsType = {
|
|
98
|
+
drop?: "copy" | "move";
|
|
98
99
|
scope?: "day" | "week";
|
|
99
100
|
/** Offset for the week (e.g., -7 for last week, 0 for current week, 7 for next week). */
|
|
100
101
|
weekOffset?: number;
|
|
@@ -170,7 +171,6 @@ export type CalendarPropsType = {
|
|
|
170
171
|
dayInfo: dayInfoType;
|
|
171
172
|
}) => React.ReactNode;
|
|
172
173
|
/** Array of tasks to be displayed in the calendar. */
|
|
173
|
-
tasks: TasksType;
|
|
174
174
|
/** Handler function for dragging a task. */
|
|
175
175
|
handleDragTask?: (event: React.DragEvent<HTMLDivElement>, currentTask: TaskFeildsType) => void;
|
|
176
176
|
/** Handler function for dropping a task. */
|
|
@@ -180,9 +180,8 @@ export type CalendarPropsType = {
|
|
|
180
180
|
/** Custom render function for the groups header. */
|
|
181
181
|
groupsHeadRender?: () => React.ReactNode;
|
|
182
182
|
/** Custom render function for the sum of hours. */
|
|
183
|
-
sumHoursRender?: ({ groupId,
|
|
183
|
+
sumHoursRender?: ({ groupId, weekOffset, calendarDate, sumHoursByGroups, }: {
|
|
184
184
|
groupId: string;
|
|
185
|
-
tasks: TasksType;
|
|
186
185
|
weekOffset: number;
|
|
187
186
|
calendarDate: Date;
|
|
188
187
|
sumHoursByGroups: number;
|
|
@@ -262,7 +261,7 @@ export type TaskType = {
|
|
|
262
261
|
/** Index of the day the task belongs to. */
|
|
263
262
|
dayIndex: number;
|
|
264
263
|
/** Unique identifier for the task. */
|
|
265
|
-
|
|
264
|
+
id: string;
|
|
266
265
|
/** This is a prop to save the date in local storage until a date of your choice */
|
|
267
266
|
taskExpiryDate?: Date;
|
|
268
267
|
/**task created date */
|
|
@@ -271,6 +270,8 @@ export type TaskType = {
|
|
|
271
270
|
taskLocation?: string;
|
|
272
271
|
/**task timezone */
|
|
273
272
|
taskTimzone?: string;
|
|
273
|
+
hash?: string;
|
|
274
|
+
dragHash?: string;
|
|
274
275
|
};
|
|
275
276
|
export type filterTaskType = {
|
|
276
277
|
/** Start time of the task. */
|
|
@@ -357,8 +358,6 @@ export type handleDragTaskEndType = (event: React.DragEvent<HTMLDivElement>) =>
|
|
|
357
358
|
export type SumHoursContainerPropsType = {
|
|
358
359
|
/** ID of the group. */
|
|
359
360
|
groupId: string;
|
|
360
|
-
/** Array of tasks to be displayed in the calendar. */
|
|
361
|
-
tasks: TasksType;
|
|
362
361
|
/** Offset for the week (e.g., -7 for last week, 0 for current week, 7 for next week). */
|
|
363
362
|
weekOffset: number;
|
|
364
363
|
/** The current date to display in the calendar. */
|
|
@@ -366,9 +365,8 @@ export type SumHoursContainerPropsType = {
|
|
|
366
365
|
/** Sum of hours for the group. */
|
|
367
366
|
sumHoursByGroups: number;
|
|
368
367
|
/** Custom render function for the sum of hours. */
|
|
369
|
-
sumHoursRender?: ({ groupId,
|
|
368
|
+
sumHoursRender?: ({ groupId, weekOffset, calendarDate, sumHoursByGroups, }: {
|
|
370
369
|
groupId: string;
|
|
371
|
-
tasks: TasksType;
|
|
372
370
|
weekOffset: number;
|
|
373
371
|
calendarDate: Date;
|
|
374
372
|
sumHoursByGroups: number;
|
|
@@ -392,4 +390,28 @@ export type dailyHoursType = {
|
|
|
392
390
|
}[];
|
|
393
391
|
export type CalendarTablePropsType = CalendarPropsType;
|
|
394
392
|
export type TimeZone = "Africa/Abidjan" | "Africa/Accra" | "Africa/Addis_Ababa" | "Africa/Algiers" | "Africa/Asmara" | "Africa/Asmera" | "Africa/Bamako" | "Africa/Bangui" | "Africa/Banjul" | "Africa/Bissau" | "Africa/Blantyre" | "Africa/Brazzaville" | "Africa/Bujumbura" | "Africa/Cairo" | "Africa/Casablanca" | "Africa/Ceuta" | "Africa/Conakry" | "Africa/Dakar" | "Africa/Dar_es_Salaam" | "Africa/Djibouti" | "Africa/Douala" | "Africa/El_Aaiun" | "Africa/Freetown" | "Africa/Gaborone" | "Africa/Harare" | "Africa/Johannesburg" | "Africa/Juba" | "Africa/Kampala" | "Africa/Khartoum" | "Africa/Kigali" | "Africa/Kinshasa" | "Africa/Lagos" | "Africa/Libreville" | "Africa/Lome" | "Africa/Luanda" | "Africa/Lubumbashi" | "Africa/Lusaka" | "Africa/Malabo" | "Africa/Maputo" | "Africa/Maseru" | "Africa/Mbabane" | "Africa/Mogadishu" | "Africa/Monrovia" | "Africa/Nairobi" | "Africa/Ndjamena" | "Africa/Niamey" | "Africa/Nouakchott" | "Africa/Ouagadougou" | "Africa/Porto-Novo" | "Africa/Sao_Tome" | "Africa/Timbuktu" | "Africa/Tripoli" | "Africa/Tunis" | "Africa/Windhoek" | "America/Adak" | "America/Anchorage" | "America/Anguilla" | "America/Antigua" | "America/Araguaina" | "America/Argentina/Buenos_Aires" | "America/Argentina/Catamarca" | "America/Argentina/ComodRivadavia" | "America/Argentina/Cordoba" | "America/Argentina/Jujuy" | "America/Argentina/La_Rioja" | "America/Argentina/Mendoza" | "America/Argentina/Rio_Gallegos" | "America/Argentina/Salta" | "America/Argentina/San_Juan" | "America/Argentina/San_Luis" | "America/Argentina/Tucuman" | "America/Argentina/Ushuaia" | "America/Aruba" | "America/Asuncion" | "America/Atikokan" | "America/Atka" | "America/Bahia" | "America/Bahia_Banderas" | "America/Barbados" | "America/Belem" | "America/Belize" | "America/Blanc-Sablon" | "America/Boa_Vista" | "America/Bogota" | "America/Boise" | "America/Buenos_Aires" | "America/Cambridge_Bay" | "America/Campo_Grande" | "America/Cancun" | "America/Caracas" | "America/Catamarca" | "America/Cayenne" | "America/Cayman" | "America/Chicago" | "America/Chihuahua" | "America/Ciudad_Juarez" | "America/Coral_Harbour" | "America/Cordoba" | "America/Costa_Rica" | "America/Creston" | "America/Cuiaba" | "America/Curacao" | "America/Danmarkshavn" | "America/Dawson" | "America/Dawson_Creek" | "America/Denver" | "America/Detroit" | "America/Dominica" | "America/Edmonton" | "America/Eirunepe" | "America/El_Salvador" | "America/Ensenada" | "America/Fort_Nelson" | "America/Fort_Wayne" | "America/Fortaleza" | "America/Glace_Bay" | "America/Godthab" | "America/Goose_Bay" | "America/Grand_Turk" | "America/Grenada" | "America/Guadeloupe" | "America/Guatemala" | "America/Guayaquil" | "America/Guyana" | "America/Halifax" | "America/Havana" | "America/Hermosillo" | "America/Indiana/Indianapolis" | "America/Indiana/Knox" | "America/Indiana/Marengo" | "America/Indiana/Petersburg" | "America/Indiana/Tell_City" | "America/Indiana/Vevay" | "America/Indiana/Vincennes" | "America/Indiana/Winamac" | "America/Indianapolis" | "America/Inuvik" | "America/Iqaluit" | "America/Jamaica" | "America/Jujuy" | "America/Juneau" | "America/Kentucky/Louisville" | "America/Kentucky/Monticello" | "America/Knox_IN" | "America/Kralendijk" | "America/La_Paz" | "America/Lima" | "America/Los_Angeles" | "America/Louisville" | "America/Lower_Princes" | "America/Maceio" | "America/Managua" | "America/Manaus" | "America/Marigot" | "America/Martinique" | "America/Matamoros" | "America/Mazatlan" | "America/Mendoza" | "America/Menominee" | "America/Merida" | "America/Metlakatla" | "America/Mexico_City" | "America/Miquelon" | "America/Moncton" | "America/Monterrey" | "America/Montevideo" | "America/Montreal" | "America/Montserrat" | "America/Nassau" | "America/New_York" | "America/Nipigon" | "America/Nome" | "America/Noronha" | "America/North_Dakota/Beulah" | "America/North_Dakota/Center" | "America/North_Dakota/New_Salem" | "America/Nuuk" | "America/Ojinaga" | "America/Panama" | "America/Pangnirtung" | "America/Paramaribo" | "America/Phoenix" | "America/Port-au-Prince" | "America/Port_of_Spain" | "America/Porto_Acre" | "America/Porto_Velho" | "America/Puerto_Rico" | "America/Punta_Arenas" | "America/Rainy_River" | "America/Rankin_Inlet" | "America/Recife" | "America/Regina" | "America/Resolute" | "America/Rio_Branco" | "America/Rosario" | "America/Santa_Isabel" | "America/Santarem" | "America/Santiago" | "America/Santo_Domingo" | "America/Sao_Paulo" | "America/Scoresbysund" | "America/Shiprock" | "America/Sitka" | "America/St_Barthelemy" | "America/St_Johns" | "America/St_Kitts" | "America/St_Lucia" | "America/St_Thomas" | "America/St_Vincent" | "America/Swift_Current" | "America/Tegucigalpa" | "America/Thule" | "America/Thunder_Bay" | "America/Tijuana" | "America/Toronto" | "America/Tortola" | "America/Vancouver" | "America/Virgin" | "America/Whitehorse" | "America/Winnipeg" | "America/Yakutat" | "America/Yellowknife" | "Antarctica/Casey" | "Antarctica/Davis" | "Antarctica/DumontDUrville" | "Antarctica/Macquarie" | "Antarctica/Mawson" | "Antarctica/McMurdo" | "Antarctica/Palmer" | "Antarctica/Rothera" | "Antarctica/South_Pole" | "Antarctica/Syowa" | "Antarctica/Troll" | "Antarctica/Vostok" | "Arctic/Longyearbyen" | "Asia/Aden" | "Asia/Almaty" | "Asia/Amman" | "Asia/Anadyr" | "Asia/Aqtau" | "Asia/Aqtobe" | "Asia/Ashgabat" | "Asia/Ashkhabad" | "Asia/Atyrau" | "Asia/Baghdad" | "Asia/Bahrain" | "Asia/Baku" | "Asia/Bangkok" | "Asia/Barnaul" | "Asia/Beirut" | "Asia/Bishkek" | "Asia/Brunei" | "Asia/Calcutta" | "Asia/Chita" | "Asia/Choibalsan" | "Asia/Chongqing" | "Asia/Chungking" | "Asia/Colombo" | "Asia/Dacca" | "Asia/Damascus" | "Asia/Dhaka" | "Asia/Dili" | "Asia/Dubai" | "Asia/Dushanbe" | "Asia/Famagusta" | "Asia/Gaza" | "Asia/Harbin" | "Asia/Hebron" | "Asia/Ho_Chi_Minh" | "Asia/Hong_Kong" | "Asia/Hovd" | "Asia/Irkutsk" | "Asia/Istanbul" | "Asia/Jakarta" | "Asia/Jayapura" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Kamchatka" | "Asia/Karachi" | "Asia/Kashgar" | "Asia/Kathmandu" | "Asia/Katmandu" | "Asia/Khandyga" | "Asia/Kolkata" | "Asia/Krasnoyarsk" | "Asia/Kuala_Lumpur" | "Asia/Kuching" | "Asia/Kuwait" | "Asia/Macao" | "Asia/Macau" | "Asia/Magadan" | "Asia/Makassar" | "Asia/Manila" | "Asia/Muscat" | "Asia/Nicosia" | "Asia/Novokuznetsk" | "Asia/Novosibirsk" | "Asia/Omsk" | "Asia/Oral" | "Asia/Phnom_Penh" | "Asia/Pontianak" | "Asia/Pyongyang" | "Asia/Qatar" | "Asia/Qostanay" | "Asia/Qyzylorda" | "Asia/Rangoon" | "Asia/Riyadh" | "Asia/Saigon" | "Asia/Sakhalin" | "Asia/Samarkand" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Srednekolymsk" | "Asia/Taipei" | "Asia/Tashkent" | "Asia/Tbilisi" | "Asia/Tehran" | "Asia/Tel_Aviv" | "Asia/Thimbu" | "Asia/Thimphu" | "Asia/Tokyo" | "Asia/Tomsk" | "Asia/Ujung_Pandang" | "Asia/Ulaanbaatar" | "Asia/Ulan_Bator" | "Asia/Urumqi" | "Asia/Ust-Nera" | "Asia/Vientiane" | "Asia/Vladivostok" | "Asia/Yakutsk" | "Asia/Yangon" | "Asia/Yekaterinburg" | "Asia/Yerevan" | "Atlantic/Azores" | "Atlantic/Bermuda" | "Atlantic/Canary" | "Atlantic/Cape_Verde" | "Atlantic/Faeroe" | "Atlantic/Faroe" | "Atlantic/Jan_Mayen" | "Atlantic/Madeira" | "Atlantic/Reykjavik" | "Atlantic/South_Georgia" | "Atlantic/St_Helena" | "Atlantic/Stanley" | "Australia/ACT" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Broken_Hill" | "Australia/Canberra" | "Australia/Currie" | "Australia/Darwin" | "Australia/Eucla" | "Australia/Hobart" | "Australia/LHI" | "Australia/Lindeman" | "Australia/Lord_Howe" | "Australia/Melbourne" | "Australia/North" | "Australia/NSW" | "Australia/Perth" | "Australia/Queensland" | "Australia/South" | "Australia/Sydney" | "Australia/Tasmania" | "Australia/Victoria" | "Australia/West" | "Australia/Yancowinna" | "Brazil/Acre" | "Brazil/DeNoronha" | "Brazil/East" | "Brazil/West" | "Canada/Atlantic" | "Canada/Central" | "Canada/Eastern" | "Canada/Mountain" | "Canada/Newfoundland" | "Canada/Pacific" | "Canada/Saskatchewan" | "Canada/Yukon" | "CET" | "Chile/Continental" | "Chile/EasterIsland" | "CST6CDT" | "Cuba" | "EET" | "Egypt" | "Eire" | "EST" | "EST5EDT" | "Etc/GMT" | "Etc/GMT+0" | "Etc/GMT+1" | "Etc/GMT+10" | "Etc/GMT+11" | "Etc/GMT+12" | "Etc/GMT+2" | "Etc/GMT+3" | "Etc/GMT+4" | "Etc/GMT+5" | "Etc/GMT+6" | "Etc/GMT+7" | "Etc/GMT+8" | "Etc/GMT+9" | "Etc/GMT-0" | "Etc/GMT-1" | "Etc/GMT-10" | "Etc/GMT-11" | "Etc/GMT-12" | "Etc/GMT-13" | "Etc/GMT-14" | "Etc/GMT-2" | "Etc/GMT-3" | "Etc/GMT-4" | "Etc/GMT-5" | "Etc/GMT-6" | "Etc/GMT-7" | "Etc/GMT-8" | "Etc/GMT-9" | "Etc/GMT0" | "Etc/Greenwich" | "Etc/UCT" | "Etc/Universal" | "Etc/UTC" | "Etc/Zulu" | "Europe/Amsterdam" | "Europe/Andorra" | "Europe/Astrakhan" | "Europe/Athens" | "Europe/Belfast" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Busingen" | "Europe/Chisinau" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Gibraltar" | "Europe/Guernsey" | "Europe/Helsinki" | "Europe/Isle_of_Man" | "Europe/Istanbul" | "Europe/Jersey" | "Europe/Kaliningrad" | "Europe/Kiev" | "Europe/Kirov" | "Europe/Kyiv" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Mariehamn" | "Europe/Minsk" | "Europe/Monaco" | "Europe/Moscow" | "Europe/Nicosia" | "Europe/Oslo" | "Europe/Paris" | "Europe/Podgorica" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Samara" | "Europe/San_Marino" | "Europe/Sarajevo" | "Europe/Saratov" | "Europe/Simferopol" | "Europe/Skopje" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Tirane" | "Europe/Tiraspol" | "Europe/Ulyanovsk" | "Europe/Uzhgorod" | "Europe/Vaduz" | "Europe/Vatican" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Volgograd" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zaporozhye" | "Europe/Zurich" | "Factory" | "GB" | "GB-Eire" | "GMT" | "GMT+0" | "GMT-0" | "GMT0" | "Greenwich" | "Hongkong" | "HST" | "Iceland" | "Indian/Antananarivo" | "Indian/Chagos" | "Indian/Christmas" | "Indian/Cocos" | "Indian/Comoro" | "Indian/Kerguelen" | "Indian/Mahe" | "Indian/Maldives" | "Indian/Mauritius" | "Indian/Mayotte" | "Indian/Reunion" | "Iran" | "Israel" | "Jamaica" | "Japan" | "Kwajalein" | "Libya" | "MET" | "Mexico/BajaNorte" | "Mexico/BajaSur" | "Mexico/General" | "MST" | "MST7MDT" | "Navajo" | "NZ" | "NZ-CHAT" | "Pacific/Apia" | "Pacific/Auckland" | "Pacific/Bougainville" | "Pacific/Chatham" | "Pacific/Chuuk" | "Pacific/Easter" | "Pacific/Efate" | "Pacific/Enderbury" | "Pacific/Fakaofo" | "Pacific/Fiji" | "Pacific/Funafuti" | "Pacific/Galapagos" | "Pacific/Gambier" | "Pacific/Guadalcanal" | "Pacific/Guam" | "Pacific/Honolulu" | "Pacific/Johnston" | "Pacific/Kanton" | "Pacific/Kiritimati" | "Pacific/Kosrae" | "Pacific/Kwajalein" | "Pacific/Majuro" | "Pacific/Marquesas" | "Pacific/Midway" | "Pacific/Nauru" | "Pacific/Niue" | "Pacific/Norfolk" | "Pacific/Noumea" | "Pacific/Pago_Pago" | "Pacific/Palau" | "Pacific/Pitcairn" | "Pacific/Pohnpei" | "Pacific/Ponape" | "Pacific/Port_Moresby" | "Pacific/Rarotonga" | "Pacific/Saipan" | "Pacific/Samoa" | "Pacific/Tahiti" | "Pacific/Tarawa" | "Pacific/Tongatapu" | "Pacific/Truk" | "Pacific/Wake" | "Pacific/Wallis" | "Pacific/Yap" | "Poland" | "Portugal" | "PRC" | "PST8PDT" | "ROC" | "ROK" | "Singapore" | "Turkey" | "UCT" | "Universal" | "US/Alaska" | "US/Aleutian" | "US/Arizona" | "US/Central" | "US/East-Indiana" | "US/Eastern" | "US/Hawaii" | "US/Indiana-Starke" | "US/Michigan" | "US/Mountain" | "US/Pacific" | "US/Samoa" | "UTC" | "W-SU" | "WET" | "Zulu";
|
|
393
|
+
export type virtualDataPropsType = {
|
|
394
|
+
groups: GroupFeildsType[];
|
|
395
|
+
props: CalendarPropsType;
|
|
396
|
+
dailyHours: dailyHoursType;
|
|
397
|
+
handleDragOver: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
398
|
+
tasks: TasksType;
|
|
399
|
+
getTasks: (offset: string) => TasksType;
|
|
400
|
+
getTask: (offset: string, taskId: string) => TaskFeildsType | undefined;
|
|
401
|
+
addTask: (offset: string, task: TaskFeildsType) => void;
|
|
402
|
+
updateTask: (offset: string, taskId: string, task: TaskFeildsType) => void;
|
|
403
|
+
deleteTask: (offset: string, taskId: string) => void;
|
|
404
|
+
isValidTask: (task: TaskFeildsType) => boolean;
|
|
405
|
+
};
|
|
406
|
+
export type Task = TaskFeildsType;
|
|
407
|
+
export type TaskBucket = {
|
|
408
|
+
list: Task[];
|
|
409
|
+
indexMap: Record<string, number>;
|
|
410
|
+
sumOfTaskDuration: number;
|
|
411
|
+
};
|
|
412
|
+
export type TasksStore = {
|
|
413
|
+
buckets: Record<string, TaskBucket>;
|
|
414
|
+
dataLength: number;
|
|
415
|
+
taskCache: Record<string, Task[]>;
|
|
416
|
+
};
|
|
395
417
|
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Task, TaskFeildsType } from "../definitions";
|
|
2
|
+
export declare function useCalendarTask(hashScope: "week" | "group" | "day", timeZone?: string): {
|
|
3
|
+
tasks: {
|
|
4
|
+
buckets: Record<string, import("../definitions").TaskBucket>;
|
|
5
|
+
dataLength: number;
|
|
6
|
+
taskCache: Record<string, Task[]>;
|
|
7
|
+
};
|
|
8
|
+
addTask: (task: Task) => void;
|
|
9
|
+
getTasks: (hash: string) => Task[];
|
|
10
|
+
updateTask: (hash: string, taskId: string, updatedTask: Partial<Task>) => void;
|
|
11
|
+
deleteTask: (hash: string, taskId: string) => void;
|
|
12
|
+
cleanExpiredTasks: () => void;
|
|
13
|
+
cleanExpiredTasksByHash: (hash: string) => void;
|
|
14
|
+
isValidTask: (task: Task) => boolean;
|
|
15
|
+
getTask: (hash: string, taskId: string) => TaskFeildsType | undefined;
|
|
16
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TasksType } from "../definitions";
|
|
2
|
+
export declare const useData: (sliceIndex: number, itemsByLine: number, windowLines: number, tasks: TasksType, bottomBufferSize: number, topBufferSize: number) => {
|
|
3
|
+
visibleTasks: import("../definitions").TaskFeildsType[];
|
|
4
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
interface UseIntersectionObserverProps extends IntersectionObserverInit {
|
|
2
|
+
freezeOnceVisible?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useIntersectionObserver(elementRef: React.RefObject<Element | null>, { threshold, root, rootMargin, freezeOnceVisible, }?: UseIntersectionObserverProps): IntersectionObserverEntry | undefined;
|
|
5
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
export { default as Calendar } from './components/index';
|
|
2
2
|
export * from './lib/utils';
|
|
3
3
|
export * from './definitions/index';
|
|
4
|
+
export * from './hooks/useCalendarTask';
|
|
5
|
+
export * from './contexts/CalendarTaskContext';
|
|
6
|
+
export * from './components/TaskContainer/';
|
|
7
|
+
export * from './components/TaskContainer/TaskVirtual';
|
|
8
|
+
export * from './components/AddTask';
|
|
9
|
+
export * from './components/SumHoursContainer';
|
|
10
|
+
export * from './components/SumHoursHead';
|
|
11
|
+
export * from './components/GroupContainer';
|
|
12
|
+
export * from './components/VirtualGroupRow';
|
|
13
|
+
export * from './components/VirtualGroupRowDay';
|
|
14
|
+
export * from './components/DayContainer';
|
|
15
|
+
export * from './hooks/useCalendarDateState';
|
|
16
|
+
export * from './contexts/CalendarTaskContext';
|
|
@@ -28,24 +28,23 @@ export declare function getWeekDays(jump: number, timeZone?: TimeZone): {
|
|
|
28
28
|
* @param dateSelectionnee - The selected date.
|
|
29
29
|
* @returns The week difference in days.
|
|
30
30
|
*/
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function calculateWeekDifference(dateSelectionnee: Date, timeZone?: TimeZone): number;
|
|
32
32
|
/**
|
|
33
33
|
* Calculate the number of weeks since an arbitrary origin date (January 1, 2022).
|
|
34
34
|
* @param annee - The year.
|
|
35
35
|
* @param numeroSemaine - The week number.
|
|
36
36
|
* @returns The number of weeks since the origin date.
|
|
37
37
|
*/
|
|
38
|
-
export declare function getSessionStorageRecordForDragAndDrop(tasks: TasksType, positionDay: number, dropGroupId: string): {
|
|
38
|
+
export declare function getSessionStorageRecordForDragAndDrop(tasks: TasksType, positionDay: number, dropGroupId: string, getTask: (hash: string, taskId: string) => TaskFeildsType | undefined, hash: string): {
|
|
39
39
|
taskDropStart: number;
|
|
40
40
|
taskDropEnd: number;
|
|
41
41
|
taskDropDate: Date;
|
|
42
42
|
newTask: any;
|
|
43
|
-
newTasks: TasksType;
|
|
44
43
|
} | undefined;
|
|
45
44
|
export declare function compareWeekOffset(calendarDate: Date, weekOffset: number, taskDate: Date, timeZone?: TimeZone): boolean;
|
|
46
45
|
export declare const sumHoursByGroups: (groupId: string, tasks: TasksType | any, weekOffset: number, calendarDate: Date, timeZone?: TimeZone) => number;
|
|
47
46
|
export declare function saveTasksToLocalStorage(tasks: TasksType): void;
|
|
48
|
-
export declare const updateCalendarDateWithOffset: (offset: number,
|
|
47
|
+
export declare const updateCalendarDateWithOffset: (offset: number, timeZone?: TimeZone) => Date;
|
|
49
48
|
export declare const updateOffsetWithDateCalendar: (calendarDate: Date, timeZone?: TimeZone) => number;
|
|
50
49
|
export declare const millisecondsToHours: (milliseconds: number) => string;
|
|
51
50
|
export declare const checkDuplicates: (tasks: TasksType, taskStart: number, taskEnd: number, groupId: string) => boolean;
|
|
@@ -84,3 +83,8 @@ export declare function duplicateTasksForPeriod(periodStart: Date, periodEnd: Da
|
|
|
84
83
|
export declare function duplicateTaskForPeriod(periodStart: Date, periodEnd: Date, task: TaskFeildsType, ecartDay?: number, groupId?: string, taskExpiryDate?: Date): TasksType;
|
|
85
84
|
export declare const GetTimeRangeByDay: (start: number, end: number) => number[];
|
|
86
85
|
export declare function totalLabel(milliseconds: number): string;
|
|
86
|
+
export declare function getHash(weekOffset: number, groupId?: string, dayIndex?: number): {
|
|
87
|
+
week: string;
|
|
88
|
+
group: string;
|
|
89
|
+
day: string;
|
|
90
|
+
};
|