diff --git a/Rakefile b/Rakefile index 25cf3f967a..8f779848f6 100644 --- a/Rakefile +++ b/Rakefile @@ -34,4 +34,14 @@ namespace :vendorize do locales = Dir.glob('node_modules/flatpickr/dist/l10n/*.js').map { |f| File.read(f) } File.write('vendor/assets/javascripts/rails_admin/flatpickr-with-locales.js', ([flatpickr] + locales).join("\n")) end + + task :jquery_ui do + Dir.chdir(__dir__) + Dir.glob('vendor/assets/javascripts/rails_admin/jquery-ui/**/*.js').each do |dest| + src = dest.sub(%r{vendor/assets/javascripts/rails_admin/jquery-ui/}, 'node_modules/jquery-ui/ui/') + FileUtils.cp(src, dest) + rescue Errno::ENOENT + warn "File #{src} doesn't exist, skipping" + end + end end diff --git a/spec/dummy_app/config/importmap.rails_admin.rb b/spec/dummy_app/config/importmap.rails_admin.rb index 7b1a8a1cf1..4607085be7 100644 --- a/spec/dummy_app/config/importmap.rails_admin.rb +++ b/spec/dummy_app/config/importmap.rails_admin.rb @@ -14,6 +14,6 @@ pin 'bootstrap', to: 'https://ga.jspm.io/npm:bootstrap@5.1.3/dist/js/bootstrap.esm.js' pin 'flatpickr', to: 'https://ga.jspm.io/npm:flatpickr@4.6.13/dist/flatpickr.js' pin 'flatpickr/', to: 'https://ga.jspm.io/npm:flatpickr@4.6.13/' -pin 'jquery', to: 'https://ga.jspm.io/npm:jquery@3.6.0/dist/jquery.js' -pin 'jquery-ui/', to: 'https://ga.jspm.io/npm:jquery-ui@1.13.1/' +pin 'jquery', to: 'https://ga.jspm.io/npm:jquery@3.7.1/dist/jquery.js' +pin 'jquery-ui/', to: 'https://ga.jspm.io/npm:jquery-ui@1.14.0/' pin 'trix', to: 'https://ga.jspm.io/npm:trix@2.0.0-beta.0/dist/trix.js' diff --git a/spec/dummy_app/package.json b/spec/dummy_app/package.json index c343a5f364..c320ba228e 100644 --- a/spec/dummy_app/package.json +++ b/spec/dummy_app/package.json @@ -8,7 +8,7 @@ "@rails/actiontext": "^7.0.3-1", "@rails/activestorage": "^7.0.3-1", "@rails/webpacker": "5.4.3", - "rails_admin": "file:../../", + "rails_admin": "file:../..", "trix": "^2.0.0-beta.0", "webpack": "^4.46.0", "webpack-cli": "^3.3.12" diff --git a/src/rails_admin/base.js b/src/rails_admin/base.js index 8e2685bab5..bd9756d316 100644 --- a/src/rails_admin/base.js +++ b/src/rails_admin/base.js @@ -8,15 +8,21 @@ import "bootstrap"; import "jquery-ui/ui/version.js"; import "jquery-ui/ui/keycode.js"; import "jquery-ui/ui/position.js"; -import "jquery-ui/ui/safe-active-element.js"; import "jquery-ui/ui/data.js"; -import "jquery-ui/ui/ie.js"; import "jquery-ui/ui/scroll-parent.js"; import "jquery-ui/ui/unique-id.js"; import "jquery-ui/ui/widget.js"; import "jquery-ui/ui/widgets/menu.js"; import "jquery-ui/ui/widgets/mouse.js"; +// For compatibility with jQuery UI < 1.14 +console.log(window.$.ui.safeActiveElement); +if (window.$.ui.safeActiveElement === undefined) { + window.$.ui.safeActiveElement = function (document) { + return document.activeElement; + }; +} + import "./abstract-select"; import "./filter-box"; import "./filtering-multiselect"; diff --git a/vendor/assets/javascripts/rails_admin/jquery-ui/data.js b/vendor/assets/javascripts/rails_admin/jquery-ui/data.js index 8f26a44a13..a00f096da8 100644 --- a/vendor/assets/javascripts/rails_admin/jquery-ui/data.js +++ b/vendor/assets/javascripts/rails_admin/jquery-ui/data.js @@ -1,20 +1,20 @@ -//= require rails_admin/jquery-ui/version - /*! - * jQuery UI :data 1.12.1 - * http://jqueryui.com + * jQuery UI :data 1.14.0 + * https://jqueryui.com * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. - * http://jquery.org/license + * https://jquery.org/license */ //>>label: :data Selector //>>group: Core //>>description: Selects elements which have data stored under the specified key. -//>>docs: http://api.jqueryui.com/data-selector/ +//>>docs: https://api.jqueryui.com/data-selector/ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -24,18 +24,14 @@ // Browser globals factory( jQuery ); } -} ( function( $ ) { -return $.extend( $.expr[ ":" ], { - data: $.expr.createPseudo ? - $.expr.createPseudo( function( dataName ) { - return function( elem ) { - return !!$.data( elem, dataName ); - }; - } ) : +} )( function( $ ) { +"use strict"; - // Support: jQuery <1.8 - function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - } +return $.extend( $.expr.pseudos, { + data: $.expr.createPseudo( function( dataName ) { + return function( elem ) { + return !!$.data( elem, dataName ); + }; + } ) +} ); } ); -} ) ); diff --git a/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js b/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js index 3f28df2cd3..6472341224 100644 --- a/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js +++ b/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js @@ -1,723 +1,48 @@ -//= require rails_admin/jquery-ui/version - /*! - * jQuery UI Effects 1.12.1 - * http://jqueryui.com + * jQuery UI Effects 1.14.0 + * https://jqueryui.com * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. - * http://jquery.org/license + * https://jquery.org/license */ //>>label: Effects Core //>>group: Effects -// jscs:disable maximumLineLength +/* eslint-disable max-len */ //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. -// jscs:enable maximumLineLength -//>>docs: http://api.jqueryui.com/category/effects-core/ -//>>demos: http://jqueryui.com/effect/ +/* eslint-enable max-len */ +//>>docs: https://api.jqueryui.com/category/effects-core/ +//>>demos: https://jqueryui.com/effect/ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define( [ "jquery", "./version" ], factory ); + define( [ + "jquery", + "./jquery-var-for-color", + "./vendor/jquery-color/jquery.color", + "./version" + ], factory ); } else { // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; var dataSpace = "ui-effects-", dataSpaceStyle = "ui-effects-style", - dataSpaceAnimated = "ui-effects-animated", - - // Create a local jQuery because jQuery Color relies on it and the - // global may not exist with AMD and a custom build (#10199) - jQuery = $; + dataSpaceAnimated = "ui-effects-animated"; $.effects = { effect: {} }; -/*! - * jQuery Color Animations v2.1.2 - * https://github.com/jquery/jquery-color - * - * Copyright 2014 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * Date: Wed Jan 16 08:47:09 2013 -0600 - */ -( function( jQuery, undefined ) { - - var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + - "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", - - // Plusequals test for += 100 -= 100 - rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, - - // A set of RE's that can match strings and generate color tuples. - stringParsers = [ { - re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, - parse: function( execResult ) { - return [ - execResult[ 1 ], - execResult[ 2 ], - execResult[ 3 ], - execResult[ 4 ] - ]; - } - }, { - re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, - parse: function( execResult ) { - return [ - execResult[ 1 ] * 2.55, - execResult[ 2 ] * 2.55, - execResult[ 3 ] * 2.55, - execResult[ 4 ] - ]; - } - }, { - - // This regex ignores A-F because it's compared against an already lowercased string - re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, - parse: function( execResult ) { - return [ - parseInt( execResult[ 1 ], 16 ), - parseInt( execResult[ 2 ], 16 ), - parseInt( execResult[ 3 ], 16 ) - ]; - } - }, { - - // This regex ignores A-F because it's compared against an already lowercased string - re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, - parse: function( execResult ) { - return [ - parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), - parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), - parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) - ]; - } - }, { - re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, - space: "hsla", - parse: function( execResult ) { - return [ - execResult[ 1 ], - execResult[ 2 ] / 100, - execResult[ 3 ] / 100, - execResult[ 4 ] - ]; - } - } ], - - // JQuery.Color( ) - color = jQuery.Color = function( color, green, blue, alpha ) { - return new jQuery.Color.fn.parse( color, green, blue, alpha ); - }, - spaces = { - rgba: { - props: { - red: { - idx: 0, - type: "byte" - }, - green: { - idx: 1, - type: "byte" - }, - blue: { - idx: 2, - type: "byte" - } - } - }, - - hsla: { - props: { - hue: { - idx: 0, - type: "degrees" - }, - saturation: { - idx: 1, - type: "percent" - }, - lightness: { - idx: 2, - type: "percent" - } - } - } - }, - propTypes = { - "byte": { - floor: true, - max: 255 - }, - "percent": { - max: 1 - }, - "degrees": { - mod: 360, - floor: true - } - }, - support = color.support = {}, - - // Element for support tests - supportElem = jQuery( "

