@gitlab/ui 132.0.1 → 132.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts.js +13 -0
- package/dist/components/base/accordion/accordion.js +69 -0
- package/dist/components/base/accordion/accordion_item.js +160 -0
- package/dist/components/base/accordion/constants.js +3 -0
- package/dist/components/base/alert/alert.js +263 -0
- package/dist/components/base/animated_icon/animated_chevron_down_up_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_chevron_lg_down_up_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_chevron_lg_right_down_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_chevron_right_down_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_duo_chat_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_loader_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_notifications_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_sidebar_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_smile_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_sort_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_star_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_todo_icon.js +45 -0
- package/dist/components/base/animated_icon/animated_upload_icon.js +45 -0
- package/dist/components/base/animated_icon/base_animated_icon.js +77 -0
- package/dist/components/base/attribute_list/attribute_list.js +100 -0
- package/dist/components/base/avatar/avatar.js +175 -0
- package/dist/components/base/avatar/utils.js +17 -0
- package/dist/components/base/avatar_labeled/avatar_labeled.js +198 -0
- package/dist/components/base/avatar_link/avatar_link.js +47 -0
- package/dist/components/base/avatars_inline/avatars_inline.js +139 -0
- package/dist/components/base/badge/badge.js +197 -0
- package/dist/components/base/banner/banner.js +149 -0
- package/dist/components/base/breadcrumb/breadcrumb.js +282 -0
- package/dist/components/base/breadcrumb/breadcrumb_item.js +96 -0
- package/dist/components/base/broadcast_message/broadcast_message.js +113 -0
- package/dist/components/base/broadcast_message/constants.js +5 -0
- package/dist/components/base/button/button.js +419 -0
- package/dist/components/base/button_group/button_group.js +53 -0
- package/dist/components/base/card/card.js +69 -0
- package/dist/components/base/collapse/collapse.js +163 -0
- package/dist/components/base/color_mode_toggle/color_mode_toggle.js +92 -0
- package/dist/components/base/datepicker/datepicker.js +475 -0
- package/dist/components/base/daterange_picker/daterange_picker.js +394 -0
- package/dist/components/base/drawer/drawer.js +156 -0
- package/dist/components/base/dropdown/dropdown.js +330 -0
- package/dist/components/base/dropdown/dropdown_divider.js +48 -0
- package/dist/components/base/dropdown/dropdown_form.js +48 -0
- package/dist/components/base/dropdown/dropdown_item.js +175 -0
- package/dist/components/base/dropdown/dropdown_section_header.js +48 -0
- package/dist/components/base/dropdown/dropdown_text.js +48 -0
- package/dist/components/base/filtered_search/common_story_options.js +14 -0
- package/dist/components/base/filtered_search/filtered_search.js +428 -0
- package/dist/components/base/filtered_search/filtered_search_suggestion.js +95 -0
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +139 -0
- package/dist/components/base/filtered_search/filtered_search_term.js +217 -0
- package/dist/components/base/filtered_search/filtered_search_token.js +383 -0
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +444 -0
- package/dist/components/base/filtered_search/filtered_search_utils.js +241 -0
- package/dist/components/base/form/form.js +43 -0
- package/dist/components/base/form/form_character_count/form_character_count.js +107 -0
- package/dist/components/base/form/form_checkbox/form_checkbox.js +342 -0
- package/dist/components/base/form/form_checkbox/form_checkbox_group.js +188 -0
- package/dist/components/base/form/form_combobox/constants.js +55 -0
- package/dist/components/base/form/form_combobox/form_combobox.js +239 -0
- package/dist/components/base/form/form_date/form_date.js +143 -0
- package/dist/components/base/form/form_fields/form_field_validator.js +93 -0
- package/dist/components/base/form/form_fields/form_fields.js +289 -0
- package/dist/components/base/form/form_fields/form_fields_loop.js +75 -0
- package/dist/components/base/form/form_fields/mappers.js +13 -0
- package/dist/components/base/form/form_fields/validators.js +48 -0
- package/dist/components/base/form/form_group/form_group.js +119 -0
- package/dist/components/base/form/form_input/form_input.js +695 -0
- package/dist/components/base/form/form_input_group/form_input_group.js +120 -0
- package/dist/components/base/form/form_input_group/form_input_group_mixin.js +41 -0
- package/dist/components/base/form/form_radio/form_radio.js +259 -0
- package/dist/components/base/form/form_radio_group/form_radio_group.js +189 -0
- package/dist/components/base/form/form_select/constants.js +12 -0
- package/dist/components/base/form/form_select/form_select.js +96 -0
- package/dist/components/base/form/form_textarea/form_textarea.js +166 -0
- package/dist/components/base/form/input_group_text/input_group_text.js +43 -0
- package/dist/components/base/icon/icon.js +113 -0
- package/dist/components/base/illustration/illustration.js +80 -0
- package/dist/components/base/infinite_scroll/infinite_scroll.js +196 -0
- package/dist/components/base/keyset_pagination/keyset_pagination.js +152 -0
- package/dist/components/base/label/label.js +174 -0
- package/dist/components/base/link/link.js +330 -0
- package/dist/components/base/loading_icon/loading_icon.js +120 -0
- package/dist/components/base/markdown/markdown.js +50 -0
- package/dist/components/base/modal/modal.js +259 -0
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +716 -0
- package/dist/components/base/new_dropdowns/base_dropdown/constants.js +5 -0
- package/dist/components/base/new_dropdowns/base_dropdown/dropdown_container.js +32 -0
- package/dist/components/base/new_dropdowns/constants.js +24 -0
- package/dist/components/base/new_dropdowns/disclosure/constants.js +8 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +400 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +112 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +196 -0
- package/dist/components/base/new_dropdowns/disclosure/mock_data.js +168 -0
- package/dist/components/base/new_dropdowns/disclosure/utils.js +84 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +997 -0
- package/dist/components/base/new_dropdowns/listbox/listbox_group.js +58 -0
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +112 -0
- package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +94 -0
- package/dist/components/base/new_dropdowns/listbox/mock_data.js +131 -0
- package/dist/components/base/new_dropdowns/listbox/utils.js +33 -0
- package/dist/components/base/pagination/pagination.js +397 -0
- package/dist/components/base/path/data.js +34 -0
- package/dist/components/base/path/path.js +177 -0
- package/dist/components/base/popover/popover.js +142 -0
- package/dist/components/base/progress_bar/progress_bar.js +117 -0
- package/dist/components/base/search_box_by_click/search_box_by_click.js +245 -0
- package/dist/components/base/search_box_by_type/search_box_by_type.js +187 -0
- package/dist/components/base/segmented_control/segmented_control.js +73 -0
- package/dist/components/base/skeleton_loader/skeleton_loader.js +232 -0
- package/dist/components/base/sorting/sorting.js +180 -0
- package/dist/components/base/table/constants.js +5 -0
- package/dist/components/base/table/table.js +187 -0
- package/dist/components/base/table_lite/table_lite.js +80 -0
- package/dist/components/base/tabs/constants.js +3 -0
- package/dist/components/base/tabs/tab/tab.js +113 -0
- package/dist/components/base/tabs/tabs/scrollable_tabs.js +162 -0
- package/dist/components/base/tabs/tabs/tabs.js +223 -0
- package/dist/components/base/toast/index.js +66 -0
- package/dist/components/base/toast/toast.js +125 -0
- package/dist/components/base/toast/toaster.js +87 -0
- package/dist/components/base/toggle/toggle.js +178 -0
- package/dist/components/base/token/token.js +97 -0
- package/dist/components/base/token_selector/helpers.js +5 -0
- package/dist/components/base/token_selector/token_container.js +160 -0
- package/dist/components/base/token_selector/token_selector.js +454 -0
- package/dist/components/base/token_selector/token_selector_dropdown.js +223 -0
- package/dist/components/base/tooltip/tooltip.js +54 -0
- package/dist/components/charts/area/area.js +329 -0
- package/dist/components/charts/bar/bar.js +207 -0
- package/dist/components/charts/chart/chart.js +215 -0
- package/dist/components/charts/column/column.js +221 -0
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +199 -0
- package/dist/components/charts/gauge/gauge.js +205 -0
- package/dist/components/charts/heatmap/heatmap.js +299 -0
- package/dist/components/charts/heatmap/index.js +2 -0
- package/dist/components/charts/legend/legend.js +245 -0
- package/dist/components/charts/line/line.js +340 -0
- package/dist/components/charts/series_label/series_label.js +101 -0
- package/dist/components/charts/shared/tooltip/tooltip.js +369 -0
- package/dist/components/charts/shared/tooltip/tooltip_default_format/tooltip_default_format.js +53 -0
- package/dist/components/charts/single_stat/single_stat.js +164 -0
- package/dist/components/charts/sparkline/sparkline.js +299 -0
- package/dist/components/charts/stacked_column/stacked_column.js +380 -0
- package/dist/components/dashboards/dashboard_layout/dashboard_layout.js +125 -0
- package/dist/components/dashboards/dashboard_layout/grid_layout/grid_layout.js +326 -0
- package/dist/components/dashboards/dashboard_layout/validators.js +14 -0
- package/dist/components/dashboards/dashboard_panel/dashboard_panel.js +236 -0
- package/dist/components/dashboards/mock_data.js +49 -0
- package/dist/components/experimental/experiment_badge/constants.js +4 -0
- package/dist/components/experimental/experiment_badge/experiment_badge.js +102 -0
- package/dist/components/extended/multi_step_form_template/multi_step_form_template.js +87 -0
- package/dist/components/index.js +107 -0
- package/dist/components/mixins/button_mixin.js +11 -0
- package/dist/components/mixins/safe_link_mixin.js +30 -0
- package/dist/components/mixins/tooltip_mixin.js +21 -0
- package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +53 -0
- package/dist/components/regions/empty_state/empty_state.js +181 -0
- package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +64 -0
- package/dist/components/shared_components/clipboard_button/clipboard_button.js +100 -0
- package/dist/components/shared_components/close_button/close_button.js +55 -0
- package/dist/components/utilities/animated_number/animated_number.js +131 -0
- package/dist/components/utilities/friendly_wrap/friendly_wrap.js +75 -0
- package/dist/components/utilities/intersection_observer/intersection_observer.js +88 -0
- package/dist/components/utilities/intersperse/intersperse.js +104 -0
- package/dist/components/utilities/sprintf/sprintf.js +171 -0
- package/dist/components/utilities/truncate/constants.js +8 -0
- package/dist/components/utilities/truncate/truncate.js +154 -0
- package/dist/components/utilities/truncate_text/constants.js +7 -0
- package/dist/components/utilities/truncate_text/truncate_text.js +146 -0
- package/dist/config.js +53 -0
- package/dist/directives/hover_load/hover_load.js +45 -0
- package/dist/directives/index.js +8 -0
- package/dist/directives/modal.js +1 -0
- package/dist/directives/outside/outside.js +149 -0
- package/dist/directives/resize_observer/resize_observer.js +58 -0
- package/dist/directives/safe_html/constants.js +6 -0
- package/dist/directives/safe_html/safe_html.js +39 -0
- package/dist/directives/safe_link/mock_data.js +10 -0
- package/dist/directives/safe_link/safe_link.js +67 -0
- package/dist/directives/tooltip/container.js +7 -0
- package/dist/directives/tooltip/tooltip.js +18 -0
- package/dist/index.css +7 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +2 -0
- package/dist/tailwind.css +2 -0
- package/dist/tailwind.css.map +1 -0
- package/dist/tokens/build/js/tokens.dark.js +1410 -0
- package/dist/tokens/build/js/tokens.js +1410 -0
- package/dist/tokens/common_story_options.js +29 -0
- package/dist/tokens/tokens_story.js +76 -0
- package/dist/utils/breakpoints.js +20 -0
- package/dist/utils/charts/config.js +616 -0
- package/dist/utils/charts/constants.js +69 -0
- package/dist/utils/charts/mock_data.js +191 -0
- package/dist/utils/charts/story_config.js +24 -0
- package/dist/utils/charts/theme.js +200 -0
- package/dist/utils/charts/utils.js +54 -0
- package/dist/utils/constants.js +331 -0
- package/dist/utils/data_utils.js +19 -0
- package/dist/utils/datetime_utility.js +61 -0
- package/dist/utils/equality_utils.js +84 -0
- package/dist/utils/form_options_utils.js +46 -0
- package/dist/utils/i18n.js +65 -0
- package/dist/utils/is_slot_empty.js +34 -0
- package/dist/utils/number_utils.js +132 -0
- package/dist/utils/play_utils.js +11 -0
- package/dist/utils/set_utils.js +25 -0
- package/dist/utils/stories_constants.js +29 -0
- package/dist/utils/stories_utils.js +62 -0
- package/dist/utils/story_decorators/container.js +19 -0
- package/dist/utils/string_utils.js +69 -0
- package/dist/utils/svgs/svg_paths.js +7 -0
- package/dist/utils/test_utils.js +33 -0
- package/dist/utils/use_fake_date.js +29 -0
- package/dist/utils/use_mock_intersection_observer.js +105 -0
- package/dist/utils/utils.js +205 -0
- package/dist/utils/vue_utils.js +57 -0
- package/dist/utils.js +5 -0
- package/dist/vendor/bootstrap-vue/src/bv-config.js +8 -0
- package/dist/vendor/bootstrap-vue/src/components/button/button-close.js +81 -0
- package/dist/vendor/bootstrap-vue/src/components/button/button.js +204 -0
- package/dist/vendor/bootstrap-vue/src/components/button/index.js +2 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.js +41 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.js +52 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.js +75 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.js +52 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.js +85 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.js +97 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.js +60 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown.js +270 -0
- package/dist/vendor/bootstrap-vue/src/components/dropdown/index.js +8 -0
- package/dist/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.js +53 -0
- package/dist/vendor/bootstrap-vue/src/components/form/form-text.js +55 -0
- package/dist/vendor/bootstrap-vue/src/components/form/form-valid-feedback.js +53 -0
- package/dist/vendor/bootstrap-vue/src/components/form/form.js +56 -0
- package/dist/vendor/bootstrap-vue/src/components/form/index.js +4 -0
- package/dist/vendor/bootstrap-vue/src/components/form-group/form-group.js +347 -0
- package/dist/vendor/bootstrap-vue/src/components/form-group/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.js +54 -0
- package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option.js +41 -0
- package/dist/vendor/bootstrap-vue/src/components/form-select/form-select.js +143 -0
- package/dist/vendor/bootstrap-vue/src/components/form-select/helpers/mixin-options.js +56 -0
- package/dist/vendor/bootstrap-vue/src/components/form-select/index.js +3 -0
- package/dist/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +217 -0
- package/dist/vendor/bootstrap-vue/src/components/form-textarea/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/components/layout/col.js +155 -0
- package/dist/vendor/bootstrap-vue/src/components/layout/form-row.js +34 -0
- package/dist/vendor/bootstrap-vue/src/components/layout/index.js +2 -0
- package/dist/vendor/bootstrap-vue/src/components/link/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/components/link/link.js +283 -0
- package/dist/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal-event.class.js +21 -0
- package/dist/vendor/bootstrap-vue/src/components/modal/helpers/modal-manager.js +212 -0
- package/dist/vendor/bootstrap-vue/src/components/modal/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/components/modal/modal.js +1059 -0
- package/dist/vendor/bootstrap-vue/src/components/popover/helpers/bv-popover-template.js +55 -0
- package/dist/vendor/bootstrap-vue/src/components/popover/helpers/bv-popover.js +31 -0
- package/dist/vendor/bootstrap-vue/src/components/popover/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/components/popover/popover.js +49 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/constants.js +22 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/default-sort-compare.js +64 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/filter-event.js +40 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-bottom-row.js +43 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-busy.js +83 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-caption.js +50 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-colgroup.js +32 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-empty.js +82 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-filtering.js +292 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-items.js +154 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-pagination.js +44 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-provider.js +191 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-selectable.js +213 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-sorting.js +274 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-stacked.js +39 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-table-renderer.js +186 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-tbody-row.js +338 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-tbody.js +243 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-tfoot.js +50 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-thead.js +218 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-top-row.js +42 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/normalize-fields.js +86 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/sanitize-row.js +31 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/stringify-record-values.js +11 -0
- package/dist/vendor/bootstrap-vue/src/components/table/helpers/text-selection-active.js +14 -0
- package/dist/vendor/bootstrap-vue/src/components/table/index.js +9 -0
- package/dist/vendor/bootstrap-vue/src/components/table/table-lite.js +51 -0
- package/dist/vendor/bootstrap-vue/src/components/table/table-simple.js +44 -0
- package/dist/vendor/bootstrap-vue/src/components/table/table.js +67 -0
- package/dist/vendor/bootstrap-vue/src/components/table/tbody.js +116 -0
- package/dist/vendor/bootstrap-vue/src/components/table/td.js +204 -0
- package/dist/vendor/bootstrap-vue/src/components/table/tfoot.js +96 -0
- package/dist/vendor/bootstrap-vue/src/components/table/th.js +26 -0
- package/dist/vendor/bootstrap-vue/src/components/table/thead.js +99 -0
- package/dist/vendor/bootstrap-vue/src/components/table/tr.js +121 -0
- package/dist/vendor/bootstrap-vue/src/components/tabs/index.js +2 -0
- package/dist/vendor/bootstrap-vue/src/components/tabs/tab.js +238 -0
- package/dist/vendor/bootstrap-vue/src/components/tabs/tabs.js +690 -0
- package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-popper.js +251 -0
- package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip-template.js +118 -0
- package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +932 -0
- package/dist/vendor/bootstrap-vue/src/components/tooltip/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/components/tooltip/tooltip.js +337 -0
- package/dist/vendor/bootstrap-vue/src/components/transition/bv-transition.js +103 -0
- package/dist/vendor/bootstrap-vue/src/components/transporter/transporter.js +205 -0
- package/dist/vendor/bootstrap-vue/src/constants/components.js +55 -0
- package/dist/vendor/bootstrap-vue/src/constants/config.js +11 -0
- package/dist/vendor/bootstrap-vue/src/constants/env.js +36 -0
- package/dist/vendor/bootstrap-vue/src/constants/events.js +56 -0
- package/dist/vendor/bootstrap-vue/src/constants/key-codes.js +11 -0
- package/dist/vendor/bootstrap-vue/src/constants/popper.js +10 -0
- package/dist/vendor/bootstrap-vue/src/constants/props.js +24 -0
- package/dist/vendor/bootstrap-vue/src/constants/regex.js +35 -0
- package/dist/vendor/bootstrap-vue/src/constants/safe-types.js +15 -0
- package/dist/vendor/bootstrap-vue/src/constants/slots.js +36 -0
- package/dist/vendor/bootstrap-vue/src/directives/modal/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/directives/modal/modal.js +112 -0
- package/dist/vendor/bootstrap-vue/src/directives/tooltip/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/directives/tooltip/tooltip.js +267 -0
- package/dist/vendor/bootstrap-vue/src/directives/visible/index.js +1 -0
- package/dist/vendor/bootstrap-vue/src/directives/visible/visible.js +187 -0
- package/dist/vendor/bootstrap-vue/src/mixins/attrs.js +5 -0
- package/dist/vendor/bootstrap-vue/src/mixins/click-out.js +54 -0
- package/dist/vendor/bootstrap-vue/src/mixins/dropdown.js +470 -0
- package/dist/vendor/bootstrap-vue/src/mixins/focus-in.js +46 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-control.js +73 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-custom.js +26 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-options.js +91 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-selection.js +62 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-size.js +26 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-state.js +50 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-text.js +293 -0
- package/dist/vendor/bootstrap-vue/src/mixins/form-validity.js +50 -0
- package/dist/vendor/bootstrap-vue/src/mixins/has-listener.js +29 -0
- package/dist/vendor/bootstrap-vue/src/mixins/id.js +57 -0
- package/dist/vendor/bootstrap-vue/src/mixins/listen-on-document.js +62 -0
- package/dist/vendor/bootstrap-vue/src/mixins/listen-on-root.js +120 -0
- package/dist/vendor/bootstrap-vue/src/mixins/listen-on-window.js +62 -0
- package/dist/vendor/bootstrap-vue/src/mixins/listeners.js +25 -0
- package/dist/vendor/bootstrap-vue/src/mixins/model.js +10 -0
- package/dist/vendor/bootstrap-vue/src/mixins/normalize-slot.js +30 -0
- package/dist/vendor/bootstrap-vue/src/mixins/scoped-style.js +18 -0
- package/dist/vendor/bootstrap-vue/src/mixins/use-parent.js +14 -0
- package/dist/vendor/bootstrap-vue/src/utils/array.js +27 -0
- package/dist/vendor/bootstrap-vue/src/utils/bv-event.class.js +60 -0
- package/dist/vendor/bootstrap-vue/src/utils/cache.js +60 -0
- package/dist/vendor/bootstrap-vue/src/utils/clone-deep.js +18 -0
- package/dist/vendor/bootstrap-vue/src/utils/config-set.js +86 -0
- package/dist/vendor/bootstrap-vue/src/utils/config.js +71 -0
- package/dist/vendor/bootstrap-vue/src/utils/create-new-child-component.js +133 -0
- package/dist/vendor/bootstrap-vue/src/utils/css-escape.js +70 -0
- package/dist/vendor/bootstrap-vue/src/utils/dom.js +298 -0
- package/dist/vendor/bootstrap-vue/src/utils/element-to-vue-instance-registry.js +28 -0
- package/dist/vendor/bootstrap-vue/src/utils/env.js +16 -0
- package/dist/vendor/bootstrap-vue/src/utils/events.js +78 -0
- package/dist/vendor/bootstrap-vue/src/utils/get-event-root.js +5 -0
- package/dist/vendor/bootstrap-vue/src/utils/get-instance-from-directive.js +3 -0
- package/dist/vendor/bootstrap-vue/src/utils/get-scope-id.js +9 -0
- package/dist/vendor/bootstrap-vue/src/utils/get.js +63 -0
- package/dist/vendor/bootstrap-vue/src/utils/html.js +16 -0
- package/dist/vendor/bootstrap-vue/src/utils/identity.js +3 -0
- package/dist/vendor/bootstrap-vue/src/utils/inspect.js +35 -0
- package/dist/vendor/bootstrap-vue/src/utils/locale.js +18 -0
- package/dist/vendor/bootstrap-vue/src/utils/loose-equal.js +59 -0
- package/dist/vendor/bootstrap-vue/src/utils/loose-index-of.js +13 -0
- package/dist/vendor/bootstrap-vue/src/utils/math.js +9 -0
- package/dist/vendor/bootstrap-vue/src/utils/memoize.js +14 -0
- package/dist/vendor/bootstrap-vue/src/utils/model.js +33 -0
- package/dist/vendor/bootstrap-vue/src/utils/noop.js +3 -0
- package/dist/vendor/bootstrap-vue/src/utils/normalize-slot.js +51 -0
- package/dist/vendor/bootstrap-vue/src/utils/number.js +23 -0
- package/dist/vendor/bootstrap-vue/src/utils/object.js +72 -0
- package/dist/vendor/bootstrap-vue/src/utils/observe-dom.js +76 -0
- package/dist/vendor/bootstrap-vue/src/utils/on-instance-destroy.js +22 -0
- package/dist/vendor/bootstrap-vue/src/utils/plugins.js +124 -0
- package/dist/vendor/bootstrap-vue/src/utils/props.js +67 -0
- package/dist/vendor/bootstrap-vue/src/utils/router.js +150 -0
- package/dist/vendor/bootstrap-vue/src/utils/safe-vue-instance.js +14 -0
- package/dist/vendor/bootstrap-vue/src/utils/stable-sort.js +28 -0
- package/dist/vendor/bootstrap-vue/src/utils/string.js +47 -0
- package/dist/vendor/bootstrap-vue/src/utils/stringify-object-values.js +31 -0
- package/dist/vendor/bootstrap-vue/src/utils/warn.js +45 -0
- package/dist/vendor/bootstrap-vue/src/vue.js +55 -0
- package/package.json +4 -3
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown.js +2 -2
- package/src/vendor/bootstrap-vue/src/components/form-group/form-group.js +2 -2
- package/src/vendor/bootstrap-vue/src/components/layout/col.js +2 -2
- package/src/vendor/bootstrap-vue/src/components/modal/modal.js +2 -2
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.js +2 -2
- package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +8 -9
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-document.js +1 -2
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-root.js +1 -2
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-window.js +1 -2
- package/src/vendor/bootstrap-vue/src/utils/array.js +0 -1
- package/src/vendor/bootstrap-vue/src/utils/locale.js +1 -2
|
@@ -0,0 +1,1059 @@
|
|
|
1
|
+
import { extend, COMPONENT_UID_KEY } from '../../vue';
|
|
2
|
+
import { NAME_MODAL } from '../../constants/components';
|
|
3
|
+
import { IS_BROWSER } from '../../constants/env';
|
|
4
|
+
import { EVENT_NAME_CHANGE, EVENT_NAME_SHOW, EVENT_NAME_HIDE, EVENT_NAME_TOGGLE, EVENT_NAME_OK, EVENT_NAME_CANCEL, EVENT_NAME_CLOSE, EVENT_NAME_HIDDEN, EVENT_NAME_SHOWN, EVENT_OPTIONS_NO_CAPTURE } from '../../constants/events';
|
|
5
|
+
import { CODE_ESC } from '../../constants/key-codes';
|
|
6
|
+
import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING, PROP_TYPE_ARRAY, PROP_TYPE_OBJECT } from '../../constants/props';
|
|
7
|
+
import { HTMLElement } from '../../constants/safe-types';
|
|
8
|
+
import { SLOT_NAME_MODAL_TITLE, SLOT_NAME_MODAL_HEADER, SLOT_NAME_MODAL_HEADER_CLOSE, SLOT_NAME_DEFAULT, SLOT_NAME_MODAL_FOOTER, SLOT_NAME_MODAL_CANCEL, SLOT_NAME_MODAL_OK, SLOT_NAME_MODAL_BACKDROP } from '../../constants/slots';
|
|
9
|
+
import { concat } from '../../utils/array';
|
|
10
|
+
import { getActiveElement, requestAF, contains, closest, getTabables, attemptFocus, select } from '../../utils/dom';
|
|
11
|
+
import { getRootActionEventName, getRootEventName, eventOn, eventOff } from '../../utils/events';
|
|
12
|
+
import { htmlOrText } from '../../utils/html';
|
|
13
|
+
import { identity } from '../../utils/identity';
|
|
14
|
+
import { isUndefinedOrNull, isString } from '../../utils/inspect';
|
|
15
|
+
import { makeModelMixin } from '../../utils/model';
|
|
16
|
+
import { sortKeys } from '../../utils/object';
|
|
17
|
+
import { observeDom } from '../../utils/observe-dom';
|
|
18
|
+
import { attrsMixin } from '../../mixins/attrs';
|
|
19
|
+
import { props as props$1, idMixin } from '../../mixins/id';
|
|
20
|
+
import { listenOnDocumentMixin } from '../../mixins/listen-on-document';
|
|
21
|
+
import { listenOnRootMixin } from '../../mixins/listen-on-root';
|
|
22
|
+
import { listenOnWindowMixin } from '../../mixins/listen-on-window';
|
|
23
|
+
import { normalizeSlotMixin } from '../../mixins/normalize-slot';
|
|
24
|
+
import { scopedStyleMixin } from '../../mixins/scoped-style';
|
|
25
|
+
import { BButton } from '../button/button';
|
|
26
|
+
import { BButtonClose } from '../button/button-close';
|
|
27
|
+
import { BVTransition } from '../transition/bv-transition';
|
|
28
|
+
import { BVTransporter } from '../transporter/transporter';
|
|
29
|
+
import { BvModalEvent } from './helpers/bv-modal-event.class';
|
|
30
|
+
import { modalManager } from './helpers/modal-manager';
|
|
31
|
+
|
|
32
|
+
// --- Constants ---
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
mixin: modelMixin,
|
|
36
|
+
props: modelProps,
|
|
37
|
+
prop: MODEL_PROP_NAME,
|
|
38
|
+
event: MODEL_EVENT_NAME
|
|
39
|
+
} = makeModelMixin('visible', {
|
|
40
|
+
type: PROP_TYPE_BOOLEAN,
|
|
41
|
+
defaultValue: false,
|
|
42
|
+
event: EVENT_NAME_CHANGE
|
|
43
|
+
});
|
|
44
|
+
const TRIGGER_BACKDROP = 'backdrop';
|
|
45
|
+
const TRIGGER_ESC = 'esc';
|
|
46
|
+
const TRIGGER_FORCE = 'FORCE';
|
|
47
|
+
const TRIGGER_TOGGLE = 'toggle';
|
|
48
|
+
const BUTTON_CANCEL = 'cancel';
|
|
49
|
+
// TODO: This should be renamed to 'close'
|
|
50
|
+
const BUTTON_CLOSE = 'headerclose';
|
|
51
|
+
const BUTTON_OK = 'ok';
|
|
52
|
+
const BUTTONS = [BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_OK];
|
|
53
|
+
|
|
54
|
+
// `ObserveDom` config to detect changes in modal content
|
|
55
|
+
// so that we can adjust the modal padding if needed
|
|
56
|
+
const OBSERVER_CONFIG = {
|
|
57
|
+
subtree: true,
|
|
58
|
+
childList: true,
|
|
59
|
+
characterData: true,
|
|
60
|
+
attributes: true,
|
|
61
|
+
attributeFilter: ['style', 'class']
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// --- Props ---
|
|
65
|
+
|
|
66
|
+
const props = sortKeys({
|
|
67
|
+
...props$1,
|
|
68
|
+
...modelProps,
|
|
69
|
+
ariaLabel: {
|
|
70
|
+
type: PROP_TYPE_STRING,
|
|
71
|
+
required: false,
|
|
72
|
+
default: undefined
|
|
73
|
+
},
|
|
74
|
+
autoFocusButton: {
|
|
75
|
+
type: PROP_TYPE_STRING,
|
|
76
|
+
required: false,
|
|
77
|
+
default: null,
|
|
78
|
+
validator: value => {
|
|
79
|
+
return isUndefinedOrNull(value) || BUTTONS.includes(value);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
bodyClass: {
|
|
83
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
84
|
+
required: false,
|
|
85
|
+
default: undefined
|
|
86
|
+
},
|
|
87
|
+
busy: {
|
|
88
|
+
type: PROP_TYPE_BOOLEAN,
|
|
89
|
+
required: false,
|
|
90
|
+
default: false
|
|
91
|
+
},
|
|
92
|
+
buttonSize: {
|
|
93
|
+
type: PROP_TYPE_STRING,
|
|
94
|
+
required: false,
|
|
95
|
+
default: undefined
|
|
96
|
+
},
|
|
97
|
+
cancelDisabled: {
|
|
98
|
+
type: PROP_TYPE_BOOLEAN,
|
|
99
|
+
required: false,
|
|
100
|
+
default: false
|
|
101
|
+
},
|
|
102
|
+
cancelTitle: {
|
|
103
|
+
type: PROP_TYPE_STRING,
|
|
104
|
+
required: false,
|
|
105
|
+
default: 'Cancel'
|
|
106
|
+
},
|
|
107
|
+
cancelTitleHtml: {
|
|
108
|
+
type: PROP_TYPE_STRING,
|
|
109
|
+
required: false,
|
|
110
|
+
default: undefined
|
|
111
|
+
},
|
|
112
|
+
cancelVariant: {
|
|
113
|
+
type: PROP_TYPE_STRING,
|
|
114
|
+
required: false,
|
|
115
|
+
default: 'secondary'
|
|
116
|
+
},
|
|
117
|
+
centered: {
|
|
118
|
+
type: PROP_TYPE_BOOLEAN,
|
|
119
|
+
required: false,
|
|
120
|
+
default: false
|
|
121
|
+
},
|
|
122
|
+
contentClass: {
|
|
123
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
124
|
+
required: false,
|
|
125
|
+
default: undefined
|
|
126
|
+
},
|
|
127
|
+
dialogClass: {
|
|
128
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
129
|
+
required: false,
|
|
130
|
+
default: undefined
|
|
131
|
+
},
|
|
132
|
+
footerClass: {
|
|
133
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
134
|
+
required: false,
|
|
135
|
+
default: undefined
|
|
136
|
+
},
|
|
137
|
+
footerTag: {
|
|
138
|
+
type: PROP_TYPE_STRING,
|
|
139
|
+
required: false,
|
|
140
|
+
default: 'footer'
|
|
141
|
+
},
|
|
142
|
+
headerClass: {
|
|
143
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
144
|
+
required: false,
|
|
145
|
+
default: undefined
|
|
146
|
+
},
|
|
147
|
+
headerCloseContent: {
|
|
148
|
+
type: PROP_TYPE_STRING,
|
|
149
|
+
required: false,
|
|
150
|
+
default: '×'
|
|
151
|
+
},
|
|
152
|
+
headerCloseLabel: {
|
|
153
|
+
type: PROP_TYPE_STRING,
|
|
154
|
+
required: false,
|
|
155
|
+
default: 'Close'
|
|
156
|
+
},
|
|
157
|
+
headerTag: {
|
|
158
|
+
type: PROP_TYPE_STRING,
|
|
159
|
+
required: false,
|
|
160
|
+
default: 'header'
|
|
161
|
+
},
|
|
162
|
+
// TODO: Rename to `noBackdrop` and deprecate `hideBackdrop`
|
|
163
|
+
hideBackdrop: {
|
|
164
|
+
type: PROP_TYPE_BOOLEAN,
|
|
165
|
+
required: false,
|
|
166
|
+
default: false
|
|
167
|
+
},
|
|
168
|
+
// TODO: Rename to `noFooter` and deprecate `hideFooter`
|
|
169
|
+
hideFooter: {
|
|
170
|
+
type: PROP_TYPE_BOOLEAN,
|
|
171
|
+
required: false,
|
|
172
|
+
default: false
|
|
173
|
+
},
|
|
174
|
+
// TODO: Rename to `noHeader` and deprecate `hideHeader`
|
|
175
|
+
hideHeader: {
|
|
176
|
+
type: PROP_TYPE_BOOLEAN,
|
|
177
|
+
required: false,
|
|
178
|
+
default: false
|
|
179
|
+
},
|
|
180
|
+
// TODO: Rename to `noHeaderClose` and deprecate `hideHeaderClose`
|
|
181
|
+
hideHeaderClose: {
|
|
182
|
+
type: PROP_TYPE_BOOLEAN,
|
|
183
|
+
required: false,
|
|
184
|
+
default: false
|
|
185
|
+
},
|
|
186
|
+
ignoreEnforceFocusSelector: {
|
|
187
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_STRING],
|
|
188
|
+
required: false,
|
|
189
|
+
default: undefined
|
|
190
|
+
},
|
|
191
|
+
lazy: {
|
|
192
|
+
type: PROP_TYPE_BOOLEAN,
|
|
193
|
+
required: false,
|
|
194
|
+
default: false
|
|
195
|
+
},
|
|
196
|
+
modalClass: {
|
|
197
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
198
|
+
required: false,
|
|
199
|
+
default: undefined
|
|
200
|
+
},
|
|
201
|
+
noCloseOnBackdrop: {
|
|
202
|
+
type: PROP_TYPE_BOOLEAN,
|
|
203
|
+
required: false,
|
|
204
|
+
default: false
|
|
205
|
+
},
|
|
206
|
+
noCloseOnEsc: {
|
|
207
|
+
type: PROP_TYPE_BOOLEAN,
|
|
208
|
+
required: false,
|
|
209
|
+
default: false
|
|
210
|
+
},
|
|
211
|
+
noEnforceFocus: {
|
|
212
|
+
type: PROP_TYPE_BOOLEAN,
|
|
213
|
+
required: false,
|
|
214
|
+
default: false
|
|
215
|
+
},
|
|
216
|
+
noFade: {
|
|
217
|
+
type: PROP_TYPE_BOOLEAN,
|
|
218
|
+
required: false,
|
|
219
|
+
default: false
|
|
220
|
+
},
|
|
221
|
+
noStacking: {
|
|
222
|
+
type: PROP_TYPE_BOOLEAN,
|
|
223
|
+
required: false,
|
|
224
|
+
default: false
|
|
225
|
+
},
|
|
226
|
+
okDisabled: {
|
|
227
|
+
type: PROP_TYPE_BOOLEAN,
|
|
228
|
+
required: false,
|
|
229
|
+
default: false
|
|
230
|
+
},
|
|
231
|
+
okOnly: {
|
|
232
|
+
type: PROP_TYPE_BOOLEAN,
|
|
233
|
+
required: false,
|
|
234
|
+
default: false
|
|
235
|
+
},
|
|
236
|
+
okTitle: {
|
|
237
|
+
type: PROP_TYPE_STRING,
|
|
238
|
+
required: false,
|
|
239
|
+
default: 'OK'
|
|
240
|
+
},
|
|
241
|
+
okTitleHtml: {
|
|
242
|
+
type: PROP_TYPE_STRING,
|
|
243
|
+
required: false,
|
|
244
|
+
default: undefined
|
|
245
|
+
},
|
|
246
|
+
okVariant: {
|
|
247
|
+
type: PROP_TYPE_STRING,
|
|
248
|
+
required: false,
|
|
249
|
+
default: 'primary'
|
|
250
|
+
},
|
|
251
|
+
// HTML Element, CSS selector string or Vue component instance
|
|
252
|
+
returnFocus: {
|
|
253
|
+
type: [HTMLElement, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
254
|
+
required: false,
|
|
255
|
+
default: undefined
|
|
256
|
+
},
|
|
257
|
+
scrollable: {
|
|
258
|
+
type: PROP_TYPE_BOOLEAN,
|
|
259
|
+
required: false,
|
|
260
|
+
default: false
|
|
261
|
+
},
|
|
262
|
+
size: {
|
|
263
|
+
type: PROP_TYPE_STRING,
|
|
264
|
+
required: false,
|
|
265
|
+
default: 'md'
|
|
266
|
+
},
|
|
267
|
+
static: {
|
|
268
|
+
type: PROP_TYPE_BOOLEAN,
|
|
269
|
+
required: false,
|
|
270
|
+
default: false
|
|
271
|
+
},
|
|
272
|
+
title: {
|
|
273
|
+
type: PROP_TYPE_STRING,
|
|
274
|
+
required: false,
|
|
275
|
+
default: undefined
|
|
276
|
+
},
|
|
277
|
+
titleClass: {
|
|
278
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
279
|
+
required: false,
|
|
280
|
+
default: undefined
|
|
281
|
+
},
|
|
282
|
+
titleHtml: {
|
|
283
|
+
type: PROP_TYPE_STRING,
|
|
284
|
+
required: false,
|
|
285
|
+
default: undefined
|
|
286
|
+
},
|
|
287
|
+
titleTag: {
|
|
288
|
+
type: PROP_TYPE_STRING,
|
|
289
|
+
required: false,
|
|
290
|
+
default: 'h5'
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// --- Main component ---
|
|
295
|
+
|
|
296
|
+
// @vue/component
|
|
297
|
+
const BModal = /*#__PURE__*/extend({
|
|
298
|
+
name: NAME_MODAL,
|
|
299
|
+
mixins: [attrsMixin, idMixin, modelMixin, listenOnDocumentMixin, listenOnRootMixin, listenOnWindowMixin, normalizeSlotMixin, scopedStyleMixin],
|
|
300
|
+
inheritAttrs: false,
|
|
301
|
+
props,
|
|
302
|
+
data() {
|
|
303
|
+
return {
|
|
304
|
+
isHidden: true,
|
|
305
|
+
// If modal should not be in document
|
|
306
|
+
isVisible: false,
|
|
307
|
+
// Controls modal visible state
|
|
308
|
+
isTransitioning: false,
|
|
309
|
+
// Used for style control
|
|
310
|
+
isShow: false,
|
|
311
|
+
// Used for style control
|
|
312
|
+
isBlock: false,
|
|
313
|
+
// Used for style control
|
|
314
|
+
isOpening: false,
|
|
315
|
+
// To signal that the modal is in the process of opening
|
|
316
|
+
isClosing: false,
|
|
317
|
+
// To signal that the modal is in the process of closing
|
|
318
|
+
ignoreBackdropClick: false,
|
|
319
|
+
// Used to signify if click out listener should ignore the click
|
|
320
|
+
isModalOverflowing: false,
|
|
321
|
+
// The following items are controlled by the modalManager instance
|
|
322
|
+
scrollbarWidth: 0,
|
|
323
|
+
zIndex: modalManager.getBaseZIndex(),
|
|
324
|
+
isTop: true,
|
|
325
|
+
isBodyOverflowing: false
|
|
326
|
+
};
|
|
327
|
+
},
|
|
328
|
+
computed: {
|
|
329
|
+
modalId() {
|
|
330
|
+
return this.safeId();
|
|
331
|
+
},
|
|
332
|
+
modalOuterId() {
|
|
333
|
+
return this.safeId('__BV_modal_outer_');
|
|
334
|
+
},
|
|
335
|
+
modalHeaderId() {
|
|
336
|
+
return this.safeId('__BV_modal_header_');
|
|
337
|
+
},
|
|
338
|
+
modalBodyId() {
|
|
339
|
+
return this.safeId('__BV_modal_body_');
|
|
340
|
+
},
|
|
341
|
+
modalTitleId() {
|
|
342
|
+
return this.safeId('__BV_modal_title_');
|
|
343
|
+
},
|
|
344
|
+
modalContentId() {
|
|
345
|
+
return this.safeId('__BV_modal_content_');
|
|
346
|
+
},
|
|
347
|
+
modalFooterId() {
|
|
348
|
+
return this.safeId('__BV_modal_footer_');
|
|
349
|
+
},
|
|
350
|
+
modalBackdropId() {
|
|
351
|
+
return this.safeId('__BV_modal_backdrop_');
|
|
352
|
+
},
|
|
353
|
+
modalClasses() {
|
|
354
|
+
return [{
|
|
355
|
+
fade: !this.noFade,
|
|
356
|
+
show: this.isShow,
|
|
357
|
+
'gl-block': this.isBlock
|
|
358
|
+
}, this.modalClass];
|
|
359
|
+
},
|
|
360
|
+
modalStyles() {
|
|
361
|
+
const sbWidth = `${this.scrollbarWidth}px`;
|
|
362
|
+
return {
|
|
363
|
+
paddingLeft: !this.isBodyOverflowing && this.isModalOverflowing ? sbWidth : '',
|
|
364
|
+
paddingRight: this.isBodyOverflowing && !this.isModalOverflowing ? sbWidth : ''
|
|
365
|
+
};
|
|
366
|
+
},
|
|
367
|
+
dialogClasses() {
|
|
368
|
+
return [{
|
|
369
|
+
[`modal-${this.size}`]: this.size,
|
|
370
|
+
'modal-dialog-centered': this.centered,
|
|
371
|
+
'modal-dialog-scrollable': this.scrollable
|
|
372
|
+
}, this.dialogClass];
|
|
373
|
+
},
|
|
374
|
+
modalOuterStyle() {
|
|
375
|
+
// Styles needed for proper stacking of modals
|
|
376
|
+
return {
|
|
377
|
+
position: 'absolute',
|
|
378
|
+
zIndex: this.zIndex
|
|
379
|
+
};
|
|
380
|
+
},
|
|
381
|
+
slotScope() {
|
|
382
|
+
return {
|
|
383
|
+
cancel: this.onCancel,
|
|
384
|
+
close: this.onClose,
|
|
385
|
+
hide: this.hide,
|
|
386
|
+
ok: this.onOk,
|
|
387
|
+
visible: this.isVisible
|
|
388
|
+
};
|
|
389
|
+
},
|
|
390
|
+
computeIgnoreEnforceFocusSelector() {
|
|
391
|
+
// Normalize to an single selector with selectors separated by `,`
|
|
392
|
+
return concat(this.ignoreEnforceFocusSelector).filter(identity).join(',').trim();
|
|
393
|
+
},
|
|
394
|
+
computedAttrs() {
|
|
395
|
+
// If the parent has a scoped style attribute, and the modal
|
|
396
|
+
// is portalled, add the scoped attribute to the modal wrapper
|
|
397
|
+
const scopedStyleAttrs = !this.static ? this.scopedStyleAttrs : {};
|
|
398
|
+
return {
|
|
399
|
+
...scopedStyleAttrs,
|
|
400
|
+
...this.bvAttrs,
|
|
401
|
+
id: this.modalOuterId
|
|
402
|
+
};
|
|
403
|
+
},
|
|
404
|
+
computedModalAttrs() {
|
|
405
|
+
const {
|
|
406
|
+
isVisible,
|
|
407
|
+
ariaLabel
|
|
408
|
+
} = this;
|
|
409
|
+
return {
|
|
410
|
+
id: this.modalId,
|
|
411
|
+
role: 'dialog',
|
|
412
|
+
'aria-hidden': isVisible ? null : 'true',
|
|
413
|
+
'aria-modal': isVisible ? 'true' : null,
|
|
414
|
+
'aria-label': ariaLabel,
|
|
415
|
+
'aria-labelledby': this.hideHeader || ariaLabel ||
|
|
416
|
+
// TODO: Rename slot to `title` and deprecate `modal-title`
|
|
417
|
+
!(this.hasNormalizedSlot(SLOT_NAME_MODAL_TITLE) || this.titleHtml || this.title) ? null : this.modalTitleId,
|
|
418
|
+
'aria-describedby': this.modalBodyId
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
watch: {
|
|
423
|
+
[MODEL_PROP_NAME](newValue, oldValue) {
|
|
424
|
+
if (newValue !== oldValue) {
|
|
425
|
+
this[newValue ? 'show' : 'hide']();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
created() {
|
|
430
|
+
// Define non-reactive properties
|
|
431
|
+
this.$_observer = null;
|
|
432
|
+
this.$_returnFocus = this.returnFocus || null;
|
|
433
|
+
},
|
|
434
|
+
mounted() {
|
|
435
|
+
// Set initial z-index as queried from the DOM
|
|
436
|
+
this.zIndex = modalManager.getBaseZIndex();
|
|
437
|
+
// Listen for events from others to either open or close ourselves
|
|
438
|
+
// and listen to all modals to enable/disable enforce focus
|
|
439
|
+
this.listenOnRoot(getRootActionEventName(NAME_MODAL, EVENT_NAME_SHOW), this.showHandler);
|
|
440
|
+
this.listenOnRoot(getRootActionEventName(NAME_MODAL, EVENT_NAME_HIDE), this.hideHandler);
|
|
441
|
+
this.listenOnRoot(getRootActionEventName(NAME_MODAL, EVENT_NAME_TOGGLE), this.toggleHandler);
|
|
442
|
+
// Listen for `bv:modal::show events`, and close ourselves if the
|
|
443
|
+
// opening modal not us
|
|
444
|
+
this.listenOnRoot(getRootEventName(NAME_MODAL, EVENT_NAME_SHOW), this.modalListener);
|
|
445
|
+
// Initially show modal?
|
|
446
|
+
if (this[MODEL_PROP_NAME] === true) {
|
|
447
|
+
this.$nextTick(this.show);
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
beforeDestroy() {
|
|
451
|
+
// Ensure everything is back to normal
|
|
452
|
+
modalManager.unregisterModal(this);
|
|
453
|
+
this.setObserver(false);
|
|
454
|
+
if (this.isVisible) {
|
|
455
|
+
this.isVisible = false;
|
|
456
|
+
this.isShow = false;
|
|
457
|
+
this.isTransitioning = false;
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
methods: {
|
|
461
|
+
setObserver() {
|
|
462
|
+
let on = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
463
|
+
this.$_observer && this.$_observer.disconnect();
|
|
464
|
+
this.$_observer = null;
|
|
465
|
+
if (on) {
|
|
466
|
+
this.$_observer = observeDom(this.$refs.content, this.checkModalOverflow.bind(this), OBSERVER_CONFIG);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
// Private method to update the v-model
|
|
470
|
+
updateModel(value) {
|
|
471
|
+
if (value !== this[MODEL_PROP_NAME]) {
|
|
472
|
+
this.$emit(MODEL_EVENT_NAME, value);
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
// Private method to create a BvModalEvent object
|
|
476
|
+
buildEvent(type) {
|
|
477
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
478
|
+
return new BvModalEvent(type, {
|
|
479
|
+
// Default options
|
|
480
|
+
cancelable: false,
|
|
481
|
+
target: this.$refs.modal || this.$el || null,
|
|
482
|
+
relatedTarget: null,
|
|
483
|
+
trigger: null,
|
|
484
|
+
// Supplied options
|
|
485
|
+
...options,
|
|
486
|
+
// Options that can't be overridden
|
|
487
|
+
vueTarget: this,
|
|
488
|
+
componentId: this.modalId
|
|
489
|
+
});
|
|
490
|
+
},
|
|
491
|
+
// Public method to show modal
|
|
492
|
+
show() {
|
|
493
|
+
if (this.isVisible || this.isOpening) {
|
|
494
|
+
// If already open, or in the process of opening, do nothing
|
|
495
|
+
/* istanbul ignore next */
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
/* istanbul ignore next */
|
|
499
|
+
if (this.isClosing) {
|
|
500
|
+
// If we are in the process of closing, wait until hidden before re-opening
|
|
501
|
+
/* istanbul ignore next */
|
|
502
|
+
this.$_showOnHidden = true;
|
|
503
|
+
/* istanbul ignore next */
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this.isOpening = true;
|
|
507
|
+
// Set the element to return focus to when closed
|
|
508
|
+
this.$_returnFocus = this.$_returnFocus || this.getActiveElement();
|
|
509
|
+
const showEvent = this.buildEvent(EVENT_NAME_SHOW, {
|
|
510
|
+
cancelable: true
|
|
511
|
+
});
|
|
512
|
+
this.emitEvent(showEvent);
|
|
513
|
+
// Don't show if canceled
|
|
514
|
+
if (showEvent.defaultPrevented || this.isVisible) {
|
|
515
|
+
this.isOpening = false;
|
|
516
|
+
// Ensure the v-model reflects the current state
|
|
517
|
+
this.updateModel(false);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
// Show the modal
|
|
521
|
+
this.doShow();
|
|
522
|
+
},
|
|
523
|
+
// Public method to hide modal
|
|
524
|
+
hide() {
|
|
525
|
+
let trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
526
|
+
if (!this.isVisible || this.isClosing) {
|
|
527
|
+
/* istanbul ignore next */
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
this.isClosing = true;
|
|
531
|
+
const hideEvent = this.buildEvent(EVENT_NAME_HIDE, {
|
|
532
|
+
cancelable: trigger !== TRIGGER_FORCE,
|
|
533
|
+
trigger: trigger || null
|
|
534
|
+
});
|
|
535
|
+
// We emit specific event for one of the three built-in buttons
|
|
536
|
+
if (trigger === BUTTON_OK) {
|
|
537
|
+
this.$emit(EVENT_NAME_OK, hideEvent);
|
|
538
|
+
} else if (trigger === BUTTON_CANCEL) {
|
|
539
|
+
this.$emit(EVENT_NAME_CANCEL, hideEvent);
|
|
540
|
+
} else if (trigger === BUTTON_CLOSE) {
|
|
541
|
+
this.$emit(EVENT_NAME_CLOSE, hideEvent);
|
|
542
|
+
}
|
|
543
|
+
this.emitEvent(hideEvent);
|
|
544
|
+
// Hide if not canceled
|
|
545
|
+
if (hideEvent.defaultPrevented || !this.isVisible) {
|
|
546
|
+
this.isClosing = false;
|
|
547
|
+
// Ensure v-model reflects current state
|
|
548
|
+
this.updateModel(true);
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
// Stop observing for content changes
|
|
552
|
+
this.setObserver(false);
|
|
553
|
+
// Trigger the hide transition
|
|
554
|
+
this.isVisible = false;
|
|
555
|
+
// Update the v-model
|
|
556
|
+
this.updateModel(false);
|
|
557
|
+
},
|
|
558
|
+
// Public method to toggle modal visibility
|
|
559
|
+
toggle(triggerEl) {
|
|
560
|
+
if (triggerEl) {
|
|
561
|
+
this.$_returnFocus = triggerEl;
|
|
562
|
+
}
|
|
563
|
+
if (this.isVisible) {
|
|
564
|
+
this.hide(TRIGGER_TOGGLE);
|
|
565
|
+
} else {
|
|
566
|
+
this.show();
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
// Private method to get the current document active element
|
|
570
|
+
getActiveElement() {
|
|
571
|
+
// Returning focus to `document.body` may cause unwanted scrolls,
|
|
572
|
+
// so we exclude setting focus on body
|
|
573
|
+
const activeElement = getActiveElement(IS_BROWSER ? [document.body] : []);
|
|
574
|
+
// Preset the fallback return focus value if it is not set
|
|
575
|
+
// `document.activeElement` should be the trigger element that was clicked or
|
|
576
|
+
// in the case of using the v-model, which ever element has current focus
|
|
577
|
+
// Will be overridden by some commands such as toggle, etc.
|
|
578
|
+
// Note: On IE 11, `document.activeElement` may be `null`
|
|
579
|
+
// So we test it for truthiness first
|
|
580
|
+
// https://github.com/bootstrap-vue/bootstrap-vue/issues/3206
|
|
581
|
+
return activeElement && activeElement.focus ? activeElement : null;
|
|
582
|
+
},
|
|
583
|
+
// Private method to finish showing modal
|
|
584
|
+
doShow() {
|
|
585
|
+
/* istanbul ignore next: commenting out for now until we can test stacking */
|
|
586
|
+
if (modalManager.modalsAreOpen && this.noStacking) {
|
|
587
|
+
// If another modal(s) is already open, wait for it(them) to close
|
|
588
|
+
this.listenOnRootOnce(getRootEventName(NAME_MODAL, EVENT_NAME_HIDDEN), this.doShow);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
modalManager.registerModal(this);
|
|
592
|
+
// Place modal in DOM
|
|
593
|
+
this.isHidden = false;
|
|
594
|
+
this.$nextTick(() => {
|
|
595
|
+
// We do this in `$nextTick()` to ensure the modal is in DOM first
|
|
596
|
+
// before we show it
|
|
597
|
+
this.isVisible = true;
|
|
598
|
+
this.isOpening = false;
|
|
599
|
+
// Update the v-model
|
|
600
|
+
this.updateModel(true);
|
|
601
|
+
this.$nextTick(() => {
|
|
602
|
+
// Observe changes in modal content and adjust if necessary
|
|
603
|
+
// In a `$nextTick()` in case modal content is lazy
|
|
604
|
+
this.setObserver(true);
|
|
605
|
+
});
|
|
606
|
+
});
|
|
607
|
+
},
|
|
608
|
+
// Transition handlers
|
|
609
|
+
onBeforeEnter() {
|
|
610
|
+
this.isTransitioning = true;
|
|
611
|
+
this.setResizeEvent(true);
|
|
612
|
+
},
|
|
613
|
+
onEnter() {
|
|
614
|
+
this.isBlock = true;
|
|
615
|
+
// We add the `show` class 1 frame later
|
|
616
|
+
// `requestAF()` runs the callback before the next repaint, so we need
|
|
617
|
+
// two calls to guarantee the next frame has been rendered
|
|
618
|
+
requestAF(() => {
|
|
619
|
+
requestAF(() => {
|
|
620
|
+
this.isShow = true;
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
},
|
|
624
|
+
onAfterEnter() {
|
|
625
|
+
this.checkModalOverflow();
|
|
626
|
+
this.isTransitioning = false;
|
|
627
|
+
// We use `requestAF()` to allow transition hooks to complete
|
|
628
|
+
// before passing control over to the other handlers
|
|
629
|
+
// This will allow users to not have to use `$nextTick()` or `requestAF()`
|
|
630
|
+
// when trying to pre-focus an element
|
|
631
|
+
requestAF(() => {
|
|
632
|
+
this.emitEvent(this.buildEvent(EVENT_NAME_SHOWN));
|
|
633
|
+
this.setEnforceFocus(true);
|
|
634
|
+
this.$nextTick(() => {
|
|
635
|
+
// Delayed in a `$nextTick()` to allow users time to pre-focus
|
|
636
|
+
// an element if the wish
|
|
637
|
+
this.focusFirst();
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
},
|
|
641
|
+
onBeforeLeave() {
|
|
642
|
+
this.isTransitioning = true;
|
|
643
|
+
this.setResizeEvent(false);
|
|
644
|
+
this.setEnforceFocus(false);
|
|
645
|
+
},
|
|
646
|
+
onLeave() {
|
|
647
|
+
// Remove the 'show' class
|
|
648
|
+
this.isShow = false;
|
|
649
|
+
},
|
|
650
|
+
onAfterLeave() {
|
|
651
|
+
this.isBlock = false;
|
|
652
|
+
this.isTransitioning = false;
|
|
653
|
+
this.isModalOverflowing = false;
|
|
654
|
+
this.isHidden = true;
|
|
655
|
+
this.$nextTick(() => {
|
|
656
|
+
this.isClosing = false;
|
|
657
|
+
modalManager.unregisterModal(this);
|
|
658
|
+
this.returnFocusTo();
|
|
659
|
+
// TODO: Need to find a way to pass the `trigger` property
|
|
660
|
+
// to the `hidden` event, not just only the `hide` event
|
|
661
|
+
this.emitEvent(this.buildEvent(EVENT_NAME_HIDDEN));
|
|
662
|
+
// Handle pending show request (show was called while closing)
|
|
663
|
+
if (this.$_showOnHidden) {
|
|
664
|
+
this.$_showOnHidden = false;
|
|
665
|
+
this.show();
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
},
|
|
669
|
+
emitEvent(bvEvent) {
|
|
670
|
+
const {
|
|
671
|
+
type
|
|
672
|
+
} = bvEvent;
|
|
673
|
+
// We emit on `$root` first in case a global listener wants to cancel
|
|
674
|
+
// the event first before the instance emits its event
|
|
675
|
+
this.emitOnRoot(getRootEventName(NAME_MODAL, type), bvEvent, bvEvent.componentId);
|
|
676
|
+
this.$emit(type, bvEvent);
|
|
677
|
+
},
|
|
678
|
+
// UI event handlers
|
|
679
|
+
onDialogMousedown() {
|
|
680
|
+
// Watch to see if the matching mouseup event occurs outside the dialog
|
|
681
|
+
// And if it does, cancel the clickOut handler
|
|
682
|
+
const modal = this.$refs.modal;
|
|
683
|
+
const onceModalMouseup = event => {
|
|
684
|
+
eventOff(modal, 'mouseup', onceModalMouseup, EVENT_OPTIONS_NO_CAPTURE);
|
|
685
|
+
if (event.target === modal) {
|
|
686
|
+
this.ignoreBackdropClick = true;
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
eventOn(modal, 'mouseup', onceModalMouseup, EVENT_OPTIONS_NO_CAPTURE);
|
|
690
|
+
},
|
|
691
|
+
onClickOut(event) {
|
|
692
|
+
if (this.ignoreBackdropClick) {
|
|
693
|
+
// Click was initiated inside the modal content, but finished outside.
|
|
694
|
+
// Set by the above onDialogMousedown handler
|
|
695
|
+
this.ignoreBackdropClick = false;
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
// Do nothing if not visible, backdrop click disabled, or element
|
|
699
|
+
// that generated click event is no longer in document body
|
|
700
|
+
if (!this.isVisible || this.noCloseOnBackdrop || !contains(document.body, event.target)) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
// If backdrop clicked, hide modal
|
|
704
|
+
if (!contains(this.$refs.content, event.target)) {
|
|
705
|
+
this.hide(TRIGGER_BACKDROP);
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
onOk() {
|
|
709
|
+
this.hide(BUTTON_OK);
|
|
710
|
+
},
|
|
711
|
+
onCancel() {
|
|
712
|
+
this.hide(BUTTON_CANCEL);
|
|
713
|
+
},
|
|
714
|
+
onClose() {
|
|
715
|
+
this.hide(BUTTON_CLOSE);
|
|
716
|
+
},
|
|
717
|
+
onEsc(event) {
|
|
718
|
+
// If ESC pressed, hide modal
|
|
719
|
+
if (event.keyCode === CODE_ESC && this.isVisible && !this.noCloseOnEsc) {
|
|
720
|
+
this.hide(TRIGGER_ESC);
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
// Document focusin listener
|
|
724
|
+
focusHandler(event) {
|
|
725
|
+
// If focus leaves modal content, bring it back
|
|
726
|
+
const content = this.$refs.content;
|
|
727
|
+
const {
|
|
728
|
+
target
|
|
729
|
+
} = event;
|
|
730
|
+
if (this.noEnforceFocus || !this.isTop || !this.isVisible || !content || document === target || contains(content, target) || this.computeIgnoreEnforceFocusSelector && closest(this.computeIgnoreEnforceFocusSelector, target, true)) {
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
const tabables = getTabables(this.$refs.content);
|
|
734
|
+
const bottomTrap = this.$refs['bottom-trap'];
|
|
735
|
+
const topTrap = this.$refs['top-trap'];
|
|
736
|
+
if (bottomTrap && target === bottomTrap) {
|
|
737
|
+
// If user pressed TAB out of modal into our bottom trab trap element
|
|
738
|
+
// Find the first tabable element in the modal content and focus it
|
|
739
|
+
if (attemptFocus(tabables[0])) {
|
|
740
|
+
// Focus was successful
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
} else if (topTrap && target === topTrap) {
|
|
744
|
+
// If user pressed CTRL-TAB out of modal and into our top tab trap element
|
|
745
|
+
// Find the last tabable element in the modal content and focus it
|
|
746
|
+
if (attemptFocus(tabables[tabables.length - 1])) {
|
|
747
|
+
// Focus was successful
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
// Otherwise focus the modal content container
|
|
752
|
+
attemptFocus(content, {
|
|
753
|
+
preventScroll: true
|
|
754
|
+
});
|
|
755
|
+
},
|
|
756
|
+
// Turn on/off focusin listener
|
|
757
|
+
setEnforceFocus(on) {
|
|
758
|
+
this.listenDocument(on, 'focusin', this.focusHandler);
|
|
759
|
+
},
|
|
760
|
+
// Resize listener
|
|
761
|
+
setResizeEvent(on) {
|
|
762
|
+
this.listenWindow(on, 'resize', this.checkModalOverflow);
|
|
763
|
+
this.listenWindow(on, 'orientationchange', this.checkModalOverflow);
|
|
764
|
+
},
|
|
765
|
+
// Root listener handlers
|
|
766
|
+
showHandler(id, triggerEl) {
|
|
767
|
+
if (id === this.modalId) {
|
|
768
|
+
this.$_returnFocus = triggerEl || this.getActiveElement();
|
|
769
|
+
this.show();
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
hideHandler(id) {
|
|
773
|
+
if (id === this.modalId) {
|
|
774
|
+
this.hide('event');
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
toggleHandler(id, triggerEl) {
|
|
778
|
+
if (id === this.modalId) {
|
|
779
|
+
this.toggle(triggerEl);
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
modalListener(bvEvent) {
|
|
783
|
+
// If another modal opens, close this one if stacking not permitted
|
|
784
|
+
if (this.noStacking && bvEvent.vueTarget !== this) {
|
|
785
|
+
this.hide();
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
// Focus control handlers
|
|
789
|
+
focusFirst() {
|
|
790
|
+
// Don't try and focus if we are SSR
|
|
791
|
+
if (IS_BROWSER) {
|
|
792
|
+
requestAF(() => {
|
|
793
|
+
const modal = this.$refs.modal;
|
|
794
|
+
const content = this.$refs.content;
|
|
795
|
+
const activeElement = this.getActiveElement();
|
|
796
|
+
// If the modal contains the activeElement, we don't do anything
|
|
797
|
+
if (modal && content && !(activeElement && contains(content, activeElement))) {
|
|
798
|
+
const ok = this.$refs['ok-button'];
|
|
799
|
+
const cancel = this.$refs['cancel-button'];
|
|
800
|
+
const close = this.$refs['close-button'];
|
|
801
|
+
// Focus the appropriate button or modal content wrapper
|
|
802
|
+
const autoFocus = this.autoFocusButton;
|
|
803
|
+
/* istanbul ignore next */
|
|
804
|
+
const el = autoFocus === BUTTON_OK && ok ? ok.$el || ok : autoFocus === BUTTON_CANCEL && cancel ? cancel.$el || cancel : autoFocus === BUTTON_CLOSE && close ? close.$el || close : content;
|
|
805
|
+
// Focus the element
|
|
806
|
+
attemptFocus(el);
|
|
807
|
+
if (el === content) {
|
|
808
|
+
// Make sure top of modal is showing (if longer than the viewport)
|
|
809
|
+
this.$nextTick(() => {
|
|
810
|
+
modal.scrollTop = 0;
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
returnFocusTo() {
|
|
818
|
+
// Prefer `returnFocus` prop over event specified
|
|
819
|
+
// `return_focus` value
|
|
820
|
+
let el = this.returnFocus || this.$_returnFocus || null;
|
|
821
|
+
this.$_returnFocus = null;
|
|
822
|
+
this.$nextTick(() => {
|
|
823
|
+
// Is el a string CSS selector?
|
|
824
|
+
el = isString(el) ? select(el) : el;
|
|
825
|
+
if (el) {
|
|
826
|
+
// Possibly could be a component reference
|
|
827
|
+
el = el.$el || el;
|
|
828
|
+
attemptFocus(el);
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
},
|
|
832
|
+
checkModalOverflow() {
|
|
833
|
+
if (this.isVisible) {
|
|
834
|
+
const modal = this.$refs.modal;
|
|
835
|
+
this.isModalOverflowing = modal.scrollHeight > document.documentElement.clientHeight;
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
makeModal(h) {
|
|
839
|
+
// Modal header
|
|
840
|
+
let $header = h();
|
|
841
|
+
if (!this.hideHeader) {
|
|
842
|
+
// TODO: Rename slot to `header` and deprecate `modal-header`
|
|
843
|
+
let $modalHeader = this.normalizeSlot(SLOT_NAME_MODAL_HEADER, this.slotScope);
|
|
844
|
+
if (!$modalHeader) {
|
|
845
|
+
let $closeButton = h();
|
|
846
|
+
if (!this.hideHeaderClose) {
|
|
847
|
+
$closeButton = h(BButtonClose, {
|
|
848
|
+
props: {
|
|
849
|
+
content: this.headerCloseContent,
|
|
850
|
+
disabled: this.isTransitioning,
|
|
851
|
+
ariaLabel: this.headerCloseLabel
|
|
852
|
+
},
|
|
853
|
+
on: {
|
|
854
|
+
click: this.onClose
|
|
855
|
+
},
|
|
856
|
+
ref: 'close-button'
|
|
857
|
+
},
|
|
858
|
+
// TODO: Rename slot to `header-close` and deprecate `modal-header-close`
|
|
859
|
+
[this.normalizeSlot(SLOT_NAME_MODAL_HEADER_CLOSE)]);
|
|
860
|
+
}
|
|
861
|
+
$modalHeader = [h(this.titleTag, {
|
|
862
|
+
staticClass: 'modal-title',
|
|
863
|
+
class: this.titleClass,
|
|
864
|
+
attrs: {
|
|
865
|
+
id: this.modalTitleId
|
|
866
|
+
},
|
|
867
|
+
// TODO: Rename slot to `title` and deprecate `modal-title`
|
|
868
|
+
domProps: this.hasNormalizedSlot(SLOT_NAME_MODAL_TITLE) ? {} : htmlOrText(this.titleHtml, this.title)
|
|
869
|
+
},
|
|
870
|
+
// TODO: Rename slot to `title` and deprecate `modal-title`
|
|
871
|
+
this.normalizeSlot(SLOT_NAME_MODAL_TITLE, this.slotScope)), $closeButton];
|
|
872
|
+
}
|
|
873
|
+
$header = h(this.headerTag, {
|
|
874
|
+
staticClass: 'modal-header',
|
|
875
|
+
class: this.headerClass,
|
|
876
|
+
attrs: {
|
|
877
|
+
id: this.modalHeaderId
|
|
878
|
+
},
|
|
879
|
+
ref: 'header'
|
|
880
|
+
}, [$modalHeader]);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// Modal body
|
|
884
|
+
const $body = h('div', {
|
|
885
|
+
staticClass: 'modal-body',
|
|
886
|
+
class: this.bodyClass,
|
|
887
|
+
attrs: {
|
|
888
|
+
id: this.modalBodyId
|
|
889
|
+
},
|
|
890
|
+
ref: 'body'
|
|
891
|
+
}, this.normalizeSlot(SLOT_NAME_DEFAULT, this.slotScope));
|
|
892
|
+
|
|
893
|
+
// Modal footer
|
|
894
|
+
let $footer = h();
|
|
895
|
+
if (!this.hideFooter) {
|
|
896
|
+
// TODO: Rename slot to `footer` and deprecate `modal-footer`
|
|
897
|
+
let $modalFooter = this.normalizeSlot(SLOT_NAME_MODAL_FOOTER, this.slotScope);
|
|
898
|
+
if (!$modalFooter) {
|
|
899
|
+
let $cancelButton = h();
|
|
900
|
+
if (!this.okOnly) {
|
|
901
|
+
$cancelButton = h(BButton, {
|
|
902
|
+
props: {
|
|
903
|
+
variant: this.cancelVariant,
|
|
904
|
+
size: this.buttonSize,
|
|
905
|
+
disabled: this.cancelDisabled || this.busy || this.isTransitioning
|
|
906
|
+
},
|
|
907
|
+
// TODO: Rename slot to `cancel-button` and deprecate `modal-cancel`
|
|
908
|
+
domProps: this.hasNormalizedSlot(SLOT_NAME_MODAL_CANCEL) ? {} : htmlOrText(this.cancelTitleHtml, this.cancelTitle),
|
|
909
|
+
on: {
|
|
910
|
+
click: this.onCancel
|
|
911
|
+
},
|
|
912
|
+
ref: 'cancel-button'
|
|
913
|
+
},
|
|
914
|
+
// TODO: Rename slot to `cancel-button` and deprecate `modal-cancel`
|
|
915
|
+
this.normalizeSlot(SLOT_NAME_MODAL_CANCEL));
|
|
916
|
+
}
|
|
917
|
+
const $okButton = h(BButton, {
|
|
918
|
+
props: {
|
|
919
|
+
variant: this.okVariant,
|
|
920
|
+
size: this.buttonSize,
|
|
921
|
+
disabled: this.okDisabled || this.busy || this.isTransitioning
|
|
922
|
+
},
|
|
923
|
+
// TODO: Rename slot to `ok-button` and deprecate `modal-ok`
|
|
924
|
+
domProps: this.hasNormalizedSlot(SLOT_NAME_MODAL_OK) ? {} : htmlOrText(this.okTitleHtml, this.okTitle),
|
|
925
|
+
on: {
|
|
926
|
+
click: this.onOk
|
|
927
|
+
},
|
|
928
|
+
ref: 'ok-button'
|
|
929
|
+
},
|
|
930
|
+
// TODO: Rename slot to `ok-button` and deprecate `modal-ok`
|
|
931
|
+
this.normalizeSlot(SLOT_NAME_MODAL_OK));
|
|
932
|
+
$modalFooter = [$cancelButton, $okButton];
|
|
933
|
+
}
|
|
934
|
+
$footer = h(this.footerTag, {
|
|
935
|
+
staticClass: 'modal-footer',
|
|
936
|
+
class: this.footerClass,
|
|
937
|
+
attrs: {
|
|
938
|
+
id: this.modalFooterId
|
|
939
|
+
},
|
|
940
|
+
ref: 'footer'
|
|
941
|
+
}, [$modalFooter]);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// Assemble modal content
|
|
945
|
+
const $modalContent = h('div', {
|
|
946
|
+
staticClass: 'modal-content',
|
|
947
|
+
class: this.contentClass,
|
|
948
|
+
attrs: {
|
|
949
|
+
id: this.modalContentId,
|
|
950
|
+
tabindex: '-1'
|
|
951
|
+
},
|
|
952
|
+
ref: 'content'
|
|
953
|
+
}, [$header, $body, $footer]);
|
|
954
|
+
|
|
955
|
+
// Tab traps to prevent page from scrolling to next element in
|
|
956
|
+
// tab index during enforce-focus tab cycle
|
|
957
|
+
let $tabTrapTop = h();
|
|
958
|
+
let $tabTrapBottom = h();
|
|
959
|
+
if (this.isVisible && !this.noEnforceFocus) {
|
|
960
|
+
$tabTrapTop = h('span', {
|
|
961
|
+
attrs: {
|
|
962
|
+
tabindex: '0'
|
|
963
|
+
},
|
|
964
|
+
ref: 'top-trap'
|
|
965
|
+
});
|
|
966
|
+
$tabTrapBottom = h('span', {
|
|
967
|
+
attrs: {
|
|
968
|
+
tabindex: '0'
|
|
969
|
+
},
|
|
970
|
+
ref: 'bottom-trap'
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// Modal dialog wrapper
|
|
975
|
+
const $modalDialog = h('div', {
|
|
976
|
+
staticClass: 'modal-dialog',
|
|
977
|
+
class: this.dialogClasses,
|
|
978
|
+
on: {
|
|
979
|
+
mousedown: this.onDialogMousedown
|
|
980
|
+
},
|
|
981
|
+
ref: 'dialog'
|
|
982
|
+
}, [$tabTrapTop, $modalContent, $tabTrapBottom]);
|
|
983
|
+
|
|
984
|
+
// Modal
|
|
985
|
+
let $modal = h('div', {
|
|
986
|
+
staticClass: 'modal',
|
|
987
|
+
class: this.modalClasses,
|
|
988
|
+
style: this.modalStyles,
|
|
989
|
+
attrs: this.computedModalAttrs,
|
|
990
|
+
on: {
|
|
991
|
+
keydown: this.onEsc,
|
|
992
|
+
click: this.onClickOut
|
|
993
|
+
},
|
|
994
|
+
directives: [{
|
|
995
|
+
name: 'show',
|
|
996
|
+
value: this.isVisible
|
|
997
|
+
}],
|
|
998
|
+
ref: 'modal'
|
|
999
|
+
}, [$modalDialog]);
|
|
1000
|
+
|
|
1001
|
+
// Wrap modal in transition
|
|
1002
|
+
// Sadly, we can't use `BVTransition` here due to the differences in
|
|
1003
|
+
// transition durations for `.modal` and `.modal-dialog`
|
|
1004
|
+
// At least until https://github.com/vuejs/vue/issues/9986 is resolved
|
|
1005
|
+
$modal = h('transition', {
|
|
1006
|
+
props: {
|
|
1007
|
+
enterClass: '',
|
|
1008
|
+
enterToClass: '',
|
|
1009
|
+
enterActiveClass: '',
|
|
1010
|
+
leaveClass: '',
|
|
1011
|
+
leaveActiveClass: '',
|
|
1012
|
+
leaveToClass: ''
|
|
1013
|
+
},
|
|
1014
|
+
on: {
|
|
1015
|
+
beforeEnter: this.onBeforeEnter,
|
|
1016
|
+
enter: this.onEnter,
|
|
1017
|
+
afterEnter: this.onAfterEnter,
|
|
1018
|
+
beforeLeave: this.onBeforeLeave,
|
|
1019
|
+
leave: this.onLeave,
|
|
1020
|
+
afterLeave: this.onAfterLeave
|
|
1021
|
+
}
|
|
1022
|
+
}, [$modal]);
|
|
1023
|
+
|
|
1024
|
+
// Modal backdrop
|
|
1025
|
+
let $backdrop = h();
|
|
1026
|
+
if (!this.hideBackdrop && this.isVisible) {
|
|
1027
|
+
$backdrop = h('div', {
|
|
1028
|
+
staticClass: 'modal-backdrop',
|
|
1029
|
+
attrs: {
|
|
1030
|
+
id: this.modalBackdropId
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
// TODO: Rename slot to `backdrop` and deprecate `modal-backdrop`
|
|
1034
|
+
this.normalizeSlot(SLOT_NAME_MODAL_BACKDROP));
|
|
1035
|
+
}
|
|
1036
|
+
$backdrop = h(BVTransition, {
|
|
1037
|
+
props: {
|
|
1038
|
+
noFade: this.noFade
|
|
1039
|
+
}
|
|
1040
|
+
}, [$backdrop]);
|
|
1041
|
+
|
|
1042
|
+
// Assemble modal and backdrop in an outer <div>
|
|
1043
|
+
return h('div', {
|
|
1044
|
+
style: this.modalOuterStyle,
|
|
1045
|
+
attrs: this.computedAttrs,
|
|
1046
|
+
key: `modal-outer-${this[COMPONENT_UID_KEY]}`
|
|
1047
|
+
}, [$modal, $backdrop]);
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
1050
|
+
render(h) {
|
|
1051
|
+
if (this.static) {
|
|
1052
|
+
return this.lazy && this.isHidden ? h() : this.makeModal(h);
|
|
1053
|
+
} else {
|
|
1054
|
+
return this.isHidden ? h() : h(BVTransporter, [this.makeModal(h)]);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
export { BModal, props };
|