diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/js/jquery/ui/datepicker.js --- a/wp/wp-includes/js/jquery/ui/datepicker.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/js/jquery/ui/datepicker.js Tue Sep 27 16:37:53 2022 +0200 @@ -1,7 +1,6 @@ -// jscs:disable maximumLineLength -/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ +/* eslint-disable max-len, camelcase */ /*! - * jQuery UI Datepicker 1.12.1 + * jQuery UI Datepicker 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -19,6 +18,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -31,9 +32,10 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; -$.extend( $.ui, { datepicker: { version: "1.12.1" } } ); +$.extend( $.ui, { datepicker: { version: "1.13.1" } } ); var datepicker_instActive; @@ -61,6 +63,7 @@ return 0; } + /* Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, @@ -87,58 +90,61 @@ prevText: "Prev", // Display text for previous month link nextText: "Next", // Display text for next month link currentText: "Today", // Display text for current month link - monthNames: [ "January","February","March","April","May","June", - "July","August","September","October","November","December" ], // Names of months for drop-down and formatting + monthNames: [ "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting - dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday + dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday weekHeader: "Wk", // Column header for week of the year dateFormat: "mm/dd/yy", // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... isRTL: false, // True if right-to-left language, false if left-to-right showMonthAfterYear: false, // True if the year select precedes month, false for month then year - yearSuffix: "" // Additional text to append to the year in the month headers + yearSuffix: "", // Additional text to append to the year in the month headers, + selectMonthLabel: "Select month", // Invisible label for month selector + selectYearLabel: "Select year" // Invisible label for year selector }; this._defaults = { // Global defaults for all the date picker instances showOn: "focus", // "focus" for popup on focus, - // "button" for trigger button, or "both" for either + // "button" for trigger button, or "both" for either showAnim: "fadeIn", // Name of jQuery animation for popup showOptions: {}, // Options for enhanced animations defaultDate: null, // Used when field is blank: actual date, - // +/-number for offset from today, null for today + // +/-number for offset from today, null for today appendText: "", // Display text following the input box, e.g. showing the format buttonText: "...", // Text for trigger button buttonImage: "", // URL for trigger button image buttonImageOnly: false, // True if the image appears alone, false if it appears on a button hideIfNoPrevNext: false, // True to hide next/previous month links - // if not applicable, false to just disable them + // if not applicable, false to just disable them navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links gotoCurrent: false, // True if today link goes back to current selection instead changeMonth: false, // True if month can be selected directly, false if only prev/next changeYear: false, // True if year can be selected directly, false if only prev/next yearRange: "c-10:c+10", // Range of years to display in drop-down, - // either relative to today's year (-nn:+nn), relative to currently displayed year - // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) + // either relative to today's year (-nn:+nn), relative to currently displayed year + // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) showOtherMonths: false, // True to show dates in other months, false to leave blank selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable showWeek: false, // True to show week of the year, false to not show it calculateWeek: this.iso8601Week, // How to calculate the week of the year, - // takes a Date and returns the number of the week for it + // takes a Date and returns the number of the week for it shortYearCutoff: "+10", // Short year values < this are in the current century, - // > this are in the previous century, - // string value starting with "+" for current year + value + // > this are in the previous century, + // string value starting with "+" for current year + value minDate: null, // The earliest selectable date, or null for no limit maxDate: null, // The latest selectable date, or null for no limit duration: "fast", // Duration of display/closure beforeShowDay: null, // Function that takes a date and returns an array with - // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", - // [2] = cell title (optional), e.g. $.datepicker.noWeekends + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", + // [2] = cell title (optional), e.g. $.datepicker.noWeekends beforeShow: null, // Function that takes an input field and - // returns a set of custom settings for the date picker + // returns a set of custom settings for the date picker onSelect: null, // Define a callback function when a date is selected onChangeMonthYear: null, // Define a callback function when the month or year is changed onClose: null, // Define a callback function when the datepicker is closed + onUpdateDatepicker: null, // Define a callback function when the datepicker is updated numberOfMonths: 1, // Number of months to show at a time showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) stepMonths: 1, // Number of months to step back/forward @@ -157,6 +163,7 @@ } $.extend( Datepicker.prototype, { + /* Class name added to elements to indicate already configured with a date picker. */ markerClassName: "hasDatepicker", @@ -206,7 +213,7 @@ drawMonth: 0, drawYear: 0, // month being drawn inline: inline, // is datepicker inline or not dpDiv: ( !inline ? this.dpDiv : // presentation div - datepicker_bindHover( $( "
" ) ) ) }; + datepicker_bindHover( $( "
" ) ) ) }; }, /* Attach the date picker to an input field. */ @@ -219,7 +226,7 @@ } this._attachments( input, inst ); input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). - on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); + on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); this._autoSize( inst ); $.data( target, "datepicker", inst ); @@ -239,7 +246,9 @@ inst.append.remove(); } if ( appendText ) { - inst.append = $( "" + appendText + "" ); + inst.append = $( "" ) + .addClass( this._appendClass ) + .text( appendText ); input[ isRTL ? "before" : "after" ]( inst.append ); } @@ -256,12 +265,32 @@ if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked buttonText = this._get( inst, "buttonText" ); buttonImage = this._get( inst, "buttonImage" ); - inst.trigger = $( this._get( inst, "buttonImageOnly" ) ? - $( "" ).addClass( this._triggerClass ). - attr( { src: buttonImage, alt: buttonText, title: buttonText } ) : - $( "" ).addClass( this._triggerClass ). - html( !buttonImage ? buttonText : $( "" ).attr( - { src:buttonImage, alt:buttonText, title:buttonText } ) ) ); + + if ( this._get( inst, "buttonImageOnly" ) ) { + inst.trigger = $( "" ) + .addClass( this._triggerClass ) + .attr( { + src: buttonImage, + alt: buttonText, + title: buttonText + } ); + } else { + inst.trigger = $( "" : "" ); + controls = ""; + if ( !inst.inline ) { + controls = $( "" : "" ) + ( isRTL ? "" : controls ) + "" : ""; + buttonPanel = ""; + if ( showButtonPanel ) { + buttonPanel = $( "
" ) + .append( isRTL ? controls : "" ) + .append( this._isInRange( inst, gotoDate ) ? + $( "
" + ""; thead = ( showWeek ? "" : "" ); @@ -1803,20 +1917,22 @@ ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? - // or defaultDate is current printedDate and defaultDate is selectedDate - " " + this._dayOverClass : "" ) + // highlight selected day + // or defaultDate is current printedDate and defaultDate is selectedDate + " " + this._dayOverClass : "" ) + // highlight selected day ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates - ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day - ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) + ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day + ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions ( otherMonth && !showOtherMonths ? " " : // display for other months - ( unselectable ? "" + printDate.getDate() + "" : "" + printDate.getDate() + "" ) ) + ""; // display selectable date + ( unselectable ? "" + printDate.getDate() + "" : "" + printDate.getDate() + "" ) ) + ""; // display selectable date printDate.setDate( printDate.getDate() + 1 ); printDate = this._daylightSavingAdjust( printDate ); } @@ -1828,7 +1944,7 @@ drawYear++; } calender += "
" + this._get( inst, "weekHeader" ) + "
" + ( isMultiMonth ? "" + - ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "
" : "" ) : "" ); + ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "
" : "" ) : "" ); group += calender; } html += group; @@ -1840,12 +1956,14 @@ /* Generate the month and year header. */ _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort ) { + secondary, monthNames, monthNamesShort ) { var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, changeMonth = this._get( inst, "changeMonth" ), changeYear = this._get( inst, "changeYear" ), showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), + selectMonthLabel = this._get( inst, "selectMonthLabel" ), + selectYearLabel = this._get( inst, "selectYearLabel" ), html = "
", monthHtml = ""; @@ -1855,7 +1973,7 @@ } else { inMinYear = ( minDate && minDate.getFullYear() === drawYear ); inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); - monthHtml += ""; for ( month = 0; month < 12; month++ ) { if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { monthHtml += "