diff --git a/frontend/package.json b/frontend/package.json index 18debd4..15bbfa9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "mapdash-frontend", "private": true, - "version": "0.2.15", + "version": "0.2.16", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/src/datepicker.ts b/frontend/src/datepicker.ts index a2b8467..cd57f18 100644 --- a/frontend/src/datepicker.ts +++ b/frontend/src/datepicker.ts @@ -2,8 +2,12 @@ // #date-end) stay in the DOM (hidden) as the source of truth — all filter code // keeps reading/writing them. The calendar selects into a temporary state; the // filter is applied (and the popup closed) only when the user presses «Применить». -// Both endpoints are chosen by clicking days; «Сбросить» clears the in-progress -// selection. +// +// Two endpoint pills «С» / «По» sit above the grid: one is active, and clicking a +// day writes into the active endpoint, then focus auto-advances to the other. Each +// pill has a × to clear just that endpoint, so an OPEN range is possible — «с X» +// (no end) or «по Y» (no start). «Применить» is enabled once at least one endpoint +// is set; «Сбросить» clears both. const MONTHS = ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь']; const WEEKDAYS = ['пн', 'вт', 'ср', 'чт', 'пт', 'сб', 'вс']; @@ -35,9 +39,11 @@ export function createDateRange(): DateRange { let viewY = new Date().getFullYear(); let viewM = new Date().getMonth(); - // In-progress selection (committed to the inputs only when both ends are set). + // In-progress selection (committed to the inputs on «Применить»). Either end may + // stay empty → an open range. `activeEnd` is the endpoint the next day-click fills. let selStart = ''; let selEnd = ''; + let activeEnd: 'start' | 'end' = 'start'; function updateText(): void { const s = startInput.value; @@ -53,7 +59,14 @@ export function createDateRange(): DateRange { function render(): void { const s = parseISO(selStart); const e = parseISO(selEnd); + const endPill = (which: 'start' | 'end', label: string, val: string): string => + ``; const parts: string[] = [ + `