Et2Date: Add widget classes to flatpicker popup

This commit is contained in:
nathan 2023-02-09 14:42:14 -07:00
parent 1a55a2c643
commit 4322937ea7

View File

@ -419,6 +419,7 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
this._onDayCreate = this._onDayCreate.bind(this); this._onDayCreate = this._onDayCreate.bind(this);
this._handleInputChange = this._handleInputChange.bind(this); this._handleInputChange = this._handleInputChange.bind(this);
this._onReady = this._onReady.bind(this);
this.handleScroll = this.handleScroll.bind(this); this.handleScroll = this.handleScroll.bind(this);
} }
@ -532,7 +533,8 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
// Listen for flatpickr change so we can update internal value, needed for validation // Listen for flatpickr change so we can update internal value, needed for validation
options.onChange = options.onReady = this._updateValueOnChange; options.onChange = this._updateValueOnChange;
options.onReady = this._onReady;
// Remove Lion's inert attribute so we can work in Et2Dialog // Remove Lion's inert attribute so we can work in Et2Dialog
options.onOpen = [() => options.onOpen = [() =>
@ -744,6 +746,14 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
this.modelValue = this.getValue(); this.modelValue = this.getValue();
} }
_onReady(selectedDates : Date[], dateStr : string, instance : Instance)
{
this._updateValueOnChange(selectedDates, dateStr, instance);
// Add any classes we have to the instance
instance.calendarContainer.classList.add(...this.classList.values())
}
/** /**
* Customise date rendering * Customise date rendering
* *