rails_admin 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/Rakefile +2 -0
  4. data/app/assets/javascripts/rails_admin/{application.js → application.js.erb} +8 -0
  5. data/app/assets/stylesheets/rails_admin/{application.scss → application.scss.erb} +4 -0
  6. data/app/controllers/rails_admin/application_controller.rb +2 -0
  7. data/app/controllers/rails_admin/main_controller.rb +9 -14
  8. data/app/helpers/rails_admin/application_helper.rb +37 -9
  9. data/app/helpers/rails_admin/form_builder.rb +10 -0
  10. data/app/helpers/rails_admin/main_helper.rb +7 -15
  11. data/app/views/layouts/rails_admin/_head.html.erb +12 -3
  12. data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +3 -1
  13. data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +1 -1
  14. data/app/views/layouts/rails_admin/application.html.erb +4 -1
  15. data/app/views/rails_admin/main/_dashboard_history.html.erb +1 -1
  16. data/app/views/rails_admin/main/_form_action_text.html.erb +2 -1
  17. data/app/views/rails_admin/main/_form_file_upload.html.erb +1 -1
  18. data/app/views/rails_admin/main/_form_filtering_multiselect.html.erb +2 -2
  19. data/app/views/rails_admin/main/_form_filtering_select.html.erb +1 -1
  20. data/app/views/rails_admin/main/_form_multiple_file_upload.html.erb +1 -1
  21. data/app/views/rails_admin/main/dashboard.html.erb +2 -2
  22. data/app/views/rails_admin/main/history.html.erb +1 -1
  23. data/app/views/rails_admin/main/index.html.erb +7 -19
  24. data/config/initializers/active_record_extensions.rb +26 -3
  25. data/config/initializers/mongoid_extensions.rb +2 -0
  26. data/config/locales/rails_admin.en.yml +3 -2
  27. data/config/routes.rb +2 -0
  28. data/lib/generators/rails_admin/importmap_formatter.rb +28 -0
  29. data/lib/generators/rails_admin/install_generator.rb +68 -9
  30. data/lib/generators/rails_admin/templates/rails_admin.js +1 -0
  31. data/lib/generators/rails_admin/templates/rails_admin.scss.erb +1 -0
  32. data/lib/generators/rails_admin/templates/rails_admin.webpacker.js +2 -0
  33. data/lib/generators/rails_admin/utils.rb +2 -0
  34. data/lib/rails_admin/abstract_model.rb +9 -2
  35. data/lib/rails_admin/adapters/active_record/association.rb +11 -1
  36. data/lib/rails_admin/adapters/active_record/object_extension.rb +2 -0
  37. data/lib/rails_admin/adapters/active_record/property.rb +2 -0
  38. data/lib/rails_admin/adapters/active_record.rb +25 -2
  39. data/lib/rails_admin/adapters/composite_primary_keys/association.rb +45 -0
  40. data/lib/rails_admin/adapters/composite_primary_keys.rb +40 -0
  41. data/lib/rails_admin/adapters/mongoid/association.rb +14 -4
  42. data/lib/rails_admin/adapters/mongoid/bson.rb +2 -0
  43. data/lib/rails_admin/adapters/mongoid/extension.rb +3 -3
  44. data/lib/rails_admin/adapters/mongoid/object_extension.rb +2 -0
  45. data/lib/rails_admin/adapters/mongoid/property.rb +2 -0
  46. data/lib/rails_admin/adapters/mongoid.rb +4 -2
  47. data/lib/rails_admin/config/actions/base.rb +2 -0
  48. data/lib/rails_admin/config/actions/bulk_delete.rb +2 -0
  49. data/lib/rails_admin/config/actions/dashboard.rb +2 -0
  50. data/lib/rails_admin/config/actions/delete.rb +2 -0
  51. data/lib/rails_admin/config/actions/edit.rb +2 -0
  52. data/lib/rails_admin/config/actions/export.rb +2 -0
  53. data/lib/rails_admin/config/actions/history_index.rb +2 -0
  54. data/lib/rails_admin/config/actions/history_show.rb +2 -0
  55. data/lib/rails_admin/config/actions/index.rb +2 -0
  56. data/lib/rails_admin/config/actions/new.rb +2 -0
  57. data/lib/rails_admin/config/actions/show.rb +2 -0
  58. data/lib/rails_admin/config/actions/show_in_app.rb +2 -0
  59. data/lib/rails_admin/config/actions.rb +2 -0
  60. data/lib/rails_admin/config/configurable.rb +2 -0
  61. data/lib/rails_admin/config/const_load_suppressor.rb +78 -0
  62. data/lib/rails_admin/config/fields/association.rb +2 -0
  63. data/lib/rails_admin/config/fields/base.rb +44 -14
  64. data/lib/rails_admin/config/fields/factories/action_text.rb +2 -0
  65. data/lib/rails_admin/config/fields/factories/active_storage.rb +2 -0
  66. data/lib/rails_admin/config/fields/factories/association.rb +6 -5
  67. data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -0
  68. data/lib/rails_admin/config/fields/factories/devise.rb +2 -0
  69. data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -0
  70. data/lib/rails_admin/config/fields/factories/enum.rb +2 -0
  71. data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -0
  72. data/lib/rails_admin/config/fields/factories/password.rb +2 -0
  73. data/lib/rails_admin/config/fields/factories/shrine.rb +2 -0
  74. data/lib/rails_admin/config/fields/group.rb +2 -0
  75. data/lib/rails_admin/config/fields/types/action_text.rb +6 -0
  76. data/lib/rails_admin/config/fields/types/active_record_enum.rb +2 -0
  77. data/lib/rails_admin/config/fields/types/active_storage.rb +14 -0
  78. data/lib/rails_admin/config/fields/types/all.rb +3 -0
  79. data/lib/rails_admin/config/fields/types/belongs_to_association.rb +7 -5
  80. data/lib/rails_admin/config/fields/types/boolean.rb +7 -1
  81. data/lib/rails_admin/config/fields/types/bson_object_id.rb +2 -0
  82. data/lib/rails_admin/config/fields/types/carrierwave.rb +2 -0
  83. data/lib/rails_admin/config/fields/types/citext.rb +2 -0
  84. data/lib/rails_admin/config/fields/types/ck_editor.rb +2 -0
  85. data/lib/rails_admin/config/fields/types/code_mirror.rb +2 -0
  86. data/lib/rails_admin/config/fields/types/color.rb +2 -0
  87. data/lib/rails_admin/config/fields/types/composite_keys_belongs_to_association.rb +31 -0
  88. data/lib/rails_admin/config/fields/types/date.rb +2 -0
  89. data/lib/rails_admin/config/fields/types/datetime.rb +12 -0
  90. data/lib/rails_admin/config/fields/types/decimal.rb +2 -0
  91. data/lib/rails_admin/config/fields/types/dragonfly.rb +2 -0
  92. data/lib/rails_admin/config/fields/types/enum.rb +15 -2
  93. data/lib/rails_admin/config/fields/types/file_upload.rb +2 -0
  94. data/lib/rails_admin/config/fields/types/float.rb +2 -0
  95. data/lib/rails_admin/config/fields/types/froala.rb +2 -0
  96. data/lib/rails_admin/config/fields/types/has_and_belongs_to_many_association.rb +2 -0
  97. data/lib/rails_admin/config/fields/types/has_many_association.rb +2 -0
  98. data/lib/rails_admin/config/fields/types/has_one_association.rb +7 -1
  99. data/lib/rails_admin/config/fields/types/hidden.rb +2 -0
  100. data/lib/rails_admin/config/fields/types/inet.rb +2 -0
  101. data/lib/rails_admin/config/fields/types/integer.rb +2 -0
  102. data/lib/rails_admin/config/fields/types/json.rb +2 -0
  103. data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +22 -0
  104. data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +2 -0
  105. data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +2 -0
  106. data/lib/rails_admin/config/fields/types/numeric.rb +6 -0
  107. data/lib/rails_admin/config/fields/types/paperclip.rb +2 -0
  108. data/lib/rails_admin/config/fields/types/password.rb +2 -0
  109. data/lib/rails_admin/config/fields/types/polymorphic_association.rb +2 -0
  110. data/lib/rails_admin/config/fields/types/serialized.rb +2 -0
  111. data/lib/rails_admin/config/fields/types/shrine.rb +2 -0
  112. data/lib/rails_admin/config/fields/types/simple_mde.rb +2 -0
  113. data/lib/rails_admin/config/fields/types/string.rb +2 -0
  114. data/lib/rails_admin/config/fields/types/string_like.rb +6 -0
  115. data/lib/rails_admin/config/fields/types/text.rb +2 -0
  116. data/lib/rails_admin/config/fields/types/time.rb +6 -0
  117. data/lib/rails_admin/config/fields/types/timestamp.rb +2 -0
  118. data/lib/rails_admin/config/fields/types/uuid.rb +2 -0
  119. data/lib/rails_admin/config/fields/types/wysihtml5.rb +2 -0
  120. data/lib/rails_admin/config/fields/types.rb +2 -0
  121. data/lib/rails_admin/config/fields.rb +3 -1
  122. data/lib/rails_admin/config/groupable.rb +2 -0
  123. data/lib/rails_admin/config/has_description.rb +2 -0
  124. data/lib/rails_admin/config/has_fields.rb +3 -1
  125. data/lib/rails_admin/config/has_groups.rb +2 -0
  126. data/lib/rails_admin/config/hideable.rb +2 -0
  127. data/lib/rails_admin/config/inspectable.rb +2 -0
  128. data/lib/rails_admin/config/lazy_model.rb +74 -0
  129. data/lib/rails_admin/config/model.rb +5 -1
  130. data/lib/rails_admin/config/proxyable/proxy.rb +2 -0
  131. data/lib/rails_admin/config/proxyable.rb +2 -0
  132. data/lib/rails_admin/config/sections/base.rb +2 -0
  133. data/lib/rails_admin/config/sections/create.rb +2 -0
  134. data/lib/rails_admin/config/sections/edit.rb +2 -0
  135. data/lib/rails_admin/config/sections/export.rb +2 -0
  136. data/lib/rails_admin/config/sections/list.rb +6 -0
  137. data/lib/rails_admin/config/sections/modal.rb +2 -0
  138. data/lib/rails_admin/config/sections/nested.rb +2 -0
  139. data/lib/rails_admin/config/sections/show.rb +2 -0
  140. data/lib/rails_admin/config/sections/update.rb +2 -0
  141. data/lib/rails_admin/config/sections.rb +2 -0
  142. data/lib/rails_admin/config.rb +26 -37
  143. data/lib/rails_admin/engine.rb +19 -17
  144. data/lib/rails_admin/extension.rb +2 -0
  145. data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +21 -4
  146. data/lib/rails_admin/extensions/cancancan.rb +2 -0
  147. data/lib/rails_admin/extensions/controller_extension.rb +2 -0
  148. data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +49 -27
  149. data/lib/rails_admin/extensions/paper_trail.rb +2 -0
  150. data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +2 -0
  151. data/lib/rails_admin/extensions/pundit.rb +2 -0
  152. data/lib/rails_admin/support/csv_converter.rb +2 -1
  153. data/lib/rails_admin/support/datetime.rb +3 -1
  154. data/lib/rails_admin/support/es_module_processor.rb +23 -0
  155. data/lib/rails_admin/support/hash_helper.rb +2 -0
  156. data/lib/rails_admin/version.rb +3 -1
  157. data/lib/rails_admin.rb +7 -2
  158. data/lib/tasks/rails_admin.rake +2 -0
  159. data/package.json +2 -2
  160. data/src/rails_admin/base.js +13 -1
  161. data/src/rails_admin/filter-box.js +165 -209
  162. data/src/rails_admin/filtering-multiselect.js +5 -10
  163. data/src/rails_admin/filtering-select.js +16 -7
  164. data/src/rails_admin/i18n.js +3 -1
  165. data/src/rails_admin/nested-form-hooks.js +6 -4
  166. data/src/rails_admin/remote-form.js +5 -5
  167. data/src/rails_admin/styles/base/theming.scss +25 -8
  168. data/src/rails_admin/styles/base.scss +5 -5
  169. data/src/rails_admin/styles/widgets.scss +1 -1
  170. data/src/rails_admin/ui.js +45 -18
  171. data/src/rails_admin/widgets.js +7 -2
  172. data/vendor/assets/fonts/rails_admin/fa-solid-900.ttf +0 -0
  173. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff2 +0 -0
  174. data/vendor/assets/javascripts/rails_admin/jquery3.js +118 -109
  175. data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4531 -2782
  176. metadata +15 -12
  177. data/lib/generators/rails_admin/templates/rails_admin.js.erb +0 -2
  178. data/lib/generators/rails_admin/templates/rails_admin.scss +0 -1
  179. data/lib/generators/rails_admin/templates/webpack.config.js +0 -29
  180. data/lib/rails_admin/support/esmodule_preprocessor.rb +0 -33
  181. data/vendor/assets/fonts/rails_admin/fa-solid-900.eot +0 -0
  182. data/vendor/assets/fonts/rails_admin/fa-solid-900.svg +0 -5034
  183. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff +0 -0
