iqvoc 4.8.0 → 4.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/app/assets/fonts/FiraMono-Regular.eot +0 -0
  4. data/app/assets/fonts/FiraMono-Regular.ttf +0 -0
  5. data/app/assets/fonts/FiraMono-Regular.woff +0 -0
  6. data/app/assets/fonts/FiraSans-Bold.eot +0 -0
  7. data/app/assets/fonts/FiraSans-Bold.ttf +0 -0
  8. data/app/assets/fonts/FiraSans-Bold.woff +0 -0
  9. data/app/assets/fonts/FiraSans-BoldItalic.eot +0 -0
  10. data/app/assets/fonts/FiraSans-BoldItalic.ttf +0 -0
  11. data/app/assets/fonts/FiraSans-BoldItalic.woff +0 -0
  12. data/app/assets/javascripts/framework.js +3 -2
  13. data/app/assets/javascripts/iqvoc/autocomplete.js +42 -0
  14. data/app/assets/javascripts/iqvoc/concept_mapper.js +4 -3
  15. data/app/assets/javascripts/iqvoc/entityselect.js.erb +19 -30
  16. data/app/assets/javascripts/iqvoc/federated_concept_mapper.js +14 -26
  17. data/app/assets/javascripts/iqvoc/iqvoc.js +15 -4
  18. data/app/assets/javascripts/iqvoc/manifest.js +1 -1
  19. data/app/assets/stylesheets/_framework.scss +2 -4
  20. data/app/assets/stylesheets/iqvoc/_manifest.scss +2 -2
  21. data/app/assets/stylesheets/iqvoc/components/_datepicker.scss +7 -0
  22. data/app/assets/stylesheets/iqvoc/components/typeahead.scss +56 -0
  23. data/app/assets/stylesheets/iqvoc/hacks/_hacks.scss +4 -0
  24. data/app/assets/stylesheets/iqvoc/settings/_bootstrap-variables.scss +8 -8
  25. data/app/assets/stylesheets/iqvoc/settings/_bootstrap.scss +5 -0
  26. data/app/assets/stylesheets/iqvoc/settings/_fonts.scss +25 -64
  27. data/app/views/pages/components.html.erb +44 -0
  28. data/lib/iqvoc/version.rb +1 -1
  29. data/vendor/assets/javascripts/pickadate/picker.date.js +1322 -0
  30. data/vendor/assets/javascripts/pickadate/picker.js +1061 -0
  31. data/vendor/assets/javascripts/typeahead.jquery.js +1184 -0
  32. data/vendor/assets/stylesheets/pickadate/classic.date.scss +278 -0
  33. data/vendor/assets/stylesheets/pickadate/classic.scss +109 -0
  34. metadata +19 -23
  35. data/app/assets/stylesheets/iqvoc/hacks/_jquery-ui_extensions.scss +0 -14
  36. data/vendor/assets/javascripts/jquery-ui.datepicker-de.js +0 -22
  37. data/vendor/assets/javascripts/jquery-ui.js +0 -4676
  38. data/vendor/assets/stylesheets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  39. data/vendor/assets/stylesheets/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  40. data/vendor/assets/stylesheets/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  41. data/vendor/assets/stylesheets/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  42. data/vendor/assets/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  43. data/vendor/assets/stylesheets/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  44. data/vendor/assets/stylesheets/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  45. data/vendor/assets/stylesheets/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  46. data/vendor/assets/stylesheets/images/ui-icons_217bc0_256x240.png +0 -0
  47. data/vendor/assets/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
  48. data/vendor/assets/stylesheets/images/ui-icons_469bdd_256x240.png +0 -0
  49. data/vendor/assets/stylesheets/images/ui-icons_6da8d5_256x240.png +0 -0
  50. data/vendor/assets/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
  51. data/vendor/assets/stylesheets/images/ui-icons_d8e7f3_256x240.png +0 -0
  52. data/vendor/assets/stylesheets/images/ui-icons_f9bd01_256x240.png +0 -0
  53. data/vendor/assets/stylesheets/jquery-ui.scss +0 -709
  54. data/vendor/assets/stylesheets/jquery-ui.structure.scss +0 -317
  55. data/vendor/assets/stylesheets/jquery-ui.theme.scss +0 -410
