calendar-debug.js revision 99cbf2228f35bc4176ef142f181b0430f061c419
/**
* The Calendar component is a UI widget that allows users
* to view dates in a two-dimensional month grid, as well as
* to select one or more dates, or ranges of dates. Calendar
* is generated dynamically and relies on the developer to
* provide for a progressive enhancement alternative.
*
*
* @module calendar
*/
CALENDAR = 'calendar',
/** Create a calendar view to represent a single or multiple
* month range of dates, rendered as a grid with date and
* weekday labels.
*
* @class Calendar
* @extends CalendarBase
* @param config {Object} Configuration object (see Configuration attributes)
* @constructor
*/
}
/**
* A property tracking the last selected date on the calendar, for the
* purposes of multiple selection.
*
* @property _lastSelectedDate
* @type Date
* @default null
* @private
*/
_lastSelectedDate: null,
/**
* Designated initializer. Activates the navigation plugin for the calendar.
*
* @method initializer
*/
initializer : function () {
},
/**
* syncUI implementation
*
* Update the scroll position, based on the current value of scrollY
* @method syncUI
*/
syncUI : function () {
},
/**
* Overrides the _bindCalendarEvents placeholder in CalendarBase
* and binds calendar events during bindUI stage.
* @method _bindCalendarEvents
* @protected
*/
_bindCalendarEvents : function () {
},
/**
* Handles the calendar clicks based on selection mode.
* @method _clickCalendar
* @param {Event} ev A click event
* @private
*/
_clickCalendar : function (ev) {
switch (this.get("selectionMode")) {
case("single"):
if (clickedCellIsDay) {
if (!clickedCellIsSelected) {
this._clearSelection(true);
}
}
break;
case("multiple-sticky"):
if (clickedCellIsDay) {
if (clickedCellIsSelected) {
}
else {
}
}
break;
case("multiple"):
this._clearSelection(true);
this._addDateToSelection(this._lastSelectedDate);
}
else if (((os == 'macintosh' && ev.metaKey) || (os != 'macintosh' && ev.ctrlKey)) && !ev.shiftKey) {
if (clickedCellIsSelected) {
this._lastSelectedDate = null;
}
else {
this._addDateToSelection(this._lastSelectedDate);
}
}
if (this._lastSelectedDate != null) {
this._lastSelectedDate = selectedDate;
}
else {
this._addDateToSelection(this._lastSelectedDate);
}
}
if (this._lastSelectedDate != null) {
this._clearSelection(true);
this._lastSelectedDate = selectedDate;
}
else {
this._clearSelection(true);
this._addDateToSelection(this._lastSelectedDate);
}
}
break;
}
if (clickedCellIsDay) {
/**
* Fired when a specific date cell in the calendar is clicked. The event carries a
* payload which includes a `cell` property corresponding to the node of the actual
* date cell, and a `date` property, with the `Date` that was clicked.
*
* @event dateClick
*/
}
/**
* Fired when any of the previous month's days displayed before the calendar grid
* are clicked.
*
* @event prevMonthClick
*/
this.fire("prevMonthClick");
}
/**
* Fired when any of the next month's days displayed after the calendar grid
* are clicked.
*
* @event nextMonthClick
*/
this.fire("nextMonthClick");
}
},
/**
* Subtracts one month from the current calendar view.
* @method subtractMonth
*/
subtractMonth : function (e) {
e.halt();
},
/**
* Subtracts one year from the current calendar view.
* @method subtractYear
*/
subtractYear : function (e) {
e.halt();
},
/**
* Adds one month to the current calendar view.
* @method addMonth
*/
addMonth : function (e) {
e.halt();
},
/**
* Adds one year to the current calendar view.
* @method addYear
*/
addYear : function (e) {
e.halt();
}
},
{
/**
* The identity of the widget.
*
* @property NAME
* @type String
* @default 'Calendar'
* @readOnly
* @protected
* @static
*/
NAME: "Calendar",
/**
* Static property used to define the default attribute configuration of
* the Widget.
*
* @property ATTRS
* @type {Object}
* @protected
* @static
*/
ATTRS: {
/**
* A setting specifying the type of selection the calendar allows.
* Possible values include:
* <ul>
* <li>`single`</li> - One date at a time
* <li>`multiple-sticky</li> - Multiple dates, selected one at a time (the dates "stick")
* dates, and Shift key for date ranges.
*
* @attribute selectionMode
* @type String
* @default single
*/
value: "single"
},
/**
* The date corresponding to the current calendar view. Always
* normalized to the first of the month that contains the date
* at assignment time. Used as the first date visible in the
* calendar.
*
* @attribute date
* @type Date
* @default Today's date as set on the user's computer.
*/
date: {
value: new Date(),
return newDate;
}
return minDate;
}
return actualMaxDate;
}
}
},
/**
* The minimum date that can be displayed by the calendar. The calendar will not
* allow dates earlier than this one to be set, and will reset any earlier date to
* this date. Should be `null` if no minimum date is needed.
*
* @attribute minimumDate
* @type Date
* @default null
*/
minimumDate: {
value: null,
if (val != null) {
}
return newMinDate;
}
else {
return val;
}
}
},
/**
* The maximum date that can be displayed by the calendar. The calendar will not
* allow dates later than this one to be set, and will reset any later date to
* this date. Should be `null` if no maximum date is needed.
*
* @attribute maximumDate
* @type Date
* @default null
*/
maximumDate: {
value: null,
if (val != null) {
if (curDate!= null && !ydate.isGreaterOrEqual(val, ydate.addMonths(curDate, this._paneNumber - 1))) {
}
return newMaxDate;
}
else {
return val;
}
}
}
}
});