@@ -1,5 +1,5 @@
1
1
  import jQuery from "jquery";
2
- import "jquery-ui/ui/effect";
2
+ import "jquery-ui/ui/effect.js";
3
3
  import I18n from "./i18n";
4
4
 
5
5
  (function ($) {
@@ -7,6 +7,34 @@ import I18n from "./i18n";
7
7
  $("#list [name='bulk_ids[]']").prop("checked", $(this).is(":checked"));
8
8
  });
9
9
 
10
+ $(document)
11
+ .on("turbo:click", function () {
12
+ $("#loading").show();
13
+ })
14
+ .on("turbo:before-render", function (event) {
15
+ document
16
+ .querySelectorAll('.sidebar .btn-toggle[aria-expanded="false"]')
17
+ .forEach((element) => {
18
+ const newButton = event.detail.newBody.querySelector(
19
+ `.sidebar [data-bs-target="${element.dataset.bsTarget}"]`
20
+ );
21
+ const newMenu = event.detail.newBody.querySelector(
22
+ element.dataset.bsTarget
23
+ );
24
+ if (newButton) {
25
+ newButton.parentNode.replaceChild(
26
+ element.cloneNode(true),
27
+ newButton
28
+ );
29
+ }
30
+ if (newMenu) {
31
+ newMenu.classList.remove("show");
32
+ }
33
+ });
34
+
35
+ $("#loading").hide();
36
+ });
37
+
10
38
  $(document).on("click", "[data-bs-target]", function () {
11
39
  if (!$(this).hasClass("disabled")) {
12
40
  if ($(this).has("i.fa-chevron-down").length) {
@@ -51,12 +79,14 @@ import I18n from "./i18n";
51
79
  }
52
80
  );
53
81
 
54
- document.addEventListener("turbo:load", function () {
82
+ function triggerDomReady() {
55
83
  I18n.init($("html").attr("lang"), $("#admin-js").data("i18nOptions"));
56
84
 
57
85
  const event = new CustomEvent("rails_admin.dom_ready");
58
86
  document.dispatchEvent(event);
59
- });
87
+ }
88
+ $(document).ready(triggerDomReady);
89
+ document.addEventListener("turbo:render", triggerDomReady);
60
90
 
61
91
  document.addEventListener("rails_admin.dom_ready", function () {
62
92
  $(".nav.nav-pills li.active").removeClass("active");
@@ -80,21 +110,18 @@ import I18n from "./i18n";
80
110
  .each(function () {
81
111
  $(this).siblings(".control-group").hide();
82
112
  });
83
- $('button[name][type="submit"]')
84
- .attr("type", "button")
85
- .on("click", function () {
86
- var form = $(this).closest("form");
87
- form.append(
88
- $("<input />")
89
- .attr("type", "hidden")
90
- .attr("name", $(this).attr("name"))
91
- .attr("value", true)
92
- );
93
- if ($(this).is("[formnovalidate]")) {
94
- form.attr("novalidate", true);
95
- }
96
- form.trigger("submit");
97
- });
113
+ $('button[name][type="submit"]').on("click", function () {
114
+ var form = $(this).closest("form");
115
+ form.append(
116
+ $("<input />")
117
+ .attr("type", "hidden")
118
+ .attr("name", $(this).attr("name"))
119
+ .attr("value", $(this).attr("value"))
120
+ );
121
+ if ($(this).is("[formnovalidate]")) {
122
+ form.attr("novalidate", true);
123
+ }
124
+ });
98
125
  $.each($("#filters_box").data("options"), function () {
99
126
  $.filters.append(this);
100
127
  });
@@ -1,6 +1,6 @@
1
1
  import jQuery from "jquery";
2
- import "jquery-ui/ui/widgets/sortable";
3
- import * as bootstrap from "bootstrap/dist/js/bootstrap.esm";
2
+ import "jquery-ui/ui/widgets/sortable.js";
3
+ import * as bootstrap from "bootstrap";
4
4
  import flatpickr from "flatpickr";
5
5
  import I18n from "./i18n";
6
6
 
@@ -489,6 +489,11 @@ import I18n from "./i18n";
489
489
  return content.find("trix-editor").each(function () {
490
490
  if (!window.Trix) {
491
491
  options = $(this).data("options");
492
+ if (options.warn_dynamic_load) {
493
+ console.warn(
494
+ "ActionText assets should be loaded statically. Follow instructions in https://github.com/railsadminteam/rails_admin/wiki/ActionText"
495
+ );
496
+ }
492
497
  $("head").append(
493
498
  '<link href="' +
494
499
  options["csspath"] +
@@ -1,15 +1,15 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.5.1
2
+ * jQuery JavaScript Library v3.6.0
3
3
  * https://jquery.com/
4
4
  *
5
5
  * Includes Sizzle.js
6
6
  * https://sizzlejs.com/
7
7
  *
8
- * Copyright JS Foundation and other contributors
8
+ * Copyright OpenJS Foundation and other contributors
9
9
  * Released under the MIT license
10
10
  * https://jquery.org/license
11
11
  *
12
- * Date: 2020-05-04T22:49Z
12
+ * Date: 2021-03-02T17:08Z
13
13
  */
14
14
  ( function( global, factory ) {
15
15
 
@@ -76,12 +76,16 @@ var support = {};
76
76
 
77
77
  var isFunction = function isFunction( obj ) {
78
78
 
79
- // Support: Chrome <=57, Firefox <=52
80
- // In some browsers, typeof returns "function" for HTML <object> elements
81
- // (i.e., `typeof document.createElement( "object" ) === "function"`).
82
- // We don't want to classify *any* DOM node as a function.
83
- return typeof obj === "function" && typeof obj.nodeType !== "number";
84
- };
79
+ // Support: Chrome <=57, Firefox <=52
80
+ // In some browsers, typeof returns "function" for HTML <object> elements
81
+ // (i.e., `typeof document.createElement( "object" ) === "function"`).
82
+ // We don't want to classify *any* DOM node as a function.
83
+ // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
84
+ // Plus for old WebKit, typeof returns "function" for HTML collections
85
+ // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
86
+ return typeof obj === "function" && typeof obj.nodeType !== "number" &&
87
+ typeof obj.item !== "function";
88
+ };
85
89
 
86
90
 
87
91
  var isWindow = function isWindow( obj ) {
@@ -147,7 +151,7 @@ function toType( obj ) {
147
151
 
148
152
 
149
153
  var
150
- version = "3.5.1",
154
+ version = "3.6.0",
151
155
 
152
156
  // Define a local copy of jQuery
153
157
  jQuery = function( selector, context ) {
@@ -401,7 +405,7 @@ jQuery.extend( {
401
405
  if ( isArrayLike( Object( arr ) ) ) {
402
406
  jQuery.merge( ret,
403
407
  typeof arr === "string" ?
404
- [ arr ] : arr
408
+ [ arr ] : arr
405
409
  );
406
410
  } else {
407
411
  push.call( ret, arr );
@@ -496,9 +500,9 @@ if ( typeof Symbol === "function" ) {
496
500
 
497
501
  // Populate the class2type map
498
502
  jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
499
- function( _i, name ) {
500
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
501
- } );
503
+ function( _i, name ) {
504
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
505
+ } );
502
506
 
503
507
  function isArrayLike( obj ) {
504
508
 
@@ -518,14 +522,14 @@ function isArrayLike( obj ) {
518
522
  }
519
523
  var Sizzle =
520
524
  /*!
521
- * Sizzle CSS Selector Engine v2.3.5
525
+ * Sizzle CSS Selector Engine v2.3.6
522
526
  * https://sizzlejs.com/
523
527
  *
524
528
  * Copyright JS Foundation and other contributors
525
529
  * Released under the MIT license
526
530
  * https://js.foundation/
527
531
  *
528
- * Date: 2020-03-14
532
+ * Date: 2021-02-16
529
533
  */
530
534
  ( function( window ) {
531
535
  var i,
@@ -1108,8 +1112,8 @@ support = Sizzle.support = {};
1108
1112
  * @returns {Boolean} True iff elem is a non-HTML XML node
1109
1113
  */
1110
1114
  isXML = Sizzle.isXML = function( elem ) {
1111
- var namespace = elem.namespaceURI,
1112
- docElem = ( elem.ownerDocument || elem ).documentElement;
1115
+ var namespace = elem && elem.namespaceURI,
1116
+ docElem = elem && ( elem.ownerDocument || elem ).documentElement;
1113
1117
 
1114
1118
  // Support: IE <=8
1115
1119
  // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
@@ -3024,9 +3028,9 @@ var rneedsContext = jQuery.expr.match.needsContext;
3024
3028
 
3025
3029
  function nodeName( elem, name ) {
3026
3030
 
3027
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3031
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3028
3032
 
3029
- };
3033
+ }
3030
3034
  var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
3031
3035
 
3032
3036
 
@@ -3997,8 +4001,8 @@ jQuery.extend( {
3997
4001
  resolveContexts = Array( i ),
3998
4002
  resolveValues = slice.call( arguments ),
3999
4003
 
4000
- // the master Deferred
4001
- master = jQuery.Deferred(),
4004
+ // the primary Deferred
4005
+ primary = jQuery.Deferred(),
4002
4006
 
4003
4007
  // subordinate callback factory
4004
4008
  updateFunc = function( i ) {
@@ -4006,30 +4010,30 @@ jQuery.extend( {
4006
4010
  resolveContexts[ i ] = this;
4007
4011
  resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
4008
4012
  if ( !( --remaining ) ) {
4009
- master.resolveWith( resolveContexts, resolveValues );
4013
+ primary.resolveWith( resolveContexts, resolveValues );
4010
4014
  }
4011
4015
  };
4012
4016
  };
4013
4017
 
4014
4018
  // Single- and empty arguments are adopted like Promise.resolve
4015
4019
  if ( remaining <= 1 ) {
4016
- adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
4020
+ adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
4017
4021
  !remaining );
4018
4022
 
4019
4023
  // Use .then() to unwrap secondary thenables (cf. gh-3000)
4020
- if ( master.state() === "pending" ||
4024
+ if ( primary.state() === "pending" ||
4021
4025
  isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
4022
4026
 
4023
- return master.then();
4027
+ return primary.then();
4024
4028
  }
4025
4029
  }
4026
4030
 
4027
4031
  // Multiple arguments are aggregated like Promise.all array elements
4028
4032
  while ( i-- ) {
4029
- adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
4033
+ adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
4030
4034
  }
4031
4035
 
4032
- return master.promise();
4036
+ return primary.promise();
4033
4037
  }
4034
4038
  } );
4035
4039
 
@@ -4180,8 +4184,8 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
4180
4184
  for ( ; i < len; i++ ) {
4181
4185
  fn(
4182
4186
  elems[ i ], key, raw ?
4183
- value :
4184
- value.call( elems[ i ], i, fn( elems[ i ], key ) )
4187
+ value :
4188
+ value.call( elems[ i ], i, fn( elems[ i ], key ) )
4185
4189
  );
4186
4190
  }
4187
4191
  }
@@ -5089,10 +5093,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
5089
5093
  }
5090
5094
 
5091
5095
 
5092
- var
5093
- rkeyEvent = /^key/,
5094
- rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
5095
- rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
5096
+ var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
5096
5097
 
5097
5098
  function returnTrue() {
5098
5099
  return true;
@@ -5387,8 +5388,8 @@ jQuery.event = {
5387
5388
  event = jQuery.event.fix( nativeEvent ),
5388
5389
 
5389
5390
  handlers = (
5390
- dataPriv.get( this, "events" ) || Object.create( null )
5391
- )[ event.type ] || [],
5391
+ dataPriv.get( this, "events" ) || Object.create( null )
5392
+ )[ event.type ] || [],
5392
5393
  special = jQuery.event.special[ event.type ] || {};
5393
5394
 
5394
5395
  // Use the fix-ed jQuery.Event rather than the (read-only) native event
@@ -5512,12 +5513,12 @@ jQuery.event = {
5512
5513
  get: isFunction( hook ) ?
5513
5514
  function() {
5514
5515
  if ( this.originalEvent ) {
5515
- return hook( this.originalEvent );
5516
+ return hook( this.originalEvent );
5516
5517
  }
5517
5518
  } :
5518
5519
  function() {
5519
5520
  if ( this.originalEvent ) {
5520
- return this.originalEvent[ name ];
5521
+ return this.originalEvent[ name ];
5521
5522
  }
5522
5523
  },
5523
5524
 
@@ -5656,7 +5657,13 @@ function leverageNative( el, type, expectSync ) {
5656
5657
  // Cancel the outer synthetic event
5657
5658
  event.stopImmediatePropagation();
5658
5659
  event.preventDefault();
5659
- return result.value;
5660
+
5661
+ // Support: Chrome 86+
5662
+ // In Chrome, if an element having a focusout handler is blurred by
5663
+ // clicking outside of it, it invokes the handler synchronously. If
5664
+ // that handler calls `.remove()` on the element, the data is cleared,
5665
+ // leaving `result` undefined. We need to guard against this.
5666
+ return result && result.value;
5660
5667
  }
5661
5668
 
5662
5669
  // If this is an inner synthetic event for an event with a bubbling surrogate
@@ -5821,34 +5828,7 @@ jQuery.each( {
5821
5828
  targetTouches: true,
5822
5829
  toElement: true,
5823
5830
  touches: true,
5824
-
5825
- which: function( event ) {
5826
- var button = event.button;
5827
-
5828
- // Add which for key events
5829
- if ( event.which == null && rkeyEvent.test( event.type ) ) {
5830
- return event.charCode != null ? event.charCode : event.keyCode;
5831
- }
5832
-
5833
- // Add which for click: 1 === left; 2 === middle; 3 === right
5834
- if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
5835
- if ( button & 1 ) {
5836
- return 1;
5837
- }
5838
-
5839
- if ( button & 2 ) {
5840
- return 3;
5841
- }
5842
-
5843
- if ( button & 4 ) {
5844
- return 2;
5845
- }
5846
-
5847
- return 0;
5848
- }
5849
-
5850
- return event.which;
5851
- }
5831
+ which: true
5852
5832
  }, jQuery.event.addProp );
5853
5833
 
5854
5834
  jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
@@ -5874,6 +5854,12 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
5874
5854
  return true;
5875
5855
  },
5876
5856
 
5857
+ // Suppress native focus or blur as it's already being fired
5858
+ // in leverageNative.
5859
+ _default: function() {
5860
+ return true;
5861
+ },
5862
+
5877
5863
  delegateType: delegateType
5878
5864
  };
5879
5865
  } );
@@ -6541,6 +6527,10 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6541
6527
  // set in CSS while `offset*` properties report correct values.
6542
6528
  // Behavior in IE 9 is more subtle than in newer versions & it passes
6543
6529
  // some versions of this test; make sure not to make it pass there!
6530
+ //
6531
+ // Support: Firefox 70+
6532
+ // Only Firefox includes border widths
6533
+ // in computed dimensions. (gh-4529)
6544
6534
  reliableTrDimensions: function() {
6545
6535
  var table, tr, trChild, trStyle;
6546
6536
  if ( reliableTrDimensionsVal == null ) {
@@ -6548,17 +6538,32 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6548
6538
  tr = document.createElement( "tr" );
6549
6539
  trChild = document.createElement( "div" );
6550
6540
 
6551
- table.style.cssText = "position:absolute;left:-11111px";
6541
+ table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
6542
+ tr.style.cssText = "border:1px solid";
6543
+
6544
+ // Support: Chrome 86+
6545
+ // Height set through cssText does not get applied.
6546
+ // Computed height then comes back as 0.
6552
6547
  tr.style.height = "1px";
6553
6548
  trChild.style.height = "9px";
6554
6549
 
6550
+ // Support: Android 8 Chrome 86+
6551
+ // In our bodyBackground.html iframe,
6552
+ // display for all div elements is set to "inline",
6553
+ // which causes a problem only in Android 8 Chrome 86.
6554
+ // Ensuring the div is display: block
6555
+ // gets around this issue.
6556
+ trChild.style.display = "block";
6557
+
6555
6558
  documentElement
6556
6559
  .appendChild( table )
6557
6560
  .appendChild( tr )
6558
6561
  .appendChild( trChild );
6559
6562
 
6560
6563
  trStyle = window.getComputedStyle( tr );
6561
- reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
6564
+ reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
6565
+ parseInt( trStyle.borderTopWidth, 10 ) +
6566
+ parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
6562
6567
 
6563
6568
  documentElement.removeChild( table );
6564
6569
  }
@@ -7022,10 +7027,10 @@ jQuery.each( [ "height", "width" ], function( _i, dimension ) {
7022
7027
  // Running getBoundingClientRect on a disconnected node
7023
7028
  // in IE throws an error.
7024
7029
  ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
7025
- swap( elem, cssShow, function() {
7026
- return getWidthOrHeight( elem, dimension, extra );
7027
- } ) :
7028
- getWidthOrHeight( elem, dimension, extra );
7030
+ swap( elem, cssShow, function() {
7031
+ return getWidthOrHeight( elem, dimension, extra );
7032
+ } ) :
7033
+ getWidthOrHeight( elem, dimension, extra );
7029
7034
  }
7030
7035
  },
7031
7036
 
@@ -7084,7 +7089,7 @@ jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
7084
7089
  swap( elem, { marginLeft: 0 }, function() {
7085
7090
  return elem.getBoundingClientRect().left;
7086
7091
  } )
7087
- ) + "px";
7092
+ ) + "px";
7088
7093
  }
7089
7094
  }
7090
7095
  );
@@ -7223,7 +7228,7 @@ Tween.propHooks = {
7223
7228
  if ( jQuery.fx.step[ tween.prop ] ) {
7224
7229
  jQuery.fx.step[ tween.prop ]( tween );
7225
7230
  } else if ( tween.elem.nodeType === 1 && (
7226
- jQuery.cssHooks[ tween.prop ] ||
7231
+ jQuery.cssHooks[ tween.prop ] ||
7227
7232
  tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
7228
7233
  jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
7229
7234
  } else {
@@ -7468,7 +7473,7 @@ function defaultPrefilter( elem, props, opts ) {
7468
7473
 
7469
7474
  anim.done( function() {
7470
7475
 
7471
- /* eslint-enable no-loop-func */
7476
+ /* eslint-enable no-loop-func */
7472
7477
 
7473
7478
  // The final step of a "hide" animation is actually hiding the element
7474
7479
  if ( !hidden ) {
@@ -7588,7 +7593,7 @@ function Animation( elem, properties, options ) {
7588
7593
  tweens: [],
7589
7594
  createTween: function( prop, end ) {
7590
7595
  var tween = jQuery.Tween( elem, animation.opts, prop, end,
7591
- animation.opts.specialEasing[ prop ] || animation.opts.easing );
7596
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
7592
7597
  animation.tweens.push( tween );
7593
7598
  return tween;
7594
7599
  },
@@ -7761,7 +7766,8 @@ jQuery.fn.extend( {
7761
7766
  anim.stop( true );
7762
7767
  }
7763
7768
  };
7764
- doAnimation.finish = doAnimation;
7769
+
7770
+ doAnimation.finish = doAnimation;
7765
7771
 
7766
7772
  return empty || optall.queue === false ?
7767
7773
  this.each( doAnimation ) :
@@ -8401,8 +8407,8 @@ jQuery.fn.extend( {
8401
8407
  if ( this.setAttribute ) {
8402
8408
  this.setAttribute( "class",
8403
8409
  className || value === false ?
8404
- "" :
8405
- dataPriv.get( this, "__className__" ) || ""
8410
+ "" :
8411
+ dataPriv.get( this, "__className__" ) || ""
8406
8412
  );
8407
8413
  }
8408
8414
  }
@@ -8417,7 +8423,7 @@ jQuery.fn.extend( {
8417
8423
  while ( ( elem = this[ i++ ] ) ) {
8418
8424
  if ( elem.nodeType === 1 &&
8419
8425
  ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
8420
- return true;
8426
+ return true;
8421
8427
  }
8422
8428
  }
8423
8429
 
@@ -8707,9 +8713,7 @@ jQuery.extend( jQuery.event, {
8707
8713
  special.bindType || type;
8708
8714
 
8709
8715
  // jQuery handler
8710
- handle = (
8711
- dataPriv.get( cur, "events" ) || Object.create( null )
8712
- )[ event.type ] &&
8716
+ handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
8713
8717
  dataPriv.get( cur, "handle" );
8714
8718
  if ( handle ) {
8715
8719
  handle.apply( cur, data );
@@ -8856,7 +8860,7 @@ var rquery = ( /\?/ );
8856
8860
 
8857
8861
  // Cross-browser xml parsing
8858
8862
  jQuery.parseXML = function( data ) {
8859
- var xml;
8863
+ var xml, parserErrorElem;
8860
8864
  if ( !data || typeof data !== "string" ) {
8861
8865
  return null;
8862
8866
  }
@@ -8865,12 +8869,17 @@ jQuery.parseXML = function( data ) {
8865
8869
  // IE throws on parseFromString with invalid input.
8866
8870
  try {
8867
8871
  xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8868
- } catch ( e ) {
8869
- xml = undefined;
8870
- }
8872
+ } catch ( e ) {}
8871
8873
 
8872
- if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
8873
- jQuery.error( "Invalid XML: " + data );
8874
+ parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8875
+ if ( !xml || parserErrorElem ) {
8876
+ jQuery.error( "Invalid XML: " + (
8877
+ parserErrorElem ?
8878
+ jQuery.map( parserErrorElem.childNodes, function( el ) {
8879
+ return el.textContent;
8880
+ } ).join( "\n" ) :
8881
+ data
8882
+ ) );
8874
8883
  }
8875
8884
  return xml;
8876
8885
  };
@@ -8971,16 +8980,14 @@ jQuery.fn.extend( {
8971
8980
  // Can add propHook for "elements" to filter or add form elements
8972
8981
  var elements = jQuery.prop( this, "elements" );
8973
8982
  return elements ? jQuery.makeArray( elements ) : this;
8974
- } )
8975
- .filter( function() {
8983
+ } ).filter( function() {
8976
8984
  var type = this.type;
8977
8985
 
8978
8986
  // Use .is( ":disabled" ) so that fieldset[disabled] works
8979
8987
  return this.name && !jQuery( this ).is( ":disabled" ) &&
8980
8988
  rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8981
8989
  ( this.checked || !rcheckableType.test( type ) );
8982
- } )
8983
- .map( function( _i, elem ) {
8990
+ } ).map( function( _i, elem ) {
8984
8991
  var val = jQuery( this ).val();
8985
8992
 
8986
8993
  if ( val == null ) {
@@ -9033,7 +9040,8 @@ var
9033
9040
 
9034
9041
  // Anchor tag for parsing the document origin
9035
9042
  originAnchor = document.createElement( "a" );
9036
- originAnchor.href = location.href;
9043
+
9044
+ originAnchor.href = location.href;
9037
9045
 
9038
9046
  // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
9039
9047
  function addToPrefiltersOrTransports( structure ) {
@@ -9414,8 +9422,8 @@ jQuery.extend( {
9414
9422
  // Context for global events is callbackContext if it is a DOM node or jQuery collection
9415
9423
  globalEventContext = s.context &&
9416
9424
  ( callbackContext.nodeType || callbackContext.jquery ) ?
9417
- jQuery( callbackContext ) :
9418
- jQuery.event,
9425
+ jQuery( callbackContext ) :
9426
+ jQuery.event,
9419
9427
 
9420
9428
  // Deferreds
9421
9429
  deferred = jQuery.Deferred(),
@@ -9727,8 +9735,10 @@ jQuery.extend( {
9727
9735
  response = ajaxHandleResponses( s, jqXHR, responses );
9728
9736
  }
9729
9737
 
9730
- // Use a noop converter for missing script
9731
- if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
9738
+ // Use a noop converter for missing script but not if jsonp
9739
+ if ( !isSuccess &&
9740
+ jQuery.inArray( "script", s.dataTypes ) > -1 &&
9741
+ jQuery.inArray( "json", s.dataTypes ) < 0 ) {
9732
9742
  s.converters[ "text script" ] = function() {};
9733
9743
  }
9734
9744
 
@@ -10466,12 +10476,6 @@ jQuery.offset = {
10466
10476
  options.using.call( elem, props );
10467
10477
 
10468
10478
  } else {
10469
- if ( typeof props.top === "number" ) {
10470
- props.top += "px";
10471
- }
10472
- if ( typeof props.left === "number" ) {
10473
- props.left += "px";
10474
- }
10475
10479
  curElem.css( props );
10476
10480
  }
10477
10481
  }
@@ -10640,8 +10644,11 @@ jQuery.each( [ "top", "left" ], function( _i, prop ) {
10640
10644
 
10641
10645
  // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10642
10646
  jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10643
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
10644
- function( defaultExtra, funcName ) {
10647
+ jQuery.each( {
10648
+ padding: "inner" + name,
10649
+ content: type,
10650
+ "": "outer" + name
10651
+ }, function( defaultExtra, funcName ) {
10645
10652
 
10646
10653
  // Margin is only for outerHeight, outerWidth
10647
10654
  jQuery.fn[ funcName ] = function( margin, value ) {
@@ -10726,7 +10733,8 @@ jQuery.fn.extend( {
10726
10733
  }
10727
10734
  } );
10728
10735
 
10729
- jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10736
+ jQuery.each(
10737
+ ( "blur focus focusin focusout resize scroll click dblclick " +
10730
10738
  "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10731
10739
  "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10732
10740
  function( _i, name ) {
@@ -10737,7 +10745,8 @@ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10737
10745
  this.on( name, null, data, fn ) :
10738
10746
  this.trigger( name );
10739
10747
  };
10740
- } );
10748
+ }
10749
+ );
10741
10750
 
10742
10751
 
10743
10752