first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,18 @@
.yui3-calendar-header {
text-align: center;
position: relative;
/* ie6 width fix */
width: 100%;
}
.yui3-calendar-header-label {
display: inline;
}
.yui3-calendarnav-prevmonth {
cursor: pointer;
}
.yui3-calendarnav-nextmonth {
cursor: pointer;
}
@@ -0,0 +1,78 @@
.yui3-skin-night .yui3-calendarnav-prevmonth, .yui3-skin-night .yui3-calendarnav-nextmonth {
width: 0;
height: 0;
padding: 0;
margin: 0;
border: 10px solid transparent;
position: absolute;
/* ie6 height fix */
font-size: 0;
line-height: 0;
/* ie6 transparent fix */
_border-left-color: black;
_border-top-color: black;
_border-right-color: black;
_border-bottom-color: black;
_filter: chroma(color=black);
}
.yui3-skin-night .yui3-calendarnav-prevmonth:hover,
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth:hover,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth:hover {
border-right-color: #0066CC;
}
.yui3-skin-night .yui3-calendarnav-nextmonth:hover,
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth:hover,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth:hover {
border-left-color: #0066CC;
}
.yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,
.yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover {
cursor: default;
border-right-color: #CCCCCC;
border-left-color: transparent;
}
.yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,
.yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover {
cursor: default;
border-left-color: #CCCCCC;
border-right-color: transparent;
}
.yui3-skin-night .yui3-calendarnav-prevmonth {
border-right-color: #FFFFFF;
left: 0;
margin-left: -10px;
}
.yui3-skin-night .yui3-calendarnav-nextmonth {
border-left-color: #FFFFFF;
right: 0;
margin-right: -10px;
}
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth {
left: auto;
right: 0;
border-left-color: #FFFFFF;
border-right-color: transparent;
}
[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth,
.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth {
left: 0;
right: auto;
border-right-color: #FFFFFF;
border-left-color: transparent;
}
@@ -0,0 +1 @@
.yui3-calendar-header{text-align:center;position:relative;width:100%}.yui3-calendar-header-label{display:inline}.yui3-calendarnav-prevmonth{cursor:pointer}.yui3-calendarnav-nextmonth{cursor:pointer}.yui3-skin-night .yui3-calendarnav-prevmonth,.yui3-skin-night .yui3-calendarnav-nextmonth{width:0;height:0;padding:0;margin:0;border:10px solid transparent;position:absolute;font-size:0;line-height:0;_border-left-color:black;_border-top-color:black;_border-right-color:black;_border-bottom-color:black;_filter:chroma(color=black)}.yui3-skin-night .yui3-calendarnav-prevmonth:hover,[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth:hover,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth:hover{border-right-color:#06c}.yui3-skin-night .yui3-calendarnav-nextmonth:hover,[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth:hover,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth:hover{border-left-color:#06c}.yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,.yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover{cursor:default;border-right-color:#ccc;border-left-color:transparent}.yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,.yui3-skin-night .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover{cursor:default;border-left-color:#ccc;border-right-color:transparent}.yui3-skin-night .yui3-calendarnav-prevmonth{border-right-color:#fff;left:0;margin-left:-10px}.yui3-skin-night .yui3-calendarnav-nextmonth{border-left-color:#fff;right:0;margin-right:-10px}[dir="rtl"] .yui3-skin-night .yui3-calendarnav-prevmonth,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-prevmonth{left:auto;right:0;border-left-color:#fff;border-right-color:transparent}[dir="rtl"] .yui3-skin-night .yui3-calendarnav-nextmonth,.yui3-skin-night [dir="rtl"] .yui3-calendarnav-nextmonth{left:0;right:auto;border-right-color:#fff;border-left-color:transparent}#yui3-css-stamp.skin-night-calendarnavigator{display:none}
@@ -0,0 +1,78 @@
.yui3-skin-sam .yui3-calendarnav-prevmonth, .yui3-skin-sam .yui3-calendarnav-nextmonth {
width: 0;
height: 0;
padding: 0;
margin: 0;
border: 10px solid transparent;
position: absolute;
/* ie6 height fix */
font-size: 0;
line-height: 0;
/* ie6 transparent fix */
_border-left-color: white;
_border-top-color: white;
_border-right-color: white;
_border-bottom-color: white;
_filter: chroma(color=white);
}
.yui3-skin-sam .yui3-calendarnav-prevmonth:hover,
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth:hover,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth:hover {
border-right-color: #0066CC;
}
.yui3-skin-sam .yui3-calendarnav-nextmonth:hover,
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth:hover,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth:hover {
border-left-color: #0066CC;
}
.yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,
.yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover {
cursor: default;
border-right-color: #CCCCCC;
border-left-color: transparent;
}
.yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,
.yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover {
cursor: default;
border-left-color: #CCCCCC;
border-right-color: transparent;
}
.yui3-skin-sam .yui3-calendarnav-prevmonth {
border-right-color: #000000;
left: 0;
margin-left: -10px;
}
.yui3-skin-sam .yui3-calendarnav-nextmonth {
border-left-color: #000000;
right: 0;
margin-right: -10px;
}
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth {
left: auto;
right: 0;
border-left-color: #000000;
border-right-color: transparent;
}
[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth,
.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth {
left: 0;
right: auto;
border-right-color: #000000;
border-left-color: transparent;
}
@@ -0,0 +1 @@
.yui3-calendar-header{text-align:center;position:relative;width:100%}.yui3-calendar-header-label{display:inline}.yui3-calendarnav-prevmonth{cursor:pointer}.yui3-calendarnav-nextmonth{cursor:pointer}.yui3-skin-sam .yui3-calendarnav-prevmonth,.yui3-skin-sam .yui3-calendarnav-nextmonth{width:0;height:0;padding:0;margin:0;border:10px solid transparent;position:absolute;font-size:0;line-height:0;_border-left-color:white;_border-top-color:white;_border-right-color:white;_border-bottom-color:white;_filter:chroma(color=white)}.yui3-skin-sam .yui3-calendarnav-prevmonth:hover,[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth:hover,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth:hover{border-right-color:#06c}.yui3-skin-sam .yui3-calendarnav-nextmonth:hover,[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth:hover,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth:hover{border-left-color:#06c}.yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,.yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover{cursor:default;border-right-color:#ccc;border-left-color:transparent}.yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled,.yui3-skin-sam .yui3-calendarnav-nextmonth.yui3-calendarnav-month-disabled:hover,[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled,[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth.yui3-calendarnav-month-disabled:hover{cursor:default;border-left-color:#ccc;border-right-color:transparent}.yui3-skin-sam .yui3-calendarnav-prevmonth{border-right-color:#000;left:0;margin-left:-10px}.yui3-skin-sam .yui3-calendarnav-nextmonth{border-left-color:#000;right:0;margin-right:-10px}[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-prevmonth,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-prevmonth{left:auto;right:0;border-left-color:#000;border-right-color:transparent}[dir="rtl"] .yui3-skin-sam .yui3-calendarnav-nextmonth,.yui3-skin-sam [dir="rtl"] .yui3-calendarnav-nextmonth{left:0;right:auto;border-right-color:#000;border-left-color:transparent}#yui3-css-stamp.skin-sam-calendarnavigator{display:none}
@@ -0,0 +1,297 @@
YUI.add('calendarnavigator', function (Y, NAME) {
/**
* Provides a plugin which adds navigation controls to Calendar.
*
* @module calendarnavigator
*/
var CONTENT_BOX = "contentBox",
HOST = "host",
getCN = Y.ClassNameManager.getClassName,
substitute = Y.Lang.sub,
node = Y.Node,
create = node.create,
CALENDAR = 'calendar',
CALENDARNAV = 'calendarnav',
CAL_HD = getCN(CALENDAR, 'header'),
CAL_PREV_M = getCN(CALENDARNAV, 'prevmonth'),
CAL_NEXT_M = getCN(CALENDARNAV, 'nextmonth'),
CAL_DIS_M = getCN(CALENDARNAV, 'month-disabled'),
ydate = Y.DataType.Date;
/**
* A plugin class which adds navigation controls to Calendar.
*
* @class CalendarNavigator
* @extends Plugin.Base
* @namespace Plugin
*/
function CalendarNavigator() {
CalendarNavigator.superclass.constructor.apply(this, arguments);
}
/**
* The namespace for the plugin. This will be the property on the widget, which will
* reference the plugin instance, when it's plugged in.
*
* @property NS
* @static
* @type String
* @default "navigator"
*/
CalendarNavigator.NS = "navigator";
/**
* The NAME of the CalendarNavigator class. Used to prefix events generated
* by the plugin class.
*
* @property NAME
* @static
* @type String
* @default "pluginCalendarNavigator"
*/
CalendarNavigator.NAME = "pluginCalendarNavigator";
/**
* Static property used to define the default attribute
* configuration for the plugin.
*
* @property ATTRS
* @type Object
* @static
*/
CalendarNavigator.ATTRS = {
/**
* The number of months to shift by when the control arrows are clicked.
*
* @attribute shiftByMonths
* @type Number
* @default 1 (months)
*/
shiftByMonths : {
value: 1
}
};
/**
* The CSS classnames for the calendar navigator controls.
* @property CALENDARNAV_STRINGS
* @type Object
* @readOnly
* @protected
* @static
*/
CalendarNavigator.CALENDARNAV_STRINGS = {
prev_month_class: CAL_PREV_M,
next_month_class: CAL_NEXT_M
};
/**
* The template for the calendar navigator previous month control.
* @property PREV_MONTH_CONTROL_TEMPLATE
* @type String
* @protected
* @static
*/
CalendarNavigator.PREV_MONTH_CONTROL_TEMPLATE = '<a class="yui3-u {prev_month_class}" role="button" aria-label="{prev_month_arialabel}" ' +
'tabindex="{control_tabindex}" />';
/**
* The template for the calendar navigator next month control.
* @property NEXT_MONTH_CONTROL_TEMPLATE
* @type String
* @readOnly
* @protected
* @static
*/
CalendarNavigator.NEXT_MONTH_CONTROL_TEMPLATE = '<a class="yui3-u {next_month_class}" role="button" aria-label="{next_month_arialabel}" ' +
'tabindex="{control_tabindex}" />';
Y.extend(CalendarNavigator, Y.Plugin.Base, {
_eventAttachments : {},
_controls: {},
/**
* The initializer lifecycle implementation. Modifies the host widget's
* render to add navigation controls.
*
* @method initializer
*/
initializer : function() {
// After the host has rendered its UI, place the navigation cotnrols
this._controls = {};
this._eventAttachments = {};
this.afterHostMethod("renderUI", this._initNavigationControls);
},
/**
* The initializer destructor implementation. Responsible for destroying the initialized
* control mechanisms.
*
* @method destructor
*/
destructor : function() {
},
/**
* Private utility method that focuses on a navigation button when it is clicked
* or pressed with a keyboard.
*
* @method _focusNavigation
* @param {Event} ev Click or keydown event from the controls
* @protected
*/
_focusNavigation : function (ev) {
ev.currentTarget.focus();
},
/**
* Private utility method that subtracts months from the host calendar date
* based on the control click and the shiftByMonths property.
*
* @method _subtractMonths
* @param {Event} ev Click event from the controls
* @protected
*/
_subtractMonths : function (ev) {
if ( (ev.type === "click") || (ev.type === "keydown" && (ev.keyCode === 13 || ev.keyCode === 32)) ) {
var host = this.get(HOST),
oldDate = host.get("date");
host.set("date", ydate.addMonths(oldDate, -1*this.get("shiftByMonths")));
ev.preventDefault();
}
},
/**
* Private utility method that adds months to the host calendar date
* based on the control click and the shiftByMonths property.
*
* @method _addMonths
* @param {Event} ev Click event from the controls
* @protected
*/
_addMonths : function (ev) {
if ( (ev.type === "click") || (ev.type === "keydown" && (ev.keyCode === 13 || ev.keyCode === 32)) ) {
var host = this.get(HOST),
oldDate = host.get("date");
host.set("date", ydate.addMonths(oldDate, this.get("shiftByMonths")));
ev.preventDefault();
}
},
_updateControlState : function () {
var host = this.get(HOST),
startDate = host.get('date'),
endDate = ydate.addMonths(startDate, host._paneNumber - 1),
minDate = host._normalizeDate(host.get("minimumDate")),
maxDate = host._normalizeDate(host.get("maximumDate"));
if (ydate.areEqual(minDate, startDate)) {
if (this._eventAttachments.prevMonth) {
this._eventAttachments.prevMonth.detach();
this._eventAttachments.prevMonth = false;
}
if (!this._controls.prevMonth.hasClass(CAL_DIS_M)) {
this._controls.prevMonth.addClass(CAL_DIS_M).setAttribute("aria-disabled", "true");
}
}
else {
if (!this._eventAttachments.prevMonth) {
this._eventAttachments.prevMonth = this._controls.prevMonth.on(["click", "keydown"], this._subtractMonths, this);
}
if (this._controls.prevMonth.hasClass(CAL_DIS_M)) {
this._controls.prevMonth.removeClass(CAL_DIS_M).setAttribute("aria-disabled", "false");
}
}
if (ydate.areEqual(maxDate, endDate)) {
if (this._eventAttachments.nextMonth) {
this._eventAttachments.nextMonth.detach();
this._eventAttachments.nextMonth = false;
}
if (!this._controls.nextMonth.hasClass(CAL_DIS_M)) {
this._controls.nextMonth.addClass(CAL_DIS_M).setAttribute("aria-disabled", "true");
}
}
else {
if (!this._eventAttachments.nextMonth) {
this._eventAttachments.nextMonth = this._controls.nextMonth.on(["click", "keydown"], this._addMonths, this);
}
if (this._controls.nextMonth.hasClass(CAL_DIS_M)) {
this._controls.nextMonth.removeClass(CAL_DIS_M).setAttribute("aria-disabled", "false");
}
}
this._controls.prevMonth.on(["click", "keydown"], this._focusNavigation, this);
this._controls.nextMonth.on(["click", "keydown"], this._focusNavigation, this);
},
/**
* Private render assist method that renders the previous month control
*
* @method _renderPrevControls
* @private
*/
_renderPrevControls : function () {
var prevControlNode = create(substitute (CalendarNavigator.PREV_MONTH_CONTROL_TEMPLATE,
CalendarNavigator.CALENDARNAV_STRINGS));
prevControlNode.on("selectstart", this.get(HOST)._preventSelectionStart);
return prevControlNode;
},
/**
* Private render assist method that renders the next month control
*
* @method _renderNextControls
* @private
*/
_renderNextControls : function () {
var nextControlNode = create(substitute (CalendarNavigator.NEXT_MONTH_CONTROL_TEMPLATE,
CalendarNavigator.CALENDARNAV_STRINGS));
nextControlNode.on("selectstart", this.get(HOST)._preventSelectionStart);
return nextControlNode;
},
/**
* Protected render assist method that initialized and renders the navigation controls.
* @method _initNavigationControls
* @protected
*/
_initNavigationControls : function() {
var host = this.get(HOST),
headerCell = host.get(CONTENT_BOX).one("." + CAL_HD);
CalendarNavigator.CALENDARNAV_STRINGS.control_tabindex = host.get("tabIndex");
CalendarNavigator.CALENDARNAV_STRINGS.prev_month_arialabel = "Go to previous month";
CalendarNavigator.CALENDARNAV_STRINGS.next_month_arialabel = "Go to next month";
this._controls.prevMonth = this._renderPrevControls();
this._controls.nextMonth = this._renderNextControls();
this._updateControlState();
host.after(["dateChange", "minimumDateChange", "maximumDateChange"], this._updateControlState, this);
headerCell.prepend(this._controls.prevMonth);
headerCell.append(this._controls.nextMonth);
}
});
Y.namespace("Plugin").CalendarNavigator = CalendarNavigator;
}, '3.18.1', {"requires": ["plugin", "classnamemanager", "datatype-date", "node"], "skinnable": true});
@@ -0,0 +1 @@
YUI.add("calendarnavigator",function(e,t){function v(){v.superclass.constructor.apply(this,arguments)}var n="contentBox",r="host",i=e.ClassNameManager.getClassName,s=e.Lang.sub,o=e.Node,u=o.create,a="calendar",f="calendarnav",l=i(a,"header"),c=i(f,"prevmonth"),h=i(f,"nextmonth"),p=i(f,"month-disabled"),d=e.DataType.Date;v.NS="navigator",v.NAME="pluginCalendarNavigator",v.ATTRS={shiftByMonths:{value:1}},v.CALENDARNAV_STRINGS={prev_month_class:c,next_month_class:h},v.PREV_MONTH_CONTROL_TEMPLATE='<a class="yui3-u {prev_month_class}" role="button" aria-label="{prev_month_arialabel}" tabindex="{control_tabindex}" />',v.NEXT_MONTH_CONTROL_TEMPLATE='<a class="yui3-u {next_month_class}" role="button" aria-label="{next_month_arialabel}" tabindex="{control_tabindex}" />',e.extend(v,e.Plugin.Base,{_eventAttachments:{},_controls:{},initializer:function(){this._controls={},this._eventAttachments={},this.afterHostMethod("renderUI",this._initNavigationControls)},destructor:function(){},_focusNavigation:function(e){e.currentTarget.focus()},_subtractMonths:function(e){if(e.type==="click"||e.type==="keydown"&&(e.keyCode===13||e.keyCode===32)){var t=this.get(r),n=t.get("date");t.set("date",d.addMonths(n,-1*this.get("shiftByMonths"))),e.preventDefault()}},_addMonths:function(e){if(e.type==="click"||e.type==="keydown"&&(e.keyCode===13||e.keyCode===32)){var t=this.get(r),n=t.get("date");t.set("date",d.addMonths(n,this.get("shiftByMonths"))),e.preventDefault()}},_updateControlState:function(){var e=this.get(r),t=e.get("date"),n=d.addMonths(t,e._paneNumber-1),i=e._normalizeDate(e.get("minimumDate")),s=e._normalizeDate(e.get("maximumDate"));d.areEqual(i,t)?(this._eventAttachments.prevMonth&&(this._eventAttachments.prevMonth.detach(),this._eventAttachments.prevMonth=!1),this._controls.prevMonth.hasClass(p)||this._controls.prevMonth.addClass(p).setAttribute("aria-disabled","true")):(this._eventAttachments.prevMonth||(this._eventAttachments.prevMonth=this._controls.prevMonth.on(["click","keydown"],this._subtractMonths,this)),this._controls.prevMonth.hasClass(p)&&this._controls.prevMonth.removeClass(p).setAttribute("aria-disabled","false")),d.areEqual(s,n)?(this._eventAttachments.nextMonth&&(this._eventAttachments.nextMonth.detach(),this._eventAttachments.nextMonth=!1),this._controls.nextMonth.hasClass(p)||this._controls.nextMonth.addClass(p).setAttribute("aria-disabled","true")):(this._eventAttachments.nextMonth||(this._eventAttachments.nextMonth=this._controls.nextMonth.on(["click","keydown"],this._addMonths,this)),this._controls.nextMonth.hasClass(p)&&this._controls.nextMonth.removeClass(p).setAttribute("aria-disabled","false")),this._controls.prevMonth.on(["click","keydown"],this._focusNavigation,this),this._controls.nextMonth.on(["click","keydown"],this._focusNavigation,this)},_renderPrevControls:function(){var e=u(s(v.PREV_MONTH_CONTROL_TEMPLATE,v.CALENDARNAV_STRINGS));return e.on("selectstart",this.get(r)._preventSelectionStart),e},_renderNextControls:function(){var e=u(s(v.NEXT_MONTH_CONTROL_TEMPLATE,v.CALENDARNAV_STRINGS));return e.on("selectstart",this.get(r)._preventSelectionStart),e},_initNavigationControls:function(){var e=this.get(r),t=e.get(n).one("."+l);v.CALENDARNAV_STRINGS.control_tabindex=e.get("tabIndex"),v.CALENDARNAV_STRINGS.prev_month_arialabel="Go to previous month",v.CALENDARNAV_STRINGS.next_month_arialabel="Go to next month",this._controls.prevMonth=this._renderPrevControls(),this._controls.nextMonth=this._renderNextControls(),this._updateControlState(),e.after(["dateChange","minimumDateChange","maximumDateChange"],this._updateControlState,this),t.prepend(this._controls.prevMonth),t.append(this._controls.nextMonth)}}),e.namespace("Plugin").CalendarNavigator=v},"3.18.1",{requires:["plugin","classnamemanager","datatype-date","node"],skinnable:!0});
@@ -0,0 +1,297 @@
YUI.add('calendarnavigator', function (Y, NAME) {
/**
* Provides a plugin which adds navigation controls to Calendar.
*
* @module calendarnavigator
*/
var CONTENT_BOX = "contentBox",
HOST = "host",
getCN = Y.ClassNameManager.getClassName,
substitute = Y.Lang.sub,
node = Y.Node,
create = node.create,
CALENDAR = 'calendar',
CALENDARNAV = 'calendarnav',
CAL_HD = getCN(CALENDAR, 'header'),
CAL_PREV_M = getCN(CALENDARNAV, 'prevmonth'),
CAL_NEXT_M = getCN(CALENDARNAV, 'nextmonth'),
CAL_DIS_M = getCN(CALENDARNAV, 'month-disabled'),
ydate = Y.DataType.Date;
/**
* A plugin class which adds navigation controls to Calendar.
*
* @class CalendarNavigator
* @extends Plugin.Base
* @namespace Plugin
*/
function CalendarNavigator() {
CalendarNavigator.superclass.constructor.apply(this, arguments);
}
/**
* The namespace for the plugin. This will be the property on the widget, which will
* reference the plugin instance, when it's plugged in.
*
* @property NS
* @static
* @type String
* @default "navigator"
*/
CalendarNavigator.NS = "navigator";
/**
* The NAME of the CalendarNavigator class. Used to prefix events generated
* by the plugin class.
*
* @property NAME
* @static
* @type String
* @default "pluginCalendarNavigator"
*/
CalendarNavigator.NAME = "pluginCalendarNavigator";
/**
* Static property used to define the default attribute
* configuration for the plugin.
*
* @property ATTRS
* @type Object
* @static
*/
CalendarNavigator.ATTRS = {
/**
* The number of months to shift by when the control arrows are clicked.
*
* @attribute shiftByMonths
* @type Number
* @default 1 (months)
*/
shiftByMonths : {
value: 1
}
};
/**
* The CSS classnames for the calendar navigator controls.
* @property CALENDARNAV_STRINGS
* @type Object
* @readOnly
* @protected
* @static
*/
CalendarNavigator.CALENDARNAV_STRINGS = {
prev_month_class: CAL_PREV_M,
next_month_class: CAL_NEXT_M
};
/**
* The template for the calendar navigator previous month control.
* @property PREV_MONTH_CONTROL_TEMPLATE
* @type String
* @protected
* @static
*/
CalendarNavigator.PREV_MONTH_CONTROL_TEMPLATE = '<a class="yui3-u {prev_month_class}" role="button" aria-label="{prev_month_arialabel}" ' +
'tabindex="{control_tabindex}" />';
/**
* The template for the calendar navigator next month control.
* @property NEXT_MONTH_CONTROL_TEMPLATE
* @type String
* @readOnly
* @protected
* @static
*/
CalendarNavigator.NEXT_MONTH_CONTROL_TEMPLATE = '<a class="yui3-u {next_month_class}" role="button" aria-label="{next_month_arialabel}" ' +
'tabindex="{control_tabindex}" />';
Y.extend(CalendarNavigator, Y.Plugin.Base, {
_eventAttachments : {},
_controls: {},
/**
* The initializer lifecycle implementation. Modifies the host widget's
* render to add navigation controls.
*
* @method initializer
*/
initializer : function() {
// After the host has rendered its UI, place the navigation cotnrols
this._controls = {};
this._eventAttachments = {};
this.afterHostMethod("renderUI", this._initNavigationControls);
},
/**
* The initializer destructor implementation. Responsible for destroying the initialized
* control mechanisms.
*
* @method destructor
*/
destructor : function() {
},
/**
* Private utility method that focuses on a navigation button when it is clicked
* or pressed with a keyboard.
*
* @method _focusNavigation
* @param {Event} ev Click or keydown event from the controls
* @protected
*/
_focusNavigation : function (ev) {
ev.currentTarget.focus();
},
/**
* Private utility method that subtracts months from the host calendar date
* based on the control click and the shiftByMonths property.
*
* @method _subtractMonths
* @param {Event} ev Click event from the controls
* @protected
*/
_subtractMonths : function (ev) {
if ( (ev.type === "click") || (ev.type === "keydown" && (ev.keyCode === 13 || ev.keyCode === 32)) ) {
var host = this.get(HOST),
oldDate = host.get("date");
host.set("date", ydate.addMonths(oldDate, -1*this.get("shiftByMonths")));
ev.preventDefault();
}
},
/**
* Private utility method that adds months to the host calendar date
* based on the control click and the shiftByMonths property.
*
* @method _addMonths
* @param {Event} ev Click event from the controls
* @protected
*/
_addMonths : function (ev) {
if ( (ev.type === "click") || (ev.type === "keydown" && (ev.keyCode === 13 || ev.keyCode === 32)) ) {
var host = this.get(HOST),
oldDate = host.get("date");
host.set("date", ydate.addMonths(oldDate, this.get("shiftByMonths")));
ev.preventDefault();
}
},
_updateControlState : function () {
var host = this.get(HOST),
startDate = host.get('date'),
endDate = ydate.addMonths(startDate, host._paneNumber - 1),
minDate = host._normalizeDate(host.get("minimumDate")),
maxDate = host._normalizeDate(host.get("maximumDate"));
if (ydate.areEqual(minDate, startDate)) {
if (this._eventAttachments.prevMonth) {
this._eventAttachments.prevMonth.detach();
this._eventAttachments.prevMonth = false;
}
if (!this._controls.prevMonth.hasClass(CAL_DIS_M)) {
this._controls.prevMonth.addClass(CAL_DIS_M).setAttribute("aria-disabled", "true");
}
}
else {
if (!this._eventAttachments.prevMonth) {
this._eventAttachments.prevMonth = this._controls.prevMonth.on(["click", "keydown"], this._subtractMonths, this);
}
if (this._controls.prevMonth.hasClass(CAL_DIS_M)) {
this._controls.prevMonth.removeClass(CAL_DIS_M).setAttribute("aria-disabled", "false");
}
}
if (ydate.areEqual(maxDate, endDate)) {
if (this._eventAttachments.nextMonth) {
this._eventAttachments.nextMonth.detach();
this._eventAttachments.nextMonth = false;
}
if (!this._controls.nextMonth.hasClass(CAL_DIS_M)) {
this._controls.nextMonth.addClass(CAL_DIS_M).setAttribute("aria-disabled", "true");
}
}
else {
if (!this._eventAttachments.nextMonth) {
this._eventAttachments.nextMonth = this._controls.nextMonth.on(["click", "keydown"], this._addMonths, this);
}
if (this._controls.nextMonth.hasClass(CAL_DIS_M)) {
this._controls.nextMonth.removeClass(CAL_DIS_M).setAttribute("aria-disabled", "false");
}
}
this._controls.prevMonth.on(["click", "keydown"], this._focusNavigation, this);
this._controls.nextMonth.on(["click", "keydown"], this._focusNavigation, this);
},
/**
* Private render assist method that renders the previous month control
*
* @method _renderPrevControls
* @private
*/
_renderPrevControls : function () {
var prevControlNode = create(substitute (CalendarNavigator.PREV_MONTH_CONTROL_TEMPLATE,
CalendarNavigator.CALENDARNAV_STRINGS));
prevControlNode.on("selectstart", this.get(HOST)._preventSelectionStart);
return prevControlNode;
},
/**
* Private render assist method that renders the next month control
*
* @method _renderNextControls
* @private
*/
_renderNextControls : function () {
var nextControlNode = create(substitute (CalendarNavigator.NEXT_MONTH_CONTROL_TEMPLATE,
CalendarNavigator.CALENDARNAV_STRINGS));
nextControlNode.on("selectstart", this.get(HOST)._preventSelectionStart);
return nextControlNode;
},
/**
* Protected render assist method that initialized and renders the navigation controls.
* @method _initNavigationControls
* @protected
*/
_initNavigationControls : function() {
var host = this.get(HOST),
headerCell = host.get(CONTENT_BOX).one("." + CAL_HD);
CalendarNavigator.CALENDARNAV_STRINGS.control_tabindex = host.get("tabIndex");
CalendarNavigator.CALENDARNAV_STRINGS.prev_month_arialabel = "Go to previous month";
CalendarNavigator.CALENDARNAV_STRINGS.next_month_arialabel = "Go to next month";
this._controls.prevMonth = this._renderPrevControls();
this._controls.nextMonth = this._renderNextControls();
this._updateControlState();
host.after(["dateChange", "minimumDateChange", "maximumDateChange"], this._updateControlState, this);
headerCell.prepend(this._controls.prevMonth);
headerCell.append(this._controls.nextMonth);
}
});
Y.namespace("Plugin").CalendarNavigator = CalendarNavigator;
}, '3.18.1', {"requires": ["plugin", "classnamemanager", "datatype-date", "node"], "skinnable": true});