@openui5/sap.ui.unified 1.149.1 → 1.151.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/REUSE.toml +24 -0
  2. package/THIRDPARTY.txt +25 -6
  3. package/package.json +2 -2
  4. package/src/sap/ui/unified/.library +1 -1
  5. package/src/sap/ui/unified/Calendar.js +11 -1
  6. package/src/sap/ui/unified/CalendarAppointment.js +23 -4
  7. package/src/sap/ui/unified/CalendarDateInterval.js +1 -1
  8. package/src/sap/ui/unified/CalendarLegend.js +1 -1
  9. package/src/sap/ui/unified/CalendarLegendItem.js +1 -1
  10. package/src/sap/ui/unified/CalendarMonthInterval.js +5 -1
  11. package/src/sap/ui/unified/CalendarOneMonthInterval.js +1 -1
  12. package/src/sap/ui/unified/CalendarRow.js +1 -1
  13. package/src/sap/ui/unified/CalendarRowRenderer.js +39 -24
  14. package/src/sap/ui/unified/CalendarTimeInterval.js +1 -1
  15. package/src/sap/ui/unified/CalendarWeekInterval.js +1 -1
  16. package/src/sap/ui/unified/ColorPicker.js +46 -1
  17. package/src/sap/ui/unified/ColorPickerPopover.js +1 -1
  18. package/src/sap/ui/unified/ColorPickerRenderer.js +49 -15
  19. package/src/sap/ui/unified/ContentSwitcher.js +1 -1
  20. package/src/sap/ui/unified/Currency.js +1 -1
  21. package/src/sap/ui/unified/CurrencyRenderer.js +1 -1
  22. package/src/sap/ui/unified/DateRange.js +1 -1
  23. package/src/sap/ui/unified/DateTypeRange.js +1 -1
  24. package/src/sap/ui/unified/FileUploader.js +1 -1
  25. package/src/sap/ui/unified/FileUploaderParameter.js +1 -1
  26. package/src/sap/ui/unified/FileUploaderXHRSettings.js +1 -1
  27. package/src/sap/ui/unified/Menu.js +1 -1
  28. package/src/sap/ui/unified/MenuItem.js +2 -2
  29. package/src/sap/ui/unified/MenuItemBase.js +1 -1
  30. package/src/sap/ui/unified/MenuItemGroup.js +1 -1
  31. package/src/sap/ui/unified/MenuRenderer.js +4 -2
  32. package/src/sap/ui/unified/MenuTextFieldItem.js +8 -4
  33. package/src/sap/ui/unified/MonthlyRecurrenceRule.js +1 -1
  34. package/src/sap/ui/unified/NonWorkingPeriod.js +1 -1
  35. package/src/sap/ui/unified/RecurrenceRule.js +1 -1
  36. package/src/sap/ui/unified/RecurringCalendarAppointment.js +7 -2
  37. package/src/sap/ui/unified/RecurringNonWorkingPeriod.js +15 -1
  38. package/src/sap/ui/unified/Shell.js +1 -1
  39. package/src/sap/ui/unified/ShellHeadItem.js +2 -30
  40. package/src/sap/ui/unified/ShellHeadUserItem.js +3 -31
  41. package/src/sap/ui/unified/ShellHeader.js +29 -13
  42. package/src/sap/ui/unified/ShellLayout.js +1 -1
  43. package/src/sap/ui/unified/ShellOverlay.js +1 -1
  44. package/src/sap/ui/unified/SplitContainer.js +1 -1
  45. package/src/sap/ui/unified/TimeRange.js +1 -1
  46. package/src/sap/ui/unified/WeeklyRecurrenceRule.js +1 -1
  47. package/src/sap/ui/unified/YearlyRecurrenceRule.js +1 -1
  48. package/src/sap/ui/unified/calendar/DatesRow.js +1 -1
  49. package/src/sap/ui/unified/calendar/Header.js +1 -1
  50. package/src/sap/ui/unified/calendar/HeaderRenderer.js +1 -0
  51. package/src/sap/ui/unified/calendar/IndexPicker.js +1 -1
  52. package/src/sap/ui/unified/calendar/Month.js +60 -1
  53. package/src/sap/ui/unified/calendar/MonthPicker.js +1 -1
  54. package/src/sap/ui/unified/calendar/MonthRenderer.js +23 -10
  55. package/src/sap/ui/unified/calendar/MonthsRow.js +196 -40
  56. package/src/sap/ui/unified/calendar/OneMonthDatesRow.js +1 -1
  57. package/src/sap/ui/unified/calendar/TimesRow.js +1 -1
  58. package/src/sap/ui/unified/calendar/WeeksRow.js +1 -1
  59. package/src/sap/ui/unified/calendar/YearPicker.js +1 -1
  60. package/src/sap/ui/unified/calendar/YearRangePicker.js +1 -1
  61. package/src/sap/ui/unified/library.js +2 -2
  62. package/src/sap/ui/unified/messagebundle_en_US_sappsd.properties +73 -9
  63. package/src/sap/ui/unified/messagebundle_en_US_saptrc.properties +70 -8
  64. package/src/sap/ui/unified/themes/base/Calendar.less +39 -6
  65. package/src/sap/ui/unified/themes/base/ColorPicker.less +125 -3
  66. package/src/sap/ui/unified/themes/base/FileUploader.less +5 -0
  67. package/src/sap/ui/unified/themes/base/ShellHeader.less +2 -7
  68. package/src/sap/ui/unified/themes/sap_hcb/Calendar.less +2 -1
