activeadmin 3.2.3 → 4.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -57
- data/CONTRIBUTING.md +25 -108
- data/README.md +19 -32
- data/app/assets/config/active_admin_manifest.js +2 -0
- data/app/controllers/active_admin/base_controller/menu.rb +39 -0
- data/{lib → app/controllers}/active_admin/base_controller.rb +46 -18
- data/{lib → app/controllers}/active_admin/page_controller.rb +0 -4
- data/{lib → app/controllers}/active_admin/resource_controller/action_builder.rb +1 -1
- data/{lib → app/controllers}/active_admin/resource_controller/data_access.rb +2 -2
- data/{lib → app/controllers}/active_admin/resource_controller/scoping.rb +1 -1
- data/{lib → app/controllers}/active_admin/resource_controller/streaming.rb +2 -2
- data/app/controllers/active_admin/resource_controller.rb +102 -0
- data/app/helpers/active_admin/auto_link_helper.rb +66 -0
- data/app/helpers/active_admin/breadcrumb_helper.rb +41 -0
- data/app/helpers/active_admin/display_helper.rb +117 -0
- data/app/helpers/active_admin/form_helper.rb +95 -0
- data/app/helpers/active_admin/index_helper.rb +40 -0
- data/app/helpers/active_admin/layout_helper.rb +63 -0
- data/app/javascript/active_admin/features/batch_actions.js +89 -0
- data/app/javascript/active_admin/features/dark_mode_toggle.js +37 -0
- data/app/javascript/active_admin/features/filters.js +34 -0
- data/app/javascript/active_admin/features/has_many.js +28 -0
- data/app/javascript/active_admin/features/main_menu.js +12 -0
- data/app/javascript/active_admin/features/per_page.js +9 -0
- data/app/javascript/active_admin/utils/dom.js +17 -0
- data/app/javascript/active_admin.js +10 -0
- data/app/views/active_admin/_flash_messages.html.erb +22 -0
- data/app/views/active_admin/_html_head.html.erb +13 -0
- data/app/views/active_admin/_main_navigation.html.erb +28 -0
- data/app/views/active_admin/_page_header.html.erb +27 -0
- data/app/views/active_admin/_sidebar.html.erb +5 -0
- data/app/views/active_admin/_site_footer.html.erb +7 -0
- data/app/views/active_admin/_site_header.html.erb +30 -0
- data/app/views/active_admin/devise/confirmations/new.html.erb +5 -3
- data/app/views/active_admin/devise/passwords/edit.html.erb +5 -3
- data/app/views/active_admin/devise/passwords/new.html.erb +5 -4
- data/app/views/active_admin/devise/registrations/new.html.erb +6 -4
- data/app/views/active_admin/devise/sessions/new.html.erb +6 -4
- data/app/views/active_admin/devise/shared/_links.erb +3 -1
- data/app/views/active_admin/devise/unlocks/new.html.erb +6 -4
- data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_gap.html.erb +3 -1
- data/app/views/active_admin/kaminari/_next_page.html.erb +16 -0
- data/app/views/active_admin/kaminari/_page.html.erb +14 -0
- data/app/views/{kaminari/active_admin_countless → active_admin/kaminari}/_paginator.html.erb +1 -2
- data/app/views/active_admin/kaminari/_prev_page.html.erb +16 -0
- data/app/views/active_admin/page/index.html.arb +5 -1
- data/app/views/active_admin/resource/_active_filters.html.erb +32 -0
- data/app/views/active_admin/resource/_batch_actions_dropdown.html.erb +19 -0
- data/app/views/active_admin/resource/_form.html.arb +16 -0
- data/app/views/active_admin/resource/_form_default.html.arb +12 -0
- data/app/views/active_admin/resource/_index_as_table_default.html.arb +9 -0
- data/app/views/active_admin/resource/_index_blank_slate.html.erb +14 -0
- data/app/views/active_admin/resource/_index_empty_results.html.erb +5 -0
- data/app/views/active_admin/resource/_index_table_actions_default.html.erb +9 -0
- data/app/views/active_admin/resource/_show_default.html.arb +3 -0
- data/app/views/active_admin/resource/edit.html.arb +1 -1
- data/app/views/active_admin/resource/index.html.arb +94 -1
- data/app/views/active_admin/resource/new.html.arb +1 -1
- data/app/views/active_admin/resource/show.html.arb +12 -1
- data/app/views/active_admin/shared/_action_items.html.erb +3 -0
- data/app/views/active_admin/shared/_download_format_links.html.erb +7 -0
- data/app/views/active_admin/shared/_resource_comments.html.erb +51 -0
- data/app/views/active_admin/shared/_sidebar_section.html.arb +7 -0
- data/app/views/active_admin/shared/_sidebar_sections.html.erb +5 -0
- data/app/views/layouts/active_admin.html.erb +20 -0
- data/app/views/layouts/active_admin_logged_out.html.erb +8 -45
- data/config/locales/ar.yml +0 -16
- data/config/locales/az.yml +0 -16
- data/config/locales/bg.yml +0 -9
- data/config/locales/bs.yml +0 -7
- data/config/locales/ca.yml +0 -9
- data/config/locales/cs.yml +0 -9
- data/config/locales/da.yml +0 -16
- data/config/locales/de-CH.yml +0 -10
- data/config/locales/de.yml +0 -16
- data/config/locales/el.yml +0 -13
- data/config/locales/en-CA.yml +0 -16
- data/config/locales/en-GB.yml +0 -16
- data/config/locales/en.yml +18 -28
- data/config/locales/eo.yml +0 -17
- data/config/locales/es-MX.yml +0 -9
- data/config/locales/es.yml +0 -16
- data/config/locales/fa.yml +0 -9
- data/config/locales/fi.yml +0 -9
- data/config/locales/fr.yml +32 -26
- data/config/locales/he.yml +0 -16
- data/config/locales/hr.yml +0 -9
- data/config/locales/hu.yml +0 -6
- data/config/locales/id.yml +0 -16
- data/config/locales/it.yml +0 -16
- data/config/locales/ja.yml +0 -16
- data/config/locales/ko.yml +0 -9
- data/config/locales/lt.yml +0 -16
- data/config/locales/lv.yml +0 -6
- data/config/locales/mk.yml +0 -15
- data/config/locales/nb.yml +0 -12
- data/config/locales/nl.yml +21 -29
- data/config/locales/pl.yml +0 -16
- data/config/locales/pt-BR.yml +0 -16
- data/config/locales/pt-PT.yml +0 -6
- data/config/locales/ro.yml +0 -6
- data/config/locales/ru.yml +0 -16
- data/config/locales/sk.yml +0 -16
- data/config/locales/sv-SE.yml +0 -16
- data/config/locales/tr.yml +0 -16
- data/config/locales/uk.yml +0 -16
- data/config/locales/vi.yml +0 -16
- data/config/locales/zh-CN.yml +0 -16
- data/config/locales/zh-TW.yml +0 -16
- data/lib/active_admin/application.rb +1 -9
- data/lib/active_admin/batch_actions/controller.rb +1 -4
- data/lib/active_admin/batch_actions/resource_extension.rb +6 -13
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +0 -6
- data/lib/active_admin/batch_actions/views/selection_cells.rb +2 -2
- data/lib/active_admin/batch_actions.rb +0 -5
- data/lib/active_admin/callbacks.rb +6 -4
- data/lib/active_admin/component.rb +0 -1
- data/lib/active_admin/csv_builder.rb +1 -1
- data/lib/active_admin/devise.rb +3 -3
- data/lib/active_admin/dsl.rb +2 -2
- data/lib/active_admin/dynamic_settings_node.rb +4 -4
- data/lib/active_admin/engine.rb +19 -6
- data/lib/active_admin/filters/active.rb +6 -4
- data/lib/active_admin/filters/active_filter.rb +1 -3
- data/lib/active_admin/filters/forms.rb +1 -42
- data/lib/active_admin/filters/resource_extension.rb +17 -9
- data/lib/active_admin/filters.rb +0 -2
- data/lib/active_admin/form_builder.rb +15 -14
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +8 -10
- data/lib/active_admin/inputs/filters/base.rb +1 -1
- data/lib/active_admin/inputs/filters/check_boxes_input.rb +1 -6
- data/lib/active_admin/inputs/filters/date_range_input.rb +4 -2
- data/lib/active_admin/inputs.rb +0 -3
- data/lib/active_admin/menu.rb +10 -7
- data/lib/active_admin/menu_collection.rb +1 -1
- data/lib/active_admin/menu_item.rb +24 -3
- data/lib/active_admin/namespace.rb +2 -44
- data/lib/active_admin/namespace_settings.rb +2 -35
- data/lib/active_admin/order_clause.rb +4 -1
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +3 -75
- data/lib/active_admin/orm/active_record/comments.rb +10 -5
- data/lib/active_admin/pundit_adapter.rb +1 -1
- data/lib/active_admin/resource/action_items.rb +15 -20
- data/lib/active_admin/resource/attributes.rb +1 -8
- data/lib/active_admin/resource/naming.rb +1 -2
- data/lib/active_admin/resource.rb +1 -0
- data/lib/active_admin/resource_dsl.rb +1 -1
- data/lib/active_admin/scope.rb +1 -1
- data/lib/active_admin/settings_node.rb +1 -1
- data/lib/active_admin/sidebar_section.rb +0 -5
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers.rb +0 -12
- data/lib/active_admin/views/components/active_admin_form.rb +20 -16
- data/lib/active_admin/views/components/attributes_table.rb +4 -12
- data/lib/active_admin/views/components/index_list.rb +10 -23
- data/lib/active_admin/views/components/paginated_collection.rb +34 -39
- data/lib/active_admin/views/components/panel.rb +2 -10
- data/lib/active_admin/views/components/scopes.rb +12 -21
- data/lib/active_admin/views/components/status_tag.rb +22 -19
- data/lib/active_admin/views/components/table_for.rb +19 -24
- data/lib/active_admin/views/components/tabs.rb +10 -11
- data/lib/active_admin/views/index_as_table.rb +24 -97
- data/lib/active_admin.rb +7 -11
- data/lib/generators/active_admin/assets/assets_generator.rb +4 -4
- data/lib/generators/active_admin/assets/templates/active_admin.css +3 -0
- data/lib/generators/active_admin/assets/templates/tailwind.config.js +18 -0
- data/lib/generators/active_admin/install/install_generator.rb +2 -8
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +10 -87
- data/lib/generators/active_admin/install/templates/dashboard.rb +8 -25
- data/lib/generators/active_admin/page/page_generator.rb +0 -1
- data/lib/generators/active_admin/resource/resource_generator.rb +46 -7
- data/lib/generators/active_admin/resource/templates/resource.rb.erb +42 -0
- data/lib/generators/active_admin/views_generator.rb +18 -0
- metadata +67 -214
- data/app/assets/javascripts/active_admin/base.js +0 -521
- data/app/assets/stylesheets/active_admin/_base.scss +0 -57
- data/app/assets/stylesheets/active_admin/_forms.scss +0 -315
- data/app/assets/stylesheets/active_admin/_header.scss +0 -188
- data/app/assets/stylesheets/active_admin/_mixins.scss +0 -1
- data/app/assets/stylesheets/active_admin/_normalize.scss +0 -349
- data/app/assets/stylesheets/active_admin/_print.scss +0 -287
- data/app/assets/stylesheets/active_admin/_typography.scss +0 -100
- data/app/assets/stylesheets/active_admin/components/_batch_actions.scss +0 -6
- data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +0 -30
- data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +0 -20
- data/app/assets/stylesheets/active_admin/components/_buttons.scss +0 -6
- data/app/assets/stylesheets/active_admin/components/_columns.scss +0 -3
- data/app/assets/stylesheets/active_admin/components/_comments.scss +0 -41
- data/app/assets/stylesheets/active_admin/components/_date_picker.scss +0 -148
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +0 -154
- data/app/assets/stylesheets/active_admin/components/_flash_messages.scss +0 -37
- data/app/assets/stylesheets/active_admin/components/_grid.scss +0 -9
- data/app/assets/stylesheets/active_admin/components/_index_list.scss +0 -12
- data/app/assets/stylesheets/active_admin/components/_links.scss +0 -5
- data/app/assets/stylesheets/active_admin/components/_modal_dialog.scss +0 -34
- data/app/assets/stylesheets/active_admin/components/_pagination.scss +0 -58
- data/app/assets/stylesheets/active_admin/components/_panels.scss +0 -6
- data/app/assets/stylesheets/active_admin/components/_scopes.scss +0 -13
- data/app/assets/stylesheets/active_admin/components/_status_tags.scss +0 -12
- data/app/assets/stylesheets/active_admin/components/_table_tools.scss +0 -70
- data/app/assets/stylesheets/active_admin/components/_tables.scss +0 -112
- data/app/assets/stylesheets/active_admin/components/_tabs.scss +0 -68
- data/app/assets/stylesheets/active_admin/components/_unsupported_browser.scss +0 -16
- data/app/assets/stylesheets/active_admin/mixins/_all.scss +0 -8
- data/app/assets/stylesheets/active_admin/mixins/_buttons.scss +0 -65
- data/app/assets/stylesheets/active_admin/mixins/_gradients.scss +0 -28
- data/app/assets/stylesheets/active_admin/mixins/_rounded.scss +0 -22
- data/app/assets/stylesheets/active_admin/mixins/_sections.scss +0 -41
- data/app/assets/stylesheets/active_admin/mixins/_shadows.scss +0 -15
- data/app/assets/stylesheets/active_admin/mixins/_typography.scss +0 -3
- data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +0 -17
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +0 -51
- data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +0 -44
- data/app/assets/stylesheets/active_admin/structure/_footer.scss +0 -19
- data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +0 -29
- data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -43
- data/app/javascript/active_admin/base.js +0 -28
- data/app/javascript/active_admin/ext/jquery-ui.js +0 -7
- data/app/javascript/active_admin/ext/jquery.js +0 -9
- data/app/javascript/active_admin/initializers/batch-actions.js +0 -61
- data/app/javascript/active_admin/initializers/checkbox-toggler.js +0 -3
- data/app/javascript/active_admin/initializers/datepicker.js +0 -16
- data/app/javascript/active_admin/initializers/dropdown-menu.js +0 -9
- data/app/javascript/active_admin/initializers/filters.js +0 -10
- data/app/javascript/active_admin/initializers/has-many.js +0 -98
- data/app/javascript/active_admin/initializers/per-page.js +0 -13
- data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +0 -3
- data/app/javascript/active_admin/initializers/tabs.js +0 -6
- data/app/javascript/active_admin/lib/checkbox-toggler.js +0 -49
- data/app/javascript/active_admin/lib/dropdown-menu.js +0 -116
- data/app/javascript/active_admin/lib/filters.js +0 -39
- data/app/javascript/active_admin/lib/modal-dialog.js +0 -63
- data/app/javascript/active_admin/lib/per-page.js +0 -38
- data/app/javascript/active_admin/lib/table-checkbox-toggler.js +0 -38
- data/app/javascript/active_admin/lib/utils.js +0 -40
- data/app/views/kaminari/active_admin/_first_page.html.erb +0 -11
- data/app/views/kaminari/active_admin/_gap.html.erb +0 -8
- data/app/views/kaminari/active_admin/_last_page.html.erb +0 -11
- data/app/views/kaminari/active_admin/_next_page.html.erb +0 -11
- data/app/views/kaminari/active_admin/_page.html.erb +0 -12
- data/app/views/kaminari/active_admin/_paginator.html.erb +0 -25
- data/app/views/kaminari/active_admin/_prev_page.html.erb +0 -11
- data/app/views/kaminari/active_admin_countless/_first_page.html.erb +0 -11
- data/app/views/kaminari/active_admin_countless/_next_page.html.erb +0 -11
- data/app/views/kaminari/active_admin_countless/_page.html.erb +0 -12
- data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +0 -11
- data/app/views/layouts/active_admin.html.arb +0 -2
- data/lib/active_admin/abstract_view_factory.rb +0 -48
- data/lib/active_admin/asset_registration.rb +0 -30
- data/lib/active_admin/base_controller/menu.rb +0 -35
- data/lib/active_admin/batch_actions/views/batch_action_selector.rb +0 -59
- data/lib/active_admin/filters/active_sidebar.rb +0 -28
- data/lib/active_admin/generators/boilerplate.rb +0 -54
- data/lib/active_admin/helpers/collection.rb +0 -21
- data/lib/active_admin/helpers/i18n.rb +0 -8
- data/lib/active_admin/inputs/datepicker_input.rb +0 -28
- data/lib/active_admin/inputs/filters/date_picker_input.rb +0 -14
- data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +0 -24
- data/lib/active_admin/orm/mongoid.rb +0 -2
- data/lib/active_admin/resource_controller/sidebars.rb +0 -19
- data/lib/active_admin/resource_controller.rb +0 -68
- data/lib/active_admin/view_factory.rb +0 -28
- data/lib/active_admin/view_helpers/active_admin_application_helper.rb +0 -13
- data/lib/active_admin/view_helpers/auto_link_helper.rb +0 -46
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +0 -34
- data/lib/active_admin/view_helpers/display_helper.rb +0 -119
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +0 -60
- data/lib/active_admin/view_helpers/fields_for.rb +0 -51
- data/lib/active_admin/view_helpers/flash_helper.rb +0 -15
- data/lib/active_admin/view_helpers/form_helper.rb +0 -21
- data/lib/active_admin/view_helpers/scope_name_helper.rb +0 -17
- data/lib/active_admin/view_helpers/sidebar_helper.rb +0 -16
- data/lib/active_admin/view_helpers/title_helper.rb +0 -12
- data/lib/active_admin/view_helpers/view_factory_helper.rb +0 -12
- data/lib/active_admin/views/action_items.rb +0 -18
- data/lib/active_admin/views/components/active_filters_sidebar_content.rb +0 -59
- data/lib/active_admin/views/components/blank_slate.rb +0 -18
- data/lib/active_admin/views/components/columns.rb +0 -162
- data/lib/active_admin/views/components/dropdown_menu.rb +0 -69
- data/lib/active_admin/views/components/menu.rb +0 -33
- data/lib/active_admin/views/components/menu_item.rb +0 -59
- data/lib/active_admin/views/components/sidebar.rb +0 -14
- data/lib/active_admin/views/components/sidebar_section.rb +0 -35
- data/lib/active_admin/views/components/site_title.rb +0 -55
- data/lib/active_admin/views/components/unsupported_browser.rb +0 -12
- data/lib/active_admin/views/footer.rb +0 -32
- data/lib/active_admin/views/header.rb +0 -20
- data/lib/active_admin/views/index_as_block.rb +0 -37
- data/lib/active_admin/views/index_as_blog.rb +0 -156
- data/lib/active_admin/views/index_as_grid.rb +0 -81
- data/lib/active_admin/views/pages/base.rb +0 -134
- data/lib/active_admin/views/pages/form.rb +0 -65
- data/lib/active_admin/views/pages/index.rb +0 -166
- data/lib/active_admin/views/pages/layout.rb +0 -27
- data/lib/active_admin/views/pages/page.rb +0 -31
- data/lib/active_admin/views/pages/show.rb +0 -60
- data/lib/active_admin/views/tabbed_navigation.rb +0 -12
- data/lib/active_admin/views/title_bar.rb +0 -56
- data/lib/generators/active_admin/assets/templates/active_admin.js +0 -1
- data/lib/generators/active_admin/assets/templates/active_admin.scss +0 -17
- data/lib/generators/active_admin/resource/templates/admin.rb.erb +0 -46
- data/lib/generators/active_admin/webpacker/plugins/jquery.js +0 -7
- data/lib/generators/active_admin/webpacker/templates/active_admin.js +0 -5
- data/lib/generators/active_admin/webpacker/templates/active_admin.scss +0 -17
- data/lib/generators/active_admin/webpacker/templates/print.scss +0 -2
- data/lib/generators/active_admin/webpacker/webpacker_generator.rb +0 -27
- data/vendor/assets/javascripts/jquery-ui/data.js +0 -45
- data/vendor/assets/javascripts/jquery-ui/disable-selection.js +0 -51
- data/vendor/assets/javascripts/jquery-ui/focusable.js +0 -89
- data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +0 -83
- data/vendor/assets/javascripts/jquery-ui/form.js +0 -25
- data/vendor/assets/javascripts/jquery-ui/ie.js +0 -20
- data/vendor/assets/javascripts/jquery-ui/keycode.js +0 -51
- data/vendor/assets/javascripts/jquery-ui/labels.js +0 -71
- data/vendor/assets/javascripts/jquery-ui/plugin.js +0 -49
- data/vendor/assets/javascripts/jquery-ui/position.js +0 -513
- data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +0 -46
- data/vendor/assets/javascripts/jquery-ui/safe-blur.js +0 -27
- data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +0 -50
- data/vendor/assets/javascripts/jquery-ui/tabbable.js +0 -41
- data/vendor/assets/javascripts/jquery-ui/unique-id.js +0 -54
- data/vendor/assets/javascripts/jquery-ui/version.js +0 -20
- data/vendor/assets/javascripts/jquery-ui/widget.js +0 -758
- data/vendor/assets/javascripts/jquery-ui/widgets/button.js +0 -454
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +0 -294
- data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +0 -304
- data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +0 -2243
- data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +0 -971
- data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +0 -1268
- data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +0 -241
- data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +0 -1228
- data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +0 -1622
- data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +0 -931
- /data/{lib → app/controllers}/active_admin/base_controller/authorization.rb +0 -0
- /data/{lib → app/controllers}/active_admin/resource_controller/decorators.rb +0 -0
- /data/{lib → app/controllers}/active_admin/resource_controller/polymorphic_routes.rb +0 -0
- /data/{lib → app/controllers}/active_admin/resource_controller/resource_class_methods.rb +0 -0
- /data/lib/{active_admin/orm/mongoid/.gitkeep → generators/active_admin/assets/templates/builds/.keep} +0 -0
@@ -1,1228 +0,0 @@
|
|
1
|
-
//= require jquery-ui/widgets/mouse
|
2
|
-
//= require jquery-ui/disable-selection
|
3
|
-
//= require jquery-ui/plugin
|
4
|
-
//= require jquery-ui/version
|
5
|
-
//= require jquery-ui/widget
|
6
|
-
|
7
|
-
/*!
|
8
|
-
* jQuery UI Resizable 1.13.3
|
9
|
-
* https://jqueryui.com
|
10
|
-
*
|
11
|
-
* Copyright OpenJS Foundation and other contributors
|
12
|
-
* Released under the MIT license.
|
13
|
-
* https://jquery.org/license
|
14
|
-
*/
|
15
|
-
|
16
|
-
//>>label: Resizable
|
17
|
-
//>>group: Interactions
|
18
|
-
//>>description: Enables resize functionality for any element.
|
19
|
-
//>>docs: https://api.jqueryui.com/resizable/
|
20
|
-
//>>demos: https://jqueryui.com/resizable/
|
21
|
-
//>>css.structure: ../../themes/base/core.css
|
22
|
-
//>>css.structure: ../../themes/base/resizable.css
|
23
|
-
//>>css.theme: ../../themes/base/theme.css
|
24
|
-
|
25
|
-
( function( factory ) {
|
26
|
-
"use strict";
|
27
|
-
|
28
|
-
if ( typeof define === "function" && define.amd ) {
|
29
|
-
|
30
|
-
// AMD. Register as an anonymous module.
|
31
|
-
define( [
|
32
|
-
"jquery",
|
33
|
-
"./mouse",
|
34
|
-
"../disable-selection",
|
35
|
-
"../plugin",
|
36
|
-
"../version",
|
37
|
-
"../widget"
|
38
|
-
], factory );
|
39
|
-
} else {
|
40
|
-
|
41
|
-
// Browser globals
|
42
|
-
factory( jQuery );
|
43
|
-
}
|
44
|
-
} )( function( $ ) {
|
45
|
-
"use strict";
|
46
|
-
|
47
|
-
$.widget( "ui.resizable", $.ui.mouse, {
|
48
|
-
version: "1.13.3",
|
49
|
-
widgetEventPrefix: "resize",
|
50
|
-
options: {
|
51
|
-
alsoResize: false,
|
52
|
-
animate: false,
|
53
|
-
animateDuration: "slow",
|
54
|
-
animateEasing: "swing",
|
55
|
-
aspectRatio: false,
|
56
|
-
autoHide: false,
|
57
|
-
classes: {
|
58
|
-
"ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
|
59
|
-
},
|
60
|
-
containment: false,
|
61
|
-
ghost: false,
|
62
|
-
grid: false,
|
63
|
-
handles: "e,s,se",
|
64
|
-
helper: false,
|
65
|
-
maxHeight: null,
|
66
|
-
maxWidth: null,
|
67
|
-
minHeight: 10,
|
68
|
-
minWidth: 10,
|
69
|
-
|
70
|
-
// See #7960
|
71
|
-
zIndex: 90,
|
72
|
-
|
73
|
-
// Callbacks
|
74
|
-
resize: null,
|
75
|
-
start: null,
|
76
|
-
stop: null
|
77
|
-
},
|
78
|
-
|
79
|
-
_num: function( value ) {
|
80
|
-
return parseFloat( value ) || 0;
|
81
|
-
},
|
82
|
-
|
83
|
-
_isNumber: function( value ) {
|
84
|
-
return !isNaN( parseFloat( value ) );
|
85
|
-
},
|
86
|
-
|
87
|
-
_hasScroll: function( el, a ) {
|
88
|
-
|
89
|
-
if ( $( el ).css( "overflow" ) === "hidden" ) {
|
90
|
-
return false;
|
91
|
-
}
|
92
|
-
|
93
|
-
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
94
|
-
has = false;
|
95
|
-
|
96
|
-
if ( el[ scroll ] > 0 ) {
|
97
|
-
return true;
|
98
|
-
}
|
99
|
-
|
100
|
-
// TODO: determine which cases actually cause this to happen
|
101
|
-
// if the element doesn't have the scroll set, see if it's possible to
|
102
|
-
// set the scroll
|
103
|
-
try {
|
104
|
-
el[ scroll ] = 1;
|
105
|
-
has = ( el[ scroll ] > 0 );
|
106
|
-
el[ scroll ] = 0;
|
107
|
-
} catch ( e ) {
|
108
|
-
|
109
|
-
// `el` might be a string, then setting `scroll` will throw
|
110
|
-
// an error in strict mode; ignore it.
|
111
|
-
}
|
112
|
-
return has;
|
113
|
-
},
|
114
|
-
|
115
|
-
_create: function() {
|
116
|
-
|
117
|
-
var margins,
|
118
|
-
o = this.options,
|
119
|
-
that = this;
|
120
|
-
this._addClass( "ui-resizable" );
|
121
|
-
|
122
|
-
$.extend( this, {
|
123
|
-
_aspectRatio: !!( o.aspectRatio ),
|
124
|
-
aspectRatio: o.aspectRatio,
|
125
|
-
originalElement: this.element,
|
126
|
-
_proportionallyResizeElements: [],
|
127
|
-
_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
|
128
|
-
} );
|
129
|
-
|
130
|
-
// Wrap the element if it cannot hold child nodes
|
131
|
-
if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
|
132
|
-
|
133
|
-
this.element.wrap(
|
134
|
-
$( "<div class='ui-wrapper'></div>" ).css( {
|
135
|
-
overflow: "hidden",
|
136
|
-
position: this.element.css( "position" ),
|
137
|
-
width: this.element.outerWidth(),
|
138
|
-
height: this.element.outerHeight(),
|
139
|
-
top: this.element.css( "top" ),
|
140
|
-
left: this.element.css( "left" )
|
141
|
-
} )
|
142
|
-
);
|
143
|
-
|
144
|
-
this.element = this.element.parent().data(
|
145
|
-
"ui-resizable", this.element.resizable( "instance" )
|
146
|
-
);
|
147
|
-
|
148
|
-
this.elementIsWrapper = true;
|
149
|
-
|
150
|
-
margins = {
|
151
|
-
marginTop: this.originalElement.css( "marginTop" ),
|
152
|
-
marginRight: this.originalElement.css( "marginRight" ),
|
153
|
-
marginBottom: this.originalElement.css( "marginBottom" ),
|
154
|
-
marginLeft: this.originalElement.css( "marginLeft" )
|
155
|
-
};
|
156
|
-
|
157
|
-
this.element.css( margins );
|
158
|
-
this.originalElement.css( "margin", 0 );
|
159
|
-
|
160
|
-
// support: Safari
|
161
|
-
// Prevent Safari textarea resize
|
162
|
-
this.originalResizeStyle = this.originalElement.css( "resize" );
|
163
|
-
this.originalElement.css( "resize", "none" );
|
164
|
-
|
165
|
-
this._proportionallyResizeElements.push( this.originalElement.css( {
|
166
|
-
position: "static",
|
167
|
-
zoom: 1,
|
168
|
-
display: "block"
|
169
|
-
} ) );
|
170
|
-
|
171
|
-
// Support: IE9
|
172
|
-
// avoid IE jump (hard set the margin)
|
173
|
-
this.originalElement.css( margins );
|
174
|
-
|
175
|
-
this._proportionallyResize();
|
176
|
-
}
|
177
|
-
|
178
|
-
this._setupHandles();
|
179
|
-
|
180
|
-
if ( o.autoHide ) {
|
181
|
-
$( this.element )
|
182
|
-
.on( "mouseenter", function() {
|
183
|
-
if ( o.disabled ) {
|
184
|
-
return;
|
185
|
-
}
|
186
|
-
that._removeClass( "ui-resizable-autohide" );
|
187
|
-
that._handles.show();
|
188
|
-
} )
|
189
|
-
.on( "mouseleave", function() {
|
190
|
-
if ( o.disabled ) {
|
191
|
-
return;
|
192
|
-
}
|
193
|
-
if ( !that.resizing ) {
|
194
|
-
that._addClass( "ui-resizable-autohide" );
|
195
|
-
that._handles.hide();
|
196
|
-
}
|
197
|
-
} );
|
198
|
-
}
|
199
|
-
|
200
|
-
this._mouseInit();
|
201
|
-
},
|
202
|
-
|
203
|
-
_destroy: function() {
|
204
|
-
|
205
|
-
this._mouseDestroy();
|
206
|
-
this._addedHandles.remove();
|
207
|
-
|
208
|
-
var wrapper,
|
209
|
-
_destroy = function( exp ) {
|
210
|
-
$( exp )
|
211
|
-
.removeData( "resizable" )
|
212
|
-
.removeData( "ui-resizable" )
|
213
|
-
.off( ".resizable" );
|
214
|
-
};
|
215
|
-
|
216
|
-
// TODO: Unwrap at same DOM position
|
217
|
-
if ( this.elementIsWrapper ) {
|
218
|
-
_destroy( this.element );
|
219
|
-
wrapper = this.element;
|
220
|
-
this.originalElement.css( {
|
221
|
-
position: wrapper.css( "position" ),
|
222
|
-
width: wrapper.outerWidth(),
|
223
|
-
height: wrapper.outerHeight(),
|
224
|
-
top: wrapper.css( "top" ),
|
225
|
-
left: wrapper.css( "left" )
|
226
|
-
} ).insertAfter( wrapper );
|
227
|
-
wrapper.remove();
|
228
|
-
}
|
229
|
-
|
230
|
-
this.originalElement.css( "resize", this.originalResizeStyle );
|
231
|
-
_destroy( this.originalElement );
|
232
|
-
|
233
|
-
return this;
|
234
|
-
},
|
235
|
-
|
236
|
-
_setOption: function( key, value ) {
|
237
|
-
this._super( key, value );
|
238
|
-
|
239
|
-
switch ( key ) {
|
240
|
-
case "handles":
|
241
|
-
this._removeHandles();
|
242
|
-
this._setupHandles();
|
243
|
-
break;
|
244
|
-
case "aspectRatio":
|
245
|
-
this._aspectRatio = !!value;
|
246
|
-
break;
|
247
|
-
default:
|
248
|
-
break;
|
249
|
-
}
|
250
|
-
},
|
251
|
-
|
252
|
-
_setupHandles: function() {
|
253
|
-
var o = this.options, handle, i, n, hname, axis, that = this;
|
254
|
-
this.handles = o.handles ||
|
255
|
-
( !$( ".ui-resizable-handle", this.element ).length ?
|
256
|
-
"e,s,se" : {
|
257
|
-
n: ".ui-resizable-n",
|
258
|
-
e: ".ui-resizable-e",
|
259
|
-
s: ".ui-resizable-s",
|
260
|
-
w: ".ui-resizable-w",
|
261
|
-
se: ".ui-resizable-se",
|
262
|
-
sw: ".ui-resizable-sw",
|
263
|
-
ne: ".ui-resizable-ne",
|
264
|
-
nw: ".ui-resizable-nw"
|
265
|
-
} );
|
266
|
-
|
267
|
-
this._handles = $();
|
268
|
-
this._addedHandles = $();
|
269
|
-
if ( this.handles.constructor === String ) {
|
270
|
-
|
271
|
-
if ( this.handles === "all" ) {
|
272
|
-
this.handles = "n,e,s,w,se,sw,ne,nw";
|
273
|
-
}
|
274
|
-
|
275
|
-
n = this.handles.split( "," );
|
276
|
-
this.handles = {};
|
277
|
-
|
278
|
-
for ( i = 0; i < n.length; i++ ) {
|
279
|
-
|
280
|
-
handle = String.prototype.trim.call( n[ i ] );
|
281
|
-
hname = "ui-resizable-" + handle;
|
282
|
-
axis = $( "<div>" );
|
283
|
-
this._addClass( axis, "ui-resizable-handle " + hname );
|
284
|
-
|
285
|
-
axis.css( { zIndex: o.zIndex } );
|
286
|
-
|
287
|
-
this.handles[ handle ] = ".ui-resizable-" + handle;
|
288
|
-
if ( !this.element.children( this.handles[ handle ] ).length ) {
|
289
|
-
this.element.append( axis );
|
290
|
-
this._addedHandles = this._addedHandles.add( axis );
|
291
|
-
}
|
292
|
-
}
|
293
|
-
|
294
|
-
}
|
295
|
-
|
296
|
-
this._renderAxis = function( target ) {
|
297
|
-
|
298
|
-
var i, axis, padPos, padWrapper;
|
299
|
-
|
300
|
-
target = target || this.element;
|
301
|
-
|
302
|
-
for ( i in this.handles ) {
|
303
|
-
|
304
|
-
if ( this.handles[ i ].constructor === String ) {
|
305
|
-
this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
|
306
|
-
} else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
|
307
|
-
this.handles[ i ] = $( this.handles[ i ] );
|
308
|
-
this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
|
309
|
-
}
|
310
|
-
|
311
|
-
if ( this.elementIsWrapper &&
|
312
|
-
this.originalElement[ 0 ]
|
313
|
-
.nodeName
|
314
|
-
.match( /^(textarea|input|select|button)$/i ) ) {
|
315
|
-
axis = $( this.handles[ i ], this.element );
|
316
|
-
|
317
|
-
padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
|
318
|
-
axis.outerHeight() :
|
319
|
-
axis.outerWidth();
|
320
|
-
|
321
|
-
padPos = [ "padding",
|
322
|
-
/ne|nw|n/.test( i ) ? "Top" :
|
323
|
-
/se|sw|s/.test( i ) ? "Bottom" :
|
324
|
-
/^e$/.test( i ) ? "Right" : "Left" ].join( "" );
|
325
|
-
|
326
|
-
target.css( padPos, padWrapper );
|
327
|
-
|
328
|
-
this._proportionallyResize();
|
329
|
-
}
|
330
|
-
|
331
|
-
this._handles = this._handles.add( this.handles[ i ] );
|
332
|
-
}
|
333
|
-
};
|
334
|
-
|
335
|
-
// TODO: make renderAxis a prototype function
|
336
|
-
this._renderAxis( this.element );
|
337
|
-
|
338
|
-
this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
|
339
|
-
this._handles.disableSelection();
|
340
|
-
|
341
|
-
this._handles.on( "mouseover", function() {
|
342
|
-
if ( !that.resizing ) {
|
343
|
-
if ( this.className ) {
|
344
|
-
axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
|
345
|
-
}
|
346
|
-
that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
|
347
|
-
}
|
348
|
-
} );
|
349
|
-
|
350
|
-
if ( o.autoHide ) {
|
351
|
-
this._handles.hide();
|
352
|
-
this._addClass( "ui-resizable-autohide" );
|
353
|
-
}
|
354
|
-
},
|
355
|
-
|
356
|
-
_removeHandles: function() {
|
357
|
-
this._addedHandles.remove();
|
358
|
-
},
|
359
|
-
|
360
|
-
_mouseCapture: function( event ) {
|
361
|
-
var i, handle,
|
362
|
-
capture = false;
|
363
|
-
|
364
|
-
for ( i in this.handles ) {
|
365
|
-
handle = $( this.handles[ i ] )[ 0 ];
|
366
|
-
if ( handle === event.target || $.contains( handle, event.target ) ) {
|
367
|
-
capture = true;
|
368
|
-
}
|
369
|
-
}
|
370
|
-
|
371
|
-
return !this.options.disabled && capture;
|
372
|
-
},
|
373
|
-
|
374
|
-
_mouseStart: function( event ) {
|
375
|
-
|
376
|
-
var curleft, curtop, cursor,
|
377
|
-
o = this.options,
|
378
|
-
el = this.element;
|
379
|
-
|
380
|
-
this.resizing = true;
|
381
|
-
|
382
|
-
this._renderProxy();
|
383
|
-
|
384
|
-
curleft = this._num( this.helper.css( "left" ) );
|
385
|
-
curtop = this._num( this.helper.css( "top" ) );
|
386
|
-
|
387
|
-
if ( o.containment ) {
|
388
|
-
curleft += $( o.containment ).scrollLeft() || 0;
|
389
|
-
curtop += $( o.containment ).scrollTop() || 0;
|
390
|
-
}
|
391
|
-
|
392
|
-
this.offset = this.helper.offset();
|
393
|
-
this.position = { left: curleft, top: curtop };
|
394
|
-
|
395
|
-
this.size = this._helper ? {
|
396
|
-
width: this.helper.width(),
|
397
|
-
height: this.helper.height()
|
398
|
-
} : {
|
399
|
-
width: el.width(),
|
400
|
-
height: el.height()
|
401
|
-
};
|
402
|
-
|
403
|
-
this.originalSize = this._helper ? {
|
404
|
-
width: el.outerWidth(),
|
405
|
-
height: el.outerHeight()
|
406
|
-
} : {
|
407
|
-
width: el.width(),
|
408
|
-
height: el.height()
|
409
|
-
};
|
410
|
-
|
411
|
-
this.sizeDiff = {
|
412
|
-
width: el.outerWidth() - el.width(),
|
413
|
-
height: el.outerHeight() - el.height()
|
414
|
-
};
|
415
|
-
|
416
|
-
this.originalPosition = { left: curleft, top: curtop };
|
417
|
-
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
418
|
-
|
419
|
-
this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
|
420
|
-
o.aspectRatio :
|
421
|
-
( ( this.originalSize.width / this.originalSize.height ) || 1 );
|
422
|
-
|
423
|
-
cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
|
424
|
-
$( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
|
425
|
-
|
426
|
-
this._addClass( "ui-resizable-resizing" );
|
427
|
-
this._propagate( "start", event );
|
428
|
-
return true;
|
429
|
-
},
|
430
|
-
|
431
|
-
_mouseDrag: function( event ) {
|
432
|
-
|
433
|
-
var data, props,
|
434
|
-
smp = this.originalMousePosition,
|
435
|
-
a = this.axis,
|
436
|
-
dx = ( event.pageX - smp.left ) || 0,
|
437
|
-
dy = ( event.pageY - smp.top ) || 0,
|
438
|
-
trigger = this._change[ a ];
|
439
|
-
|
440
|
-
this._updatePrevProperties();
|
441
|
-
|
442
|
-
if ( !trigger ) {
|
443
|
-
return false;
|
444
|
-
}
|
445
|
-
|
446
|
-
data = trigger.apply( this, [ event, dx, dy ] );
|
447
|
-
|
448
|
-
this._updateVirtualBoundaries( event.shiftKey );
|
449
|
-
if ( this._aspectRatio || event.shiftKey ) {
|
450
|
-
data = this._updateRatio( data, event );
|
451
|
-
}
|
452
|
-
|
453
|
-
data = this._respectSize( data, event );
|
454
|
-
|
455
|
-
this._updateCache( data );
|
456
|
-
|
457
|
-
this._propagate( "resize", event );
|
458
|
-
|
459
|
-
props = this._applyChanges();
|
460
|
-
|
461
|
-
if ( !this._helper && this._proportionallyResizeElements.length ) {
|
462
|
-
this._proportionallyResize();
|
463
|
-
}
|
464
|
-
|
465
|
-
if ( !$.isEmptyObject( props ) ) {
|
466
|
-
this._updatePrevProperties();
|
467
|
-
this._trigger( "resize", event, this.ui() );
|
468
|
-
this._applyChanges();
|
469
|
-
}
|
470
|
-
|
471
|
-
return false;
|
472
|
-
},
|
473
|
-
|
474
|
-
_mouseStop: function( event ) {
|
475
|
-
|
476
|
-
this.resizing = false;
|
477
|
-
var pr, ista, soffseth, soffsetw, s, left, top,
|
478
|
-
o = this.options, that = this;
|
479
|
-
|
480
|
-
if ( this._helper ) {
|
481
|
-
|
482
|
-
pr = this._proportionallyResizeElements;
|
483
|
-
ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
|
484
|
-
soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
|
485
|
-
soffsetw = ista ? 0 : that.sizeDiff.width;
|
486
|
-
|
487
|
-
s = {
|
488
|
-
width: ( that.helper.width() - soffsetw ),
|
489
|
-
height: ( that.helper.height() - soffseth )
|
490
|
-
};
|
491
|
-
left = ( parseFloat( that.element.css( "left" ) ) +
|
492
|
-
( that.position.left - that.originalPosition.left ) ) || null;
|
493
|
-
top = ( parseFloat( that.element.css( "top" ) ) +
|
494
|
-
( that.position.top - that.originalPosition.top ) ) || null;
|
495
|
-
|
496
|
-
if ( !o.animate ) {
|
497
|
-
this.element.css( $.extend( s, { top: top, left: left } ) );
|
498
|
-
}
|
499
|
-
|
500
|
-
that.helper.height( that.size.height );
|
501
|
-
that.helper.width( that.size.width );
|
502
|
-
|
503
|
-
if ( this._helper && !o.animate ) {
|
504
|
-
this._proportionallyResize();
|
505
|
-
}
|
506
|
-
}
|
507
|
-
|
508
|
-
$( "body" ).css( "cursor", "auto" );
|
509
|
-
|
510
|
-
this._removeClass( "ui-resizable-resizing" );
|
511
|
-
|
512
|
-
this._propagate( "stop", event );
|
513
|
-
|
514
|
-
if ( this._helper ) {
|
515
|
-
this.helper.remove();
|
516
|
-
}
|
517
|
-
|
518
|
-
return false;
|
519
|
-
|
520
|
-
},
|
521
|
-
|
522
|
-
_updatePrevProperties: function() {
|
523
|
-
this.prevPosition = {
|
524
|
-
top: this.position.top,
|
525
|
-
left: this.position.left
|
526
|
-
};
|
527
|
-
this.prevSize = {
|
528
|
-
width: this.size.width,
|
529
|
-
height: this.size.height
|
530
|
-
};
|
531
|
-
},
|
532
|
-
|
533
|
-
_applyChanges: function() {
|
534
|
-
var props = {};
|
535
|
-
|
536
|
-
if ( this.position.top !== this.prevPosition.top ) {
|
537
|
-
props.top = this.position.top + "px";
|
538
|
-
}
|
539
|
-
if ( this.position.left !== this.prevPosition.left ) {
|
540
|
-
props.left = this.position.left + "px";
|
541
|
-
}
|
542
|
-
|
543
|
-
this.helper.css( props );
|
544
|
-
|
545
|
-
if ( this.size.width !== this.prevSize.width ) {
|
546
|
-
props.width = this.size.width + "px";
|
547
|
-
this.helper.width( props.width );
|
548
|
-
}
|
549
|
-
if ( this.size.height !== this.prevSize.height ) {
|
550
|
-
props.height = this.size.height + "px";
|
551
|
-
this.helper.height( props.height );
|
552
|
-
}
|
553
|
-
|
554
|
-
return props;
|
555
|
-
},
|
556
|
-
|
557
|
-
_updateVirtualBoundaries: function( forceAspectRatio ) {
|
558
|
-
var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
|
559
|
-
o = this.options;
|
560
|
-
|
561
|
-
b = {
|
562
|
-
minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
|
563
|
-
maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
|
564
|
-
minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
|
565
|
-
maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
|
566
|
-
};
|
567
|
-
|
568
|
-
if ( this._aspectRatio || forceAspectRatio ) {
|
569
|
-
pMinWidth = b.minHeight * this.aspectRatio;
|
570
|
-
pMinHeight = b.minWidth / this.aspectRatio;
|
571
|
-
pMaxWidth = b.maxHeight * this.aspectRatio;
|
572
|
-
pMaxHeight = b.maxWidth / this.aspectRatio;
|
573
|
-
|
574
|
-
if ( pMinWidth > b.minWidth ) {
|
575
|
-
b.minWidth = pMinWidth;
|
576
|
-
}
|
577
|
-
if ( pMinHeight > b.minHeight ) {
|
578
|
-
b.minHeight = pMinHeight;
|
579
|
-
}
|
580
|
-
if ( pMaxWidth < b.maxWidth ) {
|
581
|
-
b.maxWidth = pMaxWidth;
|
582
|
-
}
|
583
|
-
if ( pMaxHeight < b.maxHeight ) {
|
584
|
-
b.maxHeight = pMaxHeight;
|
585
|
-
}
|
586
|
-
}
|
587
|
-
this._vBoundaries = b;
|
588
|
-
},
|
589
|
-
|
590
|
-
_updateCache: function( data ) {
|
591
|
-
this.offset = this.helper.offset();
|
592
|
-
if ( this._isNumber( data.left ) ) {
|
593
|
-
this.position.left = data.left;
|
594
|
-
}
|
595
|
-
if ( this._isNumber( data.top ) ) {
|
596
|
-
this.position.top = data.top;
|
597
|
-
}
|
598
|
-
if ( this._isNumber( data.height ) ) {
|
599
|
-
this.size.height = data.height;
|
600
|
-
}
|
601
|
-
if ( this._isNumber( data.width ) ) {
|
602
|
-
this.size.width = data.width;
|
603
|
-
}
|
604
|
-
},
|
605
|
-
|
606
|
-
_updateRatio: function( data ) {
|
607
|
-
|
608
|
-
var cpos = this.position,
|
609
|
-
csize = this.size,
|
610
|
-
a = this.axis;
|
611
|
-
|
612
|
-
if ( this._isNumber( data.height ) ) {
|
613
|
-
data.width = ( data.height * this.aspectRatio );
|
614
|
-
} else if ( this._isNumber( data.width ) ) {
|
615
|
-
data.height = ( data.width / this.aspectRatio );
|
616
|
-
}
|
617
|
-
|
618
|
-
if ( a === "sw" ) {
|
619
|
-
data.left = cpos.left + ( csize.width - data.width );
|
620
|
-
data.top = null;
|
621
|
-
}
|
622
|
-
if ( a === "nw" ) {
|
623
|
-
data.top = cpos.top + ( csize.height - data.height );
|
624
|
-
data.left = cpos.left + ( csize.width - data.width );
|
625
|
-
}
|
626
|
-
|
627
|
-
return data;
|
628
|
-
},
|
629
|
-
|
630
|
-
_respectSize: function( data ) {
|
631
|
-
|
632
|
-
var o = this._vBoundaries,
|
633
|
-
a = this.axis,
|
634
|
-
ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
|
635
|
-
ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
|
636
|
-
isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
|
637
|
-
isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
|
638
|
-
dw = this.originalPosition.left + this.originalSize.width,
|
639
|
-
dh = this.originalPosition.top + this.originalSize.height,
|
640
|
-
cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
|
641
|
-
if ( isminw ) {
|
642
|
-
data.width = o.minWidth;
|
643
|
-
}
|
644
|
-
if ( isminh ) {
|
645
|
-
data.height = o.minHeight;
|
646
|
-
}
|
647
|
-
if ( ismaxw ) {
|
648
|
-
data.width = o.maxWidth;
|
649
|
-
}
|
650
|
-
if ( ismaxh ) {
|
651
|
-
data.height = o.maxHeight;
|
652
|
-
}
|
653
|
-
|
654
|
-
if ( isminw && cw ) {
|
655
|
-
data.left = dw - o.minWidth;
|
656
|
-
}
|
657
|
-
if ( ismaxw && cw ) {
|
658
|
-
data.left = dw - o.maxWidth;
|
659
|
-
}
|
660
|
-
if ( isminh && ch ) {
|
661
|
-
data.top = dh - o.minHeight;
|
662
|
-
}
|
663
|
-
if ( ismaxh && ch ) {
|
664
|
-
data.top = dh - o.maxHeight;
|
665
|
-
}
|
666
|
-
|
667
|
-
// Fixing jump error on top/left - bug #2330
|
668
|
-
if ( !data.width && !data.height && !data.left && data.top ) {
|
669
|
-
data.top = null;
|
670
|
-
} else if ( !data.width && !data.height && !data.top && data.left ) {
|
671
|
-
data.left = null;
|
672
|
-
}
|
673
|
-
|
674
|
-
return data;
|
675
|
-
},
|
676
|
-
|
677
|
-
_getPaddingPlusBorderDimensions: function( element ) {
|
678
|
-
var i = 0,
|
679
|
-
widths = [],
|
680
|
-
borders = [
|
681
|
-
element.css( "borderTopWidth" ),
|
682
|
-
element.css( "borderRightWidth" ),
|
683
|
-
element.css( "borderBottomWidth" ),
|
684
|
-
element.css( "borderLeftWidth" )
|
685
|
-
],
|
686
|
-
paddings = [
|
687
|
-
element.css( "paddingTop" ),
|
688
|
-
element.css( "paddingRight" ),
|
689
|
-
element.css( "paddingBottom" ),
|
690
|
-
element.css( "paddingLeft" )
|
691
|
-
];
|
692
|
-
|
693
|
-
for ( ; i < 4; i++ ) {
|
694
|
-
widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
|
695
|
-
widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
|
696
|
-
}
|
697
|
-
|
698
|
-
return {
|
699
|
-
height: widths[ 0 ] + widths[ 2 ],
|
700
|
-
width: widths[ 1 ] + widths[ 3 ]
|
701
|
-
};
|
702
|
-
},
|
703
|
-
|
704
|
-
_proportionallyResize: function() {
|
705
|
-
|
706
|
-
if ( !this._proportionallyResizeElements.length ) {
|
707
|
-
return;
|
708
|
-
}
|
709
|
-
|
710
|
-
var prel,
|
711
|
-
i = 0,
|
712
|
-
element = this.helper || this.element;
|
713
|
-
|
714
|
-
for ( ; i < this._proportionallyResizeElements.length; i++ ) {
|
715
|
-
|
716
|
-
prel = this._proportionallyResizeElements[ i ];
|
717
|
-
|
718
|
-
// TODO: Seems like a bug to cache this.outerDimensions
|
719
|
-
// considering that we are in a loop.
|
720
|
-
if ( !this.outerDimensions ) {
|
721
|
-
this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
|
722
|
-
}
|
723
|
-
|
724
|
-
prel.css( {
|
725
|
-
height: ( element.height() - this.outerDimensions.height ) || 0,
|
726
|
-
width: ( element.width() - this.outerDimensions.width ) || 0
|
727
|
-
} );
|
728
|
-
|
729
|
-
}
|
730
|
-
|
731
|
-
},
|
732
|
-
|
733
|
-
_renderProxy: function() {
|
734
|
-
|
735
|
-
var el = this.element, o = this.options;
|
736
|
-
this.elementOffset = el.offset();
|
737
|
-
|
738
|
-
if ( this._helper ) {
|
739
|
-
|
740
|
-
this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } );
|
741
|
-
|
742
|
-
this._addClass( this.helper, this._helper );
|
743
|
-
this.helper.css( {
|
744
|
-
width: this.element.outerWidth(),
|
745
|
-
height: this.element.outerHeight(),
|
746
|
-
position: "absolute",
|
747
|
-
left: this.elementOffset.left + "px",
|
748
|
-
top: this.elementOffset.top + "px",
|
749
|
-
zIndex: ++o.zIndex //TODO: Don't modify option
|
750
|
-
} );
|
751
|
-
|
752
|
-
this.helper
|
753
|
-
.appendTo( "body" )
|
754
|
-
.disableSelection();
|
755
|
-
|
756
|
-
} else {
|
757
|
-
this.helper = this.element;
|
758
|
-
}
|
759
|
-
|
760
|
-
},
|
761
|
-
|
762
|
-
_change: {
|
763
|
-
e: function( event, dx ) {
|
764
|
-
return { width: this.originalSize.width + dx };
|
765
|
-
},
|
766
|
-
w: function( event, dx ) {
|
767
|
-
var cs = this.originalSize, sp = this.originalPosition;
|
768
|
-
return { left: sp.left + dx, width: cs.width - dx };
|
769
|
-
},
|
770
|
-
n: function( event, dx, dy ) {
|
771
|
-
var cs = this.originalSize, sp = this.originalPosition;
|
772
|
-
return { top: sp.top + dy, height: cs.height - dy };
|
773
|
-
},
|
774
|
-
s: function( event, dx, dy ) {
|
775
|
-
return { height: this.originalSize.height + dy };
|
776
|
-
},
|
777
|
-
se: function( event, dx, dy ) {
|
778
|
-
return $.extend( this._change.s.apply( this, arguments ),
|
779
|
-
this._change.e.apply( this, [ event, dx, dy ] ) );
|
780
|
-
},
|
781
|
-
sw: function( event, dx, dy ) {
|
782
|
-
return $.extend( this._change.s.apply( this, arguments ),
|
783
|
-
this._change.w.apply( this, [ event, dx, dy ] ) );
|
784
|
-
},
|
785
|
-
ne: function( event, dx, dy ) {
|
786
|
-
return $.extend( this._change.n.apply( this, arguments ),
|
787
|
-
this._change.e.apply( this, [ event, dx, dy ] ) );
|
788
|
-
},
|
789
|
-
nw: function( event, dx, dy ) {
|
790
|
-
return $.extend( this._change.n.apply( this, arguments ),
|
791
|
-
this._change.w.apply( this, [ event, dx, dy ] ) );
|
792
|
-
}
|
793
|
-
},
|
794
|
-
|
795
|
-
_propagate: function( n, event ) {
|
796
|
-
$.ui.plugin.call( this, n, [ event, this.ui() ] );
|
797
|
-
if ( n !== "resize" ) {
|
798
|
-
this._trigger( n, event, this.ui() );
|
799
|
-
}
|
800
|
-
},
|
801
|
-
|
802
|
-
plugins: {},
|
803
|
-
|
804
|
-
ui: function() {
|
805
|
-
return {
|
806
|
-
originalElement: this.originalElement,
|
807
|
-
element: this.element,
|
808
|
-
helper: this.helper,
|
809
|
-
position: this.position,
|
810
|
-
size: this.size,
|
811
|
-
originalSize: this.originalSize,
|
812
|
-
originalPosition: this.originalPosition
|
813
|
-
};
|
814
|
-
}
|
815
|
-
|
816
|
-
} );
|
817
|
-
|
818
|
-
/*
|
819
|
-
* Resizable Extensions
|
820
|
-
*/
|
821
|
-
|
822
|
-
$.ui.plugin.add( "resizable", "animate", {
|
823
|
-
|
824
|
-
stop: function( event ) {
|
825
|
-
var that = $( this ).resizable( "instance" ),
|
826
|
-
o = that.options,
|
827
|
-
pr = that._proportionallyResizeElements,
|
828
|
-
ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
|
829
|
-
soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
|
830
|
-
soffsetw = ista ? 0 : that.sizeDiff.width,
|
831
|
-
style = {
|
832
|
-
width: ( that.size.width - soffsetw ),
|
833
|
-
height: ( that.size.height - soffseth )
|
834
|
-
},
|
835
|
-
left = ( parseFloat( that.element.css( "left" ) ) +
|
836
|
-
( that.position.left - that.originalPosition.left ) ) || null,
|
837
|
-
top = ( parseFloat( that.element.css( "top" ) ) +
|
838
|
-
( that.position.top - that.originalPosition.top ) ) || null;
|
839
|
-
|
840
|
-
that.element.animate(
|
841
|
-
$.extend( style, top && left ? { top: top, left: left } : {} ), {
|
842
|
-
duration: o.animateDuration,
|
843
|
-
easing: o.animateEasing,
|
844
|
-
step: function() {
|
845
|
-
|
846
|
-
var data = {
|
847
|
-
width: parseFloat( that.element.css( "width" ) ),
|
848
|
-
height: parseFloat( that.element.css( "height" ) ),
|
849
|
-
top: parseFloat( that.element.css( "top" ) ),
|
850
|
-
left: parseFloat( that.element.css( "left" ) )
|
851
|
-
};
|
852
|
-
|
853
|
-
if ( pr && pr.length ) {
|
854
|
-
$( pr[ 0 ] ).css( { width: data.width, height: data.height } );
|
855
|
-
}
|
856
|
-
|
857
|
-
// Propagating resize, and updating values for each animation step
|
858
|
-
that._updateCache( data );
|
859
|
-
that._propagate( "resize", event );
|
860
|
-
|
861
|
-
}
|
862
|
-
}
|
863
|
-
);
|
864
|
-
}
|
865
|
-
|
866
|
-
} );
|
867
|
-
|
868
|
-
$.ui.plugin.add( "resizable", "containment", {
|
869
|
-
|
870
|
-
start: function() {
|
871
|
-
var element, p, co, ch, cw, width, height,
|
872
|
-
that = $( this ).resizable( "instance" ),
|
873
|
-
o = that.options,
|
874
|
-
el = that.element,
|
875
|
-
oc = o.containment,
|
876
|
-
ce = ( oc instanceof $ ) ?
|
877
|
-
oc.get( 0 ) :
|
878
|
-
( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
|
879
|
-
|
880
|
-
if ( !ce ) {
|
881
|
-
return;
|
882
|
-
}
|
883
|
-
|
884
|
-
that.containerElement = $( ce );
|
885
|
-
|
886
|
-
if ( /document/.test( oc ) || oc === document ) {
|
887
|
-
that.containerOffset = {
|
888
|
-
left: 0,
|
889
|
-
top: 0
|
890
|
-
};
|
891
|
-
that.containerPosition = {
|
892
|
-
left: 0,
|
893
|
-
top: 0
|
894
|
-
};
|
895
|
-
|
896
|
-
that.parentData = {
|
897
|
-
element: $( document ),
|
898
|
-
left: 0,
|
899
|
-
top: 0,
|
900
|
-
width: $( document ).width(),
|
901
|
-
height: $( document ).height() || document.body.parentNode.scrollHeight
|
902
|
-
};
|
903
|
-
} else {
|
904
|
-
element = $( ce );
|
905
|
-
p = [];
|
906
|
-
$( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
|
907
|
-
p[ i ] = that._num( element.css( "padding" + name ) );
|
908
|
-
} );
|
909
|
-
|
910
|
-
that.containerOffset = element.offset();
|
911
|
-
that.containerPosition = element.position();
|
912
|
-
that.containerSize = {
|
913
|
-
height: ( element.innerHeight() - p[ 3 ] ),
|
914
|
-
width: ( element.innerWidth() - p[ 1 ] )
|
915
|
-
};
|
916
|
-
|
917
|
-
co = that.containerOffset;
|
918
|
-
ch = that.containerSize.height;
|
919
|
-
cw = that.containerSize.width;
|
920
|
-
width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw );
|
921
|
-
height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch );
|
922
|
-
|
923
|
-
that.parentData = {
|
924
|
-
element: ce,
|
925
|
-
left: co.left,
|
926
|
-
top: co.top,
|
927
|
-
width: width,
|
928
|
-
height: height
|
929
|
-
};
|
930
|
-
}
|
931
|
-
},
|
932
|
-
|
933
|
-
resize: function( event ) {
|
934
|
-
var woset, hoset, isParent, isOffsetRelative,
|
935
|
-
that = $( this ).resizable( "instance" ),
|
936
|
-
o = that.options,
|
937
|
-
co = that.containerOffset,
|
938
|
-
cp = that.position,
|
939
|
-
pRatio = that._aspectRatio || event.shiftKey,
|
940
|
-
cop = {
|
941
|
-
top: 0,
|
942
|
-
left: 0
|
943
|
-
},
|
944
|
-
ce = that.containerElement,
|
945
|
-
continueResize = true;
|
946
|
-
|
947
|
-
if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
|
948
|
-
cop = co;
|
949
|
-
}
|
950
|
-
|
951
|
-
if ( cp.left < ( that._helper ? co.left : 0 ) ) {
|
952
|
-
that.size.width = that.size.width +
|
953
|
-
( that._helper ?
|
954
|
-
( that.position.left - co.left ) :
|
955
|
-
( that.position.left - cop.left ) );
|
956
|
-
|
957
|
-
if ( pRatio ) {
|
958
|
-
that.size.height = that.size.width / that.aspectRatio;
|
959
|
-
continueResize = false;
|
960
|
-
}
|
961
|
-
that.position.left = o.helper ? co.left : 0;
|
962
|
-
}
|
963
|
-
|
964
|
-
if ( cp.top < ( that._helper ? co.top : 0 ) ) {
|
965
|
-
that.size.height = that.size.height +
|
966
|
-
( that._helper ?
|
967
|
-
( that.position.top - co.top ) :
|
968
|
-
that.position.top );
|
969
|
-
|
970
|
-
if ( pRatio ) {
|
971
|
-
that.size.width = that.size.height * that.aspectRatio;
|
972
|
-
continueResize = false;
|
973
|
-
}
|
974
|
-
that.position.top = that._helper ? co.top : 0;
|
975
|
-
}
|
976
|
-
|
977
|
-
isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
|
978
|
-
isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
|
979
|
-
|
980
|
-
if ( isParent && isOffsetRelative ) {
|
981
|
-
that.offset.left = that.parentData.left + that.position.left;
|
982
|
-
that.offset.top = that.parentData.top + that.position.top;
|
983
|
-
} else {
|
984
|
-
that.offset.left = that.element.offset().left;
|
985
|
-
that.offset.top = that.element.offset().top;
|
986
|
-
}
|
987
|
-
|
988
|
-
woset = Math.abs( that.sizeDiff.width +
|
989
|
-
( that._helper ?
|
990
|
-
that.offset.left - cop.left :
|
991
|
-
( that.offset.left - co.left ) ) );
|
992
|
-
|
993
|
-
hoset = Math.abs( that.sizeDiff.height +
|
994
|
-
( that._helper ?
|
995
|
-
that.offset.top - cop.top :
|
996
|
-
( that.offset.top - co.top ) ) );
|
997
|
-
|
998
|
-
if ( woset + that.size.width >= that.parentData.width ) {
|
999
|
-
that.size.width = that.parentData.width - woset;
|
1000
|
-
if ( pRatio ) {
|
1001
|
-
that.size.height = that.size.width / that.aspectRatio;
|
1002
|
-
continueResize = false;
|
1003
|
-
}
|
1004
|
-
}
|
1005
|
-
|
1006
|
-
if ( hoset + that.size.height >= that.parentData.height ) {
|
1007
|
-
that.size.height = that.parentData.height - hoset;
|
1008
|
-
if ( pRatio ) {
|
1009
|
-
that.size.width = that.size.height * that.aspectRatio;
|
1010
|
-
continueResize = false;
|
1011
|
-
}
|
1012
|
-
}
|
1013
|
-
|
1014
|
-
if ( !continueResize ) {
|
1015
|
-
that.position.left = that.prevPosition.left;
|
1016
|
-
that.position.top = that.prevPosition.top;
|
1017
|
-
that.size.width = that.prevSize.width;
|
1018
|
-
that.size.height = that.prevSize.height;
|
1019
|
-
}
|
1020
|
-
},
|
1021
|
-
|
1022
|
-
stop: function() {
|
1023
|
-
var that = $( this ).resizable( "instance" ),
|
1024
|
-
o = that.options,
|
1025
|
-
co = that.containerOffset,
|
1026
|
-
cop = that.containerPosition,
|
1027
|
-
ce = that.containerElement,
|
1028
|
-
helper = $( that.helper ),
|
1029
|
-
ho = helper.offset(),
|
1030
|
-
w = helper.outerWidth() - that.sizeDiff.width,
|
1031
|
-
h = helper.outerHeight() - that.sizeDiff.height;
|
1032
|
-
|
1033
|
-
if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
|
1034
|
-
$( this ).css( {
|
1035
|
-
left: ho.left - cop.left - co.left,
|
1036
|
-
width: w,
|
1037
|
-
height: h
|
1038
|
-
} );
|
1039
|
-
}
|
1040
|
-
|
1041
|
-
if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
|
1042
|
-
$( this ).css( {
|
1043
|
-
left: ho.left - cop.left - co.left,
|
1044
|
-
width: w,
|
1045
|
-
height: h
|
1046
|
-
} );
|
1047
|
-
}
|
1048
|
-
}
|
1049
|
-
} );
|
1050
|
-
|
1051
|
-
$.ui.plugin.add( "resizable", "alsoResize", {
|
1052
|
-
|
1053
|
-
start: function() {
|
1054
|
-
var that = $( this ).resizable( "instance" ),
|
1055
|
-
o = that.options;
|
1056
|
-
|
1057
|
-
$( o.alsoResize ).each( function() {
|
1058
|
-
var el = $( this );
|
1059
|
-
el.data( "ui-resizable-alsoresize", {
|
1060
|
-
width: parseFloat( el.css( "width" ) ), height: parseFloat( el.css( "height" ) ),
|
1061
|
-
left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
|
1062
|
-
} );
|
1063
|
-
} );
|
1064
|
-
},
|
1065
|
-
|
1066
|
-
resize: function( event, ui ) {
|
1067
|
-
var that = $( this ).resizable( "instance" ),
|
1068
|
-
o = that.options,
|
1069
|
-
os = that.originalSize,
|
1070
|
-
op = that.originalPosition,
|
1071
|
-
delta = {
|
1072
|
-
height: ( that.size.height - os.height ) || 0,
|
1073
|
-
width: ( that.size.width - os.width ) || 0,
|
1074
|
-
top: ( that.position.top - op.top ) || 0,
|
1075
|
-
left: ( that.position.left - op.left ) || 0
|
1076
|
-
};
|
1077
|
-
|
1078
|
-
$( o.alsoResize ).each( function() {
|
1079
|
-
var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
|
1080
|
-
css = el.parents( ui.originalElement[ 0 ] ).length ?
|
1081
|
-
[ "width", "height" ] :
|
1082
|
-
[ "width", "height", "top", "left" ];
|
1083
|
-
|
1084
|
-
$.each( css, function( i, prop ) {
|
1085
|
-
var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
|
1086
|
-
if ( sum && sum >= 0 ) {
|
1087
|
-
style[ prop ] = sum || null;
|
1088
|
-
}
|
1089
|
-
} );
|
1090
|
-
|
1091
|
-
el.css( style );
|
1092
|
-
} );
|
1093
|
-
},
|
1094
|
-
|
1095
|
-
stop: function() {
|
1096
|
-
$( this ).removeData( "ui-resizable-alsoresize" );
|
1097
|
-
}
|
1098
|
-
} );
|
1099
|
-
|
1100
|
-
$.ui.plugin.add( "resizable", "ghost", {
|
1101
|
-
|
1102
|
-
start: function() {
|
1103
|
-
|
1104
|
-
var that = $( this ).resizable( "instance" ), cs = that.size;
|
1105
|
-
|
1106
|
-
that.ghost = that.originalElement.clone();
|
1107
|
-
that.ghost.css( {
|
1108
|
-
opacity: 0.25,
|
1109
|
-
display: "block",
|
1110
|
-
position: "relative",
|
1111
|
-
height: cs.height,
|
1112
|
-
width: cs.width,
|
1113
|
-
margin: 0,
|
1114
|
-
left: 0,
|
1115
|
-
top: 0
|
1116
|
-
} );
|
1117
|
-
|
1118
|
-
that._addClass( that.ghost, "ui-resizable-ghost" );
|
1119
|
-
|
1120
|
-
// DEPRECATED
|
1121
|
-
// TODO: remove after 1.12
|
1122
|
-
if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
|
1123
|
-
|
1124
|
-
// Ghost option
|
1125
|
-
that.ghost.addClass( this.options.ghost );
|
1126
|
-
}
|
1127
|
-
|
1128
|
-
that.ghost.appendTo( that.helper );
|
1129
|
-
|
1130
|
-
},
|
1131
|
-
|
1132
|
-
resize: function() {
|
1133
|
-
var that = $( this ).resizable( "instance" );
|
1134
|
-
if ( that.ghost ) {
|
1135
|
-
that.ghost.css( {
|
1136
|
-
position: "relative",
|
1137
|
-
height: that.size.height,
|
1138
|
-
width: that.size.width
|
1139
|
-
} );
|
1140
|
-
}
|
1141
|
-
},
|
1142
|
-
|
1143
|
-
stop: function() {
|
1144
|
-
var that = $( this ).resizable( "instance" );
|
1145
|
-
if ( that.ghost && that.helper ) {
|
1146
|
-
that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
|
1147
|
-
}
|
1148
|
-
}
|
1149
|
-
|
1150
|
-
} );
|
1151
|
-
|
1152
|
-
$.ui.plugin.add( "resizable", "grid", {
|
1153
|
-
|
1154
|
-
resize: function() {
|
1155
|
-
var outerDimensions,
|
1156
|
-
that = $( this ).resizable( "instance" ),
|
1157
|
-
o = that.options,
|
1158
|
-
cs = that.size,
|
1159
|
-
os = that.originalSize,
|
1160
|
-
op = that.originalPosition,
|
1161
|
-
a = that.axis,
|
1162
|
-
grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
|
1163
|
-
gridX = ( grid[ 0 ] || 1 ),
|
1164
|
-
gridY = ( grid[ 1 ] || 1 ),
|
1165
|
-
ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
|
1166
|
-
oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
|
1167
|
-
newWidth = os.width + ox,
|
1168
|
-
newHeight = os.height + oy,
|
1169
|
-
isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
|
1170
|
-
isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
|
1171
|
-
isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
|
1172
|
-
isMinHeight = o.minHeight && ( o.minHeight > newHeight );
|
1173
|
-
|
1174
|
-
o.grid = grid;
|
1175
|
-
|
1176
|
-
if ( isMinWidth ) {
|
1177
|
-
newWidth += gridX;
|
1178
|
-
}
|
1179
|
-
if ( isMinHeight ) {
|
1180
|
-
newHeight += gridY;
|
1181
|
-
}
|
1182
|
-
if ( isMaxWidth ) {
|
1183
|
-
newWidth -= gridX;
|
1184
|
-
}
|
1185
|
-
if ( isMaxHeight ) {
|
1186
|
-
newHeight -= gridY;
|
1187
|
-
}
|
1188
|
-
|
1189
|
-
if ( /^(se|s|e)$/.test( a ) ) {
|
1190
|
-
that.size.width = newWidth;
|
1191
|
-
that.size.height = newHeight;
|
1192
|
-
} else if ( /^(ne)$/.test( a ) ) {
|
1193
|
-
that.size.width = newWidth;
|
1194
|
-
that.size.height = newHeight;
|
1195
|
-
that.position.top = op.top - oy;
|
1196
|
-
} else if ( /^(sw)$/.test( a ) ) {
|
1197
|
-
that.size.width = newWidth;
|
1198
|
-
that.size.height = newHeight;
|
1199
|
-
that.position.left = op.left - ox;
|
1200
|
-
} else {
|
1201
|
-
if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
|
1202
|
-
outerDimensions = that._getPaddingPlusBorderDimensions( this );
|
1203
|
-
}
|
1204
|
-
|
1205
|
-
if ( newHeight - gridY > 0 ) {
|
1206
|
-
that.size.height = newHeight;
|
1207
|
-
that.position.top = op.top - oy;
|
1208
|
-
} else {
|
1209
|
-
newHeight = gridY - outerDimensions.height;
|
1210
|
-
that.size.height = newHeight;
|
1211
|
-
that.position.top = op.top + os.height - newHeight;
|
1212
|
-
}
|
1213
|
-
if ( newWidth - gridX > 0 ) {
|
1214
|
-
that.size.width = newWidth;
|
1215
|
-
that.position.left = op.left - ox;
|
1216
|
-
} else {
|
1217
|
-
newWidth = gridX - outerDimensions.width;
|
1218
|
-
that.size.width = newWidth;
|
1219
|
-
that.position.left = op.left + os.width - newWidth;
|
1220
|
-
}
|
1221
|
-
}
|
1222
|
-
}
|
1223
|
-
|
1224
|
-
} );
|
1225
|
-
|
1226
|
-
return $.ui.resizable;
|
1227
|
-
|
1228
|
-
} );
|