UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

49 lines (48 loc) 1.59 kB
/** * DevExtreme (esm/__internal/ui/calendar/calendar.single.selection.strategy.js) * Version: 25.2.7 * Build date: Tue May 05 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import CalendarSelectionStrategy from "./calendar.selection.strategy"; class CalendarSingleSelectionStrategy extends CalendarSelectionStrategy { constructor(component) { super(component); this.NAME = "SingleSelection" } dateOption(optionName) { if ("value" === optionName) { return this.calendar._getDateOption("value") } return this.calendar._getDateOption(optionName) } getViewOptions() { const value = this.dateOption("value") ?? void 0; return { value: value, range: [], selectionMode: "single" } } selectValue(selectedValue, e) { this.skipNavigate(); this.dateValue(selectedValue, e) } updateAriaSelected(val, previousVal) { const value = val ?? [this.dateOption("value")]; const previousValue = previousVal ?? []; super.updateAriaSelected(value, previousValue) } getDefaultCurrentDate() { return this.dateOption("value") } restoreValue() { this.calendar.option("value", null) } _updateViewsValue(value) { this._updateViewsOption("value", value[0]) } } export default CalendarSingleSelectionStrategy;