@super-calendar/dom 2.14.2 → 2.16.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/README.md +48 -0
- package/dist/index.d.mts +47 -26
- package/dist/index.d.ts +47 -26
- package/dist/index.js +1264 -452
- package/dist/index.mjs +1265 -453
- package/package.json +2 -2
- package/src/Calendar.tsx +13 -0
- package/src/DateRangePicker.tsx +60 -6
- package/src/EventActions.tsx +470 -0
- package/src/InertDiv.ts +7 -0
- package/src/MonthList.tsx +64 -38
- package/src/MonthView.tsx +14 -2
- package/src/ResourceTimeline.tsx +438 -98
- package/src/TimeGrid.tsx +305 -35
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -52,6 +52,14 @@ export function MyCalendar() {
|
|
|
52
52
|
|
|
53
53
|
For a custom picker, pair the headless hooks (`useDateRange`, `useMonthGrid`) with `MonthList` and `TimeGrid`, all re-exported from this package.
|
|
54
54
|
|
|
55
|
+
`DatePicker` and `DateRangePicker` apply `theme` to both the popover chrome and
|
|
56
|
+
the calendar inside it. Theme updates apply while open, and per-slot styles take
|
|
57
|
+
precedence. Setting `disabled` closes an open popover; re-enabling the field
|
|
58
|
+
leaves it closed until you open it again.
|
|
59
|
+
|
|
60
|
+
`MonthList` applies callback, date-constraint, theme, and slot updates to mounted
|
|
61
|
+
months, including when `date` and `events` keep the same references.
|
|
62
|
+
|
|
55
63
|
## Touch event gestures
|
|
56
64
|
|
|
57
65
|
Touch and pen on `TimeGrid` wait for a 300 ms hold within 8 px before dragging.
|
|
@@ -73,6 +81,24 @@ On the time grid, dragging any segment of a multi-day event previews the whole
|
|
|
73
81
|
range moving together and preserves its duration. Drag a resize grip to change
|
|
74
82
|
only the start or end. See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
75
83
|
|
|
84
|
+
In `TimeGrid` and `ResourceTimeline`, choose **Edit events**, then an event,
|
|
85
|
+
to open move and resize actions (one `dragStepMinutes` step,
|
|
86
|
+
a page, or a neighbouring lane) for keyboard, click, and tap users. The actions
|
|
87
|
+
call `onDragEvent` with the same bounds as a drop. Rejected edits show a polite
|
|
88
|
+
status message, customizable with `labels.eventChangeRejected`. Long choosers
|
|
89
|
+
scroll without shrinking their choices. Titles without spaces wrap. The centered
|
|
90
|
+
dialog and chooser include both dates for multi-day events. Pass `getEventId` to `Calendar`,
|
|
91
|
+
`TimeGrid`, or `ResourceTimeline` to keep editing across full data refreshes.
|
|
92
|
+
Return a stable, unique string or number per event or recurring occurrence;
|
|
93
|
+
missing, invalid, or duplicate IDs close the dialog. Without this prop, full
|
|
94
|
+
refreshes close it. See
|
|
95
|
+
[Move and resize actions](https://super-calendar.afonsojramos.me/guides/accessibility#move-and-resize-actions-web).
|
|
96
|
+
|
|
97
|
+
`ResourceTimeline` supports keyboard event activation in both orientations.
|
|
98
|
+
`draggable: false` keeps an event clickable while preventing moves and resizes.
|
|
99
|
+
Active gestures retain the original event through live insertions and reordering;
|
|
100
|
+
removing the event or lane, losing capture, or unmounting cancels the gesture.
|
|
101
|
+
|
|
76
102
|
## Month chip dimensions
|
|
77
103
|
|
|
78
104
|
`chipHeight` and `chipGap` configure month lanes and overflow rows on `Calendar`,
|
|
@@ -102,6 +128,28 @@ On the time grid, an empty-slot touch tap calls `onPressCell` from the column's
|
|
|
102
128
|
click. Swipes and cancelled contacts do not press the slot. Mouse and pen retain
|
|
103
129
|
drag-to-create behavior. See the [DOM guide](https://super-calendar.afonsojramos.me/guides/dom).
|
|
104
130
|
|
|
131
|
+
The drag-to-create preview stays within the visible hours of the pressed column,
|
|
132
|
+
with its border inside the column.
|
|
133
|
+
|
|
134
|
+
Pass `renderCreateGhost` to `TimeGrid`, `Calendar`, or `ResourceTimeline` to draw
|
|
135
|
+
a draft inside that preview. Define the component once, outside render:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { TimeGrid, type CreateGhostArgs } from "@super-calendar/dom";
|
|
139
|
+
import { format } from "date-fns";
|
|
140
|
+
|
|
141
|
+
function DraftPreview({ start, end }: CreateGhostArgs) {
|
|
142
|
+
return <strong>{`New event ${format(start, "HH:mm")} - ${format(end, "HH:mm")}`}</strong>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
<TimeGrid date={date} events={events} onCreateEvent={create} renderCreateGhost={DraftPreview} />;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`start` and `end` are the range `onCreateEvent` would receive on release, which
|
|
149
|
+
can extend past a narrowed `minHour`/`maxHour` window. The content is clipped to
|
|
150
|
+
the preview, non-interactive, and hidden from assistive tech.
|
|
151
|
+
The range follows scrolling and zooming during a held sweep, even without another pointer move.
|
|
152
|
+
|
|
105
153
|
## Documentation
|
|
106
154
|
|
|
107
155
|
See the [full documentation](https://super-calendar.afonsojramos.me), the [quickstart](https://super-calendar.afonsojramos.me/quickstart), and the [API reference](https://super-calendar.afonsojramos.me/reference/api).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { CSSProperties, ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
3
|
-
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
4
|
-
//#region src/slots.d.ts
|
|
3
|
+
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs, CreateGhostArgs as CreateGhostArgs$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
5
4
|
/**
|
|
6
5
|
* Per-slot styling overrides. Give a slot a Tailwind/CSS class and/or an inline
|
|
7
6
|
* style; missing slots keep the built-in look.
|
|
@@ -29,8 +28,6 @@ interface ResolvedSlot {
|
|
|
29
28
|
style: CSSProperties | undefined;
|
|
30
29
|
"data-slot": string;
|
|
31
30
|
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/theme.d.ts
|
|
34
31
|
/**
|
|
35
32
|
* Theme for the react-dom renderer. Combines the shared color palette from
|
|
36
33
|
* `@super-calendar/core` with the DOM-specific pixel metrics and font stack.
|
|
@@ -55,8 +52,6 @@ export declare const defaultDomTheme: DomCalendarTheme;
|
|
|
55
52
|
export declare const darkDomTheme: DomCalendarTheme;
|
|
56
53
|
/** Merge a partial override onto a base theme (defaults to {@link defaultDomTheme}). */
|
|
57
54
|
export declare function mergeDomTheme(overrides?: Partial<DomCalendarTheme>, base?: DomCalendarTheme): DomCalendarTheme;
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/Agenda.d.ts
|
|
60
55
|
/**
|
|
61
56
|
* Styleable parts of {@link Agenda}. Pass a class or inline style per slot via the
|
|
62
57
|
* `classNames` / `styles` props.
|
|
@@ -120,8 +115,6 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
120
115
|
* ```
|
|
121
116
|
*/
|
|
122
117
|
export declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/YearView.d.ts
|
|
125
118
|
/**
|
|
126
119
|
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
127
120
|
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
@@ -186,8 +179,6 @@ interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
186
179
|
* renders for `mode="year"`.
|
|
187
180
|
*/
|
|
188
181
|
export declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/MonthView.d.ts
|
|
191
182
|
/**
|
|
192
183
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
193
184
|
* the `classNames` / `styles` props to restyle just that part.
|
|
@@ -327,13 +318,13 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
327
318
|
* ```
|
|
328
319
|
*/
|
|
329
320
|
export declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels: labelsProp, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
330
|
-
|
|
331
|
-
|
|
321
|
+
/** Styleable parts of the built-in move and resize actions. */
|
|
322
|
+
type EventActionsSlot = "eventActionsTrigger" | "eventActionsList" | "eventActions" | "eventAction";
|
|
332
323
|
/**
|
|
333
324
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
334
325
|
* the `classNames` / `styles` props.
|
|
335
326
|
*/
|
|
336
|
-
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
327
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
337
328
|
/** Props passed to a custom time-grid event renderer. */
|
|
338
329
|
interface DomRenderEventArgs<T = unknown> {
|
|
339
330
|
/** The event to render. */
|
|
@@ -485,6 +476,16 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
485
476
|
onPressCell?: (date: Date) => void;
|
|
486
477
|
/** Drag empty grid space to create; called with the swept start/end. */
|
|
487
478
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
479
|
+
/**
|
|
480
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
481
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
482
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, and
|
|
483
|
+
* re-renders as the sweep changes them. The grid keeps positioning, sizing and
|
|
484
|
+
* styling the preview and clips the content to it; the content is
|
|
485
|
+
* non-interactive and hidden from assistive tech. Renders only while a sweep
|
|
486
|
+
* can create, so it needs `onCreateEvent` and does not enable creation itself.
|
|
487
|
+
*/
|
|
488
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
488
489
|
/** Fires when an event drag begins (e.g. to trigger haptics). */
|
|
489
490
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
490
491
|
/**
|
|
@@ -492,6 +493,8 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
492
493
|
* Return `false` to reject the drop (the event snaps back).
|
|
493
494
|
*/
|
|
494
495
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
496
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
497
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
495
498
|
/**
|
|
496
499
|
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
497
500
|
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
@@ -516,8 +519,6 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
516
519
|
* ```
|
|
517
520
|
*/
|
|
518
521
|
export declare const TimeGrid: <T = unknown>(props: TimeGridProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
519
|
-
//#endregion
|
|
520
|
-
//#region src/Calendar.d.ts
|
|
521
522
|
/**
|
|
522
523
|
* Styleable parts across every view {@link Calendar} can render. Only the slots
|
|
523
524
|
* for the active `mode` apply; the rest are ignored. See {@link MonthViewSlot},
|
|
@@ -658,6 +659,11 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
658
659
|
* dragged (`start` at midnight of the first, `end` at midnight after the last).
|
|
659
660
|
*/
|
|
660
661
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
662
|
+
/**
|
|
663
|
+
* A component that draws content inside the time-grid drag-to-create preview;
|
|
664
|
+
* see `TimeGrid`'s prop of the same name. Applies to the week/day grid only.
|
|
665
|
+
*/
|
|
666
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
661
667
|
/** Fires when an event drag begins. */
|
|
662
668
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
663
669
|
/**
|
|
@@ -666,6 +672,8 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
666
672
|
* days dragged so the time of day and duration are kept.
|
|
667
673
|
*/
|
|
668
674
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
675
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
676
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
669
677
|
/** Tap a day's column header. */
|
|
670
678
|
onPressDateHeader?: (day: Date) => void;
|
|
671
679
|
/** Custom time-grid event renderer. */
|
|
@@ -738,8 +746,6 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
738
746
|
* ```
|
|
739
747
|
*/
|
|
740
748
|
export declare const Calendar: <T = unknown>(props: CalendarProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
741
|
-
//#endregion
|
|
742
|
-
//#region src/MonthList.d.ts
|
|
743
749
|
/**
|
|
744
750
|
* Styleable parts of {@link MonthList}. The shared weekday header uses `weekdays`
|
|
745
751
|
* / `weekday`; every other slot is forwarded to each month's {@link MonthView}
|
|
@@ -815,8 +821,6 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
815
821
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
816
822
|
*/
|
|
817
823
|
export declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
818
|
-
//#endregion
|
|
819
|
-
//#region src/DateRangePicker.d.ts
|
|
820
824
|
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|
|
821
825
|
type DatePickerSlot = "trigger" | "popover" | "footer" | "clear";
|
|
822
826
|
interface PickerBaseProps extends DateSelectionConstraints$1, SlotStyleProps<DatePickerSlot | MonthListSlot> {
|
|
@@ -826,7 +830,7 @@ interface PickerBaseProps extends DateSelectionConstraints$1, SlotStyleProps<Dat
|
|
|
826
830
|
height?: number;
|
|
827
831
|
/** Placeholder shown on the trigger when nothing is selected. */
|
|
828
832
|
placeholder?: string;
|
|
829
|
-
/** Disable the
|
|
833
|
+
/** Disable the field and close its popover. Re-enabling leaves the popover closed. */
|
|
830
834
|
disabled?: boolean;
|
|
831
835
|
/** Theme overrides for the calendar. */
|
|
832
836
|
theme?: Partial<DomCalendarTheme>;
|
|
@@ -877,13 +881,11 @@ interface DateRangePickerProps extends PickerBaseProps {
|
|
|
877
881
|
* ```
|
|
878
882
|
*/
|
|
879
883
|
export declare function DateRangePicker({ value, onChange, formatLabel, weekStartsOn, height, placeholder, disabled, theme: themeOverrides, className, style, classNames, styles, minDate, maxDate, isDateDisabled }: DateRangePickerProps): ReactElement;
|
|
880
|
-
//#endregion
|
|
881
|
-
//#region src/ResourceTimeline.d.ts
|
|
882
884
|
/**
|
|
883
885
|
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
884
886
|
* slot via the `classNames` / `styles` props.
|
|
885
887
|
*/
|
|
886
|
-
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
888
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
887
889
|
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
888
890
|
interface Resource {
|
|
889
891
|
/** Stable id events reference via their `resourceId`. */
|
|
@@ -958,10 +960,25 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
958
960
|
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
959
961
|
*/
|
|
960
962
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
963
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
964
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
961
965
|
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
962
966
|
onPressCell?: (at: Date, resource: Resource) => void;
|
|
963
967
|
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
964
968
|
onCreateEvent?: (start: Date, end: Date, resource: Resource) => void;
|
|
969
|
+
/**
|
|
970
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
971
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
972
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, plus
|
|
973
|
+
* the lane's resource, and re-renders as the sweep changes them. The board
|
|
974
|
+
* keeps positioning, sizing and styling the preview and clips the content to
|
|
975
|
+
* it; the content is non-interactive and hidden from assistive tech. Renders
|
|
976
|
+
* only while a sweep can create, so it needs `onCreateEvent` and does not
|
|
977
|
+
* enable creation itself. Applies to both orientations.
|
|
978
|
+
*/
|
|
979
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1 & {
|
|
980
|
+
resource: Resource;
|
|
981
|
+
}>;
|
|
965
982
|
/**
|
|
966
983
|
* Shade the hours outside this window, per lane. Same shape as the Calendar's
|
|
967
984
|
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
@@ -987,6 +1004,11 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
987
1004
|
renderResourceHeader?: (resource: Resource, index: number) => ReactNode;
|
|
988
1005
|
/** Snap dragged events to this many minutes (default 15). */
|
|
989
1006
|
dragStepMinutes?: number;
|
|
1007
|
+
/**
|
|
1008
|
+
* Words for the move and resize actions and the event labels. Keys you omit
|
|
1009
|
+
* stay in English (`defaultCalendarLabels`).
|
|
1010
|
+
*/
|
|
1011
|
+
labels?: Partial<CalendarLabels$1>;
|
|
990
1012
|
/** Show the current-time line when `date` is today (default true). */
|
|
991
1013
|
showNowIndicator?: boolean;
|
|
992
1014
|
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
@@ -1014,6 +1036,5 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
1014
1036
|
* />
|
|
1015
1037
|
* ```
|
|
1016
1038
|
*/
|
|
1017
|
-
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, onPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
1018
|
-
|
|
1019
|
-
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type DatePickerProps, type DatePickerSlot, type DateRange, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, type MonthListProps, type MonthListSlot, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ResourceTimelineSlot, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
|
1039
|
+
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, getEventId, onPressCell, onCreateEvent, renderCreateGhost, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, labels: labelsProp, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
1040
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CreateGhostArgs, type DatePickerProps, type DatePickerSlot, type DateRange, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, type MonthListProps, type MonthListSlot, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ResourceTimelineSlot, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
2
|
import { CSSProperties, ComponentType, ReactElement, ReactNode, RefAttributes } from "react";
|
|
3
|
-
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, CalendarMode, CalendarMode as CalendarMode$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
4
|
-
//#region src/slots.d.ts
|
|
3
|
+
import { BusinessHours, BusinessHours as BusinessHours$1, BusinessHoursBand, BusinessHoursBand as BusinessHoursBand$1, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarEvent as CalendarEvent$1, CalendarHandle, CalendarHandle as CalendarHandle$1, CalendarLabels, CalendarLabels as CalendarLabels$1, CalendarMode, CalendarMode as CalendarMode$1, CreateGhostArgs, CreateGhostArgs as CreateGhostArgs$1, DateRange, DateRange as DateRange$1, DateSelectionConstraints, DateSelectionConstraints as DateSelectionConstraints$1, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventAccessibilityLabeler as EventAccessibilityLabeler$1, ICalEvent, ICalendarEvent, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, PositionedEvent, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, TimeGridMode as TimeGridMode$1, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekStartsOn as WeekStartsOn$1, WeekdayFormat, WeekdayFormat as WeekdayFormat$1, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken } from "@super-calendar/core";
|
|
5
4
|
/**
|
|
6
5
|
* Per-slot styling overrides. Give a slot a Tailwind/CSS class and/or an inline
|
|
7
6
|
* style; missing slots keep the built-in look.
|
|
@@ -29,8 +28,6 @@ interface ResolvedSlot {
|
|
|
29
28
|
style: CSSProperties | undefined;
|
|
30
29
|
"data-slot": string;
|
|
31
30
|
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/theme.d.ts
|
|
34
31
|
/**
|
|
35
32
|
* Theme for the react-dom renderer. Combines the shared color palette from
|
|
36
33
|
* `@super-calendar/core` with the DOM-specific pixel metrics and font stack.
|
|
@@ -55,8 +52,6 @@ export declare const defaultDomTheme: DomCalendarTheme;
|
|
|
55
52
|
export declare const darkDomTheme: DomCalendarTheme;
|
|
56
53
|
/** Merge a partial override onto a base theme (defaults to {@link defaultDomTheme}). */
|
|
57
54
|
export declare function mergeDomTheme(overrides?: Partial<DomCalendarTheme>, base?: DomCalendarTheme): DomCalendarTheme;
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/Agenda.d.ts
|
|
60
55
|
/**
|
|
61
56
|
* Styleable parts of {@link Agenda}. Pass a class or inline style per slot via the
|
|
62
57
|
* `classNames` / `styles` props.
|
|
@@ -120,8 +115,6 @@ interface AgendaProps<T = unknown> extends SlotStyleProps<AgendaSlot> {
|
|
|
120
115
|
* ```
|
|
121
116
|
*/
|
|
122
117
|
export declare function Agenda<T = unknown>({ events, locale, ampm, activeDate, theme: themeOverrides, height, renderEvent, eventAccessibilityLabel, onPressEvent, onPressDay, className, style, classNames, styles }: AgendaProps<T>): ReactElement;
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/YearView.d.ts
|
|
125
118
|
/**
|
|
126
119
|
* Styleable parts of {@link YearView}. Pass a class or inline style per slot
|
|
127
120
|
* via the `classNames` / `styles` props; day cells carry `data-today`,
|
|
@@ -186,8 +179,6 @@ interface YearViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
186
179
|
* renders for `mode="year"`.
|
|
187
180
|
*/
|
|
188
181
|
export declare function YearView<T = unknown>({ date, events, weekStartsOn, hiddenDays, locale, labels: labelsProp, activeDate, selectedRange, selectedDates, minDate, maxDate, isDateDisabled, minMonthWidth, onPressDay, onPressMonth, onSelectDrag, onCreateEvent, theme: themeOverrides, className, style, classNames, styles }: YearViewProps<T>): ReactElement;
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/MonthView.d.ts
|
|
191
182
|
/**
|
|
192
183
|
* Styleable parts of {@link MonthView}. Pass a class or inline style per slot via
|
|
193
184
|
* the `classNames` / `styles` props to restyle just that part.
|
|
@@ -327,13 +318,13 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
327
318
|
* ```
|
|
328
319
|
*/
|
|
329
320
|
export declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels: labelsProp, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
330
|
-
|
|
331
|
-
|
|
321
|
+
/** Styleable parts of the built-in move and resize actions. */
|
|
322
|
+
type EventActionsSlot = "eventActionsTrigger" | "eventActionsList" | "eventActions" | "eventAction";
|
|
332
323
|
/**
|
|
333
324
|
* Styleable parts of {@link TimeGrid}. Pass a class or inline style per slot via
|
|
334
325
|
* the `classNames` / `styles` props.
|
|
335
326
|
*/
|
|
336
|
-
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
327
|
+
type TimeGridSlot = "header" | "weekNumber" | "columnHeader" | "columnHeaderWeekday" | "columnHeaderDate" | "allDayLane" | "allDayLabel" | "allDayColumn" | "allDayEvent" | "hourGutter" | "hourLabel" | "dayColumn" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
337
328
|
/** Props passed to a custom time-grid event renderer. */
|
|
338
329
|
interface DomRenderEventArgs<T = unknown> {
|
|
339
330
|
/** The event to render. */
|
|
@@ -485,6 +476,16 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
485
476
|
onPressCell?: (date: Date) => void;
|
|
486
477
|
/** Drag empty grid space to create; called with the swept start/end. */
|
|
487
478
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
479
|
+
/**
|
|
480
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
481
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
482
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, and
|
|
483
|
+
* re-renders as the sweep changes them. The grid keeps positioning, sizing and
|
|
484
|
+
* styling the preview and clips the content to it; the content is
|
|
485
|
+
* non-interactive and hidden from assistive tech. Renders only while a sweep
|
|
486
|
+
* can create, so it needs `onCreateEvent` and does not enable creation itself.
|
|
487
|
+
*/
|
|
488
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
488
489
|
/** Fires when an event drag begins (e.g. to trigger haptics). */
|
|
489
490
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
490
491
|
/**
|
|
@@ -492,6 +493,8 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
492
493
|
* Return `false` to reject the drop (the event snaps back).
|
|
493
494
|
*/
|
|
494
495
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
496
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
497
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
495
498
|
/**
|
|
496
499
|
* Page the grid to a new anchor date. Supplying it alongside `onDragEvent`
|
|
497
500
|
* turns on edge auto-advance: dragging an event to the left/right edge and
|
|
@@ -516,8 +519,6 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
516
519
|
* ```
|
|
517
520
|
*/
|
|
518
521
|
export declare const TimeGrid: <T = unknown>(props: TimeGridProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
519
|
-
//#endregion
|
|
520
|
-
//#region src/Calendar.d.ts
|
|
521
522
|
/**
|
|
522
523
|
* Styleable parts across every view {@link Calendar} can render. Only the slots
|
|
523
524
|
* for the active `mode` apply; the rest are ignored. See {@link MonthViewSlot},
|
|
@@ -658,6 +659,11 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
658
659
|
* dragged (`start` at midnight of the first, `end` at midnight after the last).
|
|
659
660
|
*/
|
|
660
661
|
onCreateEvent?: (start: Date, end: Date) => void;
|
|
662
|
+
/**
|
|
663
|
+
* A component that draws content inside the time-grid drag-to-create preview;
|
|
664
|
+
* see `TimeGrid`'s prop of the same name. Applies to the week/day grid only.
|
|
665
|
+
*/
|
|
666
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1>;
|
|
661
667
|
/** Fires when an event drag begins. */
|
|
662
668
|
onDragStart?: (event: CalendarEvent$1<T>) => void;
|
|
663
669
|
/**
|
|
@@ -666,6 +672,8 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
666
672
|
* days dragged so the time of day and duration are kept.
|
|
667
673
|
*/
|
|
668
674
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date) => void | boolean;
|
|
675
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
676
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
669
677
|
/** Tap a day's column header. */
|
|
670
678
|
onPressDateHeader?: (day: Date) => void;
|
|
671
679
|
/** Custom time-grid event renderer. */
|
|
@@ -738,8 +746,6 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
738
746
|
* ```
|
|
739
747
|
*/
|
|
740
748
|
export declare const Calendar: <T = unknown>(props: CalendarProps<T> & RefAttributes<CalendarHandle$1>) => ReactElement;
|
|
741
|
-
//#endregion
|
|
742
|
-
//#region src/MonthList.d.ts
|
|
743
749
|
/**
|
|
744
750
|
* Styleable parts of {@link MonthList}. The shared weekday header uses `weekdays`
|
|
745
751
|
* / `weekday`; every other slot is forwarded to each month's {@link MonthView}
|
|
@@ -815,8 +821,6 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
815
821
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
816
822
|
*/
|
|
817
823
|
export declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
818
|
-
//#endregion
|
|
819
|
-
//#region src/DateRangePicker.d.ts
|
|
820
824
|
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|
|
821
825
|
type DatePickerSlot = "trigger" | "popover" | "footer" | "clear";
|
|
822
826
|
interface PickerBaseProps extends DateSelectionConstraints$1, SlotStyleProps<DatePickerSlot | MonthListSlot> {
|
|
@@ -826,7 +830,7 @@ interface PickerBaseProps extends DateSelectionConstraints$1, SlotStyleProps<Dat
|
|
|
826
830
|
height?: number;
|
|
827
831
|
/** Placeholder shown on the trigger when nothing is selected. */
|
|
828
832
|
placeholder?: string;
|
|
829
|
-
/** Disable the
|
|
833
|
+
/** Disable the field and close its popover. Re-enabling leaves the popover closed. */
|
|
830
834
|
disabled?: boolean;
|
|
831
835
|
/** Theme overrides for the calendar. */
|
|
832
836
|
theme?: Partial<DomCalendarTheme>;
|
|
@@ -877,13 +881,11 @@ interface DateRangePickerProps extends PickerBaseProps {
|
|
|
877
881
|
* ```
|
|
878
882
|
*/
|
|
879
883
|
export declare function DateRangePicker({ value, onChange, formatLabel, weekStartsOn, height, placeholder, disabled, theme: themeOverrides, className, style, classNames, styles, minDate, maxDate, isDateDisabled }: DateRangePickerProps): ReactElement;
|
|
880
|
-
//#endregion
|
|
881
|
-
//#region src/ResourceTimeline.d.ts
|
|
882
884
|
/**
|
|
883
885
|
* Styleable parts of {@link ResourceTimeline}. Pass a class or inline style per
|
|
884
886
|
* slot via the `classNames` / `styles` props.
|
|
885
887
|
*/
|
|
886
|
-
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost";
|
|
888
|
+
type ResourceTimelineSlot = "header" | "corner" | "timeAxis" | "hourTick" | "resourceLabel" | "row" | "track" | "gridLines" | "businessHours" | "backgroundEvent" | "event" | "eventBox" | "nowIndicator" | "createGhost" | EventActionsSlot;
|
|
887
889
|
/** A schedulable lane (room, person, machine) that events are grouped under. */
|
|
888
890
|
interface Resource {
|
|
889
891
|
/** Stable id events reference via their `resourceId`. */
|
|
@@ -958,10 +960,25 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
958
960
|
* proposed new start/end. Return `false` to reject the drop (it snaps back).
|
|
959
961
|
*/
|
|
960
962
|
onDragEvent?: (event: CalendarEvent$1<T>, start: Date, end: Date, resource: Resource) => void | boolean;
|
|
963
|
+
/** Stable, unique event identity for the web editing dialog across data refreshes. */
|
|
964
|
+
getEventId?: (event: CalendarEvent$1<T>) => string | number;
|
|
961
965
|
/** Tap empty lane space; called with the snapped time and the lane's resource. */
|
|
962
966
|
onPressCell?: (at: Date, resource: Resource) => void;
|
|
963
967
|
/** Drag empty lane space to create; called with the swept start/end and the lane's resource. */
|
|
964
968
|
onCreateEvent?: (start: Date, end: Date, resource: Resource) => void;
|
|
969
|
+
/**
|
|
970
|
+
* A component that draws content inside the drag-to-create preview, such as a
|
|
971
|
+
* draft title and the live time range. It receives the snapped `start` and
|
|
972
|
+
* `end` that `onCreateEvent` would get if the pointer were released now, plus
|
|
973
|
+
* the lane's resource, and re-renders as the sweep changes them. The board
|
|
974
|
+
* keeps positioning, sizing and styling the preview and clips the content to
|
|
975
|
+
* it; the content is non-interactive and hidden from assistive tech. Renders
|
|
976
|
+
* only while a sweep can create, so it needs `onCreateEvent` and does not
|
|
977
|
+
* enable creation itself. Applies to both orientations.
|
|
978
|
+
*/
|
|
979
|
+
renderCreateGhost?: ComponentType<CreateGhostArgs$1 & {
|
|
980
|
+
resource: Resource;
|
|
981
|
+
}>;
|
|
965
982
|
/**
|
|
966
983
|
* Shade the hours outside this window, per lane. Same shape as the Calendar's
|
|
967
984
|
* `businessHours` plus the lane's resource, so per-resource opening hours work
|
|
@@ -987,6 +1004,11 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
987
1004
|
renderResourceHeader?: (resource: Resource, index: number) => ReactNode;
|
|
988
1005
|
/** Snap dragged events to this many minutes (default 15). */
|
|
989
1006
|
dragStepMinutes?: number;
|
|
1007
|
+
/**
|
|
1008
|
+
* Words for the move and resize actions and the event labels. Keys you omit
|
|
1009
|
+
* stay in English (`defaultCalendarLabels`).
|
|
1010
|
+
*/
|
|
1011
|
+
labels?: Partial<CalendarLabels$1>;
|
|
990
1012
|
/** Show the current-time line when `date` is today (default true). */
|
|
991
1013
|
showNowIndicator?: boolean;
|
|
992
1014
|
/** Fixed "now" instant for the indicator (doesn't tick). Defaults to the device clock. */
|
|
@@ -1014,6 +1036,5 @@ interface ResourceTimelineProps<T = unknown> extends SlotStyleProps<ResourceTime
|
|
|
1014
1036
|
* />
|
|
1015
1037
|
* ```
|
|
1016
1038
|
*/
|
|
1017
|
-
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, onPressCell, onCreateEvent, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
1018
|
-
|
|
1019
|
-
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type DatePickerProps, type DatePickerSlot, type DateRange, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, type MonthListProps, type MonthListSlot, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ResourceTimelineSlot, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|
|
1039
|
+
export declare function ResourceTimeline<T = unknown>({ date, orientation, resources: allResources, resourcesPerPage, resourcePage, events, resourceId, startHour, endHour, hourWidth, hourHeight, rowHeight, labelWidth, ampm, theme: themeOverrides, renderEvent, onPressEvent, onDragEvent, getEventId, onPressCell, onCreateEvent, renderCreateGhost, businessHours, renderBusinessHours, renderResourceHeader, dragStepMinutes, labels: labelsProp, showNowIndicator, now: nowProp, timeZone, className, style, classNames, styles }: ResourceTimelineProps<T>): ReactElement;
|
|
1040
|
+
export { type AgendaProps, type AgendaSlot, type BusinessHours, type BusinessHoursBand, type CalendarEvent, type CalendarHandle, type CalendarLabels, type CalendarMode, type CalendarProps, type CalendarSlot, type CreateGhostArgs, type DatePickerProps, type DatePickerSlot, type DateRange, type DateRangePickerProps, type DateSelectionConstraints, type DaySelectionState, type DomAgendaEvent, type DomAgendaEventArgs, type DomCalendarTheme, type DomMonthEvent, type DomMonthEventArgs, type DomRenderEvent, type DomRenderEventArgs, type EventAccessibilityLabelContext, type EventAccessibilityLabeler, type ICalEvent, type ICalendarEvent, type MonthEventSegment, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, type MonthListProps, type MonthListSlot, type MonthViewProps, type MonthViewSlot, type MonthWeekEvents, type PositionedEvent, type RecurrenceFrequency, type RecurrenceRule, type ResolvedSlot, type Resource, type ResourceEventArgs, type ResourceTimelineProps, type ResourceTimelineSlot, type ScrollToTimeOptions, type SlotDefault, type SlotStyleProps, type TimeGridMode, type TimeGridProps, type TimeGridSlot, type ToICalendarOptions, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, type WeekdayFormat, type YearViewProps, type YearViewSlot, backgroundBandsForDay, buildMonthGrid, daySelectionState, defaultCalendarLabels, expandRecurringEvents, getViewDays, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isWithinDateRange, layoutDayEvents, layoutMonthWeek, nextDateRange, parseICalendar, toICalendar, useDateRange, useEventSource, useMonthGrid, useNow, weekdayFormatToken };
|