office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
112 lines (110 loc) • 4.07 kB
JavaScript
define(["require", "exports", "tslib", "react", "office-ui-fabric-react/lib/Dropdown", "office-ui-fabric-react/lib/DatePicker"], function (require, exports, tslib_1, React, Dropdown_1, DatePicker_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DayPickerStrings = {
months: [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
],
shortMonths: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
],
days: [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
],
shortDays: [
'S',
'M',
'T',
'W',
'T',
'F',
'S'
],
goToToday: 'Go to today',
prevMonthAriaLabel: 'Go to previous month',
nextMonthAriaLabel: 'Go to next month',
prevYearAriaLabel: 'Go to previous year',
nextYearAriaLabel: 'Go to next year'
};
var DatePickerBasicExample = (function (_super) {
tslib_1.__extends(DatePickerBasicExample, _super);
function DatePickerBasicExample() {
var _this = _super.call(this) || this;
_this.state = {
firstDayOfWeek: DatePicker_1.DayOfWeek.Sunday
};
return _this;
}
DatePickerBasicExample.prototype.render = function () {
var firstDayOfWeek = this.state.firstDayOfWeek;
return (React.createElement("div", null,
React.createElement(DatePicker_1.DatePicker, { firstDayOfWeek: firstDayOfWeek, strings: DayPickerStrings, placeholder: 'Select a date...' }),
React.createElement(Dropdown_1.Dropdown, { label: 'Select the first day of the week', options: [
{
text: 'Sunday',
key: DatePicker_1.DayOfWeek[DatePicker_1.DayOfWeek.Sunday]
},
{
text: 'Monday',
key: DatePicker_1.DayOfWeek[DatePicker_1.DayOfWeek.Monday]
},
{
text: 'Tuesday',
key: DatePicker_1.DayOfWeek[DatePicker_1.DayOfWeek.Tuesday]
},
{
text: 'Wednesday',
key: DatePicker_1.DayOfWeek[DatePicker_1.DayOfWeek.Wednesday]
},
{
text: 'Thursday',
key: DatePicker_1.DayOfWeek[DatePicker_1.DayOfWeek.Thursday]
},
{
text: 'Friday',
key: DatePicker_1.DayOfWeek[DatePicker_1.DayOfWeek.Friday]
},
{
text: 'Saturday',
key: DatePicker_1.DayOfWeek[DatePicker_1.DayOfWeek.Saturday]
}
], selectedKey: DatePicker_1.DayOfWeek[firstDayOfWeek], onChanged: this._onDropdownChanged.bind(this) })));
};
DatePickerBasicExample.prototype._onDropdownChanged = function (option) {
this.setState({
firstDayOfWeek: DatePicker_1.DayOfWeek[option.key]
});
};
return DatePickerBasicExample;
}(React.Component));
exports.DatePickerBasicExample = DatePickerBasicExample;
});
//# sourceMappingURL=DatePicker.Basic.Example.js.map