@super-calendar/dom 2.13.0 → 2.14.1
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 +26 -0
- package/dist/index.d.mts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +235 -64
- package/dist/index.mjs +237 -66
- package/package.json +2 -2
- package/src/Calendar.tsx +16 -0
- package/src/MonthList.tsx +11 -4
- package/src/MonthView.tsx +26 -16
- package/src/ResourceTimeline.tsx +48 -50
- package/src/TimeGrid.tsx +263 -35
- package/src/touch.ts +61 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/dom",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"description": "Virtualized month / week / day calendar and date picker for react-dom. No React Native, no react-native-web.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"calendar",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@super-calendar/core": "2.
|
|
51
|
+
"@super-calendar/core": "2.14.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@legendapp/list": ">=3",
|
package/src/Calendar.tsx
CHANGED
|
@@ -176,6 +176,10 @@ export interface CalendarProps<T = unknown>
|
|
|
176
176
|
eventOverlap?: boolean;
|
|
177
177
|
/** Snap dragged/created events to this many minutes. */
|
|
178
178
|
dragStepMinutes?: number;
|
|
179
|
+
/** DOM touch/pen hold duration in ms (default 300). */
|
|
180
|
+
touchDragDelay?: number;
|
|
181
|
+
/** DOM touch/pen movement tolerance in px (default 8). */
|
|
182
|
+
touchDragThreshold?: number;
|
|
179
183
|
/**
|
|
180
184
|
* Tap empty space: the date+time pressed on the week/day grid, or the tapped
|
|
181
185
|
* day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
@@ -210,6 +214,10 @@ export interface CalendarProps<T = unknown>
|
|
|
210
214
|
// --- Month mode ---
|
|
211
215
|
/** Max chips per day before a "+N more" row. */
|
|
212
216
|
maxVisibleEventCount?: number;
|
|
217
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
218
|
+
chipHeight?: number;
|
|
219
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
220
|
+
chipGap?: number;
|
|
213
221
|
/** Overflow row template; `{moreCount}` is replaced. */
|
|
214
222
|
moreLabel?: string;
|
|
215
223
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -361,6 +369,8 @@ function CalendarInner<T = unknown>(
|
|
|
361
369
|
eventDurationEditable,
|
|
362
370
|
eventOverlap,
|
|
363
371
|
dragStepMinutes,
|
|
372
|
+
touchDragDelay,
|
|
373
|
+
touchDragThreshold,
|
|
364
374
|
onPressCell,
|
|
365
375
|
onCreateEvent,
|
|
366
376
|
onDragStart,
|
|
@@ -371,6 +381,8 @@ function CalendarInner<T = unknown>(
|
|
|
371
381
|
keyboardEventNavigation,
|
|
372
382
|
// month
|
|
373
383
|
maxVisibleEventCount,
|
|
384
|
+
chipHeight,
|
|
385
|
+
chipGap,
|
|
374
386
|
moreLabel,
|
|
375
387
|
labels,
|
|
376
388
|
showAdjacentMonths,
|
|
@@ -496,6 +508,8 @@ function CalendarInner<T = unknown>(
|
|
|
496
508
|
classNames={classNames}
|
|
497
509
|
styles={styles}
|
|
498
510
|
maxVisibleEventCount={maxVisibleEventCount}
|
|
511
|
+
chipHeight={chipHeight}
|
|
512
|
+
chipGap={chipGap}
|
|
499
513
|
moreLabel={moreLabel}
|
|
500
514
|
showAdjacentMonths={showAdjacentMonths}
|
|
501
515
|
showTitle={showTitle}
|
|
@@ -563,6 +577,8 @@ function CalendarInner<T = unknown>(
|
|
|
563
577
|
eventDurationEditable={eventDurationEditable}
|
|
564
578
|
eventOverlap={eventOverlap}
|
|
565
579
|
dragStepMinutes={dragStepMinutes}
|
|
580
|
+
touchDragDelay={touchDragDelay}
|
|
581
|
+
touchDragThreshold={touchDragThreshold}
|
|
566
582
|
onPressEvent={onPressEvent}
|
|
567
583
|
onPressCell={onPressCell}
|
|
568
584
|
onCreateEvent={onCreateEvent}
|
package/src/MonthList.tsx
CHANGED
|
@@ -52,6 +52,10 @@ export interface MonthListProps<T = unknown>
|
|
|
52
52
|
eventAccessibilityLabel?: EventAccessibilityLabeler<T>;
|
|
53
53
|
/** Max chips shown per day before a "+N more" row (default 3). */
|
|
54
54
|
maxVisibleEventCount?: number;
|
|
55
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
56
|
+
chipHeight?: number;
|
|
57
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
58
|
+
chipGap?: number;
|
|
55
59
|
/** Template for the overflow row; `{moreCount}` is replaced. */
|
|
56
60
|
moreLabel?: string;
|
|
57
61
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -102,6 +106,8 @@ export function MonthList<T = unknown>({
|
|
|
102
106
|
renderEvent,
|
|
103
107
|
eventAccessibilityLabel,
|
|
104
108
|
maxVisibleEventCount,
|
|
109
|
+
chipHeight,
|
|
110
|
+
chipGap,
|
|
105
111
|
moreLabel,
|
|
106
112
|
labels,
|
|
107
113
|
onPressEvent,
|
|
@@ -148,11 +154,10 @@ export function MonthList<T = unknown>({
|
|
|
148
154
|
return map;
|
|
149
155
|
}, [events]);
|
|
150
156
|
|
|
151
|
-
//
|
|
152
|
-
// actually change, not on every parent render.
|
|
157
|
+
// Cached rows refresh when selection, events, or chip dimensions change.
|
|
153
158
|
const extraData = useMemo(
|
|
154
|
-
() => [selectedRange, selectedDates, events] as const,
|
|
155
|
-
[selectedRange, selectedDates, events],
|
|
159
|
+
() => [selectedRange, selectedDates, events, chipHeight, chipGap] as const,
|
|
160
|
+
[selectedRange, selectedDates, events, chipHeight, chipGap],
|
|
156
161
|
);
|
|
157
162
|
|
|
158
163
|
return (
|
|
@@ -202,6 +207,8 @@ export function MonthList<T = unknown>({
|
|
|
202
207
|
renderEvent={renderEvent}
|
|
203
208
|
eventAccessibilityLabel={eventAccessibilityLabel}
|
|
204
209
|
maxVisibleEventCount={maxVisibleEventCount}
|
|
210
|
+
chipHeight={chipHeight}
|
|
211
|
+
chipGap={chipGap}
|
|
205
212
|
moreLabel={moreLabel}
|
|
206
213
|
labels={labels}
|
|
207
214
|
onPressEvent={onPressEvent}
|
package/src/MonthView.tsx
CHANGED
|
@@ -127,6 +127,10 @@ export interface MonthViewProps<T = unknown>
|
|
|
127
127
|
* per day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
128
128
|
*/
|
|
129
129
|
maxVisibleEventCount?: number;
|
|
130
|
+
/** Height of an event chip and of the "+N more" row, in px (default 18). */
|
|
131
|
+
chipHeight?: number;
|
|
132
|
+
/** Vertical gap between event chips, in px (default 2). */
|
|
133
|
+
chipGap?: number;
|
|
130
134
|
/** Template for the overflow row; `{moreCount}` is replaced (default "{moreCount} More"). */
|
|
131
135
|
moreLabel?: string;
|
|
132
136
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -328,6 +332,7 @@ function eventCellDefault(
|
|
|
328
332
|
// True while a drag is over this day: a create sweep covering it, or a move
|
|
329
333
|
// about to land on it. Tinted over the weekend shading so the drag reads live.
|
|
330
334
|
isDragTarget: boolean,
|
|
335
|
+
chipGap: number,
|
|
331
336
|
): SlotDefault {
|
|
332
337
|
return {
|
|
333
338
|
base: {
|
|
@@ -338,7 +343,7 @@ function eventCellDefault(
|
|
|
338
343
|
cursor: day.isDisabled ? "default" : "pointer",
|
|
339
344
|
display: "flex",
|
|
340
345
|
flexDirection: "column",
|
|
341
|
-
gap:
|
|
346
|
+
gap: chipGap,
|
|
342
347
|
padding: CELL_PAD,
|
|
343
348
|
boxSizing: "border-box",
|
|
344
349
|
textAlign: "left",
|
|
@@ -397,12 +402,12 @@ const chipButtonDefault: SlotDefault = {
|
|
|
397
402
|
},
|
|
398
403
|
};
|
|
399
404
|
|
|
400
|
-
function chipDefault(theme: DomCalendarTheme): SlotDefault {
|
|
405
|
+
function chipDefault(theme: DomCalendarTheme, chipHeight: number): SlotDefault {
|
|
401
406
|
return {
|
|
402
407
|
base: {
|
|
403
408
|
display: "block",
|
|
404
|
-
height:
|
|
405
|
-
lineHeight: `${
|
|
409
|
+
height: chipHeight,
|
|
410
|
+
lineHeight: `${chipHeight}px`,
|
|
406
411
|
whiteSpace: "nowrap",
|
|
407
412
|
overflow: "hidden",
|
|
408
413
|
textOverflow: "ellipsis",
|
|
@@ -418,7 +423,7 @@ function chipDefault(theme: DomCalendarTheme): SlotDefault {
|
|
|
418
423
|
};
|
|
419
424
|
}
|
|
420
425
|
|
|
421
|
-
function moreButtonDefault(theme: DomCalendarTheme): SlotDefault {
|
|
426
|
+
function moreButtonDefault(theme: DomCalendarTheme, chipHeight: number): SlotDefault {
|
|
422
427
|
return {
|
|
423
428
|
base: {
|
|
424
429
|
position: "relative",
|
|
@@ -427,8 +432,8 @@ function moreButtonDefault(theme: DomCalendarTheme): SlotDefault {
|
|
|
427
432
|
background: "transparent",
|
|
428
433
|
cursor: "pointer",
|
|
429
434
|
textAlign: "left",
|
|
430
|
-
height:
|
|
431
|
-
lineHeight: `${
|
|
435
|
+
height: chipHeight,
|
|
436
|
+
lineHeight: `${chipHeight}px`,
|
|
432
437
|
fontFamily: "inherit",
|
|
433
438
|
},
|
|
434
439
|
themed: {
|
|
@@ -487,6 +492,8 @@ export function MonthView<T = unknown>({
|
|
|
487
492
|
renderEvent,
|
|
488
493
|
eventAccessibilityLabel,
|
|
489
494
|
maxVisibleEventCount = 3,
|
|
495
|
+
chipHeight = CHIP_HEIGHT,
|
|
496
|
+
chipGap = CHIP_GAP,
|
|
490
497
|
moreLabel = "{moreCount} More",
|
|
491
498
|
labels: labelsProp,
|
|
492
499
|
onPressEvent,
|
|
@@ -579,7 +586,7 @@ export function MonthView<T = unknown>({
|
|
|
579
586
|
}, [moreOpenFor]);
|
|
580
587
|
// Reserve `maxVisibleEventCount` rows below the date so every cell is uniform;
|
|
581
588
|
// when a day overflows, the last row becomes the "+N more" affordance.
|
|
582
|
-
const eventRowHeight = CELL_PAD * 2 + DATE_ROW + maxVisibleEventCount * (
|
|
589
|
+
const eventRowHeight = CELL_PAD * 2 + DATE_ROW + maxVisibleEventCount * (chipHeight + chipGap);
|
|
583
590
|
const { weeks, weekdays } = useMemo(
|
|
584
591
|
() =>
|
|
585
592
|
buildMonthGrid(date, {
|
|
@@ -833,7 +840,7 @@ export function MonthView<T = unknown>({
|
|
|
833
840
|
})
|
|
834
841
|
.filter((b) => b.startCol <= b.endCol);
|
|
835
842
|
const barChipButton = slot("chipButton", chipButtonDefault);
|
|
836
|
-
const barChip = slot("chip", chipDefault(theme));
|
|
843
|
+
const barChip = slot("chip", chipDefault(theme, chipHeight));
|
|
837
844
|
return (
|
|
838
845
|
<div
|
|
839
846
|
key={week.id}
|
|
@@ -897,6 +904,7 @@ export function MonthView<T = unknown>({
|
|
|
897
904
|
cellHeight,
|
|
898
905
|
highlightWeekends,
|
|
899
906
|
inCreate || isDropTarget,
|
|
907
|
+
chipGap,
|
|
900
908
|
),
|
|
901
909
|
);
|
|
902
910
|
return (
|
|
@@ -1019,9 +1027,9 @@ export function MonthView<T = unknown>({
|
|
|
1019
1027
|
top:
|
|
1020
1028
|
CELL_PAD +
|
|
1021
1029
|
DATE_ROW +
|
|
1022
|
-
|
|
1023
|
-
b.seg.lane * (
|
|
1024
|
-
height:
|
|
1030
|
+
chipGap +
|
|
1031
|
+
b.seg.lane * (chipHeight + chipGap),
|
|
1032
|
+
height: chipHeight,
|
|
1025
1033
|
pointerEvents: isDragging ? "none" : "auto",
|
|
1026
1034
|
// Fade the bar being carried, so the tinted drop
|
|
1027
1035
|
// target reads as where it is going.
|
|
@@ -1057,13 +1065,13 @@ export function MonthView<T = unknown>({
|
|
|
1057
1065
|
})}
|
|
1058
1066
|
<div
|
|
1059
1067
|
{...slot("events", {
|
|
1060
|
-
base: { display: "flex", flexDirection: "column", gap:
|
|
1068
|
+
base: { display: "flex", flexDirection: "column", gap: chipGap },
|
|
1061
1069
|
})}
|
|
1062
1070
|
>
|
|
1063
1071
|
{/* Reserve one row per visible lane so the absolute bars have
|
|
1064
1072
|
space and "+more" sits below them. */}
|
|
1065
1073
|
{Array.from({ length: visibleLanes }, (_, i) => (
|
|
1066
|
-
<div key={`lane-${i}`} aria-hidden style={{ height:
|
|
1074
|
+
<div key={`lane-${i}`} aria-hidden style={{ height: chipHeight }} />
|
|
1067
1075
|
))}
|
|
1068
1076
|
{hiddenEvents.length > 0 ? (
|
|
1069
1077
|
<button
|
|
@@ -1080,7 +1088,7 @@ export function MonthView<T = unknown>({
|
|
|
1080
1088
|
setMoreOpenFor((open) => (open === day.id ? null : day.id));
|
|
1081
1089
|
}
|
|
1082
1090
|
}}
|
|
1083
|
-
{...slot("more", moreButtonDefault(theme))}
|
|
1091
|
+
{...slot("more", moreButtonDefault(theme, chipHeight))}
|
|
1084
1092
|
aria-label={`${labels.moreEvents(hiddenEvents.length)}, ${dayLabel}`}
|
|
1085
1093
|
aria-expanded={onPressMore ? undefined : moreOpenFor === day.id}
|
|
1086
1094
|
>
|
|
@@ -1160,7 +1168,9 @@ export function MonthView<T = unknown>({
|
|
|
1160
1168
|
{Chip ? (
|
|
1161
1169
|
<Chip event={event} onPress={() => onPressEvent?.(event)} />
|
|
1162
1170
|
) : (
|
|
1163
|
-
<span {...slot("chip", chipDefault(theme))}>
|
|
1171
|
+
<span {...slot("chip", chipDefault(theme, chipHeight))}>
|
|
1172
|
+
{event.title}
|
|
1173
|
+
</span>
|
|
1164
1174
|
)}
|
|
1165
1175
|
</button>
|
|
1166
1176
|
))}
|
package/src/ResourceTimeline.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { addMinutes, startOfDay } from "date-fns";
|
|
2
1
|
import type {
|
|
3
2
|
ComponentType,
|
|
4
3
|
CSSProperties,
|
|
@@ -19,6 +18,9 @@ import {
|
|
|
19
18
|
eventTimeLabel,
|
|
20
19
|
formatHour,
|
|
21
20
|
layoutDayEvents,
|
|
21
|
+
movedClockSpan,
|
|
22
|
+
type PositionedEvent,
|
|
23
|
+
resolveDraggedBounds,
|
|
22
24
|
} from "@super-calendar/core";
|
|
23
25
|
import { createSlots, dataState, type ResolvedSlot, type SlotStyleProps } from "./slots";
|
|
24
26
|
import { type DomCalendarTheme, mergeDomTheme } from "./theme";
|
|
@@ -340,6 +342,9 @@ export function ResourceTimeline<T = unknown>({
|
|
|
340
342
|
cross: number;
|
|
341
343
|
startHours: number;
|
|
342
344
|
durationHours: number;
|
|
345
|
+
// The event's own bounds, for previewing a move across a DST change; null
|
|
346
|
+
// for a bar clipped to the day.
|
|
347
|
+
span: { start: Date; end: Date } | null;
|
|
343
348
|
} | null>(null);
|
|
344
349
|
const applyDrag = (next: DragState | null) => {
|
|
345
350
|
dragRef.current = next;
|
|
@@ -351,9 +356,9 @@ export function ResourceTimeline<T = unknown>({
|
|
|
351
356
|
key: string,
|
|
352
357
|
resourceId: string,
|
|
353
358
|
kind: "move" | "resize",
|
|
354
|
-
|
|
355
|
-
durationHours: number,
|
|
359
|
+
pe: PositionedEvent<T>,
|
|
356
360
|
) => {
|
|
361
|
+
const { startHours, durationHours } = pe;
|
|
357
362
|
if (!onDragEvent) return;
|
|
358
363
|
e.stopPropagation();
|
|
359
364
|
try {
|
|
@@ -366,6 +371,10 @@ export function ResourceTimeline<T = unknown>({
|
|
|
366
371
|
cross: vertical ? e.clientX : e.clientY,
|
|
367
372
|
startHours,
|
|
368
373
|
durationHours,
|
|
374
|
+
span:
|
|
375
|
+
pe.continuesBefore || pe.continuesAfter
|
|
376
|
+
? null
|
|
377
|
+
: { start: pe.event.start, end: pe.event.end },
|
|
369
378
|
};
|
|
370
379
|
applyDrag({ key, resourceId, kind, startHours, durationHours, crossPx: 0, moved: false });
|
|
371
380
|
};
|
|
@@ -375,13 +384,24 @@ export function ResourceTimeline<T = unknown>({
|
|
|
375
384
|
const dHours = ((vertical ? e.clientY : e.clientX) - origin.current.x) / hourSize;
|
|
376
385
|
const snap = (v: number) => Math.round(v / snapHours) * snapHours;
|
|
377
386
|
if (d.kind === "move") {
|
|
378
|
-
const
|
|
379
|
-
|
|
387
|
+
const o = origin.current;
|
|
388
|
+
const requestedHours = clamp(
|
|
389
|
+
snap(o.startHours + dHours),
|
|
380
390
|
startHour,
|
|
381
|
-
endHour -
|
|
391
|
+
endHour - o.durationHours,
|
|
382
392
|
);
|
|
383
|
-
|
|
384
|
-
|
|
393
|
+
// Draw the bar where the drop commits it: a start in the hour a
|
|
394
|
+
// spring-forward change skips moves on past it, and the kept elapsed
|
|
395
|
+
// duration covers a different number of hours once a DST change falls
|
|
396
|
+
// inside it or stops falling inside it.
|
|
397
|
+
const span = o.span;
|
|
398
|
+
const moved = span
|
|
399
|
+
? movedClockSpan(span.start, span.end, Math.round((requestedHours - o.startHours) * 60))
|
|
400
|
+
: null;
|
|
401
|
+
const startHours = moved ? o.startHours + moved.startHours : requestedHours;
|
|
402
|
+
const durationHours = moved ? moved.hours : o.durationHours;
|
|
403
|
+
const crossPx = (vertical ? e.clientX : e.clientY) - o.cross;
|
|
404
|
+
applyDrag({ ...d, startHours, durationHours, crossPx, moved: true });
|
|
385
405
|
} else {
|
|
386
406
|
const durationHours = clamp(
|
|
387
407
|
snap(origin.current.durationHours + dHours),
|
|
@@ -433,10 +453,22 @@ export function ResourceTimeline<T = unknown>({
|
|
|
433
453
|
return;
|
|
434
454
|
}
|
|
435
455
|
const target = d.kind === "move" ? laneAt(e, resource) : resource;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
|
|
456
|
+
// Shift the event by how far its bar moved, like the native renderer, so a
|
|
457
|
+
// move keeps its elapsed duration across a DST change.
|
|
458
|
+
const o = origin.current;
|
|
459
|
+
const startDelta = o ? Math.round((d.startHours - o.startHours) * 60) : 0;
|
|
460
|
+
// A move shifts both edges alike; its preview duration only redraws the
|
|
461
|
+
// kept elapsed duration.
|
|
462
|
+
const endDelta =
|
|
463
|
+
d.kind === "move" ? startDelta : o ? Math.round((d.durationHours - o.durationHours) * 60) : 0;
|
|
464
|
+
const next = resolveDraggedBounds(
|
|
465
|
+
event.start,
|
|
466
|
+
event.end,
|
|
467
|
+
startDelta,
|
|
468
|
+
endDelta,
|
|
469
|
+
dragStepMinutes,
|
|
470
|
+
);
|
|
471
|
+
if (next) onDragEvent?.(event, next.start, next.end, target);
|
|
440
472
|
applyDrag(null);
|
|
441
473
|
origin.current = null;
|
|
442
474
|
};
|
|
@@ -732,17 +764,7 @@ export function ResourceTimeline<T = unknown>({
|
|
|
732
764
|
aria-label={pe.event.title}
|
|
733
765
|
{...dataState({ "data-dragging": !!active })}
|
|
734
766
|
onPointerDown={
|
|
735
|
-
draggable
|
|
736
|
-
? (e) =>
|
|
737
|
-
beginDrag(
|
|
738
|
-
e,
|
|
739
|
-
key,
|
|
740
|
-
resource.id,
|
|
741
|
-
"move",
|
|
742
|
-
pe.startHours,
|
|
743
|
-
pe.durationHours,
|
|
744
|
-
)
|
|
745
|
-
: undefined
|
|
767
|
+
draggable ? (e) => beginDrag(e, key, resource.id, "move", pe) : undefined
|
|
746
768
|
}
|
|
747
769
|
onPointerMove={draggable ? moveDrag : undefined}
|
|
748
770
|
onPointerUp={
|
|
@@ -783,14 +805,7 @@ export function ResourceTimeline<T = unknown>({
|
|
|
783
805
|
aria-hidden
|
|
784
806
|
onPointerDown={(e) => {
|
|
785
807
|
e.stopPropagation();
|
|
786
|
-
beginDrag(
|
|
787
|
-
e,
|
|
788
|
-
key,
|
|
789
|
-
resource.id,
|
|
790
|
-
"resize",
|
|
791
|
-
pe.startHours,
|
|
792
|
-
pe.durationHours,
|
|
793
|
-
);
|
|
808
|
+
beginDrag(e, key, resource.id, "resize", pe);
|
|
794
809
|
}}
|
|
795
810
|
style={{
|
|
796
811
|
position: "absolute",
|
|
@@ -983,17 +998,7 @@ export function ResourceTimeline<T = unknown>({
|
|
|
983
998
|
aria-label={pe.event.title}
|
|
984
999
|
{...dataState({ "data-dragging": !!active })}
|
|
985
1000
|
onPointerDown={
|
|
986
|
-
draggable
|
|
987
|
-
? (e) =>
|
|
988
|
-
beginDrag(
|
|
989
|
-
e,
|
|
990
|
-
key,
|
|
991
|
-
resource.id,
|
|
992
|
-
"move",
|
|
993
|
-
pe.startHours,
|
|
994
|
-
pe.durationHours,
|
|
995
|
-
)
|
|
996
|
-
: undefined
|
|
1001
|
+
draggable ? (e) => beginDrag(e, key, resource.id, "move", pe) : undefined
|
|
997
1002
|
}
|
|
998
1003
|
onPointerMove={draggable ? moveDrag : undefined}
|
|
999
1004
|
onPointerUp={
|
|
@@ -1032,14 +1037,7 @@ export function ResourceTimeline<T = unknown>({
|
|
|
1032
1037
|
aria-hidden
|
|
1033
1038
|
onPointerDown={(e) => {
|
|
1034
1039
|
e.stopPropagation();
|
|
1035
|
-
beginDrag(
|
|
1036
|
-
e,
|
|
1037
|
-
key,
|
|
1038
|
-
resource.id,
|
|
1039
|
-
"resize",
|
|
1040
|
-
pe.startHours,
|
|
1041
|
-
pe.durationHours,
|
|
1042
|
-
);
|
|
1040
|
+
beginDrag(e, key, resource.id, "resize", pe);
|
|
1043
1041
|
}}
|
|
1044
1042
|
style={{
|
|
1045
1043
|
position: "absolute",
|