Web: date picker commits on leave, close day context menu on event click
- Date picker: clicking a day only selects it now; the choice is committed
when you leave the picker (click outside) or press Save — for both date and
datetime modes (previously datetime discarded on click-away, and date
committed instantly on click, neither of which was wanted).
- The day right-click context menu ("Neuen Termin erstellen") now closes when
an event popup opens (the event row stops propagation, so its own
outside-click closer never fired).
- version v47 -> v48.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1373,6 +1373,9 @@ function showDayContextMenu(date, mouseEvent) {
|
|||||||
|
|
||||||
// ── Event Popup ───────────────────────────────────────────
|
// ── Event Popup ───────────────────────────────────────────
|
||||||
function showEventPopup(ev, anchor) {
|
function showEventPopup(ev, anchor) {
|
||||||
|
// The event row stops click propagation, so the day context menu's own
|
||||||
|
// outside-click closer never fires — remove it explicitly here.
|
||||||
|
document.querySelectorAll('.cal-context-menu').forEach(m => m.remove());
|
||||||
const popup = document.getElementById('popup-event');
|
const popup = document.getElementById('popup-event');
|
||||||
document.getElementById('popup-copy-menu').classList.add('hidden');
|
document.getElementById('popup-copy-menu').classList.add('hidden');
|
||||||
popup.classList.remove('hidden');
|
popup.classList.remove('hidden');
|
||||||
|
|||||||
@@ -48,9 +48,10 @@ export function openDatePicker(anchor, value, mode = 'datetime') {
|
|||||||
resolve(result);
|
resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click outside → cancel
|
// Click outside (leaving the picker) → commit the current selection,
|
||||||
|
// rather than discarding it. Cancel button still reverts.
|
||||||
overlay.addEventListener('mousedown', e => {
|
overlay.addEventListener('mousedown', e => {
|
||||||
if (e.target === overlay) done(null);
|
if (e.target === overlay) done(buildResult());
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Calendar builder ──────────────────────────────────
|
// ── Calendar builder ──────────────────────────────────
|
||||||
@@ -144,13 +145,11 @@ export function openDatePicker(anchor, value, mode = 'datetime') {
|
|||||||
render();
|
render();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Day click
|
// Day click → just select/highlight; committing happens on Save or when
|
||||||
|
// the user leaves the picker (clicks outside).
|
||||||
card.querySelectorAll('.dtp-day').forEach(el => {
|
card.querySelectorAll('.dtp-day').forEach(el => {
|
||||||
el.addEventListener('click', () => {
|
el.addEventListener('click', () => {
|
||||||
selDate = new Date(parseInt(el.dataset.ts));
|
selDate = new Date(parseInt(el.dataset.ts));
|
||||||
// In date-only mode there's nothing else to choose — commit the day
|
|
||||||
// immediately instead of forcing an extra "Save" click.
|
|
||||||
if (mode === 'date') { done(buildResult()); return; }
|
|
||||||
if (el.classList.contains('other')) {
|
if (el.classList.contains('other')) {
|
||||||
viewYear = selDate.getFullYear();
|
viewYear = selDate.getFullYear();
|
||||||
viewMonth = selDate.getMonth();
|
viewMonth = selDate.getMonth();
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// Increment APP_VERSION with every code change
|
// Increment APP_VERSION with every code change
|
||||||
export const APP_VERSION = 'v47';
|
export const APP_VERSION = 'v48';
|
||||||
|
|||||||
Reference in New Issue
Block a user