@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,243 @@
|
|
|
1
|
+
import { extend } from '../../../vue';
|
|
2
|
+
import { EVENT_NAME_ROW_CLICKED, EVENT_NAME_ROW_MIDDLE_CLICKED, EVENT_NAME_ROW_CONTEXTMENU, EVENT_NAME_ROW_DBLCLICKED } from '../../../constants/events';
|
|
3
|
+
import { CODE_ENTER, CODE_SPACE, CODE_UP, CODE_DOWN, CODE_HOME, CODE_END } from '../../../constants/key-codes';
|
|
4
|
+
import { PROP_TYPE_ARRAY_OBJECT_STRING } from '../../../constants/props';
|
|
5
|
+
import { from } from '../../../utils/array';
|
|
6
|
+
import { isElement, closest, isActiveElement, attemptFocus } from '../../../utils/dom';
|
|
7
|
+
import { safeVueInstance } from '../../../utils/safe-vue-instance';
|
|
8
|
+
import { stopEvent } from '../../../utils/events';
|
|
9
|
+
import { sortKeys } from '../../../utils/object';
|
|
10
|
+
import { makeProp, pluckProps } from '../../../utils/props';
|
|
11
|
+
import { props as props$1, BTbody } from '../tbody';
|
|
12
|
+
import { filterEvent } from './filter-event';
|
|
13
|
+
import { textSelectionActive } from './text-selection-active';
|
|
14
|
+
import { props as props$2, tbodyRowMixin } from './mixin-tbody-row';
|
|
15
|
+
|
|
16
|
+
// --- Helper methods ---
|
|
17
|
+
|
|
18
|
+
const getCellSlotName = value => `cell(${value || ''})`;
|
|
19
|
+
|
|
20
|
+
// --- Props ---
|
|
21
|
+
|
|
22
|
+
const props = sortKeys({
|
|
23
|
+
...props$1,
|
|
24
|
+
...props$2,
|
|
25
|
+
tbodyClass: makeProp(PROP_TYPE_ARRAY_OBJECT_STRING)
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// --- Mixin ---
|
|
29
|
+
|
|
30
|
+
// @vue/component
|
|
31
|
+
const tbodyMixin = extend({
|
|
32
|
+
mixins: [tbodyRowMixin],
|
|
33
|
+
props,
|
|
34
|
+
beforeDestroy() {
|
|
35
|
+
this.$_bodyFieldSlotNameCache = null;
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
// Returns all the item TR elements (excludes detail and spacer rows)
|
|
39
|
+
// `this.$refs['item-rows']` is an array of item TR components/elements
|
|
40
|
+
// Rows should all be `<b-tr>` components, but we map to TR elements
|
|
41
|
+
// Also note that `this.$refs['item-rows']` may not always be in document order
|
|
42
|
+
getTbodyTrs() {
|
|
43
|
+
const {
|
|
44
|
+
$refs
|
|
45
|
+
} = this;
|
|
46
|
+
const tbody = $refs.tbody ? $refs.tbody.$el || $refs.tbody : null;
|
|
47
|
+
const trs = ($refs['item-rows'] || []).map(tr => tr.$el || tr);
|
|
48
|
+
return tbody && tbody.children && tbody.children.length > 0 && trs && trs.length > 0 ? from(tbody.children).filter(tr => trs.includes(tr)) : /* istanbul ignore next */[];
|
|
49
|
+
},
|
|
50
|
+
// Returns index of a particular TBODY item TR
|
|
51
|
+
// We set `true` on closest to include self in result
|
|
52
|
+
getTbodyTrIndex(el) {
|
|
53
|
+
/* istanbul ignore next: should not normally happen */
|
|
54
|
+
if (!isElement(el)) {
|
|
55
|
+
return -1;
|
|
56
|
+
}
|
|
57
|
+
const tr = el.tagName === 'TR' ? el : closest('tr', el, true);
|
|
58
|
+
return tr ? this.getTbodyTrs().indexOf(tr) : -1;
|
|
59
|
+
},
|
|
60
|
+
// Emits a row event, with the item object, row index and original event
|
|
61
|
+
emitTbodyRowEvent(type, event) {
|
|
62
|
+
if (type && event && event.target) {
|
|
63
|
+
const rowIndex = this.getTbodyTrIndex(event.target);
|
|
64
|
+
if (rowIndex > -1) {
|
|
65
|
+
// The array of TRs correlate to the `computedItems` array
|
|
66
|
+
const item = this.computedItems[rowIndex];
|
|
67
|
+
if (this.hasListener(type)) {
|
|
68
|
+
this.$emit(type, item, rowIndex, event);
|
|
69
|
+
}
|
|
70
|
+
// Call selectionHandler directly if selectable (defined in mixin-selectable.js)
|
|
71
|
+
if (type === EVENT_NAME_ROW_CLICKED && this.hasSelectableRowClick) {
|
|
72
|
+
this.selectionHandler(item, rowIndex, event);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
tbodyRowEventStopped(event) {
|
|
78
|
+
return this.stopIfBusy && this.stopIfBusy(event);
|
|
79
|
+
},
|
|
80
|
+
// Delegated row event handlers
|
|
81
|
+
onTbodyRowKeydown(event) {
|
|
82
|
+
// Keyboard navigation and row click emulation
|
|
83
|
+
const {
|
|
84
|
+
target,
|
|
85
|
+
keyCode
|
|
86
|
+
} = event;
|
|
87
|
+
if (this.tbodyRowEventStopped(event) || target.tagName !== 'TR' || !isActiveElement(target) || target.tabIndex !== 0) {
|
|
88
|
+
// Early exit if not an item row TR
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if ([CODE_ENTER, CODE_SPACE].includes(keyCode)) {
|
|
92
|
+
// Emulated click for keyboard users, transfer to click handler
|
|
93
|
+
stopEvent(event);
|
|
94
|
+
this.onTBodyRowClicked(event);
|
|
95
|
+
} else if ([CODE_UP, CODE_DOWN, CODE_HOME, CODE_END].includes(keyCode)) {
|
|
96
|
+
// Keyboard navigation
|
|
97
|
+
const rowIndex = this.getTbodyTrIndex(target);
|
|
98
|
+
if (rowIndex > -1) {
|
|
99
|
+
stopEvent(event);
|
|
100
|
+
const trs = this.getTbodyTrs();
|
|
101
|
+
const shift = event.shiftKey;
|
|
102
|
+
if (keyCode === CODE_HOME || shift && keyCode === CODE_UP) {
|
|
103
|
+
// Focus first row
|
|
104
|
+
attemptFocus(trs[0]);
|
|
105
|
+
} else if (keyCode === CODE_END || shift && keyCode === CODE_DOWN) {
|
|
106
|
+
// Focus last row
|
|
107
|
+
attemptFocus(trs[trs.length - 1]);
|
|
108
|
+
} else if (keyCode === CODE_UP && rowIndex > 0) {
|
|
109
|
+
// Focus previous row
|
|
110
|
+
attemptFocus(trs[rowIndex - 1]);
|
|
111
|
+
} else if (keyCode === CODE_DOWN && rowIndex < trs.length - 1) {
|
|
112
|
+
// Focus next row
|
|
113
|
+
attemptFocus(trs[rowIndex + 1]);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
onTBodyRowClicked(event) {
|
|
119
|
+
const {
|
|
120
|
+
$refs
|
|
121
|
+
} = this;
|
|
122
|
+
const tbody = $refs.tbody ? $refs.tbody.$el || $refs.tbody : null;
|
|
123
|
+
// Don't emit event when the table is busy, the user clicked
|
|
124
|
+
// on a non-disabled control or is selecting text
|
|
125
|
+
if (this.tbodyRowEventStopped(event) || filterEvent(event) || textSelectionActive(tbody || this.$el)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.emitTbodyRowEvent(EVENT_NAME_ROW_CLICKED, event);
|
|
129
|
+
},
|
|
130
|
+
onTbodyRowMiddleMouseRowClicked(event) {
|
|
131
|
+
if (!this.tbodyRowEventStopped(event) && event.which === 2) {
|
|
132
|
+
this.emitTbodyRowEvent(EVENT_NAME_ROW_MIDDLE_CLICKED, event);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
onTbodyRowContextmenu(event) {
|
|
136
|
+
if (!this.tbodyRowEventStopped(event)) {
|
|
137
|
+
this.emitTbodyRowEvent(EVENT_NAME_ROW_CONTEXTMENU, event);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
onTbodyRowDblClicked(event) {
|
|
141
|
+
if (!this.tbodyRowEventStopped(event) && !filterEvent(event)) {
|
|
142
|
+
this.emitTbodyRowEvent(EVENT_NAME_ROW_DBLCLICKED, event);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
// Render the tbody element and children
|
|
146
|
+
// Note:
|
|
147
|
+
// Row hover handlers are handled by the tbody-row mixin
|
|
148
|
+
// As mouseenter/mouseleave events do not bubble
|
|
149
|
+
renderTbody() {
|
|
150
|
+
const {
|
|
151
|
+
computedItems: items,
|
|
152
|
+
renderBusy,
|
|
153
|
+
renderTopRow,
|
|
154
|
+
renderEmpty,
|
|
155
|
+
renderBottomRow,
|
|
156
|
+
hasSelectableRowClick
|
|
157
|
+
} = safeVueInstance(this);
|
|
158
|
+
const h = this.$createElement;
|
|
159
|
+
const hasRowClickHandler = this.hasListener(EVENT_NAME_ROW_CLICKED) || hasSelectableRowClick;
|
|
160
|
+
|
|
161
|
+
// Prepare the tbody rows
|
|
162
|
+
const $rows = [];
|
|
163
|
+
|
|
164
|
+
// Add the item data rows or the busy slot
|
|
165
|
+
const $busy = renderBusy ? renderBusy() : null;
|
|
166
|
+
if ($busy) {
|
|
167
|
+
// If table is busy and a busy slot, then return only the busy "row" indicator
|
|
168
|
+
$rows.push($busy);
|
|
169
|
+
} else {
|
|
170
|
+
// Table isn't busy, or we don't have a busy slot
|
|
171
|
+
|
|
172
|
+
// Create a slot cache for improved performance when looking up cell slot names
|
|
173
|
+
// Values will be keyed by the field's `key` and will store the slot's name
|
|
174
|
+
// Slots could be dynamic (i.e. `v-if`), so we must compute on each render
|
|
175
|
+
// Used by tbody-row mixin render helper
|
|
176
|
+
const cache = {};
|
|
177
|
+
let defaultSlotName = getCellSlotName();
|
|
178
|
+
defaultSlotName = this.hasNormalizedSlot(defaultSlotName) ? defaultSlotName : null;
|
|
179
|
+
this.computedFields.forEach(field => {
|
|
180
|
+
const {
|
|
181
|
+
key
|
|
182
|
+
} = field;
|
|
183
|
+
const slotName = getCellSlotName(key);
|
|
184
|
+
const lowercaseSlotName = getCellSlotName(key.toLowerCase());
|
|
185
|
+
cache[key] = this.hasNormalizedSlot(slotName) ? slotName : this.hasNormalizedSlot(lowercaseSlotName) ? /* istanbul ignore next */lowercaseSlotName : defaultSlotName;
|
|
186
|
+
});
|
|
187
|
+
// Created as a non-reactive property so to not trigger component updates
|
|
188
|
+
// Must be a fresh object each render
|
|
189
|
+
this.$_bodyFieldSlotNameCache = cache;
|
|
190
|
+
|
|
191
|
+
// Add static top row slot (hidden in visibly stacked mode
|
|
192
|
+
// as we can't control `data-label` attr)
|
|
193
|
+
$rows.push(renderTopRow ? renderTopRow() : h());
|
|
194
|
+
|
|
195
|
+
// Render the rows
|
|
196
|
+
items.forEach((item, rowIndex) => {
|
|
197
|
+
// Render the individual item row (rows if details slot)
|
|
198
|
+
$rows.push(this.renderTbodyRow(item, rowIndex));
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Empty items / empty filtered row slot (only shows if `items.length < 1`)
|
|
202
|
+
$rows.push(renderEmpty ? renderEmpty() : h());
|
|
203
|
+
|
|
204
|
+
// Static bottom row slot (hidden in visibly stacked mode
|
|
205
|
+
// as we can't control `data-label` attr)
|
|
206
|
+
$rows.push(renderBottomRow ? renderBottomRow() : h());
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Note: these events will only emit if a listener is registered
|
|
210
|
+
const handlers = {
|
|
211
|
+
auxclick: this.onTbodyRowMiddleMouseRowClicked,
|
|
212
|
+
// TODO:
|
|
213
|
+
// Perhaps we do want to automatically prevent the
|
|
214
|
+
// default context menu from showing if there is a
|
|
215
|
+
// `row-contextmenu` listener registered
|
|
216
|
+
contextmenu: this.onTbodyRowContextmenu,
|
|
217
|
+
// The following event(s) is not considered A11Y friendly
|
|
218
|
+
dblclick: this.onTbodyRowDblClicked
|
|
219
|
+
// Hover events (`mouseenter`/`mouseleave`) are handled by `tbody-row` mixin
|
|
220
|
+
};
|
|
221
|
+
// Add in click/keydown listeners if needed
|
|
222
|
+
if (hasRowClickHandler) {
|
|
223
|
+
handlers.click = this.onTBodyRowClicked;
|
|
224
|
+
handlers.keydown = this.onTbodyRowKeydown;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Assemble rows into the tbody
|
|
228
|
+
const $tbody = h(BTbody, {
|
|
229
|
+
class: this.tbodyClass || null,
|
|
230
|
+
props: pluckProps(props$1, this.$props),
|
|
231
|
+
// BTbody transfers all native event listeners to the root element
|
|
232
|
+
// TODO: Only set the handlers if the table is not busy
|
|
233
|
+
on: handlers,
|
|
234
|
+
ref: 'tbody'
|
|
235
|
+
}, $rows);
|
|
236
|
+
|
|
237
|
+
// Return the assembled tbody
|
|
238
|
+
return $tbody;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
export { props, tbodyMixin };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { extend } from '../../../vue';
|
|
2
|
+
import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING, PROP_TYPE_ARRAY_OBJECT_STRING } from '../../../constants/props';
|
|
3
|
+
import { SLOT_NAME_CUSTOM_FOOT } from '../../../constants/slots';
|
|
4
|
+
import { makeProp } from '../../../utils/props';
|
|
5
|
+
import { BTfoot } from '../tfoot';
|
|
6
|
+
|
|
7
|
+
// --- Props ---
|
|
8
|
+
|
|
9
|
+
const props = {
|
|
10
|
+
footClone: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
11
|
+
// Any Bootstrap theme variant (or custom)
|
|
12
|
+
// Falls back to `headRowVariant`
|
|
13
|
+
footRowVariant: makeProp(PROP_TYPE_STRING),
|
|
14
|
+
// 'dark', 'light', or `null` (or custom)
|
|
15
|
+
footVariant: makeProp(PROP_TYPE_STRING),
|
|
16
|
+
tfootClass: makeProp(PROP_TYPE_ARRAY_OBJECT_STRING),
|
|
17
|
+
tfootTrClass: makeProp(PROP_TYPE_ARRAY_OBJECT_STRING)
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// --- Mixin ---
|
|
21
|
+
|
|
22
|
+
// @vue/component
|
|
23
|
+
const tfootMixin = extend({
|
|
24
|
+
props,
|
|
25
|
+
methods: {
|
|
26
|
+
renderTFootCustom() {
|
|
27
|
+
const h = this.$createElement;
|
|
28
|
+
if (this.hasNormalizedSlot(SLOT_NAME_CUSTOM_FOOT)) {
|
|
29
|
+
return h(BTfoot, {
|
|
30
|
+
class: this.tfootClass || null,
|
|
31
|
+
props: {
|
|
32
|
+
footVariant: this.footVariant || this.headVariant || null
|
|
33
|
+
},
|
|
34
|
+
key: 'bv-tfoot-custom'
|
|
35
|
+
}, this.normalizeSlot(SLOT_NAME_CUSTOM_FOOT, {
|
|
36
|
+
items: this.computedItems.slice(),
|
|
37
|
+
fields: this.computedFields.slice(),
|
|
38
|
+
columns: this.computedFields.length
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
return h();
|
|
42
|
+
},
|
|
43
|
+
renderTfoot() {
|
|
44
|
+
// Passing true to renderThead will make it render a tfoot
|
|
45
|
+
return this.footClone ? this.renderThead(true) : this.renderTFootCustom();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export { props, tfootMixin };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { extend } from '../../../vue';
|
|
2
|
+
import { EVENT_NAME_HEAD_CLICKED } from '../../../constants/events';
|
|
3
|
+
import { CODE_ENTER, CODE_SPACE } from '../../../constants/key-codes';
|
|
4
|
+
import { PROP_TYPE_STRING, PROP_TYPE_ARRAY_OBJECT_STRING } from '../../../constants/props';
|
|
5
|
+
import { SLOT_NAME_THEAD_TOP } from '../../../constants/slots';
|
|
6
|
+
import { stopEvent } from '../../../utils/events';
|
|
7
|
+
import { htmlOrText } from '../../../utils/html';
|
|
8
|
+
import { identity } from '../../../utils/identity';
|
|
9
|
+
import { isUndefinedOrNull } from '../../../utils/inspect';
|
|
10
|
+
import { noop } from '../../../utils/noop';
|
|
11
|
+
import { makeProp } from '../../../utils/props';
|
|
12
|
+
import { safeVueInstance } from '../../../utils/safe-vue-instance';
|
|
13
|
+
import { startCase } from '../../../utils/string';
|
|
14
|
+
import { BThead } from '../thead';
|
|
15
|
+
import { BTfoot } from '../tfoot';
|
|
16
|
+
import { BTr } from '../tr';
|
|
17
|
+
import { BTh } from '../th';
|
|
18
|
+
import { filterEvent } from './filter-event';
|
|
19
|
+
import { textSelectionActive } from './text-selection-active';
|
|
20
|
+
|
|
21
|
+
// --- Helper methods ---
|
|
22
|
+
|
|
23
|
+
const getHeadSlotName = value => `head(${value || ''})`;
|
|
24
|
+
const getFootSlotName = value => `foot(${value || ''})`;
|
|
25
|
+
|
|
26
|
+
// --- Props ---
|
|
27
|
+
|
|
28
|
+
const props = {
|
|
29
|
+
// Any Bootstrap theme variant (or custom)
|
|
30
|
+
headRowVariant: makeProp(PROP_TYPE_STRING),
|
|
31
|
+
// 'light', 'dark' or `null` (or custom)
|
|
32
|
+
headVariant: makeProp(PROP_TYPE_STRING),
|
|
33
|
+
theadClass: makeProp(PROP_TYPE_ARRAY_OBJECT_STRING),
|
|
34
|
+
theadTrClass: makeProp(PROP_TYPE_ARRAY_OBJECT_STRING)
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// --- Mixin ---
|
|
38
|
+
|
|
39
|
+
// @vue/component
|
|
40
|
+
const theadMixin = extend({
|
|
41
|
+
props,
|
|
42
|
+
methods: {
|
|
43
|
+
fieldClasses(field) {
|
|
44
|
+
// Header field (<th>) classes
|
|
45
|
+
return [field.class ? field.class : '', field.thClass ? field.thClass : ''];
|
|
46
|
+
},
|
|
47
|
+
headClicked(event, field, isFoot) {
|
|
48
|
+
if (this.stopIfBusy && this.stopIfBusy(event)) {
|
|
49
|
+
// If table is busy (via provider) then don't propagate
|
|
50
|
+
return;
|
|
51
|
+
} else if (filterEvent(event)) {
|
|
52
|
+
// Clicked on a non-disabled control so ignore
|
|
53
|
+
return;
|
|
54
|
+
} else if (textSelectionActive(this.$el)) {
|
|
55
|
+
// User is selecting text, so ignore
|
|
56
|
+
/* istanbul ignore next: JSDOM doesn't support getSelection() */
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
stopEvent(event);
|
|
60
|
+
this.$emit(EVENT_NAME_HEAD_CLICKED, field.key, field, event, isFoot);
|
|
61
|
+
// Call handleSort directly if sortable (defined in mixin-sorting.js)
|
|
62
|
+
if (this.isSortable) {
|
|
63
|
+
this.handleSort(field.key, field, event, isFoot);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
renderThead() {
|
|
67
|
+
let isFoot = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
68
|
+
const {
|
|
69
|
+
computedFields: fields,
|
|
70
|
+
isSortable,
|
|
71
|
+
isSelectable,
|
|
72
|
+
headVariant,
|
|
73
|
+
footVariant,
|
|
74
|
+
headRowVariant,
|
|
75
|
+
footRowVariant
|
|
76
|
+
} = safeVueInstance(this);
|
|
77
|
+
const h = this.$createElement;
|
|
78
|
+
|
|
79
|
+
// In always stacked mode, we don't bother rendering the head/foot
|
|
80
|
+
// Or if no field headings (empty table)
|
|
81
|
+
if (this.isStackedAlways || fields.length === 0) {
|
|
82
|
+
return h();
|
|
83
|
+
}
|
|
84
|
+
const hasHeadClickListener = isSortable || this.hasListener(EVENT_NAME_HEAD_CLICKED);
|
|
85
|
+
|
|
86
|
+
// Reference to `selectAllRows` and `clearSelected()`, if table is selectable
|
|
87
|
+
const selectAllRows = isSelectable ? this.selectAllRows : noop;
|
|
88
|
+
const clearSelected = isSelectable ? this.clearSelected : noop;
|
|
89
|
+
|
|
90
|
+
// Helper function to generate a field <th> cell
|
|
91
|
+
const makeCell = (field, colIndex) => {
|
|
92
|
+
const {
|
|
93
|
+
label,
|
|
94
|
+
labelHtml,
|
|
95
|
+
variant,
|
|
96
|
+
stickyColumn,
|
|
97
|
+
key
|
|
98
|
+
} = field;
|
|
99
|
+
let ariaLabel = null;
|
|
100
|
+
if (!field.label.trim() && !field.headerTitle) {
|
|
101
|
+
// In case field's label and title are empty/blank
|
|
102
|
+
// We need to add a hint about what the column is about for non-sighted users
|
|
103
|
+
/* istanbul ignore next */
|
|
104
|
+
ariaLabel = startCase(field.key);
|
|
105
|
+
}
|
|
106
|
+
const on = {};
|
|
107
|
+
if (hasHeadClickListener) {
|
|
108
|
+
on.click = event => {
|
|
109
|
+
this.headClicked(event, field, isFoot);
|
|
110
|
+
};
|
|
111
|
+
on.keydown = event => {
|
|
112
|
+
const keyCode = event.keyCode;
|
|
113
|
+
if (keyCode === CODE_ENTER || keyCode === CODE_SPACE) {
|
|
114
|
+
this.headClicked(event, field, isFoot);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const sortAttrs = isSortable ? this.sortTheadThAttrs(key, field, isFoot) : {};
|
|
119
|
+
const sortClass = isSortable ? this.sortTheadThClasses(key, field, isFoot) : null;
|
|
120
|
+
const sortLabel = isSortable ? this.sortTheadThLabel(key, field, isFoot) : null;
|
|
121
|
+
const data = {
|
|
122
|
+
class: [{
|
|
123
|
+
// We need to make the header cell relative when we have
|
|
124
|
+
// a `.gl-sr-only` sort label to work around overflow issues
|
|
125
|
+
'gl-relative': sortLabel
|
|
126
|
+
}, this.fieldClasses(field), sortClass],
|
|
127
|
+
props: {
|
|
128
|
+
variant,
|
|
129
|
+
stickyColumn
|
|
130
|
+
},
|
|
131
|
+
style: field.thStyle || {},
|
|
132
|
+
attrs: {
|
|
133
|
+
// We only add a `tabindex` of `0` if there is a head-clicked listener
|
|
134
|
+
// and the current field is sortable
|
|
135
|
+
tabindex: hasHeadClickListener && field.sortable ? '0' : null,
|
|
136
|
+
abbr: field.headerAbbr || null,
|
|
137
|
+
title: field.headerTitle || null,
|
|
138
|
+
'aria-colindex': colIndex + 1,
|
|
139
|
+
'aria-label': ariaLabel,
|
|
140
|
+
...this.getThValues(null, key, field.thAttr, isFoot ? 'foot' : 'head', {}),
|
|
141
|
+
...sortAttrs
|
|
142
|
+
},
|
|
143
|
+
on,
|
|
144
|
+
key
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Handle edge case where in-document templates are used with new
|
|
148
|
+
// `v-slot:name` syntax where the browser lower-cases the v-slot's
|
|
149
|
+
// name (attributes become lower cased when parsed by the browser)
|
|
150
|
+
// We have replaced the square bracket syntax with round brackets
|
|
151
|
+
// to prevent confusion with dynamic slot names
|
|
152
|
+
let slotNames = [getHeadSlotName(key), getHeadSlotName(key.toLowerCase()), getHeadSlotName()];
|
|
153
|
+
// Footer will fallback to header slot names
|
|
154
|
+
if (isFoot) {
|
|
155
|
+
slotNames = [getFootSlotName(key), getFootSlotName(key.toLowerCase()), getFootSlotName(), ...slotNames];
|
|
156
|
+
}
|
|
157
|
+
const scope = {
|
|
158
|
+
label,
|
|
159
|
+
column: key,
|
|
160
|
+
field,
|
|
161
|
+
isFoot,
|
|
162
|
+
// Add in row select methods
|
|
163
|
+
selectAllRows,
|
|
164
|
+
clearSelected
|
|
165
|
+
};
|
|
166
|
+
const $content = this.normalizeSlot(slotNames, scope) || h('div', {
|
|
167
|
+
domProps: htmlOrText(labelHtml, label)
|
|
168
|
+
});
|
|
169
|
+
const $srLabel = sortLabel ? h('span', {
|
|
170
|
+
staticClass: 'gl-sr-only'
|
|
171
|
+
}, ` (${sortLabel})`) : null;
|
|
172
|
+
|
|
173
|
+
// Return the header cell
|
|
174
|
+
return h(BTh, data, [$content, $srLabel].filter(identity));
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Generate the array of <th> cells
|
|
178
|
+
const $cells = fields.map(makeCell).filter(identity);
|
|
179
|
+
|
|
180
|
+
// Generate the row(s)
|
|
181
|
+
const $trs = [];
|
|
182
|
+
if (isFoot) {
|
|
183
|
+
$trs.push(h(BTr, {
|
|
184
|
+
class: this.tfootTrClass,
|
|
185
|
+
props: {
|
|
186
|
+
variant: isUndefinedOrNull(footRowVariant) ? headRowVariant : /* istanbul ignore next */footRowVariant
|
|
187
|
+
}
|
|
188
|
+
}, $cells));
|
|
189
|
+
} else {
|
|
190
|
+
const scope = {
|
|
191
|
+
columns: fields.length,
|
|
192
|
+
fields,
|
|
193
|
+
// Add in row select methods
|
|
194
|
+
selectAllRows,
|
|
195
|
+
clearSelected
|
|
196
|
+
};
|
|
197
|
+
$trs.push(this.normalizeSlot(SLOT_NAME_THEAD_TOP, scope) || h());
|
|
198
|
+
$trs.push(h(BTr, {
|
|
199
|
+
class: this.theadTrClass,
|
|
200
|
+
props: {
|
|
201
|
+
variant: headRowVariant
|
|
202
|
+
}
|
|
203
|
+
}, $cells));
|
|
204
|
+
}
|
|
205
|
+
return h(isFoot ? BTfoot : BThead, {
|
|
206
|
+
class: (isFoot ? this.tfootClass : this.theadClass) || null,
|
|
207
|
+
props: isFoot ? {
|
|
208
|
+
footVariant: footVariant || headVariant || null
|
|
209
|
+
} : {
|
|
210
|
+
headVariant: headVariant || null
|
|
211
|
+
},
|
|
212
|
+
key: isFoot ? 'bv-tfoot' : 'bv-thead'
|
|
213
|
+
}, $trs);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
export { props, theadMixin };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { extend } from '../../../vue';
|
|
2
|
+
import { SLOT_NAME_TOP_ROW } from '../../../constants/slots';
|
|
3
|
+
import { isFunction } from '../../../utils/inspect';
|
|
4
|
+
import { BTr } from '../tr';
|
|
5
|
+
|
|
6
|
+
// --- Props ---
|
|
7
|
+
|
|
8
|
+
const props = {};
|
|
9
|
+
|
|
10
|
+
// --- Mixin ---
|
|
11
|
+
|
|
12
|
+
// @vue/component
|
|
13
|
+
const topRowMixin = extend({
|
|
14
|
+
methods: {
|
|
15
|
+
renderTopRow() {
|
|
16
|
+
const {
|
|
17
|
+
computedFields: fields,
|
|
18
|
+
stacked,
|
|
19
|
+
tbodyTrClass,
|
|
20
|
+
tbodyTrAttr
|
|
21
|
+
} = this;
|
|
22
|
+
const h = this.$createElement;
|
|
23
|
+
|
|
24
|
+
// Add static Top Row slot (hidden in visibly stacked mode as we can't control the data-label)
|
|
25
|
+
// If in *always* stacked mode, we don't bother rendering the row
|
|
26
|
+
if (!this.hasNormalizedSlot(SLOT_NAME_TOP_ROW) || stacked === true || stacked === '') {
|
|
27
|
+
return h();
|
|
28
|
+
}
|
|
29
|
+
return h(BTr, {
|
|
30
|
+
staticClass: 'b-table-top-row',
|
|
31
|
+
class: [isFunction(tbodyTrClass) ? tbodyTrClass(null, 'row-top') : tbodyTrClass],
|
|
32
|
+
attrs: isFunction(tbodyTrAttr) ? tbodyTrAttr(null, 'row-top') : tbodyTrAttr,
|
|
33
|
+
key: 'b-top-row'
|
|
34
|
+
}, [this.normalizeSlot(SLOT_NAME_TOP_ROW, {
|
|
35
|
+
columns: fields.length,
|
|
36
|
+
fields
|
|
37
|
+
})]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export { props, topRowMixin };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { identity } from '../../../utils/identity';
|
|
2
|
+
import { isArray, isString, isObject, isFunction } from '../../../utils/inspect';
|
|
3
|
+
import { clone, keys } from '../../../utils/object';
|
|
4
|
+
import { startCase } from '../../../utils/string';
|
|
5
|
+
import { IGNORED_FIELD_KEYS } from './constants';
|
|
6
|
+
|
|
7
|
+
// Private function to massage field entry into common object format
|
|
8
|
+
const processField = (key, value) => {
|
|
9
|
+
let field = null;
|
|
10
|
+
if (isString(value)) {
|
|
11
|
+
// Label shortcut
|
|
12
|
+
field = {
|
|
13
|
+
key,
|
|
14
|
+
label: value
|
|
15
|
+
};
|
|
16
|
+
} else if (isFunction(value)) {
|
|
17
|
+
// Formatter shortcut
|
|
18
|
+
field = {
|
|
19
|
+
key,
|
|
20
|
+
formatter: value
|
|
21
|
+
};
|
|
22
|
+
} else if (isObject(value)) {
|
|
23
|
+
field = clone(value);
|
|
24
|
+
field.key = field.key || key;
|
|
25
|
+
} else if (value !== false) {
|
|
26
|
+
// Fallback to just key
|
|
27
|
+
/* istanbul ignore next */
|
|
28
|
+
field = {
|
|
29
|
+
key
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return field;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// We normalize fields into an array of objects
|
|
36
|
+
// [ { key:..., label:..., ...}, {...}, ..., {..}]
|
|
37
|
+
const normalizeFields = (origFields, items) => {
|
|
38
|
+
const fields = [];
|
|
39
|
+
if (isArray(origFields)) {
|
|
40
|
+
// Normalize array Form
|
|
41
|
+
origFields.filter(identity).forEach(f => {
|
|
42
|
+
if (isString(f)) {
|
|
43
|
+
fields.push({
|
|
44
|
+
key: f,
|
|
45
|
+
label: startCase(f)
|
|
46
|
+
});
|
|
47
|
+
} else if (isObject(f) && f.key && isString(f.key)) {
|
|
48
|
+
// Full object definition. We use assign so that we don't mutate the original
|
|
49
|
+
fields.push(clone(f));
|
|
50
|
+
} else if (isObject(f) && keys(f).length === 1) {
|
|
51
|
+
// Shortcut object (i.e. { 'foo_bar': 'This is Foo Bar' }
|
|
52
|
+
const key = keys(f)[0];
|
|
53
|
+
const field = processField(key, f[key]);
|
|
54
|
+
if (field) {
|
|
55
|
+
fields.push(field);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// If no field provided, take a sample from first record (if exits)
|
|
62
|
+
if (fields.length === 0 && isArray(items) && items.length > 0) {
|
|
63
|
+
const sample = items[0];
|
|
64
|
+
keys(sample).forEach(k => {
|
|
65
|
+
if (!IGNORED_FIELD_KEYS[k]) {
|
|
66
|
+
fields.push({
|
|
67
|
+
key: k,
|
|
68
|
+
label: startCase(k)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Ensure we have a unique array of fields and that they have String labels
|
|
75
|
+
const memo = {};
|
|
76
|
+
return fields.filter(f => {
|
|
77
|
+
if (!memo[f.key]) {
|
|
78
|
+
memo[f.key] = true;
|
|
79
|
+
f.label = isString(f.label) ? f.label : startCase(f.key);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export { normalizeFields };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { isFunction, isArray } from '../../../utils/inspect';
|
|
2
|
+
import { keys, clone, pick } from '../../../utils/object';
|
|
3
|
+
import { IGNORED_FIELD_KEYS } from './constants';
|
|
4
|
+
|
|
5
|
+
// Return a copy of a row after all reserved fields have been filtered out
|
|
6
|
+
const sanitizeRow = function (row, ignoreFields, includeFields) {
|
|
7
|
+
let fieldsObj = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
8
|
+
// We first need to format the row based on the field configurations
|
|
9
|
+
// This ensures that we add formatted values for keys that may not
|
|
10
|
+
// exist in the row itself
|
|
11
|
+
const formattedRow = keys(fieldsObj).reduce((result, key) => {
|
|
12
|
+
const field = fieldsObj[key];
|
|
13
|
+
const {
|
|
14
|
+
filterByFormatted
|
|
15
|
+
} = field;
|
|
16
|
+
const formatter = isFunction(filterByFormatted) ? /* istanbul ignore next */filterByFormatted : filterByFormatted ? /* istanbul ignore next */field.formatter : null;
|
|
17
|
+
if (isFunction(formatter)) {
|
|
18
|
+
result[key] = formatter(row[key], key, row);
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}, clone(row));
|
|
22
|
+
|
|
23
|
+
// Determine the allowed keys:
|
|
24
|
+
// - Ignore special fields that start with `_`
|
|
25
|
+
// - Ignore fields in the `ignoreFields` array
|
|
26
|
+
// - Include only fields in the `includeFields` array
|
|
27
|
+
const allowedKeys = keys(formattedRow).filter(key => !IGNORED_FIELD_KEYS[key] && !(isArray(ignoreFields) && ignoreFields.length > 0 && ignoreFields.includes(key)) && !(isArray(includeFields) && includeFields.length > 0 && !includeFields.includes(key)));
|
|
28
|
+
return pick(formattedRow, allowedKeys);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { sanitizeRow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isObject } from '../../../utils/inspect';
|
|
2
|
+
import { stringifyObjectValues } from '../../../utils/stringify-object-values';
|
|
3
|
+
import { sanitizeRow } from './sanitize-row';
|
|
4
|
+
|
|
5
|
+
// Stringifies the values of a record, ignoring any special top level field keys
|
|
6
|
+
// TODO: Add option to stringify `scopedSlot` items
|
|
7
|
+
const stringifyRecordValues = (row, ignoreFields, includeFields, fieldsObj) => {
|
|
8
|
+
return isObject(row) ? stringifyObjectValues(sanitizeRow(row, ignoreFields, includeFields, fieldsObj)) : /* istanbul ignore next */'';
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { stringifyRecordValues };
|