react-weekly-planning 1.0.34 → 1.0.35
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/index.js +70 -70
- package/package.json +1 -1
- 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/index.tsx +0 -77
- package/jest.config.js +0 -9
- package/jest.config.ts +0 -10
- 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}/CalendarForday.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/{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
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { memo } from "react";
|
|
2
|
-
import { SumHoursContainerPropsType } from "../../definitions";
|
|
3
|
-
import { millisecondsToHours, totalLabel } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
const SumHoursContainer = ({
|
|
6
|
-
groupId,
|
|
7
|
-
tasks,
|
|
8
|
-
weekOffset,
|
|
9
|
-
calendarDate,
|
|
10
|
-
sumHoursByGroups,
|
|
11
|
-
sumHoursRender,
|
|
12
|
-
className,
|
|
13
|
-
style,
|
|
14
|
-
}: SumHoursContainerPropsType) => {
|
|
15
|
-
if (sumHoursRender) {
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
{sumHoursRender({
|
|
19
|
-
groupId,
|
|
20
|
-
tasks,
|
|
21
|
-
weekOffset,
|
|
22
|
-
calendarDate,
|
|
23
|
-
sumHoursByGroups,
|
|
24
|
-
})}
|
|
25
|
-
</>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div
|
|
31
|
-
style={{ textAlign: "right", marginRight: "5px", ...style }}
|
|
32
|
-
className={`${className}`}
|
|
33
|
-
>
|
|
34
|
-
{totalLabel(sumHoursByGroups)}
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default memo(SumHoursContainer);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { memo } from "react";
|
|
2
|
-
import { SumHoursHeadContainerPropsType } from "../../definitions";
|
|
3
|
-
|
|
4
|
-
const SumHoursHead = ({
|
|
5
|
-
sumHoursHeadRender,
|
|
6
|
-
className,
|
|
7
|
-
style,
|
|
8
|
-
}: SumHoursHeadContainerPropsType) => {
|
|
9
|
-
if (sumHoursHeadRender) {
|
|
10
|
-
return <>{sumHoursHeadRender()}</>;
|
|
11
|
-
}
|
|
12
|
-
return (
|
|
13
|
-
<div
|
|
14
|
-
className={`${className}`}
|
|
15
|
-
style={{ textAlign: "right", marginRight: "5px", ...style }}
|
|
16
|
-
>
|
|
17
|
-
Hours
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default memo(SumHoursHead);
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { memo } from "react";
|
|
2
|
-
import { TaskContainerPropsType } from "../../definitions";
|
|
3
|
-
import { millisecondsToDate } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
const TaskContainer = ({
|
|
6
|
-
handleDragTask,
|
|
7
|
-
taskRender,
|
|
8
|
-
handleDragTaskEnd,
|
|
9
|
-
style,
|
|
10
|
-
className,
|
|
11
|
-
currentTask,
|
|
12
|
-
handleClickTask,
|
|
13
|
-
}: TaskContainerPropsType) => {
|
|
14
|
-
|
|
15
|
-
const handleDragStart = (event: React.DragEvent<HTMLDivElement>) => {
|
|
16
|
-
if (!handleDragTask) return;
|
|
17
|
-
event.dataTransfer.effectAllowed = "move";
|
|
18
|
-
event.dataTransfer.setData("text/plain", currentTask.taskId);
|
|
19
|
-
window.sessionStorage.setItem("calendardragtaskId", currentTask.taskId);
|
|
20
|
-
window.sessionStorage.setItem(
|
|
21
|
-
"calendardragtaskStart",
|
|
22
|
-
`${currentTask.taskStart}`
|
|
23
|
-
);
|
|
24
|
-
window.sessionStorage.setItem(
|
|
25
|
-
"calendardragtaskEnd",
|
|
26
|
-
`${currentTask.taskEnd}`
|
|
27
|
-
);
|
|
28
|
-
window.sessionStorage.setItem(
|
|
29
|
-
"calendardragdayIndex",
|
|
30
|
-
`${currentTask.dayIndex}`
|
|
31
|
-
);
|
|
32
|
-
handleDragTask(event, currentTask);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleDragEnd = (event: React.DragEvent<HTMLDivElement>) => {
|
|
36
|
-
if (!handleDragTaskEnd) return;
|
|
37
|
-
handleDragTaskEnd(event);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const handleClick = () => {
|
|
41
|
-
if (!handleClickTask) return;
|
|
42
|
-
handleClickTask(currentTask);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
if (taskRender) {
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
onClick={handleClick}
|
|
49
|
-
id={currentTask.taskId}
|
|
50
|
-
className={`taskContainer ${className}`}
|
|
51
|
-
style={{ ...style }}
|
|
52
|
-
draggable
|
|
53
|
-
onDragStart={handleDragStart}
|
|
54
|
-
onDragEnd={handleDragEnd}
|
|
55
|
-
>
|
|
56
|
-
{taskRender({
|
|
57
|
-
currentTask,
|
|
58
|
-
})}
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div
|
|
65
|
-
onClick={handleClick}
|
|
66
|
-
id={currentTask.taskId}
|
|
67
|
-
className={`taskContainer ${className}`}
|
|
68
|
-
style={{ ...style }}
|
|
69
|
-
draggable
|
|
70
|
-
onDragStart={handleDragStart}
|
|
71
|
-
onDragEnd={handleDragEnd}
|
|
72
|
-
>
|
|
73
|
-
<p className="tasklabel">{currentTask.task && currentTask.task}</p>
|
|
74
|
-
|
|
75
|
-
<p className="taskhour">
|
|
76
|
-
{currentTask.taskStart &&
|
|
77
|
-
currentTask.taskEnd &&
|
|
78
|
-
`${millisecondsToDate(currentTask.taskStart).formattedDate} - ${
|
|
79
|
-
millisecondsToDate(currentTask.taskEnd).formattedDate
|
|
80
|
-
}`}
|
|
81
|
-
</p>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default memo(TaskContainer);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import TaskContainer from "../TaskContainer";
|
|
3
|
-
import { TaskFeildsType } from "../../definitions";
|
|
4
|
-
|
|
5
|
-
const TaskList = ({ tasks }: { tasks: TaskFeildsType[] }) => (
|
|
6
|
-
<div style={{ height: 300, width: "100%" }}>
|
|
7
|
-
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
8
|
-
{tasks.map(task => <TaskContainer key={task.id} currentTask={task} />)}
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export default TaskList;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "react";
|
|
2
|
-
import { GroupPropsType } from "../definitions";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type CalendarContextProviderPropsType = {
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
groups: GroupPropsType[];
|
|
8
|
-
weekOffset: number;
|
|
9
|
-
date:Date
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type CalendarContextType = {
|
|
13
|
-
groups: GroupPropsType[];
|
|
14
|
-
weekOffset: number;
|
|
15
|
-
date:Date
|
|
16
|
-
};
|
|
17
|
-
const CalendarContext = createContext<CalendarContextType>({
|
|
18
|
-
groups: [],
|
|
19
|
-
weekOffset: 0,
|
|
20
|
-
date:new Date()
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const CalendarContextProvider = ({
|
|
24
|
-
groups,
|
|
25
|
-
weekOffset,
|
|
26
|
-
children,
|
|
27
|
-
date
|
|
28
|
-
}: CalendarContextProviderPropsType) => {
|
|
29
|
-
return (
|
|
30
|
-
<CalendarContext.Provider value={{ groups, weekOffset ,date}}>
|
|
31
|
-
{children}
|
|
32
|
-
</CalendarContext.Provider>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export const useCalendarContext = () => useContext(CalendarContext);
|
|
38
|
-
export default CalendarContextProvider;
|