activeadmin 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/lib/active_admin/version.rb +1 -1
  4. data/lib/active_admin/views/components/active_admin_form.rb +1 -1
  5. data/vendor/assets/javascripts/jquery-ui/data.js +12 -8
  6. data/vendor/assets/javascripts/jquery-ui/disable-selection.js +10 -7
  7. data/vendor/assets/javascripts/jquery-ui/focusable.js +12 -9
  8. data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +60 -57
  9. data/vendor/assets/javascripts/jquery-ui/form.js +15 -12
  10. data/vendor/assets/javascripts/jquery-ui/ie.js +5 -2
  11. data/vendor/assets/javascripts/jquery-ui/keycode.js +11 -7
  12. data/vendor/assets/javascripts/jquery-ui/labels.js +46 -40
  13. data/vendor/assets/javascripts/jquery-ui/plugin.js +5 -2
  14. data/vendor/assets/javascripts/jquery-ui/position.js +30 -17
  15. data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
  16. data/vendor/assets/javascripts/jquery-ui/safe-blur.js +6 -2
  17. data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +10 -7
  18. data/vendor/assets/javascripts/jquery-ui/tabbable.js +11 -8
  19. data/vendor/assets/javascripts/jquery-ui/unique-id.js +10 -7
  20. data/vendor/assets/javascripts/jquery-ui/version.js +6 -3
  21. data/vendor/assets/javascripts/jquery-ui/widget.js +53 -30
  22. data/vendor/assets/javascripts/jquery-ui/widgets/button.js +87 -24
  23. data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +276 -273
  24. data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +15 -11
  25. data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +182 -62
  26. data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +53 -36
  27. data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +28 -19
  28. data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +22 -11
  29. data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +47 -26
  30. data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +186 -125
  31. data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +20 -20
  32. metadata +3 -4
  33. data/vendor/assets/javascripts/jquery-ui/escape-selector.js +0 -23
@@ -1,27 +1,28 @@
1
1
  //= require jquery-ui/version
2
2
  //= require jquery-ui/keycode
3
3
 
4
- // jscs:disable maximumLineLength
5
- /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
4
+ /* eslint-disable max-len, camelcase */
6
5
  /*!
7
- * jQuery UI Datepicker 1.12.1
8
- * http://jqueryui.com
6
+ * jQuery UI Datepicker 1.13.3
7
+ * https://jqueryui.com
9
8
  *
10
- * Copyright jQuery Foundation and other contributors
9
+ * Copyright OpenJS Foundation and other contributors
11
10
  * Released under the MIT license.
12
- * http://jquery.org/license
11
+ * https://jquery.org/license
13
12
  */
14
13
 
15
14
  //>>label: Datepicker
16
15
  //>>group: Widgets
17
16
  //>>description: Displays a calendar from an input or inline for selecting dates.
18
- //>>docs: http://api.jqueryui.com/datepicker/
19
- //>>demos: http://jqueryui.com/datepicker/
17
+ //>>docs: https://api.jqueryui.com/datepicker/
18
+ //>>demos: https://jqueryui.com/datepicker/
20
19
  //>>css.structure: ../../themes/base/core.css
21
20
  //>>css.structure: ../../themes/base/datepicker.css
22
21
  //>>css.theme: ../../themes/base/theme.css
23
22
 