@@ -0,0 +1,1322 @@
1
+
2
+ /*!
3
+ * Date picker for pickadate.js v3.5.0
4
+ * http://amsul.github.io/pickadate.js/date.htm
5
+ */
6
+
7
+ (function ( factory ) {
8
+
9
+ // Register as an anonymous module.
10
+ if ( typeof define == 'function' && define.amd )
11
+ define( ['picker','jquery'], factory )
12
+
13
+ // Or using browser globals.
14
+ else factory( Picker, jQuery )
15
+
16
+ }(function( Picker, $ ) {
17
+
18
+
19
+ /**
20
+ * Globals and constants
21
+ */
22
+ var DAYS_IN_WEEK = 7,
23
+ WEEKS_IN_CALENDAR = 6,
24
+ _ = Picker._
25
+
26
+
27
+
28
+ /**
29
+ * The date picker constructor
30
+ */
31
+ function DatePicker( picker, settings ) {
32
+
33
+ var calendar = this,
34
+ elementValue = picker.$node[ 0 ].value,
35
+ elementDataValue = picker.$node.data( 'value' ),
36
+ valueString = elementDataValue || elementValue,
37
+ formatString = elementDataValue ? settings.formatSubmit : settings.format,
38
+ isRTL = function() {
39
+ return getComputedStyle( picker.$root[0] ).direction === 'rtl'
40
+ }
41
+
42
+ calendar.settings = settings
43
+ calendar.$node = picker.$node
44
+
45
+ // The queue of methods that will be used to build item objects.
46
+ calendar.queue = {
47
+ min: 'measure create',
48
+ max: 'measure create',
49
+ now: 'now create',
50
+ select: 'parse create validate',
51
+ highlight: 'parse navigate create validate',
52
+ view: 'parse create validate viewset',
53
+ disable: 'deactivate',
54
+ enable: 'activate'
55
+ }
56
+
57
+ // The component's item object.
58
+ calendar.item = {}
59
+
60
+ calendar.item.clear = null
61
+ calendar.item.disable = ( settings.disable || [] ).slice( 0 )
62
+ calendar.item.enable = -(function( collectionDisabled ) {
63
+ return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
64
+ })( calendar.item.disable )
65
+
66
+ calendar.
67
+ set( 'min', settings.min ).
68
+ set( 'max', settings.max ).
69
+ set( 'now' )
70
+
71
+ // When there’s a value, set the `select`, which in turn
72
+ // also sets the `highlight` and `view`.
73
+ if ( valueString ) {
74
+ calendar.set( 'select', valueString, { format: formatString })
75
+ }
76
+
77
+ // If there’s no value, default to highlighting “today”.
78
+ else {
79
+ calendar.
80
+ set( 'select', null ).
81
+ set( 'highlight', calendar.item.now )
82
+ }
83
+
84
+
85
+ // The keycode to movement mapping.
86
+ calendar.key = {
87
+ 40: 7, // Down
88
+ 38: -7, // Up
89
+ 39: function() { return isRTL() ? -1 : 1 }, // Right
90
+ 37: function() { return isRTL() ? 1 : -1 }, // Left
91
+ go: function( timeChange ) {
92
+ var highlightedObject = calendar.item.highlight,
93
+ targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )
94
+ calendar.set(
95
+ 'highlight',
96
+ [ targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate() ],
97
+ { interval: timeChange }
98
+ )
99
+ this.render()
100
+ }
101
+ }
102
+
103
+
104
+ // Bind some picker events.
105
+ picker.
106
+ on( 'render', function() {
107
+ picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {
108
+ var value = this.value
109
+ if ( value ) {
110
+ picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )
111
+ picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )
112
+ }
113
+ })
114
+ picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {
115
+ var value = this.value
116
+ if ( value ) {
117
+ picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )
118
+ picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )
119
+ }
120
+ })
121
+ }).
122
+ on( 'open', function() {
123
+ picker.$root.find( 'button, select' ).attr( 'disabled', false )
124
+ }).
125
+ on( 'close', function() {
126
+ picker.$root.find( 'button, select' ).attr( 'disabled', true )
127
+ })
128
+
129
+ } //DatePicker
130
+
131
+
132
+ /**
133
+ * Set a datepicker item object.
134
+ */
135
+ DatePicker.prototype.set = function( type, value, options ) {
136
+
137
+ var calendar = this,
138
+ calendarItem = calendar.item
139
+
140
+ // If the value is `null` just set it immediately.
141
+ if ( value === null ) {
142
+ if ( type == 'clear' ) type = 'select'
143
+ calendarItem[ type ] = value
144
+ return calendar
145
+ }
146
+
147
+ // Otherwise go through the queue of methods, and invoke the functions.
148
+ // Update this as the time unit, and set the final value as this item.
149
+ // * In the case of `enable`, keep the queue but set `disable` instead.
150
+ // And in the case of `flip`, keep the queue but set `enable` instead.
151
+ calendarItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = calendar.queue[ type ].split( ' ' ).map( function( method ) {
152
+ value = calendar[ method ]( type, value, options )
153
+ return value
154
+ }).pop()
155
+
156
+ // Check if we need to cascade through more updates.
157
+ if ( type == 'select' ) {
158
+ calendar.set( 'highlight', calendarItem.select, options )
159
+ }
160
+ else if ( type == 'highlight' ) {
161
+ calendar.set( 'view', calendarItem.highlight, options )
162
+ }
163
+ else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) {
164
+ if ( calendarItem.select && calendar.disabled( calendarItem.select ) ) {
165
+ calendar.set( 'select', calendarItem.select, options )
166
+ }
167
+ if ( calendarItem.highlight && calendar.disabled( calendarItem.highlight ) ) {
168
+ calendar.set( 'highlight', calendarItem.highlight, options )
169
+ }
170
+ }
171
+
172
+ return calendar
173
+ } //DatePicker.prototype.set
174
+
175
+
176
+ /**
177
+ * Get a datepicker item object.
178
+ */
179
+ DatePicker.prototype.get = function( type ) {
180
+ return this.item[ type ]
181
+ } //DatePicker.prototype.get
182
+
183
+
184
+ /**
185
+ * Create a picker date object.
186
+ */
187
+ DatePicker.prototype.create = function( type, value, options ) {
188
+
189
+ var isInfiniteValue,
190
+ calendar = this
191
+
192
+ // If there’s no value, use the type as the value.
193
+ value = value === undefined ? type : value
194
+
195
+
196
+ // If it’s infinity, update the value.
197
+ if ( value == -Infinity || value == Infinity ) {
198
+ isInfiniteValue = value
199
+ }
200
+
201
+ // If it’s an object, use the native date object.
202
+ else if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
203
+ value = value.obj
204
+ }
205
+
206
+ // If it’s an array, convert it into a date and make sure
207
+ // that it’s a valid date – otherwise default to today.
208
+ else if ( $.isArray( value ) ) {
209
+ value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] )
210
+ value = _.isDate( value ) ? value : calendar.create().obj
211
+ }
212
+
213
+ // If it’s a number or date object, make a normalized date.
214
+ else if ( _.isInteger( value ) || _.isDate( value ) ) {
215
+ value = calendar.normalize( new Date( value ), options )
216
+ }
217
+
218
+ // If it’s a literal true or any other case, set it to now.
219
+ else /*if ( value === true )*/ {
220
+ value = calendar.now( type, value, options )
221
+ }
222
+
223
+ // Return the compiled object.
224
+ return {
225
+ year: isInfiniteValue || value.getFullYear(),
226
+ month: isInfiniteValue || value.getMonth(),
227
+ date: isInfiniteValue || value.getDate(),
228
+ day: isInfiniteValue || value.getDay(),
229
+ obj: isInfiniteValue || value,
230
+ pick: isInfiniteValue || value.getTime()
231
+ }
232
+ } //DatePicker.prototype.create
233
+
234
+
235
+ /**
236
+ * Create a range limit object using an array, date object,
237
+ * literal “true”, or integer relative to another time.
238
+ */
239
+ DatePicker.prototype.createRange = function( from, to ) {
240
+
241
+ var calendar = this,
242
+ createDate = function( date ) {
243
+ if ( date === true || $.isArray( date ) || _.isDate( date ) ) {
244
+ return calendar.create( date )
245
+ }
246
+ return date
247
+ }
248
+
249
+ // Create objects if possible.
250
+ if ( !_.isInteger( from ) ) {
251
+ from = createDate( from )
252
+ }
253
+ if ( !_.isInteger( to ) ) {
254
+ to = createDate( to )
255
+ }
256
+
257
+ // Create relative dates.
258
+ if ( _.isInteger( from ) && $.isPlainObject( to ) ) {
259
+ from = [ to.year, to.month, to.date + from ];
260
+ }
261
+ else if ( _.isInteger( to ) && $.isPlainObject( from ) ) {
262
+ to = [ from.year, from.month, from.date + to ];
263
+ }
264
+
265
+ return {
266
+ from: createDate( from ),
267
+ to: createDate( to )
268
+ }
269
+ } //DatePicker.prototype.createRange
270
+
271
+
272
+ /**
273
+ * Check if a date unit falls within a date range object.
274
+ */
275
+ DatePicker.prototype.withinRange = function( range, dateUnit ) {
276
+ range = this.createRange(range.from, range.to)
277
+ return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick
278
+ }
279
+
280
+
281
+ /**
282
+ * Check if two date range objects overlap.
283
+ */
284
+ DatePicker.prototype.overlapRanges = function( one, two ) {
285
+
286
+ var calendar = this
287
+
288
+ // Convert the ranges into comparable dates.
289
+ one = calendar.createRange( one.from, one.to )
290
+ two = calendar.createRange( two.from, two.to )
291
+
292
+ return calendar.withinRange( one, two.from ) || calendar.withinRange( one, two.to ) ||
293
+ calendar.withinRange( two, one.from ) || calendar.withinRange( two, one.to )
294
+ }
295
+
296
+
297
+ /**
298
+ * Get the date today.
299
+ */
300
+ DatePicker.prototype.now = function( type, value, options ) {
301
+ value = new Date()
302
+ if ( options && options.rel ) {
303
+ value.setDate( value.getDate() + options.rel )
304
+ }
305
+ return this.normalize( value, options )
306
+ }
307
+
308
+
309
+ /**
310
+ * Navigate to next/prev month.
311
+ */
312
+ DatePicker.prototype.navigate = function( type, value, options ) {
313
+
314
+ var targetDateObject,
315
+ targetYear,
316
+ targetMonth,
317
+ targetDate,
318
+ isTargetArray = $.isArray( value ),
319
+ isTargetObject = $.isPlainObject( value ),
320
+ viewsetObject = this.item.view/*,
321
+ safety = 100*/
322
+
323
+
324
+ if ( isTargetArray || isTargetObject ) {
325
+
326
+ if ( isTargetObject ) {
327
+ targetYear = value.year
328
+ targetMonth = value.month
329
+ targetDate = value.date
330
+ }
331
+ else {
332
+ targetYear = +value[0]
333
+ targetMonth = +value[1]
334
+ targetDate = +value[2]
335
+ }
336
+
337
+ // If we’re navigating months but the view is in a different
338
+ // month, navigate to the view’s year and month.
339
+ if ( options && options.nav && viewsetObject && viewsetObject.month !== targetMonth ) {
340
+ targetYear = viewsetObject.year
341
+ targetMonth = viewsetObject.month
342
+ }
343
+
344
+ // Figure out the expected target year and month.
345
+ targetDateObject = new Date( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 )
346
+ targetYear = targetDateObject.getFullYear()
347
+ targetMonth = targetDateObject.getMonth()
348
+
349
+ // If the month we’re going to doesn’t have enough days,
350
+ // keep decreasing the date until we reach the month’s last date.
351
+ while ( /*safety &&*/ new Date( targetYear, targetMonth, targetDate ).getMonth() !== targetMonth ) {
352
+ targetDate -= 1
353
+ /*safety -= 1
354
+ if ( !safety ) {
355
+ throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
356
+ }*/
357
+ }
358
+
359
+ value = [ targetYear, targetMonth, targetDate ]
360
+ }
361
+
362
+ return value
363
+ } //DatePicker.prototype.navigate
364
+
365
+
366
+ /**
367
+ * Normalize a date by setting the hours to midnight.
368
+ */
369
+ DatePicker.prototype.normalize = function( value/*, options*/ ) {
370
+ value.setHours( 0, 0, 0, 0 )
371
+ return value
372
+ }
373
+
374
+
375
+ /**
376
+ * Measure the range of dates.
377
+ */
378
+ DatePicker.prototype.measure = function( type, value/*, options*/ ) {
379
+
380
+ var calendar = this
381
+
382
+ // If it's anything false-y, remove the limits.
383
+ if ( !value ) {
384
+ value = type == 'min' ? -Infinity : Infinity
385
+ }
386
+
387
+ // If it's an integer, get a date relative to today.
388
+ else if ( _.isInteger( value ) ) {
389
+ value = calendar.now( type, value, { rel: value } )
390
+ }
391
+
392
+ return value
393
+ } ///DatePicker.prototype.measure
394
+
395
+
396
+ /**
397
+ * Create a viewset object based on navigation.
398
+ */
399
+ DatePicker.prototype.viewset = function( type, dateObject/*, options*/ ) {
400
+ return this.create([ dateObject.year, dateObject.month, 1 ])
401
+ }
402
+
403
+
404
+ /**
405
+ * Validate a date as enabled and shift if needed.
406
+ */
407
+ DatePicker.prototype.validate = function( type, dateObject, options ) {
408
+
409
+ var calendar = this,
410
+
411
+ // Keep a reference to the original date.
412
+ originalDateObject = dateObject,
413
+
414
+ // Make sure we have an interval.
415
+ interval = options && options.interval ? options.interval : 1,
416
+
417
+ // Check if the calendar enabled dates are inverted.
418
+ isFlippedBase = calendar.item.enable === -1,
419
+
420
+ // Check if we have any enabled dates after/before now.
421
+ hasEnabledBeforeTarget, hasEnabledAfterTarget,
422
+
423
+ // The min & max limits.
424
+ minLimitObject = calendar.item.min,
425
+ maxLimitObject = calendar.item.max,
426
+
427
+ // Check if we’ve reached the limit during shifting.
428
+ reachedMin, reachedMax,
429
+
430
+ // Check if the calendar is inverted and at least one weekday is enabled.
431
+ hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter( function( value ) {
432
+
433
+ // If there’s a date, check where it is relative to the target.
434
+ if ( $.isArray( value ) ) {
435
+ var dateTime = calendar.create( value ).pick
436
+ if ( dateTime < dateObject.pick ) hasEnabledBeforeTarget = true
437
+ else if ( dateTime > dateObject.pick ) hasEnabledAfterTarget = true
438
+ }
439
+
440
+ // Return only integers for enabled weekdays.
441
+ return _.isInteger( value )
442
+ }).length/*,
443
+
444
+ safety = 100*/
445
+
446
+
447
+
448
+ // Cases to validate for:
449
+ // [1] Not inverted and date disabled.
450
+ // [2] Inverted and some dates enabled.
451
+ // [3] Not inverted and out of range.
452
+ //
453
+ // Cases to **not** validate for:
454
+ // • Navigating months.
455
+ // • Not inverted and date enabled.
456
+ // • Inverted and all dates disabled.
457
+ // • ..and anything else.
458
+ if ( !options || !options.nav ) if (
459
+ /* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) ||
460
+ /* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) ||
461
+ /* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) )
462
+ ) {
463
+
464
+
465
+ // When inverted, flip the direction if there aren’t any enabled weekdays
466
+ // and there are no enabled dates in the direction of the interval.
467
+ if ( isFlippedBase && !hasEnabledWeekdays && ( ( !hasEnabledAfterTarget && interval > 0 ) || ( !hasEnabledBeforeTarget && interval < 0 ) ) ) {
468
+ interval *= -1
469
+ }
470
+
471
+
472
+ // Keep looping until we reach an enabled date.
473
+ while ( /*safety &&*/ calendar.disabled( dateObject ) ) {
474
+
475
+ /*safety -= 1
476
+ if ( !safety ) {
477
+ throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
478
+ }*/
479
+
480
+
481
+ // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
482
+ if ( Math.abs( interval ) > 1 && ( dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month ) ) {
483
+ dateObject = originalDateObject
484
+ interval = interval > 0 ? 1 : -1
485
+ }
486
+
487
+
488
+ // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
489
+ if ( dateObject.pick <= minLimitObject.pick ) {
490
+ reachedMin = true
491
+ interval = 1
492
+ dateObject = calendar.create([
493
+ minLimitObject.year,
494
+ minLimitObject.month,
495
+ minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)
496
+ ])
497
+ }
498
+ else if ( dateObject.pick >= maxLimitObject.pick ) {
499
+ reachedMax = true
500
+ interval = -1
501
+ dateObject = calendar.create([
502
+ maxLimitObject.year,
503
+ maxLimitObject.month,
504
+ maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)
505
+ ])
506
+ }
507
+
508
+
509
+ // If we’ve reached both limits, just break out of the loop.
510
+ if ( reachedMin && reachedMax ) {
511
+ break
512
+ }
513
+
514
+
515
+ // Finally, create the shifted date using the interval and keep looping.
516
+ dateObject = calendar.create([ dateObject.year, dateObject.month, dateObject.date + interval ])
517
+ }
518
+
519
+ } //endif
520
+
521
+
522
+ // Return the date object settled on.
523
+ return dateObject
524
+ } //DatePicker.prototype.validate
525
+
526
+
527
+ /**
528
+ * Check if a date is disabled.
529
+ */
530
+ DatePicker.prototype.disabled = function( dateToVerify ) {
531
+
532
+ var
533
+ calendar = this,
534
+
535
+ // Filter through the disabled dates to check if this is one.
536
+ isDisabledMatch = calendar.item.disable.filter( function( dateToDisable ) {
537
+
538
+ // If the date is a number, match the weekday with 0index and `firstDay` check.
539
+ if ( _.isInteger( dateToDisable ) ) {
540
+ return dateToVerify.day === ( calendar.settings.firstDay ? dateToDisable : dateToDisable - 1 ) % 7
541
+ }
542
+
543
+ // If it’s an array or a native JS date, create and match the exact date.
544
+ if ( $.isArray( dateToDisable ) || _.isDate( dateToDisable ) ) {
545
+ return dateToVerify.pick === calendar.create( dateToDisable ).pick
546
+ }
547
+
548
+ // If it’s an object, match a date within the “from” and “to” range.
549
+ if ( $.isPlainObject( dateToDisable ) ) {
550
+ return calendar.withinRange( dateToDisable, dateToVerify )
551
+ }
552
+ })
553
+
554
+ // If this date matches a disabled date, confirm it’s not inverted.
555
+ isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( dateToDisable ) {
556
+ return $.isArray( dateToDisable ) && dateToDisable[3] == 'inverted' ||
557
+ $.isPlainObject( dateToDisable ) && dateToDisable.inverted
558
+ }).length
559
+
560
+ // Check the calendar “enabled” flag and respectively flip the
561
+ // disabled state. Then also check if it’s beyond the min/max limits.
562
+ return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
563
+ dateToVerify.pick < calendar.item.min.pick ||
564
+ dateToVerify.pick > calendar.item.max.pick
565
+
566
+ } //DatePicker.prototype.disabled
567
+
568
+
569
+ /**
570
+ * Parse a string into a usable type.
571
+ */
572
+ DatePicker.prototype.parse = function( type, value, options ) {
573
+
574
+ var calendar = this,
575
+ parsingObject = {}
576
+
577
+ // If it’s already parsed, we’re good.
578
+ if ( !value || typeof value != 'string' ) {
579
+ return value
580
+ }
581
+
582
+ // We need a `.format` to parse the value with.
583
+ if ( !( options && options.format ) ) {
584
+ options = options || {}
585
+ options.format = calendar.settings.format
586
+ }
587
+
588
+ // Convert the format into an array and then map through it.
589
+ calendar.formats.toArray( options.format ).map( function( label ) {
590
+
591
+ var
592
+ // Grab the formatting label.
593
+ formattingLabel = calendar.formats[ label ],
594
+
595
+ // The format length is from the formatting label function or the
596
+ // label length without the escaping exclamation (!) mark.
597
+ formatLength = formattingLabel ? _.trigger( formattingLabel, calendar, [ value, parsingObject ] ) : label.replace( /^!/, '' ).length
598
+
599
+ // If there's a format label, split the value up to the format length.
600
+ // Then add it to the parsing object with appropriate label.
601
+ if ( formattingLabel ) {
602
+ parsingObject[ label ] = value.substr( 0, formatLength )
603
+ }
604
+
605
+ // Update the value as the substring from format length to end.
606
+ value = value.substr( formatLength )
607
+ })
608
+
609
+ // Compensate for month 0index.
610
+ return [
611
+ parsingObject.yyyy || parsingObject.yy,
612
+ +( parsingObject.mm || parsingObject.m ) - 1,
613
+ parsingObject.dd || parsingObject.d
614
+ ]
615
+ } //DatePicker.prototype.parse
616
+
617
+
618
+ /**
619
+ * Various formats to display the object in.
620
+ */
621
+ DatePicker.prototype.formats = (function() {
622
+
623
+ // Return the length of the first word in a collection.
624
+ function getWordLengthFromCollection( string, collection, dateObject ) {
625
+
626
+ // Grab the first word from the string.
627
+ var word = string.match( /\w+/ )[ 0 ]
628
+
629
+ // If there's no month index, add it to the date object
630
+ if ( !dateObject.mm && !dateObject.m ) {
631
+ dateObject.m = collection.indexOf( word ) + 1
632
+ }
633
+
634
+ // Return the length of the word.
635
+ return word.length
636
+ }
637
+
638
+ // Get the length of the first word in a string.
639
+ function getFirstWordLength( string ) {
640
+ return string.match( /\w+/ )[ 0 ].length
641
+ }
642
+
643
+ return {
644
+
645
+ d: function( string, dateObject ) {
646
+
647
+ // If there's string, then get the digits length.
648
+ // Otherwise return the selected date.
649
+ return string ? _.digits( string ) : dateObject.date
650
+ },
651
+ dd: function( string, dateObject ) {
652
+
653
+ // If there's a string, then the length is always 2.
654
+ // Otherwise return the selected date with a leading zero.
655
+ return string ? 2 : _.lead( dateObject.date )
656
+ },
657
+ ddd: function( string, dateObject ) {
658
+
659
+ // If there's a string, then get the length of the first word.
660
+ // Otherwise return the short selected weekday.
661
+ return string ? getFirstWordLength( string ) : this.settings.weekdaysShort[ dateObject.day ]
662
+ },
663
+ dddd: function( string, dateObject ) {
664
+
665
+ // If there's a string, then get the length of the first word.
666
+ // Otherwise return the full selected weekday.
667
+ return string ? getFirstWordLength( string ) : this.settings.weekdaysFull[ dateObject.day ]
668
+ },
669
+ m: function( string, dateObject ) {
670
+
671
+ // If there's a string, then get the length of the digits
672
+ // Otherwise return the selected month with 0index compensation.
673
+ return string ? _.digits( string ) : dateObject.month + 1
674
+ },
675
+ mm: function( string, dateObject ) {
676
+
677
+ // If there's a string, then the length is always 2.
678
+ // Otherwise return the selected month with 0index and leading zero.
679
+ return string ? 2 : _.lead( dateObject.month + 1 )
680
+ },
681
+ mmm: function( string, dateObject ) {
682
+
683
+ var collection = this.settings.monthsShort
684
+
685
+ // If there's a string, get length of the relevant month from the short
686
+ // months collection. Otherwise return the selected month from that collection.
687
+ return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
688
+ },
689
+ mmmm: function( string, dateObject ) {
690
+
691
+ var collection = this.settings.monthsFull
692
+
693
+ // If there's a string, get length of the relevant month from the full
694
+ // months collection. Otherwise return the selected month from that collection.
695
+ return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
696
+ },
697
+ yy: function( string, dateObject ) {
698
+
699
+ // If there's a string, then the length is always 2.
700
+ // Otherwise return the selected year by slicing out the first 2 digits.
701
+ return string ? 2 : ( '' + dateObject.year ).slice( 2 )
702
+ },
703
+ yyyy: function( string, dateObject ) {
704
+
705
+ // If there's a string, then the length is always 4.
706
+ // Otherwise return the selected year.
707
+ return string ? 4 : dateObject.year
708
+ },
709
+
710
+ // Create an array by splitting the formatting string passed.
711
+ toArray: function( formatString ) { return formatString.split( /(d{1,4}|m{1,4}|y{4}|yy|!.)/g ) },
712
+
713
+ // Format an object into a string using the formatting options.
714
+ toString: function ( formatString, itemObject ) {
715
+ var calendar = this
716
+ return calendar.formats.toArray( formatString ).map( function( label ) {
717
+ return _.trigger( calendar.formats[ label ], calendar, [ 0, itemObject ] ) || label.replace( /^!/, '' )
718
+ }).join( '' )
719
+ }
720
+ }
721
+ })() //DatePicker.prototype.formats
722
+
723
+
724
+
725
+
726
+ /**
727
+ * Check if two date units are the exact.
728
+ */
729
+ DatePicker.prototype.isDateExact = function( one, two ) {
730
+
731
+ var calendar = this
732
+
733
+ // When we’re working with weekdays, do a direct comparison.
734
+ if (
735
+ ( _.isInteger( one ) && _.isInteger( two ) ) ||
736
+ ( typeof one == 'boolean' && typeof two == 'boolean' )
737
+ ) {
738
+ return one === two
739
+ }
740
+
741
+ // When we’re working with date representations, compare the “pick” value.
742
+ if (
743
+ ( _.isDate( one ) || $.isArray( one ) ) &&
744
+ ( _.isDate( two ) || $.isArray( two ) )
745
+ ) {
746
+ return calendar.create( one ).pick === calendar.create( two ).pick
747
+ }
748
+
749
+ // When we’re working with range objects, compare the “from” and “to”.
750
+ if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
751
+ return calendar.isDateExact( one.from, two.from ) && calendar.isDateExact( one.to, two.to )
752
+ }
753
+
754
+ return false
755
+ }
756
+
757
+
758
+ /**
759
+ * Check if two date units overlap.
760
+ */
761
+ DatePicker.prototype.isDateOverlap = function( one, two ) {
762
+
763
+ var calendar = this,
764
+ firstDay = calendar.settings.firstDay ? 1 : 0
765
+
766
+ // When we’re working with a weekday index, compare the days.
767
+ if ( _.isInteger( one ) && ( _.isDate( two ) || $.isArray( two ) ) ) {
768
+ one = one % 7 + firstDay
769
+ return one === calendar.create( two ).day + 1
770
+ }
771
+ if ( _.isInteger( two ) && ( _.isDate( one ) || $.isArray( one ) ) ) {
772
+ two = two % 7 + firstDay
773
+ return two === calendar.create( one ).day + 1
774
+ }
775
+
776
+ // When we’re working with range objects, check if the ranges overlap.
777
+ if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
778
+ return calendar.overlapRanges( one, two )
779
+ }
780
+
781
+ return false
782
+ }
783
+
784
+
785
+ /**
786
+ * Flip the “enabled” state.
787
+ */
788
+ DatePicker.prototype.flipEnable = function(val) {
789
+ var itemObject = this.item
790
+ itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
791
+ }
792
+
793
+
794
+ /**
795
+ * Mark a collection of dates as “disabled”.
796
+ */
797
+ DatePicker.prototype.deactivate = function( type, datesToDisable ) {
798
+
799
+ var calendar = this,
800
+ disabledItems = calendar.item.disable.slice(0)
801
+
802
+
803
+ // If we’re flipping, that’s all we need to do.
804
+ if ( datesToDisable == 'flip' ) {
805
+ calendar.flipEnable()
806
+ }
807
+
808
+ else if ( datesToDisable === false ) {
809
+ calendar.flipEnable(1)
810
+ disabledItems = []
811
+ }
812
+
813
+ else if ( datesToDisable === true ) {
814
+ calendar.flipEnable(-1)
815
+ disabledItems = []
816
+ }
817
+
818
+ // Otherwise go through the dates to disable.
819
+ else {
820
+
821
+ datesToDisable.map(function( unitToDisable ) {
822
+
823
+ var matchFound
824
+
825
+ // When we have disabled items, check for matches.
826
+ // If something is matched, immediately break out.
827
+ for ( var index = 0; index < disabledItems.length; index += 1 ) {
828
+ if ( calendar.isDateExact( unitToDisable, disabledItems[index] ) ) {
829
+ matchFound = true
830
+ break
831
+ }
832
+ }
833
+
834
+ // If nothing was found, add the validated unit to the collection.
835
+ if ( !matchFound ) {
836
+ if (
837
+ _.isInteger( unitToDisable ) ||
838
+ _.isDate( unitToDisable ) ||
839
+ $.isArray( unitToDisable ) ||
840
+ ( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
841
+ ) {
842
+ disabledItems.push( unitToDisable )
843
+ }
844
+ }
845
+ })
846
+ }
847
+
848
+ // Return the updated collection.
849
+ return disabledItems
850
+ } //DatePicker.prototype.deactivate
851
+
852
+
853
+ /**
854
+ * Mark a collection of dates as “enabled”.
855
+ */
856
+ DatePicker.prototype.activate = function( type, datesToEnable ) {
857
+
858
+ var calendar = this,
859
+ disabledItems = calendar.item.disable,
860
+ disabledItemsCount = disabledItems.length
861
+
862
+ // If we’re flipping, that’s all we need to do.
863
+ if ( datesToEnable == 'flip' ) {
864
+ calendar.flipEnable()
865
+ }
866
+
867
+ else if ( datesToEnable === true ) {
868
+ calendar.flipEnable(1)
869
+ disabledItems = []
870
+ }
871
+
872
+ else if ( datesToEnable === false ) {
873
+ calendar.flipEnable(-1)
874
+ disabledItems = []
875
+ }
876
+
877
+ // Otherwise go through the disabled dates.
878
+ else {
879
+
880
+ datesToEnable.map(function( unitToEnable ) {
881
+
882
+ var matchFound,
883
+ disabledUnit,
884
+ index,
885
+ isExactRange
886
+
887
+ // Go through the disabled items and try to find a match.
888
+ for ( index = 0; index < disabledItemsCount; index += 1 ) {
889
+
890
+ disabledUnit = disabledItems[index]
891
+
892
+ // When an exact match is found, remove it from the collection.
893
+ if ( calendar.isDateExact( disabledUnit, unitToEnable ) ) {
894
+ matchFound = disabledItems[index] = null
895
+ isExactRange = true
896
+ break
897
+ }
898
+
899
+ // When an overlapped match is found, add the “inverted” state to it.
900
+ else if ( calendar.isDateOverlap( disabledUnit, unitToEnable ) ) {
901
+ if ( $.isPlainObject( unitToEnable ) ) {
902
+ unitToEnable.inverted = true
903
+ matchFound = unitToEnable
904
+ }
905
+ else if ( $.isArray( unitToEnable ) ) {
906
+ matchFound = unitToEnable
907
+ if ( !matchFound[3] ) matchFound.push( 'inverted' )
908
+ }
909
+ else if ( _.isDate( unitToEnable ) ) {
910
+ matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
911
+ }
912
+ break
913
+ }
914
+ }
915
+
916
+ // If a match was found, remove a previous duplicate entry.
917
+ if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
918
+ if ( calendar.isDateExact( disabledItems[index], unitToEnable ) ) {
919
+ disabledItems[index] = null
920
+ break
921
+ }
922
+ }
923
+
924
+ // In the event that we’re dealing with an exact range of dates,
925
+ // make sure there are no “inverted” dates because of it.
926
+ if ( isExactRange ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
927
+ if ( calendar.isDateOverlap( disabledItems[index], unitToEnable ) ) {
928
+ disabledItems[index] = null
929
+ break
930
+ }
931
+ }
932
+
933
+ // If something is still matched, add it into the collection.
934
+ if ( matchFound ) {
935
+ disabledItems.push( matchFound )
936
+ }
937
+ })
938
+ }
939
+
940
+ // Return the updated collection.
941
+ return disabledItems.filter(function( val ) { return val != null })
942
+ } //DatePicker.prototype.activate
943
+
944
+
945
+ /**
946
+ * Create a string for the nodes in the picker.
947
+ */
948
+ DatePicker.prototype.nodes = function( isOpen ) {
949
+
950
+ var
951
+ calendar = this,
952
+ settings = calendar.settings,
953
+ calendarItem = calendar.item,
954
+ nowObject = calendarItem.now,
955
+ selectedObject = calendarItem.select,
956
+ highlightedObject = calendarItem.highlight,
957
+ viewsetObject = calendarItem.view,
958
+ disabledCollection = calendarItem.disable,
959
+ minLimitObject = calendarItem.min,
960
+ maxLimitObject = calendarItem.max,
961
+
962
+
963
+ // Create the calendar table head using a copy of weekday labels collection.
964
+ // * We do a copy so we don't mutate the original array.
965
+ tableHead = (function( collection, fullCollection ) {
966
+
967
+ // If the first day should be Monday, move Sunday to the end.
968
+ if ( settings.firstDay ) {
969
+ collection.push( collection.shift() )
970
+ fullCollection.push( fullCollection.shift() )
971
+ }
972
+
973
+ // Create and return the table head group.
974
+ return _.node(
975
+ 'thead',
976
+ _.node(
977
+ 'tr',
978
+ _.group({
979
+ min: 0,
980
+ max: DAYS_IN_WEEK - 1,
981
+ i: 1,
982
+ node: 'th',
983
+ item: function( counter ) {
984
+ return [
985
+ collection[ counter ],
986
+ settings.klass.weekdays,
987
+ 'scope=col title="' + fullCollection[ counter ] + '"'
988
+ ]
989
+ }
990
+ })
991
+ )
992
+ ) //endreturn
993
+ })( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort ).slice( 0 ), settings.weekdaysFull.slice( 0 ) ), //tableHead
994
+
995
+
996
+ // Create the nav for next/prev month.
997
+ createMonthNav = function( next ) {
998
+
999
+ // Otherwise, return the created month tag.
1000
+ return _.node(
1001
+ 'div',
1002
+ ' ',
1003
+ settings.klass[ 'nav' + ( next ? 'Next' : 'Prev' ) ] + (
1004
+
1005
+ // If the focused month is outside the range, disabled the button.
1006
+ ( next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month ) ||
1007
+ ( !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ) ?
1008
+ ' ' + settings.klass.navDisabled : ''
1009
+ ),
1010
+ 'data-nav=' + ( next || -1 ) + ' ' +
1011
+ _.ariaAttr({
1012
+ role: 'button',
1013
+ controls: calendar.$node[0].id + '_table'
1014
+ }) + ' ' +
1015
+ 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev ) + '"'
1016
+ ) //endreturn
1017
+ }, //createMonthNav
1018
+
1019
+
1020
+ // Create the month label.
1021
+ createMonthLabel = function() {
1022
+
1023
+ var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull
1024
+
1025
+ // If there are months to select, add a dropdown menu.
1026
+ if ( settings.selectMonths ) {
1027
+
1028
+ return _.node( 'select',
1029
+ _.group({
1030
+ min: 0,
1031
+ max: 11,
1032
+ i: 1,
1033
+ node: 'option',
1034
+ item: function( loopedMonth ) {
1035
+
1036
+ return [
1037
+
1038
+ // The looped month and no classes.
1039
+ monthsCollection[ loopedMonth ], 0,
1040
+
1041
+ // Set the value and selected index.
1042
+ 'value=' + loopedMonth +
1043
+ ( viewsetObject.month == loopedMonth ? ' selected' : '' ) +
1044
+ (
1045
+ (
1046
+ ( viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month ) ||
1047
+ ( viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month )
1048
+ ) ?
1049
+ ' disabled' : ''
1050
+ )
1051
+ ]
1052
+ }
1053
+ }),
1054
+ settings.klass.selectMonth,
1055
+ ( isOpen ? '' : 'disabled' ) + ' ' +
1056
+ _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
1057
+ 'title="' + settings.labelMonthSelect + '"'
1058
+ )
1059
+ }
1060
+
1061
+ // If there's a need for a month selector
1062
+ return _.node( 'div', monthsCollection[ viewsetObject.month ], settings.klass.month )
1063
+ }, //createMonthLabel
1064
+
1065
+
1066
+ // Create the year label.
1067
+ createYearLabel = function() {
1068
+
1069
+ var focusedYear = viewsetObject.year,
1070
+
1071
+ // If years selector is set to a literal "true", set it to 5. Otherwise
1072
+ // divide in half to get half before and half after focused year.
1073
+ numberYears = settings.selectYears === true ? 5 : ~~( settings.selectYears / 2 )
1074
+
1075
+ // If there are years to select, add a dropdown menu.
1076
+ if ( numberYears ) {
1077
+
1078
+ var
1079
+ minYear = minLimitObject.year,
1080
+ maxYear = maxLimitObject.year,
1081
+ lowestYear = focusedYear - numberYears,
1082
+ highestYear = focusedYear + numberYears
1083
+
1084
+ // If the min year is greater than the lowest year, increase the highest year
1085
+ // by the difference and set the lowest year to the min year.
1086
+ if ( minYear > lowestYear ) {
1087
+ highestYear += minYear - lowestYear
1088
+ lowestYear = minYear
1089
+ }
1090
+
1091
+ // If the max year is less than the highest year, decrease the lowest year
1092
+ // by the lower of the two: available and needed years. Then set the
1093
+ // highest year to the max year.
1094
+ if ( maxYear < highestYear ) {
1095
+
1096
+ var availableYears = lowestYear - minYear,
1097
+ neededYears = highestYear - maxYear
1098
+
1099
+ lowestYear -= availableYears > neededYears ? neededYears : availableYears
1100
+ highestYear = maxYear
1101
+ }
1102
+
1103
+ return _.node( 'select',
1104
+ _.group({
1105
+ min: lowestYear,
1106
+ max: highestYear,
1107
+ i: 1,
1108
+ node: 'option',
1109
+ item: function( loopedYear ) {
1110
+ return [
1111
+
1112
+ // The looped year and no classes.
1113
+ loopedYear, 0,
1114
+
1115
+ // Set the value and selected index.
1116
+ 'value=' + loopedYear + ( focusedYear == loopedYear ? ' selected' : '' )
1117
+ ]
1118
+ }
1119
+ }),
1120
+ settings.klass.selectYear,
1121
+ ( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
1122
+ 'title="' + settings.labelYearSelect + '"'
1123
+ )
1124
+ }
1125
+
1126
+ // Otherwise just return the year focused
1127
+ return _.node( 'div', focusedYear, settings.klass.year )
1128
+ } //createYearLabel
1129
+
1130
+
1131
+ // Create and return the entire calendar.
1132
+ return _.node(
1133
+ 'div',
1134
+ ( settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel() ) +
1135
+ createMonthNav() + createMonthNav( 1 ),
1136
+ settings.klass.header
1137
+ ) + _.node(
1138
+ 'table',
1139
+ tableHead +
1140
+ _.node(
1141
+ 'tbody',
1142
+ _.group({
1143
+ min: 0,
1144
+ max: WEEKS_IN_CALENDAR - 1,
1145
+ i: 1,
1146
+ node: 'tr',
1147
+ item: function( rowCounter ) {
1148
+
1149
+ // If Monday is the first day and the month starts on Sunday, shift the date back a week.
1150
+ var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0
1151
+
1152
+ return [
1153
+ _.group({
1154
+ min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
1155
+ max: function() {
1156
+ return this.min + DAYS_IN_WEEK - 1
1157
+ },
1158
+ i: 1,
1159
+ node: 'td',
1160
+ item: function( targetDate ) {
1161
+
1162
+ // Convert the time date from a relative date to a target date.
1163
+ targetDate = calendar.create([ viewsetObject.year, viewsetObject.month, targetDate + ( settings.firstDay ? 1 : 0 ) ])
1164
+
1165
+ var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
1166
+ isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
1167
+ isDisabled = disabledCollection && calendar.disabled( targetDate ) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick
1168
+
1169
+ return [
1170
+ _.node(
1171
+ 'div',
1172
+ targetDate.date,
1173
+ (function( klasses ) {
1174
+
1175
+ // Add the `infocus` or `outfocus` classes based on month in view.
1176
+ klasses.push( viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus )
1177
+
1178
+ // Add the `today` class if needed.
1179
+ if ( nowObject.pick == targetDate.pick ) {
1180
+ klasses.push( settings.klass.now )
1181
+ }
1182
+
1183
+ // Add the `selected` class if something's selected and the time matches.
1184
+ if ( isSelected ) {
1185
+ klasses.push( settings.klass.selected )
1186
+ }
1187
+
1188
+ // Add the `highlighted` class if something's highlighted and the time matches.
1189
+ if ( isHighlighted ) {
1190
+ klasses.push( settings.klass.highlighted )
1191
+ }
1192
+
1193
+ // Add the `disabled` class if something's disabled and the object matches.
1194
+ if ( isDisabled ) {
1195
+ klasses.push( settings.klass.disabled )
1196
+ }
1197
+
1198
+ return klasses.join( ' ' )
1199
+ })([ settings.klass.day ]),
1200
+ 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
1201
+ role: 'gridcell',
1202
+ selected: isSelected && calendar.$node.val() === _.trigger(
1203
+ calendar.formats.toString,
1204
+ calendar,
1205
+ [ settings.format, targetDate ]
1206
+ ) ? true : null,
1207
+ activedescendant: isHighlighted ? true : null,
1208
+ disabled: isDisabled ? true : null
1209
+ })
1210
+ ),
1211
+ '',
1212
+ _.ariaAttr({ role: 'presentation' })
1213
+ ] //endreturn
1214
+ }
1215
+ })
1216
+ ] //endreturn
1217
+ }
1218
+ })
1219
+ ),
1220
+ settings.klass.table,
1221
+ 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
1222
+ role: 'grid',
1223
+ controls: calendar.$node[0].id,
1224
+ readonly: true
1225
+ })
1226
+ ) +
1227
+
1228
+ // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
1229
+ _.node(
1230
+ 'div',
1231
+ _.node( 'button', settings.today, settings.klass.buttonToday,
1232
+ 'type=button data-pick=' + nowObject.pick +
1233
+ ( isOpen ? '' : ' disabled' ) + ' ' +
1234
+ _.ariaAttr({ controls: calendar.$node[0].id }) ) +
1235
+ _.node( 'button', settings.clear, settings.klass.buttonClear,
1236
+ 'type=button data-clear=1' +
1237
+ ( isOpen ? '' : ' disabled' ) + ' ' +
1238
+ _.ariaAttr({ controls: calendar.$node[0].id }) ),
1239
+ settings.klass.footer
1240
+ ) //endreturn
1241
+ } //DatePicker.prototype.nodes
1242
+
1243
+
1244
+
1245
+
1246
+ /**
1247
+ * The date picker defaults.
1248
+ */
1249
+ DatePicker.defaults = (function( prefix ) {
1250
+
1251
+ return {
1252
+
1253
+ // The title label to use for the month nav buttons
1254
+ labelMonthNext: 'Next month',
1255
+ labelMonthPrev: 'Previous month',
1256
+
1257
+ // The title label to use for the dropdown selectors
1258
+ labelMonthSelect: 'Select a month',
1259
+ labelYearSelect: 'Select a year',
1260
+
1261
+ // Months and weekdays
1262
+ monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
1263
+ monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
1264
+ weekdaysFull: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
1265
+ weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
1266
+
1267
+ // Today and clear
1268
+ today: 'Today',
1269
+ clear: 'Clear',
1270
+
1271
+ // The format to show on the `input` element
1272
+ format: 'd mmmm, yyyy',
1273
+
1274
+ // Classes
1275
+ klass: {
1276
+
1277
+ table: prefix + 'table',
1278
+
1279
+ header: prefix + 'header',
1280
+
1281
+ navPrev: prefix + 'nav--prev',
1282
+ navNext: prefix + 'nav--next',
1283
+ navDisabled: prefix + 'nav--disabled',
1284
+
1285
+ month: prefix + 'month',
1286
+ year: prefix + 'year',
1287
+
1288
+ selectMonth: prefix + 'select--month',
1289
+ selectYear: prefix + 'select--year',
1290
+
1291
+ weekdays: prefix + 'weekday',
1292
+
1293
+ day: prefix + 'day',
1294
+ disabled: prefix + 'day--disabled',
1295
+ selected: prefix + 'day--selected',
1296
+ highlighted: prefix + 'day--highlighted',
1297
+ now: prefix + 'day--today',
1298
+ infocus: prefix + 'day--infocus',
1299
+ outfocus: prefix + 'day--outfocus',
1300
+
1301
+ footer: prefix + 'footer',
1302
+
1303
+ buttonClear: prefix + 'button--clear',
1304
+ buttonToday: prefix + 'button--today'
1305
+ }
1306
+ }
1307
+ })( Picker.klasses().picker + '__' )
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+ /**
1314
+ * Extend the picker to add the date picker.
1315
+ */
1316
+ Picker.extend( 'pickadate', DatePicker )
1317
+
1318
+
1319
+ }));
1320
+
1321
+
1322
+