alchemy_cms 7.0.7 → 7.1.0.pre.b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/backport.yml +36 -0
- data/.github/workflows/test.yml +3 -2
- data/.gitignore +1 -0
- data/.standard.yml +1 -1
- data/CHANGELOG.md +150 -0
- data/Gemfile +8 -10
- data/README.md +10 -8
- data/alchemy_cms.gemspec +3 -2
- data/app/assets/config/alchemy_manifest.js +0 -1
- data/app/assets/javascripts/alchemy/admin.js +1 -19
- data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +2 -3
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +19 -34
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +38 -13
- data/app/assets/javascripts/alchemy/alchemy.file_progress.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.fixed_elements.js +32 -25
- data/app/assets/javascripts/alchemy/alchemy.growler.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.image_overlay.coffee +3 -5
- data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +0 -57
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +22 -63
- data/app/assets/javascripts/alchemy/alchemy.list_filter.js.coffee +2 -2
- data/app/assets/javascripts/alchemy/alchemy.preview.js.coffee +5 -4
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +5 -5
- data/app/assets/javascripts/alchemy/templates/index.js +0 -2
- data/app/assets/javascripts/alchemy/templates/node_folder.hbs +1 -1
- data/app/assets/javascripts/alchemy/templates/page.hbs +1 -1
- data/app/assets/javascripts/alchemy/templates/page_folder.hbs +2 -2
- data/app/assets/stylesheets/alchemy/_custom-properties.scss +82 -0
- data/app/assets/stylesheets/alchemy/_mixins.scss +38 -30
- data/app/assets/stylesheets/alchemy/_variables.scss +12 -5
- data/app/assets/stylesheets/alchemy/admin.scss +3 -4
- data/app/assets/stylesheets/alchemy/archive.scss +107 -50
- data/app/assets/stylesheets/alchemy/attachments.scss +5 -4
- data/app/assets/stylesheets/alchemy/buttons.scss +38 -164
- data/app/assets/stylesheets/alchemy/dashboard.scss +31 -6
- data/app/assets/stylesheets/alchemy/dialogs.scss +12 -28
- data/app/assets/stylesheets/alchemy/elements.scss +273 -282
- data/app/assets/stylesheets/alchemy/flash.scss +20 -12
- data/app/assets/stylesheets/alchemy/forms.scss +21 -34
- data/app/assets/stylesheets/alchemy/frame.scss +11 -32
- data/app/assets/stylesheets/alchemy/hints.scss +4 -62
- data/app/assets/stylesheets/alchemy/image_library.scss +36 -33
- data/app/assets/stylesheets/alchemy/menubar.scss +7 -6
- data/app/assets/stylesheets/alchemy/navigation.scss +27 -15
- data/app/assets/stylesheets/alchemy/nodes.scss +11 -7
- data/app/assets/stylesheets/alchemy/notices.scss +16 -4
- data/app/assets/stylesheets/alchemy/page-select.scss +10 -2
- data/app/assets/stylesheets/alchemy/pagination.scss +22 -13
- data/app/assets/stylesheets/alchemy/resource_info.scss +7 -5
- data/app/assets/stylesheets/alchemy/selects.scss +49 -42
- data/app/assets/stylesheets/alchemy/shoelace.scss +345 -0
- data/app/assets/stylesheets/alchemy/sitemap.scss +24 -14
- data/app/assets/stylesheets/alchemy/spinner.scss +9 -19
- data/app/assets/stylesheets/alchemy/tables.scss +16 -24
- data/app/assets/stylesheets/alchemy/tags.scss +4 -0
- data/app/assets/stylesheets/alchemy/toolbar.scss +29 -25
- data/app/assets/stylesheets/alchemy/upload.scss +140 -89
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +80 -108
- data/app/components/alchemy/admin/node_select.rb +39 -0
- data/app/components/alchemy/admin/page_select.rb +42 -0
- data/app/controllers/alchemy/admin/base_controller.rb +5 -6
- data/app/controllers/alchemy/admin/elements_controller.rb +63 -35
- data/app/controllers/alchemy/admin/resources_controller.rb +5 -5
- data/app/controllers/alchemy/base_controller.rb +4 -2
- data/app/controllers/alchemy/messages_controller.rb +4 -4
- data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +1 -1
- data/app/controllers/concerns/alchemy/site_redirects.rb +1 -1
- data/app/decorators/alchemy/element_editor.rb +0 -2
- data/app/helpers/alchemy/admin/attachments_helper.rb +6 -5
- data/app/helpers/alchemy/admin/base_helper.rb +17 -12
- data/app/helpers/alchemy/admin/ingredients_helper.rb +4 -1
- data/app/helpers/alchemy/admin/pages_helper.rb +5 -11
- data/app/helpers/alchemy/base_helper.rb +47 -13
- data/app/javascript/alchemy_admin/components/alchemy_html_element.js +129 -0
- data/app/javascript/alchemy_admin/components/button.js +59 -0
- data/app/javascript/alchemy_admin/components/char_counter.js +40 -0
- data/app/javascript/alchemy_admin/components/datepicker.js +39 -0
- data/app/javascript/alchemy_admin/components/dialog_link.js +45 -0
- data/app/javascript/alchemy_admin/components/element_editor/publish_element_button.js +36 -0
- data/app/javascript/alchemy_admin/components/element_editor.js +553 -0
- data/app/javascript/alchemy_admin/components/ingredient_group.js +54 -0
- data/app/javascript/alchemy_admin/components/link_buttons/link_button.js +48 -0
- data/app/javascript/alchemy_admin/components/link_buttons/unlink_button.js +38 -0
- data/app/javascript/alchemy_admin/components/link_buttons.js +79 -0
- data/app/javascript/alchemy_admin/components/node_select.js +45 -0
- data/app/javascript/alchemy_admin/components/overlay.js +18 -0
- data/app/javascript/alchemy_admin/components/page_select.js +63 -0
- data/app/javascript/alchemy_admin/components/remote_select.js +134 -0
- data/app/javascript/alchemy_admin/components/select.js +12 -0
- data/app/javascript/alchemy_admin/components/spinner.js +31 -0
- data/app/javascript/alchemy_admin/components/tinymce.js +146 -0
- data/app/javascript/alchemy_admin/components/uploader/file_upload.js +266 -0
- data/app/javascript/alchemy_admin/components/uploader/progress.js +258 -0
- data/app/javascript/alchemy_admin/components/uploader.js +132 -0
- data/app/javascript/alchemy_admin/dirty.js +49 -0
- data/app/javascript/alchemy_admin/file_editors.js +1 -1
- data/app/javascript/alchemy_admin/gui.js +14 -0
- data/app/javascript/alchemy_admin/i18n.js +12 -8
- data/app/javascript/alchemy_admin/image_cropper.js +6 -3
- data/app/javascript/alchemy_admin/image_loader.js +7 -15
- data/app/javascript/alchemy_admin/ingredient_anchor_link.js +2 -5
- data/app/javascript/alchemy_admin/initializer.js +65 -0
- data/app/javascript/alchemy_admin/locales/en.js +31 -0
- data/app/javascript/alchemy_admin/picture_editors.js +2 -2
- data/app/javascript/alchemy_admin/picture_selector.js +38 -0
- data/app/javascript/alchemy_admin/please_wait_overlay.js +8 -0
- data/app/javascript/alchemy_admin/sortable_elements.js +78 -0
- data/app/javascript/alchemy_admin/spinner.js +36 -0
- data/app/javascript/alchemy_admin/tags_autocomplete.js +46 -0
- data/app/javascript/alchemy_admin/utils/ajax.js +6 -5
- data/app/javascript/alchemy_admin/utils/dom_helpers.js +20 -0
- data/app/javascript/alchemy_admin/utils/format.js +11 -0
- data/app/javascript/alchemy_admin/utils/string_conversions.js +10 -0
- data/app/javascript/alchemy_admin.js +70 -13
- data/app/javascript/menubar.js +10 -0
- data/app/models/alchemy/attachment.rb +9 -11
- data/app/models/alchemy/element/element_ingredients.rb +2 -2
- data/app/models/alchemy/element.rb +11 -0
- data/app/models/alchemy/ingredient.rb +3 -3
- data/app/models/alchemy/ingredient_validator.rb +2 -2
- data/app/models/alchemy/ingredients/richtext.rb +1 -10
- data/app/models/alchemy/node.rb +4 -0
- data/app/models/alchemy/page/page_natures.rb +10 -2
- data/app/models/alchemy/page.rb +10 -50
- data/app/models/alchemy/picture/url.rb +1 -9
- data/app/models/concerns/alchemy/picture_thumbnails.rb +1 -1
- data/app/serializers/alchemy/page_tree_serializer.rb +2 -1
- data/app/services/alchemy/copy_page.rb +98 -0
- data/app/views/alchemy/_menubar.html.erb +17 -13
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +14 -10
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +44 -36
- data/app/views/alchemy/admin/attachments/_replace_button.html.erb +15 -21
- data/app/views/alchemy/admin/attachments/archive_overlay.js.erb +0 -1
- data/app/views/alchemy/admin/attachments/assign.js.erb +1 -1
- data/app/views/alchemy/admin/attachments/index.html.erb +6 -4
- data/app/views/alchemy/admin/attachments/show.html.erb +8 -8
- data/app/views/alchemy/admin/clipboard/clear.js.erb +1 -1
- data/app/views/alchemy/admin/clipboard/index.html.erb +3 -7
- data/app/views/alchemy/admin/clipboard/insert.js.erb +1 -1
- data/app/views/alchemy/admin/crop.html.erb +1 -1
- data/app/views/alchemy/admin/dashboard/_locked_pages.html.erb +1 -1
- data/app/views/alchemy/admin/dashboard/index.html.erb +13 -11
- data/app/views/alchemy/admin/dashboard/info.html.erb +7 -7
- data/app/views/alchemy/admin/elements/_add_nested_element_form.html.erb +22 -24
- data/app/views/alchemy/admin/elements/_element.html.erb +52 -44
- data/app/views/alchemy/admin/elements/_footer.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_form.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_header.html.erb +11 -12
- data/app/views/alchemy/admin/elements/_toolbar.html.erb +33 -45
- data/app/views/alchemy/admin/elements/create.js.erb +7 -15
- data/app/views/alchemy/admin/elements/destroy.js.erb +0 -2
- data/app/views/alchemy/admin/elements/index.html.erb +27 -24
- data/app/views/alchemy/admin/elements/new.html.erb +9 -11
- data/app/views/alchemy/admin/ingredients/_file_fields.html.erb +2 -2
- data/app/views/alchemy/admin/ingredients/_picture_fields.html.erb +3 -3
- data/app/views/alchemy/admin/ingredients/_video_fields.html.erb +1 -2
- data/app/views/alchemy/admin/languages/_form.html.erb +2 -3
- data/app/views/alchemy/admin/languages/_language.html.erb +15 -8
- data/app/views/alchemy/admin/languages/_table.html.erb +1 -0
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +28 -16
- data/app/views/alchemy/admin/layoutpages/index.html.erb +2 -2
- data/app/views/alchemy/admin/legacy_page_urls/_legacy_page_url.html.erb +12 -8
- data/app/views/alchemy/admin/legacy_page_urls/_new.html.erb +1 -1
- data/app/views/alchemy/admin/nodes/_form.html.erb +20 -21
- data/app/views/alchemy/admin/nodes/_node.html.erb +39 -34
- data/app/views/alchemy/admin/nodes/index.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_anchor_link.html.erb +4 -4
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_current_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_external_link.html.erb +4 -4
- data/app/views/alchemy/admin/pages/_file_link.html.erb +5 -5
- data/app/views/alchemy/admin/pages/_form.html.erb +10 -21
- data/app/views/alchemy/admin/pages/_internal_link.html.erb +4 -4
- data/app/views/alchemy/admin/pages/_locked_page.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +4 -17
- data/app/views/alchemy/admin/pages/_page.html.erb +76 -72
- data/app/views/alchemy/admin/pages/_page_infos.html.erb +23 -7
- data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +2 -1
- data/app/views/alchemy/admin/pages/_page_status.html.erb +11 -21
- data/app/views/alchemy/admin/pages/_publication_fields.html.erb +2 -5
- data/app/views/alchemy/admin/pages/_table.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_table_row.html.erb +43 -39
- data/app/views/alchemy/admin/pages/_toolbar.html.erb +43 -38
- data/app/views/alchemy/admin/pages/configure.html.erb +12 -14
- data/app/views/alchemy/admin/pages/edit.html.erb +80 -103
- data/app/views/alchemy/admin/pages/info.html.erb +20 -11
- data/app/views/alchemy/admin/pages/link.html.erb +22 -16
- data/app/views/alchemy/admin/pages/new.html.erb +9 -11
- data/app/views/alchemy/admin/pages/unlock.js.erb +10 -3
- data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +15 -13
- data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +3 -5
- data/app/views/alchemy/admin/partials/_routes.html.erb +10 -2
- data/app/views/alchemy/admin/partials/_site_select.html.erb +6 -5
- data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +28 -23
- data/app/views/alchemy/admin/pictures/_archive.html.erb +5 -5
- data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +21 -23
- data/app/views/alchemy/admin/pictures/_infos.html.erb +2 -6
- data/app/views/alchemy/admin/pictures/_picture.html.erb +15 -17
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +17 -16
- data/app/views/alchemy/admin/pictures/_tag_list.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +1 -1
- data/app/views/alchemy/admin/pictures/assign.js.erb +1 -1
- data/app/views/alchemy/admin/pictures/index.html.erb +34 -30
- data/app/views/alchemy/admin/pictures/show.html.erb +3 -3
- data/app/views/alchemy/admin/resources/_filter.html.erb +1 -1
- data/app/views/alchemy/admin/resources/_form.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_resource.html.erb +16 -9
- data/app/views/alchemy/admin/resources/_table.html.erb +4 -1
- data/app/views/alchemy/admin/resources/index.html.erb +22 -19
- data/app/views/alchemy/admin/sites/index.html.erb +2 -1
- data/app/views/alchemy/admin/styleguide/index.html.erb +54 -28
- data/app/views/alchemy/admin/tags/_tag.html.erb +16 -14
- data/app/views/alchemy/admin/tags/index.html.erb +15 -12
- data/app/views/alchemy/admin/tinymce/_setup.html.erb +29 -0
- data/app/views/alchemy/admin/uploader/_button.html.erb +23 -29
- data/app/views/alchemy/admin/uploader/_setup.html.erb +3 -8
- data/app/views/alchemy/base/500.html.erb +1 -1
- data/app/views/alchemy/base/error_notice.js.erb +0 -1
- data/app/views/alchemy/ingredients/_boolean_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/_datetime_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/_file_editor.html.erb +5 -5
- data/app/views/alchemy/ingredients/_link_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/_node_editor.html.erb +6 -19
- data/app/views/alchemy/ingredients/_page_editor.html.erb +7 -19
- data/app/views/alchemy/ingredients/_picture_editor.html.erb +2 -2
- data/app/views/alchemy/ingredients/_richtext_editor.html.erb +6 -15
- data/app/views/alchemy/ingredients/_select_editor.html.erb +2 -1
- data/app/views/alchemy/ingredients/_text_editor.html.erb +1 -1
- data/app/views/alchemy/ingredients/shared/_anchor.html.erb +1 -1
- data/app/views/alchemy/ingredients/shared/_link_tools.html.erb +10 -20
- data/app/views/alchemy/ingredients/shared/_picture_tools.html.erb +42 -49
- data/app/views/kaminari/alchemy/_first_page.html.erb +4 -2
- data/app/views/kaminari/alchemy/_gap.html.erb +1 -1
- data/app/views/kaminari/alchemy/_last_page.html.erb +4 -2
- data/app/views/kaminari/alchemy/_next_page.html.erb +4 -2
- data/app/views/kaminari/alchemy/_prev_page.html.erb +4 -2
- data/app/views/layouts/alchemy/admin.html.erb +10 -29
- data/config/alchemy/modules.yml +30 -30
- data/config/importmap.rb +10 -1
- data/config/initializers/rails_live_reload.rb +13 -0
- data/config/locales/alchemy.en.yml +23 -9
- data/config/routes.rb +2 -1
- data/lib/alchemy/auth_accessors.rb +6 -1
- data/lib/alchemy/dev_support/live_reload_watcher.rb +5 -0
- data/lib/alchemy/engine.rb +8 -2
- data/lib/alchemy/forms/builder.rb +18 -12
- data/lib/alchemy/resource.rb +2 -2
- data/lib/alchemy/resources_helper.rb +6 -6
- data/lib/alchemy/test_support/capybara_helpers.rb +8 -5
- data/lib/alchemy/test_support/rspec_matchers.rb +14 -0
- data/lib/alchemy/test_support/shared_uploader_examples.rb +1 -1
- data/lib/alchemy/tinymce.rb +8 -3
- data/lib/alchemy/version.rb +1 -1
- data/package.json +14 -5
- data/vendor/assets/fonts/remixicon.eot +0 -0
- data/vendor/assets/fonts/remixicon.svg +7816 -0
- data/vendor/assets/fonts/remixicon.ttf +0 -0
- data/vendor/assets/fonts/remixicon.woff +0 -0
- data/vendor/assets/fonts/remixicon.woff2 +0 -0
- data/vendor/assets/stylesheets/remixicon.scss +10480 -0
- metadata +85 -90
- data/app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee +0 -30
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +0 -53
- data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +0 -45
- data/app/assets/javascripts/alchemy/alchemy.char_counter.js.coffee +0 -19
- data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +0 -59
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +0 -79
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +0 -267
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +0 -27
- data/app/assets/javascripts/alchemy/alchemy.spinner.js +0 -32
- data/app/assets/javascripts/alchemy/alchemy.tooltips.coffee +0 -10
- data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +0 -131
- data/app/assets/javascripts/alchemy/menubar.js.coffee +0 -8
- data/app/assets/javascripts/alchemy/node_select.js +0 -39
- data/app/assets/javascripts/alchemy/page_select.js +0 -46
- data/app/assets/javascripts/alchemy/templates/node.hbs +0 -16
- data/app/assets/javascripts/alchemy/templates/spinner.hbs +0 -7
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +0 -435
- data/app/javascript/alchemy_admin/datepicker.js +0 -33
- data/app/javascript/alchemy_admin/tinymce.js +0 -146
- data/app/javascript/alchemy_admin/translations.js +0 -32
- data/app/views/alchemy/admin/elements/fold.js.erb +0 -33
- data/app/views/alchemy/admin/elements/order.js.erb +0 -11
- data/app/views/alchemy/admin/elements/publish.js.erb +0 -21
- data/app/views/alchemy/admin/elements/update.js.erb +0 -27
- data/vendor/assets/fonts/fa-regular-400.eot +0 -0
- data/vendor/assets/fonts/fa-regular-400.svg +0 -803
- data/vendor/assets/fonts/fa-regular-400.ttf +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff2 +0 -0
- data/vendor/assets/fonts/fa-solid-900.eot +0 -0
- data/vendor/assets/fonts/fa-solid-900.svg +0 -4938
- data/vendor/assets/fonts/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff2 +0 -0
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +0 -178
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +0 -125
- data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +0 -1502
- data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +0 -224
- data/vendor/assets/javascripts/jquery-ui/data.js +0 -45
- 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/plugin.js +0 -49
- 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/unique-id.js +0 -54
- data/vendor/assets/javascripts/jquery-ui/version.js +0 -20
- data/vendor/assets/javascripts/jquery-ui/widget.js +0 -754
- 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/sortable.js +0 -1623
- data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +0 -931
- data/vendor/assets/javascripts/jquery_plugins/jquery.scrollTo.min.js +0 -7
- data/vendor/assets/javascripts/jquery_plugins/jquery.ui.tabspaging.js +0 -296
- data/vendor/assets/stylesheets/fontawesome/_animated.scss +0 -20
- data/vendor/assets/stylesheets/fontawesome/_bordered-pulled.scss +0 -20
- data/vendor/assets/stylesheets/fontawesome/_core.scss +0 -21
- data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +0 -6
- data/vendor/assets/stylesheets/fontawesome/_icons.scss +0 -1441
- data/vendor/assets/stylesheets/fontawesome/_larger.scss +0 -23
- data/vendor/assets/stylesheets/fontawesome/_list.scss +0 -18
- data/vendor/assets/stylesheets/fontawesome/_mixins.scss +0 -56
- data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +0 -24
- data/vendor/assets/stylesheets/fontawesome/_screen-reader.scss +0 -5
- data/vendor/assets/stylesheets/fontawesome/_stacked.scss +0 -31
- data/vendor/assets/stylesheets/fontawesome/_variables.scss +0 -1458
- data/vendor/assets/stylesheets/fontawesome/fontawesome.scss +0 -16
- data/vendor/assets/stylesheets/fontawesome/regular.scss +0 -23
- data/vendor/assets/stylesheets/fontawesome/solid.scss +0 -24
@@ -1,1623 +0,0 @@
|
|
1
|
-
//= require jquery-ui/widgets/mouse
|
2
|
-
//= require jquery-ui/data
|
3
|
-
//= require jquery-ui/ie
|
4
|
-
//= require jquery-ui/scroll-parent
|
5
|
-
//= require jquery-ui/version
|
6
|
-
//= require jquery-ui/widget
|
7
|
-
|
8
|
-
/*!
|
9
|
-
* jQuery UI Sortable 1.13.0
|
10
|
-
* http://jqueryui.com
|
11
|
-
*
|
12
|
-
* Copyright jQuery Foundation and other contributors
|
13
|
-
* Released under the MIT license.
|
14
|
-
* http://jquery.org/license
|
15
|
-
*/
|
16
|
-
|
17
|
-
//>>label: Sortable
|
18
|
-
//>>group: Interactions
|
19
|
-
//>>description: Enables items in a list to be sorted using the mouse.
|
20
|
-
//>>docs: http://api.jqueryui.com/sortable/
|
21
|
-
//>>demos: http://jqueryui.com/sortable/
|
22
|
-
//>>css.structure: ../../themes/base/sortable.css
|
23
|
-
|
24
|
-
( function( factory ) {
|
25
|
-
"use strict";
|
26
|
-
|
27
|
-
if ( typeof define === "function" && define.amd ) {
|
28
|
-
|
29
|
-
// AMD. Register as an anonymous module.
|
30
|
-
define( [
|
31
|
-
"jquery",
|
32
|
-
"./mouse",
|
33
|
-
"../data",
|
34
|
-
"../ie",
|
35
|
-
"../scroll-parent",
|
36
|
-
"../version",
|
37
|
-
"../widget"
|
38
|
-
], factory );
|
39
|
-
} else {
|
40
|
-
|
41
|
-
// Browser globals
|
42
|
-
factory( jQuery );
|
43
|
-
}
|
44
|
-
} )( function( $ ) {
|
45
|
-
"use strict";
|
46
|
-
|
47
|
-
return $.widget( "ui.sortable", $.ui.mouse, {
|
48
|
-
version: "1.13.0",
|
49
|
-
widgetEventPrefix: "sort",
|
50
|
-
ready: false,
|
51
|
-
options: {
|
52
|
-
appendTo: "parent",
|
53
|
-
axis: false,
|
54
|
-
connectWith: false,
|
55
|
-
containment: false,
|
56
|
-
cursor: "auto",
|
57
|
-
cursorAt: false,
|
58
|
-
dropOnEmpty: true,
|
59
|
-
forcePlaceholderSize: false,
|
60
|
-
forceHelperSize: false,
|
61
|
-
grid: false,
|
62
|
-
handle: false,
|
63
|
-
helper: "original",
|
64
|
-
items: "> *",
|
65
|
-
opacity: false,
|
66
|
-
placeholder: false,
|
67
|
-
revert: false,
|
68
|
-
scroll: true,
|
69
|
-
scrollSensitivity: 20,
|
70
|
-
scrollSpeed: 20,
|
71
|
-
scope: "default",
|
72
|
-
tolerance: "intersect",
|
73
|
-
zIndex: 1000,
|
74
|
-
|
75
|
-
// Callbacks
|
76
|
-
activate: null,
|
77
|
-
beforeStop: null,
|
78
|
-
change: null,
|
79
|
-
deactivate: null,
|
80
|
-
out: null,
|
81
|
-
over: null,
|
82
|
-
receive: null,
|
83
|
-
remove: null,
|
84
|
-
sort: null,
|
85
|
-
start: null,
|
86
|
-
stop: null,
|
87
|
-
update: null
|
88
|
-
},
|
89
|
-
|
90
|
-
_isOverAxis: function( x, reference, size ) {
|
91
|
-
return ( x >= reference ) && ( x < ( reference + size ) );
|
92
|
-
},
|
93
|
-
|
94
|
-
_isFloating: function( item ) {
|
95
|
-
return ( /left|right/ ).test( item.css( "float" ) ) ||
|
96
|
-
( /inline|table-cell/ ).test( item.css( "display" ) );
|
97
|
-
},
|
98
|
-
|
99
|
-
_create: function() {
|
100
|
-
this.containerCache = {};
|
101
|
-
this._addClass( "ui-sortable" );
|
102
|
-
|
103
|
-
//Get the items
|
104
|
-
this.refresh();
|
105
|
-
|
106
|
-
//Let's determine the parent's offset
|
107
|
-
this.offset = this.element.offset();
|
108
|
-
|
109
|
-
//Initialize mouse events for interaction
|
110
|
-
this._mouseInit();
|
111
|
-
|
112
|
-
this._setHandleClassName();
|
113
|
-
|
114
|
-
//We're ready to go
|
115
|
-
this.ready = true;
|
116
|
-
|
117
|
-
},
|
118
|
-
|
119
|
-
_setOption: function( key, value ) {
|
120
|
-
this._super( key, value );
|
121
|
-
|
122
|
-
if ( key === "handle" ) {
|
123
|
-
this._setHandleClassName();
|
124
|
-
}
|
125
|
-
},
|
126
|
-
|
127
|
-
_setHandleClassName: function() {
|
128
|
-
var that = this;
|
129
|
-
this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
|
130
|
-
$.each( this.items, function() {
|
131
|
-
that._addClass(
|
132
|
-
this.instance.options.handle ?
|
133
|
-
this.item.find( this.instance.options.handle ) :
|
134
|
-
this.item,
|
135
|
-
"ui-sortable-handle"
|
136
|
-
);
|
137
|
-
} );
|
138
|
-
},
|
139
|
-
|
140
|
-
_destroy: function() {
|
141
|
-
this._mouseDestroy();
|
142
|
-
|
143
|
-
for ( var i = this.items.length - 1; i >= 0; i-- ) {
|
144
|
-
this.items[ i ].item.removeData( this.widgetName + "-item" );
|
145
|
-
}
|
146
|
-
|
147
|
-
return this;
|
148
|
-
},
|
149
|
-
|
150
|
-
_mouseCapture: function( event, overrideHandle ) {
|
151
|
-
var currentItem = null,
|
152
|
-
validHandle = false,
|
153
|
-
that = this;
|
154
|
-
|
155
|
-
if ( this.reverting ) {
|
156
|
-
return false;
|
157
|
-
}
|
158
|
-
|
159
|
-
if ( this.options.disabled || this.options.type === "static" ) {
|
160
|
-
return false;
|
161
|
-
}
|
162
|
-
|
163
|
-
//We have to refresh the items data once first
|
164
|
-
this._refreshItems( event );
|
165
|
-
|
166
|
-
//Find out if the clicked node (or one of its parents) is a actual item in this.items
|
167
|
-
$( event.target ).parents().each( function() {
|
168
|
-
if ( $.data( this, that.widgetName + "-item" ) === that ) {
|
169
|
-
currentItem = $( this );
|
170
|
-
return false;
|
171
|
-
}
|
172
|
-
} );
|
173
|
-
if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
|
174
|
-
currentItem = $( event.target );
|
175
|
-
}
|
176
|
-
|
177
|
-
if ( !currentItem ) {
|
178
|
-
return false;
|
179
|
-
}
|
180
|
-
if ( this.options.handle && !overrideHandle ) {
|
181
|
-
$( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
|
182
|
-
if ( this === event.target ) {
|
183
|
-
validHandle = true;
|
184
|
-
}
|
185
|
-
} );
|
186
|
-
if ( !validHandle ) {
|
187
|
-
return false;
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
this.currentItem = currentItem;
|
192
|
-
this._removeCurrentsFromItems();
|
193
|
-
return true;
|
194
|
-
|
195
|
-
},
|
196
|
-
|
197
|
-
_mouseStart: function( event, overrideHandle, noActivation ) {
|
198
|
-
|
199
|
-
var i, body,
|
200
|
-
o = this.options;
|
201
|
-
|
202
|
-
this.currentContainer = this;
|
203
|
-
|
204
|
-
//We only need to call refreshPositions, because the refreshItems call has been moved to
|
205
|
-
// mouseCapture
|
206
|
-
this.refreshPositions();
|
207
|
-
|
208
|
-
//Prepare the dragged items parent
|
209
|
-
this.appendTo = $( o.appendTo !== "parent" ?
|
210
|
-
o.appendTo :
|
211
|
-
this.currentItem.parent() );
|
212
|
-
|
213
|
-
//Create and append the visible helper
|
214
|
-
this.helper = this._createHelper( event );
|
215
|
-
|
216
|
-
//Cache the helper size
|
217
|
-
this._cacheHelperProportions();
|
218
|
-
|
219
|
-
/*
|
220
|
-
* - Position generation -
|
221
|
-
* This block generates everything position related - it's the core of draggables.
|
222
|
-
*/
|
223
|
-
|
224
|
-
//Cache the margins of the original element
|
225
|
-
this._cacheMargins();
|
226
|
-
|
227
|
-
//The element's absolute position on the page minus margins
|
228
|
-
this.offset = this.currentItem.offset();
|
229
|
-
this.offset = {
|
230
|
-
top: this.offset.top - this.margins.top,
|
231
|
-
left: this.offset.left - this.margins.left
|
232
|
-
};
|
233
|
-
|
234
|
-
$.extend( this.offset, {
|
235
|
-
click: { //Where the click happened, relative to the element
|
236
|
-
left: event.pageX - this.offset.left,
|
237
|
-
top: event.pageY - this.offset.top
|
238
|
-
},
|
239
|
-
|
240
|
-
// This is a relative to absolute position minus the actual position calculation -
|
241
|
-
// only used for relative positioned helper
|
242
|
-
relative: this._getRelativeOffset()
|
243
|
-
} );
|
244
|
-
|
245
|
-
// After we get the helper offset, but before we get the parent offset we can
|
246
|
-
// change the helper's position to absolute
|
247
|
-
// TODO: Still need to figure out a way to make relative sorting possible
|
248
|
-
this.helper.css( "position", "absolute" );
|
249
|
-
this.cssPosition = this.helper.css( "position" );
|
250
|
-
|
251
|
-
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
|
252
|
-
if ( o.cursorAt ) {
|
253
|
-
this._adjustOffsetFromHelper( o.cursorAt );
|
254
|
-
}
|
255
|
-
|
256
|
-
//Cache the former DOM position
|
257
|
-
this.domPosition = {
|
258
|
-
prev: this.currentItem.prev()[ 0 ],
|
259
|
-
parent: this.currentItem.parent()[ 0 ]
|
260
|
-
};
|
261
|
-
|
262
|
-
// If the helper is not the original, hide the original so it's not playing any role during
|
263
|
-
// the drag, won't cause anything bad this way
|
264
|
-
if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
|
265
|
-
this.currentItem.hide();
|
266
|
-
}
|
267
|
-
|
268
|
-
//Create the placeholder
|
269
|
-
this._createPlaceholder();
|
270
|
-
|
271
|
-
//Get the next scrolling parent
|
272
|
-
this.scrollParent = this.placeholder.scrollParent();
|
273
|
-
|
274
|
-
$.extend( this.offset, {
|
275
|
-
parent: this._getParentOffset()
|
276
|
-
} );
|
277
|
-
|
278
|
-
//Set a containment if given in the options
|
279
|
-
if ( o.containment ) {
|
280
|
-
this._setContainment();
|
281
|
-
}
|
282
|
-
|
283
|
-
if ( o.cursor && o.cursor !== "auto" ) { // cursor option
|
284
|
-
body = this.document.find( "body" );
|
285
|
-
|
286
|
-
// Support: IE
|
287
|
-
this.storedCursor = body.css( "cursor" );
|
288
|
-
body.css( "cursor", o.cursor );
|
289
|
-
|
290
|
-
this.storedStylesheet =
|
291
|
-
$( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
|
292
|
-
}
|
293
|
-
|
294
|
-
// We need to make sure to grab the zIndex before setting the
|
295
|
-
// opacity, because setting the opacity to anything lower than 1
|
296
|
-
// causes the zIndex to change from "auto" to 0.
|
297
|
-
if ( o.zIndex ) { // zIndex option
|
298
|
-
if ( this.helper.css( "zIndex" ) ) {
|
299
|
-
this._storedZIndex = this.helper.css( "zIndex" );
|
300
|
-
}
|
301
|
-
this.helper.css( "zIndex", o.zIndex );
|
302
|
-
}
|
303
|
-
|
304
|
-
if ( o.opacity ) { // opacity option
|
305
|
-
if ( this.helper.css( "opacity" ) ) {
|
306
|
-
this._storedOpacity = this.helper.css( "opacity" );
|
307
|
-
}
|
308
|
-
this.helper.css( "opacity", o.opacity );
|
309
|
-
}
|
310
|
-
|
311
|
-
//Prepare scrolling
|
312
|
-
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
313
|
-
this.scrollParent[ 0 ].tagName !== "HTML" ) {
|
314
|
-
this.overflowOffset = this.scrollParent.offset();
|
315
|
-
}
|
316
|
-
|
317
|
-
//Call callbacks
|
318
|
-
this._trigger( "start", event, this._uiHash() );
|
319
|
-
|
320
|
-
//Recache the helper size
|
321
|
-
if ( !this._preserveHelperProportions ) {
|
322
|
-
this._cacheHelperProportions();
|
323
|
-
}
|
324
|
-
|
325
|
-
//Post "activate" events to possible containers
|
326
|
-
if ( !noActivation ) {
|
327
|
-
for ( i = this.containers.length - 1; i >= 0; i-- ) {
|
328
|
-
this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
|
329
|
-
}
|
330
|
-
}
|
331
|
-
|
332
|
-
//Prepare possible droppables
|
333
|
-
if ( $.ui.ddmanager ) {
|
334
|
-
$.ui.ddmanager.current = this;
|
335
|
-
}
|
336
|
-
|
337
|
-
if ( $.ui.ddmanager && !o.dropBehaviour ) {
|
338
|
-
$.ui.ddmanager.prepareOffsets( this, event );
|
339
|
-
}
|
340
|
-
|
341
|
-
this.dragging = true;
|
342
|
-
|
343
|
-
this._addClass( this.helper, "ui-sortable-helper" );
|
344
|
-
|
345
|
-
//Move the helper, if needed
|
346
|
-
if ( !this.helper.parent().is( this.appendTo ) ) {
|
347
|
-
this.helper.detach().appendTo( this.appendTo );
|
348
|
-
|
349
|
-
//Update position
|
350
|
-
this.offset.parent = this._getParentOffset();
|
351
|
-
}
|
352
|
-
|
353
|
-
//Generate the original position
|
354
|
-
this.position = this.originalPosition = this._generatePosition( event );
|
355
|
-
this.originalPageX = event.pageX;
|
356
|
-
this.originalPageY = event.pageY;
|
357
|
-
this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );
|
358
|
-
|
359
|
-
this._mouseDrag( event );
|
360
|
-
|
361
|
-
return true;
|
362
|
-
|
363
|
-
},
|
364
|
-
|
365
|
-
_scroll: function( event ) {
|
366
|
-
var o = this.options,
|
367
|
-
scrolled = false;
|
368
|
-
|
369
|
-
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
370
|
-
this.scrollParent[ 0 ].tagName !== "HTML" ) {
|
371
|
-
|
372
|
-
if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
|
373
|
-
event.pageY < o.scrollSensitivity ) {
|
374
|
-
this.scrollParent[ 0 ].scrollTop =
|
375
|
-
scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
|
376
|
-
} else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
|
377
|
-
this.scrollParent[ 0 ].scrollTop =
|
378
|
-
scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
|
379
|
-
}
|
380
|
-
|
381
|
-
if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
|
382
|
-
event.pageX < o.scrollSensitivity ) {
|
383
|
-
this.scrollParent[ 0 ].scrollLeft = scrolled =
|
384
|
-
this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
|
385
|
-
} else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
|
386
|
-
this.scrollParent[ 0 ].scrollLeft = scrolled =
|
387
|
-
this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
|
388
|
-
}
|
389
|
-
|
390
|
-
} else {
|
391
|
-
|
392
|
-
if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
|
393
|
-
scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
|
394
|
-
} else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
|
395
|
-
o.scrollSensitivity ) {
|
396
|
-
scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
|
397
|
-
}
|
398
|
-
|
399
|
-
if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
|
400
|
-
scrolled = this.document.scrollLeft(
|
401
|
-
this.document.scrollLeft() - o.scrollSpeed
|
402
|
-
);
|
403
|
-
} else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
|
404
|
-
o.scrollSensitivity ) {
|
405
|
-
scrolled = this.document.scrollLeft(
|
406
|
-
this.document.scrollLeft() + o.scrollSpeed
|
407
|
-
);
|
408
|
-
}
|
409
|
-
|
410
|
-
}
|
411
|
-
|
412
|
-
return scrolled;
|
413
|
-
},
|
414
|
-
|
415
|
-
_mouseDrag: function( event ) {
|
416
|
-
var i, item, itemElement, intersection,
|
417
|
-
o = this.options;
|
418
|
-
|
419
|
-
//Compute the helpers position
|
420
|
-
this.position = this._generatePosition( event );
|
421
|
-
this.positionAbs = this._convertPositionTo( "absolute" );
|
422
|
-
|
423
|
-
//Set the helper position
|
424
|
-
if ( !this.options.axis || this.options.axis !== "y" ) {
|
425
|
-
this.helper[ 0 ].style.left = this.position.left + "px";
|
426
|
-
}
|
427
|
-
if ( !this.options.axis || this.options.axis !== "x" ) {
|
428
|
-
this.helper[ 0 ].style.top = this.position.top + "px";
|
429
|
-
}
|
430
|
-
|
431
|
-
//Post events to containers
|
432
|
-
this._contactContainers( event );
|
433
|
-
|
434
|
-
if ( this.innermostContainer !== null ) {
|
435
|
-
|
436
|
-
//Do scrolling
|
437
|
-
if ( o.scroll ) {
|
438
|
-
if ( this._scroll( event ) !== false ) {
|
439
|
-
|
440
|
-
//Update item positions used in position checks
|
441
|
-
this._refreshItemPositions( true );
|
442
|
-
|
443
|
-
if ( $.ui.ddmanager && !o.dropBehaviour ) {
|
444
|
-
$.ui.ddmanager.prepareOffsets( this, event );
|
445
|
-
}
|
446
|
-
}
|
447
|
-
}
|
448
|
-
|
449
|
-
this.dragDirection = {
|
450
|
-
vertical: this._getDragVerticalDirection(),
|
451
|
-
horizontal: this._getDragHorizontalDirection()
|
452
|
-
};
|
453
|
-
|
454
|
-
//Rearrange
|
455
|
-
for ( i = this.items.length - 1; i >= 0; i-- ) {
|
456
|
-
|
457
|
-
//Cache variables and intersection, continue if no intersection
|
458
|
-
item = this.items[ i ];
|
459
|
-
itemElement = item.item[ 0 ];
|
460
|
-
intersection = this._intersectsWithPointer( item );
|
461
|
-
if ( !intersection ) {
|
462
|
-
continue;
|
463
|
-
}
|
464
|
-
|
465
|
-
// Only put the placeholder inside the current Container, skip all
|
466
|
-
// items from other containers. This works because when moving
|
467
|
-
// an item from one container to another the
|
468
|
-
// currentContainer is switched before the placeholder is moved.
|
469
|
-
//
|
470
|
-
// Without this, moving items in "sub-sortables" can cause
|
471
|
-
// the placeholder to jitter between the outer and inner container.
|
472
|
-
if ( item.instance !== this.currentContainer ) {
|
473
|
-
continue;
|
474
|
-
}
|
475
|
-
|
476
|
-
// Cannot intersect with itself
|
477
|
-
// no useless actions that have been done before
|
478
|
-
// no action if the item moved is the parent of the item checked
|
479
|
-
if ( itemElement !== this.currentItem[ 0 ] &&
|
480
|
-
this.placeholder[ intersection === 1 ?
|
481
|
-
"next" : "prev" ]()[ 0 ] !== itemElement &&
|
482
|
-
!$.contains( this.placeholder[ 0 ], itemElement ) &&
|
483
|
-
( this.options.type === "semi-dynamic" ?
|
484
|
-
!$.contains( this.element[ 0 ], itemElement ) :
|
485
|
-
true
|
486
|
-
)
|
487
|
-
) {
|
488
|
-
|
489
|
-
this.direction = intersection === 1 ? "down" : "up";
|
490
|
-
|
491
|
-
if ( this.options.tolerance === "pointer" ||
|
492
|
-
this._intersectsWithSides( item ) ) {
|
493
|
-
this._rearrange( event, item );
|
494
|
-
} else {
|
495
|
-
break;
|
496
|
-
}
|
497
|
-
|
498
|
-
this._trigger( "change", event, this._uiHash() );
|
499
|
-
break;
|
500
|
-
}
|
501
|
-
}
|
502
|
-
}
|
503
|
-
|
504
|
-
//Interconnect with droppables
|
505
|
-
if ( $.ui.ddmanager ) {
|
506
|
-
$.ui.ddmanager.drag( this, event );
|
507
|
-
}
|
508
|
-
|
509
|
-
//Call callbacks
|
510
|
-
this._trigger( "sort", event, this._uiHash() );
|
511
|
-
|
512
|
-
this.lastPositionAbs = this.positionAbs;
|
513
|
-
return false;
|
514
|
-
|
515
|
-
},
|
516
|
-
|
517
|
-
_mouseStop: function( event, noPropagation ) {
|
518
|
-
|
519
|
-
if ( !event ) {
|
520
|
-
return;
|
521
|
-
}
|
522
|
-
|
523
|
-
//If we are using droppables, inform the manager about the drop
|
524
|
-
if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
|
525
|
-
$.ui.ddmanager.drop( this, event );
|
526
|
-
}
|
527
|
-
|
528
|
-
if ( this.options.revert ) {
|
529
|
-
var that = this,
|
530
|
-
cur = this.placeholder.offset(),
|
531
|
-
axis = this.options.axis,
|
532
|
-
animation = {};
|
533
|
-
|
534
|
-
if ( !axis || axis === "x" ) {
|
535
|
-
animation.left = cur.left - this.offset.parent.left - this.margins.left +
|
536
|
-
( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
|
537
|
-
0 :
|
538
|
-
this.offsetParent[ 0 ].scrollLeft
|
539
|
-
);
|
540
|
-
}
|
541
|
-
if ( !axis || axis === "y" ) {
|
542
|
-
animation.top = cur.top - this.offset.parent.top - this.margins.top +
|
543
|
-
( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
|
544
|
-
0 :
|
545
|
-
this.offsetParent[ 0 ].scrollTop
|
546
|
-
);
|
547
|
-
}
|
548
|
-
this.reverting = true;
|
549
|
-
$( this.helper ).animate(
|
550
|
-
animation,
|
551
|
-
parseInt( this.options.revert, 10 ) || 500,
|
552
|
-
function() {
|
553
|
-
that._clear( event );
|
554
|
-
}
|
555
|
-
);
|
556
|
-
} else {
|
557
|
-
this._clear( event, noPropagation );
|
558
|
-
}
|
559
|
-
|
560
|
-
return false;
|
561
|
-
|
562
|
-
},
|
563
|
-
|
564
|
-
cancel: function() {
|
565
|
-
|
566
|
-
if ( this.dragging ) {
|
567
|
-
|
568
|
-
this._mouseUp( new $.Event( "mouseup", { target: null } ) );
|
569
|
-
|
570
|
-
if ( this.options.helper === "original" ) {
|
571
|
-
this.currentItem.css( this._storedCSS );
|
572
|
-
this._removeClass( this.currentItem, "ui-sortable-helper" );
|
573
|
-
} else {
|
574
|
-
this.currentItem.show();
|
575
|
-
}
|
576
|
-
|
577
|
-
//Post deactivating events to containers
|
578
|
-
for ( var i = this.containers.length - 1; i >= 0; i-- ) {
|
579
|
-
this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
|
580
|
-
if ( this.containers[ i ].containerCache.over ) {
|
581
|
-
this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
|
582
|
-
this.containers[ i ].containerCache.over = 0;
|
583
|
-
}
|
584
|
-
}
|
585
|
-
|
586
|
-
}
|
587
|
-
|
588
|
-
if ( this.placeholder ) {
|
589
|
-
|
590
|
-
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
|
591
|
-
// it unbinds ALL events from the original node!
|
592
|
-
if ( this.placeholder[ 0 ].parentNode ) {
|
593
|
-
this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
|
594
|
-
}
|
595
|
-
if ( this.options.helper !== "original" && this.helper &&
|
596
|
-
this.helper[ 0 ].parentNode ) {
|
597
|
-
this.helper.remove();
|
598
|
-
}
|
599
|
-
|
600
|
-
$.extend( this, {
|
601
|
-
helper: null,
|
602
|
-
dragging: false,
|
603
|
-
reverting: false,
|
604
|
-
_noFinalSort: null
|
605
|
-
} );
|
606
|
-
|
607
|
-
if ( this.domPosition.prev ) {
|
608
|
-
$( this.domPosition.prev ).after( this.currentItem );
|
609
|
-
} else {
|
610
|
-
$( this.domPosition.parent ).prepend( this.currentItem );
|
611
|
-
}
|
612
|
-
}
|
613
|
-
|
614
|
-
return this;
|
615
|
-
|
616
|
-
},
|
617
|
-
|
618
|
-
serialize: function( o ) {
|
619
|
-
|
620
|
-
var items = this._getItemsAsjQuery( o && o.connected ),
|
621
|
-
str = [];
|
622
|
-
o = o || {};
|
623
|
-
|
624
|
-
$( items ).each( function() {
|
625
|
-
var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
|
626
|
-
.match( o.expression || ( /(.+)[\-=_](.+)/ ) );
|
627
|
-
if ( res ) {
|
628
|
-
str.push(
|
629
|
-
( o.key || res[ 1 ] + "[]" ) +
|
630
|
-
"=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
|
631
|
-
}
|
632
|
-
} );
|
633
|
-
|
634
|
-
if ( !str.length && o.key ) {
|
635
|
-
str.push( o.key + "=" );
|
636
|
-
}
|
637
|
-
|
638
|
-
return str.join( "&" );
|
639
|
-
|
640
|
-
},
|
641
|
-
|
642
|
-
toArray: function( o ) {
|
643
|
-
|
644
|
-
var items = this._getItemsAsjQuery( o && o.connected ),
|
645
|
-
ret = [];
|
646
|
-
|
647
|
-
o = o || {};
|
648
|
-
|
649
|
-
items.each( function() {
|
650
|
-
ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
|
651
|
-
} );
|
652
|
-
return ret;
|
653
|
-
|
654
|
-
},
|
655
|
-
|
656
|
-
/* Be careful with the following core functions */
|
657
|
-
_intersectsWith: function( item ) {
|
658
|
-
|
659
|
-
var x1 = this.positionAbs.left,
|
660
|
-
x2 = x1 + this.helperProportions.width,
|
661
|
-
y1 = this.positionAbs.top,
|
662
|
-
y2 = y1 + this.helperProportions.height,
|
663
|
-
l = item.left,
|
664
|
-
r = l + item.width,
|
665
|
-
t = item.top,
|
666
|
-
b = t + item.height,
|
667
|
-
dyClick = this.offset.click.top,
|
668
|
-
dxClick = this.offset.click.left,
|
669
|
-
isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
|
670
|
-
( y1 + dyClick ) < b ),
|
671
|
-
isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
|
672
|
-
( x1 + dxClick ) < r ),
|
673
|
-
isOverElement = isOverElementHeight && isOverElementWidth;
|
674
|
-
|
675
|
-
if ( this.options.tolerance === "pointer" ||
|
676
|
-
this.options.forcePointerForContainers ||
|
677
|
-
( this.options.tolerance !== "pointer" &&
|
678
|
-
this.helperProportions[ this.floating ? "width" : "height" ] >
|
679
|
-
item[ this.floating ? "width" : "height" ] )
|
680
|
-
) {
|
681
|
-
return isOverElement;
|
682
|
-
} else {
|
683
|
-
|
684
|
-
return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
|
685
|
-
x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
|
686
|
-
t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
|
687
|
-
y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
|
688
|
-
|
689
|
-
}
|
690
|
-
},
|
691
|
-
|
692
|
-
_intersectsWithPointer: function( item ) {
|
693
|
-
var verticalDirection, horizontalDirection,
|
694
|
-
isOverElementHeight = ( this.options.axis === "x" ) ||
|
695
|
-
this._isOverAxis(
|
696
|
-
this.positionAbs.top + this.offset.click.top, item.top, item.height ),
|
697
|
-
isOverElementWidth = ( this.options.axis === "y" ) ||
|
698
|
-
this._isOverAxis(
|
699
|
-
this.positionAbs.left + this.offset.click.left, item.left, item.width ),
|
700
|
-
isOverElement = isOverElementHeight && isOverElementWidth;
|
701
|
-
|
702
|
-
if ( !isOverElement ) {
|
703
|
-
return false;
|
704
|
-
}
|
705
|
-
|
706
|
-
verticalDirection = this.dragDirection.vertical;
|
707
|
-
horizontalDirection = this.dragDirection.horizontal;
|
708
|
-
|
709
|
-
return this.floating ?
|
710
|
-
( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
|
711
|
-
( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
|
712
|
-
|
713
|
-
},
|
714
|
-
|
715
|
-
_intersectsWithSides: function( item ) {
|
716
|
-
|
717
|
-
var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
|
718
|
-
this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
|
719
|
-
isOverRightHalf = this._isOverAxis( this.positionAbs.left +
|
720
|
-
this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
|
721
|
-
verticalDirection = this.dragDirection.vertical,
|
722
|
-
horizontalDirection = this.dragDirection.horizontal;
|
723
|
-
|
724
|
-
if ( this.floating && horizontalDirection ) {
|
725
|
-
return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
|
726
|
-
( horizontalDirection === "left" && !isOverRightHalf ) );
|
727
|
-
} else {
|
728
|
-
return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
|
729
|
-
( verticalDirection === "up" && !isOverBottomHalf ) );
|
730
|
-
}
|
731
|
-
|
732
|
-
},
|
733
|
-
|
734
|
-
_getDragVerticalDirection: function() {
|
735
|
-
var delta = this.positionAbs.top - this.lastPositionAbs.top;
|
736
|
-
return delta !== 0 && ( delta > 0 ? "down" : "up" );
|
737
|
-
},
|
738
|
-
|
739
|
-
_getDragHorizontalDirection: function() {
|
740
|
-
var delta = this.positionAbs.left - this.lastPositionAbs.left;
|
741
|
-
return delta !== 0 && ( delta > 0 ? "right" : "left" );
|
742
|
-
},
|
743
|
-
|
744
|
-
refresh: function( event ) {
|
745
|
-
this._refreshItems( event );
|
746
|
-
this._setHandleClassName();
|
747
|
-
this.refreshPositions();
|
748
|
-
return this;
|
749
|
-
},
|
750
|
-
|
751
|
-
_connectWith: function() {
|
752
|
-
var options = this.options;
|
753
|
-
return options.connectWith.constructor === String ?
|
754
|
-
[ options.connectWith ] :
|
755
|
-
options.connectWith;
|
756
|
-
},
|
757
|
-
|
758
|
-
_getItemsAsjQuery: function( connected ) {
|
759
|
-
|
760
|
-
var i, j, cur, inst,
|
761
|
-
items = [],
|
762
|
-
queries = [],
|
763
|
-
connectWith = this._connectWith();
|
764
|
-
|
765
|
-
if ( connectWith && connected ) {
|
766
|
-
for ( i = connectWith.length - 1; i >= 0; i-- ) {
|
767
|
-
cur = $( connectWith[ i ], this.document[ 0 ] );
|
768
|
-
for ( j = cur.length - 1; j >= 0; j-- ) {
|
769
|
-
inst = $.data( cur[ j ], this.widgetFullName );
|
770
|
-
if ( inst && inst !== this && !inst.options.disabled ) {
|
771
|
-
queries.push( [ typeof inst.options.items === "function" ?
|
772
|
-
inst.options.items.call( inst.element ) :
|
773
|
-
$( inst.options.items, inst.element )
|
774
|
-
.not( ".ui-sortable-helper" )
|
775
|
-
.not( ".ui-sortable-placeholder" ), inst ] );
|
776
|
-
}
|
777
|
-
}
|
778
|
-
}
|
779
|
-
}
|
780
|
-
|
781
|
-
queries.push( [ typeof this.options.items === "function" ?
|
782
|
-
this.options.items
|
783
|
-
.call( this.element, null, { options: this.options, item: this.currentItem } ) :
|
784
|
-
$( this.options.items, this.element )
|
785
|
-
.not( ".ui-sortable-helper" )
|
786
|
-
.not( ".ui-sortable-placeholder" ), this ] );
|
787
|
-
|
788
|
-
function addItems() {
|
789
|
-
items.push( this );
|
790
|
-
}
|
791
|
-
for ( i = queries.length - 1; i >= 0; i-- ) {
|
792
|
-
queries[ i ][ 0 ].each( addItems );
|
793
|
-
}
|
794
|
-
|
795
|
-
return $( items );
|
796
|
-
|
797
|
-
},
|
798
|
-
|
799
|
-
_removeCurrentsFromItems: function() {
|
800
|
-
|
801
|
-
var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
|
802
|
-
|
803
|
-
this.items = $.grep( this.items, function( item ) {
|
804
|
-
for ( var j = 0; j < list.length; j++ ) {
|
805
|
-
if ( list[ j ] === item.item[ 0 ] ) {
|
806
|
-
return false;
|
807
|
-
}
|
808
|
-
}
|
809
|
-
return true;
|
810
|
-
} );
|
811
|
-
|
812
|
-
},
|
813
|
-
|
814
|
-
_refreshItems: function( event ) {
|
815
|
-
|
816
|
-
this.items = [];
|
817
|
-
this.containers = [ this ];
|
818
|
-
|
819
|
-
var i, j, cur, inst, targetData, _queries, item, queriesLength,
|
820
|
-
items = this.items,
|
821
|
-
queries = [ [ typeof this.options.items === "function" ?
|
822
|
-
this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
|
823
|
-
$( this.options.items, this.element ), this ] ],
|
824
|
-
connectWith = this._connectWith();
|
825
|
-
|
826
|
-
//Shouldn't be run the first time through due to massive slow-down
|
827
|
-
if ( connectWith && this.ready ) {
|
828
|
-
for ( i = connectWith.length - 1; i >= 0; i-- ) {
|
829
|
-
cur = $( connectWith[ i ], this.document[ 0 ] );
|
830
|
-
for ( j = cur.length - 1; j >= 0; j-- ) {
|
831
|
-
inst = $.data( cur[ j ], this.widgetFullName );
|
832
|
-
if ( inst && inst !== this && !inst.options.disabled ) {
|
833
|
-
queries.push( [ typeof inst.options.items === "function" ?
|
834
|
-
inst.options.items
|
835
|
-
.call( inst.element[ 0 ], event, { item: this.currentItem } ) :
|
836
|
-
$( inst.options.items, inst.element ), inst ] );
|
837
|
-
this.containers.push( inst );
|
838
|
-
}
|
839
|
-
}
|
840
|
-
}
|
841
|
-
}
|
842
|
-
|
843
|
-
for ( i = queries.length - 1; i >= 0; i-- ) {
|
844
|
-
targetData = queries[ i ][ 1 ];
|
845
|
-
_queries = queries[ i ][ 0 ];
|
846
|
-
|
847
|
-
for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
|
848
|
-
item = $( _queries[ j ] );
|
849
|
-
|
850
|
-
// Data for target checking (mouse manager)
|
851
|
-
item.data( this.widgetName + "-item", targetData );
|
852
|
-
|
853
|
-
items.push( {
|
854
|
-
item: item,
|
855
|
-
instance: targetData,
|
856
|
-
width: 0, height: 0,
|
857
|
-
left: 0, top: 0
|
858
|
-
} );
|
859
|
-
}
|
860
|
-
}
|
861
|
-
|
862
|
-
},
|
863
|
-
|
864
|
-
_refreshItemPositions: function( fast ) {
|
865
|
-
var i, item, t, p;
|
866
|
-
|
867
|
-
for ( i = this.items.length - 1; i >= 0; i-- ) {
|
868
|
-
item = this.items[ i ];
|
869
|
-
|
870
|
-
//We ignore calculating positions of all connected containers when we're not over them
|
871
|
-
if ( this.currentContainer && item.instance !== this.currentContainer &&
|
872
|
-
item.item[ 0 ] !== this.currentItem[ 0 ] ) {
|
873
|
-
continue;
|
874
|
-
}
|
875
|
-
|
876
|
-
t = this.options.toleranceElement ?
|
877
|
-
$( this.options.toleranceElement, item.item ) :
|
878
|
-
item.item;
|
879
|
-
|
880
|
-
if ( !fast ) {
|
881
|
-
item.width = t.outerWidth();
|
882
|
-
item.height = t.outerHeight();
|
883
|
-
}
|
884
|
-
|
885
|
-
p = t.offset();
|
886
|
-
item.left = p.left;
|
887
|
-
item.top = p.top;
|
888
|
-
}
|
889
|
-
},
|
890
|
-
|
891
|
-
refreshPositions: function( fast ) {
|
892
|
-
|
893
|
-
// Determine whether items are being displayed horizontally
|
894
|
-
this.floating = this.items.length ?
|
895
|
-
this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
|
896
|
-
false;
|
897
|
-
|
898
|
-
if ( this.innermostContainer !== null ) {
|
899
|
-
this._refreshItemPositions( fast );
|
900
|
-
}
|
901
|
-
|
902
|
-
var i, p;
|
903
|
-
|
904
|
-
if ( this.options.custom && this.options.custom.refreshContainers ) {
|
905
|
-
this.options.custom.refreshContainers.call( this );
|
906
|
-
} else {
|
907
|
-
for ( i = this.containers.length - 1; i >= 0; i-- ) {
|
908
|
-
p = this.containers[ i ].element.offset();
|
909
|
-
this.containers[ i ].containerCache.left = p.left;
|
910
|
-
this.containers[ i ].containerCache.top = p.top;
|
911
|
-
this.containers[ i ].containerCache.width =
|
912
|
-
this.containers[ i ].element.outerWidth();
|
913
|
-
this.containers[ i ].containerCache.height =
|
914
|
-
this.containers[ i ].element.outerHeight();
|
915
|
-
}
|
916
|
-
}
|
917
|
-
|
918
|
-
return this;
|
919
|
-
},
|
920
|
-
|
921
|
-
_createPlaceholder: function( that ) {
|
922
|
-
that = that || this;
|
923
|
-
var className, nodeName,
|
924
|
-
o = that.options;
|
925
|
-
|
926
|
-
if ( !o.placeholder || o.placeholder.constructor === String ) {
|
927
|
-
className = o.placeholder;
|
928
|
-
nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
|
929
|
-
o.placeholder = {
|
930
|
-
element: function() {
|
931
|
-
|
932
|
-
var element = $( "<" + nodeName + ">", that.document[ 0 ] );
|
933
|
-
|
934
|
-
that._addClass( element, "ui-sortable-placeholder",
|
935
|
-
className || that.currentItem[ 0 ].className )
|
936
|
-
._removeClass( element, "ui-sortable-helper" );
|
937
|
-
|
938
|
-
if ( nodeName === "tbody" ) {
|
939
|
-
that._createTrPlaceholder(
|
940
|
-
that.currentItem.find( "tr" ).eq( 0 ),
|
941
|
-
$( "<tr>", that.document[ 0 ] ).appendTo( element )
|
942
|
-
);
|
943
|
-
} else if ( nodeName === "tr" ) {
|
944
|
-
that._createTrPlaceholder( that.currentItem, element );
|
945
|
-
} else if ( nodeName === "img" ) {
|
946
|
-
element.attr( "src", that.currentItem.attr( "src" ) );
|
947
|
-
}
|
948
|
-
|
949
|
-
if ( !className ) {
|
950
|
-
element.css( "visibility", "hidden" );
|
951
|
-
}
|
952
|
-
|
953
|
-
return element;
|
954
|
-
},
|
955
|
-
update: function( container, p ) {
|
956
|
-
|
957
|
-
// 1. If a className is set as 'placeholder option, we don't force sizes -
|
958
|
-
// the class is responsible for that
|
959
|
-
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a
|
960
|
-
// class name is specified
|
961
|
-
if ( className && !o.forcePlaceholderSize ) {
|
962
|
-
return;
|
963
|
-
}
|
964
|
-
|
965
|
-
// If the element doesn't have a actual height or width by itself (without
|
966
|
-
// styles coming from a stylesheet), it receives the inline height and width
|
967
|
-
// from the dragged item. Or, if it's a tbody or tr, it's going to have a height
|
968
|
-
// anyway since we're populating them with <td>s above, but they're unlikely to
|
969
|
-
// be the correct height on their own if the row heights are dynamic, so we'll
|
970
|
-
// always assign the height of the dragged item given forcePlaceholderSize
|
971
|
-
// is true.
|
972
|
-
if ( !p.height() || ( o.forcePlaceholderSize &&
|
973
|
-
( nodeName === "tbody" || nodeName === "tr" ) ) ) {
|
974
|
-
p.height(
|
975
|
-
that.currentItem.innerHeight() -
|
976
|
-
parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
|
977
|
-
parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
|
978
|
-
}
|
979
|
-
if ( !p.width() ) {
|
980
|
-
p.width(
|
981
|
-
that.currentItem.innerWidth() -
|
982
|
-
parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
|
983
|
-
parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
|
984
|
-
}
|
985
|
-
}
|
986
|
-
};
|
987
|
-
}
|
988
|
-
|
989
|
-
//Create the placeholder
|
990
|
-
that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
|
991
|
-
|
992
|
-
//Append it after the actual current item
|
993
|
-
that.currentItem.after( that.placeholder );
|
994
|
-
|
995
|
-
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
|
996
|
-
o.placeholder.update( that, that.placeholder );
|
997
|
-
|
998
|
-
},
|
999
|
-
|
1000
|
-
_createTrPlaceholder: function( sourceTr, targetTr ) {
|
1001
|
-
var that = this;
|
1002
|
-
|
1003
|
-
sourceTr.children().each( function() {
|
1004
|
-
$( "<td> </td>", that.document[ 0 ] )
|
1005
|
-
.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
|
1006
|
-
.appendTo( targetTr );
|
1007
|
-
} );
|
1008
|
-
},
|
1009
|
-
|
1010
|
-
_contactContainers: function( event ) {
|
1011
|
-
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
|
1012
|
-
floating, axis,
|
1013
|
-
innermostContainer = null,
|
1014
|
-
innermostIndex = null;
|
1015
|
-
|
1016
|
-
// Get innermost container that intersects with item
|
1017
|
-
for ( i = this.containers.length - 1; i >= 0; i-- ) {
|
1018
|
-
|
1019
|
-
// Never consider a container that's located within the item itself
|
1020
|
-
if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
|
1021
|
-
continue;
|
1022
|
-
}
|
1023
|
-
|
1024
|
-
if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
|
1025
|
-
|
1026
|
-
// If we've already found a container and it's more "inner" than this, then continue
|
1027
|
-
if ( innermostContainer &&
|
1028
|
-
$.contains(
|
1029
|
-
this.containers[ i ].element[ 0 ],
|
1030
|
-
innermostContainer.element[ 0 ] ) ) {
|
1031
|
-
continue;
|
1032
|
-
}
|
1033
|
-
|
1034
|
-
innermostContainer = this.containers[ i ];
|
1035
|
-
innermostIndex = i;
|
1036
|
-
|
1037
|
-
} else {
|
1038
|
-
|
1039
|
-
// container doesn't intersect. trigger "out" event if necessary
|
1040
|
-
if ( this.containers[ i ].containerCache.over ) {
|
1041
|
-
this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
|
1042
|
-
this.containers[ i ].containerCache.over = 0;
|
1043
|
-
}
|
1044
|
-
}
|
1045
|
-
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
this.innermostContainer = innermostContainer;
|
1049
|
-
|
1050
|
-
// If no intersecting containers found, return
|
1051
|
-
if ( !innermostContainer ) {
|
1052
|
-
return;
|
1053
|
-
}
|
1054
|
-
|
1055
|
-
// Move the item into the container if it's not there already
|
1056
|
-
if ( this.containers.length === 1 ) {
|
1057
|
-
if ( !this.containers[ innermostIndex ].containerCache.over ) {
|
1058
|
-
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
|
1059
|
-
this.containers[ innermostIndex ].containerCache.over = 1;
|
1060
|
-
}
|
1061
|
-
} else {
|
1062
|
-
|
1063
|
-
// When entering a new container, we will find the item with the least distance and
|
1064
|
-
// append our item near it
|
1065
|
-
dist = 10000;
|
1066
|
-
itemWithLeastDistance = null;
|
1067
|
-
floating = innermostContainer.floating || this._isFloating( this.currentItem );
|
1068
|
-
posProperty = floating ? "left" : "top";
|
1069
|
-
sizeProperty = floating ? "width" : "height";
|
1070
|
-
axis = floating ? "pageX" : "pageY";
|
1071
|
-
|
1072
|
-
for ( j = this.items.length - 1; j >= 0; j-- ) {
|
1073
|
-
if ( !$.contains(
|
1074
|
-
this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
|
1075
|
-
) {
|
1076
|
-
continue;
|
1077
|
-
}
|
1078
|
-
if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
|
1079
|
-
continue;
|
1080
|
-
}
|
1081
|
-
|
1082
|
-
cur = this.items[ j ].item.offset()[ posProperty ];
|
1083
|
-
nearBottom = false;
|
1084
|
-
if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
|
1085
|
-
nearBottom = true;
|
1086
|
-
}
|
1087
|
-
|
1088
|
-
if ( Math.abs( event[ axis ] - cur ) < dist ) {
|
1089
|
-
dist = Math.abs( event[ axis ] - cur );
|
1090
|
-
itemWithLeastDistance = this.items[ j ];
|
1091
|
-
this.direction = nearBottom ? "up" : "down";
|
1092
|
-
}
|
1093
|
-
}
|
1094
|
-
|
1095
|
-
//Check if dropOnEmpty is enabled
|
1096
|
-
if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
|
1097
|
-
return;
|
1098
|
-
}
|
1099
|
-
|
1100
|
-
if ( this.currentContainer === this.containers[ innermostIndex ] ) {
|
1101
|
-
if ( !this.currentContainer.containerCache.over ) {
|
1102
|
-
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
|
1103
|
-
this.currentContainer.containerCache.over = 1;
|
1104
|
-
}
|
1105
|
-
return;
|
1106
|
-
}
|
1107
|
-
|
1108
|
-
if ( itemWithLeastDistance ) {
|
1109
|
-
this._rearrange( event, itemWithLeastDistance, null, true );
|
1110
|
-
} else {
|
1111
|
-
this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
|
1112
|
-
}
|
1113
|
-
this._trigger( "change", event, this._uiHash() );
|
1114
|
-
this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
|
1115
|
-
this.currentContainer = this.containers[ innermostIndex ];
|
1116
|
-
|
1117
|
-
//Update the placeholder
|
1118
|
-
this.options.placeholder.update( this.currentContainer, this.placeholder );
|
1119
|
-
|
1120
|
-
//Update scrollParent
|
1121
|
-
this.scrollParent = this.placeholder.scrollParent();
|
1122
|
-
|
1123
|
-
//Update overflowOffset
|
1124
|
-
if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
1125
|
-
this.scrollParent[ 0 ].tagName !== "HTML" ) {
|
1126
|
-
this.overflowOffset = this.scrollParent.offset();
|
1127
|
-
}
|
1128
|
-
|
1129
|
-
this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
|
1130
|
-
this.containers[ innermostIndex ].containerCache.over = 1;
|
1131
|
-
}
|
1132
|
-
|
1133
|
-
},
|
1134
|
-
|
1135
|
-
_createHelper: function( event ) {
|
1136
|
-
|
1137
|
-
var o = this.options,
|
1138
|
-
helper = typeof o.helper === "function" ?
|
1139
|
-
$( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
|
1140
|
-
( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
|
1141
|
-
|
1142
|
-
//Add the helper to the DOM if that didn't happen already
|
1143
|
-
if ( !helper.parents( "body" ).length ) {
|
1144
|
-
this.appendTo[ 0 ].appendChild( helper[ 0 ] );
|
1145
|
-
}
|
1146
|
-
|
1147
|
-
if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
|
1148
|
-
this._storedCSS = {
|
1149
|
-
width: this.currentItem[ 0 ].style.width,
|
1150
|
-
height: this.currentItem[ 0 ].style.height,
|
1151
|
-
position: this.currentItem.css( "position" ),
|
1152
|
-
top: this.currentItem.css( "top" ),
|
1153
|
-
left: this.currentItem.css( "left" )
|
1154
|
-
};
|
1155
|
-
}
|
1156
|
-
|
1157
|
-
if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
|
1158
|
-
helper.width( this.currentItem.width() );
|
1159
|
-
}
|
1160
|
-
if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
|
1161
|
-
helper.height( this.currentItem.height() );
|
1162
|
-
}
|
1163
|
-
|
1164
|
-
return helper;
|
1165
|
-
|
1166
|
-
},
|
1167
|
-
|
1168
|
-
_adjustOffsetFromHelper: function( obj ) {
|
1169
|
-
if ( typeof obj === "string" ) {
|
1170
|
-
obj = obj.split( " " );
|
1171
|
-
}
|
1172
|
-
if ( Array.isArray( obj ) ) {
|
1173
|
-
obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
|
1174
|
-
}
|
1175
|
-
if ( "left" in obj ) {
|
1176
|
-
this.offset.click.left = obj.left + this.margins.left;
|
1177
|
-
}
|
1178
|
-
if ( "right" in obj ) {
|
1179
|
-
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
1180
|
-
}
|
1181
|
-
if ( "top" in obj ) {
|
1182
|
-
this.offset.click.top = obj.top + this.margins.top;
|
1183
|
-
}
|
1184
|
-
if ( "bottom" in obj ) {
|
1185
|
-
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
1186
|
-
}
|
1187
|
-
},
|
1188
|
-
|
1189
|
-
_getParentOffset: function() {
|
1190
|
-
|
1191
|
-
//Get the offsetParent and cache its position
|
1192
|
-
this.offsetParent = this.helper.offsetParent();
|
1193
|
-
var po = this.offsetParent.offset();
|
1194
|
-
|
1195
|
-
// This is a special case where we need to modify a offset calculated on start, since the
|
1196
|
-
// following happened:
|
1197
|
-
// 1. The position of the helper is absolute, so it's position is calculated based on the
|
1198
|
-
// next positioned parent
|
1199
|
-
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
|
1200
|
-
// the document, which means that the scroll is included in the initial calculation of the
|
1201
|
-
// offset of the parent, and never recalculated upon drag
|
1202
|
-
if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
1203
|
-
$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
|
1204
|
-
po.left += this.scrollParent.scrollLeft();
|
1205
|
-
po.top += this.scrollParent.scrollTop();
|
1206
|
-
}
|
1207
|
-
|
1208
|
-
// This needs to be actually done for all browsers, since pageX/pageY includes this
|
1209
|
-
// information with an ugly IE fix
|
1210
|
-
if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
|
1211
|
-
( this.offsetParent[ 0 ].tagName &&
|
1212
|
-
this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
|
1213
|
-
po = { top: 0, left: 0 };
|
1214
|
-
}
|
1215
|
-
|
1216
|
-
return {
|
1217
|
-
top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
|
1218
|
-
left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
|
1219
|
-
};
|
1220
|
-
|
1221
|
-
},
|
1222
|
-
|
1223
|
-
_getRelativeOffset: function() {
|
1224
|
-
|
1225
|
-
if ( this.cssPosition === "relative" ) {
|
1226
|
-
var p = this.currentItem.position();
|
1227
|
-
return {
|
1228
|
-
top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
|
1229
|
-
this.scrollParent.scrollTop(),
|
1230
|
-
left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
|
1231
|
-
this.scrollParent.scrollLeft()
|
1232
|
-
};
|
1233
|
-
} else {
|
1234
|
-
return { top: 0, left: 0 };
|
1235
|
-
}
|
1236
|
-
|
1237
|
-
},
|
1238
|
-
|
1239
|
-
_cacheMargins: function() {
|
1240
|
-
this.margins = {
|
1241
|
-
left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
|
1242
|
-
top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
|
1243
|
-
};
|
1244
|
-
},
|
1245
|
-
|
1246
|
-
_cacheHelperProportions: function() {
|
1247
|
-
this.helperProportions = {
|
1248
|
-
width: this.helper.outerWidth(),
|
1249
|
-
height: this.helper.outerHeight()
|
1250
|
-
};
|
1251
|
-
},
|
1252
|
-
|
1253
|
-
_setContainment: function() {
|
1254
|
-
|
1255
|
-
var ce, co, over,
|
1256
|
-
o = this.options;
|
1257
|
-
if ( o.containment === "parent" ) {
|
1258
|
-
o.containment = this.helper[ 0 ].parentNode;
|
1259
|
-
}
|
1260
|
-
if ( o.containment === "document" || o.containment === "window" ) {
|
1261
|
-
this.containment = [
|
1262
|
-
0 - this.offset.relative.left - this.offset.parent.left,
|
1263
|
-
0 - this.offset.relative.top - this.offset.parent.top,
|
1264
|
-
o.containment === "document" ?
|
1265
|
-
this.document.width() :
|
1266
|
-
this.window.width() - this.helperProportions.width - this.margins.left,
|
1267
|
-
( o.containment === "document" ?
|
1268
|
-
( this.document.height() || document.body.parentNode.scrollHeight ) :
|
1269
|
-
this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
|
1270
|
-
) - this.helperProportions.height - this.margins.top
|
1271
|
-
];
|
1272
|
-
}
|
1273
|
-
|
1274
|
-
if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
|
1275
|
-
ce = $( o.containment )[ 0 ];
|
1276
|
-
co = $( o.containment ).offset();
|
1277
|
-
over = ( $( ce ).css( "overflow" ) !== "hidden" );
|
1278
|
-
|
1279
|
-
this.containment = [
|
1280
|
-
co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
|
1281
|
-
( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
|
1282
|
-
co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
|
1283
|
-
( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
|
1284
|
-
co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
|
1285
|
-
( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
|
1286
|
-
( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
|
1287
|
-
this.helperProportions.width - this.margins.left,
|
1288
|
-
co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
|
1289
|
-
( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
|
1290
|
-
( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
|
1291
|
-
this.helperProportions.height - this.margins.top
|
1292
|
-
];
|
1293
|
-
}
|
1294
|
-
|
1295
|
-
},
|
1296
|
-
|
1297
|
-
_convertPositionTo: function( d, pos ) {
|
1298
|
-
|
1299
|
-
if ( !pos ) {
|
1300
|
-
pos = this.position;
|
1301
|
-
}
|
1302
|
-
var mod = d === "absolute" ? 1 : -1,
|
1303
|
-
scroll = this.cssPosition === "absolute" &&
|
1304
|
-
!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
1305
|
-
$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
|
1306
|
-
this.offsetParent :
|
1307
|
-
this.scrollParent,
|
1308
|
-
scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
|
1309
|
-
|
1310
|
-
return {
|
1311
|
-
top: (
|
1312
|
-
|
1313
|
-
// The absolute mouse position
|
1314
|
-
pos.top +
|
1315
|
-
|
1316
|
-
// Only for relative positioned nodes: Relative offset from element to offset parent
|
1317
|
-
this.offset.relative.top * mod +
|
1318
|
-
|
1319
|
-
// The offsetParent's offset without borders (offset + border)
|
1320
|
-
this.offset.parent.top * mod -
|
1321
|
-
( ( this.cssPosition === "fixed" ?
|
1322
|
-
-this.scrollParent.scrollTop() :
|
1323
|
-
( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
|
1324
|
-
),
|
1325
|
-
left: (
|
1326
|
-
|
1327
|
-
// The absolute mouse position
|
1328
|
-
pos.left +
|
1329
|
-
|
1330
|
-
// Only for relative positioned nodes: Relative offset from element to offset parent
|
1331
|
-
this.offset.relative.left * mod +
|
1332
|
-
|
1333
|
-
// The offsetParent's offset without borders (offset + border)
|
1334
|
-
this.offset.parent.left * mod -
|
1335
|
-
( ( this.cssPosition === "fixed" ?
|
1336
|
-
-this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
|
1337
|
-
scroll.scrollLeft() ) * mod )
|
1338
|
-
)
|
1339
|
-
};
|
1340
|
-
|
1341
|
-
},
|
1342
|
-
|
1343
|
-
_generatePosition: function( event ) {
|
1344
|
-
|
1345
|
-
var top, left,
|
1346
|
-
o = this.options,
|
1347
|
-
pageX = event.pageX,
|
1348
|
-
pageY = event.pageY,
|
1349
|
-
scroll = this.cssPosition === "absolute" &&
|
1350
|
-
!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
1351
|
-
$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
|
1352
|
-
this.offsetParent :
|
1353
|
-
this.scrollParent,
|
1354
|
-
scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
|
1355
|
-
|
1356
|
-
// This is another very weird special case that only happens for relative elements:
|
1357
|
-
// 1. If the css position is relative
|
1358
|
-
// 2. and the scroll parent is the document or similar to the offset parent
|
1359
|
-
// we have to refresh the relative offset during the scroll so there are no jumps
|
1360
|
-
if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
|
1361
|
-
this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
|
1362
|
-
this.offset.relative = this._getRelativeOffset();
|
1363
|
-
}
|
1364
|
-
|
1365
|
-
/*
|
1366
|
-
* - Position constraining -
|
1367
|
-
* Constrain the position to a mix of grid, containment.
|
1368
|
-
*/
|
1369
|
-
|
1370
|
-
if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
|
1371
|
-
|
1372
|
-
if ( this.containment ) {
|
1373
|
-
if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
|
1374
|
-
pageX = this.containment[ 0 ] + this.offset.click.left;
|
1375
|
-
}
|
1376
|
-
if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
|
1377
|
-
pageY = this.containment[ 1 ] + this.offset.click.top;
|
1378
|
-
}
|
1379
|
-
if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
|
1380
|
-
pageX = this.containment[ 2 ] + this.offset.click.left;
|
1381
|
-
}
|
1382
|
-
if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
|
1383
|
-
pageY = this.containment[ 3 ] + this.offset.click.top;
|
1384
|
-
}
|
1385
|
-
}
|
1386
|
-
|
1387
|
-
if ( o.grid ) {
|
1388
|
-
top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
|
1389
|
-
o.grid[ 1 ] ) * o.grid[ 1 ];
|
1390
|
-
pageY = this.containment ?
|
1391
|
-
( ( top - this.offset.click.top >= this.containment[ 1 ] &&
|
1392
|
-
top - this.offset.click.top <= this.containment[ 3 ] ) ?
|
1393
|
-
top :
|
1394
|
-
( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
|
1395
|
-
top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
|
1396
|
-
top;
|
1397
|
-
|
1398
|
-
left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
|
1399
|
-
o.grid[ 0 ] ) * o.grid[ 0 ];
|
1400
|
-
pageX = this.containment ?
|
1401
|
-
( ( left - this.offset.click.left >= this.containment[ 0 ] &&
|
1402
|
-
left - this.offset.click.left <= this.containment[ 2 ] ) ?
|
1403
|
-
left :
|
1404
|
-
( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
|
1405
|
-
left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
|
1406
|
-
left;
|
1407
|
-
}
|
1408
|
-
|
1409
|
-
}
|
1410
|
-
|
1411
|
-
return {
|
1412
|
-
top: (
|
1413
|
-
|
1414
|
-
// The absolute mouse position
|
1415
|
-
pageY -
|
1416
|
-
|
1417
|
-
// Click offset (relative to the element)
|
1418
|
-
this.offset.click.top -
|
1419
|
-
|
1420
|
-
// Only for relative positioned nodes: Relative offset from element to offset parent
|
1421
|
-
this.offset.relative.top -
|
1422
|
-
|
1423
|
-
// The offsetParent's offset without borders (offset + border)
|
1424
|
-
this.offset.parent.top +
|
1425
|
-
( ( this.cssPosition === "fixed" ?
|
1426
|
-
-this.scrollParent.scrollTop() :
|
1427
|
-
( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
|
1428
|
-
),
|
1429
|
-
left: (
|
1430
|
-
|
1431
|
-
// The absolute mouse position
|
1432
|
-
pageX -
|
1433
|
-
|
1434
|
-
// Click offset (relative to the element)
|
1435
|
-
this.offset.click.left -
|
1436
|
-
|
1437
|
-
// Only for relative positioned nodes: Relative offset from element to offset parent
|
1438
|
-
this.offset.relative.left -
|
1439
|
-
|
1440
|
-
// The offsetParent's offset without borders (offset + border)
|
1441
|
-
this.offset.parent.left +
|
1442
|
-
( ( this.cssPosition === "fixed" ?
|
1443
|
-
-this.scrollParent.scrollLeft() :
|
1444
|
-
scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
|
1445
|
-
)
|
1446
|
-
};
|
1447
|
-
|
1448
|
-
},
|
1449
|
-
|
1450
|
-
_rearrange: function( event, i, a, hardRefresh ) {
|
1451
|
-
|
1452
|
-
if ( a ) {
|
1453
|
-
a[ 0 ].appendChild( this.placeholder[ 0 ] );
|
1454
|
-
} else {
|
1455
|
-
i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
|
1456
|
-
( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
|
1457
|
-
}
|
1458
|
-
|
1459
|
-
//Various things done here to improve the performance:
|
1460
|
-
// 1. we create a setTimeout, that calls refreshPositions
|
1461
|
-
// 2. on the instance, we have a counter variable, that get's higher after every append
|
1462
|
-
// 3. on the local scope, we copy the counter variable, and check in the timeout,
|
1463
|
-
// if it's still the same
|
1464
|
-
// 4. this lets only the last addition to the timeout stack through
|
1465
|
-
this.counter = this.counter ? ++this.counter : 1;
|
1466
|
-
var counter = this.counter;
|
1467
|
-
|
1468
|
-
this._delay( function() {
|
1469
|
-
if ( counter === this.counter ) {
|
1470
|
-
|
1471
|
-
//Precompute after each DOM insertion, NOT on mousemove
|
1472
|
-
this.refreshPositions( !hardRefresh );
|
1473
|
-
}
|
1474
|
-
} );
|
1475
|
-
|
1476
|
-
},
|
1477
|
-
|
1478
|
-
_clear: function( event, noPropagation ) {
|
1479
|
-
|
1480
|
-
this.reverting = false;
|
1481
|
-
|
1482
|
-
// We delay all events that have to be triggered to after the point where the placeholder
|
1483
|
-
// has been removed and everything else normalized again
|
1484
|
-
var i,
|
1485
|
-
delayedTriggers = [];
|
1486
|
-
|
1487
|
-
// We first have to update the dom position of the actual currentItem
|
1488
|
-
// Note: don't do it if the current item is already removed (by a user), or it gets
|
1489
|
-
// reappended (see #4088)
|
1490
|
-
if ( !this._noFinalSort && this.currentItem.parent().length ) {
|
1491
|
-
this.placeholder.before( this.currentItem );
|
1492
|
-
}
|
1493
|
-
this._noFinalSort = null;
|
1494
|
-
|
1495
|
-
if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
|
1496
|
-
for ( i in this._storedCSS ) {
|
1497
|
-
if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
|
1498
|
-
this._storedCSS[ i ] = "";
|
1499
|
-
}
|
1500
|
-
}
|
1501
|
-
this.currentItem.css( this._storedCSS );
|
1502
|
-
this._removeClass( this.currentItem, "ui-sortable-helper" );
|
1503
|
-
} else {
|
1504
|
-
this.currentItem.show();
|
1505
|
-
}
|
1506
|
-
|
1507
|
-
if ( this.fromOutside && !noPropagation ) {
|
1508
|
-
delayedTriggers.push( function( event ) {
|
1509
|
-
this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
|
1510
|
-
} );
|
1511
|
-
}
|
1512
|
-
if ( ( this.fromOutside ||
|
1513
|
-
this.domPosition.prev !==
|
1514
|
-
this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
|
1515
|
-
this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
|
1516
|
-
|
1517
|
-
// Trigger update callback if the DOM position has changed
|
1518
|
-
delayedTriggers.push( function( event ) {
|
1519
|
-
this._trigger( "update", event, this._uiHash() );
|
1520
|
-
} );
|
1521
|
-
}
|
1522
|
-
|
1523
|
-
// Check if the items Container has Changed and trigger appropriate
|
1524
|
-
// events.
|
1525
|
-
if ( this !== this.currentContainer ) {
|
1526
|
-
if ( !noPropagation ) {
|
1527
|
-
delayedTriggers.push( function( event ) {
|
1528
|
-
this._trigger( "remove", event, this._uiHash() );
|
1529
|
-
} );
|
1530
|
-
delayedTriggers.push( ( function( c ) {
|
1531
|
-
return function( event ) {
|
1532
|
-
c._trigger( "receive", event, this._uiHash( this ) );
|
1533
|
-
};
|
1534
|
-
} ).call( this, this.currentContainer ) );
|
1535
|
-
delayedTriggers.push( ( function( c ) {
|
1536
|
-
return function( event ) {
|
1537
|
-
c._trigger( "update", event, this._uiHash( this ) );
|
1538
|
-
};
|
1539
|
-
} ).call( this, this.currentContainer ) );
|
1540
|
-
}
|
1541
|
-
}
|
1542
|
-
|
1543
|
-
//Post events to containers
|
1544
|
-
function delayEvent( type, instance, container ) {
|
1545
|
-
return function( event ) {
|
1546
|
-
container._trigger( type, event, instance._uiHash( instance ) );
|
1547
|
-
};
|
1548
|
-
}
|
1549
|
-
for ( i = this.containers.length - 1; i >= 0; i-- ) {
|
1550
|
-
if ( !noPropagation ) {
|
1551
|
-
delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
|
1552
|
-
}
|
1553
|
-
if ( this.containers[ i ].containerCache.over ) {
|
1554
|
-
delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
|
1555
|
-
this.containers[ i ].containerCache.over = 0;
|
1556
|
-
}
|
1557
|
-
}
|
1558
|
-
|
1559
|
-
//Do what was originally in plugins
|
1560
|
-
if ( this.storedCursor ) {
|
1561
|
-
this.document.find( "body" ).css( "cursor", this.storedCursor );
|
1562
|
-
this.storedStylesheet.remove();
|
1563
|
-
}
|
1564
|
-
if ( this._storedOpacity ) {
|
1565
|
-
this.helper.css( "opacity", this._storedOpacity );
|
1566
|
-
}
|
1567
|
-
if ( this._storedZIndex ) {
|
1568
|
-
this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
|
1569
|
-
}
|
1570
|
-
|
1571
|
-
this.dragging = false;
|
1572
|
-
|
1573
|
-
if ( !noPropagation ) {
|
1574
|
-
this._trigger( "beforeStop", event, this._uiHash() );
|
1575
|
-
}
|
1576
|
-
|
1577
|
-
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
|
1578
|
-
// it unbinds ALL events from the original node!
|
1579
|
-
this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
|
1580
|
-
|
1581
|
-
if ( !this.cancelHelperRemoval ) {
|
1582
|
-
if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
|
1583
|
-
this.helper.remove();
|
1584
|
-
}
|
1585
|
-
this.helper = null;
|
1586
|
-
}
|
1587
|
-
|
1588
|
-
if ( !noPropagation ) {
|
1589
|
-
for ( i = 0; i < delayedTriggers.length; i++ ) {
|
1590
|
-
|
1591
|
-
// Trigger all delayed events
|
1592
|
-
delayedTriggers[ i ].call( this, event );
|
1593
|
-
}
|
1594
|
-
this._trigger( "stop", event, this._uiHash() );
|
1595
|
-
}
|
1596
|
-
|
1597
|
-
this.fromOutside = false;
|
1598
|
-
return !this.cancelHelperRemoval;
|
1599
|
-
|
1600
|
-
},
|
1601
|
-
|
1602
|
-
_trigger: function() {
|
1603
|
-
if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
|
1604
|
-
this.cancel();
|
1605
|
-
}
|
1606
|
-
},
|
1607
|
-
|
1608
|
-
_uiHash: function( _inst ) {
|
1609
|
-
var inst = _inst || this;
|
1610
|
-
return {
|
1611
|
-
helper: inst.helper,
|
1612
|
-
placeholder: inst.placeholder || $( [] ),
|
1613
|
-
position: inst.position,
|
1614
|
-
originalPosition: inst.originalPosition,
|
1615
|
-
offset: inst.positionAbs,
|
1616
|
-
item: inst.currentItem,
|
1617
|
-
sender: _inst ? _inst.element : null
|
1618
|
-
};
|
1619
|
-
}
|
1620
|
-
|
1621
|
-
} );
|
1622
|
-
|
1623
|
-
} );
|