react-weekly-planning 1.0.34 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/{components → dist/components}/CalendarForday.js +1 -1
- package/{index.js → dist/components/index.js} +2 -3
- package/dist/index.js +7 -0
- package/dist/types/components/AddTask/index.d.ts +3 -0
- package/dist/types/components/CalendarForWeek.d.ts +4 -0
- package/dist/types/components/CalendarForday.d.ts +5 -0
- package/dist/types/components/DayContainer/index.d.ts +3 -0
- package/dist/types/components/GroupContainer/index.d.ts +3 -0
- package/dist/types/components/GroupsHeadContainer/index.d.ts +3 -0
- package/dist/types/components/SumHoursContainer/index.d.ts +3 -0
- package/dist/types/components/SumHoursHead/index.d.ts +3 -0
- package/dist/types/components/TaskContainer/index.d.ts +3 -0
- package/dist/types/components/TaskList/index.d.ts +5 -0
- package/{index.tsx → dist/types/components/index.d.ts} +65 -77
- package/dist/types/contexts/CalendarContext.d.ts +15 -0
- package/dist/types/definitions/index.d.ts +395 -0
- package/dist/types/hooks/useCalendarDateState.d.ts +6 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/lib/slyles.d.ts +4 -0
- package/dist/types/lib/utils.d.ts +80 -0
- package/package.json +20 -2
- package/assets/planning-screenshot.png +0 -0
- package/assets/planning-screenshot.webp +0 -0
- package/babel.config.js +0 -1
- package/components/AddTask/index.tsx +0 -43
- package/components/CalendarForWeek.tsx +0 -233
- package/components/CalendarForday.tsx +0 -131
- package/components/DayContainer/index.tsx +0 -36
- package/components/GroupContainer/index.tsx +0 -42
- package/components/GroupsHeadContainer/index.tsx +0 -19
- package/components/SumHoursContainer/index.tsx +0 -39
- package/components/SumHoursHead/index.tsx +0 -22
- package/components/TaskContainer/index.tsx +0 -86
- package/components/TaskList/index.tsx +0 -13
- package/contexts/CalendarContext.tsx +0 -38
- package/definitions/index.ts +0 -1084
- package/hooks/useCalendarDateState.ts +0 -45
- package/jest.config.js +0 -9
- package/jest.config.ts +0 -10
- package/jsdoc.json +0 -26
- package/lib/slyles.ts +0 -25
- package/lib/utils.ts +0 -976
- /package/{components → dist/components}/AddTask/index.js +0 -0
- /package/{components → dist/components}/CalendarForWeek.js +0 -0
- /package/{components → dist/components}/DayContainer/index.js +0 -0
- /package/{components → dist/components}/GroupContainer/index.js +0 -0
- /package/{components → dist/components}/GroupsHeadContainer/index.js +0 -0
- /package/{components → dist/components}/SumHoursContainer/index.js +0 -0
- /package/{components → dist/components}/SumHoursHead/index.js +0 -0
- /package/{components → dist/components}/TaskContainer/index.js +0 -0
- /package/{components → dist/components}/TaskList/index.js +0 -0
- /package/{style.css → dist/components/style.css} +0 -0
- /package/{contexts → dist/contexts}/CalendarContext.js +0 -0
- /package/{definitions → dist/definitions}/index.js +0 -0
- /package/{hooks → dist/hooks}/useCalendarDateState.js +0 -0
- /package/{lib → dist/lib}/slyles.js +0 -0
- /package/{lib → dist/lib}/utils.js +0 -0
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ It is possible to use either Weekoffset or Date, or even both simultaneously.
|
|
|
118
118
|
|
|
119
119
|
**Example**:
|
|
120
120
|
```jsx
|
|
121
|
-
import {getSavedTasks} from "react-weekly-planning
|
|
121
|
+
import {getSavedTasks} from "react-weekly-planning";
|
|
122
122
|
const [tasks,setTasks]=useState([])
|
|
123
123
|
|
|
124
124
|
useEffect(()=>{
|
|
@@ -137,7 +137,7 @@ Here is a complete, minimal example showing how to set up the `Calendar` with si
|
|
|
137
137
|
```tsx
|
|
138
138
|
import React, { useState } from "react";
|
|
139
139
|
import Calendar from "react-pweekly-planning"; // Verify your exact import path based on package.json
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
|
|
142
142
|
const App = () => {
|
|
143
143
|
const [date] = useState(new Date());
|
|
@@ -263,7 +263,7 @@ Props for the Calendar component.
|
|
|
263
263
|
|
|
264
264
|
**Example**:
|
|
265
265
|
```javascript
|
|
266
|
-
import {updateOffsetWithDateCalendar} from "react-weekly-planning
|
|
266
|
+
import {updateOffsetWithDateCalendar} from "react-weekly-planning";
|
|
267
267
|
const offset = updateOffsetWithDateCalendar(new Date());
|
|
268
268
|
console.log(offset); // Logs the week offset for the given date
|
|
269
269
|
```
|
|
@@ -277,7 +277,7 @@ Props for the Calendar component.
|
|
|
277
277
|
|
|
278
278
|
**Example**:
|
|
279
279
|
```javascript
|
|
280
|
-
import {millisecondsToHours} from "react-weekly-planning
|
|
280
|
+
import {millisecondsToHours} from "react-weekly-planning";
|
|
281
281
|
const formattedTime = millisecondsToHours(1716905215397);
|
|
282
282
|
console.log(formattedTime); // Logs the formatted time for 14h06
|
|
283
283
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "
|
|
2
|
+
import "./style.css";
|
|
3
3
|
import { memo, useEffect } from "react";
|
|
4
4
|
import { compareWeekOffset, saveTasksToLocalStorage } from "../lib/utils";
|
|
5
5
|
import useCalendarDateState from "../hooks/useCalendarDateState";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import "./style.css";
|
|
3
|
-
import CalendarForWeek from "./
|
|
4
|
-
import CalendarForDay from "./
|
|
3
|
+
import CalendarForWeek from "./CalendarForWeek";
|
|
4
|
+
import CalendarForDay from "./CalendarForday";
|
|
5
5
|
/**
|
|
6
6
|
* Calendar component to display tasks and groups in a weekly view.
|
|
7
7
|
*
|
|
@@ -67,4 +67,3 @@ const Calendar = (props) => {
|
|
|
67
67
|
return (_jsx(_Fragment, { children: props.scope === "day" ? _jsx(CalendarForDay, Object.assign({}, props)) : _jsx(CalendarForWeek, Object.assign({}, props)) }));
|
|
68
68
|
};
|
|
69
69
|
export default Calendar;
|
|
70
|
-
export { CalendarForDay };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
// 1. Tu exportes ton composant principal
|
|
3
|
+
export { default as Calendar } from './components/index';
|
|
4
|
+
// 2. Tu exportes tout le contenu de ton fichier utils
|
|
5
|
+
export * from './lib/utils';
|
|
6
|
+
export * from './definitions/index';
|
|
7
|
+
// OU exportes des éléments spécifiques : export { formatTime, generateSlots } from './utils';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AddTaskPropsType } from "../../definitions";
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<({ currentGroup, handleAddTask, addTaskRender, dayInfo, addTaskStyle, addTaskClassName, }: AddTaskPropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CalendarTablePropsType } from "../definitions";
|
|
2
|
+
declare function CalendarForWeek(props: CalendarTablePropsType): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<typeof CalendarForWeek>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "./style.css";
|
|
2
|
+
import { CalendarTablePropsType } from "../definitions";
|
|
3
|
+
declare function CalendarForDay(props: CalendarTablePropsType): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const _default: import("react").MemoExoticComponent<typeof CalendarForDay>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DayPropsType } from "../../definitions";
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<({ dayIndex, dayOfTheMonth, day, dayMonth, dayYear, dayRender, className, style, }: DayPropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SumHoursContainerPropsType } from "../../definitions";
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<({ groupId, tasks, weekOffset, calendarDate, sumHoursByGroups, sumHoursRender, className, style, }: SumHoursContainerPropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SumHoursHeadContainerPropsType } from "../../definitions";
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<({ sumHoursHeadRender, className, style, }: SumHoursHeadContainerPropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TaskContainerPropsType } from "../../definitions";
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<({ handleDragTask, taskRender, handleDragTaskEnd, style, className, currentTask, handleClickTask, }: TaskContainerPropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -1,77 +1,65 @@
|
|
|
1
|
-
import "./style.css";
|
|
2
|
-
import { CalendarPropsType } from "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param {
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {React.
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {(
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {React.CSSProperties} [props.
|
|
18
|
-
* @param {string} [props.
|
|
19
|
-
* @param {React.CSSProperties} [props.
|
|
20
|
-
* @param {string} [props.
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {string} [props.
|
|
24
|
-
* @param {React.CSSProperties} [props.
|
|
25
|
-
* @param {string} [props.
|
|
26
|
-
* @param {React.CSSProperties} [props.
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {React.CSSProperties} [props.
|
|
30
|
-
* @param {string} [props.
|
|
31
|
-
* @param {React.CSSProperties} [props.
|
|
32
|
-
* @param {string} [props.
|
|
33
|
-
* @param {React.CSSProperties} [props.
|
|
34
|
-
* @param {string} [props.
|
|
35
|
-
* @param {
|
|
36
|
-
* @param {
|
|
37
|
-
* @param {
|
|
38
|
-
* @param {(
|
|
39
|
-
* @param {TasksType} props.
|
|
40
|
-
* @param {(event: React.DragEvent<HTMLDivElement
|
|
41
|
-
* @param {(
|
|
42
|
-
* @param {(
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param {() =>
|
|
58
|
-
* @param {
|
|
59
|
-
* @param {
|
|
60
|
-
* @param {
|
|
61
|
-
* @param {React.CSSProperties} [props.
|
|
62
|
-
* @param {string} [props.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const Calendar = (props: CalendarPropsType) => {
|
|
68
|
-
return (
|
|
69
|
-
<>
|
|
70
|
-
{props.scope === "day" ? <CalendarForDay {...props} /> : <CalendarForWeek {...props} />}
|
|
71
|
-
</>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default Calendar;
|
|
76
|
-
|
|
77
|
-
export { CalendarForDay };
|
|
1
|
+
import "./style.css";
|
|
2
|
+
import { CalendarPropsType } from "../definitions";
|
|
3
|
+
/**
|
|
4
|
+
* Calendar component to display tasks and groups in a weekly view.
|
|
5
|
+
*
|
|
6
|
+
* @param {CalendarPropsType} props - The props for the Calendar component.
|
|
7
|
+
* @param {number} [props.weekOffset] - Offset for the week (e.g., -7 for last week, 0 for current week, 7 for next week).
|
|
8
|
+
* @param {GroupFeildsType[]} props.groups - Array of group data to be displayed in the calendar.
|
|
9
|
+
* @param {string} [props.className] - Additional class names for the calendar component.
|
|
10
|
+
* @param {React.CSSProperties} [props.style] - Additional styles for the calendar component.
|
|
11
|
+
* @param {Date} props.date - The current date to display in the calendar.
|
|
12
|
+
* @param {(currentGroup: { currentGroup: GroupFeildsType }) => React.ReactNode} [props.groupRender] - Custom render function for a group.
|
|
13
|
+
* @param {({ dayIndex, day, dayOfTheMonth, dayMonth, dayYear }: { dayIndex: number; day: string; dayOfTheMonth: number; dayMonth: string; dayYear: number }) => React.ReactNode} [props.dayRender] - Custom render function for a day.
|
|
14
|
+
* @param {(currentTask: { currentTask: TaskFeildsType }) => React.ReactNode} [props.taskRender] - Custom render function for a task.
|
|
15
|
+
* @param {React.CSSProperties} [props.rowsStyle] - Additional styles for the rows.
|
|
16
|
+
* @param {string} [props.rowsClassName] - Additional class names for the rows.
|
|
17
|
+
* @param {React.CSSProperties} [props.groupsColsStyle] - Additional styles for the group columns.
|
|
18
|
+
* @param {string} [props.groupsColsClassName] - Additional class names for the group columns.
|
|
19
|
+
* @param {React.CSSProperties} [props.daysColsStyle] - Additional styles for the day columns.
|
|
20
|
+
* @param {string} [props.daysColsClassName] - Additional class names for the day columns.
|
|
21
|
+
* @param {string} [props.addTaskClassName] - Additional class names for the add-task button.
|
|
22
|
+
* @param {React.CSSProperties} [props.addTaskStyle] - Additional styles for the add-task button.
|
|
23
|
+
* @param {string} [props.groupContainerClassName] - Additional class names for the group containers.
|
|
24
|
+
* @param {React.CSSProperties} [props.groupContainerStyle] - Additional styles for the group containers.
|
|
25
|
+
* @param {string} [props.dayClassName] - Additional class names for the day elements.
|
|
26
|
+
* @param {React.CSSProperties} [props.dayStyle] - Additional styles for the day elements.
|
|
27
|
+
* @param {React.CSSProperties} [props.taskContainerStyle] - Additional styles for the task container.
|
|
28
|
+
* @param {string} [props.taskContainerClassName] - Additional class names for the task container.
|
|
29
|
+
* @param {React.CSSProperties} [props.groupHeadContainerStyle] - Additional styles for the group header container.
|
|
30
|
+
* @param {string} [props.groupHeadContainerClassName] - Additional class names for the group header container.
|
|
31
|
+
* @param {React.CSSProperties} [props.sumHoursContainerStyle] - Additional styles for the sum-of-hours container.
|
|
32
|
+
* @param {string} [props.sumHoursContainerClassName] - Additional class names for the sum-of-hours container.
|
|
33
|
+
* @param {React.CSSProperties} [props.sumHoursHeadStyle] - Additional styles for the sum-of-hours header.
|
|
34
|
+
* @param {string} [props.sumHoursHeadClassName] - Additional class names for the sum-of-hours header.
|
|
35
|
+
* @param {(currentGroup: GroupFeildsType, dayInfo: dayInfoType) => void} [props.handleAddTask] - Handler function for adding a new task.
|
|
36
|
+
* @param {({ currentGroup, dayInfo }: { currentGroup: GroupFeildsType; dayInfo: dayInfoType }) => React.ReactNode} [props.addTaskRender] - Custom render function for adding a task.
|
|
37
|
+
* @param {TasksType} props.tasks - Array of tasks to be displayed in the calendar.
|
|
38
|
+
* @param {(event: React.DragEvent<HTMLDivElement>, currentTask: TaskFeildsType) => void} [props.handleDragTask] - Handler function for dragging a task.
|
|
39
|
+
* @param {(event: React.DragEvent<HTMLDivElement>, taskStart: number, taskEnd: number, taskDate: Date, groupId: string, dayIndex: number, newTask: TaskFeildsType, newTasks: TasksType) => void} [props.handleDropTask] - Handler function for dropping a task.
|
|
40
|
+
* @param {(event: React.DragEvent<HTMLDivElement>) => void} [props.handleDragTaskEnd] - Handler function for ending the drag of a task.
|
|
41
|
+
* @param {() => React.ReactNode} [props.groupsHeadRender] - Custom render function for the groups header.
|
|
42
|
+
* @param {({
|
|
43
|
+
* groupId,
|
|
44
|
+
* tasks,
|
|
45
|
+
* weekOffset,
|
|
46
|
+
* calendarDate,
|
|
47
|
+
* sumHoursByGroups
|
|
48
|
+
* }: {
|
|
49
|
+
* groupId: string;
|
|
50
|
+
* tasks: TasksType;
|
|
51
|
+
* weekOffset: number;
|
|
52
|
+
* calendarDate: Date;
|
|
53
|
+
* sumHoursByGroups: number;
|
|
54
|
+
* }) => React.ReactNode} [props.sumHoursRender] - Custom render function for the sum of hours.
|
|
55
|
+
* @param {() => React.ReactNode} [props.sumHoursHeadRender] - Custom render function for the sum-of-hours header.
|
|
56
|
+
* @param {(currentTask: TaskFeildsType) => void} [props.handleClickTask] - Handler function for clicking a task.
|
|
57
|
+
* @param {(currentGroup: GroupFeildsType) => void} [props.handleClickGroup] - Handler function for clicking a group.
|
|
58
|
+
* @param {0|1|2|3|4|5|6} [props.dayOffset] - Offset index for the day column (0 = first day of week, …, 6 = last day).
|
|
59
|
+
* @param {React.CSSProperties} [props.dayColsStyle] - Additional styles for the day columns.
|
|
60
|
+
* @param {string} [props.dayColsClassName] - Additional class names for the day columns.
|
|
61
|
+
* @param {React.CSSProperties} [props.hoursColsStyle] - Additional styles for the hours columns.
|
|
62
|
+
* @param {string} [props.hoursColsClassName] - Additional class names for the hours columns.
|
|
63
|
+
*/
|
|
64
|
+
declare const Calendar: (props: CalendarPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
export default Calendar;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GroupPropsType } from "../definitions";
|
|
2
|
+
type CalendarContextProviderPropsType = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
groups: GroupPropsType[];
|
|
5
|
+
weekOffset: number;
|
|
6
|
+
date: Date;
|
|
7
|
+
};
|
|
8
|
+
type CalendarContextType = {
|
|
9
|
+
groups: GroupPropsType[];
|
|
10
|
+
weekOffset: number;
|
|
11
|
+
date: Date;
|
|
12
|
+
};
|
|
13
|
+
declare const CalendarContextProvider: ({ groups, weekOffset, children, date }: CalendarContextProviderPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const useCalendarContext: () => CalendarContextType;
|
|
15
|
+
export default CalendarContextProvider;
|