Make stay bands draggable to move stays between days

Dragging any week-segment of a stay band onto an in-range day moves the
whole stay there, preserving its length (same one-PATCH date+end_date
shift the multi-day chips use). Clicking a band still opens the editor.
This commit is contained in:
2026-07-20 09:50:01 +07:00
parent b452430415
commit 71a158aa51
4 changed files with 28 additions and 4 deletions
+4
View File
@@ -4,6 +4,7 @@
// partitioning) so a stay keeps the same vertical position across weeks.
import { el } from '../dom.js';
import { parseYMD, daysBetweenInclusive, typeInfo, stayShortName, entrySpanDays } from '../format.js';
import { makeBandDraggable } from './dragdrop.js';
// Per-instance band palette: each stay gets its own hue (not the generic stay
// type colour) so overlapping/adjacent areas read apart. Muted-but-distinct
@@ -97,6 +98,9 @@ export function renderWeekBands(weekYmd, layout, tctx) {
band.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); open(e); }
});
// Standard HTML5 DnD doesn't fire click after a real drag, so a plain
// click still opens the day editor with no extra guard needed.
makeBandDraggable(band, s.entry);
strip.appendChild(band);
}
return strip;