@@ -78,7 +78,7 @@ sap.ui.define([
78
78
  * If used inside the calendar the properties and aggregation are directly taken from the parent
79
79
  * (To not duplicate and sync DateRanges and so on...)
80
80
  * @extends sap.ui.core.Control
81
- * @version 1.149.1
81
+ * @version 1.151.0
82
82
  *
83
83
  * @constructor
84
84
  * @public
@@ -155,6 +155,15 @@ sap.ui.define([
155
155
  */
156
156
  showWeekNumbers : {type : "boolean", group : "Appearance", defaultValue : true},
157
157
 
158
+ /**
159
+ * Determines whether the header of the week numbers column is displayed.
160
+ * The column header text is translated according to the active language.
161
+ *
162
+ * <b>Note:</b> Takes effect only when <code>showWeekNumbers</code> is set to <code>true</code>.
163
+ * @since 1.151
164
+ */
165
+ showWeekNumbersHeader : {type : "boolean", group : "Appearance", defaultValue : false},
166
+
158
167
  /**
159
168
  * The value of this property is set trough the sap.ui.unified.Calendar control,
160
169
  * in order for the current sap.ui.unified.calendar.Month control to know which
@@ -326,6 +335,30 @@ sap.ui.define([
326
335
  return "";
327
336
  };
328
337
 
338
+ /**
339
+ * Returns the text to display in the week numbers column header.
340
+ * Returns an empty string when the header should not be shown.
341
+ * @returns {string} The week numbers column header text, or empty string
342
+ * @private
343
+ */
344
+ Month.prototype._getWeekNumbersHeaderText = function() {
345
+ if (!this.getShowWeekNumbersHeader()) {
346
+ return "";
347
+ }
348
+
349
+ // Locales where the calendar week abbreviation (sap-calendarWeek narrow) is too long
350
+ // to fit in the week number column header cell — verified manually.
351
+ // These fall back to the "week" narrow display name from CLDR (week-narrow.displayName).
352
+ const _oLongCWLocales = new Set(["ar", "ar-EG", "ar-SA", "he", "vi", "zh-CN", "zh-HK", "zh-TW"]),
353
+ oLocaleData = this._getLocaleData();
354
+
355
+ if (_oLongCWLocales.has(this._getLocale())) {
356
+ return oLocaleData.getDisplayName("week", "narrow");
357
+ }
358
+
359
+ return oLocaleData.getCalendarWeek("narrow").replace("{0}", "").trim();
360
+ };
361
+
329
362
  Month.prototype.exit = function(){
330
363
 
331
364
  if (this._oItemNavigation) {
@@ -364,6 +397,14 @@ sap.ui.define([
364
397
 
365
398
  // check if day names are too big -> use smaller ones
366
399
  _checkNamesLength.call(this);
400
+
401
+ if (this._bFocusFromTouch) {
402
+ const iFocusedIndex = this._oItemNavigation.getFocusedIndex();
403
+ const oDomRef = this._oItemNavigation.getItemDomRefs()[iFocusedIndex];
404
+ if (oDomRef) {
405
+ oDomRef.classList.add("sapUiCalItemFocusFromTouch");
406
+ }
407
+ }
367
408
  };
368
409
 
369
410
  Month.prototype.onmouseover = function(oEvent) {
@@ -1084,6 +1125,10 @@ sap.ui.define([
1084
1125
  clientY: oEvent.clientY
1085
1126
  };
1086
1127
 
1128
+ if (oEvent.target.closest(".sapUiCalItem")) {
1129
+ this._bFocusFromTouch = true;
1130
+ }
1131
+
1087
1132
  // handle only mouse down on a week number
1088
1133
  if (oEvent.button
1089
1134
  || Device.support.touch
@@ -1102,6 +1147,12 @@ sap.ui.define([
1102
1147
  this._handleWeekSelection(oFirstDayOfWeekCalendarDate, bFocusStartDate);
1103
1148
  };
1104
1149
 
1150
+ Month.prototype.ontouchstart = function(oEvent) {
1151
+ if (oEvent.target.closest(".sapUiCalItem")) {
1152
+ this._bFocusFromTouch = true;
1153
+ }
1154
+ };
1155
+
1105
1156
  Month.prototype.onmouseup = function(oEvent){
1106
1157
  // BCP: 1980116734
1107
1158
  // on a combi device right mouse button resulted in a selection (both a week or a single day)
@@ -1188,6 +1239,7 @@ sap.ui.define([
1188
1239
  if (oEvent.which === KeyCodes.SPACE){
1189
1240
  this.bSpaceButtonPressed = true;
1190
1241
  }
1242
+ this._bFocusFromTouch = false;
1191
1243
  };
1192
1244
  Month.prototype.onkeyup = function(oEvent){
1193
1245
  if (oEvent.which === KeyCodes.SPACE){
@@ -1798,6 +1850,7 @@ sap.ui.define([
1798
1850
  // when again clicked on a same week number - then remove the selections
1799
1851
  oAggOwner.removeAllSelectedDates();
1800
1852
  oAggOwner.addSelectedDate(oDateRange);
1853
+ _fireSelect.call(this);
1801
1854
  }
1802
1855
 
1803
1856
  return this;
@@ -2163,6 +2216,12 @@ sap.ui.define([
2163
2216
  this._selectedWithMouse = true;
2164
2217
  }
2165
2218
 
2219
+ if (this._bFocusFromTouch) {
2220
+ oDomRef.classList.add("sapUiCalItemFocusFromTouch");
2221
+ } else {
2222
+ oDomRef.classList.remove("sapUiCalItemFocusFromTouch");
2223
+ }
2224
+
2166
2225
  if (bFireFocus) {
2167
2226
  this.fireFocus({date: oFocusedDate.toLocalJSDate(), otherMonth: bOtherMonth});
2168
2227
  }
@@ -57,7 +57,7 @@ sap.ui.define([
57
57
  * renders a MonthPicker with ItemNavigation
58
58
  * This is used inside the calendar. Not for stand alone usage
59
59
  * @extends sap.ui.core.Control
60
- * @version 1.149.1
60
+ * @version 1.151.0
61
61
  *
62
62
  * @constructor
63
63
  * @public
@@ -197,10 +197,10 @@ sap.ui.define([
197
197
 
198
198
  MonthRenderer.renderDayNames = function(oRm, oMonth, oLocaleData, iStartDay, iDays, bDayNumberAsId, sWidth){
199
199
 
200
- var iFirstDayOfWeek = oMonth._getFirstDayOfWeek();
201
- var sId = oMonth.getId();
202
- var sDayId = "";
203
- var sCalendarType = oMonth.getPrimaryCalendarType();
200
+ var iFirstDayOfWeek = oMonth._getFirstDayOfWeek(),
201
+ sId = oMonth.getId(),
202
+ sCalendarType = oMonth.getPrimaryCalendarType(),
203
+ sDayId = "";
204
204
 
205
205
  var aWeekDays = [];
206
206
  if (oMonth._bLongWeekDays || !oMonth._bNamesLengthChecked) {
@@ -211,7 +211,7 @@ sap.ui.define([
211
211
  var aWeekDaysWide = oLocaleData.getDaysStandAlone("wide", sCalendarType);
212
212
 
213
213
  if (oMonth.getShowWeekNumbers() && sCalendarType !== CalendarType.Islamic) { // on Islamic primary calendar week numbers are not shown, do not add dummy cell
214
- this.renderDummyCell(oRm, "sapUiCalWH", true, "columnheader");
214
+ this.renderDummyCell(oRm, "sapUiCalWH", true, oMonth._getWeekNumbersHeaderText(), "columnheader");
215
215
  }
216
216
 
217
217
  for ( var i = 0; i < iDays; i++) {
@@ -308,7 +308,7 @@ sap.ui.define([
308
308
 
309
309
  if (iLength === 28) {
310
310
  // there are only 4 full weeks (28 days), add one hidden 'day' div in order to open space for 5-th week
311
- this.renderDummyCell(oRm, "sapUiCalItem", false, "");
311
+ this.renderDummyCell(oRm, "sapUiCalItem", false, "", "");
312
312
  }
313
313
  };
314
314
 
@@ -316,22 +316,35 @@ sap.ui.define([
316
316
  * Generates empty 'day' div that adds space for one more week in the calendar, in case of 4 full weeks only (28 days)
317
317
  * @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer
318
318
  * @param {string} sClassName css class that will be added to the dummy element styles
319
- * @param {boolean} bVisible if set to true the dummy element will be visible
319
+ * @param {boolean} bShowColumn if set to true the dummy element will be visible
320
+ * @param {string} sCellText text to render inside the dummy element; if empty, no text span is rendered
320
321
  * @param {string} sRole aria role attribute
321
322
  * @private
322
323
  */
323
- MonthRenderer.renderDummyCell = function(oRm, sClassName, bVisible, sRole) {
324
+ MonthRenderer.renderDummyCell = function(oRm, sClassName, bShowColumn, sCellText, sRole) {
325
+ var sFullText = Library.getResourceBundleFor("sap.ui.unified").getText("CALENDAR_WEEK");
324
326
  oRm.openStart("div");
325
327
  oRm.class(sClassName);
326
328
  oRm.class("sapUiCalDummy");
327
- oRm.style("visibility", bVisible ? "visible" : "hidden");
329
+ oRm.style("visibility", bShowColumn ? "visible" : "hidden");
328
330
  oRm.attr("role", sRole);
331
+ if (sCellText) {
332
+ oRm.attr("title", sFullText);
333
+ }
329
334
  oRm.openEnd();
330
335
 
336
+ if (sCellText) {
337
+ oRm.openStart("span");
338
+ oRm.attr("aria-hidden", "true");
339
+ oRm.openEnd();
340
+ oRm.text(sCellText);
341
+ oRm.close("span");
342
+ }
343
+
331
344
  oRm.openStart("span");
332
345
  oRm.class("sapUiPseudoInvisibleText");
333
346
  oRm.openEnd();
334
- oRm.text(Library.getResourceBundleFor("sap.ui.unified").getText("CALENDAR_WEEK"));
347
+ oRm.text(sFullText);
335
348
  oRm.close("span");
336
349
 
337
350
  oRm.close('div');
@@ -23,7 +23,8 @@ sap.ui.define([
23
23
  "sap/ui/thirdparty/jquery",
24
24
  "sap/ui/unified/DateRange",
25
25
  "sap/ui/core/date/UI5Date",
26
- 'sap/ui/core/InvisibleText'
26
+ 'sap/ui/core/InvisibleText',
27
+ 'sap/ui/Device'
27
28
  ], function(
28
29
  Formatting,
29
30
  _CalendarType, // type of `primaryCalendarType` and `secondaryCalendarType`
@@ -42,7 +43,8 @@ sap.ui.define([
42
43
  jQuery,
43
44
  DateRange,
44
45
  UI5Date,
45
- InvisibleText
46
+ InvisibleText,
47
+ Device
46
48
  ) {
47
49
  "use strict";
48
50
 
@@ -68,7 +70,7 @@ sap.ui.define([
68
70
  * The MontsRow works with UI5Date or JavaScript Date objects, but only the month and the year are used to display and interact.
69
71
  * As representation for a month, the 1st of the month will always be returned in the API.
70
72
  * @extends sap.ui.core.Control
71
- * @version 1.149.1
73
+ * @version 1.151.0
72
74
  *
73
75
  * @constructor
74
76
  * @public
@@ -145,7 +147,13 @@ sap.ui.define([
145
147
  *
146
148
  * @since 1.145.0
147
149
  */
148
- showWeekNumbers : {type : "boolean", group : "Appearance", defaultValue : false}
150
+ showWeekNumbers : {type : "boolean", group : "Appearance", defaultValue : false},
151
+
152
+ /**
153
+ * The focused date for keyboard interval selection preview.
154
+ * @private
155
+ */
156
+ _focusedDate : {type : "object", group : "Data", visibility: "hidden", defaultValue: null}
149
157
  },
150
158
  aggregations : {
151
159
 
@@ -212,7 +220,7 @@ sap.ui.define([
212
220
  this._oFormatYyyymm = DateFormat.getInstance({pattern: "yyyyMMdd", calendarType: sCalendarType});
213
221
  this._oFormatOnlyYearLong = DateFormat.getInstance({pattern: "yyyy", calendarType: sCalendarType});
214
222
  this._oFormatLong = DateFormat.getInstance({pattern: "MMMM y", calendarType: sCalendarType});
215
- this._mouseMoveProxy = jQuery.proxy(this._handleMouseMove, this);
223
+ this._mouseMoveProxy = this._handleMouseMove.bind(this);
216
224
  this._rb = Library.getResourceBundleFor("sap.ui.unified");
217
225
  };
218
226
 
@@ -278,11 +286,15 @@ sap.ui.define([
278
286
 
279
287
  if (!oEvent.relatedControlId || !containsOrEquals(this.getDomRef(), Element.getElementById(oEvent.relatedControlId).getFocusDomRef())) {
280
288
  if (this._bMouseMove) {
281
- _unbindMousemove.call(this, true);
289
+ this._unbindMousemove(true);
282
290
 
283
- _selectMonth.call(this, this._getDate());
291
+ var bSelected = _selectMonth.call(this, this._getDate());
292
+ if (!bSelected && this._oMoveSelectedDate) {
293
+ _selectMonth.call(this, this._oMoveSelectedDate);
294
+ }
284
295
  this._bMoveChange = false;
285
296
  this._bMousedownChange = false;
297
+ this._oMoveSelectedDate = undefined;
286
298
  _fireSelect.call(this);
287
299
  }
288
300
 
@@ -671,7 +683,9 @@ sap.ui.define([
671
683
  sCalendarType = this.getProperty("primaryCalendarType"),
672
684
  i,
673
685
  aSelectedDates,
674
- oMyDate;
686
+ oMyDate,
687
+ oFocusedDate = this.getProperty("_focusedDate"),
688
+ bSelectionBetween = false;
675
689
 
676
690
  CalendarUtils._checkCalendarDate(oDate);
677
691
 
@@ -698,6 +712,14 @@ sap.ui.define([
698
712
  oEndTimeStamp = oEndDate.toUTCJSDate().getTime();
699
713
  }
700
714
 
715
+ if (oFocusedDate) {
716
+ oFocusedDate = CalendarDate.fromLocalJSDate(oFocusedDate, sCalendarType);
717
+ oFocusedDate.setDate(1);
718
+ }
719
+
720
+ bSelectionBetween = this._isMarkingUnfinishedRangeAllowed() && oFocusedDate && !this._selectedWithMouse &&
721
+ (CalendarUtils._isBetween(oMyDate, oStartDate, oFocusedDate, true) || CalendarUtils._isBetween(oMyDate, oFocusedDate, oStartDate, true));
722
+
701
723
  if (oTimeStamp == oStartTimeStamp && !oEndDate ) {
702
724
  iSelected = 1; // single day selected
703
725
  break;
@@ -711,7 +733,7 @@ sap.ui.define([
711
733
  } else if (oEndDate && oTimeStamp == oEndTimeStamp) {
712
734
  iSelected = 3; // interval end
713
735
  break;
714
- } else if (oEndDate && oTimeStamp > oStartTimeStamp && oTimeStamp < oEndTimeStamp) {
736
+ } else if ((oEndDate && oTimeStamp > oStartTimeStamp && oTimeStamp < oEndTimeStamp) || bSelectionBetween) {
715
737
  iSelected = 4; // interval between
716
738
  break;
717
739
  }
@@ -798,11 +820,44 @@ sap.ui.define([
798
820
 
799
821
  };
800
822
 
823
+ MonthsRow.prototype.onmousedown = function(oEvent) {
824
+ this._oMousedownPosition = {
825
+ clientX: oEvent.clientX,
826
+ clientY: oEvent.clientY
827
+ };
828
+ };
829
+
830
+ MonthsRow.prototype._isValueInThreshold = function(iReference, iValue, iThreshold) {
831
+ var iLowerThreshold = iReference - iThreshold,
832
+ iUpperThreshold = iReference + iThreshold;
833
+
834
+ return iValue >= iLowerThreshold && iValue <= iUpperThreshold;
835
+ };
836
+
837
+ MonthsRow.prototype._areMouseEventCoordinatesInThreshold = function(clientX, clientY, iThreshold) {
838
+ return this._oMousedownPosition
839
+ && this._isValueInThreshold(this._oMousedownPosition.clientX, clientX, iThreshold)
840
+ && this._isValueInThreshold(this._oMousedownPosition.clientY, clientY, iThreshold)
841
+ ? true : false;
842
+ };
843
+
844
+ MonthsRow.prototype._getSelectedDateFromEvent = function(oEvent) {
845
+ var oTarget = oEvent.target,
846
+ sExtractedMonth, oParsedDate;
847
+
848
+ sExtractedMonth = oTarget.getAttribute("data-sap-month") || oTarget.parentNode.getAttribute("data-sap-month");
849
+
850
+ oParsedDate = sExtractedMonth ? this._oFormatYyyymm.parse(sExtractedMonth, this.getProperty("primaryCalendarType")) : null;
851
+
852
+ return oParsedDate ? CalendarDate.fromLocalJSDate(oParsedDate, this.getProperty("primaryCalendarType")) : null;
853
+ };
854
+
801
855
  MonthsRow.prototype._handleMouseMove = function(oEvent){
802
856
 
803
857
  if (!this.$().is(":visible")) {
804
858
  // calendar was closed -> remove mousemove handler
805
- _unbindMousemove.call(this, true);
859
+ this._unbindMousemove(true);
860
+ return;
806
861
  }
807
862
 
808
863
  var $Target = jQuery(oEvent.target);
@@ -811,26 +866,104 @@ sap.ui.define([
811
866
  $Target = $Target.parent();
812
867
  }
813
868
 
814
- if ($Target.hasClass("sapUiCalItem")) {
815
- var oOldFocusedDate = this._getDate();
816
- var oFocusedDate = CalendarDate.fromLocalJSDate(this._oFormatYyyymm.parse($Target.attr("data-sap-month"), this.getProperty("primaryCalendarType")));
817
- oFocusedDate.setDate(1);
869
+ if (this._sLastTargetId && this._sLastTargetId === $Target.attr("id")) {
870
+ // mouse move at same month -> do nothing
871
+ return;
872
+ }
873
+ this._sLastTargetId = $Target.attr("id");
874
+
875
+ if (!$Target.hasClass("sapUiCalItem") || !containsOrEquals(this.getDomRef(), oEvent.target)) {
876
+ return;
877
+ }
818
878
 
819
- if (!oFocusedDate.isSame(oOldFocusedDate)) {
820
- this.setDate(oFocusedDate.toLocalJSDate());
821
- _selectMonth.call(this, oFocusedDate, true);
822
- this._bMoveChange = true;
879
+ var oOldFocusedDate = this._getDate();
880
+ var oFocusedDate = CalendarDate.fromLocalJSDate(this._oFormatYyyymm.parse($Target.attr("data-sap-month"), this.getProperty("primaryCalendarType")));
881
+ oFocusedDate.setDate(1);
882
+
883
+ if (!oFocusedDate.isSame(oOldFocusedDate)) {
884
+ this.setDate(oFocusedDate.toLocalJSDate());
885
+ var bSelected = _selectMonth.call(this, oFocusedDate, true);
886
+ if (bSelected) {
887
+ this._oMoveSelectedDate = new CalendarDate(oFocusedDate, this.getProperty("primaryCalendarType"));
823
888
  }
889
+ this._bMoveChange = true;
890
+ }
891
+ };
892
+
893
+ MonthsRow.prototype.onmouseover = function(oEvent) {
894
+ var $Target = jQuery(oEvent.target),
895
+ oSelectedDateRange = this.getSelectedDates()[0],
896
+ iMonth1,
897
+ iMonth2;
898
+
899
+ if (!this._isMarkingUnfinishedRangeAllowed()) {
900
+ return;
901
+ }
902
+
903
+ if (!$Target.hasClass("sapUiCalItemText") && !$Target.hasClass("sapUiCalItem")) {
904
+ return;
905
+ }
906
+
907
+ if ($Target.hasClass("sapUiCalItemText")) {
908
+ $Target = $Target.parent();
909
+ }
910
+
911
+ iMonth1 = parseInt(this._oFormatYyyymm.format(CalendarDate.fromLocalJSDate(oSelectedDateRange.getStartDate(), this.getProperty("primaryCalendarType")).toUTCJSDate(), true));
912
+ iMonth2 = parseInt($Target.attr("data-sap-month"));
913
+
914
+ if (this.hasListeners("datehovered")) {
915
+ this.fireEvent("datehovered", { date1: iMonth1, date2: iMonth2 });
916
+ } else {
917
+ this._markMonthsBetweenStartAndHoveredMonth(iMonth1, iMonth2);
918
+ }
919
+ };
920
+
921
+ MonthsRow.prototype._markMonthsBetweenStartAndHoveredMonth = function(iMonth1, iMonth2) {
922
+ const aDomRefs = this.$().find(".sapUiCalItem");
923
+
924
+ // swap if necessary
925
+ if (iMonth1 > iMonth2) {
926
+ [iMonth1, iMonth2] = [iMonth2, iMonth1];
824
927
  }
825
928
 
929
+ [...aDomRefs].forEach((elem) => {
930
+ const $CheckRef = jQuery(elem);
931
+ const iCheckMonth = parseInt($CheckRef.attr("data-sap-month"));
932
+
933
+ if (iCheckMonth > iMonth1 && iCheckMonth < iMonth2 && this._isMonthInAllowedRange(iCheckMonth)) {
934
+ $CheckRef.addClass("sapUiCalItemSelBetween");
935
+ } else {
936
+ $CheckRef.removeClass("sapUiCalItemSelBetween");
937
+ if (iCheckMonth !== iMonth1 && iCheckMonth !== iMonth2) {
938
+ $CheckRef.removeClass("sapUiCalItemSel");
939
+ }
940
+ }
941
+ });
942
+ };
943
+
944
+ MonthsRow.prototype._isMonthInAllowedRange = function(iCheckMonth) {
945
+ const oCheckDate = this._oFormatYyyymm.parse(String(iCheckMonth));
946
+ const oCalDate = CalendarDate.fromLocalJSDate(oCheckDate, this.getProperty("primaryCalendarType"));
947
+
948
+ return this._checkMonthEnabled(oCalDate);
949
+ };
950
+
951
+ MonthsRow.prototype._isMarkingUnfinishedRangeAllowed = function() {
952
+ var oSelectedRange = this.getSelectedDates()[0],
953
+ bValidRangeForMarking = !!(oSelectedRange && oSelectedRange.getStartDate() && !oSelectedRange.getEndDate());
954
+
955
+ return this.getIntervalSelection() && bValidRangeForMarking;
826
956
  };
827
957
 
828
958
  MonthsRow.prototype.onmouseup = function(oEvent){
959
+ // BCP: 1980116734
960
+ // on a combi device right mouse button resulted in a selection
961
+ var bNotRightMouseButton = oEvent.button !== 2;
829
962
 
830
963
  if (this._bMouseMove) {
831
- _unbindMousemove.call(this, true);
964
+ this._unbindMousemove(true);
832
965
 
833
- // focus now selected day
966
+ // focus now selected month
834
967
  var oFocusedDate = this._getDate();
835
968
  var aDomRefs = this._oItemNavigation.getItemDomRefs();
836
969
 
@@ -844,20 +977,13 @@ sap.ui.define([
844
977
 
845
978
  if (this._bMoveChange) {
846
979
  // selection was changed -> make it final
847
- var $Target = jQuery(oEvent.target);
848
-
849
- if ($Target.hasClass("sapUiCalItemText")) {
850
- $Target = $Target.parent();
980
+ var bSelected = _selectMonth.call(this, oFocusedDate);
981
+ if (!bSelected && this._oMoveSelectedDate) {
982
+ _selectMonth.call(this, this._oMoveSelectedDate);
851
983
  }
852
-
853
- if ($Target.hasClass("sapUiCalItem")) {
854
- oFocusedDate = CalendarDate.fromLocalJSDate(this._oFormatYyyymm.parse($Target.attr("data-sap-month")));
855
- oFocusedDate.setDate(1);
856
- }
857
-
858
- _selectMonth.call(this, oFocusedDate);
859
984
  this._bMoveChange = false;
860
985
  this._bMousedownChange = false;
986
+ this._oMoveSelectedDate = undefined;
861
987
  _fireSelect.call(this);
862
988
  }
863
989
  }
@@ -865,10 +991,25 @@ sap.ui.define([
865
991
  if (this._bMousedownChange) {
866
992
  this._bMousedownChange = false;
867
993
  _fireSelect.call(this);
994
+ } else if (Device.support.touch && bNotRightMouseButton && this._areMouseEventCoordinatesInThreshold(oEvent.clientX, oEvent.clientY, 10)) {
995
+ var classList = oEvent.target.classList,
996
+ bIsMonthSelected = classList.contains("sapUiCalItemText") || classList.contains("sapUiCalItem"),
997
+ oSelectedDate = this._getSelectedDateFromEvent(oEvent);
998
+
999
+ if (bIsMonthSelected && oSelectedDate) {
1000
+ _selectMonth.call(this, oSelectedDate, false);
1001
+ _fireSelect.call(this);
1002
+ }
868
1003
  }
869
1004
 
870
1005
  };
871
1006
 
1007
+ MonthsRow.prototype.onkeydown = function(oEvent){
1008
+ if (this.getIntervalSelection()) {
1009
+ this._selectedWithMouse = false;
1010
+ }
1011
+ };
1012
+
872
1013
  MonthsRow.prototype.onsapselect = function(oEvent){
873
1014
 
874
1015
  // focused item must be selected
@@ -1065,7 +1206,14 @@ sap.ui.define([
1065
1206
 
1066
1207
  if (oEvent.type == "mousedown") {
1067
1208
  // as no click event is fired in some cases, e.g. if DOM changed select the month on mousedown
1209
+ if (this.getIntervalSelection()) {
1210
+ this._sLastTargetId = aDomRefs[iIndex].id;
1211
+ this._selectedWithMouse = true;
1212
+ }
1068
1213
  _handleMousedown.call(this, oEvent, oFocusedDate, iIndex);
1214
+ } else if (this.getIntervalSelection()) {
1215
+ this.setProperty("_focusedDate", oFocusedDate.toLocalJSDate(), true);
1216
+ this.invalidate();
1069
1217
  }
1070
1218
 
1071
1219
  }
@@ -1082,6 +1230,11 @@ sap.ui.define([
1082
1230
  if (oEvent.type == "mousedown") {
1083
1231
  // as no click event is fired in some cases, e.g. if DOM has changed select the day on mousedown
1084
1232
  var oFocusedDate = this._getDate();
1233
+ if (this.getIntervalSelection()) {
1234
+ var aDomRefs = this._oItemNavigation.getItemDomRefs();
1235
+ this._sLastTargetId = aDomRefs[iIndex].id;
1236
+ this._selectedWithMouse = true;
1237
+ }
1085
1238
  _handleMousedown.call(this, oEvent, oFocusedDate, iIndex);
1086
1239
  }
1087
1240
 
@@ -1137,8 +1290,8 @@ sap.ui.define([
1137
1290
  */
1138
1291
  function _handleMousedown(oEvent, oFocusedDate, iIndex){
1139
1292
 
1140
- if (oEvent.button) {
1141
- // only use left mouse button
1293
+ if (oEvent.button || Device.support.touch) {
1294
+ // only use left mouse button; on touch devices avoid selection during scrolling
1142
1295
  return;
1143
1296
  }
1144
1297
 
@@ -1149,11 +1302,13 @@ sap.ui.define([
1149
1302
 
1150
1303
  if (this._bMouseMove) {
1151
1304
  // a mouseup must be happened outside of control -> just end move
1152
- _unbindMousemove.call(this, true);
1305
+ this._unbindMousemove(true);
1153
1306
  this._bMoveChange = false;
1307
+ this._oMoveSelectedDate = undefined;
1154
1308
  } else if (bSelected && this.getIntervalSelection() && this.$().is(":visible")) {
1155
1309
  // if closed in select event, do not add mousemove handler
1156
- _bindMousemove.call(this, true);
1310
+ this._bindMousemove(true);
1311
+ this._oMoveSelectedDate = new CalendarDate(oFocusedDate, this.getProperty("primaryCalendarType"));
1157
1312
  }
1158
1313
 
1159
1314
  oEvent.preventDefault();
@@ -1319,7 +1474,7 @@ sap.ui.define([
1319
1474
 
1320
1475
  if (this._bMouseMove) {
1321
1476
  // detach mouse move handler because calendar might be losed in select event handler
1322
- _unbindMousemove.call(this, true);
1477
+ this._unbindMousemove(true);
1323
1478
  }
1324
1479
 
1325
1480
  this.fireSelect();
@@ -1391,19 +1546,20 @@ sap.ui.define([
1391
1546
  }
1392
1547
  }
1393
1548
 
1394
- function _bindMousemove(){
1549
+ MonthsRow.prototype._bindMousemove = function(){
1395
1550
 
1396
1551
  jQuery(window.document).on('mousemove', this._mouseMoveProxy);
1397
1552
  this._bMouseMove = true;
1398
1553
 
1399
- }
1554
+ };
1400
1555
 
1401
- function _unbindMousemove(){
1556
+ MonthsRow.prototype._unbindMousemove = function(){
1402
1557
 
1403
1558
  jQuery(window.document).off('mousemove', this._mouseMoveProxy);
1404
1559
  this._bMouseMove = undefined;
1560
+ this._sLastTargetId = undefined;
1405
1561
 
1406
- }
1562
+ };
1407
1563
 
1408
1564
  return MonthsRow;
1409
1565
 
@@ -34,7 +34,7 @@ sap.ui.define([
34
34
  * Other usages are not supported.
35
35
  *
36
36
  * @extends sap.ui.unified.calendar.DatesRow
37
- * @version 1.149.1
37
+ * @version 1.151.0
38
38
  *
39
39
  * @constructor
40
40
  * @private
@@ -69,7 +69,7 @@ sap.ui.define([
69
69
  *
70
70
  * The TimesRow works with UI5Date or JavaScript Date objects.
71
71
  * @extends sap.ui.core.Control
72
- * @version 1.149.1
72
+ * @version 1.151.0
73
73
  *
74
74
  * @constructor
75
75
  * @public
@@ -41,7 +41,7 @@ sap.ui.define([
41
41
  * The WeeksRow works with UI5Date or JavaScript Date objects for its API, but internally uses CalendarDate objects for calculations.
42
42
  *
43
43
  * @extends sap.ui.core.Control
44
- * @version 1.149.1
44
+ * @version 1.151.0
45
45
  *
46
46
  * @constructor
47
47
  * @private
@@ -61,7 +61,7 @@ sap.ui.define([
61
61
  * As in all date-time controls, all pubic JS Date objects that are given (e.g. <code>setDate()</code>) or read
62
62
  * (e.g. <code>getFirstRenderedDate</code>) with values which are considered as date objects in browser(local) timezone.
63
63
  * @extends sap.ui.core.Control
64
- * @version 1.149.1
64
+ * @version 1.151.0
65
65
  *
66
66
  * @constructor
67
67
  * @public
@@ -45,7 +45,7 @@ sap.ui.define([
45
45
  * @extends sap.ui.unified.calendar.YearPicker
46
46
  *
47
47
  * @author SAP SE
48
- * @version 1.149.1
48
+ * @version 1.151.0
49
49
  *
50
50
  * @constructor
51
51
  * @private
@@ -32,14 +32,14 @@ sap.ui.define([
32
32
  * @namespace
33
33
  * @alias sap.ui.unified
34
34
  * @author SAP SE
35
- * @version 1.149.1
35
+ * @version 1.151.0
36
36
  * @since 1.28
37
37
  * @public
38
38
  */
39
39
  var thisLib = Library.init({
40
40
  name : "sap.ui.unified",
41
41
  apiVersion: 2,
42
- version: "1.149.1",
42
+ version: "1.151.0",
43
43
  dependencies : ["sap.ui.core"],
44
44
  designtime: "sap/ui/unified/designtime/library.designtime",
45
45
  types: [