UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

46 lines (45 loc) 1.44 kB
/** * DevExtreme (esm/__internal/ui/calendar/m_calendar.single.selection.strategy.js) * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import CalendarSelectionStrategy from "./m_calendar.selection.strategy"; class CalendarSingleSelectionStrategy extends CalendarSelectionStrategy { constructor(component) { super(component); this.NAME = "SingleSelection" } getViewOptions() { return { value: this.dateOption("value"), range: [], selectionMode: "single" } } selectValue(selectedValue, e) { this.skipNavigate(); this.dateValue(selectedValue, e) } updateAriaSelected(value, previousValue) { value ?? (value = [this.dateOption("value")]); previousValue ?? (previousValue = []); super.updateAriaSelected(value, previousValue) } getDefaultCurrentDate() { const date = this.dateOption("value"); if ("" === date) { return new Date } return date } restoreValue() { this.calendar.option("value", null) } _updateViewsValue(value) { this._updateViewsOption("value", value[0]) } } export default CalendarSingleSelectionStrategy;