1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.CalendarMonthHeaderRow = void 0;
|
4 | var React = require("react");
|
5 | var utilities_1 = require("@fluentui/utilities");
|
6 | var date_time_utilities_1 = require("@fluentui/date-time-utilities");
|
7 | var CalendarMonthHeaderRow = function (props) {
|
8 | var showWeekNumbers = props.showWeekNumbers, strings = props.strings, firstDayOfWeek = props.firstDayOfWeek, allFocusable = props.allFocusable, weeksToShow = props.weeksToShow, weeks = props.weeks, classNames = props.classNames;
|
9 | var dayLabels = strings.shortDays.slice();
|
10 | var firstOfMonthIndex = utilities_1.findIndex(weeks[1], function (day) { return day.originalDate.getDate() === 1; });
|
11 | if (weeksToShow === 1 && firstOfMonthIndex >= 0) {
|
12 |
|
13 | var firstOfMonthIndexOffset = (firstOfMonthIndex + firstDayOfWeek) % date_time_utilities_1.DAYS_IN_WEEK;
|
14 | dayLabels[firstOfMonthIndexOffset] = strings.shortMonths[weeks[1][firstOfMonthIndex].originalDate.getMonth()];
|
15 | }
|
16 | return (React.createElement("tr", null,
|
17 | showWeekNumbers && React.createElement("th", { className: classNames.dayCell }),
|
18 | dayLabels.map(function (val, index) {
|
19 | var i = (index + firstDayOfWeek) % date_time_utilities_1.DAYS_IN_WEEK;
|
20 | var label = index === firstOfMonthIndex ? strings.days[i] + ' ' + dayLabels[i] : strings.days[i];
|
21 | return (React.createElement("th", { className: utilities_1.css(classNames.dayCell, classNames.weekDayLabelCell), scope: "col", key: dayLabels[i] + ' ' + index, title: label, "aria-label": label, "data-is-focusable": allFocusable ? true : undefined }, dayLabels[i]));
|
22 | })));
|
23 | };
|
24 | exports.CalendarMonthHeaderRow = CalendarMonthHeaderRow;
|
25 |
|
\ | No newline at end of file |