react-weekly-planning 1.0.0

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.
@@ -0,0 +1,446 @@
1
+ /**
2
+ * Props for the Group component.
3
+ */
4
+ export type GroupPropsType = {
5
+ /** Custom render function for the group. */
6
+ groupRender?: ({
7
+ currentGroup
8
+ }: {
9
+ currentGroup: GroupFeildsType;
10
+ }) => React.ReactNode;
11
+ /** Additional class names for the group component. */
12
+ className?: string;
13
+ /** Additional styles for the group component. */
14
+ style?: React.CSSProperties | undefined;
15
+ /** The current group data. */
16
+ currentGroup: GroupFeildsType;
17
+ /** Handler function for clicking the group. */
18
+ handleClickGroup?: (currentGroup: GroupFeildsType) => void;
19
+ };
20
+
21
+ /**
22
+ * Required fields for a group.
23
+ */
24
+ type GroupRiquiredFieldsType = {
25
+ /** Label for the group. */
26
+ label?: string;
27
+ /** URL of the image representing the group. */
28
+ imageUrl?: string;
29
+ /** Unique identifier for the group. */
30
+ id: string;
31
+ };
32
+
33
+ /**
34
+ * Additional fields for a group.
35
+ */
36
+ type GroupAdditionalFieldsType = Record<any, unknown>;
37
+
38
+ /**
39
+ * Fields for a group, including both required and additional fields.
40
+ */
41
+ export type GroupFeildsType = GroupRiquiredFieldsType &
42
+ GroupAdditionalFieldsType;
43
+
44
+
45
+
46
+ /**
47
+ * Props for the GroupComponent.
48
+ */
49
+ export type GroupComponentPropsType = {
50
+ /** Custom render function for the group. */
51
+ groupRender?: ({
52
+ currentGroup
53
+ }: {
54
+ currentGroup: GroupFeildsType;
55
+ }) => React.ReactNode;
56
+ /** Additional class names for the group component. */
57
+ className?: string;
58
+ /** Additional styles for the group component. */
59
+ style?: React.CSSProperties | undefined;
60
+ };
61
+
62
+ /**
63
+ * Props for the Days component.
64
+ */
65
+ export type DaysPropsType = {
66
+ /** Custom render function for a day. */
67
+ dayRender?: ({
68
+ dayIndex,
69
+ day,
70
+ dayOfTheMonth,
71
+ dayMonth,
72
+ dayYear,
73
+ }: {
74
+ dayIndex?: number;
75
+ day?: string;
76
+ dayOfTheMonth?: number;
77
+ dayMonth?: string;
78
+ dayYear?: number;
79
+ }) => React.ReactNode;
80
+ /** Additional class names for the days component. */
81
+ className?: string;
82
+ /** Additional styles for the days component. */
83
+ style?: React.CSSProperties | undefined;
84
+ };
85
+
86
+ /**
87
+ * Props for a single day.
88
+ */
89
+ export type DayPropsType = {
90
+ /** Index of the day. */
91
+ dayIndex: number;
92
+ /** Name of the day. */
93
+ day: string;
94
+ /** Day of the month. */
95
+ dayOfTheMonth: number;
96
+ /** Custom render function for a day. */
97
+ dayRender?: ({
98
+ dayIndex,
99
+ day,
100
+ dayOfTheMonth,
101
+ dayMonth,
102
+ dayYear,
103
+ }: {
104
+ dayIndex: number;
105
+ day: string;
106
+ dayOfTheMonth: number;
107
+ dayMonth: string;
108
+ dayYear: number;
109
+ }) => React.ReactNode;
110
+ /** Month of the day. */
111
+ dayMonth: string;
112
+ /** Year of the day. */
113
+ dayYear: number;
114
+ /** Additional class names for the day component. */
115
+ className?: string;
116
+ /** Additional styles for the day component. */
117
+ style?: React.CSSProperties | undefined;
118
+ };
119
+
120
+ /**
121
+ * Props for the Calendar component.
122
+ */
123
+ export type CalendarPropsType = {
124
+ /** Offset for the week (e.g., -7 for last week, 0 for current week, 7 for next week). */
125
+ weekOffset?: number;
126
+ /** Array of group data to be displayed in the calendar. */
127
+ groups: GroupFeildsType[];
128
+ /** Additional class names for the calendar component. */
129
+ className?: string;
130
+ /** Additional styles for the calendar component. */
131
+ style?: React.CSSProperties | undefined;
132
+ /** The current date to display in the calendar. */
133
+ date: Date;
134
+ /** Custom render function for a group. */
135
+ groupRender?: ({
136
+ currentGroup
137
+ }: {
138
+ currentGroup: GroupFeildsType;
139
+ }) => React.ReactNode;
140
+ /** Custom render function for a day. */
141
+ dayRender?: ({
142
+ dayIndex,
143
+ day,
144
+ dayOfTheMonth,
145
+ dayMonth,
146
+ dayYear,
147
+ }: {
148
+ dayIndex: number;
149
+ day: string;
150
+ dayOfTheMonth: number;
151
+ dayMonth: string;
152
+ dayYear: number;
153
+ }) => React.ReactNode;
154
+ /** Custom render function for a task. */
155
+ taskRender?: ({
156
+ currentTask,
157
+ handleDragTask
158
+ }: {
159
+ currentTask: TaskFeildsType;
160
+ handleDragTask?: (
161
+ event: React.DragEvent<HTMLDivElement>,
162
+ currentTask: TaskFeildsType
163
+ ) => void;
164
+ }) => React.ReactNode;
165
+ /** Additional styles for the rows. */
166
+ rowsStyle?: React.CSSProperties | undefined;
167
+ /** Additional class names for the rows. */
168
+ rowsClassName?: string;
169
+ /** Additional styles for the group columns. */
170
+ groupsColsStyle?: React.CSSProperties | undefined;
171
+ /** Additional class names for the group columns. */
172
+ groupsColsClassName?: string;
173
+ /** Additional styles for the day columns. */
174
+ daysColsStyle?: React.CSSProperties | undefined;
175
+ /** Additional class names for the day columns. */
176
+ daysColsClassName?: string;
177
+ /** Additional class names for the add task button. */
178
+ addTaskClassName?: string;
179
+ /** Additional styles for the add task button. */
180
+ addTaskStyle?: React.CSSProperties | undefined;
181
+ /** Additional class names for the groups. */
182
+ groupClassName?: string;
183
+ /** Additional styles for the groups. */
184
+ groupStyle?: React.CSSProperties | undefined;
185
+ /** Additional class names for the days. */
186
+ dayClassName?: string;
187
+ /** Additional styles for the days. */
188
+ dayStyle?: React.CSSProperties | undefined;
189
+ /** Additional styles for the task container. */
190
+ taskContainerStyle?: React.CSSProperties | undefined;
191
+ /** Additional class names for the task container. */
192
+ taskContainerClassName?: string;
193
+ /** Additional styles for the group head container. */
194
+ groupHeadContainerStyle?: React.CSSProperties | undefined;
195
+ /** Additional class names for the group head container. */
196
+ groupHeadContainerClassName?: string;
197
+ /** Additional styles for the sum hours container. */
198
+ sumHoursContainerStyle?: React.CSSProperties | undefined;
199
+ /** Additional class names for the sum hours container. */
200
+ sumHoursContainerClassName?: string;
201
+ /** Additional styles for the sum hours header. */
202
+ sumHoursHeadStyle?: React.CSSProperties | undefined;
203
+ /** Additional class names for the sum hours header. */
204
+ sumHoursHeadClassName?: string;
205
+ /** Handler function for adding a new task. */
206
+ handleAddTask?: (
207
+ groupId: string,
208
+ dayInfo: dayInfoType
209
+ ) => void;
210
+ /** Custom render function for adding a task. */
211
+ addTaskRender?:({
212
+ groupId,
213
+ dayInfo,
214
+ }: {
215
+ groupId: string;
216
+ dayInfo: dayInfoType;
217
+ }) => React.ReactNode;
218
+ /** Array of tasks to be displayed in the calendar. */
219
+ tasks: TasksType;
220
+ /** Handler function for dragging a task. */
221
+ handleDragTask?: (
222
+ event: React.DragEvent<HTMLDivElement>,
223
+ currentTask: TaskFeildsType
224
+ ) => void;
225
+ /** Handler function for dropping a task. */
226
+ handleDropTask?: (
227
+ event: React.DragEvent<HTMLTableDataCellElement>,
228
+ taskStart: number,
229
+ taskEnd: number,
230
+ taskDate: Date,
231
+ groupId: string,
232
+ dayIndex: number,
233
+ newTask: TaskFeildsType,
234
+ newTasks: TasksType
235
+ ) => void;
236
+ /** Handler function for ending the drag of a task. */
237
+ handleDragTaskEnd?: (
238
+ event: React.DragEvent<HTMLDivElement>
239
+ ) => void;
240
+ /** Custom render function for the groups header. */
241
+ groupsHeadRender?: () => React.ReactNode;
242
+ /** Custom render function for the sum of hours. */
243
+ sumHoursRender?: ({
244
+ groupId,
245
+ tasks,
246
+ weekOffset,
247
+ calendarDate,
248
+ sumHoursByGroups,
249
+ }: {
250
+ groupId: string;
251
+ tasks: TasksType;
252
+ weekOffset: number;
253
+ calendarDate: Date;
254
+ sumHoursByGroups: number;
255
+ }) => React.ReactNode;
256
+ /** Custom render function for the sum of hours header. */
257
+ sumHoursHeadRender?:() => React.ReactNode;
258
+ /** Handler function for clicking a task. */
259
+ handleClickTask?: (currentTask: TaskFeildsType) => void;
260
+ /** Handler function for clicking a group. */
261
+ handleClickGroup?: (currentGroup: GroupFeildsType) => void;
262
+ };
263
+
264
+ /**
265
+ * Type for style props.
266
+ */
267
+ export type StyleType = React.CSSProperties | undefined;
268
+
269
+ /**
270
+ * Props for the AddTask component.
271
+ */
272
+ export type AddTaskPropsType = {
273
+ /** ID of the group. */
274
+ groupId: string;
275
+ /** Additional styles for the add task button. */
276
+ addTaskStyle?: StyleType;
277
+ /** Additional class names for the add task button. */
278
+ addTaskClassName?: string;
279
+ /** Custom render function for adding a task. */
280
+ addTaskRender?: ({
281
+ groupId,
282
+ dayInfo,
283
+ }: {
284
+ groupId: string;
285
+ dayInfo: dayInfoType;
286
+ }) => React.ReactNode;
287
+ /** Information about the day. */
288
+ dayInfo: dayInfoType;
289
+ /** Handler function for adding a new task. */
290
+ handleAddTask?: (
291
+ groupId: string,
292
+ dayInfo: dayInfoType
293
+ ) => void;
294
+ };
295
+
296
+ /**
297
+ * Information about a day.
298
+ */
299
+ export type dayInfoType = {
300
+ /** Position of the day. */
301
+ positionDay: number;
302
+ /** Date of the day. */
303
+ day: Date;
304
+ /** Start time of the day. */
305
+ start: number;
306
+ /** End time of the day. */
307
+ end: number;
308
+ };
309
+
310
+ /**
311
+ * Type for a task.
312
+ */
313
+ export type TaskType = {
314
+ /** Start time of the task. */
315
+ taskStart: number;
316
+ /** End time of the task. */
317
+ taskEnd: number;
318
+ /** Description of the task. */
319
+ task: string;
320
+ /** Date of the task. */
321
+ taskDate: Date;
322
+ /** ID of the group the task belongs to. */
323
+ groupId: string;
324
+ /** Index of the day the task belongs to. */
325
+ dayIndex: number;
326
+ /** Unique identifier for the task. */
327
+ taskId: string;
328
+ };
329
+
330
+ /**
331
+ * Props for the TaskContainer component.
332
+ */
333
+ export type TaskContainerPropsType = {
334
+ /** Additional class names for the task container. */
335
+ className?: string;
336
+ /** Additional styles for the task container. */
337
+ style?: React.CSSProperties | undefined;
338
+ /** Handler function for dragging a task. */
339
+ handleDragTask?: (
340
+ event: React.DragEvent<HTMLDivElement>,
341
+ currentTask: TaskFeildsType
342
+ ) => void;
343
+ /** Custom render function for a task. */
344
+ taskRender?: ({
345
+ currentTask,
346
+ handleDragTask
347
+ }: {
348
+ currentTask: TaskFeildsType;
349
+ handleDragTask?: (
350
+ event: React.DragEvent<HTMLDivElement>,
351
+ currentTask: TaskFeildsType
352
+ ) => void;
353
+ }) => React.ReactNode;
354
+ /** Handler function for ending the drag of a task. */
355
+ handleDragTaskEnd?:(
356
+ event: React.DragEvent<HTMLDivElement>
357
+ ) => void;
358
+ /** The current task data. */
359
+ currentTask: TaskFeildsType;
360
+ /** Handler function for clicking a task. */
361
+ handleClickTask?: (currentTask: TaskFeildsType) => void;
362
+ };
363
+
364
+
365
+
366
+ /**
367
+ * Props for the GroupsHeadContainer component.
368
+ */
369
+ export type GroupsHeadContainerPropsType = {
370
+ /** Custom render function for the groups header. */
371
+ groupsHeadRender?: () => React.ReactNode;
372
+ /** Additional styles for the groups header container. */
373
+ style?: React.CSSProperties | undefined;
374
+ /** Additional class names for the groups header container. */
375
+ className?: string;
376
+ };
377
+
378
+
379
+
380
+ /**
381
+ * Props for the SumHoursHeadContainer component.
382
+ */
383
+ export type SumHoursHeadContainerPropsType = {
384
+ /** Custom render function for the sum hours header. */
385
+ sumHoursHeadRender?: () => React.ReactNode;
386
+ /** Additional styles for the sum hours header container. */
387
+ style?: React.CSSProperties | undefined;
388
+ /** Additional class names for the sum hours header container. */
389
+ className?: string;
390
+ };
391
+
392
+ /**
393
+ * Additional fields for a task.
394
+ */
395
+ type TaskAdditionalFieldsType = Record<any, unknown>;
396
+
397
+ /**
398
+ * Fields for a task, including both required and additional fields.
399
+ */
400
+ export type TaskFeildsType = TaskType & TaskAdditionalFieldsType;
401
+
402
+ /**
403
+ * Type for an array of tasks.
404
+ */
405
+ export type TasksType = TaskFeildsType[];
406
+
407
+ /**
408
+ * Handler function type for ending the drag of a task.
409
+ */
410
+ export type handleDragTaskEndType = (
411
+ event: React.DragEvent<HTMLDivElement>
412
+ ) => void;
413
+
414
+ /**
415
+ * Props for the SumHoursContainer component.
416
+ */
417
+ export type SumHoursContainerPropsType = {
418
+ /** ID of the group. */
419
+ groupId: string;
420
+ /** Array of tasks to be displayed in the calendar. */
421
+ tasks: TasksType;
422
+ /** Offset for the week (e.g., -7 for last week, 0 for current week, 7 for next week). */
423
+ weekOffset: number;
424
+ /** The current date to display in the calendar. */
425
+ calendarDate: Date;
426
+ /** Sum of hours for the group. */
427
+ sumHoursByGroups: number;
428
+ /** Custom render function for the sum of hours. */
429
+ sumHoursRender?: ({
430
+ groupId,
431
+ tasks,
432
+ weekOffset,
433
+ calendarDate,
434
+ sumHoursByGroups,
435
+ }: {
436
+ groupId: string;
437
+ tasks: TasksType;
438
+ weekOffset: number;
439
+ calendarDate: Date;
440
+ sumHoursByGroups: number;
441
+ }) => React.ReactNode;
442
+ /** Additional styles for the sum hours container. */
443
+ style?: React.CSSProperties | undefined;
444
+ /** Additional class names for the sum hours container. */
445
+ className?: string;
446
+ };