Skip to content

Commit 5470e23

Browse files
authored
feat(ui5-calendar): introduce new component. (#2424)
"CalendarSelection" enumeration is introduced with single, multiple and range selection modes. DayPicker component uses the new "CalendarSelection" class, in order to provide support for the three selection modes. Selection of multiple dates can be configured via the "selection" property of the Calendar component. Holding control keyboard key doesn't allow multiple dates selection. The logic for selecting a range of dates is moved from the DateRangePicker component into the DayPicker component. Selecting a range of dates via mouse now doesn't cause flickering on the hovered items. Updating the selected date range into the DateRangePicker component input field is now reflected visually, when the popover is opened. DateRangePicker now works properly with only start date of the range typed into the input field. Calendar navigation is now compliant with the specification. Playground sample is created. Fixes #1730
1 parent fb0b24c commit 5470e23

18 files changed

+620
-334
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import DataType from "./DataType.js";
2+
3+
const CalendarSelections = {
4+
Single: "Single",
5+
Multiple: "Multiple",
6+
Range: "Range",
7+
};
8+
9+
class CalendarSelection extends DataType {
10+
static isValid(value) {
11+
return !!CalendarSelections[value];
12+
}
13+
}
14+
15+
CalendarSelection.generateTypeAcessors(CalendarSelections);
16+
17+
export default CalendarSelection;

packages/main/src/Calendar.hbs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<div
22
class="{{classes.main}}"
33
style="{{styles.main}} "
4-
@keydown={{_onkeydown}}
4+
@keydown={{_onkeydown}}
5+
@focusout={{_onfocusout}}
56
>
67

78
<ui5-calendar-header
@@ -16,6 +17,7 @@
1617
._isNextButtonDisabled="{{_header._isNextButtonDisabled}}"
1718
._isPrevButtonDisabled="{{_header._isPrevButtonDisabled}}"
1819
._isMonthButtonHidden="{{_header._isMonthButtonHidden}}"
20+
._tabIndex="{{_header.tabIndex}}"
1921
></ui5-calendar-header>
2022

2123
<div id="{{_id}}-content">
@@ -26,6 +28,7 @@
2628
.selectedDates="{{_oMonth.selectedDates}}"
2729
._hidden="{{_oMonth._hidden}}"
2830
.primaryCalendarType="{{_oMonth.primaryCalendarType}}"
31+
.selection="{{_oMonth.selection}}"
2932
.minDate="{{_oMonth.minDate}}"
3033
.maxDate="{{_oMonth.maxDate}}"
3134
timestamp="{{_oMonth.timestamp}}"

0 commit comments

Comments
 (0)