@openui5/sap.ui.unified 1.111.6 → 1.112.1

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 (97) hide show
  1. package/package.json +2 -2
  2. package/src/sap/ui/unified/.library +1 -1
  3. package/src/sap/ui/unified/Calendar.js +83 -67
  4. package/src/sap/ui/unified/CalendarAppointment.js +34 -48
  5. package/src/sap/ui/unified/CalendarDateInterval.js +10 -7
  6. package/src/sap/ui/unified/CalendarLegend.js +1 -1
  7. package/src/sap/ui/unified/CalendarLegendItem.js +1 -1
  8. package/src/sap/ui/unified/CalendarMonthInterval.js +1 -1
  9. package/src/sap/ui/unified/CalendarOneMonthInterval.js +1 -1
  10. package/src/sap/ui/unified/CalendarRow.js +38 -57
  11. package/src/sap/ui/unified/CalendarRowRenderer.js +16 -12
  12. package/src/sap/ui/unified/CalendarTimeInterval.js +8 -6
  13. package/src/sap/ui/unified/CalendarWeekInterval.js +1 -1
  14. package/src/sap/ui/unified/ColorPicker.js +1 -1
  15. package/src/sap/ui/unified/ColorPickerPopover.js +1 -1
  16. package/src/sap/ui/unified/ContentSwitcher.js +1 -1
  17. package/src/sap/ui/unified/Currency.js +1 -1
  18. package/src/sap/ui/unified/CurrencyRenderer.js +1 -1
  19. package/src/sap/ui/unified/DateRange.js +1 -1
  20. package/src/sap/ui/unified/DateTypeRange.js +1 -1
  21. package/src/sap/ui/unified/FileUploader.js +29 -1
  22. package/src/sap/ui/unified/FileUploaderParameter.js +1 -1
  23. package/src/sap/ui/unified/FileUploaderXHRSettings.js +1 -1
  24. package/src/sap/ui/unified/Menu.js +1 -1
  25. package/src/sap/ui/unified/MenuItem.js +1 -1
  26. package/src/sap/ui/unified/MenuItemBase.js +1 -1
  27. package/src/sap/ui/unified/MenuRenderer.js +1 -1
  28. package/src/sap/ui/unified/MenuTextFieldItem.js +15 -14
  29. package/src/sap/ui/unified/Shell.js +1 -1
  30. package/src/sap/ui/unified/ShellHeadItem.js +1 -1
  31. package/src/sap/ui/unified/ShellHeadUserItem.js +1 -1
  32. package/src/sap/ui/unified/ShellLayout.js +1 -1
  33. package/src/sap/ui/unified/ShellOverlay.js +1 -1
  34. package/src/sap/ui/unified/SplitContainer.js +1 -1
  35. package/src/sap/ui/unified/calendar/CalendarUtils.js +13 -12
  36. package/src/sap/ui/unified/calendar/DatesRow.js +1 -1
  37. package/src/sap/ui/unified/calendar/DatesRowRenderer.js +8 -1
  38. package/src/sap/ui/unified/calendar/Header.js +1 -1
  39. package/src/sap/ui/unified/calendar/IndexPicker.js +1 -1
  40. package/src/sap/ui/unified/calendar/Month.js +52 -48
  41. package/src/sap/ui/unified/calendar/MonthPicker.js +29 -34
  42. package/src/sap/ui/unified/calendar/MonthRenderer.js +4 -0
  43. package/src/sap/ui/unified/calendar/MonthsRow.js +16 -15
  44. package/src/sap/ui/unified/calendar/OneMonthDatesRow.js +1 -1
  45. package/src/sap/ui/unified/calendar/TimesRow.js +6 -4
  46. package/src/sap/ui/unified/calendar/TimesRowRenderer.js +21 -23
  47. package/src/sap/ui/unified/calendar/YearPicker.js +45 -53
  48. package/src/sap/ui/unified/calendar/YearRangePicker.js +11 -11
  49. package/src/sap/ui/unified/library.js +2 -2
  50. package/src/sap/ui/unified/messagebundle.properties +3 -0
  51. package/src/sap/ui/unified/messagebundle_ar.properties +2 -0
  52. package/src/sap/ui/unified/messagebundle_bg.properties +2 -0
  53. package/src/sap/ui/unified/messagebundle_ca.properties +2 -0
  54. package/src/sap/ui/unified/messagebundle_cs.properties +2 -0
  55. package/src/sap/ui/unified/messagebundle_cy.properties +2 -0
  56. package/src/sap/ui/unified/messagebundle_da.properties +2 -0
  57. package/src/sap/ui/unified/messagebundle_de.properties +2 -0
  58. package/src/sap/ui/unified/messagebundle_el.properties +2 -0
  59. package/src/sap/ui/unified/messagebundle_en.properties +2 -0
  60. package/src/sap/ui/unified/messagebundle_en_GB.properties +2 -0
  61. package/src/sap/ui/unified/messagebundle_en_US_sappsd.properties +2 -0
  62. package/src/sap/ui/unified/messagebundle_en_US_saptrc.properties +2 -0
  63. package/src/sap/ui/unified/messagebundle_es.properties +2 -0
  64. package/src/sap/ui/unified/messagebundle_es_MX.properties +2 -0
  65. package/src/sap/ui/unified/messagebundle_et.properties +2 -0
  66. package/src/sap/ui/unified/messagebundle_fi.properties +2 -0
  67. package/src/sap/ui/unified/messagebundle_fr.properties +2 -0
  68. package/src/sap/ui/unified/messagebundle_fr_CA.properties +2 -0
  69. package/src/sap/ui/unified/messagebundle_hi.properties +2 -0
  70. package/src/sap/ui/unified/messagebundle_hr.properties +2 -0
  71. package/src/sap/ui/unified/messagebundle_hu.properties +2 -0
  72. package/src/sap/ui/unified/messagebundle_id.properties +2 -0
  73. package/src/sap/ui/unified/messagebundle_it.properties +2 -0
  74. package/src/sap/ui/unified/messagebundle_iw.properties +2 -0
  75. package/src/sap/ui/unified/messagebundle_ja.properties +4 -2
  76. package/src/sap/ui/unified/messagebundle_kk.properties +2 -0
  77. package/src/sap/ui/unified/messagebundle_ko.properties +2 -0
  78. package/src/sap/ui/unified/messagebundle_lt.properties +2 -0
  79. package/src/sap/ui/unified/messagebundle_lv.properties +2 -0
  80. package/src/sap/ui/unified/messagebundle_ms.properties +2 -0
  81. package/src/sap/ui/unified/messagebundle_nl.properties +2 -0
  82. package/src/sap/ui/unified/messagebundle_no.properties +2 -0
  83. package/src/sap/ui/unified/messagebundle_pl.properties +2 -0
  84. package/src/sap/ui/unified/messagebundle_pt.properties +2 -0
  85. package/src/sap/ui/unified/messagebundle_pt_PT.properties +2 -0
  86. package/src/sap/ui/unified/messagebundle_ro.properties +6 -4
  87. package/src/sap/ui/unified/messagebundle_ru.properties +2 -0
  88. package/src/sap/ui/unified/messagebundle_sh.properties +2 -0
  89. package/src/sap/ui/unified/messagebundle_sk.properties +2 -0
  90. package/src/sap/ui/unified/messagebundle_sl.properties +2 -0
  91. package/src/sap/ui/unified/messagebundle_sv.properties +2 -0
  92. package/src/sap/ui/unified/messagebundle_th.properties +2 -0
  93. package/src/sap/ui/unified/messagebundle_tr.properties +2 -0
  94. package/src/sap/ui/unified/messagebundle_uk.properties +2 -0
  95. package/src/sap/ui/unified/messagebundle_vi.properties +2 -0
  96. package/src/sap/ui/unified/messagebundle_zh_CN.properties +2 -0
  97. package/src/sap/ui/unified/messagebundle_zh_TW.properties +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openui5/sap.ui.unified",
