@@ -105,8 +105,9 @@ define([
105
105
_overwriteFindPos : function ( ) {
106
106
$ . datepicker . constructor . prototype . _findPos = function ( obj ) {
107
107
let domPosition = obj . getBoundingClientRect ( ) ;
108
+
108
109
return [ domPosition . left , domPosition . top ] ;
109
- }
110
+ } ;
110
111
} ,
111
112
112
113
/**
@@ -151,7 +152,7 @@ define([
151
152
dayNames = this . _get ( inst , 'dayNames' ) ,
152
153
dayNamesMin = this . _get ( inst , 'dayNamesMin' ) ,
153
154
monthNames = this . _get ( inst , 'monthNames' ) ,
154
- monthNamesShort = this . _get ( inst , 'monthNamesShort' ) ,
155
+ monthNamesShort = this . _get ( inst , 'monthNamesShort' ) ,
155
156
beforeShowDay = this . _get ( inst , 'beforeShowDay' ) ,
156
157
showOtherMonths = this . _get ( inst , 'showOtherMonths' ) ,
157
158
selectOtherMonths = this . _get ( inst , 'selectOtherMonths' ) ,
@@ -208,22 +209,22 @@ define([
208
209
'<span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w' ) + '">' +
209
210
'' + prevText + '</span></a>'
210
211
: hideIfNoPrevNext ? ''
211
- : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="' +
212
- '' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' +
213
- '' + ( isRTL ? 'e' : 'w' ) + '">' + prevText + '</span></a>' ;
212
+ : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="' +
213
+ '' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' +
214
+ '' + ( isRTL ? 'e' : 'w' ) + '">' + prevText + '</span></a>' ;
214
215
nextText = ! navigationAsDateFormat ?
215
216
nextText
216
- : this . formatDate ( nextText ,
217
+ : this . formatDate ( nextText ,
217
218
this . _daylightSavingAdjust ( new Date ( drawYear , drawMonth + stepMonths , 1 ) ) ,
218
219
this . _getFormatConfig ( inst ) ) ;
219
220
next = this . _canAdjustMonth ( inst , + 1 , drawYear , drawMonth ) ?
220
221
'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' +
221
222
'title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' +
222
223
'' + ( isRTL ? 'w' : 'e' ) + '">' + nextText + '</span></a>'
223
224
: hideIfNoPrevNext ? ''
224
- : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="' + nextText + '">' +
225
- '<span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e' ) + '">' + nextText +
226
- '</span></a>' ;
225
+ : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="' + nextText + '">' +
226
+ '<span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e' ) + '">' + nextText +
227
+ '</span></a>' ;
227
228
gotoDate = this . _get ( inst , 'gotoCurrent' ) && inst . currentDay ? currentDate : today ;
228
229
currentText = ! navigationAsDateFormat ? currentText :
229
230
this . formatDate ( currentText , gotoDate , this . _getFormatConfig ( inst ) ) ;
@@ -235,8 +236,8 @@ define([
235
236
buttonPanel = showButtonPanel ?
236
237
'<div class="ui-datepicker-buttonpane ui-widget-content">' + ( isRTL ? controls : '' ) +
237
238
( this . _isInRange ( inst , gotoDate ) ? '<button type="button" class="ui-datepicker-current ' +
238
- 'ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
239
- '>' + currentText + '</button>' : '' ) + ( isRTL ? '' : controls ) + '</div>' : '' ;
239
+ 'ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
240
+ '>' + currentText + '</button>' : '' ) + ( isRTL ? '' : controls ) + '</div>' : '' ;
240
241
firstDay = parseInt ( this . _get ( inst , 'firstDay' ) , 10 ) ;
241
242
firstDay = isNaN ( firstDay ) ? 0 : firstDay ;
242
243
@@ -253,15 +254,19 @@ define([
253
254
254
255
if ( numMonths [ 1 ] > 1 ) {
255
256
switch ( col ) {
256
- case 0 : calender += ' ui-datepicker-group-first' ;
257
+ case 0 :
258
+ calender += ' ui-datepicker-group-first' ;
257
259
cornerClass = ' ui-corner-' + ( isRTL ? 'right' : 'left' ) ;
258
260
break ;
259
261
260
- case numMonths [ 1 ] - 1 : calender += ' ui-datepicker-group-last' ;
262
+ case numMonths [ 1 ] - 1 :
263
+ calender += ' ui-datepicker-group-last' ;
261
264
cornerClass = ' ui-corner-' + ( isRTL ? 'left' : 'right' ) ;
262
265
break ;
263
266
264
- default : calender += ' ui-datepicker-group-middle' ; cornerClass = '' ;
267
+ default :
268
+ calender += ' ui-datepicker-group-middle' ;
269
+ cornerClass = '' ;
265
270
}
266
271
}
267
272
calender += '">' ;
@@ -271,7 +276,7 @@ define([
271
276
( / a l l | l e f t / . test ( cornerClass ) && parseInt ( row , 10 ) === 0 ? isRTL ? next : prev : '' ) +
272
277
( / a l l | r i g h t / . test ( cornerClass ) && parseInt ( row , 10 ) === 0 ? isRTL ? prev : next : '' ) +
273
278
this . _generateMonthYearHeader ( inst , drawMonth , drawYear , minDate , maxDate ,
274
- row > 0 || col > 0 , monthNames , monthNamesShort ) + // draw month headers
279
+ row > 0 || col > 0 , monthNames , monthNamesShort ) + // draw month headers
275
280
'</div><table class="ui-datepicker-calendar"><thead>' +
276
281
'<tr>' ;
277
282
thead = showWeek ?
@@ -280,7 +285,7 @@ define([
280
285
for ( dow = 0 ; dow < 7 ; dow ++ ) { // days of the week
281
286
day = ( dow + firstDay ) % 7 ;
282
287
thead += '<th' + ( ( dow + firstDay + 6 ) % 7 >= 5 ?
283
- ' class="ui-datepicker-week-end"' : '' ) + '>' +
288
+ ' class="ui-datepicker-week-end"' : '' ) + '>' +
284
289
'<span title="' + dayNames [ day ] + '">' + dayNamesMin [ day ] + '</span></th>' ;
285
290
}
286
291
calender += thead + '</tr></thead><tbody>' ;
@@ -298,40 +303,40 @@ define([
298
303
for ( dRow = 0 ; dRow < numRows ; dRow ++ ) { // create date picker rows
299
304
calender += '<tr>' ;
300
305
tbody = ! showWeek ? '' : '<td class="ui-datepicker-week-col">' +
301
- this . _get ( inst , 'calculateWeek' ) ( printDate ) + '</td>' ;
306
+ this . _get ( inst , 'calculateWeek' ) ( printDate ) + '</td>' ;
302
307
303
308
for ( dow = 0 ; dow < 7 ; dow ++ ) { // create date picker days
304
309
daySettings = beforeShowDay ?
305
310
beforeShowDay . apply ( inst . input ? inst . input [ 0 ] : null , [ printDate ] ) : [ true , '' ] ;
306
311
otherMonth = printDate . getMonth ( ) !== drawMonth ;
307
312
unselectable = otherMonth && ! selectOtherMonths || ! daySettings [ 0 ] ||
308
- minDate && printDate < minDate || maxDate && printDate > maxDate ;
313
+ minDate && printDate < minDate || maxDate && printDate > maxDate ;
309
314
tbody += '<td class="' +
310
- ( ( dow + firstDay + 6 ) % 7 >= 5 ? ' ui-datepicker-week-end' : '' ) + // highlight weekends
311
- ( otherMonth ? ' ui-datepicker-other-month' : '' ) + // highlight days from other months
312
- ( printDate . getTime ( ) === selectedDate . getTime ( ) &&
313
- drawMonth === inst . selectedMonth && inst . _keyEvent || // user pressed key
314
- defaultDate . getTime ( ) === printDate . getTime ( ) &&
315
- defaultDate . getTime ( ) === selectedDate . getTime ( ) ?
316
- // or defaultDate is current printedDate and defaultDate is selectedDate
317
- ' ' + this . _dayOverClass : '' ) + // highlight selected day
318
- ( unselectable ? ' ' + this . _unselectableClass + ' ui-state-disabled' : '' ) +
319
- ( otherMonth && ! showOtherMonths ? '' : ' ' + daySettings [ 1 ] + // highlight custom dates
320
- ( printDate . getTime ( ) === currentDate . getTime ( ) ? ' ' + this . _currentClass : '' ) +
321
- ( printDate . getDate ( ) === today . getDate ( ) && printDate . getMonth ( ) === today . getMonth ( ) &&
322
- printDate . getYear ( ) === today . getYear ( ) ? ' ui-datepicker-today' : '' ) ) + '"' +
323
- ( ( ! otherMonth || showOtherMonths ) && daySettings [ 2 ] ?
324
- ' title="' + daySettings [ 2 ] + '"' : '' ) + // cell title
325
- ( unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' +
326
- '' + printDate . getMonth ( ) + '" data-year="' + printDate . getFullYear ( ) + '"' ) + '>' +
327
- ( otherMonth && ! showOtherMonths ? ' ' : // display for other months
328
- unselectable ? '<span class="ui-state-default">' + printDate . getDate ( ) + '</span>'
329
- : '<a class="ui-state-default' +
330
- ( printDate . getTime ( ) === today . getTime ( ) ? ' ' : '' ) +
331
- ( printDate . getTime ( ) === currentDate . getTime ( ) ? ' ui-state-active' : '' ) +
332
- ( otherMonth ? ' ui-priority-secondary' : '' ) +
333
- '" data-date="' + printDate . getDate ( ) + '" href="#">' +
334
- printDate . getDate ( ) + '</a>' ) + '</td>' ;
315
+ ( ( dow + firstDay + 6 ) % 7 >= 5 ? ' ui-datepicker-week-end' : '' ) + // highlight weekends
316
+ ( otherMonth ? ' ui-datepicker-other-month' : '' ) + // highlight days from other months
317
+ ( printDate . getTime ( ) === selectedDate . getTime ( ) &&
318
+ drawMonth === inst . selectedMonth && inst . _keyEvent || // user pressed key
319
+ defaultDate . getTime ( ) === printDate . getTime ( ) &&
320
+ defaultDate . getTime ( ) === selectedDate . getTime ( ) ?
321
+ // or defaultDate is current printedDate and defaultDate is selectedDate
322
+ ' ' + this . _dayOverClass : '' ) + // highlight selected day
323
+ ( unselectable ? ' ' + this . _unselectableClass + ' ui-state-disabled' : '' ) +
324
+ ( otherMonth && ! showOtherMonths ? '' : ' ' + daySettings [ 1 ] + // highlight custom dates
325
+ ( printDate . getTime ( ) === currentDate . getTime ( ) ? ' ' + this . _currentClass : '' ) +
326
+ ( printDate . getDate ( ) === today . getDate ( ) && printDate . getMonth ( ) === today . getMonth ( ) &&
327
+ printDate . getYear ( ) === today . getYear ( ) ? ' ui-datepicker-today' : '' ) ) + '"' +
328
+ ( ( ! otherMonth || showOtherMonths ) && daySettings [ 2 ] ?
329
+ ' title="' + daySettings [ 2 ] + '"' : '' ) + // cell title
330
+ ( unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' +
331
+ '' + printDate . getMonth ( ) + '" data-year="' + printDate . getFullYear ( ) + '"' ) + '>' +
332
+ ( otherMonth && ! showOtherMonths ? ' ' : // display for other months
333
+ unselectable ? '<span class="ui-state-default">' + printDate . getDate ( ) + '</span>'
334
+ : '<a class="ui-state-default' +
335
+ ( printDate . getTime ( ) === today . getTime ( ) ? ' ' : '' ) +
336
+ ( printDate . getTime ( ) === currentDate . getTime ( ) ? ' ui-state-active' : '' ) +
337
+ ( otherMonth ? ' ui-priority-secondary' : '' ) +
338
+ '" data-date="' + printDate . getDate ( ) + '" href="#">' +
339
+ printDate . getDate ( ) + '</a>' ) + '</td>' ;
335
340
printDate . setDate ( printDate . getDate ( ) + 1 ) ;
336
341
printDate = this . _daylightSavingAdjust ( printDate ) ;
337
342
}
@@ -344,8 +349,8 @@ define([
344
349
drawYear ++ ;
345
350
}
346
351
calender += '</tbody></table>' + ( isMultiMonth ? '</div>' +
347
- ( numMonths [ 0 ] > 0 && col === numMonths [ 1 ] - 1 ? '<div class="ui-datepicker-row-break"></div>'
348
- : '' ) : '' ) ;
352
+ ( numMonths [ 0 ] > 0 && col === numMonths [ 1 ] - 1 ? '<div class="ui-datepicker-row-break"></div>'
353
+ : '' ) : '' ) ;
349
354
group += calender ;
350
355
}
351
356
html += group ;
@@ -415,72 +420,72 @@ define([
415
420
* @var {Object}
416
421
*/
417
422
$ . widget ( 'mage.calendar' , $ . extend ( { } , calendarBasePrototype ,
418
- /** @lends {$.mage.calendar.prototype} */ {
419
- /**
420
- * key - backend format, value - jquery format
421
- * @type {Object }
422
- * @private
423
- */
424
- dateTimeFormat : {
425
- date : {
426
- 'EEEE' : 'DD' ,
427
- 'EEE' : 'D' ,
428
- 'EE' : 'D' ,
429
- 'E' : 'D' ,
430
- 'D' : 'o' ,
431
- 'MMMM' : 'MM' ,
432
- 'MMM' : 'M' ,
433
- 'MM' : 'mm' ,
434
- 'M' : 'mm' ,
435
- 'yyyy' : 'yy' ,
436
- 'y' : 'yy' ,
437
- 'Y' : 'yy' ,
438
- 'yy' : 'yy' // Always long year format on frontend
439
- } ,
440
- time : {
441
- 'a' : 'TT'
442
- }
423
+ /** @lends {$.mage.calendar.prototype} */ {
424
+ /**
425
+ * key - backend format, value - jquery format
426
+ * @type {Object }
427
+ * @private
428
+ */
429
+ dateTimeFormat : {
430
+ date : {
431
+ 'EEEE' : 'DD' ,
432
+ 'EEE' : 'D' ,
433
+ 'EE' : 'D' ,
434
+ 'E' : 'D' ,
435
+ 'D' : 'o' ,
436
+ 'MMMM' : 'MM' ,
437
+ 'MMM' : 'M' ,
438
+ 'MM' : 'mm' ,
439
+ 'M' : 'mm' ,
440
+ 'yyyy' : 'yy' ,
441
+ 'y' : 'yy' ,
442
+ 'Y' : 'yy' ,
443
+ 'yy' : 'yy' // Always long year format on frontend
443
444
} ,
445
+ time : {
446
+ 'a' : 'TT'
447
+ }
448
+ } ,
444
449
445
- /**
446
- * Add Date and Time converting to _create method
447
- * @protected
448
- */
449
- _create : function ( ) {
450
- if ( this . options . dateFormat ) {
451
- this . options . dateFormat = this . _convertFormat ( this . options . dateFormat , 'date' ) ;
452
- }
453
-
454
- if ( this . options . timeFormat ) {
455
- this . options . timeFormat = this . _convertFormat ( this . options . timeFormat , 'time' ) ;
456
- }
457
- calendarBasePrototype . _create . apply ( this , arguments ) ;
458
- } ,
450
+ /**
451
+ * Add Date and Time converting to _create method
452
+ * @protected
453
+ */
454
+ _create : function ( ) {
455
+ if ( this . options . dateFormat ) {
456
+ this . options . dateFormat = this . _convertFormat ( this . options . dateFormat , 'date' ) ;
457
+ }
459
458
460
- /**
461
- * Converting date or time format
462
- * @protected
463
- * @param {String } format
464
- * @param {String } type
465
- * @return {String }
466
- */
467
- _convertFormat : function ( format , type ) {
468
- var symbols = format . match ( / ( [ a - z ] + ) / ig) ,
469
- separators = format . match ( / ( [ ^ a - z ] + ) / ig) ,
470
- self = this ,
471
- convertedFormat = '' ;
472
-
473
- if ( symbols ) {
474
- $ . each ( symbols , function ( key , val ) {
475
- convertedFormat +=
476
- ( self . dateTimeFormat [ type ] [ val ] || val ) +
477
- ( separators [ key ] || '' ) ;
478
- } ) ;
479
- }
459
+ if ( this . options . timeFormat ) {
460
+ this . options . timeFormat = this . _convertFormat ( this . options . timeFormat , 'time' ) ;
461
+ }
462
+ calendarBasePrototype . _create . apply ( this , arguments ) ;
463
+ } ,
480
464
481
- return convertedFormat ;
465
+ /**
466
+ * Converting date or time format
467
+ * @protected
468
+ * @param {String } format
469
+ * @param {String } type
470
+ * @return {String }
471
+ */
472
+ _convertFormat : function ( format , type ) {
473
+ var symbols = format . match ( / ( [ a - z ] + ) / ig) ,
474
+ separators = format . match ( / ( [ ^ a - z ] + ) / ig) ,
475
+ self = this ,
476
+ convertedFormat = '' ;
477
+
478
+ if ( symbols ) {
479
+ $ . each ( symbols , function ( key , val ) {
480
+ convertedFormat +=
481
+ ( self . dateTimeFormat [ type ] [ val ] || val ) +
482
+ ( separators [ key ] || '' ) ;
483
+ } ) ;
482
484
}
483
- } )
485
+
486
+ return convertedFormat ;
487
+ }
488
+ } )
484
489
) ;
485
490
486
491
/**
@@ -564,7 +569,7 @@ define([
564
569
} ;
565
570
566
571
return {
567
- dateRange : $ . mage . dateRange ,
568
- calendar : $ . mage . calendar
572
+ dateRange : $ . mage . dateRange ,
573
+ calendar : $ . mage . calendar
569
574
} ;
570
575
} ) ;
0 commit comments