solidus_backend 1.2.3 → 1.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Rakefile +1 -1
- data/app/assets/javascripts/spree/backend.js +5 -4
- data/app/assets/javascripts/spree/backend/adjustments.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/{admin.js.erb → admin.js} +13 -44
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +36 -25
- data/app/assets/javascripts/spree/backend/components/tabs.coffee +79 -0
- data/app/assets/javascripts/spree/backend/components/tooltips.js +31 -0
- data/app/assets/javascripts/spree/backend/images/index.js.coffee +0 -3
- data/app/assets/javascripts/spree/backend/{line_items_on_order_edit.js.erb → line_items_on_order_edit.js} +3 -10
- data/app/assets/javascripts/spree/backend/{option_type_autocomplete.js.erb → option_type_autocomplete.js} +0 -0
- data/app/assets/javascripts/spree/backend/payments/edit.js.coffee +32 -147
- data/app/assets/javascripts/spree/backend/routes.js +1 -0
- data/app/assets/javascripts/spree/backend/shipments.js +314 -0
- data/app/assets/javascripts/spree/backend/{spree-select2.js.erb → spree-select2.js} +2 -11
- data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +52 -73
- data/app/assets/javascripts/spree/backend/stock_management/index_update_forms.coffee +54 -52
- data/app/assets/javascripts/spree/backend/stock_management/stock_item.coffee +4 -37
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/stock_transfers/edit.coffee +0 -10
- data/app/assets/javascripts/spree/backend/stock_transfers/receive.coffee +0 -10
- data/app/assets/javascripts/spree/backend/{taxon_autocomplete.js.erb → taxon_autocomplete.js} +10 -6
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +25 -19
- data/app/assets/javascripts/spree/backend/user_picker.js +8 -5
- data/app/assets/javascripts/spree/backend/{variant_autocomplete.js.coffee.erb → variant_autocomplete.js.coffee} +2 -4
- data/app/assets/stylesheets/spree/backend.css +0 -3
- data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +666 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +17 -0
- data/app/assets/stylesheets/spree/backend/components/_progress.scss +1 -0
- data/app/assets/stylesheets/spree/backend/components/_tabs.scss +108 -0
- data/app/assets/stylesheets/spree/backend/plugins/_bootstrap_tooltip.scss +47 -0
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +1 -1
- data/app/assets/stylesheets/spree/backend/sections/_payments.scss +14 -0
- data/app/assets/stylesheets/spree/backend/sections/_stock_management.scss +11 -9
- data/app/assets/stylesheets/spree/backend/sections/_stock_transfers.scss +0 -49
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +11 -14
- data/app/assets/stylesheets/spree/backend/shared/_header.scss +30 -0
- data/app/assets/stylesheets/spree/backend/shared/_layout.scss +0 -105
- data/app/assets/stylesheets/spree/backend/shared/_skeleton.scss +242 -0
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +2 -0
- data/app/assets/stylesheets/spree/backend/shared/_typography.scss +5 -1
- data/app/assets/stylesheets/spree/backend/shared/_utilities.scss +35 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +9 -5
- data/app/controllers/spree/admin/adjustments_controller.rb +2 -3
- data/app/controllers/spree/admin/base_controller.rb +46 -56
- data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
- data/app/controllers/spree/admin/countries_controller.rb +0 -2
- data/app/controllers/spree/admin/customer_returns_controller.rb +1 -1
- data/app/controllers/spree/admin/general_settings_controller.rb +6 -8
- data/app/controllers/spree/admin/images_controller.rb +16 -17
- data/app/controllers/spree/admin/log_entries_controller.rb +1 -2
- data/app/controllers/spree/admin/option_types_controller.rb +17 -21
- data/app/controllers/spree/admin/option_values_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +21 -22
- data/app/controllers/spree/admin/orders_controller.rb +41 -42
- data/app/controllers/spree/admin/payment_methods_controller.rb +18 -18
- data/app/controllers/spree/admin/payments_controller.rb +11 -11
- data/app/controllers/spree/admin/product_properties_controller.rb +13 -13
- data/app/controllers/spree/admin/products_controller.rb +4 -4
- data/app/controllers/spree/admin/promotion_actions_controller.rb +15 -11
- data/app/controllers/spree/admin/promotion_codes_controller.rb +0 -1
- data/app/controllers/spree/admin/promotion_rules_controller.rb +15 -15
- data/app/controllers/spree/admin/promotions_controller.rb +35 -35
- data/app/controllers/spree/admin/prototypes_controller.rb +2 -3
- data/app/controllers/spree/admin/reports_controller.rb +11 -5
- data/app/controllers/spree/admin/resource_controller.rb +130 -133
- data/app/controllers/spree/admin/return_authorizations_controller.rb +2 -2
- data/app/controllers/spree/admin/return_items_controller.rb +0 -1
- data/app/controllers/spree/admin/search_controller.rb +1 -3
- data/app/controllers/spree/admin/shipping_methods_controller.rb +3 -3
- data/app/controllers/spree/admin/states_controller.rb +10 -10
- data/app/controllers/spree/admin/stock_items_controller.rb +42 -42
- data/app/controllers/spree/admin/stock_locations_controller.rb +4 -12
- data/app/controllers/spree/admin/stock_movements_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +7 -4
- data/app/controllers/spree/admin/store_credits_controller.rb +4 -4
- data/app/controllers/spree/admin/style_guide_controller.rb +3 -0
- data/app/controllers/spree/admin/taxonomies_controller.rb +0 -6
- data/app/controllers/spree/admin/taxons_controller.rb +13 -36
- data/app/controllers/spree/admin/users_controller.rb +54 -72
- data/app/controllers/spree/admin/variants_controller.rb +22 -35
- data/app/controllers/spree/admin/variants_including_master_controller.rb +0 -2
- data/app/controllers/spree/admin/zones_controller.rb +11 -11
- data/app/helpers/spree/admin/adjustments_helper.rb +4 -5
- data/app/helpers/spree/admin/base_helper.rb +32 -34
- data/app/helpers/spree/admin/general_settings_helper.rb +1 -1
- data/app/helpers/spree/admin/images_helper.rb +0 -1
- data/app/helpers/spree/admin/navigation_helper.rb +41 -35
- data/app/helpers/spree/admin/orders_helper.rb +5 -6
- data/app/helpers/spree/admin/payments_helper.rb +1 -1
- data/app/helpers/spree/admin/products_helper.rb +7 -7
- data/app/helpers/spree/admin/stock_locations_helper.rb +1 -1
- data/app/helpers/spree/admin/store_credit_events_helper.rb +6 -6
- data/app/helpers/spree/admin/tables_helper.rb +0 -2
- data/app/helpers/spree/admin/taxons_helper.rb +1 -1
- data/app/helpers/spree/promotion_rules_helper.rb +1 -4
- data/app/models/spree/backend_configuration.rb +1 -0
- data/app/views/kaminari/solidus_admin/_first_page.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_gap.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_last_page.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_next_page.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_page.html.erb +9 -0
- data/app/views/kaminari/solidus_admin/_paginator.html.erb +15 -0
- data/app/views/kaminari/solidus_admin/_prev_page.html.erb +3 -0
- data/app/views/spree/admin/adjustment_reasons/edit.html.erb +2 -0
- data/app/views/spree/admin/adjustment_reasons/index.html.erb +7 -6
- data/app/views/spree/admin/adjustment_reasons/new.html.erb +2 -0
- data/app/views/spree/admin/adjustment_reasons/shared/_form.html.erb +3 -3
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +4 -4
- data/app/views/spree/admin/adjustments/_form.html.erb +5 -5
- data/app/views/spree/admin/adjustments/edit.html.erb +1 -2
- data/app/views/spree/admin/adjustments/new.html.erb +0 -1
- data/app/views/spree/admin/cancellations/index.html.erb +6 -6
- data/app/views/spree/admin/countries/_form.html.erb +3 -3
- data/app/views/spree/admin/countries/edit.html.erb +1 -1
- data/app/views/spree/admin/countries/index.html.erb +4 -4
- data/app/views/spree/admin/countries/new.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +4 -4
- data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +10 -10
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +11 -11
- data/app/views/spree/admin/customer_returns/edit.html.erb +2 -2
- data/app/views/spree/admin/customer_returns/index.html.erb +9 -10
- data/app/views/spree/admin/customer_returns/new.html.erb +2 -3
- data/app/views/spree/admin/general_settings/edit.html.erb +37 -26
- data/app/views/spree/admin/images/_form.html.erb +2 -2
- data/app/views/spree/admin/images/edit.html.erb +0 -1
- data/app/views/spree/admin/images/index.html.erb +2 -2
- data/app/views/spree/admin/images/new.html.erb +0 -3
- data/app/views/spree/admin/log_entries/index.html.erb +2 -2
- data/app/views/spree/admin/option_types/_form.html.erb +3 -3
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
- data/app/views/spree/admin/option_types/edit.html.erb +7 -5
- data/app/views/spree/admin/option_types/index.html.erb +6 -7
- data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
- data/app/views/spree/admin/orders/_adjustments.html.erb +4 -2
- data/app/views/spree/admin/orders/_carton.html.erb +7 -7
- data/app/views/spree/admin/orders/_carton_manifest.html.erb +3 -5
- data/app/views/spree/admin/orders/_form.html.erb +0 -1
- data/app/views/spree/admin/orders/_line_items.html.erb +10 -8
- data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +0 -2
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +3 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +99 -100
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +4 -9
- data/app/views/spree/admin/orders/confirm/_line_items.html.erb +4 -4
- data/app/views/spree/admin/orders/confirm/_payments.html.erb +7 -7
- data/app/views/spree/admin/orders/confirm/_shipment.html.erb +10 -7
- data/app/views/spree/admin/orders/confirm/_shipment_manifest.html.erb +2 -2
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -5
- data/app/views/spree/admin/orders/index.html.erb +15 -14
- data/app/views/spree/admin/payment_methods/_form.html.erb +9 -10
- data/app/views/spree/admin/payment_methods/edit.html.erb +1 -1
- data/app/views/spree/admin/payment_methods/index.html.erb +18 -17
- data/app/views/spree/admin/payment_methods/new.html.erb +2 -2
- data/app/views/spree/admin/payments/_capture_events.html.erb +2 -2
- data/app/views/spree/admin/payments/_form.html.erb +3 -3
- data/app/views/spree/admin/payments/_list.html.erb +29 -17
- data/app/views/spree/admin/payments/credit.html.erb +3 -3
- data/app/views/spree/admin/payments/index.html.erb +3 -3
- data/app/views/spree/admin/payments/new.html.erb +2 -2
- data/app/views/spree/admin/payments/show.html.erb +3 -3
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +4 -4
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +4 -4
- data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +5 -5
- data/app/views/spree/admin/product_properties/index.html.erb +6 -8
- data/app/views/spree/admin/products/_form.html.erb +33 -33
- data/app/views/spree/admin/products/_properties_form.erb +1 -1
- data/app/views/spree/admin/products/index.html.erb +10 -9
- data/app/views/spree/admin/products/new.html.erb +6 -5
- data/app/views/spree/admin/promotion_codes/index.csv.ruby +2 -2
- data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
- data/app/views/spree/admin/promotions/_form.html.erb +2 -2
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/index.html.erb +15 -16
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +5 -2
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +3 -3
- data/app/views/spree/admin/properties/_form.html.erb +2 -2
- data/app/views/spree/admin/properties/index.html.erb +8 -9
- data/app/views/spree/admin/prototypes/_form.html.erb +4 -4
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +2 -2
- data/app/views/spree/admin/prototypes/index.html.erb +7 -10
- data/app/views/spree/admin/prototypes/new.js.erb +1 -1
- data/app/views/spree/admin/prototypes/show.html.erb +1 -1
- data/app/views/spree/admin/refund_reasons/edit.html.erb +2 -0
- data/app/views/spree/admin/refund_reasons/index.html.erb +7 -8
- data/app/views/spree/admin/refund_reasons/new.html.erb +2 -0
- data/app/views/spree/admin/refund_reasons/shared/_form.html.erb +2 -2
- data/app/views/spree/admin/refunds/edit.html.erb +3 -4
- data/app/views/spree/admin/refunds/new.html.erb +4 -5
- data/app/views/spree/admin/reimbursement_types/index.html.erb +4 -4
- data/app/views/spree/admin/reimbursements/edit.html.erb +10 -11
- data/app/views/spree/admin/reimbursements/index.html.erb +4 -6
- data/app/views/spree/admin/reimbursements/show.html.erb +12 -12
- data/app/views/spree/admin/return_authorizations/_form.html.erb +15 -15
- data/app/views/spree/admin/return_authorizations/edit.html.erb +1 -2
- data/app/views/spree/admin/return_authorizations/index.html.erb +5 -5
- data/app/views/spree/admin/return_authorizations/new.html.erb +1 -2
- data/app/views/spree/admin/return_reasons/index.html.erb +2 -2
- data/app/views/spree/admin/shared/_address_form.html.erb +10 -10
- data/app/views/spree/admin/shared/_areas_tabs.html.erb +19 -0
- data/app/views/spree/admin/shared/_calculator_fields.html.erb +2 -2
- data/app/views/spree/admin/shared/_configuration_menu.html.erb +9 -64
- data/app/views/spree/admin/shared/_destroy.js.erb +0 -2
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +0 -1
- data/app/views/spree/admin/shared/_flash.html.erb +11 -0
- data/app/views/spree/admin/shared/_general_tabs.html.erb +2 -0
- data/app/views/spree/admin/shared/_head.html.erb +10 -1
- data/app/views/spree/admin/shared/_header.html.erb +13 -5
- data/app/views/spree/admin/shared/_navigation.html.erb +1 -1
- data/app/views/spree/admin/shared/_navigation_header.html.erb +5 -0
- data/app/views/spree/admin/shared/_new_resource_links.html.erb +0 -1
- data/app/views/spree/admin/shared/_no_objects_found.html.erb +4 -0
- data/app/views/spree/admin/shared/_order_submenu.html.erb +18 -18
- data/app/views/spree/admin/shared/_order_summary.html.erb +12 -12
- data/app/views/spree/admin/shared/_order_tabs.html.erb +4 -1
- data/app/views/spree/admin/shared/_payments_tabs.html.erb +9 -0
- data/app/views/spree/admin/shared/_product_sub_menu.html.erb +2 -2
- data/app/views/spree/admin/shared/_product_tabs.html.erb +9 -14
- data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +1 -1
- data/app/views/spree/admin/shared/_refunds.html.erb +6 -6
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +21 -0
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +26 -0
- data/app/views/spree/admin/shared/_shipping_tabs.html.erb +17 -0
- data/app/views/spree/admin/shared/_spinner.html.erb +6 -0
- data/app/views/spree/admin/shared/_stock_sub_menu.html.erb +3 -3
- data/app/views/spree/admin/shared/_table_filter.html.erb +1 -1
- data/app/views/spree/admin/shared/_tabs.html.erb +4 -2
- data/app/views/spree/admin/shared/_taxes_tabs.html.erb +13 -0
- data/app/views/spree/admin/shared/_variant_search.html.erb +2 -2
- data/app/views/spree/admin/shared/named_types/_edit.html.erb +2 -0
- data/app/views/spree/admin/shared/named_types/_form.html.erb +3 -5
- data/app/views/spree/admin/shared/named_types/_index.html.erb +4 -5
- data/app/views/spree/admin/shared/named_types/_new.html.erb +2 -0
- data/app/views/spree/admin/shipping_categories/_form.html.erb +2 -2
- data/app/views/spree/admin/shipping_categories/edit.html.erb +1 -1
- data/app/views/spree/admin/shipping_categories/index.html.erb +6 -7
- data/app/views/spree/admin/shipping_categories/new.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +26 -8
- data/app/views/spree/admin/shipping_methods/edit.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/index.html.erb +10 -11
- data/app/views/spree/admin/shipping_methods/new.html.erb +1 -1
- data/app/views/spree/admin/states/_form.html.erb +2 -2
- data/app/views/spree/admin/states/_state_list.html.erb +3 -3
- data/app/views/spree/admin/states/edit.html.erb +1 -1
- data/app/views/spree/admin/states/index.html.erb +3 -3
- data/app/views/spree/admin/states/new.html.erb +1 -1
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +15 -27
- data/app/views/spree/admin/stock_items/index.html.erb +1 -3
- data/app/views/spree/admin/stock_locations/_form.html.erb +17 -18
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +2 -3
- data/app/views/spree/admin/stock_locations/edit.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/index.html.erb +9 -10
- data/app/views/spree/admin/stock_locations/new.html.erb +1 -1
- data/app/views/spree/admin/stock_movements/_form.html.erb +2 -2
- data/app/views/spree/admin/stock_movements/index.html.erb +8 -9
- data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +4 -4
- data/app/views/spree/admin/stock_transfers/_transfer_item_actions.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/_transfer_item_table.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/edit.html.erb +8 -21
- data/app/views/spree/admin/stock_transfers/index.html.erb +8 -6
- data/app/views/spree/admin/stock_transfers/new.html.erb +2 -3
- data/app/views/spree/admin/stock_transfers/receive.html.erb +6 -21
- data/app/views/spree/admin/stock_transfers/show.html.erb +8 -8
- data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +10 -23
- data/app/views/spree/admin/store_credits/_form.html.erb +3 -3
- data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +1 -1
- data/app/views/spree/admin/store_credits/edit_amount.html.erb +1 -1
- data/app/views/spree/admin/store_credits/edit_validity.html.erb +0 -1
- data/app/views/spree/admin/store_credits/index.html.erb +11 -12
- data/app/views/spree/admin/store_credits/show.html.erb +11 -11
- data/app/views/spree/admin/style_guide/topics/components/_tabs.html.erb +17 -0
- data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +2 -2
- data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +1 -1
- data/app/views/spree/admin/tax_categories/_form.html.erb +5 -7
- data/app/views/spree/admin/tax_categories/edit.html.erb +1 -1
- data/app/views/spree/admin/tax_categories/index.html.erb +8 -9
- data/app/views/spree/admin/tax_categories/new.html.erb +1 -1
- data/app/views/spree/admin/tax_categories/show.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/_form.html.erb +4 -4
- data/app/views/spree/admin/tax_rates/edit.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/index.html.erb +12 -13
- data/app/views/spree/admin/tax_rates/new.html.erb +2 -2
- data/app/views/spree/admin/taxonomies/_form.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/_list.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/edit.erb +0 -3
- data/app/views/spree/admin/taxonomies/index.html.erb +4 -7
- data/app/views/spree/admin/taxonomies/new.html.erb +1 -3
- data/app/views/spree/admin/taxons/_form.html.erb +8 -7
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +1 -1
- data/app/views/spree/admin/taxons/edit.html.erb +1 -4
- data/app/views/spree/admin/taxons/index.html.erb +1 -1
- data/app/views/spree/admin/trackers/_form.html.erb +3 -3
- data/app/views/spree/admin/trackers/edit.html.erb +1 -1
- data/app/views/spree/admin/trackers/index.html.erb +7 -8
- data/app/views/spree/admin/trackers/new.html.erb +1 -1
- data/app/views/spree/admin/users/_addresses_form.html.erb +2 -4
- data/app/views/spree/admin/users/_form.html.erb +6 -6
- data/app/views/spree/admin/users/_sidebar.html.erb +5 -5
- data/app/views/spree/admin/users/addresses.html.erb +1 -1
- data/app/views/spree/admin/users/edit.html.erb +0 -2
- data/app/views/spree/admin/users/index.html.erb +2 -2
- data/app/views/spree/admin/users/items.html.erb +11 -12
- data/app/views/spree/admin/users/orders.html.erb +9 -10
- data/app/views/spree/admin/variants/_form.html.erb +60 -34
- data/app/views/spree/admin/variants/_table.html.erb +47 -0
- data/app/views/spree/admin/variants/_table_filter.html.erb +25 -0
- data/app/views/spree/admin/variants/edit.html.erb +6 -1
- data/app/views/spree/admin/variants/index.html.erb +28 -112
- data/app/views/spree/admin/variants/new.html.erb +1 -1
- data/app/views/spree/admin/variants/new.js.erb +2 -3
- data/app/views/spree/admin/zones/_country_members.html.erb +2 -2
- data/app/views/spree/admin/zones/_form.html.erb +3 -3
- data/app/views/spree/admin/zones/_state_members.html.erb +2 -2
- data/app/views/spree/admin/zones/edit.html.erb +1 -1
- data/app/views/spree/admin/zones/index.html.erb +9 -10
- data/app/views/spree/admin/zones/new.html.erb +1 -1
- data/app/views/spree/layouts/admin.html.erb +15 -33
- data/config/initializers/assets.rb +7 -1
- data/config/initializers/form_builder.rb +2 -3
- data/config/routes.rb +12 -11
- data/lib/spree/backend.rb +1 -0
- data/lib/spree/backend/action_callbacks.rb +0 -1
- data/lib/spree/backend/callbacks.rb +3 -5
- data/lib/spree/backend/engine.rb +1 -14
- data/script/rails +0 -1
- data/solidus_backend.gemspec +1 -0
- data/spec/controllers/spree/admin/base_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +6 -7
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +2 -4
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -1
- data/spec/controllers/spree/admin/orders_controller_spec.rb +27 -91
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +38 -13
- data/spec/controllers/spree/admin/payments_controller_spec.rb +108 -104
- data/spec/controllers/spree/admin/products_controller_spec.rb +7 -7
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +6 -9
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -1
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/reports_controller_spec.rb +14 -9
- data/spec/controllers/spree/admin/resource_controller_spec.rb +6 -6
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +13 -13
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/search_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +8 -7
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +13 -25
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +3 -4
- data/spec/controllers/spree/admin/users_controller_spec.rb +19 -19
- data/spec/controllers/spree/admin/variants_controller_spec.rb +7 -6
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +3 -3
- data/spec/features/admin/configuration/countries_spec.rb +1 -1
- data/spec/features/admin/configuration/general_settings_spec.rb +12 -2
- data/spec/features/admin/configuration/payment_methods_spec.rb +13 -12
- data/spec/features/admin/configuration/shipping_methods_spec.rb +7 -7
- data/spec/features/admin/configuration/states_spec.rb +12 -12
- data/spec/features/admin/configuration/stock_locations_spec.rb +5 -4
- data/spec/features/admin/configuration/tax_categories_spec.rb +6 -6
- data/spec/features/admin/configuration/tax_rates_spec.rb +4 -4
- data/spec/features/admin/configuration/taxonomies_spec.rb +6 -6
- data/spec/features/admin/configuration/zones_spec.rb +6 -6
- data/spec/features/admin/homepage_spec.rb +2 -5
- data/spec/features/admin/locale_spec.rb +9 -7
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +15 -15
- data/spec/features/admin/orders/adjustments_spec.rb +17 -18
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +1 -2
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +1 -1
- data/spec/features/admin/orders/customer_details_spec.rb +12 -12
- data/spec/features/admin/orders/line_items_spec.rb +3 -3
- data/spec/features/admin/orders/listing_spec.rb +21 -1
- data/spec/features/admin/orders/log_entries_spec.rb +7 -7
- data/spec/features/admin/orders/new_order_spec.rb +7 -7
- data/spec/features/admin/orders/order_details_spec.rb +41 -29
- data/spec/features/admin/orders/payments_spec.rb +20 -28
- data/spec/features/admin/orders/risk_analysis_spec.rb +2 -2
- data/spec/features/admin/orders/shipments_spec.rb +11 -6
- data/spec/features/admin/products/edit/images_spec.rb +14 -14
- data/spec/features/admin/products/edit/products_spec.rb +10 -10
- data/spec/features/admin/products/edit/taxons_spec.rb +2 -2
- data/spec/features/admin/products/edit/variants_spec.rb +9 -9
- data/spec/features/admin/products/option_types_spec.rb +11 -12
- data/spec/features/admin/products/products_spec.rb +66 -68
- data/spec/features/admin/products/properties_spec.rb +14 -14
- data/spec/features/admin/products/prototypes_spec.rb +3 -3
- data/spec/features/admin/products/stock_management_spec.rb +16 -11
- data/spec/features/admin/products/variant_spec.rb +4 -4
- data/spec/features/admin/promotion_adjustments_spec.rb +41 -41
- data/spec/features/admin/reports_spec.rb +9 -9
- data/spec/features/admin/stock_transfer_spec.rb +8 -22
- data/spec/features/admin/store_credits_spec.rb +0 -1
- data/spec/features/admin/taxons_spec.rb +5 -6
- data/spec/features/admin/users_spec.rb +6 -9
- data/spec/helpers/admin/base_helper_spec.rb +1 -2
- data/spec/helpers/admin/navigation_helper_spec.rb +15 -18
- data/spec/helpers/admin/reimbursements_helper_spec.rb +3 -3
- data/spec/helpers/admin/stock_movements_helper_spec.rb +1 -3
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +3 -3
- data/spec/helpers/promotion_rules_helper_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -4
- data/spec/support/feature/base_feature_helper.rb +3 -3
- data/vendor/assets/javascripts/{backbone.js → solidus_admin/backbone.js} +764 -452
- data/vendor/assets/javascripts/solidus_admin/bind-polyfill.js +28 -0
- data/vendor/assets/javascripts/solidus_admin/bootstrap.js +3560 -0
- data/vendor/assets/javascripts/solidus_admin/tether.js +1726 -0
- data/vendor/assets/javascripts/solidus_admin/underscore.js +1548 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_alert.scss +65 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_animation.scss +27 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_breadcrumb.scss +23 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_button-group.scss +224 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_buttons.scss +173 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_card.scss +292 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_carousel.scss +252 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_close.scss +28 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_code.scss +58 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_custom-forms.scss +226 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_dropdown.scss +193 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_forms.scss +452 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_grid.scss +76 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_images.scss +53 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_input-group.scss +189 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_jumbotron.scss +20 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_labels.scss +77 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_list-group.scss +140 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_media.scss +90 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_mixins.scss +55 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_modal.scss +146 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_nav.scss +162 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_navbar.scss +230 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_normalize.scss +428 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_pager.scss +57 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_pagination.scss +73 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_popover.scss +140 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_print.scss +88 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_progress.scss +156 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_reboot.scss +347 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_responsive-embed.scss +39 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_tables.scss +193 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_tooltip.scss +85 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_type.scss +157 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities-background.scss +24 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities-responsive.scss +49 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities-spacing.scss +39 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities.scss +95 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_variables.scss +666 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap-flex.scss +8 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap-grid.scss +62 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap-reboot.scss +10 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap.scss +56 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_alert.scss +14 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_background-variant.scss +13 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_border-radius.scss +35 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_breakpoints.scss +86 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_buttons.scss +100 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_cards.scss +38 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_center-block.scss +7 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_clearfix.scss +7 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_forms.scss +89 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_gradients.scss +43 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_grid-framework.scss +44 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_grid.scss +75 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_hover.scss +59 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_image.scss +34 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_label.scss +11 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_list-group.scss +30 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_lists.scss +7 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_nav-divider.scss +10 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_navbar-align.scss +9 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_pagination.scss +22 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_progress.scss +18 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_pulls.scss +6 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_reset-filter.scss +8 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_reset-text.scss +18 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_resize.scss +6 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_screen-reader.scss +32 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_size.scss +6 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_tab-focus.scss +9 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_table-row.scss +30 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_text-hide.scss +8 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_text-truncate.scss +8 -0
- metadata +140 -35
- data/app/assets/javascripts/spree/backend/orders/edit_form.js +0 -20
- data/app/assets/javascripts/spree/backend/shipments.js.erb +0 -353
- data/app/assets/javascripts/spree/backend/stock_management/index.coffee +0 -4
- data/app/assets/javascripts/spree/backend/stock_transfers/ship.js.coffee +0 -10
- data/app/assets/javascripts/spree/backend/taxon_tree_menu.js.coffee +0 -21
- data/app/assets/javascripts/spree/frontend/backend.js +0 -1
- data/app/assets/stylesheets/spree/backend/components/_pagination.scss +0 -17
- data/app/assets/stylesheets/spree/backend/plugins/_powertip.scss +0 -87
- data/app/assets/stylesheets/spree/backend/plugins/_token-input.scss +0 -110
- data/app/assets/stylesheets/spree/frontend/backend.css +0 -1
- data/app/views/spree/admin/orders/_line_item.html.erb +0 -9
- data/app/views/spree/admin/shared/_content_header.html.erb +0 -23
- data/app/views/spree/admin/shared/_show_resource_links.html.erb +0 -5
- data/app/views/spree/admin/shared/_update_order_state.js +0 -7
- data/vendor/assets/javascripts/jquery.cookie.js +0 -41
- data/vendor/assets/javascripts/jquery.powertip.js +0 -1165
- data/vendor/assets/javascripts/underscore-min.js +0 -1227
- data/vendor/assets/stylesheets/bootstrap/components/_media.scss +0 -61
- data/vendor/assets/stylesheets/jquery.powertip.css +0 -85
@@ -0,0 +1,28 @@
|
|
1
|
+
// Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Polyfill
|
2
|
+
if (!Function.prototype.bind) {
|
3
|
+
Function.prototype.bind = function(oThis) {
|
4
|
+
if (typeof this !== 'function') {
|
5
|
+
// closest thing possible to the ECMAScript 5
|
6
|
+
// internal IsCallable function
|
7
|
+
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
8
|
+
}
|
9
|
+
|
10
|
+
var aArgs = Array.prototype.slice.call(arguments, 1),
|
11
|
+
fToBind = this,
|
12
|
+
fNOP = function() {},
|
13
|
+
fBound = function() {
|
14
|
+
return fToBind.apply(this instanceof fNOP
|
15
|
+
? this
|
16
|
+
: oThis,
|
17
|
+
aArgs.concat(Array.prototype.slice.call(arguments)));
|
18
|
+
};
|
19
|
+
|
20
|
+
if (this.prototype) {
|
21
|
+
// Function.prototype doesn't have a prototype property
|
22
|
+
fNOP.prototype = this.prototype;
|
23
|
+
}
|
24
|
+
fBound.prototype = new fNOP();
|
25
|
+
|
26
|
+
return fBound;
|
27
|
+
};
|
28
|
+
}
|
@@ -0,0 +1,3560 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap v4.0.0-alpha.2 (http://getbootstrap.com)
|
3
|
+
* Copyright 2011-2015 Twitter, Inc.
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
5
|
+
*/
|
6
|
+
|
7
|
+
if (typeof jQuery === 'undefined') {
|
8
|
+
throw new Error('Bootstrap\'s JavaScript requires jQuery')
|
9
|
+
}
|
10
|
+
|
11
|
+
+function ($) {
|
12
|
+
var version = $.fn.jquery.split(' ')[0].split('.')
|
13
|
+
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 3)) {
|
14
|
+
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v3.0.0')
|
15
|
+
}
|
16
|
+
}(jQuery);
|
17
|
+
|
18
|
+
|
19
|
+
+function ($) {
|
20
|
+
|
21
|
+
/**
|
22
|
+
* --------------------------------------------------------------------------
|
23
|
+
* Bootstrap (v4.0.0-alpha.2): util.js
|
24
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
25
|
+
* --------------------------------------------------------------------------
|
26
|
+
*/
|
27
|
+
|
28
|
+
'use strict';
|
29
|
+
|
30
|
+
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
|
31
|
+
|
32
|
+
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
33
|
+
|
34
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
35
|
+
|
36
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
37
|
+
|
38
|
+
var Util = (function ($) {
|
39
|
+
|
40
|
+
/**
|
41
|
+
* ------------------------------------------------------------------------
|
42
|
+
* Private TransitionEnd Helpers
|
43
|
+
* ------------------------------------------------------------------------
|
44
|
+
*/
|
45
|
+
|
46
|
+
var transition = false;
|
47
|
+
|
48
|
+
var TransitionEndEvent = {
|
49
|
+
WebkitTransition: 'webkitTransitionEnd',
|
50
|
+
MozTransition: 'transitionend',
|
51
|
+
OTransition: 'oTransitionEnd otransitionend',
|
52
|
+
transition: 'transitionend'
|
53
|
+
};
|
54
|
+
|
55
|
+
// shoutout AngusCroll (https://goo.gl/pxwQGp)
|
56
|
+
function toType(obj) {
|
57
|
+
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
|
58
|
+
}
|
59
|
+
|
60
|
+
function isElement(obj) {
|
61
|
+
return (obj[0] || obj).nodeType;
|
62
|
+
}
|
63
|
+
|
64
|
+
function getSpecialTransitionEndEvent() {
|
65
|
+
return {
|
66
|
+
bindType: transition.end,
|
67
|
+
delegateType: transition.end,
|
68
|
+
handle: function handle(event) {
|
69
|
+
if ($(event.target).is(this)) {
|
70
|
+
return event.handleObj.handler.apply(this, arguments);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
};
|
74
|
+
}
|
75
|
+
|
76
|
+
function transitionEndTest() {
|
77
|
+
if (window.QUnit) {
|
78
|
+
return false;
|
79
|
+
}
|
80
|
+
|
81
|
+
var el = document.createElement('bootstrap');
|
82
|
+
|
83
|
+
for (var _name in TransitionEndEvent) {
|
84
|
+
if (el.style[_name] !== undefined) {
|
85
|
+
return { end: TransitionEndEvent[_name] };
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
return false;
|
90
|
+
}
|
91
|
+
|
92
|
+
function transitionEndEmulator(duration) {
|
93
|
+
var _this = this;
|
94
|
+
|
95
|
+
var called = false;
|
96
|
+
|
97
|
+
$(this).one(Util.TRANSITION_END, function () {
|
98
|
+
called = true;
|
99
|
+
});
|
100
|
+
|
101
|
+
setTimeout(function () {
|
102
|
+
if (!called) {
|
103
|
+
Util.triggerTransitionEnd(_this);
|
104
|
+
}
|
105
|
+
}, duration);
|
106
|
+
|
107
|
+
return this;
|
108
|
+
}
|
109
|
+
|
110
|
+
function setTransitionEndSupport() {
|
111
|
+
transition = transitionEndTest();
|
112
|
+
|
113
|
+
$.fn.emulateTransitionEnd = transitionEndEmulator;
|
114
|
+
|
115
|
+
if (Util.supportsTransitionEnd()) {
|
116
|
+
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* --------------------------------------------------------------------------
|
122
|
+
* Public Util Api
|
123
|
+
* --------------------------------------------------------------------------
|
124
|
+
*/
|
125
|
+
|
126
|
+
var Util = {
|
127
|
+
|
128
|
+
TRANSITION_END: 'bsTransitionEnd',
|
129
|
+
|
130
|
+
getUID: function getUID(prefix) {
|
131
|
+
do {
|
132
|
+
prefix += ~ ~(Math.random() * 1000000); // "~~" acts like a faster Math.floor() here
|
133
|
+
} while (document.getElementById(prefix));
|
134
|
+
return prefix;
|
135
|
+
},
|
136
|
+
|
137
|
+
getSelectorFromElement: function getSelectorFromElement(element) {
|
138
|
+
var selector = element.getAttribute('data-target');
|
139
|
+
|
140
|
+
if (!selector) {
|
141
|
+
selector = element.getAttribute('href') || '';
|
142
|
+
selector = /^#[a-z]/i.test(selector) ? selector : null;
|
143
|
+
}
|
144
|
+
|
145
|
+
return selector;
|
146
|
+
},
|
147
|
+
|
148
|
+
reflow: function reflow(element) {
|
149
|
+
new Function('bs', 'return bs')(element.offsetHeight);
|
150
|
+
},
|
151
|
+
|
152
|
+
triggerTransitionEnd: function triggerTransitionEnd(element) {
|
153
|
+
$(element).trigger(transition.end);
|
154
|
+
},
|
155
|
+
|
156
|
+
supportsTransitionEnd: function supportsTransitionEnd() {
|
157
|
+
return Boolean(transition);
|
158
|
+
},
|
159
|
+
|
160
|
+
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
161
|
+
for (var property in configTypes) {
|
162
|
+
if (configTypes.hasOwnProperty(property)) {
|
163
|
+
var expectedTypes = configTypes[property];
|
164
|
+
var value = config[property];
|
165
|
+
var valueType = undefined;
|
166
|
+
|
167
|
+
if (value && isElement(value)) {
|
168
|
+
valueType = 'element';
|
169
|
+
} else {
|
170
|
+
valueType = toType(value);
|
171
|
+
}
|
172
|
+
|
173
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
174
|
+
throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
};
|
180
|
+
|
181
|
+
setTransitionEndSupport();
|
182
|
+
|
183
|
+
return Util;
|
184
|
+
})(jQuery);
|
185
|
+
|
186
|
+
/**
|
187
|
+
* --------------------------------------------------------------------------
|
188
|
+
* Bootstrap (v4.0.0-alpha.2): alert.js
|
189
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
190
|
+
* --------------------------------------------------------------------------
|
191
|
+
*/
|
192
|
+
|
193
|
+
var Alert = (function ($) {
|
194
|
+
|
195
|
+
/**
|
196
|
+
* ------------------------------------------------------------------------
|
197
|
+
* Constants
|
198
|
+
* ------------------------------------------------------------------------
|
199
|
+
*/
|
200
|
+
|
201
|
+
var NAME = 'alert';
|
202
|
+
var VERSION = '4.0.0-alpha';
|
203
|
+
var DATA_KEY = 'bs.alert';
|
204
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
205
|
+
var DATA_API_KEY = '.data-api';
|
206
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
207
|
+
var TRANSITION_DURATION = 150;
|
208
|
+
|
209
|
+
var Selector = {
|
210
|
+
DISMISS: '[data-dismiss="alert"]'
|
211
|
+
};
|
212
|
+
|
213
|
+
var Event = {
|
214
|
+
CLOSE: 'close' + EVENT_KEY,
|
215
|
+
CLOSED: 'closed' + EVENT_KEY,
|
216
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
217
|
+
};
|
218
|
+
|
219
|
+
var ClassName = {
|
220
|
+
ALERT: 'alert',
|
221
|
+
FADE: 'fade',
|
222
|
+
IN: 'in'
|
223
|
+
};
|
224
|
+
|
225
|
+
/**
|
226
|
+
* ------------------------------------------------------------------------
|
227
|
+
* Class Definition
|
228
|
+
* ------------------------------------------------------------------------
|
229
|
+
*/
|
230
|
+
|
231
|
+
var Alert = (function () {
|
232
|
+
function Alert(element) {
|
233
|
+
_classCallCheck(this, Alert);
|
234
|
+
|
235
|
+
this._element = element;
|
236
|
+
}
|
237
|
+
|
238
|
+
/**
|
239
|
+
* ------------------------------------------------------------------------
|
240
|
+
* Data Api implementation
|
241
|
+
* ------------------------------------------------------------------------
|
242
|
+
*/
|
243
|
+
|
244
|
+
// getters
|
245
|
+
|
246
|
+
_createClass(Alert, [{
|
247
|
+
key: 'close',
|
248
|
+
|
249
|
+
// public
|
250
|
+
|
251
|
+
value: function close(element) {
|
252
|
+
element = element || this._element;
|
253
|
+
|
254
|
+
var rootElement = this._getRootElement(element);
|
255
|
+
var customEvent = this._triggerCloseEvent(rootElement);
|
256
|
+
|
257
|
+
if (customEvent.isDefaultPrevented()) {
|
258
|
+
return;
|
259
|
+
}
|
260
|
+
|
261
|
+
this._removeElement(rootElement);
|
262
|
+
}
|
263
|
+
}, {
|
264
|
+
key: 'dispose',
|
265
|
+
value: function dispose() {
|
266
|
+
$.removeData(this._element, DATA_KEY);
|
267
|
+
this._element = null;
|
268
|
+
}
|
269
|
+
|
270
|
+
// private
|
271
|
+
|
272
|
+
}, {
|
273
|
+
key: '_getRootElement',
|
274
|
+
value: function _getRootElement(element) {
|
275
|
+
var selector = Util.getSelectorFromElement(element);
|
276
|
+
var parent = false;
|
277
|
+
|
278
|
+
if (selector) {
|
279
|
+
parent = $(selector)[0];
|
280
|
+
}
|
281
|
+
|
282
|
+
if (!parent) {
|
283
|
+
parent = $(element).closest('.' + ClassName.ALERT)[0];
|
284
|
+
}
|
285
|
+
|
286
|
+
return parent;
|
287
|
+
}
|
288
|
+
}, {
|
289
|
+
key: '_triggerCloseEvent',
|
290
|
+
value: function _triggerCloseEvent(element) {
|
291
|
+
var closeEvent = $.Event(Event.CLOSE);
|
292
|
+
|
293
|
+
$(element).trigger(closeEvent);
|
294
|
+
return closeEvent;
|
295
|
+
}
|
296
|
+
}, {
|
297
|
+
key: '_removeElement',
|
298
|
+
value: function _removeElement(element) {
|
299
|
+
$(element).removeClass(ClassName.IN);
|
300
|
+
|
301
|
+
if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {
|
302
|
+
this._destroyElement(element);
|
303
|
+
return;
|
304
|
+
}
|
305
|
+
|
306
|
+
$(element).one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION);
|
307
|
+
}
|
308
|
+
}, {
|
309
|
+
key: '_destroyElement',
|
310
|
+
value: function _destroyElement(element) {
|
311
|
+
$(element).detach().trigger(Event.CLOSED).remove();
|
312
|
+
}
|
313
|
+
|
314
|
+
// static
|
315
|
+
|
316
|
+
}], [{
|
317
|
+
key: '_jQueryInterface',
|
318
|
+
value: function _jQueryInterface(config) {
|
319
|
+
return this.each(function () {
|
320
|
+
var $element = $(this);
|
321
|
+
var data = $element.data(DATA_KEY);
|
322
|
+
|
323
|
+
if (!data) {
|
324
|
+
data = new Alert(this);
|
325
|
+
$element.data(DATA_KEY, data);
|
326
|
+
}
|
327
|
+
|
328
|
+
if (config === 'close') {
|
329
|
+
data[config](this);
|
330
|
+
}
|
331
|
+
});
|
332
|
+
}
|
333
|
+
}, {
|
334
|
+
key: '_handleDismiss',
|
335
|
+
value: function _handleDismiss(alertInstance) {
|
336
|
+
return function (event) {
|
337
|
+
if (event) {
|
338
|
+
event.preventDefault();
|
339
|
+
}
|
340
|
+
|
341
|
+
alertInstance.close(this);
|
342
|
+
};
|
343
|
+
}
|
344
|
+
}, {
|
345
|
+
key: 'VERSION',
|
346
|
+
get: function get() {
|
347
|
+
return VERSION;
|
348
|
+
}
|
349
|
+
}]);
|
350
|
+
|
351
|
+
return Alert;
|
352
|
+
})();
|
353
|
+
|
354
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
355
|
+
|
356
|
+
/**
|
357
|
+
* ------------------------------------------------------------------------
|
358
|
+
* jQuery
|
359
|
+
* ------------------------------------------------------------------------
|
360
|
+
*/
|
361
|
+
|
362
|
+
$.fn[NAME] = Alert._jQueryInterface;
|
363
|
+
$.fn[NAME].Constructor = Alert;
|
364
|
+
$.fn[NAME].noConflict = function () {
|
365
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
366
|
+
return Alert._jQueryInterface;
|
367
|
+
};
|
368
|
+
|
369
|
+
return Alert;
|
370
|
+
})(jQuery);
|
371
|
+
|
372
|
+
/**
|
373
|
+
* --------------------------------------------------------------------------
|
374
|
+
* Bootstrap (v4.0.0-alpha.2): button.js
|
375
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
376
|
+
* --------------------------------------------------------------------------
|
377
|
+
*/
|
378
|
+
|
379
|
+
var Button = (function ($) {
|
380
|
+
|
381
|
+
/**
|
382
|
+
* ------------------------------------------------------------------------
|
383
|
+
* Constants
|
384
|
+
* ------------------------------------------------------------------------
|
385
|
+
*/
|
386
|
+
|
387
|
+
var NAME = 'button';
|
388
|
+
var VERSION = '4.0.0-alpha';
|
389
|
+
var DATA_KEY = 'bs.button';
|
390
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
391
|
+
var DATA_API_KEY = '.data-api';
|
392
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
393
|
+
|
394
|
+
var ClassName = {
|
395
|
+
ACTIVE: 'active',
|
396
|
+
BUTTON: 'btn',
|
397
|
+
FOCUS: 'focus'
|
398
|
+
};
|
399
|
+
|
400
|
+
var Selector = {
|
401
|
+
DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
|
402
|
+
DATA_TOGGLE: '[data-toggle="buttons"]',
|
403
|
+
INPUT: 'input',
|
404
|
+
ACTIVE: '.active',
|
405
|
+
BUTTON: '.btn'
|
406
|
+
};
|
407
|
+
|
408
|
+
var Event = {
|
409
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
|
410
|
+
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
|
411
|
+
};
|
412
|
+
|
413
|
+
/**
|
414
|
+
* ------------------------------------------------------------------------
|
415
|
+
* Class Definition
|
416
|
+
* ------------------------------------------------------------------------
|
417
|
+
*/
|
418
|
+
|
419
|
+
var Button = (function () {
|
420
|
+
function Button(element) {
|
421
|
+
_classCallCheck(this, Button);
|
422
|
+
|
423
|
+
this._element = element;
|
424
|
+
}
|
425
|
+
|
426
|
+
/**
|
427
|
+
* ------------------------------------------------------------------------
|
428
|
+
* Data Api implementation
|
429
|
+
* ------------------------------------------------------------------------
|
430
|
+
*/
|
431
|
+
|
432
|
+
// getters
|
433
|
+
|
434
|
+
_createClass(Button, [{
|
435
|
+
key: 'toggle',
|
436
|
+
|
437
|
+
// public
|
438
|
+
|
439
|
+
value: function toggle() {
|
440
|
+
var triggerChangeEvent = true;
|
441
|
+
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
|
442
|
+
|
443
|
+
if (rootElement) {
|
444
|
+
var input = $(this._element).find(Selector.INPUT)[0];
|
445
|
+
|
446
|
+
if (input) {
|
447
|
+
if (input.type === 'radio') {
|
448
|
+
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
|
449
|
+
triggerChangeEvent = false;
|
450
|
+
} else {
|
451
|
+
var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
|
452
|
+
|
453
|
+
if (activeElement) {
|
454
|
+
$(activeElement).removeClass(ClassName.ACTIVE);
|
455
|
+
}
|
456
|
+
}
|
457
|
+
}
|
458
|
+
|
459
|
+
if (triggerChangeEvent) {
|
460
|
+
input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
|
461
|
+
$(this._element).trigger('change');
|
462
|
+
}
|
463
|
+
}
|
464
|
+
} else {
|
465
|
+
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
|
466
|
+
}
|
467
|
+
|
468
|
+
if (triggerChangeEvent) {
|
469
|
+
$(this._element).toggleClass(ClassName.ACTIVE);
|
470
|
+
}
|
471
|
+
}
|
472
|
+
}, {
|
473
|
+
key: 'dispose',
|
474
|
+
value: function dispose() {
|
475
|
+
$.removeData(this._element, DATA_KEY);
|
476
|
+
this._element = null;
|
477
|
+
}
|
478
|
+
|
479
|
+
// static
|
480
|
+
|
481
|
+
}], [{
|
482
|
+
key: '_jQueryInterface',
|
483
|
+
value: function _jQueryInterface(config) {
|
484
|
+
return this.each(function () {
|
485
|
+
var data = $(this).data(DATA_KEY);
|
486
|
+
|
487
|
+
if (!data) {
|
488
|
+
data = new Button(this);
|
489
|
+
$(this).data(DATA_KEY, data);
|
490
|
+
}
|
491
|
+
|
492
|
+
if (config === 'toggle') {
|
493
|
+
data[config]();
|
494
|
+
}
|
495
|
+
});
|
496
|
+
}
|
497
|
+
}, {
|
498
|
+
key: 'VERSION',
|
499
|
+
get: function get() {
|
500
|
+
return VERSION;
|
501
|
+
}
|
502
|
+
}]);
|
503
|
+
|
504
|
+
return Button;
|
505
|
+
})();
|
506
|
+
|
507
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
508
|
+
event.preventDefault();
|
509
|
+
|
510
|
+
var button = event.target;
|
511
|
+
|
512
|
+
if (!$(button).hasClass(ClassName.BUTTON)) {
|
513
|
+
button = $(button).closest(Selector.BUTTON);
|
514
|
+
}
|
515
|
+
|
516
|
+
Button._jQueryInterface.call($(button), 'toggle');
|
517
|
+
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
518
|
+
var button = $(event.target).closest(Selector.BUTTON)[0];
|
519
|
+
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
520
|
+
});
|
521
|
+
|
522
|
+
/**
|
523
|
+
* ------------------------------------------------------------------------
|
524
|
+
* jQuery
|
525
|
+
* ------------------------------------------------------------------------
|
526
|
+
*/
|
527
|
+
|
528
|
+
$.fn[NAME] = Button._jQueryInterface;
|
529
|
+
$.fn[NAME].Constructor = Button;
|
530
|
+
$.fn[NAME].noConflict = function () {
|
531
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
532
|
+
return Button._jQueryInterface;
|
533
|
+
};
|
534
|
+
|
535
|
+
return Button;
|
536
|
+
})(jQuery);
|
537
|
+
|
538
|
+
/**
|
539
|
+
* --------------------------------------------------------------------------
|
540
|
+
* Bootstrap (v4.0.0-alpha.2): carousel.js
|
541
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
542
|
+
* --------------------------------------------------------------------------
|
543
|
+
*/
|
544
|
+
|
545
|
+
var Carousel = (function ($) {
|
546
|
+
|
547
|
+
/**
|
548
|
+
* ------------------------------------------------------------------------
|
549
|
+
* Constants
|
550
|
+
* ------------------------------------------------------------------------
|
551
|
+
*/
|
552
|
+
|
553
|
+
var NAME = 'carousel';
|
554
|
+
var VERSION = '4.0.0-alpha';
|
555
|
+
var DATA_KEY = 'bs.carousel';
|
556
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
557
|
+
var DATA_API_KEY = '.data-api';
|
558
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
559
|
+
var TRANSITION_DURATION = 600;
|
560
|
+
|
561
|
+
var Default = {
|
562
|
+
interval: 5000,
|
563
|
+
keyboard: true,
|
564
|
+
slide: false,
|
565
|
+
pause: 'hover',
|
566
|
+
wrap: true
|
567
|
+
};
|
568
|
+
|
569
|
+
var DefaultType = {
|
570
|
+
interval: '(number|boolean)',
|
571
|
+
keyboard: 'boolean',
|
572
|
+
slide: '(boolean|string)',
|
573
|
+
pause: '(string|boolean)',
|
574
|
+
wrap: 'boolean'
|
575
|
+
};
|
576
|
+
|
577
|
+
var Direction = {
|
578
|
+
NEXT: 'next',
|
579
|
+
PREVIOUS: 'prev'
|
580
|
+
};
|
581
|
+
|
582
|
+
var Event = {
|
583
|
+
SLIDE: 'slide' + EVENT_KEY,
|
584
|
+
SLID: 'slid' + EVENT_KEY,
|
585
|
+
KEYDOWN: 'keydown' + EVENT_KEY,
|
586
|
+
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
587
|
+
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
|
588
|
+
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
|
589
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
590
|
+
};
|
591
|
+
|
592
|
+
var ClassName = {
|
593
|
+
CAROUSEL: 'carousel',
|
594
|
+
ACTIVE: 'active',
|
595
|
+
SLIDE: 'slide',
|
596
|
+
RIGHT: 'right',
|
597
|
+
LEFT: 'left',
|
598
|
+
ITEM: 'carousel-item'
|
599
|
+
};
|
600
|
+
|
601
|
+
var Selector = {
|
602
|
+
ACTIVE: '.active',
|
603
|
+
ACTIVE_ITEM: '.active.carousel-item',
|
604
|
+
ITEM: '.carousel-item',
|
605
|
+
NEXT_PREV: '.next, .prev',
|
606
|
+
INDICATORS: '.carousel-indicators',
|
607
|
+
DATA_SLIDE: '[data-slide], [data-slide-to]',
|
608
|
+
DATA_RIDE: '[data-ride="carousel"]'
|
609
|
+
};
|
610
|
+
|
611
|
+
/**
|
612
|
+
* ------------------------------------------------------------------------
|
613
|
+
* Class Definition
|
614
|
+
* ------------------------------------------------------------------------
|
615
|
+
*/
|
616
|
+
|
617
|
+
var Carousel = (function () {
|
618
|
+
function Carousel(element, config) {
|
619
|
+
_classCallCheck(this, Carousel);
|
620
|
+
|
621
|
+
this._items = null;
|
622
|
+
this._interval = null;
|
623
|
+
this._activeElement = null;
|
624
|
+
|
625
|
+
this._isPaused = false;
|
626
|
+
this._isSliding = false;
|
627
|
+
|
628
|
+
this._config = this._getConfig(config);
|
629
|
+
this._element = $(element)[0];
|
630
|
+
this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];
|
631
|
+
|
632
|
+
this._addEventListeners();
|
633
|
+
}
|
634
|
+
|
635
|
+
/**
|
636
|
+
* ------------------------------------------------------------------------
|
637
|
+
* Data Api implementation
|
638
|
+
* ------------------------------------------------------------------------
|
639
|
+
*/
|
640
|
+
|
641
|
+
// getters
|
642
|
+
|
643
|
+
_createClass(Carousel, [{
|
644
|
+
key: 'next',
|
645
|
+
|
646
|
+
// public
|
647
|
+
|
648
|
+
value: function next() {
|
649
|
+
if (!this._isSliding) {
|
650
|
+
this._slide(Direction.NEXT);
|
651
|
+
}
|
652
|
+
}
|
653
|
+
}, {
|
654
|
+
key: 'nextWhenVisible',
|
655
|
+
value: function nextWhenVisible() {
|
656
|
+
// Don't call next when the page isn't visible
|
657
|
+
if (!document.hidden) {
|
658
|
+
this.next();
|
659
|
+
}
|
660
|
+
}
|
661
|
+
}, {
|
662
|
+
key: 'prev',
|
663
|
+
value: function prev() {
|
664
|
+
if (!this._isSliding) {
|
665
|
+
this._slide(Direction.PREVIOUS);
|
666
|
+
}
|
667
|
+
}
|
668
|
+
}, {
|
669
|
+
key: 'pause',
|
670
|
+
value: function pause(event) {
|
671
|
+
if (!event) {
|
672
|
+
this._isPaused = true;
|
673
|
+
}
|
674
|
+
|
675
|
+
if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
|
676
|
+
Util.triggerTransitionEnd(this._element);
|
677
|
+
this.cycle(true);
|
678
|
+
}
|
679
|
+
|
680
|
+
clearInterval(this._interval);
|
681
|
+
this._interval = null;
|
682
|
+
}
|
683
|
+
}, {
|
684
|
+
key: 'cycle',
|
685
|
+
value: function cycle(event) {
|
686
|
+
if (!event) {
|
687
|
+
this._isPaused = false;
|
688
|
+
}
|
689
|
+
|
690
|
+
if (this._interval) {
|
691
|
+
clearInterval(this._interval);
|
692
|
+
this._interval = null;
|
693
|
+
}
|
694
|
+
|
695
|
+
if (this._config.interval && !this._isPaused) {
|
696
|
+
this._interval = setInterval($.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval);
|
697
|
+
}
|
698
|
+
}
|
699
|
+
}, {
|
700
|
+
key: 'to',
|
701
|
+
value: function to(index) {
|
702
|
+
var _this2 = this;
|
703
|
+
|
704
|
+
this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
|
705
|
+
|
706
|
+
var activeIndex = this._getItemIndex(this._activeElement);
|
707
|
+
|
708
|
+
if (index > this._items.length - 1 || index < 0) {
|
709
|
+
return;
|
710
|
+
}
|
711
|
+
|
712
|
+
if (this._isSliding) {
|
713
|
+
$(this._element).one(Event.SLID, function () {
|
714
|
+
return _this2.to(index);
|
715
|
+
});
|
716
|
+
return;
|
717
|
+
}
|
718
|
+
|
719
|
+
if (activeIndex === index) {
|
720
|
+
this.pause();
|
721
|
+
this.cycle();
|
722
|
+
return;
|
723
|
+
}
|
724
|
+
|
725
|
+
var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
|
726
|
+
|
727
|
+
this._slide(direction, this._items[index]);
|
728
|
+
}
|
729
|
+
}, {
|
730
|
+
key: 'dispose',
|
731
|
+
value: function dispose() {
|
732
|
+
$(this._element).off(EVENT_KEY);
|
733
|
+
$.removeData(this._element, DATA_KEY);
|
734
|
+
|
735
|
+
this._items = null;
|
736
|
+
this._config = null;
|
737
|
+
this._element = null;
|
738
|
+
this._interval = null;
|
739
|
+
this._isPaused = null;
|
740
|
+
this._isSliding = null;
|
741
|
+
this._activeElement = null;
|
742
|
+
this._indicatorsElement = null;
|
743
|
+
}
|
744
|
+
|
745
|
+
// private
|
746
|
+
|
747
|
+
}, {
|
748
|
+
key: '_getConfig',
|
749
|
+
value: function _getConfig(config) {
|
750
|
+
config = $.extend({}, Default, config);
|
751
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
752
|
+
return config;
|
753
|
+
}
|
754
|
+
}, {
|
755
|
+
key: '_addEventListeners',
|
756
|
+
value: function _addEventListeners() {
|
757
|
+
if (this._config.keyboard) {
|
758
|
+
$(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this));
|
759
|
+
}
|
760
|
+
|
761
|
+
if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) {
|
762
|
+
$(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this));
|
763
|
+
}
|
764
|
+
}
|
765
|
+
}, {
|
766
|
+
key: '_keydown',
|
767
|
+
value: function _keydown(event) {
|
768
|
+
event.preventDefault();
|
769
|
+
|
770
|
+
if (/input|textarea/i.test(event.target.tagName)) {
|
771
|
+
return;
|
772
|
+
}
|
773
|
+
|
774
|
+
switch (event.which) {
|
775
|
+
case 37:
|
776
|
+
this.prev();break;
|
777
|
+
case 39:
|
778
|
+
this.next();break;
|
779
|
+
default:
|
780
|
+
return;
|
781
|
+
}
|
782
|
+
}
|
783
|
+
}, {
|
784
|
+
key: '_getItemIndex',
|
785
|
+
value: function _getItemIndex(element) {
|
786
|
+
this._items = $.makeArray($(element).parent().find(Selector.ITEM));
|
787
|
+
return this._items.indexOf(element);
|
788
|
+
}
|
789
|
+
}, {
|
790
|
+
key: '_getItemByDirection',
|
791
|
+
value: function _getItemByDirection(direction, activeElement) {
|
792
|
+
var isNextDirection = direction === Direction.NEXT;
|
793
|
+
var isPrevDirection = direction === Direction.PREVIOUS;
|
794
|
+
var activeIndex = this._getItemIndex(activeElement);
|
795
|
+
var lastItemIndex = this._items.length - 1;
|
796
|
+
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
|
797
|
+
|
798
|
+
if (isGoingToWrap && !this._config.wrap) {
|
799
|
+
return activeElement;
|
800
|
+
}
|
801
|
+
|
802
|
+
var delta = direction === Direction.PREVIOUS ? -1 : 1;
|
803
|
+
var itemIndex = (activeIndex + delta) % this._items.length;
|
804
|
+
|
805
|
+
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
806
|
+
}
|
807
|
+
}, {
|
808
|
+
key: '_triggerSlideEvent',
|
809
|
+
value: function _triggerSlideEvent(relatedTarget, directionalClassname) {
|
810
|
+
var slideEvent = $.Event(Event.SLIDE, {
|
811
|
+
relatedTarget: relatedTarget,
|
812
|
+
direction: directionalClassname
|
813
|
+
});
|
814
|
+
|
815
|
+
$(this._element).trigger(slideEvent);
|
816
|
+
|
817
|
+
return slideEvent;
|
818
|
+
}
|
819
|
+
}, {
|
820
|
+
key: '_setActiveIndicatorElement',
|
821
|
+
value: function _setActiveIndicatorElement(element) {
|
822
|
+
if (this._indicatorsElement) {
|
823
|
+
$(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
|
824
|
+
|
825
|
+
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
826
|
+
|
827
|
+
if (nextIndicator) {
|
828
|
+
$(nextIndicator).addClass(ClassName.ACTIVE);
|
829
|
+
}
|
830
|
+
}
|
831
|
+
}
|
832
|
+
}, {
|
833
|
+
key: '_slide',
|
834
|
+
value: function _slide(direction, element) {
|
835
|
+
var _this3 = this;
|
836
|
+
|
837
|
+
var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
|
838
|
+
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
|
839
|
+
|
840
|
+
var isCycling = Boolean(this._interval);
|
841
|
+
|
842
|
+
var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT;
|
843
|
+
|
844
|
+
if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
|
845
|
+
this._isSliding = false;
|
846
|
+
return;
|
847
|
+
}
|
848
|
+
|
849
|
+
var slideEvent = this._triggerSlideEvent(nextElement, directionalClassName);
|
850
|
+
if (slideEvent.isDefaultPrevented()) {
|
851
|
+
return;
|
852
|
+
}
|
853
|
+
|
854
|
+
if (!activeElement || !nextElement) {
|
855
|
+
// some weirdness is happening, so we bail
|
856
|
+
return;
|
857
|
+
}
|
858
|
+
|
859
|
+
this._isSliding = true;
|
860
|
+
|
861
|
+
if (isCycling) {
|
862
|
+
this.pause();
|
863
|
+
}
|
864
|
+
|
865
|
+
this._setActiveIndicatorElement(nextElement);
|
866
|
+
|
867
|
+
var slidEvent = $.Event(Event.SLID, {
|
868
|
+
relatedTarget: nextElement,
|
869
|
+
direction: directionalClassName
|
870
|
+
});
|
871
|
+
|
872
|
+
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
|
873
|
+
|
874
|
+
$(nextElement).addClass(direction);
|
875
|
+
|
876
|
+
Util.reflow(nextElement);
|
877
|
+
|
878
|
+
$(activeElement).addClass(directionalClassName);
|
879
|
+
$(nextElement).addClass(directionalClassName);
|
880
|
+
|
881
|
+
$(activeElement).one(Util.TRANSITION_END, function () {
|
882
|
+
$(nextElement).removeClass(directionalClassName).removeClass(direction);
|
883
|
+
|
884
|
+
$(nextElement).addClass(ClassName.ACTIVE);
|
885
|
+
|
886
|
+
$(activeElement).removeClass(ClassName.ACTIVE).removeClass(direction).removeClass(directionalClassName);
|
887
|
+
|
888
|
+
_this3._isSliding = false;
|
889
|
+
|
890
|
+
setTimeout(function () {
|
891
|
+
return $(_this3._element).trigger(slidEvent);
|
892
|
+
}, 0);
|
893
|
+
}).emulateTransitionEnd(TRANSITION_DURATION);
|
894
|
+
} else {
|
895
|
+
$(activeElement).removeClass(ClassName.ACTIVE);
|
896
|
+
$(nextElement).addClass(ClassName.ACTIVE);
|
897
|
+
|
898
|
+
this._isSliding = false;
|
899
|
+
$(this._element).trigger(slidEvent);
|
900
|
+
}
|
901
|
+
|
902
|
+
if (isCycling) {
|
903
|
+
this.cycle();
|
904
|
+
}
|
905
|
+
}
|
906
|
+
|
907
|
+
// static
|
908
|
+
|
909
|
+
}], [{
|
910
|
+
key: '_jQueryInterface',
|
911
|
+
value: function _jQueryInterface(config) {
|
912
|
+
return this.each(function () {
|
913
|
+
var data = $(this).data(DATA_KEY);
|
914
|
+
var _config = $.extend({}, Default, $(this).data());
|
915
|
+
|
916
|
+
if (typeof config === 'object') {
|
917
|
+
$.extend(_config, config);
|
918
|
+
}
|
919
|
+
|
920
|
+
var action = typeof config === 'string' ? config : _config.slide;
|
921
|
+
|
922
|
+
if (!data) {
|
923
|
+
data = new Carousel(this, _config);
|
924
|
+
$(this).data(DATA_KEY, data);
|
925
|
+
}
|
926
|
+
|
927
|
+
if (typeof config === 'number') {
|
928
|
+
data.to(config);
|
929
|
+
} else if (typeof action === 'string') {
|
930
|
+
if (data[action] === undefined) {
|
931
|
+
throw new Error('No method named "' + action + '"');
|
932
|
+
}
|
933
|
+
data[action]();
|
934
|
+
} else if (_config.interval) {
|
935
|
+
data.pause();
|
936
|
+
data.cycle();
|
937
|
+
}
|
938
|
+
});
|
939
|
+
}
|
940
|
+
}, {
|
941
|
+
key: '_dataApiClickHandler',
|
942
|
+
value: function _dataApiClickHandler(event) {
|
943
|
+
var selector = Util.getSelectorFromElement(this);
|
944
|
+
|
945
|
+
if (!selector) {
|
946
|
+
return;
|
947
|
+
}
|
948
|
+
|
949
|
+
var target = $(selector)[0];
|
950
|
+
|
951
|
+
if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
|
952
|
+
return;
|
953
|
+
}
|
954
|
+
|
955
|
+
var config = $.extend({}, $(target).data(), $(this).data());
|
956
|
+
var slideIndex = this.getAttribute('data-slide-to');
|
957
|
+
|
958
|
+
if (slideIndex) {
|
959
|
+
config.interval = false;
|
960
|
+
}
|
961
|
+
|
962
|
+
Carousel._jQueryInterface.call($(target), config);
|
963
|
+
|
964
|
+
if (slideIndex) {
|
965
|
+
$(target).data(DATA_KEY).to(slideIndex);
|
966
|
+
}
|
967
|
+
|
968
|
+
event.preventDefault();
|
969
|
+
}
|
970
|
+
}, {
|
971
|
+
key: 'VERSION',
|
972
|
+
get: function get() {
|
973
|
+
return VERSION;
|
974
|
+
}
|
975
|
+
}, {
|
976
|
+
key: 'Default',
|
977
|
+
get: function get() {
|
978
|
+
return Default;
|
979
|
+
}
|
980
|
+
}]);
|
981
|
+
|
982
|
+
return Carousel;
|
983
|
+
})();
|
984
|
+
|
985
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
986
|
+
|
987
|
+
$(window).on(Event.LOAD_DATA_API, function () {
|
988
|
+
$(Selector.DATA_RIDE).each(function () {
|
989
|
+
var $carousel = $(this);
|
990
|
+
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
991
|
+
});
|
992
|
+
});
|
993
|
+
|
994
|
+
/**
|
995
|
+
* ------------------------------------------------------------------------
|
996
|
+
* jQuery
|
997
|
+
* ------------------------------------------------------------------------
|
998
|
+
*/
|
999
|
+
|
1000
|
+
$.fn[NAME] = Carousel._jQueryInterface;
|
1001
|
+
$.fn[NAME].Constructor = Carousel;
|
1002
|
+
$.fn[NAME].noConflict = function () {
|
1003
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
1004
|
+
return Carousel._jQueryInterface;
|
1005
|
+
};
|
1006
|
+
|
1007
|
+
return Carousel;
|
1008
|
+
})(jQuery);
|
1009
|
+
|
1010
|
+
/**
|
1011
|
+
* --------------------------------------------------------------------------
|
1012
|
+
* Bootstrap (v4.0.0-alpha.2): collapse.js
|
1013
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
1014
|
+
* --------------------------------------------------------------------------
|
1015
|
+
*/
|
1016
|
+
|
1017
|
+
var Collapse = (function ($) {
|
1018
|
+
|
1019
|
+
/**
|
1020
|
+
* ------------------------------------------------------------------------
|
1021
|
+
* Constants
|
1022
|
+
* ------------------------------------------------------------------------
|
1023
|
+
*/
|
1024
|
+
|
1025
|
+
var NAME = 'collapse';
|
1026
|
+
var VERSION = '4.0.0-alpha';
|
1027
|
+
var DATA_KEY = 'bs.collapse';
|
1028
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
1029
|
+
var DATA_API_KEY = '.data-api';
|
1030
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
1031
|
+
var TRANSITION_DURATION = 600;
|
1032
|
+
|
1033
|
+
var Default = {
|
1034
|
+
toggle: true,
|
1035
|
+
parent: ''
|
1036
|
+
};
|
1037
|
+
|
1038
|
+
var DefaultType = {
|
1039
|
+
toggle: 'boolean',
|
1040
|
+
parent: 'string'
|
1041
|
+
};
|
1042
|
+
|
1043
|
+
var Event = {
|
1044
|
+
SHOW: 'show' + EVENT_KEY,
|
1045
|
+
SHOWN: 'shown' + EVENT_KEY,
|
1046
|
+
HIDE: 'hide' + EVENT_KEY,
|
1047
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
1048
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
1049
|
+
};
|
1050
|
+
|
1051
|
+
var ClassName = {
|
1052
|
+
IN: 'in',
|
1053
|
+
COLLAPSE: 'collapse',
|
1054
|
+
COLLAPSING: 'collapsing',
|
1055
|
+
COLLAPSED: 'collapsed'
|
1056
|
+
};
|
1057
|
+
|
1058
|
+
var Dimension = {
|
1059
|
+
WIDTH: 'width',
|
1060
|
+
HEIGHT: 'height'
|
1061
|
+
};
|
1062
|
+
|
1063
|
+
var Selector = {
|
1064
|
+
ACTIVES: '.panel > .in, .panel > .collapsing',
|
1065
|
+
DATA_TOGGLE: '[data-toggle="collapse"]'
|
1066
|
+
};
|
1067
|
+
|
1068
|
+
/**
|
1069
|
+
* ------------------------------------------------------------------------
|
1070
|
+
* Class Definition
|
1071
|
+
* ------------------------------------------------------------------------
|
1072
|
+
*/
|
1073
|
+
|
1074
|
+
var Collapse = (function () {
|
1075
|
+
function Collapse(element, config) {
|
1076
|
+
_classCallCheck(this, Collapse);
|
1077
|
+
|
1078
|
+
this._isTransitioning = false;
|
1079
|
+
this._element = element;
|
1080
|
+
this._config = this._getConfig(config);
|
1081
|
+
this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]')));
|
1082
|
+
|
1083
|
+
this._parent = this._config.parent ? this._getParent() : null;
|
1084
|
+
|
1085
|
+
if (!this._config.parent) {
|
1086
|
+
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
if (this._config.toggle) {
|
1090
|
+
this.toggle();
|
1091
|
+
}
|
1092
|
+
}
|
1093
|
+
|
1094
|
+
/**
|
1095
|
+
* ------------------------------------------------------------------------
|
1096
|
+
* Data Api implementation
|
1097
|
+
* ------------------------------------------------------------------------
|
1098
|
+
*/
|
1099
|
+
|
1100
|
+
// getters
|
1101
|
+
|
1102
|
+
_createClass(Collapse, [{
|
1103
|
+
key: 'toggle',
|
1104
|
+
|
1105
|
+
// public
|
1106
|
+
|
1107
|
+
value: function toggle() {
|
1108
|
+
if ($(this._element).hasClass(ClassName.IN)) {
|
1109
|
+
this.hide();
|
1110
|
+
} else {
|
1111
|
+
this.show();
|
1112
|
+
}
|
1113
|
+
}
|
1114
|
+
}, {
|
1115
|
+
key: 'show',
|
1116
|
+
value: function show() {
|
1117
|
+
var _this4 = this;
|
1118
|
+
|
1119
|
+
if (this._isTransitioning || $(this._element).hasClass(ClassName.IN)) {
|
1120
|
+
return;
|
1121
|
+
}
|
1122
|
+
|
1123
|
+
var actives = undefined;
|
1124
|
+
var activesData = undefined;
|
1125
|
+
|
1126
|
+
if (this._parent) {
|
1127
|
+
actives = $.makeArray($(Selector.ACTIVES));
|
1128
|
+
if (!actives.length) {
|
1129
|
+
actives = null;
|
1130
|
+
}
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
if (actives) {
|
1134
|
+
activesData = $(actives).data(DATA_KEY);
|
1135
|
+
if (activesData && activesData._isTransitioning) {
|
1136
|
+
return;
|
1137
|
+
}
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
var startEvent = $.Event(Event.SHOW);
|
1141
|
+
$(this._element).trigger(startEvent);
|
1142
|
+
if (startEvent.isDefaultPrevented()) {
|
1143
|
+
return;
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
if (actives) {
|
1147
|
+
Collapse._jQueryInterface.call($(actives), 'hide');
|
1148
|
+
if (!activesData) {
|
1149
|
+
$(actives).data(DATA_KEY, null);
|
1150
|
+
}
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
var dimension = this._getDimension();
|
1154
|
+
|
1155
|
+
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
|
1156
|
+
|
1157
|
+
this._element.style[dimension] = 0;
|
1158
|
+
this._element.setAttribute('aria-expanded', true);
|
1159
|
+
|
1160
|
+
if (this._triggerArray.length) {
|
1161
|
+
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
|
1162
|
+
}
|
1163
|
+
|
1164
|
+
this.setTransitioning(true);
|
1165
|
+
|
1166
|
+
var complete = function complete() {
|
1167
|
+
$(_this4._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.IN);
|
1168
|
+
|
1169
|
+
_this4._element.style[dimension] = '';
|
1170
|
+
|
1171
|
+
_this4.setTransitioning(false);
|
1172
|
+
|
1173
|
+
$(_this4._element).trigger(Event.SHOWN);
|
1174
|
+
};
|
1175
|
+
|
1176
|
+
if (!Util.supportsTransitionEnd()) {
|
1177
|
+
complete();
|
1178
|
+
return;
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
1182
|
+
var scrollSize = 'scroll' + capitalizedDimension;
|
1183
|
+
|
1184
|
+
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
1185
|
+
|
1186
|
+
this._element.style[dimension] = this._element[scrollSize] + 'px';
|
1187
|
+
}
|
1188
|
+
}, {
|
1189
|
+
key: 'hide',
|
1190
|
+
value: function hide() {
|
1191
|
+
var _this5 = this;
|
1192
|
+
|
1193
|
+
if (this._isTransitioning || !$(this._element).hasClass(ClassName.IN)) {
|
1194
|
+
return;
|
1195
|
+
}
|
1196
|
+
|
1197
|
+
var startEvent = $.Event(Event.HIDE);
|
1198
|
+
$(this._element).trigger(startEvent);
|
1199
|
+
if (startEvent.isDefaultPrevented()) {
|
1200
|
+
return;
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
var dimension = this._getDimension();
|
1204
|
+
var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight';
|
1205
|
+
|
1206
|
+
this._element.style[dimension] = this._element[offsetDimension] + 'px';
|
1207
|
+
|
1208
|
+
Util.reflow(this._element);
|
1209
|
+
|
1210
|
+
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.IN);
|
1211
|
+
|
1212
|
+
this._element.setAttribute('aria-expanded', false);
|
1213
|
+
|
1214
|
+
if (this._triggerArray.length) {
|
1215
|
+
$(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
this.setTransitioning(true);
|
1219
|
+
|
1220
|
+
var complete = function complete() {
|
1221
|
+
_this5.setTransitioning(false);
|
1222
|
+
$(_this5._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
|
1223
|
+
};
|
1224
|
+
|
1225
|
+
this._element.style[dimension] = 0;
|
1226
|
+
|
1227
|
+
if (!Util.supportsTransitionEnd()) {
|
1228
|
+
complete();
|
1229
|
+
return;
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
1233
|
+
}
|
1234
|
+
}, {
|
1235
|
+
key: 'setTransitioning',
|
1236
|
+
value: function setTransitioning(isTransitioning) {
|
1237
|
+
this._isTransitioning = isTransitioning;
|
1238
|
+
}
|
1239
|
+
}, {
|
1240
|
+
key: 'dispose',
|
1241
|
+
value: function dispose() {
|
1242
|
+
$.removeData(this._element, DATA_KEY);
|
1243
|
+
|
1244
|
+
this._config = null;
|
1245
|
+
this._parent = null;
|
1246
|
+
this._element = null;
|
1247
|
+
this._triggerArray = null;
|
1248
|
+
this._isTransitioning = null;
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
// private
|
1252
|
+
|
1253
|
+
}, {
|
1254
|
+
key: '_getConfig',
|
1255
|
+
value: function _getConfig(config) {
|
1256
|
+
config = $.extend({}, Default, config);
|
1257
|
+
config.toggle = Boolean(config.toggle); // coerce string values
|
1258
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
1259
|
+
return config;
|
1260
|
+
}
|
1261
|
+
}, {
|
1262
|
+
key: '_getDimension',
|
1263
|
+
value: function _getDimension() {
|
1264
|
+
var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
|
1265
|
+
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
|
1266
|
+
}
|
1267
|
+
}, {
|
1268
|
+
key: '_getParent',
|
1269
|
+
value: function _getParent() {
|
1270
|
+
var _this6 = this;
|
1271
|
+
|
1272
|
+
var parent = $(this._config.parent)[0];
|
1273
|
+
var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]';
|
1274
|
+
|
1275
|
+
$(parent).find(selector).each(function (i, element) {
|
1276
|
+
_this6._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
1277
|
+
});
|
1278
|
+
|
1279
|
+
return parent;
|
1280
|
+
}
|
1281
|
+
}, {
|
1282
|
+
key: '_addAriaAndCollapsedClass',
|
1283
|
+
value: function _addAriaAndCollapsedClass(element, triggerArray) {
|
1284
|
+
if (element) {
|
1285
|
+
var isOpen = $(element).hasClass(ClassName.IN);
|
1286
|
+
element.setAttribute('aria-expanded', isOpen);
|
1287
|
+
|
1288
|
+
if (triggerArray.length) {
|
1289
|
+
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
1290
|
+
}
|
1291
|
+
}
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
// static
|
1295
|
+
|
1296
|
+
}], [{
|
1297
|
+
key: '_getTargetFromElement',
|
1298
|
+
value: function _getTargetFromElement(element) {
|
1299
|
+
var selector = Util.getSelectorFromElement(element);
|
1300
|
+
return selector ? $(selector)[0] : null;
|
1301
|
+
}
|
1302
|
+
}, {
|
1303
|
+
key: '_jQueryInterface',
|
1304
|
+
value: function _jQueryInterface(config) {
|
1305
|
+
return this.each(function () {
|
1306
|
+
var $this = $(this);
|
1307
|
+
var data = $this.data(DATA_KEY);
|
1308
|
+
var _config = $.extend({}, Default, $this.data(), typeof config === 'object' && config);
|
1309
|
+
|
1310
|
+
if (!data && _config.toggle && /show|hide/.test(config)) {
|
1311
|
+
_config.toggle = false;
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
if (!data) {
|
1315
|
+
data = new Collapse(this, _config);
|
1316
|
+
$this.data(DATA_KEY, data);
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
if (typeof config === 'string') {
|
1320
|
+
if (data[config] === undefined) {
|
1321
|
+
throw new Error('No method named "' + config + '"');
|
1322
|
+
}
|
1323
|
+
data[config]();
|
1324
|
+
}
|
1325
|
+
});
|
1326
|
+
}
|
1327
|
+
}, {
|
1328
|
+
key: 'VERSION',
|
1329
|
+
get: function get() {
|
1330
|
+
return VERSION;
|
1331
|
+
}
|
1332
|
+
}, {
|
1333
|
+
key: 'Default',
|
1334
|
+
get: function get() {
|
1335
|
+
return Default;
|
1336
|
+
}
|
1337
|
+
}]);
|
1338
|
+
|
1339
|
+
return Collapse;
|
1340
|
+
})();
|
1341
|
+
|
1342
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
1343
|
+
event.preventDefault();
|
1344
|
+
|
1345
|
+
var target = Collapse._getTargetFromElement(this);
|
1346
|
+
var data = $(target).data(DATA_KEY);
|
1347
|
+
var config = data ? 'toggle' : $(this).data();
|
1348
|
+
|
1349
|
+
Collapse._jQueryInterface.call($(target), config);
|
1350
|
+
});
|
1351
|
+
|
1352
|
+
/**
|
1353
|
+
* ------------------------------------------------------------------------
|
1354
|
+
* jQuery
|
1355
|
+
* ------------------------------------------------------------------------
|
1356
|
+
*/
|
1357
|
+
|
1358
|
+
$.fn[NAME] = Collapse._jQueryInterface;
|
1359
|
+
$.fn[NAME].Constructor = Collapse;
|
1360
|
+
$.fn[NAME].noConflict = function () {
|
1361
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
1362
|
+
return Collapse._jQueryInterface;
|
1363
|
+
};
|
1364
|
+
|
1365
|
+
return Collapse;
|
1366
|
+
})(jQuery);
|
1367
|
+
|
1368
|
+
/**
|
1369
|
+
* --------------------------------------------------------------------------
|
1370
|
+
* Bootstrap (v4.0.0-alpha.2): dropdown.js
|
1371
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
1372
|
+
* --------------------------------------------------------------------------
|
1373
|
+
*/
|
1374
|
+
|
1375
|
+
var Dropdown = (function ($) {
|
1376
|
+
|
1377
|
+
/**
|
1378
|
+
* ------------------------------------------------------------------------
|
1379
|
+
* Constants
|
1380
|
+
* ------------------------------------------------------------------------
|
1381
|
+
*/
|
1382
|
+
|
1383
|
+
var NAME = 'dropdown';
|
1384
|
+
var VERSION = '4.0.0-alpha';
|
1385
|
+
var DATA_KEY = 'bs.dropdown';
|
1386
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
1387
|
+
var DATA_API_KEY = '.data-api';
|
1388
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
1389
|
+
|
1390
|
+
var Event = {
|
1391
|
+
HIDE: 'hide' + EVENT_KEY,
|
1392
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
1393
|
+
SHOW: 'show' + EVENT_KEY,
|
1394
|
+
SHOWN: 'shown' + EVENT_KEY,
|
1395
|
+
CLICK: 'click' + EVENT_KEY,
|
1396
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
|
1397
|
+
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
|
1398
|
+
};
|
1399
|
+
|
1400
|
+
var ClassName = {
|
1401
|
+
BACKDROP: 'dropdown-backdrop',
|
1402
|
+
DISABLED: 'disabled',
|
1403
|
+
OPEN: 'open'
|
1404
|
+
};
|
1405
|
+
|
1406
|
+
var Selector = {
|
1407
|
+
BACKDROP: '.dropdown-backdrop',
|
1408
|
+
DATA_TOGGLE: '[data-toggle="dropdown"]',
|
1409
|
+
FORM_CHILD: '.dropdown form',
|
1410
|
+
ROLE_MENU: '[role="menu"]',
|
1411
|
+
ROLE_LISTBOX: '[role="listbox"]',
|
1412
|
+
NAVBAR_NAV: '.navbar-nav',
|
1413
|
+
VISIBLE_ITEMS: '[role="menu"] li:not(.disabled) a, ' + '[role="listbox"] li:not(.disabled) a'
|
1414
|
+
};
|
1415
|
+
|
1416
|
+
/**
|
1417
|
+
* ------------------------------------------------------------------------
|
1418
|
+
* Class Definition
|
1419
|
+
* ------------------------------------------------------------------------
|
1420
|
+
*/
|
1421
|
+
|
1422
|
+
var Dropdown = (function () {
|
1423
|
+
function Dropdown(element) {
|
1424
|
+
_classCallCheck(this, Dropdown);
|
1425
|
+
|
1426
|
+
this._element = element;
|
1427
|
+
|
1428
|
+
this._addEventListeners();
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
/**
|
1432
|
+
* ------------------------------------------------------------------------
|
1433
|
+
* Data Api implementation
|
1434
|
+
* ------------------------------------------------------------------------
|
1435
|
+
*/
|
1436
|
+
|
1437
|
+
// getters
|
1438
|
+
|
1439
|
+
_createClass(Dropdown, [{
|
1440
|
+
key: 'toggle',
|
1441
|
+
|
1442
|
+
// public
|
1443
|
+
|
1444
|
+
value: function toggle() {
|
1445
|
+
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
|
1446
|
+
return false;
|
1447
|
+
}
|
1448
|
+
|
1449
|
+
var parent = Dropdown._getParentFromElement(this);
|
1450
|
+
var isActive = $(parent).hasClass(ClassName.OPEN);
|
1451
|
+
|
1452
|
+
Dropdown._clearMenus();
|
1453
|
+
|
1454
|
+
if (isActive) {
|
1455
|
+
return false;
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) {
|
1459
|
+
|
1460
|
+
// if mobile we use a backdrop because click events don't delegate
|
1461
|
+
var dropdown = document.createElement('div');
|
1462
|
+
dropdown.className = ClassName.BACKDROP;
|
1463
|
+
$(dropdown).insertBefore(this);
|
1464
|
+
$(dropdown).on('click', Dropdown._clearMenus);
|
1465
|
+
}
|
1466
|
+
|
1467
|
+
var relatedTarget = { relatedTarget: this };
|
1468
|
+
var showEvent = $.Event(Event.SHOW, relatedTarget);
|
1469
|
+
|
1470
|
+
$(parent).trigger(showEvent);
|
1471
|
+
|
1472
|
+
if (showEvent.isDefaultPrevented()) {
|
1473
|
+
return false;
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
this.focus();
|
1477
|
+
this.setAttribute('aria-expanded', 'true');
|
1478
|
+
|
1479
|
+
$(parent).toggleClass(ClassName.OPEN);
|
1480
|
+
$(parent).trigger($.Event(Event.SHOWN, relatedTarget));
|
1481
|
+
|
1482
|
+
return false;
|
1483
|
+
}
|
1484
|
+
}, {
|
1485
|
+
key: 'dispose',
|
1486
|
+
value: function dispose() {
|
1487
|
+
$.removeData(this._element, DATA_KEY);
|
1488
|
+
$(this._element).off(EVENT_KEY);
|
1489
|
+
this._element = null;
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
// private
|
1493
|
+
|
1494
|
+
}, {
|
1495
|
+
key: '_addEventListeners',
|
1496
|
+
value: function _addEventListeners() {
|
1497
|
+
$(this._element).on(Event.CLICK, this.toggle);
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
// static
|
1501
|
+
|
1502
|
+
}], [{
|
1503
|
+
key: '_jQueryInterface',
|
1504
|
+
value: function _jQueryInterface(config) {
|
1505
|
+
return this.each(function () {
|
1506
|
+
var data = $(this).data(DATA_KEY);
|
1507
|
+
|
1508
|
+
if (!data) {
|
1509
|
+
$(this).data(DATA_KEY, data = new Dropdown(this));
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
if (typeof config === 'string') {
|
1513
|
+
if (data[config] === undefined) {
|
1514
|
+
throw new Error('No method named "' + config + '"');
|
1515
|
+
}
|
1516
|
+
data[config].call(this);
|
1517
|
+
}
|
1518
|
+
});
|
1519
|
+
}
|
1520
|
+
}, {
|
1521
|
+
key: '_clearMenus',
|
1522
|
+
value: function _clearMenus(event) {
|
1523
|
+
if (event && event.which === 3) {
|
1524
|
+
return;
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
var backdrop = $(Selector.BACKDROP)[0];
|
1528
|
+
if (backdrop) {
|
1529
|
+
backdrop.parentNode.removeChild(backdrop);
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
var toggles = $.makeArray($(Selector.DATA_TOGGLE));
|
1533
|
+
|
1534
|
+
for (var i = 0; i < toggles.length; i++) {
|
1535
|
+
var _parent = Dropdown._getParentFromElement(toggles[i]);
|
1536
|
+
var relatedTarget = { relatedTarget: toggles[i] };
|
1537
|
+
|
1538
|
+
if (!$(_parent).hasClass(ClassName.OPEN)) {
|
1539
|
+
continue;
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
if (event && event.type === 'click' && /input|textarea/i.test(event.target.tagName) && $.contains(_parent, event.target)) {
|
1543
|
+
continue;
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
var hideEvent = $.Event(Event.HIDE, relatedTarget);
|
1547
|
+
$(_parent).trigger(hideEvent);
|
1548
|
+
if (hideEvent.isDefaultPrevented()) {
|
1549
|
+
continue;
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
toggles[i].setAttribute('aria-expanded', 'false');
|
1553
|
+
|
1554
|
+
$(_parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget));
|
1555
|
+
}
|
1556
|
+
}
|
1557
|
+
}, {
|
1558
|
+
key: '_getParentFromElement',
|
1559
|
+
value: function _getParentFromElement(element) {
|
1560
|
+
var parent = undefined;
|
1561
|
+
var selector = Util.getSelectorFromElement(element);
|
1562
|
+
|
1563
|
+
if (selector) {
|
1564
|
+
parent = $(selector)[0];
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
return parent || element.parentNode;
|
1568
|
+
}
|
1569
|
+
}, {
|
1570
|
+
key: '_dataApiKeydownHandler',
|
1571
|
+
value: function _dataApiKeydownHandler(event) {
|
1572
|
+
if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
|
1573
|
+
return;
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
event.preventDefault();
|
1577
|
+
event.stopPropagation();
|
1578
|
+
|
1579
|
+
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
|
1580
|
+
return;
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
var parent = Dropdown._getParentFromElement(this);
|
1584
|
+
var isActive = $(parent).hasClass(ClassName.OPEN);
|
1585
|
+
|
1586
|
+
if (!isActive && event.which !== 27 || isActive && event.which === 27) {
|
1587
|
+
|
1588
|
+
if (event.which === 27) {
|
1589
|
+
var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
|
1590
|
+
$(toggle).trigger('focus');
|
1591
|
+
}
|
1592
|
+
|
1593
|
+
$(this).trigger('click');
|
1594
|
+
return;
|
1595
|
+
}
|
1596
|
+
|
1597
|
+
var items = $.makeArray($(Selector.VISIBLE_ITEMS));
|
1598
|
+
|
1599
|
+
items = items.filter(function (item) {
|
1600
|
+
return item.offsetWidth || item.offsetHeight;
|
1601
|
+
});
|
1602
|
+
|
1603
|
+
if (!items.length) {
|
1604
|
+
return;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
var index = items.indexOf(event.target);
|
1608
|
+
|
1609
|
+
if (event.which === 38 && index > 0) {
|
1610
|
+
// up
|
1611
|
+
index--;
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
if (event.which === 40 && index < items.length - 1) {
|
1615
|
+
// down
|
1616
|
+
index++;
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
if (! ~index) {
|
1620
|
+
index = 0;
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
items[index].focus();
|
1624
|
+
}
|
1625
|
+
}, {
|
1626
|
+
key: 'VERSION',
|
1627
|
+
get: function get() {
|
1628
|
+
return VERSION;
|
1629
|
+
}
|
1630
|
+
}]);
|
1631
|
+
|
1632
|
+
return Dropdown;
|
1633
|
+
})();
|
1634
|
+
|
1635
|
+
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
1636
|
+
e.stopPropagation();
|
1637
|
+
});
|
1638
|
+
|
1639
|
+
/**
|
1640
|
+
* ------------------------------------------------------------------------
|
1641
|
+
* jQuery
|
1642
|
+
* ------------------------------------------------------------------------
|
1643
|
+
*/
|
1644
|
+
|
1645
|
+
$.fn[NAME] = Dropdown._jQueryInterface;
|
1646
|
+
$.fn[NAME].Constructor = Dropdown;
|
1647
|
+
$.fn[NAME].noConflict = function () {
|
1648
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
1649
|
+
return Dropdown._jQueryInterface;
|
1650
|
+
};
|
1651
|
+
|
1652
|
+
return Dropdown;
|
1653
|
+
})(jQuery);
|
1654
|
+
|
1655
|
+
/**
|
1656
|
+
* --------------------------------------------------------------------------
|
1657
|
+
* Bootstrap (v4.0.0-alpha.2): modal.js
|
1658
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
1659
|
+
* --------------------------------------------------------------------------
|
1660
|
+
*/
|
1661
|
+
|
1662
|
+
var Modal = (function ($) {
|
1663
|
+
|
1664
|
+
/**
|
1665
|
+
* ------------------------------------------------------------------------
|
1666
|
+
* Constants
|
1667
|
+
* ------------------------------------------------------------------------
|
1668
|
+
*/
|
1669
|
+
|
1670
|
+
var NAME = 'modal';
|
1671
|
+
var VERSION = '4.0.0-alpha';
|
1672
|
+
var DATA_KEY = 'bs.modal';
|
1673
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
1674
|
+
var DATA_API_KEY = '.data-api';
|
1675
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
1676
|
+
var TRANSITION_DURATION = 300;
|
1677
|
+
var BACKDROP_TRANSITION_DURATION = 150;
|
1678
|
+
|
1679
|
+
var Default = {
|
1680
|
+
backdrop: true,
|
1681
|
+
keyboard: true,
|
1682
|
+
focus: true,
|
1683
|
+
show: true
|
1684
|
+
};
|
1685
|
+
|
1686
|
+
var DefaultType = {
|
1687
|
+
backdrop: '(boolean|string)',
|
1688
|
+
keyboard: 'boolean',
|
1689
|
+
focus: 'boolean',
|
1690
|
+
show: 'boolean'
|
1691
|
+
};
|
1692
|
+
|
1693
|
+
var Event = {
|
1694
|
+
HIDE: 'hide' + EVENT_KEY,
|
1695
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
1696
|
+
SHOW: 'show' + EVENT_KEY,
|
1697
|
+
SHOWN: 'shown' + EVENT_KEY,
|
1698
|
+
FOCUSIN: 'focusin' + EVENT_KEY,
|
1699
|
+
RESIZE: 'resize' + EVENT_KEY,
|
1700
|
+
CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
|
1701
|
+
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
|
1702
|
+
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
|
1703
|
+
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
|
1704
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
1705
|
+
};
|
1706
|
+
|
1707
|
+
var ClassName = {
|
1708
|
+
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
|
1709
|
+
BACKDROP: 'modal-backdrop',
|
1710
|
+
OPEN: 'modal-open',
|
1711
|
+
FADE: 'fade',
|
1712
|
+
IN: 'in'
|
1713
|
+
};
|
1714
|
+
|
1715
|
+
var Selector = {
|
1716
|
+
DIALOG: '.modal-dialog',
|
1717
|
+
DATA_TOGGLE: '[data-toggle="modal"]',
|
1718
|
+
DATA_DISMISS: '[data-dismiss="modal"]',
|
1719
|
+
FIXED_CONTENT: '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
|
1720
|
+
};
|
1721
|
+
|
1722
|
+
/**
|
1723
|
+
* ------------------------------------------------------------------------
|
1724
|
+
* Class Definition
|
1725
|
+
* ------------------------------------------------------------------------
|
1726
|
+
*/
|
1727
|
+
|
1728
|
+
var Modal = (function () {
|
1729
|
+
function Modal(element, config) {
|
1730
|
+
_classCallCheck(this, Modal);
|
1731
|
+
|
1732
|
+
this._config = this._getConfig(config);
|
1733
|
+
this._element = element;
|
1734
|
+
this._dialog = $(element).find(Selector.DIALOG)[0];
|
1735
|
+
this._backdrop = null;
|
1736
|
+
this._isShown = false;
|
1737
|
+
this._isBodyOverflowing = false;
|
1738
|
+
this._ignoreBackdropClick = false;
|
1739
|
+
this._originalBodyPadding = 0;
|
1740
|
+
this._scrollbarWidth = 0;
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
/**
|
1744
|
+
* ------------------------------------------------------------------------
|
1745
|
+
* Data Api implementation
|
1746
|
+
* ------------------------------------------------------------------------
|
1747
|
+
*/
|
1748
|
+
|
1749
|
+
// getters
|
1750
|
+
|
1751
|
+
_createClass(Modal, [{
|
1752
|
+
key: 'toggle',
|
1753
|
+
|
1754
|
+
// public
|
1755
|
+
|
1756
|
+
value: function toggle(relatedTarget) {
|
1757
|
+
return this._isShown ? this.hide() : this.show(relatedTarget);
|
1758
|
+
}
|
1759
|
+
}, {
|
1760
|
+
key: 'show',
|
1761
|
+
value: function show(relatedTarget) {
|
1762
|
+
var _this7 = this;
|
1763
|
+
|
1764
|
+
var showEvent = $.Event(Event.SHOW, {
|
1765
|
+
relatedTarget: relatedTarget
|
1766
|
+
});
|
1767
|
+
|
1768
|
+
$(this._element).trigger(showEvent);
|
1769
|
+
|
1770
|
+
if (this._isShown || showEvent.isDefaultPrevented()) {
|
1771
|
+
return;
|
1772
|
+
}
|
1773
|
+
|
1774
|
+
this._isShown = true;
|
1775
|
+
|
1776
|
+
this._checkScrollbar();
|
1777
|
+
this._setScrollbar();
|
1778
|
+
|
1779
|
+
$(document.body).addClass(ClassName.OPEN);
|
1780
|
+
|
1781
|
+
this._setEscapeEvent();
|
1782
|
+
this._setResizeEvent();
|
1783
|
+
|
1784
|
+
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
|
1785
|
+
|
1786
|
+
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
1787
|
+
$(_this7._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
1788
|
+
if ($(event.target).is(_this7._element)) {
|
1789
|
+
_this7._ignoreBackdropClick = true;
|
1790
|
+
}
|
1791
|
+
});
|
1792
|
+
});
|
1793
|
+
|
1794
|
+
this._showBackdrop($.proxy(this._showElement, this, relatedTarget));
|
1795
|
+
}
|
1796
|
+
}, {
|
1797
|
+
key: 'hide',
|
1798
|
+
value: function hide(event) {
|
1799
|
+
if (event) {
|
1800
|
+
event.preventDefault();
|
1801
|
+
}
|
1802
|
+
|
1803
|
+
var hideEvent = $.Event(Event.HIDE);
|
1804
|
+
|
1805
|
+
$(this._element).trigger(hideEvent);
|
1806
|
+
|
1807
|
+
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
1808
|
+
return;
|
1809
|
+
}
|
1810
|
+
|
1811
|
+
this._isShown = false;
|
1812
|
+
|
1813
|
+
this._setEscapeEvent();
|
1814
|
+
this._setResizeEvent();
|
1815
|
+
|
1816
|
+
$(document).off(Event.FOCUSIN);
|
1817
|
+
|
1818
|
+
$(this._element).removeClass(ClassName.IN);
|
1819
|
+
|
1820
|
+
$(this._element).off(Event.CLICK_DISMISS);
|
1821
|
+
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
1822
|
+
|
1823
|
+
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
1824
|
+
|
1825
|
+
$(this._element).one(Util.TRANSITION_END, $.proxy(this._hideModal, this)).emulateTransitionEnd(TRANSITION_DURATION);
|
1826
|
+
} else {
|
1827
|
+
this._hideModal();
|
1828
|
+
}
|
1829
|
+
}
|
1830
|
+
}, {
|
1831
|
+
key: 'dispose',
|
1832
|
+
value: function dispose() {
|
1833
|
+
$.removeData(this._element, DATA_KEY);
|
1834
|
+
|
1835
|
+
$(window).off(EVENT_KEY);
|
1836
|
+
$(document).off(EVENT_KEY);
|
1837
|
+
$(this._element).off(EVENT_KEY);
|
1838
|
+
$(this._backdrop).off(EVENT_KEY);
|
1839
|
+
|
1840
|
+
this._config = null;
|
1841
|
+
this._element = null;
|
1842
|
+
this._dialog = null;
|
1843
|
+
this._backdrop = null;
|
1844
|
+
this._isShown = null;
|
1845
|
+
this._isBodyOverflowing = null;
|
1846
|
+
this._ignoreBackdropClick = null;
|
1847
|
+
this._originalBodyPadding = null;
|
1848
|
+
this._scrollbarWidth = null;
|
1849
|
+
}
|
1850
|
+
|
1851
|
+
// private
|
1852
|
+
|
1853
|
+
}, {
|
1854
|
+
key: '_getConfig',
|
1855
|
+
value: function _getConfig(config) {
|
1856
|
+
config = $.extend({}, Default, config);
|
1857
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
1858
|
+
return config;
|
1859
|
+
}
|
1860
|
+
}, {
|
1861
|
+
key: '_showElement',
|
1862
|
+
value: function _showElement(relatedTarget) {
|
1863
|
+
var _this8 = this;
|
1864
|
+
|
1865
|
+
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
|
1866
|
+
|
1867
|
+
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
1868
|
+
// don't move modals dom position
|
1869
|
+
document.body.appendChild(this._element);
|
1870
|
+
}
|
1871
|
+
|
1872
|
+
this._element.style.display = 'block';
|
1873
|
+
this._element.scrollTop = 0;
|
1874
|
+
|
1875
|
+
if (transition) {
|
1876
|
+
Util.reflow(this._element);
|
1877
|
+
}
|
1878
|
+
|
1879
|
+
$(this._element).addClass(ClassName.IN);
|
1880
|
+
|
1881
|
+
if (this._config.focus) {
|
1882
|
+
this._enforceFocus();
|
1883
|
+
}
|
1884
|
+
|
1885
|
+
var shownEvent = $.Event(Event.SHOWN, {
|
1886
|
+
relatedTarget: relatedTarget
|
1887
|
+
});
|
1888
|
+
|
1889
|
+
var transitionComplete = function transitionComplete() {
|
1890
|
+
if (_this8._config.focus) {
|
1891
|
+
_this8._element.focus();
|
1892
|
+
}
|
1893
|
+
$(_this8._element).trigger(shownEvent);
|
1894
|
+
};
|
1895
|
+
|
1896
|
+
if (transition) {
|
1897
|
+
$(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
|
1898
|
+
} else {
|
1899
|
+
transitionComplete();
|
1900
|
+
}
|
1901
|
+
}
|
1902
|
+
}, {
|
1903
|
+
key: '_enforceFocus',
|
1904
|
+
value: function _enforceFocus() {
|
1905
|
+
var _this9 = this;
|
1906
|
+
|
1907
|
+
$(document).off(Event.FOCUSIN) // guard against infinite focus loop
|
1908
|
+
.on(Event.FOCUSIN, function (event) {
|
1909
|
+
if (_this9._element !== event.target && !$(_this9._element).has(event.target).length) {
|
1910
|
+
_this9._element.focus();
|
1911
|
+
}
|
1912
|
+
});
|
1913
|
+
}
|
1914
|
+
}, {
|
1915
|
+
key: '_setEscapeEvent',
|
1916
|
+
value: function _setEscapeEvent() {
|
1917
|
+
var _this10 = this;
|
1918
|
+
|
1919
|
+
if (this._isShown && this._config.keyboard) {
|
1920
|
+
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
1921
|
+
if (event.which === 27) {
|
1922
|
+
_this10.hide();
|
1923
|
+
}
|
1924
|
+
});
|
1925
|
+
} else if (!this._isShown) {
|
1926
|
+
$(this._element).off(Event.KEYDOWN_DISMISS);
|
1927
|
+
}
|
1928
|
+
}
|
1929
|
+
}, {
|
1930
|
+
key: '_setResizeEvent',
|
1931
|
+
value: function _setResizeEvent() {
|
1932
|
+
if (this._isShown) {
|
1933
|
+
$(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this));
|
1934
|
+
} else {
|
1935
|
+
$(window).off(Event.RESIZE);
|
1936
|
+
}
|
1937
|
+
}
|
1938
|
+
}, {
|
1939
|
+
key: '_hideModal',
|
1940
|
+
value: function _hideModal() {
|
1941
|
+
var _this11 = this;
|
1942
|
+
|
1943
|
+
this._element.style.display = 'none';
|
1944
|
+
this._showBackdrop(function () {
|
1945
|
+
$(document.body).removeClass(ClassName.OPEN);
|
1946
|
+
_this11._resetAdjustments();
|
1947
|
+
_this11._resetScrollbar();
|
1948
|
+
$(_this11._element).trigger(Event.HIDDEN);
|
1949
|
+
});
|
1950
|
+
}
|
1951
|
+
}, {
|
1952
|
+
key: '_removeBackdrop',
|
1953
|
+
value: function _removeBackdrop() {
|
1954
|
+
if (this._backdrop) {
|
1955
|
+
$(this._backdrop).remove();
|
1956
|
+
this._backdrop = null;
|
1957
|
+
}
|
1958
|
+
}
|
1959
|
+
}, {
|
1960
|
+
key: '_showBackdrop',
|
1961
|
+
value: function _showBackdrop(callback) {
|
1962
|
+
var _this12 = this;
|
1963
|
+
|
1964
|
+
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
|
1965
|
+
|
1966
|
+
if (this._isShown && this._config.backdrop) {
|
1967
|
+
var doAnimate = Util.supportsTransitionEnd() && animate;
|
1968
|
+
|
1969
|
+
this._backdrop = document.createElement('div');
|
1970
|
+
this._backdrop.className = ClassName.BACKDROP;
|
1971
|
+
|
1972
|
+
if (animate) {
|
1973
|
+
$(this._backdrop).addClass(animate);
|
1974
|
+
}
|
1975
|
+
|
1976
|
+
$(this._backdrop).appendTo(document.body);
|
1977
|
+
|
1978
|
+
$(this._element).on(Event.CLICK_DISMISS, function (event) {
|
1979
|
+
if (_this12._ignoreBackdropClick) {
|
1980
|
+
_this12._ignoreBackdropClick = false;
|
1981
|
+
return;
|
1982
|
+
}
|
1983
|
+
if (event.target !== event.currentTarget) {
|
1984
|
+
return;
|
1985
|
+
}
|
1986
|
+
if (_this12._config.backdrop === 'static') {
|
1987
|
+
_this12._element.focus();
|
1988
|
+
} else {
|
1989
|
+
_this12.hide();
|
1990
|
+
}
|
1991
|
+
});
|
1992
|
+
|
1993
|
+
if (doAnimate) {
|
1994
|
+
Util.reflow(this._backdrop);
|
1995
|
+
}
|
1996
|
+
|
1997
|
+
$(this._backdrop).addClass(ClassName.IN);
|
1998
|
+
|
1999
|
+
if (!callback) {
|
2000
|
+
return;
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
if (!doAnimate) {
|
2004
|
+
callback();
|
2005
|
+
return;
|
2006
|
+
}
|
2007
|
+
|
2008
|
+
$(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
|
2009
|
+
} else if (!this._isShown && this._backdrop) {
|
2010
|
+
$(this._backdrop).removeClass(ClassName.IN);
|
2011
|
+
|
2012
|
+
var callbackRemove = function callbackRemove() {
|
2013
|
+
_this12._removeBackdrop();
|
2014
|
+
if (callback) {
|
2015
|
+
callback();
|
2016
|
+
}
|
2017
|
+
};
|
2018
|
+
|
2019
|
+
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
2020
|
+
$(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
|
2021
|
+
} else {
|
2022
|
+
callbackRemove();
|
2023
|
+
}
|
2024
|
+
} else if (callback) {
|
2025
|
+
callback();
|
2026
|
+
}
|
2027
|
+
}
|
2028
|
+
|
2029
|
+
// ----------------------------------------------------------------------
|
2030
|
+
// the following methods are used to handle overflowing modals
|
2031
|
+
// todo (fat): these should probably be refactored out of modal.js
|
2032
|
+
// ----------------------------------------------------------------------
|
2033
|
+
|
2034
|
+
}, {
|
2035
|
+
key: '_handleUpdate',
|
2036
|
+
value: function _handleUpdate() {
|
2037
|
+
this._adjustDialog();
|
2038
|
+
}
|
2039
|
+
}, {
|
2040
|
+
key: '_adjustDialog',
|
2041
|
+
value: function _adjustDialog() {
|
2042
|
+
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
2043
|
+
|
2044
|
+
if (!this._isBodyOverflowing && isModalOverflowing) {
|
2045
|
+
this._element.style.paddingLeft = this._scrollbarWidth + 'px';
|
2046
|
+
}
|
2047
|
+
|
2048
|
+
if (this._isBodyOverflowing && !isModalOverflowing) {
|
2049
|
+
this._element.style.paddingRight = this._scrollbarWidth + 'px~';
|
2050
|
+
}
|
2051
|
+
}
|
2052
|
+
}, {
|
2053
|
+
key: '_resetAdjustments',
|
2054
|
+
value: function _resetAdjustments() {
|
2055
|
+
this._element.style.paddingLeft = '';
|
2056
|
+
this._element.style.paddingRight = '';
|
2057
|
+
}
|
2058
|
+
}, {
|
2059
|
+
key: '_checkScrollbar',
|
2060
|
+
value: function _checkScrollbar() {
|
2061
|
+
var fullWindowWidth = window.innerWidth;
|
2062
|
+
if (!fullWindowWidth) {
|
2063
|
+
// workaround for missing window.innerWidth in IE8
|
2064
|
+
var documentElementRect = document.documentElement.getBoundingClientRect();
|
2065
|
+
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
|
2066
|
+
}
|
2067
|
+
this._isBodyOverflowing = document.body.clientWidth < fullWindowWidth;
|
2068
|
+
this._scrollbarWidth = this._getScrollbarWidth();
|
2069
|
+
}
|
2070
|
+
}, {
|
2071
|
+
key: '_setScrollbar',
|
2072
|
+
value: function _setScrollbar() {
|
2073
|
+
var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
|
2074
|
+
|
2075
|
+
this._originalBodyPadding = document.body.style.paddingRight || '';
|
2076
|
+
|
2077
|
+
if (this._isBodyOverflowing) {
|
2078
|
+
document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px';
|
2079
|
+
}
|
2080
|
+
}
|
2081
|
+
}, {
|
2082
|
+
key: '_resetScrollbar',
|
2083
|
+
value: function _resetScrollbar() {
|
2084
|
+
document.body.style.paddingRight = this._originalBodyPadding;
|
2085
|
+
}
|
2086
|
+
}, {
|
2087
|
+
key: '_getScrollbarWidth',
|
2088
|
+
value: function _getScrollbarWidth() {
|
2089
|
+
// thx d.walsh
|
2090
|
+
var scrollDiv = document.createElement('div');
|
2091
|
+
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
|
2092
|
+
document.body.appendChild(scrollDiv);
|
2093
|
+
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
2094
|
+
document.body.removeChild(scrollDiv);
|
2095
|
+
return scrollbarWidth;
|
2096
|
+
}
|
2097
|
+
|
2098
|
+
// static
|
2099
|
+
|
2100
|
+
}], [{
|
2101
|
+
key: '_jQueryInterface',
|
2102
|
+
value: function _jQueryInterface(config, relatedTarget) {
|
2103
|
+
return this.each(function () {
|
2104
|
+
var data = $(this).data(DATA_KEY);
|
2105
|
+
var _config = $.extend({}, Modal.Default, $(this).data(), typeof config === 'object' && config);
|
2106
|
+
|
2107
|
+
if (!data) {
|
2108
|
+
data = new Modal(this, _config);
|
2109
|
+
$(this).data(DATA_KEY, data);
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
if (typeof config === 'string') {
|
2113
|
+
if (data[config] === undefined) {
|
2114
|
+
throw new Error('No method named "' + config + '"');
|
2115
|
+
}
|
2116
|
+
data[config](relatedTarget);
|
2117
|
+
} else if (_config.show) {
|
2118
|
+
data.show(relatedTarget);
|
2119
|
+
}
|
2120
|
+
});
|
2121
|
+
}
|
2122
|
+
}, {
|
2123
|
+
key: 'VERSION',
|
2124
|
+
get: function get() {
|
2125
|
+
return VERSION;
|
2126
|
+
}
|
2127
|
+
}, {
|
2128
|
+
key: 'Default',
|
2129
|
+
get: function get() {
|
2130
|
+
return Default;
|
2131
|
+
}
|
2132
|
+
}]);
|
2133
|
+
|
2134
|
+
return Modal;
|
2135
|
+
})();
|
2136
|
+
|
2137
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
2138
|
+
var _this13 = this;
|
2139
|
+
|
2140
|
+
var target = undefined;
|
2141
|
+
var selector = Util.getSelectorFromElement(this);
|
2142
|
+
|
2143
|
+
if (selector) {
|
2144
|
+
target = $(selector)[0];
|
2145
|
+
}
|
2146
|
+
|
2147
|
+
var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
|
2148
|
+
|
2149
|
+
if (this.tagName === 'A') {
|
2150
|
+
event.preventDefault();
|
2151
|
+
}
|
2152
|
+
|
2153
|
+
var $target = $(target).one(Event.SHOW, function (showEvent) {
|
2154
|
+
if (showEvent.isDefaultPrevented()) {
|
2155
|
+
// only register focus restorer if modal will actually get shown
|
2156
|
+
return;
|
2157
|
+
}
|
2158
|
+
|
2159
|
+
$target.one(Event.HIDDEN, function () {
|
2160
|
+
if ($(_this13).is(':visible')) {
|
2161
|
+
_this13.focus();
|
2162
|
+
}
|
2163
|
+
});
|
2164
|
+
});
|
2165
|
+
|
2166
|
+
Modal._jQueryInterface.call($(target), config, this);
|
2167
|
+
});
|
2168
|
+
|
2169
|
+
/**
|
2170
|
+
* ------------------------------------------------------------------------
|
2171
|
+
* jQuery
|
2172
|
+
* ------------------------------------------------------------------------
|
2173
|
+
*/
|
2174
|
+
|
2175
|
+
$.fn[NAME] = Modal._jQueryInterface;
|
2176
|
+
$.fn[NAME].Constructor = Modal;
|
2177
|
+
$.fn[NAME].noConflict = function () {
|
2178
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
2179
|
+
return Modal._jQueryInterface;
|
2180
|
+
};
|
2181
|
+
|
2182
|
+
return Modal;
|
2183
|
+
})(jQuery);
|
2184
|
+
|
2185
|
+
/**
|
2186
|
+
* --------------------------------------------------------------------------
|
2187
|
+
* Bootstrap (v4.0.0-alpha.2): scrollspy.js
|
2188
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
2189
|
+
* --------------------------------------------------------------------------
|
2190
|
+
*/
|
2191
|
+
|
2192
|
+
var ScrollSpy = (function ($) {
|
2193
|
+
|
2194
|
+
/**
|
2195
|
+
* ------------------------------------------------------------------------
|
2196
|
+
* Constants
|
2197
|
+
* ------------------------------------------------------------------------
|
2198
|
+
*/
|
2199
|
+
|
2200
|
+
var NAME = 'scrollspy';
|
2201
|
+
var VERSION = '4.0.0-alpha';
|
2202
|
+
var DATA_KEY = 'bs.scrollspy';
|
2203
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
2204
|
+
var DATA_API_KEY = '.data-api';
|
2205
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
2206
|
+
|
2207
|
+
var Default = {
|
2208
|
+
offset: 10,
|
2209
|
+
method: 'auto',
|
2210
|
+
target: ''
|
2211
|
+
};
|
2212
|
+
|
2213
|
+
var DefaultType = {
|
2214
|
+
offset: 'number',
|
2215
|
+
method: 'string',
|
2216
|
+
target: '(string|element)'
|
2217
|
+
};
|
2218
|
+
|
2219
|
+
var Event = {
|
2220
|
+
ACTIVATE: 'activate' + EVENT_KEY,
|
2221
|
+
SCROLL: 'scroll' + EVENT_KEY,
|
2222
|
+
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
|
2223
|
+
};
|
2224
|
+
|
2225
|
+
var ClassName = {
|
2226
|
+
DROPDOWN_ITEM: 'dropdown-item',
|
2227
|
+
DROPDOWN_MENU: 'dropdown-menu',
|
2228
|
+
NAV_LINK: 'nav-link',
|
2229
|
+
NAV: 'nav',
|
2230
|
+
ACTIVE: 'active'
|
2231
|
+
};
|
2232
|
+
|
2233
|
+
var Selector = {
|
2234
|
+
DATA_SPY: '[data-spy="scroll"]',
|
2235
|
+
ACTIVE: '.active',
|
2236
|
+
LIST_ITEM: '.list-item',
|
2237
|
+
LI: 'li',
|
2238
|
+
LI_DROPDOWN: 'li.dropdown',
|
2239
|
+
NAV_LINKS: '.nav-link',
|
2240
|
+
DROPDOWN: '.dropdown',
|
2241
|
+
DROPDOWN_ITEMS: '.dropdown-item',
|
2242
|
+
DROPDOWN_TOGGLE: '.dropdown-toggle'
|
2243
|
+
};
|
2244
|
+
|
2245
|
+
var OffsetMethod = {
|
2246
|
+
OFFSET: 'offset',
|
2247
|
+
POSITION: 'position'
|
2248
|
+
};
|
2249
|
+
|
2250
|
+
/**
|
2251
|
+
* ------------------------------------------------------------------------
|
2252
|
+
* Class Definition
|
2253
|
+
* ------------------------------------------------------------------------
|
2254
|
+
*/
|
2255
|
+
|
2256
|
+
var ScrollSpy = (function () {
|
2257
|
+
function ScrollSpy(element, config) {
|
2258
|
+
_classCallCheck(this, ScrollSpy);
|
2259
|
+
|
2260
|
+
this._element = element;
|
2261
|
+
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
2262
|
+
this._config = this._getConfig(config);
|
2263
|
+
this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
|
2264
|
+
this._offsets = [];
|
2265
|
+
this._targets = [];
|
2266
|
+
this._activeTarget = null;
|
2267
|
+
this._scrollHeight = 0;
|
2268
|
+
|
2269
|
+
$(this._scrollElement).on(Event.SCROLL, $.proxy(this._process, this));
|
2270
|
+
|
2271
|
+
this.refresh();
|
2272
|
+
this._process();
|
2273
|
+
}
|
2274
|
+
|
2275
|
+
/**
|
2276
|
+
* ------------------------------------------------------------------------
|
2277
|
+
* Data Api implementation
|
2278
|
+
* ------------------------------------------------------------------------
|
2279
|
+
*/
|
2280
|
+
|
2281
|
+
// getters
|
2282
|
+
|
2283
|
+
_createClass(ScrollSpy, [{
|
2284
|
+
key: 'refresh',
|
2285
|
+
|
2286
|
+
// public
|
2287
|
+
|
2288
|
+
value: function refresh() {
|
2289
|
+
var _this14 = this;
|
2290
|
+
|
2291
|
+
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
|
2292
|
+
|
2293
|
+
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
2294
|
+
|
2295
|
+
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
|
2296
|
+
|
2297
|
+
this._offsets = [];
|
2298
|
+
this._targets = [];
|
2299
|
+
|
2300
|
+
this._scrollHeight = this._getScrollHeight();
|
2301
|
+
|
2302
|
+
var targets = $.makeArray($(this._selector));
|
2303
|
+
|
2304
|
+
targets.map(function (element) {
|
2305
|
+
var target = undefined;
|
2306
|
+
var targetSelector = Util.getSelectorFromElement(element);
|
2307
|
+
|
2308
|
+
if (targetSelector) {
|
2309
|
+
target = $(targetSelector)[0];
|
2310
|
+
}
|
2311
|
+
|
2312
|
+
if (target && (target.offsetWidth || target.offsetHeight)) {
|
2313
|
+
// todo (fat): remove sketch reliance on jQuery position/offset
|
2314
|
+
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
|
2315
|
+
}
|
2316
|
+
}).filter(function (item) {
|
2317
|
+
return item;
|
2318
|
+
}).sort(function (a, b) {
|
2319
|
+
return a[0] - b[0];
|
2320
|
+
}).forEach(function (item) {
|
2321
|
+
_this14._offsets.push(item[0]);
|
2322
|
+
_this14._targets.push(item[1]);
|
2323
|
+
});
|
2324
|
+
}
|
2325
|
+
}, {
|
2326
|
+
key: 'dispose',
|
2327
|
+
value: function dispose() {
|
2328
|
+
$.removeData(this._element, DATA_KEY);
|
2329
|
+
$(this._scrollElement).off(EVENT_KEY);
|
2330
|
+
|
2331
|
+
this._element = null;
|
2332
|
+
this._scrollElement = null;
|
2333
|
+
this._config = null;
|
2334
|
+
this._selector = null;
|
2335
|
+
this._offsets = null;
|
2336
|
+
this._targets = null;
|
2337
|
+
this._activeTarget = null;
|
2338
|
+
this._scrollHeight = null;
|
2339
|
+
}
|
2340
|
+
|
2341
|
+
// private
|
2342
|
+
|
2343
|
+
}, {
|
2344
|
+
key: '_getConfig',
|
2345
|
+
value: function _getConfig(config) {
|
2346
|
+
config = $.extend({}, Default, config);
|
2347
|
+
|
2348
|
+
if (typeof config.target !== 'string') {
|
2349
|
+
var id = $(config.target).attr('id');
|
2350
|
+
if (!id) {
|
2351
|
+
id = Util.getUID(NAME);
|
2352
|
+
$(config.target).attr('id', id);
|
2353
|
+
}
|
2354
|
+
config.target = '#' + id;
|
2355
|
+
}
|
2356
|
+
|
2357
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
2358
|
+
|
2359
|
+
return config;
|
2360
|
+
}
|
2361
|
+
}, {
|
2362
|
+
key: '_getScrollTop',
|
2363
|
+
value: function _getScrollTop() {
|
2364
|
+
return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop;
|
2365
|
+
}
|
2366
|
+
}, {
|
2367
|
+
key: '_getScrollHeight',
|
2368
|
+
value: function _getScrollHeight() {
|
2369
|
+
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
|
2370
|
+
}
|
2371
|
+
}, {
|
2372
|
+
key: '_process',
|
2373
|
+
value: function _process() {
|
2374
|
+
var scrollTop = this._getScrollTop() + this._config.offset;
|
2375
|
+
var scrollHeight = this._getScrollHeight();
|
2376
|
+
var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight;
|
2377
|
+
|
2378
|
+
if (this._scrollHeight !== scrollHeight) {
|
2379
|
+
this.refresh();
|
2380
|
+
}
|
2381
|
+
|
2382
|
+
if (scrollTop >= maxScroll) {
|
2383
|
+
var target = this._targets[this._targets.length - 1];
|
2384
|
+
|
2385
|
+
if (this._activeTarget !== target) {
|
2386
|
+
this._activate(target);
|
2387
|
+
}
|
2388
|
+
}
|
2389
|
+
|
2390
|
+
if (this._activeTarget && scrollTop < this._offsets[0]) {
|
2391
|
+
this._activeTarget = null;
|
2392
|
+
this._clear();
|
2393
|
+
return;
|
2394
|
+
}
|
2395
|
+
|
2396
|
+
for (var i = this._offsets.length; i--;) {
|
2397
|
+
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
|
2398
|
+
|
2399
|
+
if (isActiveTarget) {
|
2400
|
+
this._activate(this._targets[i]);
|
2401
|
+
}
|
2402
|
+
}
|
2403
|
+
}
|
2404
|
+
}, {
|
2405
|
+
key: '_activate',
|
2406
|
+
value: function _activate(target) {
|
2407
|
+
this._activeTarget = target;
|
2408
|
+
|
2409
|
+
this._clear();
|
2410
|
+
|
2411
|
+
var queries = this._selector.split(',');
|
2412
|
+
queries = queries.map(function (selector) {
|
2413
|
+
return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
|
2414
|
+
});
|
2415
|
+
|
2416
|
+
var $link = $(queries.join(','));
|
2417
|
+
|
2418
|
+
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
|
2419
|
+
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
2420
|
+
$link.addClass(ClassName.ACTIVE);
|
2421
|
+
} else {
|
2422
|
+
// todo (fat) this is kinda sus…
|
2423
|
+
// recursively add actives to tested nav-links
|
2424
|
+
$link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
|
2425
|
+
}
|
2426
|
+
|
2427
|
+
$(this._scrollElement).trigger(Event.ACTIVATE, {
|
2428
|
+
relatedTarget: target
|
2429
|
+
});
|
2430
|
+
}
|
2431
|
+
}, {
|
2432
|
+
key: '_clear',
|
2433
|
+
value: function _clear() {
|
2434
|
+
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
|
2435
|
+
}
|
2436
|
+
|
2437
|
+
// static
|
2438
|
+
|
2439
|
+
}], [{
|
2440
|
+
key: '_jQueryInterface',
|
2441
|
+
value: function _jQueryInterface(config) {
|
2442
|
+
return this.each(function () {
|
2443
|
+
var data = $(this).data(DATA_KEY);
|
2444
|
+
var _config = typeof config === 'object' && config || null;
|
2445
|
+
|
2446
|
+
if (!data) {
|
2447
|
+
data = new ScrollSpy(this, _config);
|
2448
|
+
$(this).data(DATA_KEY, data);
|
2449
|
+
}
|
2450
|
+
|
2451
|
+
if (typeof config === 'string') {
|
2452
|
+
if (data[config] === undefined) {
|
2453
|
+
throw new Error('No method named "' + config + '"');
|
2454
|
+
}
|
2455
|
+
data[config]();
|
2456
|
+
}
|
2457
|
+
});
|
2458
|
+
}
|
2459
|
+
}, {
|
2460
|
+
key: 'VERSION',
|
2461
|
+
get: function get() {
|
2462
|
+
return VERSION;
|
2463
|
+
}
|
2464
|
+
}, {
|
2465
|
+
key: 'Default',
|
2466
|
+
get: function get() {
|
2467
|
+
return Default;
|
2468
|
+
}
|
2469
|
+
}]);
|
2470
|
+
|
2471
|
+
return ScrollSpy;
|
2472
|
+
})();
|
2473
|
+
|
2474
|
+
$(window).on(Event.LOAD_DATA_API, function () {
|
2475
|
+
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
2476
|
+
|
2477
|
+
for (var i = scrollSpys.length; i--;) {
|
2478
|
+
var $spy = $(scrollSpys[i]);
|
2479
|
+
ScrollSpy._jQueryInterface.call($spy, $spy.data());
|
2480
|
+
}
|
2481
|
+
});
|
2482
|
+
|
2483
|
+
/**
|
2484
|
+
* ------------------------------------------------------------------------
|
2485
|
+
* jQuery
|
2486
|
+
* ------------------------------------------------------------------------
|
2487
|
+
*/
|
2488
|
+
|
2489
|
+
$.fn[NAME] = ScrollSpy._jQueryInterface;
|
2490
|
+
$.fn[NAME].Constructor = ScrollSpy;
|
2491
|
+
$.fn[NAME].noConflict = function () {
|
2492
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
2493
|
+
return ScrollSpy._jQueryInterface;
|
2494
|
+
};
|
2495
|
+
|
2496
|
+
return ScrollSpy;
|
2497
|
+
})(jQuery);
|
2498
|
+
|
2499
|
+
/**
|
2500
|
+
* --------------------------------------------------------------------------
|
2501
|
+
* Bootstrap (v4.0.0-alpha.2): tab.js
|
2502
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
2503
|
+
* --------------------------------------------------------------------------
|
2504
|
+
*/
|
2505
|
+
|
2506
|
+
var Tab = (function ($) {
|
2507
|
+
|
2508
|
+
/**
|
2509
|
+
* ------------------------------------------------------------------------
|
2510
|
+
* Constants
|
2511
|
+
* ------------------------------------------------------------------------
|
2512
|
+
*/
|
2513
|
+
|
2514
|
+
var NAME = 'tab';
|
2515
|
+
var VERSION = '4.0.0-alpha';
|
2516
|
+
var DATA_KEY = 'bs.tab';
|
2517
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
2518
|
+
var DATA_API_KEY = '.data-api';
|
2519
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
2520
|
+
var TRANSITION_DURATION = 150;
|
2521
|
+
|
2522
|
+
var Event = {
|
2523
|
+
HIDE: 'hide' + EVENT_KEY,
|
2524
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
2525
|
+
SHOW: 'show' + EVENT_KEY,
|
2526
|
+
SHOWN: 'shown' + EVENT_KEY,
|
2527
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
2528
|
+
};
|
2529
|
+
|
2530
|
+
var ClassName = {
|
2531
|
+
DROPDOWN_MENU: 'dropdown-menu',
|
2532
|
+
ACTIVE: 'active',
|
2533
|
+
FADE: 'fade',
|
2534
|
+
IN: 'in'
|
2535
|
+
};
|
2536
|
+
|
2537
|
+
var Selector = {
|
2538
|
+
A: 'a',
|
2539
|
+
LI: 'li',
|
2540
|
+
DROPDOWN: '.dropdown',
|
2541
|
+
UL: 'ul:not(.dropdown-menu)',
|
2542
|
+
FADE_CHILD: '> .nav-item .fade, > .fade',
|
2543
|
+
ACTIVE: '.active',
|
2544
|
+
ACTIVE_CHILD: '> .nav-item > .active, > .active',
|
2545
|
+
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
|
2546
|
+
DROPDOWN_TOGGLE: '.dropdown-toggle',
|
2547
|
+
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
|
2548
|
+
};
|
2549
|
+
|
2550
|
+
/**
|
2551
|
+
* ------------------------------------------------------------------------
|
2552
|
+
* Class Definition
|
2553
|
+
* ------------------------------------------------------------------------
|
2554
|
+
*/
|
2555
|
+
|
2556
|
+
var Tab = (function () {
|
2557
|
+
function Tab(element) {
|
2558
|
+
_classCallCheck(this, Tab);
|
2559
|
+
|
2560
|
+
this._element = element;
|
2561
|
+
}
|
2562
|
+
|
2563
|
+
/**
|
2564
|
+
* ------------------------------------------------------------------------
|
2565
|
+
* Data Api implementation
|
2566
|
+
* ------------------------------------------------------------------------
|
2567
|
+
*/
|
2568
|
+
|
2569
|
+
// getters
|
2570
|
+
|
2571
|
+
_createClass(Tab, [{
|
2572
|
+
key: 'show',
|
2573
|
+
|
2574
|
+
// public
|
2575
|
+
|
2576
|
+
value: function show() {
|
2577
|
+
var _this15 = this;
|
2578
|
+
|
2579
|
+
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) {
|
2580
|
+
return;
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
var target = undefined;
|
2584
|
+
var previous = undefined;
|
2585
|
+
var ulElement = $(this._element).closest(Selector.UL)[0];
|
2586
|
+
var selector = Util.getSelectorFromElement(this._element);
|
2587
|
+
|
2588
|
+
if (ulElement) {
|
2589
|
+
previous = $.makeArray($(ulElement).find(Selector.ACTIVE));
|
2590
|
+
previous = previous[previous.length - 1];
|
2591
|
+
}
|
2592
|
+
|
2593
|
+
var hideEvent = $.Event(Event.HIDE, {
|
2594
|
+
relatedTarget: this._element
|
2595
|
+
});
|
2596
|
+
|
2597
|
+
var showEvent = $.Event(Event.SHOW, {
|
2598
|
+
relatedTarget: previous
|
2599
|
+
});
|
2600
|
+
|
2601
|
+
if (previous) {
|
2602
|
+
$(previous).trigger(hideEvent);
|
2603
|
+
}
|
2604
|
+
|
2605
|
+
$(this._element).trigger(showEvent);
|
2606
|
+
|
2607
|
+
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
|
2608
|
+
return;
|
2609
|
+
}
|
2610
|
+
|
2611
|
+
if (selector) {
|
2612
|
+
target = $(selector)[0];
|
2613
|
+
}
|
2614
|
+
|
2615
|
+
this._activate(this._element, ulElement);
|
2616
|
+
|
2617
|
+
var complete = function complete() {
|
2618
|
+
var hiddenEvent = $.Event(Event.HIDDEN, {
|
2619
|
+
relatedTarget: _this15._element
|
2620
|
+
});
|
2621
|
+
|
2622
|
+
var shownEvent = $.Event(Event.SHOWN, {
|
2623
|
+
relatedTarget: previous
|
2624
|
+
});
|
2625
|
+
|
2626
|
+
$(previous).trigger(hiddenEvent);
|
2627
|
+
$(_this15._element).trigger(shownEvent);
|
2628
|
+
};
|
2629
|
+
|
2630
|
+
if (target) {
|
2631
|
+
this._activate(target, target.parentNode, complete);
|
2632
|
+
} else {
|
2633
|
+
complete();
|
2634
|
+
}
|
2635
|
+
}
|
2636
|
+
}, {
|
2637
|
+
key: 'dispose',
|
2638
|
+
value: function dispose() {
|
2639
|
+
$.removeClass(this._element, DATA_KEY);
|
2640
|
+
this._element = null;
|
2641
|
+
}
|
2642
|
+
|
2643
|
+
// private
|
2644
|
+
|
2645
|
+
}, {
|
2646
|
+
key: '_activate',
|
2647
|
+
value: function _activate(element, container, callback) {
|
2648
|
+
var active = $(container).find(Selector.ACTIVE_CHILD)[0];
|
2649
|
+
var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
|
2650
|
+
|
2651
|
+
var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback);
|
2652
|
+
|
2653
|
+
if (active && isTransitioning) {
|
2654
|
+
$(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
2655
|
+
} else {
|
2656
|
+
complete();
|
2657
|
+
}
|
2658
|
+
|
2659
|
+
if (active) {
|
2660
|
+
$(active).removeClass(ClassName.IN);
|
2661
|
+
}
|
2662
|
+
}
|
2663
|
+
}, {
|
2664
|
+
key: '_transitionComplete',
|
2665
|
+
value: function _transitionComplete(element, active, isTransitioning, callback) {
|
2666
|
+
if (active) {
|
2667
|
+
$(active).removeClass(ClassName.ACTIVE);
|
2668
|
+
|
2669
|
+
var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
|
2670
|
+
|
2671
|
+
if (dropdownChild) {
|
2672
|
+
$(dropdownChild).removeClass(ClassName.ACTIVE);
|
2673
|
+
}
|
2674
|
+
|
2675
|
+
active.setAttribute('aria-expanded', false);
|
2676
|
+
}
|
2677
|
+
|
2678
|
+
$(element).addClass(ClassName.ACTIVE);
|
2679
|
+
element.setAttribute('aria-expanded', true);
|
2680
|
+
|
2681
|
+
if (isTransitioning) {
|
2682
|
+
Util.reflow(element);
|
2683
|
+
$(element).addClass(ClassName.IN);
|
2684
|
+
} else {
|
2685
|
+
$(element).removeClass(ClassName.FADE);
|
2686
|
+
}
|
2687
|
+
|
2688
|
+
if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
|
2689
|
+
|
2690
|
+
var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
|
2691
|
+
if (dropdownElement) {
|
2692
|
+
$(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
2693
|
+
}
|
2694
|
+
|
2695
|
+
element.setAttribute('aria-expanded', true);
|
2696
|
+
}
|
2697
|
+
|
2698
|
+
if (callback) {
|
2699
|
+
callback();
|
2700
|
+
}
|
2701
|
+
}
|
2702
|
+
|
2703
|
+
// static
|
2704
|
+
|
2705
|
+
}], [{
|
2706
|
+
key: '_jQueryInterface',
|
2707
|
+
value: function _jQueryInterface(config) {
|
2708
|
+
return this.each(function () {
|
2709
|
+
var $this = $(this);
|
2710
|
+
var data = $this.data(DATA_KEY);
|
2711
|
+
|
2712
|
+
if (!data) {
|
2713
|
+
data = data = new Tab(this);
|
2714
|
+
$this.data(DATA_KEY, data);
|
2715
|
+
}
|
2716
|
+
|
2717
|
+
if (typeof config === 'string') {
|
2718
|
+
if (data[config] === undefined) {
|
2719
|
+
throw new Error('No method named "' + config + '"');
|
2720
|
+
}
|
2721
|
+
data[config]();
|
2722
|
+
}
|
2723
|
+
});
|
2724
|
+
}
|
2725
|
+
}, {
|
2726
|
+
key: 'VERSION',
|
2727
|
+
get: function get() {
|
2728
|
+
return VERSION;
|
2729
|
+
}
|
2730
|
+
}]);
|
2731
|
+
|
2732
|
+
return Tab;
|
2733
|
+
})();
|
2734
|
+
|
2735
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
2736
|
+
event.preventDefault();
|
2737
|
+
Tab._jQueryInterface.call($(this), 'show');
|
2738
|
+
});
|
2739
|
+
|
2740
|
+
/**
|
2741
|
+
* ------------------------------------------------------------------------
|
2742
|
+
* jQuery
|
2743
|
+
* ------------------------------------------------------------------------
|
2744
|
+
*/
|
2745
|
+
|
2746
|
+
$.fn[NAME] = Tab._jQueryInterface;
|
2747
|
+
$.fn[NAME].Constructor = Tab;
|
2748
|
+
$.fn[NAME].noConflict = function () {
|
2749
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
2750
|
+
return Tab._jQueryInterface;
|
2751
|
+
};
|
2752
|
+
|
2753
|
+
return Tab;
|
2754
|
+
})(jQuery);
|
2755
|
+
|
2756
|
+
/* global Tether */
|
2757
|
+
|
2758
|
+
/**
|
2759
|
+
* --------------------------------------------------------------------------
|
2760
|
+
* Bootstrap (v4.0.0-alpha.2): tooltip.js
|
2761
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
2762
|
+
* --------------------------------------------------------------------------
|
2763
|
+
*/
|
2764
|
+
|
2765
|
+
var Tooltip = (function ($) {
|
2766
|
+
|
2767
|
+
/**
|
2768
|
+
* Check for Tether dependency
|
2769
|
+
* Tether - http://github.hubspot.com/tether/
|
2770
|
+
*/
|
2771
|
+
if (window.Tether === undefined) {
|
2772
|
+
throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)');
|
2773
|
+
}
|
2774
|
+
|
2775
|
+
/**
|
2776
|
+
* ------------------------------------------------------------------------
|
2777
|
+
* Constants
|
2778
|
+
* ------------------------------------------------------------------------
|
2779
|
+
*/
|
2780
|
+
|
2781
|
+
var NAME = 'tooltip';
|
2782
|
+
var VERSION = '4.0.0-alpha';
|
2783
|
+
var DATA_KEY = 'bs.tooltip';
|
2784
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
2785
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
2786
|
+
var TRANSITION_DURATION = 150;
|
2787
|
+
var CLASS_PREFIX = 'bs-tether';
|
2788
|
+
|
2789
|
+
var Default = {
|
2790
|
+
animation: true,
|
2791
|
+
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
|
2792
|
+
trigger: 'hover focus',
|
2793
|
+
title: '',
|
2794
|
+
delay: 0,
|
2795
|
+
html: false,
|
2796
|
+
selector: false,
|
2797
|
+
placement: 'top',
|
2798
|
+
offset: '0 0',
|
2799
|
+
constraints: []
|
2800
|
+
};
|
2801
|
+
|
2802
|
+
var DefaultType = {
|
2803
|
+
animation: 'boolean',
|
2804
|
+
template: 'string',
|
2805
|
+
title: '(string|element|function)',
|
2806
|
+
trigger: 'string',
|
2807
|
+
delay: '(number|object)',
|
2808
|
+
html: 'boolean',
|
2809
|
+
selector: '(string|boolean)',
|
2810
|
+
placement: '(string|function)',
|
2811
|
+
offset: 'string',
|
2812
|
+
constraints: 'array'
|
2813
|
+
};
|
2814
|
+
|
2815
|
+
var AttachmentMap = {
|
2816
|
+
TOP: 'bottom center',
|
2817
|
+
RIGHT: 'middle left',
|
2818
|
+
BOTTOM: 'top center',
|
2819
|
+
LEFT: 'middle right'
|
2820
|
+
};
|
2821
|
+
|
2822
|
+
var HoverState = {
|
2823
|
+
IN: 'in',
|
2824
|
+
OUT: 'out'
|
2825
|
+
};
|
2826
|
+
|
2827
|
+
var Event = {
|
2828
|
+
HIDE: 'hide' + EVENT_KEY,
|
2829
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
2830
|
+
SHOW: 'show' + EVENT_KEY,
|
2831
|
+
SHOWN: 'shown' + EVENT_KEY,
|
2832
|
+
INSERTED: 'inserted' + EVENT_KEY,
|
2833
|
+
CLICK: 'click' + EVENT_KEY,
|
2834
|
+
FOCUSIN: 'focusin' + EVENT_KEY,
|
2835
|
+
FOCUSOUT: 'focusout' + EVENT_KEY,
|
2836
|
+
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
2837
|
+
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
2838
|
+
};
|
2839
|
+
|
2840
|
+
var ClassName = {
|
2841
|
+
FADE: 'fade',
|
2842
|
+
IN: 'in'
|
2843
|
+
};
|
2844
|
+
|
2845
|
+
var Selector = {
|
2846
|
+
TOOLTIP: '.tooltip',
|
2847
|
+
TOOLTIP_INNER: '.tooltip-inner'
|
2848
|
+
};
|
2849
|
+
|
2850
|
+
var TetherClass = {
|
2851
|
+
element: false,
|
2852
|
+
enabled: false
|
2853
|
+
};
|
2854
|
+
|
2855
|
+
var Trigger = {
|
2856
|
+
HOVER: 'hover',
|
2857
|
+
FOCUS: 'focus',
|
2858
|
+
CLICK: 'click',
|
2859
|
+
MANUAL: 'manual'
|
2860
|
+
};
|
2861
|
+
|
2862
|
+
/**
|
2863
|
+
* ------------------------------------------------------------------------
|
2864
|
+
* Class Definition
|
2865
|
+
* ------------------------------------------------------------------------
|
2866
|
+
*/
|
2867
|
+
|
2868
|
+
var Tooltip = (function () {
|
2869
|
+
function Tooltip(element, config) {
|
2870
|
+
_classCallCheck(this, Tooltip);
|
2871
|
+
|
2872
|
+
// private
|
2873
|
+
this._isEnabled = true;
|
2874
|
+
this._timeout = 0;
|
2875
|
+
this._hoverState = '';
|
2876
|
+
this._activeTrigger = {};
|
2877
|
+
this._tether = null;
|
2878
|
+
|
2879
|
+
// protected
|
2880
|
+
this.element = element;
|
2881
|
+
this.config = this._getConfig(config);
|
2882
|
+
this.tip = null;
|
2883
|
+
|
2884
|
+
this._setListeners();
|
2885
|
+
}
|
2886
|
+
|
2887
|
+
/**
|
2888
|
+
* ------------------------------------------------------------------------
|
2889
|
+
* jQuery
|
2890
|
+
* ------------------------------------------------------------------------
|
2891
|
+
*/
|
2892
|
+
|
2893
|
+
// getters
|
2894
|
+
|
2895
|
+
_createClass(Tooltip, [{
|
2896
|
+
key: 'enable',
|
2897
|
+
|
2898
|
+
// public
|
2899
|
+
|
2900
|
+
value: function enable() {
|
2901
|
+
this._isEnabled = true;
|
2902
|
+
}
|
2903
|
+
}, {
|
2904
|
+
key: 'disable',
|
2905
|
+
value: function disable() {
|
2906
|
+
this._isEnabled = false;
|
2907
|
+
}
|
2908
|
+
}, {
|
2909
|
+
key: 'toggleEnabled',
|
2910
|
+
value: function toggleEnabled() {
|
2911
|
+
this._isEnabled = !this._isEnabled;
|
2912
|
+
}
|
2913
|
+
}, {
|
2914
|
+
key: 'toggle',
|
2915
|
+
value: function toggle(event) {
|
2916
|
+
if (event) {
|
2917
|
+
var dataKey = this.constructor.DATA_KEY;
|
2918
|
+
var context = $(event.currentTarget).data(dataKey);
|
2919
|
+
|
2920
|
+
if (!context) {
|
2921
|
+
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
2922
|
+
$(event.currentTarget).data(dataKey, context);
|
2923
|
+
}
|
2924
|
+
|
2925
|
+
context._activeTrigger.click = !context._activeTrigger.click;
|
2926
|
+
|
2927
|
+
if (context._isWithActiveTrigger()) {
|
2928
|
+
context._enter(null, context);
|
2929
|
+
} else {
|
2930
|
+
context._leave(null, context);
|
2931
|
+
}
|
2932
|
+
} else {
|
2933
|
+
|
2934
|
+
if ($(this.getTipElement()).hasClass(ClassName.IN)) {
|
2935
|
+
this._leave(null, this);
|
2936
|
+
return;
|
2937
|
+
}
|
2938
|
+
|
2939
|
+
this._enter(null, this);
|
2940
|
+
}
|
2941
|
+
}
|
2942
|
+
}, {
|
2943
|
+
key: 'dispose',
|
2944
|
+
value: function dispose() {
|
2945
|
+
clearTimeout(this._timeout);
|
2946
|
+
|
2947
|
+
this.cleanupTether();
|
2948
|
+
|
2949
|
+
$.removeData(this.element, this.constructor.DATA_KEY);
|
2950
|
+
|
2951
|
+
$(this.element).off(this.constructor.EVENT_KEY);
|
2952
|
+
|
2953
|
+
if (this.tip) {
|
2954
|
+
$(this.tip).remove();
|
2955
|
+
}
|
2956
|
+
|
2957
|
+
this._isEnabled = null;
|
2958
|
+
this._timeout = null;
|
2959
|
+
this._hoverState = null;
|
2960
|
+
this._activeTrigger = null;
|
2961
|
+
this._tether = null;
|
2962
|
+
|
2963
|
+
this.element = null;
|
2964
|
+
this.config = null;
|
2965
|
+
this.tip = null;
|
2966
|
+
}
|
2967
|
+
}, {
|
2968
|
+
key: 'show',
|
2969
|
+
value: function show() {
|
2970
|
+
var _this16 = this;
|
2971
|
+
|
2972
|
+
var showEvent = $.Event(this.constructor.Event.SHOW);
|
2973
|
+
|
2974
|
+
if (this.isWithContent() && this._isEnabled) {
|
2975
|
+
$(this.element).trigger(showEvent);
|
2976
|
+
|
2977
|
+
var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
|
2978
|
+
|
2979
|
+
if (showEvent.isDefaultPrevented() || !isInTheDom) {
|
2980
|
+
return;
|
2981
|
+
}
|
2982
|
+
|
2983
|
+
var tip = this.getTipElement();
|
2984
|
+
var tipId = Util.getUID(this.constructor.NAME);
|
2985
|
+
|
2986
|
+
tip.setAttribute('id', tipId);
|
2987
|
+
this.element.setAttribute('aria-describedby', tipId);
|
2988
|
+
|
2989
|
+
this.setContent();
|
2990
|
+
|
2991
|
+
if (this.config.animation) {
|
2992
|
+
$(tip).addClass(ClassName.FADE);
|
2993
|
+
}
|
2994
|
+
|
2995
|
+
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
|
2996
|
+
|
2997
|
+
var attachment = this._getAttachment(placement);
|
2998
|
+
|
2999
|
+
$(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
|
3000
|
+
|
3001
|
+
$(this.element).trigger(this.constructor.Event.INSERTED);
|
3002
|
+
|
3003
|
+
this._tether = new Tether({
|
3004
|
+
attachment: attachment,
|
3005
|
+
element: tip,
|
3006
|
+
target: this.element,
|
3007
|
+
classes: TetherClass,
|
3008
|
+
classPrefix: CLASS_PREFIX,
|
3009
|
+
offset: this.config.offset,
|
3010
|
+
constraints: this.config.constraints,
|
3011
|
+
addTargetClasses: false
|
3012
|
+
});
|
3013
|
+
|
3014
|
+
Util.reflow(tip);
|
3015
|
+
this._tether.position();
|
3016
|
+
|
3017
|
+
$(tip).addClass(ClassName.IN);
|
3018
|
+
|
3019
|
+
var complete = function complete() {
|
3020
|
+
var prevHoverState = _this16._hoverState;
|
3021
|
+
_this16._hoverState = null;
|
3022
|
+
|
3023
|
+
$(_this16.element).trigger(_this16.constructor.Event.SHOWN);
|
3024
|
+
|
3025
|
+
if (prevHoverState === HoverState.OUT) {
|
3026
|
+
_this16._leave(null, _this16);
|
3027
|
+
}
|
3028
|
+
};
|
3029
|
+
|
3030
|
+
if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
|
3031
|
+
$(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
|
3032
|
+
return;
|
3033
|
+
}
|
3034
|
+
|
3035
|
+
complete();
|
3036
|
+
}
|
3037
|
+
}
|
3038
|
+
}, {
|
3039
|
+
key: 'hide',
|
3040
|
+
value: function hide(callback) {
|
3041
|
+
var _this17 = this;
|
3042
|
+
|
3043
|
+
var tip = this.getTipElement();
|
3044
|
+
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
3045
|
+
var complete = function complete() {
|
3046
|
+
if (_this17._hoverState !== HoverState.IN && tip.parentNode) {
|
3047
|
+
tip.parentNode.removeChild(tip);
|
3048
|
+
}
|
3049
|
+
|
3050
|
+
_this17.element.removeAttribute('aria-describedby');
|
3051
|
+
$(_this17.element).trigger(_this17.constructor.Event.HIDDEN);
|
3052
|
+
_this17.cleanupTether();
|
3053
|
+
|
3054
|
+
if (callback) {
|
3055
|
+
callback();
|
3056
|
+
}
|
3057
|
+
};
|
3058
|
+
|
3059
|
+
$(this.element).trigger(hideEvent);
|
3060
|
+
|
3061
|
+
if (hideEvent.isDefaultPrevented()) {
|
3062
|
+
return;
|
3063
|
+
}
|
3064
|
+
|
3065
|
+
$(tip).removeClass(ClassName.IN);
|
3066
|
+
|
3067
|
+
if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
|
3068
|
+
|
3069
|
+
$(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
3070
|
+
} else {
|
3071
|
+
complete();
|
3072
|
+
}
|
3073
|
+
|
3074
|
+
this._hoverState = '';
|
3075
|
+
}
|
3076
|
+
|
3077
|
+
// protected
|
3078
|
+
|
3079
|
+
}, {
|
3080
|
+
key: 'isWithContent',
|
3081
|
+
value: function isWithContent() {
|
3082
|
+
return Boolean(this.getTitle());
|
3083
|
+
}
|
3084
|
+
}, {
|
3085
|
+
key: 'getTipElement',
|
3086
|
+
value: function getTipElement() {
|
3087
|
+
return this.tip = this.tip || $(this.config.template)[0];
|
3088
|
+
}
|
3089
|
+
}, {
|
3090
|
+
key: 'setContent',
|
3091
|
+
value: function setContent() {
|
3092
|
+
var $tip = $(this.getTipElement());
|
3093
|
+
|
3094
|
+
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
|
3095
|
+
|
3096
|
+
$tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
|
3097
|
+
|
3098
|
+
this.cleanupTether();
|
3099
|
+
}
|
3100
|
+
}, {
|
3101
|
+
key: 'setElementContent',
|
3102
|
+
value: function setElementContent($element, content) {
|
3103
|
+
var html = this.config.html;
|
3104
|
+
if (typeof content === 'object' && (content.nodeType || content.jquery)) {
|
3105
|
+
// content is a DOM node or a jQuery
|
3106
|
+
if (html) {
|
3107
|
+
if (!$(content).parent().is($element)) {
|
3108
|
+
$element.empty().append(content);
|
3109
|
+
}
|
3110
|
+
} else {
|
3111
|
+
$element.text($(content).text());
|
3112
|
+
}
|
3113
|
+
} else {
|
3114
|
+
$element[html ? 'html' : 'text'](content);
|
3115
|
+
}
|
3116
|
+
}
|
3117
|
+
}, {
|
3118
|
+
key: 'getTitle',
|
3119
|
+
value: function getTitle() {
|
3120
|
+
var title = this.element.getAttribute('data-original-title');
|
3121
|
+
|
3122
|
+
if (!title) {
|
3123
|
+
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
|
3124
|
+
}
|
3125
|
+
|
3126
|
+
return title;
|
3127
|
+
}
|
3128
|
+
}, {
|
3129
|
+
key: 'cleanupTether',
|
3130
|
+
value: function cleanupTether() {
|
3131
|
+
if (this._tether) {
|
3132
|
+
this._tether.destroy();
|
3133
|
+
}
|
3134
|
+
}
|
3135
|
+
|
3136
|
+
// private
|
3137
|
+
|
3138
|
+
}, {
|
3139
|
+
key: '_getAttachment',
|
3140
|
+
value: function _getAttachment(placement) {
|
3141
|
+
return AttachmentMap[placement.toUpperCase()];
|
3142
|
+
}
|
3143
|
+
}, {
|
3144
|
+
key: '_setListeners',
|
3145
|
+
value: function _setListeners() {
|
3146
|
+
var _this18 = this;
|
3147
|
+
|
3148
|
+
var triggers = this.config.trigger.split(' ');
|
3149
|
+
|
3150
|
+
triggers.forEach(function (trigger) {
|
3151
|
+
if (trigger === 'click') {
|
3152
|
+
$(_this18.element).on(_this18.constructor.Event.CLICK, _this18.config.selector, $.proxy(_this18.toggle, _this18));
|
3153
|
+
} else if (trigger !== Trigger.MANUAL) {
|
3154
|
+
var eventIn = trigger === Trigger.HOVER ? _this18.constructor.Event.MOUSEENTER : _this18.constructor.Event.FOCUSIN;
|
3155
|
+
var eventOut = trigger === Trigger.HOVER ? _this18.constructor.Event.MOUSELEAVE : _this18.constructor.Event.FOCUSOUT;
|
3156
|
+
|
3157
|
+
$(_this18.element).on(eventIn, _this18.config.selector, $.proxy(_this18._enter, _this18)).on(eventOut, _this18.config.selector, $.proxy(_this18._leave, _this18));
|
3158
|
+
}
|
3159
|
+
});
|
3160
|
+
|
3161
|
+
if (this.config.selector) {
|
3162
|
+
this.config = $.extend({}, this.config, {
|
3163
|
+
trigger: 'manual',
|
3164
|
+
selector: ''
|
3165
|
+
});
|
3166
|
+
} else {
|
3167
|
+
this._fixTitle();
|
3168
|
+
}
|
3169
|
+
}
|
3170
|
+
}, {
|
3171
|
+
key: '_fixTitle',
|
3172
|
+
value: function _fixTitle() {
|
3173
|
+
var titleType = typeof this.element.getAttribute('data-original-title');
|
3174
|
+
if (this.element.getAttribute('title') || titleType !== 'string') {
|
3175
|
+
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
|
3176
|
+
this.element.setAttribute('title', '');
|
3177
|
+
}
|
3178
|
+
}
|
3179
|
+
}, {
|
3180
|
+
key: '_enter',
|
3181
|
+
value: function _enter(event, context) {
|
3182
|
+
var dataKey = this.constructor.DATA_KEY;
|
3183
|
+
|
3184
|
+
context = context || $(event.currentTarget).data(dataKey);
|
3185
|
+
|
3186
|
+
if (!context) {
|
3187
|
+
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
3188
|
+
$(event.currentTarget).data(dataKey, context);
|
3189
|
+
}
|
3190
|
+
|
3191
|
+
if (event) {
|
3192
|
+
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
|
3193
|
+
}
|
3194
|
+
|
3195
|
+
if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
|
3196
|
+
context._hoverState = HoverState.IN;
|
3197
|
+
return;
|
3198
|
+
}
|
3199
|
+
|
3200
|
+
clearTimeout(context._timeout);
|
3201
|
+
|
3202
|
+
context._hoverState = HoverState.IN;
|
3203
|
+
|
3204
|
+
if (!context.config.delay || !context.config.delay.show) {
|
3205
|
+
context.show();
|
3206
|
+
return;
|
3207
|
+
}
|
3208
|
+
|
3209
|
+
context._timeout = setTimeout(function () {
|
3210
|
+
if (context._hoverState === HoverState.IN) {
|
3211
|
+
context.show();
|
3212
|
+
}
|
3213
|
+
}, context.config.delay.show);
|
3214
|
+
}
|
3215
|
+
}, {
|
3216
|
+
key: '_leave',
|
3217
|
+
value: function _leave(event, context) {
|
3218
|
+
var dataKey = this.constructor.DATA_KEY;
|
3219
|
+
|
3220
|
+
context = context || $(event.currentTarget).data(dataKey);
|
3221
|
+
|
3222
|
+
if (!context) {
|
3223
|
+
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
3224
|
+
$(event.currentTarget).data(dataKey, context);
|
3225
|
+
}
|
3226
|
+
|
3227
|
+
if (event) {
|
3228
|
+
context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
|
3229
|
+
}
|
3230
|
+
|
3231
|
+
if (context._isWithActiveTrigger()) {
|
3232
|
+
return;
|
3233
|
+
}
|
3234
|
+
|
3235
|
+
clearTimeout(context._timeout);
|
3236
|
+
|
3237
|
+
context._hoverState = HoverState.OUT;
|
3238
|
+
|
3239
|
+
if (!context.config.delay || !context.config.delay.hide) {
|
3240
|
+
context.hide();
|
3241
|
+
return;
|
3242
|
+
}
|
3243
|
+
|
3244
|
+
context._timeout = setTimeout(function () {
|
3245
|
+
if (context._hoverState === HoverState.OUT) {
|
3246
|
+
context.hide();
|
3247
|
+
}
|
3248
|
+
}, context.config.delay.hide);
|
3249
|
+
}
|
3250
|
+
}, {
|
3251
|
+
key: '_isWithActiveTrigger',
|
3252
|
+
value: function _isWithActiveTrigger() {
|
3253
|
+
for (var trigger in this._activeTrigger) {
|
3254
|
+
if (this._activeTrigger[trigger]) {
|
3255
|
+
return true;
|
3256
|
+
}
|
3257
|
+
}
|
3258
|
+
|
3259
|
+
return false;
|
3260
|
+
}
|
3261
|
+
}, {
|
3262
|
+
key: '_getConfig',
|
3263
|
+
value: function _getConfig(config) {
|
3264
|
+
config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
|
3265
|
+
|
3266
|
+
if (config.delay && typeof config.delay === 'number') {
|
3267
|
+
config.delay = {
|
3268
|
+
show: config.delay,
|
3269
|
+
hide: config.delay
|
3270
|
+
};
|
3271
|
+
}
|
3272
|
+
|
3273
|
+
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
3274
|
+
|
3275
|
+
return config;
|
3276
|
+
}
|
3277
|
+
}, {
|
3278
|
+
key: '_getDelegateConfig',
|
3279
|
+
value: function _getDelegateConfig() {
|
3280
|
+
var config = {};
|
3281
|
+
|
3282
|
+
if (this.config) {
|
3283
|
+
for (var key in this.config) {
|
3284
|
+
if (this.constructor.Default[key] !== this.config[key]) {
|
3285
|
+
config[key] = this.config[key];
|
3286
|
+
}
|
3287
|
+
}
|
3288
|
+
}
|
3289
|
+
|
3290
|
+
return config;
|
3291
|
+
}
|
3292
|
+
|
3293
|
+
// static
|
3294
|
+
|
3295
|
+
}], [{
|
3296
|
+
key: '_jQueryInterface',
|
3297
|
+
value: function _jQueryInterface(config) {
|
3298
|
+
return this.each(function () {
|
3299
|
+
var data = $(this).data(DATA_KEY);
|
3300
|
+
var _config = typeof config === 'object' ? config : null;
|
3301
|
+
|
3302
|
+
if (!data && /destroy|hide/.test(config)) {
|
3303
|
+
return;
|
3304
|
+
}
|
3305
|
+
|
3306
|
+
if (!data) {
|
3307
|
+
data = new Tooltip(this, _config);
|
3308
|
+
$(this).data(DATA_KEY, data);
|
3309
|
+
}
|
3310
|
+
|
3311
|
+
if (typeof config === 'string') {
|
3312
|
+
if (data[config] === undefined) {
|
3313
|
+
throw new Error('No method named "' + config + '"');
|
3314
|
+
}
|
3315
|
+
data[config]();
|
3316
|
+
}
|
3317
|
+
});
|
3318
|
+
}
|
3319
|
+
}, {
|
3320
|
+
key: 'VERSION',
|
3321
|
+
get: function get() {
|
3322
|
+
return VERSION;
|
3323
|
+
}
|
3324
|
+
}, {
|
3325
|
+
key: 'Default',
|
3326
|
+
get: function get() {
|
3327
|
+
return Default;
|
3328
|
+
}
|
3329
|
+
}, {
|
3330
|
+
key: 'NAME',
|
3331
|
+
get: function get() {
|
3332
|
+
return NAME;
|
3333
|
+
}
|
3334
|
+
}, {
|
3335
|
+
key: 'DATA_KEY',
|
3336
|
+
get: function get() {
|
3337
|
+
return DATA_KEY;
|
3338
|
+
}
|
3339
|
+
}, {
|
3340
|
+
key: 'Event',
|
3341
|
+
get: function get() {
|
3342
|
+
return Event;
|
3343
|
+
}
|
3344
|
+
}, {
|
3345
|
+
key: 'EVENT_KEY',
|
3346
|
+
get: function get() {
|
3347
|
+
return EVENT_KEY;
|
3348
|
+
}
|
3349
|
+
}, {
|
3350
|
+
key: 'DefaultType',
|
3351
|
+
get: function get() {
|
3352
|
+
return DefaultType;
|
3353
|
+
}
|
3354
|
+
}]);
|
3355
|
+
|
3356
|
+
return Tooltip;
|
3357
|
+
})();
|
3358
|
+
|
3359
|
+
$.fn[NAME] = Tooltip._jQueryInterface;
|
3360
|
+
$.fn[NAME].Constructor = Tooltip;
|
3361
|
+
$.fn[NAME].noConflict = function () {
|
3362
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
3363
|
+
return Tooltip._jQueryInterface;
|
3364
|
+
};
|
3365
|
+
|
3366
|
+
return Tooltip;
|
3367
|
+
})(jQuery);
|
3368
|
+
|
3369
|
+
/**
|
3370
|
+
* --------------------------------------------------------------------------
|
3371
|
+
* Bootstrap (v4.0.0-alpha.2): popover.js
|
3372
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
3373
|
+
* --------------------------------------------------------------------------
|
3374
|
+
*/
|
3375
|
+
|
3376
|
+
var Popover = (function ($) {
|
3377
|
+
|
3378
|
+
/**
|
3379
|
+
* ------------------------------------------------------------------------
|
3380
|
+
* Constants
|
3381
|
+
* ------------------------------------------------------------------------
|
3382
|
+
*/
|
3383
|
+
|
3384
|
+
var NAME = 'popover';
|
3385
|
+
var VERSION = '4.0.0-alpha';
|
3386
|
+
var DATA_KEY = 'bs.popover';
|
3387
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
3388
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
3389
|
+
|
3390
|
+
var Default = $.extend({}, Tooltip.Default, {
|
3391
|
+
placement: 'right',
|
3392
|
+
trigger: 'click',
|
3393
|
+
content: '',
|
3394
|
+
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
|
3395
|
+
});
|
3396
|
+
|
3397
|
+
var DefaultType = $.extend({}, Tooltip.DefaultType, {
|
3398
|
+
content: '(string|element|function)'
|
3399
|
+
});
|
3400
|
+
|
3401
|
+
var ClassName = {
|
3402
|
+
FADE: 'fade',
|
3403
|
+
IN: 'in'
|
3404
|
+
};
|
3405
|
+
|
3406
|
+
var Selector = {
|
3407
|
+
TITLE: '.popover-title',
|
3408
|
+
CONTENT: '.popover-content',
|
3409
|
+
ARROW: '.popover-arrow'
|
3410
|
+
};
|
3411
|
+
|
3412
|
+
var Event = {
|
3413
|
+
HIDE: 'hide' + EVENT_KEY,
|
3414
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
3415
|
+
SHOW: 'show' + EVENT_KEY,
|
3416
|
+
SHOWN: 'shown' + EVENT_KEY,
|
3417
|
+
INSERTED: 'inserted' + EVENT_KEY,
|
3418
|
+
CLICK: 'click' + EVENT_KEY,
|
3419
|
+
FOCUSIN: 'focusin' + EVENT_KEY,
|
3420
|
+
FOCUSOUT: 'focusout' + EVENT_KEY,
|
3421
|
+
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
3422
|
+
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
3423
|
+
};
|
3424
|
+
|
3425
|
+
/**
|
3426
|
+
* ------------------------------------------------------------------------
|
3427
|
+
* Class Definition
|
3428
|
+
* ------------------------------------------------------------------------
|
3429
|
+
*/
|
3430
|
+
|
3431
|
+
var Popover = (function (_Tooltip) {
|
3432
|
+
_inherits(Popover, _Tooltip);
|
3433
|
+
|
3434
|
+
function Popover() {
|
3435
|
+
_classCallCheck(this, Popover);
|
3436
|
+
|
3437
|
+
_get(Object.getPrototypeOf(Popover.prototype), 'constructor', this).apply(this, arguments);
|
3438
|
+
}
|
3439
|
+
|
3440
|
+
/**
|
3441
|
+
* ------------------------------------------------------------------------
|
3442
|
+
* jQuery
|
3443
|
+
* ------------------------------------------------------------------------
|
3444
|
+
*/
|
3445
|
+
|
3446
|
+
_createClass(Popover, [{
|
3447
|
+
key: 'isWithContent',
|
3448
|
+
|
3449
|
+
// overrides
|
3450
|
+
|
3451
|
+
value: function isWithContent() {
|
3452
|
+
return this.getTitle() || this._getContent();
|
3453
|
+
}
|
3454
|
+
}, {
|
3455
|
+
key: 'getTipElement',
|
3456
|
+
value: function getTipElement() {
|
3457
|
+
return this.tip = this.tip || $(this.config.template)[0];
|
3458
|
+
}
|
3459
|
+
}, {
|
3460
|
+
key: 'setContent',
|
3461
|
+
value: function setContent() {
|
3462
|
+
var $tip = $(this.getTipElement());
|
3463
|
+
|
3464
|
+
// we use append for html objects to maintain js events
|
3465
|
+
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
|
3466
|
+
this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
|
3467
|
+
|
3468
|
+
$tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
|
3469
|
+
|
3470
|
+
this.cleanupTether();
|
3471
|
+
}
|
3472
|
+
|
3473
|
+
// private
|
3474
|
+
|
3475
|
+
}, {
|
3476
|
+
key: '_getContent',
|
3477
|
+
value: function _getContent() {
|
3478
|
+
return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
|
3479
|
+
}
|
3480
|
+
|
3481
|
+
// static
|
3482
|
+
|
3483
|
+
}], [{
|
3484
|
+
key: '_jQueryInterface',
|
3485
|
+
value: function _jQueryInterface(config) {
|
3486
|
+
return this.each(function () {
|
3487
|
+
var data = $(this).data(DATA_KEY);
|
3488
|
+
var _config = typeof config === 'object' ? config : null;
|
3489
|
+
|
3490
|
+
if (!data && /destroy|hide/.test(config)) {
|
3491
|
+
return;
|
3492
|
+
}
|
3493
|
+
|
3494
|
+
if (!data) {
|
3495
|
+
data = new Popover(this, _config);
|
3496
|
+
$(this).data(DATA_KEY, data);
|
3497
|
+
}
|
3498
|
+
|
3499
|
+
if (typeof config === 'string') {
|
3500
|
+
if (data[config] === undefined) {
|
3501
|
+
throw new Error('No method named "' + config + '"');
|
3502
|
+
}
|
3503
|
+
data[config]();
|
3504
|
+
}
|
3505
|
+
});
|
3506
|
+
}
|
3507
|
+
}, {
|
3508
|
+
key: 'VERSION',
|
3509
|
+
|
3510
|
+
// getters
|
3511
|
+
|
3512
|
+
get: function get() {
|
3513
|
+
return VERSION;
|
3514
|
+
}
|
3515
|
+
}, {
|
3516
|
+
key: 'Default',
|
3517
|
+
get: function get() {
|
3518
|
+
return Default;
|
3519
|
+
}
|
3520
|
+
}, {
|
3521
|
+
key: 'NAME',
|
3522
|
+
get: function get() {
|
3523
|
+
return NAME;
|
3524
|
+
}
|
3525
|
+
}, {
|
3526
|
+
key: 'DATA_KEY',
|
3527
|
+
get: function get() {
|
3528
|
+
return DATA_KEY;
|
3529
|
+
}
|
3530
|
+
}, {
|
3531
|
+
key: 'Event',
|
3532
|
+
get: function get() {
|
3533
|
+
return Event;
|
3534
|
+
}
|
3535
|
+
}, {
|
3536
|
+
key: 'EVENT_KEY',
|
3537
|
+
get: function get() {
|
3538
|
+
return EVENT_KEY;
|
3539
|
+
}
|
3540
|
+
}, {
|
3541
|
+
key: 'DefaultType',
|
3542
|
+
get: function get() {
|
3543
|
+
return DefaultType;
|
3544
|
+
}
|
3545
|
+
}]);
|
3546
|
+
|
3547
|
+
return Popover;
|
3548
|
+
})(Tooltip);
|
3549
|
+
|
3550
|
+
$.fn[NAME] = Popover._jQueryInterface;
|
3551
|
+
$.fn[NAME].Constructor = Popover;
|
3552
|
+
$.fn[NAME].noConflict = function () {
|
3553
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
3554
|
+
return Popover._jQueryInterface;
|
3555
|
+
};
|
3556
|
+
|
3557
|
+
return Popover;
|
3558
|
+
})(jQuery);
|
3559
|
+
|
3560
|
+
}(jQuery);
|