react-weekly-planning 1.0.33 → 1.0.34
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/lib/utils.js +0 -13
- package/lib/utils.ts +0 -14
- package/package.json +1 -8
- package/__tests__/page.test.js +0 -106
- package/__tests__/page.test.tsx +0 -129
- package/definition.txt +0 -319
- package/docs/global.html +0 -4983
- package/docs/index.html +0 -475
- package/docs/index.ts.html +0 -551
- package/docs/scripts/app.min.js +0 -1
- package/docs/scripts/linenumber.js +0 -26
- package/docs/scripts/search.js +0 -39
- package/docs/styles/app.min.css +0 -1
- package/docs/styles/iframe.css +0 -13
- package/docs/styles/prettify-jsdoc.css +0 -111
- package/docs/styles/prettify-tomorrow.css +0 -132
- package/docs/styles/reset.css +0 -44
- package/myJsDoc.js +0 -0
- package/out/index.html +0 -129
- package/out/scripts/app.min.js +0 -1
- package/out/scripts/linenumber.js +0 -26
- package/out/scripts/search.js +0 -39
- package/out/styles/app.min.css +0 -1
- package/out/styles/iframe.css +0 -13
- package/out/styles/prettify-jsdoc.css +0 -111
- package/out/styles/prettify-tomorrow.css +0 -132
- package/out/styles/reset.css +0 -44
package/lib/utils.js
CHANGED
|
@@ -9,7 +9,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import moment from "moment";
|
|
13
12
|
import dayjs from "dayjs";
|
|
14
13
|
import { v4 as uuidv4 } from "uuid";
|
|
15
14
|
export const DAY_IN_MILLISECONDS = 86400000;
|
|
@@ -184,18 +183,6 @@ export function calculerEcartSemaine(dateSelectionnee, timeZone) {
|
|
|
184
183
|
* @param numeroSemaine - The week number.
|
|
185
184
|
* @returns The number of weeks since the origin date.
|
|
186
185
|
*/
|
|
187
|
-
function semainesDepuisOrigine(annee, numeroSemaine) {
|
|
188
|
-
const dateActuelle = new Date();
|
|
189
|
-
const dateOrigine = new Date(dateActuelle.getFullYear() - 2, 0, 1);
|
|
190
|
-
const anneeOrigine = dateOrigine.getFullYear();
|
|
191
|
-
const numeroSemaineOrigine = getWeekNumber(dateOrigine);
|
|
192
|
-
let nombreSemaines = 0;
|
|
193
|
-
for (let i = anneeOrigine; i < annee; i++) {
|
|
194
|
-
nombreSemaines += moment().year(i).isoWeeksInYear();
|
|
195
|
-
}
|
|
196
|
-
nombreSemaines += numeroSemaine - numeroSemaineOrigine;
|
|
197
|
-
return nombreSemaines;
|
|
198
|
-
}
|
|
199
186
|
export function getSessionStorageRecordForDragAndDrop(tasks, positionDay, dropGroupId) {
|
|
200
187
|
const dragtaskId = window.sessionStorage.getItem("calendardragtaskId");
|
|
201
188
|
const dragtaskStart = window.sessionStorage.getItem("calendardragtaskStart");
|
package/lib/utils.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import moment from "moment";
|
|
2
1
|
import dayjs from "dayjs";
|
|
3
2
|
import { v4 as uuidv4 } from "uuid";
|
|
4
3
|
import {
|
|
@@ -210,20 +209,7 @@ export function calculerEcartSemaine(dateSelectionnee: Date, timeZone?: TimeZone
|
|
|
210
209
|
* @param numeroSemaine - The week number.
|
|
211
210
|
* @returns The number of weeks since the origin date.
|
|
212
211
|
*/
|
|
213
|
-
function semainesDepuisOrigine(annee: number, numeroSemaine: number): number {
|
|
214
|
-
const dateActuelle = new Date();
|
|
215
|
-
const dateOrigine = new Date(dateActuelle.getFullYear() - 2, 0, 1);
|
|
216
|
-
const anneeOrigine = dateOrigine.getFullYear();
|
|
217
|
-
const numeroSemaineOrigine = getWeekNumber(dateOrigine);
|
|
218
|
-
|
|
219
|
-
let nombreSemaines = 0;
|
|
220
|
-
for (let i = anneeOrigine; i < annee; i++) {
|
|
221
|
-
nombreSemaines += moment().year(i).isoWeeksInYear();
|
|
222
|
-
}
|
|
223
|
-
nombreSemaines += numeroSemaine - numeroSemaineOrigine;
|
|
224
212
|
|
|
225
|
-
return nombreSemaines;
|
|
226
|
-
}
|
|
227
213
|
|
|
228
214
|
export function getSessionStorageRecordForDragAndDrop(
|
|
229
215
|
tasks: TasksType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-weekly-planning",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest --env=jsdom",
|
|
@@ -41,13 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/types": "^7.29.0",
|
|
43
43
|
"@types/babel__generator": "^7.27.0",
|
|
44
|
-
"axios": "^1.13.6",
|
|
45
44
|
"dayjs": "^1.11.19",
|
|
46
|
-
"ical": "^0.8.0",
|
|
47
|
-
"ics-to-json": "^2.0.2",
|
|
48
|
-
"moment": "^2.30.1",
|
|
49
45
|
"react-window": "^2.2.7",
|
|
50
|
-
"sass": "^1.97.3",
|
|
51
46
|
"ts-node": "^10.9.2",
|
|
52
47
|
"uuid": "^13.0.0"
|
|
53
48
|
},
|
|
@@ -60,12 +55,10 @@
|
|
|
60
55
|
"@testing-library/jest-dom": "^6.9.1",
|
|
61
56
|
"@testing-library/react": "^16.3.2",
|
|
62
57
|
"@types/babel__core": "^7.20.5",
|
|
63
|
-
"@types/ical": "^0.8.3",
|
|
64
58
|
"@types/jest": "^30.0.0",
|
|
65
59
|
"@types/react": "^19.2.14",
|
|
66
60
|
"@types/react-window": "^2.0.0",
|
|
67
61
|
"babel-jest": "^30.2.0",
|
|
68
|
-
"docdash": "^2.0.2",
|
|
69
62
|
"jest": "^30.2.0",
|
|
70
63
|
"jest-environment-jsdom": "^30.2.0",
|
|
71
64
|
"react": "^19.2.4",
|
package/__tests__/page.test.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
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
|
-
});
|
package/__tests__/page.test.tsx
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
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];
|
|
18
|
-
|
|
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();
|
|
36
|
-
|
|
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
|
-
};
|
|
50
|
-
|
|
51
|
-
tasks.push(task);
|
|
52
|
-
|
|
53
|
-
if (!event.start) return [];
|
|
54
|
-
|
|
55
|
-
// Gestion des occurrences récurrentes
|
|
56
|
-
if (event.rrule) {
|
|
57
|
-
const occurrences = event.rrule.between(
|
|
58
|
-
event.start,
|
|
59
|
-
taskExpiryDate || new Date()
|
|
60
|
-
);
|
|
61
|
-
|
|
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
|
-
}
|
|
74
|
-
|
|
75
|
-
return tasks;
|
|
76
|
-
}
|
|
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";
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
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;
|
|
121
|
-
}
|
|
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"));
|
|
129
|
-
});
|
package/definition.txt
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
definition
|
|
2
|
-
export type GroupPropsType = {
|
|
3
|
-
label?: string;
|
|
4
|
-
imageUrl?: string;
|
|
5
|
-
id?: string;
|
|
6
|
-
groupRender?: GroupRenderType;
|
|
7
|
-
className?: string;
|
|
8
|
-
style?: React.CSSProperties | undefined;
|
|
9
|
-
currentGroup: GroupFeildsType;
|
|
10
|
-
handleClickGroup?: (currentGroup: GroupFeildsType) => void;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type GroupRiquiredFieldsType = {
|
|
14
|
-
label?: string;
|
|
15
|
-
imageUrl?: string;
|
|
16
|
-
id: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type GroupAdditionalFieldsType = Record<any, unknown>;
|
|
20
|
-
export type GroupFeildsType = GroupRiquiredFieldsType &
|
|
21
|
-
GroupAdditionalFieldsType;
|
|
22
|
-
|
|
23
|
-
export type GroupRenderType = ({
|
|
24
|
-
id,
|
|
25
|
-
label,
|
|
26
|
-
imageUrl,
|
|
27
|
-
currentGroup,
|
|
28
|
-
}: {
|
|
29
|
-
id?: string;
|
|
30
|
-
label?: string;
|
|
31
|
-
imageUrl?: string;
|
|
32
|
-
currentGroup?: GroupFeildsType;
|
|
33
|
-
}) => React.ReactNode;
|
|
34
|
-
export type GroupComponentPropsType = {
|
|
35
|
-
groupRender?: GroupRenderType;
|
|
36
|
-
className?: string;
|
|
37
|
-
style?: React.CSSProperties | undefined;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export type TaskRenderType = ({
|
|
41
|
-
taskId,
|
|
42
|
-
taskStart,
|
|
43
|
-
taskEnd,
|
|
44
|
-
task,
|
|
45
|
-
taskDate,
|
|
46
|
-
groupId,
|
|
47
|
-
dayIndex,
|
|
48
|
-
handleDragTask,
|
|
49
|
-
}: {
|
|
50
|
-
taskStart: number;
|
|
51
|
-
taskEnd: number;
|
|
52
|
-
task: string;
|
|
53
|
-
taskDate: Date;
|
|
54
|
-
groupId: string;
|
|
55
|
-
dayIndex: number;
|
|
56
|
-
taskId: string;
|
|
57
|
-
currentTask?: TaskFeildsType;
|
|
58
|
-
handleDragTask?: (
|
|
59
|
-
event: React.DragEvent<HTMLDivElement>,
|
|
60
|
-
taskId: string,
|
|
61
|
-
taskStart: number,
|
|
62
|
-
taskEnd: number,
|
|
63
|
-
task: string,
|
|
64
|
-
taskDate: Date,
|
|
65
|
-
groupId: string,
|
|
66
|
-
dayIndex: number
|
|
67
|
-
) => void;
|
|
68
|
-
}) => React.ReactNode;
|
|
69
|
-
|
|
70
|
-
export type DayRenderType = ({
|
|
71
|
-
dayIndex,
|
|
72
|
-
day,
|
|
73
|
-
dayOfTheMonth,
|
|
74
|
-
dayMonth,
|
|
75
|
-
dayYear,
|
|
76
|
-
}: {
|
|
77
|
-
dayIndex?: number;
|
|
78
|
-
day?: string;
|
|
79
|
-
dayOfTheMonth?: number;
|
|
80
|
-
dayMonth?: string;
|
|
81
|
-
dayYear?: number;
|
|
82
|
-
}) => React.ReactNode;
|
|
83
|
-
|
|
84
|
-
export type DaysPropsType = {
|
|
85
|
-
dayRender: DayRenderType;
|
|
86
|
-
className?: string;
|
|
87
|
-
style?: React.CSSProperties | undefined;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export type DayPropsType = {
|
|
91
|
-
dayIndex?: number;
|
|
92
|
-
day?: string;
|
|
93
|
-
dayOfTheMonth?: number;
|
|
94
|
-
dayRender?: DayRenderType;
|
|
95
|
-
dayMonth?: string;
|
|
96
|
-
dayYear?: number;
|
|
97
|
-
className?: string;
|
|
98
|
-
style?: React.CSSProperties | undefined;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export type AddTaskRenderType = ({
|
|
102
|
-
dayIndex,
|
|
103
|
-
groupId,
|
|
104
|
-
dayInfo,
|
|
105
|
-
}: {
|
|
106
|
-
dayIndex?: number;
|
|
107
|
-
groupId?: string;
|
|
108
|
-
dayInfo: dayInfoType;
|
|
109
|
-
}) => React.ReactNode;
|
|
110
|
-
|
|
111
|
-
export type CalendarPropsType = {
|
|
112
|
-
/**
|
|
113
|
-
* Props for the Calendar component.
|
|
114
|
-
*/
|
|
115
|
-
/** Offset for the week (e.g., -7 for last week, 0 for current week, 7 for next week). */
|
|
116
|
-
weekOffset: number;
|
|
117
|
-
/** Array of group data to be displayed in the calendar. [{id*:string,label:string,imageUrl:string,...the fields of your choice}] id field is required */
|
|
118
|
-
groups: GroupFeildsType[];
|
|
119
|
-
/** Additional class names for the calendar component. */
|
|
120
|
-
className?: string;
|
|
121
|
-
/** Additional styles for the calendar component. */
|
|
122
|
-
style?: React.CSSProperties | undefined;
|
|
123
|
-
/** The current date to display in the calendar. */
|
|
124
|
-
date: Date;
|
|
125
|
-
/** Custom render function for a group.
|
|
126
|
-
* const GroupRender=({
|
|
127
|
-
id,
|
|
128
|
-
label,
|
|
129
|
-
imageUrl,
|
|
130
|
-
currentGroup,
|
|
131
|
-
})=> {
|
|
132
|
-
your render
|
|
133
|
-
}
|
|
134
|
-
*/
|
|
135
|
-
groupRender?: GroupRenderType;
|
|
136
|
-
/** Custom render function for a day.
|
|
137
|
-
* const DayRender=(dayIndex,
|
|
138
|
-
day,
|
|
139
|
-
dayOfTheMonth,
|
|
140
|
-
dayMonth,
|
|
141
|
-
dayYear)=> {
|
|
142
|
-
your render
|
|
143
|
-
}
|
|
144
|
-
*/
|
|
145
|
-
dayRender?: DayRenderType;
|
|
146
|
-
/** Custom render function for a task.
|
|
147
|
-
* const TasKRender=({
|
|
148
|
-
taskId,
|
|
149
|
-
taskStart,
|
|
150
|
-
taskEnd,
|
|
151
|
-
task,
|
|
152
|
-
taskDate,
|
|
153
|
-
groupId,
|
|
154
|
-
dayIndex,
|
|
155
|
-
handleDragTask,
|
|
156
|
-
})=> {
|
|
157
|
-
your render
|
|
158
|
-
}
|
|
159
|
-
*/
|
|
160
|
-
taskRender?: TaskRenderType;
|
|
161
|
-
/** Additional styles for the rows. */
|
|
162
|
-
rowsStyle?: React.CSSProperties | undefined;
|
|
163
|
-
/** Additional class names for the rows. */
|
|
164
|
-
rowsClassName?: string;
|
|
165
|
-
/** Additional styles for the group columns. */
|
|
166
|
-
groupsColsStyle?: React.CSSProperties | undefined;
|
|
167
|
-
/** Additional class names for the group columns. */
|
|
168
|
-
groupsColsClassName?: string;
|
|
169
|
-
/** Additional styles for the day columns. */
|
|
170
|
-
daysColsStyle?: React.CSSProperties | undefined;
|
|
171
|
-
daysColsClassName?: string;
|
|
172
|
-
addTaskClassName?: string;
|
|
173
|
-
addTaskStyle?: React.CSSProperties | undefined;
|
|
174
|
-
/** Additional class names for the groups. */
|
|
175
|
-
groupClassName?: string;
|
|
176
|
-
groupStyle?: React.CSSProperties | undefined;
|
|
177
|
-
dayClassName?: string;
|
|
178
|
-
dayStyle?: React.CSSProperties | undefined;
|
|
179
|
-
taskContainerStyle?: React.CSSProperties | undefined;
|
|
180
|
-
taskContainerClassName?: string;
|
|
181
|
-
groupHeadContainerStyle?: React.CSSProperties | undefined;
|
|
182
|
-
groupHeadContainerClassName?: string;
|
|
183
|
-
sumHoursContainerStyle?: React.CSSProperties | undefined;
|
|
184
|
-
sumHoursContainerClassName?: string;
|
|
185
|
-
sumHoursHeadStyle?: React.CSSProperties | undefined;
|
|
186
|
-
sumHoursHeadClassName?: string;
|
|
187
|
-
|
|
188
|
-
handleAddTask?: (
|
|
189
|
-
dayIndex: number,
|
|
190
|
-
groupId: string,
|
|
191
|
-
dayInfo: dayInfoType
|
|
192
|
-
) => void;
|
|
193
|
-
addTaskRender?: AddTaskRenderType;
|
|
194
|
-
tasks?: TasksType;
|
|
195
|
-
handleDragTask?: (
|
|
196
|
-
event: React.DragEvent<HTMLDivElement>,
|
|
197
|
-
taskId: string,
|
|
198
|
-
taskStart: number,
|
|
199
|
-
taskEnd: number,
|
|
200
|
-
task: string,
|
|
201
|
-
taskDate: Date,
|
|
202
|
-
groupId: string,
|
|
203
|
-
dayIndex: number
|
|
204
|
-
) => void;
|
|
205
|
-
handleDropTask?: (
|
|
206
|
-
event: React.DragEvent<HTMLTableDataCellElement>,
|
|
207
|
-
taskStart: number,
|
|
208
|
-
taskEnd: number,
|
|
209
|
-
taskDate: Date,
|
|
210
|
-
groupId: string,
|
|
211
|
-
dayIndex: number,
|
|
212
|
-
newTask: TaskFeildsType,
|
|
213
|
-
newTasts: TasksType
|
|
214
|
-
) => void;
|
|
215
|
-
handleDragTaskEnd?: handleDragTaskEndType;
|
|
216
|
-
groupsHeadRender?: GroupsHeadRenderType;
|
|
217
|
-
sumHoursRender?: SumHoursRenderType;
|
|
218
|
-
sumHoursHeadRender?: SumHoursHeadRenderType;
|
|
219
|
-
handleClickTask?: (currentTask: TaskFeildsType) => void;
|
|
220
|
-
handleClickGroup?: (currentGroup: GroupFeildsType) => void;
|
|
221
|
-
};
|
|
222
|
-
export type StyleType = React.CSSProperties | undefined;
|
|
223
|
-
export type AddTaskPropsType = {
|
|
224
|
-
dayIndex: number;
|
|
225
|
-
groupId: string;
|
|
226
|
-
addTaskStyle?: StyleType;
|
|
227
|
-
addTaskClassName?: string;
|
|
228
|
-
addTaskRender?: AddTaskRenderType;
|
|
229
|
-
dayInfo: dayInfoType;
|
|
230
|
-
handleAddTask?: (
|
|
231
|
-
dayIndex: number,
|
|
232
|
-
groupId: string,
|
|
233
|
-
dayInfo: dayInfoType
|
|
234
|
-
) => void;
|
|
235
|
-
};
|
|
236
|
-
export type dayInfoType = {
|
|
237
|
-
positionDay: number;
|
|
238
|
-
day: Date;
|
|
239
|
-
start: number;
|
|
240
|
-
end: number;
|
|
241
|
-
};
|
|
242
|
-
export type TaskType = {
|
|
243
|
-
taskStart: number;
|
|
244
|
-
taskEnd: number;
|
|
245
|
-
task: string;
|
|
246
|
-
taskDate: Date;
|
|
247
|
-
groupId: string;
|
|
248
|
-
dayIndex: number;
|
|
249
|
-
taskId: string;
|
|
250
|
-
};
|
|
251
|
-
export type TaskContainerPropsType = {
|
|
252
|
-
taskStart: number;
|
|
253
|
-
taskEnd: number;
|
|
254
|
-
task: string;
|
|
255
|
-
taskDate: Date;
|
|
256
|
-
groupId: string;
|
|
257
|
-
dayIndex: number;
|
|
258
|
-
taskId: string;
|
|
259
|
-
className?: string;
|
|
260
|
-
style?: React.CSSProperties | undefined;
|
|
261
|
-
handleDragTask?: (
|
|
262
|
-
event: React.DragEvent<HTMLDivElement>,
|
|
263
|
-
taskId: string,
|
|
264
|
-
taskStart: number,
|
|
265
|
-
taskEnd: number,
|
|
266
|
-
task: string,
|
|
267
|
-
taskDate: Date,
|
|
268
|
-
groupId: string,
|
|
269
|
-
dayIndex: number
|
|
270
|
-
) => void;
|
|
271
|
-
taskRender?: TaskRenderType;
|
|
272
|
-
handleDragTaskEnd?: handleDragTaskEndType;
|
|
273
|
-
currentTask: TaskFeildsType;
|
|
274
|
-
handleClickTask?: (currentTask: TaskFeildsType) => void;
|
|
275
|
-
};
|
|
276
|
-
type GroupsHeadRenderType = () => React.ReactNode;
|
|
277
|
-
export type GroupsHeadContainerPropsType = {
|
|
278
|
-
groupsHeadRender?: GroupsHeadRenderType;
|
|
279
|
-
style?: React.CSSProperties | undefined;
|
|
280
|
-
className?: string;
|
|
281
|
-
};
|
|
282
|
-
type SumHoursHeadRenderType = () => React.ReactNode;
|
|
283
|
-
export type SumHoursHeadContainerPropsType = {
|
|
284
|
-
sumHoursHeadRender?: SumHoursHeadRenderType;
|
|
285
|
-
style?: React.CSSProperties | undefined;
|
|
286
|
-
className?: string;
|
|
287
|
-
};
|
|
288
|
-
type TaskAdditionalFieldsType = Record<any, unknown>;
|
|
289
|
-
export type TaskFeildsType = TaskType & TaskAdditionalFieldsType;
|
|
290
|
-
|
|
291
|
-
export type TasksType = TaskFeildsType[];
|
|
292
|
-
export type handleDragTaskEndType = (
|
|
293
|
-
event: React.DragEvent<HTMLDivElement>
|
|
294
|
-
) => void;
|
|
295
|
-
export type SumHoursRenderType = ({
|
|
296
|
-
groupId,
|
|
297
|
-
tasks,
|
|
298
|
-
weekOffset,
|
|
299
|
-
calendarDate,
|
|
300
|
-
sumHoursByGroups,
|
|
301
|
-
}: {
|
|
302
|
-
groupId: string;
|
|
303
|
-
tasks: TasksType | any;
|
|
304
|
-
weekOffset: number;
|
|
305
|
-
calendarDate: Date;
|
|
306
|
-
sumHoursByGroups: number;
|
|
307
|
-
}) => React.ReactNode;
|
|
308
|
-
|
|
309
|
-
export type SumHoursContainerPropsType = {
|
|
310
|
-
groupId: string;
|
|
311
|
-
tasks: TasksType | any;
|
|
312
|
-
weekOffset: number;
|
|
313
|
-
calendarDate: Date;
|
|
314
|
-
sumHoursByGroups: number;
|
|
315
|
-
sumHoursRender?: SumHoursRenderType;
|
|
316
|
-
style?: React.CSSProperties | undefined;
|
|
317
|
-
className?: string;
|
|
318
|
-
};
|
|
319
|
-
https://www.linkedin.com/in/patrick-aime?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app
|