24
23
  ( function( factory ) {
24
+ "use strict";
25
+
25
26
  if ( typeof define === "function" && define.amd ) {
26
27
 
27
28
  // AMD. Register as an anonymous module.
@@ -35,9 +36,10 @@
35
36
  // Browser globals
36
37
  factory( jQuery );
37
38
  }
38
- }( function( $ ) {
39
+ } )( function( $ ) {
40
+ "use strict";
39
41
 
40
- $.extend( $.ui, { datepicker: { version: "1.12.1" } } );
42
+ $.extend( $.ui, { datepicker: { version: "1.13.3" } } );
41
43
 
42
44
  var datepicker_instActive;
43
45
 
@@ -65,6 +67,7 @@ function datepicker_getZindex( elem ) {
65
67
 
66
68
  return 0;
67
69
  }
70
+
68
71
  /* Date picker manager.
69
72
  Use the singleton instance of this class, $.datepicker, to interact with the date picker.
70
73
  Settings for (groups of) date pickers are maintained in an instance object,
@@ -91,18 +94,20 @@ function Datepicker() {
91
94
  prevText: "Prev", // Display text for previous month link
92
95
  nextText: "Next", // Display text for next month link
93
96
  currentText: "Today", // Display text for current month link
94
- monthNames: [ "January","February","March","April","May","June",
95
- "July","August","September","October","November","December" ], // Names of months for drop-down and formatting
97
+ monthNames: [ "January", "February", "March", "April", "May", "June",
98
+ "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting
96
99
  monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
97
100
  dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
98
101
  dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
99
- dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday
102
+ dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday
100
103
  weekHeader: "Wk", // Column header for week of the year
101
104
  dateFormat: "mm/dd/yy", // See format options on parseDate
102
105
  firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
103
106
  isRTL: false, // True if right-to-left language, false if left-to-right
104
107
  showMonthAfterYear: false, // True if the year select precedes month, false for month then year
105
- yearSuffix: "" // Additional text to append to the year in the month headers
108
+ yearSuffix: "", // Additional text to append to the year in the month headers,
109
+ selectMonthLabel: "Select month", // Invisible label for month selector
110
+ selectYearLabel: "Select year" // Invisible label for year selector
106
111
  };
107
112
  this._defaults = { // Global defaults for all the date picker instances
108
113
  showOn: "focus", // "focus" for popup on focus,
@@ -143,6 +148,7 @@ function Datepicker() {
143
148
  onSelect: null, // Define a callback function when a date is selected
144
149
  onChangeMonthYear: null, // Define a callback function when the month or year is changed
145
150
  onClose: null, // Define a callback function when the datepicker is closed
151
+ onUpdateDatepicker: null, // Define a callback function when the datepicker is updated
146
152
  numberOfMonths: 1, // Number of months to show at a time
147
153
  showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
148
154
  stepMonths: 1, // Number of months to step back/forward
@@ -161,6 +167,7 @@ function Datepicker() {
161
167
  }
162
168
 
163
169
  $.extend( Datepicker.prototype, {
170
+
164
171
  /* Class name added to elements to indicate already configured with a date picker. */
165
172
  markerClassName: "hasDatepicker",
166
173
 
@@ -243,7 +250,9 @@ $.extend( Datepicker.prototype, {
243
250
  inst.append.remove();
244
251
  }
245
252
  if ( appendText ) {
246
- inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" );
253
+ inst.append = $( "<span>" )
254
+ .addClass( this._appendClass )
255
+ .text( appendText );
247
256
  input[ isRTL ? "before" : "after" ]( inst.append );
248
257
  }
249
258
 
@@ -260,12 +269,32 @@ $.extend( Datepicker.prototype, {
260
269
  if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
261
270
  buttonText = this._get( inst, "buttonText" );
262
271
  buttonImage = this._get( inst, "buttonImage" );
263
- inst.trigger = $( this._get( inst, "buttonImageOnly" ) ?
264
- $( "<img/>" ).addClass( this._triggerClass ).
265
- attr( { src: buttonImage, alt: buttonText, title: buttonText } ) :
266
- $( "<button type='button'></button>" ).addClass( this._triggerClass ).
267
- html( !buttonImage ? buttonText : $( "<img/>" ).attr(
268
- { src:buttonImage, alt:buttonText, title:buttonText } ) ) );
272
+
273
+ if ( this._get( inst, "buttonImageOnly" ) ) {
274
+ inst.trigger = $( "<img>" )
275
+ .addClass( this._triggerClass )
276
+ .attr( {
277
+ src: buttonImage,
278
+ alt: buttonText,
279
+ title: buttonText
280
+ } );
281
+ } else {
282
+ inst.trigger = $( "<button type='button'>" )
283
+ .addClass( this._triggerClass );
284
+ if ( buttonImage ) {
285
+ inst.trigger.html(
286
+ $( "<img>" )
287
+ .attr( {
288
+ src: buttonImage,
289
+ alt: buttonText,
290
+ title: buttonText
291
+ } )
292
+ );
293
+ } else {
294
+ inst.trigger.text( buttonText );
295
+ }
296
+ }
297
+
269
298
  input[ isRTL ? "before" : "after" ]( inst.trigger );
270
299
  inst.trigger.on( "click", function() {
271
300
  if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
@@ -327,7 +356,7 @@ $.extend( Datepicker.prototype, {
327
356
  }
328
357
 
329
358
  // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
330
- // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
359
+ // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
331
360
  inst.dpDiv.css( "display", "block" );
332
361
  },
333
362
 
@@ -411,6 +440,7 @@ $.extend( Datepicker.prototype, {
411
440
 
412
441
  if ( datepicker_instActive === inst ) {
413
442
  datepicker_instActive = null;
443
+ this._curInst = null;
414
444
  }
415
445
  },
416
446
 
@@ -430,7 +460,9 @@ $.extend( Datepicker.prototype, {
430
460
  if ( nodeName === "input" ) {
431
461
  target.disabled = false;
432
462
  inst.trigger.filter( "button" ).
433
- each( function() { this.disabled = false; } ).end().
463
+ each( function() {
464
+ this.disabled = false;
465
+ } ).end().
434
466
  filter( "img" ).css( { opacity: "1.0", cursor: "" } );
435
467
  } else if ( nodeName === "div" || nodeName === "span" ) {
436
468
  inline = $target.children( "." + this._inlineClass );
@@ -439,7 +471,11 @@ $.extend( Datepicker.prototype, {
439
471
  prop( "disabled", false );
440
472
  }
441
473
  this._disabledInputs = $.map( this._disabledInputs,
442
- function( value ) { return ( value === target ? null : value ); } ); // delete entry
474
+
475
+ // Delete entry
476
+ function( value ) {
477
+ return ( value === target ? null : value );
478
+ } );
443
479
  },
444
480
 
445
481
  /* Disable the date picker to a jQuery selection.
@@ -458,7 +494,9 @@ $.extend( Datepicker.prototype, {
458
494
  if ( nodeName === "input" ) {
459
495
  target.disabled = true;
460
496
  inst.trigger.filter( "button" ).
461
- each( function() { this.disabled = true; } ).end().
497
+ each( function() {
498
+ this.disabled = true;
499
+ } ).end().
462
500
  filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
463
501
  } else if ( nodeName === "div" || nodeName === "span" ) {
464
502
  inline = $target.children( "." + this._inlineClass );
@@ -467,7 +505,11 @@ $.extend( Datepicker.prototype, {
467
505
  prop( "disabled", true );
468
506
  }
469
507
  this._disabledInputs = $.map( this._disabledInputs,
470
- function( value ) { return ( value === target ? null : value ); } ); // delete entry
508
+
509
+ // Delete entry
510
+ function( value ) {
511
+ return ( value === target ? null : value );
512
+ } );
471
513
  this._disabledInputs[ this._disabledInputs.length ] = target;
472
514
  },
473
515
 
@@ -495,8 +537,7 @@ $.extend( Datepicker.prototype, {
495
537
  _getInst: function( target ) {
496
538
  try {
497
539
  return $.data( target, "datepicker" );
498
- }
499
- catch ( err ) {
540
+ } catch ( err ) {
500
541
  throw "Missing instance data for this datepicker";
501
542
  }
502
543
  },
@@ -729,8 +770,7 @@ $.extend( Datepicker.prototype, {
729
770
  $.datepicker._updateAlternate( inst );
730
771
  $.datepicker._updateDatepicker( inst );
731
772
  }
732
- }
733
- catch ( err ) {
773
+ } catch ( err ) {
734
774
  }
735
775
  }
736
776
  return true;
@@ -835,7 +875,8 @@ $.extend( Datepicker.prototype, {
835
875
  numMonths = this._getNumberOfMonths( inst ),
836
876
  cols = numMonths[ 1 ],
837
877
  width = 17,
838
- activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
878
+ activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ),
879
+ onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" );
839
880
 
840
881
  if ( activeCell.length > 0 ) {
841
882
  datepicker_handleMouseover.apply( activeCell.get( 0 ) );
@@ -861,11 +902,15 @@ $.extend( Datepicker.prototype, {
861
902
 
862
903
  //assure that inst.yearshtml didn't change.
863
904
  if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
864
- inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml );
905
+ inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml );
865
906
  }
866
907
  origyearshtml = inst.yearshtml = null;
867
908
  }, 0 );
868
909
  }
910
+
911
+ if ( onUpdateDatepicker ) {
912
+ onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] );
913
+ }
869
914
  },
870
915
 
871
916
  // #6694 - don't focus the input if it's already focused
@@ -903,7 +948,7 @@ $.extend( Datepicker.prototype, {
903
948
  inst = this._getInst( obj ),
904
949
  isRTL = this._get( inst, "isRTL" );
905
950
 
906
- while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) {
951
+ while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) {
907
952
  obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
908
953
  }
909
954
 
@@ -991,9 +1036,7 @@ $.extend( Datepicker.prototype, {
991
1036
  if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
992
1037
  return;
993
1038
  }
994
- this._adjustInstDate( inst, offset +
995
- ( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning
996
- period );
1039
+ this._adjustInstDate( inst, offset, period );
997
1040
  this._updateDatepicker( inst );
998
1041
  },
999
1042
 
@@ -1040,7 +1083,7 @@ $.extend( Datepicker.prototype, {
1040
1083
  }
1041
1084
 
1042
1085
  inst = this._getInst( target[ 0 ] );
1043
- inst.selectedDay = inst.currentDay = $( "a", td ).html();
1086
+ inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) );
1044
1087
  inst.selectedMonth = inst.currentMonth = month;
1045
1088
  inst.selectedYear = inst.currentYear = year;
1046
1089
  this._selectDate( id, this._formatDate( inst,
@@ -1093,7 +1136,7 @@ $.extend( Datepicker.prototype, {
1093
1136
  altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
1094
1137
  date = this._getDate( inst );
1095
1138
  dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
1096
- $( altField ).val( dateStr );
1139
+ $( document ).find( altField ).val( dateStr );
1097
1140
  }
1098
1141
  },
1099
1142
 
@@ -1532,8 +1575,7 @@ $.extend( Datepicker.prototype, {
1532
1575
  try {
1533
1576
  return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
1534
1577
  offset, $.datepicker._getFormatConfig( inst ) );
1535
- }
1536
- catch ( e ) {
1578
+ } catch ( e ) {
1537
1579
 
1538
1580
  // Ignore
1539
1581
  }
@@ -1707,32 +1749,104 @@ $.extend( Datepicker.prototype, {
1707
1749
  this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
1708
1750
  this._getFormatConfig( inst ) ) );
1709
1751
 
1710
- prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ?
1711
- "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
1712
- " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" :
1713
- ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) );
1752
+ if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) {
1753
+ prev = $( "<a>" )
1754
+ .attr( {
1755
+ "class": "ui-datepicker-prev ui-corner-all",
1756
+ "data-handler": "prev",
1757
+ "data-event": "click",
1758
+ title: prevText
1759
+ } )
1760
+ .append(
1761
+ $( "<span>" )
1762
+ .addClass( "ui-icon ui-icon-circle-triangle-" +
1763
+ ( isRTL ? "e" : "w" ) )
1764
+ .text( prevText )
1765
+ )[ 0 ].outerHTML;
1766
+ } else if ( hideIfNoPrevNext ) {
1767
+ prev = "";
1768
+ } else {
1769
+ prev = $( "<a>" )
1770
+ .attr( {
1771
+ "class": "ui-datepicker-prev ui-corner-all ui-state-disabled",
1772
+ title: prevText
1773
+ } )
1774
+ .append(
1775
+ $( "<span>" )
1776
+ .addClass( "ui-icon ui-icon-circle-triangle-" +
1777
+ ( isRTL ? "e" : "w" ) )
1778
+ .text( prevText )
1779
+ )[ 0 ].outerHTML;
1780
+ }
1714
1781
 
1715
1782
  nextText = this._get( inst, "nextText" );
1716
1783
  nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
1717
1784
  this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
1718
1785
  this._getFormatConfig( inst ) ) );
1719
1786
 
1720
- next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ?
1721
- "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
1722
- " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" :
1723
- ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) );
1787
+ if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) {
1788
+ next = $( "<a>" )
1789
+ .attr( {
1790
+ "class": "ui-datepicker-next ui-corner-all",
1791
+ "data-handler": "next",
1792
+ "data-event": "click",
1793
+ title: nextText
1794
+ } )
1795
+ .append(
1796
+ $( "<span>" )
1797
+ .addClass( "ui-icon ui-icon-circle-triangle-" +
1798
+ ( isRTL ? "w" : "e" ) )
1799
+ .text( nextText )
1800
+ )[ 0 ].outerHTML;
1801
+ } else if ( hideIfNoPrevNext ) {
1802
+ next = "";
1803
+ } else {
1804
+ next = $( "<a>" )
1805
+ .attr( {
1806
+ "class": "ui-datepicker-next ui-corner-all ui-state-disabled",
1807
+ title: nextText
1808
+ } )
1809
+ .append(
1810
+ $( "<span>" )
1811
+ .attr( "class", "ui-icon ui-icon-circle-triangle-" +
1812
+ ( isRTL ? "w" : "e" ) )
1813
+ .text( nextText )
1814
+ )[ 0 ].outerHTML;
1815
+ }
1724
1816
 
1725
1817
  currentText = this._get( inst, "currentText" );
1726
1818
  gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
1727
1819
  currentText = ( !navigationAsDateFormat ? currentText :
1728
1820
  this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
1729
1821
 
1730
- controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
1731
- this._get( inst, "closeText" ) + "</button>" : "" );
1732
-
1733
- buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) +
1734
- ( this._isInRange( inst, gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
1735
- ">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : "";
1822
+ controls = "";
1823
+ if ( !inst.inline ) {
1824
+ controls = $( "<button>" )
1825
+ .attr( {
1826
+ type: "button",
1827
+ "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all",
1828
+ "data-handler": "hide",
1829
+ "data-event": "click"
1830
+ } )
1831
+ .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML;
1832
+ }
1833
+
1834
+ buttonPanel = "";
1835
+ if ( showButtonPanel ) {
1836
+ buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" )
1837
+ .append( isRTL ? controls : "" )
1838
+ .append( this._isInRange( inst, gotoDate ) ?
1839
+ $( "<button>" )
1840
+ .attr( {
1841
+ type: "button",
1842
+ "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all",
1843
+ "data-handler": "today",
1844
+ "data-event": "click"
1845
+ } )
1846
+ .text( currentText ) :
1847
+ "" )
1848
+ .append( isRTL ? "" : controls )[ 0 ].outerHTML;
1849
+ }
1736
1850
 
1737
1851
  firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
1738
1852
  firstDay = ( isNaN( firstDay ) ? 0 : firstDay );
@@ -1820,7 +1934,9 @@ $.extend( Datepicker.prototype, {
1820
1934
  ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
1821
1935
  ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
1822
1936
  ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
1823
- "' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
1937
+ "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader
1938
+ "' data-date='" + printDate.getDate() + // store date as data
1939
+ "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
1824
1940
  printDate.setDate( printDate.getDate() + 1 );
1825
1941
  printDate = this._daylightSavingAdjust( printDate );
1826
1942
  }
@@ -1850,6 +1966,8 @@ $.extend( Datepicker.prototype, {
1850
1966
  changeMonth = this._get( inst, "changeMonth" ),
1851
1967
  changeYear = this._get( inst, "changeYear" ),
1852
1968
  showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
1969
+ selectMonthLabel = this._get( inst, "selectMonthLabel" ),
1970
+ selectYearLabel = this._get( inst, "selectYearLabel" ),
1853
1971
  html = "<div class='ui-datepicker-title'>",
1854
1972
  monthHtml = "";
1855
1973
 
@@ -1859,7 +1977,7 @@ $.extend( Datepicker.prototype, {
1859
1977
  } else {
1860
1978
  inMinYear = ( minDate && minDate.getFullYear() === drawYear );
1861
1979
  inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
1862
- monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
1980
+ monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>";
1863
1981
  for ( month = 0; month < 12; month++ ) {
1864
1982
  if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
1865
1983
  monthHtml += "<option value='" + month + "'" +
@@ -1894,7 +2012,7 @@ $.extend( Datepicker.prototype, {
1894
2012
  endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
1895
2013
  year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
1896
2014
  endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
1897
- inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
2015
+ inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>";
1898
2016
  for ( ; year <= endYear; year++ ) {
1899
2017
  inst.yearshtml += "<option value='" + year + "'" +
1900
2018
  ( year === drawYear ? " selected='selected'" : "" ) +
@@ -2106,18 +2224,20 @@ $.fn.datepicker = function( options ) {
2106
2224
  apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
2107
2225
  }
2108
2226
  return this.each( function() {
2109
- typeof options === "string" ?
2110
- $.datepicker[ "_" + options + "Datepicker" ].
2111
- apply( $.datepicker, [ this ].concat( otherArgs ) ) :
2227
+ if ( typeof options === "string" ) {
2228
+ $.datepicker[ "_" + options + "Datepicker" ]
2229
+ .apply( $.datepicker, [ this ].concat( otherArgs ) );
2230
+ } else {
2112
2231
  $.datepicker._attachDatepicker( this, options );
2232
+ }
2113
2233
  } );
2114
2234
  };
2115
2235
 
2116
2236
  $.datepicker = new Datepicker(); // singleton instance
2117
2237
  $.datepicker.initialized = false;
2118
2238
  $.datepicker.uuid = new Date().getTime();
2119
- $.datepicker.version = "1.12.1";
2239
+ $.datepicker.version = "1.13.3";
2120
2240
 
2121
2241
  return $.datepicker;
2122
2242
 
2123
- } ) );
2243
+ } );
@@ -13,24 +13,26 @@
13
13
  //= require jquery-ui/widget
14
14
 
15
15
  /*!
16
- * jQuery UI Dialog 1.12.1
17
- * http://jqueryui.com
16
+ * jQuery UI Dialog 1.13.3
17
+ * https://jqueryui.com
18
18
  *
19
- * Copyright jQuery Foundation and other contributors
19
+ * Copyright OpenJS Foundation and other contributors
20
20
  * Released under the MIT license.
21
- * http://jquery.org/license
21
+ * https://jquery.org/license
22
22
  */
23
23
 
24
24
  //>>label: Dialog
25
25
  //>>group: Widgets
26
26
  //>>description: Displays customizable dialog windows.
27
- //>>docs: http://api.jqueryui.com/dialog/
28
- //>>demos: http://jqueryui.com/dialog/
27
+ //>>docs: https://api.jqueryui.com/dialog/
28
+ //>>demos: https://jqueryui.com/dialog/
29
29
  //>>css.structure: ../../themes/base/core.css
30
30
  //>>css.structure: ../../themes/base/dialog.css
31
31
  //>>css.theme: ../../themes/base/theme.css
32
32
 
33
33
  ( function( factory ) {
34
+ "use strict";
35
+
34
36
  if ( typeof define === "function" && define.amd ) {
35
37
 
36
38
  // AMD. Register as an anonymous module.
@@ -55,10 +57,11 @@
55
57
  // Browser globals
56
58
  factory( jQuery );
57
59
  }
58
- }( function( $ ) {
60
+ } )( function( $ ) {
61
+ "use strict";
59
62
 
60
63
  $.widget( "ui.dialog", {
61
- version: "1.12.1",
64
+ version: "1.13.3",
62
65
  options: {
63
66
  appendTo: "body",
64
67
  autoOpen: true,
@@ -303,7 +306,7 @@ $.widget( "ui.dialog", {
303
306
  that._trigger( "focus" );
304
307
  } );
305
308
 
306
- // Track the dialog immediately upon openening in case a focus event
309
+ // Track the dialog immediately upon opening in case a focus event
307
310
  // somehow occurs outside of the dialog before an element inside the
308
311
  // dialog is focused (#10152)
309
312
  this._makeFocusTarget();
@@ -339,22 +342,23 @@ $.widget( "ui.dialog", {
339
342
  hasFocus.eq( 0 ).trigger( "focus" );
340
343
  },
341
344
 
342
- _keepFocus: function( event ) {
343
- function checkFocus() {
344
- var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
345
- isActive = this.uiDialog[ 0 ] === activeElement ||
346
- $.contains( this.uiDialog[ 0 ], activeElement );
347
- if ( !isActive ) {
348
- this._focusTabbable();
349
- }
345
+ _restoreTabbableFocus: function() {
346
+ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
347
+ isActive = this.uiDialog[ 0 ] === activeElement ||
348
+ $.contains( this.uiDialog[ 0 ], activeElement );
349
+ if ( !isActive ) {
350
+ this._focusTabbable();
350
351
  }
352
+ },
353
+
354
+ _keepFocus: function( event ) {
351
355
  event.preventDefault();
352
- checkFocus.call( this );
356
+ this._restoreTabbableFocus();
353
357
 
354
358
  // support: IE
355
359
  // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
356
360
  // so we check again later
357
- this._delay( checkFocus );
361
+ this._delay( this._restoreTabbableFocus );
358
362
  },
359
363
 
360
364
  _createWrapper: function() {
@@ -383,8 +387,8 @@ $.widget( "ui.dialog", {
383
387
  return;
384
388
  }
385
389
  var tabbables = this.uiDialog.find( ":tabbable" ),
386
- first = tabbables.filter( ":first" ),
387
- last = tabbables.filter( ":last" );
390
+ first = tabbables.first(),
391
+ last = tabbables.last();
388
392
 
389
393
  if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
390
394
  !event.shiftKey ) {
@@ -495,14 +499,14 @@ $.widget( "ui.dialog", {
495
499
  this.uiDialogButtonPane.remove();
496
500
  this.uiButtonSet.empty();
497
501
 
498
- if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
502
+ if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) {
499
503
  this._removeClass( this.uiDialog, "ui-dialog-buttons" );
500
504
  return;
501
505
  }
502
506
 
503
507
  $.each( buttons, function( name, props ) {
504
508
  var click, buttonOptions;
505
- props = $.isFunction( props ) ?
509
+ props = typeof props === "function" ?
506
510
  { click: props, text: name } :
507
511
  props;
508
512
 
@@ -867,6 +871,8 @@ $.widget( "ui.dialog", {
867
871
  return;
868
872
  }
869
873
 
874
+ var jqMinor = $.fn.jquery.substring( 0, 4 );
875
+
870
876
  // We use a delay in case the overlay is created from an
871
877
  // event that we're going to be cancelling (#2804)
872
878
  var isOpening = true;
@@ -877,20 +883,31 @@ $.widget( "ui.dialog", {
877
883
  if ( !this.document.data( "ui-dialog-overlays" ) ) {
878
884
 
879
885
  // Prevent use of anchors and inputs
880
- // Using _on() for an event handler shared across many instances is
881
- // safe because the dialogs stack and must be closed in reverse order
882
- this._on( this.document, {
883
- focusin: function( event ) {
884
- if ( isOpening ) {
885
- return;
886
- }
886
+ // This doesn't use `_on()` because it is a shared event handler
887
+ // across all open modal dialogs.
888
+ this.document.on( "focusin.ui-dialog", function( event ) {
889
+ if ( isOpening ) {
890
+ return;
891
+ }
887
892
 
888
- if ( !this._allowInteraction( event ) ) {
889
- event.preventDefault();
890
- this._trackingInstances()[ 0 ]._focusTabbable();
893
+ var instance = this._trackingInstances()[ 0 ];
894
+ if ( !instance._allowInteraction( event ) ) {
895
+ event.preventDefault();
896
+ instance._focusTabbable();
897
+
898
+ // Support: jQuery >=3.4 <3.7 only
899
+ // In jQuery 3.4-3.6, there are multiple issues with focus/blur
900
+ // trigger chains or when triggering is done on a hidden element
901
+ // at least once.
902
+ // Trigger focus in a delay in addition if needed to avoid the issues.
903
+ // See https://github.com/jquery/jquery/issues/4382
904
+ // See https://github.com/jquery/jquery/issues/4856
905
+ // See https://github.com/jquery/jquery/issues/4950
906
+ if ( jqMinor === "3.4." || jqMinor === "3.5." || jqMinor === "3.6." ) {
907
+ instance._delay( instance._restoreTabbableFocus );
891
908
  }
892
909
  }
893
- } );
910
+ }.bind( this ) );
894
911
  }
895
912
 
896
913
  this.overlay = $( "<div>" )
@@ -913,7 +930,7 @@ $.widget( "ui.dialog", {
913
930
  var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
914
931
 
915
932
  if ( !overlays ) {
916
- this._off( this.document, "focusin" );
933
+ this.document.off( "focusin.ui-dialog" );
917
934
  this.document.removeData( "ui-dialog-overlays" );
918
935
  } else {
919
936
  this.document.data( "ui-dialog-overlays", overlays );
@@ -951,4 +968,4 @@ if ( $.uiBackCompat !== false ) {
951
968
 
952
969
  return $.ui.dialog;
953
970
 
954
- } ) );
971
+ } );