@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.js
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_MonthList = require("./MonthList-
|
|
24
|
+
const require_MonthList = require("./MonthList-DWAjW5R7.js");
|
|
25
25
|
let date_fns = require("date-fns");
|
|
26
26
|
let react = require("react");
|
|
27
27
|
let react_native_reanimated = require("react-native-reanimated");
|
|
@@ -67,14 +67,14 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
67
67
|
if (item.kind === "header") {
|
|
68
68
|
const isHighlighted = activeDate ? (0, date_fns.isSameDay)(item.date, activeDate) : (0, _super_calendar_core.getIsToday)(item.date);
|
|
69
69
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
70
|
-
style: [styles$
|
|
70
|
+
style: [styles$4.header, { color: isHighlighted ? theme.colors.todayBackground : theme.colors.textMuted }],
|
|
71
71
|
onPress: onPressDay ? () => onPressDay(item.date) : void 0,
|
|
72
72
|
accessibilityRole: onPressDay ? "button" : "header",
|
|
73
73
|
children: (0, date_fns.format)(item.date, "EEEE, d LLLL", { locale })
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
77
|
-
style: styles$
|
|
77
|
+
style: [styles$4.eventRow, theme.containers.agendaRow],
|
|
78
78
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
79
79
|
event: item.event,
|
|
80
80
|
mode: "schedule",
|
|
@@ -93,11 +93,11 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
93
93
|
RenderEventComponent
|
|
94
94
|
]);
|
|
95
95
|
if (rows.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
96
|
-
style: [styles$
|
|
96
|
+
style: [styles$4.empty, { color: theme.colors.textMuted }],
|
|
97
97
|
children: "No events"
|
|
98
98
|
});
|
|
99
99
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_legendapp_list_react_native.LegendList, {
|
|
100
|
-
style: styles$
|
|
100
|
+
style: [styles$4.list, theme.containers.agendaList],
|
|
101
101
|
data: rows,
|
|
102
102
|
keyExtractor: keyExtractorRow,
|
|
103
103
|
renderItem,
|
|
@@ -105,7 +105,7 @@ function Agenda({ events, locale, renderEvent, keyExtractor, onPressEvent, onLon
|
|
|
105
105
|
recycleItems: false
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
const styles$
|
|
108
|
+
const styles$4 = react_native.StyleSheet.create({
|
|
109
109
|
list: { flex: 1 },
|
|
110
110
|
header: {
|
|
111
111
|
fontSize: 13,
|
|
@@ -138,7 +138,7 @@ const numericStyle = (value, fallback) => typeof value === "number" ? value : fa
|
|
|
138
138
|
* only shows once a full line is free beneath the title. Pass your own
|
|
139
139
|
* `renderEvent` to `<Calendar>` to replace it entirely.
|
|
140
140
|
*/
|
|
141
|
-
function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, cellStyle, onPress, onLongPress }) {
|
|
141
|
+
function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime = true, ellipsizeTitle = false, allDayLabel, accessibilityLabel: accessibilityLabelProp, cellStyle, onPress, onLongPress }) {
|
|
142
142
|
const theme = require_MonthList.useCalendarTheme();
|
|
143
143
|
const isAllDayEvent = isAllDay ?? false;
|
|
144
144
|
const timeLabel = (0, _super_calendar_core.eventTimeLabel)({
|
|
@@ -152,7 +152,7 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
152
152
|
});
|
|
153
153
|
const ellipsizeMode = (0, _super_calendar_core.titleEllipsizeMode)(ellipsizeTitle);
|
|
154
154
|
const titleLineHeight = numericStyle(theme.text.eventTitle.lineHeight, FALLBACK_TITLE_LINE_HEIGHT);
|
|
155
|
-
const accessibilityLabel = (0, _super_calendar_core.eventAccessibilityLabel)({
|
|
155
|
+
const accessibilityLabel = accessibilityLabelProp ?? (0, _super_calendar_core.eventAccessibilityLabel)({
|
|
156
156
|
title: event.title,
|
|
157
157
|
isAllDay: isAllDayEvent,
|
|
158
158
|
start: event.start,
|
|
@@ -182,12 +182,16 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
182
182
|
const timeStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
183
183
|
return { display: layout.value.showTime ? "flex" : "none" };
|
|
184
184
|
}, [layout]);
|
|
185
|
-
|
|
185
|
+
const contentStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
186
|
+
const { titleMaxLines, showTime } = layout.value;
|
|
187
|
+
return { justifyContent: titleMaxLines === 1 && !showTime ? "center" : "flex-start" };
|
|
188
|
+
}, [layout]);
|
|
189
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.TouchableOpacity, {
|
|
186
190
|
style: [
|
|
187
|
-
styles$
|
|
188
|
-
isSchedule && styles$
|
|
191
|
+
styles$3.box,
|
|
192
|
+
isSchedule && styles$3.scheduleBox,
|
|
189
193
|
{ backgroundColor: theme.colors.eventBackground },
|
|
190
|
-
event.disabled && styles$
|
|
194
|
+
event.disabled && styles$3.disabled,
|
|
191
195
|
cellStyle
|
|
192
196
|
],
|
|
193
197
|
onPress,
|
|
@@ -196,46 +200,50 @@ function DefaultEvent({ event, mode, boxHeight, isAllDay, ampm = false, showTime
|
|
|
196
200
|
accessibilityRole: "button",
|
|
197
201
|
accessibilityLabel,
|
|
198
202
|
accessibilityState: { disabled: event.disabled ?? false },
|
|
199
|
-
children:
|
|
200
|
-
|
|
201
|
-
|
|
203
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
204
|
+
testID: "event-chip-content",
|
|
205
|
+
style: [styles$3.content, contentStyle],
|
|
206
|
+
children: [event.title ? fixedTitleLines == null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
207
|
+
style: [styles$3.titleClip, titleClipStyle],
|
|
208
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
209
|
+
style: [
|
|
210
|
+
theme.text.eventTitle,
|
|
211
|
+
isSchedule && styles$3.scheduleTitle,
|
|
212
|
+
{ color: theme.colors.eventText }
|
|
213
|
+
],
|
|
214
|
+
ellipsizeMode,
|
|
215
|
+
allowFontScaling: false,
|
|
216
|
+
children: event.title
|
|
217
|
+
})
|
|
218
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
202
219
|
style: [
|
|
203
220
|
theme.text.eventTitle,
|
|
204
|
-
|
|
221
|
+
styles$3.title,
|
|
222
|
+
isSchedule && styles$3.scheduleTitle,
|
|
205
223
|
{ color: theme.colors.eventText }
|
|
206
224
|
],
|
|
225
|
+
numberOfLines: fixedTitleLines,
|
|
207
226
|
ellipsizeMode,
|
|
208
227
|
allowFontScaling: false,
|
|
209
228
|
children: event.title
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
style: [
|
|
226
|
-
styles$2.time,
|
|
227
|
-
isSchedule && styles$2.scheduleTime,
|
|
228
|
-
{ color: theme.colors.eventText }
|
|
229
|
-
],
|
|
230
|
-
numberOfLines: 2,
|
|
231
|
-
ellipsizeMode,
|
|
232
|
-
allowFontScaling: false,
|
|
233
|
-
children: timeLabel
|
|
234
|
-
})
|
|
235
|
-
}) : null]
|
|
229
|
+
}) : null, timeLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
230
|
+
style: timeStyle,
|
|
231
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
232
|
+
style: [
|
|
233
|
+
styles$3.time,
|
|
234
|
+
isSchedule && styles$3.scheduleTime,
|
|
235
|
+
{ color: theme.colors.eventText }
|
|
236
|
+
],
|
|
237
|
+
numberOfLines: 2,
|
|
238
|
+
ellipsizeMode,
|
|
239
|
+
allowFontScaling: false,
|
|
240
|
+
children: timeLabel
|
|
241
|
+
})
|
|
242
|
+
}) : null]
|
|
243
|
+
})
|
|
236
244
|
});
|
|
237
245
|
}
|
|
238
|
-
const styles$
|
|
246
|
+
const styles$3 = react_native.StyleSheet.create({
|
|
239
247
|
box: {
|
|
240
248
|
flexGrow: 1,
|
|
241
249
|
flexShrink: 1,
|
|
@@ -260,6 +268,10 @@ const styles$2 = react_native.StyleSheet.create({
|
|
|
260
268
|
lineHeight: 18,
|
|
261
269
|
opacity: .75
|
|
262
270
|
},
|
|
271
|
+
content: {
|
|
272
|
+
flexGrow: 1,
|
|
273
|
+
flexShrink: 1
|
|
274
|
+
},
|
|
263
275
|
titleClip: { overflow: "hidden" },
|
|
264
276
|
title: { flexShrink: 1 },
|
|
265
277
|
time: {
|
|
@@ -319,18 +331,26 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
319
331
|
});
|
|
320
332
|
if (perDay.every((list) => list.length === 0)) return null;
|
|
321
333
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
322
|
-
style: [
|
|
334
|
+
style: [
|
|
335
|
+
styles$2.lane,
|
|
336
|
+
{ borderBottomColor: theme.colors.gridLine },
|
|
337
|
+
theme.containers.allDayLane
|
|
338
|
+
],
|
|
323
339
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
324
|
-
style: [styles$
|
|
340
|
+
style: [styles$2.gutter, { width: hourColumnWidth }],
|
|
325
341
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
326
|
-
style: [styles$
|
|
342
|
+
style: [styles$2.label, { color: theme.colors.textMuted }],
|
|
327
343
|
allowFontScaling: false,
|
|
328
344
|
children: "all-day"
|
|
329
345
|
})
|
|
330
346
|
}), days.map((day, dayIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
331
|
-
style: [
|
|
347
|
+
style: [
|
|
348
|
+
styles$2.column,
|
|
349
|
+
{ width: dayWidth },
|
|
350
|
+
theme.containers.allDayColumn
|
|
351
|
+
],
|
|
332
352
|
children: perDay[dayIndex].map((event, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
333
|
-
style: styles$
|
|
353
|
+
style: styles$2.chip,
|
|
334
354
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
335
355
|
event,
|
|
336
356
|
mode,
|
|
@@ -342,7 +362,7 @@ function AllDayLane({ days, events, mode, hourColumnWidth, dayWidth, renderEvent
|
|
|
342
362
|
}, day.toISOString()))]
|
|
343
363
|
});
|
|
344
364
|
}
|
|
345
|
-
const styles$
|
|
365
|
+
const styles$2 = react_native.StyleSheet.create({
|
|
346
366
|
lane: {
|
|
347
367
|
flexDirection: "row",
|
|
348
368
|
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
@@ -363,9 +383,9 @@ const styles$1 = react_native.StyleSheet.create({
|
|
|
363
383
|
//#endregion
|
|
364
384
|
//#region src/components/TimeGrid.tsx
|
|
365
385
|
const isWeb = react_native.Platform.OS === "web";
|
|
366
|
-
const MINUTES_PER_HOUR = 60;
|
|
386
|
+
const MINUTES_PER_HOUR$1 = 60;
|
|
367
387
|
const HOURS_PER_DAY = 24;
|
|
368
|
-
const MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
|
|
388
|
+
const MINUTES_PER_DAY = MINUTES_PER_HOUR$1 * HOURS_PER_DAY;
|
|
369
389
|
const PAGE_WINDOW = 180;
|
|
370
390
|
const PAGE_VIEWABILITY = { itemVisiblePercentThreshold: 90 };
|
|
371
391
|
/** Default height in pixels of one hour row on the time grid. */
|
|
@@ -376,7 +396,7 @@ const DEFAULT_HOUR_COLUMN_WIDTH = 56;
|
|
|
376
396
|
const MIN_EVENT_HEIGHT = 32;
|
|
377
397
|
const EVENT_GAP = 2;
|
|
378
398
|
const DRAG_ACTIVATE_MS = 300;
|
|
379
|
-
const MOVE_ACTIVATE_MS = 500;
|
|
399
|
+
const MOVE_ACTIVATE_MS$1 = 500;
|
|
380
400
|
const DRAG_ACTIVATE_PX = 8;
|
|
381
401
|
const RESIZE_HANDLE_HEIGHT = 14;
|
|
382
402
|
const DEFAULT_DRAG_STEP_MINUTES = 15;
|
|
@@ -470,12 +490,12 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
470
490
|
moveOffsetX.value = 0;
|
|
471
491
|
return;
|
|
472
492
|
}
|
|
473
|
-
moveOffset.value = minuteDelta / MINUTES_PER_HOUR * cellHeight.value;
|
|
493
|
+
moveOffset.value = minuteDelta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
474
494
|
moveOffsetX.value = dayDelta * dayWidth;
|
|
475
495
|
const totalDelta = minuteDelta + dayDelta * MINUTES_PER_DAY;
|
|
476
496
|
(0, react_native_reanimated.runOnJS)(commitDrag)(totalDelta, totalDelta);
|
|
477
497
|
});
|
|
478
|
-
return isWeb ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX]).activeOffsetY([-8, DRAG_ACTIVATE_PX]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS);
|
|
498
|
+
return isWeb ? pan.activeOffsetX([-8, DRAG_ACTIVATE_PX]).activeOffsetY([-8, DRAG_ACTIVATE_PX]) : pan.activateAfterLongPress(MOVE_ACTIVATE_MS$1);
|
|
479
499
|
}, [
|
|
480
500
|
draggable,
|
|
481
501
|
snapMinutes,
|
|
@@ -498,7 +518,7 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
498
518
|
resizeDelta.value = 0;
|
|
499
519
|
return;
|
|
500
520
|
}
|
|
501
|
-
resizeDelta.value = delta / MINUTES_PER_HOUR * cellHeight.value;
|
|
521
|
+
resizeDelta.value = delta / MINUTES_PER_HOUR$1 * cellHeight.value;
|
|
502
522
|
(0, react_native_reanimated.runOnJS)(commitDrag)(0, delta);
|
|
503
523
|
}), [
|
|
504
524
|
resizable,
|
|
@@ -512,12 +532,13 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
512
532
|
const handleLongPress = !draggable && onLongPress ? () => onLongPress(positioned.event) : void 0;
|
|
513
533
|
const box = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
514
534
|
style: [
|
|
515
|
-
styles.eventBox,
|
|
535
|
+
styles$1.eventBox,
|
|
516
536
|
{
|
|
517
537
|
left,
|
|
518
538
|
width
|
|
519
539
|
},
|
|
520
|
-
boxStyle
|
|
540
|
+
boxStyle,
|
|
541
|
+
theme.containers.timeGridEvent
|
|
521
542
|
],
|
|
522
543
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderEventComponent, {
|
|
523
544
|
event: positioned.event,
|
|
@@ -530,8 +551,8 @@ function AnimatedEventBox({ positioned, cellHeight, minHour, left, width, dayWid
|
|
|
530
551
|
}), resizable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
531
552
|
gesture: resizeGesture,
|
|
532
553
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
533
|
-
style: styles.resizeHandle,
|
|
534
|
-
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
554
|
+
style: styles$1.resizeHandle,
|
|
555
|
+
children: showDragHandle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.resizeGrip, { backgroundColor: theme.colors.eventText }] }) : null
|
|
535
556
|
})
|
|
536
557
|
}) : null]
|
|
537
558
|
});
|
|
@@ -546,8 +567,8 @@ const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hour
|
|
|
546
567
|
const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ top: (hour - minHour) * cellHeight.value }), [hour, minHour]);
|
|
547
568
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
548
569
|
style: [
|
|
549
|
-
styles.hourRow,
|
|
550
|
-
styles.nonInteractive,
|
|
570
|
+
styles$1.hourRow,
|
|
571
|
+
styles$1.nonInteractive,
|
|
551
572
|
animatedStyle
|
|
552
573
|
],
|
|
553
574
|
children: [hourComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
@@ -556,7 +577,7 @@ const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hour
|
|
|
556
577
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
557
578
|
style: [
|
|
558
579
|
theme.text.hourLabel,
|
|
559
|
-
styles.hourLabel,
|
|
580
|
+
styles$1.hourLabel,
|
|
560
581
|
{
|
|
561
582
|
width: hourColumnWidth,
|
|
562
583
|
color: theme.colors.textMuted
|
|
@@ -564,7 +585,7 @@ const HourRow = ({ hour, minHour, cellHeight, hourColumnWidth, label, ampm, hour
|
|
|
564
585
|
],
|
|
565
586
|
allowFontScaling: false,
|
|
566
587
|
children: label
|
|
567
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles.hourLine, { backgroundColor: theme.colors.gridLine }] })]
|
|
588
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: [styles$1.hourLine, { backgroundColor: theme.colors.gridLine }] })]
|
|
568
589
|
});
|
|
569
590
|
};
|
|
570
591
|
const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth }) => {
|
|
@@ -575,8 +596,8 @@ const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth })
|
|
|
575
596
|
fraction
|
|
576
597
|
]);
|
|
577
598
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
|
|
578
|
-
styles.timeslotLine,
|
|
579
|
-
styles.nonInteractive,
|
|
599
|
+
styles$1.timeslotLine,
|
|
600
|
+
styles$1.nonInteractive,
|
|
580
601
|
{
|
|
581
602
|
left: hourColumnWidth,
|
|
582
603
|
backgroundColor: theme.colors.gridLine
|
|
@@ -585,16 +606,18 @@ const TimeslotLine = ({ hour, minHour, fraction, cellHeight, hourColumnWidth })
|
|
|
585
606
|
] });
|
|
586
607
|
};
|
|
587
608
|
const NowIndicator = ({ cellHeight, nowHours, minHour, left, width, color }) => {
|
|
609
|
+
const theme = require_MonthList.useCalendarTheme();
|
|
588
610
|
const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ top: (nowHours - minHour) * cellHeight.value }), [nowHours, minHour]);
|
|
589
611
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
|
|
590
|
-
styles.nowIndicator,
|
|
591
|
-
styles.nonInteractive,
|
|
612
|
+
styles$1.nowIndicator,
|
|
613
|
+
styles$1.nonInteractive,
|
|
592
614
|
{
|
|
593
615
|
left,
|
|
594
616
|
width,
|
|
595
617
|
backgroundColor: color
|
|
596
618
|
},
|
|
597
|
-
animatedStyle
|
|
619
|
+
animatedStyle,
|
|
620
|
+
theme.containers.nowIndicator
|
|
598
621
|
] });
|
|
599
622
|
};
|
|
600
623
|
const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color }) => {
|
|
@@ -609,8 +632,8 @@ const ShadeBand = ({ cellHeight, startHour, endHour, minHour, left, width, color
|
|
|
609
632
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
610
633
|
testID: "business-hours-shade",
|
|
611
634
|
style: [
|
|
612
|
-
styles.shadeBand,
|
|
613
|
-
styles.nonInteractive,
|
|
635
|
+
styles$1.shadeBand,
|
|
636
|
+
styles$1.nonInteractive,
|
|
614
637
|
{
|
|
615
638
|
left,
|
|
616
639
|
width,
|
|
@@ -674,7 +697,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
674
697
|
const { locationX, locationY } = event.nativeEvent;
|
|
675
698
|
const day = days[days.length === 1 ? 0 : Math.floor(locationX / dayWidth)];
|
|
676
699
|
if (!day) return null;
|
|
677
|
-
const minutes = Math.round((minHour + locationY / heightSource.value) * MINUTES_PER_HOUR);
|
|
700
|
+
const minutes = Math.round((minHour + locationY / heightSource.value) * MINUTES_PER_HOUR$1);
|
|
678
701
|
const pressed = new Date(day);
|
|
679
702
|
pressed.setHours(0, 0, 0, 0);
|
|
680
703
|
pressed.setMinutes(minutes);
|
|
@@ -691,7 +714,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
691
714
|
const hoursRange = (0, react.useMemo)(() => Array.from({ length: maxHour - minHour }, (_, index) => minHour + index), [minHour, maxHour]);
|
|
692
715
|
const now = useNow(showNowIndicator && isActive);
|
|
693
716
|
const nowDayIndex = days.findIndex((day) => (0, _super_calendar_core.getIsToday)(day));
|
|
694
|
-
const nowHours = ((0, date_fns.getHours)(now) * MINUTES_PER_HOUR + (0, date_fns.getMinutes)(now)) / MINUTES_PER_HOUR;
|
|
717
|
+
const nowHours = ((0, date_fns.getHours)(now) * MINUTES_PER_HOUR$1 + (0, date_fns.getMinutes)(now)) / MINUTES_PER_HOUR$1;
|
|
695
718
|
const nowInWindow = nowHours >= minHour && nowHours <= maxHour;
|
|
696
719
|
const fullHeightStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ height: (maxHour - minHour) * heightSource.value }), [
|
|
697
720
|
minHour,
|
|
@@ -739,7 +762,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
739
762
|
const tapCell = (0, react.useCallback)((x, y) => {
|
|
740
763
|
const day = days[days.length === 1 ? 0 : Math.floor(x / dayWidth)];
|
|
741
764
|
if (!day) return;
|
|
742
|
-
const minutes = Math.round((minHour + y / heightSource.value) * MINUTES_PER_HOUR);
|
|
765
|
+
const minutes = Math.round((minHour + y / heightSource.value) * MINUTES_PER_HOUR$1);
|
|
743
766
|
const pressed = new Date(day);
|
|
744
767
|
pressed.setHours(0, 0, 0, 0);
|
|
745
768
|
pressed.setMinutes(minutes);
|
|
@@ -764,7 +787,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
764
787
|
createCancelled.value = 0;
|
|
765
788
|
}).onUpdate((event) => {
|
|
766
789
|
if (createCancelled.value) return;
|
|
767
|
-
const stepPx = snapMinutes / MINUTES_PER_HOUR * heightSource.value;
|
|
790
|
+
const stepPx = snapMinutes / MINUTES_PER_HOUR$1 * heightSource.value;
|
|
768
791
|
const snap = (y) => stepPx > 0 ? Math.round(y / stepPx) * stepPx : y;
|
|
769
792
|
const startSnap = snap(createStartY.value);
|
|
770
793
|
const endSnap = snap(createStartY.value + event.translationY);
|
|
@@ -833,7 +856,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
833
856
|
opacity: createActive.value
|
|
834
857
|
}));
|
|
835
858
|
const cellLayer = onPressCell || onLongPressCell || createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
836
|
-
style: [styles.cellPressLayer, { left: hourColumnWidth }],
|
|
859
|
+
style: [styles$1.cellPressLayer, { left: hourColumnWidth }],
|
|
837
860
|
onPress: onPressCell ? handleBackgroundPress : void 0,
|
|
838
861
|
onLongPress: !createEnabled && onLongPressCell ? handleBackgroundLongPress : void 0,
|
|
839
862
|
tabIndex: -1,
|
|
@@ -841,7 +864,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
841
864
|
accessibilityElementsHidden: true
|
|
842
865
|
}) : null;
|
|
843
866
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
844
|
-
style: styles.container,
|
|
867
|
+
style: styles$1.container,
|
|
845
868
|
children: [showAllDayEventCell ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AllDayLane, {
|
|
846
869
|
days,
|
|
847
870
|
events,
|
|
@@ -866,15 +889,15 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
866
889
|
y: initialScrollY
|
|
867
890
|
},
|
|
868
891
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
869
|
-
style: [styles.content, fullHeightStyle],
|
|
892
|
+
style: [styles$1.content, fullHeightStyle],
|
|
870
893
|
children: [
|
|
871
894
|
cellLayer && backgroundGesture ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
872
895
|
gesture: backgroundGesture,
|
|
873
896
|
children: cellLayer
|
|
874
897
|
}) : cellLayer,
|
|
875
898
|
days.map((day, dayIndex) => (0, _super_calendar_core.isWeekend)(day) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
|
|
876
|
-
styles.weekendColumn,
|
|
877
|
-
styles.nonInteractive,
|
|
899
|
+
styles$1.weekendColumn,
|
|
900
|
+
styles$1.nonInteractive,
|
|
878
901
|
{ backgroundColor: theme.colors.weekendBackground },
|
|
879
902
|
{
|
|
880
903
|
left: dayLeft(dayIndex),
|
|
@@ -885,8 +908,8 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
885
908
|
calendarCellStyle ? days.map((day, dayIndex) => {
|
|
886
909
|
const cellStyle = calendarCellStyle(day);
|
|
887
910
|
return cellStyle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
|
|
888
|
-
styles.weekendColumn,
|
|
889
|
-
styles.nonInteractive,
|
|
911
|
+
styles$1.weekendColumn,
|
|
912
|
+
styles$1.nonInteractive,
|
|
890
913
|
{
|
|
891
914
|
left: dayLeft(dayIndex),
|
|
892
915
|
width: dayWidth
|
|
@@ -905,8 +928,8 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
905
928
|
color: theme.colors.outsideHoursBackground
|
|
906
929
|
}, `closed-${day.toISOString()}-${bandIndex}`))) : null,
|
|
907
930
|
days.map((day, dayIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
|
|
908
|
-
styles.daySeparator,
|
|
909
|
-
styles.nonInteractive,
|
|
931
|
+
styles$1.daySeparator,
|
|
932
|
+
styles$1.nonInteractive,
|
|
910
933
|
{ backgroundColor: theme.colors.gridLine },
|
|
911
934
|
{ left: dayLeft(dayIndex) },
|
|
912
935
|
fullHeightStyle
|
|
@@ -957,7 +980,7 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
957
980
|
color: theme.colors.nowIndicator
|
|
958
981
|
}) : null,
|
|
959
982
|
createEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, { style: [
|
|
960
|
-
styles.createGhost,
|
|
983
|
+
styles$1.createGhost,
|
|
961
984
|
{ pointerEvents: "none" },
|
|
962
985
|
{
|
|
963
986
|
backgroundColor: theme.colors.eventBackground,
|
|
@@ -972,10 +995,15 @@ function TimetablePageInner({ mode, numberOfDays, date, events, cellHeight, hour
|
|
|
972
995
|
});
|
|
973
996
|
}
|
|
974
997
|
const TimetablePage = (0, react.memo)(TimetablePageInner);
|
|
975
|
-
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 }) {
|
|
998
|
+
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 }) {
|
|
976
999
|
const clampedMinHour = Math.max(0, Math.min(minHour, HOURS_PER_DAY - 1));
|
|
977
1000
|
const clampedMaxHour = Math.max(clampedMinHour + 1, Math.min(maxHour, HOURS_PER_DAY));
|
|
978
1001
|
const hourColumnWidth = hideHours ? 0 : hourColumnWidthProp;
|
|
1002
|
+
const labeledRenderEvent = (0, react.useMemo)(() => require_MonthList.withEventAccessibilityLabel(renderEvent, eventAccessibilityLabel, ampm), [
|
|
1003
|
+
renderEvent,
|
|
1004
|
+
eventAccessibilityLabel,
|
|
1005
|
+
ampm
|
|
1006
|
+
]);
|
|
979
1007
|
const { width, height } = (0, react_native.useWindowDimensions)();
|
|
980
1008
|
const listRef = (0, react.useRef)(null);
|
|
981
1009
|
const containerRef = (0, react.useRef)(null);
|
|
@@ -985,7 +1013,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
985
1013
|
const [measured, setMeasured] = (0, react.useState)(false);
|
|
986
1014
|
const weekAnchored = mode === "week" || mode === "custom" && weekEndsOn != null;
|
|
987
1015
|
const step = weekAnchored ? 7 : (0, _super_calendar_core.viewDayCount)(mode, numberOfDays);
|
|
988
|
-
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR - clampedMinHour) * hourHeight;
|
|
1016
|
+
const seedDefaultY = Math.max(0, scrollOffsetMinutes / MINUTES_PER_HOUR$1 - clampedMinHour) * hourHeight;
|
|
989
1017
|
const scrollY = (0, react_native_reanimated.useSharedValue)(seedDefaultY);
|
|
990
1018
|
const offsetSeedRef = (0, react.useRef)(null);
|
|
991
1019
|
const captureOffsetSeed = (0, react.useCallback)((y) => {
|
|
@@ -1167,7 +1195,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1167
1195
|
minHourHeight,
|
|
1168
1196
|
maxHourHeight,
|
|
1169
1197
|
showNowIndicator,
|
|
1170
|
-
renderEvent,
|
|
1198
|
+
renderEvent: labeledRenderEvent,
|
|
1171
1199
|
keyExtractor,
|
|
1172
1200
|
snapMinutes: Math.max(1, dragStepMinutes),
|
|
1173
1201
|
showDragHandle,
|
|
@@ -1209,7 +1237,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1209
1237
|
minHourHeight,
|
|
1210
1238
|
maxHourHeight,
|
|
1211
1239
|
showNowIndicator,
|
|
1212
|
-
|
|
1240
|
+
labeledRenderEvent,
|
|
1213
1241
|
keyExtractor,
|
|
1214
1242
|
dragStepMinutes,
|
|
1215
1243
|
showDragHandle,
|
|
@@ -1227,7 +1255,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1227
1255
|
}), [events, activeIndex]);
|
|
1228
1256
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1229
1257
|
ref: containerRef,
|
|
1230
|
-
style: styles.container,
|
|
1258
|
+
style: styles$1.container,
|
|
1231
1259
|
children: [
|
|
1232
1260
|
renderHeader ? renderHeader(headerDays) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultHeader, {
|
|
1233
1261
|
days: headerDays,
|
|
@@ -1236,13 +1264,14 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1236
1264
|
hourColumnWidth,
|
|
1237
1265
|
showWeekNumber,
|
|
1238
1266
|
weekNumberPrefix,
|
|
1267
|
+
weekdayFormat,
|
|
1239
1268
|
locale,
|
|
1240
1269
|
activeDate,
|
|
1241
1270
|
onPressDateHeader
|
|
1242
1271
|
}),
|
|
1243
1272
|
headerComponent,
|
|
1244
1273
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1245
|
-
style: styles.pager,
|
|
1274
|
+
style: styles$1.pager,
|
|
1246
1275
|
onLayout: (event) => {
|
|
1247
1276
|
setPageHeight(event.nativeEvent.layout.height);
|
|
1248
1277
|
setContainerWidth(event.nativeEvent.layout.width);
|
|
@@ -1250,7 +1279,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1250
1279
|
},
|
|
1251
1280
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_legendapp_list_react_native.LegendList, {
|
|
1252
1281
|
ref: listRef,
|
|
1253
|
-
style: isWeb ? [styles.pagerList, styles.webNoScroll] : styles.pagerList,
|
|
1282
|
+
style: isWeb ? [styles$1.pagerList, styles$1.webNoScroll] : styles$1.pagerList,
|
|
1254
1283
|
data: pageDates,
|
|
1255
1284
|
extraData: listExtraData,
|
|
1256
1285
|
horizontal: true,
|
|
@@ -1280,7 +1309,7 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1280
1309
|
*
|
|
1281
1310
|
* @example
|
|
1282
1311
|
* ```tsx
|
|
1283
|
-
* import { TimeGrid } from "
|
|
1312
|
+
* import { TimeGrid } from "@super-calendar/native";
|
|
1284
1313
|
*
|
|
1285
1314
|
* <TimeGrid
|
|
1286
1315
|
* mode="week"
|
|
@@ -1292,13 +1321,13 @@ function TimeGridInner({ mode, numberOfDays = 1, weekEndsOn, date, events, cellH
|
|
|
1292
1321
|
* ```
|
|
1293
1322
|
*/
|
|
1294
1323
|
const TimeGrid = (0, react.memo)(TimeGridInner);
|
|
1295
|
-
const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, weekNumberPrefix = "W", locale, activeDate, onPressDateHeader }) => {
|
|
1324
|
+
const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, weekNumberPrefix = "W", weekdayFormat, locale, activeDate, onPressDateHeader }) => {
|
|
1296
1325
|
const theme = require_MonthList.useCalendarTheme();
|
|
1297
1326
|
const dayWidth = (width - hourColumnWidth) / days.length;
|
|
1298
1327
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1299
|
-
style: [styles.headerRow, { borderBottomColor: theme.colors.gridLine }],
|
|
1328
|
+
style: [styles$1.headerRow, { borderBottomColor: theme.colors.gridLine }],
|
|
1300
1329
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1301
|
-
style: [styles.weekNumberGutter, { width: hourColumnWidth }],
|
|
1330
|
+
style: [styles$1.weekNumberGutter, { width: hourColumnWidth }],
|
|
1302
1331
|
children: showWeekNumber && hourColumnWidth > 0 && days[0] ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1303
1332
|
style: [theme.text.hourLabel, { color: theme.colors.textMuted }],
|
|
1304
1333
|
allowFontScaling: false,
|
|
@@ -1308,29 +1337,34 @@ const DefaultHeader = ({ days, mode, width, hourColumnWidth, showWeekNumber, wee
|
|
|
1308
1337
|
day,
|
|
1309
1338
|
mode,
|
|
1310
1339
|
width: dayWidth,
|
|
1340
|
+
weekdayFormat,
|
|
1311
1341
|
locale,
|
|
1312
1342
|
activeDate,
|
|
1313
1343
|
onPressDateHeader
|
|
1314
1344
|
}, day.toISOString()))]
|
|
1315
1345
|
});
|
|
1316
1346
|
};
|
|
1317
|
-
const DayHeader = ({ day, width, locale, activeDate, onPressDateHeader }) => {
|
|
1347
|
+
const DayHeader = ({ day, width, weekdayFormat = "short", locale, activeDate, onPressDateHeader }) => {
|
|
1318
1348
|
const theme = require_MonthList.useCalendarTheme();
|
|
1319
1349
|
const isToday = (0, _super_calendar_core.getIsToday)(day);
|
|
1320
1350
|
const isHighlighted = activeDate ? (0, _super_calendar_core.isSameCalendarDay)(day, activeDate) : isToday;
|
|
1321
1351
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Pressable, {
|
|
1322
|
-
style: [
|
|
1352
|
+
style: [
|
|
1353
|
+
styles$1.dayHeader,
|
|
1354
|
+
{ width },
|
|
1355
|
+
theme.containers.columnHeader
|
|
1356
|
+
],
|
|
1323
1357
|
onPress: onPressDateHeader ? () => onPressDateHeader(day) : void 0,
|
|
1324
1358
|
disabled: !onPressDateHeader,
|
|
1325
1359
|
accessibilityRole: onPressDateHeader ? "button" : void 0,
|
|
1326
1360
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1327
|
-
style: [styles.dayHeaderWeekday, { color: theme.colors.textMuted }],
|
|
1361
|
+
style: [styles$1.dayHeaderWeekday, { color: theme.colors.textMuted }],
|
|
1328
1362
|
allowFontScaling: false,
|
|
1329
|
-
children: (0, date_fns.format)(day,
|
|
1363
|
+
children: (0, date_fns.format)(day, (0, _super_calendar_core.weekdayFormatToken)(weekdayFormat), { locale })
|
|
1330
1364
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1331
|
-
style: [styles.dayHeaderBadge, isHighlighted && { backgroundColor: theme.colors.todayBackground }],
|
|
1365
|
+
style: [styles$1.dayHeaderBadge, isHighlighted && { backgroundColor: theme.colors.todayBackground }],
|
|
1332
1366
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1333
|
-
style: [styles.dayHeaderNumber, { color: isHighlighted ? theme.colors.todayText : theme.colors.text }],
|
|
1367
|
+
style: [styles$1.dayHeaderNumber, { color: isHighlighted ? theme.colors.todayText : theme.colors.text }],
|
|
1334
1368
|
allowFontScaling: false,
|
|
1335
1369
|
...isToday && { accessibilityLabel: `Today, ${day.getDate()}` },
|
|
1336
1370
|
children: day.getDate()
|
|
@@ -1338,7 +1372,7 @@ const DayHeader = ({ day, width, locale, activeDate, onPressDateHeader }) => {
|
|
|
1338
1372
|
})]
|
|
1339
1373
|
});
|
|
1340
1374
|
};
|
|
1341
|
-
const styles = react_native.StyleSheet.create({
|
|
1375
|
+
const styles$1 = react_native.StyleSheet.create({
|
|
1342
1376
|
pager: { flex: 1 },
|
|
1343
1377
|
pagerList: { flex: 1 },
|
|
1344
1378
|
container: { flex: 1 },
|
|
@@ -1461,7 +1495,7 @@ function visibleRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
1461
1495
|
*
|
|
1462
1496
|
* @example
|
|
1463
1497
|
* ```tsx
|
|
1464
|
-
* import { Calendar, type CalendarEvent } from "
|
|
1498
|
+
* import { Calendar, type CalendarEvent } from "@super-calendar/native";
|
|
1465
1499
|
*
|
|
1466
1500
|
* function MyCalendar() {
|
|
1467
1501
|
* const [date, setDate] = useState(new Date());
|
|
@@ -1480,7 +1514,7 @@ function visibleRange(mode, date, weekStartsOn, numberOfDays, weekEndsOn) {
|
|
|
1480
1514
|
* }
|
|
1481
1515
|
* ```
|
|
1482
1516
|
*/
|
|
1483
|
-
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 }) {
|
|
1517
|
+
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 }) {
|
|
1484
1518
|
const mergedTheme = (0, react.useMemo)(() => require_MonthList.mergeTheme(theme), [theme]);
|
|
1485
1519
|
const internalCellHeight = (0, react_native_reanimated.useSharedValue)(hourHeight);
|
|
1486
1520
|
const cellHeight = cellHeightProp ?? internalCellHeight;
|
|
@@ -1502,7 +1536,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1502
1536
|
weekEndsOn
|
|
1503
1537
|
]);
|
|
1504
1538
|
const resolvedRenderEvent = (0, react.useMemo)(() => {
|
|
1505
|
-
if (eventCellStyle == null && ampm == null && showTime == null && ellipsizeTitle == null && allDayLabel == null) return renderEvent;
|
|
1539
|
+
if (eventCellStyle == null && ampm == null && showTime == null && ellipsizeTitle == null && allDayLabel == null && eventAccessibilityLabel == null) return renderEvent;
|
|
1506
1540
|
const Base = renderEvent;
|
|
1507
1541
|
return function StyledEvent(props) {
|
|
1508
1542
|
const cellStyle = typeof eventCellStyle === "function" ? eventCellStyle(props.event) : eventCellStyle;
|
|
@@ -1512,7 +1546,12 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1512
1546
|
ampm,
|
|
1513
1547
|
showTime,
|
|
1514
1548
|
ellipsizeTitle,
|
|
1515
|
-
allDayLabel
|
|
1549
|
+
allDayLabel,
|
|
1550
|
+
accessibilityLabel: eventAccessibilityLabel ? eventAccessibilityLabel(props.event, {
|
|
1551
|
+
mode: props.mode,
|
|
1552
|
+
isAllDay: props.isAllDay ?? false,
|
|
1553
|
+
ampm: ampm ?? false
|
|
1554
|
+
}) : props.accessibilityLabel
|
|
1516
1555
|
});
|
|
1517
1556
|
};
|
|
1518
1557
|
}, [
|
|
@@ -1521,7 +1560,8 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1521
1560
|
ampm,
|
|
1522
1561
|
showTime,
|
|
1523
1562
|
ellipsizeTitle,
|
|
1524
|
-
allDayLabel
|
|
1563
|
+
allDayLabel,
|
|
1564
|
+
eventAccessibilityLabel
|
|
1525
1565
|
]);
|
|
1526
1566
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MonthList.CalendarThemeProvider, {
|
|
1527
1567
|
value: mergedTheme,
|
|
@@ -1530,6 +1570,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1530
1570
|
events,
|
|
1531
1571
|
maxVisibleEventCount,
|
|
1532
1572
|
weekStartsOn,
|
|
1573
|
+
weekdayFormat,
|
|
1533
1574
|
locale,
|
|
1534
1575
|
sortedMonthView,
|
|
1535
1576
|
moreLabel,
|
|
@@ -1570,6 +1611,7 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1570
1611
|
cellHeight,
|
|
1571
1612
|
hourHeight,
|
|
1572
1613
|
weekStartsOn,
|
|
1614
|
+
weekdayFormat,
|
|
1573
1615
|
renderEvent: resolvedRenderEvent,
|
|
1574
1616
|
keyExtractor,
|
|
1575
1617
|
scrollOffsetMinutes,
|
|
@@ -1613,6 +1655,326 @@ function Calendar({ events, mode, date, onChangeDate, onChangeDateRange, onPress
|
|
|
1613
1655
|
});
|
|
1614
1656
|
}
|
|
1615
1657
|
//#endregion
|
|
1658
|
+
//#region src/components/ResourceTimeline.tsx
|
|
1659
|
+
const MOVE_ACTIVATE_MS = 250;
|
|
1660
|
+
const MINUTES_PER_HOUR = 60;
|
|
1661
|
+
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
1662
|
+
function DefaultBar({ event, width }) {
|
|
1663
|
+
const theme = require_MonthList.useCalendarTheme();
|
|
1664
|
+
const time = (0, _super_calendar_core.eventTimeLabel)({
|
|
1665
|
+
mode: "day",
|
|
1666
|
+
isAllDay: false,
|
|
1667
|
+
start: event.start,
|
|
1668
|
+
end: event.end,
|
|
1669
|
+
ampm: false,
|
|
1670
|
+
showTime: true
|
|
1671
|
+
});
|
|
1672
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1673
|
+
style: [
|
|
1674
|
+
styles.bar,
|
|
1675
|
+
{ backgroundColor: theme.colors.eventBackground },
|
|
1676
|
+
theme.containers.timeGridEvent
|
|
1677
|
+
],
|
|
1678
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1679
|
+
numberOfLines: 1,
|
|
1680
|
+
style: [theme.text.eventTitle, { color: theme.colors.eventText }],
|
|
1681
|
+
allowFontScaling: false,
|
|
1682
|
+
children: event.title
|
|
1683
|
+
}), time && width > 56 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1684
|
+
numberOfLines: 1,
|
|
1685
|
+
style: [styles.barTime, { color: theme.colors.eventText }],
|
|
1686
|
+
allowFontScaling: false,
|
|
1687
|
+
children: time
|
|
1688
|
+
}) : null]
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
function ResourceBar({ pe, left, width, laneHeight, hourWidth, snapMinutes, Renderer, onPress, onDragEvent, theme }) {
|
|
1692
|
+
const moveX = (0, react_native_reanimated.useSharedValue)(0);
|
|
1693
|
+
const resizeW = (0, react_native_reanimated.useSharedValue)(0);
|
|
1694
|
+
const latest = (0, react.useRef)({
|
|
1695
|
+
event: pe.event,
|
|
1696
|
+
onDragEvent
|
|
1697
|
+
});
|
|
1698
|
+
latest.current = {
|
|
1699
|
+
event: pe.event,
|
|
1700
|
+
onDragEvent
|
|
1701
|
+
};
|
|
1702
|
+
const draggable = !pe.event.disabled;
|
|
1703
|
+
(0, react.useEffect)(() => {
|
|
1704
|
+
moveX.value = 0;
|
|
1705
|
+
resizeW.value = 0;
|
|
1706
|
+
}, [
|
|
1707
|
+
pe.startHours,
|
|
1708
|
+
pe.durationHours,
|
|
1709
|
+
moveX,
|
|
1710
|
+
resizeW
|
|
1711
|
+
]);
|
|
1712
|
+
const snapBack = (0, react.useCallback)(() => {
|
|
1713
|
+
moveX.value = 0;
|
|
1714
|
+
resizeW.value = 0;
|
|
1715
|
+
}, [moveX, resizeW]);
|
|
1716
|
+
const commit = (0, react.useCallback)((deltaStartMin, deltaEndMin) => {
|
|
1717
|
+
const { event, onDragEvent: handler } = latest.current;
|
|
1718
|
+
const next = (0, _super_calendar_core.resolveDraggedBounds)(event.start, event.end, deltaStartMin, deltaEndMin, snapMinutes);
|
|
1719
|
+
if (!next) {
|
|
1720
|
+
snapBack();
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1723
|
+
if (handler(event, next.start, next.end) === false) snapBack();
|
|
1724
|
+
}, [snapMinutes, snapBack]);
|
|
1725
|
+
const barStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
1726
|
+
transform: [{ translateX: moveX.value }],
|
|
1727
|
+
width: Math.max(width + resizeW.value, 2)
|
|
1728
|
+
}), [width]);
|
|
1729
|
+
const moveGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(draggable).activateAfterLongPress(MOVE_ACTIVATE_MS).onUpdate((e) => {
|
|
1730
|
+
moveX.value = e.translationX;
|
|
1731
|
+
}).onEnd((e) => {
|
|
1732
|
+
const delta = (0, _super_calendar_core.snapDeltaMinutes)(e.translationX, hourWidth, snapMinutes);
|
|
1733
|
+
if (delta === 0) {
|
|
1734
|
+
moveX.value = 0;
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
moveX.value = delta / MINUTES_PER_HOUR * hourWidth;
|
|
1738
|
+
(0, react_native_reanimated.runOnJS)(commit)(delta, delta);
|
|
1739
|
+
}), [
|
|
1740
|
+
draggable,
|
|
1741
|
+
hourWidth,
|
|
1742
|
+
snapMinutes,
|
|
1743
|
+
moveX,
|
|
1744
|
+
commit
|
|
1745
|
+
]);
|
|
1746
|
+
const resizeGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(draggable).onUpdate((e) => {
|
|
1747
|
+
resizeW.value = e.translationX;
|
|
1748
|
+
}).onEnd((e) => {
|
|
1749
|
+
const delta = (0, _super_calendar_core.snapDeltaMinutes)(e.translationX, hourWidth, snapMinutes);
|
|
1750
|
+
if (delta === 0) {
|
|
1751
|
+
resizeW.value = 0;
|
|
1752
|
+
return;
|
|
1753
|
+
}
|
|
1754
|
+
resizeW.value = delta / MINUTES_PER_HOUR * hourWidth;
|
|
1755
|
+
(0, react_native_reanimated.runOnJS)(commit)(0, delta);
|
|
1756
|
+
}), [
|
|
1757
|
+
draggable,
|
|
1758
|
+
hourWidth,
|
|
1759
|
+
snapMinutes,
|
|
1760
|
+
resizeW,
|
|
1761
|
+
commit
|
|
1762
|
+
]);
|
|
1763
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
1764
|
+
style: [{
|
|
1765
|
+
position: "absolute",
|
|
1766
|
+
left,
|
|
1767
|
+
top: pe.column * laneHeight,
|
|
1768
|
+
height: laneHeight,
|
|
1769
|
+
padding: 1
|
|
1770
|
+
}, barStyle],
|
|
1771
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1772
|
+
gesture: moveGesture,
|
|
1773
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
1774
|
+
onPress,
|
|
1775
|
+
accessibilityRole: "button",
|
|
1776
|
+
accessibilityLabel: pe.event.title,
|
|
1777
|
+
style: styles.fill,
|
|
1778
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Renderer, {
|
|
1779
|
+
event: pe.event,
|
|
1780
|
+
width,
|
|
1781
|
+
onPress
|
|
1782
|
+
})
|
|
1783
|
+
})
|
|
1784
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
1785
|
+
gesture: resizeGesture,
|
|
1786
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1787
|
+
style: [styles.resizeGrip, { backgroundColor: theme.colors.eventText }],
|
|
1788
|
+
accessibilityRole: "adjustable",
|
|
1789
|
+
accessibilityLabel: `Resize ${pe.event.title}`
|
|
1790
|
+
})
|
|
1791
|
+
})]
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* A horizontal resource timeline: rows are resources (rooms, people, machines)
|
|
1796
|
+
* and the x-axis is one day's hours. Events sit in their resource's row, and
|
|
1797
|
+
* overlapping events in the same row stack into sub-lanes (via the shared
|
|
1798
|
+
* `layoutDayEvents`). The grid scrolls horizontally when the axis is wider than
|
|
1799
|
+
* the screen. Pass `onDragEvent` to enable long-press drag-to-move and edge
|
|
1800
|
+
* resize along the time axis. Read the theme from context — wrap in
|
|
1801
|
+
* `CalendarThemeProvider` (or render inside `<Calendar>`) to restyle.
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* ```tsx
|
|
1805
|
+
* <ResourceTimeline
|
|
1806
|
+
* date={new Date()}
|
|
1807
|
+
* resources={[{ id: "a", title: "Room A" }, { id: "b", title: "Room B" }]}
|
|
1808
|
+
* events={events} // each event carries a `resourceId`
|
|
1809
|
+
* />
|
|
1810
|
+
* ```
|
|
1811
|
+
*/
|
|
1812
|
+
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 }) {
|
|
1813
|
+
const theme = require_MonthList.useCalendarTheme();
|
|
1814
|
+
const Renderer = renderEvent ?? DefaultBar;
|
|
1815
|
+
const hours = (0, react.useMemo)(() => Array.from({ length: Math.max(0, endHour - startHour) }, (_, i) => startHour + i), [startHour, endHour]);
|
|
1816
|
+
const trackWidth = (endHour - startHour) * hourWidth;
|
|
1817
|
+
const byResource = (0, react.useMemo)(() => {
|
|
1818
|
+
const map = /* @__PURE__ */ new Map();
|
|
1819
|
+
for (const resource of resources) {
|
|
1820
|
+
const own = events.filter((event) => resourceId(event) === resource.id);
|
|
1821
|
+
map.set(resource.id, (0, _super_calendar_core.layoutDayEvents)(own, date));
|
|
1822
|
+
}
|
|
1823
|
+
return map;
|
|
1824
|
+
}, [
|
|
1825
|
+
resources,
|
|
1826
|
+
events,
|
|
1827
|
+
resourceId,
|
|
1828
|
+
date
|
|
1829
|
+
]);
|
|
1830
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, {
|
|
1831
|
+
horizontal: true,
|
|
1832
|
+
showsHorizontalScrollIndicator: true,
|
|
1833
|
+
style: styles.root,
|
|
1834
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1835
|
+
style: { width: labelWidth + trackWidth },
|
|
1836
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1837
|
+
style: [styles.header, { borderBottomColor: theme.colors.gridLine }],
|
|
1838
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: { width: labelWidth } }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1839
|
+
style: {
|
|
1840
|
+
width: trackWidth,
|
|
1841
|
+
height: 24
|
|
1842
|
+
},
|
|
1843
|
+
children: hours.map((h) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1844
|
+
allowFontScaling: false,
|
|
1845
|
+
style: [styles.hourTick, {
|
|
1846
|
+
left: (h - startHour) * hourWidth,
|
|
1847
|
+
color: theme.colors.textMuted
|
|
1848
|
+
}],
|
|
1849
|
+
children: (0, _super_calendar_core.formatHour)(h, { ampm })
|
|
1850
|
+
}, h))
|
|
1851
|
+
})]
|
|
1852
|
+
}), resources.map((resource) => {
|
|
1853
|
+
const positioned = byResource.get(resource.id) ?? [];
|
|
1854
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1855
|
+
style: [
|
|
1856
|
+
styles.row,
|
|
1857
|
+
{
|
|
1858
|
+
height: rowHeight,
|
|
1859
|
+
borderBottomColor: theme.colors.gridLine
|
|
1860
|
+
},
|
|
1861
|
+
theme.containers.resourceRow
|
|
1862
|
+
],
|
|
1863
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1864
|
+
style: [
|
|
1865
|
+
styles.label,
|
|
1866
|
+
{
|
|
1867
|
+
width: labelWidth,
|
|
1868
|
+
borderRightColor: theme.colors.gridLine
|
|
1869
|
+
},
|
|
1870
|
+
theme.containers.resourceLabel
|
|
1871
|
+
],
|
|
1872
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
|
|
1873
|
+
numberOfLines: 1,
|
|
1874
|
+
style: { color: theme.colors.text },
|
|
1875
|
+
allowFontScaling: false,
|
|
1876
|
+
children: resource.title ?? resource.id
|
|
1877
|
+
})
|
|
1878
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
1879
|
+
style: { width: trackWidth },
|
|
1880
|
+
children: [hours.slice(1).map((h) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
1881
|
+
pointerEvents: "none",
|
|
1882
|
+
style: [styles.gridLine, {
|
|
1883
|
+
left: (h - startHour) * hourWidth,
|
|
1884
|
+
backgroundColor: theme.colors.gridLine
|
|
1885
|
+
}]
|
|
1886
|
+
}, h)), positioned.map((pe, idx) => {
|
|
1887
|
+
const left = clamp(pe.startHours - startHour, 0, endHour - startHour) * hourWidth;
|
|
1888
|
+
const right = clamp(pe.startHours + pe.durationHours - startHour, 0, endHour - startHour) * hourWidth;
|
|
1889
|
+
const width = Math.max(right - left, 2);
|
|
1890
|
+
const laneHeight = rowHeight / pe.columns;
|
|
1891
|
+
const onPress = () => onPressEvent?.(pe.event);
|
|
1892
|
+
if (onDragEvent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResourceBar, {
|
|
1893
|
+
pe,
|
|
1894
|
+
left,
|
|
1895
|
+
width,
|
|
1896
|
+
laneHeight,
|
|
1897
|
+
hourWidth,
|
|
1898
|
+
snapMinutes: dragStepMinutes,
|
|
1899
|
+
Renderer,
|
|
1900
|
+
onPress,
|
|
1901
|
+
onDragEvent,
|
|
1902
|
+
theme
|
|
1903
|
+
}, idx);
|
|
1904
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
1905
|
+
onPress,
|
|
1906
|
+
accessibilityRole: "button",
|
|
1907
|
+
accessibilityLabel: pe.event.title,
|
|
1908
|
+
style: {
|
|
1909
|
+
position: "absolute",
|
|
1910
|
+
left,
|
|
1911
|
+
width,
|
|
1912
|
+
top: pe.column * laneHeight,
|
|
1913
|
+
height: laneHeight,
|
|
1914
|
+
padding: 1
|
|
1915
|
+
},
|
|
1916
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Renderer, {
|
|
1917
|
+
event: pe.event,
|
|
1918
|
+
width,
|
|
1919
|
+
onPress
|
|
1920
|
+
})
|
|
1921
|
+
}, idx);
|
|
1922
|
+
})]
|
|
1923
|
+
})]
|
|
1924
|
+
}, resource.id);
|
|
1925
|
+
})]
|
|
1926
|
+
})
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
const styles = react_native.StyleSheet.create({
|
|
1930
|
+
root: { flexGrow: 0 },
|
|
1931
|
+
header: {
|
|
1932
|
+
flexDirection: "row",
|
|
1933
|
+
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
1934
|
+
},
|
|
1935
|
+
hourTick: {
|
|
1936
|
+
position: "absolute",
|
|
1937
|
+
top: 4,
|
|
1938
|
+
fontSize: 10
|
|
1939
|
+
},
|
|
1940
|
+
row: {
|
|
1941
|
+
flexDirection: "row",
|
|
1942
|
+
borderBottomWidth: react_native.StyleSheet.hairlineWidth
|
|
1943
|
+
},
|
|
1944
|
+
label: {
|
|
1945
|
+
justifyContent: "center",
|
|
1946
|
+
paddingHorizontal: 10,
|
|
1947
|
+
borderRightWidth: react_native.StyleSheet.hairlineWidth
|
|
1948
|
+
},
|
|
1949
|
+
gridLine: {
|
|
1950
|
+
position: "absolute",
|
|
1951
|
+
top: 0,
|
|
1952
|
+
bottom: 0,
|
|
1953
|
+
width: react_native.StyleSheet.hairlineWidth
|
|
1954
|
+
},
|
|
1955
|
+
bar: {
|
|
1956
|
+
flex: 1,
|
|
1957
|
+
borderRadius: 6,
|
|
1958
|
+
paddingHorizontal: 6,
|
|
1959
|
+
paddingVertical: 2,
|
|
1960
|
+
overflow: "hidden"
|
|
1961
|
+
},
|
|
1962
|
+
barTime: {
|
|
1963
|
+
fontSize: 11,
|
|
1964
|
+
opacity: .75
|
|
1965
|
+
},
|
|
1966
|
+
fill: { flex: 1 },
|
|
1967
|
+
resizeGrip: {
|
|
1968
|
+
position: "absolute",
|
|
1969
|
+
right: 1,
|
|
1970
|
+
top: "30%",
|
|
1971
|
+
bottom: "30%",
|
|
1972
|
+
width: 4,
|
|
1973
|
+
borderRadius: 2,
|
|
1974
|
+
opacity: .5
|
|
1975
|
+
}
|
|
1976
|
+
});
|
|
1977
|
+
//#endregion
|
|
1616
1978
|
exports.Agenda = Agenda;
|
|
1617
1979
|
exports.Calendar = Calendar;
|
|
1618
1980
|
exports.CalendarThemeProvider = require_MonthList.CalendarThemeProvider;
|
|
@@ -1622,6 +1984,7 @@ exports.DefaultMonthEvent = require_MonthList.DefaultMonthEvent;
|
|
|
1622
1984
|
exports.MonthList = require_MonthList.MonthList;
|
|
1623
1985
|
exports.MonthPager = require_MonthList.MonthPager;
|
|
1624
1986
|
exports.MonthView = require_MonthList.MonthView;
|
|
1987
|
+
exports.ResourceTimeline = ResourceTimeline;
|
|
1625
1988
|
exports.TimeGrid = TimeGrid;
|
|
1626
1989
|
Object.defineProperty(exports, "buildMonthGrid", {
|
|
1627
1990
|
enumerable: true,
|
|
@@ -1747,3 +2110,9 @@ Object.defineProperty(exports, "useMonthGrid", {
|
|
|
1747
2110
|
return _super_calendar_core.useMonthGrid;
|
|
1748
2111
|
}
|
|
1749
2112
|
});
|
|
2113
|
+
Object.defineProperty(exports, "weekdayFormatToken", {
|
|
2114
|
+
enumerable: true,
|
|
2115
|
+
get: function() {
|
|
2116
|
+
return _super_calendar_core.weekdayFormatToken;
|
|
2117
|
+
}
|
|
2118
|
+
});
|