@super-calendar/dom 2.6.0 → 2.7.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.
- package/dist/index.d.mts +84 -15
- package/dist/index.d.ts +84 -15
- package/dist/index.js +571 -118
- package/dist/index.mjs +549 -120
- package/package.json +2 -2
- package/src/Agenda.tsx +5 -2
- package/src/Calendar.tsx +30 -0
- package/src/MonthList.tsx +3 -1
- package/src/MonthView.tsx +135 -3
- package/src/ResourceTimeline.tsx +269 -20
- package/src/TimeGrid.tsx +364 -80
- package/src/YearView.tsx +14 -4
- package/src/index.ts +5 -0
package/src/YearView.tsx
CHANGED
|
@@ -5,9 +5,11 @@ import {
|
|
|
5
5
|
buildMonthWeeks,
|
|
6
6
|
type CalendarEvent,
|
|
7
7
|
getIsToday,
|
|
8
|
+
filterHiddenDays,
|
|
8
9
|
getWeekDays,
|
|
9
10
|
getYearMonths,
|
|
10
11
|
groupEventsByDay,
|
|
12
|
+
isBackgroundEvent,
|
|
11
13
|
isSameCalendarDay,
|
|
12
14
|
type WeekStartsOn,
|
|
13
15
|
weekdayFormatToken,
|
|
@@ -38,6 +40,8 @@ export interface YearViewProps<T = unknown> extends SlotStyleProps<YearViewSlot>
|
|
|
38
40
|
events?: CalendarEvent<T>[];
|
|
39
41
|
/** First day of the week. Sunday = 0 (default) … Saturday = 6. */
|
|
40
42
|
weekStartsOn?: WeekStartsOn;
|
|
43
|
+
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
44
|
+
hiddenDays?: number[];
|
|
41
45
|
locale?: Locale;
|
|
42
46
|
/** Highlight this date instead of the real "today". */
|
|
43
47
|
activeDate?: Date;
|
|
@@ -67,6 +71,7 @@ export function YearView<T = unknown>({
|
|
|
67
71
|
date,
|
|
68
72
|
events,
|
|
69
73
|
weekStartsOn = 0,
|
|
74
|
+
hiddenDays,
|
|
70
75
|
locale,
|
|
71
76
|
activeDate,
|
|
72
77
|
minMonthWidth = 150,
|
|
@@ -84,14 +89,19 @@ export function YearView<T = unknown>({
|
|
|
84
89
|
const months = useMemo(() => getYearMonths(date), [date]);
|
|
85
90
|
const weekdayLabels = useMemo(
|
|
86
91
|
() =>
|
|
87
|
-
getWeekDays(date, weekStartsOn).map((d) =>
|
|
92
|
+
filterHiddenDays(getWeekDays(date, weekStartsOn), hiddenDays).map((d) =>
|
|
88
93
|
format(d, weekdayFormatToken("narrow"), { locale }),
|
|
89
94
|
),
|
|
90
|
-
[date, weekStartsOn, locale],
|
|
95
|
+
[date, weekStartsOn, locale, hiddenDays],
|
|
91
96
|
);
|
|
92
97
|
// Days that hold at least one event, keyed like `groupEventsByDay`.
|
|
93
98
|
const eventDays = useMemo(
|
|
94
|
-
() =>
|
|
99
|
+
() =>
|
|
100
|
+
new Set(
|
|
101
|
+
events && events.length > 0
|
|
102
|
+
? groupEventsByDay(events.filter((e) => !isBackgroundEvent(e))).keys()
|
|
103
|
+
: [],
|
|
104
|
+
),
|
|
95
105
|
[events],
|
|
96
106
|
);
|
|
97
107
|
|
|
@@ -109,7 +119,7 @@ export function YearView<T = unknown>({
|
|
|
109
119
|
})}
|
|
110
120
|
>
|
|
111
121
|
{months.map((month) => {
|
|
112
|
-
const weeks = buildMonthWeeks(month, weekStartsOn);
|
|
122
|
+
const weeks = buildMonthWeeks(month, weekStartsOn, { hiddenDays });
|
|
113
123
|
const monthLabel = format(month, "MMMM yyyy", { locale });
|
|
114
124
|
const titleContent = format(month, "MMMM", { locale });
|
|
115
125
|
return (
|
package/src/index.ts
CHANGED
|
@@ -61,6 +61,7 @@ export { type ResolvedSlot, type SlotDefault, type SlotStyleProps } from "./slot
|
|
|
61
61
|
export { type DomCalendarTheme, darkDomTheme, defaultDomTheme, mergeDomTheme } from "./theme";
|
|
62
62
|
export {
|
|
63
63
|
type BusinessHours,
|
|
64
|
+
type BusinessHoursBand,
|
|
64
65
|
type CalendarEvent,
|
|
65
66
|
type CalendarMode,
|
|
66
67
|
type DateRange,
|
|
@@ -81,7 +82,9 @@ export {
|
|
|
81
82
|
type RecurrenceFrequency,
|
|
82
83
|
expandRecurringEvents,
|
|
83
84
|
getViewDays,
|
|
85
|
+
backgroundBandsForDay,
|
|
84
86
|
isAllDayEvent,
|
|
87
|
+
isBackgroundEvent,
|
|
85
88
|
layoutDayEvents,
|
|
86
89
|
daySelectionState,
|
|
87
90
|
isDateSelectable,
|
|
@@ -89,6 +92,8 @@ export {
|
|
|
89
92
|
isWithinDateRange,
|
|
90
93
|
nextDateRange,
|
|
91
94
|
useDateRange,
|
|
95
|
+
useEventSource,
|
|
96
|
+
useNow,
|
|
92
97
|
useMonthGrid,
|
|
93
98
|
buildMonthGrid,
|
|
94
99
|
weekdayFormatToken,
|