" )[ 0 ], - - // Colors = jQuery.Color.names - colors, - - // Local aliases of functions called often - each = jQuery.each; - -// Determine rgba support immediately -supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; -support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; - -// Define cache name and alpha properties -// for rgba and hsla spaces -each( spaces, function( spaceName, space ) { - space.cache = "_" + spaceName; - space.props.alpha = { - idx: 3, - type: "percent", - def: 1 - }; -} ); - -function clamp( value, prop, allowEmpty ) { - var type = propTypes[ prop.type ] || {}; - - if ( value == null ) { - return ( allowEmpty || !prop.def ) ? null : prop.def; - } - - // ~~ is an short way of doing floor for positive numbers - value = type.floor ? ~~value : parseFloat( value ); - - // IE will pass in empty strings as value for alpha, - // which will hit this case - if ( isNaN( value ) ) { - return prop.def; - } - - if ( type.mod ) { - - // We add mod before modding to make sure that negatives values - // get converted properly: -10 -> 350 - return ( value + type.mod ) % type.mod; - } - - // For now all property types without mod have min and max - return 0 > value ? 0 : type.max < value ? type.max : value; -} - -function stringParse( string ) { - var inst = color(), - rgba = inst._rgba = []; - - string = string.toLowerCase(); - - each( stringParsers, function( i, parser ) { - var parsed, - match = parser.re.exec( string ), - values = match && parser.parse( match ), - spaceName = parser.space || "rgba"; - - if ( values ) { - parsed = inst[ spaceName ]( values ); - - // If this was an rgba parse the assignment might happen twice - // oh well.... - inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; - rgba = inst._rgba = parsed._rgba; - - // Exit each( stringParsers ) here because we matched - return false; - } - } ); - - // Found a stringParser that handled it - if ( rgba.length ) { - - // If this came from a parsed string, force "transparent" when alpha is 0 - // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) - if ( rgba.join() === "0,0,0,0" ) { - jQuery.extend( rgba, colors.transparent ); - } - return inst; - } - - // Named colors - return colors[ string ]; -} - -color.fn = jQuery.extend( color.prototype, { - parse: function( red, green, blue, alpha ) { - if ( red === undefined ) { - this._rgba = [ null, null, null, null ]; - return this; - } - if ( red.jquery || red.nodeType ) { - red = jQuery( red ).css( green ); - green = undefined; - } - - var inst = this, - type = jQuery.type( red ), - rgba = this._rgba = []; - - // More than 1 argument specified - assume ( red, green, blue, alpha ) - if ( green !== undefined ) { - red = [ red, green, blue, alpha ]; - type = "array"; - } - - if ( type === "string" ) { - return this.parse( stringParse( red ) || colors._default ); - } - - if ( type === "array" ) { - each( spaces.rgba.props, function( key, prop ) { - rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); - } ); - return this; - } - - if ( type === "object" ) { - if ( red instanceof color ) { - each( spaces, function( spaceName, space ) { - if ( red[ space.cache ] ) { - inst[ space.cache ] = red[ space.cache ].slice(); - } - } ); - } else { - each( spaces, function( spaceName, space ) { - var cache = space.cache; - each( space.props, function( key, prop ) { - - // If the cache doesn't exist, and we know how to convert - if ( !inst[ cache ] && space.to ) { - - // If the value was null, we don't need to copy it - // if the key was alpha, we don't need to copy it either - if ( key === "alpha" || red[ key ] == null ) { - return; - } - inst[ cache ] = space.to( inst._rgba ); - } - - // This is the only case where we allow nulls for ALL properties. - // call clamp with alwaysAllowEmpty - inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); - } ); - - // Everything defined but alpha? - if ( inst[ cache ] && - jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { - - // Use the default of 1 - inst[ cache ][ 3 ] = 1; - if ( space.from ) { - inst._rgba = space.from( inst[ cache ] ); - } - } - } ); - } - return this; - } - }, - is: function( compare ) { - var is = color( compare ), - same = true, - inst = this; - - each( spaces, function( _, space ) { - var localCache, - isCache = is[ space.cache ]; - if ( isCache ) { - localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; - each( space.props, function( _, prop ) { - if ( isCache[ prop.idx ] != null ) { - same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); - return same; - } - } ); - } - return same; - } ); - return same; - }, - _space: function() { - var used = [], - inst = this; - each( spaces, function( spaceName, space ) { - if ( inst[ space.cache ] ) { - used.push( spaceName ); - } - } ); - return used.pop(); - }, - transition: function( other, distance ) { - var end = color( other ), - spaceName = end._space(), - space = spaces[ spaceName ], - startColor = this.alpha() === 0 ? color( "transparent" ) : this, - start = startColor[ space.cache ] || space.to( startColor._rgba ), - result = start.slice(); - - end = end[ space.cache ]; - each( space.props, function( key, prop ) { - var index = prop.idx, - startValue = start[ index ], - endValue = end[ index ], - type = propTypes[ prop.type ] || {}; - - // If null, don't override start value - if ( endValue === null ) { - return; - } - - // If null - use end - if ( startValue === null ) { - result[ index ] = endValue; - } else { - if ( type.mod ) { - if ( endValue - startValue > type.mod / 2 ) { - startValue += type.mod; - } else if ( startValue - endValue > type.mod / 2 ) { - startValue -= type.mod; - } - } - result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); - } - } ); - return this[ spaceName ]( result ); - }, - blend: function( opaque ) { - - // If we are already opaque - return ourself - if ( this._rgba[ 3 ] === 1 ) { - return this; - } - - var rgb = this._rgba.slice(), - a = rgb.pop(), - blend = color( opaque )._rgba; - - return color( jQuery.map( rgb, function( v, i ) { - return ( 1 - a ) * blend[ i ] + a * v; - } ) ); - }, - toRgbaString: function() { - var prefix = "rgba(", - rgba = jQuery.map( this._rgba, function( v, i ) { - return v == null ? ( i > 2 ? 1 : 0 ) : v; - } ); - - if ( rgba[ 3 ] === 1 ) { - rgba.pop(); - prefix = "rgb("; - } - - return prefix + rgba.join() + ")"; - }, - toHslaString: function() { - var prefix = "hsla(", - hsla = jQuery.map( this.hsla(), function( v, i ) { - if ( v == null ) { - v = i > 2 ? 1 : 0; - } - - // Catch 1 and 2 - if ( i && i < 3 ) { - v = Math.round( v * 100 ) + "%"; - } - return v; - } ); - - if ( hsla[ 3 ] === 1 ) { - hsla.pop(); - prefix = "hsl("; - } - return prefix + hsla.join() + ")"; - }, - toHexString: function( includeAlpha ) { - var rgba = this._rgba.slice(), - alpha = rgba.pop(); - - if ( includeAlpha ) { - rgba.push( ~~( alpha * 255 ) ); - } - - return "#" + jQuery.map( rgba, function( v ) { - - // Default to 0 when nulls exist - v = ( v || 0 ).toString( 16 ); - return v.length === 1 ? "0" + v : v; - } ).join( "" ); - }, - toString: function() { - return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); - } -} ); -color.fn.parse.prototype = color.fn; - -// Hsla conversions adapted from: -// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 - -function hue2rgb( p, q, h ) { - h = ( h + 1 ) % 1; - if ( h * 6 < 1 ) { - return p + ( q - p ) * h * 6; - } - if ( h * 2 < 1 ) { - return q; - } - if ( h * 3 < 2 ) { - return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; - } - return p; -} - -spaces.hsla.to = function( rgba ) { - if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { - return [ null, null, null, rgba[ 3 ] ]; - } - var r = rgba[ 0 ] / 255, - g = rgba[ 1 ] / 255, - b = rgba[ 2 ] / 255, - a = rgba[ 3 ], - max = Math.max( r, g, b ), - min = Math.min( r, g, b ), - diff = max - min, - add = max + min, - l = add * 0.5, - h, s; - - if ( min === max ) { - h = 0; - } else if ( r === max ) { - h = ( 60 * ( g - b ) / diff ) + 360; - } else if ( g === max ) { - h = ( 60 * ( b - r ) / diff ) + 120; - } else { - h = ( 60 * ( r - g ) / diff ) + 240; - } - - // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0% - // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) - if ( diff === 0 ) { - s = 0; - } else if ( l <= 0.5 ) { - s = diff / add; - } else { - s = diff / ( 2 - add ); - } - return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; -}; - -spaces.hsla.from = function( hsla ) { - if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { - return [ null, null, null, hsla[ 3 ] ]; - } - var h = hsla[ 0 ] / 360, - s = hsla[ 1 ], - l = hsla[ 2 ], - a = hsla[ 3 ], - q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, - p = 2 * l - q; - - return [ - Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), - Math.round( hue2rgb( p, q, h ) * 255 ), - Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), - a - ]; -}; - -each( spaces, function( spaceName, space ) { - var props = space.props, - cache = space.cache, - to = space.to, - from = space.from; - - // Makes rgba() and hsla() - color.fn[ spaceName ] = function( value ) { - - // Generate a cache for this space if it doesn't exist - if ( to && !this[ cache ] ) { - this[ cache ] = to( this._rgba ); - } - if ( value === undefined ) { - return this[ cache ].slice(); - } - - var ret, - type = jQuery.type( value ), - arr = ( type === "array" || type === "object" ) ? value : arguments, - local = this[ cache ].slice(); - - each( props, function( key, prop ) { - var val = arr[ type === "object" ? key : prop.idx ]; - if ( val == null ) { - val = local[ prop.idx ]; - } - local[ prop.idx ] = clamp( val, prop ); - } ); - - if ( from ) { - ret = color( from( local ) ); - ret[ cache ] = local; - return ret; - } else { - return color( local ); - } - }; - - // Makes red() green() blue() alpha() hue() saturation() lightness() - each( props, function( key, prop ) { - - // Alpha is included in more than one space - if ( color.fn[ key ] ) { - return; - } - color.fn[ key ] = function( value ) { - var vtype = jQuery.type( value ), - fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), - local = this[ fn ](), - cur = local[ prop.idx ], - match; - - if ( vtype === "undefined" ) { - return cur; - } - - if ( vtype === "function" ) { - value = value.call( this, cur ); - vtype = jQuery.type( value ); - } - if ( value == null && prop.empty ) { - return this; - } - if ( vtype === "string" ) { - match = rplusequals.exec( value ); - if ( match ) { - value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); - } - } - local[ prop.idx ] = value; - return this[ fn ]( local ); - }; - } ); -} ); - -// Add cssHook and .fx.step function for each named hook. -// accept a space separated string of properties -color.hook = function( hook ) { - var hooks = hook.split( " " ); - each( hooks, function( i, hook ) { - jQuery.cssHooks[ hook ] = { - set: function( elem, value ) { - var parsed, curElem, - backgroundColor = ""; - - if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || - ( parsed = stringParse( value ) ) ) ) { - value = color( parsed || value ); - if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { - curElem = hook === "backgroundColor" ? elem.parentNode : elem; - while ( - ( backgroundColor === "" || backgroundColor === "transparent" ) && - curElem && curElem.style - ) { - try { - backgroundColor = jQuery.css( curElem, "backgroundColor" ); - curElem = curElem.parentNode; - } catch ( e ) { - } - } - - value = value.blend( backgroundColor && backgroundColor !== "transparent" ? - backgroundColor : - "_default" ); - } - - value = value.toRgbaString(); - } - try { - elem.style[ hook ] = value; - } catch ( e ) { - - // Wrapped to prevent IE from throwing errors on "invalid" values like - // 'auto' or 'inherit' - } - } - }; - jQuery.fx.step[ hook ] = function( fx ) { - if ( !fx.colorInit ) { - fx.start = color( fx.elem, hook ); - fx.end = color( fx.end ); - fx.colorInit = true; - } - jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); - }; - } ); - -}; - -color.hook( stepHooks ); - -jQuery.cssHooks.borderColor = { - expand: function( value ) { - var expanded = {}; - - each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { - expanded[ "border" + part + "Color" ] = value; - } ); - return expanded; - } -}; - -// Basic color names only. -// Usage of any of the other color names requires adding yourself or including -// jquery.color.svg-names.js. -colors = jQuery.Color.names = { - - // 4.1. Basic color keywords - aqua: "#00ffff", - black: "#000000", - blue: "#0000ff", - fuchsia: "#ff00ff", - gray: "#808080", - green: "#008000", - lime: "#00ff00", - maroon: "#800000", - navy: "#000080", - olive: "#808000", - purple: "#800080", - red: "#ff0000", - silver: "#c0c0c0", - teal: "#008080", - white: "#ffffff", - yellow: "#ffff00", - - // 4.2.3. "transparent" color keyword - transparent: [ null, null, null, 0 ], - - _default: "#ffffff" -}; - -} )( jQuery ); - /******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ /******************************************************************************/ @@ -748,28 +73,22 @@ $.each( } ); +function camelCase( string ) { + return string.replace( /-([\da-z])/gi, function( all, letter ) { + return letter.toUpperCase(); + } ); +} + function getElementStyles( elem ) { var key, len, - style = elem.ownerDocument.defaultView ? - elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : - elem.currentStyle, + style = elem.ownerDocument.defaultView.getComputedStyle( elem ), styles = {}; - if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { - len = style.length; - while ( len-- ) { - key = style[ len ]; - if ( typeof style[ key ] === "string" ) { - styles[ $.camelCase( key ) ] = style[ key ]; - } - } - - // Support: Opera, IE <9 - } else { - for ( key in style ) { - if ( typeof style[ key ] === "string" ) { - styles[ key ] = style[ key ]; - } + len = style.length; + while ( len-- ) { + key = style[ len ]; + if ( typeof style[ key ] === "string" ) { + styles[ camelCase( key ) ] = style[ key ]; } } @@ -794,15 +113,6 @@ function styleDifference( oldStyle, newStyle ) { return diff; } -// Support: jQuery <1.8 -if ( !$.fn.addBack ) { - $.fn.addBack = function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - }; -} - $.effects.animateClass = function( value, duration, easing, callback ) { var o = $.speed( duration, easing, callback ); @@ -934,15 +244,15 @@ $.fn.extend( { ( function() { -if ( $.expr && $.expr.filters && $.expr.filters.animated ) { - $.expr.filters.animated = ( function( orig ) { +if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { + $.expr.pseudos.animated = ( function( orig ) { return function( elem ) { return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); }; - } )( $.expr.filters.animated ); + } )( $.expr.pseudos.animated ); } -if ( $.uiBackCompat !== false ) { +if ( $.uiBackCompat === true ) { $.extend( $.effects, { // Saves a set of properties in a data storage @@ -1008,6 +318,7 @@ if ( $.uiBackCompat !== false ) { // Firefox incorrectly exposes anonymous content // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 try { + // eslint-disable-next-line no-unused-expressions active.id; } catch ( e ) { active = document.body; @@ -1070,7 +381,7 @@ if ( $.uiBackCompat !== false ) { } $.extend( $.effects, { - version: "1.12.1", + version: "1.14.0", define: function( name, mode, effect ) { if ( !effect ) { @@ -1193,7 +504,7 @@ $.extend( $.effects, { // Lock in margins first to account for form elements, which // will change margin if you explicitly set height - // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 + // see: https://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 // Support: Safari element.css( { marginTop: element.css( "marginTop" ), @@ -1286,7 +597,7 @@ function _normalizeArguments( effect, options, speed, callback ) { } // Catch (effect, callback) - if ( $.isFunction( options ) ) { + if ( typeof options === "function" ) { callback = options; speed = null; options = {}; @@ -1300,7 +611,7 @@ function _normalizeArguments( effect, options, speed, callback ) { } // Catch (effect, options, callback) - if ( $.isFunction( speed ) ) { + if ( typeof speed === "function" ) { callback = speed; speed = null; } @@ -1334,7 +645,7 @@ function standardAnimationOption( option ) { } // Complete callback - if ( $.isFunction( option ) ) { + if ( typeof option === "function" ) { return true; } @@ -1361,7 +672,7 @@ $.fn.extend( { var el = $( this ), normalizedMode = $.effects.mode( el, mode ) || defaultMode; - // Sentinel for duck-punching the :animated psuedo-selector + // Sentinel for duck-punching the :animated pseudo-selector el.data( dataSpaceAnimated, true ); // Save effect mode for later use, @@ -1369,7 +680,7 @@ $.fn.extend( { // as the .show() below destroys the initial state modes.push( normalizedMode ); - // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13 + // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 if ( defaultMode && ( normalizedMode === "show" || ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { el.show(); @@ -1379,7 +690,7 @@ $.fn.extend( { $.effects.saveStyle( el ); } - if ( $.isFunction( next ) ) { + if ( typeof next === "function" ) { next(); } }; @@ -1414,11 +725,11 @@ $.fn.extend( { } function done() { - if ( $.isFunction( complete ) ) { + if ( typeof complete === "function" ) { complete.call( elem[ 0 ] ); } - if ( $.isFunction( next ) ) { + if ( typeof next === "function" ) { next(); } } @@ -1427,7 +738,7 @@ $.fn.extend( { // as toggle can be either show or hide depending on element state args.mode = modes.shift(); - if ( $.uiBackCompat !== false && !defaultMode ) { + if ( $.uiBackCompat === true && !defaultMode ) { if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { // Call the core method to track "olddisplay" properly @@ -1527,22 +838,24 @@ $.fn.extend( { width: target.innerWidth() }, startPosition = element.offset(), - transfer = $( "

" ) - .appendTo( "body" ) - .addClass( options.className ) - .css( { - top: startPosition.top - fixTop, - left: startPosition.left - fixLeft, - height: element.innerHeight(), - width: element.innerWidth(), - position: targetFixed ? "fixed" : "absolute" - } ) - .animate( animation, options.duration, options.easing, function() { - transfer.remove(); - if ( $.isFunction( done ) ) { - done(); - } - } ); + transfer = $( "
" ); + + transfer + .appendTo( "body" ) + .addClass( options.className ) + .css( { + top: startPosition.top - fixTop, + left: startPosition.left - fixLeft, + height: element.innerHeight(), + width: element.innerWidth(), + position: targetFixed ? "fixed" : "absolute" + } ) + .animate( animation, options.duration, options.easing, function() { + transfer.remove(); + if ( typeof done === "function" ) { + done(); + } + } ); } } ); @@ -1585,7 +898,7 @@ $.fx.step.clip = function( fx ) { ( function() { -// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) +// Based on easing equations from Robert Penner (http://robertpenner.com/easing) var baseEasings = {}; @@ -1634,4 +947,4 @@ $.each( baseEasings, function( name, easeIn ) { return $.effects; -} ) ); +} ); diff --git a/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js b/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js deleted file mode 100644 index 5c4b5d358b..0000000000 --- a/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js +++ /dev/null @@ -1,17 +0,0 @@ -//= require rails_admin/jquery-ui/version - -( function( factory ) { - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define( [ "jquery", "./version" ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -} ( function( $ ) { - -// This file is deprecated -return $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); -} ) ); diff --git a/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js b/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js index c5f7ee3f2f..762a960aac 100644 --- a/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js +++ b/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js @@ -1,20 +1,20 @@ -//= require rails_admin/jquery-ui/version - /*! - * jQuery UI Keycode 1.12.1 - * http://jqueryui.com + * jQuery UI Keycode 1.14.0 + * https://jqueryui.com * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. - * http://jquery.org/license + * https://jquery.org/license */ //>>label: Keycode //>>group: Core //>>description: Provide keycodes as keynames -//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ +//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -24,7 +24,9 @@ // Browser globals factory( jQuery ); } -} ( function( $ ) { +} )( function( $ ) { +"use strict"; + return $.ui.keyCode = { BACKSPACE: 8, COMMA: 188, @@ -44,4 +46,4 @@ return $.ui.keyCode = { UP: 38 }; -} ) ); +} ); diff --git a/vendor/assets/javascripts/rails_admin/jquery-ui/position.js b/vendor/assets/javascripts/rails_admin/jquery-ui/position.js index 8fcc51fb9b..28f7a9f85e 100644 --- a/vendor/assets/javascripts/rails_admin/jquery-ui/position.js +++ b/vendor/assets/javascripts/rails_admin/jquery-ui/position.js @@ -1,23 +1,23 @@ -//= require rails_admin/jquery-ui/version - /*! - * jQuery UI Position 1.12.1 - * http://jqueryui.com + * jQuery UI Position 1.14.0 + * https://jqueryui.com * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. - * http://jquery.org/license + * https://jquery.org/license * - * http://api.jqueryui.com/position/ + * https://api.jqueryui.com/position/ */ //>>label: Position //>>group: Core //>>description: Positions elements relative to other elements. -//>>docs: http://api.jqueryui.com/position/ -//>>demos: http://jqueryui.com/position/ +//>>docs: https://api.jqueryui.com/position/ +//>>demos: https://jqueryui.com/position/ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -27,7 +27,9 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; + ( function() { var cachedScrollbarWidth, max = Math.max, @@ -50,6 +52,10 @@ function parseCss( element, property ) { return parseInt( $.css( element, property ), 10 ) || 0; } +function isWindow( obj ) { + return obj != null && obj === obj.window; +} + function getDimensions( elem ) { var raw = elem[ 0 ]; if ( raw.nodeType === 9 ) { @@ -59,7 +65,7 @@ function getDimensions( elem ) { offset: { top: 0, left: 0 } }; } - if ( $.isWindow( raw ) ) { + if ( isWindow( raw ) ) { return { width: elem.width(), height: elem.height(), @@ -86,9 +92,9 @@ $.position = { return cachedScrollbarWidth; } var w1, w2, - div = $( "
" + - "
" ), + div = $( "
" + + "
" ), innerDiv = div.children()[ 0 ]; $( "body" ).append( div ); @@ -121,12 +127,12 @@ $.position = { }, getWithinInfo: function( element ) { var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[ 0 ] ), + isElemWindow = isWindow( withinElement[ 0 ] ), isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, - hasOffset = !isWindow && !isDocument; + hasOffset = !isElemWindow && !isDocument; return { element: withinElement, - isWindow: isWindow, + isWindow: isElemWindow, isDocument: isDocument, offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, scrollLeft: withinElement.scrollLeft(), @@ -146,7 +152,12 @@ $.fn.position = function( options ) { options = $.extend( {}, options ); var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, - target = $( options.of ), + + // Make sure string options are treated as CSS selectors + target = typeof options.of === "string" ? + $( document ).find( options.of ) : + $( options.of ), + within = $.position.getWithinInfo( options.within ), scrollInfo = $.position.getScrollInfo( within ), collision = ( options.collision || "flip" ).split( " " ), @@ -497,4 +508,4 @@ $.ui.position = { return $.ui.position; -} ) ); +} ); diff --git a/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js b/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js deleted file mode 100644 index e355d40d03..0000000000 --- a/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js +++ /dev/null @@ -1,42 +0,0 @@ -//= require rails_admin/jquery-ui/version - -( function( factory ) { - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define( [ "jquery", "./version" ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -} ( function( $ ) { -return $.ui.safeActiveElement = function( document ) { - var activeElement; - - // Support: IE 9 only - // IE9 throws an "Unspecified error" accessing document.activeElement from an