activeadmin 2.6.1 → 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +438 -9
- data/CONTRIBUTING.md +12 -36
- data/README.md +8 -8
- data/app/assets/javascripts/active_admin/base.js +27 -25
- data/app/assets/stylesheets/active_admin/_base.scss +53 -37
- data/app/assets/stylesheets/active_admin/_forms.scss +2 -13
- data/app/assets/stylesheets/active_admin/_header.scss +37 -3
- data/app/assets/stylesheets/active_admin/_normalize.scss +25 -123
- data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
- data/app/assets/stylesheets/active_admin/components/_date_picker.scss +1 -2
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +7 -5
- data/app/assets/stylesheets/active_admin/components/_pagination.scss +5 -2
- data/app/assets/stylesheets/active_admin/components/_table_tools.scss +9 -6
- data/app/assets/stylesheets/active_admin/components/_tabs.scss +10 -7
- data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +2 -2
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +12 -0
- data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +1 -1
- data/app/assets/stylesheets/active_admin/structure/_footer.scss +6 -1
- data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +6 -4
- data/app/javascript/active_admin/initializers/has-many.js +4 -1
- data/app/javascript/active_admin/initializers/per-page.js +1 -1
- data/app/javascript/active_admin/lib/checkbox-toggler.js +3 -3
- data/app/javascript/active_admin/lib/dropdown-menu.js +1 -1
- data/app/javascript/active_admin/lib/modal-dialog.js +7 -7
- data/app/javascript/active_admin/lib/per-page.js +1 -1
- data/app/javascript/active_admin/lib/table-checkbox-toggler.js +1 -1
- data/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/active_admin/devise/mailer/unlock_instructions.html.erb +2 -2
- data/app/views/active_admin/devise/shared/_links.erb +1 -1
- data/app/views/active_admin/page/index.html.arb +1 -0
- data/app/views/active_admin/resource/edit.html.arb +1 -0
- data/app/views/active_admin/resource/index.html.arb +1 -0
- data/app/views/active_admin/resource/new.html.arb +1 -0
- data/app/views/active_admin/resource/show.html.arb +1 -0
- data/app/views/layouts/active_admin.html.arb +1 -0
- data/app/views/layouts/active_admin_logged_out.html.erb +18 -7
- data/config/locales/ar.yml +6 -13
- data/config/locales/az.yml +0 -7
- data/config/locales/bg.yml +0 -7
- data/config/locales/bs.yml +0 -7
- data/config/locales/ca.yml +0 -7
- data/config/locales/cs.yml +0 -7
- data/config/locales/da.yml +0 -7
- data/config/locales/de-CH.yml +0 -7
- data/config/locales/de.yml +0 -8
- data/config/locales/el.yml +0 -7
- data/config/locales/en-CA.yml +0 -7
- data/config/locales/en-GB.yml +0 -7
- data/config/locales/en.yml +0 -8
- data/config/locales/eo.yml +0 -8
- data/config/locales/es-MX.yml +2 -8
- data/config/locales/es.yml +2 -10
- data/config/locales/fa.yml +0 -7
- data/config/locales/fi.yml +0 -7
- data/config/locales/fr.yml +3 -11
- data/config/locales/he.yml +0 -9
- data/config/locales/hr.yml +0 -7
- data/config/locales/hu.yml +0 -8
- data/config/locales/id.yml +0 -7
- data/config/locales/it.yml +18 -8
- data/config/locales/ja.yml +2 -10
- data/config/locales/ko.yml +1 -8
- data/config/locales/lt.yml +0 -8
- data/config/locales/lv.yml +0 -7
- data/config/locales/mk.yml +0 -8
- data/config/locales/nb.yml +0 -8
- data/config/locales/nl.yml +1 -9
- data/config/locales/pl.yml +0 -8
- data/config/locales/pt-BR.yml +0 -8
- data/config/locales/pt-PT.yml +0 -7
- data/config/locales/ro.yml +3 -9
- data/config/locales/ru.yml +0 -6
- data/config/locales/sk.yml +0 -8
- data/config/locales/sv-SE.yml +58 -39
- data/config/locales/tr.yml +0 -11
- data/config/locales/uk.yml +0 -6
- data/config/locales/vi.yml +38 -19
- data/config/locales/zh-CN.yml +34 -23
- data/config/locales/zh-TW.yml +0 -7
- data/lib/active_admin/abstract_view_factory.rb +1 -0
- data/lib/active_admin/application.rb +19 -19
- data/lib/active_admin/application_settings.rb +4 -3
- data/lib/active_admin/asset_registration.rb +4 -3
- data/lib/active_admin/authorization_adapter.rb +6 -3
- data/lib/active_admin/base_controller/authorization.rb +15 -13
- data/lib/active_admin/base_controller/menu.rb +1 -0
- data/lib/active_admin/base_controller.rb +6 -5
- data/lib/active_admin/batch_actions/controller.rb +4 -3
- data/lib/active_admin/batch_actions/resource_extension.rb +10 -8
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +4 -3
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +7 -6
- data/lib/active_admin/batch_actions/views/selection_cells.rb +4 -3
- data/lib/active_admin/batch_actions.rb +1 -0
- data/lib/active_admin/callbacks.rb +1 -0
- data/lib/active_admin/cancan_adapter.rb +2 -1
- data/lib/active_admin/collection_decorator.rb +32 -0
- data/lib/active_admin/component.rb +1 -0
- data/lib/active_admin/controller_action.rb +1 -0
- data/lib/active_admin/csv_builder.rb +25 -17
- data/lib/active_admin/dependency.rb +12 -15
- data/lib/active_admin/devise.rb +16 -5
- data/lib/active_admin/dsl.rb +2 -1
- data/lib/active_admin/dynamic_setting.rb +1 -0
- data/lib/active_admin/dynamic_settings_node.rb +3 -2
- data/lib/active_admin/engine.rb +17 -9
- data/lib/active_admin/error.rb +1 -2
- data/lib/active_admin/filters/active.rb +2 -1
- data/lib/active_admin/filters/active_filter.rb +6 -6
- data/lib/active_admin/filters/active_sidebar.rb +4 -30
- data/lib/active_admin/filters/dsl.rb +1 -0
- data/lib/active_admin/filters/forms.rb +9 -8
- data/lib/active_admin/filters/formtastic_addons.rb +3 -7
- data/lib/active_admin/filters/resource_extension.rb +6 -5
- data/lib/active_admin/filters.rb +8 -7
- data/lib/active_admin/form_builder.rb +25 -20
- data/lib/active_admin/generators/boilerplate.rb +2 -1
- data/lib/active_admin/helpers/collection.rb +2 -0
- data/lib/active_admin/helpers/i18n.rb +1 -0
- data/lib/active_admin/helpers/optional_display.rb +3 -2
- data/lib/active_admin/helpers/routes/url_helpers.rb +1 -0
- data/lib/active_admin/helpers/scope_chain.rb +1 -0
- data/lib/active_admin/inputs/datepicker_input.rb +2 -1
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +7 -6
- data/lib/active_admin/inputs/filters/base.rb +2 -1
- data/lib/active_admin/inputs/filters/boolean_input.rb +2 -1
- data/lib/active_admin/inputs/filters/check_boxes_input.rb +2 -1
- data/lib/active_admin/inputs/filters/date_picker_input.rb +1 -0
- data/lib/active_admin/inputs/filters/date_range_input.rb +3 -2
- data/lib/active_admin/inputs/filters/numeric_input.rb +2 -1
- data/lib/active_admin/inputs/filters/select_input.rb +5 -2
- data/lib/active_admin/inputs/filters/string_input.rb +2 -1
- data/lib/active_admin/inputs/filters/text_input.rb +1 -0
- data/lib/active_admin/inputs.rb +1 -0
- data/lib/active_admin/localizers/resource_localizer.rb +4 -3
- data/lib/active_admin/localizers.rb +2 -1
- data/lib/active_admin/menu.rb +8 -3
- data/lib/active_admin/menu_collection.rb +1 -0
- data/lib/active_admin/menu_item.rb +8 -7
- data/lib/active_admin/namespace.rb +16 -15
- data/lib/active_admin/namespace_settings.rb +9 -5
- data/lib/active_admin/order_clause.rb +2 -1
- data/lib/active_admin/orm/active_record/comments/comment.rb +12 -3
- data/lib/active_admin/orm/active_record/comments/namespace_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/resource_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +1 -0
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +21 -20
- data/lib/active_admin/orm/active_record/comments/views.rb +3 -2
- data/lib/active_admin/orm/active_record/comments.rb +28 -27
- data/lib/active_admin/orm/active_record.rb +2 -1
- data/lib/active_admin/orm/mongoid.rb +1 -0
- data/lib/active_admin/page.rb +2 -1
- data/lib/active_admin/page_controller.rb +1 -0
- data/lib/active_admin/page_dsl.rb +1 -0
- data/lib/active_admin/page_presenter.rb +1 -0
- data/lib/active_admin/pundit_adapter.rb +58 -16
- data/lib/active_admin/resource/action_items.rb +6 -5
- data/lib/active_admin/resource/attributes.rb +9 -1
- data/lib/active_admin/resource/belongs_to.rb +3 -2
- data/lib/active_admin/resource/controllers.rb +2 -1
- data/lib/active_admin/resource/includes.rb +1 -0
- data/lib/active_admin/resource/menu.rb +5 -4
- data/lib/active_admin/resource/model.rb +1 -0
- data/lib/active_admin/resource/naming.rb +5 -4
- data/lib/active_admin/resource/ordering.rb +1 -0
- data/lib/active_admin/resource/page_presenters.rb +1 -0
- data/lib/active_admin/resource/pagination.rb +1 -0
- data/lib/active_admin/resource/routes.rb +6 -7
- data/lib/active_admin/resource/scope_to.rb +8 -7
- data/lib/active_admin/resource/scopes.rb +1 -0
- data/lib/active_admin/resource/sidebars.rb +2 -1
- data/lib/active_admin/resource.rb +20 -19
- data/lib/active_admin/resource_collection.rb +1 -0
- data/lib/active_admin/resource_controller/action_builder.rb +1 -0
- data/lib/active_admin/resource_controller/data_access.rb +31 -5
- data/lib/active_admin/resource_controller/decorators.rb +7 -28
- data/lib/active_admin/resource_controller/polymorphic_routes.rb +1 -0
- data/lib/active_admin/resource_controller/resource_class_methods.rb +1 -0
- data/lib/active_admin/resource_controller/scoping.rb +1 -0
- data/lib/active_admin/resource_controller/sidebars.rb +1 -0
- data/lib/active_admin/resource_controller/streaming.rb +9 -7
- data/lib/active_admin/resource_controller.rb +13 -11
- data/lib/active_admin/resource_dsl.rb +11 -25
- data/lib/active_admin/router.rb +1 -0
- data/lib/active_admin/scope.rb +7 -6
- data/lib/active_admin/settings_node.rb +1 -0
- data/lib/active_admin/sidebar_section.rb +1 -0
- data/lib/active_admin/version.rb +2 -1
- data/lib/active_admin/view_factory.rb +18 -17
- data/lib/active_admin/view_helpers/active_admin_application_helper.rb +1 -0
- data/lib/active_admin/view_helpers/auto_link_helper.rb +2 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +4 -3
- data/lib/active_admin/view_helpers/display_helper.rb +23 -8
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +2 -1
- data/lib/active_admin/view_helpers/fields_for.rb +3 -2
- data/lib/active_admin/view_helpers/flash_helper.rb +1 -0
- data/lib/active_admin/view_helpers/form_helper.rb +1 -0
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -0
- data/lib/active_admin/view_helpers/scope_name_helper.rb +1 -0
- data/lib/active_admin/view_helpers/sidebar_helper.rb +1 -0
- data/lib/active_admin/view_helpers/title_helper.rb +1 -0
- data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -0
- data/lib/active_admin/view_helpers.rb +2 -1
- data/lib/active_admin/views/action_items.rb +1 -0
- data/lib/active_admin/views/components/active_admin_form.rb +8 -11
- data/lib/active_admin/views/components/active_filters_sidebar_content.rb +59 -0
- data/lib/active_admin/views/components/attributes_table.rb +6 -5
- data/lib/active_admin/views/components/blank_slate.rb +2 -1
- data/lib/active_admin/views/components/columns.rb +1 -0
- data/lib/active_admin/views/components/dropdown_menu.rb +7 -9
- data/lib/active_admin/views/components/index_list.rb +4 -3
- data/lib/active_admin/views/components/menu.rb +2 -1
- data/lib/active_admin/views/components/menu_item.rb +5 -4
- data/lib/active_admin/views/components/paginated_collection.rb +19 -18
- data/lib/active_admin/views/components/panel.rb +2 -1
- data/lib/active_admin/views/components/scopes.rb +8 -5
- data/lib/active_admin/views/components/sidebar.rb +1 -0
- data/lib/active_admin/views/components/sidebar_section.rb +1 -0
- data/lib/active_admin/views/components/site_title.rb +2 -1
- data/lib/active_admin/views/components/status_tag.rb +12 -11
- data/lib/active_admin/views/components/table_for.rb +18 -17
- data/lib/active_admin/views/components/tabs.rb +4 -3
- data/lib/active_admin/views/components/unsupported_browser.rb +1 -0
- data/lib/active_admin/views/footer.rb +3 -1
- data/lib/active_admin/views/header.rb +3 -2
- data/lib/active_admin/views/index_as_block.rb +1 -0
- data/lib/active_admin/views/index_as_blog.rb +2 -1
- data/lib/active_admin/views/index_as_grid.rb +2 -1
- data/lib/active_admin/views/index_as_table.rb +16 -19
- data/lib/active_admin/views/pages/base.rb +17 -11
- data/lib/active_admin/views/pages/form.rb +1 -0
- data/lib/active_admin/views/pages/index.rb +15 -13
- data/lib/active_admin/views/pages/layout.rb +1 -0
- data/lib/active_admin/views/pages/page.rb +1 -0
- data/lib/active_admin/views/pages/show.rb +2 -7
- data/lib/active_admin/views/tabbed_navigation.rb +3 -2
- data/lib/active_admin/views/title_bar.rb +2 -1
- data/lib/active_admin/views.rb +2 -1
- data/lib/active_admin.rb +63 -61
- data/lib/activeadmin.rb +2 -1
- data/lib/generators/active_admin/assets/assets_generator.rb +3 -2
- data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
- data/lib/generators/active_admin/devise/devise_generator.rb +6 -5
- data/lib/generators/active_admin/install/install_generator.rb +15 -8
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +27 -3
- data/lib/generators/active_admin/install/templates/dashboard.rb +1 -0
- data/lib/generators/active_admin/page/page_generator.rb +2 -1
- data/lib/generators/active_admin/page/templates/page.rb +1 -0
- data/lib/generators/active_admin/resource/resource_generator.rb +4 -3
- data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
- data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
- data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
- data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
- data/lib/generators/active_admin/webpacker/webpacker_generator.rb +27 -0
- data/vendor/assets/javascripts/jquery-ui/data.js +12 -8
- data/vendor/assets/javascripts/jquery-ui/disable-selection.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/focusable.js +12 -9
- data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +60 -57
- data/vendor/assets/javascripts/jquery-ui/form.js +15 -12
- data/vendor/assets/javascripts/jquery-ui/ie.js +5 -2
- data/vendor/assets/javascripts/jquery-ui/keycode.js +11 -7
- data/vendor/assets/javascripts/jquery-ui/labels.js +46 -40
- data/vendor/assets/javascripts/jquery-ui/plugin.js +5 -2
- data/vendor/assets/javascripts/jquery-ui/position.js +30 -17
- data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
- data/vendor/assets/javascripts/jquery-ui/safe-blur.js +6 -2
- data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/tabbable.js +11 -8
- data/vendor/assets/javascripts/jquery-ui/unique-id.js +10 -7
- data/vendor/assets/javascripts/jquery-ui/version.js +6 -3
- data/vendor/assets/javascripts/jquery-ui/widget.js +53 -30
- data/vendor/assets/javascripts/jquery-ui/widgets/button.js +87 -24
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +276 -273
- data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +15 -11
- data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +182 -62
- data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +53 -36
- data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +28 -19
- data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +22 -11
- data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +47 -26
- data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +186 -125
- data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +20 -20
- metadata +48 -114
- data/docs/.gitignore +0 -1
- data/docs/0-installation.md +0 -118
- data/docs/1-general-configuration.md +0 -224
- data/docs/10-custom-pages.md +0 -150
- data/docs/11-decorators.md +0 -59
- data/docs/12-arbre-components.md +0 -214
- data/docs/13-authorization-adapter.md +0 -285
- data/docs/14-gotchas.md +0 -138
- data/docs/2-resource-customization.md +0 -466
- data/docs/3-index-pages/custom-index.md +0 -35
- data/docs/3-index-pages/index-as-block.md +0 -19
- data/docs/3-index-pages/index-as-blog.md +0 -69
- data/docs/3-index-pages/index-as-grid.md +0 -27
- data/docs/3-index-pages/index-as-table.md +0 -234
- data/docs/3-index-pages.md +0 -328
- data/docs/4-csv-format.md +0 -74
- data/docs/5-forms.md +0 -232
- data/docs/6-show-pages.md +0 -81
- data/docs/7-sidebars.md +0 -75
- data/docs/8-custom-actions.md +0 -177
- data/docs/9-batch-actions.md +0 -237
- data/docs/CNAME +0 -1
- data/docs/Gemfile +0 -3
- data/docs/Gemfile.lock +0 -248
- data/docs/README.md +0 -24
- data/docs/_config.yml +0 -4
- data/docs/_includes/footer.html +0 -8
- data/docs/_includes/google-analytics.html +0 -16
- data/docs/_includes/head.html +0 -7
- data/docs/_includes/toc.html +0 -98
- data/docs/_includes/top-menu.html +0 -17
- data/docs/_layouts/default.html +0 -21
- data/docs/documentation.md +0 -60
- data/docs/images/activeadmin.png +0 -0
- data/docs/images/code-header.png +0 -0
- data/docs/images/divider.png +0 -0
- data/docs/images/features.png +0 -0
- data/docs/images/tidelift.svg +0 -14
- data/docs/index.html +0 -226
- data/docs/stylesheets/main.css +0 -1205
- data/lib/active_admin/deprecation.rb +0 -10
- data/lib/ransack_ext.rb +0 -20
- data/vendor/assets/javascripts/jquery-ui/escape-selector.js +0 -23
- /data/app/assets/stylesheets/active_admin/{print.scss → _print.scss} +0 -0
@@ -1,27 +1,28 @@
|
|
1
1
|
//= require jquery-ui/version
|
2
2
|
//= require jquery-ui/keycode
|
3
3
|
|
4
|
-
|
5
|
-
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
4
|
+
/* eslint-disable max-len, camelcase */
|
6
5
|
/*!
|
7
|
-
* jQuery UI Datepicker 1.
|
8
|
-
*
|
6
|
+
* jQuery UI Datepicker 1.13.3
|
7
|
+
* https://jqueryui.com
|
9
8
|
*
|
10
|
-
* Copyright
|
9
|
+
* Copyright OpenJS Foundation and other contributors
|
11
10
|
* Released under the MIT license.
|
12
|
-
*
|
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:
|
19
|
-
//>>demos:
|
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.
|
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
|
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
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
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
|
-
//
|
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() {
|
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
|
-
|
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() {
|
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
|
-
|
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
|
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.
|
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 ).
|
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
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
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
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
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 =
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
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='#'
|
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.
|
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.
|
17
|
-
*
|
16
|
+
* jQuery UI Dialog 1.13.3
|
17
|
+
* https://jqueryui.com
|
18
18
|
*
|
19
|
-
* Copyright
|
19
|
+
* Copyright OpenJS Foundation and other contributors
|
20
20
|
* Released under the MIT license.
|
21
|
-
*
|
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:
|
28
|
-
//>>demos:
|
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.
|
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
|
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
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
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
|
-
|
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(
|
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.
|
387
|
-
last = tabbables.
|
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 ) || (
|
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 =
|
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
|
-
//
|
881
|
-
//
|
882
|
-
this.
|
883
|
-
|
884
|
-
|
885
|
-
|
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
|
-
|
889
|
-
|
890
|
-
|
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.
|
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
|
+
} );
|