react-weekly-planning 1.0.17 → 1.0.18

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 CHANGED
@@ -11,6 +11,10 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
11
11
 
12
12
  ![Planning Screenshot](https://raw.githubusercontent.com/Yvesmorel/react-pweekly-planning/main/assets/planning-screenshot.webp)
13
13
 
14
+ [See the demo](https://react-weekly-planning-demo.vercel.app)
15
+
16
+ [Demo repository](https://github.com/Yvesmorel/react-weekly-planning-demo.git)
17
+
14
18
  #### `weekOffset`
15
19
 
16
20
  - **Description**: This prop sets the offset for the week being displayed in the calendar.
package/index.js CHANGED
@@ -1,41 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import "./style.css";
3
3
  import { getWeekDays, getDayHourly, calculerEcartSemaine, getSessionStorageRecordForDragAndDrop, sumHoursByGroups, millisecondsToDate, compareWeekOffset, } from "./lib/utils";
4
- const tableStyle = {
5
- width: "100%",
6
- height: "150px",
7
- borderRadius: "0.5rem",
8
- zIndex: 10,
9
- };
10
- const trStyle = {
4
+ const theadTrStyle = {
11
5
  color: "#0f5173",
12
6
  fontWeight: "300",
13
7
  position: "sticky",
14
8
  top: 0,
15
9
  };
16
- const thStyle = {
17
- color: "#0f5173",
18
- paddingLeft: "5px",
19
- };
20
- const weekDayThStyle = {};
21
- const totalThStyle = {
22
- width: "40px",
23
- textAlign: "right",
24
- paddingRight: "2px",
25
- };
26
- const tdStyle = {
10
+ const groupTdStyle = {
27
11
  height: "auto",
28
12
  width: "150px",
29
13
  };
30
- const tableTrStyle = {
31
- borderBottom: "1.5px solid #0f52737e",
32
- // backgroundColor: "#f2f8fb",
33
- padding: "2px",
34
- };
35
- const tableTdStyle = {
36
- borderLeft: "0.74px solid rgba(198, 219, 225, 0.68)",
37
- borderRight: "0.74px solid rgba(198, 219, 225, 0.68)",
38
- };
39
14
  const groupContainerStyle = {
40
15
  width: "100%",
41
16
  height: "100%",
@@ -99,7 +74,7 @@ const Calendar = ({ style, className, groups, weekOffset, date, groupRender, day
99
74
  const handleDragOver = (event) => {
100
75
  event.preventDefault();
101
76
  };
102
- return (_jsxs("table", { className: `${className}`, style: Object.assign(Object.assign({}, tableStyle), style), children: [_jsx("thead", { children: _jsxs("tr", { className: `${rowsClassName}`, style: Object.assign(Object.assign(Object.assign({}, trStyle), tableTrStyle), rowsStyle), children: [_jsx("th", { style: thStyle, children: _jsx(GroupsHeadContainer, { className: `${groupHeadContainerClassName}`, style: groupHeadContainerStyle, groupsHeadRender: groupsHeadRender }) }), weekDays.map((day, i) => (_jsx("th", { className: `${daysColsClassName}`, style: Object.assign(Object.assign({}, weekDayThStyle), daysColsStyle), children: _jsx(DayContainer, { style: dayStyle, className: dayClassName, dayIndex: i, dayRender: dayRender, day: day.day, dayOfTheMonth: day.dayOfTheMonth, dayMonth: day.dayMonth, dayYear: day.dayYear }) }, i))), _jsx("th", { style: totalThStyle, children: _jsx(SumHoursHead, { className: sumHoursHeadClassName, style: sumHoursHeadStyle, sumHoursHeadRender: sumHoursHeadRender }) })] }, "") }), _jsx("tbody", { children: groups === null || groups === void 0 ? void 0 : groups.map((group, i) => (_jsxs("tr", { className: `${rowsClassName}`, style: Object.assign(Object.assign({}, tableTrStyle), rowsStyle), children: [_jsx("td", { className: `${groupsColsClassName}`, style: Object.assign(Object.assign(Object.assign({}, tdStyle), tableTdStyle), groupsColsStyle), children: _jsx(GroupContainer, { style: groupStyle, className: groupClassName, groupRender: groupRender, currentGroup: group, handleClickGroup: handleClickGroup }) }, i), dailyHours.map((_, positionDay) => (_jsx("td", { style: Object.assign({ width: "8vw" }, tableTdStyle), onDragOver: handleDragOver, onDrop: (event) => {
77
+ return (_jsxs("table", { className: `planningCalendar ${className}`, style: Object.assign({}, style), children: [_jsx("thead", { children: _jsxs("tr", { className: `${rowsClassName}`, style: Object.assign(Object.assign({}, theadTrStyle), rowsStyle), children: [_jsx("th", { className: "dayTh", children: _jsx(GroupsHeadContainer, { className: `${groupHeadContainerClassName}`, style: groupHeadContainerStyle, groupsHeadRender: groupsHeadRender }) }), weekDays.map((day, i) => (_jsx("th", { className: `${daysColsClassName}`, style: Object.assign({}, daysColsStyle), children: _jsx(DayContainer, { style: dayStyle, className: dayClassName, dayIndex: i, dayRender: dayRender, day: day.day, dayOfTheMonth: day.dayOfTheMonth, dayMonth: day.dayMonth, dayYear: day.dayYear }) }, i))), _jsx("th", { className: "totalTh", children: _jsx(SumHoursHead, { className: sumHoursHeadClassName, style: sumHoursHeadStyle, sumHoursHeadRender: sumHoursHeadRender }) })] }, "") }), _jsx("tbody", { children: groups === null || groups === void 0 ? void 0 : groups.map((group, i) => (_jsxs("tr", { className: `${rowsClassName}`, style: Object.assign({}, rowsStyle), children: [_jsx("td", { className: `${groupsColsClassName}`, style: Object.assign(Object.assign({}, groupTdStyle), groupsColsStyle), children: _jsx(GroupContainer, { style: groupStyle, className: groupClassName, groupRender: groupRender, currentGroup: group, handleClickGroup: handleClickGroup }) }, i), dailyHours.map((_, positionDay) => (_jsx("td", { onDragOver: handleDragOver, onDrop: (event) => {
103
78
  if (!handleDropTask || !tasks)
104
79
  return;
105
80
  const dropInfo = getSessionStorageRecordForDragAndDrop(tasks, positionDay, group.id);
package/index.tsx CHANGED
@@ -9,8 +9,6 @@ import {
9
9
  GroupsHeadContainerPropsType,
10
10
  SumHoursContainerPropsType,
11
11
  SumHoursHeadContainerPropsType,
12
- TaskType,
13
- TaskFeildsType,
14
12
  TasksType,
15
13
  } from "./definitions";
16
14
  import {
@@ -23,46 +21,18 @@ import {
23
21
  compareWeekOffset,
24
22
  } from "./lib/utils";
25
23
 
26
- const tableStyle: StyleType = {
27
- width: "100%",
28
- height: "150px",
29
- borderRadius: "0.5rem",
30
- zIndex: 10,
31
- };
32
24
 
33
- const trStyle: StyleType = {
25
+ const theadTrStyle: StyleType = {
34
26
  color: "#0f5173",
35
27
  fontWeight: "300",
36
28
  position: "sticky",
37
29
  top: 0,
38
30
  };
39
31
 
40
- const thStyle: StyleType = {
41
- color: "#0f5173",
42
- paddingLeft: "5px",
43
- };
44
-
45
- const weekDayThStyle: StyleType = {};
46
-
47
- const totalThStyle: StyleType = {
48
- width: "40px",
49
- textAlign: "right",
50
- paddingRight: "2px",
51
- };
52
-
53
- const tdStyle: StyleType = {
32
+ const groupTdStyle: StyleType = {
54
33
  height: "auto",
55
34
  width: "150px",
56
35
  };
57
- const tableTrStyle: StyleType = {
58
- borderBottom: "1.5px solid #0f52737e",
59
- // backgroundColor: "#f2f8fb",
60
- padding: "2px",
61
- };
62
- const tableTdStyle: StyleType = {
63
- borderLeft: "0.74px solid rgba(198, 219, 225, 0.68)",
64
- borderRight: "0.74px solid rgba(198, 219, 225, 0.68)",
65
- };
66
36
 
67
37
  const groupContainerStyle: StyleType = {
68
38
  width: "100%",
@@ -170,14 +140,14 @@ const Calendar = ({
170
140
  event.preventDefault();
171
141
  };
172
142
  return (
173
- <table className={`${className}`} style={{ ...tableStyle, ...style }}>
143
+ <table className={`planningCalendar ${className}`} style={{ ...style }}>
174
144
  <thead>
175
145
  <tr
176
146
  className={`${rowsClassName}`}
177
- style={{ ...trStyle, ...tableTrStyle, ...rowsStyle }}
147
+ style={{ ...theadTrStyle, ...rowsStyle }}
178
148
  key=""
179
149
  >
180
- <th style={thStyle}>
150
+ <th className="dayTh">
181
151
  <GroupsHeadContainer
182
152
  className={`${groupHeadContainerClassName}`}
183
153
  style={groupHeadContainerStyle}
@@ -188,7 +158,7 @@ const Calendar = ({
188
158
  <th
189
159
  key={i}
190
160
  className={`${daysColsClassName}`}
191
- style={{ ...weekDayThStyle, ...daysColsStyle }}
161
+ style={{...daysColsStyle }}
192
162
  >
193
163
  <DayContainer
194
164
  style={dayStyle}
@@ -202,7 +172,7 @@ const Calendar = ({
202
172
  />
203
173
  </th>
204
174
  ))}
205
- <th style={totalThStyle}>
175
+ <th className="totalTh">
206
176
  <SumHoursHead
207
177
  className={sumHoursHeadClassName}
208
178
  style={sumHoursHeadStyle}
@@ -216,12 +186,12 @@ const Calendar = ({
216
186
  <tr
217
187
  key={`${i} tr`}
218
188
  className={`${rowsClassName}`}
219
- style={{ ...tableTrStyle, ...rowsStyle }}
189
+ style={{ ...rowsStyle }}
220
190
  >
221
191
  <td
222
192
  className={`${groupsColsClassName}`}
223
193
  key={i}
224
- style={{ ...tdStyle, ...tableTdStyle, ...groupsColsStyle }}
194
+ style={{ ...groupTdStyle,...groupsColsStyle }}
225
195
  >
226
196
  <GroupContainer
227
197
  style={groupStyle}
@@ -233,7 +203,6 @@ const Calendar = ({
233
203
  </td>
234
204
  {dailyHours.map((_, positionDay) => (
235
205
  <td
236
- style={{ width: "8vw", ...tableTdStyle }}
237
206
  key={`td-${group.id}day-i${positionDay}`}
238
207
  onDragOver={handleDragOver}
239
208
  onDrop={(event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-weekly-planning",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "jest",
package/style.css CHANGED
@@ -3,7 +3,7 @@
3
3
  display: flex;
4
4
  align-items: center;
5
5
  justify-content: center;
6
- flex:1;
6
+ flex: 1;
7
7
  background-color: #f2f8fb;
8
8
  opacity: 0;
9
9
  border-radius: 5px;
@@ -48,4 +48,31 @@
48
48
  font-weight: 600;
49
49
  margin-left: 5px;
50
50
  }
51
- td{ -moz-box-sizing: border-box;}
51
+
52
+ .planningCalendar{
53
+ width: 100%;
54
+ height: 150px;
55
+ border-radius: 0.5rem;
56
+ z-index: 10
57
+ }
58
+ .planningCalendar .dayTh{
59
+ color: #0f5173;
60
+ padding-left: 5px
61
+ }
62
+ .planningCalendar .totalTh {
63
+ color: #0f5173;
64
+ width: 40px;
65
+ text-align: right;
66
+ padding-right: 2px;
67
+ }
68
+
69
+ .planningCalendar td {
70
+ -moz-box-sizing: border-box;
71
+ border-left: 0.74px solid rgba(198, 219, 225, 0.68);
72
+ border-right: 0.74px solid rgba(198, 219, 225, 0.68);
73
+ width: 8vw;
74
+ }
75
+ .planningCalendar tr {
76
+ border-bottom: 1.5px solid #0f52737e;
77
+ padding: 2px;
78
+ }