@underverse-ui/underverse 0.2.100 → 0.2.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +49 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9238,6 +9238,7 @@ function CalendarTimeline({
|
|
|
9238
9238
|
const dragRef = React28.useRef(null);
|
|
9239
9239
|
const [preview, setPreview] = React28.useState(null);
|
|
9240
9240
|
const suppressNextEventClickRef = React28.useRef(false);
|
|
9241
|
+
const [hoverCell, setHoverCell] = React28.useState(null);
|
|
9241
9242
|
const autoScrollStateRef = React28.useRef({
|
|
9242
9243
|
dir: 0,
|
|
9243
9244
|
speed: 0,
|
|
@@ -9447,7 +9448,32 @@ function CalendarTimeline({
|
|
|
9447
9448
|
};
|
|
9448
9449
|
const onPointerMove = (e) => {
|
|
9449
9450
|
const drag = dragRef.current;
|
|
9450
|
-
if (!drag
|
|
9451
|
+
if (!drag) {
|
|
9452
|
+
if (isViewOnly) return;
|
|
9453
|
+
if (!(interactions?.creatable ?? false)) return;
|
|
9454
|
+
const target = e.target;
|
|
9455
|
+
if (target?.closest?.("[data-uv-ct-event]")) {
|
|
9456
|
+
if (hoverCell) setHoverCell(null);
|
|
9457
|
+
return;
|
|
9458
|
+
}
|
|
9459
|
+
const ctx = getPointerContext(e.clientX, e.clientY);
|
|
9460
|
+
if (!ctx) {
|
|
9461
|
+
if (hoverCell) setHoverCell(null);
|
|
9462
|
+
return;
|
|
9463
|
+
}
|
|
9464
|
+
const rowEl = target?.closest?.("[data-uv-ct-row]");
|
|
9465
|
+
if (!rowEl) {
|
|
9466
|
+
if (hoverCell) setHoverCell(null);
|
|
9467
|
+
return;
|
|
9468
|
+
}
|
|
9469
|
+
const rect = rowEl.getBoundingClientRect();
|
|
9470
|
+
const y = clamp3(e.clientY - rect.top, 0, rect.height);
|
|
9471
|
+
if (!hoverCell || hoverCell.resourceId !== ctx.resourceId || hoverCell.slotIdx !== ctx.slotIdx || Math.abs(hoverCell.y - y) > 0.5) {
|
|
9472
|
+
setHoverCell({ resourceId: ctx.resourceId, slotIdx: ctx.slotIdx, y });
|
|
9473
|
+
}
|
|
9474
|
+
return;
|
|
9475
|
+
}
|
|
9476
|
+
if (drag.pointerId !== e.pointerId) return;
|
|
9451
9477
|
updateAutoScrollFromPointer(e.clientX, e.clientY);
|
|
9452
9478
|
updateDragPreview(e.clientX, e.clientY);
|
|
9453
9479
|
};
|
|
@@ -9456,6 +9482,7 @@ function CalendarTimeline({
|
|
|
9456
9482
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
9457
9483
|
dragRef.current = null;
|
|
9458
9484
|
stopAutoScroll();
|
|
9485
|
+
setHoverCell(null);
|
|
9459
9486
|
if (!preview) {
|
|
9460
9487
|
setPreview(null);
|
|
9461
9488
|
return;
|
|
@@ -9628,6 +9655,7 @@ function CalendarTimeline({
|
|
|
9628
9655
|
className: "relative flex-1 overflow-auto scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent",
|
|
9629
9656
|
onPointerMove,
|
|
9630
9657
|
onPointerUp,
|
|
9658
|
+
onPointerLeave: () => setHoverCell(null),
|
|
9631
9659
|
children: [
|
|
9632
9660
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: { height: topSpacer } }),
|
|
9633
9661
|
rows.slice(startRow, endRow).map((row, idx) => {
|
|
@@ -9639,6 +9667,7 @@ function CalendarTimeline({
|
|
|
9639
9667
|
const r = row.resource;
|
|
9640
9668
|
const layout = layoutsByResource.get(r.id) ?? { visible: [], hidden: [], baseTop: lanePaddingY, eventHeight };
|
|
9641
9669
|
const canMore = layout.hidden.length > 0 && !!onMoreClick;
|
|
9670
|
+
const showCreateHint = !isViewOnly && (interactions?.creatable ?? false) && !preview && hoverCell?.resourceId === r.id;
|
|
9642
9671
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9643
9672
|
"div",
|
|
9644
9673
|
{
|
|
@@ -9711,6 +9740,7 @@ function CalendarTimeline({
|
|
|
9711
9740
|
ev.className,
|
|
9712
9741
|
isPreview && "ring-2 ring-primary/50 ring-offset-1 ring-offset-background scale-[1.02] z-10"
|
|
9713
9742
|
),
|
|
9743
|
+
"data-uv-ct-event": true,
|
|
9714
9744
|
style: {
|
|
9715
9745
|
left,
|
|
9716
9746
|
top,
|
|
@@ -9781,6 +9811,24 @@ function CalendarTimeline({
|
|
|
9781
9811
|
}
|
|
9782
9812
|
);
|
|
9783
9813
|
})() : null,
|
|
9814
|
+
showCreateHint ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9815
|
+
"div",
|
|
9816
|
+
{
|
|
9817
|
+
className: cn(
|
|
9818
|
+
"pointer-events-none absolute z-20",
|
|
9819
|
+
"h-5 w-5 rounded-full",
|
|
9820
|
+
"bg-background/80 backdrop-blur-sm",
|
|
9821
|
+
"border border-border/60 shadow-xs",
|
|
9822
|
+
"flex items-center justify-center"
|
|
9823
|
+
),
|
|
9824
|
+
style: {
|
|
9825
|
+
left: hoverCell.slotIdx * slotWidth + slotWidth / 2 - 10,
|
|
9826
|
+
top: clamp3(Math.round(hoverCell.y - 10), 6, Math.max(6, h - 26))
|
|
9827
|
+
},
|
|
9828
|
+
"aria-hidden": true,
|
|
9829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react20.Plus, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
9830
|
+
}
|
|
9831
|
+
) : null,
|
|
9784
9832
|
canMore ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
9785
9833
|
"button",
|
|
9786
9834
|
{
|