react-weekly-planning 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/__tests__/page.test.js +106 -46
- package/__tests__/page.test.tsx +117 -45
- package/babel.config.js +1 -0
- package/components/AddTask/index.js +17 -0
- package/components/AddTask/index.tsx +43 -0
- package/components/CalendarForWeek.js +50 -0
- package/components/CalendarForWeek.tsx +229 -0
- package/components/CalendarForday.js +34 -0
- package/components/CalendarForday.tsx +130 -0
- package/components/DayContainer/index.js +15 -0
- package/components/DayContainer/index.tsx +36 -0
- package/components/GroupContainer/index.js +15 -0
- package/components/GroupContainer/index.tsx +42 -0
- package/components/GroupsHeadContainer/index.js +9 -0
- package/components/GroupsHeadContainer/index.tsx +19 -0
- package/components/SumHoursContainer/index.js +15 -0
- package/components/SumHoursContainer/index.tsx +38 -0
- package/components/SumHoursHead/index.js +9 -0
- package/components/SumHoursHead/index.tsx +22 -0
- package/components/TaskContainer/index.js +35 -0
- package/components/TaskContainer/index.tsx +86 -0
- package/components/TaskList/index.js +5 -0
- package/components/TaskList/index.tsx +20 -0
- package/contexts/CalendarContext.js +12 -12
- package/contexts/CalendarContext.tsx +4 -0
- package/definitions/index.js +1 -1
- package/definitions/index.ts +668 -7
- package/docs/global.html +4982 -4982
- package/docs/index.html +474 -474
- package/docs/index.ts.html +121 -121
- package/docs/scripts/linenumber.js +26 -26
- package/docs/scripts/search.js +38 -38
- package/docs/styles/iframe.css +12 -12
- package/docs/styles/prettify-jsdoc.css +111 -111
- package/docs/styles/prettify-tomorrow.css +132 -132
- package/docs/styles/reset.css +44 -44
- package/hooks/useCalendarDateState.js +19 -0
- package/hooks/useCalendarDateState.ts +44 -0
- package/index.js +70 -248
- package/index.tsx +59 -605
- package/jest.config.js +9 -9
- package/lib/slyles.js +21 -0
- package/lib/slyles.ts +25 -0
- package/lib/utils.js +619 -490
- package/lib/utils.ts +687 -383
- package/out/index.html +128 -128
- package/out/scripts/linenumber.js +26 -26
- package/out/scripts/search.js +38 -38
- package/out/styles/iframe.css +12 -12
- package/out/styles/prettify-jsdoc.css +111 -111
- package/out/styles/prettify-tomorrow.css +132 -132
- package/out/styles/reset.css +44 -44
- package/package.json +81 -71
- package/style.css +26 -4
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CalendarPropsType,
|
|
4
|
+
CalendarTablePropsType,
|
|
5
|
+
TaskFeildsType,
|
|
6
|
+
} from "../definitions";
|
|
7
|
+
import GroupContainer from "./GroupContainer";
|
|
8
|
+
import GroupsHeadContainer from "./GroupsHeadContainer";
|
|
9
|
+
|
|
10
|
+
import { groupTdStyle, theadTrStyle } from "../lib/slyles";
|
|
11
|
+
import DayContainer from "./DayContainer";
|
|
12
|
+
import SumHoursHead from "./SumHoursHead";
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
compareWeekOffset,
|
|
16
|
+
getSessionStorageRecordForDragAndDrop,
|
|
17
|
+
saveTasksToLocalStorage,
|
|
18
|
+
sumHoursByGroups,
|
|
19
|
+
updateOffsetWithDateCalendar,
|
|
20
|
+
} from "../lib/utils";
|
|
21
|
+
|
|
22
|
+
import TaskContainer from "./TaskContainer";
|
|
23
|
+
|
|
24
|
+
import AddTask from "./AddTask";
|
|
25
|
+
import SumHoursContainer from "./SumHoursContainer";
|
|
26
|
+
import { memo, useEffect } from "react";
|
|
27
|
+
import useCalendarDateState from "../hooks/useCalendarDateState";
|
|
28
|
+
|
|
29
|
+
function CalendarForWeek(props: CalendarTablePropsType) {
|
|
30
|
+
const { dailyHours, weekDays } = useCalendarDateState(
|
|
31
|
+
props.date,
|
|
32
|
+
props.weekOffset,
|
|
33
|
+
props.timeZone
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const handleDragOver = (event: React.DragEvent<HTMLTableCellElement>) => {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
saveTasksToLocalStorage(props.tasks);
|
|
42
|
+
}, [props.tasks]);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<table
|
|
46
|
+
className={`planningCalendar ${props.className}`}
|
|
47
|
+
style={{ ...props.style }}
|
|
48
|
+
>
|
|
49
|
+
<thead>
|
|
50
|
+
<tr
|
|
51
|
+
className={`${props.rowsClassName}`}
|
|
52
|
+
style={{ ...theadTrStyle, ...props.rowsStyle }}
|
|
53
|
+
key=""
|
|
54
|
+
>
|
|
55
|
+
<th
|
|
56
|
+
className={`dayTh ${props.groupsColsClassName}`}
|
|
57
|
+
style={{ ...props.groupsColsStyle }}
|
|
58
|
+
>
|
|
59
|
+
<GroupsHeadContainer
|
|
60
|
+
className={`${props.groupHeadContainerClassName}`}
|
|
61
|
+
style={props.groupHeadContainerStyle}
|
|
62
|
+
groupsHeadRender={props.groupsHeadRender}
|
|
63
|
+
/>
|
|
64
|
+
</th>
|
|
65
|
+
{weekDays.map((day, i) => (
|
|
66
|
+
<th
|
|
67
|
+
key={i}
|
|
68
|
+
className={`${props.daysColsClassName}`}
|
|
69
|
+
style={{ ...props.daysColsStyle }}
|
|
70
|
+
>
|
|
71
|
+
<DayContainer
|
|
72
|
+
style={props.dayStyle}
|
|
73
|
+
className={props.dayClassName}
|
|
74
|
+
dayIndex={i}
|
|
75
|
+
dayRender={props.dayRender}
|
|
76
|
+
day={day.day}
|
|
77
|
+
dayOfTheMonth={day.dayOfTheMonth}
|
|
78
|
+
dayMonth={day.dayMonth}
|
|
79
|
+
dayYear={day.dayYear}
|
|
80
|
+
/>
|
|
81
|
+
</th>
|
|
82
|
+
))}
|
|
83
|
+
<th
|
|
84
|
+
className={`totalTh ${props.hoursColsClassName}`}
|
|
85
|
+
style={props.hoursColsStyle}
|
|
86
|
+
>
|
|
87
|
+
<SumHoursHead
|
|
88
|
+
className={props.sumHoursHeadClassName}
|
|
89
|
+
style={props.sumHoursHeadStyle}
|
|
90
|
+
sumHoursHeadRender={props.sumHoursHeadRender}
|
|
91
|
+
/>
|
|
92
|
+
</th>
|
|
93
|
+
</tr>
|
|
94
|
+
</thead>
|
|
95
|
+
<tbody>
|
|
96
|
+
{props.groups?.map((group, i) => (
|
|
97
|
+
<tr
|
|
98
|
+
key={`${i} tr`}
|
|
99
|
+
className={`${props.rowsClassName}`}
|
|
100
|
+
style={{ ...props.rowsStyle }}
|
|
101
|
+
>
|
|
102
|
+
<td
|
|
103
|
+
className={`${props.groupsColsClassName}`}
|
|
104
|
+
key={i}
|
|
105
|
+
style={{ ...groupTdStyle, ...props.groupsColsStyle }}
|
|
106
|
+
>
|
|
107
|
+
<GroupContainer
|
|
108
|
+
style={props.groupContainerStyle}
|
|
109
|
+
className={props.groupContainerClassName}
|
|
110
|
+
groupRender={props.groupRender}
|
|
111
|
+
currentGroup={group}
|
|
112
|
+
handleClickGroup={props.handleClickGroup}
|
|
113
|
+
/>
|
|
114
|
+
</td>
|
|
115
|
+
{dailyHours.map((_, positionDay) => (
|
|
116
|
+
<td
|
|
117
|
+
key={`td-${group.id}day-i${positionDay}`}
|
|
118
|
+
onDragOver={handleDragOver}
|
|
119
|
+
onDrop={(event) => {
|
|
120
|
+
if (!props.handleDropTask || !props.tasks) return;
|
|
121
|
+
const dropInfo = getSessionStorageRecordForDragAndDrop(
|
|
122
|
+
props.tasks,
|
|
123
|
+
positionDay,
|
|
124
|
+
group.id
|
|
125
|
+
);
|
|
126
|
+
if (!dropInfo) return;
|
|
127
|
+
props.handleDropTask(
|
|
128
|
+
event,
|
|
129
|
+
dropInfo.taskDropStart,
|
|
130
|
+
dropInfo.taskDropEnd,
|
|
131
|
+
dropInfo.taskDropDate,
|
|
132
|
+
group.id,
|
|
133
|
+
positionDay,
|
|
134
|
+
dropInfo.newTask,
|
|
135
|
+
dropInfo.newTasks
|
|
136
|
+
);
|
|
137
|
+
}}
|
|
138
|
+
id={`td-${group.id}day-i`}
|
|
139
|
+
className={props.dayColsClassName}
|
|
140
|
+
style={props.dayColsStyle}
|
|
141
|
+
>
|
|
142
|
+
<div
|
|
143
|
+
key={positionDay}
|
|
144
|
+
style={{
|
|
145
|
+
display: "flex",
|
|
146
|
+
width: "100%",
|
|
147
|
+
height: "100%",
|
|
148
|
+
flexDirection: "column",
|
|
149
|
+
padding: "5px",
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<>
|
|
153
|
+
{props.tasks
|
|
154
|
+
.map((task, taskKey) => {
|
|
155
|
+
if (
|
|
156
|
+
task.dayIndex === positionDay &&
|
|
157
|
+
task.groupId === group.id &&
|
|
158
|
+
compareWeekOffset(
|
|
159
|
+
props.date,
|
|
160
|
+
props.weekOffset || 0,
|
|
161
|
+
task.taskDate
|
|
162
|
+
)
|
|
163
|
+
) {
|
|
164
|
+
return (
|
|
165
|
+
<TaskContainer
|
|
166
|
+
key={`${taskKey} task`}
|
|
167
|
+
handleDragTask={props.handleDragTask}
|
|
168
|
+
taskRender={props.taskRender}
|
|
169
|
+
handleDragTaskEnd={props.handleDragTaskEnd}
|
|
170
|
+
style={props.taskContainerStyle}
|
|
171
|
+
className={`${props.taskContainerClassName}`}
|
|
172
|
+
currentTask={task}
|
|
173
|
+
handleClickTask={props.handleClickTask}
|
|
174
|
+
/>
|
|
175
|
+
);
|
|
176
|
+
} else return "";
|
|
177
|
+
})}
|
|
178
|
+
</>
|
|
179
|
+
|
|
180
|
+
<AddTask
|
|
181
|
+
addTaskStyle={props.addTaskStyle}
|
|
182
|
+
addTaskClassName={props.addTaskClassName}
|
|
183
|
+
currentGroup={group}
|
|
184
|
+
dayInfo={dailyHours[positionDay]}
|
|
185
|
+
addTaskRender={props.addTaskRender}
|
|
186
|
+
handleAddTask={props.handleAddTask}
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
</td>
|
|
190
|
+
))}
|
|
191
|
+
<td
|
|
192
|
+
key={`${i}sumHours`}
|
|
193
|
+
style={props.hoursColsStyle}
|
|
194
|
+
className={props.hoursColsClassName}
|
|
195
|
+
>
|
|
196
|
+
<SumHoursContainer
|
|
197
|
+
groupId={group.id}
|
|
198
|
+
tasks={props.tasks}
|
|
199
|
+
weekOffset={props.weekOffset || 0}
|
|
200
|
+
calendarDate={props.date}
|
|
201
|
+
sumHoursRender={props.sumHoursRender}
|
|
202
|
+
sumHoursByGroups={sumHoursByGroups(
|
|
203
|
+
group.id,
|
|
204
|
+
props.tasks,
|
|
205
|
+
props.weekOffset || 0,
|
|
206
|
+
props.date
|
|
207
|
+
)}
|
|
208
|
+
className={props.sumHoursContainerClassName}
|
|
209
|
+
style={props.sumHoursContainerStyle}
|
|
210
|
+
/>
|
|
211
|
+
</td>
|
|
212
|
+
</tr>
|
|
213
|
+
))}
|
|
214
|
+
</tbody>
|
|
215
|
+
</table>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export default memo(
|
|
220
|
+
CalendarForWeek,
|
|
221
|
+
(
|
|
222
|
+
prevProps: Readonly<CalendarPropsType>,
|
|
223
|
+
nextProps: Readonly<CalendarPropsType>
|
|
224
|
+
) =>
|
|
225
|
+
prevProps.tasks === nextProps.tasks &&
|
|
226
|
+
prevProps.date === nextProps.date &&
|
|
227
|
+
prevProps.groups === nextProps.groups &&
|
|
228
|
+
prevProps.weekOffset === nextProps.weekOffset
|
|
229
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import "../style.css";
|
|
4
|
+
import { memo, useEffect } from "react";
|
|
5
|
+
import { compareWeekOffset, saveTasksToLocalStorage } from "../lib/utils";
|
|
6
|
+
import useCalendarDateState from "../hooks/useCalendarDateState";
|
|
7
|
+
import AddTask from "./AddTask";
|
|
8
|
+
import TaskContainer from "./TaskContainer";
|
|
9
|
+
import GroupContainer from "./GroupContainer";
|
|
10
|
+
import DayContainer from "./DayContainer";
|
|
11
|
+
function CalendarForDay(props) {
|
|
12
|
+
const { dailyHours, weekDays } = useCalendarDateState(props.date, props.weekOffset, props.timeZone);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
saveTasksToLocalStorage(props.tasks);
|
|
15
|
+
}, [props.tasks]);
|
|
16
|
+
const currentDay = weekDays[props.dayOffset || 0];
|
|
17
|
+
const currentDailyHours = dailyHours[props.dayOffset || 0];
|
|
18
|
+
return (_jsxs("div", { className: ` CalendarTableForDay ${props.className}`, style: Object.assign({}, props.style), children: [currentDay && (_jsx(DayContainer, { style: props.dayStyle, className: props.dayClassName, dayIndex: props.dayOffset || 0, dayRender: props.dayRender, day: currentDay.day, dayOfTheMonth: currentDay.dayOfTheMonth, dayMonth: currentDay.dayMonth, dayYear: currentDay.dayYear })), _jsx("div", { className: `CalendarTableForDayTasksContainer`, children: currentDailyHours &&
|
|
19
|
+
props.groups.map((group, i) => {
|
|
20
|
+
return (_jsxs("div", { style: Object.assign({ width: "100%", height: "auto", background: "#f2f8f8", padding: "5px", borderBottom: "1.5px solid #0f52737e", borderRight: "0.74px solid rgba(198, 219, 225, 0.68)", borderLeft: "0.74px solid rgba(198, 219, 225, 0.68)" }, props.rowsStyle), className: `${props.rowsClassName}`, children: [_jsx("div", { style: Object.assign({ width: "auto", height: "auto" }, props.groupsColsStyle), className: props.groupsColsClassName, children: _jsx(GroupContainer, { style: props.groupContainerStyle, className: props.groupContainerClassName, groupRender: props.groupRender, currentGroup: group, handleClickGroup: props.handleClickGroup }) }), props.tasks.map((task, taskKey) => {
|
|
21
|
+
if (task.dayIndex === (props.dayOffset || 0) &&
|
|
22
|
+
task.groupId === group.id &&
|
|
23
|
+
compareWeekOffset(props.date, props.weekOffset || 0, task.taskDate)) {
|
|
24
|
+
return (_jsx(TaskContainer, { handleDragTask: props.handleDragTask, taskRender: props.taskRender, handleDragTaskEnd: props.handleDragTaskEnd, style: props.taskContainerStyle, className: `${props.taskContainerClassName}`, currentTask: task, handleClickTask: props.handleClickTask }, `${taskKey} task`));
|
|
25
|
+
}
|
|
26
|
+
else
|
|
27
|
+
return "";
|
|
28
|
+
}), _jsx(AddTask, { addTaskStyle: props.addTaskStyle, addTaskClassName: props.addTaskClassName, currentGroup: group, dayInfo: currentDailyHours, addTaskRender: props.addTaskRender, handleAddTask: props.handleAddTask })] }, i));
|
|
29
|
+
}) })] }));
|
|
30
|
+
}
|
|
31
|
+
export default memo(CalendarForDay, (prevProps, nextProps) => prevProps.tasks === nextProps.tasks &&
|
|
32
|
+
prevProps.date === nextProps.date &&
|
|
33
|
+
prevProps.groups === nextProps.groups &&
|
|
34
|
+
prevProps.weekOffset === nextProps.weekOffset);
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../style.css";
|
|
3
|
+
import { memo, useEffect } from "react";
|
|
4
|
+
|
|
5
|
+
import { CalendarPropsType, CalendarTablePropsType } from "../definitions";
|
|
6
|
+
import { compareWeekOffset, saveTasksToLocalStorage } from "../lib/utils";
|
|
7
|
+
import useCalendarDateState from "../hooks/useCalendarDateState";
|
|
8
|
+
|
|
9
|
+
import AddTask from "./AddTask";
|
|
10
|
+
import TaskContainer from "./TaskContainer";
|
|
11
|
+
import GroupContainer from "./GroupContainer";
|
|
12
|
+
import DayContainer from "./DayContainer";
|
|
13
|
+
|
|
14
|
+
function CalendarForDay(props: CalendarTablePropsType) {
|
|
15
|
+
const { dailyHours, weekDays } = useCalendarDateState(
|
|
16
|
+
props.date,
|
|
17
|
+
props.weekOffset,
|
|
18
|
+
props.timeZone
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
saveTasksToLocalStorage(props.tasks);
|
|
23
|
+
}, [props.tasks]);
|
|
24
|
+
|
|
25
|
+
const currentDay = weekDays[props.dayOffset || 0];
|
|
26
|
+
const currentDailyHours = dailyHours[props.dayOffset || 0];
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={` CalendarTableForDay ${props.className}`}
|
|
31
|
+
style={{ ...props.style }}
|
|
32
|
+
>
|
|
33
|
+
{currentDay && (
|
|
34
|
+
<DayContainer
|
|
35
|
+
style={props.dayStyle}
|
|
36
|
+
className={props.dayClassName}
|
|
37
|
+
dayIndex={props.dayOffset || 0}
|
|
38
|
+
dayRender={props.dayRender}
|
|
39
|
+
day={currentDay.day}
|
|
40
|
+
dayOfTheMonth={currentDay.dayOfTheMonth}
|
|
41
|
+
dayMonth={currentDay.dayMonth}
|
|
42
|
+
dayYear={currentDay.dayYear}
|
|
43
|
+
/>
|
|
44
|
+
)}
|
|
45
|
+
<div className={`CalendarTableForDayTasksContainer`}>
|
|
46
|
+
{currentDailyHours &&
|
|
47
|
+
props.groups.map((group, i) => {
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
key={i}
|
|
51
|
+
style={{
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: "auto",
|
|
54
|
+
background: "#f2f8f8",
|
|
55
|
+
padding: "5px",
|
|
56
|
+
borderBottom: "1.5px solid #0f52737e",
|
|
57
|
+
borderRight: "0.74px solid rgba(198, 219, 225, 0.68)",
|
|
58
|
+
borderLeft: "0.74px solid rgba(198, 219, 225, 0.68)",
|
|
59
|
+
...props.rowsStyle,
|
|
60
|
+
}}
|
|
61
|
+
className={`${props.rowsClassName}`}
|
|
62
|
+
>
|
|
63
|
+
<div
|
|
64
|
+
style={{
|
|
65
|
+
width: "auto",
|
|
66
|
+
height: "auto",
|
|
67
|
+
...props.groupsColsStyle,
|
|
68
|
+
}}
|
|
69
|
+
className={props.groupsColsClassName}
|
|
70
|
+
>
|
|
71
|
+
<GroupContainer
|
|
72
|
+
style={props.groupContainerStyle}
|
|
73
|
+
className={props.groupContainerClassName}
|
|
74
|
+
groupRender={props.groupRender}
|
|
75
|
+
currentGroup={group}
|
|
76
|
+
handleClickGroup={props.handleClickGroup}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{props.tasks.map((task, taskKey) => {
|
|
81
|
+
if (
|
|
82
|
+
task.dayIndex === (props.dayOffset || 0) &&
|
|
83
|
+
task.groupId === group.id &&
|
|
84
|
+
compareWeekOffset(
|
|
85
|
+
props.date,
|
|
86
|
+
props.weekOffset || 0,
|
|
87
|
+
task.taskDate
|
|
88
|
+
)
|
|
89
|
+
) {
|
|
90
|
+
return (
|
|
91
|
+
<TaskContainer
|
|
92
|
+
key={`${taskKey} task`}
|
|
93
|
+
handleDragTask={props.handleDragTask}
|
|
94
|
+
taskRender={props.taskRender}
|
|
95
|
+
handleDragTaskEnd={props.handleDragTaskEnd}
|
|
96
|
+
style={props.taskContainerStyle}
|
|
97
|
+
className={`${props.taskContainerClassName}`}
|
|
98
|
+
currentTask={task}
|
|
99
|
+
handleClickTask={props.handleClickTask}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
} else return "";
|
|
103
|
+
})}
|
|
104
|
+
<AddTask
|
|
105
|
+
addTaskStyle={props.addTaskStyle}
|
|
106
|
+
addTaskClassName={props.addTaskClassName}
|
|
107
|
+
currentGroup={group}
|
|
108
|
+
dayInfo={currentDailyHours}
|
|
109
|
+
addTaskRender={props.addTaskRender}
|
|
110
|
+
handleAddTask={props.handleAddTask}
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
})}
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default memo(
|
|
121
|
+
CalendarForDay,
|
|
122
|
+
(
|
|
123
|
+
prevProps: Readonly<CalendarPropsType>,
|
|
124
|
+
nextProps: Readonly<CalendarPropsType>
|
|
125
|
+
) =>
|
|
126
|
+
prevProps.tasks === nextProps.tasks &&
|
|
127
|
+
prevProps.date === nextProps.date &&
|
|
128
|
+
prevProps.groups === nextProps.groups &&
|
|
129
|
+
prevProps.weekOffset === nextProps.weekOffset
|
|
130
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
const DayContainer = ({ dayIndex, dayOfTheMonth, day, dayMonth, dayYear, dayRender, className, style, }) => {
|
|
4
|
+
if (dayRender) {
|
|
5
|
+
return (_jsx(_Fragment, { children: dayRender({
|
|
6
|
+
dayIndex,
|
|
7
|
+
day,
|
|
8
|
+
dayOfTheMonth,
|
|
9
|
+
dayMonth,
|
|
10
|
+
dayYear,
|
|
11
|
+
}) }));
|
|
12
|
+
}
|
|
13
|
+
return (_jsx("div", { className: `${className}`, style: style, children: `${day}. ${dayOfTheMonth}` }));
|
|
14
|
+
};
|
|
15
|
+
export default memo(DayContainer);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { DayPropsType } from "../../definitions";
|
|
3
|
+
|
|
4
|
+
const DayContainer = ({
|
|
5
|
+
dayIndex,
|
|
6
|
+
dayOfTheMonth,
|
|
7
|
+
day,
|
|
8
|
+
dayMonth,
|
|
9
|
+
dayYear,
|
|
10
|
+
dayRender,
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
}: DayPropsType) => {
|
|
14
|
+
|
|
15
|
+
if (dayRender) {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
{dayRender({
|
|
19
|
+
dayIndex,
|
|
20
|
+
day,
|
|
21
|
+
dayOfTheMonth,
|
|
22
|
+
dayMonth,
|
|
23
|
+
dayYear,
|
|
24
|
+
})}
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className={`${className}`} style={style}>
|
|
31
|
+
{`${day}. ${dayOfTheMonth}`}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default memo(DayContainer);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { groupContainerStyle } from "../../lib/slyles";
|
|
4
|
+
const GroupContainer = ({ className, style, groupRender, currentGroup, handleClickGroup, }) => {
|
|
5
|
+
if (groupRender) {
|
|
6
|
+
return _jsx(_Fragment, { children: groupRender({ currentGroup }) });
|
|
7
|
+
}
|
|
8
|
+
const handleClick = () => {
|
|
9
|
+
if (!handleClickGroup)
|
|
10
|
+
return;
|
|
11
|
+
handleClickGroup(currentGroup);
|
|
12
|
+
};
|
|
13
|
+
return (_jsxs("div", { onClick: handleClick, className: `${className}`, style: Object.assign(Object.assign({}, groupContainerStyle), style), children: [currentGroup.imageUrl && (_jsx("img", { width: 30, height: 30, src: currentGroup.imageUrl, alt: "groupimg" })), _jsx("label", { children: currentGroup.label && currentGroup.label })] }));
|
|
14
|
+
};
|
|
15
|
+
export default memo(GroupContainer);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { GroupPropsType } from "../../definitions";
|
|
3
|
+
import { groupContainerStyle } from "../../lib/slyles";
|
|
4
|
+
|
|
5
|
+
const GroupContainer = ({
|
|
6
|
+
className,
|
|
7
|
+
style,
|
|
8
|
+
groupRender,
|
|
9
|
+
currentGroup,
|
|
10
|
+
handleClickGroup,
|
|
11
|
+
}: GroupPropsType) => {
|
|
12
|
+
|
|
13
|
+
if (groupRender) {
|
|
14
|
+
return <>{groupRender({ currentGroup })}</>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const handleClick = () => {
|
|
18
|
+
if (!handleClickGroup) return;
|
|
19
|
+
handleClickGroup(currentGroup);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
onClick={handleClick}
|
|
25
|
+
className={`${className}`}
|
|
26
|
+
style={{ ...groupContainerStyle, ...style }}
|
|
27
|
+
>
|
|
28
|
+
{currentGroup.imageUrl && (
|
|
29
|
+
<img
|
|
30
|
+
width={30}
|
|
31
|
+
height={30}
|
|
32
|
+
src={currentGroup.imageUrl}
|
|
33
|
+
alt="groupimg"
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
|
|
37
|
+
<label>{currentGroup.label && currentGroup.label}</label>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default memo(GroupContainer);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
const GroupsHeadContainer = ({ groupsHeadRender, style, className, }) => {
|
|
4
|
+
if (groupsHeadRender) {
|
|
5
|
+
return _jsx(_Fragment, { children: groupsHeadRender() });
|
|
6
|
+
}
|
|
7
|
+
return (_jsx("div", { className: `${className}`, style: style, children: "WeeklyCalendar" }));
|
|
8
|
+
};
|
|
9
|
+
export default memo(GroupsHeadContainer);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { GroupsHeadContainerPropsType } from "../../definitions";
|
|
3
|
+
|
|
4
|
+
const GroupsHeadContainer = ({
|
|
5
|
+
groupsHeadRender,
|
|
6
|
+
style,
|
|
7
|
+
className,
|
|
8
|
+
}: GroupsHeadContainerPropsType) => {
|
|
9
|
+
if (groupsHeadRender) {
|
|
10
|
+
return <>{groupsHeadRender()}</>;
|
|
11
|
+
}
|
|
12
|
+
return (
|
|
13
|
+
<div className={`${className}`} style={style}>
|
|
14
|
+
WeeklyCalendar
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default memo(GroupsHeadContainer);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
const SumHoursContainer = ({ groupId, tasks, weekOffset, calendarDate, sumHoursByGroups, sumHoursRender, className, style, }) => {
|
|
4
|
+
if (sumHoursRender) {
|
|
5
|
+
return (_jsx(_Fragment, { children: sumHoursRender({
|
|
6
|
+
groupId,
|
|
7
|
+
tasks,
|
|
8
|
+
weekOffset,
|
|
9
|
+
calendarDate,
|
|
10
|
+
sumHoursByGroups,
|
|
11
|
+
}) }));
|
|
12
|
+
}
|
|
13
|
+
return (_jsx("div", { style: Object.assign({ textAlign: "right", marginRight: "5px" }, style), className: `${className}`, children: sumHoursByGroups }));
|
|
14
|
+
};
|
|
15
|
+
export default memo(SumHoursContainer);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { SumHoursContainerPropsType } from "../../definitions";
|
|
3
|
+
|
|
4
|
+
const SumHoursContainer = ({
|
|
5
|
+
groupId,
|
|
6
|
+
tasks,
|
|
7
|
+
weekOffset,
|
|
8
|
+
calendarDate,
|
|
9
|
+
sumHoursByGroups,
|
|
10
|
+
sumHoursRender,
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
}: SumHoursContainerPropsType) => {
|
|
14
|
+
if (sumHoursRender) {
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
{sumHoursRender({
|
|
18
|
+
groupId,
|
|
19
|
+
tasks,
|
|
20
|
+
weekOffset,
|
|
21
|
+
calendarDate,
|
|
22
|
+
sumHoursByGroups,
|
|
23
|
+
})}
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{ textAlign: "right", marginRight: "5px", ...style }}
|
|
31
|
+
className={`${className}`}
|
|
32
|
+
>
|
|
33
|
+
{sumHoursByGroups}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default memo(SumHoursContainer);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
const SumHoursHead = ({ sumHoursHeadRender, className, style, }) => {
|
|
4
|
+
if (sumHoursHeadRender) {
|
|
5
|
+
return _jsx(_Fragment, { children: sumHoursHeadRender() });
|
|
6
|
+
}
|
|
7
|
+
return (_jsx("div", { className: `${className}`, style: Object.assign({ textAlign: "right", marginRight: "5px" }, style), children: "Hours" }));
|
|
8
|
+
};
|
|
9
|
+
export default memo(SumHoursHead);
|
|
@@ -0,0 +1,22 @@
|
|
|
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);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { millisecondsToDate } from "../../lib/utils";
|
|
4
|
+
const TaskContainer = ({ handleDragTask, taskRender, handleDragTaskEnd, style, className, currentTask, handleClickTask, }) => {
|
|
5
|
+
const handleDragStart = (event) => {
|
|
6
|
+
if (!handleDragTask)
|
|
7
|
+
return;
|
|
8
|
+
event.dataTransfer.effectAllowed = "move";
|
|
9
|
+
event.dataTransfer.setData("text/plain", currentTask.taskId);
|
|
10
|
+
window.sessionStorage.setItem("calendardragtaskId", currentTask.taskId);
|
|
11
|
+
window.sessionStorage.setItem("calendardragtaskStart", `${currentTask.taskStart}`);
|
|
12
|
+
window.sessionStorage.setItem("calendardragtaskEnd", `${currentTask.taskEnd}`);
|
|
13
|
+
window.sessionStorage.setItem("calendardragdayIndex", `${currentTask.dayIndex}`);
|
|
14
|
+
handleDragTask(event, currentTask);
|
|
15
|
+
};
|
|
16
|
+
const handleDragEnd = (event) => {
|
|
17
|
+
if (!handleDragTaskEnd)
|
|
18
|
+
return;
|
|
19
|
+
handleDragTaskEnd(event);
|
|
20
|
+
};
|
|
21
|
+
const handleClick = () => {
|
|
22
|
+
if (!handleClickTask)
|
|
23
|
+
return;
|
|
24
|
+
handleClickTask(currentTask);
|
|
25
|
+
};
|
|
26
|
+
if (taskRender) {
|
|
27
|
+
return (_jsx("div", { onClick: handleClick, id: currentTask.taskId, className: `taskContainer ${className}`, style: Object.assign({}, style), draggable: true, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: taskRender({
|
|
28
|
+
currentTask,
|
|
29
|
+
}) }));
|
|
30
|
+
}
|
|
31
|
+
return (_jsxs("div", { onClick: handleClick, id: currentTask.taskId, className: `taskContainer ${className}`, style: Object.assign({}, style), draggable: true, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: [_jsx("p", { className: "tasklabel", children: currentTask.task && currentTask.task }), _jsx("p", { className: "taskhour", children: currentTask.taskStart &&
|
|
32
|
+
currentTask.taskEnd &&
|
|
33
|
+
`${millisecondsToDate(currentTask.taskStart).formattedDate} - ${millisecondsToDate(currentTask.taskEnd).formattedDate}` })] }));
|
|
34
|
+
};
|
|
35
|
+
export default memo(TaskContainer);
|