3
- "version": "1.111.6",
3
+ "version": "1.112.1",
4
4
  "description": "OpenUI5 UI Library sap.ui.unified",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -14,6 +14,6 @@
14
14
  "url": "https://github.com/SAP/openui5.git"
15
15
  },
16
16
  "dependencies": {
17
- "@openui5/sap.ui.core": "1.111.6"
17
+ "@openui5/sap.ui.core": "1.112.1"
18
18
  }
19
19
  }
@@ -6,7 +6,7 @@
6
6
  <copyright>OpenUI5
7
7
  * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
8
8
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
9
- <version>1.111.6</version>
9
+ <version>1.112.1</version>
10
10
 
11
11
  <documentation>Unified controls intended for both, mobile and desktop scenarios</documentation>
12
12
 
@@ -76,7 +76,7 @@ sap.ui.define([
76
76
  * Basic Calendar.
77
77
  * This calendar is used for DatePickers
78
78
  * @extends sap.ui.core.Control
79
- * @version 1.111.6
79
+ * @version 1.112.1
80
80
  *
81
81
  * @constructor
82
82
  * @public
@@ -138,14 +138,14 @@ sap.ui.define([
138
138
  * If not set, the calendar type of the global configuration is used.
139
139
  * @since 1.34.0
140
140
  */
141
- primaryCalendarType : {type : "sap.ui.core.CalendarType", group : "Appearance"},
141
+ primaryCalendarType : {type : "sap.ui.core.CalendarType", group : "Appearance", defaultValue : null},
142
142
 
143
143
  /**
144
144
  * If set, the days are also displayed in this calendar type
145
145
  * If not set, the dates are only displayed in the primary calendar type
146
146
  * @since 1.34.0
147
147
  */
148
- secondaryCalendarType : {type : "sap.ui.core.CalendarType", group : "Appearance"},
148
+ secondaryCalendarType : {type : "sap.ui.core.CalendarType", group : "Appearance", defaultValue : null},
149
149
 
150
150
  /**
151
151
  * Width of Calendar
@@ -349,6 +349,11 @@ sap.ui.define([
349
349
  this._iBreakPointDesktop = Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[1];
350
350
  this._iBreakPointLargeDesktop = Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[2];
351
351
 
352
+ // set default calendar type from configuration
353
+ var sCalendarType = Configuration.getCalendarType();
354
+ this.setProperty("primaryCalendarType", sCalendarType);
355
+ this.setProperty("secondaryCalendarType", sCalendarType);
356
+
352
357
  this._iColumns = 1; // default columns for the calendar
353
358
 
354
359
  // Render the monthPicker first to get the length of the current month name. The _currentPicker property will
@@ -356,12 +361,12 @@ sap.ui.define([
356
361
  this.setProperty("_currentPicker", CURRENT_PICKERS.MONTH_PICKER);
357
362
 
358
363
  // to format year with era in Japanese
359
- this._oYearFormat = DateFormat.getDateInstance({format: "y", calendarType: this._getPrimaryCalendarType()});
364
+ this._oYearFormat = DateFormat.getDateInstance({format: "y", calendarType: sCalendarType});
360
365
 
361
366
  this.data("sap-ui-fastnavgroup", "true", true); // Define group for F6 handling
362
367
 
363
- this._oMinDate = CalendarUtils._minDate(this._getPrimaryCalendarType());
364
- this._oMaxDate = CalendarUtils._maxDate(this._getPrimaryCalendarType());
368
+ this._oMinDate = CalendarUtils._minDate(this.getPrimaryCalendarType());
369
+ this._oMaxDate = CalendarUtils._maxDate(this.getPrimaryCalendarType());
365
370
 
366
371
  this._initializeHeader();
367
372
  this._initializeSecondMonthHeader();
@@ -484,7 +489,7 @@ sap.ui.define([
484
489
  Calendar.prototype._initializeYearRangePicker = function() {
485
490
  var oYearRangePicker = new YearRangePicker(this.getId() + "--YRP");
486
491
  oYearRangePicker.attachEvent("select", this._selectYearRange, this);
487
- oYearRangePicker.setPrimaryCalendarType(this._getPrimaryCalendarType());
492
+ oYearRangePicker.setPrimaryCalendarType(this.getPrimaryCalendarType());
488
493
  this.setAggregation("yearRangePicker", oYearRangePicker); // do not invalidate
489
494
  };
490
495
 
@@ -504,7 +509,7 @@ sap.ui.define([
504
509
  weekDays: oWeekDays
505
510
  });
506
511
 
507
- this._focusDate(CalendarDate.fromLocalJSDate(oWeekDays.getStartDate(), this._getPrimaryCalendarType()), true, false, false);
512
+ this._focusDate(CalendarDate.fromLocalJSDate(oWeekDays.getStartDate(), this.getPrimaryCalendarType()), true, false, false);
508
513
 
509
514
  if (!bExecuteDefault) {
510
515
  oEvent.preventDefault();
@@ -537,7 +542,7 @@ sap.ui.define([
537
542
 
538
543
  if (aMonths.length > 1 && oMonthDate) {
539
544
  // for more than one month - re-render same months (if already rendered once)
540
- oCalDate = CalendarDate.fromLocalJSDate(oMonthDate, this._getPrimaryCalendarType());
545
+ oCalDate = CalendarDate.fromLocalJSDate(oMonthDate, this.getPrimaryCalendarType());
541
546
  } else if (aMonths.length > 1) {
542
547
  oCalDate = _determineFirstMonthDate.call(this, this._getFocusedDate());
543
548
  } else {
@@ -564,6 +569,7 @@ sap.ui.define([
564
569
  this._updateHeader(oCalDate);
565
570
 
566
571
  this._updateHeadersButtons();
572
+ this._adjustYearRangeDisplay();
567
573
 
568
574
  this._updateLegendParent();
569
575
  if (this.getInitialFocusedDate()) {
@@ -729,7 +735,7 @@ sap.ui.define([
729
735
  */
730
736
  Calendar.prototype._setFocusedDate = function(oDate){
731
737
  CalendarUtils._checkCalendarDate(oDate);
732
- this._oFocusedDate = new CalendarDate(oDate, this._getPrimaryCalendarType());
738
+ this._oFocusedDate = new CalendarDate(oDate, this.getPrimaryCalendarType());
733
739
  };
734
740
 
735
741
  /**
@@ -780,7 +786,7 @@ sap.ui.define([
780
786
  if (this.getDomRef()) {
781
787
  // if rendered just use the date of the first month
782
788
  var aMonths = this.getAggregation("month");
783
- oStartDate = CalendarDate.fromLocalJSDate(aMonths[0].getDate(), this._getPrimaryCalendarType());
789
+ oStartDate = CalendarDate.fromLocalJSDate(aMonths[0].getDate(), this.getPrimaryCalendarType());
784
790
  } else {
785
791
  // if not rendered use the focused date
786
792
  oStartDate = new CalendarDate(this._getFocusedDate());
@@ -859,7 +865,6 @@ sap.ui.define([
859
865
  i;
860
866
 
861
867
  this.setProperty("primaryCalendarType", sCalendarType);
862
- this._adjustYearRangeDisplay();
863
868
 
864
869
  this._oYearFormat = DateFormat.getDateInstance({format: "y", calendarType: sCalendarType});
865
870
 
@@ -892,6 +897,7 @@ sap.ui.define([
892
897
 
893
898
  Calendar.prototype.setSecondaryCalendarType = function(sCalendarType){
894
899
 
900
+ this._bSecondaryCalendarTypeSet = true; // as property can not be empty but we use it only if set
895
901
  this.setProperty("secondaryCalendarType", sCalendarType);
896
902
 
897
903
  this._oYearFormatSecondary = DateFormat.getDateInstance({format: "y", calendarType: sCalendarType});
@@ -911,22 +917,24 @@ sap.ui.define([
911
917
 
912
918
  };
913
919
 
914
- Calendar.prototype._getPrimaryCalendarType = function(){
915
- return this.getProperty("primaryCalendarType") || Configuration.getCalendarType();
916
- };
917
-
918
920
  /**
919
921
  * Returns if there is secondary calendar type set and if it is different from the primary one.
920
- * @returns {string} if there is secondary calendar type set and if it is different from the primary one
922
+ * @returns {boolean} if there is secondary calendar type set and if it is different from the primary one
921
923
  */
922
924
  Calendar.prototype._getSecondaryCalendarType = function(){
923
- var sSecondaryCalendarType = this.getSecondaryCalendarType();
924
925
 
925
- if (sSecondaryCalendarType === this._getPrimaryCalendarType()) {
926
- return undefined;
926
+ var sSecondaryCalendarType;
927
+
928
+ if (this._bSecondaryCalendarTypeSet) {
929
+ sSecondaryCalendarType = this.getSecondaryCalendarType();
930
+ var sPrimaryCalendarType = this.getPrimaryCalendarType();
931
+ if (sSecondaryCalendarType == sPrimaryCalendarType) {
932
+ sSecondaryCalendarType = undefined;
933
+ }
927
934
  }
928
935
 
929
936
  return sSecondaryCalendarType;
937
+
930
938
  };
931
939
 
932
940
  /**
@@ -962,7 +970,7 @@ sap.ui.define([
962
970
  */
963
971
  Calendar.prototype.setMinDate = function(oDate){
964
972
  var aMonths = this.getAggregation("month"),
965
- sPrimaryCalendarType = this._getPrimaryCalendarType(),
973
+ sPrimaryCalendarType = this.getPrimaryCalendarType(),
966
974
  iMinYear;
967
975
 
968
976
  if (deepEqual(oDate, this.getMinDate())) {
@@ -1017,7 +1025,7 @@ sap.ui.define([
1017
1025
  Calendar.prototype.setMaxDate = function(oDate){
1018
1026
 
1019
1027
  var aMonths = this.getAggregation("month"),
1020
- sPrimaryCalendarType = this._getPrimaryCalendarType(),
1028
+ sPrimaryCalendarType = this.getPrimaryCalendarType(),
1021
1029
  iMaxYear;
1022
1030
 
1023
1031
  if (deepEqual(oDate, this.getMaxDate())) {
@@ -1287,7 +1295,7 @@ sap.ui.define([
1287
1295
 
1288
1296
  var oCalDate;
1289
1297
  if (aMonths.length > 1) {
1290
- oCalDate = CalendarDate.fromLocalJSDate(aMonths[0].getDate(), this._getPrimaryCalendarType());
1298
+ oCalDate = CalendarDate.fromLocalJSDate(aMonths[0].getDate(), this.getPrimaryCalendarType());
1291
1299
  } else {
1292
1300
  oCalDate = this._getFocusedDate();
1293
1301
  }
@@ -1343,7 +1351,7 @@ sap.ui.define([
1343
1351
  var oHeader = this.getAggregation("header");
1344
1352
  var iMonths = _getMonths.call(this);
1345
1353
 
1346
- var oCheckDate = new CalendarDate(oDate, this._getPrimaryCalendarType());
1354
+ var oCheckDate = new CalendarDate(oDate, this.getPrimaryCalendarType());
1347
1355
 
1348
1356
  if (this._iMode === 1 && iMonths > 1) {
1349
1357
  oCheckDate = _determineFirstMonthDate.call(this, oDate);
@@ -1395,7 +1403,7 @@ sap.ui.define([
1395
1403
  Calendar.prototype._togglePrevNexYearPicker = function(){
1396
1404
  var oYearRangePicker = this.getAggregation("yearRangePicker"),
1397
1405
  oYearPicker = this._getYearPicker(),
1398
- sPrimaryType = this._getPrimaryCalendarType(),
1406
+ sPrimaryType = this.getPrimaryCalendarType(),
1399
1407
  oMinDate = new CalendarDate(this._oMinDate, sPrimaryType),
1400
1408
  oMaxDate = new CalendarDate(this._oMaxDate, sPrimaryType),
1401
1409
  oHeader = this.getAggregation("header"),
@@ -1444,7 +1452,7 @@ sap.ui.define([
1444
1452
  switch (this._iMode) {
1445
1453
  case 0: // day picker
1446
1454
  if (iMonths > 1) {
1447
- oFirstMonthDate = CalendarDate.fromLocalJSDate(this.getAggregation("month")[0].getDate(), this._getPrimaryCalendarType());
1455
+ oFirstMonthDate = CalendarDate.fromLocalJSDate(this.getAggregation("month")[0].getDate(), this.getPrimaryCalendarType());
1448
1456
  oFirstMonthDate.setDate(1);
1449
1457
  this._setFocusedDate(oFirstMonthDate);
1450
1458
  oFocusedDate = this._getFocusedDate();
@@ -1503,7 +1511,7 @@ sap.ui.define([
1503
1511
  switch (this._iMode) {
1504
1512
  case 0: // day picker
1505
1513
  if (iMonths > 1) {
1506
- oFirstMonthDate = CalendarDate.fromLocalJSDate(this.getAggregation("month")[0].getDate(), this._getPrimaryCalendarType());
1514
+ oFirstMonthDate = CalendarDate.fromLocalJSDate(this.getAggregation("month")[0].getDate(), this.getPrimaryCalendarType());
1507
1515
  oFirstMonthDate.setMonth(oFirstMonthDate.getMonth(),1);
1508
1516
  this._setFocusedDate(oFirstMonthDate);
1509
1517
  oFocusedDate = this._getFocusedDate();
@@ -1621,7 +1629,7 @@ sap.ui.define([
1621
1629
 
1622
1630
  Calendar.prototype._getDisplayedSecondaryMonths = function(){
1623
1631
 
1624
- var sPrimaryCalendarType = this._getPrimaryCalendarType(),
1632
+ var sPrimaryCalendarType = this.getPrimaryCalendarType(),
1625
1633
  sSecondaryCalendarType = this._getSecondaryCalendarType(),
1626
1634
  aMonths = this.getAggregation("month"),
1627
1635
  oFirstDate = CalendarDate.fromLocalJSDate(aMonths[0].getDate(), sPrimaryCalendarType),
@@ -1646,7 +1654,7 @@ sap.ui.define([
1646
1654
  * @returns {object} two values - start and end date
1647
1655
  */
1648
1656
  Calendar.prototype._getDisplayedSecondaryYears = function(){
1649
- var sPrimaryCalendarType = this._getPrimaryCalendarType(),
1657
+ var sPrimaryCalendarType = this.getPrimaryCalendarType(),
1650
1658
  sSecondaryCalendarType = this._getSecondaryCalendarType(),
1651
1659
  oFirstDate, oLastDate, oFocusedDate, oDate, aMonths, oYearPicker, iHalfRange;
1652
1660
  switch (this._iMode) {
@@ -1738,7 +1746,7 @@ sap.ui.define([
1738
1746
  */
1739
1747
  Calendar.prototype._handleFocus = function (oEvent) {
1740
1748
 
1741
- var oDate = CalendarDate.fromLocalJSDate(oEvent.getParameter("date"), this._getPrimaryCalendarType()),
1749
+ var oDate = CalendarDate.fromLocalJSDate(oEvent.getParameter("date"), this.getPrimaryCalendarType()),
1742
1750
  bOtherMonth = oEvent.getParameter("otherMonth"),
1743
1751
  bRestoreOldDate = oEvent.getParameter("restoreOldDate");
1744
1752
 
@@ -1779,14 +1787,14 @@ sap.ui.define([
1779
1787
  aMonths = this.getAggregation("month"),
1780
1788
  oMonth,
1781
1789
  oMonthDate,
1782
- oFirstDate = _determineFirstMonthDate.call(this, new CalendarDate(oDate, this._getPrimaryCalendarType())),
1790
+ oFirstDate = _determineFirstMonthDate.call(this, new CalendarDate(oDate, this.getPrimaryCalendarType())),
1783
1791
  i = 0,
1784
1792
  bMonthContainsDate = aMonths[0].checkDateFocusable(oDate.toLocalJSDate()),
1785
1793
  bFireStartDateChange = !bNoEvent && !bMonthContainsDate;
1786
1794
 
1787
1795
  for (i = 0; i < aMonths.length; i++) {
1788
1796
  oMonth = aMonths[i];
1789
- oMonthDate = new CalendarDate(oFirstDate, this._getPrimaryCalendarType());
1797
+ oMonthDate = new CalendarDate(oFirstDate, this.getPrimaryCalendarType());
1790
1798
  oMonthDate.setMonth(oFirstDate.getMonth() + i);
1791
1799
  if (!bSkipFocus && CalendarUtils._isSameMonthAndYear(oMonthDate, oDate)) {
1792
1800
  oMonth.setDate(oDate.toLocalJSDate());
@@ -1989,7 +1997,7 @@ sap.ui.define([
1989
1997
  var sText;
1990
1998
  var sYear;
1991
1999
  var sPattern;
1992
- var sPrimaryCalendarType = this._getPrimaryCalendarType();
2000
+ var sPrimaryCalendarType = this.getPrimaryCalendarType();
1993
2001
  var sSecondaryCalendarType = this._getSecondaryCalendarType();
1994
2002
  var sSecondaryMonthInfo = "";
1995
2003
 
@@ -2101,7 +2109,7 @@ sap.ui.define([
2101
2109
 
2102
2110
  if (aMonths.length > 1 && oMonthDate) {
2103
2111
  // for more than one month - re-render same months (if already rendered once)
2104
- oCalDate = CalendarDate.fromLocalJSDate(oMonthDate, this._getPrimaryCalendarType());
2112
+ oCalDate = CalendarDate.fromLocalJSDate(oMonthDate, this.getPrimaryCalendarType());
2105
2113
  } else if (aMonths.length > 1) {
2106
2114
  oCalDate = _determineFirstMonthDate.call(this, this._getFocusedDate());
2107
2115
  } else {
@@ -2130,19 +2138,23 @@ sap.ui.define([
2130
2138
  };
2131
2139
 
2132
2140
  Calendar.prototype._selectMonth = function () {
2133
- var oFocusedDate = new CalendarDate(this._getFocusedDate(), this._getPrimaryCalendarType()),
2141
+ var oFocusedDate = new CalendarDate(this._getFocusedDate(), this.getPrimaryCalendarType()),
2134
2142
  oMonthPicker = this._getMonthPicker(),
2135
2143
  iFocusedMonth = oMonthPicker.getProperty("_focusedMonth"),
2136
2144
  iMonth = (iFocusedMonth || iFocusedMonth === 0) ? iFocusedMonth : oMonthPicker.getMonth(),
2137
- oSecondDate = oMonthPicker._iYear ?
2138
- new CalendarDate(oMonthPicker._iYear, iMonth - 1, 1) :
2145
+ oSecondCalDate = CalendarDate.fromLocalJSDate(UI5Date.getInstance(), this.getPrimaryCalendarType());
2146
+
2147
+ oSecondCalDate = oMonthPicker._iYear ?
2148
+ oSecondCalDate
2149
+ .setYear(oMonthPicker._iYear)
2150
+ .setMonth(iMonth - 1, 1) :
2139
2151
  new CalendarDate(this._getFocusedDate().getYear(), iMonth - 1, 1);
2140
2152
 
2141
2153
  if (_getMonths.call(this) > 1) {
2142
- if (this._bActionTriggeredFromSecondHeader && oSecondDate.getYear() >= CalendarUtils._minDate().getYear()) {
2143
- oFocusedDate.setYear(oSecondDate.getYear());
2144
- iMonth = oSecondDate.getMonth();
2145
- } else if (oFocusedDate.getYear() === CalendarUtils._maxDate().getYear() && iMonth === 11) {
2154
+ if (this._bActionTriggeredFromSecondHeader && oSecondCalDate.getYear() >= CalendarUtils._minDate(this.getPrimaryCalendarType()).getYear()) {
2155
+ oFocusedDate.setYear(oSecondCalDate.getYear());
2156
+ iMonth = oSecondCalDate.getMonth();
2157
+ } else if (oFocusedDate.getYear() === CalendarUtils._maxDate(this.getPrimaryCalendarType()).getYear() && iMonth === 11) {
2146
2158
  iMonth -= 1;
2147
2159
  }
2148
2160
  }
@@ -2175,10 +2187,10 @@ sap.ui.define([
2175
2187
  * @returns {void}
2176
2188
  */
2177
2189
  Calendar.prototype._selectYear = function () {
2178
- var oFocusedDate = new CalendarDate(this._getFocusedDate(), this._getPrimaryCalendarType()),
2190
+ var oFocusedDate = new CalendarDate(this._getFocusedDate(), this.getPrimaryCalendarType()),
2179
2191
  oFocusedMonth = oFocusedDate.getMonth(),
2180
2192
  oYearPicker = this._getYearPicker(),
2181
- oDate = CalendarDate.fromLocalJSDate(oYearPicker.getDate(), this._getPrimaryCalendarType());
2193
+ oDate = CalendarDate.fromLocalJSDate(oYearPicker.getDate(), this.getPrimaryCalendarType());
2182
2194
 
2183
2195
  // to keep day and month stable also for islamic date
2184
2196
  if (!this._bActionTriggeredFromSecondHeader){
@@ -2219,7 +2231,7 @@ sap.ui.define([
2219
2231
  var oYearRangePicker = this.getAggregation("yearRangePicker"),
2220
2232
  oHeader = this.getAggregation("header"),
2221
2233
  iRangeSize = oYearRangePicker.getRangeSize(),
2222
- sPrimaryCalendarType = this._getPrimaryCalendarType(),
2234
+ sPrimaryCalendarType = this.getPrimaryCalendarType(),
2223
2235
  oStartDate = CalendarDate.fromLocalJSDate(oYearRangePicker.getDate(), sPrimaryCalendarType),
2224
2236
  oEndDate = new CalendarDate(oStartDate.getYear() + iRangeSize - 1, 0, 1, sPrimaryCalendarType),
2225
2237
  oFocusedDate = this._getFocusedDate(),
@@ -2228,9 +2240,9 @@ sap.ui.define([
2228
2240
  oFocusedDate.setYear(oStartDate.getYear() + iRangeSize / 2);
2229
2241
  oStartDate.setMonth(0, 1); // always use the first of the month to have stable year in Japanese calendar
2230
2242
  if (oFocusedDate.isBefore(this._oMinDate)) {
2231
- oFocusedDate = new CalendarDate(this._oMinDate, this._getPrimaryCalendarType());
2243
+ oFocusedDate = new CalendarDate(this._oMinDate, this.getPrimaryCalendarType());
2232
2244
  } else if (oFocusedDate.isAfter(this._oMaxDate)){
2233
- oFocusedDate = new CalendarDate(this._oMaxDate, this._getPrimaryCalendarType());
2245
+ oFocusedDate = new CalendarDate(this._oMaxDate, this.getPrimaryCalendarType());
2234
2246
  }
2235
2247
  this._setFocusedDate(oFocusedDate);
2236
2248
 
@@ -2247,7 +2259,7 @@ sap.ui.define([
2247
2259
  Calendar.prototype._showYearRangePicker = function () {
2248
2260
  var oYearRangePicker = this.getAggregation("yearRangePicker"),
2249
2261
  oYearPicker = this._getYearPicker(),
2250
- oRangeMidDate = CalendarDate.fromLocalJSDate(oYearPicker.getFirstRenderedDate(), this._getPrimaryCalendarType());
2262
+ oRangeMidDate = CalendarDate.fromLocalJSDate(oYearPicker.getFirstRenderedDate(), this.getPrimaryCalendarType());
2251
2263
 
2252
2264
  this.setProperty("_currentPicker", CURRENT_PICKERS.YEAR_RANGE_PICKER);
2253
2265
 
@@ -2431,14 +2443,14 @@ sap.ui.define([
2431
2443
  oSecondMonthHeader = this.getAggregation("secondMonthHeader"),
2432
2444
  sFirstHeaderText = sFirstHeaderYear,
2433
2445
  sSecondHeaderText = sSecondHeaderYear || sFirstHeaderYear,
2434
- sPrimaryCalendarType = this._getPrimaryCalendarType();
2446
+ sPrimaryCalendarType = this.getPrimaryCalendarType();
2435
2447
 
2436
2448
  if (this._iMode === 2 && oYearPicker) {
2437
2449
 
2438
2450
  var oDate = oYearPicker.getProperty("_middleDate") ? oYearPicker.getProperty("_middleDate") : oYearPicker._getDate(),
2439
2451
  oFirstDate = new CalendarDate(oDate, sPrimaryCalendarType),
2440
- oMinYear = CalendarUtils._minDate(this._getPrimaryCalendarType()).getYear(),
2441
- oMaxYear = CalendarUtils._maxDate(this._getPrimaryCalendarType()).getYear(),
2452
+ oMinYear = CalendarUtils._minDate(this.getPrimaryCalendarType()).getYear(),
2453
+ oMaxYear = CalendarUtils._maxDate(this.getPrimaryCalendarType()).getYear(),
2442
2454
  oSecondDate,
2443
2455
  sFirstYear,
2444
2456
  sSecondYear;
@@ -2481,21 +2493,25 @@ sap.ui.define([
2481
2493
  };
2482
2494
 
2483
2495
  Calendar.prototype._adjustYearRangeDisplay = function() {
2484
- var oYearRangePicker = this.getAggregation("yearRangePicker");
2496
+ var oYearRangePicker = this.getAggregation("yearRangePicker"),
2497
+ sLang = sap.ui.getCore().getConfiguration().getLanguage().toLocaleLowerCase(),
2498
+ sPrimaryCalendarType = this.getPrimaryCalendarType();
2485
2499
 
2486
2500
  if (!this._getSucessorsPickerPopup()) {
2487
- switch (this._getPrimaryCalendarType()) {
2488
- case CalendarType.Japanese:
2489
- oYearRangePicker.setColumns(1);
2490
- oYearRangePicker.setYears(4);
2491
- break;
2492
- case CalendarType.Gregorian:
2493
- oYearRangePicker.setColumns(3);
2494
- oYearRangePicker.setYears(9);
2495
- break;
2496
- default:
2497
- oYearRangePicker.setColumns(2);
2498
- oYearRangePicker.setYears(8);
2501
+ // An evaluation about the count of year cells that could fit in the sap.ui.unified.calendar.YearRangePicker
2502
+ // has to be made based not only on the sap.ui.core.CalendarType, but also on the language configuration.
2503
+ // Based on those two criteria a couple of groups with different year cells count would be indicated and we
2504
+ // could cover those scenarios with visual tests afterwards. Currently only the scenario with korean language
2505
+ // is covered.
2506
+ if (sPrimaryCalendarType == CalendarType.Japanese) {
2507
+ oYearRangePicker.setColumns(1);
2508
+ oYearRangePicker.setYears(4);
2509
+ } else if (sLang == "ko" || sLang == "ko-kr" || sPrimaryCalendarType != CalendarType.Gregorian) {
2510
+ oYearRangePicker.setColumns(2);
2511
+ oYearRangePicker.setYears(8);
2512
+ } else if (sPrimaryCalendarType == CalendarType.Gregorian) {
2513
+ oYearRangePicker.setColumns(3);
2514
+ oYearRangePicker.setYears(9);
2499
2515
  }
2500
2516
  }
2501
2517
  };
@@ -2531,7 +2547,7 @@ sap.ui.define([
2531
2547
  function _determineFocusedDate(){
2532
2548
 
2533
2549
  var aSelectedDates = this.getSelectedDates();
2534
- var sCalendarType = this._getPrimaryCalendarType();
2550
+ var sCalendarType = this.getPrimaryCalendarType();
2535
2551
  if (aSelectedDates && aSelectedDates[0] && aSelectedDates[0].getStartDate()) {
2536
2552
  // selected dates are provided -> use first one to focus
2537
2553
  this._oFocusedDate = CalendarDate.fromLocalJSDate(aSelectedDates[0].getStartDate(), sCalendarType);
@@ -2650,7 +2666,7 @@ sap.ui.define([
2650
2666
  */
2651
2667
  function _determineFirstMonthDate(oDate){
2652
2668
 
2653
- var oFirstDate = new CalendarDate(oDate, this._getPrimaryCalendarType());
2669
+ var oFirstDate = new CalendarDate(oDate, this.getPrimaryCalendarType());
2654
2670
  oFirstDate.setDate(1);
2655
2671
 
2656
2672
  var iMonths = _getMonths.call(this); // to use validation
@@ -2688,7 +2704,7 @@ sap.ui.define([
2688
2704
  oDate;
2689
2705
 
2690
2706
  if (aMonths.length > 1) {
2691
- oDate = CalendarDate.fromLocalJSDate(aMonths[0].getDate(), this._getPrimaryCalendarType());
2707
+ oDate = CalendarDate.fromLocalJSDate(aMonths[0].getDate(), this.getPrimaryCalendarType());
2692
2708
  } else {
2693
2709
  oDate = this._getFocusedDate();
2694
2710
  }
@@ -2709,7 +2725,7 @@ sap.ui.define([
2709
2725
  function _displayDate(oDate, bSkipFocus) {
2710
2726
 
2711
2727
  var oCalDate,
2712
- sPrimaryCalendarType = this._getPrimaryCalendarType(),
2728
+ sPrimaryCalendarType = this.getPrimaryCalendarType(),
2713
2729
  iYear;
2714
2730
 
2715
2731
  if (!oDate) {
@@ -5,8 +5,30 @@
5
5
  */
6
6
 
7
7
  // Provides control sap.ui.unified.CalendarAppointment.
8
- sap.ui.define(['./DateTypeRange', 'sap/ui/core/format/DateFormat', 'sap/ui/core/format/NumberFormat', 'sap/ui/core/format/TimezoneUtil', 'sap/ui/core/Core', './calendar/CalendarUtils', './library', "sap/base/Log", "sap/ui/core/Configuration"],
9
- function(DateTypeRange, DateFormat, NumberFormat, TimezoneUtil, Core, CalendarUtils, library, Log, Configuration) {
8
+ sap.ui.define([
9
+ './DateTypeRange',
10
+ 'sap/ui/core/format/DateFormat',
11
+ 'sap/ui/core/format/NumberFormat',
12
+ 'sap/ui/core/format/TimezoneUtil',
13
+ 'sap/ui/core/Core',
14
+ './calendar/CalendarUtils',
15
+ './library',
16
+ "sap/base/Log",
17
+ "sap/ui/core/Configuration",
18
+ "sap/ui/core/date/UI5Date"
19
+ ],
20
+ function(
21
+ DateTypeRange,
22
+ DateFormat,
23
+ NumberFormat,
24
+ TimezoneUtil,
25
+ Core,
26
+ CalendarUtils,
27
+ library,
28
+ Log,
29
+ Configuration,
30
+ UI5Date
31
+ ) {
10
32
  "use strict";
11
33
 
12
34
  /**
@@ -21,7 +43,7 @@ sap.ui.define(['./DateTypeRange', 'sap/ui/core/format/DateFormat', 'sap/ui/core/
21
43
  *
22
44
  * Applications could inherit from this element to add own fields.
23
45
  * @extends sap.ui.unified.DateTypeRange
24
- * @version 1.111.6
46
+ * @version 1.112.1
25
47
  *
26
48
  * @constructor
27
49
  * @public
@@ -124,12 +146,12 @@ sap.ui.define(['./DateTypeRange', 'sap/ui/core/format/DateFormat', 'sap/ui/core/
124
146
  * @private
125
147
  */
126
148
  CalendarAppointment.prototype._getDateRangeIntersectionText = function (oCurrentlyDisplayedDate) {
127
- var oStartDate = this._getStartDateWithTimezoneAdaptation(),
128
- oEndDate = this._getEndDateWithTimezoneAdaptation() ? this._getEndDateWithTimezoneAdaptation() : new Date(864000000000000), //in case of emergency call this number
149
+ var oStartDate = this.getStartDate(),
150
+ oEndDate = this.getEndDate() ? this.getEndDate() : UI5Date.getInstance(864000000000000), //in case of emergency call this number
129
151
  sFirstLineText,
130
152
  sSecondLineText,
131
- oCurrentDayStart = new Date(oCurrentlyDisplayedDate.getFullYear(), oCurrentlyDisplayedDate.getMonth(), oCurrentlyDisplayedDate.getDate(), 0, 0, 0),
132
- oNextDayStart = new Date(oCurrentDayStart.getFullYear(), oCurrentDayStart.getMonth(), oCurrentDayStart.getDate() + 1),
153
+ oCurrentDayStart = UI5Date.getInstance(oCurrentlyDisplayedDate.getFullYear(), oCurrentlyDisplayedDate.getMonth(), oCurrentlyDisplayedDate.getDate(), 0, 0, 0),
154
+ oNextDayStart = UI5Date.getInstance(oCurrentDayStart.getFullYear(), oCurrentDayStart.getMonth(), oCurrentDayStart.getDate() + 1),
133
155
  oTimeFormat = DateFormat.getTimeInstance({pattern: "HH:mm"}),
134
156
  oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.m"),
135
157
  oHourFormat = NumberFormat.getUnitInstance({
@@ -180,14 +202,14 @@ sap.ui.define(['./DateTypeRange', 'sap/ui/core/format/DateFormat', 'sap/ui/core/
180
202
  */
181
203
  CalendarAppointment._getComparer = function(oDate) {
182
204
  var ONE_DAY = 24 * 60 * 60 * 1000,
183
- iCurrentDayStartTime = new Date(oDate.getFullYear(), oDate.getMonth(), oDate.getDate(), 0, 0, 0).getTime(),
205
+ iCurrentDayStartTime = UI5Date.getInstance(oDate.getFullYear(), oDate.getMonth(), oDate.getDate(), 0, 0, 0).getTime(),
184
206
  iNextDayStart = iCurrentDayStartTime + ONE_DAY;
185
207
 
186
208
  return function(oAppInfo1, oAppInfo2) {
187
- var iStartDateTime1 = oAppInfo1.appointment._getStartDateWithTimezoneAdaptation().getTime(),
188
- iStartDateTime2 = oAppInfo2.appointment._getStartDateWithTimezoneAdaptation().getTime(),
189
- iEndDateTime1 = oAppInfo1.appointment._getEndDateWithTimezoneAdaptation() ? oAppInfo1.appointment._getEndDateWithTimezoneAdaptation().getTime() : 864000000000000, //this is max date in case of no max date
190
- iEndDateTime2 = oAppInfo2.appointment._getEndDateWithTimezoneAdaptation() ? oAppInfo2.appointment._getEndDateWithTimezoneAdaptation().getTime() : 864000000000000,
209
+ var iStartDateTime1 = oAppInfo1.appointment.getStartDate().getTime(),
210
+ iStartDateTime2 = oAppInfo2.appointment.getStartDate().getTime(),
211
+ iEndDateTime1 = oAppInfo1.appointment.getEndDate() ? oAppInfo1.appointment.getEndDate().getTime() : 864000000000000, //this is max date in case of no max date
212
+ iEndDateTime2 = oAppInfo2.appointment.getEndDate() ? oAppInfo2.appointment.getEndDate().getTime() : 864000000000000,
191
213
  bWholeDay1 = iStartDateTime1 <= iCurrentDayStartTime && iEndDateTime1 >= iNextDayStart,
192
214
  bWholeDay2 = iStartDateTime2 <= iCurrentDayStartTime && iEndDateTime2 >= iNextDayStart,
193
215
  iResult;
@@ -252,42 +274,6 @@ sap.ui.define(['./DateTypeRange', 'sap/ui/core/format/DateFormat', 'sap/ui/core/
252
274
  return oAppointmentParts.length > 0 ? oAppointmentParts[0] : null;
253
275
  };
254
276
 
255
- CalendarAppointment.prototype._getEndDateWithTimezoneAdaptation = function() {
256
- if (!this.getProperty("endDate")) {
257
- return null;
258
- }
259
-
260
- var oEndDate = this._convertToTimezone(this.getEndDate());
261
-
262
- return oEndDate;
263
- };
264
-
265
- CalendarAppointment.prototype._getStartDateWithTimezoneAdaptation = function() {
266
- if (!this.getProperty("startDate")) {
267
- return null;
268
- }
269
-
270
- var oStartDate = this._convertToTimezone(this.getStartDate());
271
-
272
- return oStartDate;
273
- };
274
-
275
- /**
276
- * Aligns a date to the timezone from the configuration.
277
- *
278
- * @returns {Object} <code>oNewDate</code> aligned to the configured timezone.
279
- * @private
280
- */
281
- CalendarAppointment.prototype._convertToTimezone = function(oDate) {
282
- var sConfigTimezone = Core.getConfiguration().getTimezone();
283
- var sLocalTimezone = TimezoneUtil.getLocalTimezone();
284
-
285
- var iConfigOffsetMillis = TimezoneUtil.calculateOffset(oDate, sConfigTimezone) * 1000;
286
- var iLocalOffsetMillis = TimezoneUtil.calculateOffset(oDate, sLocalTimezone) * 1000;
287
-
288
- return new Date(oDate.getTime() - iConfigOffsetMillis + iLocalOffsetMillis);
289
- };
290
-
291
277
  return CalendarAppointment;
292
278
 
293
279
  });
@@ -21,7 +21,9 @@ sap.ui.define([
21
21
  "sap/ui/core/CalendarType",
22
22
  "sap/ui/core/Core",
23
23
  "sap/base/Log",
24
- "./DateRange"
24
+ "./DateRange",
25
+ "sap/ui/core/date/UI5Date"
26
+
25
27
  ], function(
26
28
  CalendarUtils,
27
29
  Calendar,
@@ -38,7 +40,8 @@ sap.ui.define([
38
40
  CalendarType,
39
41
  Core,
40
42
  Log,
41
- DateRange
43
+ DateRange,
44
+ UI5Date
42
45
  ) {
43
46
  "use strict";
44
47
 
@@ -56,7 +59,7 @@ sap.ui.define([
56
59
  * @class
57
60
  * <code>CalendarDateInterval</code> only visualizes the dates in a one-line interval and allows the selection of a single day.
58
61
  * @extends sap.ui.unified.Calendar
59
- * @version 1.111.6
62
+ * @version 1.112.1
60
63
  *
61
64
  * @constructor
62
65
  * @public
@@ -321,7 +324,7 @@ sap.ui.define([
321
324
  sAriaLabel = oTexts.sAriaLabel,
322
325
  oHeader = this.getAggregation("header");
323
326
  var oLocaleData = this._getLocaleData();
324
- var oEndDate = CalendarDate.fromLocalJSDate(new Date(oDate.toLocalJSDate().getTime() + (this._getDays() - 1) * 24 * 60 * 60 * 1000), this.getPrimaryCalendarType());
327
+ var oEndDate = CalendarDate.fromLocalJSDate(UI5Date.getInstance(oDate.toLocalJSDate().getTime() + (this._getDays() - 1) * 24 * 60 * 60 * 1000), this.getPrimaryCalendarType());
325
328
  oEndDate.setDate(1); // always use the first of the month to have stable year in Japanese calendar
326
329
  var sDelimiter = oLocaleData.getIntervalPattern().replace("{0}", "").replace("{1}", "");
327
330
  var sEndYear = this._oYearFormat.format(oEndDate.toUTCJSDate(), true);
@@ -352,7 +355,7 @@ sap.ui.define([
352
355
  var oStartDate = this.getStartDate(),
353
356
  oCalPicker = this._getCalendar(),
354
357
  oSelectedRange = new DateRange(),
355
- oEndDate = new Date(oStartDate.getTime());
358
+ oEndDate = UI5Date.getInstance(oStartDate.getTime());
356
359
 
357
360
  oEndDate.setDate(oEndDate.getDate() + this._getDays() - 1);
358
361
  oSelectedRange.setStartDate(oStartDate);
@@ -432,13 +435,13 @@ sap.ui.define([
432
435
  var oMinDate = this.getMinDate();
433
436
  if (oMinDate && oStartDate.getTime() < oMinDate.getTime()) {
434
437
  Log.warning("startDate < minDate -> minDate as startDate set", this);
435
- oStartDate = new Date(oMinDate.getTime());
438
+ oStartDate = UI5Date.getInstance(oMinDate.getTime());
436
439
  }
437
440
 
438
441
  var oMaxDate = this.getMaxDate();
439
442
  if (oMaxDate && oStartDate.getTime() > oMaxDate.getTime()) {
440
443
  Log.warning("startDate > maxDate -> maxDate as startDate set", this);
441
- oStartDate = new Date(oMaxDate.getTime());
444
+ oStartDate = UI5Date.getInstance(oMaxDate.getTime());
442
445
  }
443
446
 
444
447
  this.setProperty("startDate", oStartDate, true);
@@ -56,7 +56,7 @@ sap.ui.define([
56
56
  * @extends sap.ui.core.Control
57
57
  *
58
58
  * @author SAP SE
59
- * @version 1.111.6
59
+ * @version 1.112.1
60
60
  *
61
61
  * @constructor
62
62
  * @public
@@ -21,7 +21,7 @@ sap.ui.define(['sap/ui/core/Element', './library'],
21
21
  * @class
22
22
  * Item to be displayed in a CalendarLegend.
23
23
  * @extends sap.ui.core.Element
24
- * @version 1.111.6
24
+ * @version 1.112.1
25
25
  *
26
26
  * @constructor
27
27
  * @public