}
}(function( $ ) {
-// TODO Use uniqueId, if possible
-var idIncrement = 0,
- // TODO Move this to the instance
+var widget,
+ calendarOptions = [ "dateFormat", "eachDay", "max", "min", "numberOfMonths", "showWeek" ],
+ // TODO Move this to the instance?
suppressExpandOnFocus = false;
-$.widget( "ui.datepicker", {
+widget = $.widget( "ui.datepicker", {
version: "@VERSION",
options: {
appendTo: null,
- dateFormat: { date: "short" },
- // TODO Review
- eachDay: $.noop,
- max: null,
- min: null,
- numberOfMonths: 1,
position: {
my: "left top",
at: "left bottom"
},
- showWeek: false,
show: true,
hide: true,
// Initialize calendar widget
this.calendarInstance = this.calendar
- .calendar({
- dateFormat: this.options.dateFormat,
- eachDay: this.options.eachDay,
- max: this.options.max,
- min: this.options.min,
- numberOfMonths: this.options.numberOfMonths,
- showWeek: this.options.showWeek,
+ .calendar( $.extend( {}, this.options, {
value: this._getParsedValue(),
select: function( event ) {
that.element.val( that.calendarInstance.value() );
that._focusTrigger();
that._trigger( "select", event );
}
- })
+ }) )
.calendar( "instance" );
this._setHiddenPicker();
_setOption: function( key, value ) {
this._super( key, value );
- if ( $.inArray( key, [ "showWeek", "numberOfMonths", "dateFormat", "eachDay", "min", "max" ] ) !== -1 ) {
+ if ( $.inArray( key, calendarOptions ) !== -1 ) {
this.calendarInstance.option( key, value );
}
}
}
});
+
+$.each( calendarOptions, function( index, option ) {
+ $.ui.datepicker.prototype.options[ option ] = $.ui.calendar.prototype.options[ option ];
+});
+
+return widget;
+
}));