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