Skip to content
Browse files

Build for fixes to #2532705

  • Loading branch information...
1 parent f98a0f6 commit acc255d2efbd3389471fa215da9f6e27e3b031d7 @allenrabinovich committed
View
4 build/calendar-base/calendar-base-coverage.js
2 additions, 2 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 build/calendar-base/calendar-base-debug.js
@@ -32,7 +32,7 @@ var getCN = Y.ClassNameManager.getClassName,
L = Y.Lang,
node = Y.Node,
create = node.create,
- substitute = Y.substitute,
+ substitute = L.sub,
each = Y.each,
hasVal = Y.Array.hasValue,
iOf = Y.Array.indexOf,
View
2 build/calendar-base/calendar-base-min.js
@@ -1 +1 @@
-YUI.add("calendar-base",function(e,t){function P(e){P.superclass.constructor.apply(this,arguments)}var n=e.ClassNameManager.getClassName,r="calendar",i=n(r,"grid"),s=n(r,"left-grid"),o=n(r,"right-grid"),u=n(r,"body"),a=n(r,"header"),f=n(r,"header-label"),l=n(r,"weekdayrow"),c=n(r,"weekday"),h=n(r,"column-hidden"),p=n(r,"day-selected"),d=n(r,"selection-disabled"),v=n(r,"row"),m=n(r,"day"),g=n(r,"prevmonth-day"),y=n(r,"nextmonth-day"),b=n(r,"anchor"),w=n(r,"pane"),E=n(r,"status"),S=e.Lang,x=e.Node,T=x.create,N=e.substitute,C=e.each,k=e.Array.hasValue,L=e.Array.indexOf,A=e.Object.hasKey,O=e.Object.setValue,M=e.Object.owns,_=e.Object.isEmpty,D=e.DataType.Date;e.CalendarBase=e.extend(P,e.Widget,{_paneProperties:{},_paneNumber:1,_calendarId:null,_selectedDates:{},_rules:{},_filterFunction:null,_storedDateCells:{},initializer:function(){this._paneProperties={},this._calendarId=e.guid("calendar"),this._selectedDates={},_(this._rules)&&(this._rules={}),this._storedDateCells={}},renderUI:function(){var e=this.get("contentBox");e.appendChild(this._initCalendarHTML(this.get("date"))),this.get("showPrevMonth")&&this._afterShowPrevMonthChange(),this.get("showNextMonth")&&this._afterShowNextMonthChange(),this._renderCustomRules(),this._renderSelectedDates(),this.get("boundingBox").setAttribute("aria-labelledby",this._calendarId+"_header")},bindUI:function(){this.after("dateChange",this._afterDateChange),this.after("showPrevMonthChange",this._afterShowPrevMonthChange),this.after("showNextMonthChange",this._afterShowNextMonthChange),this.after("headerRendererChange",this._afterHeaderRendererChange),this.after("customRendererChange",this._afterCustomRendererChange),this.after("enabledDatesRuleChange",this._afterCustomRendererChange),this.after("disabledDatesRuleChange",this._afterCustomRendererChange),this.after("focusedChange",this._afterFocusedChange),this.after("selectionChange",this._renderSelectedDates),this._bindCalendarEvents()},_getSelectedDatesList:function(){var e=[];return C(this._selectedDates,function(t){C(t,function(t){C(t,function(t){e.push(t)},this)},this)},this),e},_getSelectedDatesInMonth:function(t){var n=t.getFullYear(),r=t.getMonth();return A(this._selectedDates,n)&&A(this._selectedDates[n],r)?e.Object.values(this._selectedDates[n][r]):[]},_isNumInList:function(e,t){if(t=="all")return!0;var n=t.split(","),r=n.length;while(r--){var i=n[r].split("-");if(i.length==2&&e>=parseInt(i[0],10)&&e<=parseInt(i[1],10))return!0;if(i.length==1&&parseInt(n[r],10)==e)return!0}return!1},_getRulesForDate:function(e){var t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=e.getDay(),s=this._rules,o=[],u,a,f,l;for(u in s)if(this._isNumInList(t,u))if(S.isString(s[u]))o.push(s[u]);else for(a in s[u])if(this._isNumInList(n,a))if(S.isString(s[u][a]))o.push(s[u][a]);else for(f in s[u][a])if(this._isNumInList(r,f))if(S.isString(s[u][a][f]))o.push(s[u][a][f]);else for(l in s[u][a][f])this._isNumInList(i,l)&&S.isString(s[u][a][f][l])&&o.push(s[u][a][f][l]);return o},_matchesRule:function(e,t){return L(this._getRulesForDate(e),t)>=0},_canBeSelected:function(e){var t=this.get("enabledDatesRule"),n=this.get("disabledDatesRule");return t?this._matchesRule(e,t):n?!this._matchesRule(e,n):!0},selectDates:function(e){return D.isValidDate(e)?this._addDateToSelection(e):S.isArray(e)&&this._addDatesToSelection(e),this},deselectDates:function(e){return e?D.isValidDate(e)?this._removeDateFromSelection(e):S.isArray(e)&&this._removeDatesFromSelection(e):this._clearSelection(),this},_addDateToSelection:function(e,t){if(this._canBeSelected(e)){var n=e.getFullYear(),r=e.getMonth(),i=e.getDate();A(this._selectedDates,n)?A(this._selectedDates[n],r)?this._selectedDates[n][r][i]=e:(this._selectedDates[n][r]={},this._selectedDates[n][r][i]=e):(this._selectedDates[n]={},this._selectedDates[n][r]={},this._selectedDates[n][r][i]=e),this._selectedDates=O(this._selectedDates,[n,r,i],e),t||this._fireSelectionChange()}},_addDatesToSelection:function(e){C(e,this._addDateToSelection,this),this._fireSelectionChange()},_addDateRangeToSelection:function(e,t){var n=(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4,r=e.getTime(),i=t.getTime();if(r>i){var s=r;r=i,i=s+n}else i-=n;for(var o=r;o<=i;o+=864e5){var u=new Date(o);u.setHours(12),this._addDateToSelection(u,o)}this._fireSelectionChange()},_removeDateFromSelection:function(e,t){var n=e.getFullYear(),r=e.getMonth(),i=e.getDate();A(this._selectedDates,n)&&A(this._selectedDates[n],r)&&A(this._selectedDates[n][r],i)&&(delete this._selectedDates[n][r][i],t||this._fireSelectionChange())},_removeDatesFromSelection:function(e){C(e,this._removeDateFromSelection,this),this._fireSelectionChange()},_removeDateRangeFromSelection:function(e,t){var n=e.getTime(),r=t.getTime();for(var i=n;i<=r;i+=864e5)this._removeDateFromSelection(new Date(i),i);this._fireSelectionChange()},_clearSelection:function(e){this._selectedDates={},this.get("contentBox").all("."+p).removeClass(p).setAttribute("aria-selected",!1),e||this._fireSelectionChange()},_fireSelectionChange:function(){this.fire("selectionChange",{newSelection:this._getSelectedDatesList()})},_restoreModifiedCells:function(){var e=this.get("contentBox"),t;for(t in this._storedDateCells)e.one("#"+t).replace(this._storedDateCells[t]),delete this._storedDateCells[t]},_renderCustomRules:function(){this.get("contentBox").all("."+m+",."+y).removeClass(d).setAttribute("aria-disabled",!1);if(!_(this._rules)){var e=this.get("enabledDatesRule"),t=this.get("disabledDatesRule");for(var n=0;n<this._paneNumber;n++){var r=D.addMonths(this.get("date"),n),i=D.listOfDatesInMonth(r);C(i,function(n){var r=this._getRulesForDate(n);if(r.length>0){var i=this._dateToNode(n);(e&&L(r,e)<0||!e&&t&&L(r,t)>=0)&&i.addClass(d).setAttribute("aria-disabled",!0),S.isFunction(this._filterFunction)&&(this._storedDateCells[i.get("id")]=i.cloneNode(!0),this._filterFunction(n,i,r))}else if(e){var i=this._dateToNode(n);i.addClass(d).setAttribute("aria-disabled",!0)}},this)}}},_renderSelectedDates:function(){this.get("contentBox").all("."+p).removeClass(p).setAttribute("aria-selected",!1);for(var e=0;e<this._paneNumber;e++){var t=D.addMonths(this.get("date"),e),n=this._getSelectedDatesInMonth(t);C(n,function(e){this._dateToNode(e).addClass(p).setAttribute("aria-selected",!0)},this)}},_dateToNode:function(e){var t=e.getDate(),n=0,r=t%7,i=(12+e.getMonth()-this.get("date").getMonth())%12,s=this._calendarId+"_pane_"+i,o=this._paneProperties[s].cutoffCol;switch(r){case 0:o>=6?n=12:n=5;break;case 1:n=6;break;case 2:o>0?n=7:n=0;break;case 3:o>1?n=8:n=1;break;case 4:o>2?n=9:n=2;break;case 5:o>3?n=10:n=3;break;case 6:o>4?n=11:n=4}return this.get("contentBox").one("#"+this._calendarId+"_pane_"+i+"_"+n+"_"+t)},_nodeToDate:function(e){var t=e.get("id").split("_").reverse(),n=parseInt(t[2],10),r=parseInt(t[0],10),i=D.addMonths(this.get("date"),n),s=i.getFullYear(),o=i.getMonth();return new Date(s,o,r,12,0,0,0)},_bindCalendarEvents:function(){},_normalizeDate:function(e){return e?new Date(e.getFullYear(),e.getMonth(),1,12,0,0,0):null},_getCutoffColumn:function(e,t){var n=this._normalizeDate(e).getDay()-t,r=6-(n+7)%7;return r},_turnPrevMonthOn:function(e){var t=e.get("id"),n=this._paneProperties[t].paneDate,r=D.daysInMonth(D.addMonths(n,-1));this._paneProperties[t].hasOwnProperty("daysInPrevMonth")||(this._paneProperties[t].daysInPrevMonth=0);if(r!=this._paneProperties[t].daysInPrevMonth){this._paneProperties[t].daysInPrevMonth=r;for(var i=5;i>=0;i--)e.one("#"+t+"_"+i+"_"+(i-5)).set("text",r--)}},_turnPrevMonthOff:function(e){var t=e.get("id");this._paneProperties[t].daysInPrevMonth=0;for(var n=5;n>=0;n--)e.one("#"+t+"_"+n+"_"+(n-5)).setContent("&nbsp;")},_cleanUpNextMonthCells:function(e){var t=e.get("id");e.one("#"+t+"_6_29").removeClass(y),e.one("#"+t+"_7_30").removeClass(y),e.one("#"+t+"_8_31").removeClass(y),e.one("#"+t+"_0_30").removeClass(y),e.one("#"+t+"_1_31").removeClass(y)},_turnNextMonthOn:function(e){var t=1,n=e.get("id"),r=this._paneProperties[n].daysInMonth,i=this._paneProperties[n].cutoffCol;for(var s=r-22;s<i+7;s++)e.one("#"+n+"_"+s+"_"+(s+23)).set("text",t++).addClass(y);var o=i;r==31&&i<=1?o=2:r==30&&i===0&&(o=1);for(var s=o;s<i+7;s++)e.one("#"+n+"_"+s+"_"+(s+30)).set("text",t++).addClass(y)},_turnNextMonthOff:function(e){var t=e.get("id"),n=this._paneProperties[t].daysInMonth,r=this._paneProperties[t].cutoffCol;for(var i=n-22;i<=12;i++)e.one("#"+t+"_"+i+"_"+(i+23)).setContent("&nbsp;").addClass(y);var s=0;n==31&&r<=1?s=2:n==30&&r===0&&(s=1);for(var i=s;i<=12;i++)e.one("#"+t+"_"+i+"_"+(i+30)).setContent("&nbsp;").addClass(y)},_afterShowNextMonthChange:function(){var e=this.get("contentBox"),t=e.one("#"+this._calendarId+"_pane_"+(this._paneNumber-1));this._cleanUpNextMonthCells(t),this.get("showNextMonth")?this._turnNextMonthOn(t):this._turnNextMonthOff(t)},_afterShowPrevMonthChange:function(){var e=this.get("contentBox"),t=e.one("#"+this._calendarId+"_pane_"+0);this.get("showPrevMonth")?this._turnPrevMonthOn(t):this._turnPrevMonthOff(t)},_afterHeaderRendererChange:function(){var e=this.get("contentBox").one("."+f);e.setContent(this._updateCalendarHeader(this.get("date")))},_afterCustomRendererChange:function(){this._restoreModifiedCells(),this._renderCustomRules()},_afterDateChange:function(){var e=this.get("contentBox"),t=e.one("."+a).one("."+f),n=e.all("."+i),r=this.get("date"),s=0;e.setStyle("visibility","hidden"),t.setContent(this._updateCalendarHeader(r)),this._restoreModifiedCells(),n.each(function(e){this._rerenderCalendarPane(D.addMonths(r,s++),e)},this),this._afterShowPrevMonthChange(),this._afterShowNextMonthChange(),this._renderCustomRules(),this._renderSelectedDates(),e.setStyle("visibility","visible")},_initCalendarPane:function(e,t){var n="",r=this.get("strings.very_short_weekdays")||["Su","Mo","Tu","We","Th","Fr","Sa"],i=this.get("strings.weekdays")||["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=this.get("strings.first_weekday")||0,o=this._getCutoffColumn(e,s),u=D.daysInMonth(e),a=["","","","","",""],f={};f.weekday_row="";for(var l=s;l<=s+6;l++)f.weekday_row+=N(P.WEEKDAY_TEMPLATE,{weekdayname:r[l%7],full_weekdayname:i[l%7]});f.weekday_row_template=N(P.WEEKDAY_ROW_TEMPLATE,f);for(var c=0;c<=5;c++)for(var p=0;p<=12;p++){var d=7*c-5+p,v=t+"_"+p+"_"+d,b=m;d<1?b=g:d>u&&(b=y);if(d<1||d>u)d="&nbsp;";var w=p>=o&&p<o+7?"":h;a[c]+=N(P.CALDAY_TEMPLATE,{day_content:d,calendar_col_class:"calendar_col"+p,calendar_col_visibility_class:w,calendar_day_class:b,calendar_day_id:v})}f.body_template="",C(a,function(e){f.body_template+=N(P.CALDAY_ROW_TEMPLATE,{calday_row:e})}),f.calendar_pane_id=t,f.calendar_pane_tabindex=this.get("tabIndex"),f.pane_arialabel=D.format(e,{format:"%B %Y"});var E=N(N(P.CALENDAR_GRID_TEMPLATE,f),P.CALENDAR_STRINGS);return this._paneProperties[t]={cutoffCol:o,daysInMonth:u,paneDate:e},E},_rerenderCalendarPane:function(e,t){var n=this.get("strings.first_weekday")||0,r=this._getCutoffColumn(e,n),i=D.daysInMonth(e),s=t.get("id");t.setStyle("visibility","hidden"),t.setAttribute("aria-label",D.format(e,{format:"%B %Y"}));for(var o=0;o<=12;o++){var u=t.all(".calendar_col"+o);u.removeClass(h);if(o<r||o>=r+7)u.addClass(h);else switch(o){case 0:var a=t.one("#"+s+"_0_30");i>=30?(a.set("text","30"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.addClass(y).addClass(m));break;case 1:var a=t.one("#"+s+"_1_31");i>=31?(a.set("text","31"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y));break;case 6:var a=t.one("#"+s+"_6_29");i>=29?(a.set("text","29"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y));break;case 7:var a=t.one("#"+s+"_7_30");i>=30?(a.set("text","30"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y));break;case 8:var a=t.one("#"+s+"_8_31");i>=31?(a.set("text","31"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y))}}this._paneProperties[s].cutoffCol=r,this._paneProperties[s].daysInMonth=i,this._paneProperties[s].paneDate=e,t.setStyle("visibility","visible")},_updateCalendarHeader:function(t){var n="",r=this.get("headerRenderer");return e.Lang.isString(r)?n=D.format(t,{format:r}):r instanceof Function&&(n=r.call(this,t)),n},_initCalendarHeader:function(e){return N(N(P.HEADER_TEMPLATE,{calheader:this._updateCalendarHeader(e),calendar_id:this._calendarId}),P.CALENDAR_STRINGS)},_initCalendarHTML:function(t){function i(){var e=this._initCalendarPane(D.addMonths(t,r),n.calendar_id+"_pane_"+r);return r++,e}var n={},r=0;n.header_template=this._initCalendarHeader(t),n.calendar_id=this._calendarId,n.body_template=N(N(P.CONTENT_TEMPLATE,n),P.CALENDAR_STRINGS);var s=n.body_template.replace(/\{calendar_grid_template\}/g,e.bind(i,this));return this._paneNumber=r,s}},{CALENDAR_STRINGS:{calendar_grid_class:i,calendar_body_class:u,calendar_hd_class:a,calendar_hd_label_class:f,calendar_weekdayrow_class:l,calendar_weekday_class:c,calendar_row_class:v,calendar_day_class:m,calendar_dayanchor_class:b,calendar_pane_class:w,calendar_right_grid_class:o,calendar_left_grid_class:s,calendar_status_class:E},CONTENT_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1">{calendar_grid_template}</div></div>',ONE_PANE_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1">{calendar_grid_template}</div></div>',TWO_PANE_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1-2"><div class = "{calendar_left_grid_class}">{calendar_grid_template}</div></div><div class="yui3-u-1-2"><div class = "{calendar_right_grid_class}">{calendar_grid_template}</div></div></div>',THREE_PANE_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1-3"><div class = "{calendar_left_grid_class}">{calendar_grid_template}</div></div><div class="yui3-u-1-3">{calendar_grid_template}</div><div class="yui3-u-1-3"><div class = "{calendar_right_grid_class}">{calendar_grid_template}</div></div></div>',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}"><thead>{weekday_row_template}</thead><tbody>{body_template}</tbody></table>',HEADER_TEMPLATE:'<div class="yui3-g {calendar_hd_class}"><div class="yui3-u {calendar_hd_label_class}" id="{calendar_id}_header" aria-role="heading">{calheader}</div></div>',WEEKDAY_ROW_TEMPLATE:'<tr class="{calendar_weekdayrow_class}" role="row">{weekday_row}</tr>',CALDAY_ROW_TEMPLATE:'<tr class="{calendar_row_class}" role="row">{calday_row}</tr>',WEEKDAY_TEMPLATE:'<th class="{calendar_weekday_class}" role="columnheader" aria-label="{full_weekdayname}">{weekdayname}</th>',CALDAY_TEMPLATE:'<td class="{calendar_col_class} {calendar_day_class} {calendar_col_visibility_class}" id="{calendar_day_id}" role="gridcell" tabindex="-1">{day_content}</td>',NAME:"calendarBase",ATTRS:{tabIndex:{value:1},date:{value:new Date,setter:function(e){var t=this._normalizeDate(e);return D.areEqual(t,this.get("date"))?this.get("date"):t}},showPrevMonth:{value:!1},showNextMonth:{value:!1},strings:{valueFn:function(){return e.Intl.get("calendar-base")}},headerRenderer:{value:"%B %Y"},enabledDatesRule:{value:null},disabledDatesRule:{value:null},selectedDates:{readOnly:!0,getter:function(e){return this._getSelectedDatesList()}},customRenderer:{lazyAdd:!1,value:{},setter:function(e){this._rules=e.rules,this._filterFunction=e.filterFunction}}}})},"@VERSION@",{requires:["widget","substitute","datatype-date","datatype-date-math","cssgrids"],lang:["de","en","es","es-AR","fr","it","ja","nb-NO","nl","pt-BR","ru","zh-HANT-TW"],skinnable:!0});
+YUI.add("calendar-base",function(e,t){function P(e){P.superclass.constructor.apply(this,arguments)}var n=e.ClassNameManager.getClassName,r="calendar",i=n(r,"grid"),s=n(r,"left-grid"),o=n(r,"right-grid"),u=n(r,"body"),a=n(r,"header"),f=n(r,"header-label"),l=n(r,"weekdayrow"),c=n(r,"weekday"),h=n(r,"column-hidden"),p=n(r,"day-selected"),d=n(r,"selection-disabled"),v=n(r,"row"),m=n(r,"day"),g=n(r,"prevmonth-day"),y=n(r,"nextmonth-day"),b=n(r,"anchor"),w=n(r,"pane"),E=n(r,"status"),S=e.Lang,x=e.Node,T=x.create,N=S.sub,C=e.each,k=e.Array.hasValue,L=e.Array.indexOf,A=e.Object.hasKey,O=e.Object.setValue,M=e.Object.owns,_=e.Object.isEmpty,D=e.DataType.Date;e.CalendarBase=e.extend(P,e.Widget,{_paneProperties:{},_paneNumber:1,_calendarId:null,_selectedDates:{},_rules:{},_filterFunction:null,_storedDateCells:{},initializer:function(){this._paneProperties={},this._calendarId=e.guid("calendar"),this._selectedDates={},_(this._rules)&&(this._rules={}),this._storedDateCells={}},renderUI:function(){var e=this.get("contentBox");e.appendChild(this._initCalendarHTML(this.get("date"))),this.get("showPrevMonth")&&this._afterShowPrevMonthChange(),this.get("showNextMonth")&&this._afterShowNextMonthChange(),this._renderCustomRules(),this._renderSelectedDates(),this.get("boundingBox").setAttribute("aria-labelledby",this._calendarId+"_header")},bindUI:function(){this.after("dateChange",this._afterDateChange),this.after("showPrevMonthChange",this._afterShowPrevMonthChange),this.after("showNextMonthChange",this._afterShowNextMonthChange),this.after("headerRendererChange",this._afterHeaderRendererChange),this.after("customRendererChange",this._afterCustomRendererChange),this.after("enabledDatesRuleChange",this._afterCustomRendererChange),this.after("disabledDatesRuleChange",this._afterCustomRendererChange),this.after("focusedChange",this._afterFocusedChange),this.after("selectionChange",this._renderSelectedDates),this._bindCalendarEvents()},_getSelectedDatesList:function(){var e=[];return C(this._selectedDates,function(t){C(t,function(t){C(t,function(t){e.push(t)},this)},this)},this),e},_getSelectedDatesInMonth:function(t){var n=t.getFullYear(),r=t.getMonth();return A(this._selectedDates,n)&&A(this._selectedDates[n],r)?e.Object.values(this._selectedDates[n][r]):[]},_isNumInList:function(e,t){if(t=="all")return!0;var n=t.split(","),r=n.length;while(r--){var i=n[r].split("-");if(i.length==2&&e>=parseInt(i[0],10)&&e<=parseInt(i[1],10))return!0;if(i.length==1&&parseInt(n[r],10)==e)return!0}return!1},_getRulesForDate:function(e){var t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=e.getDay(),s=this._rules,o=[],u,a,f,l;for(u in s)if(this._isNumInList(t,u))if(S.isString(s[u]))o.push(s[u]);else for(a in s[u])if(this._isNumInList(n,a))if(S.isString(s[u][a]))o.push(s[u][a]);else for(f in s[u][a])if(this._isNumInList(r,f))if(S.isString(s[u][a][f]))o.push(s[u][a][f]);else for(l in s[u][a][f])this._isNumInList(i,l)&&S.isString(s[u][a][f][l])&&o.push(s[u][a][f][l]);return o},_matchesRule:function(e,t){return L(this._getRulesForDate(e),t)>=0},_canBeSelected:function(e){var t=this.get("enabledDatesRule"),n=this.get("disabledDatesRule");return t?this._matchesRule(e,t):n?!this._matchesRule(e,n):!0},selectDates:function(e){return D.isValidDate(e)?this._addDateToSelection(e):S.isArray(e)&&this._addDatesToSelection(e),this},deselectDates:function(e){return e?D.isValidDate(e)?this._removeDateFromSelection(e):S.isArray(e)&&this._removeDatesFromSelection(e):this._clearSelection(),this},_addDateToSelection:function(e,t){if(this._canBeSelected(e)){var n=e.getFullYear(),r=e.getMonth(),i=e.getDate();A(this._selectedDates,n)?A(this._selectedDates[n],r)?this._selectedDates[n][r][i]=e:(this._selectedDates[n][r]={},this._selectedDates[n][r][i]=e):(this._selectedDates[n]={},this._selectedDates[n][r]={},this._selectedDates[n][r][i]=e),this._selectedDates=O(this._selectedDates,[n,r,i],e),t||this._fireSelectionChange()}},_addDatesToSelection:function(e){C(e,this._addDateToSelection,this),this._fireSelectionChange()},_addDateRangeToSelection:function(e,t){var n=(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4,r=e.getTime(),i=t.getTime();if(r>i){var s=r;r=i,i=s+n}else i-=n;for(var o=r;o<=i;o+=864e5){var u=new Date(o);u.setHours(12),this._addDateToSelection(u,o)}this._fireSelectionChange()},_removeDateFromSelection:function(e,t){var n=e.getFullYear(),r=e.getMonth(),i=e.getDate();A(this._selectedDates,n)&&A(this._selectedDates[n],r)&&A(this._selectedDates[n][r],i)&&(delete this._selectedDates[n][r][i],t||this._fireSelectionChange())},_removeDatesFromSelection:function(e){C(e,this._removeDateFromSelection,this),this._fireSelectionChange()},_removeDateRangeFromSelection:function(e,t){var n=e.getTime(),r=t.getTime();for(var i=n;i<=r;i+=864e5)this._removeDateFromSelection(new Date(i),i);this._fireSelectionChange()},_clearSelection:function(e){this._selectedDates={},this.get("contentBox").all("."+p).removeClass(p).setAttribute("aria-selected",!1),e||this._fireSelectionChange()},_fireSelectionChange:function(){this.fire("selectionChange",{newSelection:this._getSelectedDatesList()})},_restoreModifiedCells:function(){var e=this.get("contentBox"),t;for(t in this._storedDateCells)e.one("#"+t).replace(this._storedDateCells[t]),delete this._storedDateCells[t]},_renderCustomRules:function(){this.get("contentBox").all("."+m+",."+y).removeClass(d).setAttribute("aria-disabled",!1);if(!_(this._rules)){var e=this.get("enabledDatesRule"),t=this.get("disabledDatesRule");for(var n=0;n<this._paneNumber;n++){var r=D.addMonths(this.get("date"),n),i=D.listOfDatesInMonth(r);C(i,function(n){var r=this._getRulesForDate(n);if(r.length>0){var i=this._dateToNode(n);(e&&L(r,e)<0||!e&&t&&L(r,t)>=0)&&i.addClass(d).setAttribute("aria-disabled",!0),S.isFunction(this._filterFunction)&&(this._storedDateCells[i.get("id")]=i.cloneNode(!0),this._filterFunction(n,i,r))}else if(e){var i=this._dateToNode(n);i.addClass(d).setAttribute("aria-disabled",!0)}},this)}}},_renderSelectedDates:function(){this.get("contentBox").all("."+p).removeClass(p).setAttribute("aria-selected",!1);for(var e=0;e<this._paneNumber;e++){var t=D.addMonths(this.get("date"),e),n=this._getSelectedDatesInMonth(t);C(n,function(e){this._dateToNode(e).addClass(p).setAttribute("aria-selected",!0)},this)}},_dateToNode:function(e){var t=e.getDate(),n=0,r=t%7,i=(12+e.getMonth()-this.get("date").getMonth())%12,s=this._calendarId+"_pane_"+i,o=this._paneProperties[s].cutoffCol;switch(r){case 0:o>=6?n=12:n=5;break;case 1:n=6;break;case 2:o>0?n=7:n=0;break;case 3:o>1?n=8:n=1;break;case 4:o>2?n=9:n=2;break;case 5:o>3?n=10:n=3;break;case 6:o>4?n=11:n=4}return this.get("contentBox").one("#"+this._calendarId+"_pane_"+i+"_"+n+"_"+t)},_nodeToDate:function(e){var t=e.get("id").split("_").reverse(),n=parseInt(t[2],10),r=parseInt(t[0],10),i=D.addMonths(this.get("date"),n),s=i.getFullYear(),o=i.getMonth();return new Date(s,o,r,12,0,0,0)},_bindCalendarEvents:function(){},_normalizeDate:function(e){return e?new Date(e.getFullYear(),e.getMonth(),1,12,0,0,0):null},_getCutoffColumn:function(e,t){var n=this._normalizeDate(e).getDay()-t,r=6-(n+7)%7;return r},_turnPrevMonthOn:function(e){var t=e.get("id"),n=this._paneProperties[t].paneDate,r=D.daysInMonth(D.addMonths(n,-1));this._paneProperties[t].hasOwnProperty("daysInPrevMonth")||(this._paneProperties[t].daysInPrevMonth=0);if(r!=this._paneProperties[t].daysInPrevMonth){this._paneProperties[t].daysInPrevMonth=r;for(var i=5;i>=0;i--)e.one("#"+t+"_"+i+"_"+(i-5)).set("text",r--)}},_turnPrevMonthOff:function(e){var t=e.get("id");this._paneProperties[t].daysInPrevMonth=0;for(var n=5;n>=0;n--)e.one("#"+t+"_"+n+"_"+(n-5)).setContent("&nbsp;")},_cleanUpNextMonthCells:function(e){var t=e.get("id");e.one("#"+t+"_6_29").removeClass(y),e.one("#"+t+"_7_30").removeClass(y),e.one("#"+t+"_8_31").removeClass(y),e.one("#"+t+"_0_30").removeClass(y),e.one("#"+t+"_1_31").removeClass(y)},_turnNextMonthOn:function(e){var t=1,n=e.get("id"),r=this._paneProperties[n].daysInMonth,i=this._paneProperties[n].cutoffCol;for(var s=r-22;s<i+7;s++)e.one("#"+n+"_"+s+"_"+(s+23)).set("text",t++).addClass(y);var o=i;r==31&&i<=1?o=2:r==30&&i===0&&(o=1);for(var s=o;s<i+7;s++)e.one("#"+n+"_"+s+"_"+(s+30)).set("text",t++).addClass(y)},_turnNextMonthOff:function(e){var t=e.get("id"),n=this._paneProperties[t].daysInMonth,r=this._paneProperties[t].cutoffCol;for(var i=n-22;i<=12;i++)e.one("#"+t+"_"+i+"_"+(i+23)).setContent("&nbsp;").addClass(y);var s=0;n==31&&r<=1?s=2:n==30&&r===0&&(s=1);for(var i=s;i<=12;i++)e.one("#"+t+"_"+i+"_"+(i+30)).setContent("&nbsp;").addClass(y)},_afterShowNextMonthChange:function(){var e=this.get("contentBox"),t=e.one("#"+this._calendarId+"_pane_"+(this._paneNumber-1));this._cleanUpNextMonthCells(t),this.get("showNextMonth")?this._turnNextMonthOn(t):this._turnNextMonthOff(t)},_afterShowPrevMonthChange:function(){var e=this.get("contentBox"),t=e.one("#"+this._calendarId+"_pane_"+0);this.get("showPrevMonth")?this._turnPrevMonthOn(t):this._turnPrevMonthOff(t)},_afterHeaderRendererChange:function(){var e=this.get("contentBox").one("."+f);e.setContent(this._updateCalendarHeader(this.get("date")))},_afterCustomRendererChange:function(){this._restoreModifiedCells(),this._renderCustomRules()},_afterDateChange:function(){var e=this.get("contentBox"),t=e.one("."+a).one("."+f),n=e.all("."+i),r=this.get("date"),s=0;e.setStyle("visibility","hidden"),t.setContent(this._updateCalendarHeader(r)),this._restoreModifiedCells(),n.each(function(e){this._rerenderCalendarPane(D.addMonths(r,s++),e)},this),this._afterShowPrevMonthChange(),this._afterShowNextMonthChange(),this._renderCustomRules(),this._renderSelectedDates(),e.setStyle("visibility","visible")},_initCalendarPane:function(e,t){var n="",r=this.get("strings.very_short_weekdays")||["Su","Mo","Tu","We","Th","Fr","Sa"],i=this.get("strings.weekdays")||["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=this.get("strings.first_weekday")||0,o=this._getCutoffColumn(e,s),u=D.daysInMonth(e),a=["","","","","",""],f={};f.weekday_row="";for(var l=s;l<=s+6;l++)f.weekday_row+=N(P.WEEKDAY_TEMPLATE,{weekdayname:r[l%7],full_weekdayname:i[l%7]});f.weekday_row_template=N(P.WEEKDAY_ROW_TEMPLATE,f);for(var c=0;c<=5;c++)for(var p=0;p<=12;p++){var d=7*c-5+p,v=t+"_"+p+"_"+d,b=m;d<1?b=g:d>u&&(b=y);if(d<1||d>u)d="&nbsp;";var w=p>=o&&p<o+7?"":h;a[c]+=N(P.CALDAY_TEMPLATE,{day_content:d,calendar_col_class:"calendar_col"+p,calendar_col_visibility_class:w,calendar_day_class:b,calendar_day_id:v})}f.body_template="",C(a,function(e){f.body_template+=N(P.CALDAY_ROW_TEMPLATE,{calday_row:e})}),f.calendar_pane_id=t,f.calendar_pane_tabindex=this.get("tabIndex"),f.pane_arialabel=D.format(e,{format:"%B %Y"});var E=N(N(P.CALENDAR_GRID_TEMPLATE,f),P.CALENDAR_STRINGS);return this._paneProperties[t]={cutoffCol:o,daysInMonth:u,paneDate:e},E},_rerenderCalendarPane:function(e,t){var n=this.get("strings.first_weekday")||0,r=this._getCutoffColumn(e,n),i=D.daysInMonth(e),s=t.get("id");t.setStyle("visibility","hidden"),t.setAttribute("aria-label",D.format(e,{format:"%B %Y"}));for(var o=0;o<=12;o++){var u=t.all(".calendar_col"+o);u.removeClass(h);if(o<r||o>=r+7)u.addClass(h);else switch(o){case 0:var a=t.one("#"+s+"_0_30");i>=30?(a.set("text","30"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.addClass(y).addClass(m));break;case 1:var a=t.one("#"+s+"_1_31");i>=31?(a.set("text","31"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y));break;case 6:var a=t.one("#"+s+"_6_29");i>=29?(a.set("text","29"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y));break;case 7:var a=t.one("#"+s+"_7_30");i>=30?(a.set("text","30"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y));break;case 8:var a=t.one("#"+s+"_8_31");i>=31?(a.set("text","31"),a.removeClass(y).addClass(m)):(a.setContent("&nbsp;"),a.removeClass(m).addClass(y))}}this._paneProperties[s].cutoffCol=r,this._paneProperties[s].daysInMonth=i,this._paneProperties[s].paneDate=e,t.setStyle("visibility","visible")},_updateCalendarHeader:function(t){var n="",r=this.get("headerRenderer");return e.Lang.isString(r)?n=D.format(t,{format:r}):r instanceof Function&&(n=r.call(this,t)),n},_initCalendarHeader:function(e){return N(N(P.HEADER_TEMPLATE,{calheader:this._updateCalendarHeader(e),calendar_id:this._calendarId}),P.CALENDAR_STRINGS)},_initCalendarHTML:function(t){function i(){var e=this._initCalendarPane(D.addMonths(t,r),n.calendar_id+"_pane_"+r);return r++,e}var n={},r=0;n.header_template=this._initCalendarHeader(t),n.calendar_id=this._calendarId,n.body_template=N(N(P.CONTENT_TEMPLATE,n),P.CALENDAR_STRINGS);var s=n.body_template.replace(/\{calendar_grid_template\}/g,e.bind(i,this));return this._paneNumber=r,s}},{CALENDAR_STRINGS:{calendar_grid_class:i,calendar_body_class:u,calendar_hd_class:a,calendar_hd_label_class:f,calendar_weekdayrow_class:l,calendar_weekday_class:c,calendar_row_class:v,calendar_day_class:m,calendar_dayanchor_class:b,calendar_pane_class:w,calendar_right_grid_class:o,calendar_left_grid_class:s,calendar_status_class:E},CONTENT_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1">{calendar_grid_template}</div></div>',ONE_PANE_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1">{calendar_grid_template}</div></div>',TWO_PANE_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1-2"><div class = "{calendar_left_grid_class}">{calendar_grid_template}</div></div><div class="yui3-u-1-2"><div class = "{calendar_right_grid_class}">{calendar_grid_template}</div></div></div>',THREE_PANE_TEMPLATE:'<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">{header_template}<div class="yui3-u-1-3"><div class = "{calendar_left_grid_class}">{calendar_grid_template}</div></div><div class="yui3-u-1-3">{calendar_grid_template}</div><div class="yui3-u-1-3"><div class = "{calendar_right_grid_class}">{calendar_grid_template}</div></div></div>',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}"><thead>{weekday_row_template}</thead><tbody>{body_template}</tbody></table>',HEADER_TEMPLATE:'<div class="yui3-g {calendar_hd_class}"><div class="yui3-u {calendar_hd_label_class}" id="{calendar_id}_header" aria-role="heading">{calheader}</div></div>',WEEKDAY_ROW_TEMPLATE:'<tr class="{calendar_weekdayrow_class}" role="row">{weekday_row}</tr>',CALDAY_ROW_TEMPLATE:'<tr class="{calendar_row_class}" role="row">{calday_row}</tr>',WEEKDAY_TEMPLATE:'<th class="{calendar_weekday_class}" role="columnheader" aria-label="{full_weekdayname}">{weekdayname}</th>',CALDAY_TEMPLATE:'<td class="{calendar_col_class} {calendar_day_class} {calendar_col_visibility_class}" id="{calendar_day_id}" role="gridcell" tabindex="-1">{day_content}</td>',NAME:"calendarBase",ATTRS:{tabIndex:{value:1},date:{value:new Date,setter:function(e){var t=this._normalizeDate(e);return D.areEqual(t,this.get("date"))?this.get("date"):t}},showPrevMonth:{value:!1},showNextMonth:{value:!1},strings:{valueFn:function(){return e.Intl.get("calendar-base")}},headerRenderer:{value:"%B %Y"},enabledDatesRule:{value:null},disabledDatesRule:{value:null},selectedDates:{readOnly:!0,getter:function(e){return this._getSelectedDatesList()}},customRenderer:{lazyAdd:!1,value:{},setter:function(e){this._rules=e.rules,this._filterFunction=e.filterFunction}}}})},"@VERSION@",{requires:["widget","substitute","datatype-date","datatype-date-math","cssgrids"],lang:["de","en","es","es-AR","fr","it","ja","nb-NO","nl","pt-BR","ru","zh-HANT-TW"],skinnable:!0});
View
2 build/calendar-base/calendar-base.js
@@ -32,7 +32,7 @@ var getCN = Y.ClassNameManager.getClassName,
L = Y.Lang,
node = Y.Node,
create = node.create,
- substitute = Y.substitute,
+ substitute = L.sub,
each = Y.each,
hasVal = Y.Array.hasValue,
iOf = Y.Array.indexOf,
View
5 build/calendarnavigator/calendarnavigator-coverage.js
@@ -26,7 +26,7 @@ _yuitest_coverage["build/calendarnavigator/calendarnavigator.js"] = {
path: "build/calendarnavigator/calendarnavigator.js",
code: []
};
-_yuitest_coverage["build/calendarnavigator/calendarnavigator.js"].code=["YUI.add('calendarnavigator', function (Y, NAME) {","","/**"," * Provides a plugin which adds navigation controls to Calendar."," *"," * @module calendarnavigator"," */","var CONTENT_BOX = \"contentBox\","," HOST = \"host\","," RENDERED = \"rendered\","," getCN = Y.ClassNameManager.getClassName,"," substitute = Y.substitute,"," 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(config) {"," 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}\">' + "," \"<span>&lt;</span>\" +"," '</a>';"," /**"," * 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}\">' + "," \"<span>&gt;</span>\" +"," '</a>';","","","Y.extend(CalendarNavigator, Y.Plugin.Base, {",""," _eventAttachments : {},"," _controls: {},",""," /**"," * The initializer lifecycle implementation. Modifies the host widget's "," * render to add navigation controls."," *"," * @method initializer"," * @param {Object} config The user configuration for the plugin "," */"," initializer : function(config) {",""," // 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);"," var 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);"," var oldDate = host.get(\"date\");"," host.set(\"date\", ydate.addMonths(oldDate, this.get(\"shiftByMonths\")));"," ev.preventDefault();"," }"," },","",""," _updateControlState : function () {",""," var host = this.get(HOST);"," if (ydate.areEqual(host.get(\"minimumDate\"), host.get(\"date\"))) {"," 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(host.get(\"maximumDate\"), ydate.addMonths(host.get(\"date\"), host._paneNumber - 1))) {"," 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);"," 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\";",""," var headerCell = host.get(CONTENT_BOX).one(\".\" + CAL_HD);",""," this._controls.prevMonth = this._renderPrevControls();"," this._controls.nextMonth = this._renderNextControls();",""," this._updateControlState();",""," host.after(\"dateChange\", this._updateControlState, this);",""," headerCell.prepend(this._controls.prevMonth);"," headerCell.append(this._controls.nextMonth);"," }","});","","Y.namespace(\"Plugin\").CalendarNavigator = CalendarNavigator;","","}, '@VERSION@', {\"requires\": [\"plugin\", \"classnamemanager\", \"datatype-date\", \"node\", \"substitute\"], \"skinnable\": true});"];
+_yuitest_coverage["build/calendarnavigator/calendarnavigator.js"].code=["YUI.add('calendarnavigator', function (Y, NAME) {","","/**"," * Provides a plugin which adds navigation controls to Calendar."," *"," * @module calendarnavigator"," */","var CONTENT_BOX = \"contentBox\","," HOST = \"host\","," RENDERED = \"rendered\","," 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(config) {"," 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}\">' + "," \"<span>&lt;</span>\" +"," '</a>';"," /**"," * 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}\">' + "," \"<span>&gt;</span>\" +"," '</a>';","","","Y.extend(CalendarNavigator, Y.Plugin.Base, {",""," _eventAttachments : {},"," _controls: {},",""," /**"," * The initializer lifecycle implementation. Modifies the host widget's "," * render to add navigation controls."," *"," * @method initializer"," * @param {Object} config The user configuration for the plugin "," */"," initializer : function(config) {",""," // 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);"," var 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);"," var oldDate = host.get(\"date\");"," host.set(\"date\", ydate.addMonths(oldDate, this.get(\"shiftByMonths\")));"," ev.preventDefault();"," }"," },","",""," _updateControlState : function () {",""," var host = this.get(HOST);"," if (ydate.areEqual(host.get(\"minimumDate\"), host.get(\"date\"))) {"," 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(host.get(\"maximumDate\"), ydate.addMonths(host.get(\"date\"), host._paneNumber - 1))) {"," 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);"," 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\";",""," var headerCell = host.get(CONTENT_BOX).one(\".\" + CAL_HD);",""," this._controls.prevMonth = this._renderPrevControls();"," this._controls.nextMonth = this._renderNextControls();",""," this._updateControlState();",""," host.after(\"dateChange\", this._updateControlState, this);",""," headerCell.prepend(this._controls.prevMonth);"," headerCell.append(this._controls.nextMonth);"," }","});","","Y.namespace(\"Plugin\").CalendarNavigator = CalendarNavigator;","","","}, '@VERSION@', {\"requires\": [\"plugin\", \"classnamemanager\", \"datatype-date\", \"node\", \"substitute\"], \"skinnable\": true});"];
_yuitest_coverage["build/calendarnavigator/calendarnavigator.js"].lines = {"1":0,"8":0,"29":0,"30":0,"42":0,"53":0,"64":0,"86":0,"98":0,"109":0,"114":0,"129":0,"130":0,"132":0,"154":0,"166":0,"167":0,"168":0,"169":0,"170":0,"183":0,"184":0,"185":0,"186":0,"187":0,"194":0,"195":0,"196":0,"197":0,"198":0,"201":0,"202":0,"206":0,"207":0,"209":0,"210":0,"214":0,"215":0,"216":0,"217":0,"220":0,"221":0,"225":0,"226":0,"228":0,"229":0,"233":0,"234":0,"247":0,"249":0,"251":0,"261":0,"263":0,"265":0,"274":0,"275":0,"276":0,"277":0,"279":0,"281":0,"282":0,"284":0,"286":0,"288":0,"289":0,"293":0};
_yuitest_coverage["build/calendarnavigator/calendarnavigator.js"].functions = {"CalendarNavigator:29":0,"initializer:126":0,"_focusNavigation:153":0,"_subtractMonths:165":0,"_addMonths:182":0,"_updateControlState:192":0,"_renderPrevControls:246":0,"_renderNextControls:260":0,"_initNavigationControls:273":0,"(anonymous 1):1":0};
_yuitest_coverage["build/calendarnavigator/calendarnavigator.js"].coveredLines = 66;
@@ -45,7 +45,7 @@ var CONTENT_BOX = "contentBox",
HOST = "host",
RENDERED = "rendered",
getCN = Y.ClassNameManager.getClassName,
- substitute = Y.substitute,
+ substitute = Y.Lang.sub,
node = Y.Node,
create = node.create,
CALENDAR = 'calendar',
@@ -401,4 +401,5 @@ headerCell.append(this._controls.nextMonth);
_yuitest_coverline("build/calendarnavigator/calendarnavigator.js", 293);
Y.namespace("Plugin").CalendarNavigator = CalendarNavigator;
+
}, '@VERSION@', {"requires": ["plugin", "classnamemanager", "datatype-date", "node", "substitute"], "skinnable": true});
View
3 build/calendarnavigator/calendarnavigator-debug.js
@@ -9,7 +9,7 @@ var CONTENT_BOX = "contentBox",
HOST = "host",
RENDERED = "rendered",
getCN = Y.ClassNameManager.getClassName,
- substitute = Y.substitute,
+ substitute = Y.Lang.sub,
node = Y.Node,
create = node.create,
CALENDAR = 'calendar',
@@ -292,4 +292,5 @@ Y.extend(CalendarNavigator, Y.Plugin.Base, {
Y.namespace("Plugin").CalendarNavigator = CalendarNavigator;
+
}, '@VERSION@', {"requires": ["plugin", "classnamemanager", "datatype-date", "node", "substitute"], "skinnable": true});
View
2 build/calendarnavigator/calendarnavigator-min.js
@@ -1 +1 @@
-YUI.add("calendarnavigator",function(e,t){function m(e){m.superclass.constructor.apply(this,arguments)}var n="contentBox",r="host",i="rendered",s=e.ClassNameManager.getClassName,o=e.substitute,u=e.Node,a=u.create,f="calendar",l="calendarnav",c=s(f,"header"),h=s(l,"prevmonth"),p=s(l,"nextmonth"),d=s(l,"month-disabled"),v=e.DataType.Date;m.NS="navigator",m.NAME="pluginCalendarNavigator",m.ATTRS={shiftByMonths:{value:1}},m.CALENDARNAV_STRINGS={prev_month_class:h,next_month_class:p},m.PREV_MONTH_CONTROL_TEMPLATE='<a class="yui3-u {prev_month_class}" role="button" aria-label="{prev_month_arialabel}" tabindex="{control_tabindex}"><span>&lt;</span></a>',m.NEXT_MONTH_CONTROL_TEMPLATE='<a class="yui3-u {next_month_class}" role="button" aria-label="{next_month_arialabel}" tabindex="{control_tabindex}"><span>&gt;</span></a>',e.extend(m,e.Plugin.Base,{_eventAttachments:{},_controls:{},initializer:function(e){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",v.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",v.addMonths(n,this.get("shiftByMonths"))),e.preventDefault()}},_updateControlState:function(){var e=this.get(r);v.areEqual(e.get("minimumDate"),e.get("date"))?(this._eventAttachments.prevMonth&&(this._eventAttachments.prevMonth.detach(),this._eventAttachments.prevMonth=!1),this._controls.prevMonth.hasClass(d)||this._controls.prevMonth.addClass(d).setAttribute("aria-disabled","true")):(this._eventAttachments.prevMonth||(this._eventAttachments.prevMonth=this._controls.prevMonth.on(["click","keydown"],this._subtractMonths,this)),this._controls.prevMonth.hasClass(d)&&this._controls.prevMonth.removeClass(d).setAttribute("aria-disabled","false")),v.areEqual(e.get("maximumDate"),v.addMonths(e.get("date"),e._paneNumber-1))?(this._eventAttachments.nextMonth&&(this._eventAttachments.nextMonth.detach(),this._eventAttachments.nextMonth=!1),this._controls.nextMonth.hasClass(d)||this._controls.nextMonth.addClass(d).setAttribute("aria-disabled","true")):(this._eventAttachments.nextMonth||(this._eventAttachments.nextMonth=this._controls.nextMonth.on(["click","keydown"],this._addMonths,this)),this._controls.nextMonth.hasClass(d)&&this._controls.nextMonth.removeClass(d).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=a(o(m.PREV_MONTH_CONTROL_TEMPLATE,m.CALENDARNAV_STRINGS));return e.on("selectstart",this.get(r)._preventSelectionStart),e},_renderNextControls:function(){var e=a(o(m.NEXT_MONTH_CONTROL_TEMPLATE,m.CALENDARNAV_STRINGS));return e.on("selectstart",this.get(r)._preventSelectionStart),e},_initNavigationControls:function(){var e=this.get(r);m.CALENDARNAV_STRINGS.control_tabindex=e.get("tabIndex"),m.CALENDARNAV_STRINGS.prev_month_arialabel="Go to previous month",m.CALENDARNAV_STRINGS.next_month_arialabel="Go to next month";var t=e.get(n).one("."+c);this._controls.prevMonth=this._renderPrevControls(),this._controls.nextMonth=this._renderNextControls(),this._updateControlState(),e.after("dateChange",this._updateControlState,this),t.prepend(this._controls.prevMonth),t.append(this._controls.nextMonth)}}),e.namespace("Plugin").CalendarNavigator=m},"@VERSION@",{requires:["plugin","classnamemanager","datatype-date","node","substitute"],skinnable:!0});
+YUI.add("calendarnavigator",function(e,t){function m(e){m.superclass.constructor.apply(this,arguments)}var n="contentBox",r="host",i="rendered",s=e.ClassNameManager.getClassName,o=e.Lang.sub,u=e.Node,a=u.create,f="calendar",l="calendarnav",c=s(f,"header"),h=s(l,"prevmonth"),p=s(l,"nextmonth"),d=s(l,"month-disabled"),v=e.DataType.Date;m.NS="navigator",m.NAME="pluginCalendarNavigator",m.ATTRS={shiftByMonths:{value:1}},m.CALENDARNAV_STRINGS={prev_month_class:h,next_month_class:p},m.PREV_MONTH_CONTROL_TEMPLATE='<a class="yui3-u {prev_month_class}" role="button" aria-label="{prev_month_arialabel}" tabindex="{control_tabindex}"><span>&lt;</span></a>',m.NEXT_MONTH_CONTROL_TEMPLATE='<a class="yui3-u {next_month_class}" role="button" aria-label="{next_month_arialabel}" tabindex="{control_tabindex}"><span>&gt;</span></a>',e.extend(m,e.Plugin.Base,{_eventAttachments:{},_controls:{},initializer:function(e){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",v.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",v.addMonths(n,this.get("shiftByMonths"))),e.preventDefault()}},_updateControlState:function(){var e=this.get(r);v.areEqual(e.get("minimumDate"),e.get("date"))?(this._eventAttachments.prevMonth&&(this._eventAttachments.prevMonth.detach(),this._eventAttachments.prevMonth=!1),this._controls.prevMonth.hasClass(d)||this._controls.prevMonth.addClass(d).setAttribute("aria-disabled","true")):(this._eventAttachments.prevMonth||(this._eventAttachments.prevMonth=this._controls.prevMonth.on(["click","keydown"],this._subtractMonths,this)),this._controls.prevMonth.hasClass(d)&&this._controls.prevMonth.removeClass(d).setAttribute("aria-disabled","false")),v.areEqual(e.get("maximumDate"),v.addMonths(e.get("date"),e._paneNumber-1))?(this._eventAttachments.nextMonth&&(this._eventAttachments.nextMonth.detach(),this._eventAttachments.nextMonth=!1),this._controls.nextMonth.hasClass(d)||this._controls.nextMonth.addClass(d).setAttribute("aria-disabled","true")):(this._eventAttachments.nextMonth||(this._eventAttachments.nextMonth=this._controls.nextMonth.on(["click","keydown"],this._addMonths,this)),this._controls.nextMonth.hasClass(d)&&this._controls.nextMonth.removeClass(d).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=a(o(m.PREV_MONTH_CONTROL_TEMPLATE,m.CALENDARNAV_STRINGS));return e.on("selectstart",this.get(r)._preventSelectionStart),e},_renderNextControls:function(){var e=a(o(m.NEXT_MONTH_CONTROL_TEMPLATE,m.CALENDARNAV_STRINGS));return e.on("selectstart",this.get(r)._preventSelectionStart),e},_initNavigationControls:function(){var e=this.get(r);m.CALENDARNAV_STRINGS.control_tabindex=e.get("tabIndex"),m.CALENDARNAV_STRINGS.prev_month_arialabel="Go to previous month",m.CALENDARNAV_STRINGS.next_month_arialabel="Go to next month";var t=e.get(n).one("."+c);this._controls.prevMonth=this._renderPrevControls(),this._controls.nextMonth=this._renderNextControls(),this._updateControlState(),e.after("dateChange",this._updateControlState,this),t.prepend(this._controls.prevMonth),t.append(this._controls.nextMonth)}}),e.namespace("Plugin").CalendarNavigator=m},"@VERSION@",{requires:["plugin","classnamemanager","datatype-date","node","substitute"],skinnable:!0});
View
3 build/calendarnavigator/calendarnavigator.js
@@ -9,7 +9,7 @@ var CONTENT_BOX = "contentBox",
HOST = "host",
RENDERED = "rendered",
getCN = Y.ClassNameManager.getClassName,
- substitute = Y.substitute,
+ substitute = Y.Lang.sub,
node = Y.Node,
create = node.create,
CALENDAR = 'calendar',
@@ -292,4 +292,5 @@ Y.extend(CalendarNavigator, Y.Plugin.Base, {
Y.namespace("Plugin").CalendarNavigator = CalendarNavigator;
+
}, '@VERSION@', {"requires": ["plugin", "classnamemanager", "datatype-date", "node", "substitute"], "skinnable": true});

0 comments on commit acc255d

Please sign in to comment.
Something went wrong with that request. Please try again.