@super-calendar/native 2.1.4 → 2.2.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 +1 -1
- package/dist/{DefaultMonthEvent-D2s0x2Bn.d.mts → DefaultMonthEvent-BlfDkmF5.d.mts} +61 -9
- package/dist/{DefaultMonthEvent-DaTEIcRs.d.ts → DefaultMonthEvent-Cagj4aBo.d.ts} +61 -9
- package/dist/{MonthList-oXiArmbu.js → MonthList-DWAjW5R7.js} +98 -31
- package/dist/{MonthList-DXvjxiyu.mjs → MonthList-DZx8rPle.mjs} +94 -33
- package/dist/index.d.mts +112 -8
- package/dist/index.d.ts +112 -8
- package/dist/index.js +476 -107
- package/dist/index.mjs +472 -110
- package/dist/picker.d.mts +1 -1
- package/dist/picker.d.ts +1 -1
- package/dist/picker.js +1 -1
- package/dist/picker.mjs +1 -1
- package/package.json +2 -2
- package/src/components/Agenda.tsx +2 -2
- package/src/components/AllDayLane.tsx +11 -2
- package/src/components/Calendar.tsx +38 -4
- package/src/components/DefaultEvent.tsx +68 -47
- package/src/components/DefaultMonthEvent.tsx +11 -8
- package/src/components/MonthList.tsx +16 -3
- package/src/components/MonthPager.tsx +19 -11
- package/src/components/MonthView.tsx +40 -11
- package/src/components/ResourceTimeline.tsx +441 -0
- package/src/components/TimeGrid.tsx +44 -7
- package/src/index.tsx +10 -0
- package/src/theme.ts +62 -1
- package/src/types.ts +9 -0
- package/src/utils/withEventAccessibilityLabel.tsx +30 -0
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as withEventAccessibilityLabel, c as darkTheme, d as useCalendarTheme, i as MonthView, l as defaultTheme, n as DefaultMonthEvent, o as useWebPagerKeys, r as MonthPager, s as CalendarThemeProvider, t as MonthList, u as mergeTheme } from "./MonthList-DZx8rPle.mjs";
|
|
2
2
|
import { addDays, differenceInCalendarDays, endOfDay, endOfMonth, endOfWeek, format, getHours, getISOWeek, getMinutes, isSameDay, startOfDay, startOfMonth, startOfWeek } from "date-fns";
|
|
3
3
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import Animated, { runOnJS, scrollTo, useAnimatedReaction, useAnimatedRef, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useSharedValue } from "react-native-reanimated";
|
|
5
|
-
import { buildMonthGrid, buildMonthWeeks, cellRangeFromDrag, closedHourBands, daySelectionState, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, expandRecurringEvents, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, minutesIntoDay, nextDateRange, resolveDraggedBounds, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toZonedTime, useDateRange, useMonthGrid, viewDayCount } from "@super-calendar/core";
|
|
5
|
+
import { buildMonthGrid, buildMonthWeeks, cellRangeFromDrag, closedHourBands, daySelectionState, eventAccessibilityLabel, eventChipLayout, eventTimeLabel, eventsInTimeZone, expandRecurringEvents, formatHour, getIsToday, getIsToday as getIsToday$1, getViewDays, getViewDays as getViewDays$1, getWeekDays, isAllDayEvent, isAllDayEvent as isAllDayEvent$1, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isSameCalendarDay as isSameCalendarDay$1, isWeekend, isWeekend as isWeekend$1, isWithinDateRange, layoutDayEvents, layoutDayEvents as layoutDayEvents$1, minutesIntoDay, nextDateRange, resolveDraggedBounds, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toZonedTime, useDateRange, useMonthGrid, viewDayCount, weekdayFormatToken, weekdayFormatToken as weekdayFormatToken$1 } from "@super-calendar/core";
|
|
6
6
|
import { LegendList } from "@legendapp/list/react-native";
|
|
7
|
-
import { Platform, Pressable, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
7
|
+
import { Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from "react-native";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
10
10
|
//#region src/components/Agenda.tsx
|
|
@@ -43,14 +43,14 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
43
43
|
if (item.kind === "header") {
|
|
44
44
|
const isHighlighted = activeDate ? isSameDay(item.date, activeDate) : getIsToday$1(item.date);
|
|
45
45
|
return /* @__PURE__ */ jsx(Text, {
|
|
46
|
-
style: [styles$
|
|
46
|
+
style: [styles$4.header, { color: isHighlighted ? theme.colors.todayBackground : theme.colors.textMuted }],
|
|
47
47
|
onPress: onPressDay ? () => onPressDay(item.date) : void 0,
|
|
48
48
|
accessibilityRole: onPressDay ? "button" : "header",
|
|
49
49
|
children: format(item.date, "EEEE, d LLLL", { locale })
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
return /* @__PURE__ */ jsx(View, {
|
|
53
|
-
style: styles$
|
|
53
|
+
style: [styles$4.eventRow, theme.containers.agendaRow],
|
|
54
54
|
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
55
55
|
event: item.event,
|
|
56
56
|
mode: "schedule",
|
|
@@ -69,11 +69,11 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
69
69
|
RenderEventComponent
|
|
70
70
|
]);
|
|
71
71
|
if (rows.length === 0) return /* @__PURE__ */ jsx(Text, {
|
|
72
|
-
style: [styles$
|
|
72
|
+
style: [styles$4.empty, { color: theme.colors.textMuted }],
|
|
73
73
|
children: "No events"
|
|
74
74
|
});
|
|
75
75
|
return /* @__PURE__ */ jsx(LegendList, {
|
|
76
|
-
style: styles$
|
|
76
|
+
style: [styles$4.list, theme.containers.agendaList],
|
|
77
77
|
data: rows,
|
|
78
78
|
keyExtractor: keyExtractorRow,
|
|
79
79
|
renderItem,
|
|
@@ -81,7 +81,7 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
81
81
|
recycleItems: false
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
const styles$
|
|
84
|
+
const styles$4 = StyleSheet.create({
|
|
85
85
|
list: { flex: 1 },
|
|
86
86
|
header: {
|
|
87
87
|
fontSize: 13,
|
|
@@ -114,7 +114,7 @@ const numericStyle = (value, fallback) => typeof value === "number" ? value : fa
|
|
|
114
114
|
* only shows once a full line is free beneath the title. Pass your own
|
|
115
115
|
* `renderEvent` to `<Calendar>` to replace it entirely.
|
|
116
116
|
*/
|
|
117
|
-
function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, cellStyle, onPress, onLongPress }) {
|
|
117
|
+
function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }) {
|
|
118
118
|
const theme = useCalendarTheme();
|
|
119
119
|
const isAllDayEvent = isAllDay ?? false;
|
|
120
120
|
const timeLabel = eventTimeLabel({
|
|
@@ -128,7 +128,7 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
128
128
|
});
|
|
129
129
|
const ellipsizeMode = titleEllipsizeMode(ellipsizeTitle);
|
|
130
130
|
const titleLineHeight = numericStyle(theme.text.eventTitle.lineHeight, FALLBACK_TITLE_LINE_HEIGHT);
|
|
131
|
-
const accessibilityLabel = eventAccessibilityLabel({
|
|
131
|
+
const accessibilityLabel = accessibilityLabelProp ?? eventAccessibilityLabel({
|
|
132
132
|
title: event.title,
|
|
133
133
|
isAllDay: isAllDayEvent,
|
|
134
134
|
start: event.start,
|
|
@@ -158,12 +158,16 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
158
158
|
const timeStyle = useAnimatedStyle(() => {
|
|
159
159
|
return { display: layout.value.showTime ? "flex" : "none" };
|
|
160
160
|
}, [layout]);
|
|
161
|
-
|
|
161
|
+
const contentStyle = useAnimatedStyle(() => {
|
|
162
|
+
const { titleMaxLines, showTime } = layout.value;
|
|
163
|
+
return { justifyContent: titleMaxLines === 1 && !showTime ? "center" : "flex-start" };
|
|
164
|
+
}, [layout]);
|
|
165
|
+
return /* @__PURE__ */ jsx(TouchableOpacity, {
|
|
162
166
|
style: [
|
|
163
|
-
styles$
|
|
164
|
-
isSchedule && styles$
|
|
167
|
+
styles$3.box,
|
|
168
|
+
isSchedule && styles$3.scheduleBox,
|
|
165
169
|
{ backgroundColor: theme.colors.eventBackground },
|
|
166
|
-
event.disabled && styles$
|
|
170
|
+
event.disabled && styles$3.disabled,
|
|
167
171
|
cellStyle
|
|
168
172
|
],
|
|
169
173
|
onPress,
|
|
@@ -172,46 +176,50 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
172
176
|
accessibilityRole: "button",
|
|
173
177
|
accessibilityLabel,
|
|
174
178
|
accessibilityState: { disabled: event.disabled ?? false },
|
|
175
|
-
children:
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
children: /* @__PURE__ */ jsxs(Animated.View, {
|
|
180
|
+
testID: "event-chip-content",
|
|
181
|
+
style: [styles$3.content, contentStyle],
|
|
182
|
+
children: [event.title ? fixedTitleLines == null ? /* @__PURE__ */ jsx(Animated.View, {
|
|
183
|
+
style: [styles$3.titleClip, titleClipStyle],
|
|
184
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
185
|
+
style: [
|
|
186
|
+
theme.text.eventTitle,
|
|
187
|
+
isSchedule && styles$3.scheduleTitle,
|
|
188
|
+
{ color: theme.colors.eventText }
|
|
189
|
+
],
|
|
190
|
+
ellipsizeMode,
|
|
191
|
+
allowFontScaling: false,
|
|
192
|
+
children: event.title
|
|
193
|
+
})
|
|
194
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
178
195
|
style: [
|
|
179
196
|
theme.text.eventTitle,
|
|
180
|
-
|
|
197
|
+
styles$3.title,
|
|
198
|
+
isSchedule && styles$3.scheduleTitle,
|
|
181
199
|
{ color: theme.colors.eventText }
|
|
182
200
|
],
|
|
201
|
+
numberOfLines: fixedTitleLines,
|
|
183
202
|
ellipsizeMode,
|
|
184
203
|
allowFontScaling: false,
|
|
185
204
|
children: event.title
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
style: [
|
|
202
|
-
styles$2.time,
|
|
203
|
-
isSchedule && styles$2.scheduleTime,
|
|
204
|
-
{ color: theme.colors.eventText }
|
|
205
|
-
],
|
|
206
|
-
numberOfLines: 2,
|
|
207
|
-
ellipsizeMode,
|
|
208
|
-
allowFontScaling: false,
|
|
209
|
-
children: timeLabel
|
|
210
|
-
})
|
|
211
|
-
}) : null]
|
|
205
|
+
}) : null, timeLabel ? /* @__PURE__ */ jsx(Animated.View, {
|
|
206
|
+
style: timeStyle,
|
|
207
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
208
|
+
style: [
|
|
209
|
+
styles$3.time,
|
|
210
|
+
isSchedule && styles$3.scheduleTime,
|
|
211
|
+
{ color: theme.colors.eventText }
|
|
212
|
+
],
|
|
213
|
+
numberOfLines: 2,
|
|
214
|
+
ellipsizeMode,
|
|
215
|
+
allowFontScaling: false,
|
|
216
|
+
children: timeLabel
|
|
217
|
+
})
|
|
218
|
+
}) : null]
|
|
219
|
+
})
|
|
212
220
|
});
|
|
213
221
|
}
|
|
214
|
-
const styles$
|
|
222
|
+
const styles$3 = StyleSheet.create({
|
|
215
223
|
box: {
|
|
216
224
|
flexGrow: 1,
|
|
217
225
|
flexShrink: 1,
|
|
@@ -236,6 +244,10 @@ const styles$2 = StyleSheet.create({
|
|
|
236
244
|
lineHeight: 18,
|
|
237
245
|
opacity: .75
|
|
238
246
|
},
|
|
247
|
+
content: {
|
|
248
|
+
flexGrow: 1,
|
|
249
|
+
flexShrink: 1
|
|
250
|
+
},
|
|
239
251
|
titleClip: { overflow: "hidden" },
|
|
240
252
|
title: { flexShrink: 1 },
|
|
241
253
|
time: {
|
|
@@ -295,18 +307,26 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
295
307
|
});
|
|
296
308
|
if (perDay.every((list) => list.length === 0)) return null;
|
|
297
309
|
return /* @__PURE__ */ jsxs(View, {
|
|
298
|
-
style: [
|
|
310
|
+
style: [
|
|
311
|
+
styles$2.lane,
|
|
312
|
+
{ borderBottomColor: theme.colors.gridLine },
|
|
313
|
+
theme.containers.allDayLane
|
|
314
|
+
],
|
|
299
315
|
children: [/* @__PURE__ */ jsx(View, {
|
|
300
|
-
style: [styles$
|
|
316
|
+
style: [styles$2.gutter, { width: hourColumnWidth }],
|
|
301
317
|
children: /* @__PURE__ */ jsx(Text, {
|
|
302
|
-
style: [styles$
|
|
318
|
+
style: [styles$2.label, { color: theme.colors.textMuted }],
|
|
303
319
|
allowFontScaling: false,
|
|
304
320
|
children: "all-day"
|
|
305
321
|
})
|
|
306
322
|
}), days.map((day, dayIndex) => /* @__PURE__ */ jsx(View, {
|
|
307
|
-
style: [
|
|
323
|
+
style: [
|
|
324
|
+
styles$2.column,
|
|
325
|
+
{ width: dayWidth },
|
|
326
|
+
theme.containers.allDayColumn
|
|
327
|
+
],
|
|
308
328
|
children: perDay[dayIndex].map((event, index) => /* @__PURE__ */ jsx(View, {
|
|
309
|
-
style: styles$
|
|
329
|
+
style: styles$2.chip,
|
|
310
330
|
children: /* @__PURE__ */ jsx(RenderEventComponent, {
|
|
311
331
|
event,
|
|
312
332
|
mode,
|
|
@@ -318,7 +338,7 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
318
338
|
}, day.toISOString()))]
|
|
319
339
|
});
|
|
320
340
|
}
|
|
321
|
-
const styles$
|
|
341
|
+
const styles$2 = StyleSheet.create({
|
|
322
342
|
lane: {
|
|
323
343
|
flexDirection: "row",
|
|
324
344
|
borderBottomWidth: StyleSheet.hairlineWidth
|
|
@@ -339,9 +359,9 @@ const styles$1 = StyleSheet.create({
|
|
|
339
359
|
//#endregion
|
|
340
360
|
//#region src/components/TimeGrid.tsx
|
|
341
361
|
const isWeb = Platform.OS === "web";
|
|
342
|
-
const MINUTES_PER_HOUR = 60;
|
|
362
|
+
const MINUTES_PER_HOUR$1 = 60;
|
|
343
363
|
const HOURS_PER_DAY = 24;
|
|
344
|
-
const MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
|
|
364
|
+
const MINUTES_PER_DAY = MINUTES_PER_HOUR$1 * HOURS_PER_DAY;
|
|
345
365
|
const PAGE_WINDOW = 180;
|
|
346
366
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
347
367
|
/** Default height in pixels of one hour row on the time grid. */
|
|
@@ -352,7 +372,7 @@ const DEFAULT_HOUR_COLUMN_WIDTH = 56;
|
|
|
352
372
|
const MIN_EVENT_HEIGHT = 32;
|
|
353
373
|
const EVENT_GAP = 2;
|
|
354
374
|
const DRAG_ACTIVATE_MS = 300;
|
|
355
|
-
const MOVE_ACTIVATE_MS = 500;
|
|
375
|
+
const MOVE_ACTIVATE_MS$1 = 500;
|
|
356
376
|
const DRAG_ACTIVATE_PX = 8;
|
|
357
377
|
const RESIZE_HANDLE_HEIGHT = 14;
|
|
358
378
|
const DEFAULT_DRAG_STEP_MINUTES = 15;
|
|
@@ -446,12 +466,12 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
446
466
|
moveOffsetX.value = 0;
|
|
447
467
|
return;
|
|
448
468
|
}
|
|
449
|
-
moveOffset.value = minuteDelta / MINUTES_PER_HOUR * cellHeight.value;
|
|
469
|
+
moveOffset.value = minuteDelta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
450
470
|
moveOffsetX.value = dayDelta * dayWidth;
|
|
451
471
|
const totalDelta = minuteDelta + dayDelta * MINUTES_PER_DAY;
|
|
452
472
|
runOnJS(commitDrag)(totalDelta, totalDelta);
|
|
453
473
|
});
|
|
454
|
-
return isWeb ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX]).activeOffsetY([-8, DRAG_ACTIVATE_PX]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS);
|
|
474
|
+
return isWeb ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX]).activeOffsetY([-8, DRAG_ACTIVATE_PX]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS$1);
|
|
455
475
|
}, [
|
|
456
476
|
draggable,
|
|
457
477
|
snapMinutes,
|
|
@@ -474,7 +494,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
474
494
|
resizeDelta.value = 0;
|
|
475
495
|
return;
|
|
476
496
|
}
|
|
477
|
-
resizeDelta.value = delta / MINUTES_PER_HOUR * cellHeight.value;
|
|
497
|
+
resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
478
498
|
runOnJS(commitDrag)(0, delta);
|
|
479
499
|
}), [
|
|
480
500
|
resizable,
|
|
@@ -488,12 +508,13 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
488
508
|
const handleLongPress = !draggable && onLongPress ? () => onLongPress(positioned.event) : void 0;
|
|
489
509
|
const box = /* @__PURE__ */ jsxs(Animated.View, {
|
|
490
510
|
style: [
|
|
491
|
-
styles.eventBox,
|
|
511
|
+
styles$1.eventBox,
|
|
492
512
|
{
|
|
493
513
|
left,
|
|
494
514
|
width
|
|
495
515
|
},
|
|
496
|
-
boxStyle
|
|
516
|
+
boxStyle,
|
|
517
|
+
theme.containers.timeGridEvent
|
|
497
518
|
],
|
|
498
519
|
children: [/* @__PURE__ */ jsx(RenderEventComponent, {
|
|
499
520
|
event: positioned.event,
|
|
@@ -506,8 +527,8 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
506
527
|
}), resizable ? /* @__PURE__ */ jsx(GestureDetector, {
|
|
507
528
|
gesture: resizeGesture,
|
|
508
529
|
children: /* @__PURE__ */ jsx(Animated.View, {
|
|
509
|
-
style: styles.resizeHandle,
|
|
510
|
-
children: showDragHandle ? /* @__PURE__ */ jsx(View, { style: [styles.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
530
|
+
style: styles$1.resizeHandle,
|
|
531
|
+
children: showDragHandle ? /* @__PURE__ */ jsx(View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
511
532
|
})
|
|
512
533
|
}) : null]
|
|
513
534
|
});
|
|
@@ -522,8 +543,8 @@ const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hour
|
|
|
522
543
|
const animatedStyle = useAnimatedStyle(() => ({ top: (hour - minHour) * cellHeight.value }), [hour, minHour]);
|
|
523
544
|
return /* @__PURE__ */ jsxs(Animated.View, {
|
|
524
545
|
style: [
|
|
525
|
-
styles.hourRow,
|
|
526
|
-
styles.nonInteractive,
|
|
546
|
+
styles$1.hourRow,
|
|
547
|
+
styles$1.nonInteractive,
|
|
527
548
|
animatedStyle
|
|
528
549
|
],
|
|
529
550
|
children: [hourComponent ? /* @__PURE__ */ jsx(View, {
|
|
@@ -532,7 +553,7 @@ const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hour
|
|
|
532
553
|
}) : /* @__PURE__ */ jsx(Text, {
|
|
533
554
|
style: [
|
|
534
555
|
theme.text.hourLabel,
|
|
535
|
-
styles.hourLabel,
|
|
556
|
+
styles$1.hourLabel,
|
|
536
557
|
{
|
|
537
558
|
width: hourColumnWidth,
|
|
538
559
|
color: theme.colors.textMuted
|
|
@@ -540,7 +561,7 @@ const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hour
|
|
|
540
561
|
],
|
|
541
562
|
allowFontScaling: false,
|
|
542
563
|
children: label
|
|
543
|
-
}), /* @__PURE__ */ jsx(View, { style: [styles.hourLine, { backgroundColor: theme.colors.gridLine }] })]
|
|
564
|
+
}), /* @__PURE__ */ jsx(View, { style: [styles$1.hourLine, { backgroundColor: theme.colors.gridLine }] })]
|
|
544
565
|
});
|
|
545
566
|
};
|
|
546
567
|
const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth }) => {
|
|
@@ -551,8 +572,8 @@ const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth })
|
|
|
551
572
|
fraction
|
|
552
573
|
]);
|
|
553
574
|
return /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
554
|
-
styles.timeslotLine,
|
|
555
|
-
styles.nonInteractive,
|
|
575
|
+
styles$1.timeslotLine,
|
|
576
|
+
styles$1.nonInteractive,
|
|
556
577
|
{
|
|
557
578
|
left: hourColumnWidth,
|
|
558
579
|
backgroundColor: theme.colors.gridLine
|
|
@@ -561,16 +582,18 @@ const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth })
|
|
|
561
582
|
] });
|
|
562
583
|
};
|
|
563
584
|
const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) => {
|
|
585
|
+
const theme = useCalendarTheme();
|
|
564
586
|
const animatedStyle = useAnimatedStyle(() => ({ top: (nowHours - minHour) * cellHeight.value }), [nowHours, minHour]);
|
|
565
587
|
return /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
566
|
-
styles.nowIndicator,
|
|
567
|
-
styles.nonInteractive,
|
|
588
|
+
styles$1.nowIndicator,
|
|
589
|
+
styles$1.nonInteractive,
|
|
568
590
|
{
|
|
569
591
|
left,
|
|
570
592
|
width,
|
|
571
593
|
backgroundColor: color
|
|
572
594
|
},
|
|
573
|
-
animatedStyle
|
|
595
|
+
animatedStyle,
|
|
596
|
+
theme.containers.nowIndicator
|
|
574
597
|
] });
|
|
575
598
|
};
|
|
576
599
|
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color }) => {
|
|
@@ -585,8 +608,8 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
585
608
|
return /* @__PURE__ */ jsx(Animated.View, {
|
|
586
609
|
testID: "business-hours-shade",
|
|
587
610
|
style: [
|
|
588
|
-
styles.shadeBand,
|
|
589
|
-
styles.nonInteractive,
|
|
611
|
+
styles$1.shadeBand,
|
|
612
|
+
styles$1.nonInteractive,
|
|
590
613
|
{
|
|
591
614
|
left,
|
|
592
615
|
width,
|
|
@@ -650,7 +673,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
650
673
|
const { locationX, locationY } = event.nativeEvent;
|
|
651
674
|
const day = days[days.length === 1 ? 0 : Math.floor(locationX / dayWidth)];
|
|
652
675
|
if (!day) return null;
|
|
653
|
-
const minutes = Math.round((minHour + locationY / heightSource.value) * MINUTES_PER_HOUR);
|
|
676
|
+
const minutes = Math.round((minHour + locationY / heightSource.value) * MINUTES_PER_HOUR$1);
|
|
654
677
|
const pressed = new Date(day);
|
|
655
678
|
pressed.setHours(0, 0, 0, 0);
|
|
656
679
|
pressed.setMinutes(minutes);
|
|
@@ -667,7 +690,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
667
690
|
const hoursRange = useMemo(() => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index), [minHour, maxHour]);
|
|
668
691
|
const now = useNow(showNowIndicator && isActive);
|
|
669
692
|
const nowDayIndex = days.findIndex((day) => getIsToday$1(day));
|
|
670
|
-
const nowHours = (getHours(now) * MINUTES_PER_HOUR + getMinutes(now)) / MINUTES_PER_HOUR;
|
|
693
|
+
const nowHours = (getHours(now) * MINUTES_PER_HOUR$1 + getMinutes(now)) / MINUTES_PER_HOUR$1;
|
|
671
694
|
const nowInWindow = nowHours >= minHour && nowHours <= maxHour;
|
|
672
695
|
const fullHeightStyle = useAnimatedStyle(() => ({ height: (maxHour - minHour) * heightSource.value }), [
|
|
673
696
|
minHour,
|
|
@@ -715,7 +738,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
715
738
|
const tapCell = useCallback((x, y) => {
|
|
716
739
|
const day = days[days.length === 1 ? 0 : Math.floor(x / dayWidth)];
|
|
717
740
|
if (!day) return;
|
|
718
|
-
const minutes = Math.round((minHour + y / heightSource.value) * MINUTES_PER_HOUR);
|
|
741
|
+
const minutes = Math.round((minHour + y / heightSource.value) * MINUTES_PER_HOUR$1);
|
|
719
742
|
const pressed = new Date(day);
|
|
720
743
|
pressed.setHours(0, 0, 0, 0);
|
|
721
744
|
pressed.setMinutes(minutes);
|
|
@@ -740,7 +763,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
740
763
|
createCancelled.value = 0;
|
|
741
764
|
}).onUpdate((event) => {
|
|
742
765
|
if (createCancelled.value) return;
|
|
743
|
-
const stepPx = snapMinutes / MINUTES_PER_HOUR * heightSource.value;
|
|
766
|
+
const stepPx = snapMinutes / MINUTES_PER_HOUR$1 * heightSource.value;
|
|
744
767
|
const snap = (y) => stepPx > 0 ? Math.round(y / stepPx) * stepPx : y;
|
|
745
768
|
const startSnap = snap(createStartY.value);
|
|
746
769
|
const endSnap = snap(createStartY.value + event.translationY);
|
|
@@ -809,7 +832,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
809
832
|
opacity: createActive.value
|
|
810
833
|
}));
|
|
811
834
|
const cellLayer = onPressCell || onLongPressCell || createEnabled ? /* @__PURE__ */ jsx(Pressable, {
|
|
812
|
-
style: [styles.cellPressLayer, { left: hourColumnWidth }],
|
|
835
|
+
style: [styles$1.cellPressLayer, { left: hourColumnWidth }],
|
|
813
836
|
onPress: onPressCell ? handleBackgroundPress : void 0,
|
|
814
837
|
onLongPress: !createEnabled && onLongPressCell ? handleBackgroundLongPress : void 0,
|
|
815
838
|
tabIndex: -1,
|
|
@@ -817,7 +840,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
817
840
|
accessibilityElementsHidden: true
|
|
818
841
|
}) : null;
|
|
819
842
|
return /* @__PURE__ */ jsxs(View, {
|
|
820
|
-
style: styles.container,
|
|
843
|
+
style: styles$1.container,
|
|
821
844
|
children: [showAllDayEventCell ? /* @__PURE__ */ jsx(AllDayLane, {
|
|
822
845
|
days,
|
|
823
846
|
events,
|
|
@@ -842,15 +865,15 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
842
865
|
y: initialScrollY
|
|
843
866
|
},
|
|
844
867
|
children: /* @__PURE__ */ jsxs(Animated.View, {
|
|
845
|
-
style: [styles.content, fullHeightStyle],
|
|
868
|
+
style: [styles$1.content, fullHeightStyle],
|
|
846
869
|
children: [
|
|
847
870
|
cellLayer && backgroundGesture ? /* @__PURE__ */ jsx(GestureDetector, {
|
|
848
871
|
gesture: backgroundGesture,
|
|
849
872
|
children: cellLayer
|
|
850
873
|
}) : cellLayer,
|
|
851
874
|
days.map((day, dayIndex) => isWeekend$1(day) ? /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
852
|
-
styles.weekendColumn,
|
|
853
|
-
styles.nonInteractive,
|
|
875
|
+
styles$1.weekendColumn,
|
|
876
|
+
styles$1.nonInteractive,
|
|
854
877
|
{ backgroundColor: theme.colors.weekendBackground },
|
|
855
878
|
{
|
|
856
879
|
left: dayLeft(dayIndex),
|
|
@@ -861,8 +884,8 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
861
884
|
calendarCellStyle ? days.map((day, dayIndex) => {
|
|
862
885
|
const cellStyle = calendarCellStyle(day);
|
|
863
886
|
return cellStyle ? /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
864
|
-
styles.weekendColumn,
|
|
865
|
-
styles.nonInteractive,
|
|
887
|
+
styles$1.weekendColumn,
|
|
888
|
+
styles$1.nonInteractive,
|
|
866
889
|
{
|
|
867
890
|
left: dayLeft(dayIndex),
|
|
868
891
|
width: dayWidth
|
|
@@ -881,8 +904,8 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
881
904
|
color: theme.colors.outsideHoursBackground
|
|
882
905
|
}, `closed-${day.toISOString()}-${bandIndex}`))) : null,
|
|
883
906
|
days.map((day, dayIndex) => /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
884
|
-
styles.daySeparator,
|
|
885
|
-
styles.nonInteractive,
|
|
907
|
+
styles$1.daySeparator,
|
|
908
|
+
styles$1.nonInteractive,
|
|
886
909
|
{ backgroundColor: theme.colors.gridLine },
|
|
887
910
|
{ left: dayLeft(dayIndex) },
|
|
888
911
|
fullHeightStyle
|
|
@@ -933,7 +956,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
933
956
|
color: theme.colors.nowIndicator
|
|
934
957
|
}) : null,
|
|
935
958
|
createEnabled ? /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
936
|
-
styles.createGhost,
|
|
959
|
+
styles$1.createGhost,
|
|
937
960
|
{ pointerEvents: "none" },
|
|
938
961
|
{
|
|
939
962
|
backgroundColor: theme.colors.eventBackground,
|
|
@@ -948,10 +971,15 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
948
971
|
});
|
|
949
972
|
}
|
|
950
973
|
const TimetablePage = memo(TimetablePageInner);
|
|
951
|
-
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, renderEvent, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, calendarCellStyle, businessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader }) {
|
|
974
|
+
function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellHeight, hourHeight = 48, weekStartsOn, weekdayFormat = "short", renderEvent, eventAccessibilityLabel, keyExtractor, scrollOffsetMinutes = 0, hourColumnWidth: hourColumnWidthProp = DEFAULT_HOUR_COLUMN_WIDTH, hideHours = false, timeslots = 1, showAllDayEventCell = true, calendarCellStyle, businessHours, showWeekNumber = false, headerComponent, minHour = 0, maxHour = HOURS_PER_DAY, ampm = false, isRTL = false, minHourHeight = DEFAULT_MIN_HOUR_HEIGHT, maxHourHeight = DEFAULT_MAX_HOUR_HEIGHT, showNowIndicator = true, locale, freeSwipe = false, swipeEnabled = true, showVerticalScrollIndicator = true, verticalScrollEnabled = true, weekNumberPrefix = "W", hourComponent, activeDate, resetPageOnPressCell = false, dragStepMinutes = DEFAULT_DRAG_STEP_MINUTES, showDragHandle = true, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, onPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, onChangeDate, renderHeader }) {
|
|
952
975
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
953
976
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
954
977
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
978
|
+
const labeledRenderEvent = useMemo(() => withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
|
|
979
|
+
renderEvent,
|
|
980
|
+
eventAccessibilityLabel,
|
|
981
|
+
ampm
|
|
982
|
+
]);
|
|
955
983
|
const { width, height } = useWindowDimensions();
|
|
956
984
|
const listRef = useRef(null);
|
|
957
985
|
const containerRef = useRef(null);
|
|
@@ -961,7 +989,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
961
989
|
const [measured, setMeasured] = useState(false);
|
|
962
990
|
const weekAnchored = mode === "week" || mode === "custom" && weekEndsOn != null;
|
|
963
991
|
const step = weekAnchored ? 7 : viewDayCount(mode, numberOfDays);
|
|
964
|
-
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR - clampedMinHour) * hourHeight;
|
|
992
|
+
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
|
|
965
993
|
const scrollY = useSharedValue(seedDefaultY);
|
|
966
994
|
const offsetSeedRef = useRef(null);
|
|
967
995
|
const captureOffsetSeed = useCallback((y) => {
|
|
@@ -1143,7 +1171,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1143
1171
|
minHourHeight,
|
|
1144
1172
|
maxHourHeight,
|
|
1145
1173
|
showNowIndicator,
|
|
1146
|
-
renderEvent,
|
|
1174
|
+
renderEvent: labeledRenderEvent,
|
|
1147
1175
|
keyExtractor,
|
|
1148
1176
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
1149
1177
|
showDragHandle,
|
|
@@ -1185,7 +1213,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1185
1213
|
minHourHeight,
|
|
1186
1214
|
maxHourHeight,
|
|
1187
1215
|
showNowIndicator,
|
|
1188
|
-
|
|
1216
|
+
labeledRenderEvent,
|
|
1189
1217
|
keyExtractor,
|
|
1190
1218
|
dragStepMinutes,
|
|
1191
1219
|
showDragHandle,
|
|
@@ -1203,7 +1231,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1203
1231
|
}), [events, activeIndex]);
|
|
1204
1232
|
return /* @__PURE__ */ jsxs(View, {
|
|
1205
1233
|
ref: containerRef,
|
|
1206
|
-
style: styles.container,
|
|
1234
|
+
style: styles$1.container,
|
|
1207
1235
|
children: [
|
|
1208
1236
|
renderHeader ? renderHeader(headerDays) : /* @__PURE__ */ jsx(DefaultHeader, {
|
|
1209
1237
|
days: headerDays,
|
|
@@ -1212,13 +1240,14 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1212
1240
|
hourColumnWidth,
|
|
1213
1241
|
showWeekNumber,
|
|
1214
1242
|
weekNumberPrefix,
|
|
1243
|
+
weekdayFormat,
|
|
1215
1244
|
locale,
|
|
1216
1245
|
activeDate,
|
|
1217
1246
|
onPressDateHeader
|
|
1218
1247
|
}),
|
|
1219
1248
|
headerComponent,
|
|
1220
1249
|
/* @__PURE__ */ jsx(View, {
|
|
1221
|
-
style: styles.pager,
|
|
1250
|
+
style: styles$1.pager,
|
|
1222
1251
|
onLayout: (event) => {
|
|
1223
1252
|
setPageHeight(event.nativeEvent.layout.height);
|
|
1224
1253
|
setContainerWidth(event.nativeEvent.layout.width);
|
|
@@ -1226,7 +1255,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1226
1255
|
},
|
|
1227
1256
|
children: /* @__PURE__ */ jsx(LegendList, {
|
|
1228
1257
|
ref: listRef,
|
|
1229
|
-
style: isWeb ? [styles.pagerList, styles.webNoScroll] : styles.pagerList,
|
|
1258
|
+
style: isWeb ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
|
|
1230
1259
|
data: pageDates,
|
|
1231
1260
|
extraData: listExtraData,
|
|
1232
1261
|
horizontal: true,
|
|
@@ -1256,7 +1285,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1256
1285
|
*
|
|
1257
1286
|
* @example
|
|
1258
1287
|
* ```tsx
|
|
1259
|
-
* import { TimeGrid } from "
|
|
1288
|
+
* import { TimeGrid } from "@super-calendar/native";
|
|
1260
1289
|
*
|
|
1261
1290
|
* <TimeGrid
|
|
1262
1291
|
* mode="week"
|
|
@@ -1268,13 +1297,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1268
1297
|
* ```
|
|
1269
1298
|
*/
|
|
1270
1299
|
const TimeGrid = memo(TimeGridInner);
|
|
1271
|
-
const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, weekNumberPrefix = "W", locale, activeDate, onPressDateHeader }) => {
|
|
1300
|
+
const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, weekNumberPrefix = "W", weekdayFormat, locale, activeDate, onPressDateHeader }) => {
|
|
1272
1301
|
const theme = useCalendarTheme();
|
|
1273
1302
|
const dayWidth = (width - hourColumnWidth) / days.length;
|
|
1274
1303
|
return /* @__PURE__ */ jsxs(View, {
|
|
1275
|
-
style: [styles.headerRow, { borderBottomColor: theme.colors.gridLine }],
|
|
1304
|
+
style: [styles$1.headerRow, { borderBottomColor: theme.colors.gridLine }],
|
|
1276
1305
|
children: [/* @__PURE__ */ jsx(View, {
|
|
1277
|
-
style: [styles.weekNumberGutter, { width: hourColumnWidth }],
|
|
1306
|
+
style: [styles$1.weekNumberGutter, { width: hourColumnWidth }],
|
|
1278
1307
|
children: showWeekNumber && hourColumnWidth > 0 && days[0] ? /* @__PURE__ */ jsx(Text, {
|
|
1279
1308
|
style: [theme.text.hourLabel, { color: theme.colors.textMuted }],
|
|
1280
1309
|
allowFontScaling: false,
|
|
@@ -1284,29 +1313,34 @@ const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, wee
|
|
|
1284
1313
|
day,
|
|
1285
1314
|
mode,
|
|
1286
1315
|
width: dayWidth,
|
|
1316
|
+
weekdayFormat,
|
|
1287
1317
|
locale,
|
|
1288
1318
|
activeDate,
|
|
1289
1319
|
onPressDateHeader
|
|
1290
1320
|
}, day.toISOString()))]
|
|
1291
1321
|
});
|
|
1292
1322
|
};
|
|
1293
|
-
const DayHeader = ({ day, width, locale, activeDate, onPressDateHeader }) => {
|
|
1323
|
+
const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
|
|
1294
1324
|
const theme = useCalendarTheme();
|
|
1295
1325
|
const isToday = getIsToday$1(day);
|
|
1296
1326
|
const isHighlighted = activeDate ? isSameCalendarDay$1(day, activeDate) : isToday;
|
|
1297
1327
|
return /* @__PURE__ */ jsxs(Pressable, {
|
|
1298
|
-
style: [
|
|
1328
|
+
style: [
|
|
1329
|
+
styles$1.dayHeader,
|
|
1330
|
+
{ width },
|
|
1331
|
+
theme.containers.columnHeader
|
|
1332
|
+
],
|
|
1299
1333
|
onPress: onPressDateHeader ? () => onPressDateHeader(day) : void 0,
|
|
1300
1334
|
disabled: !onPressDateHeader,
|
|
1301
1335
|
accessibilityRole: onPressDateHeader ? "button" : void 0,
|
|
1302
1336
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1303
|
-
style: [styles.dayHeaderWeekday, { color: theme.colors.textMuted }],
|
|
1337
|
+
style: [styles$1.dayHeaderWeekday, { color: theme.colors.textMuted }],
|
|
1304
1338
|
allowFontScaling: false,
|
|
1305
|
-
children: format(day,
|
|
1339
|
+
children: format(day, weekdayFormatToken$1(weekdayFormat), { locale })
|
|
1306
1340
|
}), /* @__PURE__ */ jsx(View, {
|
|
1307
|
-
style: [styles.dayHeaderBadge, isHighlighted && { backgroundColor: theme.colors.todayBackground }],
|
|
1341
|
+
style: [styles$1.dayHeaderBadge, isHighlighted && { backgroundColor: theme.colors.todayBackground }],
|
|
1308
1342
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1309
|
-
style: [styles.dayHeaderNumber, { color: isHighlighted ? theme.colors.todayText : theme.colors.text }],
|
|
1343
|
+
style: [styles$1.dayHeaderNumber, { color: isHighlighted ? theme.colors.todayText : theme.colors.text }],
|
|
1310
1344
|
allowFontScaling: false,
|
|
1311
1345
|
...isToday && { accessibilityLabel: `Today, ${day.getDate()}` },
|
|
1312
1346
|
children: day.getDate()
|
|
@@ -1314,7 +1348,7 @@ const DayHeader = ({ day, width, locale, activeDate, onPressDateHeader }) => {
|
|
|
1314
1348
|
})]
|
|
1315
1349
|
});
|
|
1316
1350
|
};
|
|
1317
|
-
const styles = StyleSheet.create({
|
|
1351
|
+
const styles$1 = StyleSheet.create({
|
|
1318
1352
|
pager: { flex: 1 },
|
|
1319
1353
|
pagerList: { flex: 1 },
|
|
1320
1354
|
container: { flex: 1 },
|
|
@@ -1437,7 +1471,7 @@ function visibleRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
1437
1471
|
*
|
|
1438
1472
|
* @example
|
|
1439
1473
|
* ```tsx
|
|
1440
|
-
* import { Calendar, type CalendarEvent } from "
|
|
1474
|
+
* import { Calendar, type CalendarEvent } from "@super-calendar/native";
|
|
1441
1475
|
*
|
|
1442
1476
|
* function MyCalendar() {
|
|
1443
1477
|
* const [date, setDate] = useState(new Date());
|
|
@@ -1456,7 +1490,7 @@ function visibleRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
1456
1490
|
* }
|
|
1457
1491
|
* ```
|
|
1458
1492
|
*/
|
|
1459
|
-
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventCellStyle, calendarCellStyle, businessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent }) {
|
|
1493
|
+
function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPressEvent, onLongPressEvent, onDragEvent, onDragStart, dragStepMinutes, showDragHandle, onPressDay, onLongPressDay, onPressMore, onPressCell, resetPageOnPressCell, onLongPressCell, onCreateEvent, onPressDateHeader, maxVisibleEventCount, sortedMonthView, moreLabel, showAdjacentMonths, disableMonthEventCellPress, weekStartsOn = 0, weekdayFormat, numberOfDays, weekEndsOn, renderEvent = DefaultEvent, eventAccessibilityLabel, eventCellStyle, calendarCellStyle, businessHours, keyExtractor = defaultKeyExtractor, theme, cellHeight: cellHeightProp, hourHeight = 48, minHourHeight, maxHourHeight, hourColumnWidth, hideHours, timeslots, showAllDayEventCell, showWeekNumber, weekNumberPrefix, hourComponent, showSixWeeks, swipeEnabled, showVerticalScrollIndicator, verticalScrollEnabled, headerComponent, minHour, maxHour, ampm, showTime, ellipsizeTitle, allDayLabel, scrollOffsetMinutes, showNowIndicator, locale, activeDate, isRTL, freeSwipe, renderTimeGridHeader, renderHeaderForMonthView, renderCustomDateForMonth, itemSeparatorComponent }) {
|
|
1460
1494
|
const mergedTheme = useMemo(() => mergeTheme(theme), [theme]);
|
|
1461
1495
|
const internalCellHeight = useSharedValue(hourHeight);
|
|
1462
1496
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -1478,7 +1512,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1478
1512
|
weekEndsOn
|
|
1479
1513
|
]);
|
|
1480
1514
|
const resolvedRenderEvent = useMemo(() => {
|
|
1481
|
-
if (eventCellStyle == null && ampm == null && showTime == null && ellipsizeTitle == null && allDayLabel == null) return renderEvent;
|
|
1515
|
+
if (eventCellStyle == null && ampm == null && showTime == null && ellipsizeTitle == null && allDayLabel == null && eventAccessibilityLabel == null) return renderEvent;
|
|
1482
1516
|
const Base = renderEvent;
|
|
1483
1517
|
return function StyledEvent(props) {
|
|
1484
1518
|
const cellStyle = typeof eventCellStyle === "function" ? eventCellStyle(props.event) : eventCellStyle;
|
|
@@ -1488,7 +1522,12 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1488
1522
|
ampm,
|
|
1489
1523
|
showTime,
|
|
1490
1524
|
ellipsizeTitle,
|
|
1491
|
-
allDayLabel
|
|
1525
|
+
allDayLabel,
|
|
1526
|
+
accessibilityLabel: eventAccessibilityLabel ? eventAccessibilityLabel(props.event, {
|
|
1527
|
+
mode: props.mode,
|
|
1528
|
+
isAllDay: props.isAllDay ?? false,
|
|
1529
|
+
ampm: ampm ?? false
|
|
1530
|
+
}) : props.accessibilityLabel
|
|
1492
1531
|
});
|
|
1493
1532
|
};
|
|
1494
1533
|
}, [
|
|
@@ -1497,7 +1536,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1497
1536
|
ampm,
|
|
1498
1537
|
showTime,
|
|
1499
1538
|
ellipsizeTitle,
|
|
1500
|
-
allDayLabel
|
|
1539
|
+
allDayLabel,
|
|
1540
|
+
eventAccessibilityLabel
|
|
1501
1541
|
]);
|
|
1502
1542
|
return /* @__PURE__ */ jsx(CalendarThemeProvider, {
|
|
1503
1543
|
value: mergedTheme,
|
|
@@ -1506,6 +1546,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1506
1546
|
events,
|
|
1507
1547
|
maxVisibleEventCount,
|
|
1508
1548
|
weekStartsOn,
|
|
1549
|
+
weekdayFormat,
|
|
1509
1550
|
locale,
|
|
1510
1551
|
sortedMonthView,
|
|
1511
1552
|
moreLabel,
|
|
@@ -1546,6 +1587,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1546
1587
|
cellHeight,
|
|
1547
1588
|
hourHeight,
|
|
1548
1589
|
weekStartsOn,
|
|
1590
|
+
weekdayFormat,
|
|
1549
1591
|
renderEvent: resolvedRenderEvent,
|
|
1550
1592
|
keyExtractor,
|
|
1551
1593
|
scrollOffsetMinutes,
|
|
@@ -1589,4 +1631,324 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1589
1631
|
});
|
|
1590
1632
|
}
|
|
1591
1633
|
//#endregion
|
|
1592
|
-
|
|
1634
|
+
//#region src/components/ResourceTimeline.tsx
|
|
1635
|
+
const MOVE_ACTIVATE_MS = 250;
|
|
1636
|
+
const MINUTES_PER_HOUR = 60;
|
|
1637
|
+
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
1638
|
+
function DefaultBar({ event, width }) {
|
|
1639
|
+
const theme = useCalendarTheme();
|
|
1640
|
+
const time = eventTimeLabel({
|
|
1641
|
+
mode: "day",
|
|
1642
|
+
isAllDay: false,
|
|
1643
|
+
start: event.start,
|
|
1644
|
+
end: event.end,
|
|
1645
|
+
ampm: false,
|
|
1646
|
+
showTime: true
|
|
1647
|
+
});
|
|
1648
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
1649
|
+
style: [
|
|
1650
|
+
styles.bar,
|
|
1651
|
+
{ backgroundColor: theme.colors.eventBackground },
|
|
1652
|
+
theme.containers.timeGridEvent
|
|
1653
|
+
],
|
|
1654
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
1655
|
+
numberOfLines: 1,
|
|
1656
|
+
style: [theme.text.eventTitle, { color: theme.colors.eventText }],
|
|
1657
|
+
allowFontScaling: false,
|
|
1658
|
+
children: event.title
|
|
1659
|
+
}), time && width > 56 ? /* @__PURE__ */ jsx(Text, {
|
|
1660
|
+
numberOfLines: 1,
|
|
1661
|
+
style: [styles.barTime, { color: theme.colors.eventText }],
|
|
1662
|
+
allowFontScaling: false,
|
|
1663
|
+
children: time
|
|
1664
|
+
}) : null]
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
function ResourceBar({ pe, left, width, laneHeight, hourWidth, snapMinutes, Renderer, onPress, onDragEvent, theme }) {
|
|
1668
|
+
const moveX = useSharedValue(0);
|
|
1669
|
+
const resizeW = useSharedValue(0);
|
|
1670
|
+
const latest = useRef({
|
|
1671
|
+
event: pe.event,
|
|
1672
|
+
onDragEvent
|
|
1673
|
+
});
|
|
1674
|
+
latest.current = {
|
|
1675
|
+
event: pe.event,
|
|
1676
|
+
onDragEvent
|
|
1677
|
+
};
|
|
1678
|
+
const draggable = !pe.event.disabled;
|
|
1679
|
+
useEffect(() => {
|
|
1680
|
+
moveX.value = 0;
|
|
1681
|
+
resizeW.value = 0;
|
|
1682
|
+
}, [
|
|
1683
|
+
pe.startHours,
|
|
1684
|
+
pe.durationHours,
|
|
1685
|
+
moveX,
|
|
1686
|
+
resizeW
|
|
1687
|
+
]);
|
|
1688
|
+
const snapBack = useCallback(() => {
|
|
1689
|
+
moveX.value = 0;
|
|
1690
|
+
resizeW.value = 0;
|
|
1691
|
+
}, [moveX, resizeW]);
|
|
1692
|
+
const commit = useCallback((deltaStartMin, deltaEndMin) => {
|
|
1693
|
+
const { event, onDragEvent: handler } = latest.current;
|
|
1694
|
+
const next = resolveDraggedBounds(event.start, event.end, deltaStartMin, deltaEndMin, snapMinutes);
|
|
1695
|
+
if (!next) {
|
|
1696
|
+
snapBack();
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
if (handler(event, next.start, next.end) === false) snapBack();
|
|
1700
|
+
}, [snapMinutes, snapBack]);
|
|
1701
|
+
const barStyle = useAnimatedStyle(() => ({
|
|
1702
|
+
transform: [{ translateX: moveX.value }],
|
|
1703
|
+
width: Math.max(width + resizeW.value, 2)
|
|
1704
|
+
}), [width]);
|
|
1705
|
+
const moveGesture = useMemo(() => Gesture.Pan().enabled(draggable).activateAfterLongPress(MOVE_ACTIVATE_MS).onUpdate((e) => {
|
|
1706
|
+
moveX.value = e.translationX;
|
|
1707
|
+
}).onEnd((e) => {
|
|
1708
|
+
const delta = snapDeltaMinutes(e.translationX, hourWidth, snapMinutes);
|
|
1709
|
+
if (delta === 0) {
|
|
1710
|
+
moveX.value = 0;
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
moveX.value = delta / MINUTES_PER_HOUR * hourWidth;
|
|
1714
|
+
runOnJS(commit)(delta, delta);
|
|
1715
|
+
}), [
|
|
1716
|
+
draggable,
|
|
1717
|
+
hourWidth,
|
|
1718
|
+
snapMinutes,
|
|
1719
|
+
moveX,
|
|
1720
|
+
commit
|
|
1721
|
+
]);
|
|
1722
|
+
const resizeGesture = useMemo(() => Gesture.Pan().enabled(draggable).onUpdate((e) => {
|
|
1723
|
+
resizeW.value = e.translationX;
|
|
1724
|
+
}).onEnd((e) => {
|
|
1725
|
+
const delta = snapDeltaMinutes(e.translationX, hourWidth, snapMinutes);
|
|
1726
|
+
if (delta === 0) {
|
|
1727
|
+
resizeW.value = 0;
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1730
|
+
resizeW.value = delta / MINUTES_PER_HOUR * hourWidth;
|
|
1731
|
+
runOnJS(commit)(0, delta);
|
|
1732
|
+
}), [
|
|
1733
|
+
draggable,
|
|
1734
|
+
hourWidth,
|
|
1735
|
+
snapMinutes,
|
|
1736
|
+
resizeW,
|
|
1737
|
+
commit
|
|
1738
|
+
]);
|
|
1739
|
+
return /* @__PURE__ */ jsxs(Animated.View, {
|
|
1740
|
+
style: [{
|
|
1741
|
+
position: "absolute",
|
|
1742
|
+
left,
|
|
1743
|
+
top: pe.column * laneHeight,
|
|
1744
|
+
height: laneHeight,
|
|
1745
|
+
padding: 1
|
|
1746
|
+
}, barStyle],
|
|
1747
|
+
children: [/* @__PURE__ */ jsx(GestureDetector, {
|
|
1748
|
+
gesture: moveGesture,
|
|
1749
|
+
children: /* @__PURE__ */ jsx(Pressable, {
|
|
1750
|
+
onPress,
|
|
1751
|
+
accessibilityRole: "button",
|
|
1752
|
+
accessibilityLabel: pe.event.title,
|
|
1753
|
+
style: styles.fill,
|
|
1754
|
+
children: /* @__PURE__ */ jsx(Renderer, {
|
|
1755
|
+
event: pe.event,
|
|
1756
|
+
width,
|
|
1757
|
+
onPress
|
|
1758
|
+
})
|
|
1759
|
+
})
|
|
1760
|
+
}), /* @__PURE__ */ jsx(GestureDetector, {
|
|
1761
|
+
gesture: resizeGesture,
|
|
1762
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
1763
|
+
style: [styles.resizeGrip, { backgroundColor: theme.colors.eventText }],
|
|
1764
|
+
accessibilityRole: "adjustable",
|
|
1765
|
+
accessibilityLabel: `Resize ${pe.event.title}`
|
|
1766
|
+
})
|
|
1767
|
+
})]
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
/**
|
|
1771
|
+
* A horizontal resource timeline: rows are resources (rooms, people, machines)
|
|
1772
|
+
* and the x-axis is one day's hours. Events sit in their resource's row, and
|
|
1773
|
+
* overlapping events in the same row stack into sub-lanes (via the shared
|
|
1774
|
+
* `layoutDayEvents`). The grid scrolls horizontally when the axis is wider than
|
|
1775
|
+
* the screen. Pass `onDragEvent` to enable long-press drag-to-move and edge
|
|
1776
|
+
* resize along the time axis. Read the theme from context — wrap in
|
|
1777
|
+
* `CalendarThemeProvider` (or render inside `<Calendar>`) to restyle.
|
|
1778
|
+
*
|
|
1779
|
+
* @example
|
|
1780
|
+
* ```tsx
|
|
1781
|
+
* <ResourceTimeline
|
|
1782
|
+
* date={new Date()}
|
|
1783
|
+
* resources={[{ id: "a", title: "Room A" }, { id: "b", title: "Room B" }]}
|
|
1784
|
+
* events={events} // each event carries a `resourceId`
|
|
1785
|
+
* />
|
|
1786
|
+
* ```
|
|
1787
|
+
*/
|
|
1788
|
+
function ResourceTimeline({ date, resources, events, resourceId = (event) => event.resourceId, startHour = 0, endHour = 24, hourWidth = 80, rowHeight = 56, labelWidth = 140, ampm = false, renderEvent, onPressEvent, onDragEvent, dragStepMinutes = 15 }) {
|
|
1789
|
+
const theme = useCalendarTheme();
|
|
1790
|
+
const Renderer = renderEvent ?? DefaultBar;
|
|
1791
|
+
const hours = useMemo(() => Array.from({ length: Math.max(0, endHour - startHour) }, (_, i) => startHour + i), [startHour, endHour]);
|
|
1792
|
+
const trackWidth = (endHour - startHour) * hourWidth;
|
|
1793
|
+
const byResource = useMemo(() => {
|
|
1794
|
+
const map = /* @__PURE__ */ new Map();
|
|
1795
|
+
for (const resource of resources) {
|
|
1796
|
+
const own = events.filter((event) => resourceId(event) === resource.id);
|
|
1797
|
+
map.set(resource.id, layoutDayEvents$1(own, date));
|
|
1798
|
+
}
|
|
1799
|
+
return map;
|
|
1800
|
+
}, [
|
|
1801
|
+
resources,
|
|
1802
|
+
events,
|
|
1803
|
+
resourceId,
|
|
1804
|
+
date
|
|
1805
|
+
]);
|
|
1806
|
+
return /* @__PURE__ */ jsx(ScrollView, {
|
|
1807
|
+
horizontal: true,
|
|
1808
|
+
showsHorizontalScrollIndicator: true,
|
|
1809
|
+
style: styles.root,
|
|
1810
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
1811
|
+
style: { width: labelWidth + trackWidth },
|
|
1812
|
+
children: [/* @__PURE__ */ jsxs(View, {
|
|
1813
|
+
style: [styles.header, { borderBottomColor: theme.colors.gridLine }],
|
|
1814
|
+
children: [/* @__PURE__ */ jsx(View, { style: { width: labelWidth } }), /* @__PURE__ */ jsx(View, {
|
|
1815
|
+
style: {
|
|
1816
|
+
width: trackWidth,
|
|
1817
|
+
height: 24
|
|
1818
|
+
},
|
|
1819
|
+
children: hours.map((h) => /* @__PURE__ */ jsx(Text, {
|
|
1820
|
+
allowFontScaling: false,
|
|
1821
|
+
style: [styles.hourTick, {
|
|
1822
|
+
left: (h - startHour) * hourWidth,
|
|
1823
|
+
color: theme.colors.textMuted
|
|
1824
|
+
}],
|
|
1825
|
+
children: formatHour(h, { ampm })
|
|
1826
|
+
}, h))
|
|
1827
|
+
})]
|
|
1828
|
+
}), resources.map((resource) => {
|
|
1829
|
+
const positioned = byResource.get(resource.id) ?? [];
|
|
1830
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
1831
|
+
style: [
|
|
1832
|
+
styles.row,
|
|
1833
|
+
{
|
|
1834
|
+
height: rowHeight,
|
|
1835
|
+
borderBottomColor: theme.colors.gridLine
|
|
1836
|
+
},
|
|
1837
|
+
theme.containers.resourceRow
|
|
1838
|
+
],
|
|
1839
|
+
children: [/* @__PURE__ */ jsx(View, {
|
|
1840
|
+
style: [
|
|
1841
|
+
styles.label,
|
|
1842
|
+
{
|
|
1843
|
+
width: labelWidth,
|
|
1844
|
+
borderRightColor: theme.colors.gridLine
|
|
1845
|
+
},
|
|
1846
|
+
theme.containers.resourceLabel
|
|
1847
|
+
],
|
|
1848
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
1849
|
+
numberOfLines: 1,
|
|
1850
|
+
style: { color: theme.colors.text },
|
|
1851
|
+
allowFontScaling: false,
|
|
1852
|
+
children: resource.title ?? resource.id
|
|
1853
|
+
})
|
|
1854
|
+
}), /* @__PURE__ */ jsxs(View, {
|
|
1855
|
+
style: { width: trackWidth },
|
|
1856
|
+
children: [hours.slice(1).map((h) => /* @__PURE__ */ jsx(View, {
|
|
1857
|
+
pointerEvents: "none",
|
|
1858
|
+
style: [styles.gridLine, {
|
|
1859
|
+
left: (h - startHour) * hourWidth,
|
|
1860
|
+
backgroundColor: theme.colors.gridLine
|
|
1861
|
+
}]
|
|
1862
|
+
}, h)), positioned.map((pe, idx) => {
|
|
1863
|
+
const left = clamp(pe.startHours - startHour, 0, endHour - startHour) * hourWidth;
|
|
1864
|
+
const right = clamp(pe.startHours + pe.durationHours - startHour, 0, endHour - startHour) * hourWidth;
|
|
1865
|
+
const width = Math.max(right - left, 2);
|
|
1866
|
+
const laneHeight = rowHeight / pe.columns;
|
|
1867
|
+
const onPress = () => onPressEvent?.(pe.event);
|
|
1868
|
+
if (onDragEvent) return /* @__PURE__ */ jsx(ResourceBar, {
|
|
1869
|
+
pe,
|
|
1870
|
+
left,
|
|
1871
|
+
width,
|
|
1872
|
+
laneHeight,
|
|
1873
|
+
hourWidth,
|
|
1874
|
+
snapMinutes: dragStepMinutes,
|
|
1875
|
+
Renderer,
|
|
1876
|
+
onPress,
|
|
1877
|
+
onDragEvent,
|
|
1878
|
+
theme
|
|
1879
|
+
}, idx);
|
|
1880
|
+
return /* @__PURE__ */ jsx(Pressable, {
|
|
1881
|
+
onPress,
|
|
1882
|
+
accessibilityRole: "button",
|
|
1883
|
+
accessibilityLabel: pe.event.title,
|
|
1884
|
+
style: {
|
|
1885
|
+
position: "absolute",
|
|
1886
|
+
left,
|
|
1887
|
+
width,
|
|
1888
|
+
top: pe.column * laneHeight,
|
|
1889
|
+
height: laneHeight,
|
|
1890
|
+
padding: 1
|
|
1891
|
+
},
|
|
1892
|
+
children: /* @__PURE__ */ jsx(Renderer, {
|
|
1893
|
+
event: pe.event,
|
|
1894
|
+
width,
|
|
1895
|
+
onPress
|
|
1896
|
+
})
|
|
1897
|
+
}, idx);
|
|
1898
|
+
})]
|
|
1899
|
+
})]
|
|
1900
|
+
}, resource.id);
|
|
1901
|
+
})]
|
|
1902
|
+
})
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
const styles = StyleSheet.create({
|
|
1906
|
+
root: { flexGrow: 0 },
|
|
1907
|
+
header: {
|
|
1908
|
+
flexDirection: "row",
|
|
1909
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
1910
|
+
},
|
|
1911
|
+
hourTick: {
|
|
1912
|
+
position: "absolute",
|
|
1913
|
+
top: 4,
|
|
1914
|
+
fontSize: 10
|
|
1915
|
+
},
|
|
1916
|
+
row: {
|
|
1917
|
+
flexDirection: "row",
|
|
1918
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
1919
|
+
},
|
|
1920
|
+
label: {
|
|
1921
|
+
justifyContent: "center",
|
|
1922
|
+
paddingHorizontal: 10,
|
|
1923
|
+
borderRightWidth: StyleSheet.hairlineWidth
|
|
1924
|
+
},
|
|
1925
|
+
gridLine: {
|
|
1926
|
+
position: "absolute",
|
|
1927
|
+
top: 0,
|
|
1928
|
+
bottom: 0,
|
|
1929
|
+
width: StyleSheet.hairlineWidth
|
|
1930
|
+
},
|
|
1931
|
+
bar: {
|
|
1932
|
+
flex: 1,
|
|
1933
|
+
borderRadius: 6,
|
|
1934
|
+
paddingHorizontal: 6,
|
|
1935
|
+
paddingVertical: 2,
|
|
1936
|
+
overflow: "hidden"
|
|
1937
|
+
},
|
|
1938
|
+
barTime: {
|
|
1939
|
+
fontSize: 11,
|
|
1940
|
+
opacity: .75
|
|
1941
|
+
},
|
|
1942
|
+
fill: { flex: 1 },
|
|
1943
|
+
resizeGrip: {
|
|
1944
|
+
position: "absolute",
|
|
1945
|
+
right: 1,
|
|
1946
|
+
top: "30%",
|
|
1947
|
+
bottom: "30%",
|
|
1948
|
+
width: 4,
|
|
1949
|
+
borderRadius: 2,
|
|
1950
|
+
opacity: .5
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
//#endregion
|
|
1954
|
+
export { Agenda, Calendar, CalendarThemeProvider, DEFAULT_HOUR_HEIGHT, DefaultEvent, DefaultMonthEvent, MonthList, MonthPager, MonthView, ResourceTimeline, TimeGrid, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, eventsInTimeZone, expandRecurringEvents, getIsToday, getViewDays, getWeekDays, isAllDayEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, layoutDayEvents, mergeTheme, minutesIntoDay, nextDateRange, toZonedTime, useCalendarTheme, useDateRange, useMonthGrid, weekdayFormatToken };
|