calendar-base-debug.js revision 528126a57f0c28ce4de35bb3c4c4cbfbb52a36e7
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The CalendarBase submodule is a basic UI calendar view that displays
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * a range of dates in a two-dimensional month grid, with one or more
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * months visible at a single time. CalendarBase supports custom date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * rendering, multiple calendar panes, and selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @module calendar
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @submodule calendar-base
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_LEFT_GRID = getCN(CALENDAR, 'left-grid'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_RIGHT_GRID = getCN(CALENDAR, 'right-grid'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_HD_LABEL = getCN(CALENDAR, 'header-label'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_WDAYROW = getCN(CALENDAR, 'weekdayrow'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_COL_HIDDEN = getCN(CALENDAR, 'column-hidden'),
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer CAL_DAY_SELECTED = getCN(CALENDAR, 'day-selected'),
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok SELECTION_DISABLED = getCN(CALENDAR, 'selection-disabled'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_PREVMONTH_DAY = getCN(CALENDAR, 'prevmonth-day'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_NEXTMONTH_DAY = getCN(CALENDAR, 'nextmonth-day'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore/** Create a calendar view to represent a single or multiple
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * month range of dates, rendered as a grid with date and
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * weekday labels.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @class CalendarBase
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @extends Widget
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param config {Object} Configuration object (see Configuration
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * attributes)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @constructor
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.superclass.constructor.apply ( this, arguments );
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'AmoreY.CalendarBase = Y.extend( CalendarBase, Y.Widget, {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A storage for various properties of individual month
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _paneProperties
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The number of month panes in the calendar, deduced
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * from the CONTENT_TEMPLATE's number of {calendar_grid}
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _paneNumber
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Number
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The unique id used to prefix various elements of this
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar instance.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _calendarId
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * The hash map of selected dates, populated with
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * selectDates() and deselectDates() methods
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * @property _selectedDates
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * @type Object
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * A private copy of the rules object, populated
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * by setting the customRenderer attribute.
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @property _rules
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A private copy of the filterFunction, populated
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * by setting the customRenderer attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _filterFunction
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Function
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Storage for calendar cells modified by any custom
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * formatting. The storage is cleared, used to restore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * cells to the original state, and repopulated accordingly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * when the calendar is rerendered.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _storedDateCells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Designated initializer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Initializes instance-level properties of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method initializer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore initializer : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * renderUI implementation
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Creates a visual representation of the calendar based on existing parameters.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method renderUI
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore renderUI : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentBox.appendChild(this._initCalendarHTML(this.get('date')));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("boundingBox").setAttribute("aria-labelledby", this._calendarId + "_header");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * bindUI implementation
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Assigns listeners to relevant events that change the state
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * of the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method bindUI
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore bindUI : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('dateChange', this._afterDateChange);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer this.after('showPrevMonthChange', this._afterShowPrevMonthChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('showNextMonthChange', this._afterShowNextMonthChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('headerRendererChange', this._afterHeaderRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('customRendererChange', this._afterCustomRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('enabledDatesRuleChange', this._afterCustomRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('disabledDatesRuleChange', this._afterCustomRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('focusedChange', this._afterFocusedChange);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * syncUI implementation
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * Update the scroll position, based on the current value of scrollY
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * @method syncUI
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore syncUI : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.updateStatus("Calendar with two month panes, currently set to " + ydate.format(this.get("date"), {format:"%B %Y"}));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal utility method that generates a list of selected dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * from the hash storage.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getSelectedDatesList
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Array} The array of `Date`s that are currently selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each (this._selectedDates, function (year) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that returns all dates selected in a specific month.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getSelectedDatesInMonth
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate corresponding to the month for which selected dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * are requested.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Array} The array of `Date`s in a given month that are currently selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _getSelectedDatesInMonth : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (hasKey(this._selectedDates, year) && hasKey(this._selectedDates[year], month)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return Y.Object.values(this._selectedDates[year][month]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal rendering method that modifies a date cell to have the
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * selected CSS class if the date cell is visible.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderSelectedDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date corresponding to a specific date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._dateToNode(oDate).addClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal rendering method that modifies a date cell to remove the
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * selected CSS class if the date cell is visible.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderUnelectedDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date corresponding to a specific date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._dateToNode(oDate).removeClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal utility method that checks whether a particular date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * is in the current view of the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _isDateVisible
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date corresponding to a specific date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the given date is in the current
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * view of the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore maxDate = ydate.addMonths(minDate, this._paneNumber - 1),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore oDateTime = this._normalizeDate(oDate).getTime();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (minDate.getTime() <= oDateTime && oDateTime <= maxDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return false;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal parsing method that receives a String list of numbers
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * and number ranges (of the form "1,2,3,4-6,7-9,10,11" etc.) and checks
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * whether a specific number is included in this list. Used for looking
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * up dates in the customRenderer rule set.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _isNumInList
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} num The number to look for in a list.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {String} strList The list of numbers of the form "1,2,3,4-6,7-8,9", etc.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the given number is in the given list.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var val = 0, len = elements.length; val < len; val++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (range.length == 2 && num >= parseInt(range[0], 10) && num <= parseInt(range[1], 10)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (range.length == 1 && (parseInt(elements[val], 10) == num)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return false;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Given a specific date, returns an array of rules (from the customRenderer rule set)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * that the given date matches.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getRulesForDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date for which an array of rules is needed
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Array} Returns an array of `String`s, each containg the name of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * a rule that the given date matches.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (L.isString(rules[years][months][dates])) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore outputRules.push(rules[years][months][dates]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (L.isString(rules[years][months][dates][days])) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore outputRules.push(rules[years][months][dates][days]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method which, given a specific date and a name of the rule,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * checks whether the date matches the given rule.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _matchesRule
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to check
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @param {String} rule The name of the rule that the date should match.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the date matches the given rule.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return (iOf(this._getRulesForDate(oDate), rule) >= 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method which checks whether a given date matches the `enabledDatesRule`
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * or does not match the `disabledDatesRule` and therefore whether it can be selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _canBeSelected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to check
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the date can be selected; false otherwise.
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore var enabledDatesRule = this.get("enabledDatesRule"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore disabledDatesRule = this.get("disabledDatesRule");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return this._matchesRule(oDate, enabledDatesRule);
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore return !this._matchesRule(oDate, disabledDatesRule);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Selects a given date or array of dates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method selectDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date|Array} dates A `Date` or `Array` of `Date`s.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Deselects a given date or array of dates, or deselects
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * all dates if no argument is specified.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method deselectDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date|Array} [dates] A `Date` or `Array` of `Date`s, or no
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * argument if all dates should be deselected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (dates == null) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that adds a given date to selection..
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _addDateToSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to add to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} [index] An optional parameter that is used
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * to differentiate between individual date selections and multiple
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * date selections.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _addDateToSelection : function (oDate, index) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (hasKey(this._selectedDates[year], month)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates[year][month][day] = oDate;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates[year][month][day] = oDate;
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._selectedDates[year][month][day] = oDate;
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._selectedDates = setVal(this._selectedDates, [year, month, day], oDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (index == null) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that adds a given list of dates to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _addDatesToSelection
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @param {Array} datesArray The list of dates to add to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _addDatesToSelection : function (datesArray) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each(datesArray, this._addDateToSelection, this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that adds a given range of dates to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _addDateRangeToSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} startDate The first date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} endDate The last date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _addDateRangeToSelection : function (startDate, endDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var timezoneDifference = (endDate.getTimezoneOffset() - startDate.getTimezoneOffset())*60000,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var time = startTime; time <= endTime; time += 86400000) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes a given date from selection..
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @method _removeDateFromSelection
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @param {Date} oDate The date to remove from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} [index] An optional parameter that is used
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * to differentiate between individual date selections and multiple
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * date selections.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _removeDateFromSelection : function (oDate, index) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore hasKey(this._selectedDates[year][month], day)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore delete this._selectedDates[year][month][day];
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (index == null) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes a given list of dates from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _removeDatesFromSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Array} datesArray The list of dates to remove from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _removeDatesFromSelection : function (datesArray) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each(datesArray, this._removeDateDromSelection);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes a given range of dates from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _removeDateRangeFromSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} startDate The first date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} endDate The last date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _removeDateRangeFromSelection : function (startDate, endDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var time = startTime; time <= endTime; time += 86400000) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._removeDateFromSelection(new Date(time), time);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes all dates from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _clearSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {boolean} noevent A Boolean specifying whether a selectionChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * event should be fired.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("contentBox").all("." + CAL_DAY_SELECTED).removeClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that fires a selectionChange event.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _fireSelectionChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Fired when the set of selected dates changes. Contains a payload with
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * a `newSelection` property with an array of selected dates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @event selectionChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.fire("selectionChange", {newSelection: this._getSelectedDatesList()});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that restores cells modified by custom formatting.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _restoreModifiedCells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentbox.one("#" + id).replace(this._storedDateCells[id]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that renders all cells modified by the customRenderer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * rules, as well as the enabledDatesRule and disabledDatesRule.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderCustomRules
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("contentBox").all("." + CAL_DAY + ",." + CAL_NEXTMONTH_DAY).removeClass(SELECTION_DISABLED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var paneNum = 0; paneNum < this._paneNumber; paneNum++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var paneDate = ydate.addMonths(this.get("date"), paneNum);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var dateArray = ydate.listOfDatesInMonth(paneDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var matchingRules = this._getRulesForDate(date);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if ((enRule && iOf(matchingRules, enRule) < 0) || (!enRule && disRule && iOf(matchingRules, disRule) >= 0)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._storedDateCells[dateNode.get("id")] = dateNode.cloneNode(true);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._filterFunction (date, dateNode, matchingRules);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that renders all cells that are currently selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderSelectedDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("contentBox").all("." + CAL_DAY_SELECTED).removeClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var paneNum = 0; paneNum < this._paneNumber; paneNum++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var paneDate = ydate.addMonths(this.get("date"), paneNum);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var dateArray = this._getSelectedDatesInMonth(paneDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._dateToNode(date).addClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that converts a date to the node wrapping the calendar cell
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * the date corresponds to..
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _dateToNode
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to convert to Node
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Node} The node wrapping the DOM element of the cell the date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * corresponds to.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore paneNum = (12 + oDate.getMonth() - this.get("date").getMonth()) % 12,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore paneId = this._calendarId + "_pane_" + paneNum,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._paneProperties[paneId].cutoffCol;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return(this.get("contentBox").one("#" + this._calendarId + "_pane_" + paneNum + "_" + col + "_" + day));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that converts a node corresponding to the DOM element of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * the cell for a particular date to that date.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _nodeToDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} oNode The Node wrapping the DOM element of a particular date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Date} The date corresponding to the DOM element that the given node wraps.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var idParts = oNode.get("id").split("_").reverse(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var shiftedDate = ydate.addMonths(this.get("date"), paneNum),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return new Date(year, month, day, 12, 0, 0, 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A placeholder method, called from bindUI, to bind the Calendar events.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _bindCalendarEvents
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that normalizes a given date by converting it to the 1st
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * day of the month the date is in, with the time set to noon.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _normalizeDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to normalize
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Date} The normalized date, set to the first of the month, with time
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * set to noon.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (date != null) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return new Date(date.getFullYear(), date.getMonth(), 1, 12, 0, 0, 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist utility method that computes the cutoff column for the calendar
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * rendering mask.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getCutoffColumn
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} date The date of the month grid to compute the cutoff column for.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} firstday The first day of the week (modified by internationalized calendars)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Number} The number of the cutoff column.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _getCutoffColumn : function (date, firstday) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var distance = this._normalizeDate(date).getDay() - firstday;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that turns on the view of the previous month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnPrevMonthOn
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its previous month's dates view
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane_date = this._paneProperties[pane_id].paneDate,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore daysInPrevMonth = ydate.daysInMonth(ydate.addMonths(pane_date, -1));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (!this._paneProperties[pane_id].hasOwnProperty("daysInPrevMonth")) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id].daysInPrevMonth = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInPrevMonth != this._paneProperties[pane_id].daysInPrevMonth) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id].daysInPrevMonth = daysInPrevMonth;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell-5)).set('text', daysInPrevMonth--);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that turns off the view of the previous month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnPrevMonthOff
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its previous month's dates view
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id].daysInPrevMonth = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell-5)).setContent(" ");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that cleans up the last few cells in the month grid
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * when the number of days in the month changes.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _cleanUpNextMonthCells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs the last date cells cleaned up.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_6_29").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_7_30").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_8_31").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_0_30").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_1_31").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that turns on the view of the next month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnNextMonthOn
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its next month's dates view
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer daysInMonth = this._paneProperties[pane_id].daysInMonth,
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer cutoffCol = this._paneProperties[pane_id].cutoffCol;
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer for (var cell = daysInMonth - 22; cell < cutoffCol + 7; cell++)
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer pane.one("#" + pane_id + "_" + cell + "_" + (cell+23)).set("text", dayCounter++).addClass(CAL_NEXTMONTH_DAY);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer else if (daysInMonth== 30 && cutoffCol == 0) {
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer for (var cell = startingCell ; cell < cutoffCol + 7; cell++) {
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer pane.one("#" + pane_id + "_" + cell + "_" + (cell+30)).set("text", dayCounter++).addClass(CAL_NEXTMONTH_DAY);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * A render assist method that turns off the view of the next month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnNextMonthOff
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its next month's dates view
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore daysInMonth = this._paneProperties[pane_id].daysInMonth,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._paneProperties[pane_id].cutoffCol;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var cell = daysInMonth - 22; cell <= 12; cell++)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell+23)).setContent(" ").addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInMonth == 31 && (cutoffCol <= 1)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (daysInMonth == 30 && cutoffCol == 0) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var cell = startingCell ; cell <= 12; cell++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell+30)).setContent(" ").addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the showNextMonth attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterShowNextMonthChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore lastPane = contentBox.one("#" + this._calendarId + "_pane_" + (this._paneNumber - 1));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the showPrevMonth attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterShowPrevMonthChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore firstPane = contentBox.one("#" + this._calendarId + "_pane_" + 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the headerRenderer attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterHeaderRendererChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var headerCell = this.get('contentBox').one("." + CAL_HD);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerCell.setContent(this._updateCalendarHeader(this.get('date')));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the customRenderer attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterCustomRendererChange
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * The handler for the change in the date attribute. Modifies the calendar
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * view by shifting the calendar grid mask and running custom rendering and
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * selection rendering as necessary.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterDateChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerCell = contentBox.one("." + CAL_HD).one("." + CAL_HD_LABEL),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendarPanes = contentBox.all("." + CAL_GRID),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentBox.setStyle("visibility", "hidden");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerCell.setContent(this._updateCalendarHeader(currentDate));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._rerenderCalendarPane(ydate.addMonths(currentDate, counter++),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentBox.setStyle("visibility", "visible");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that initializes the HTML for a single
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _initCalendarPane
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date corresponding to the month of the given
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {String} pane_id The id of the pane, to be used as a prefix for
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * element ids in the given pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _initCalendarPane : function (baseDate, pane_id) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize final output HTML string
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Get a list of short weekdays from the internationalization package, or else use default English ones.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore weekdays = this.get('strings.very_short_weekdays') || ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore fullweekdays = this.get('strings.weekdays') || ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok // Get the first day of the week from the internationalization package, or else use Sunday as default.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore firstday = this.get('strings.first_weekday') || 0,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the cutoff column of the masked calendar table, based on the start date and the first day of week.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._getCutoffColumn(baseDate, firstday),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the number of days in the month based on starting date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize the array of individual row HTML strings
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize the partial templates object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize the partial template for the weekday row cells.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the partial template for the weekday row cells with weekday names
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var day = firstday; day <= firstday + 6; day++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the partial template for the weekday row container with the weekday row cells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["weekday_row_template"] = substitute(CalendarBase.WEEKDAY_ROW_TEMPLATE, partials);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the array of individual row HTML strings
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var column = 0; column <= 12; column++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the value of the date that needs to populate the cell
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compose the value of the unique id of the current calendar cell
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var id_date = pane_id + "_" + column + "_" + date;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Set the calendar day class to one of three possible values
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Cut off dates that fall before the first and after the last date of the month
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Decide on whether a column in the masked table is visible or not based on the value of the cutoff column.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var column_visibility = (column >= cutoffCol && column < (cutoffCol + 7)) ? '' : CAL_COL_HIDDEN;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Substitute the values into the partial calendar day template and add it to the current row HTML string
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore row_array[row] += substitute (CalendarBase.CALDAY_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_col_class: "calendar_col" + column,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_col_visibility_class: column_visibility,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Instantiate the partial calendar pane body template
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the body template with the rows templates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["body_template"] += substitute(CalendarBase.CALDAY_ROW_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the calendar grid id
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the calendar pane tabindex
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["calendar_pane_tabindex"] = this.get("tabIndex");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["pane_arialabel"] = ydate.format(baseDate, {format:"%B %Y"});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Generate final output by substituting class names.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var output = substitute(substitute (CalendarBase.CALENDAR_GRID_TEMPLATE, partials),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Store the initialized pane information
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id] = {cutoffCol: cutoffCol, daysInMonth: daysInMonth, paneDate: baseDate};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that rerenders a specified calendar pane, based
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * on a new Date.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _rerenderCalendarPane
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} newDate The date corresponding to the month of the given
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The node corresponding to the calendar pane to be rerenders.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _rerenderCalendarPane : function (newDate, pane) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Get the first day of the week from the internationalization package, or else use Sunday as default.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var firstday = this.get('strings.first_weekday') || 0,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the cutoff column of the masked calendar table, based on the start date and the first day of week.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._getCutoffColumn(newDate, firstday),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the number of days in the month based on starting date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Get pane id for easier reference
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Hide the pane before making DOM changes to speed them up
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.setAttribute("aria-label", ydate.format(newDate, {format:"%B %Y"}));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Go through all columns, and flip their visibility setting based on whether they are within the unmasked range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var column = 0; column <= 12; column++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var currentColumn = pane.all("." + "calendar_col" + column);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (column < cutoffCol || column >= (cutoffCol + 7)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Clean up dates in visible columns to account for the correct number of days in a month
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_0_30");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.addClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_1_31");
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_6_29");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_7_30");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_8_31");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Update stored pane properties
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[paneId].cutoffCol = cutoffCol;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[paneId].daysInMonth = daysInMonth;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[paneId].paneDate = newDate;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Bring the pane visibility back after all DOM changes are done
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that updates the calendar header based
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * on a given date and potentially the provided headerRenderer.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _updateCalendarHeader
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date with which to update the calendar header.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _updateCalendarHeader : function (baseDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerRenderer = this.get("headerRenderer");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerString = ydate.format(baseDate, {format:headerRenderer});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (headerRenderer instanceof Function) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerString = headerRenderer.call(this, baseDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that initializes the calendar header HTML
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * based on a given date and potentially the provided headerRenderer.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _updateCalendarHeader
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date with which to initialize the calendar header.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return substitute(substitute(CalendarBase.HEADER_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {calheader: this._updateCalendarHeader(baseDate),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that initializes the calendar HTML
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * based on a given date.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _initCalendarHTML
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date with which to initialize the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Instantiate the partials holder
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Counter for iterative template replacement.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Generate the template for the header
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["header_template"] = this._initCalendarHeader(baseDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["body_template"] = substitute(substitute (CalendarBase.CONTENT_TEMPLATE, partials),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Instantiate the iterative template replacer function
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var singlePane = this._initCalendarPane(ydate.addMonths(baseDate, counter), partials["calendar_id"]+"_pane_"+counter);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Go through all occurrences of the calendar_grid_template token and replace it with an appropriate calendar grid.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var output = partials["body_template"].replace(/\{calendar_grid_template\}/g, Y.bind(paneReplacer, this));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Update the paneNumber count
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The CSS classnames for the calendar templates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CALENDAR_STRINGS
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore ARIA_STATUS_TEMPLATE: '<div role="status" aria-atomic="true" class="{calendar_status_class}"></div>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore substitute (CalendarBase.ARIA_STATUS_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore Y.one("body").append(CalendarBase.AriaStatus);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.AriaStatus.set("text", statusString);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The main content template for calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CONTENT_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CONTENT_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{header_template}' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '<div class="yui3-u-1">' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A single pane template for calendar (same as default CONTENT_TEMPLATE)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property ONE_PANE_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore ONE_PANE_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{header_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A two pane template for calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property TWO_PANE_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore TWO_PANE_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{header_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-2">'+
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_left_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-2">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_right_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A three pane template for calendar.
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @property THREE_PANE_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore THREE_PANE_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '{header_template}' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '<div class="yui3-u-1-3">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_left_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-3">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-3">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_right_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for the calendar grid.
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @property CALENDAR_GRID_TEMPLATE
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALENDAR_GRID_TEMPLATE: '<table class="{calendar_grid_class}" id="{calendar_pane_id}" role="grid" aria-readonly="true" aria-label="{pane_arialabel}" tabindex="{calendar_pane_tabindex}">' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '{weekday_row_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{body_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for the calendar header.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property HEADER_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore HEADER_TEMPLATE: '<div class="yui3-g {calendar_hd_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u {calendar_hd_label_class}" id="{calendar_id}_header" aria-role="heading">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calheader}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for the row of weekday names.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property WEEKDAY_ROW_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore WEEKDAY_ROW_TEMPLATE: '<tr class="{calendar_weekdayrow_class}" role="row">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{weekday_row}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for a single row of calendar days.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CALDAY_ROW_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALDAY_ROW_TEMPLATE: '<tr class="{calendar_row_class}" role="row">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calday_row}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for a single cell with a weekday name.
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @property CALDAY_ROW_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore WEEKDAY_TEMPLATE: '<th class="{calendar_weekday_class}" role="columnheader" aria-label="{full_weekdayname}">{weekdayname}</th>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for a single cell with a calendar day.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CALDAY_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALDAY_TEMPLATE: '<td class="{calendar_col_class} {calendar_day_class} {calendar_col_visibility_class}" id="{calendar_day_id}" role="gridcell">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{day_content}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The identity of the widget.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property NAME
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default 'calendarBase'
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Static property used to define the default attribute configuration of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * the Widget.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property ATTRS
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type {Object}
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The date corresponding to the current calendar view. Always
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * normalized to the first of the month that contains the date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * at assignment time. Used as the first date visible in the
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default The first of the month containing today's date, as
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * set on the end user's system.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (ydate.areEqual(newDate, this.get('date'))) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A setting specifying whether to shows days from the previous
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * month in the visible month's grid, if there are empty preceding
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * cells available.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute showPrevMonth
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type boolean
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default false
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A setting specifying whether to shows days from the next
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * month in the visible month's grid, if there are empty
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * cells available at the end.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute showNextMonth
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type boolean
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default false
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Strings and properties derived from the internationalization packages
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * for the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute strings
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore valueFn: function() { return Y.Intl.get("calendar-base"); }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Custom header renderer for the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute headerRenderer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String | Function
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The name of the rule which all enabled dates should match.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Either disabledDatesRule or enabledDatesRule should be specified,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * or neither, but not both.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute enabledDatesRule
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default null
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The name of the rule which all disabled dates should match.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Either disabledDatesRule or enabledDatesRule should be specified,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * or neither, but not both.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute disabledDatesRule
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default null
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A read-only attribute providing a list of currently selected dates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute selectedDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Array
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An object of the form {rules:Object, filterFunction:Function},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * providing set of rules and a custom rendering function for
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * customizing specific calendar cells.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute customRenderer
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @type Object
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @default {}
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore}, '@VERSION@' ,{lang:['de', 'en', 'fr', 'ja', 'pt-BR', 'ru', 'zh-HANT-TW'], requires:['widget', 'substitute', 'datatype-date', 'datatype-date-math', 'cssgrids']});