@openui5/sap.ui.unified 1.144.0 → 1.146.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.
- package/REUSE.toml +40 -16
- package/THIRDPARTY.txt +28 -7
- package/package.json +2 -2
- package/src/sap/ui/unified/.library +1 -1
- package/src/sap/ui/unified/Calendar.js +67 -18
- package/src/sap/ui/unified/CalendarAppointment.js +1 -1
- package/src/sap/ui/unified/CalendarDateInterval.js +68 -13
- package/src/sap/ui/unified/CalendarDateIntervalRenderer.js +13 -0
- package/src/sap/ui/unified/CalendarLegend.js +1 -1
- package/src/sap/ui/unified/CalendarLegendItem.js +1 -1
- package/src/sap/ui/unified/CalendarMonthInterval.js +1 -1
- package/src/sap/ui/unified/CalendarOneMonthInterval.js +1 -1
- package/src/sap/ui/unified/CalendarRow.js +6 -1
- package/src/sap/ui/unified/CalendarRowRenderer.js +2 -1
- package/src/sap/ui/unified/CalendarTimeInterval.js +60 -6
- package/src/sap/ui/unified/CalendarTimeIntervalRenderer.js +1 -1
- package/src/sap/ui/unified/CalendarWeekInterval.js +1 -1
- package/src/sap/ui/unified/ColorPicker.js +1 -1
- package/src/sap/ui/unified/ColorPickerPopover.js +1 -1
- package/src/sap/ui/unified/ContentSwitcher.js +1 -1
- package/src/sap/ui/unified/Currency.js +1 -1
- package/src/sap/ui/unified/CurrencyRenderer.js +1 -1
- package/src/sap/ui/unified/DateRange.js +1 -1
- package/src/sap/ui/unified/DateTypeRange.js +1 -1
- package/src/sap/ui/unified/FileUploader.js +26 -32
- package/src/sap/ui/unified/FileUploaderHttpRequestMethod.js +14 -0
- package/src/sap/ui/unified/FileUploaderParameter.js +1 -1
- package/src/sap/ui/unified/FileUploaderRenderer.js +0 -9
- package/src/sap/ui/unified/FileUploaderXHRSettings.js +1 -1
- package/src/sap/ui/unified/Menu.js +1 -1
- package/src/sap/ui/unified/MenuItem.js +1 -1
- package/src/sap/ui/unified/MenuItemBase.js +1 -1
- package/src/sap/ui/unified/MenuItemGroup.js +1 -1
- package/src/sap/ui/unified/MenuRenderer.js +1 -1
- package/src/sap/ui/unified/MenuTextFieldItem.js +1 -1
- package/src/sap/ui/unified/NonWorkingPeriod.js +1 -1
- package/src/sap/ui/unified/RecurringNonWorkingPeriod.js +1 -1
- package/src/sap/ui/unified/Shell.js +1 -1
- package/src/sap/ui/unified/ShellHeadItem.js +1 -1
- package/src/sap/ui/unified/ShellHeadUserItem.js +1 -1
- package/src/sap/ui/unified/ShellLayout.js +1 -1
- package/src/sap/ui/unified/ShellOverlay.js +1 -1
- package/src/sap/ui/unified/SplitContainer.js +1 -1
- package/src/sap/ui/unified/TimeRange.js +1 -1
- package/src/sap/ui/unified/calendar/CalendarUtils.js +17 -0
- package/src/sap/ui/unified/calendar/DatesRow.js +1 -1
- package/src/sap/ui/unified/calendar/DatesRowRenderer.js +0 -38
- package/src/sap/ui/unified/calendar/Header.js +1 -1
- package/src/sap/ui/unified/calendar/IndexPicker.js +1 -1
- package/src/sap/ui/unified/calendar/Month.js +1 -1
- package/src/sap/ui/unified/calendar/MonthPicker.js +1 -1
- package/src/sap/ui/unified/calendar/MonthPickerRenderer.js +1 -1
- package/src/sap/ui/unified/calendar/MonthRenderer.js +28 -8
- package/src/sap/ui/unified/calendar/MonthsRow.js +9 -2
- package/src/sap/ui/unified/calendar/MonthsRowRenderer.js +4 -1
- package/src/sap/ui/unified/calendar/OneMonthDatesRow.js +1 -1
- package/src/sap/ui/unified/calendar/RecurrenceUtils.js +4 -1
- package/src/sap/ui/unified/calendar/TimesRow.js +1 -1
- package/src/sap/ui/unified/calendar/WeeksRow.js +219 -0
- package/src/sap/ui/unified/calendar/WeeksRowRenderer.js +114 -0
- package/src/sap/ui/unified/calendar/YearPicker.js +1 -1
- package/src/sap/ui/unified/calendar/YearRangePicker.js +1 -1
- package/src/sap/ui/unified/library.js +2 -2
- package/src/sap/ui/unified/messagebundle.properties +3 -0
- package/src/sap/ui/unified/messagebundle_ar.properties +48 -6
- package/src/sap/ui/unified/messagebundle_bg.properties +48 -6
- package/src/sap/ui/unified/messagebundle_ca.properties +48 -6
- package/src/sap/ui/unified/messagebundle_cnr.properties +48 -6
- package/src/sap/ui/unified/messagebundle_cs.properties +48 -6
- package/src/sap/ui/unified/messagebundle_cy.properties +48 -6
- package/src/sap/ui/unified/messagebundle_da.properties +49 -7
- package/src/sap/ui/unified/messagebundle_de.properties +51 -9
- package/src/sap/ui/unified/messagebundle_el.properties +48 -6
- package/src/sap/ui/unified/messagebundle_en.properties +48 -6
- package/src/sap/ui/unified/messagebundle_en_GB.properties +48 -6
- package/src/sap/ui/unified/messagebundle_en_US_saprigi.properties +48 -6
- package/src/sap/ui/unified/messagebundle_es.properties +48 -6
- package/src/sap/ui/unified/messagebundle_es_MX.properties +55 -13
- package/src/sap/ui/unified/messagebundle_et.properties +48 -6
- package/src/sap/ui/unified/messagebundle_fi.properties +48 -6
- package/src/sap/ui/unified/messagebundle_fr.properties +48 -6
- package/src/sap/ui/unified/messagebundle_fr_CA.properties +48 -6
- package/src/sap/ui/unified/messagebundle_hi.properties +48 -6
- package/src/sap/ui/unified/messagebundle_hr.properties +48 -6
- package/src/sap/ui/unified/messagebundle_hu.properties +48 -6
- package/src/sap/ui/unified/messagebundle_id.properties +48 -6
- package/src/sap/ui/unified/messagebundle_it.properties +48 -6
- package/src/sap/ui/unified/messagebundle_iw.properties +48 -6
- package/src/sap/ui/unified/messagebundle_ja.properties +48 -6
- package/src/sap/ui/unified/messagebundle_kk.properties +48 -6
- package/src/sap/ui/unified/messagebundle_ko.properties +48 -6
- package/src/sap/ui/unified/messagebundle_lt.properties +52 -10
- package/src/sap/ui/unified/messagebundle_lv.properties +48 -6
- package/src/sap/ui/unified/messagebundle_mk.properties +48 -6
- package/src/sap/ui/unified/messagebundle_ms.properties +48 -6
- package/src/sap/ui/unified/messagebundle_nl.properties +48 -6
- package/src/sap/ui/unified/messagebundle_no.properties +48 -6
- package/src/sap/ui/unified/messagebundle_pl.properties +48 -6
- package/src/sap/ui/unified/messagebundle_pt.properties +48 -6
- package/src/sap/ui/unified/messagebundle_pt_PT.properties +48 -6
- package/src/sap/ui/unified/messagebundle_ro.properties +48 -6
- package/src/sap/ui/unified/messagebundle_ru.properties +48 -6
- package/src/sap/ui/unified/messagebundle_sh.properties +48 -6
- package/src/sap/ui/unified/messagebundle_sk.properties +48 -6
- package/src/sap/ui/unified/messagebundle_sl.properties +48 -6
- package/src/sap/ui/unified/messagebundle_sr.properties +48 -6
- package/src/sap/ui/unified/messagebundle_sv.properties +48 -6
- package/src/sap/ui/unified/messagebundle_th.properties +48 -6
- package/src/sap/ui/unified/messagebundle_tr.properties +48 -6
- package/src/sap/ui/unified/messagebundle_uk.properties +51 -9
- package/src/sap/ui/unified/messagebundle_vi.properties +50 -8
- package/src/sap/ui/unified/messagebundle_zh_CN.properties +48 -6
- package/src/sap/ui/unified/messagebundle_zh_TW.properties +48 -6
- package/src/sap/ui/unified/themes/base/Calendar.less +148 -38
- package/src/sap/ui/unified/themes/base/CalendarDateInterval.less +13 -1
- package/src/sap/ui/unified/themes/base/CalendarTimeInterval.less +17 -0
- package/src/sap/ui/unified/themes/base/FileUploader.less +25 -1
- package/src/sap/ui/unified/themes/base/IndexPicker.less +13 -8
- package/src/sap/ui/unified/themes/sap_hcb/base_Calendar.less +2 -1
|
@@ -266,6 +266,23 @@ sap.ui.define([
|
|
|
266
266
|
return oNewDate;
|
|
267
267
|
};
|
|
268
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Gets the final day of a specified month.
|
|
271
|
+
* This function processes date values in UTC to produce timezone agnostic results.
|
|
272
|
+
*
|
|
273
|
+
* @param {Date|module:sap/ui/core/date/UI5Date} oDate date instance
|
|
274
|
+
* @returns {Date|module:sap/ui/core/date/UI5Date} date instance corresponding to the last date of the month
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
CalendarUtils.getLastDateOfMonth = function(oDate) {
|
|
278
|
+
const oNewDate = new UniversalDate(oDate.getTime());
|
|
279
|
+
oNewDate.setDate(1);
|
|
280
|
+
oNewDate.setMonth(oNewDate.getMonth() + 1);
|
|
281
|
+
oNewDate.setDate(oNewDate.getDate() - 1);
|
|
282
|
+
|
|
283
|
+
return oNewDate;
|
|
284
|
+
};
|
|
285
|
+
|
|
269
286
|
/**
|
|
270
287
|
* Calculates the number of weeks for a given year using the current locale settings
|
|
271
288
|
* @param {int} iYear The target year of interest in format (YYYY)
|
|
@@ -39,7 +39,7 @@ sap.ui.define([
|
|
|
39
39
|
* If used inside the calendar the properties and aggregation are directly taken from the parent
|
|
40
40
|
* (To not duplicate and sync DateRanges and so on...)
|
|
41
41
|
* @extends sap.ui.unified.calendar.Month
|
|
42
|
-
* @version 1.
|
|
42
|
+
* @version 1.146.0
|
|
43
43
|
*
|
|
44
44
|
* @constructor
|
|
45
45
|
* @public
|
|
@@ -52,7 +52,6 @@ sap.ui.define(["sap/base/i18n/date/CalendarType", "sap/ui/core/Lib", 'sap/ui/cor
|
|
|
52
52
|
DatesRowRenderer.renderCustomIntervals(oRm, oDatesRow);
|
|
53
53
|
} else {
|
|
54
54
|
MonthRenderer.renderMonth.apply(this, arguments);
|
|
55
|
-
this.renderWeekNumbers(oRm, oDatesRow);
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
|
|
@@ -91,43 +90,6 @@ sap.ui.define(["sap/base/i18n/date/CalendarType", "sap/ui/core/Lib", 'sap/ui/cor
|
|
|
91
90
|
oRm.close("div");
|
|
92
91
|
};
|
|
93
92
|
|
|
94
|
-
/**
|
|
95
|
-
* Renders the week numbers in their own container.
|
|
96
|
-
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer
|
|
97
|
-
* @param {sap.ui.unified.calendar.DatesRow} oDatesRow The row which will be rendered
|
|
98
|
-
* @since 1.52
|
|
99
|
-
*/
|
|
100
|
-
DatesRowRenderer.renderWeekNumbers = function (oRm, oDatesRow) {
|
|
101
|
-
var oResourceBundle,
|
|
102
|
-
iDays,
|
|
103
|
-
iDaysWidth,
|
|
104
|
-
aWeekNumbers;
|
|
105
|
-
|
|
106
|
-
if (oDatesRow.getShowWeekNumbers() && oDatesRow._getPrimaryCalendarType() === CalendarType.Gregorian) {
|
|
107
|
-
oResourceBundle = Library.getResourceBundleFor("sap.ui.unified");
|
|
108
|
-
|
|
109
|
-
oRm.openStart("div", oDatesRow.getId() + "-weeks");
|
|
110
|
-
oRm.class("sapUiCalRowWeekNumbers");
|
|
111
|
-
oRm.openEnd();
|
|
112
|
-
|
|
113
|
-
iDays = oDatesRow.getDays();
|
|
114
|
-
iDaysWidth = 100 / iDays;
|
|
115
|
-
aWeekNumbers = oDatesRow.getWeekNumbers();
|
|
116
|
-
|
|
117
|
-
aWeekNumbers.forEach(function(oWeek) {
|
|
118
|
-
oRm.openStart("div", oDatesRow.getId() + "-week-" + oWeek.number + "-text");
|
|
119
|
-
oRm.class('sapUiCalRowWeekNumber');
|
|
120
|
-
oRm.style("width", oWeek.len * iDaysWidth + "%");
|
|
121
|
-
oRm.attr("data-sap-ui-week", oWeek.number);
|
|
122
|
-
oRm.openEnd();
|
|
123
|
-
oRm.text(oResourceBundle.getText('CALENDAR_DATES_ROW_WEEK_NUMBER', [oWeek.number]));
|
|
124
|
-
oRm.close("div");
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
oRm.close("div");
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
93
|
DatesRowRenderer.renderDummyCell = function() {};
|
|
132
94
|
|
|
133
95
|
/**
|
|
@@ -32,7 +32,7 @@ sap.ui.define([
|
|
|
32
32
|
* This control serves for picking an item from a grid with items which are relative periods in Plannig Calendar.
|
|
33
33
|
* This is used inside the sap.m.PlanningCalendar relative views. Not for stand alone usage.
|
|
34
34
|
* @extends sap.ui.core.Control
|
|
35
|
-
* @version 1.
|
|
35
|
+
* @version 1.146.0
|
|
36
36
|
*
|
|
37
37
|
* @constructor
|
|
38
38
|
* @private
|
|
@@ -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.
|
|
81
|
+
* @version 1.146.0
|
|
82
82
|
*
|
|
83
83
|
* @constructor
|
|
84
84
|
* @public
|
|
@@ -169,7 +169,7 @@ sap.ui.define(["sap/ui/core/Lib", "sap/ui/unified/calendar/CalendarDate", 'sap/u
|
|
|
169
169
|
|
|
170
170
|
oRm.close("div");
|
|
171
171
|
|
|
172
|
-
if (iColumns > 0 && ((i + 1) % iColumns === 0)) {
|
|
172
|
+
if (iColumns > 0 && (((i + 1) % iColumns === 0) || (i + 1) === iMonths)) {
|
|
173
173
|
// end of row
|
|
174
174
|
oRm.close("div");
|
|
175
175
|
}
|
|
@@ -422,11 +422,13 @@ sap.ui.define([
|
|
|
422
422
|
CalendarUtils._checkCalendarDate(oDay);
|
|
423
423
|
var oSecondaryDay = new CalendarDate(oDay, oHelper.sSecondaryCalendarType),
|
|
424
424
|
bSelectable = oMonth._getAriaRole() === "gridcell" && oMonth._getSelectableAccessibilitySemantics(),
|
|
425
|
+
sDayDescription = bSelectable ? oMonth._getDayDescription() : "",
|
|
426
|
+
sDayNameId = (!bDayName && iNumber >= 0) ? oHelper.sId + "-WH" + iNumber : "",
|
|
425
427
|
mAccProps = {
|
|
426
428
|
role: oMonth._getAriaRole(),
|
|
427
429
|
selected: bSelectable ? false : null,
|
|
428
430
|
label: "",
|
|
429
|
-
describedby:
|
|
431
|
+
describedby: `${sDayDescription} ${sDayNameId}`.trim() || ""
|
|
430
432
|
},
|
|
431
433
|
bBeforeFirstYear = oDay._bBeforeFirstYear,
|
|
432
434
|
sAriaType = "",
|
|
@@ -504,13 +506,31 @@ sap.ui.define([
|
|
|
504
506
|
mAccProps["describedby"] = `${mAccProps["describedby"]} ${sEndDateText}`.trim();
|
|
505
507
|
}
|
|
506
508
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
509
|
+
const oParent = oMonth.getParent();
|
|
510
|
+
const bShowWeekNumbers = oMonth.getShowWeekNumbers();
|
|
511
|
+
const bHasDate = !!oMonth._oDate;
|
|
512
|
+
const bSeparateWeekNumbers = bShowWeekNumbers && bHasDate && oParent &&
|
|
513
|
+
(oParent.isA("sap.m.PlanningCalendar") ||
|
|
514
|
+
oParent.isA("sap.ui.unified.CalendarDateInterval") ||
|
|
515
|
+
oParent.isA("sap.ui.unified.CalendarTimeInterval") ||
|
|
516
|
+
oParent.isA("sap.m.Toolbar"));
|
|
517
|
+
|
|
518
|
+
if (bSeparateWeekNumbers) {
|
|
519
|
+
// This path is for controls that render week numbers separately (e.g., CalendarDateInterval with WeeksRow)
|
|
520
|
+
let sParentId = oParent.getId();
|
|
521
|
+
|
|
522
|
+
// For Toolbar, we need to find the PlanningCalendar (Toolbar -> Table -> PlanningCalendar hierarchy)
|
|
523
|
+
const bIsToolbar = oParent.isA("sap.m.Toolbar");
|
|
524
|
+
const oGrandParent = bIsToolbar ? oParent.getParent() : null;
|
|
525
|
+
const oGreatGrandParent = oGrandParent ? oGrandParent.getParent() : null;
|
|
526
|
+
const bHasPlanningCalendar = oGreatGrandParent && oGreatGrandParent.isA("sap.m.PlanningCalendar");
|
|
527
|
+
|
|
528
|
+
if (bIsToolbar) {
|
|
529
|
+
sParentId = bHasPlanningCalendar ? oGreatGrandParent.getId() : oMonth.getId();
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
const iWeekNumber = oMonth._calculateWeekNumber(oDay);
|
|
533
|
+
mAccProps["describedby"] = mAccProps["describedby"] + " " + sParentId + "-WeekNumbersRow-week-" + iWeekNumber + "-text";
|
|
514
534
|
}
|
|
515
535
|
|
|
516
536
|
if (bNonWorking) {
|
|
@@ -68,7 +68,7 @@ sap.ui.define([
|
|
|
68
68
|
* The MontsRow works with UI5Date or JavaScript Date objects, but only the month and the year are used to display and interact.
|
|
69
69
|
* As representation for a month, the 1st of the month will always be returned in the API.
|
|
70
70
|
* @extends sap.ui.core.Control
|
|
71
|
-
* @version 1.
|
|
71
|
+
* @version 1.146.0
|
|
72
72
|
*
|
|
73
73
|
* @constructor
|
|
74
74
|
* @public
|
|
@@ -138,7 +138,14 @@ sap.ui.define([
|
|
|
138
138
|
* @private
|
|
139
139
|
* @since 1.139.0
|
|
140
140
|
*/
|
|
141
|
-
selectableAccessibilitySemantics : {type : "boolean", group : "Behavior", defaultValue : true, visibility: "hidden"}
|
|
141
|
+
selectableAccessibilitySemantics : {type : "boolean", group : "Behavior", defaultValue : true, visibility: "hidden"},
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Determines if the week numbers are displayed.
|
|
145
|
+
*
|
|
146
|
+
* @since 1.145.0
|
|
147
|
+
*/
|
|
148
|
+
showWeekNumbers : {type : "boolean", group : "Appearance", defaultValue : false}
|
|
142
149
|
},
|
|
143
150
|
aggregations : {
|
|
144
151
|
|
|
@@ -37,6 +37,10 @@ sap.ui.define(["sap/ui/core/Element", 'sap/ui/unified/calendar/CalendarUtils', '
|
|
|
37
37
|
oRm.class("sapUiCalMonthsRow");
|
|
38
38
|
oRm.class("sapUiCalRow");
|
|
39
39
|
|
|
40
|
+
if (oMonthsRow.getShowWeekNumbers()) {
|
|
41
|
+
oRm.class("sapUiCalRowWithWeekNumbers");
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
if (sTooltip) {
|
|
41
45
|
oRm.attr("title", sTooltip);
|
|
42
46
|
}
|
|
@@ -167,7 +171,6 @@ sap.ui.define(["sap/ui/core/Element", 'sap/ui/unified/calendar/CalendarUtils', '
|
|
|
167
171
|
this.renderMonth(oRm, oMonthsRow, oMonthDate, oHelper, sWidth);
|
|
168
172
|
oMonthDate.setMonth(oMonthDate.getMonth() + 1);
|
|
169
173
|
}
|
|
170
|
-
|
|
171
174
|
};
|
|
172
175
|
|
|
173
176
|
/**
|
|
@@ -44,12 +44,15 @@ sap.ui.define([
|
|
|
44
44
|
|
|
45
45
|
const oStartDate = UI5Date.getInstance(this.getStartDate());
|
|
46
46
|
const oCurrentDate = UI5Date.getInstance(oDate);
|
|
47
|
+
const oStartDateUTC = Date.UTC(oStartDate.getFullYear(), oStartDate.getMonth(), oStartDate.getDate());
|
|
48
|
+
const oCurrentDateUTC = Date.UTC(oCurrentDate.getFullYear(), oCurrentDate.getMonth(), oCurrentDate.getDate());
|
|
47
49
|
oStartDate.setHours(0,0,0,0);
|
|
48
50
|
oCurrentDate.setHours(0,0,0,0);
|
|
49
51
|
|
|
50
52
|
const iDayInMilliseconds = 24 * 60 * 60 * 1000;
|
|
51
53
|
const isDateInRange = oCurrentDate >= oStartDate && oCurrentDate <= this.getRecurrenceEndDate();
|
|
52
|
-
|
|
54
|
+
|
|
55
|
+
const isWithCorrectPattern = Math.floor((oCurrentDateUTC - oStartDateUTC) / iDayInMilliseconds) % this.getRecurrencePattern() === 0;
|
|
53
56
|
|
|
54
57
|
return isDateInRange && isWithCorrectPattern;
|
|
55
58
|
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2026 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/base/i18n/date/CalendarType",
|
|
9
|
+
"sap/ui/unified/library",
|
|
10
|
+
"sap/ui/core/Control",
|
|
11
|
+
"./WeeksRowRenderer",
|
|
12
|
+
"sap/ui/core/date/UI5Date",
|
|
13
|
+
"sap/ui/unified/calendar/CalendarUtils",
|
|
14
|
+
"sap/ui/unified/calendar/CalendarDate",
|
|
15
|
+
"sap/ui/core/Locale",
|
|
16
|
+
"sap/base/i18n/Formatting"
|
|
17
|
+
], function (
|
|
18
|
+
CalendarType,
|
|
19
|
+
unifiedLibrary,
|
|
20
|
+
Control,
|
|
21
|
+
WeeksRowRenderer,
|
|
22
|
+
UI5Date,
|
|
23
|
+
CalendarUtils,
|
|
24
|
+
CalendarDate,
|
|
25
|
+
Locale,
|
|
26
|
+
Formatting
|
|
27
|
+
) {
|
|
28
|
+
"use strict";
|
|
29
|
+
const CalendarIntervalType = unifiedLibrary.CalendarIntervalType;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Constructor for a new sap.ui.unified.calendar.WeeksRow.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [sId] ID for the new control, generated automatically if no ID is provided.
|
|
35
|
+
* @param {object} [mSettings] Initial settings for the new control.
|
|
36
|
+
*
|
|
37
|
+
* @class
|
|
38
|
+
* Renders a row of weeks, each consisting of days, for use in calendar-based controls such as the PlanningCalendar.
|
|
39
|
+
* The WeeksRow control is not intended for standalone usage, but as an internal part of higher-level calendar components.
|
|
40
|
+
*
|
|
41
|
+
* The WeeksRow works with UI5Date or JavaScript Date objects for its API, but internally uses CalendarDate objects for calculations.
|
|
42
|
+
*
|
|
43
|
+
* @extends sap.ui.core.Control
|
|
44
|
+
* @version 1.146.0
|
|
45
|
+
*
|
|
46
|
+
* @constructor
|
|
47
|
+
* @private
|
|
48
|
+
* @since 1.145.0
|
|
49
|
+
* @alias sap.ui.unified.calendar.WeeksRow
|
|
50
|
+
*/
|
|
51
|
+
const WeeksRow = Control.extend("sap.ui.unified.calendar.WeeksRow", /** @lends sap.ui.unified.calendar.WeeksRow.prototype */ {
|
|
52
|
+
metadata : {
|
|
53
|
+
library : "sap.ui.unified",
|
|
54
|
+
properties : {
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Determines the start date of the row, as a UI5Date or JavaScript Date object. The current date is used as default.
|
|
58
|
+
*/
|
|
59
|
+
startDate : { type : "object", group : "Data" },
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* If set, the calendar type is used for display.
|
|
63
|
+
* If not set, the calendar type of the global configuration is used.
|
|
64
|
+
*/
|
|
65
|
+
primaryCalendarType : { type : "sap.base.i18n.date.CalendarType", group : "Appearance", defaultValue : CalendarType.Gregorian },
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* number weeks displayed
|
|
69
|
+
*/
|
|
70
|
+
interval : { type : "int", group : "Appearance" },
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Defines the key of the <code>PlanningCalendarView</code> used for the output.
|
|
74
|
+
*
|
|
75
|
+
* <b>Note:</b> The default value is set <code>Hour</code>. If you are using your own views, the keys of these
|
|
76
|
+
* views should be used instead.
|
|
77
|
+
*/
|
|
78
|
+
viewKey : {type : "string", group : "Appearance", defaultValue : CalendarIntervalType.Hour},
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Determines if the week numbers are displayed.
|
|
82
|
+
*/
|
|
83
|
+
showWeekNumbers : {type : "boolean", group : "Appearance", defaultValue : false},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* If set, the calendar week numbering is used for display.
|
|
87
|
+
* If not set, the calendar week numbering of the global configuration is used.
|
|
88
|
+
*/
|
|
89
|
+
calendarWeekNumbering : { type : "sap.base.i18n.date.CalendarWeekNumbering", group : "Appearance", defaultValue: null}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
renderer: WeeksRowRenderer
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Sets the ARIA role for the row container.
|
|
97
|
+
* @param {string} sRole The ARIA role to be assigned.
|
|
98
|
+
* @returns {sap.ui.unified.calendar.WeeksRow} The current instance for method chaining.
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
WeeksRow.prototype._setAriaRole = function(sRole){
|
|
102
|
+
this._ariaRole = sRole;
|
|
103
|
+
|
|
104
|
+
return this;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Retrieves the locale used by this control.
|
|
109
|
+
* If the parent control specifies a locale it will be used; otherwise the
|
|
110
|
+
* control falls back to the runtime language tag.
|
|
111
|
+
*
|
|
112
|
+
* @returns {string} The locale identifier.
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
WeeksRow.prototype._getLocale = function(){
|
|
116
|
+
const oParent = this.getParent();
|
|
117
|
+
|
|
118
|
+
if (oParent && oParent.getLocale) {
|
|
119
|
+
return oParent.getLocale();
|
|
120
|
+
} else if (!this._sLocale) {
|
|
121
|
+
this._sLocale = new Locale(Formatting.getLanguageTag()).toString();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return this._sLocale;
|
|
125
|
+
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Returns the weekday index of the start date (0 = Sunday, 6 = Saturday).
|
|
130
|
+
* @returns {int} The index of the weekday corresponding to the start date.
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
WeeksRow.prototype._getFirstWeekDay = function(){
|
|
134
|
+
return this.getStartDate().getDay();
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Calculates and returns the week numbers for the currently displayed
|
|
139
|
+
* interval. The result is an array of objects, where each object contains
|
|
140
|
+
* a `number` (the week number) and `len` (how many days of that week are
|
|
141
|
+
* displayed in the interval).
|
|
142
|
+
*
|
|
143
|
+
* @returns {Array<{len: int, number: int}>} Week numbers and lengths.
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
WeeksRow.prototype._getWeekNumbers = function() {
|
|
147
|
+
const iDays = this.getInterval(),
|
|
148
|
+
sLocale = this._getLocale(),
|
|
149
|
+
oCalType = this.getPrimaryCalendarType(),
|
|
150
|
+
oStartDate = CalendarDate.fromLocalJSDate(this.getStartDate(), oCalType),
|
|
151
|
+
oDate = new CalendarDate(oStartDate, oCalType),
|
|
152
|
+
oEndDate = new CalendarDate(oStartDate, oCalType).setDate(oDate.getDate() + iDays),
|
|
153
|
+
aDisplayedDates = [],
|
|
154
|
+
sCalendarWeekNumbering = this.getCalendarWeekNumbering() || "Default";
|
|
155
|
+
|
|
156
|
+
while (oDate.isBefore(oEndDate)) {
|
|
157
|
+
aDisplayedDates.push(new CalendarDate(oDate, oCalType));
|
|
158
|
+
oDate.setDate(oDate.getDate() + 1);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const weekNumbers = aDisplayedDates.reduce(function (aWeekNumbers, oDay) {
|
|
162
|
+
const iWeekNumber = CalendarUtils.calculateWeekNumber(oDay, oCalType, sLocale, sCalendarWeekNumbering, this._getFirstWeekDay());
|
|
163
|
+
|
|
164
|
+
if (!aWeekNumbers.length || aWeekNumbers[aWeekNumbers.length - 1].number !== iWeekNumber) {
|
|
165
|
+
aWeekNumbers.push({
|
|
166
|
+
len: 0,
|
|
167
|
+
number: iWeekNumber
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
aWeekNumbers[aWeekNumbers.length - 1].len++;
|
|
172
|
+
|
|
173
|
+
return aWeekNumbers;
|
|
174
|
+
}.bind(this), []);
|
|
175
|
+
|
|
176
|
+
return weekNumbers;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Helper that returns the first and last week numbers for each month
|
|
181
|
+
* in the current interval. The returned object maps the month index
|
|
182
|
+
* (0..n-1) to an object with `first` and `last` week numbers.
|
|
183
|
+
*
|
|
184
|
+
* @returns {Object<number, {first: number, last: number}>} Mapping of month index to week numbers.
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
WeeksRow.prototype._getMonthsFirstAndLastWeekNumbers = function() {
|
|
188
|
+
const oStartDate = this.getStartDate();
|
|
189
|
+
const iInterval = this.getInterval();
|
|
190
|
+
const iCurrentYear = oStartDate.getFullYear();
|
|
191
|
+
let iCurrentDateMonth = oStartDate.getMonth();
|
|
192
|
+
const oWeeks = {};
|
|
193
|
+
const sPrimaryCalendarType = this.getPrimaryCalendarType();
|
|
194
|
+
const sCalendarWeekNumbering = this.getCalendarWeekNumbering() || "Default";
|
|
195
|
+
|
|
196
|
+
for (let i = 0; i < iInterval; i++) {
|
|
197
|
+
const oFirstDateOfMonth = UI5Date.getInstance(iCurrentYear, iCurrentDateMonth, 1);
|
|
198
|
+
const oLastDateOfMonth = CalendarUtils.getLastDateOfMonth(oFirstDateOfMonth);
|
|
199
|
+
const oFirstDateOfStartWeek = CalendarUtils.getFirstDateOfWeek(oFirstDateOfMonth);
|
|
200
|
+
const oFirstDateOfEndWeek = CalendarUtils.getFirstDateOfWeek(oLastDateOfMonth);
|
|
201
|
+
|
|
202
|
+
// Calculate week numbers for the first and last week of the month
|
|
203
|
+
const iFirstWeekNumber = iCurrentDateMonth === 0 ? 1 : CalendarUtils.calculateWeekNumber(new CalendarDate(CalendarDate.fromLocalJSDate(oFirstDateOfMonth), sPrimaryCalendarType), sPrimaryCalendarType, this._getLocale(), sCalendarWeekNumbering, oFirstDateOfStartWeek.getDay());
|
|
204
|
+
const iLastWeekNumber = CalendarUtils.calculateWeekNumber(new CalendarDate(CalendarDate.fromLocalJSDate(oLastDateOfMonth.oDate), sPrimaryCalendarType), sPrimaryCalendarType, this._getLocale(), sCalendarWeekNumbering, oFirstDateOfEndWeek.getDay());
|
|
205
|
+
|
|
206
|
+
oWeeks[i] = {
|
|
207
|
+
first: iFirstWeekNumber,
|
|
208
|
+
last: iLastWeekNumber
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
iCurrentDateMonth++;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return oWeeks;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
return WeeksRow;
|
|
218
|
+
|
|
219
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2026 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/ui/unified/library",
|
|
9
|
+
"sap/ui/core/Lib",
|
|
10
|
+
"sap/base/i18n/date/CalendarType"
|
|
11
|
+
],
|
|
12
|
+
function(
|
|
13
|
+
library,
|
|
14
|
+
coreLibrary,
|
|
15
|
+
CalendarType
|
|
16
|
+
) {
|
|
17
|
+
"use strict";
|
|
18
|
+
|
|
19
|
+
const CalendarIntervalType = library.CalendarIntervalType;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* WeeksRow renderer.
|
|
23
|
+
* @namespace
|
|
24
|
+
*/
|
|
25
|
+
const WeeksRowRenderer = {
|
|
26
|
+
apiVersion: 2
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
WeeksRowRenderer.render = function (oRm, oWeeksRow) {
|
|
30
|
+
const bShowWeekNumbers = oWeeksRow.getShowWeekNumbers();
|
|
31
|
+
const sPrimaryCalendarType = oWeeksRow.getPrimaryCalendarType();
|
|
32
|
+
const sViewKey = oWeeksRow.getViewKey();
|
|
33
|
+
if (!bShowWeekNumbers || sPrimaryCalendarType !== CalendarType.Gregorian) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
oRm.openStart("div", oWeeksRow);
|
|
38
|
+
oRm.class("sapUiCalWeeksRow");
|
|
39
|
+
oRm.class(`sapMPlanWeeksRow${sViewKey.split(" ").join("")}View`);
|
|
40
|
+
oRm.openEnd();
|
|
41
|
+
oRm.openStart("div");
|
|
42
|
+
oRm.class("sapMPlanWeeksLabelRow");
|
|
43
|
+
oRm.openEnd();
|
|
44
|
+
if (sViewKey === CalendarIntervalType.Month) {
|
|
45
|
+
const oResourceBundle = coreLibrary.getResourceBundleFor("sap.ui.unified");
|
|
46
|
+
oRm.openStart("div");
|
|
47
|
+
oRm.class("sapUiCalRowWeekLabel");
|
|
48
|
+
oRm.openEnd();
|
|
49
|
+
oRm.text(oResourceBundle.getText("CALENDAR_WEEK_NUMBERS"));
|
|
50
|
+
oRm.close("div");
|
|
51
|
+
}
|
|
52
|
+
oRm.close("div");
|
|
53
|
+
oRm.openStart("div");
|
|
54
|
+
oRm.class("sapMPlanWeeksDataRow");
|
|
55
|
+
oRm.openEnd();
|
|
56
|
+
if (sViewKey === CalendarIntervalType.Day || sViewKey === CalendarIntervalType.Week ||
|
|
57
|
+
sViewKey === CalendarIntervalType.OneMonth || sViewKey === CalendarIntervalType.OneWeek ||
|
|
58
|
+
sViewKey === "OneMonth") {
|
|
59
|
+
this.renderDaysWeeks(oRm, oWeeksRow);
|
|
60
|
+
} else if (sViewKey === CalendarIntervalType.Month) {
|
|
61
|
+
this.renderMonthsWeeks(oRm, oWeeksRow);
|
|
62
|
+
}
|
|
63
|
+
oRm.close("div");
|
|
64
|
+
oRm.close("div");
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
WeeksRowRenderer.renderMonthsWeeks = function(oRm, oWeeksRow) {
|
|
68
|
+
const iInterval = oWeeksRow.getInterval();
|
|
69
|
+
const aWeeks = oWeeksRow._getMonthsFirstAndLastWeekNumbers();
|
|
70
|
+
const sWidth = ( 100 / iInterval ) + "%";
|
|
71
|
+
|
|
72
|
+
oRm.openStart("div");
|
|
73
|
+
oRm.class("sapUiCalRowWeekNumbers");
|
|
74
|
+
oRm.openEnd();
|
|
75
|
+
for (var i = 0; i < iInterval; i++) {
|
|
76
|
+
const oWeekInfo = aWeeks[i];
|
|
77
|
+
oRm.openStart("div", `${oWeeksRow.getId()}-week-interval-${oWeekInfo.first}-${oWeekInfo.last}-text`);
|
|
78
|
+
oRm.class("sapUiCalRowWeekNumber");
|
|
79
|
+
if (sWidth) {
|
|
80
|
+
oRm.style("width", sWidth);
|
|
81
|
+
}
|
|
82
|
+
oRm.openEnd();
|
|
83
|
+
oRm.text(`${oWeekInfo.first} - ${oWeekInfo.last}`);
|
|
84
|
+
oRm.close("div");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
oRm.close("div");
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
WeeksRowRenderer.renderDaysWeeks = function(oRm, oWeeksRow) {
|
|
91
|
+
const iDays = oWeeksRow.getInterval();
|
|
92
|
+
const iDaysWidth = 100 / iDays;
|
|
93
|
+
const aWeekNumbers = oWeeksRow._getWeekNumbers();
|
|
94
|
+
const oResourceBundle = coreLibrary.getResourceBundleFor("sap.ui.unified");
|
|
95
|
+
|
|
96
|
+
oRm.openStart("div");
|
|
97
|
+
oRm.class("sapUiCalRowWeekNumbers");
|
|
98
|
+
oRm.openEnd();
|
|
99
|
+
|
|
100
|
+
aWeekNumbers.forEach(function(oWeek) {
|
|
101
|
+
oRm.openStart("div", oWeeksRow.getId() + "-week-" + oWeek.number + "-text");
|
|
102
|
+
oRm.class('sapUiCalRowWeekNumber');
|
|
103
|
+
oRm.style("width", oWeek.len * iDaysWidth + "%");
|
|
104
|
+
oRm.attr("data-sap-ui-week", oWeek.number);
|
|
105
|
+
oRm.openEnd();
|
|
106
|
+
oRm.text(oResourceBundle.getText('CALENDAR_DATES_ROW_WEEK_NUMBER', [oWeek.number]));
|
|
107
|
+
oRm.close("div");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
oRm.close("div");
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return WeeksRowRenderer;
|
|
114
|
+
});
|
|
@@ -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.
|
|
64
|
+
* @version 1.146.0
|
|
65
65
|
*
|
|
66
66
|
* @constructor
|
|
67
67
|
* @public
|
|
@@ -32,14 +32,14 @@ sap.ui.define([
|
|
|
32
32
|
* @namespace
|
|
33
33
|
* @alias sap.ui.unified
|
|
34
34
|
* @author SAP SE
|
|
35
|
-
* @version 1.
|
|
35
|
+
* @version 1.146.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.
|
|
42
|
+
version: "1.146.0",
|
|
43
43
|
dependencies : ["sap.ui.core"],
|
|
44
44
|
designtime: "sap/ui/unified/designtime/library.designtime",
|
|
45
45
|
types: [
|
|
@@ -94,6 +94,9 @@ CALENDAR_BTN_TODAY=Today
|
|
|
94
94
|
#XFLD: Text for a week in week numbers row
|
|
95
95
|
CALENDAR_DATES_ROW_WEEK_NUMBER=Week {0}
|
|
96
96
|
|
|
97
|
+
#XACT: Text for calendar weeks label
|
|
98
|
+
CALENDAR_WEEK_NUMBERS=Calendar Weeks
|
|
99
|
+
|
|
97
100
|
#XACT: Aria description of the Month picker
|
|
98
101
|
MONTH_PICKER=Month Picker
|
|
99
102
|
|