import { PropertyValues, TemplateResult } from 'lit'; import { BahtFieldBase } from '../field-base.js'; /** * Calendar field on top of flatpickr. The VALUE is always ISO `yyyy-mm-dd` * regardless of `field.date_format` (display only): * - `date_mode: 'single'` (default) -> `string | null` * - `date_mode: 'range'` -> `[start, end] | null` (inclusive) * - `date_mode: 'multiple'` -> `string[]` * `min` / `max` bound the calendar; `disabled_dates` (ISO days or `a/b` * intervals) and `disabled_weekdays` (0 = Sun … 6 = Sat) grey days out — and * the engine re-checks them on validate, so the calendar is UX, not the gate. * * The calendar renders INSIDE the element (flatpickr `static`), so it lives in * light DOM like every other node and picks up a theme set on any ancestor. * Give a clipping ancestor (`overflow: hidden`) room, or it hides the popup. * * A footer under the grid carries **Today** (picks today — greyed out when * min/max/disabled rules exclude it) and **Clear** (empties the value). With * `field.enable_time` the first button reads **Now** (i18n key `now`) and picks * today at the current time, to the minute (seconds dropped), under the same * min/max/disabled rules; like Today it closes the calendar. Both * `await el.updateComplete` resolves only once the calendar is attached (the * lazy flatpickr load is folded into it), so hosts and tests need no extra wait. * Today / Clear go through flatpickr, so they emit exactly like a click on a day. `disableMobile` * keeps this calendar on phones too — never the OS date wheel. */ export declare class BahtDatepicker extends BahtFieldBase { private fp; /** * What we last told the host. A controlled host re-feeds `value` after the * event, but a slow (or absent) re-feed must not make onClose re-emit the * pick onChange already sent — compare against this until `value` catches up. */ private lastEmitted; private todayBtn; private clearBtn; /** In-flight flatpickr load that this element is waiting on (first mount per page). */ private pendingLoad; protected getUpdateComplete(): Promise; protected renderControl(): TemplateResult; connectedCallback(): void; disconnectedCallback(): void; protected updated(changed: PropertyValues): void; private teardown; /** Push the host-fed `value` into the calendar without echoing an event. */ private syncValue; /** Value-equality for the picker's own selection (minute-precise with `enable_time`). */ private sameInstants; private options; private mountFooter; /** Today greys out when the rules exclude it; Clear when there is nothing to clear. * `fp` is passed explicitly from onReady — it fires inside the flatpickr() * call, before `this.fp` is assigned. */ private refreshFooter; private todayAllowed; private pickToday; private emitIfChanged; /** Host value (any mode) -> the Date list flatpickr works with. A bare * day is accepted even with `enable_time` on (defaults to midnight) - * a host may not always have a time to feed back (an edited record that * predates this field, for one). */ private datesOf; /** flatpickr's selection -> the value shape of the field's mode. */ private toValue; }