pageflow 17.0.5 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +362 -35
- data/README.md +0 -1
- data/admins/pageflow/accounts.rb +16 -14
- data/admins/pageflow/entry.rb +68 -20
- data/admins/pageflow/entry_templates.rb +10 -9
- data/admins/pageflow/folder.rb +1 -1
- data/admins/pageflow/membership.rb +4 -4
- data/admins/pageflow/revisions.rb +5 -5
- data/admins/pageflow/site_root_entry.rb +64 -0
- data/admins/pageflow/sites.rb +12 -3
- data/admins/pageflow/translations.rb +75 -0
- data/admins/pageflow/user.rb +21 -35
- data/app/assets/javascripts/pageflow/admin/entries.js +30 -5
- data/app/assets/javascripts/pageflow/dist/ui.js +2865 -257
- data/app/assets/stylesheets/pageflow/admin/entries/index_table.scss +2 -1
- data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +2 -1
- data/app/assets/stylesheets/pageflow/editor/background_positioning.scss +6 -0
- data/app/assets/stylesheets/pageflow/editor/base.scss +2 -0
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +7 -1
- data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +5 -1
- data/app/assets/stylesheets/pageflow/editor/files.scss +28 -16
- data/app/assets/stylesheets/pageflow/editor/filtered_files.scss +24 -0
- data/app/assets/stylesheets/pageflow/editor/info_box.scss +11 -3
- data/app/assets/stylesheets/pageflow/editor/list.scss +6 -4
- data/app/assets/stylesheets/pageflow/editor/list_search_field.scss +52 -0
- data/app/assets/stylesheets/pageflow/editor/outline.scss +0 -13
- data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/sortable.scss +12 -0
- data/app/assets/stylesheets/pageflow/mixins/buttons.scss +4 -4
- data/app/assets/stylesheets/pageflow/ui/forms.scss +4 -0
- data/app/assets/stylesheets/pageflow/ui/input/color_input.scss +8 -0
- data/app/assets/stylesheets/pageflow/ui/input/file_name_input.scss +37 -0
- data/app/assets/stylesheets/pageflow/ui/properties.scss +5 -0
- data/app/assets/stylesheets/pageflow/ui.scss +1 -0
- data/app/controllers/concerns/pageflow/controller_delegation.rb +1 -1
- data/app/controllers/concerns/pageflow/edit_locking.rb +17 -10
- data/app/controllers/concerns/pageflow/entry_password_protection.rb +1 -0
- data/app/controllers/concerns/pageflow/public_https_mode.rb +2 -1
- data/app/controllers/concerns/pageflow/quota_verification.rb +5 -4
- data/app/controllers/pageflow/admin/initial_passwords_controller.rb +1 -0
- data/app/controllers/pageflow/application_controller.rb +19 -19
- data/app/controllers/pageflow/chapters_controller.rb +3 -2
- data/app/controllers/pageflow/edit_locks_controller.rb +3 -2
- data/app/controllers/pageflow/editor/encoding_confirmations_controller.rb +1 -0
- data/app/controllers/pageflow/editor/entries_controller.rb +2 -1
- data/app/controllers/pageflow/editor/entry_publications_controller.rb +1 -0
- data/app/controllers/pageflow/editor/file_import_controller.rb +3 -3
- data/app/controllers/pageflow/editor/files_controller.rb +7 -6
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -0
- data/app/controllers/pageflow/entries_controller.rb +77 -17
- data/app/controllers/pageflow/feeds_controller.rb +1 -1
- data/app/controllers/pageflow/files_controller.rb +1 -0
- data/app/controllers/pageflow/pages_controller.rb +4 -2
- data/app/controllers/pageflow/revisions_controller.rb +2 -1
- data/app/controllers/pageflow/sitemaps_controller.rb +1 -1
- data/app/controllers/pageflow/storylines_controller.rb +1 -0
- data/app/helpers/pageflow/admin/cutoff_modes_helper.rb +12 -0
- data/app/helpers/pageflow/admin/entries_helper.rb +1 -1
- data/app/helpers/pageflow/admin/entry_translations_helper.rb +18 -0
- data/app/helpers/pageflow/admin/features_helper.rb +1 -1
- data/app/helpers/pageflow/admin/form_helper.rb +3 -3
- data/app/helpers/pageflow/admin/locales_helper.rb +10 -2
- data/app/helpers/pageflow/admin/memberships_helper.rb +32 -32
- data/app/helpers/pageflow/admin/revisions_helper.rb +1 -1
- data/app/helpers/pageflow/admin/sites_helper.rb +22 -0
- data/app/helpers/pageflow/admin/users_helper.rb +7 -5
- data/app/helpers/pageflow/admin/widgets_helper.rb +3 -3
- data/app/helpers/pageflow/asset_urls_helper.rb +1 -1
- data/app/helpers/pageflow/audio_files_helper.rb +5 -2
- data/app/helpers/pageflow/background_image_helper.rb +7 -6
- data/app/helpers/pageflow/common_entry_seed_helper.rb +2 -4
- data/app/helpers/pageflow/editor/config_helper.rb +1 -1
- data/app/helpers/pageflow/editor/files_helper.rb +1 -1
- data/app/helpers/pageflow/embed_code_helper.rb +3 -3
- data/app/helpers/pageflow/entries_helper.rb +58 -34
- data/app/helpers/pageflow/entry_json_seed_helper.rb +3 -2
- data/app/helpers/pageflow/feeds_helper.rb +2 -2
- data/app/helpers/pageflow/file_background_images_helper.rb +2 -2
- data/app/helpers/pageflow/file_thumbnails_helper.rb +4 -3
- data/app/helpers/pageflow/files_helper.rb +5 -4
- data/app/helpers/pageflow/folders_helper.rb +8 -5
- data/app/helpers/pageflow/help_entries_helper.rb +2 -2
- data/app/helpers/pageflow/hreflang_links_helper.rb +37 -0
- data/app/helpers/pageflow/info_box_helper.rb +7 -11
- data/app/helpers/pageflow/media_query_helper.rb +3 -3
- data/app/helpers/pageflow/navigation_bar_helper.rb +1 -1
- data/app/helpers/pageflow/overview_helper.rb +1 -1
- data/app/helpers/pageflow/page_types_helper.rb +5 -5
- data/app/helpers/pageflow/pages_helper.rb +29 -15
- data/app/helpers/pageflow/public_i18n_helper.rb +1 -1
- data/app/helpers/pageflow/quota_helper.rb +4 -4
- data/app/helpers/pageflow/render_json_helper.rb +6 -3
- data/app/helpers/pageflow/revision_file_helper.rb +2 -1
- data/app/helpers/pageflow/sites_helper.rb +3 -3
- data/app/helpers/pageflow/social_share_helper.rb +24 -10
- data/app/helpers/pageflow/social_share_links_helper.rb +12 -9
- data/app/helpers/pageflow/structured_data_helper.rb +1 -1
- data/app/helpers/pageflow/stub_page_configuration.rb +7 -3
- data/app/helpers/pageflow/text_direction_helper.rb +1 -1
- data/app/helpers/pageflow/themes_helper.rb +1 -1
- data/app/helpers/pageflow/video_files_helper.rb +29 -13
- data/app/helpers/pageflow/widgets_helper.rb +7 -6
- data/app/inputs/pageflow_permalink_input.rb +3 -2
- data/app/jobs/pageflow/application_job.rb +1 -0
- data/app/jobs/pageflow/entry_export_import/upload_and_publish_file_job.rb +1 -1
- data/app/jobs/pageflow/poll_meta_data_from_zencoder_job.rb +1 -0
- data/app/jobs/pageflow/poll_zencoder_job.rb +3 -2
- data/app/jobs/pageflow/process_image_or_text_track_job.rb +1 -0
- data/app/jobs/pageflow/prune_auto_snapshots_job.rb +1 -0
- data/app/jobs/pageflow/request_meta_data_from_zencoder_job.rb +1 -0
- data/app/jobs/pageflow/submit_file_to_zencoder_job.rb +1 -0
- data/app/mailers/pageflow/user_mailer.rb +1 -0
- data/app/models/concerns/pageflow/auto_generated_perma_id.rb +13 -1
- data/app/models/concerns/pageflow/entry_publication_states.rb +7 -3
- data/app/models/concerns/pageflow/feature_target.rb +8 -4
- data/app/models/concerns/pageflow/output_source.rb +3 -3
- data/app/models/concerns/pageflow/permalinkable.rb +2 -1
- data/app/models/concerns/pageflow/reusable_file.rb +23 -23
- data/app/models/concerns/pageflow/serialization_blacklist.rb +1 -1
- data/app/models/concerns/pageflow/suspendable.rb +5 -3
- data/app/models/concerns/pageflow/theme_referencer.rb +1 -1
- data/app/models/concerns/pageflow/translatable.rb +62 -0
- data/app/models/concerns/pageflow/uploadable_file.rb +6 -6
- data/app/models/pageflow/account.rb +6 -5
- data/app/models/pageflow/account_member_query.rb +1 -1
- data/app/models/pageflow/account_role_query.rb +1 -1
- data/app/models/pageflow/application_query.rb +1 -1
- data/app/models/pageflow/application_record.rb +1 -1
- data/app/models/pageflow/audio_file.rb +4 -4
- data/app/models/pageflow/audio_file_url_templates.rb +1 -1
- data/app/models/pageflow/authentication_token.rb +2 -2
- data/app/models/pageflow/chapter.rb +6 -1
- data/app/models/pageflow/chapter_scaffold.rb +2 -4
- data/app/models/pageflow/cname_site_request_scope.rb +1 -1
- data/app/models/pageflow/customized_theme.rb +6 -6
- data/app/models/pageflow/draft_entry.rb +37 -9
- data/app/models/pageflow/edit_lock.rb +19 -21
- data/app/models/pageflow/encoding_confirmation.rb +2 -2
- data/app/models/pageflow/entries_feed.rb +2 -2
- data/app/models/pageflow/entry.rb +44 -30
- data/app/models/pageflow/entry_at_revision.rb +5 -1
- data/app/models/pageflow/entry_duplicate.rb +8 -5
- data/app/models/pageflow/entry_publication.rb +2 -2
- data/app/models/pageflow/entry_role_query.rb +4 -4
- data/app/models/pageflow/entry_template.rb +4 -4
- data/app/models/pageflow/entry_title_or_account_name_query.rb +2 -2
- data/app/models/pageflow/entry_translation_group.rb +42 -0
- data/app/models/pageflow/file_reuse.rb +2 -2
- data/app/models/pageflow/file_usage.rb +10 -3
- data/app/models/pageflow/folder.rb +2 -2
- data/app/models/pageflow/home_button.rb +7 -7
- data/app/models/pageflow/image_file.rb +20 -5
- data/app/models/pageflow/image_file_url_templates.rb +1 -1
- data/app/models/pageflow/invitation_form.rb +2 -1
- data/app/models/pageflow/managed_user_query.rb +1 -1
- data/app/models/pageflow/membership.rb +5 -5
- data/app/models/pageflow/nested_revision_component_copy.rb +263 -0
- data/app/models/pageflow/null_user.rb +1 -1
- data/app/models/pageflow/overview_button.rb +1 -1
- data/app/models/pageflow/page.rb +7 -3
- data/app/models/pageflow/permalink.rb +23 -2
- data/app/models/pageflow/permalink_directory.rb +7 -0
- data/app/models/pageflow/permalink_redirect.rb +7 -0
- data/app/models/pageflow/positioned_file.rb +5 -5
- data/app/models/pageflow/potential_entry_translations.rb +55 -0
- data/app/models/pageflow/potential_memberships.rb +5 -4
- data/app/models/pageflow/published_entry.rb +62 -11
- data/app/models/pageflow/revision.rb +24 -15
- data/app/models/pageflow/roles.rb +14 -18
- data/app/models/pageflow/site.rb +36 -3
- data/app/models/pageflow/site_root_entry_form.rb +27 -0
- data/app/models/pageflow/sitemaps.rb +10 -1
- data/app/models/pageflow/storyline.rb +5 -2
- data/app/models/pageflow/storyline_scaffold.rb +1 -1
- data/app/models/pageflow/text_track_file.rb +1 -1
- data/app/models/pageflow/text_track_file_url_templates.rb +1 -1
- data/app/models/pageflow/theme_customization_file.rb +3 -2
- data/app/models/pageflow/thumbnail_file_resolver.rb +1 -1
- data/app/models/pageflow/url_template.rb +1 -1
- data/app/models/pageflow/used_file.rb +7 -3
- data/app/models/pageflow/user_name_query.rb +2 -2
- data/app/models/pageflow/video_file.rb +22 -15
- data/app/models/pageflow/video_file_url_templates.rb +6 -4
- data/app/models/pageflow/widget.rb +4 -3
- data/app/models/pageflow/with_file_usage_extension.rb +1 -1
- data/app/models/pageflow/zencoder_attachment.rb +8 -8
- data/app/policies/pageflow/account_policy.rb +3 -1
- data/app/policies/pageflow/admin/admin_only_tab_policy.rb +1 -0
- data/app/policies/pageflow/admin/entry_tab_policy.rb +1 -0
- data/app/policies/pageflow/application_policy.rb +2 -0
- data/app/policies/pageflow/entry_policy.rb +7 -1
- data/app/policies/pageflow/entry_template_policy.rb +2 -1
- data/app/policies/pageflow/file_policy.rb +4 -7
- data/app/policies/pageflow/folder_policy.rb +18 -8
- data/app/policies/pageflow/membership_policy.rb +6 -4
- data/app/policies/pageflow/site_policy.rb +10 -3
- data/app/policies/pageflow/user_policy.rb +6 -4
- data/app/state_machines/pageflow/image_and_text_track_processing_state_machine.rb +3 -2
- data/app/state_machines/pageflow/media_encoding_state_machine.rb +5 -4
- data/app/views/admin/accounts/_entry_template_details.html.arb +2 -2
- data/app/views/admin/entries/_attributes_table.html.arb +6 -5
- data/app/views/admin/entries/_form.html.erb +2 -1
- data/app/views/admin/entries/_permalink_inputs.html.erb +9 -2
- data/app/views/admin/entry_templates/_form.html.erb +1 -3
- data/app/views/admin/site_root_entry/choose.html.erb +19 -0
- data/app/views/admin/sites/_fields.html.erb +14 -1
- data/app/views/admin/translations/_form.html.erb +31 -0
- data/app/views/admin/users/_attributes_table.html.arb +13 -0
- data/app/views/components/pageflow/admin/add_membership_button.rb +13 -12
- data/app/views/components/pageflow/admin/custom_scopes_renderer.rb +1 -0
- data/app/views/components/pageflow/admin/embed_code_field.rb +1 -0
- data/app/views/components/pageflow/admin/embedded_index_table.rb +9 -10
- data/app/views/components/pageflow/admin/entries_tab.rb +1 -0
- data/app/views/components/pageflow/admin/entry_publication_state_indicator.rb +6 -5
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +2 -1
- data/app/views/components/pageflow/admin/entry_translations_tab.rb +102 -0
- data/app/views/components/pageflow/admin/entry_user_badge_list.rb +1 -0
- data/app/views/components/pageflow/admin/extensible_attributes_table.rb +9 -8
- data/app/views/components/pageflow/admin/features_tab.rb +1 -0
- data/app/views/components/pageflow/admin/grouped_folder_list.rb +1 -0
- data/app/views/components/pageflow/admin/icon_link_to.rb +1 -0
- data/app/views/components/pageflow/admin/members_tab.rb +4 -3
- data/app/views/components/pageflow/admin/membership_role_with_tooltip.rb +3 -2
- data/app/views/components/pageflow/admin/revisions_tab.rb +14 -10
- data/app/views/components/pageflow/admin/sites_tab.rb +1 -0
- data/app/views/components/pageflow/admin/tabs_view.rb +1 -0
- data/app/views/components/pageflow/admin/timestamp.rb +6 -5
- data/app/views/components/pageflow/admin/user_account_badge_list.rb +2 -3
- data/app/views/components/pageflow/admin/user_accounts_tab.rb +1 -0
- data/app/views/components/pageflow/admin/user_entries_tab.rb +1 -0
- data/app/views/components/pageflow/admin/users_tab.rb +1 -0
- data/app/views/pageflow/editor/config/_seeds.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entries/index.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entries/show.json.jbuilder +1 -1
- data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +2 -2
- data/app/views/pageflow/editor/files/_file.json.jbuilder +5 -13
- data/app/views/pageflow/editor/files/create.json.jbuilder +1 -1
- data/app/views/pageflow/editor/files/index.json.jbuilder +1 -1
- data/app/views/pageflow/editor/sites/_site.json.jbuilder +1 -0
- data/app/views/pageflow/editor/video_files/_video_file.json.jbuilder +1 -3
- data/app/views/pageflow/entries/share_menu/_bluesky_link.html.erb +8 -0
- data/app/views/pageflow/entries/share_menu/_threads_link.html.erb +8 -0
- data/app/views/pageflow/files/_file.json.jbuilder +3 -3
- data/app/views/pageflow/sitemaps/index.xml.builder +9 -1
- data/app/views/pageflow/social_share/_entry_meta_tags.html.erb +1 -1
- data/app/views/pageflow/social_share/_page_meta_tags.html.erb +1 -1
- data/config/initializers/active_admin_patches.rb +3 -6
- data/config/initializers/admin_resource_tabs.rb +3 -0
- data/config/initializers/paperclip.rb +1 -0
- data/config/initializers/symmetric_encryption.rb +1 -1
- data/config/initializers/zencoder.rb +24 -13
- data/config/locales/de.yml +110 -4
- data/config/locales/en.yml +109 -7
- data/config/routes.rb +15 -13
- data/config/spring.rb +2 -1
- data/db/migrate/20140418225525_setup_schema.rb +2 -2
- data/db/migrate/20190306161431_copy_file_attributes_of_failed_uploads.rb +2 -2
- data/db/migrate/20190820152900_drop_accounts_themes.rb +2 -1
- data/db/migrate/20191202145757_create_pageflow_scrolled_sections.rb +11 -11
- data/db/migrate/20191202150657_create_pageflow_scrolled_chapters.rb +1 -1
- data/db/migrate/20191202154723_create_pageflow_scrolled_content_elements.rb +9 -9
- data/db/migrate/20191219143450_add_position_to_content_elements.rb +2 -1
- data/db/migrate/20200117133200_change_revision_appearance_option_default_and_null.rb +2 -1
- data/db/migrate/20200122115400_create_pageflow_entry_templates.rb +25 -25
- data/db/migrate/20200206134400_convert_legacy_scrolled_content_element_types.rb +3 -3
- data/db/migrate/20221215120856_associate_entry_templates_with_sites.rb +2 -2
- data/db/migrate/20230120092923_create_other_files.rb +2 -1
- data/db/migrate/20230419083307_create_pageflow_entry_translation_group.rb +9 -0
- data/db/migrate/20240612110434_add_cutoff_mode_name_to_sites.rb +5 -0
- data/db/migrate/20240918084059_create_pageflow_permalink_redirects.rb +14 -0
- data/db/migrate/20250508172234_ensure_scrolled_entries_have_main_storyline.rb +14 -0
- data/db/migrate/20250617090048_add_custom404_entry_to_sites.rb +5 -0
- data/db/migrate/20250617100000_add_perma_id_counter_to_entries.rb +28 -0
- data/db/migrate/20250722174123_add_perma_id_to_chapters.rb +10 -0
- data/db/migrate/20250725080603_add_perma_id_indexes_to_revision_components.rb +13 -0
- data/db/migrate/20250726000000_add_display_name_to_file_usages.rb +5 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +3912 -1486
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +468 -1161
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +28125 -22
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +26589 -19
- data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +1 -0
- data/entry_types/paged/app/helpers/pageflow_paged/page_background_asset_helper.rb +1 -1
- data/entry_types/paged/app/helpers/pageflow_paged/third_party_embed_consent_helper.rb +7 -7
- data/entry_types/paged/app/views/pageflow_paged/editor/entries/_seed.json.jbuilder +1 -0
- data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
- data/entry_types/paged/lib/pageflow_paged/plugin.rb +4 -0
- data/entry_types/paged/lib/pageflow_paged/react/page_type.rb +1 -1
- data/entry_types/paged/lib/pageflow_paged/react/widget_type.rb +3 -3
- data/entry_types/paged/lib/pageflow_paged.rb +1 -1
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +5 -3
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +2 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +2 -2
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +1 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +2 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +60 -6
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +16 -2
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +21 -23
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +16 -1
- data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +15 -14
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +12 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +12 -1
- data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +19 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +2 -2
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +17 -9
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry_translations.json.jbuilder +14 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +25 -5
- data/entry_types/scrolled/app/views/pageflow_scrolled/storylines/_storyline.json.jbuilder +7 -0
- data/entry_types/scrolled/config/locales/de.yml +614 -45
- data/entry_types/scrolled/config/locales/en.yml +586 -47
- data/entry_types/scrolled/config/routes.rb +18 -8
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +11 -11
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDarkVariantDesktop.svg +56 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDarkVariantMobile.svg +22 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +26 -11
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +27 -8
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_theme_assets.rb +27 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +16 -4
- data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +1 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +24 -4
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +24 -22
- data/entry_types/scrolled/lib/pageflow_scrolled.rb +1 -1
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +6 -5
- data/entry_types/scrolled/package/config/webpack.js +22 -0
- data/entry_types/scrolled/package/contentElements/hotspots-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements/hotspots-frontend.js +1529 -0
- data/entry_types/scrolled/package/contentElements/tikTokEmbed-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements/tikTokEmbed-frontend.js +59 -0
- data/entry_types/scrolled/package/contentElements-editor.js +2075 -321
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
- data/entry_types/scrolled/package/contentElements-frontend.js +1019 -643
- data/entry_types/scrolled/package/editor.js +2086 -1091
- data/entry_types/scrolled/package/frontend/{EditableInlineText.module-ebd22921.js → FloatingPortalRootProvider-51914be7.js} +1200 -1258
- data/entry_types/scrolled/package/frontend/{PhonePlatformContext-4ec6b2de.js → PhonePlatformContext-9f76033e.js} +7 -8
- data/entry_types/scrolled/package/frontend/ThemeIcon-81f2f066.js +1932 -0
- data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-788e9cdb.js +39 -0
- data/entry_types/scrolled/package/frontend/{Viewer-1bb5597c.js → Viewer-0345ce57.js} +36 -63
- data/entry_types/scrolled/package/frontend/{Viewer-1ecf3375.js → Viewer-cdc549cc.js} +15 -22
- data/entry_types/scrolled/package/frontend/{Wavesurfer-7d9cf1b7.js → Wavesurfer-1cdc3925.js} +54 -74
- data/entry_types/scrolled/package/frontend/{components-024a9893.js → components-96660ffd.js} +1791 -841
- data/entry_types/scrolled/package/frontend/{index-11f32f10.js → index-eb670c2f.js} +11 -18
- data/entry_types/scrolled/package/frontend/index.css +1 -1
- data/entry_types/scrolled/package/frontend/index.js +517 -903
- data/entry_types/scrolled/package/frontend/{createSuper-d0f30da3.js → inherits-539844a6.js} +40 -56
- data/entry_types/scrolled/package/frontend/{useContentElementEditorState-4f4c3cf6.js → useContentElementEditorState-77fe6c79.js} +7 -8
- data/entry_types/scrolled/package/frontend/usePhonePlatform-c2ba875d.js +8 -0
- data/entry_types/scrolled/package/frontend-server.js +0 -1
- data/entry_types/scrolled/package/package.json +18 -10
- data/entry_types/scrolled/package/testHelpers.js +306 -70
- data/entry_types/scrolled/package/values/widgets.module.css +18 -0
- data/entry_types/scrolled/package/widgets/consentBar.css +1 -1
- data/entry_types/scrolled/package/widgets/consentBar.js +47 -66
- data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
- data/entry_types/scrolled/package/widgets/defaultNavigation.js +177 -207
- data/entry_types/scrolled/package/widgets/excursionDialog.css +1 -0
- data/entry_types/scrolled/package/widgets/excursionDialog.js +109 -0
- data/entry_types/scrolled/package/widgets/excursionSheet.css +1 -0
- data/entry_types/scrolled/package/widgets/excursionSheet.js +262 -0
- data/entry_types/scrolled/package/widgets/iconInlineFileRights.css +1 -1
- data/entry_types/scrolled/package/widgets/iconInlineFileRights.js +6 -9
- data/entry_types/scrolled/package/widgets/iconScrollIndicator.css +1 -0
- data/entry_types/scrolled/package/widgets/iconScrollIndicator.js +48 -0
- data/entry_types/scrolled/package/widgets/mainStorylineSheet.css +1 -0
- data/entry_types/scrolled/package/widgets/mainStorylineSheet.js +144 -0
- data/entry_types/scrolled/package/widgets/textInlineFileRights.css +1 -1
- data/entry_types/scrolled/package/widgets/textInlineFileRights.js +26 -9
- data/entry_types/scrolled/package/widgets-server.js +1 -0
- data/entry_types/scrolled/spec/factories/chapters.rb +14 -1
- data/entry_types/scrolled/spec/factories/content_elements.rb +1 -1
- data/lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb +5 -3
- data/lib/generators/pageflow/assets/assets_generator.rb +7 -5
- data/lib/generators/pageflow/cancan/cancan_generator.rb +2 -1
- data/lib/generators/pageflow/cancan/templates/ability.rb +1 -1
- data/lib/generators/pageflow/error_pages/error_pages_generator.rb +2 -1
- data/lib/generators/pageflow/initializer/initializer_generator.rb +3 -2
- data/lib/generators/pageflow/install/install_generator.rb +2 -2
- data/lib/generators/pageflow/procfile/procfile_generator.rb +2 -1
- data/lib/generators/pageflow/resque/resque_generator.rb +6 -4
- data/lib/generators/pageflow/resque/templates/resque.rake +1 -1
- data/lib/generators/pageflow/routes/routes_generator.rb +4 -2
- data/lib/generators/pageflow/seeds/seeds_generator.rb +3 -2
- data/lib/generators/pageflow/seeds/templates/seeds.rb +6 -6
- data/lib/generators/pageflow/theme/theme_generator.rb +2 -1
- data/lib/generators/pageflow/user/user_generator.rb +2 -1
- data/lib/pageflow/ability_mixin.rb +25 -15
- data/lib/pageflow/active_admin_patches/views/attributes_table.rb +1 -0
- data/lib/pageflow/active_admin_patches/views/pages/base.rb +3 -2
- data/lib/pageflow/active_admin_patches/views/table_for.rb +1 -0
- data/lib/pageflow/additional_headers.rb +27 -0
- data/lib/pageflow/admin/attributes_table_rows.rb +3 -3
- data/lib/pageflow/admin/tabs.rb +1 -1
- data/lib/pageflow/built_in_file_type.rb +1 -1
- data/lib/pageflow/built_in_page_types_plugin.rb +1 -1
- data/lib/pageflow/built_in_widget_type.rb +2 -2
- data/lib/pageflow/built_in_widget_types_plugin.rb +2 -1
- data/lib/pageflow/configuration.rb +141 -18
- data/lib/pageflow/cutoff_modes.rb +39 -0
- data/lib/pageflow/editor_controller.rb +6 -10
- data/lib/pageflow/engine.rb +4 -5
- data/lib/pageflow/entry_export_import/attachment_files.rb +1 -1
- data/lib/pageflow/entry_export_import/entry_serialization.rb +5 -4
- data/lib/pageflow/entry_export_import/file_mappings.rb +1 -0
- data/lib/pageflow/entry_export_import/revision_serialization/import.rb +1 -1
- data/lib/pageflow/entry_export_import.rb +3 -3
- data/lib/pageflow/entry_types.rb +2 -2
- data/lib/pageflow/feature.rb +1 -1
- data/lib/pageflow/features.rb +4 -6
- data/lib/pageflow/file_importers.rb +4 -4
- data/lib/pageflow/file_type.rb +3 -3
- data/lib/pageflow/file_types.rb +3 -3
- data/lib/pageflow/global_config_api.rb +5 -6
- data/lib/pageflow/help_entries.rb +7 -7
- data/lib/pageflow/help_entry.rb +1 -1
- data/lib/pageflow/hooks.rb +1 -1
- data/lib/pageflow/nested_revision_component.rb +9 -27
- data/lib/pageflow/news_item_api.rb +1 -1
- data/lib/pageflow/page_type.rb +2 -3
- data/lib/pageflow/page_types.rb +3 -3
- data/lib/pageflow/paperclip_interpolations/support.rb +1 -1
- data/lib/pageflow/paperclip_processors/vtt.rb +1 -0
- data/lib/pageflow/paperclip_processors/webp.rb +2 -2
- data/lib/pageflow/partial_editor_fragment_renderer.rb +2 -2
- data/lib/pageflow/plugin.rb +1 -2
- data/lib/pageflow/quota.rb +9 -5
- data/lib/pageflow/quotas.rb +1 -1
- data/lib/pageflow/rails_version.rb +1 -0
- data/lib/pageflow/react.rb +1 -1
- data/lib/pageflow/revision_component.rb +8 -40
- data/lib/pageflow/revision_components.rb +16 -6
- data/lib/pageflow/seeds.rb +12 -16
- data/lib/pageflow/theme.rb +1 -1
- data/lib/pageflow/theme_customizations.rb +10 -10
- data/lib/pageflow/themes.rb +3 -3
- data/lib/pageflow/user_mixin.rb +6 -6
- data/lib/pageflow/version.rb +1 -1
- data/lib/pageflow/widget_type.rb +4 -4
- data/lib/pageflow/widget_types.rb +9 -9
- data/lib/pageflow/zencoder_api.rb +32 -42
- data/lib/pageflow/zencoder_audio_output_definition.rb +14 -13
- data/lib/pageflow/zencoder_meta_data_output_definition.rb +3 -2
- data/lib/pageflow/zencoder_output_definition.rb +16 -14
- data/lib/pageflow/zencoder_video_output_definition.rb +140 -88
- data/lib/pageflow.rb +7 -2
- data/lib/tasks/pageflow_tasks.rake +1 -1
- data/package/editor.js +954 -868
- data/package/frontend.js +113 -387
- data/package/package.json +2 -1
- data/package/testHelpers.js +10 -56
- data/package/ui.js +209 -251
- data/spec/factories/accounts.rb +37 -22
- data/spec/factories/audio_files.rb +2 -2
- data/spec/factories/authentication_tokens.rb +4 -4
- data/spec/factories/chapters.rb +4 -4
- data/spec/factories/draft_entries.rb +14 -6
- data/spec/factories/edit_locks.rb +1 -1
- data/spec/factories/entries.rb +28 -19
- data/spec/factories/entry_translation_groups.rb +6 -0
- data/spec/factories/file_usages.rb +2 -1
- data/spec/factories/folders.rb +1 -1
- data/spec/factories/image_files.rb +2 -2
- data/spec/factories/pages.rb +3 -3
- data/spec/factories/published_entries.rb +26 -8
- data/spec/factories/revisions.rb +1 -1
- data/spec/factories/sites.rb +6 -0
- data/spec/factories/test_multi_attachment_files.rb +1 -1
- data/spec/factories/text_track_files.rb +1 -1
- data/spec/factories/uploadable_files.rb +1 -1
- data/spec/factories/users.rb +6 -6
- data/spec/factories/video_files.rb +2 -2
- data/spec/factories/widgets.rb +1 -1
- data/spec/fixtures/7x15_rotated.jpg +0 -0
- data/vendor/assets/javascripts/wysihtml-toolbar.js +19288 -0
- metadata +98 -45
- data/config/initializers/revision_components.rb +0 -5
- data/config/locales/twitter_to_x.de.yml +0 -6
- data/config/locales/twitter_to_x.en.yml +0 -6
- data/entry_types/scrolled/config/locales/twitter_to_x.de.yml +0 -12
- data/entry_types/scrolled/config/locales/twitter_to_x.en.yml +0 -12
- data/entry_types/scrolled/config/locales/vr_image_projection.de.yml +0 -24
- data/entry_types/scrolled/config/locales/vr_image_projection.en.yml +0 -24
- data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-b79159cc.js +0 -107
- data/entry_types/scrolled/package/frontend/arrowRight-62998af9.js +0 -77
- data/entry_types/scrolled/package/frontend/i18n-ce13a8bf.js +0 -1129
@@ -18,15 +18,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
18
18
|
if (_.isFunction(template)) {
|
19
19
|
return template(data);
|
20
20
|
}
|
21
|
-
|
22
21
|
if (template.indexOf('templates/') === 0) {
|
23
22
|
template = 'pageflow/editor/' + template;
|
24
23
|
}
|
25
|
-
|
26
24
|
if (!JST[template]) {
|
27
25
|
throw "Template '" + template + "' not found!";
|
28
26
|
}
|
29
|
-
|
30
27
|
return JST[template](data);
|
31
28
|
};
|
32
29
|
|
@@ -52,22 +49,19 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
52
49
|
* @memberof i18nUtils
|
53
50
|
* @since 12.0
|
54
51
|
*/
|
55
|
-
|
56
52
|
function attributeTranslationKeys(attributeName, keyName, options) {
|
57
53
|
var result = [];
|
58
|
-
|
59
54
|
if (options.prefixes) {
|
60
55
|
result = result.concat(_(options.prefixes).map(function (prefix) {
|
61
56
|
return prefix + '.' + attributeName + '.' + keyName;
|
62
57
|
}, this));
|
63
58
|
}
|
64
|
-
|
65
59
|
if (options && options.fallbackPrefix) {
|
66
60
|
result.push(options.fallbackPrefix + '.' + options.fallbackModelI18nKey + '.' + attributeName);
|
67
61
|
}
|
68
|
-
|
69
62
|
return result;
|
70
63
|
}
|
64
|
+
|
71
65
|
/**
|
72
66
|
* Takes the same parameters as {@link
|
73
67
|
* #i18nutilsattributetranslationkeys attributeTranslationKeys}, but returns the first existing
|
@@ -77,10 +71,10 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
77
71
|
* @memberof i18nUtils
|
78
72
|
* @since 12.0
|
79
73
|
*/
|
80
|
-
|
81
74
|
function attributeTranslation(attributeName, keyName, options) {
|
82
75
|
return findTranslation(attributeTranslationKeys(attributeName, keyName, options));
|
83
76
|
}
|
77
|
+
|
84
78
|
/**
|
85
79
|
* Find the first key for which a translation exists and return the
|
86
80
|
* translation.
|
@@ -99,19 +93,15 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
99
93
|
* @memberof i18nUtils
|
100
94
|
* @return {string}
|
101
95
|
*/
|
102
|
-
|
103
96
|
function findTranslation(keys, options) {
|
104
97
|
options = options || {};
|
105
|
-
|
106
98
|
if (options.html) {
|
107
99
|
keys = translationKeysWithSuffix(keys, 'html');
|
108
100
|
}
|
109
|
-
|
110
101
|
return _.chain(keys).reverse().reduce(function (result, key) {
|
111
102
|
var unescapedTranslation = I18n$1.t(key, _.extend({}, options, {
|
112
103
|
defaultValue: result
|
113
104
|
}));
|
114
|
-
|
115
105
|
if (!options.html || key.match(/_html$/) || result == unescapedTranslation) {
|
116
106
|
return unescapedTranslation;
|
117
107
|
} else {
|
@@ -119,6 +109,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
119
109
|
}
|
120
110
|
}, options.defaultValue).value();
|
121
111
|
}
|
112
|
+
|
122
113
|
/**
|
123
114
|
* Return the first key for which a translation exists. Returns the
|
124
115
|
* first if non of the keys has a translation.
|
@@ -129,7 +120,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
129
120
|
* @memberof i18nUtils
|
130
121
|
* @return {string}
|
131
122
|
*/
|
132
|
-
|
133
123
|
function findKeyWithTranslation(keys) {
|
134
124
|
var missing = '_not_translated';
|
135
125
|
return _(keys).detect(function (key) {
|
@@ -254,12 +244,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
254
244
|
for (var _len = arguments.length, classNames = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
255
245
|
classNames[_key - 1] = arguments[_key];
|
256
246
|
}
|
257
|
-
|
258
247
|
return classNames.reduce(function (result, className) {
|
259
248
|
result[className] = selector(styles, className);
|
260
249
|
return result;
|
261
250
|
}, {});
|
262
251
|
}
|
252
|
+
|
263
253
|
/**
|
264
254
|
* Create object that can be passed to Marionette events property from CSS
|
265
255
|
* module object.
|
@@ -297,18 +287,17 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
297
287
|
*
|
298
288
|
* @memberof cssModulesUtils
|
299
289
|
*/
|
300
|
-
|
301
290
|
function events(styles, mapping) {
|
302
291
|
return Object.keys(mapping).reduce(function (result, key) {
|
303
292
|
var _key$split = key.split(' '),
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
293
|
+
_key$split2 = _slicedToArray(_key$split, 2),
|
294
|
+
event = _key$split2[0],
|
295
|
+
className = _key$split2[1];
|
308
296
|
result["".concat(event, " ").concat(selector(styles, className))] = mapping[key];
|
309
297
|
return result;
|
310
298
|
}, {});
|
311
299
|
}
|
300
|
+
|
312
301
|
/**
|
313
302
|
* Generates a CSS selector from a CSS module rule.
|
314
303
|
*
|
@@ -321,14 +310,11 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
321
310
|
* @return {String} CSS Selector
|
322
311
|
* @memberof cssModulesUtils
|
323
312
|
*/
|
324
|
-
|
325
313
|
function selector(styles, className) {
|
326
314
|
var classNames = styles[className];
|
327
|
-
|
328
315
|
if (!classNames) {
|
329
316
|
throw new Error("Unknown class name ".concat(className, " in mapping. Knwon names: ").concat(Object.keys(styles).join(', '), "."));
|
330
317
|
}
|
331
|
-
|
332
318
|
return ".".concat(classNames.replace(/ /g, '.'));
|
333
319
|
}
|
334
320
|
|
@@ -339,28 +325,26 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
339
325
|
selector: selector
|
340
326
|
});
|
341
327
|
|
328
|
+
// Class-y constructor by github.com/opensas
|
342
329
|
// https://github.com/jashkenas/backbone/issues/2601
|
343
330
|
|
344
331
|
function BaseObject(options) {
|
345
332
|
this.initialize.apply(this, arguments);
|
346
333
|
}
|
347
|
-
|
348
334
|
_.extend(BaseObject.prototype, Backbone.Events, {
|
349
335
|
initialize: function initialize(options) {}
|
350
|
-
});
|
351
|
-
|
336
|
+
});
|
352
337
|
|
338
|
+
// The self-propagating extend function that Backbone classes use.
|
353
339
|
BaseObject.extend = Backbone.Model.extend;
|
354
340
|
|
355
341
|
var serverSideValidation = {
|
356
342
|
initialize: function initialize() {
|
357
343
|
var _this = this;
|
358
|
-
|
359
344
|
this.validationErrors = {};
|
360
345
|
this.listenTo(this, 'error', function (model, request) {
|
361
346
|
if (request.status === 422) {
|
362
347
|
_this.validationErrors = JSON.parse(request.responseText).errors;
|
363
|
-
|
364
348
|
_this.trigger('invalid');
|
365
349
|
}
|
366
350
|
});
|
@@ -370,6 +354,2656 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
370
354
|
}
|
371
355
|
};
|
372
356
|
|
357
|
+
/**!
|
358
|
+
* Sortable 1.15.3
|
359
|
+
* @author RubaXa <trash@rubaxa.org>
|
360
|
+
* @author owenm <owen23355@gmail.com>
|
361
|
+
* @license MIT
|
362
|
+
*/
|
363
|
+
function ownKeys(object, enumerableOnly) {
|
364
|
+
var keys = Object.keys(object);
|
365
|
+
if (Object.getOwnPropertySymbols) {
|
366
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
367
|
+
if (enumerableOnly) {
|
368
|
+
symbols = symbols.filter(function (sym) {
|
369
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
370
|
+
});
|
371
|
+
}
|
372
|
+
keys.push.apply(keys, symbols);
|
373
|
+
}
|
374
|
+
return keys;
|
375
|
+
}
|
376
|
+
function _objectSpread2(target) {
|
377
|
+
for (var i = 1; i < arguments.length; i++) {
|
378
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
379
|
+
if (i % 2) {
|
380
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
381
|
+
_defineProperty(target, key, source[key]);
|
382
|
+
});
|
383
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
384
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
385
|
+
} else {
|
386
|
+
ownKeys(Object(source)).forEach(function (key) {
|
387
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
388
|
+
});
|
389
|
+
}
|
390
|
+
}
|
391
|
+
return target;
|
392
|
+
}
|
393
|
+
function _typeof(obj) {
|
394
|
+
"@babel/helpers - typeof";
|
395
|
+
|
396
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
397
|
+
_typeof = function (obj) {
|
398
|
+
return typeof obj;
|
399
|
+
};
|
400
|
+
} else {
|
401
|
+
_typeof = function (obj) {
|
402
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
403
|
+
};
|
404
|
+
}
|
405
|
+
return _typeof(obj);
|
406
|
+
}
|
407
|
+
function _defineProperty(obj, key, value) {
|
408
|
+
if (key in obj) {
|
409
|
+
Object.defineProperty(obj, key, {
|
410
|
+
value: value,
|
411
|
+
enumerable: true,
|
412
|
+
configurable: true,
|
413
|
+
writable: true
|
414
|
+
});
|
415
|
+
} else {
|
416
|
+
obj[key] = value;
|
417
|
+
}
|
418
|
+
return obj;
|
419
|
+
}
|
420
|
+
function _extends() {
|
421
|
+
_extends = Object.assign || function (target) {
|
422
|
+
for (var i = 1; i < arguments.length; i++) {
|
423
|
+
var source = arguments[i];
|
424
|
+
for (var key in source) {
|
425
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
426
|
+
target[key] = source[key];
|
427
|
+
}
|
428
|
+
}
|
429
|
+
}
|
430
|
+
return target;
|
431
|
+
};
|
432
|
+
return _extends.apply(this, arguments);
|
433
|
+
}
|
434
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
435
|
+
if (source == null) return {};
|
436
|
+
var target = {};
|
437
|
+
var sourceKeys = Object.keys(source);
|
438
|
+
var key, i;
|
439
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
440
|
+
key = sourceKeys[i];
|
441
|
+
if (excluded.indexOf(key) >= 0) continue;
|
442
|
+
target[key] = source[key];
|
443
|
+
}
|
444
|
+
return target;
|
445
|
+
}
|
446
|
+
function _objectWithoutProperties(source, excluded) {
|
447
|
+
if (source == null) return {};
|
448
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
449
|
+
var key, i;
|
450
|
+
if (Object.getOwnPropertySymbols) {
|
451
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
452
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
453
|
+
key = sourceSymbolKeys[i];
|
454
|
+
if (excluded.indexOf(key) >= 0) continue;
|
455
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
456
|
+
target[key] = source[key];
|
457
|
+
}
|
458
|
+
}
|
459
|
+
return target;
|
460
|
+
}
|
461
|
+
|
462
|
+
var version = "1.15.3";
|
463
|
+
|
464
|
+
function userAgent(pattern) {
|
465
|
+
if (typeof window !== 'undefined' && window.navigator) {
|
466
|
+
return !! /*@__PURE__*/navigator.userAgent.match(pattern);
|
467
|
+
}
|
468
|
+
}
|
469
|
+
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
|
470
|
+
var Edge = userAgent(/Edge/i);
|
471
|
+
var FireFox = userAgent(/firefox/i);
|
472
|
+
var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
|
473
|
+
var IOS = userAgent(/iP(ad|od|hone)/i);
|
474
|
+
var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
|
475
|
+
|
476
|
+
var captureMode = {
|
477
|
+
capture: false,
|
478
|
+
passive: false
|
479
|
+
};
|
480
|
+
function on(el, event, fn) {
|
481
|
+
el.addEventListener(event, fn, !IE11OrLess && captureMode);
|
482
|
+
}
|
483
|
+
function off(el, event, fn) {
|
484
|
+
el.removeEventListener(event, fn, !IE11OrLess && captureMode);
|
485
|
+
}
|
486
|
+
function matches( /**HTMLElement*/el, /**String*/selector) {
|
487
|
+
if (!selector) return;
|
488
|
+
selector[0] === '>' && (selector = selector.substring(1));
|
489
|
+
if (el) {
|
490
|
+
try {
|
491
|
+
if (el.matches) {
|
492
|
+
return el.matches(selector);
|
493
|
+
} else if (el.msMatchesSelector) {
|
494
|
+
return el.msMatchesSelector(selector);
|
495
|
+
} else if (el.webkitMatchesSelector) {
|
496
|
+
return el.webkitMatchesSelector(selector);
|
497
|
+
}
|
498
|
+
} catch (_) {
|
499
|
+
return false;
|
500
|
+
}
|
501
|
+
}
|
502
|
+
return false;
|
503
|
+
}
|
504
|
+
function getParentOrHost(el) {
|
505
|
+
return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
|
506
|
+
}
|
507
|
+
function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
|
508
|
+
if (el) {
|
509
|
+
ctx = ctx || document;
|
510
|
+
do {
|
511
|
+
if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
|
512
|
+
return el;
|
513
|
+
}
|
514
|
+
if (el === ctx) break;
|
515
|
+
/* jshint boss:true */
|
516
|
+
} while (el = getParentOrHost(el));
|
517
|
+
}
|
518
|
+
return null;
|
519
|
+
}
|
520
|
+
var R_SPACE = /\s+/g;
|
521
|
+
function toggleClass(el, name, state) {
|
522
|
+
if (el && name) {
|
523
|
+
if (el.classList) {
|
524
|
+
el.classList[state ? 'add' : 'remove'](name);
|
525
|
+
} else {
|
526
|
+
var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
|
527
|
+
el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
|
528
|
+
}
|
529
|
+
}
|
530
|
+
}
|
531
|
+
function css(el, prop, val) {
|
532
|
+
var style = el && el.style;
|
533
|
+
if (style) {
|
534
|
+
if (val === void 0) {
|
535
|
+
if (document.defaultView && document.defaultView.getComputedStyle) {
|
536
|
+
val = document.defaultView.getComputedStyle(el, '');
|
537
|
+
} else if (el.currentStyle) {
|
538
|
+
val = el.currentStyle;
|
539
|
+
}
|
540
|
+
return prop === void 0 ? val : val[prop];
|
541
|
+
} else {
|
542
|
+
if (!(prop in style) && prop.indexOf('webkit') === -1) {
|
543
|
+
prop = '-webkit-' + prop;
|
544
|
+
}
|
545
|
+
style[prop] = val + (typeof val === 'string' ? '' : 'px');
|
546
|
+
}
|
547
|
+
}
|
548
|
+
}
|
549
|
+
function matrix(el, selfOnly) {
|
550
|
+
var appliedTransforms = '';
|
551
|
+
if (typeof el === 'string') {
|
552
|
+
appliedTransforms = el;
|
553
|
+
} else {
|
554
|
+
do {
|
555
|
+
var transform = css(el, 'transform');
|
556
|
+
if (transform && transform !== 'none') {
|
557
|
+
appliedTransforms = transform + ' ' + appliedTransforms;
|
558
|
+
}
|
559
|
+
/* jshint boss:true */
|
560
|
+
} while (!selfOnly && (el = el.parentNode));
|
561
|
+
}
|
562
|
+
var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
563
|
+
/*jshint -W056 */
|
564
|
+
return matrixFn && new matrixFn(appliedTransforms);
|
565
|
+
}
|
566
|
+
function find(ctx, tagName, iterator) {
|
567
|
+
if (ctx) {
|
568
|
+
var list = ctx.getElementsByTagName(tagName),
|
569
|
+
i = 0,
|
570
|
+
n = list.length;
|
571
|
+
if (iterator) {
|
572
|
+
for (; i < n; i++) {
|
573
|
+
iterator(list[i], i);
|
574
|
+
}
|
575
|
+
}
|
576
|
+
return list;
|
577
|
+
}
|
578
|
+
return [];
|
579
|
+
}
|
580
|
+
function getWindowScrollingElement() {
|
581
|
+
var scrollingElement = document.scrollingElement;
|
582
|
+
if (scrollingElement) {
|
583
|
+
return scrollingElement;
|
584
|
+
} else {
|
585
|
+
return document.documentElement;
|
586
|
+
}
|
587
|
+
}
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Returns the "bounding client rect" of given element
|
591
|
+
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
592
|
+
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
593
|
+
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
594
|
+
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
595
|
+
* @param {[HTMLElement]} container The parent the element will be placed in
|
596
|
+
* @return {Object} The boundingClientRect of el, with specified adjustments
|
597
|
+
*/
|
598
|
+
function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
|
599
|
+
if (!el.getBoundingClientRect && el !== window) return;
|
600
|
+
var elRect, top, left, bottom, right, height, width;
|
601
|
+
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
|
602
|
+
elRect = el.getBoundingClientRect();
|
603
|
+
top = elRect.top;
|
604
|
+
left = elRect.left;
|
605
|
+
bottom = elRect.bottom;
|
606
|
+
right = elRect.right;
|
607
|
+
height = elRect.height;
|
608
|
+
width = elRect.width;
|
609
|
+
} else {
|
610
|
+
top = 0;
|
611
|
+
left = 0;
|
612
|
+
bottom = window.innerHeight;
|
613
|
+
right = window.innerWidth;
|
614
|
+
height = window.innerHeight;
|
615
|
+
width = window.innerWidth;
|
616
|
+
}
|
617
|
+
if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
|
618
|
+
// Adjust for translate()
|
619
|
+
container = container || el.parentNode;
|
620
|
+
|
621
|
+
// solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
|
622
|
+
// Not needed on <= IE11
|
623
|
+
if (!IE11OrLess) {
|
624
|
+
do {
|
625
|
+
if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
|
626
|
+
var containerRect = container.getBoundingClientRect();
|
627
|
+
|
628
|
+
// Set relative to edges of padding box of container
|
629
|
+
top -= containerRect.top + parseInt(css(container, 'border-top-width'));
|
630
|
+
left -= containerRect.left + parseInt(css(container, 'border-left-width'));
|
631
|
+
bottom = top + elRect.height;
|
632
|
+
right = left + elRect.width;
|
633
|
+
break;
|
634
|
+
}
|
635
|
+
/* jshint boss:true */
|
636
|
+
} while (container = container.parentNode);
|
637
|
+
}
|
638
|
+
}
|
639
|
+
if (undoScale && el !== window) {
|
640
|
+
// Adjust for scale()
|
641
|
+
var elMatrix = matrix(container || el),
|
642
|
+
scaleX = elMatrix && elMatrix.a,
|
643
|
+
scaleY = elMatrix && elMatrix.d;
|
644
|
+
if (elMatrix) {
|
645
|
+
top /= scaleY;
|
646
|
+
left /= scaleX;
|
647
|
+
width /= scaleX;
|
648
|
+
height /= scaleY;
|
649
|
+
bottom = top + height;
|
650
|
+
right = left + width;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
return {
|
654
|
+
top: top,
|
655
|
+
left: left,
|
656
|
+
bottom: bottom,
|
657
|
+
right: right,
|
658
|
+
width: width,
|
659
|
+
height: height
|
660
|
+
};
|
661
|
+
}
|
662
|
+
|
663
|
+
/**
|
664
|
+
* Checks if a side of an element is scrolled past a side of its parents
|
665
|
+
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
666
|
+
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
667
|
+
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
668
|
+
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
669
|
+
*/
|
670
|
+
function isScrolledPast(el, elSide, parentSide) {
|
671
|
+
var parent = getParentAutoScrollElement(el, true),
|
672
|
+
elSideVal = getRect(el)[elSide];
|
673
|
+
|
674
|
+
/* jshint boss:true */
|
675
|
+
while (parent) {
|
676
|
+
var parentSideVal = getRect(parent)[parentSide],
|
677
|
+
visible = void 0;
|
678
|
+
if (parentSide === 'top' || parentSide === 'left') {
|
679
|
+
visible = elSideVal >= parentSideVal;
|
680
|
+
} else {
|
681
|
+
visible = elSideVal <= parentSideVal;
|
682
|
+
}
|
683
|
+
if (!visible) return parent;
|
684
|
+
if (parent === getWindowScrollingElement()) break;
|
685
|
+
parent = getParentAutoScrollElement(parent, false);
|
686
|
+
}
|
687
|
+
return false;
|
688
|
+
}
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
692
|
+
* and non-draggable elements
|
693
|
+
* @param {HTMLElement} el The parent element
|
694
|
+
* @param {Number} childNum The index of the child
|
695
|
+
* @param {Object} options Parent Sortable's options
|
696
|
+
* @return {HTMLElement} The child at index childNum, or null if not found
|
697
|
+
*/
|
698
|
+
function getChild(el, childNum, options, includeDragEl) {
|
699
|
+
var currentChild = 0,
|
700
|
+
i = 0,
|
701
|
+
children = el.children;
|
702
|
+
while (i < children.length) {
|
703
|
+
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
|
704
|
+
if (currentChild === childNum) {
|
705
|
+
return children[i];
|
706
|
+
}
|
707
|
+
currentChild++;
|
708
|
+
}
|
709
|
+
i++;
|
710
|
+
}
|
711
|
+
return null;
|
712
|
+
}
|
713
|
+
|
714
|
+
/**
|
715
|
+
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
716
|
+
* @param {HTMLElement} el Parent element
|
717
|
+
* @param {selector} selector Any other elements that should be ignored
|
718
|
+
* @return {HTMLElement} The last child, ignoring ghostEl
|
719
|
+
*/
|
720
|
+
function lastChild(el, selector) {
|
721
|
+
var last = el.lastElementChild;
|
722
|
+
while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
|
723
|
+
last = last.previousElementSibling;
|
724
|
+
}
|
725
|
+
return last || null;
|
726
|
+
}
|
727
|
+
|
728
|
+
/**
|
729
|
+
* Returns the index of an element within its parent for a selected set of
|
730
|
+
* elements
|
731
|
+
* @param {HTMLElement} el
|
732
|
+
* @param {selector} selector
|
733
|
+
* @return {number}
|
734
|
+
*/
|
735
|
+
function index(el, selector) {
|
736
|
+
var index = 0;
|
737
|
+
if (!el || !el.parentNode) {
|
738
|
+
return -1;
|
739
|
+
}
|
740
|
+
|
741
|
+
/* jshint boss:true */
|
742
|
+
while (el = el.previousElementSibling) {
|
743
|
+
if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
|
744
|
+
index++;
|
745
|
+
}
|
746
|
+
}
|
747
|
+
return index;
|
748
|
+
}
|
749
|
+
|
750
|
+
/**
|
751
|
+
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
752
|
+
* The value is returned in real pixels.
|
753
|
+
* @param {HTMLElement} el
|
754
|
+
* @return {Array} Offsets in the format of [left, top]
|
755
|
+
*/
|
756
|
+
function getRelativeScrollOffset(el) {
|
757
|
+
var offsetLeft = 0,
|
758
|
+
offsetTop = 0,
|
759
|
+
winScroller = getWindowScrollingElement();
|
760
|
+
if (el) {
|
761
|
+
do {
|
762
|
+
var elMatrix = matrix(el),
|
763
|
+
scaleX = elMatrix.a,
|
764
|
+
scaleY = elMatrix.d;
|
765
|
+
offsetLeft += el.scrollLeft * scaleX;
|
766
|
+
offsetTop += el.scrollTop * scaleY;
|
767
|
+
} while (el !== winScroller && (el = el.parentNode));
|
768
|
+
}
|
769
|
+
return [offsetLeft, offsetTop];
|
770
|
+
}
|
771
|
+
|
772
|
+
/**
|
773
|
+
* Returns the index of the object within the given array
|
774
|
+
* @param {Array} arr Array that may or may not hold the object
|
775
|
+
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
776
|
+
* @return {Number} The index of the object in the array, or -1
|
777
|
+
*/
|
778
|
+
function indexOfObject(arr, obj) {
|
779
|
+
for (var i in arr) {
|
780
|
+
if (!arr.hasOwnProperty(i)) continue;
|
781
|
+
for (var key in obj) {
|
782
|
+
if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
|
783
|
+
}
|
784
|
+
}
|
785
|
+
return -1;
|
786
|
+
}
|
787
|
+
function getParentAutoScrollElement(el, includeSelf) {
|
788
|
+
// skip to window
|
789
|
+
if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
|
790
|
+
var elem = el;
|
791
|
+
var gotSelf = false;
|
792
|
+
do {
|
793
|
+
// we don't need to get elem css if it isn't even overflowing in the first place (performance)
|
794
|
+
if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
|
795
|
+
var elemCSS = css(elem);
|
796
|
+
if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
|
797
|
+
if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
|
798
|
+
if (gotSelf || includeSelf) return elem;
|
799
|
+
gotSelf = true;
|
800
|
+
}
|
801
|
+
}
|
802
|
+
/* jshint boss:true */
|
803
|
+
} while (elem = elem.parentNode);
|
804
|
+
return getWindowScrollingElement();
|
805
|
+
}
|
806
|
+
function extend(dst, src) {
|
807
|
+
if (dst && src) {
|
808
|
+
for (var key in src) {
|
809
|
+
if (src.hasOwnProperty(key)) {
|
810
|
+
dst[key] = src[key];
|
811
|
+
}
|
812
|
+
}
|
813
|
+
}
|
814
|
+
return dst;
|
815
|
+
}
|
816
|
+
function isRectEqual(rect1, rect2) {
|
817
|
+
return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
|
818
|
+
}
|
819
|
+
var _throttleTimeout;
|
820
|
+
function throttle(callback, ms) {
|
821
|
+
return function () {
|
822
|
+
if (!_throttleTimeout) {
|
823
|
+
var args = arguments,
|
824
|
+
_this = this;
|
825
|
+
if (args.length === 1) {
|
826
|
+
callback.call(_this, args[0]);
|
827
|
+
} else {
|
828
|
+
callback.apply(_this, args);
|
829
|
+
}
|
830
|
+
_throttleTimeout = setTimeout(function () {
|
831
|
+
_throttleTimeout = void 0;
|
832
|
+
}, ms);
|
833
|
+
}
|
834
|
+
};
|
835
|
+
}
|
836
|
+
function cancelThrottle() {
|
837
|
+
clearTimeout(_throttleTimeout);
|
838
|
+
_throttleTimeout = void 0;
|
839
|
+
}
|
840
|
+
function scrollBy(el, x, y) {
|
841
|
+
el.scrollLeft += x;
|
842
|
+
el.scrollTop += y;
|
843
|
+
}
|
844
|
+
function clone(el) {
|
845
|
+
var Polymer = window.Polymer;
|
846
|
+
var $ = window.jQuery || window.Zepto;
|
847
|
+
if (Polymer && Polymer.dom) {
|
848
|
+
return Polymer.dom(el).cloneNode(true);
|
849
|
+
} else if ($) {
|
850
|
+
return $(el).clone(true)[0];
|
851
|
+
} else {
|
852
|
+
return el.cloneNode(true);
|
853
|
+
}
|
854
|
+
}
|
855
|
+
function getChildContainingRectFromElement(container, options, ghostEl) {
|
856
|
+
var rect = {};
|
857
|
+
Array.from(container.children).forEach(function (child) {
|
858
|
+
var _rect$left, _rect$top, _rect$right, _rect$bottom;
|
859
|
+
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
|
860
|
+
var childRect = getRect(child);
|
861
|
+
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
|
862
|
+
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
|
863
|
+
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
|
864
|
+
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
|
865
|
+
});
|
866
|
+
rect.width = rect.right - rect.left;
|
867
|
+
rect.height = rect.bottom - rect.top;
|
868
|
+
rect.x = rect.left;
|
869
|
+
rect.y = rect.top;
|
870
|
+
return rect;
|
871
|
+
}
|
872
|
+
var expando = 'Sortable' + new Date().getTime();
|
873
|
+
|
874
|
+
function AnimationStateManager() {
|
875
|
+
var animationStates = [],
|
876
|
+
animationCallbackId;
|
877
|
+
return {
|
878
|
+
captureAnimationState: function captureAnimationState() {
|
879
|
+
animationStates = [];
|
880
|
+
if (!this.options.animation) return;
|
881
|
+
var children = [].slice.call(this.el.children);
|
882
|
+
children.forEach(function (child) {
|
883
|
+
if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
|
884
|
+
animationStates.push({
|
885
|
+
target: child,
|
886
|
+
rect: getRect(child)
|
887
|
+
});
|
888
|
+
var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
|
889
|
+
|
890
|
+
// If animating: compensate for current animation
|
891
|
+
if (child.thisAnimationDuration) {
|
892
|
+
var childMatrix = matrix(child, true);
|
893
|
+
if (childMatrix) {
|
894
|
+
fromRect.top -= childMatrix.f;
|
895
|
+
fromRect.left -= childMatrix.e;
|
896
|
+
}
|
897
|
+
}
|
898
|
+
child.fromRect = fromRect;
|
899
|
+
});
|
900
|
+
},
|
901
|
+
addAnimationState: function addAnimationState(state) {
|
902
|
+
animationStates.push(state);
|
903
|
+
},
|
904
|
+
removeAnimationState: function removeAnimationState(target) {
|
905
|
+
animationStates.splice(indexOfObject(animationStates, {
|
906
|
+
target: target
|
907
|
+
}), 1);
|
908
|
+
},
|
909
|
+
animateAll: function animateAll(callback) {
|
910
|
+
var _this = this;
|
911
|
+
if (!this.options.animation) {
|
912
|
+
clearTimeout(animationCallbackId);
|
913
|
+
if (typeof callback === 'function') callback();
|
914
|
+
return;
|
915
|
+
}
|
916
|
+
var animating = false,
|
917
|
+
animationTime = 0;
|
918
|
+
animationStates.forEach(function (state) {
|
919
|
+
var time = 0,
|
920
|
+
target = state.target,
|
921
|
+
fromRect = target.fromRect,
|
922
|
+
toRect = getRect(target),
|
923
|
+
prevFromRect = target.prevFromRect,
|
924
|
+
prevToRect = target.prevToRect,
|
925
|
+
animatingRect = state.rect,
|
926
|
+
targetMatrix = matrix(target, true);
|
927
|
+
if (targetMatrix) {
|
928
|
+
// Compensate for current animation
|
929
|
+
toRect.top -= targetMatrix.f;
|
930
|
+
toRect.left -= targetMatrix.e;
|
931
|
+
}
|
932
|
+
target.toRect = toRect;
|
933
|
+
if (target.thisAnimationDuration) {
|
934
|
+
// Could also check if animatingRect is between fromRect and toRect
|
935
|
+
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
|
936
|
+
// Make sure animatingRect is on line between toRect & fromRect
|
937
|
+
(animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
|
938
|
+
// If returning to same place as started from animation and on same axis
|
939
|
+
time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
|
940
|
+
}
|
941
|
+
}
|
942
|
+
|
943
|
+
// if fromRect != toRect: animate
|
944
|
+
if (!isRectEqual(toRect, fromRect)) {
|
945
|
+
target.prevFromRect = fromRect;
|
946
|
+
target.prevToRect = toRect;
|
947
|
+
if (!time) {
|
948
|
+
time = _this.options.animation;
|
949
|
+
}
|
950
|
+
_this.animate(target, animatingRect, toRect, time);
|
951
|
+
}
|
952
|
+
if (time) {
|
953
|
+
animating = true;
|
954
|
+
animationTime = Math.max(animationTime, time);
|
955
|
+
clearTimeout(target.animationResetTimer);
|
956
|
+
target.animationResetTimer = setTimeout(function () {
|
957
|
+
target.animationTime = 0;
|
958
|
+
target.prevFromRect = null;
|
959
|
+
target.fromRect = null;
|
960
|
+
target.prevToRect = null;
|
961
|
+
target.thisAnimationDuration = null;
|
962
|
+
}, time);
|
963
|
+
target.thisAnimationDuration = time;
|
964
|
+
}
|
965
|
+
});
|
966
|
+
clearTimeout(animationCallbackId);
|
967
|
+
if (!animating) {
|
968
|
+
if (typeof callback === 'function') callback();
|
969
|
+
} else {
|
970
|
+
animationCallbackId = setTimeout(function () {
|
971
|
+
if (typeof callback === 'function') callback();
|
972
|
+
}, animationTime);
|
973
|
+
}
|
974
|
+
animationStates = [];
|
975
|
+
},
|
976
|
+
animate: function animate(target, currentRect, toRect, duration) {
|
977
|
+
if (duration) {
|
978
|
+
css(target, 'transition', '');
|
979
|
+
css(target, 'transform', '');
|
980
|
+
var elMatrix = matrix(this.el),
|
981
|
+
scaleX = elMatrix && elMatrix.a,
|
982
|
+
scaleY = elMatrix && elMatrix.d,
|
983
|
+
translateX = (currentRect.left - toRect.left) / (scaleX || 1),
|
984
|
+
translateY = (currentRect.top - toRect.top) / (scaleY || 1);
|
985
|
+
target.animatingX = !!translateX;
|
986
|
+
target.animatingY = !!translateY;
|
987
|
+
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
|
988
|
+
this.forRepaintDummy = repaint(target); // repaint
|
989
|
+
|
990
|
+
css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
|
991
|
+
css(target, 'transform', 'translate3d(0,0,0)');
|
992
|
+
typeof target.animated === 'number' && clearTimeout(target.animated);
|
993
|
+
target.animated = setTimeout(function () {
|
994
|
+
css(target, 'transition', '');
|
995
|
+
css(target, 'transform', '');
|
996
|
+
target.animated = false;
|
997
|
+
target.animatingX = false;
|
998
|
+
target.animatingY = false;
|
999
|
+
}, duration);
|
1000
|
+
}
|
1001
|
+
}
|
1002
|
+
};
|
1003
|
+
}
|
1004
|
+
function repaint(target) {
|
1005
|
+
return target.offsetWidth;
|
1006
|
+
}
|
1007
|
+
function calculateRealTime(animatingRect, fromRect, toRect, options) {
|
1008
|
+
return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
var plugins = [];
|
1012
|
+
var defaults = {
|
1013
|
+
initializeByDefault: true
|
1014
|
+
};
|
1015
|
+
var PluginManager = {
|
1016
|
+
mount: function mount(plugin) {
|
1017
|
+
// Set default static properties
|
1018
|
+
for (var option in defaults) {
|
1019
|
+
if (defaults.hasOwnProperty(option) && !(option in plugin)) {
|
1020
|
+
plugin[option] = defaults[option];
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
plugins.forEach(function (p) {
|
1024
|
+
if (p.pluginName === plugin.pluginName) {
|
1025
|
+
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
|
1026
|
+
}
|
1027
|
+
});
|
1028
|
+
plugins.push(plugin);
|
1029
|
+
},
|
1030
|
+
pluginEvent: function pluginEvent(eventName, sortable, evt) {
|
1031
|
+
var _this = this;
|
1032
|
+
this.eventCanceled = false;
|
1033
|
+
evt.cancel = function () {
|
1034
|
+
_this.eventCanceled = true;
|
1035
|
+
};
|
1036
|
+
var eventNameGlobal = eventName + 'Global';
|
1037
|
+
plugins.forEach(function (plugin) {
|
1038
|
+
if (!sortable[plugin.pluginName]) return;
|
1039
|
+
// Fire global events if it exists in this sortable
|
1040
|
+
if (sortable[plugin.pluginName][eventNameGlobal]) {
|
1041
|
+
sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
|
1042
|
+
sortable: sortable
|
1043
|
+
}, evt));
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
// Only fire plugin event if plugin is enabled in this sortable,
|
1047
|
+
// and plugin has event defined
|
1048
|
+
if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
|
1049
|
+
sortable[plugin.pluginName][eventName](_objectSpread2({
|
1050
|
+
sortable: sortable
|
1051
|
+
}, evt));
|
1052
|
+
}
|
1053
|
+
});
|
1054
|
+
},
|
1055
|
+
initializePlugins: function initializePlugins(sortable, el, defaults, options) {
|
1056
|
+
plugins.forEach(function (plugin) {
|
1057
|
+
var pluginName = plugin.pluginName;
|
1058
|
+
if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
|
1059
|
+
var initialized = new plugin(sortable, el, sortable.options);
|
1060
|
+
initialized.sortable = sortable;
|
1061
|
+
initialized.options = sortable.options;
|
1062
|
+
sortable[pluginName] = initialized;
|
1063
|
+
|
1064
|
+
// Add default options from plugin
|
1065
|
+
_extends(defaults, initialized.defaults);
|
1066
|
+
});
|
1067
|
+
for (var option in sortable.options) {
|
1068
|
+
if (!sortable.options.hasOwnProperty(option)) continue;
|
1069
|
+
var modified = this.modifyOption(sortable, option, sortable.options[option]);
|
1070
|
+
if (typeof modified !== 'undefined') {
|
1071
|
+
sortable.options[option] = modified;
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
},
|
1075
|
+
getEventProperties: function getEventProperties(name, sortable) {
|
1076
|
+
var eventProperties = {};
|
1077
|
+
plugins.forEach(function (plugin) {
|
1078
|
+
if (typeof plugin.eventProperties !== 'function') return;
|
1079
|
+
_extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
|
1080
|
+
});
|
1081
|
+
return eventProperties;
|
1082
|
+
},
|
1083
|
+
modifyOption: function modifyOption(sortable, name, value) {
|
1084
|
+
var modifiedValue;
|
1085
|
+
plugins.forEach(function (plugin) {
|
1086
|
+
// Plugin must exist on the Sortable
|
1087
|
+
if (!sortable[plugin.pluginName]) return;
|
1088
|
+
|
1089
|
+
// If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
|
1090
|
+
if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
|
1091
|
+
modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
|
1092
|
+
}
|
1093
|
+
});
|
1094
|
+
return modifiedValue;
|
1095
|
+
}
|
1096
|
+
};
|
1097
|
+
|
1098
|
+
function dispatchEvent(_ref) {
|
1099
|
+
var sortable = _ref.sortable,
|
1100
|
+
rootEl = _ref.rootEl,
|
1101
|
+
name = _ref.name,
|
1102
|
+
targetEl = _ref.targetEl,
|
1103
|
+
cloneEl = _ref.cloneEl,
|
1104
|
+
toEl = _ref.toEl,
|
1105
|
+
fromEl = _ref.fromEl,
|
1106
|
+
oldIndex = _ref.oldIndex,
|
1107
|
+
newIndex = _ref.newIndex,
|
1108
|
+
oldDraggableIndex = _ref.oldDraggableIndex,
|
1109
|
+
newDraggableIndex = _ref.newDraggableIndex,
|
1110
|
+
originalEvent = _ref.originalEvent,
|
1111
|
+
putSortable = _ref.putSortable,
|
1112
|
+
extraEventProperties = _ref.extraEventProperties;
|
1113
|
+
sortable = sortable || rootEl && rootEl[expando];
|
1114
|
+
if (!sortable) return;
|
1115
|
+
var evt,
|
1116
|
+
options = sortable.options,
|
1117
|
+
onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
|
1118
|
+
// Support for new CustomEvent feature
|
1119
|
+
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
1120
|
+
evt = new CustomEvent(name, {
|
1121
|
+
bubbles: true,
|
1122
|
+
cancelable: true
|
1123
|
+
});
|
1124
|
+
} else {
|
1125
|
+
evt = document.createEvent('Event');
|
1126
|
+
evt.initEvent(name, true, true);
|
1127
|
+
}
|
1128
|
+
evt.to = toEl || rootEl;
|
1129
|
+
evt.from = fromEl || rootEl;
|
1130
|
+
evt.item = targetEl || rootEl;
|
1131
|
+
evt.clone = cloneEl;
|
1132
|
+
evt.oldIndex = oldIndex;
|
1133
|
+
evt.newIndex = newIndex;
|
1134
|
+
evt.oldDraggableIndex = oldDraggableIndex;
|
1135
|
+
evt.newDraggableIndex = newDraggableIndex;
|
1136
|
+
evt.originalEvent = originalEvent;
|
1137
|
+
evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
|
1138
|
+
var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
|
1139
|
+
for (var option in allEventProperties) {
|
1140
|
+
evt[option] = allEventProperties[option];
|
1141
|
+
}
|
1142
|
+
if (rootEl) {
|
1143
|
+
rootEl.dispatchEvent(evt);
|
1144
|
+
}
|
1145
|
+
if (options[onName]) {
|
1146
|
+
options[onName].call(sortable, evt);
|
1147
|
+
}
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
var _excluded = ["evt"];
|
1151
|
+
var pluginEvent = function pluginEvent(eventName, sortable) {
|
1152
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
1153
|
+
originalEvent = _ref.evt,
|
1154
|
+
data = _objectWithoutProperties(_ref, _excluded);
|
1155
|
+
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
|
1156
|
+
dragEl: dragEl,
|
1157
|
+
parentEl: parentEl,
|
1158
|
+
ghostEl: ghostEl,
|
1159
|
+
rootEl: rootEl,
|
1160
|
+
nextEl: nextEl,
|
1161
|
+
lastDownEl: lastDownEl,
|
1162
|
+
cloneEl: cloneEl,
|
1163
|
+
cloneHidden: cloneHidden,
|
1164
|
+
dragStarted: moved,
|
1165
|
+
putSortable: putSortable,
|
1166
|
+
activeSortable: Sortable.active,
|
1167
|
+
originalEvent: originalEvent,
|
1168
|
+
oldIndex: oldIndex,
|
1169
|
+
oldDraggableIndex: oldDraggableIndex,
|
1170
|
+
newIndex: newIndex,
|
1171
|
+
newDraggableIndex: newDraggableIndex,
|
1172
|
+
hideGhostForTarget: _hideGhostForTarget,
|
1173
|
+
unhideGhostForTarget: _unhideGhostForTarget,
|
1174
|
+
cloneNowHidden: function cloneNowHidden() {
|
1175
|
+
cloneHidden = true;
|
1176
|
+
},
|
1177
|
+
cloneNowShown: function cloneNowShown() {
|
1178
|
+
cloneHidden = false;
|
1179
|
+
},
|
1180
|
+
dispatchSortableEvent: function dispatchSortableEvent(name) {
|
1181
|
+
_dispatchEvent({
|
1182
|
+
sortable: sortable,
|
1183
|
+
name: name,
|
1184
|
+
originalEvent: originalEvent
|
1185
|
+
});
|
1186
|
+
}
|
1187
|
+
}, data));
|
1188
|
+
};
|
1189
|
+
function _dispatchEvent(info) {
|
1190
|
+
dispatchEvent(_objectSpread2({
|
1191
|
+
putSortable: putSortable,
|
1192
|
+
cloneEl: cloneEl,
|
1193
|
+
targetEl: dragEl,
|
1194
|
+
rootEl: rootEl,
|
1195
|
+
oldIndex: oldIndex,
|
1196
|
+
oldDraggableIndex: oldDraggableIndex,
|
1197
|
+
newIndex: newIndex,
|
1198
|
+
newDraggableIndex: newDraggableIndex
|
1199
|
+
}, info));
|
1200
|
+
}
|
1201
|
+
var dragEl,
|
1202
|
+
parentEl,
|
1203
|
+
ghostEl,
|
1204
|
+
rootEl,
|
1205
|
+
nextEl,
|
1206
|
+
lastDownEl,
|
1207
|
+
cloneEl,
|
1208
|
+
cloneHidden,
|
1209
|
+
oldIndex,
|
1210
|
+
newIndex,
|
1211
|
+
oldDraggableIndex,
|
1212
|
+
newDraggableIndex,
|
1213
|
+
activeGroup,
|
1214
|
+
putSortable,
|
1215
|
+
awaitingDragStarted = false,
|
1216
|
+
ignoreNextClick = false,
|
1217
|
+
sortables = [],
|
1218
|
+
tapEvt,
|
1219
|
+
touchEvt,
|
1220
|
+
lastDx,
|
1221
|
+
lastDy,
|
1222
|
+
tapDistanceLeft,
|
1223
|
+
tapDistanceTop,
|
1224
|
+
moved,
|
1225
|
+
lastTarget,
|
1226
|
+
lastDirection,
|
1227
|
+
pastFirstInvertThresh = false,
|
1228
|
+
isCircumstantialInvert = false,
|
1229
|
+
targetMoveDistance,
|
1230
|
+
// For positioning ghost absolutely
|
1231
|
+
ghostRelativeParent,
|
1232
|
+
ghostRelativeParentInitialScroll = [],
|
1233
|
+
// (left, top)
|
1234
|
+
|
1235
|
+
_silent = false,
|
1236
|
+
savedInputChecked = [];
|
1237
|
+
|
1238
|
+
/** @const */
|
1239
|
+
var documentExists = typeof document !== 'undefined',
|
1240
|
+
PositionGhostAbsolutely = IOS,
|
1241
|
+
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
|
1242
|
+
// This will not pass for IE9, because IE9 DnD only works on anchors
|
1243
|
+
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
|
1244
|
+
supportCssPointerEvents = function () {
|
1245
|
+
if (!documentExists) return;
|
1246
|
+
// false when <= IE11
|
1247
|
+
if (IE11OrLess) {
|
1248
|
+
return false;
|
1249
|
+
}
|
1250
|
+
var el = document.createElement('x');
|
1251
|
+
el.style.cssText = 'pointer-events:auto';
|
1252
|
+
return el.style.pointerEvents === 'auto';
|
1253
|
+
}(),
|
1254
|
+
_detectDirection = function _detectDirection(el, options) {
|
1255
|
+
var elCSS = css(el),
|
1256
|
+
elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
|
1257
|
+
child1 = getChild(el, 0, options),
|
1258
|
+
child2 = getChild(el, 1, options),
|
1259
|
+
firstChildCSS = child1 && css(child1),
|
1260
|
+
secondChildCSS = child2 && css(child2),
|
1261
|
+
firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
|
1262
|
+
secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
|
1263
|
+
if (elCSS.display === 'flex') {
|
1264
|
+
return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
|
1265
|
+
}
|
1266
|
+
if (elCSS.display === 'grid') {
|
1267
|
+
return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
|
1268
|
+
}
|
1269
|
+
if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
|
1270
|
+
var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
|
1271
|
+
return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
|
1272
|
+
}
|
1273
|
+
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
|
1274
|
+
},
|
1275
|
+
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
|
1276
|
+
var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
|
1277
|
+
dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
|
1278
|
+
dragElOppLength = vertical ? dragRect.width : dragRect.height,
|
1279
|
+
targetS1Opp = vertical ? targetRect.left : targetRect.top,
|
1280
|
+
targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
|
1281
|
+
targetOppLength = vertical ? targetRect.width : targetRect.height;
|
1282
|
+
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
|
1283
|
+
},
|
1284
|
+
/**
|
1285
|
+
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
1286
|
+
* @param {Number} x X position
|
1287
|
+
* @param {Number} y Y position
|
1288
|
+
* @return {HTMLElement} Element of the first found nearest Sortable
|
1289
|
+
*/
|
1290
|
+
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
1291
|
+
var ret;
|
1292
|
+
sortables.some(function (sortable) {
|
1293
|
+
var threshold = sortable[expando].options.emptyInsertThreshold;
|
1294
|
+
if (!threshold || lastChild(sortable)) return;
|
1295
|
+
var rect = getRect(sortable),
|
1296
|
+
insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
|
1297
|
+
insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
|
1298
|
+
if (insideHorizontally && insideVertically) {
|
1299
|
+
return ret = sortable;
|
1300
|
+
}
|
1301
|
+
});
|
1302
|
+
return ret;
|
1303
|
+
},
|
1304
|
+
_prepareGroup = function _prepareGroup(options) {
|
1305
|
+
function toFn(value, pull) {
|
1306
|
+
return function (to, from, dragEl, evt) {
|
1307
|
+
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
|
1308
|
+
if (value == null && (pull || sameGroup)) {
|
1309
|
+
// Default pull value
|
1310
|
+
// Default pull and put value if same group
|
1311
|
+
return true;
|
1312
|
+
} else if (value == null || value === false) {
|
1313
|
+
return false;
|
1314
|
+
} else if (pull && value === 'clone') {
|
1315
|
+
return value;
|
1316
|
+
} else if (typeof value === 'function') {
|
1317
|
+
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
|
1318
|
+
} else {
|
1319
|
+
var otherGroup = (pull ? to : from).options.group.name;
|
1320
|
+
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
|
1321
|
+
}
|
1322
|
+
};
|
1323
|
+
}
|
1324
|
+
var group = {};
|
1325
|
+
var originalGroup = options.group;
|
1326
|
+
if (!originalGroup || _typeof(originalGroup) != 'object') {
|
1327
|
+
originalGroup = {
|
1328
|
+
name: originalGroup
|
1329
|
+
};
|
1330
|
+
}
|
1331
|
+
group.name = originalGroup.name;
|
1332
|
+
group.checkPull = toFn(originalGroup.pull, true);
|
1333
|
+
group.checkPut = toFn(originalGroup.put);
|
1334
|
+
group.revertClone = originalGroup.revertClone;
|
1335
|
+
options.group = group;
|
1336
|
+
},
|
1337
|
+
_hideGhostForTarget = function _hideGhostForTarget() {
|
1338
|
+
if (!supportCssPointerEvents && ghostEl) {
|
1339
|
+
css(ghostEl, 'display', 'none');
|
1340
|
+
}
|
1341
|
+
},
|
1342
|
+
_unhideGhostForTarget = function _unhideGhostForTarget() {
|
1343
|
+
if (!supportCssPointerEvents && ghostEl) {
|
1344
|
+
css(ghostEl, 'display', '');
|
1345
|
+
}
|
1346
|
+
};
|
1347
|
+
|
1348
|
+
// #1184 fix - Prevent click event on fallback if dragged but item not changed position
|
1349
|
+
if (documentExists && !ChromeForAndroid) {
|
1350
|
+
document.addEventListener('click', function (evt) {
|
1351
|
+
if (ignoreNextClick) {
|
1352
|
+
evt.preventDefault();
|
1353
|
+
evt.stopPropagation && evt.stopPropagation();
|
1354
|
+
evt.stopImmediatePropagation && evt.stopImmediatePropagation();
|
1355
|
+
ignoreNextClick = false;
|
1356
|
+
return false;
|
1357
|
+
}
|
1358
|
+
}, true);
|
1359
|
+
}
|
1360
|
+
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
|
1361
|
+
if (dragEl) {
|
1362
|
+
evt = evt.touches ? evt.touches[0] : evt;
|
1363
|
+
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
|
1364
|
+
if (nearest) {
|
1365
|
+
// Create imitation event
|
1366
|
+
var event = {};
|
1367
|
+
for (var i in evt) {
|
1368
|
+
if (evt.hasOwnProperty(i)) {
|
1369
|
+
event[i] = evt[i];
|
1370
|
+
}
|
1371
|
+
}
|
1372
|
+
event.target = event.rootEl = nearest;
|
1373
|
+
event.preventDefault = void 0;
|
1374
|
+
event.stopPropagation = void 0;
|
1375
|
+
nearest[expando]._onDragOver(event);
|
1376
|
+
}
|
1377
|
+
}
|
1378
|
+
};
|
1379
|
+
var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
|
1380
|
+
if (dragEl) {
|
1381
|
+
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
1382
|
+
}
|
1383
|
+
};
|
1384
|
+
|
1385
|
+
/**
|
1386
|
+
* @class Sortable
|
1387
|
+
* @param {HTMLElement} el
|
1388
|
+
* @param {Object} [options]
|
1389
|
+
*/
|
1390
|
+
function Sortable(el, options) {
|
1391
|
+
if (!(el && el.nodeType && el.nodeType === 1)) {
|
1392
|
+
throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
|
1393
|
+
}
|
1394
|
+
this.el = el; // root element
|
1395
|
+
this.options = options = _extends({}, options);
|
1396
|
+
|
1397
|
+
// Export instance
|
1398
|
+
el[expando] = this;
|
1399
|
+
var defaults = {
|
1400
|
+
group: null,
|
1401
|
+
sort: true,
|
1402
|
+
disabled: false,
|
1403
|
+
store: null,
|
1404
|
+
handle: null,
|
1405
|
+
draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
|
1406
|
+
swapThreshold: 1,
|
1407
|
+
// percentage; 0 <= x <= 1
|
1408
|
+
invertSwap: false,
|
1409
|
+
// invert always
|
1410
|
+
invertedSwapThreshold: null,
|
1411
|
+
// will be set to same as swapThreshold if default
|
1412
|
+
removeCloneOnHide: true,
|
1413
|
+
direction: function direction() {
|
1414
|
+
return _detectDirection(el, this.options);
|
1415
|
+
},
|
1416
|
+
ghostClass: 'sortable-ghost',
|
1417
|
+
chosenClass: 'sortable-chosen',
|
1418
|
+
dragClass: 'sortable-drag',
|
1419
|
+
ignore: 'a, img',
|
1420
|
+
filter: null,
|
1421
|
+
preventOnFilter: true,
|
1422
|
+
animation: 0,
|
1423
|
+
easing: null,
|
1424
|
+
setData: function setData(dataTransfer, dragEl) {
|
1425
|
+
dataTransfer.setData('Text', dragEl.textContent);
|
1426
|
+
},
|
1427
|
+
dropBubble: false,
|
1428
|
+
dragoverBubble: false,
|
1429
|
+
dataIdAttr: 'data-id',
|
1430
|
+
delay: 0,
|
1431
|
+
delayOnTouchOnly: false,
|
1432
|
+
touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
|
1433
|
+
forceFallback: false,
|
1434
|
+
fallbackClass: 'sortable-fallback',
|
1435
|
+
fallbackOnBody: false,
|
1436
|
+
fallbackTolerance: 0,
|
1437
|
+
fallbackOffset: {
|
1438
|
+
x: 0,
|
1439
|
+
y: 0
|
1440
|
+
},
|
1441
|
+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
|
1442
|
+
emptyInsertThreshold: 5
|
1443
|
+
};
|
1444
|
+
PluginManager.initializePlugins(this, el, defaults);
|
1445
|
+
|
1446
|
+
// Set default options
|
1447
|
+
for (var name in defaults) {
|
1448
|
+
!(name in options) && (options[name] = defaults[name]);
|
1449
|
+
}
|
1450
|
+
_prepareGroup(options);
|
1451
|
+
|
1452
|
+
// Bind all private methods
|
1453
|
+
for (var fn in this) {
|
1454
|
+
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
1455
|
+
this[fn] = this[fn].bind(this);
|
1456
|
+
}
|
1457
|
+
}
|
1458
|
+
|
1459
|
+
// Setup drag mode
|
1460
|
+
this.nativeDraggable = options.forceFallback ? false : supportDraggable;
|
1461
|
+
if (this.nativeDraggable) {
|
1462
|
+
// Touch start threshold cannot be greater than the native dragstart threshold
|
1463
|
+
this.options.touchStartThreshold = 1;
|
1464
|
+
}
|
1465
|
+
|
1466
|
+
// Bind events
|
1467
|
+
if (options.supportPointer) {
|
1468
|
+
on(el, 'pointerdown', this._onTapStart);
|
1469
|
+
} else {
|
1470
|
+
on(el, 'mousedown', this._onTapStart);
|
1471
|
+
on(el, 'touchstart', this._onTapStart);
|
1472
|
+
}
|
1473
|
+
if (this.nativeDraggable) {
|
1474
|
+
on(el, 'dragover', this);
|
1475
|
+
on(el, 'dragenter', this);
|
1476
|
+
}
|
1477
|
+
sortables.push(this.el);
|
1478
|
+
|
1479
|
+
// Restore sorting
|
1480
|
+
options.store && options.store.get && this.sort(options.store.get(this) || []);
|
1481
|
+
|
1482
|
+
// Add animation state manager
|
1483
|
+
_extends(this, AnimationStateManager());
|
1484
|
+
}
|
1485
|
+
Sortable.prototype = /** @lends Sortable.prototype */{
|
1486
|
+
constructor: Sortable,
|
1487
|
+
_isOutsideThisEl: function _isOutsideThisEl(target) {
|
1488
|
+
if (!this.el.contains(target) && target !== this.el) {
|
1489
|
+
lastTarget = null;
|
1490
|
+
}
|
1491
|
+
},
|
1492
|
+
_getDirection: function _getDirection(evt, target) {
|
1493
|
+
return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
|
1494
|
+
},
|
1495
|
+
_onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
|
1496
|
+
if (!evt.cancelable) return;
|
1497
|
+
var _this = this,
|
1498
|
+
el = this.el,
|
1499
|
+
options = this.options,
|
1500
|
+
preventOnFilter = options.preventOnFilter,
|
1501
|
+
type = evt.type,
|
1502
|
+
touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
|
1503
|
+
target = (touch || evt).target,
|
1504
|
+
originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
|
1505
|
+
filter = options.filter;
|
1506
|
+
_saveInputCheckedState(el);
|
1507
|
+
|
1508
|
+
// Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
|
1509
|
+
if (dragEl) {
|
1510
|
+
return;
|
1511
|
+
}
|
1512
|
+
if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
|
1513
|
+
return; // only left button and enabled
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
// cancel dnd if original target is content editable
|
1517
|
+
if (originalTarget.isContentEditable) {
|
1518
|
+
return;
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
// Safari ignores further event handling after mousedown
|
1522
|
+
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
|
1523
|
+
return;
|
1524
|
+
}
|
1525
|
+
target = closest(target, options.draggable, el, false);
|
1526
|
+
if (target && target.animated) {
|
1527
|
+
return;
|
1528
|
+
}
|
1529
|
+
if (lastDownEl === target) {
|
1530
|
+
// Ignoring duplicate `down`
|
1531
|
+
return;
|
1532
|
+
}
|
1533
|
+
|
1534
|
+
// Get the index of the dragged element within its parent
|
1535
|
+
oldIndex = index(target);
|
1536
|
+
oldDraggableIndex = index(target, options.draggable);
|
1537
|
+
|
1538
|
+
// Check filter
|
1539
|
+
if (typeof filter === 'function') {
|
1540
|
+
if (filter.call(this, evt, target, this)) {
|
1541
|
+
_dispatchEvent({
|
1542
|
+
sortable: _this,
|
1543
|
+
rootEl: originalTarget,
|
1544
|
+
name: 'filter',
|
1545
|
+
targetEl: target,
|
1546
|
+
toEl: el,
|
1547
|
+
fromEl: el
|
1548
|
+
});
|
1549
|
+
pluginEvent('filter', _this, {
|
1550
|
+
evt: evt
|
1551
|
+
});
|
1552
|
+
preventOnFilter && evt.cancelable && evt.preventDefault();
|
1553
|
+
return; // cancel dnd
|
1554
|
+
}
|
1555
|
+
} else if (filter) {
|
1556
|
+
filter = filter.split(',').some(function (criteria) {
|
1557
|
+
criteria = closest(originalTarget, criteria.trim(), el, false);
|
1558
|
+
if (criteria) {
|
1559
|
+
_dispatchEvent({
|
1560
|
+
sortable: _this,
|
1561
|
+
rootEl: criteria,
|
1562
|
+
name: 'filter',
|
1563
|
+
targetEl: target,
|
1564
|
+
fromEl: el,
|
1565
|
+
toEl: el
|
1566
|
+
});
|
1567
|
+
pluginEvent('filter', _this, {
|
1568
|
+
evt: evt
|
1569
|
+
});
|
1570
|
+
return true;
|
1571
|
+
}
|
1572
|
+
});
|
1573
|
+
if (filter) {
|
1574
|
+
preventOnFilter && evt.cancelable && evt.preventDefault();
|
1575
|
+
return; // cancel dnd
|
1576
|
+
}
|
1577
|
+
}
|
1578
|
+
if (options.handle && !closest(originalTarget, options.handle, el, false)) {
|
1579
|
+
return;
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
// Prepare `dragstart`
|
1583
|
+
this._prepareDragStart(evt, touch, target);
|
1584
|
+
},
|
1585
|
+
_prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {
|
1586
|
+
var _this = this,
|
1587
|
+
el = _this.el,
|
1588
|
+
options = _this.options,
|
1589
|
+
ownerDocument = el.ownerDocument,
|
1590
|
+
dragStartFn;
|
1591
|
+
if (target && !dragEl && target.parentNode === el) {
|
1592
|
+
var dragRect = getRect(target);
|
1593
|
+
rootEl = el;
|
1594
|
+
dragEl = target;
|
1595
|
+
parentEl = dragEl.parentNode;
|
1596
|
+
nextEl = dragEl.nextSibling;
|
1597
|
+
lastDownEl = target;
|
1598
|
+
activeGroup = options.group;
|
1599
|
+
Sortable.dragged = dragEl;
|
1600
|
+
tapEvt = {
|
1601
|
+
target: dragEl,
|
1602
|
+
clientX: (touch || evt).clientX,
|
1603
|
+
clientY: (touch || evt).clientY
|
1604
|
+
};
|
1605
|
+
tapDistanceLeft = tapEvt.clientX - dragRect.left;
|
1606
|
+
tapDistanceTop = tapEvt.clientY - dragRect.top;
|
1607
|
+
this._lastX = (touch || evt).clientX;
|
1608
|
+
this._lastY = (touch || evt).clientY;
|
1609
|
+
dragEl.style['will-change'] = 'all';
|
1610
|
+
dragStartFn = function dragStartFn() {
|
1611
|
+
pluginEvent('delayEnded', _this, {
|
1612
|
+
evt: evt
|
1613
|
+
});
|
1614
|
+
if (Sortable.eventCanceled) {
|
1615
|
+
_this._onDrop();
|
1616
|
+
return;
|
1617
|
+
}
|
1618
|
+
// Delayed drag has been triggered
|
1619
|
+
// we can re-enable the events: touchmove/mousemove
|
1620
|
+
_this._disableDelayedDragEvents();
|
1621
|
+
if (!FireFox && _this.nativeDraggable) {
|
1622
|
+
dragEl.draggable = true;
|
1623
|
+
}
|
1624
|
+
|
1625
|
+
// Bind the events: dragstart/dragend
|
1626
|
+
_this._triggerDragStart(evt, touch);
|
1627
|
+
|
1628
|
+
// Drag start event
|
1629
|
+
_dispatchEvent({
|
1630
|
+
sortable: _this,
|
1631
|
+
name: 'choose',
|
1632
|
+
originalEvent: evt
|
1633
|
+
});
|
1634
|
+
|
1635
|
+
// Chosen item
|
1636
|
+
toggleClass(dragEl, options.chosenClass, true);
|
1637
|
+
};
|
1638
|
+
|
1639
|
+
// Disable "draggable"
|
1640
|
+
options.ignore.split(',').forEach(function (criteria) {
|
1641
|
+
find(dragEl, criteria.trim(), _disableDraggable);
|
1642
|
+
});
|
1643
|
+
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
|
1644
|
+
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
|
1645
|
+
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
|
1646
|
+
on(ownerDocument, 'mouseup', _this._onDrop);
|
1647
|
+
on(ownerDocument, 'touchend', _this._onDrop);
|
1648
|
+
on(ownerDocument, 'touchcancel', _this._onDrop);
|
1649
|
+
|
1650
|
+
// Make dragEl draggable (must be before delay for FireFox)
|
1651
|
+
if (FireFox && this.nativeDraggable) {
|
1652
|
+
this.options.touchStartThreshold = 4;
|
1653
|
+
dragEl.draggable = true;
|
1654
|
+
}
|
1655
|
+
pluginEvent('delayStart', this, {
|
1656
|
+
evt: evt
|
1657
|
+
});
|
1658
|
+
|
1659
|
+
// Delay is impossible for native DnD in Edge or IE
|
1660
|
+
if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
|
1661
|
+
if (Sortable.eventCanceled) {
|
1662
|
+
this._onDrop();
|
1663
|
+
return;
|
1664
|
+
}
|
1665
|
+
// If the user moves the pointer or let go the click or touch
|
1666
|
+
// before the delay has been reached:
|
1667
|
+
// disable the delayed drag
|
1668
|
+
on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
1669
|
+
on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
1670
|
+
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
1671
|
+
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
|
1672
|
+
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
|
1673
|
+
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
|
1674
|
+
_this._dragStartTimer = setTimeout(dragStartFn, options.delay);
|
1675
|
+
} else {
|
1676
|
+
dragStartFn();
|
1677
|
+
}
|
1678
|
+
}
|
1679
|
+
},
|
1680
|
+
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {
|
1681
|
+
var touch = e.touches ? e.touches[0] : e;
|
1682
|
+
if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
|
1683
|
+
this._disableDelayedDrag();
|
1684
|
+
}
|
1685
|
+
},
|
1686
|
+
_disableDelayedDrag: function _disableDelayedDrag() {
|
1687
|
+
dragEl && _disableDraggable(dragEl);
|
1688
|
+
clearTimeout(this._dragStartTimer);
|
1689
|
+
this._disableDelayedDragEvents();
|
1690
|
+
},
|
1691
|
+
_disableDelayedDragEvents: function _disableDelayedDragEvents() {
|
1692
|
+
var ownerDocument = this.el.ownerDocument;
|
1693
|
+
off(ownerDocument, 'mouseup', this._disableDelayedDrag);
|
1694
|
+
off(ownerDocument, 'touchend', this._disableDelayedDrag);
|
1695
|
+
off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
|
1696
|
+
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
|
1697
|
+
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
|
1698
|
+
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
|
1699
|
+
},
|
1700
|
+
_triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
|
1701
|
+
touch = touch || evt.pointerType == 'touch' && evt;
|
1702
|
+
if (!this.nativeDraggable || touch) {
|
1703
|
+
if (this.options.supportPointer) {
|
1704
|
+
on(document, 'pointermove', this._onTouchMove);
|
1705
|
+
} else if (touch) {
|
1706
|
+
on(document, 'touchmove', this._onTouchMove);
|
1707
|
+
} else {
|
1708
|
+
on(document, 'mousemove', this._onTouchMove);
|
1709
|
+
}
|
1710
|
+
} else {
|
1711
|
+
on(dragEl, 'dragend', this);
|
1712
|
+
on(rootEl, 'dragstart', this._onDragStart);
|
1713
|
+
}
|
1714
|
+
try {
|
1715
|
+
if (document.selection) {
|
1716
|
+
// Timeout neccessary for IE9
|
1717
|
+
_nextTick(function () {
|
1718
|
+
document.selection.empty();
|
1719
|
+
});
|
1720
|
+
} else {
|
1721
|
+
window.getSelection().removeAllRanges();
|
1722
|
+
}
|
1723
|
+
} catch (err) {}
|
1724
|
+
},
|
1725
|
+
_dragStarted: function _dragStarted(fallback, evt) {
|
1726
|
+
awaitingDragStarted = false;
|
1727
|
+
if (rootEl && dragEl) {
|
1728
|
+
pluginEvent('dragStarted', this, {
|
1729
|
+
evt: evt
|
1730
|
+
});
|
1731
|
+
if (this.nativeDraggable) {
|
1732
|
+
on(document, 'dragover', _checkOutsideTargetEl);
|
1733
|
+
}
|
1734
|
+
var options = this.options;
|
1735
|
+
|
1736
|
+
// Apply effect
|
1737
|
+
!fallback && toggleClass(dragEl, options.dragClass, false);
|
1738
|
+
toggleClass(dragEl, options.ghostClass, true);
|
1739
|
+
Sortable.active = this;
|
1740
|
+
fallback && this._appendGhost();
|
1741
|
+
|
1742
|
+
// Drag start event
|
1743
|
+
_dispatchEvent({
|
1744
|
+
sortable: this,
|
1745
|
+
name: 'start',
|
1746
|
+
originalEvent: evt
|
1747
|
+
});
|
1748
|
+
} else {
|
1749
|
+
this._nulling();
|
1750
|
+
}
|
1751
|
+
},
|
1752
|
+
_emulateDragOver: function _emulateDragOver() {
|
1753
|
+
if (touchEvt) {
|
1754
|
+
this._lastX = touchEvt.clientX;
|
1755
|
+
this._lastY = touchEvt.clientY;
|
1756
|
+
_hideGhostForTarget();
|
1757
|
+
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
1758
|
+
var parent = target;
|
1759
|
+
while (target && target.shadowRoot) {
|
1760
|
+
target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
1761
|
+
if (target === parent) break;
|
1762
|
+
parent = target;
|
1763
|
+
}
|
1764
|
+
dragEl.parentNode[expando]._isOutsideThisEl(target);
|
1765
|
+
if (parent) {
|
1766
|
+
do {
|
1767
|
+
if (parent[expando]) {
|
1768
|
+
var inserted = void 0;
|
1769
|
+
inserted = parent[expando]._onDragOver({
|
1770
|
+
clientX: touchEvt.clientX,
|
1771
|
+
clientY: touchEvt.clientY,
|
1772
|
+
target: target,
|
1773
|
+
rootEl: parent
|
1774
|
+
});
|
1775
|
+
if (inserted && !this.options.dragoverBubble) {
|
1776
|
+
break;
|
1777
|
+
}
|
1778
|
+
}
|
1779
|
+
target = parent; // store last element
|
1780
|
+
}
|
1781
|
+
/* jshint boss:true */ while (parent = getParentOrHost(parent));
|
1782
|
+
}
|
1783
|
+
_unhideGhostForTarget();
|
1784
|
+
}
|
1785
|
+
},
|
1786
|
+
_onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
|
1787
|
+
if (tapEvt) {
|
1788
|
+
var options = this.options,
|
1789
|
+
fallbackTolerance = options.fallbackTolerance,
|
1790
|
+
fallbackOffset = options.fallbackOffset,
|
1791
|
+
touch = evt.touches ? evt.touches[0] : evt,
|
1792
|
+
ghostMatrix = ghostEl && matrix(ghostEl, true),
|
1793
|
+
scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
|
1794
|
+
scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
|
1795
|
+
relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
|
1796
|
+
dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
|
1797
|
+
dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
|
1798
|
+
|
1799
|
+
// only set the status to dragging, when we are actually dragging
|
1800
|
+
if (!Sortable.active && !awaitingDragStarted) {
|
1801
|
+
if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
|
1802
|
+
return;
|
1803
|
+
}
|
1804
|
+
this._onDragStart(evt, true);
|
1805
|
+
}
|
1806
|
+
if (ghostEl) {
|
1807
|
+
if (ghostMatrix) {
|
1808
|
+
ghostMatrix.e += dx - (lastDx || 0);
|
1809
|
+
ghostMatrix.f += dy - (lastDy || 0);
|
1810
|
+
} else {
|
1811
|
+
ghostMatrix = {
|
1812
|
+
a: 1,
|
1813
|
+
b: 0,
|
1814
|
+
c: 0,
|
1815
|
+
d: 1,
|
1816
|
+
e: dx,
|
1817
|
+
f: dy
|
1818
|
+
};
|
1819
|
+
}
|
1820
|
+
var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
|
1821
|
+
css(ghostEl, 'webkitTransform', cssMatrix);
|
1822
|
+
css(ghostEl, 'mozTransform', cssMatrix);
|
1823
|
+
css(ghostEl, 'msTransform', cssMatrix);
|
1824
|
+
css(ghostEl, 'transform', cssMatrix);
|
1825
|
+
lastDx = dx;
|
1826
|
+
lastDy = dy;
|
1827
|
+
touchEvt = touch;
|
1828
|
+
}
|
1829
|
+
evt.cancelable && evt.preventDefault();
|
1830
|
+
}
|
1831
|
+
},
|
1832
|
+
_appendGhost: function _appendGhost() {
|
1833
|
+
// Bug if using scale(): https://stackoverflow.com/questions/2637058
|
1834
|
+
// Not being adjusted for
|
1835
|
+
if (!ghostEl) {
|
1836
|
+
var container = this.options.fallbackOnBody ? document.body : rootEl,
|
1837
|
+
rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
|
1838
|
+
options = this.options;
|
1839
|
+
|
1840
|
+
// Position absolutely
|
1841
|
+
if (PositionGhostAbsolutely) {
|
1842
|
+
// Get relatively positioned parent
|
1843
|
+
ghostRelativeParent = container;
|
1844
|
+
while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
|
1845
|
+
ghostRelativeParent = ghostRelativeParent.parentNode;
|
1846
|
+
}
|
1847
|
+
if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
|
1848
|
+
if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
|
1849
|
+
rect.top += ghostRelativeParent.scrollTop;
|
1850
|
+
rect.left += ghostRelativeParent.scrollLeft;
|
1851
|
+
} else {
|
1852
|
+
ghostRelativeParent = getWindowScrollingElement();
|
1853
|
+
}
|
1854
|
+
ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
|
1855
|
+
}
|
1856
|
+
ghostEl = dragEl.cloneNode(true);
|
1857
|
+
toggleClass(ghostEl, options.ghostClass, false);
|
1858
|
+
toggleClass(ghostEl, options.fallbackClass, true);
|
1859
|
+
toggleClass(ghostEl, options.dragClass, true);
|
1860
|
+
css(ghostEl, 'transition', '');
|
1861
|
+
css(ghostEl, 'transform', '');
|
1862
|
+
css(ghostEl, 'box-sizing', 'border-box');
|
1863
|
+
css(ghostEl, 'margin', 0);
|
1864
|
+
css(ghostEl, 'top', rect.top);
|
1865
|
+
css(ghostEl, 'left', rect.left);
|
1866
|
+
css(ghostEl, 'width', rect.width);
|
1867
|
+
css(ghostEl, 'height', rect.height);
|
1868
|
+
css(ghostEl, 'opacity', '0.8');
|
1869
|
+
css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
|
1870
|
+
css(ghostEl, 'zIndex', '100000');
|
1871
|
+
css(ghostEl, 'pointerEvents', 'none');
|
1872
|
+
Sortable.ghost = ghostEl;
|
1873
|
+
container.appendChild(ghostEl);
|
1874
|
+
|
1875
|
+
// Set transform-origin
|
1876
|
+
css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
|
1877
|
+
}
|
1878
|
+
},
|
1879
|
+
_onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {
|
1880
|
+
var _this = this;
|
1881
|
+
var dataTransfer = evt.dataTransfer;
|
1882
|
+
var options = _this.options;
|
1883
|
+
pluginEvent('dragStart', this, {
|
1884
|
+
evt: evt
|
1885
|
+
});
|
1886
|
+
if (Sortable.eventCanceled) {
|
1887
|
+
this._onDrop();
|
1888
|
+
return;
|
1889
|
+
}
|
1890
|
+
pluginEvent('setupClone', this);
|
1891
|
+
if (!Sortable.eventCanceled) {
|
1892
|
+
cloneEl = clone(dragEl);
|
1893
|
+
cloneEl.removeAttribute("id");
|
1894
|
+
cloneEl.draggable = false;
|
1895
|
+
cloneEl.style['will-change'] = '';
|
1896
|
+
this._hideClone();
|
1897
|
+
toggleClass(cloneEl, this.options.chosenClass, false);
|
1898
|
+
Sortable.clone = cloneEl;
|
1899
|
+
}
|
1900
|
+
|
1901
|
+
// #1143: IFrame support workaround
|
1902
|
+
_this.cloneId = _nextTick(function () {
|
1903
|
+
pluginEvent('clone', _this);
|
1904
|
+
if (Sortable.eventCanceled) return;
|
1905
|
+
if (!_this.options.removeCloneOnHide) {
|
1906
|
+
rootEl.insertBefore(cloneEl, dragEl);
|
1907
|
+
}
|
1908
|
+
_this._hideClone();
|
1909
|
+
_dispatchEvent({
|
1910
|
+
sortable: _this,
|
1911
|
+
name: 'clone'
|
1912
|
+
});
|
1913
|
+
});
|
1914
|
+
!fallback && toggleClass(dragEl, options.dragClass, true);
|
1915
|
+
|
1916
|
+
// Set proper drop events
|
1917
|
+
if (fallback) {
|
1918
|
+
ignoreNextClick = true;
|
1919
|
+
_this._loopId = setInterval(_this._emulateDragOver, 50);
|
1920
|
+
} else {
|
1921
|
+
// Undo what was set in _prepareDragStart before drag started
|
1922
|
+
off(document, 'mouseup', _this._onDrop);
|
1923
|
+
off(document, 'touchend', _this._onDrop);
|
1924
|
+
off(document, 'touchcancel', _this._onDrop);
|
1925
|
+
if (dataTransfer) {
|
1926
|
+
dataTransfer.effectAllowed = 'move';
|
1927
|
+
options.setData && options.setData.call(_this, dataTransfer, dragEl);
|
1928
|
+
}
|
1929
|
+
on(document, 'drop', _this);
|
1930
|
+
|
1931
|
+
// #1276 fix:
|
1932
|
+
css(dragEl, 'transform', 'translateZ(0)');
|
1933
|
+
}
|
1934
|
+
awaitingDragStarted = true;
|
1935
|
+
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
|
1936
|
+
on(document, 'selectstart', _this);
|
1937
|
+
moved = true;
|
1938
|
+
if (Safari) {
|
1939
|
+
css(document.body, 'user-select', 'none');
|
1940
|
+
}
|
1941
|
+
},
|
1942
|
+
// Returns true - if no further action is needed (either inserted or another condition)
|
1943
|
+
_onDragOver: function _onDragOver( /**Event*/evt) {
|
1944
|
+
var el = this.el,
|
1945
|
+
target = evt.target,
|
1946
|
+
dragRect,
|
1947
|
+
targetRect,
|
1948
|
+
revert,
|
1949
|
+
options = this.options,
|
1950
|
+
group = options.group,
|
1951
|
+
activeSortable = Sortable.active,
|
1952
|
+
isOwner = activeGroup === group,
|
1953
|
+
canSort = options.sort,
|
1954
|
+
fromSortable = putSortable || activeSortable,
|
1955
|
+
vertical,
|
1956
|
+
_this = this,
|
1957
|
+
completedFired = false;
|
1958
|
+
if (_silent) return;
|
1959
|
+
function dragOverEvent(name, extra) {
|
1960
|
+
pluginEvent(name, _this, _objectSpread2({
|
1961
|
+
evt: evt,
|
1962
|
+
isOwner: isOwner,
|
1963
|
+
axis: vertical ? 'vertical' : 'horizontal',
|
1964
|
+
revert: revert,
|
1965
|
+
dragRect: dragRect,
|
1966
|
+
targetRect: targetRect,
|
1967
|
+
canSort: canSort,
|
1968
|
+
fromSortable: fromSortable,
|
1969
|
+
target: target,
|
1970
|
+
completed: completed,
|
1971
|
+
onMove: function onMove(target, after) {
|
1972
|
+
return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
|
1973
|
+
},
|
1974
|
+
changed: changed
|
1975
|
+
}, extra));
|
1976
|
+
}
|
1977
|
+
|
1978
|
+
// Capture animation state
|
1979
|
+
function capture() {
|
1980
|
+
dragOverEvent('dragOverAnimationCapture');
|
1981
|
+
_this.captureAnimationState();
|
1982
|
+
if (_this !== fromSortable) {
|
1983
|
+
fromSortable.captureAnimationState();
|
1984
|
+
}
|
1985
|
+
}
|
1986
|
+
|
1987
|
+
// Return invocation when dragEl is inserted (or completed)
|
1988
|
+
function completed(insertion) {
|
1989
|
+
dragOverEvent('dragOverCompleted', {
|
1990
|
+
insertion: insertion
|
1991
|
+
});
|
1992
|
+
if (insertion) {
|
1993
|
+
// Clones must be hidden before folding animation to capture dragRectAbsolute properly
|
1994
|
+
if (isOwner) {
|
1995
|
+
activeSortable._hideClone();
|
1996
|
+
} else {
|
1997
|
+
activeSortable._showClone(_this);
|
1998
|
+
}
|
1999
|
+
if (_this !== fromSortable) {
|
2000
|
+
// Set ghost class to new sortable's ghost class
|
2001
|
+
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
|
2002
|
+
toggleClass(dragEl, options.ghostClass, true);
|
2003
|
+
}
|
2004
|
+
if (putSortable !== _this && _this !== Sortable.active) {
|
2005
|
+
putSortable = _this;
|
2006
|
+
} else if (_this === Sortable.active && putSortable) {
|
2007
|
+
putSortable = null;
|
2008
|
+
}
|
2009
|
+
|
2010
|
+
// Animation
|
2011
|
+
if (fromSortable === _this) {
|
2012
|
+
_this._ignoreWhileAnimating = target;
|
2013
|
+
}
|
2014
|
+
_this.animateAll(function () {
|
2015
|
+
dragOverEvent('dragOverAnimationComplete');
|
2016
|
+
_this._ignoreWhileAnimating = null;
|
2017
|
+
});
|
2018
|
+
if (_this !== fromSortable) {
|
2019
|
+
fromSortable.animateAll();
|
2020
|
+
fromSortable._ignoreWhileAnimating = null;
|
2021
|
+
}
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
// Null lastTarget if it is not inside a previously swapped element
|
2025
|
+
if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
|
2026
|
+
lastTarget = null;
|
2027
|
+
}
|
2028
|
+
|
2029
|
+
// no bubbling and not fallback
|
2030
|
+
if (!options.dragoverBubble && !evt.rootEl && target !== document) {
|
2031
|
+
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
2032
|
+
|
2033
|
+
// Do not detect for empty insert if already inserted
|
2034
|
+
!insertion && nearestEmptyInsertDetectEvent(evt);
|
2035
|
+
}
|
2036
|
+
!options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
|
2037
|
+
return completedFired = true;
|
2038
|
+
}
|
2039
|
+
|
2040
|
+
// Call when dragEl has been inserted
|
2041
|
+
function changed() {
|
2042
|
+
newIndex = index(dragEl);
|
2043
|
+
newDraggableIndex = index(dragEl, options.draggable);
|
2044
|
+
_dispatchEvent({
|
2045
|
+
sortable: _this,
|
2046
|
+
name: 'change',
|
2047
|
+
toEl: el,
|
2048
|
+
newIndex: newIndex,
|
2049
|
+
newDraggableIndex: newDraggableIndex,
|
2050
|
+
originalEvent: evt
|
2051
|
+
});
|
2052
|
+
}
|
2053
|
+
if (evt.preventDefault !== void 0) {
|
2054
|
+
evt.cancelable && evt.preventDefault();
|
2055
|
+
}
|
2056
|
+
target = closest(target, options.draggable, el, true);
|
2057
|
+
dragOverEvent('dragOver');
|
2058
|
+
if (Sortable.eventCanceled) return completedFired;
|
2059
|
+
if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
|
2060
|
+
return completed(false);
|
2061
|
+
}
|
2062
|
+
ignoreNextClick = false;
|
2063
|
+
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
|
2064
|
+
: putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
|
2065
|
+
vertical = this._getDirection(evt, target) === 'vertical';
|
2066
|
+
dragRect = getRect(dragEl);
|
2067
|
+
dragOverEvent('dragOverValid');
|
2068
|
+
if (Sortable.eventCanceled) return completedFired;
|
2069
|
+
if (revert) {
|
2070
|
+
parentEl = rootEl; // actualization
|
2071
|
+
capture();
|
2072
|
+
this._hideClone();
|
2073
|
+
dragOverEvent('revert');
|
2074
|
+
if (!Sortable.eventCanceled) {
|
2075
|
+
if (nextEl) {
|
2076
|
+
rootEl.insertBefore(dragEl, nextEl);
|
2077
|
+
} else {
|
2078
|
+
rootEl.appendChild(dragEl);
|
2079
|
+
}
|
2080
|
+
}
|
2081
|
+
return completed(true);
|
2082
|
+
}
|
2083
|
+
var elLastChild = lastChild(el, options.draggable);
|
2084
|
+
if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
|
2085
|
+
// Insert to end of list
|
2086
|
+
|
2087
|
+
// If already at end of list: Do not insert
|
2088
|
+
if (elLastChild === dragEl) {
|
2089
|
+
return completed(false);
|
2090
|
+
}
|
2091
|
+
|
2092
|
+
// if there is a last element, it is the target
|
2093
|
+
if (elLastChild && el === evt.target) {
|
2094
|
+
target = elLastChild;
|
2095
|
+
}
|
2096
|
+
if (target) {
|
2097
|
+
targetRect = getRect(target);
|
2098
|
+
}
|
2099
|
+
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
|
2100
|
+
capture();
|
2101
|
+
if (elLastChild && elLastChild.nextSibling) {
|
2102
|
+
// the last draggable element is not the last node
|
2103
|
+
el.insertBefore(dragEl, elLastChild.nextSibling);
|
2104
|
+
} else {
|
2105
|
+
el.appendChild(dragEl);
|
2106
|
+
}
|
2107
|
+
parentEl = el; // actualization
|
2108
|
+
|
2109
|
+
changed();
|
2110
|
+
return completed(true);
|
2111
|
+
}
|
2112
|
+
} else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
|
2113
|
+
// Insert to start of list
|
2114
|
+
var firstChild = getChild(el, 0, options, true);
|
2115
|
+
if (firstChild === dragEl) {
|
2116
|
+
return completed(false);
|
2117
|
+
}
|
2118
|
+
target = firstChild;
|
2119
|
+
targetRect = getRect(target);
|
2120
|
+
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
|
2121
|
+
capture();
|
2122
|
+
el.insertBefore(dragEl, firstChild);
|
2123
|
+
parentEl = el; // actualization
|
2124
|
+
|
2125
|
+
changed();
|
2126
|
+
return completed(true);
|
2127
|
+
}
|
2128
|
+
} else if (target.parentNode === el) {
|
2129
|
+
targetRect = getRect(target);
|
2130
|
+
var direction = 0,
|
2131
|
+
targetBeforeFirstSwap,
|
2132
|
+
differentLevel = dragEl.parentNode !== el,
|
2133
|
+
differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
|
2134
|
+
side1 = vertical ? 'top' : 'left',
|
2135
|
+
scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
|
2136
|
+
scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
|
2137
|
+
if (lastTarget !== target) {
|
2138
|
+
targetBeforeFirstSwap = targetRect[side1];
|
2139
|
+
pastFirstInvertThresh = false;
|
2140
|
+
isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
|
2141
|
+
}
|
2142
|
+
direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
|
2143
|
+
var sibling;
|
2144
|
+
if (direction !== 0) {
|
2145
|
+
// Check if target is beside dragEl in respective direction (ignoring hidden elements)
|
2146
|
+
var dragIndex = index(dragEl);
|
2147
|
+
do {
|
2148
|
+
dragIndex -= direction;
|
2149
|
+
sibling = parentEl.children[dragIndex];
|
2150
|
+
} while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
|
2151
|
+
}
|
2152
|
+
// If dragEl is already beside target: Do not insert
|
2153
|
+
if (direction === 0 || sibling === target) {
|
2154
|
+
return completed(false);
|
2155
|
+
}
|
2156
|
+
lastTarget = target;
|
2157
|
+
lastDirection = direction;
|
2158
|
+
var nextSibling = target.nextElementSibling,
|
2159
|
+
after = false;
|
2160
|
+
after = direction === 1;
|
2161
|
+
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
|
2162
|
+
if (moveVector !== false) {
|
2163
|
+
if (moveVector === 1 || moveVector === -1) {
|
2164
|
+
after = moveVector === 1;
|
2165
|
+
}
|
2166
|
+
_silent = true;
|
2167
|
+
setTimeout(_unsilent, 30);
|
2168
|
+
capture();
|
2169
|
+
if (after && !nextSibling) {
|
2170
|
+
el.appendChild(dragEl);
|
2171
|
+
} else {
|
2172
|
+
target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
|
2173
|
+
}
|
2174
|
+
|
2175
|
+
// Undo chrome's scroll adjustment (has no effect on other browsers)
|
2176
|
+
if (scrolledPastTop) {
|
2177
|
+
scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
|
2178
|
+
}
|
2179
|
+
parentEl = dragEl.parentNode; // actualization
|
2180
|
+
|
2181
|
+
// must be done before animation
|
2182
|
+
if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
|
2183
|
+
targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
|
2184
|
+
}
|
2185
|
+
changed();
|
2186
|
+
return completed(true);
|
2187
|
+
}
|
2188
|
+
}
|
2189
|
+
if (el.contains(dragEl)) {
|
2190
|
+
return completed(false);
|
2191
|
+
}
|
2192
|
+
}
|
2193
|
+
return false;
|
2194
|
+
},
|
2195
|
+
_ignoreWhileAnimating: null,
|
2196
|
+
_offMoveEvents: function _offMoveEvents() {
|
2197
|
+
off(document, 'mousemove', this._onTouchMove);
|
2198
|
+
off(document, 'touchmove', this._onTouchMove);
|
2199
|
+
off(document, 'pointermove', this._onTouchMove);
|
2200
|
+
off(document, 'dragover', nearestEmptyInsertDetectEvent);
|
2201
|
+
off(document, 'mousemove', nearestEmptyInsertDetectEvent);
|
2202
|
+
off(document, 'touchmove', nearestEmptyInsertDetectEvent);
|
2203
|
+
},
|
2204
|
+
_offUpEvents: function _offUpEvents() {
|
2205
|
+
var ownerDocument = this.el.ownerDocument;
|
2206
|
+
off(ownerDocument, 'mouseup', this._onDrop);
|
2207
|
+
off(ownerDocument, 'touchend', this._onDrop);
|
2208
|
+
off(ownerDocument, 'pointerup', this._onDrop);
|
2209
|
+
off(ownerDocument, 'touchcancel', this._onDrop);
|
2210
|
+
off(document, 'selectstart', this);
|
2211
|
+
},
|
2212
|
+
_onDrop: function _onDrop( /**Event*/evt) {
|
2213
|
+
var el = this.el,
|
2214
|
+
options = this.options;
|
2215
|
+
|
2216
|
+
// Get the index of the dragged element within its parent
|
2217
|
+
newIndex = index(dragEl);
|
2218
|
+
newDraggableIndex = index(dragEl, options.draggable);
|
2219
|
+
pluginEvent('drop', this, {
|
2220
|
+
evt: evt
|
2221
|
+
});
|
2222
|
+
parentEl = dragEl && dragEl.parentNode;
|
2223
|
+
|
2224
|
+
// Get again after plugin event
|
2225
|
+
newIndex = index(dragEl);
|
2226
|
+
newDraggableIndex = index(dragEl, options.draggable);
|
2227
|
+
if (Sortable.eventCanceled) {
|
2228
|
+
this._nulling();
|
2229
|
+
return;
|
2230
|
+
}
|
2231
|
+
awaitingDragStarted = false;
|
2232
|
+
isCircumstantialInvert = false;
|
2233
|
+
pastFirstInvertThresh = false;
|
2234
|
+
clearInterval(this._loopId);
|
2235
|
+
clearTimeout(this._dragStartTimer);
|
2236
|
+
_cancelNextTick(this.cloneId);
|
2237
|
+
_cancelNextTick(this._dragStartId);
|
2238
|
+
|
2239
|
+
// Unbind events
|
2240
|
+
if (this.nativeDraggable) {
|
2241
|
+
off(document, 'drop', this);
|
2242
|
+
off(el, 'dragstart', this._onDragStart);
|
2243
|
+
}
|
2244
|
+
this._offMoveEvents();
|
2245
|
+
this._offUpEvents();
|
2246
|
+
if (Safari) {
|
2247
|
+
css(document.body, 'user-select', '');
|
2248
|
+
}
|
2249
|
+
css(dragEl, 'transform', '');
|
2250
|
+
if (evt) {
|
2251
|
+
if (moved) {
|
2252
|
+
evt.cancelable && evt.preventDefault();
|
2253
|
+
!options.dropBubble && evt.stopPropagation();
|
2254
|
+
}
|
2255
|
+
ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
|
2256
|
+
if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
|
2257
|
+
// Remove clone(s)
|
2258
|
+
cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
|
2259
|
+
}
|
2260
|
+
if (dragEl) {
|
2261
|
+
if (this.nativeDraggable) {
|
2262
|
+
off(dragEl, 'dragend', this);
|
2263
|
+
}
|
2264
|
+
_disableDraggable(dragEl);
|
2265
|
+
dragEl.style['will-change'] = '';
|
2266
|
+
|
2267
|
+
// Remove classes
|
2268
|
+
// ghostClass is added in dragStarted
|
2269
|
+
if (moved && !awaitingDragStarted) {
|
2270
|
+
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
|
2271
|
+
}
|
2272
|
+
toggleClass(dragEl, this.options.chosenClass, false);
|
2273
|
+
|
2274
|
+
// Drag stop event
|
2275
|
+
_dispatchEvent({
|
2276
|
+
sortable: this,
|
2277
|
+
name: 'unchoose',
|
2278
|
+
toEl: parentEl,
|
2279
|
+
newIndex: null,
|
2280
|
+
newDraggableIndex: null,
|
2281
|
+
originalEvent: evt
|
2282
|
+
});
|
2283
|
+
if (rootEl !== parentEl) {
|
2284
|
+
if (newIndex >= 0) {
|
2285
|
+
// Add event
|
2286
|
+
_dispatchEvent({
|
2287
|
+
rootEl: parentEl,
|
2288
|
+
name: 'add',
|
2289
|
+
toEl: parentEl,
|
2290
|
+
fromEl: rootEl,
|
2291
|
+
originalEvent: evt
|
2292
|
+
});
|
2293
|
+
|
2294
|
+
// Remove event
|
2295
|
+
_dispatchEvent({
|
2296
|
+
sortable: this,
|
2297
|
+
name: 'remove',
|
2298
|
+
toEl: parentEl,
|
2299
|
+
originalEvent: evt
|
2300
|
+
});
|
2301
|
+
|
2302
|
+
// drag from one list and drop into another
|
2303
|
+
_dispatchEvent({
|
2304
|
+
rootEl: parentEl,
|
2305
|
+
name: 'sort',
|
2306
|
+
toEl: parentEl,
|
2307
|
+
fromEl: rootEl,
|
2308
|
+
originalEvent: evt
|
2309
|
+
});
|
2310
|
+
_dispatchEvent({
|
2311
|
+
sortable: this,
|
2312
|
+
name: 'sort',
|
2313
|
+
toEl: parentEl,
|
2314
|
+
originalEvent: evt
|
2315
|
+
});
|
2316
|
+
}
|
2317
|
+
putSortable && putSortable.save();
|
2318
|
+
} else {
|
2319
|
+
if (newIndex !== oldIndex) {
|
2320
|
+
if (newIndex >= 0) {
|
2321
|
+
// drag & drop within the same list
|
2322
|
+
_dispatchEvent({
|
2323
|
+
sortable: this,
|
2324
|
+
name: 'update',
|
2325
|
+
toEl: parentEl,
|
2326
|
+
originalEvent: evt
|
2327
|
+
});
|
2328
|
+
_dispatchEvent({
|
2329
|
+
sortable: this,
|
2330
|
+
name: 'sort',
|
2331
|
+
toEl: parentEl,
|
2332
|
+
originalEvent: evt
|
2333
|
+
});
|
2334
|
+
}
|
2335
|
+
}
|
2336
|
+
}
|
2337
|
+
if (Sortable.active) {
|
2338
|
+
/* jshint eqnull:true */
|
2339
|
+
if (newIndex == null || newIndex === -1) {
|
2340
|
+
newIndex = oldIndex;
|
2341
|
+
newDraggableIndex = oldDraggableIndex;
|
2342
|
+
}
|
2343
|
+
_dispatchEvent({
|
2344
|
+
sortable: this,
|
2345
|
+
name: 'end',
|
2346
|
+
toEl: parentEl,
|
2347
|
+
originalEvent: evt
|
2348
|
+
});
|
2349
|
+
|
2350
|
+
// Save sorting
|
2351
|
+
this.save();
|
2352
|
+
}
|
2353
|
+
}
|
2354
|
+
}
|
2355
|
+
this._nulling();
|
2356
|
+
},
|
2357
|
+
_nulling: function _nulling() {
|
2358
|
+
pluginEvent('nulling', this);
|
2359
|
+
rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
|
2360
|
+
savedInputChecked.forEach(function (el) {
|
2361
|
+
el.checked = true;
|
2362
|
+
});
|
2363
|
+
savedInputChecked.length = lastDx = lastDy = 0;
|
2364
|
+
},
|
2365
|
+
handleEvent: function handleEvent( /**Event*/evt) {
|
2366
|
+
switch (evt.type) {
|
2367
|
+
case 'drop':
|
2368
|
+
case 'dragend':
|
2369
|
+
this._onDrop(evt);
|
2370
|
+
break;
|
2371
|
+
case 'dragenter':
|
2372
|
+
case 'dragover':
|
2373
|
+
if (dragEl) {
|
2374
|
+
this._onDragOver(evt);
|
2375
|
+
_globalDragOver(evt);
|
2376
|
+
}
|
2377
|
+
break;
|
2378
|
+
case 'selectstart':
|
2379
|
+
evt.preventDefault();
|
2380
|
+
break;
|
2381
|
+
}
|
2382
|
+
},
|
2383
|
+
/**
|
2384
|
+
* Serializes the item into an array of string.
|
2385
|
+
* @returns {String[]}
|
2386
|
+
*/
|
2387
|
+
toArray: function toArray() {
|
2388
|
+
var order = [],
|
2389
|
+
el,
|
2390
|
+
children = this.el.children,
|
2391
|
+
i = 0,
|
2392
|
+
n = children.length,
|
2393
|
+
options = this.options;
|
2394
|
+
for (; i < n; i++) {
|
2395
|
+
el = children[i];
|
2396
|
+
if (closest(el, options.draggable, this.el, false)) {
|
2397
|
+
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
2398
|
+
}
|
2399
|
+
}
|
2400
|
+
return order;
|
2401
|
+
},
|
2402
|
+
/**
|
2403
|
+
* Sorts the elements according to the array.
|
2404
|
+
* @param {String[]} order order of the items
|
2405
|
+
*/
|
2406
|
+
sort: function sort(order, useAnimation) {
|
2407
|
+
var items = {},
|
2408
|
+
rootEl = this.el;
|
2409
|
+
this.toArray().forEach(function (id, i) {
|
2410
|
+
var el = rootEl.children[i];
|
2411
|
+
if (closest(el, this.options.draggable, rootEl, false)) {
|
2412
|
+
items[id] = el;
|
2413
|
+
}
|
2414
|
+
}, this);
|
2415
|
+
useAnimation && this.captureAnimationState();
|
2416
|
+
order.forEach(function (id) {
|
2417
|
+
if (items[id]) {
|
2418
|
+
rootEl.removeChild(items[id]);
|
2419
|
+
rootEl.appendChild(items[id]);
|
2420
|
+
}
|
2421
|
+
});
|
2422
|
+
useAnimation && this.animateAll();
|
2423
|
+
},
|
2424
|
+
/**
|
2425
|
+
* Save the current sorting
|
2426
|
+
*/
|
2427
|
+
save: function save() {
|
2428
|
+
var store = this.options.store;
|
2429
|
+
store && store.set && store.set(this);
|
2430
|
+
},
|
2431
|
+
/**
|
2432
|
+
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
2433
|
+
* @param {HTMLElement} el
|
2434
|
+
* @param {String} [selector] default: `options.draggable`
|
2435
|
+
* @returns {HTMLElement|null}
|
2436
|
+
*/
|
2437
|
+
closest: function closest$1(el, selector) {
|
2438
|
+
return closest(el, selector || this.options.draggable, this.el, false);
|
2439
|
+
},
|
2440
|
+
/**
|
2441
|
+
* Set/get option
|
2442
|
+
* @param {string} name
|
2443
|
+
* @param {*} [value]
|
2444
|
+
* @returns {*}
|
2445
|
+
*/
|
2446
|
+
option: function option(name, value) {
|
2447
|
+
var options = this.options;
|
2448
|
+
if (value === void 0) {
|
2449
|
+
return options[name];
|
2450
|
+
} else {
|
2451
|
+
var modifiedValue = PluginManager.modifyOption(this, name, value);
|
2452
|
+
if (typeof modifiedValue !== 'undefined') {
|
2453
|
+
options[name] = modifiedValue;
|
2454
|
+
} else {
|
2455
|
+
options[name] = value;
|
2456
|
+
}
|
2457
|
+
if (name === 'group') {
|
2458
|
+
_prepareGroup(options);
|
2459
|
+
}
|
2460
|
+
}
|
2461
|
+
},
|
2462
|
+
/**
|
2463
|
+
* Destroy
|
2464
|
+
*/
|
2465
|
+
destroy: function destroy() {
|
2466
|
+
pluginEvent('destroy', this);
|
2467
|
+
var el = this.el;
|
2468
|
+
el[expando] = null;
|
2469
|
+
off(el, 'mousedown', this._onTapStart);
|
2470
|
+
off(el, 'touchstart', this._onTapStart);
|
2471
|
+
off(el, 'pointerdown', this._onTapStart);
|
2472
|
+
if (this.nativeDraggable) {
|
2473
|
+
off(el, 'dragover', this);
|
2474
|
+
off(el, 'dragenter', this);
|
2475
|
+
}
|
2476
|
+
// Remove draggable attributes
|
2477
|
+
Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
|
2478
|
+
el.removeAttribute('draggable');
|
2479
|
+
});
|
2480
|
+
this._onDrop();
|
2481
|
+
this._disableDelayedDragEvents();
|
2482
|
+
sortables.splice(sortables.indexOf(this.el), 1);
|
2483
|
+
this.el = el = null;
|
2484
|
+
},
|
2485
|
+
_hideClone: function _hideClone() {
|
2486
|
+
if (!cloneHidden) {
|
2487
|
+
pluginEvent('hideClone', this);
|
2488
|
+
if (Sortable.eventCanceled) return;
|
2489
|
+
css(cloneEl, 'display', 'none');
|
2490
|
+
if (this.options.removeCloneOnHide && cloneEl.parentNode) {
|
2491
|
+
cloneEl.parentNode.removeChild(cloneEl);
|
2492
|
+
}
|
2493
|
+
cloneHidden = true;
|
2494
|
+
}
|
2495
|
+
},
|
2496
|
+
_showClone: function _showClone(putSortable) {
|
2497
|
+
if (putSortable.lastPutMode !== 'clone') {
|
2498
|
+
this._hideClone();
|
2499
|
+
return;
|
2500
|
+
}
|
2501
|
+
if (cloneHidden) {
|
2502
|
+
pluginEvent('showClone', this);
|
2503
|
+
if (Sortable.eventCanceled) return;
|
2504
|
+
|
2505
|
+
// show clone at dragEl or original position
|
2506
|
+
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
|
2507
|
+
rootEl.insertBefore(cloneEl, dragEl);
|
2508
|
+
} else if (nextEl) {
|
2509
|
+
rootEl.insertBefore(cloneEl, nextEl);
|
2510
|
+
} else {
|
2511
|
+
rootEl.appendChild(cloneEl);
|
2512
|
+
}
|
2513
|
+
if (this.options.group.revertClone) {
|
2514
|
+
this.animate(dragEl, cloneEl);
|
2515
|
+
}
|
2516
|
+
css(cloneEl, 'display', '');
|
2517
|
+
cloneHidden = false;
|
2518
|
+
}
|
2519
|
+
}
|
2520
|
+
};
|
2521
|
+
function _globalDragOver( /**Event*/evt) {
|
2522
|
+
if (evt.dataTransfer) {
|
2523
|
+
evt.dataTransfer.dropEffect = 'move';
|
2524
|
+
}
|
2525
|
+
evt.cancelable && evt.preventDefault();
|
2526
|
+
}
|
2527
|
+
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
|
2528
|
+
var evt,
|
2529
|
+
sortable = fromEl[expando],
|
2530
|
+
onMoveFn = sortable.options.onMove,
|
2531
|
+
retVal;
|
2532
|
+
// Support for new CustomEvent feature
|
2533
|
+
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
2534
|
+
evt = new CustomEvent('move', {
|
2535
|
+
bubbles: true,
|
2536
|
+
cancelable: true
|
2537
|
+
});
|
2538
|
+
} else {
|
2539
|
+
evt = document.createEvent('Event');
|
2540
|
+
evt.initEvent('move', true, true);
|
2541
|
+
}
|
2542
|
+
evt.to = toEl;
|
2543
|
+
evt.from = fromEl;
|
2544
|
+
evt.dragged = dragEl;
|
2545
|
+
evt.draggedRect = dragRect;
|
2546
|
+
evt.related = targetEl || toEl;
|
2547
|
+
evt.relatedRect = targetRect || getRect(toEl);
|
2548
|
+
evt.willInsertAfter = willInsertAfter;
|
2549
|
+
evt.originalEvent = originalEvent;
|
2550
|
+
fromEl.dispatchEvent(evt);
|
2551
|
+
if (onMoveFn) {
|
2552
|
+
retVal = onMoveFn.call(sortable, evt, originalEvent);
|
2553
|
+
}
|
2554
|
+
return retVal;
|
2555
|
+
}
|
2556
|
+
function _disableDraggable(el) {
|
2557
|
+
el.draggable = false;
|
2558
|
+
}
|
2559
|
+
function _unsilent() {
|
2560
|
+
_silent = false;
|
2561
|
+
}
|
2562
|
+
function _ghostIsFirst(evt, vertical, sortable) {
|
2563
|
+
var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
|
2564
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
2565
|
+
var spacer = 10;
|
2566
|
+
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
|
2567
|
+
}
|
2568
|
+
function _ghostIsLast(evt, vertical, sortable) {
|
2569
|
+
var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
|
2570
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
2571
|
+
var spacer = 10;
|
2572
|
+
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
|
2573
|
+
}
|
2574
|
+
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
|
2575
|
+
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
|
2576
|
+
targetLength = vertical ? targetRect.height : targetRect.width,
|
2577
|
+
targetS1 = vertical ? targetRect.top : targetRect.left,
|
2578
|
+
targetS2 = vertical ? targetRect.bottom : targetRect.right,
|
2579
|
+
invert = false;
|
2580
|
+
if (!invertSwap) {
|
2581
|
+
// Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
|
2582
|
+
if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
|
2583
|
+
// multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
|
2584
|
+
// check if past first invert threshold on side opposite of lastDirection
|
2585
|
+
if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
|
2586
|
+
// past first invert threshold, do not restrict inverted threshold to dragEl shadow
|
2587
|
+
pastFirstInvertThresh = true;
|
2588
|
+
}
|
2589
|
+
if (!pastFirstInvertThresh) {
|
2590
|
+
// dragEl shadow (target move distance shadow)
|
2591
|
+
if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
|
2592
|
+
: mouseOnAxis > targetS2 - targetMoveDistance) {
|
2593
|
+
return -lastDirection;
|
2594
|
+
}
|
2595
|
+
} else {
|
2596
|
+
invert = true;
|
2597
|
+
}
|
2598
|
+
} else {
|
2599
|
+
// Regular
|
2600
|
+
if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
|
2601
|
+
return _getInsertDirection(target);
|
2602
|
+
}
|
2603
|
+
}
|
2604
|
+
}
|
2605
|
+
invert = invert || invertSwap;
|
2606
|
+
if (invert) {
|
2607
|
+
// Invert of regular
|
2608
|
+
if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
|
2609
|
+
return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
|
2610
|
+
}
|
2611
|
+
}
|
2612
|
+
return 0;
|
2613
|
+
}
|
2614
|
+
|
2615
|
+
/**
|
2616
|
+
* Gets the direction dragEl must be swapped relative to target in order to make it
|
2617
|
+
* seem that dragEl has been "inserted" into that element's position
|
2618
|
+
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
2619
|
+
* @return {Number} Direction dragEl must be swapped
|
2620
|
+
*/
|
2621
|
+
function _getInsertDirection(target) {
|
2622
|
+
if (index(dragEl) < index(target)) {
|
2623
|
+
return 1;
|
2624
|
+
} else {
|
2625
|
+
return -1;
|
2626
|
+
}
|
2627
|
+
}
|
2628
|
+
|
2629
|
+
/**
|
2630
|
+
* Generate id
|
2631
|
+
* @param {HTMLElement} el
|
2632
|
+
* @returns {String}
|
2633
|
+
* @private
|
2634
|
+
*/
|
2635
|
+
function _generateId(el) {
|
2636
|
+
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
2637
|
+
i = str.length,
|
2638
|
+
sum = 0;
|
2639
|
+
while (i--) {
|
2640
|
+
sum += str.charCodeAt(i);
|
2641
|
+
}
|
2642
|
+
return sum.toString(36);
|
2643
|
+
}
|
2644
|
+
function _saveInputCheckedState(root) {
|
2645
|
+
savedInputChecked.length = 0;
|
2646
|
+
var inputs = root.getElementsByTagName('input');
|
2647
|
+
var idx = inputs.length;
|
2648
|
+
while (idx--) {
|
2649
|
+
var el = inputs[idx];
|
2650
|
+
el.checked && savedInputChecked.push(el);
|
2651
|
+
}
|
2652
|
+
}
|
2653
|
+
function _nextTick(fn) {
|
2654
|
+
return setTimeout(fn, 0);
|
2655
|
+
}
|
2656
|
+
function _cancelNextTick(id) {
|
2657
|
+
return clearTimeout(id);
|
2658
|
+
}
|
2659
|
+
|
2660
|
+
// Fixed #973:
|
2661
|
+
if (documentExists) {
|
2662
|
+
on(document, 'touchmove', function (evt) {
|
2663
|
+
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
|
2664
|
+
evt.preventDefault();
|
2665
|
+
}
|
2666
|
+
});
|
2667
|
+
}
|
2668
|
+
|
2669
|
+
// Export utils
|
2670
|
+
Sortable.utils = {
|
2671
|
+
on: on,
|
2672
|
+
off: off,
|
2673
|
+
css: css,
|
2674
|
+
find: find,
|
2675
|
+
is: function is(el, selector) {
|
2676
|
+
return !!closest(el, selector, el, false);
|
2677
|
+
},
|
2678
|
+
extend: extend,
|
2679
|
+
throttle: throttle,
|
2680
|
+
closest: closest,
|
2681
|
+
toggleClass: toggleClass,
|
2682
|
+
clone: clone,
|
2683
|
+
index: index,
|
2684
|
+
nextTick: _nextTick,
|
2685
|
+
cancelNextTick: _cancelNextTick,
|
2686
|
+
detectDirection: _detectDirection,
|
2687
|
+
getChild: getChild,
|
2688
|
+
expando: expando
|
2689
|
+
};
|
2690
|
+
|
2691
|
+
/**
|
2692
|
+
* Get the Sortable instance of an element
|
2693
|
+
* @param {HTMLElement} element The element
|
2694
|
+
* @return {Sortable|undefined} The instance of Sortable
|
2695
|
+
*/
|
2696
|
+
Sortable.get = function (element) {
|
2697
|
+
return element[expando];
|
2698
|
+
};
|
2699
|
+
|
2700
|
+
/**
|
2701
|
+
* Mount a plugin to Sortable
|
2702
|
+
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
2703
|
+
*/
|
2704
|
+
Sortable.mount = function () {
|
2705
|
+
for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
|
2706
|
+
plugins[_key] = arguments[_key];
|
2707
|
+
}
|
2708
|
+
if (plugins[0].constructor === Array) plugins = plugins[0];
|
2709
|
+
plugins.forEach(function (plugin) {
|
2710
|
+
if (!plugin.prototype || !plugin.prototype.constructor) {
|
2711
|
+
throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
|
2712
|
+
}
|
2713
|
+
if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
|
2714
|
+
PluginManager.mount(plugin);
|
2715
|
+
});
|
2716
|
+
};
|
2717
|
+
|
2718
|
+
/**
|
2719
|
+
* Create sortable instance
|
2720
|
+
* @param {HTMLElement} el
|
2721
|
+
* @param {Object} [options]
|
2722
|
+
*/
|
2723
|
+
Sortable.create = function (el, options) {
|
2724
|
+
return new Sortable(el, options);
|
2725
|
+
};
|
2726
|
+
|
2727
|
+
// Export
|
2728
|
+
Sortable.version = version;
|
2729
|
+
|
2730
|
+
var autoScrolls = [],
|
2731
|
+
scrollEl,
|
2732
|
+
scrollRootEl,
|
2733
|
+
scrolling = false,
|
2734
|
+
lastAutoScrollX,
|
2735
|
+
lastAutoScrollY,
|
2736
|
+
touchEvt$1,
|
2737
|
+
pointerElemChangedInterval;
|
2738
|
+
function AutoScrollPlugin() {
|
2739
|
+
function AutoScroll() {
|
2740
|
+
this.defaults = {
|
2741
|
+
scroll: true,
|
2742
|
+
forceAutoScrollFallback: false,
|
2743
|
+
scrollSensitivity: 30,
|
2744
|
+
scrollSpeed: 10,
|
2745
|
+
bubbleScroll: true
|
2746
|
+
};
|
2747
|
+
|
2748
|
+
// Bind all private methods
|
2749
|
+
for (var fn in this) {
|
2750
|
+
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
2751
|
+
this[fn] = this[fn].bind(this);
|
2752
|
+
}
|
2753
|
+
}
|
2754
|
+
}
|
2755
|
+
AutoScroll.prototype = {
|
2756
|
+
dragStarted: function dragStarted(_ref) {
|
2757
|
+
var originalEvent = _ref.originalEvent;
|
2758
|
+
if (this.sortable.nativeDraggable) {
|
2759
|
+
on(document, 'dragover', this._handleAutoScroll);
|
2760
|
+
} else {
|
2761
|
+
if (this.options.supportPointer) {
|
2762
|
+
on(document, 'pointermove', this._handleFallbackAutoScroll);
|
2763
|
+
} else if (originalEvent.touches) {
|
2764
|
+
on(document, 'touchmove', this._handleFallbackAutoScroll);
|
2765
|
+
} else {
|
2766
|
+
on(document, 'mousemove', this._handleFallbackAutoScroll);
|
2767
|
+
}
|
2768
|
+
}
|
2769
|
+
},
|
2770
|
+
dragOverCompleted: function dragOverCompleted(_ref2) {
|
2771
|
+
var originalEvent = _ref2.originalEvent;
|
2772
|
+
// For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
|
2773
|
+
if (!this.options.dragOverBubble && !originalEvent.rootEl) {
|
2774
|
+
this._handleAutoScroll(originalEvent);
|
2775
|
+
}
|
2776
|
+
},
|
2777
|
+
drop: function drop() {
|
2778
|
+
if (this.sortable.nativeDraggable) {
|
2779
|
+
off(document, 'dragover', this._handleAutoScroll);
|
2780
|
+
} else {
|
2781
|
+
off(document, 'pointermove', this._handleFallbackAutoScroll);
|
2782
|
+
off(document, 'touchmove', this._handleFallbackAutoScroll);
|
2783
|
+
off(document, 'mousemove', this._handleFallbackAutoScroll);
|
2784
|
+
}
|
2785
|
+
clearPointerElemChangedInterval();
|
2786
|
+
clearAutoScrolls();
|
2787
|
+
cancelThrottle();
|
2788
|
+
},
|
2789
|
+
nulling: function nulling() {
|
2790
|
+
touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
|
2791
|
+
autoScrolls.length = 0;
|
2792
|
+
},
|
2793
|
+
_handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
|
2794
|
+
this._handleAutoScroll(evt, true);
|
2795
|
+
},
|
2796
|
+
_handleAutoScroll: function _handleAutoScroll(evt, fallback) {
|
2797
|
+
var _this = this;
|
2798
|
+
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
2799
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
2800
|
+
elem = document.elementFromPoint(x, y);
|
2801
|
+
touchEvt$1 = evt;
|
2802
|
+
|
2803
|
+
// IE does not seem to have native autoscroll,
|
2804
|
+
// Edge's autoscroll seems too conditional,
|
2805
|
+
// MACOS Safari does not have autoscroll,
|
2806
|
+
// Firefox and Chrome are good
|
2807
|
+
if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
|
2808
|
+
autoScroll(evt, this.options, elem, fallback);
|
2809
|
+
|
2810
|
+
// Listener for pointer element change
|
2811
|
+
var ogElemScroller = getParentAutoScrollElement(elem, true);
|
2812
|
+
if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
|
2813
|
+
pointerElemChangedInterval && clearPointerElemChangedInterval();
|
2814
|
+
// Detect for pointer elem change, emulating native DnD behaviour
|
2815
|
+
pointerElemChangedInterval = setInterval(function () {
|
2816
|
+
var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
|
2817
|
+
if (newElem !== ogElemScroller) {
|
2818
|
+
ogElemScroller = newElem;
|
2819
|
+
clearAutoScrolls();
|
2820
|
+
}
|
2821
|
+
autoScroll(evt, _this.options, newElem, fallback);
|
2822
|
+
}, 10);
|
2823
|
+
lastAutoScrollX = x;
|
2824
|
+
lastAutoScrollY = y;
|
2825
|
+
}
|
2826
|
+
} else {
|
2827
|
+
// if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
|
2828
|
+
if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
|
2829
|
+
clearAutoScrolls();
|
2830
|
+
return;
|
2831
|
+
}
|
2832
|
+
autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
|
2833
|
+
}
|
2834
|
+
}
|
2835
|
+
};
|
2836
|
+
return _extends(AutoScroll, {
|
2837
|
+
pluginName: 'scroll',
|
2838
|
+
initializeByDefault: true
|
2839
|
+
});
|
2840
|
+
}
|
2841
|
+
function clearAutoScrolls() {
|
2842
|
+
autoScrolls.forEach(function (autoScroll) {
|
2843
|
+
clearInterval(autoScroll.pid);
|
2844
|
+
});
|
2845
|
+
autoScrolls = [];
|
2846
|
+
}
|
2847
|
+
function clearPointerElemChangedInterval() {
|
2848
|
+
clearInterval(pointerElemChangedInterval);
|
2849
|
+
}
|
2850
|
+
var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
|
2851
|
+
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
|
2852
|
+
if (!options.scroll) return;
|
2853
|
+
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
2854
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
2855
|
+
sens = options.scrollSensitivity,
|
2856
|
+
speed = options.scrollSpeed,
|
2857
|
+
winScroller = getWindowScrollingElement();
|
2858
|
+
var scrollThisInstance = false,
|
2859
|
+
scrollCustomFn;
|
2860
|
+
|
2861
|
+
// New scroll root, set scrollEl
|
2862
|
+
if (scrollRootEl !== rootEl) {
|
2863
|
+
scrollRootEl = rootEl;
|
2864
|
+
clearAutoScrolls();
|
2865
|
+
scrollEl = options.scroll;
|
2866
|
+
scrollCustomFn = options.scrollFn;
|
2867
|
+
if (scrollEl === true) {
|
2868
|
+
scrollEl = getParentAutoScrollElement(rootEl, true);
|
2869
|
+
}
|
2870
|
+
}
|
2871
|
+
var layersOut = 0;
|
2872
|
+
var currentParent = scrollEl;
|
2873
|
+
do {
|
2874
|
+
var el = currentParent,
|
2875
|
+
rect = getRect(el),
|
2876
|
+
top = rect.top,
|
2877
|
+
bottom = rect.bottom,
|
2878
|
+
left = rect.left,
|
2879
|
+
right = rect.right,
|
2880
|
+
width = rect.width,
|
2881
|
+
height = rect.height,
|
2882
|
+
canScrollX = void 0,
|
2883
|
+
canScrollY = void 0,
|
2884
|
+
scrollWidth = el.scrollWidth,
|
2885
|
+
scrollHeight = el.scrollHeight,
|
2886
|
+
elCSS = css(el),
|
2887
|
+
scrollPosX = el.scrollLeft,
|
2888
|
+
scrollPosY = el.scrollTop;
|
2889
|
+
if (el === winScroller) {
|
2890
|
+
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
|
2891
|
+
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
|
2892
|
+
} else {
|
2893
|
+
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
|
2894
|
+
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
|
2895
|
+
}
|
2896
|
+
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
|
2897
|
+
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
|
2898
|
+
if (!autoScrolls[layersOut]) {
|
2899
|
+
for (var i = 0; i <= layersOut; i++) {
|
2900
|
+
if (!autoScrolls[i]) {
|
2901
|
+
autoScrolls[i] = {};
|
2902
|
+
}
|
2903
|
+
}
|
2904
|
+
}
|
2905
|
+
if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
|
2906
|
+
autoScrolls[layersOut].el = el;
|
2907
|
+
autoScrolls[layersOut].vx = vx;
|
2908
|
+
autoScrolls[layersOut].vy = vy;
|
2909
|
+
clearInterval(autoScrolls[layersOut].pid);
|
2910
|
+
if (vx != 0 || vy != 0) {
|
2911
|
+
scrollThisInstance = true;
|
2912
|
+
/* jshint loopfunc:true */
|
2913
|
+
autoScrolls[layersOut].pid = setInterval(function () {
|
2914
|
+
// emulate drag over during autoscroll (fallback), emulating native DnD behaviour
|
2915
|
+
if (isFallback && this.layer === 0) {
|
2916
|
+
Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
|
2917
|
+
}
|
2918
|
+
var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
|
2919
|
+
var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
|
2920
|
+
if (typeof scrollCustomFn === 'function') {
|
2921
|
+
if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
|
2922
|
+
return;
|
2923
|
+
}
|
2924
|
+
}
|
2925
|
+
scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
|
2926
|
+
}.bind({
|
2927
|
+
layer: layersOut
|
2928
|
+
}), 24);
|
2929
|
+
}
|
2930
|
+
}
|
2931
|
+
layersOut++;
|
2932
|
+
} while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
|
2933
|
+
scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
|
2934
|
+
}, 30);
|
2935
|
+
|
2936
|
+
var drop = function drop(_ref) {
|
2937
|
+
var originalEvent = _ref.originalEvent,
|
2938
|
+
putSortable = _ref.putSortable,
|
2939
|
+
dragEl = _ref.dragEl,
|
2940
|
+
activeSortable = _ref.activeSortable,
|
2941
|
+
dispatchSortableEvent = _ref.dispatchSortableEvent,
|
2942
|
+
hideGhostForTarget = _ref.hideGhostForTarget,
|
2943
|
+
unhideGhostForTarget = _ref.unhideGhostForTarget;
|
2944
|
+
if (!originalEvent) return;
|
2945
|
+
var toSortable = putSortable || activeSortable;
|
2946
|
+
hideGhostForTarget();
|
2947
|
+
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
|
2948
|
+
var target = document.elementFromPoint(touch.clientX, touch.clientY);
|
2949
|
+
unhideGhostForTarget();
|
2950
|
+
if (toSortable && !toSortable.el.contains(target)) {
|
2951
|
+
dispatchSortableEvent('spill');
|
2952
|
+
this.onSpill({
|
2953
|
+
dragEl: dragEl,
|
2954
|
+
putSortable: putSortable
|
2955
|
+
});
|
2956
|
+
}
|
2957
|
+
};
|
2958
|
+
function Revert() {}
|
2959
|
+
Revert.prototype = {
|
2960
|
+
startIndex: null,
|
2961
|
+
dragStart: function dragStart(_ref2) {
|
2962
|
+
var oldDraggableIndex = _ref2.oldDraggableIndex;
|
2963
|
+
this.startIndex = oldDraggableIndex;
|
2964
|
+
},
|
2965
|
+
onSpill: function onSpill(_ref3) {
|
2966
|
+
var dragEl = _ref3.dragEl,
|
2967
|
+
putSortable = _ref3.putSortable;
|
2968
|
+
this.sortable.captureAnimationState();
|
2969
|
+
if (putSortable) {
|
2970
|
+
putSortable.captureAnimationState();
|
2971
|
+
}
|
2972
|
+
var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
|
2973
|
+
if (nextSibling) {
|
2974
|
+
this.sortable.el.insertBefore(dragEl, nextSibling);
|
2975
|
+
} else {
|
2976
|
+
this.sortable.el.appendChild(dragEl);
|
2977
|
+
}
|
2978
|
+
this.sortable.animateAll();
|
2979
|
+
if (putSortable) {
|
2980
|
+
putSortable.animateAll();
|
2981
|
+
}
|
2982
|
+
},
|
2983
|
+
drop: drop
|
2984
|
+
};
|
2985
|
+
_extends(Revert, {
|
2986
|
+
pluginName: 'revertOnSpill'
|
2987
|
+
});
|
2988
|
+
function Remove() {}
|
2989
|
+
Remove.prototype = {
|
2990
|
+
onSpill: function onSpill(_ref4) {
|
2991
|
+
var dragEl = _ref4.dragEl,
|
2992
|
+
putSortable = _ref4.putSortable;
|
2993
|
+
var parentSortable = putSortable || this.sortable;
|
2994
|
+
parentSortable.captureAnimationState();
|
2995
|
+
dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
|
2996
|
+
parentSortable.animateAll();
|
2997
|
+
},
|
2998
|
+
drop: drop
|
2999
|
+
};
|
3000
|
+
_extends(Remove, {
|
3001
|
+
pluginName: 'removeOnSpill'
|
3002
|
+
});
|
3003
|
+
|
3004
|
+
Sortable.mount(new AutoScrollPlugin());
|
3005
|
+
Sortable.mount(Remove, Revert);
|
3006
|
+
|
373
3007
|
var CollectionView = Marionette.View.extend({
|
374
3008
|
initialize: function initialize() {
|
375
3009
|
this.rendered = false;
|
@@ -378,7 +3012,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
378
3012
|
this.listenTo(this.collection, 'add', this.addItem);
|
379
3013
|
this.listenTo(this.collection, 'remove', this.removeItem);
|
380
3014
|
this.listenTo(this.collection, 'sort', this.sort);
|
381
|
-
|
382
3015
|
if (this.options.loadingViewConstructor) {
|
383
3016
|
this.listenTo(this.collection, 'request', function () {
|
384
3017
|
this.loading = true;
|
@@ -399,7 +3032,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
399
3032
|
this.togglePlaceHolder();
|
400
3033
|
this.rendered = true;
|
401
3034
|
}
|
402
|
-
|
403
3035
|
return this;
|
404
3036
|
},
|
405
3037
|
onClose: function onClose() {
|
@@ -411,24 +3043,20 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
411
3043
|
model: item
|
412
3044
|
}, this.getItemViewOptions(item)));
|
413
3045
|
this.itemViews.add(view);
|
414
|
-
|
415
3046
|
if (this.rendered) {
|
416
3047
|
var index = this.collection.indexOf(item);
|
417
3048
|
view.render();
|
418
3049
|
view.$el.data('view', view);
|
419
|
-
|
420
3050
|
if (index > 0) {
|
421
3051
|
this.$el.children().eq(index - 1).after(view.el);
|
422
3052
|
} else {
|
423
3053
|
this.$el.prepend(view.el);
|
424
3054
|
}
|
425
|
-
|
426
3055
|
this.togglePlaceHolder();
|
427
3056
|
}
|
428
3057
|
},
|
429
3058
|
removeItem: function removeItem(item) {
|
430
3059
|
var view = this.itemViews.findByModel(item);
|
431
|
-
|
432
3060
|
if (view) {
|
433
3061
|
this.itemViews.remove(view);
|
434
3062
|
view.close();
|
@@ -440,19 +3068,15 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
440
3068
|
this.collection.each(function (item) {
|
441
3069
|
var itemView = this.itemViews.findByModel(item);
|
442
3070
|
var element;
|
443
|
-
|
444
3071
|
if (!itemView) {
|
445
3072
|
return;
|
446
3073
|
}
|
447
|
-
|
448
3074
|
element = itemView.$el;
|
449
|
-
|
450
3075
|
if (last) {
|
451
3076
|
last.after(element);
|
452
3077
|
} else {
|
453
3078
|
this.$el.prepend(element);
|
454
3079
|
}
|
455
|
-
|
456
3080
|
last = element;
|
457
3081
|
}, this);
|
458
3082
|
},
|
@@ -472,7 +3096,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
472
3096
|
togglePlaceHolder: function togglePlaceHolder() {
|
473
3097
|
var lastPlaceholderConstructor = this.placeHolderConstructor;
|
474
3098
|
this.placeHolderConstructor = this.getPlaceHolderConstructor();
|
475
|
-
|
476
3099
|
if (this.itemViews.length || !this.placeHolderConstructor) {
|
477
3100
|
this.closePlaceHolderView();
|
478
3101
|
} else if (!this.placeHolderView || lastPlaceholderConstructor !== this.placeHolderConstructor) {
|
@@ -492,31 +3115,47 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
492
3115
|
|
493
3116
|
var SortableCollectionView = CollectionView.extend({
|
494
3117
|
render: function render() {
|
3118
|
+
var _this = this;
|
495
3119
|
CollectionView.prototype.render.call(this);
|
496
|
-
this
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
3120
|
+
this.sortable = Sortable.create(this.el, {
|
3121
|
+
group: this.options.connectWith,
|
3122
|
+
animation: 150,
|
3123
|
+
ghostClass: 'sortable-placeholder',
|
3124
|
+
forceFallback: this.options.forceDraggableFallback,
|
3125
|
+
fallbackTolerance: 3,
|
3126
|
+
onEnd: function onEnd(event) {
|
3127
|
+
var item = $(event.item);
|
3128
|
+
if (item.parent().is(_this.el)) {
|
3129
|
+
_this.updateOrder();
|
504
3130
|
}
|
505
|
-
},
|
506
|
-
|
507
|
-
var view =
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
3131
|
+
},
|
3132
|
+
onRemove: function onRemove(event) {
|
3133
|
+
var view = $(event.item).data('view');
|
3134
|
+
_this.itemViews.remove(view);
|
3135
|
+
_this.collection.remove(view.model);
|
3136
|
+
},
|
3137
|
+
onSort: function onSort(event) {
|
3138
|
+
if (event.from !== event.to && event.to === _this.el) {
|
3139
|
+
var view = $(event.item).data('view');
|
3140
|
+
_this.reindexPositions();
|
3141
|
+
_this.itemViews.add(view);
|
3142
|
+
_this.collection.add(view.model);
|
3143
|
+
_this.collection.saveOrder();
|
3144
|
+
}
|
3145
|
+
}
|
517
3146
|
});
|
518
3147
|
return this;
|
519
3148
|
},
|
3149
|
+
onClose: function onClose() {
|
3150
|
+
CollectionView.prototype.onClose.call(this);
|
3151
|
+
this.sortable.destroy();
|
3152
|
+
},
|
3153
|
+
disableSorting: function disableSorting() {
|
3154
|
+
this.sortable.option('disabled', true);
|
3155
|
+
},
|
3156
|
+
enableSorting: function enableSorting() {
|
3157
|
+
this.sortable.option('disabled', false);
|
3158
|
+
},
|
520
3159
|
addItem: function addItem(item) {
|
521
3160
|
if (!this.itemViews.findByModel(item)) {
|
522
3161
|
CollectionView.prototype.addItem.call(this, item);
|
@@ -539,6 +3178,41 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
539
3178
|
}
|
540
3179
|
});
|
541
3180
|
|
3181
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
3182
|
+
if (source == null) return {};
|
3183
|
+
var target = {};
|
3184
|
+
var sourceKeys = Object.keys(source);
|
3185
|
+
var key, i;
|
3186
|
+
|
3187
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
3188
|
+
key = sourceKeys[i];
|
3189
|
+
if (excluded.indexOf(key) >= 0) continue;
|
3190
|
+
target[key] = source[key];
|
3191
|
+
}
|
3192
|
+
|
3193
|
+
return target;
|
3194
|
+
}
|
3195
|
+
|
3196
|
+
function _objectWithoutProperties$1(source, excluded) {
|
3197
|
+
if (source == null) return {};
|
3198
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
3199
|
+
var key, i;
|
3200
|
+
|
3201
|
+
if (Object.getOwnPropertySymbols) {
|
3202
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
3203
|
+
|
3204
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
3205
|
+
key = sourceSymbolKeys[i];
|
3206
|
+
if (excluded.indexOf(key) >= 0) continue;
|
3207
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
3208
|
+
target[key] = source[key];
|
3209
|
+
}
|
3210
|
+
}
|
3211
|
+
|
3212
|
+
return target;
|
3213
|
+
}
|
3214
|
+
|
3215
|
+
var _excluded$1 = ["ignoreUndefined"];
|
542
3216
|
var ConfigurationEditorTabView = Marionette.View.extend({
|
543
3217
|
className: 'configuration_editor_tab',
|
544
3218
|
initialize: function initialize() {
|
@@ -573,27 +3247,27 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
573
3247
|
}
|
574
3248
|
}
|
575
3249
|
});
|
576
|
-
|
577
3250
|
ConfigurationEditorTabView.Groups = function () {
|
578
3251
|
var groups = {};
|
579
|
-
|
580
3252
|
this.define = function (name, fn) {
|
581
3253
|
if (typeof fn !== 'function') {
|
582
3254
|
throw 'Group has to be function.';
|
583
3255
|
}
|
584
|
-
|
585
3256
|
groups[name] = fn;
|
586
3257
|
};
|
587
|
-
|
588
|
-
|
3258
|
+
this.apply = function (name, context) {
|
3259
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
3260
|
+
ignoreUndefined = _ref.ignoreUndefined,
|
3261
|
+
options = _objectWithoutProperties$1(_ref, _excluded$1);
|
589
3262
|
if (!(name in groups)) {
|
3263
|
+
if (ignoreUndefined) {
|
3264
|
+
return;
|
3265
|
+
}
|
590
3266
|
throw 'Undefined group named "' + name + '".';
|
591
3267
|
}
|
592
|
-
|
593
3268
|
groups[name].call(context, options || {});
|
594
3269
|
};
|
595
3270
|
};
|
596
|
-
|
597
3271
|
ConfigurationEditorTabView.groups = new ConfigurationEditorTabView.Groups();
|
598
3272
|
|
599
3273
|
function template(data) {
|
@@ -603,6 +3277,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
603
3277
|
}
|
604
3278
|
|
605
3279
|
/*global pageflow*/
|
3280
|
+
|
606
3281
|
/**
|
607
3282
|
* Switch between different views using tabs.
|
608
3283
|
*
|
@@ -623,10 +3298,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
623
3298
|
*
|
624
3299
|
* @class
|
625
3300
|
*/
|
626
|
-
|
627
|
-
var TabsView = Marionette.Layout.extend(
|
628
|
-
/* @lends TabView.prototype */
|
629
|
-
{
|
3301
|
+
var TabsView = Marionette.Layout.extend( /* @lends TabView.prototype */{
|
630
3302
|
template: template,
|
631
3303
|
className: 'tabs_view',
|
632
3304
|
ui: {
|
@@ -645,7 +3317,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
645
3317
|
this.tabFactoryFns = {};
|
646
3318
|
this.tabNames = [];
|
647
3319
|
this.currentTabName = null;
|
648
|
-
|
649
3320
|
this._refreshScrollerOnSideBarResize();
|
650
3321
|
},
|
651
3322
|
tab: function tab(name, factoryFn) {
|
@@ -657,7 +3328,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
657
3328
|
var label = findTranslation(this._labelTranslationKeys(name));
|
658
3329
|
this.ui.headers.append($('<li />').attr('data-tab-name', name).text(label));
|
659
3330
|
}, this);
|
660
|
-
|
661
3331
|
this.scroller = new IScroll(this.ui.scroller[0], {
|
662
3332
|
scrollX: true,
|
663
3333
|
scrollY: false,
|
@@ -669,9 +3339,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
669
3339
|
},
|
670
3340
|
changeTab: function changeTab(name) {
|
671
3341
|
this.container.show(this.tabFactoryFns[name]());
|
672
|
-
|
673
3342
|
this._updateActiveHeader(name);
|
674
|
-
|
675
3343
|
this.currentTabName = name;
|
676
3344
|
},
|
677
3345
|
defaultTab: function defaultTab() {
|
@@ -681,14 +3349,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
681
3349
|
return _.first(this.tabNames);
|
682
3350
|
}
|
683
3351
|
},
|
684
|
-
|
685
3352
|
/**
|
686
3353
|
* Rerender current tab.
|
687
3354
|
*/
|
688
3355
|
refresh: function refresh() {
|
689
3356
|
this.changeTab(this.currentTabName);
|
690
3357
|
},
|
691
|
-
|
692
3358
|
/**
|
693
3359
|
* Adjust tabs scroller to changed width of view.
|
694
3360
|
*/
|
@@ -702,15 +3368,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
702
3368
|
var result = _.map(this.options.translationKeyPrefixes, function (prefix) {
|
703
3369
|
return prefix + '.' + name;
|
704
3370
|
});
|
705
|
-
|
706
3371
|
if (this.options.i18n) {
|
707
3372
|
result.push(this.options.i18n + '.' + name);
|
708
3373
|
}
|
709
|
-
|
710
3374
|
if (this.options.fallbackTranslationKeyPrefix) {
|
711
3375
|
result.push(this.options.fallbackTranslationKeyPrefix + '.' + name);
|
712
3376
|
}
|
713
|
-
|
714
3377
|
return result;
|
715
3378
|
},
|
716
3379
|
_updateActiveHeader: function _updateActiveHeader(activeTabName) {
|
@@ -758,7 +3421,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
758
3421
|
*
|
759
3422
|
* @class
|
760
3423
|
*/
|
761
|
-
|
762
3424
|
var ConfigurationEditorView = Marionette.View.extend({
|
763
3425
|
className: 'configuration_editor',
|
764
3426
|
initialize: function initialize() {
|
@@ -784,14 +3446,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
784
3446
|
return tabView;
|
785
3447
|
}, this));
|
786
3448
|
},
|
787
|
-
|
788
3449
|
/**
|
789
3450
|
* Rerender current tab.
|
790
3451
|
*/
|
791
3452
|
refresh: function refresh() {
|
792
3453
|
this.tabsView.refresh();
|
793
3454
|
},
|
794
|
-
|
795
3455
|
/**
|
796
3456
|
* Adjust tabs scroller to changed width of view.
|
797
3457
|
*/
|
@@ -803,7 +3463,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
803
3463
|
return this;
|
804
3464
|
}
|
805
3465
|
});
|
806
|
-
|
807
3466
|
_.extend(ConfigurationEditorView, {
|
808
3467
|
repository: {},
|
809
3468
|
register: function register(pageTypeName, prototype) {
|
@@ -831,7 +3490,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
831
3490
|
*
|
832
3491
|
* @since 12.0
|
833
3492
|
*/
|
834
|
-
|
835
3493
|
var TableCellView = Marionette.ItemView.extend({
|
836
3494
|
tagName: 'td',
|
837
3495
|
template: template$1,
|
@@ -843,14 +3501,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
843
3501
|
this.setupContentBinding();
|
844
3502
|
this.update();
|
845
3503
|
},
|
846
|
-
|
847
3504
|
/**
|
848
3505
|
* Override in concrete cell view.
|
849
3506
|
*/
|
850
3507
|
update: function update() {
|
851
3508
|
throw 'Not implemented';
|
852
3509
|
},
|
853
|
-
|
854
3510
|
/**
|
855
3511
|
* Returns the column attribute's value in the row model.
|
856
3512
|
*/
|
@@ -868,7 +3524,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
868
3524
|
return this.model;
|
869
3525
|
}
|
870
3526
|
},
|
871
|
-
|
872
3527
|
/**
|
873
3528
|
* Look up attribute specific translations based on
|
874
3529
|
* `attributeTranslationKeyPrefixes` of the the parent `TableView`.
|
@@ -895,7 +3550,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
895
3550
|
return prefix + '.' + this.options.column.name + '.' + keyName;
|
896
3551
|
}, this);
|
897
3552
|
},
|
898
|
-
|
899
3553
|
/**
|
900
3554
|
* Set up content binding to update this view upon change of
|
901
3555
|
* specified attribute on this.getModel().
|
@@ -944,7 +3598,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
944
3598
|
attributeTranslationKeyPrefixes: this.options.attributeTranslationKeyPrefixes
|
945
3599
|
}, column.cellViewOptions || {})));
|
946
3600
|
}, this);
|
947
|
-
|
948
3601
|
this.updateClassName();
|
949
3602
|
return this;
|
950
3603
|
},
|
@@ -985,14 +3638,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
985
3638
|
},
|
986
3639
|
onRender: function onRender() {
|
987
3640
|
var view = this;
|
988
|
-
|
989
3641
|
_(this.options.columns).each(function (column) {
|
990
3642
|
this.ui.headRow.append(this.subview(new TableHeaderCellView({
|
991
3643
|
column: column,
|
992
3644
|
attributeTranslationKeyPrefixes: this.options.attributeTranslationKeyPrefixes
|
993
3645
|
})).el);
|
994
3646
|
}, this);
|
995
|
-
|
996
3647
|
this.subview(new CollectionView({
|
997
3648
|
el: this.ui.body,
|
998
3649
|
collection: this.collection,
|
@@ -1046,7 +3697,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1046
3697
|
this.$el.toggleClass('align_bottom_right', options.align === 'bottom right');
|
1047
3698
|
this.$el.toggleClass('align_bottom_left', options.align === 'bottom left');
|
1048
3699
|
this.$el.toggleClass('align_top_center', options.align === 'top center');
|
1049
|
-
|
1050
3700
|
if (options.align === 'bottom right' || options.align === 'bottom left') {
|
1051
3701
|
offsetTop = 10;
|
1052
3702
|
offsetLeft = 0;
|
@@ -1057,7 +3707,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1057
3707
|
offsetTop = -17;
|
1058
3708
|
offsetLeft = 10;
|
1059
3709
|
}
|
1060
|
-
|
1061
3710
|
this.$el.css({
|
1062
3711
|
top: position.top + offsetTop + 'px',
|
1063
3712
|
left: position.left + offsetLeft + 'px'
|
@@ -1067,7 +3716,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1067
3716
|
}
|
1068
3717
|
});
|
1069
3718
|
|
1070
|
-
function _defineProperty(obj, key, value) {
|
3719
|
+
function _defineProperty$1(obj, key, value) {
|
1071
3720
|
if (key in obj) {
|
1072
3721
|
Object.defineProperty(obj, key, {
|
1073
3722
|
value: value,
|
@@ -1082,7 +3731,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1082
3731
|
return obj;
|
1083
3732
|
}
|
1084
3733
|
|
1085
|
-
function ownKeys(object, enumerableOnly) {
|
3734
|
+
function ownKeys$1(object, enumerableOnly) {
|
1086
3735
|
var keys = Object.keys(object);
|
1087
3736
|
|
1088
3737
|
if (Object.getOwnPropertySymbols) {
|
@@ -1096,18 +3745,18 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1096
3745
|
return keys;
|
1097
3746
|
}
|
1098
3747
|
|
1099
|
-
function _objectSpread2(target) {
|
3748
|
+
function _objectSpread2$1(target) {
|
1100
3749
|
for (var i = 1; i < arguments.length; i++) {
|
1101
3750
|
var source = arguments[i] != null ? arguments[i] : {};
|
1102
3751
|
|
1103
3752
|
if (i % 2) {
|
1104
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
1105
|
-
_defineProperty(target, key, source[key]);
|
3753
|
+
ownKeys$1(Object(source), true).forEach(function (key) {
|
3754
|
+
_defineProperty$1(target, key, source[key]);
|
1106
3755
|
});
|
1107
3756
|
} else if (Object.getOwnPropertyDescriptors) {
|
1108
3757
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
1109
3758
|
} else {
|
1110
|
-
ownKeys(Object(source)).forEach(function (key) {
|
3759
|
+
ownKeys$1(Object(source)).forEach(function (key) {
|
1111
3760
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
1112
3761
|
});
|
1113
3762
|
}
|
@@ -1125,37 +3774,32 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1125
3774
|
},
|
1126
3775
|
setupAttributeBinding: function setupAttributeBinding(optionName, updateMethod) {
|
1127
3776
|
var _this = this;
|
1128
|
-
|
1129
3777
|
var normalize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (value) {
|
1130
3778
|
return value;
|
1131
3779
|
};
|
1132
3780
|
var binding = this.options["".concat(optionName, "Binding")];
|
3781
|
+
var model = this.options["".concat(optionName, "BindingModel")] || this.model;
|
1133
3782
|
var view = this;
|
1134
|
-
|
1135
3783
|
if (binding) {
|
1136
3784
|
_.flatten([binding]).forEach(function (attribute) {
|
1137
|
-
_this.listenTo(
|
3785
|
+
_this.listenTo(model, 'change:' + attribute, update);
|
1138
3786
|
});
|
1139
3787
|
}
|
1140
|
-
|
1141
3788
|
update();
|
1142
|
-
|
1143
3789
|
function update() {
|
1144
3790
|
updateMethod.call(view, view.getAttributeBoundOption(optionName, normalize));
|
1145
3791
|
}
|
1146
3792
|
},
|
1147
3793
|
getAttributeBoundOption: function getAttributeBoundOption(optionName) {
|
1148
|
-
var _this2 = this;
|
1149
|
-
|
1150
3794
|
var normalize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (value) {
|
1151
3795
|
return value;
|
1152
3796
|
};
|
1153
3797
|
var binding = this.options["".concat(optionName, "Binding")];
|
3798
|
+
var model = this.options["".concat(optionName, "BindingModel")] || this.model;
|
1154
3799
|
var bindingValueOptionName = "".concat(optionName, "BindingValue");
|
1155
3800
|
var value = Array.isArray(binding) ? binding.map(function (attribute) {
|
1156
|
-
return
|
1157
|
-
}) :
|
1158
|
-
|
3801
|
+
return model.get(attribute);
|
3802
|
+
}) : model.get(binding);
|
1159
3803
|
if (bindingValueOptionName in this.options) {
|
1160
3804
|
return value === this.options[bindingValueOptionName];
|
1161
3805
|
} else if (typeof this.options[optionName] === 'function') {
|
@@ -1278,6 +3922,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1278
3922
|
* Input will be disabled whenever the value of the `disabledBinding`
|
1279
3923
|
* attribute equals the value of this option.
|
1280
3924
|
*
|
3925
|
+
* @param {Backbone.Model} [options.disabledBindingModel]
|
3926
|
+
* Alternative model to bind to.
|
3927
|
+
*
|
1281
3928
|
* @param {string|string[]} [options.visibleBinding]
|
1282
3929
|
* Name of an attribute to control whether the input is visible. If
|
1283
3930
|
* the `visible` and `visibleBindingValue` options are not set,
|
@@ -1294,16 +3941,17 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1294
3941
|
* Input will be visible whenever the value of the `visibleBinding`
|
1295
3942
|
* attribute equals the value of this option.
|
1296
3943
|
*
|
3944
|
+
* @param {Backbone.Model} [options.visibleBindingModel]
|
3945
|
+
* Alternative model to bind to.
|
3946
|
+
*
|
1297
3947
|
* @mixin
|
1298
3948
|
*/
|
1299
|
-
|
1300
|
-
var inputView = _objectSpread2(_objectSpread2({}, attributeBinding), {}, {
|
3949
|
+
var inputView = _objectSpread2$1(_objectSpread2$1({}, attributeBinding), {}, {
|
1301
3950
|
ui: {
|
1302
3951
|
label: 'label',
|
1303
3952
|
labelText: 'label .name',
|
1304
3953
|
inlineHelp: 'label .inline_help'
|
1305
3954
|
},
|
1306
|
-
|
1307
3955
|
/**
|
1308
3956
|
* Returns an array of translation keys based on the
|
1309
3957
|
* `attributeTranslationKeyPrefixes` option and the given keyName.
|
@@ -1344,7 +3992,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1344
3992
|
this.setupBooleanAttributeBinding('disabled', this.updateDisabled);
|
1345
3993
|
this.setupBooleanAttributeBinding('visible', this.updateVisible);
|
1346
3994
|
},
|
1347
|
-
|
1348
3995
|
/**
|
1349
3996
|
* The label to display in the form.
|
1350
3997
|
* @return {string}
|
@@ -1359,12 +4006,10 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1359
4006
|
},
|
1360
4007
|
updateInlineHelp: function updateInlineHelp() {
|
1361
4008
|
this.ui.inlineHelp.html(this.inlineHelpText());
|
1362
|
-
|
1363
4009
|
if (!this.inlineHelpText()) {
|
1364
4010
|
this.ui.inlineHelp.hide();
|
1365
4011
|
}
|
1366
4012
|
},
|
1367
|
-
|
1368
4013
|
/**
|
1369
4014
|
* The inline help text for the form field.
|
1370
4015
|
* @return {string}
|
@@ -1373,11 +4018,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1373
4018
|
var keys = this.attributeTranslationKeys('inline_help', {
|
1374
4019
|
fallbackPrefix: 'pageflow.ui.inline_help'
|
1375
4020
|
});
|
1376
|
-
|
1377
4021
|
if (this.isDisabled()) {
|
1378
4022
|
keys = translationKeysWithSuffix(keys, 'disabled');
|
1379
4023
|
}
|
1380
|
-
|
1381
4024
|
return _.compact([findTranslation(keys, {
|
1382
4025
|
defaultValue: '',
|
1383
4026
|
html: true
|
@@ -1396,7 +4039,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1396
4039
|
updateDisabled: function updateDisabled() {
|
1397
4040
|
this.$el.toggleClass('input-disabled', !!this.isDisabled());
|
1398
4041
|
this.updateInlineHelp();
|
1399
|
-
|
1400
4042
|
if (this.ui.input) {
|
1401
4043
|
this.updateDisabledAttribute(this.ui.input);
|
1402
4044
|
}
|
@@ -1427,7 +4069,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1427
4069
|
*
|
1428
4070
|
* @class
|
1429
4071
|
*/
|
1430
|
-
|
1431
4072
|
var CheckBoxGroupInputView = Marionette.ItemView.extend({
|
1432
4073
|
mixins: [inputView],
|
1433
4074
|
template: template$4,
|
@@ -1449,7 +4090,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1449
4090
|
return translationKeyPrefix + '.' + value;
|
1450
4091
|
}, this);
|
1451
4092
|
}
|
1452
|
-
|
1453
4093
|
this.options.texts = _.map(this.options.translationKeys, function (key) {
|
1454
4094
|
return I18n$1.t(key);
|
1455
4095
|
});
|
@@ -1469,11 +4109,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1469
4109
|
},
|
1470
4110
|
save: function save() {
|
1471
4111
|
var configured = {};
|
1472
|
-
|
1473
4112
|
_.each(this.ui.container.find('input'), function (input) {
|
1474
4113
|
configured[$(input).attr('name')] = $(input).prop('checked');
|
1475
4114
|
});
|
1476
|
-
|
1477
4115
|
this.model.set(this.options.propertyName, configured);
|
1478
4116
|
},
|
1479
4117
|
load: function load() {
|
@@ -1504,7 +4142,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1504
4142
|
*
|
1505
4143
|
* @class
|
1506
4144
|
*/
|
1507
|
-
|
1508
4145
|
var UrlDisplayView = Marionette.ItemView.extend({
|
1509
4146
|
mixins: [inputView],
|
1510
4147
|
template: template$5,
|
@@ -1524,7 +4161,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1524
4161
|
this.update();
|
1525
4162
|
},
|
1526
4163
|
update: function update() {
|
1527
|
-
var url = this.model.get('original_url');
|
4164
|
+
var url = this.model.get(this.options.propertyName || 'original_url');
|
1528
4165
|
this.$el.toggle(this.model.isUploaded() && !_.isEmpty(url));
|
1529
4166
|
this.ui.link.attr('href', url);
|
1530
4167
|
}
|
@@ -1564,7 +4201,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1564
4201
|
*
|
1565
4202
|
* @class
|
1566
4203
|
*/
|
1567
|
-
|
1568
4204
|
var NumberInputView = Marionette.ItemView.extend({
|
1569
4205
|
mixins: [inputView],
|
1570
4206
|
template: function template() {
|
@@ -1610,11 +4246,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1610
4246
|
this.ui.input.attr('title', '');
|
1611
4247
|
}
|
1612
4248
|
});
|
1613
|
-
|
1614
4249
|
var NumberParser = /*#__PURE__*/function () {
|
1615
4250
|
function NumberParser(locale) {
|
1616
4251
|
_classCallCheck(this, NumberParser);
|
1617
|
-
|
1618
4252
|
var format = new Intl.NumberFormat(locale);
|
1619
4253
|
var parts = format.formatToParts(12345.6);
|
1620
4254
|
var numerals = Array.from({
|
@@ -1632,12 +4266,10 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1632
4266
|
return d.type === "decimal";
|
1633
4267
|
}).value, "]"));
|
1634
4268
|
this._numeral = new RegExp("[".concat(numerals.join(""), "]"), "g");
|
1635
|
-
|
1636
4269
|
this._index = function (d) {
|
1637
4270
|
return index.get(d);
|
1638
4271
|
};
|
1639
4272
|
}
|
1640
|
-
|
1641
4273
|
_createClass(NumberParser, [{
|
1642
4274
|
key: "parse",
|
1643
4275
|
value: function parse(string) {
|
@@ -1645,7 +4277,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1645
4277
|
return string ? +string : NaN;
|
1646
4278
|
}
|
1647
4279
|
}]);
|
1648
|
-
|
1649
4280
|
return NumberParser;
|
1650
4281
|
}();
|
1651
4282
|
|
@@ -1673,7 +4304,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1673
4304
|
var inputWithPlaceholderText = {
|
1674
4305
|
onRender: function onRender() {
|
1675
4306
|
this.updatePlaceholder();
|
1676
|
-
|
1677
4307
|
if (this.options.placeholderBinding) {
|
1678
4308
|
this.listenTo(this.model, 'change:' + this.options.placeholderBinding, this.updatePlaceholder);
|
1679
4309
|
}
|
@@ -1696,7 +4326,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1696
4326
|
return this.placeholderModelValue();
|
1697
4327
|
}
|
1698
4328
|
}
|
1699
|
-
|
1700
4329
|
return '';
|
1701
4330
|
},
|
1702
4331
|
placeholderModelValue: function placeholderModelValue() {
|
@@ -1711,9 +4340,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1711
4340
|
},
|
1712
4341
|
updateValidationErrorMessages: function updateValidationErrorMessages() {
|
1713
4342
|
var _this = this;
|
1714
|
-
|
1715
4343
|
var errors = this.model.validationErrors && this.model.validationErrors[this.options.propertyName] || [];
|
1716
|
-
|
1717
4344
|
if (errors.length) {
|
1718
4345
|
this.validationErrorList = this.validationErrorList || $('<ul class="validation_error_messages" />').appendTo(this.el);
|
1719
4346
|
this.validationErrorList.html('');
|
@@ -1754,7 +4381,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1754
4381
|
*
|
1755
4382
|
* @class
|
1756
4383
|
*/
|
1757
|
-
|
1758
4384
|
var TextInputView = Marionette.ItemView.extend({
|
1759
4385
|
mixins: [inputView, inputWithPlaceholderText, viewWithValidationErrorMessages],
|
1760
4386
|
template: template$6,
|
@@ -1784,21 +4410,20 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1784
4410
|
},
|
1785
4411
|
load: function load() {
|
1786
4412
|
var input = this.ui.input;
|
1787
|
-
input.val(this.model.get(this.options.propertyName));
|
4413
|
+
input.val(this.model.get(this.options.propertyName));
|
1788
4414
|
|
1789
|
-
|
4415
|
+
// set mysql varchar length as default for non-legacy data
|
4416
|
+
this.options.maxLength = this.options.maxLength || 255;
|
4417
|
+
// do not validate legacy data which length exceeds the specified maximum
|
1790
4418
|
// for new and maxLength-conforming data: add validation
|
1791
|
-
|
1792
4419
|
this.validateMaxLength = input.val().length <= this.options.maxLength;
|
1793
4420
|
},
|
1794
4421
|
validate: function validate() {
|
1795
4422
|
var input = this.ui.input;
|
1796
|
-
|
1797
4423
|
if (this.options.required && !input.val()) {
|
1798
4424
|
this.displayValidationError(I18n$1.t('pageflow.ui.views.inputs.text_input_view.required_field'));
|
1799
4425
|
return false;
|
1800
4426
|
}
|
1801
|
-
|
1802
4427
|
if (this.validateMaxLength && input.val().length > this.options.maxLength) {
|
1803
4428
|
this.displayValidationError(I18n$1.t('pageflow.ui.views.inputs.text_input_view.max_characters_exceeded', {
|
1804
4429
|
max_length: this.options.maxLength
|
@@ -1819,9 +4444,48 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1819
4444
|
}
|
1820
4445
|
});
|
1821
4446
|
|
4447
|
+
function template$7(data) {
|
4448
|
+
var __p = '';
|
4449
|
+
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n<div class="file_name_input-wrapper">\n <input type="text" dir="auto" />\n <span class="file_name_input-extension"></span>\n</div>\n';
|
4450
|
+
return __p
|
4451
|
+
}
|
4452
|
+
|
4453
|
+
var FileNameInputView = TextInputView.extend({
|
4454
|
+
template: template$7,
|
4455
|
+
className: 'file_name_input',
|
4456
|
+
ui: Object.assign({}, TextInputView.prototype.ui, {
|
4457
|
+
extension: '.file_name_input-extension'
|
4458
|
+
}),
|
4459
|
+
onRender: function onRender() {
|
4460
|
+
TextInputView.prototype.onRender.call(this);
|
4461
|
+
},
|
4462
|
+
save: function save() {
|
4463
|
+
var baseName = this.ui.input.val();
|
4464
|
+
var extension = this.ui.extension.text();
|
4465
|
+
this.model.set(this.options.propertyName, baseName + extension);
|
4466
|
+
},
|
4467
|
+
load: function load() {
|
4468
|
+
var fullName = this.model.get(this.options.propertyName) || '';
|
4469
|
+
var match = fullName.match(/^(.*?)(\.[^.]+)?$/);
|
4470
|
+
var baseName = match ? match[1] : fullName;
|
4471
|
+
var extension = match && match[2] ? match[2] : '';
|
4472
|
+
this.ui.input.val(baseName);
|
4473
|
+
this.ui.extension.text(extension);
|
4474
|
+
this.options.maxLength = this.options.maxLength || 255;
|
4475
|
+
}
|
4476
|
+
});
|
4477
|
+
|
4478
|
+
function template$8(data) {
|
4479
|
+
var __p = '';
|
4480
|
+
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n<input type="text" dir="auto" autocomplete="off" />\n';
|
4481
|
+
return __p
|
4482
|
+
}
|
4483
|
+
|
1822
4484
|
/**
|
1823
4485
|
* Input view for a color value in hex representation.
|
1824
|
-
*
|
4486
|
+
*
|
4487
|
+
* See {@link inputWithPlaceholderText} for placeholder related
|
4488
|
+
* further options. See {@link inputView} for further options.
|
1825
4489
|
*
|
1826
4490
|
* @param {Object} [options]
|
1827
4491
|
*
|
@@ -1837,6 +4501,14 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1837
4501
|
* defaultValue option is set, the value of the defaultValueBinding
|
1838
4502
|
* attribute will be used as default value.
|
1839
4503
|
*
|
4504
|
+
* @param {string|function} [options.placeholderColor]
|
4505
|
+
* Color to display in swatch by default.
|
4506
|
+
*
|
4507
|
+
* @param {string} [options.placeholderColorBinding]
|
4508
|
+
* Name of an attribute the placeholder color depends on. If a function
|
4509
|
+
* is used as placeholderColor option, it will be passed the value of the
|
4510
|
+
* placeholderColorBinding attribute each time it changes.
|
4511
|
+
*
|
1840
4512
|
* @param {string[]} [options.swatches]
|
1841
4513
|
* Preset color values to be displayed inside the picker drop
|
1842
4514
|
* down. The default value, if present, is always used as the
|
@@ -1844,10 +4516,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1844
4516
|
*
|
1845
4517
|
* @class
|
1846
4518
|
*/
|
1847
|
-
|
1848
4519
|
var ColorInputView = Marionette.ItemView.extend({
|
1849
|
-
mixins: [inputView],
|
1850
|
-
template: template$
|
4520
|
+
mixins: [inputView, inputWithPlaceholderText],
|
4521
|
+
template: template$8,
|
1851
4522
|
className: 'color_input',
|
1852
4523
|
ui: {
|
1853
4524
|
input: 'input'
|
@@ -1856,28 +4527,28 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1856
4527
|
'mousedown': 'refreshPicker'
|
1857
4528
|
},
|
1858
4529
|
onRender: function onRender() {
|
4530
|
+
this.setupAttributeBinding('placeholderColor', this.updatePlaceholderColor);
|
1859
4531
|
this.ui.input.minicolors({
|
1860
4532
|
changeDelay: 200,
|
1861
4533
|
change: _.bind(function (color) {
|
1862
4534
|
this._saving = true;
|
1863
|
-
|
1864
4535
|
if (color === this.defaultValue()) {
|
1865
4536
|
this.model.unset(this.options.propertyName);
|
1866
4537
|
} else {
|
1867
4538
|
this.model.set(this.options.propertyName, color);
|
1868
4539
|
}
|
1869
|
-
|
1870
4540
|
this._saving = false;
|
1871
4541
|
}, this)
|
1872
4542
|
});
|
1873
4543
|
this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
|
1874
|
-
|
1875
4544
|
if (this.options.defaultValueBinding) {
|
1876
4545
|
this.listenTo(this.model, 'change:' + this.options.defaultValueBinding, this.updateSettings);
|
1877
4546
|
}
|
1878
|
-
|
1879
4547
|
this.updateSettings();
|
1880
4548
|
},
|
4549
|
+
updatePlaceholderColor: function updatePlaceholderColor(value) {
|
4550
|
+
this.el.style.setProperty('--placeholder-color', value);
|
4551
|
+
},
|
1881
4552
|
updateSettings: function updateSettings() {
|
1882
4553
|
this.resetSwatchesInStoredSettings();
|
1883
4554
|
this.ui.input.minicolors('settings', {
|
@@ -1889,7 +4560,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1889
4560
|
// see https://github.com/claviska/jquery-minicolors/issues/287
|
1890
4561
|
resetSwatchesInStoredSettings: function resetSwatchesInStoredSettings() {
|
1891
4562
|
var settings = this.ui.input.data('minicolors-settings');
|
1892
|
-
|
1893
4563
|
if (settings) {
|
1894
4564
|
delete settings.swatches;
|
1895
4565
|
this.ui.input.data('minicolors-settings', settings);
|
@@ -1899,7 +4569,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1899
4569
|
if (!this._saving) {
|
1900
4570
|
this.ui.input.minicolors('value', this.model.get(this.options.propertyName) || this.defaultValue());
|
1901
4571
|
}
|
1902
|
-
|
1903
4572
|
this.$el.toggleClass('is_default', !this.model.has(this.options.propertyName));
|
1904
4573
|
},
|
1905
4574
|
refreshPicker: function refreshPicker() {
|
@@ -1910,11 +4579,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1910
4579
|
},
|
1911
4580
|
defaultValue: function defaultValue() {
|
1912
4581
|
var bindingValue;
|
1913
|
-
|
1914
4582
|
if (this.options.defaultValueBinding) {
|
1915
4583
|
bindingValue = this.model.get(this.options.defaultValueBinding);
|
1916
4584
|
}
|
1917
|
-
|
1918
4585
|
if (typeof this.options.defaultValue === 'function') {
|
1919
4586
|
return this.options.defaultValue(bindingValue);
|
1920
4587
|
} else if ('defaultValue' in this.options) {
|
@@ -1925,7 +4592,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1925
4592
|
}
|
1926
4593
|
});
|
1927
4594
|
|
1928
|
-
function template$
|
4595
|
+
function template$9(data) {
|
1929
4596
|
var __p = '';
|
1930
4597
|
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n<select></select>';
|
1931
4598
|
return __p
|
@@ -1940,6 +4607,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1940
4607
|
* @param {string[]} [options.values]
|
1941
4608
|
* List of possible values to persist in the attribute.
|
1942
4609
|
*
|
4610
|
+
* @param {number} [options.defaultValue]
|
4611
|
+
* Default value to display if property is not set.
|
4612
|
+
*
|
1943
4613
|
* @param {string[]} [options.texts]
|
1944
4614
|
* List of display texts for drop down items.
|
1945
4615
|
*
|
@@ -1987,7 +4657,10 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
1987
4657
|
* Display text for the blank item.
|
1988
4658
|
*
|
1989
4659
|
* @param {string} [options.blankTranslationKey]
|
1990
|
-
* Translation key to obtain display text for blank item.
|
4660
|
+
* Translation key to obtain display text for blank item. If neither
|
4661
|
+
* `blankText` nor `blankTranslationKey` are provided, the blank text
|
4662
|
+
* will be determined using `attributeTranslationKeyPrefixes` with
|
4663
|
+
* the suffix `blank`, similar to how labels are determined.
|
1991
4664
|
*
|
1992
4665
|
* @param {string} [options.placeholderValue]
|
1993
4666
|
* Include an item that sets the value of the attribute to a blank
|
@@ -2009,10 +4682,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2009
4682
|
*
|
2010
4683
|
* @class
|
2011
4684
|
*/
|
2012
|
-
|
2013
4685
|
var SelectInputView = Marionette.ItemView.extend({
|
2014
4686
|
mixins: [inputView],
|
2015
|
-
template: template$
|
4687
|
+
template: template$9,
|
2016
4688
|
events: {
|
2017
4689
|
'change': 'save'
|
2018
4690
|
},
|
@@ -2023,20 +4695,17 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2023
4695
|
initialize: function initialize() {
|
2024
4696
|
if (this.options.collection) {
|
2025
4697
|
this.options.values = _.pluck(this.options.collection, this.options.valueProperty);
|
2026
|
-
|
2027
4698
|
if (this.options.textProperty) {
|
2028
4699
|
this.options.texts = _.pluck(this.options.collection, this.options.textProperty);
|
2029
4700
|
} else if (this.options.translationKeyProperty) {
|
2030
4701
|
this.options.translationKeys = _.pluck(this.options.collection, this.options.translationKeyProperty);
|
2031
4702
|
}
|
2032
|
-
|
2033
4703
|
if (this.options.groupProperty) {
|
2034
4704
|
this.options.groups = _.pluck(this.options.collection, this.options.groupProperty);
|
2035
4705
|
} else if (this.options.groupTranslationKeyProperty) {
|
2036
4706
|
this.options.groupTanslationKeys = _.pluck(this.options.collection, this.options.groupTranslationKeyProperty);
|
2037
4707
|
}
|
2038
4708
|
}
|
2039
|
-
|
2040
4709
|
if (!this.options.texts) {
|
2041
4710
|
if (!this.options.translationKeys) {
|
2042
4711
|
var translationKeyPrefix = this.options.translationKeyPrefix || findKeyWithTranslation(this.attributeTranslationKeys('values', {
|
@@ -2046,18 +4715,15 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2046
4715
|
return translationKeyPrefix + '.' + value;
|
2047
4716
|
}, this);
|
2048
4717
|
}
|
2049
|
-
|
2050
4718
|
this.options.texts = _.map(this.options.translationKeys, function (key) {
|
2051
4719
|
return I18n$1.t(key);
|
2052
4720
|
});
|
2053
4721
|
}
|
2054
|
-
|
2055
4722
|
if (!this.options.groups) {
|
2056
4723
|
this.options.groups = _.map(this.options.groupTanslationKeys, function (key) {
|
2057
4724
|
return I18n$1.t(key);
|
2058
4725
|
});
|
2059
4726
|
}
|
2060
|
-
|
2061
4727
|
this.optGroups = {};
|
2062
4728
|
},
|
2063
4729
|
onRender: function onRender() {
|
@@ -2066,7 +4732,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2066
4732
|
this.appendOptions();
|
2067
4733
|
this.load();
|
2068
4734
|
this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
|
2069
|
-
|
2070
4735
|
if (this.options.ensureValueDefined && !this.model.has(this.options.propertyName)) {
|
2071
4736
|
this.save();
|
2072
4737
|
}
|
@@ -2075,24 +4740,25 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2075
4740
|
if (!this.options.includeBlank) {
|
2076
4741
|
return;
|
2077
4742
|
}
|
2078
|
-
|
4743
|
+
var blankText = this.options.blankText;
|
2079
4744
|
if (this.options.blankTranslationKey) {
|
2080
|
-
|
4745
|
+
blankText = I18n$1.t(this.options.blankTranslationKey);
|
4746
|
+
} else if (!blankText) {
|
4747
|
+
blankText = findTranslation(this.attributeTranslationKeys('blank'), {
|
4748
|
+
defaultValue: I18n$1.t('pageflow.ui.views.inputs.select_input_view.none')
|
4749
|
+
});
|
2081
4750
|
}
|
2082
|
-
|
2083
4751
|
var option = document.createElement('option');
|
2084
4752
|
option.value = '';
|
2085
|
-
option.text =
|
4753
|
+
option.text = blankText;
|
2086
4754
|
this.ui.select.append(option);
|
2087
4755
|
},
|
2088
4756
|
appendPlaceholder: function appendPlaceholder() {
|
2089
4757
|
if (!this.options.placeholderModel && !this.options.placeholderValue) {
|
2090
4758
|
return;
|
2091
4759
|
}
|
2092
|
-
|
2093
4760
|
var placeholderValue = this.options.placeholderValue || this.options.placeholderModel.get(this.options.propertyName);
|
2094
4761
|
var placeholderIndex = this.options.values.indexOf(placeholderValue);
|
2095
|
-
|
2096
4762
|
if (placeholderIndex >= 0) {
|
2097
4763
|
var option = document.createElement('option');
|
2098
4764
|
option.value = '';
|
@@ -2108,11 +4774,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2108
4774
|
var group = this.options.groups[index];
|
2109
4775
|
option.value = value;
|
2110
4776
|
option.text = this.options.texts[index];
|
2111
|
-
|
2112
4777
|
if (this.options.optionDisabled && this.options.optionDisabled(value)) {
|
2113
4778
|
option.setAttribute('disabled', true);
|
2114
4779
|
}
|
2115
|
-
|
2116
4780
|
if (group) {
|
2117
4781
|
option.setAttribute('data-group', group);
|
2118
4782
|
this.findOrCreateOptGroup(group).append(option);
|
@@ -2127,18 +4791,23 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2127
4791
|
label: label
|
2128
4792
|
}).appendTo(this.ui.select);
|
2129
4793
|
}
|
2130
|
-
|
2131
4794
|
return this.optGroups[label];
|
2132
4795
|
},
|
2133
4796
|
save: function save() {
|
2134
|
-
|
4797
|
+
var value = this.ui.select.val();
|
4798
|
+
if ('defaultValue' in this.options && value === this.options.defaultValue) {
|
4799
|
+
this.model.unset(this.options.propertyName);
|
4800
|
+
} else {
|
4801
|
+
this.model.set(this.options.propertyName, value);
|
4802
|
+
}
|
2135
4803
|
},
|
2136
4804
|
load: function load() {
|
2137
4805
|
if (!this.isClosed) {
|
2138
4806
|
var value = this.model.get(this.options.propertyName);
|
2139
|
-
|
2140
4807
|
if (this.model.has(this.options.propertyName) && this.ui.select.find('option[value="' + value + '"]:not([disabled])').length) {
|
2141
4808
|
this.ui.select.val(value);
|
4809
|
+
} else if ('defaultValue' in this.options) {
|
4810
|
+
this.ui.select.val(this.options.defaultValue);
|
2142
4811
|
} else {
|
2143
4812
|
this.ui.select.val(this.ui.select.find('option:not([disabled]):first').val());
|
2144
4813
|
}
|
@@ -2150,7 +4819,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2150
4819
|
className: 'extended_select_input',
|
2151
4820
|
initialize: function initialize() {
|
2152
4821
|
SelectInputView.prototype.initialize.apply(this, arguments);
|
2153
|
-
|
2154
4822
|
if (this.options.collection) {
|
2155
4823
|
if (this.options.descriptionProperty) {
|
2156
4824
|
this.options.descriptions = _.pluck(this.options.collection, this.options.descriptionProperty);
|
@@ -2158,7 +4826,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2158
4826
|
this.options.descriptionTanslationKeys = _.pluck(this.options.collection, this.options.descriptionTranslationKeyProperty);
|
2159
4827
|
}
|
2160
4828
|
}
|
2161
|
-
|
2162
4829
|
if (!this.options.descriptions) {
|
2163
4830
|
this.options.descriptions = _.map(this.options.descriptionTanslationKeys, function (key) {
|
2164
4831
|
return I18n$1.t(key);
|
@@ -2167,7 +4834,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2167
4834
|
},
|
2168
4835
|
onRender: function onRender() {
|
2169
4836
|
var view = this,
|
2170
|
-
|
4837
|
+
options = this.options;
|
2171
4838
|
SelectInputView.prototype.onRender.apply(this, arguments);
|
2172
4839
|
$.widget("custom.extendedselectmenu", $.ui.selectmenu, {
|
2173
4840
|
_renderItem: function _renderItem(ul, item) {
|
@@ -2179,17 +4846,14 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2179
4846
|
"class": 'text-container'
|
2180
4847
|
}).appendTo(li);
|
2181
4848
|
var index = options.values.indexOf(item.value);
|
2182
|
-
|
2183
4849
|
if (item.disabled) {
|
2184
4850
|
li.addClass('ui-state-disabled');
|
2185
4851
|
}
|
2186
|
-
|
2187
4852
|
if (options.pictogramClass) {
|
2188
4853
|
$('<span>', {
|
2189
4854
|
"class": options.pictogramClass
|
2190
4855
|
}).prependTo(li);
|
2191
4856
|
}
|
2192
|
-
|
2193
4857
|
$('<p>', {
|
2194
4858
|
text: item.label,
|
2195
4859
|
"class": 'item-text'
|
@@ -2198,7 +4862,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2198
4862
|
text: options.descriptions[index],
|
2199
4863
|
"class": 'item-description'
|
2200
4864
|
}).appendTo(container);
|
2201
|
-
|
2202
4865
|
if (options.helpLinkClicked) {
|
2203
4866
|
$('<a>', {
|
2204
4867
|
href: '#',
|
@@ -2209,15 +4872,13 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2209
4872
|
return false;
|
2210
4873
|
}).appendTo(li);
|
2211
4874
|
}
|
2212
|
-
|
2213
4875
|
return li.appendTo(ul);
|
2214
4876
|
},
|
2215
4877
|
_resizeMenu: function _resizeMenu() {
|
2216
4878
|
this.menuWrap.addClass('extended_select_input_menu');
|
2217
4879
|
var menuHeight = this.menu.height(),
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
4880
|
+
menuOffset = this.button.offset().top + this.button.outerHeight(),
|
4881
|
+
bodyHeight = $('body').height();
|
2221
4882
|
if (menuHeight + menuOffset > bodyHeight) {
|
2222
4883
|
this.menuWrap.outerHeight(bodyHeight - menuOffset - 5).css({
|
2223
4884
|
'overflow-y': 'scroll'
|
@@ -2245,7 +4906,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2245
4906
|
}
|
2246
4907
|
});
|
2247
4908
|
|
2248
|
-
function template$
|
4909
|
+
function template$a(data) {
|
2249
4910
|
var __t, __p = '';
|
2250
4911
|
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n\n<!-- inline style for wysihtml5 to pick up -->\n<textarea style="width: 100%;" dir="auto"></textarea>\n\n<div class="toolbar">\n <a data-wysihtml5-command="bold" title="' +
|
2251
4912
|
((__t = ( I18n.t('pageflow.ui.templates.inputs.text_area_input.bold') )) == null ? '' : __t) +
|
@@ -2302,10 +4963,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2302
4963
|
*
|
2303
4964
|
* @class
|
2304
4965
|
*/
|
2305
|
-
|
2306
4966
|
var TextAreaInputView = Marionette.ItemView.extend({
|
2307
4967
|
mixins: [inputView, inputWithPlaceholderText],
|
2308
|
-
template: template$
|
4968
|
+
template: template$a,
|
2309
4969
|
className: 'text_area_input',
|
2310
4970
|
ui: {
|
2311
4971
|
input: 'textarea',
|
@@ -2378,7 +5038,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2378
5038
|
}
|
2379
5039
|
}
|
2380
5040
|
});
|
2381
|
-
|
2382
5041
|
if (this.options.disableRichtext) {
|
2383
5042
|
this.ui.toolbar.find('a[data-wysihtml5-command="bold"]').hide();
|
2384
5043
|
this.ui.toolbar.find('a[data-wysihtml5-command="italic"]').hide();
|
@@ -2386,19 +5045,16 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2386
5045
|
this.ui.toolbar.find('a[data-wysihtml5-command="insertOrderedList"]').hide();
|
2387
5046
|
this.ui.toolbar.find('a[data-wysihtml5-command="insertUnorderedList"]').hide();
|
2388
5047
|
}
|
2389
|
-
|
2390
5048
|
if (!this.options.enableLists) {
|
2391
5049
|
this.ui.toolbar.find('a[data-wysihtml5-command="insertOrderedList"]').hide();
|
2392
5050
|
this.ui.toolbar.find('a[data-wysihtml5-command="insertUnorderedList"]').hide();
|
2393
5051
|
}
|
2394
|
-
|
2395
5052
|
if (this.options.disableLinks) {
|
2396
5053
|
this.ui.toolbar.find('a[data-wysihtml5-command="createLink"]').hide();
|
2397
5054
|
} else {
|
2398
5055
|
this.setupUrlLinkPanel();
|
2399
5056
|
this.setupFragmentLinkPanel();
|
2400
5057
|
}
|
2401
|
-
|
2402
5058
|
this.editor.on('change', _.bind(this.save, this));
|
2403
5059
|
this.editor.on('aftercommand:composer', _.bind(this.save, this));
|
2404
5060
|
},
|
@@ -2415,7 +5071,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2415
5071
|
this.editor.on('show:dialog', _.bind(function () {
|
2416
5072
|
this.ui.linkDialog.toggleClass('for_existing_link', this.ui.linkButton.hasClass('wysihtml5-command-active'));
|
2417
5073
|
var currentUrl = this.ui.urlInput.val();
|
2418
|
-
|
2419
5074
|
if (currentUrl.startsWith('#')) {
|
2420
5075
|
this.ui.displayUrlInput.val('');
|
2421
5076
|
this.ui.openInNewTabCheckBox.prop('checked', true);
|
@@ -2459,7 +5114,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2459
5114
|
} else {
|
2460
5115
|
this.ui.fragmentLinkRadioButton.prop('checked', true);
|
2461
5116
|
}
|
2462
|
-
|
2463
5117
|
this.ui.toolbar.toggleClass('fragment_link_panel_active', !isUrlLink);
|
2464
5118
|
},
|
2465
5119
|
showUrlLinkPanel: function showUrlLinkPanel() {
|
@@ -2483,7 +5137,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2483
5137
|
}
|
2484
5138
|
});
|
2485
5139
|
|
2486
|
-
function template$
|
5140
|
+
function template$b(data) {
|
2487
5141
|
var __p = '';
|
2488
5142
|
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n<input type="text" />\n<div class="validation"></div>\n';
|
2489
5143
|
return __p
|
@@ -2506,12 +5160,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2506
5160
|
*
|
2507
5161
|
* @class
|
2508
5162
|
*/
|
2509
|
-
|
2510
|
-
var UrlInputView = Marionette.Layout.extend(
|
2511
|
-
/** @lends UrlInputView.prototype */
|
2512
|
-
{
|
5163
|
+
var UrlInputView = Marionette.Layout.extend( /** @lends UrlInputView.prototype */{
|
2513
5164
|
mixins: [inputView],
|
2514
|
-
template: template$
|
5165
|
+
template: template$b,
|
2515
5166
|
ui: {
|
2516
5167
|
input: 'input',
|
2517
5168
|
validation: '.validation'
|
@@ -2526,7 +5177,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2526
5177
|
},
|
2527
5178
|
onChange: function onChange() {
|
2528
5179
|
var _this = this;
|
2529
|
-
|
2530
5180
|
this.validate().then(function () {
|
2531
5181
|
return _this.save();
|
2532
5182
|
}, function () {
|
@@ -2541,24 +5191,19 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2541
5191
|
},
|
2542
5192
|
save: function save() {
|
2543
5193
|
var _this2 = this;
|
2544
|
-
|
2545
5194
|
var value = this.ui.input.val();
|
2546
5195
|
$.when(this.transformPropertyValue(value)).then(function (transformedValue) {
|
2547
|
-
|
2548
|
-
|
2549
|
-
_this2.model.set((_this2$model$set = {}, _defineProperty(_this2$model$set, _this2.options.displayPropertyName, value), _defineProperty(_this2$model$set, _this2.options.propertyName, transformedValue), _this2$model$set));
|
5196
|
+
_this2.model.set(_defineProperty$1(_defineProperty$1({}, _this2.options.displayPropertyName, value), _this2.options.propertyName, transformedValue));
|
2550
5197
|
});
|
2551
5198
|
},
|
2552
5199
|
load: function load() {
|
2553
5200
|
this.ui.input.val(this.model.has(this.options.displayPropertyName) ? this.model.get(this.options.displayPropertyName) : this.model.get(this.options.propertyName));
|
2554
5201
|
this.onLoad();
|
2555
5202
|
},
|
2556
|
-
|
2557
5203
|
/**
|
2558
5204
|
* Override to be notified when the input has been loaded.
|
2559
5205
|
*/
|
2560
5206
|
onLoad: function onLoad() {},
|
2561
|
-
|
2562
5207
|
/**
|
2563
5208
|
* Override to validate the untransformed url. Validation error
|
2564
5209
|
* message can be passed as rejected promise. Progress notifications
|
@@ -2569,7 +5214,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2569
5214
|
validateUrl: function validateUrl(url) {
|
2570
5215
|
return $.Deferred().resolve().promise();
|
2571
5216
|
},
|
2572
|
-
|
2573
5217
|
/**
|
2574
5218
|
* Override to transform the property value before it is stored.
|
2575
5219
|
*
|
@@ -2578,7 +5222,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2578
5222
|
transformPropertyValue: function transformPropertyValue(value) {
|
2579
5223
|
return value;
|
2580
5224
|
},
|
2581
|
-
|
2582
5225
|
/**
|
2583
5226
|
* Override to change the list of supported host names.
|
2584
5227
|
*/
|
@@ -2598,16 +5241,13 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2598
5241
|
var view = this;
|
2599
5242
|
var options = this.options;
|
2600
5243
|
var value = this.ui.input.val();
|
2601
|
-
|
2602
5244
|
if (options.required && !value) {
|
2603
5245
|
displayValidationError(I18n$1.t('pageflow.ui.views.inputs.url_input_view.required_field'));
|
2604
5246
|
} else if (value && !isValidUrl(value)) {
|
2605
5247
|
var errorMessage = I18n$1.t('pageflow.ui.views.inputs.url_input_view.url_hint');
|
2606
|
-
|
2607
5248
|
if (options.permitHttps) {
|
2608
5249
|
errorMessage = I18n$1.t('pageflow.ui.views.inputs.url_input_view.url_hint_https');
|
2609
5250
|
}
|
2610
|
-
|
2611
5251
|
displayValidationError(errorMessage);
|
2612
5252
|
} else if (value && !hasSupportedHost(value)) {
|
2613
5253
|
displayValidationError(I18n$1.t('pageflow.ui.views.inputs.url_input_view.supported_vendors') + _.map(view.supportedHosts(), function (url) {
|
@@ -2622,31 +5262,25 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2622
5262
|
displayValidationError(error);
|
2623
5263
|
});
|
2624
5264
|
}
|
2625
|
-
|
2626
5265
|
return $.Deferred().reject().promise();
|
2627
|
-
|
2628
5266
|
function isValidUrl(url) {
|
2629
5267
|
return options.permitHttps ? url.match(/^https?:\/\//i) : url.match(/^http:\/\//i);
|
2630
5268
|
}
|
2631
|
-
|
2632
5269
|
function hasSupportedHost(url) {
|
2633
5270
|
return _.any(view.supportedHostsWithoutLegacyProtocols(), function (host) {
|
2634
5271
|
return url.match(new RegExp('^https?://' + host));
|
2635
5272
|
});
|
2636
5273
|
}
|
2637
|
-
|
2638
5274
|
function displayValidationError(message) {
|
2639
5275
|
view.$el.addClass('invalid');
|
2640
5276
|
view.ui.input.attr('aria-invalid', 'true');
|
2641
5277
|
view.ui.validation.removeClass('pending').addClass('failed').html(message).show();
|
2642
5278
|
}
|
2643
|
-
|
2644
5279
|
function displayValidationPending(message) {
|
2645
5280
|
view.$el.removeClass('invalid');
|
2646
5281
|
view.ui.input.removeAttr('aria-invalid');
|
2647
5282
|
view.ui.validation.removeClass('failed').addClass('pending').html(message).show();
|
2648
5283
|
}
|
2649
|
-
|
2650
5284
|
function resetValidationError(message) {
|
2651
5285
|
view.$el.removeClass('invalid');
|
2652
5286
|
view.ui.input.attr('aria-invalid', 'false');
|
@@ -2701,10 +5335,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2701
5335
|
*
|
2702
5336
|
* @class
|
2703
5337
|
*/
|
2704
|
-
|
2705
|
-
var ProxyUrlInputView = UrlInputView.extend(
|
2706
|
-
/** @lends ProxyUrlInputView.prototype */
|
2707
|
-
{
|
5338
|
+
var ProxyUrlInputView = UrlInputView.extend( /** @lends ProxyUrlInputView.prototype */{
|
2708
5339
|
// @override
|
2709
5340
|
validateUrl: function validateUrl(url) {
|
2710
5341
|
var view = this;
|
@@ -2732,12 +5363,11 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2732
5363
|
_.each(this.options.proxies, function (proxy) {
|
2733
5364
|
url = url.replace(new RegExp('^' + proxy.url + '/?'), proxy.base_path + '/');
|
2734
5365
|
});
|
2735
|
-
|
2736
5366
|
return url;
|
2737
5367
|
}
|
2738
5368
|
});
|
2739
5369
|
|
2740
|
-
function template$
|
5370
|
+
function template$c(data) {
|
2741
5371
|
var __p = '';
|
2742
5372
|
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n<div class="value"></div>\n<div class="slider"></div>\n';
|
2743
5373
|
return __p
|
@@ -2750,7 +5380,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2750
5380
|
* @param {Object} [options]
|
2751
5381
|
*
|
2752
5382
|
* @param {number} [options.defaultValue]
|
2753
|
-
*
|
5383
|
+
* Default value to display if property is not set.
|
2754
5384
|
*
|
2755
5385
|
* @param {number} [options.minValue=0]
|
2756
5386
|
* Value when dragging slider to the very left.
|
@@ -2770,11 +5400,10 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2770
5400
|
*
|
2771
5401
|
* @class
|
2772
5402
|
*/
|
2773
|
-
|
2774
5403
|
var SliderInputView = Marionette.ItemView.extend({
|
2775
5404
|
mixins: [inputView],
|
2776
5405
|
className: 'slider_input',
|
2777
|
-
template: template$
|
5406
|
+
template: template$c,
|
2778
5407
|
ui: {
|
2779
5408
|
widget: '.slider',
|
2780
5409
|
value: '.value'
|
@@ -2785,7 +5414,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2785
5414
|
},
|
2786
5415
|
onRender: function onRender() {
|
2787
5416
|
var _this = this;
|
2788
|
-
|
2789
5417
|
this.ui.widget.slider({
|
2790
5418
|
animate: 'fast'
|
2791
5419
|
});
|
@@ -2793,7 +5421,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2793
5421
|
return _this.updateSliderOption('min', value || 0);
|
2794
5422
|
});
|
2795
5423
|
this.setupAttributeBinding('maxValue', function (value) {
|
2796
|
-
return _this.updateSliderOption('max', value
|
5424
|
+
return _this.updateSliderOption('max', value !== undefined ? value : 100);
|
2797
5425
|
});
|
2798
5426
|
this.load();
|
2799
5427
|
this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
|
@@ -2804,7 +5432,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2804
5432
|
},
|
2805
5433
|
updateDisabled: function updateDisabled(disabled) {
|
2806
5434
|
this.$el.toggleClass('disabled', !!disabled);
|
2807
|
-
|
2808
5435
|
if (disabled) {
|
2809
5436
|
this.ui.widget.slider('disable');
|
2810
5437
|
} else {
|
@@ -2813,7 +5440,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2813
5440
|
},
|
2814
5441
|
handleSlide: function handleSlide(event, ui) {
|
2815
5442
|
this.updateText(ui.value);
|
2816
|
-
|
2817
5443
|
if (this.options.saveOnSlide) {
|
2818
5444
|
this.save(event, ui);
|
2819
5445
|
}
|
@@ -2823,13 +5449,11 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2823
5449
|
},
|
2824
5450
|
load: function load() {
|
2825
5451
|
var value;
|
2826
|
-
|
2827
5452
|
if (this.model.has(this.options.propertyName)) {
|
2828
5453
|
value = this.model.get(this.options.propertyName);
|
2829
5454
|
} else {
|
2830
5455
|
value = 'defaultValue' in this.options ? this.options.defaultValue : 0;
|
2831
5456
|
}
|
2832
|
-
|
2833
5457
|
this.ui.widget.slider('option', 'value', this.clampValue(value));
|
2834
5458
|
this.updateText(value);
|
2835
5459
|
},
|
@@ -2845,7 +5469,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2845
5469
|
}
|
2846
5470
|
});
|
2847
5471
|
|
2848
|
-
function template$
|
5472
|
+
function template$d(data) {
|
2849
5473
|
var __p = '';
|
2850
5474
|
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n\n<textarea></textarea>\n';
|
2851
5475
|
return __p
|
@@ -2853,7 +5477,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2853
5477
|
|
2854
5478
|
var JsonInputView = Marionette.ItemView.extend({
|
2855
5479
|
mixins: [inputView],
|
2856
|
-
template: template$
|
5480
|
+
template: template$d,
|
2857
5481
|
className: 'json_input',
|
2858
5482
|
ui: {
|
2859
5483
|
input: 'textarea'
|
@@ -2887,7 +5511,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2887
5511
|
},
|
2888
5512
|
validate: function validate() {
|
2889
5513
|
var input = this.ui.input;
|
2890
|
-
|
2891
5514
|
if (input.val() && !this.isValidJson(input.val())) {
|
2892
5515
|
this.displayValidationError(I18n$1.t('pageflow.ui.views.inputs.json_input_view.invalid'));
|
2893
5516
|
return false;
|
@@ -2914,7 +5537,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2914
5537
|
}
|
2915
5538
|
});
|
2916
5539
|
|
2917
|
-
function template$
|
5540
|
+
function template$e(data) {
|
2918
5541
|
var __p = '';
|
2919
5542
|
__p += '<input type="checkbox" />\n<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>';
|
2920
5543
|
return __p
|
@@ -2941,10 +5564,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2941
5564
|
*
|
2942
5565
|
* @class
|
2943
5566
|
*/
|
2944
|
-
|
2945
5567
|
var CheckBoxInputView = Marionette.ItemView.extend({
|
2946
5568
|
mixins: [inputView],
|
2947
|
-
template: template$
|
5569
|
+
template: template$e,
|
2948
5570
|
className: 'check_box_input',
|
2949
5571
|
events: {
|
2950
5572
|
'change': 'save'
|
@@ -2965,7 +5587,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2965
5587
|
save: function save() {
|
2966
5588
|
if (!this.isDisabled()) {
|
2967
5589
|
var value = this.ui.input.is(':checked');
|
2968
|
-
|
2969
5590
|
if (this.options.storeInverted) {
|
2970
5591
|
this.model.set(this.options.storeInverted, !value);
|
2971
5592
|
} else {
|
@@ -2975,7 +5596,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
2975
5596
|
},
|
2976
5597
|
load: function load() {
|
2977
5598
|
if (!this.isClosed) {
|
2978
|
-
this.ui.input.prop('checked', this.displayValue());
|
5599
|
+
this.ui.input.prop('checked', !!this.displayValue());
|
2979
5600
|
}
|
2980
5601
|
},
|
2981
5602
|
displayValue: function displayValue() {
|
@@ -3000,7 +5621,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3000
5621
|
*
|
3001
5622
|
* @class
|
3002
5623
|
*/
|
3003
|
-
|
3004
5624
|
var SeparatorView = Marionette.View.extend({
|
3005
5625
|
className: 'separator'
|
3006
5626
|
});
|
@@ -3013,7 +5633,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3013
5633
|
*
|
3014
5634
|
* @class
|
3015
5635
|
*/
|
3016
|
-
|
3017
5636
|
var LabelOnlyView = Marionette.ItemView.extend({
|
3018
5637
|
mixins: [inputView],
|
3019
5638
|
template: function template() {
|
@@ -3039,7 +5658,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3039
5658
|
*
|
3040
5659
|
* @since 12.0
|
3041
5660
|
*/
|
3042
|
-
|
3043
5661
|
var EnumTableCellView = TableCellView.extend({
|
3044
5662
|
className: 'enum_table_cell',
|
3045
5663
|
update: function update() {
|
@@ -3050,7 +5668,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3050
5668
|
}
|
3051
5669
|
});
|
3052
5670
|
|
3053
|
-
function template$
|
5671
|
+
function template$f(data) {
|
3054
5672
|
var __t, __p = '';
|
3055
5673
|
__p += '<a class="remove" title="' +
|
3056
5674
|
((__t = ( I18n.t('pageflow.editor.templates.row.destroy') )) == null ? '' : __t) +
|
@@ -3080,10 +5698,9 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3080
5698
|
*
|
3081
5699
|
* @since 12.0
|
3082
5700
|
*/
|
3083
|
-
|
3084
5701
|
var DeleteRowTableCellView = TableCellView.extend({
|
3085
5702
|
className: 'delete_row_table_cell',
|
3086
|
-
template: template$
|
5703
|
+
template: template$f,
|
3087
5704
|
ui: {
|
3088
5705
|
removeButton: '.remove'
|
3089
5706
|
},
|
@@ -3097,7 +5714,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3097
5714
|
if (this.options.toggleDeleteButton) {
|
3098
5715
|
var context = this.getModel();
|
3099
5716
|
var toggle = context[this.options.toggleDeleteButton].apply(context);
|
3100
|
-
|
3101
5717
|
if (this.options.invertToggleDeleteButton) {
|
3102
5718
|
return !toggle;
|
3103
5719
|
} else {
|
@@ -3132,7 +5748,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3132
5748
|
*
|
3133
5749
|
* @since 12.0
|
3134
5750
|
*/
|
3135
|
-
|
3136
5751
|
var PresenceTableCellView = TableCellView.extend({
|
3137
5752
|
className: 'presence_table_cell',
|
3138
5753
|
update: function update() {
|
@@ -3164,7 +5779,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3164
5779
|
*
|
3165
5780
|
* @since 12.0
|
3166
5781
|
*/
|
3167
|
-
|
3168
5782
|
var IconTableCellView = TableCellView.extend({
|
3169
5783
|
className: 'icon_table_cell',
|
3170
5784
|
update: function update() {
|
@@ -3200,7 +5814,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3200
5814
|
*
|
3201
5815
|
* @since 12.0
|
3202
5816
|
*/
|
3203
|
-
|
3204
5817
|
var TextTableCellView = TableCellView.extend({
|
3205
5818
|
className: 'text_table_cell',
|
3206
5819
|
update: function update() {
|
@@ -3211,14 +5824,12 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3211
5824
|
return this.attributeValue();
|
3212
5825
|
} else if (typeof this.options.column["default"] === 'function') {
|
3213
5826
|
var options = {};
|
3214
|
-
|
3215
5827
|
if (this.options.column.contentBinding) {
|
3216
5828
|
options = {
|
3217
5829
|
contentBinding: this.options.column.contentBinding,
|
3218
5830
|
model: this.getModel()
|
3219
5831
|
};
|
3220
5832
|
}
|
3221
|
-
|
3222
5833
|
return this.options.column["default"](options);
|
3223
5834
|
} else if ('default' in this.options.column) {
|
3224
5835
|
return this.options.column["default"];
|
@@ -3236,8 +5847,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3236
5847
|
},
|
3237
5848
|
appendSubview: function appendSubview(view) {
|
3238
5849
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
3239
|
-
|
3240
|
-
|
5850
|
+
to = _ref.to;
|
3241
5851
|
return (to || this.$el).append(this.subview(view).el);
|
3242
5852
|
},
|
3243
5853
|
onClose: function onClose() {
|
@@ -3246,7 +5856,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3246
5856
|
}
|
3247
5857
|
}
|
3248
5858
|
};
|
3249
|
-
|
3250
5859
|
if (!Marionette.View.prototype.appendSubview) {
|
3251
5860
|
Cocktail.mixin(Marionette.View, subviewContainer);
|
3252
5861
|
}
|
@@ -3258,7 +5867,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3258
5867
|
var target = $(event.currentTarget);
|
3259
5868
|
var key = target.attr('data-tooltip');
|
3260
5869
|
var position;
|
3261
|
-
|
3262
5870
|
if (target.data('tooltipAlign') === 'bottom left') {
|
3263
5871
|
position = {
|
3264
5872
|
left: target.position().left,
|
@@ -3280,7 +5888,6 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3280
5888
|
top: target.position().top + target.outerHeight() / 2
|
3281
5889
|
};
|
3282
5890
|
}
|
3283
|
-
|
3284
5891
|
this.tooltip.show(I18n$1.t(key), position, {
|
3285
5892
|
align: target.data('tooltipAlign')
|
3286
5893
|
});
|
@@ -3304,6 +5911,7 @@ this.pageflow._uiGlobalInterop = (function (exports, Marionette, _, $, I18n$1, B
|
|
3304
5911
|
exports.DeleteRowTableCellView = DeleteRowTableCellView;
|
3305
5912
|
exports.EnumTableCellView = EnumTableCellView;
|
3306
5913
|
exports.ExtendedSelectInputView = ExtendedSelectInputView;
|
5914
|
+
exports.FileNameInputView = FileNameInputView;
|
3307
5915
|
exports.IconTableCellView = IconTableCellView;
|
3308
5916
|
exports.JsonInputView = JsonInputView;
|
3309
5917
|
exports.LabelOnlyView = LabelOnlyView;
|