UNPKG

@universal-material/web

Version:
43 lines 1.41 kB
import { __decorate } from "tslib"; import { customElement, property, state } from 'lit/decorators.js'; import { UmCalendarBase } from './calendar-base'; import { styles } from './calendar.styles.js'; let UmCalendar = class UmCalendar extends UmCalendarBase { constructor() { super(...arguments); this.dateValue = null; } static { this.styles = [styles, UmCalendarBase.styles]; } get value() { return this._getDateString(this.dateValue); } set value(value) { this.dateValue = this._getDateFromString(value); } _selectDate(date) { this.dateValue = date; this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true })); this.dispatchEvent(new Event('change', { bubbles: true })); if (this.month === date.getMonth() && this.year === date.getFullYear()) { return; } this.month = date.getMonth(); this.year = date.getFullYear(); } _getSelectedDateClasses(date) { return this.dateValue?.getTime() === date.getTime() ? { 'selected-date': true } : {}; } }; __decorate([ state() ], UmCalendar.prototype, "dateValue", void 0); __decorate([ property() ], UmCalendar.prototype, "value", null); UmCalendar = __decorate([ customElement('u-calendar') ], UmCalendar); export { UmCalendar }; //# sourceMappingURL=calendar.js.map